@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { field, type FieldVariantProps } from "@seed-design/css/recipes/field";
|
|
4
|
+
import { fieldLabel, type FieldLabelVariantProps } from "@seed-design/css/recipes/field-label";
|
|
5
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
|
+
import { RadioGroup as RadioGroupPrimitive } from "@seed-design/react-radio-group";
|
|
7
|
+
import type * as React from "react";
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
11
|
+
import { InternalIcon } from "../private/Icon";
|
|
12
|
+
|
|
13
|
+
const { withProvider, withContext } = createSlotRecipeContext(field);
|
|
14
|
+
const {
|
|
15
|
+
withContext: withLabelContext,
|
|
16
|
+
withProvider: withLabelProvider,
|
|
17
|
+
useClassNames: useLabelClassNames,
|
|
18
|
+
} = createSlotRecipeContext(fieldLabel);
|
|
19
|
+
|
|
20
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
|
|
22
|
+
export interface RadioGroupFieldRootProps
|
|
23
|
+
extends FieldVariantProps,
|
|
24
|
+
RadioGroupPrimitive.RootProps {}
|
|
25
|
+
|
|
26
|
+
export const RadioGroupFieldRoot = withProvider<HTMLDivElement, RadioGroupFieldRootProps>(
|
|
27
|
+
RadioGroupPrimitive.Root,
|
|
28
|
+
"root",
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
32
|
+
|
|
33
|
+
export interface RadioGroupFieldHeaderProps
|
|
34
|
+
extends PrimitiveProps,
|
|
35
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
36
|
+
|
|
37
|
+
export const RadioGroupFieldHeader = withContext<HTMLDivElement, RadioGroupFieldHeaderProps>(
|
|
38
|
+
Primitive.div,
|
|
39
|
+
"header",
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export interface RadioGroupFieldLabelProps
|
|
43
|
+
extends FieldLabelVariantProps,
|
|
44
|
+
RadioGroupPrimitive.LabelProps {}
|
|
45
|
+
|
|
46
|
+
export const RadioGroupFieldLabel = withLabelProvider<HTMLDivElement, RadioGroupFieldLabelProps>(
|
|
47
|
+
RadioGroupPrimitive.Label,
|
|
48
|
+
"root",
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export interface RadioGroupFieldIndicatorTextProps
|
|
52
|
+
extends PrimitiveProps,
|
|
53
|
+
React.HTMLAttributes<HTMLSpanElement> {}
|
|
54
|
+
|
|
55
|
+
export const RadioGroupFieldIndicatorText = withLabelContext<
|
|
56
|
+
HTMLSpanElement,
|
|
57
|
+
RadioGroupFieldIndicatorTextProps
|
|
58
|
+
>(Primitive.span, "indicatorText");
|
|
59
|
+
|
|
60
|
+
export interface RadioGroupFieldRequiredIndicatorProps extends React.SVGProps<SVGElement> {}
|
|
61
|
+
|
|
62
|
+
export const RadioGroupFieldRequiredIndicator = forwardRef<
|
|
63
|
+
SVGSVGElement,
|
|
64
|
+
RadioGroupFieldRequiredIndicatorProps
|
|
65
|
+
>(({ className, ...props }, ref) => {
|
|
66
|
+
const { indicatorIcon } = useLabelClassNames();
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<InternalIcon
|
|
70
|
+
svg={
|
|
71
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: InternalIcon is aria-hidden
|
|
72
|
+
<svg
|
|
73
|
+
viewBox="0 0 6 6"
|
|
74
|
+
fill="none"
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
className={clsx(indicatorIcon, className)}
|
|
77
|
+
>
|
|
78
|
+
<path
|
|
79
|
+
d="M3.75002 1.55859L4.41318 1.09468C4.75243 0.857361 5.21982 0.939865 5.45732 1.27899C5.69499 1.61836 5.61243 2.08615 5.27295 2.32366L4.30763 2.99902L5.27372 3.67612C5.61285 3.91381 5.69517 4.38137 5.45761 4.72059C5.21999 5.0599 4.7523 5.14233 4.41299 4.90471L3.75002 4.44043V5.25C3.75002 5.66421 3.41423 6 3.00002 6C2.5858 6 2.25002 5.66421 2.25002 5.25V4.44043L1.58704 4.90471C1.24773 5.14233 0.780041 5.0599 0.542418 4.72059C0.304856 4.38137 0.387176 3.91381 0.726309 3.67612L1.6924 2.99902L0.727079 2.32366C0.387603 2.08615 0.305043 1.61836 0.542707 1.27899C0.780206 0.939865 1.2476 0.857361 1.58685 1.09468L2.25002 1.55859V0.75C2.25002 0.335786 2.5858 0 3.00002 0C3.41423 0 3.75002 0.335786 3.75002 0.75V1.55859Z"
|
|
80
|
+
fill="currentColor"
|
|
81
|
+
/>
|
|
82
|
+
</svg>
|
|
83
|
+
}
|
|
84
|
+
ref={ref}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
RadioGroupFieldRequiredIndicator.displayName = "RadioGroupFieldRequiredIndicator";
|
|
90
|
+
|
|
91
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
92
|
+
|
|
93
|
+
export interface RadioGroupFieldFooterProps
|
|
94
|
+
extends PrimitiveProps,
|
|
95
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
96
|
+
|
|
97
|
+
export const RadioGroupFieldFooter = withContext<HTMLDivElement, RadioGroupFieldFooterProps>(
|
|
98
|
+
Primitive.div,
|
|
99
|
+
"footer",
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
export interface RadioGroupFieldDescriptionProps extends RadioGroupPrimitive.DescriptionProps {}
|
|
103
|
+
|
|
104
|
+
export const RadioGroupFieldDescription = withContext<
|
|
105
|
+
HTMLSpanElement,
|
|
106
|
+
RadioGroupFieldDescriptionProps
|
|
107
|
+
>(RadioGroupPrimitive.Description, "description");
|
|
108
|
+
|
|
109
|
+
export interface RadioGroupFieldErrorMessageProps extends RadioGroupPrimitive.ErrorMessageProps {}
|
|
110
|
+
|
|
111
|
+
export const RadioGroupFieldErrorMessage = withContext<
|
|
112
|
+
HTMLDivElement,
|
|
113
|
+
RadioGroupFieldErrorMessageProps
|
|
114
|
+
>(RadioGroupPrimitive.ErrorMessage, "errorMessage");
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
export {
|
|
2
|
+
CheckSelectBoxBody as Body,
|
|
3
|
+
CheckSelectBoxCheckmarkControl as CheckmarkControl,
|
|
4
|
+
CheckSelectBoxCheckmarkIcon as CheckmarkIcon,
|
|
2
5
|
CheckSelectBoxContent as Content,
|
|
3
6
|
CheckSelectBoxDescription as Description,
|
|
7
|
+
CheckSelectBoxFooter as Footer,
|
|
4
8
|
CheckSelectBoxGroup as Group,
|
|
9
|
+
CheckSelectBoxHiddenInput as HiddenInput,
|
|
5
10
|
CheckSelectBoxLabel as Label,
|
|
6
11
|
CheckSelectBoxRoot as Root,
|
|
12
|
+
CheckSelectBoxTrigger as Trigger,
|
|
13
|
+
type CheckSelectBoxBodyProps as BodyProps,
|
|
14
|
+
type CheckSelectBoxCheckmarkControlProps as CheckmarkControlProps,
|
|
15
|
+
type CheckSelectBoxCheckmarkIconProps as CheckmarkIconProps,
|
|
7
16
|
type CheckSelectBoxContentProps as ContentProps,
|
|
8
17
|
type CheckSelectBoxDescriptionProps as DescriptionProps,
|
|
18
|
+
type CheckSelectBoxFooterProps as FooterProps,
|
|
9
19
|
type CheckSelectBoxGroupProps as GroupProps,
|
|
20
|
+
type CheckSelectBoxHiddenInputProps as HiddenInputProps,
|
|
10
21
|
type CheckSelectBoxLabelProps as LabelProps,
|
|
11
22
|
type CheckSelectBoxRootProps as RootProps,
|
|
23
|
+
type CheckSelectBoxTriggerProps as TriggerProps,
|
|
12
24
|
} from "./CheckSelectBox";
|
|
@@ -1,35 +1,154 @@
|
|
|
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
|
+
selectBoxCheckmark,
|
|
5
|
+
type SelectBoxCheckmarkVariantProps,
|
|
6
|
+
} from "@seed-design/css/recipes/selectBoxCheckmark";
|
|
7
|
+
import {
|
|
8
|
+
selectBoxGroup,
|
|
9
|
+
type SelectBoxGroupVariantProps,
|
|
10
|
+
} from "@seed-design/css/recipes/select-box-group";
|
|
3
11
|
import { Checkbox as CheckboxPrimitive, useCheckboxContext } from "@seed-design/react-checkbox";
|
|
12
|
+
import {
|
|
13
|
+
Collapsible,
|
|
14
|
+
CollapsibleProvider,
|
|
15
|
+
useCollapsible,
|
|
16
|
+
useCollapsibleContext,
|
|
17
|
+
} from "@seed-design/react-collapsible";
|
|
4
18
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
19
|
+
import clsx from "clsx";
|
|
20
|
+
import {
|
|
21
|
+
createContext,
|
|
22
|
+
forwardRef,
|
|
23
|
+
useCallback,
|
|
24
|
+
useContext,
|
|
25
|
+
useState,
|
|
26
|
+
type PropsWithChildren,
|
|
27
|
+
} from "react";
|
|
7
28
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
8
29
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
30
|
+
import { InternalIcon, type InternalIconProps } from "../private/Icon";
|
|
31
|
+
|
|
32
|
+
const { PropsProvider, ClassNamesProvider, withContext, useProps, useClassNames } =
|
|
33
|
+
createSlotRecipeContext(selectBox);
|
|
9
34
|
|
|
10
|
-
const { withContext: withGroupContext } = createRecipeContext(selectBoxGroup);
|
|
11
|
-
const { withContext, withProvider } = createSlotRecipeContext(selectBox);
|
|
12
35
|
const withStateProps = createWithStateProps([useCheckboxContext]);
|
|
13
36
|
|
|
37
|
+
const FooterContext = createContext<{
|
|
38
|
+
isFooterRendered: boolean;
|
|
39
|
+
footerRef: (node: HTMLDivElement | null) => void;
|
|
40
|
+
footerVisibility: Exclude<NonNullable<CheckSelectBoxRootProps["footerVisibility"]>, "always">;
|
|
41
|
+
} | null>(null);
|
|
14
42
|
export interface CheckSelectBoxGroupProps
|
|
15
|
-
extends
|
|
16
|
-
|
|
43
|
+
extends SelectBoxGroupVariantProps,
|
|
44
|
+
PrimitiveProps,
|
|
45
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
46
|
+
/**
|
|
47
|
+
* Number of columns in the grid layout. When bigger than 1, child `CheckSelectBoxRoot` will have a default layout of "vertical".
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
columns?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const CheckSelectBoxGroup = forwardRef<HTMLDivElement, CheckSelectBoxGroupProps>(
|
|
54
|
+
({ columns = 1, className, style, ...props }, ref) => {
|
|
55
|
+
const [variantProps, otherProps] = selectBoxGroup.splitVariantProps(props);
|
|
56
|
+
const recipeClassName = selectBoxGroup(variantProps);
|
|
57
|
+
const layout = columns === 1 ? "horizontal" : "vertical";
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<PropsProvider value={{ layout }}>
|
|
61
|
+
<Primitive.div
|
|
62
|
+
ref={ref}
|
|
63
|
+
data-columns={columns}
|
|
64
|
+
className={clsx(recipeClassName, className)}
|
|
65
|
+
style={
|
|
66
|
+
{
|
|
67
|
+
...style,
|
|
68
|
+
"--seed-select-box-group--columns": columns,
|
|
69
|
+
} as React.CSSProperties
|
|
70
|
+
}
|
|
71
|
+
{...otherProps}
|
|
72
|
+
/>
|
|
73
|
+
</PropsProvider>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
function FooterVisibilityProvider({
|
|
79
|
+
children,
|
|
80
|
+
footerVisibility,
|
|
81
|
+
}: PropsWithChildren<{
|
|
82
|
+
footerVisibility: Exclude<NonNullable<CheckSelectBoxRootProps["footerVisibility"]>, "always">;
|
|
83
|
+
}>) {
|
|
84
|
+
const { checked } = useCheckboxContext();
|
|
85
|
+
|
|
86
|
+
const collapsible = useCollapsible({
|
|
87
|
+
open: {
|
|
88
|
+
"when-selected": checked,
|
|
89
|
+
"when-not-selected": !checked,
|
|
90
|
+
}[footerVisibility],
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const [isFooterRendered, setIsFooterRendered] = useState(false);
|
|
94
|
+
const footerRef = useCallback((node: HTMLDivElement | null) => {
|
|
95
|
+
setIsFooterRendered(!!node);
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<CollapsibleProvider value={collapsible}>
|
|
100
|
+
<FooterContext.Provider value={{ isFooterRendered, footerRef, footerVisibility }}>
|
|
101
|
+
{children}
|
|
102
|
+
</FooterContext.Provider>
|
|
103
|
+
</CollapsibleProvider>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
17
106
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
107
|
+
export interface CheckSelectBoxRootProps
|
|
108
|
+
extends SelectBoxVariantProps,
|
|
109
|
+
CheckboxPrimitive.RootProps {
|
|
110
|
+
/**
|
|
111
|
+
* Controls when the footer is visible.
|
|
112
|
+
* @default "when-selected"
|
|
113
|
+
*/
|
|
114
|
+
footerVisibility?: "when-selected" | "when-not-selected" | "always";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const CheckSelectBoxRoot = forwardRef<HTMLLabelElement, CheckSelectBoxRootProps>(
|
|
118
|
+
({ footerVisibility = "when-selected", className, children, ...props }, ref) => {
|
|
119
|
+
const [variantProps, otherProps] = selectBox.splitVariantProps(props);
|
|
120
|
+
const classNames = selectBox({
|
|
121
|
+
...useProps(),
|
|
122
|
+
...variantProps,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<ClassNamesProvider value={classNames}>
|
|
127
|
+
<CheckboxPrimitive.Root
|
|
128
|
+
ref={ref}
|
|
129
|
+
className={clsx(classNames.root, className)}
|
|
130
|
+
{...otherProps}
|
|
131
|
+
>
|
|
132
|
+
{footerVisibility === "always" ? (
|
|
133
|
+
children
|
|
134
|
+
) : (
|
|
135
|
+
<FooterVisibilityProvider footerVisibility={footerVisibility}>
|
|
136
|
+
{children}
|
|
137
|
+
</FooterVisibilityProvider>
|
|
138
|
+
)}
|
|
139
|
+
</CheckboxPrimitive.Root>
|
|
140
|
+
</ClassNamesProvider>
|
|
141
|
+
);
|
|
142
|
+
},
|
|
26
143
|
);
|
|
27
144
|
|
|
28
|
-
export interface
|
|
145
|
+
export interface CheckSelectBoxTriggerProps
|
|
146
|
+
extends PrimitiveProps,
|
|
147
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
29
148
|
|
|
30
|
-
export const
|
|
31
|
-
|
|
32
|
-
"
|
|
149
|
+
export const CheckSelectBoxTrigger = withContext<HTMLDivElement, CheckSelectBoxTriggerProps>(
|
|
150
|
+
withStateProps(Primitive.div),
|
|
151
|
+
"trigger",
|
|
33
152
|
);
|
|
34
153
|
|
|
35
154
|
export interface CheckSelectBoxContentProps
|
|
@@ -41,20 +160,106 @@ export const CheckSelectBoxContent = withContext<HTMLDivElement, CheckSelectBoxC
|
|
|
41
160
|
"content",
|
|
42
161
|
);
|
|
43
162
|
|
|
163
|
+
export interface CheckSelectBoxBodyProps
|
|
164
|
+
extends PrimitiveProps,
|
|
165
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
166
|
+
|
|
167
|
+
export const CheckSelectBoxBody = withContext<HTMLDivElement, CheckSelectBoxBodyProps>(
|
|
168
|
+
withStateProps(Primitive.div),
|
|
169
|
+
"body",
|
|
170
|
+
);
|
|
171
|
+
|
|
44
172
|
export interface CheckSelectBoxLabelProps
|
|
45
173
|
extends PrimitiveProps,
|
|
46
|
-
React.HTMLAttributes<
|
|
174
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
47
175
|
|
|
48
|
-
export const CheckSelectBoxLabel = withContext<
|
|
176
|
+
export const CheckSelectBoxLabel = withContext<HTMLDivElement, CheckSelectBoxLabelProps>(
|
|
49
177
|
withStateProps(Primitive.div),
|
|
50
178
|
"label",
|
|
51
179
|
);
|
|
52
180
|
|
|
53
181
|
export interface CheckSelectBoxDescriptionProps
|
|
54
182
|
extends PrimitiveProps,
|
|
55
|
-
React.HTMLAttributes<
|
|
183
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
56
184
|
|
|
57
185
|
export const CheckSelectBoxDescription = withContext<
|
|
58
|
-
|
|
186
|
+
HTMLDivElement,
|
|
59
187
|
CheckSelectBoxDescriptionProps
|
|
60
188
|
>(withStateProps(Primitive.div), "description");
|
|
189
|
+
|
|
190
|
+
const { withProvider: withCheckmarkProvider, withContext: withCheckmarkContext } =
|
|
191
|
+
createSlotRecipeContext(selectBoxCheckmark);
|
|
192
|
+
const withCheckmarkStateProps = createWithStateProps([useCheckboxContext]);
|
|
193
|
+
|
|
194
|
+
export interface CheckSelectBoxCheckmarkControlProps
|
|
195
|
+
extends SelectBoxCheckmarkVariantProps,
|
|
196
|
+
CheckboxPrimitive.ControlProps {}
|
|
197
|
+
|
|
198
|
+
export const CheckSelectBoxCheckmarkControl = withCheckmarkProvider<
|
|
199
|
+
HTMLDivElement,
|
|
200
|
+
CheckSelectBoxCheckmarkControlProps
|
|
201
|
+
>(CheckboxPrimitive.Control, "root");
|
|
202
|
+
|
|
203
|
+
export interface CheckSelectBoxCheckmarkIconProps extends InternalIconProps {}
|
|
204
|
+
|
|
205
|
+
export const CheckSelectBoxCheckmarkIcon = withCheckmarkContext<
|
|
206
|
+
SVGSVGElement,
|
|
207
|
+
CheckSelectBoxCheckmarkIconProps
|
|
208
|
+
>(withCheckmarkStateProps(InternalIcon), "icon");
|
|
209
|
+
|
|
210
|
+
export interface CheckSelectBoxHiddenInputProps extends CheckboxPrimitive.HiddenInputProps {}
|
|
211
|
+
|
|
212
|
+
export const CheckSelectBoxHiddenInput = forwardRef<
|
|
213
|
+
HTMLInputElement,
|
|
214
|
+
CheckSelectBoxHiddenInputProps
|
|
215
|
+
>((props, ref) => {
|
|
216
|
+
// when footerVisibility !== "when-selected", this context is automatically unavailable since it's not wrapped in CollapsibleProvider
|
|
217
|
+
const collapsibleContext = useCollapsibleContext({ strict: false });
|
|
218
|
+
const footerContext = useContext(FooterContext);
|
|
219
|
+
|
|
220
|
+
const triggerAriaProps = footerContext?.isFooterRendered
|
|
221
|
+
? collapsibleContext?.triggerAriaProps
|
|
222
|
+
: undefined;
|
|
223
|
+
|
|
224
|
+
return <CheckboxPrimitive.HiddenInput ref={ref} {...triggerAriaProps} {...props} />;
|
|
225
|
+
});
|
|
226
|
+
CheckSelectBoxHiddenInput.displayName = "CheckSelectBoxHiddenInput";
|
|
227
|
+
|
|
228
|
+
export interface CheckSelectBoxFooterProps
|
|
229
|
+
extends PrimitiveProps,
|
|
230
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
231
|
+
|
|
232
|
+
export const CheckSelectBoxFooter = forwardRef<HTMLDivElement, CheckSelectBoxFooterProps>(
|
|
233
|
+
({ className, children, ...props }, ref) => {
|
|
234
|
+
const classNames = useClassNames();
|
|
235
|
+
const { stateProps } = useCheckboxContext();
|
|
236
|
+
const collapsibleContext = useCollapsibleContext({ strict: false });
|
|
237
|
+
const footerContext = useContext(FooterContext);
|
|
238
|
+
const composedRef = composeRefs(ref, footerContext?.footerRef ?? null);
|
|
239
|
+
|
|
240
|
+
if (collapsibleContext) {
|
|
241
|
+
return (
|
|
242
|
+
<Collapsible.Content
|
|
243
|
+
ref={composedRef}
|
|
244
|
+
className={clsx(classNames.footer, className)}
|
|
245
|
+
{...stateProps}
|
|
246
|
+
{...props}
|
|
247
|
+
>
|
|
248
|
+
{children}
|
|
249
|
+
</Collapsible.Content>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<Primitive.div
|
|
255
|
+
ref={composedRef}
|
|
256
|
+
className={clsx(classNames.footer, className)}
|
|
257
|
+
{...stateProps}
|
|
258
|
+
{...props}
|
|
259
|
+
>
|
|
260
|
+
{children}
|
|
261
|
+
</Primitive.div>
|
|
262
|
+
);
|
|
263
|
+
},
|
|
264
|
+
);
|
|
265
|
+
CheckSelectBoxFooter.displayName = "CheckSelectBoxFooter";
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
export {
|
|
2
|
+
RadioSelectBoxBody as Body,
|
|
2
3
|
RadioSelectBoxContent as Content,
|
|
3
4
|
RadioSelectBoxDescription as Description,
|
|
5
|
+
RadioSelectBoxFooter as Footer,
|
|
6
|
+
RadioSelectBoxGroup as Group,
|
|
7
|
+
RadioSelectBoxHiddenInput as HiddenInput,
|
|
4
8
|
RadioSelectBoxItem as Item,
|
|
5
9
|
RadioSelectBoxLabel as Label,
|
|
6
|
-
|
|
10
|
+
RadioSelectBoxTrigger as Trigger,
|
|
11
|
+
type RadioSelectBoxBodyProps as BodyProps,
|
|
7
12
|
type RadioSelectBoxContentProps as ContentProps,
|
|
8
13
|
type RadioSelectBoxDescriptionProps as DescriptionProps,
|
|
14
|
+
type RadioSelectBoxFooterProps as FooterProps,
|
|
15
|
+
type RadioSelectBoxGroupProps as GroupProps,
|
|
16
|
+
type RadioSelectBoxHiddenInputProps as HiddenInputProps,
|
|
9
17
|
type RadioSelectBoxItemProps as ItemProps,
|
|
10
18
|
type RadioSelectBoxLabelProps as LabelProps,
|
|
11
|
-
type
|
|
19
|
+
type RadioSelectBoxTriggerProps as TriggerProps,
|
|
12
20
|
} from "./RadioSelectBox";
|