Skip to content

Commit

Permalink
Merge pull request #48 from atomicjolt/sc/slots-api
Browse files Browse the repository at this point in the history
Implement Slots API
  • Loading branch information
seanrcollings authored Dec 2, 2024
2 parents 39d5c8a + 9e257be commit cf6954d
Show file tree
Hide file tree
Showing 57 changed files with 2,029 additions and 2,824 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-chairs-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atomicjolt/atomic-elements": major
---

Migrated Table to new collections API
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { StorybookConfig } from "@storybook/react-vite";
const config: StorybookConfig = {
stories: [
"../packages/atomic-elements/**/*.stories.@(js|jsx|ts|tsx)",
"../packages/atomic-elements/src/**/*.mdx",
],

addons: [
Expand Down
140 changes: 76 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/atomic-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@react-aria/button": "^3.9.5",
"@react-aria/calendar": "^3.5.8",
"@react-aria/checkbox": "^3.14.3",
"@react-aria/collections": "^3.0.0-alpha.5",
"@react-aria/collections": "^3.0.0-alpha.6",
"@react-aria/combobox": "^3.9.1",
"@react-aria/datepicker": "^3.10.1",
"@react-aria/dialog": "^3.5.14",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@react-aria/utils": "^3.24.1",
"@react-aria/visually-hidden": "^3.8.12",
"@react-stately/flags": "^3.0.3",
"@react-stately/table": "^3.11.8",
"@react-stately/table": "^3.13.0",
"@react-stately/utils": "^3.10.1",
"classnames": "^2.3.1",
"react-stately": "^3.30.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { mergeProps, useObjectRef } from "@react-aria/utils";
import { SpinnerLoader } from "../../Loaders/SpinnerLoader";
import {
ExtendedSize,
HasIcon,
HasVariant,
LoadingProps,
RenderBaseProps,
Expand Down Expand Up @@ -53,7 +54,8 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
function Button(props, forwardedRef) {
[props, forwardedRef] = useContextPropsV2(
ButtonContext,
props,
// Button doesn't have Icon props, but the context does
props as ButtonProps & HasIcon,
forwardedRef
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ElementWrapperProps } from "../../../../types";
import { useContextPropsV2 } from "@hooks/useContextProps";
import { useRenderProps } from "@hooks";
import { InputContext } from "./Input.context";
import { SlotProps } from "@hooks/useSlottedContext";

const StyledInput = styled.input`
${mixins.Regular}
Expand All @@ -13,7 +14,11 @@ const StyledInput = styled.input`
`;

export interface InputProps
extends ElementWrapperProps<React.InputHTMLAttributes<HTMLInputElement>> {}
extends Omit<
ElementWrapperProps<React.InputHTMLAttributes<HTMLInputElement>>,
"slot"
>,
SlotProps {}

/** A wrapped `<input type="text" />` element */
export const Input = forwardRef(function Input(
Expand All @@ -30,5 +35,12 @@ export const Input = forwardRef(function Input(
style,
});

return <StyledInput ref={ref} {...renderProps} {...rest} />;
return (
<StyledInput
ref={ref}
{...renderProps}
{...rest}
slot={rest.slot || undefined}
/>
);
});
Loading

0 comments on commit cf6954d

Please sign in to comment.