@seed-design/react 1.1.17 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AspectRatio/AspectRatio.cjs +53 -0
- package/lib/components/AspectRatio/AspectRatio.d.ts +11 -0
- package/lib/components/AspectRatio/AspectRatio.d.ts.map +1 -0
- package/lib/components/AspectRatio/AspectRatio.js +30 -0
- package/lib/components/AspectRatio/index.cjs +9 -0
- package/lib/components/AspectRatio/index.d.ts +2 -0
- package/lib/components/AspectRatio/index.d.ts.map +1 -0
- package/lib/components/AspectRatio/index.js +1 -0
- package/lib/components/Avatar/Avatar.cjs +4 -10
- package/lib/components/Avatar/Avatar.d.ts +4 -4
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +4 -10
- package/lib/components/Checkbox/Checkbox.cjs +5 -0
- package/lib/components/Checkbox/Checkbox.d.ts +4 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +5 -1
- package/lib/components/Checkbox/Checkbox.namespace.cjs +1 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.namespace.js +1 -1
- package/lib/components/Checkbox/index.cjs +1 -0
- package/lib/components/Checkbox/index.d.ts +1 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Checkbox/index.js +1 -1
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Fieldset/Fieldset.cjs +86 -0
- package/lib/components/Fieldset/Fieldset.d.ts +30 -0
- package/lib/components/Fieldset/Fieldset.d.ts.map +1 -0
- package/lib/components/Fieldset/Fieldset.js +75 -0
- package/lib/components/Fieldset/Fieldset.namespace.cjs +16 -0
- package/lib/components/Fieldset/Fieldset.namespace.d.ts +2 -0
- package/lib/components/Fieldset/Fieldset.namespace.d.ts.map +1 -0
- package/lib/components/Fieldset/Fieldset.namespace.js +1 -0
- package/lib/components/Fieldset/index.cjs +18 -0
- package/lib/components/Fieldset/index.d.ts +3 -0
- package/lib/components/Fieldset/index.d.ts.map +1 -0
- package/lib/components/Fieldset/index.js +3 -0
- package/lib/components/Grid/Grid.cjs +56 -0
- package/lib/components/Grid/Grid.d.ts +41 -0
- package/lib/components/Grid/Grid.d.ts.map +1 -0
- package/lib/components/Grid/Grid.js +33 -0
- package/lib/components/Grid/index.cjs +9 -0
- package/lib/components/Grid/index.d.ts +2 -0
- package/lib/components/Grid/index.d.ts.map +1 -0
- package/lib/components/Grid/index.js +1 -0
- package/lib/components/GridItem/GridItem.cjs +45 -0
- package/lib/components/GridItem/GridItem.d.ts +35 -0
- package/lib/components/GridItem/GridItem.d.ts.map +1 -0
- package/lib/components/GridItem/GridItem.js +22 -0
- package/lib/components/GridItem/index.cjs +9 -0
- package/lib/components/GridItem/index.d.ts +2 -0
- package/lib/components/GridItem/index.d.ts.map +1 -0
- package/lib/components/GridItem/index.js +1 -0
- package/lib/components/HelpBubble/HelpBubble.cjs +5 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +3 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -1
- package/lib/components/HelpBubble/HelpBubble.js +5 -1
- package/lib/components/HelpBubble/HelpBubble.namespace.cjs +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +1 -1
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -1
- package/lib/components/HelpBubble/HelpBubble.namespace.js +1 -1
- package/lib/components/HelpBubble/index.cjs +1 -0
- package/lib/components/HelpBubble/index.d.ts +1 -1
- package/lib/components/HelpBubble/index.d.ts.map +1 -1
- package/lib/components/HelpBubble/index.js +1 -1
- package/lib/components/ImageFrame/ImageFrame.cjs +157 -0
- package/lib/components/ImageFrame/ImageFrame.d.ts +51 -0
- package/lib/components/ImageFrame/ImageFrame.d.ts.map +1 -0
- package/lib/components/ImageFrame/ImageFrame.js +129 -0
- package/lib/components/ImageFrame/index.cjs +14 -0
- package/lib/components/ImageFrame/index.d.ts +2 -0
- package/lib/components/ImageFrame/index.d.ts.map +1 -0
- package/lib/components/ImageFrame/index.js +1 -0
- package/lib/components/MenuSheet/MenuSheet.cjs +60 -24
- package/lib/components/MenuSheet/MenuSheet.d.ts +12 -0
- package/lib/components/MenuSheet/MenuSheet.d.ts.map +1 -1
- package/lib/components/MenuSheet/MenuSheet.js +57 -25
- package/lib/components/MenuSheet/MenuSheet.namespace.cjs +4 -0
- package/lib/components/MenuSheet/MenuSheet.namespace.d.ts +1 -1
- package/lib/components/MenuSheet/MenuSheet.namespace.d.ts.map +1 -1
- package/lib/components/MenuSheet/MenuSheet.namespace.js +1 -1
- package/lib/components/MenuSheet/index.cjs +4 -0
- package/lib/components/MenuSheet/index.d.ts +1 -1
- package/lib/components/MenuSheet/index.d.ts.map +1 -1
- package/lib/components/MenuSheet/index.js +1 -1
- package/lib/components/RadioGroup/RadioGroup.cjs +4 -1
- package/lib/components/RadioGroup/RadioGroup.d.ts +3 -2
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js +4 -1
- package/lib/components/RadioGroupField/RadioGroupField.cjs +79 -0
- package/lib/components/RadioGroupField/RadioGroupField.d.ts +30 -0
- package/lib/components/RadioGroupField/RadioGroupField.d.ts.map +1 -0
- package/lib/components/RadioGroupField/RadioGroupField.js +68 -0
- package/lib/components/RadioGroupField/RadioGroupField.namespace.cjs +16 -0
- package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts +2 -0
- package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts.map +1 -0
- package/lib/components/RadioGroupField/RadioGroupField.namespace.js +1 -0
- package/lib/components/RadioGroupField/index.cjs +18 -0
- package/lib/components/RadioGroupField/index.d.ts +3 -0
- package/lib/components/RadioGroupField/index.d.ts.map +1 -0
- package/lib/components/RadioGroupField/index.js +3 -0
- package/lib/components/SelectBox/CheckSelectBox.cjs +117 -8
- package/lib/components/SelectBox/CheckSelectBox.d.ts +38 -10
- package/lib/components/SelectBox/CheckSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/CheckSelectBox.js +113 -10
- package/lib/components/SelectBox/CheckSelectBox.namespace.cjs +6 -0
- package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts +1 -1
- package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts.map +1 -1
- package/lib/components/SelectBox/CheckSelectBox.namespace.js +1 -1
- package/lib/components/SelectBox/RadioSelectBox.cjs +112 -9
- package/lib/components/SelectBox/RadioSelectBox.d.ts +31 -7
- package/lib/components/SelectBox/RadioSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/RadioSelectBox.js +109 -10
- package/lib/components/SelectBox/RadioSelectBox.namespace.cjs +5 -1
- package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts +1 -1
- package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts.map +1 -1
- package/lib/components/SelectBox/RadioSelectBox.namespace.js +1 -1
- package/lib/components/SelectBox/index.cjs +11 -1
- package/lib/components/SelectBox/index.d.ts +2 -2
- package/lib/components/SelectBox/index.d.ts.map +1 -1
- package/lib/components/SelectBox/index.js +2 -2
- package/lib/components/Switch/Switch.cjs +5 -5
- package/lib/components/Switch/Switch.d.ts +3 -3
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +5 -5
- package/lib/components/TagGroup/TagGroup.cjs +25 -9
- package/lib/components/TagGroup/TagGroup.d.ts +5 -1
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.js +25 -10
- package/lib/components/TagGroup/TagGroup.namespace.cjs +1 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +1 -1
- package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.namespace.js +1 -1
- package/lib/components/TagGroup/index.cjs +1 -0
- package/lib/components/TagGroup/index.d.ts +1 -1
- package/lib/components/TagGroup/index.d.ts.map +1 -1
- package/lib/components/TagGroup/index.js +1 -1
- package/lib/components/index.cjs +53 -1
- package/lib/components/index.d.ts +6 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +16 -6
- package/lib/index.cjs +53 -1
- package/lib/index.js +16 -6
- package/lib/utils/styled.cjs +6 -0
- package/lib/utils/styled.d.ts +6 -0
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +6 -0
- package/package.json +5 -2
- package/src/components/AspectRatio/AspectRatio.tsx +38 -0
- package/src/components/AspectRatio/index.ts +1 -0
- package/src/components/Avatar/Avatar.tsx +7 -14
- package/src/components/Checkbox/Checkbox.namespace.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +15 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Dialog/Dialog.tsx +6 -0
- package/src/components/Fieldset/Fieldset.namespace.ts +17 -0
- package/src/components/Fieldset/Fieldset.tsx +101 -0
- package/src/components/Fieldset/index.ts +19 -0
- package/src/components/Grid/Grid.tsx +79 -0
- package/src/components/Grid/index.ts +1 -0
- package/src/components/GridItem/GridItem.tsx +70 -0
- package/src/components/GridItem/index.ts +1 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +3 -0
- package/src/components/HelpBubble/HelpBubble.tsx +7 -2
- package/src/components/HelpBubble/index.ts +2 -0
- package/src/components/ImageFrame/ImageFrame.tsx +227 -0
- package/src/components/ImageFrame/index.ts +14 -0
- package/src/components/MenuSheet/MenuSheet.namespace.ts +8 -0
- package/src/components/MenuSheet/MenuSheet.tsx +82 -34
- package/src/components/MenuSheet/index.ts +8 -0
- package/src/components/RadioGroup/RadioGroup.tsx +8 -2
- package/src/components/RadioGroupField/RadioGroupField.namespace.ts +18 -0
- package/src/components/RadioGroupField/RadioGroupField.tsx +114 -0
- package/src/components/RadioGroupField/index.ts +2 -0
- package/src/components/SelectBox/CheckSelectBox.namespace.ts +12 -0
- package/src/components/SelectBox/CheckSelectBox.tsx +229 -24
- package/src/components/SelectBox/RadioSelectBox.namespace.ts +10 -2
- package/src/components/SelectBox/RadioSelectBox.tsx +210 -16
- package/src/components/SelectBox/index.ts +22 -2
- package/src/components/Switch/Switch.tsx +7 -7
- package/src/components/TagGroup/TagGroup.namespace.ts +2 -0
- package/src/components/TagGroup/TagGroup.tsx +33 -9
- package/src/components/TagGroup/index.ts +2 -0
- package/src/components/index.ts +6 -0
- package/src/utils/styled.tsx +18 -0
|
@@ -1,29 +1,153 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
2
|
+
import { selectBox, type SelectBoxVariantProps } from "@seed-design/css/recipes/select-box";
|
|
3
|
+
import {
|
|
4
|
+
selectBoxGroup,
|
|
5
|
+
type SelectBoxGroupVariantProps,
|
|
6
|
+
} from "@seed-design/css/recipes/select-box-group";
|
|
7
|
+
import {
|
|
8
|
+
Collapsible,
|
|
9
|
+
CollapsibleProvider,
|
|
10
|
+
useCollapsible,
|
|
11
|
+
useCollapsibleContext,
|
|
12
|
+
} from "@seed-design/react-collapsible";
|
|
3
13
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
14
|
import {
|
|
5
15
|
RadioGroup as RadioGroupPrimitive,
|
|
6
16
|
useRadioGroupItemContext,
|
|
7
17
|
} from "@seed-design/react-radio-group";
|
|
8
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
createContext,
|
|
20
|
+
forwardRef,
|
|
21
|
+
useCallback,
|
|
22
|
+
useContext,
|
|
23
|
+
useState,
|
|
24
|
+
type PropsWithChildren,
|
|
25
|
+
} from "react";
|
|
9
26
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
10
27
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
28
|
+
import clsx from "clsx";
|
|
29
|
+
|
|
30
|
+
const { PropsProvider, ClassNamesProvider, withContext, useProps, useClassNames } =
|
|
31
|
+
createSlotRecipeContext(selectBox);
|
|
11
32
|
|
|
12
|
-
const { withContext: withGroupContext } = createRecipeContext(selectBoxGroup);
|
|
13
|
-
const { withContext, withProvider } = createSlotRecipeContext(selectBox);
|
|
14
33
|
const withStateProps = createWithStateProps([useRadioGroupItemContext]);
|
|
15
34
|
|
|
16
|
-
|
|
35
|
+
const FooterContext = createContext<{
|
|
36
|
+
isFooterRendered: boolean;
|
|
37
|
+
footerRef: (node: HTMLDivElement | null) => void;
|
|
38
|
+
footerVisibility: Exclude<NonNullable<RadioSelectBoxItemProps["footerVisibility"]>, "always">;
|
|
39
|
+
} | null>(null);
|
|
40
|
+
|
|
41
|
+
export interface RadioSelectBoxGroupProps
|
|
42
|
+
extends SelectBoxGroupVariantProps,
|
|
43
|
+
PrimitiveProps,
|
|
44
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
45
|
+
/**
|
|
46
|
+
* Number of columns in the grid layout. When bigger than 1, child `RadioSelectBoxItem` will have a default layout of "vertical".
|
|
47
|
+
* @default 1
|
|
48
|
+
*/
|
|
49
|
+
columns?: number;
|
|
50
|
+
}
|
|
17
51
|
|
|
18
|
-
export const
|
|
19
|
-
|
|
52
|
+
export const RadioSelectBoxGroup = forwardRef<HTMLDivElement, RadioSelectBoxGroupProps>(
|
|
53
|
+
({ columns = 1, className, style, ...props }, ref) => {
|
|
54
|
+
const [variantProps, otherProps] = selectBoxGroup.splitVariantProps(props);
|
|
55
|
+
const recipeClassName = selectBoxGroup(variantProps);
|
|
56
|
+
const layout = columns === 1 ? "horizontal" : "vertical";
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<PropsProvider value={{ layout }}>
|
|
60
|
+
<Primitive.div
|
|
61
|
+
ref={ref}
|
|
62
|
+
data-columns={columns}
|
|
63
|
+
className={clsx(recipeClassName, className)}
|
|
64
|
+
style={
|
|
65
|
+
{
|
|
66
|
+
...style,
|
|
67
|
+
"--seed-select-box-group--columns": columns,
|
|
68
|
+
} as React.CSSProperties
|
|
69
|
+
}
|
|
70
|
+
{...otherProps}
|
|
71
|
+
/>
|
|
72
|
+
</PropsProvider>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
20
75
|
);
|
|
21
76
|
|
|
22
|
-
|
|
77
|
+
function FooterVisibilityProvider({
|
|
78
|
+
children,
|
|
79
|
+
footerVisibility,
|
|
80
|
+
}: PropsWithChildren<{
|
|
81
|
+
footerVisibility: Exclude<NonNullable<RadioSelectBoxItemProps["footerVisibility"]>, "always">;
|
|
82
|
+
}>) {
|
|
83
|
+
const { checked } = useRadioGroupItemContext();
|
|
84
|
+
|
|
85
|
+
const collapsible = useCollapsible({
|
|
86
|
+
open: {
|
|
87
|
+
"when-selected": checked,
|
|
88
|
+
"when-not-selected": !checked,
|
|
89
|
+
}[footerVisibility],
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const [isFooterRendered, setIsFooterRendered] = useState(false);
|
|
93
|
+
const footerRef = useCallback((node: HTMLDivElement | null) => {
|
|
94
|
+
setIsFooterRendered(!!node);
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<CollapsibleProvider value={collapsible}>
|
|
99
|
+
<FooterContext.Provider value={{ isFooterRendered, footerRef, footerVisibility }}>
|
|
100
|
+
{children}
|
|
101
|
+
</FooterContext.Provider>
|
|
102
|
+
</CollapsibleProvider>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface RadioSelectBoxItemProps
|
|
107
|
+
extends SelectBoxVariantProps,
|
|
108
|
+
RadioGroupPrimitive.ItemProps {
|
|
109
|
+
/**
|
|
110
|
+
* Controls when the footer is visible.
|
|
111
|
+
* @default "when-selected"
|
|
112
|
+
*/
|
|
113
|
+
footerVisibility?: "when-selected" | "when-not-selected" | "always";
|
|
114
|
+
}
|
|
23
115
|
|
|
24
|
-
export const RadioSelectBoxItem =
|
|
25
|
-
|
|
26
|
-
|
|
116
|
+
export const RadioSelectBoxItem = forwardRef<HTMLLabelElement, RadioSelectBoxItemProps>(
|
|
117
|
+
({ footerVisibility = "when-selected", className, children, ...props }, ref) => {
|
|
118
|
+
const [variantProps, otherProps] = selectBox.splitVariantProps(props);
|
|
119
|
+
const classNames = selectBox({
|
|
120
|
+
...useProps(),
|
|
121
|
+
...variantProps,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<ClassNamesProvider value={classNames}>
|
|
126
|
+
<RadioGroupPrimitive.Item
|
|
127
|
+
ref={ref}
|
|
128
|
+
className={clsx(classNames.root, className)}
|
|
129
|
+
{...otherProps}
|
|
130
|
+
>
|
|
131
|
+
{footerVisibility === "always" ? (
|
|
132
|
+
children
|
|
133
|
+
) : (
|
|
134
|
+
<FooterVisibilityProvider footerVisibility={footerVisibility}>
|
|
135
|
+
{children}
|
|
136
|
+
</FooterVisibilityProvider>
|
|
137
|
+
)}
|
|
138
|
+
</RadioGroupPrimitive.Item>
|
|
139
|
+
</ClassNamesProvider>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
export interface RadioSelectBoxTriggerProps
|
|
145
|
+
extends PrimitiveProps,
|
|
146
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
147
|
+
|
|
148
|
+
export const RadioSelectBoxTrigger = withContext<HTMLDivElement, RadioSelectBoxTriggerProps>(
|
|
149
|
+
withStateProps(Primitive.div),
|
|
150
|
+
"trigger",
|
|
27
151
|
);
|
|
28
152
|
|
|
29
153
|
export interface RadioSelectBoxContentProps
|
|
@@ -35,20 +159,90 @@ export const RadioSelectBoxContent = withContext<HTMLDivElement, RadioSelectBoxC
|
|
|
35
159
|
"content",
|
|
36
160
|
);
|
|
37
161
|
|
|
162
|
+
export interface RadioSelectBoxBodyProps
|
|
163
|
+
extends PrimitiveProps,
|
|
164
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
165
|
+
|
|
166
|
+
export const RadioSelectBoxBody = withContext<HTMLDivElement, RadioSelectBoxBodyProps>(
|
|
167
|
+
withStateProps(Primitive.div),
|
|
168
|
+
"body",
|
|
169
|
+
);
|
|
170
|
+
|
|
38
171
|
export interface RadioSelectBoxLabelProps
|
|
39
172
|
extends PrimitiveProps,
|
|
40
|
-
React.HTMLAttributes<
|
|
173
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
41
174
|
|
|
42
|
-
export const RadioSelectBoxLabel = withContext<
|
|
175
|
+
export const RadioSelectBoxLabel = withContext<HTMLDivElement, RadioSelectBoxLabelProps>(
|
|
43
176
|
withStateProps(Primitive.div),
|
|
44
177
|
"label",
|
|
45
178
|
);
|
|
46
179
|
|
|
47
180
|
export interface RadioSelectBoxDescriptionProps
|
|
48
181
|
extends PrimitiveProps,
|
|
49
|
-
React.HTMLAttributes<
|
|
182
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
50
183
|
|
|
51
184
|
export const RadioSelectBoxDescription = withContext<
|
|
52
|
-
|
|
185
|
+
HTMLDivElement,
|
|
53
186
|
RadioSelectBoxDescriptionProps
|
|
54
187
|
>(withStateProps(Primitive.div), "description");
|
|
188
|
+
|
|
189
|
+
export interface RadioSelectBoxHiddenInputProps extends RadioGroupPrimitive.ItemHiddenInputProps {}
|
|
190
|
+
|
|
191
|
+
export const RadioSelectBoxHiddenInput = forwardRef<
|
|
192
|
+
HTMLInputElement,
|
|
193
|
+
RadioSelectBoxHiddenInputProps
|
|
194
|
+
>((props, ref) => {
|
|
195
|
+
// when footerVisibility !== "when-selected", this context is automatically unavailable since it's not wrapped in CollapsibleProvider
|
|
196
|
+
|
|
197
|
+
// NOTE: aria-expanded on role="radio" is not officially supported. See: https://github.com/w3c/aria/issues/1404
|
|
198
|
+
// but it helps some screen readers to announce the expanded/collapsed state of the footer.
|
|
199
|
+
// gov.uk applies aria-expanded on the radio input as well. See: https://design-system.service.gov.uk/components/radios/#conditionally-revealing-a-related-question
|
|
200
|
+
const collapsibleContext = useCollapsibleContext({ strict: false });
|
|
201
|
+
const footerContext = useContext(FooterContext);
|
|
202
|
+
|
|
203
|
+
const triggerAriaProps = footerContext?.isFooterRendered
|
|
204
|
+
? collapsibleContext?.triggerAriaProps
|
|
205
|
+
: undefined;
|
|
206
|
+
|
|
207
|
+
return <RadioGroupPrimitive.ItemHiddenInput ref={ref} {...triggerAriaProps} {...props} />;
|
|
208
|
+
});
|
|
209
|
+
RadioSelectBoxHiddenInput.displayName = "RadioSelectBoxHiddenInput";
|
|
210
|
+
|
|
211
|
+
export interface RadioSelectBoxFooterProps
|
|
212
|
+
extends PrimitiveProps,
|
|
213
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
214
|
+
|
|
215
|
+
export const RadioSelectBoxFooter = forwardRef<HTMLDivElement, RadioSelectBoxFooterProps>(
|
|
216
|
+
({ className, children, ...props }, ref) => {
|
|
217
|
+
const classNames = useClassNames();
|
|
218
|
+
const { stateProps } = useRadioGroupItemContext();
|
|
219
|
+
const collapsibleContext = useCollapsibleContext({ strict: false });
|
|
220
|
+
const footerContext = useContext(FooterContext);
|
|
221
|
+
const composedRef = composeRefs(ref, footerContext?.footerRef ?? null);
|
|
222
|
+
|
|
223
|
+
if (collapsibleContext) {
|
|
224
|
+
return (
|
|
225
|
+
<Collapsible.Content
|
|
226
|
+
ref={composedRef}
|
|
227
|
+
className={clsx(classNames.footer, className)}
|
|
228
|
+
{...stateProps}
|
|
229
|
+
{...props}
|
|
230
|
+
>
|
|
231
|
+
{children}
|
|
232
|
+
</Collapsible.Content>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<Primitive.div
|
|
238
|
+
ref={composedRef}
|
|
239
|
+
className={clsx(classNames.footer, className)}
|
|
240
|
+
{...stateProps}
|
|
241
|
+
{...props}
|
|
242
|
+
>
|
|
243
|
+
{children}
|
|
244
|
+
</Primitive.div>
|
|
245
|
+
);
|
|
246
|
+
},
|
|
247
|
+
);
|
|
248
|
+
RadioSelectBoxFooter.displayName = "RadioSelectBoxFooter";
|
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
export {
|
|
2
|
+
CheckSelectBoxBody,
|
|
3
|
+
CheckSelectBoxCheckmarkControl,
|
|
4
|
+
CheckSelectBoxCheckmarkIcon,
|
|
2
5
|
CheckSelectBoxContent,
|
|
3
6
|
CheckSelectBoxDescription,
|
|
7
|
+
CheckSelectBoxFooter,
|
|
4
8
|
CheckSelectBoxGroup,
|
|
9
|
+
CheckSelectBoxHiddenInput,
|
|
5
10
|
CheckSelectBoxLabel,
|
|
6
11
|
CheckSelectBoxRoot,
|
|
12
|
+
CheckSelectBoxTrigger,
|
|
13
|
+
type CheckSelectBoxBodyProps,
|
|
14
|
+
type CheckSelectBoxCheckmarkControlProps,
|
|
15
|
+
type CheckSelectBoxCheckmarkIconProps,
|
|
7
16
|
type CheckSelectBoxContentProps,
|
|
8
17
|
type CheckSelectBoxDescriptionProps,
|
|
18
|
+
type CheckSelectBoxFooterProps,
|
|
9
19
|
type CheckSelectBoxGroupProps,
|
|
20
|
+
type CheckSelectBoxHiddenInputProps,
|
|
10
21
|
type CheckSelectBoxLabelProps,
|
|
11
22
|
type CheckSelectBoxRootProps,
|
|
23
|
+
type CheckSelectBoxTriggerProps,
|
|
12
24
|
} from "./CheckSelectBox";
|
|
13
25
|
|
|
14
26
|
export {
|
|
27
|
+
RadioSelectBoxBody,
|
|
15
28
|
RadioSelectBoxContent,
|
|
16
29
|
RadioSelectBoxDescription,
|
|
30
|
+
RadioSelectBoxFooter,
|
|
31
|
+
RadioSelectBoxGroup,
|
|
32
|
+
RadioSelectBoxHiddenInput,
|
|
17
33
|
RadioSelectBoxItem,
|
|
18
34
|
RadioSelectBoxLabel,
|
|
19
|
-
|
|
35
|
+
RadioSelectBoxTrigger,
|
|
36
|
+
type RadioSelectBoxBodyProps,
|
|
20
37
|
type RadioSelectBoxContentProps,
|
|
21
38
|
type RadioSelectBoxDescriptionProps,
|
|
39
|
+
type RadioSelectBoxFooterProps,
|
|
40
|
+
type RadioSelectBoxGroupProps,
|
|
41
|
+
type RadioSelectBoxHiddenInputProps,
|
|
22
42
|
type RadioSelectBoxItemProps,
|
|
23
43
|
type RadioSelectBoxLabelProps,
|
|
24
|
-
type
|
|
44
|
+
type RadioSelectBoxTriggerProps,
|
|
25
45
|
} from "./RadioSelectBox";
|
|
26
46
|
|
|
27
47
|
export * as CheckSelectBox from "./CheckSelectBox.namespace";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Switch as SwitchPrimitive, useSwitchContext } from "@seed-design/react-switch";
|
|
2
2
|
import { switchStyle, type SwitchVariantProps } from "@seed-design/css/recipes/switch";
|
|
3
|
-
import {
|
|
3
|
+
import { switchmark, type SwitchmarkVariantProps } from "@seed-design/css/recipes/switchmark";
|
|
4
4
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
5
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
6
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
withContext: withControlContext,
|
|
14
14
|
PropsProvider: ControlPropsProvider,
|
|
15
15
|
withProvider: withControlProvider,
|
|
16
|
-
} = createSlotRecipeContext(
|
|
16
|
+
} = createSlotRecipeContext(switchmark);
|
|
17
17
|
const withStateProps = createWithStateProps([useSwitchContext]);
|
|
18
18
|
|
|
19
19
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -25,7 +25,7 @@ type SwitchVariantDeprecatedSizeProps = "small" | "medium";
|
|
|
25
25
|
|
|
26
26
|
export interface SwitchRootProps
|
|
27
27
|
extends Omit<SwitchVariantProps, "size">,
|
|
28
|
-
Omit<
|
|
28
|
+
Omit<SwitchmarkVariantProps, "size">,
|
|
29
29
|
SwitchPrimitive.RootProps {
|
|
30
30
|
size?: SwitchVariantProps["size"] | SwitchVariantDeprecatedSizeProps;
|
|
31
31
|
}
|
|
@@ -41,20 +41,20 @@ export const SwitchRoot = React.forwardRef<HTMLLabelElement, SwitchRootProps>(
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const [{ switch: switchVariantProps,
|
|
44
|
+
const [{ switch: switchVariantProps, switchmark: switchmarkVariantProps }, otherProps] =
|
|
45
45
|
splitMultipleVariantsProps(
|
|
46
46
|
{
|
|
47
47
|
...props,
|
|
48
48
|
// TODO: replace this mapping completely
|
|
49
49
|
size: props.size === "small" ? "16" : props.size === "medium" ? "32" : props.size,
|
|
50
50
|
},
|
|
51
|
-
{
|
|
51
|
+
{ switchmark, switch: switchStyle },
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
const classNames = switchStyle(switchVariantProps);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<ControlPropsProvider value={
|
|
57
|
+
<ControlPropsProvider value={switchmarkVariantProps}>
|
|
58
58
|
<ClassNamesProvider value={classNames}>
|
|
59
59
|
<SwitchPrimitive.Root
|
|
60
60
|
ref={ref}
|
|
@@ -70,7 +70,7 @@ SwitchRoot.displayName = "SwitchRoot";
|
|
|
70
70
|
|
|
71
71
|
////////////////////////////////////////////////////////////////////////////////////
|
|
72
72
|
|
|
73
|
-
export interface SwitchControlProps extends
|
|
73
|
+
export interface SwitchControlProps extends SwitchmarkVariantProps, SwitchPrimitive.ControlProps {}
|
|
74
74
|
|
|
75
75
|
export const SwitchControl = withControlProvider<HTMLDivElement, SwitchControlProps>(
|
|
76
76
|
SwitchPrimitive.Control,
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
tagGroupItem,
|
|
5
5
|
type TagGroupItemVariantProps,
|
|
6
6
|
} from "@seed-design/css/recipes/tag-group-item";
|
|
7
|
-
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
8
7
|
import { forwardRef, Children, Fragment } from "react";
|
|
9
8
|
import clsx from "clsx";
|
|
10
9
|
import { splitMultipleVariantsProps } from "../../utils/splitMultipleVariantsProps";
|
|
11
|
-
import {
|
|
10
|
+
import { useStyleProps, type StyleProps } from "../../utils/styled";
|
|
11
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
12
12
|
|
|
13
|
-
const { PropsProvider, useProps } =
|
|
13
|
+
const { PropsProvider, useProps, withContext, ClassNamesProvider } =
|
|
14
|
+
createSlotRecipeContext(tagGroupItem);
|
|
14
15
|
|
|
15
16
|
export interface TagGroupRootProps
|
|
16
17
|
extends TagGroupVariantProps,
|
|
@@ -50,14 +51,37 @@ export const TagGroupRoot = forwardRef<HTMLSpanElement, TagGroupRootProps>(
|
|
|
50
51
|
|
|
51
52
|
export interface TagGroupItemProps
|
|
52
53
|
extends TagGroupItemVariantProps,
|
|
54
|
+
Pick<StyleProps, "flexShrink">,
|
|
53
55
|
PrimitiveProps,
|
|
54
56
|
React.HTMLAttributes<HTMLSpanElement> {}
|
|
55
57
|
|
|
56
|
-
export const TagGroupItem = forwardRef<HTMLSpanElement, TagGroupItemProps>(
|
|
57
|
-
|
|
58
|
+
export const TagGroupItem = forwardRef<HTMLSpanElement, TagGroupItemProps>(
|
|
59
|
+
({ className, ...props }, ref) => {
|
|
60
|
+
const parentVariantProps = useProps();
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
const [variantProps, otherProps] = tagGroupItem.splitVariantProps(props);
|
|
63
|
+
const classNames = tagGroupItem({ ...parentVariantProps, ...variantProps });
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
const { style, restProps } = useStyleProps(otherProps);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<ClassNamesProvider value={classNames}>
|
|
69
|
+
<Primitive.span
|
|
70
|
+
ref={ref}
|
|
71
|
+
style={style}
|
|
72
|
+
className={clsx(classNames.root, className)}
|
|
73
|
+
{...restProps}
|
|
74
|
+
/>
|
|
75
|
+
</ClassNamesProvider>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export interface TagGroupItemLabelProps
|
|
81
|
+
extends PrimitiveProps,
|
|
82
|
+
React.HTMLAttributes<HTMLSpanElement> {}
|
|
83
|
+
|
|
84
|
+
export const TagGroupItemLabel = withContext<HTMLSpanElement, TagGroupItemLabelProps>(
|
|
85
|
+
Primitive.span,
|
|
86
|
+
"label",
|
|
87
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./ActionButton";
|
|
|
2
2
|
export * from "./ActionChip";
|
|
3
3
|
export * from "./ActionSheet";
|
|
4
4
|
export * from "./Article";
|
|
5
|
+
export * from "./AspectRatio";
|
|
5
6
|
export * from "./Avatar";
|
|
6
7
|
export * from "./Badge";
|
|
7
8
|
export * from "./BottomSheet";
|
|
@@ -23,12 +24,16 @@ export * from "./ExtendedFab";
|
|
|
23
24
|
export * from "./Fab";
|
|
24
25
|
export * from "./Field";
|
|
25
26
|
export * from "./FieldButton";
|
|
27
|
+
export * from "./Fieldset";
|
|
26
28
|
export * from "./Flex";
|
|
27
29
|
export * from "./Float";
|
|
28
30
|
export * from "./FloatingActionButton";
|
|
31
|
+
export * from "./Grid";
|
|
32
|
+
export * from "./GridItem";
|
|
29
33
|
export * from "./HelpBubble";
|
|
30
34
|
export * from "./Icon";
|
|
31
35
|
export * from "./IdentityPlaceholder";
|
|
36
|
+
export * from "./ImageFrame";
|
|
32
37
|
export * from "./Inline";
|
|
33
38
|
export * from "./InlineBanner";
|
|
34
39
|
export * from "./LinkContent";
|
|
@@ -43,6 +48,7 @@ export * from "./Portal";
|
|
|
43
48
|
export * from "./ProgressCircle";
|
|
44
49
|
export * from "./PullToRefresh";
|
|
45
50
|
export * from "./RadioGroup";
|
|
51
|
+
export * from "./RadioGroupField";
|
|
46
52
|
export * from "./ReactionButton";
|
|
47
53
|
export * from "./ResponsivePair";
|
|
48
54
|
export * from "./ScrollFog";
|
package/src/utils/styled.tsx
CHANGED
|
@@ -471,6 +471,11 @@ export interface StyleProps {
|
|
|
471
471
|
| "spaceBetween" // @deprecated Use `space-between` instead.
|
|
472
472
|
| "spaceAround"; // @deprecated Use `space-around` instead.
|
|
473
473
|
|
|
474
|
+
/**
|
|
475
|
+
* In flexbox layout, this property is ignored.
|
|
476
|
+
*/
|
|
477
|
+
justifySelf?: "center" | "start" | "end" | "stretch";
|
|
478
|
+
|
|
474
479
|
alignItems?:
|
|
475
480
|
| "flex-start"
|
|
476
481
|
| "flex-end"
|
|
@@ -497,6 +502,13 @@ export interface StyleProps {
|
|
|
497
502
|
|
|
498
503
|
gap?: Dimension | `spacingX.${SpacingX}` | `spacingY.${SpacingY}` | 0 | (string & {});
|
|
499
504
|
|
|
505
|
+
// Grid Item
|
|
506
|
+
// NOTE: gridArea는 지원하지 않습니다.
|
|
507
|
+
// grid-area가 grid-column/row의 shorthand이므로 CSS 변수로 동시에 바인딩하면 충돌합니다.
|
|
508
|
+
gridColumn?: string;
|
|
509
|
+
|
|
510
|
+
gridRow?: string;
|
|
511
|
+
|
|
500
512
|
// NOTE: Not sure how to treat transform/translate right now, mark as unstable until we have a better solution.
|
|
501
513
|
unstable_transform?: string;
|
|
502
514
|
|
|
@@ -577,10 +589,13 @@ export function useStyleProps<T extends UseStyleProps>(
|
|
|
577
589
|
flexDirection,
|
|
578
590
|
flexWrap,
|
|
579
591
|
justifyContent,
|
|
592
|
+
justifySelf,
|
|
580
593
|
alignItems,
|
|
581
594
|
alignContent,
|
|
582
595
|
alignSelf,
|
|
583
596
|
gap,
|
|
597
|
+
gridColumn,
|
|
598
|
+
gridRow,
|
|
584
599
|
unstable_transform,
|
|
585
600
|
_active,
|
|
586
601
|
style,
|
|
@@ -644,9 +659,12 @@ export function useStyleProps<T extends UseStyleProps>(
|
|
|
644
659
|
"--seed-box-flex-direction": handleFlexDirection(flexDirection),
|
|
645
660
|
"--seed-box-flex-wrap": flexWrap === true ? "wrap" : flexWrap,
|
|
646
661
|
"--seed-box-justify-content": handleJustifyContent(justifyContent),
|
|
662
|
+
"--seed-box-justify-self": justifySelf,
|
|
647
663
|
"--seed-box-align-items": handleAlignItems(alignItems),
|
|
648
664
|
"--seed-box-align-content": handleAlignItems(alignContent),
|
|
649
665
|
"--seed-box-align-self": handleAlignItems(alignSelf),
|
|
666
|
+
"--seed-box-grid-column": gridColumn,
|
|
667
|
+
"--seed-box-grid-row": gridRow,
|
|
650
668
|
"--seed-box-unstable-transform": unstable_transform,
|
|
651
669
|
|
|
652
670
|
// Active
|