@seed-design/react 1.1.16 → 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.
Files changed (189) hide show
  1. package/lib/components/AspectRatio/AspectRatio.cjs +53 -0
  2. package/lib/components/AspectRatio/AspectRatio.d.ts +11 -0
  3. package/lib/components/AspectRatio/AspectRatio.d.ts.map +1 -0
  4. package/lib/components/AspectRatio/AspectRatio.js +30 -0
  5. package/lib/components/AspectRatio/index.cjs +9 -0
  6. package/lib/components/AspectRatio/index.d.ts +2 -0
  7. package/lib/components/AspectRatio/index.d.ts.map +1 -0
  8. package/lib/components/AspectRatio/index.js +1 -0
  9. package/lib/components/Avatar/Avatar.cjs +4 -10
  10. package/lib/components/Avatar/Avatar.d.ts +4 -4
  11. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  12. package/lib/components/Avatar/Avatar.js +4 -10
  13. package/lib/components/Checkbox/Checkbox.cjs +10 -0
  14. package/lib/components/Checkbox/Checkbox.d.ts +4 -0
  15. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  16. package/lib/components/Checkbox/Checkbox.js +10 -1
  17. package/lib/components/Checkbox/Checkbox.namespace.cjs +1 -0
  18. package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
  19. package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -1
  20. package/lib/components/Checkbox/Checkbox.namespace.js +1 -1
  21. package/lib/components/Checkbox/index.cjs +1 -0
  22. package/lib/components/Checkbox/index.d.ts +1 -1
  23. package/lib/components/Checkbox/index.d.ts.map +1 -1
  24. package/lib/components/Checkbox/index.js +1 -1
  25. package/lib/components/ChipTabs/ChipTabs.cjs +23 -4
  26. package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -1
  27. package/lib/components/ChipTabs/ChipTabs.js +23 -4
  28. package/lib/components/Dialog/Dialog.d.ts.map +1 -1
  29. package/lib/components/Fieldset/Fieldset.cjs +86 -0
  30. package/lib/components/Fieldset/Fieldset.d.ts +30 -0
  31. package/lib/components/Fieldset/Fieldset.d.ts.map +1 -0
  32. package/lib/components/Fieldset/Fieldset.js +75 -0
  33. package/lib/components/Fieldset/Fieldset.namespace.cjs +16 -0
  34. package/lib/components/Fieldset/Fieldset.namespace.d.ts +2 -0
  35. package/lib/components/Fieldset/Fieldset.namespace.d.ts.map +1 -0
  36. package/lib/components/Fieldset/Fieldset.namespace.js +1 -0
  37. package/lib/components/Fieldset/index.cjs +18 -0
  38. package/lib/components/Fieldset/index.d.ts +3 -0
  39. package/lib/components/Fieldset/index.d.ts.map +1 -0
  40. package/lib/components/Fieldset/index.js +3 -0
  41. package/lib/components/Grid/Grid.cjs +56 -0
  42. package/lib/components/Grid/Grid.d.ts +41 -0
  43. package/lib/components/Grid/Grid.d.ts.map +1 -0
  44. package/lib/components/Grid/Grid.js +33 -0
  45. package/lib/components/Grid/index.cjs +9 -0
  46. package/lib/components/Grid/index.d.ts +2 -0
  47. package/lib/components/Grid/index.d.ts.map +1 -0
  48. package/lib/components/Grid/index.js +1 -0
  49. package/lib/components/GridItem/GridItem.cjs +45 -0
  50. package/lib/components/GridItem/GridItem.d.ts +35 -0
  51. package/lib/components/GridItem/GridItem.d.ts.map +1 -0
  52. package/lib/components/GridItem/GridItem.js +22 -0
  53. package/lib/components/GridItem/index.cjs +9 -0
  54. package/lib/components/GridItem/index.d.ts +2 -0
  55. package/lib/components/GridItem/index.d.ts.map +1 -0
  56. package/lib/components/GridItem/index.js +1 -0
  57. package/lib/components/HelpBubble/HelpBubble.cjs +5 -0
  58. package/lib/components/HelpBubble/HelpBubble.d.ts +3 -0
  59. package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -1
  60. package/lib/components/HelpBubble/HelpBubble.js +5 -1
  61. package/lib/components/HelpBubble/HelpBubble.namespace.cjs +1 -0
  62. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +1 -1
  63. package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -1
  64. package/lib/components/HelpBubble/HelpBubble.namespace.js +1 -1
  65. package/lib/components/HelpBubble/index.cjs +1 -0
  66. package/lib/components/HelpBubble/index.d.ts +1 -1
  67. package/lib/components/HelpBubble/index.d.ts.map +1 -1
  68. package/lib/components/HelpBubble/index.js +1 -1
  69. package/lib/components/ImageFrame/ImageFrame.cjs +157 -0
  70. package/lib/components/ImageFrame/ImageFrame.d.ts +51 -0
  71. package/lib/components/ImageFrame/ImageFrame.d.ts.map +1 -0
  72. package/lib/components/ImageFrame/ImageFrame.js +129 -0
  73. package/lib/components/ImageFrame/index.cjs +14 -0
  74. package/lib/components/ImageFrame/index.d.ts +2 -0
  75. package/lib/components/ImageFrame/index.d.ts.map +1 -0
  76. package/lib/components/ImageFrame/index.js +1 -0
  77. package/lib/components/MenuSheet/MenuSheet.cjs +60 -24
  78. package/lib/components/MenuSheet/MenuSheet.d.ts +12 -0
  79. package/lib/components/MenuSheet/MenuSheet.d.ts.map +1 -1
  80. package/lib/components/MenuSheet/MenuSheet.js +57 -25
  81. package/lib/components/MenuSheet/MenuSheet.namespace.cjs +4 -0
  82. package/lib/components/MenuSheet/MenuSheet.namespace.d.ts +1 -1
  83. package/lib/components/MenuSheet/MenuSheet.namespace.d.ts.map +1 -1
  84. package/lib/components/MenuSheet/MenuSheet.namespace.js +1 -1
  85. package/lib/components/MenuSheet/index.cjs +4 -0
  86. package/lib/components/MenuSheet/index.d.ts +1 -1
  87. package/lib/components/MenuSheet/index.d.ts.map +1 -1
  88. package/lib/components/MenuSheet/index.js +1 -1
  89. package/lib/components/RadioGroup/RadioGroup.cjs +4 -1
  90. package/lib/components/RadioGroup/RadioGroup.d.ts +3 -2
  91. package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  92. package/lib/components/RadioGroup/RadioGroup.js +4 -1
  93. package/lib/components/RadioGroupField/RadioGroupField.cjs +79 -0
  94. package/lib/components/RadioGroupField/RadioGroupField.d.ts +30 -0
  95. package/lib/components/RadioGroupField/RadioGroupField.d.ts.map +1 -0
  96. package/lib/components/RadioGroupField/RadioGroupField.js +68 -0
  97. package/lib/components/RadioGroupField/RadioGroupField.namespace.cjs +16 -0
  98. package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts +2 -0
  99. package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts.map +1 -0
  100. package/lib/components/RadioGroupField/RadioGroupField.namespace.js +1 -0
  101. package/lib/components/RadioGroupField/index.cjs +18 -0
  102. package/lib/components/RadioGroupField/index.d.ts +3 -0
  103. package/lib/components/RadioGroupField/index.d.ts.map +1 -0
  104. package/lib/components/RadioGroupField/index.js +3 -0
  105. package/lib/components/SelectBox/CheckSelectBox.cjs +117 -8
  106. package/lib/components/SelectBox/CheckSelectBox.d.ts +38 -10
  107. package/lib/components/SelectBox/CheckSelectBox.d.ts.map +1 -1
  108. package/lib/components/SelectBox/CheckSelectBox.js +113 -10
  109. package/lib/components/SelectBox/CheckSelectBox.namespace.cjs +6 -0
  110. package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts +1 -1
  111. package/lib/components/SelectBox/CheckSelectBox.namespace.d.ts.map +1 -1
  112. package/lib/components/SelectBox/CheckSelectBox.namespace.js +1 -1
  113. package/lib/components/SelectBox/RadioSelectBox.cjs +112 -9
  114. package/lib/components/SelectBox/RadioSelectBox.d.ts +31 -7
  115. package/lib/components/SelectBox/RadioSelectBox.d.ts.map +1 -1
  116. package/lib/components/SelectBox/RadioSelectBox.js +109 -10
  117. package/lib/components/SelectBox/RadioSelectBox.namespace.cjs +5 -1
  118. package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts +1 -1
  119. package/lib/components/SelectBox/RadioSelectBox.namespace.d.ts.map +1 -1
  120. package/lib/components/SelectBox/RadioSelectBox.namespace.js +1 -1
  121. package/lib/components/SelectBox/index.cjs +11 -1
  122. package/lib/components/SelectBox/index.d.ts +2 -2
  123. package/lib/components/SelectBox/index.d.ts.map +1 -1
  124. package/lib/components/SelectBox/index.js +2 -2
  125. package/lib/components/Switch/Switch.cjs +10 -5
  126. package/lib/components/Switch/Switch.d.ts +3 -3
  127. package/lib/components/Switch/Switch.d.ts.map +1 -1
  128. package/lib/components/Switch/Switch.js +10 -5
  129. package/lib/components/TagGroup/TagGroup.cjs +25 -9
  130. package/lib/components/TagGroup/TagGroup.d.ts +5 -1
  131. package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
  132. package/lib/components/TagGroup/TagGroup.js +25 -10
  133. package/lib/components/TagGroup/TagGroup.namespace.cjs +1 -0
  134. package/lib/components/TagGroup/TagGroup.namespace.d.ts +1 -1
  135. package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -1
  136. package/lib/components/TagGroup/TagGroup.namespace.js +1 -1
  137. package/lib/components/TagGroup/index.cjs +1 -0
  138. package/lib/components/TagGroup/index.d.ts +1 -1
  139. package/lib/components/TagGroup/index.d.ts.map +1 -1
  140. package/lib/components/TagGroup/index.js +1 -1
  141. package/lib/components/index.cjs +53 -1
  142. package/lib/components/index.d.ts +6 -0
  143. package/lib/components/index.d.ts.map +1 -1
  144. package/lib/components/index.js +16 -6
  145. package/lib/index.cjs +53 -1
  146. package/lib/index.js +16 -6
  147. package/lib/utils/styled.cjs +11 -5
  148. package/lib/utils/styled.d.ts +6 -0
  149. package/lib/utils/styled.d.ts.map +1 -1
  150. package/lib/utils/styled.js +11 -5
  151. package/package.json +6 -3
  152. package/src/components/AspectRatio/AspectRatio.tsx +38 -0
  153. package/src/components/AspectRatio/index.ts +1 -0
  154. package/src/components/Avatar/Avatar.tsx +7 -14
  155. package/src/components/Checkbox/Checkbox.namespace.ts +2 -0
  156. package/src/components/Checkbox/Checkbox.tsx +24 -0
  157. package/src/components/Checkbox/index.ts +2 -0
  158. package/src/components/ChipTabs/ChipTabs.tsx +25 -4
  159. package/src/components/Dialog/Dialog.tsx +6 -0
  160. package/src/components/Fieldset/Fieldset.namespace.ts +17 -0
  161. package/src/components/Fieldset/Fieldset.tsx +101 -0
  162. package/src/components/Fieldset/index.ts +19 -0
  163. package/src/components/Grid/Grid.tsx +79 -0
  164. package/src/components/Grid/index.ts +1 -0
  165. package/src/components/GridItem/GridItem.tsx +70 -0
  166. package/src/components/GridItem/index.ts +1 -0
  167. package/src/components/HelpBubble/HelpBubble.namespace.ts +3 -0
  168. package/src/components/HelpBubble/HelpBubble.tsx +7 -2
  169. package/src/components/HelpBubble/index.ts +2 -0
  170. package/src/components/ImageFrame/ImageFrame.tsx +227 -0
  171. package/src/components/ImageFrame/index.ts +14 -0
  172. package/src/components/MenuSheet/MenuSheet.namespace.ts +8 -0
  173. package/src/components/MenuSheet/MenuSheet.tsx +82 -34
  174. package/src/components/MenuSheet/index.ts +8 -0
  175. package/src/components/RadioGroup/RadioGroup.tsx +8 -2
  176. package/src/components/RadioGroupField/RadioGroupField.namespace.ts +18 -0
  177. package/src/components/RadioGroupField/RadioGroupField.tsx +114 -0
  178. package/src/components/RadioGroupField/index.ts +2 -0
  179. package/src/components/SelectBox/CheckSelectBox.namespace.ts +12 -0
  180. package/src/components/SelectBox/CheckSelectBox.tsx +229 -24
  181. package/src/components/SelectBox/RadioSelectBox.namespace.ts +10 -2
  182. package/src/components/SelectBox/RadioSelectBox.tsx +210 -16
  183. package/src/components/SelectBox/index.ts +22 -2
  184. package/src/components/Switch/Switch.tsx +16 -7
  185. package/src/components/TagGroup/TagGroup.namespace.ts +2 -0
  186. package/src/components/TagGroup/TagGroup.tsx +33 -9
  187. package/src/components/TagGroup/index.ts +2 -0
  188. package/src/components/index.ts +6 -0
  189. package/src/utils/styled.tsx +23 -5
@@ -4,37 +4,146 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const reactComposeRefs = require('@radix-ui/react-compose-refs');
7
8
  const selectBox = require('@seed-design/css/recipes/select-box');
9
+ const selectBoxCheckmark = require('@seed-design/css/recipes/selectBoxCheckmark');
8
10
  const selectBoxGroup = require('@seed-design/css/recipes/select-box-group');
9
11
  const reactCheckbox = require('@seed-design/react-checkbox');
12
+ const reactCollapsible = require('@seed-design/react-collapsible');
10
13
  const reactPrimitive = require('@seed-design/react-primitive');
14
+ const clsx = require('clsx');
11
15
  const React = require('react');
12
- const createRecipeContext = require('../../utils/createRecipeContext.cjs');
13
16
  const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
14
17
  const createWithStateProps = require('../../utils/createWithStateProps.cjs');
18
+ const Icon = require('../private/Icon.cjs');
15
19
 
16
- const { withContext: withGroupContext } = createRecipeContext.createRecipeContext(selectBoxGroup.selectBoxGroup);
17
- const { withContext, withProvider } = createSlotRecipeContext.createSlotRecipeContext(selectBox.selectBox);
20
+ const { PropsProvider, ClassNamesProvider, withContext, useProps, useClassNames } = createSlotRecipeContext.createSlotRecipeContext(selectBox.selectBox);
18
21
  const withStateProps = createWithStateProps.createWithStateProps([reactCheckbox.useCheckboxContext]);
19
- const CheckSelectBoxGroup = withGroupContext(
20
- React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.div, { ref, role: "group", ...props }))
22
+ const FooterContext = React.createContext(null);
23
+ const CheckSelectBoxGroup = React.forwardRef(
24
+ ({ columns = 1, className, style, ...props }, ref) => {
25
+ const [variantProps, otherProps] = selectBoxGroup.selectBoxGroup.splitVariantProps(props);
26
+ const recipeClassName = selectBoxGroup.selectBoxGroup(variantProps);
27
+ const layout = columns === 1 ? "horizontal" : "vertical";
28
+ return /* @__PURE__ */ jsxRuntime.jsx(PropsProvider, { value: { layout }, children: /* @__PURE__ */ jsxRuntime.jsx(
29
+ reactPrimitive.Primitive.div,
30
+ {
31
+ ref,
32
+ "data-columns": columns,
33
+ className: clsx(recipeClassName, className),
34
+ style: {
35
+ ...style,
36
+ "--seed-select-box-group--columns": columns
37
+ },
38
+ ...otherProps
39
+ }
40
+ ) });
41
+ }
21
42
  );
22
- const CheckSelectBoxRoot = withProvider(
23
- reactCheckbox.Checkbox.Root,
24
- "root"
43
+ function FooterVisibilityProvider({
44
+ children,
45
+ footerVisibility
46
+ }) {
47
+ const { checked } = reactCheckbox.useCheckboxContext();
48
+ const collapsible = reactCollapsible.useCollapsible({
49
+ open: {
50
+ "when-selected": checked,
51
+ "when-not-selected": !checked
52
+ }[footerVisibility]
53
+ });
54
+ const [isFooterRendered, setIsFooterRendered] = React.useState(false);
55
+ const footerRef = React.useCallback((node) => {
56
+ setIsFooterRendered(!!node);
57
+ }, []);
58
+ return /* @__PURE__ */ jsxRuntime.jsx(reactCollapsible.CollapsibleProvider, { value: collapsible, children: /* @__PURE__ */ jsxRuntime.jsx(FooterContext.Provider, { value: { isFooterRendered, footerRef, footerVisibility }, children }) });
59
+ }
60
+ const CheckSelectBoxRoot = React.forwardRef(
61
+ ({ footerVisibility = "when-selected", className, children, ...props }, ref) => {
62
+ const [variantProps, otherProps] = selectBox.selectBox.splitVariantProps(props);
63
+ const classNames = selectBox.selectBox({
64
+ ...useProps(),
65
+ ...variantProps
66
+ });
67
+ return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(
68
+ reactCheckbox.Checkbox.Root,
69
+ {
70
+ ref,
71
+ className: clsx(classNames.root, className),
72
+ ...otherProps,
73
+ children: footerVisibility === "always" ? children : /* @__PURE__ */ jsxRuntime.jsx(FooterVisibilityProvider, { footerVisibility, children })
74
+ }
75
+ ) });
76
+ }
77
+ );
78
+ const CheckSelectBoxTrigger = withContext(
79
+ withStateProps(reactPrimitive.Primitive.div),
80
+ "trigger"
25
81
  );
26
82
  const CheckSelectBoxContent = withContext(
27
83
  withStateProps(reactPrimitive.Primitive.div),
28
84
  "content"
29
85
  );
86
+ const CheckSelectBoxBody = withContext(
87
+ withStateProps(reactPrimitive.Primitive.div),
88
+ "body"
89
+ );
30
90
  const CheckSelectBoxLabel = withContext(
31
91
  withStateProps(reactPrimitive.Primitive.div),
32
92
  "label"
33
93
  );
34
94
  const CheckSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.div), "description");
95
+ const { withProvider: withCheckmarkProvider, withContext: withCheckmarkContext } = createSlotRecipeContext.createSlotRecipeContext(selectBoxCheckmark.selectBoxCheckmark);
96
+ const withCheckmarkStateProps = createWithStateProps.createWithStateProps([reactCheckbox.useCheckboxContext]);
97
+ const CheckSelectBoxCheckmarkControl = withCheckmarkProvider(reactCheckbox.Checkbox.Control, "root");
98
+ const CheckSelectBoxCheckmarkIcon = withCheckmarkContext(withCheckmarkStateProps(Icon.InternalIcon), "icon");
99
+ const CheckSelectBoxHiddenInput = React.forwardRef((props, ref) => {
100
+ const collapsibleContext = reactCollapsible.useCollapsibleContext({ strict: false });
101
+ const footerContext = React.useContext(FooterContext);
102
+ const triggerAriaProps = footerContext?.isFooterRendered ? collapsibleContext?.triggerAriaProps : void 0;
103
+ return /* @__PURE__ */ jsxRuntime.jsx(reactCheckbox.Checkbox.HiddenInput, { ref, ...triggerAriaProps, ...props });
104
+ });
105
+ CheckSelectBoxHiddenInput.displayName = "CheckSelectBoxHiddenInput";
106
+ const CheckSelectBoxFooter = React.forwardRef(
107
+ ({ className, children, ...props }, ref) => {
108
+ const classNames = useClassNames();
109
+ const { stateProps } = reactCheckbox.useCheckboxContext();
110
+ const collapsibleContext = reactCollapsible.useCollapsibleContext({ strict: false });
111
+ const footerContext = React.useContext(FooterContext);
112
+ const composedRef = reactComposeRefs.composeRefs(ref, footerContext?.footerRef ?? null);
113
+ if (collapsibleContext) {
114
+ return /* @__PURE__ */ jsxRuntime.jsx(
115
+ reactCollapsible.Collapsible.Content,
116
+ {
117
+ ref: composedRef,
118
+ className: clsx(classNames.footer, className),
119
+ ...stateProps,
120
+ ...props,
121
+ children
122
+ }
123
+ );
124
+ }
125
+ return /* @__PURE__ */ jsxRuntime.jsx(
126
+ reactPrimitive.Primitive.div,
127
+ {
128
+ ref: composedRef,
129
+ className: clsx(classNames.footer, className),
130
+ ...stateProps,
131
+ ...props,
132
+ children
133
+ }
134
+ );
135
+ }
136
+ );
137
+ CheckSelectBoxFooter.displayName = "CheckSelectBoxFooter";
35
138
 
139
+ exports.CheckSelectBoxBody = CheckSelectBoxBody;
140
+ exports.CheckSelectBoxCheckmarkControl = CheckSelectBoxCheckmarkControl;
141
+ exports.CheckSelectBoxCheckmarkIcon = CheckSelectBoxCheckmarkIcon;
36
142
  exports.CheckSelectBoxContent = CheckSelectBoxContent;
37
143
  exports.CheckSelectBoxDescription = CheckSelectBoxDescription;
144
+ exports.CheckSelectBoxFooter = CheckSelectBoxFooter;
38
145
  exports.CheckSelectBoxGroup = CheckSelectBoxGroup;
146
+ exports.CheckSelectBoxHiddenInput = CheckSelectBoxHiddenInput;
39
147
  exports.CheckSelectBoxLabel = CheckSelectBoxLabel;
40
148
  exports.CheckSelectBoxRoot = CheckSelectBoxRoot;
149
+ exports.CheckSelectBoxTrigger = CheckSelectBoxTrigger;
@@ -1,23 +1,51 @@
1
+ import { SelectBoxVariantProps } from '@seed-design/css/recipes/select-box';
2
+ import { SelectBoxCheckmarkVariantProps } from '@seed-design/css/recipes/selectBoxCheckmark';
3
+ import { SelectBoxGroupVariantProps } from '@seed-design/css/recipes/select-box-group';
1
4
  import { Checkbox as CheckboxPrimitive } from '@seed-design/react-checkbox';
2
5
  import { PrimitiveProps } from '@seed-design/react-primitive';
6
+ import { InternalIconProps } from '../private/Icon';
3
7
  import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
- export interface CheckSelectBoxGroupProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
8
+ export interface CheckSelectBoxGroupProps extends SelectBoxGroupVariantProps, PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * Number of columns in the grid layout. When bigger than 1, child `CheckSelectBoxRoot` will have a default layout of "vertical".
11
+ * @default 1
12
+ */
13
+ columns?: number;
5
14
  }
6
- /**
7
- * CheckSelectBoxGroup is a simple div wrapper for future extensibility.
8
- * It does not have spacing by default, nesting <VStack> under it is recommended.
9
- */
10
15
  export declare const CheckSelectBoxGroup: ForwardRefExoticComponent<CheckSelectBoxGroupProps & RefAttributes<HTMLDivElement>>;
11
- export interface CheckSelectBoxRootProps extends CheckboxPrimitive.RootProps {
16
+ export interface CheckSelectBoxRootProps extends SelectBoxVariantProps, CheckboxPrimitive.RootProps {
17
+ /**
18
+ * Controls when the footer is visible.
19
+ * @default "when-selected"
20
+ */
21
+ footerVisibility?: "when-selected" | "when-not-selected" | "always";
12
22
  }
13
23
  export declare const CheckSelectBoxRoot: ForwardRefExoticComponent<CheckSelectBoxRootProps & RefAttributes<HTMLLabelElement>>;
24
+ export interface CheckSelectBoxTriggerProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
25
+ }
26
+ export declare const CheckSelectBoxTrigger: ForwardRefExoticComponent<CheckSelectBoxTriggerProps & RefAttributes<HTMLDivElement>>;
14
27
  export interface CheckSelectBoxContentProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
15
28
  }
16
29
  export declare const CheckSelectBoxContent: ForwardRefExoticComponent<CheckSelectBoxContentProps & RefAttributes<HTMLDivElement>>;
17
- export interface CheckSelectBoxLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {
30
+ export interface CheckSelectBoxBodyProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
31
+ }
32
+ export declare const CheckSelectBoxBody: ForwardRefExoticComponent<CheckSelectBoxBodyProps & RefAttributes<HTMLDivElement>>;
33
+ export interface CheckSelectBoxLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
34
+ }
35
+ export declare const CheckSelectBoxLabel: ForwardRefExoticComponent<CheckSelectBoxLabelProps & RefAttributes<HTMLDivElement>>;
36
+ export interface CheckSelectBoxDescriptionProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
37
+ }
38
+ export declare const CheckSelectBoxDescription: ForwardRefExoticComponent<CheckSelectBoxDescriptionProps & RefAttributes<HTMLDivElement>>;
39
+ export interface CheckSelectBoxCheckmarkControlProps extends SelectBoxCheckmarkVariantProps, CheckboxPrimitive.ControlProps {
40
+ }
41
+ export declare const CheckSelectBoxCheckmarkControl: ForwardRefExoticComponent<CheckSelectBoxCheckmarkControlProps & RefAttributes<HTMLDivElement>>;
42
+ export interface CheckSelectBoxCheckmarkIconProps extends InternalIconProps {
43
+ }
44
+ export declare const CheckSelectBoxCheckmarkIcon: ForwardRefExoticComponent<CheckSelectBoxCheckmarkIconProps & RefAttributes<SVGSVGElement>>;
45
+ export interface CheckSelectBoxHiddenInputProps extends CheckboxPrimitive.HiddenInputProps {
18
46
  }
19
- export declare const CheckSelectBoxLabel: ForwardRefExoticComponent<CheckSelectBoxLabelProps & RefAttributes<HTMLSpanElement>>;
20
- export interface CheckSelectBoxDescriptionProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {
47
+ export declare const CheckSelectBoxHiddenInput: ForwardRefExoticComponent<CheckSelectBoxHiddenInputProps & RefAttributes<HTMLInputElement>>;
48
+ export interface CheckSelectBoxFooterProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
21
49
  }
22
- export declare const CheckSelectBoxDescription: ForwardRefExoticComponent<CheckSelectBoxDescriptionProps & RefAttributes<HTMLSpanElement>>;
50
+ export declare const CheckSelectBoxFooter: ForwardRefExoticComponent<CheckSelectBoxFooterProps & RefAttributes<HTMLDivElement>>;
23
51
  //# sourceMappingURL=CheckSelectBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckSelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/CheckSelectBox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAsB,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAU9E,MAAM,WAAW,wBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM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
  import { jsx } from 'react/jsx-runtime';
3
+ import { composeRefs } from '@radix-ui/react-compose-refs';
3
4
  import { selectBox } from '@seed-design/css/recipes/select-box';
5
+ import { selectBoxCheckmark } from '@seed-design/css/recipes/selectBoxCheckmark';
4
6
  import { selectBoxGroup } from '@seed-design/css/recipes/select-box-group';
5
7
  import { Checkbox, useCheckboxContext } from '@seed-design/react-checkbox';
8
+ import { useCollapsibleContext, Collapsible, useCollapsible, CollapsibleProvider } from '@seed-design/react-collapsible';
6
9
  import { Primitive } from '@seed-design/react-primitive';
7
- import { forwardRef } from 'react';
8
- import { createRecipeContext } from '../../utils/createRecipeContext.js';
10
+ import clsx from 'clsx';
11
+ import { forwardRef, useContext, createContext, useState, useCallback } from 'react';
9
12
  import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
10
13
  import { createWithStateProps } from '../../utils/createWithStateProps.js';
14
+ import { InternalIcon } from '../private/Icon.js';
11
15
 
12
- const { withContext: withGroupContext } = createRecipeContext(selectBoxGroup);
13
- const { withContext, withProvider } = createSlotRecipeContext(selectBox);
16
+ const { PropsProvider, ClassNamesProvider, withContext, useProps, useClassNames } = createSlotRecipeContext(selectBox);
14
17
  const withStateProps = createWithStateProps([useCheckboxContext]);
15
- const CheckSelectBoxGroup = withGroupContext(
16
- forwardRef((props, ref) => /* @__PURE__ */ jsx(Primitive.div, { ref, role: "group", ...props }))
18
+ const FooterContext = createContext(null);
19
+ const CheckSelectBoxGroup = forwardRef(
20
+ ({ columns = 1, className, style, ...props }, ref) => {
21
+ const [variantProps, otherProps] = selectBoxGroup.splitVariantProps(props);
22
+ const recipeClassName = selectBoxGroup(variantProps);
23
+ const layout = columns === 1 ? "horizontal" : "vertical";
24
+ return /* @__PURE__ */ jsx(PropsProvider, { value: { layout }, children: /* @__PURE__ */ jsx(
25
+ Primitive.div,
26
+ {
27
+ ref,
28
+ "data-columns": columns,
29
+ className: clsx(recipeClassName, className),
30
+ style: {
31
+ ...style,
32
+ "--seed-select-box-group--columns": columns
33
+ },
34
+ ...otherProps
35
+ }
36
+ ) });
37
+ }
17
38
  );
18
- const CheckSelectBoxRoot = withProvider(
19
- Checkbox.Root,
20
- "root"
39
+ function FooterVisibilityProvider({
40
+ children,
41
+ footerVisibility
42
+ }) {
43
+ const { checked } = useCheckboxContext();
44
+ const collapsible = useCollapsible({
45
+ open: {
46
+ "when-selected": checked,
47
+ "when-not-selected": !checked
48
+ }[footerVisibility]
49
+ });
50
+ const [isFooterRendered, setIsFooterRendered] = useState(false);
51
+ const footerRef = useCallback((node) => {
52
+ setIsFooterRendered(!!node);
53
+ }, []);
54
+ return /* @__PURE__ */ jsx(CollapsibleProvider, { value: collapsible, children: /* @__PURE__ */ jsx(FooterContext.Provider, { value: { isFooterRendered, footerRef, footerVisibility }, children }) });
55
+ }
56
+ const CheckSelectBoxRoot = forwardRef(
57
+ ({ footerVisibility = "when-selected", className, children, ...props }, ref) => {
58
+ const [variantProps, otherProps] = selectBox.splitVariantProps(props);
59
+ const classNames = selectBox({
60
+ ...useProps(),
61
+ ...variantProps
62
+ });
63
+ return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(
64
+ Checkbox.Root,
65
+ {
66
+ ref,
67
+ className: clsx(classNames.root, className),
68
+ ...otherProps,
69
+ children: footerVisibility === "always" ? children : /* @__PURE__ */ jsx(FooterVisibilityProvider, { footerVisibility, children })
70
+ }
71
+ ) });
72
+ }
73
+ );
74
+ const CheckSelectBoxTrigger = withContext(
75
+ withStateProps(Primitive.div),
76
+ "trigger"
21
77
  );
22
78
  const CheckSelectBoxContent = withContext(
23
79
  withStateProps(Primitive.div),
24
80
  "content"
25
81
  );
82
+ const CheckSelectBoxBody = withContext(
83
+ withStateProps(Primitive.div),
84
+ "body"
85
+ );
26
86
  const CheckSelectBoxLabel = withContext(
27
87
  withStateProps(Primitive.div),
28
88
  "label"
29
89
  );
30
90
  const CheckSelectBoxDescription = withContext(withStateProps(Primitive.div), "description");
91
+ const { withProvider: withCheckmarkProvider, withContext: withCheckmarkContext } = createSlotRecipeContext(selectBoxCheckmark);
92
+ const withCheckmarkStateProps = createWithStateProps([useCheckboxContext]);
93
+ const CheckSelectBoxCheckmarkControl = withCheckmarkProvider(Checkbox.Control, "root");
94
+ const CheckSelectBoxCheckmarkIcon = withCheckmarkContext(withCheckmarkStateProps(InternalIcon), "icon");
95
+ const CheckSelectBoxHiddenInput = forwardRef((props, ref) => {
96
+ const collapsibleContext = useCollapsibleContext({ strict: false });
97
+ const footerContext = useContext(FooterContext);
98
+ const triggerAriaProps = footerContext?.isFooterRendered ? collapsibleContext?.triggerAriaProps : void 0;
99
+ return /* @__PURE__ */ jsx(Checkbox.HiddenInput, { ref, ...triggerAriaProps, ...props });
100
+ });
101
+ CheckSelectBoxHiddenInput.displayName = "CheckSelectBoxHiddenInput";
102
+ const CheckSelectBoxFooter = forwardRef(
103
+ ({ className, children, ...props }, ref) => {
104
+ const classNames = useClassNames();
105
+ const { stateProps } = useCheckboxContext();
106
+ const collapsibleContext = useCollapsibleContext({ strict: false });
107
+ const footerContext = useContext(FooterContext);
108
+ const composedRef = composeRefs(ref, footerContext?.footerRef ?? null);
109
+ if (collapsibleContext) {
110
+ return /* @__PURE__ */ jsx(
111
+ Collapsible.Content,
112
+ {
113
+ ref: composedRef,
114
+ className: clsx(classNames.footer, className),
115
+ ...stateProps,
116
+ ...props,
117
+ children
118
+ }
119
+ );
120
+ }
121
+ return /* @__PURE__ */ jsx(
122
+ Primitive.div,
123
+ {
124
+ ref: composedRef,
125
+ className: clsx(classNames.footer, className),
126
+ ...stateProps,
127
+ ...props,
128
+ children
129
+ }
130
+ );
131
+ }
132
+ );
133
+ CheckSelectBoxFooter.displayName = "CheckSelectBoxFooter";
31
134
 
32
- export { CheckSelectBoxContent, CheckSelectBoxDescription, CheckSelectBoxGroup, CheckSelectBoxLabel, CheckSelectBoxRoot };
135
+ export { CheckSelectBoxBody, CheckSelectBoxCheckmarkControl, CheckSelectBoxCheckmarkIcon, CheckSelectBoxContent, CheckSelectBoxDescription, CheckSelectBoxFooter, CheckSelectBoxGroup, CheckSelectBoxHiddenInput, CheckSelectBoxLabel, CheckSelectBoxRoot, CheckSelectBoxTrigger };
@@ -6,8 +6,14 @@ const CheckSelectBox = require('./CheckSelectBox.cjs');
6
6
 
7
7
 
8
8
 
9
+ exports.Body = CheckSelectBox.CheckSelectBoxBody;
10
+ exports.CheckmarkControl = CheckSelectBox.CheckSelectBoxCheckmarkControl;
11
+ exports.CheckmarkIcon = CheckSelectBox.CheckSelectBoxCheckmarkIcon;
9
12
  exports.Content = CheckSelectBox.CheckSelectBoxContent;
10
13
  exports.Description = CheckSelectBox.CheckSelectBoxDescription;
14
+ exports.Footer = CheckSelectBox.CheckSelectBoxFooter;
11
15
  exports.Group = CheckSelectBox.CheckSelectBoxGroup;
16
+ exports.HiddenInput = CheckSelectBox.CheckSelectBoxHiddenInput;
12
17
  exports.Label = CheckSelectBox.CheckSelectBoxLabel;
13
18
  exports.Root = CheckSelectBox.CheckSelectBoxRoot;
19
+ exports.Trigger = CheckSelectBox.CheckSelectBoxTrigger;
@@ -1,2 +1,2 @@
1
- export { CheckSelectBoxContent as Content, CheckSelectBoxDescription as Description, CheckSelectBoxGroup as Group, CheckSelectBoxLabel as Label, CheckSelectBoxRoot as Root, type CheckSelectBoxContentProps as ContentProps, type CheckSelectBoxDescriptionProps as DescriptionProps, type CheckSelectBoxGroupProps as GroupProps, type CheckSelectBoxLabelProps as LabelProps, type CheckSelectBoxRootProps as RootProps, } from './CheckSelectBox';
1
+ export { CheckSelectBoxBody as Body, CheckSelectBoxCheckmarkControl as CheckmarkControl, CheckSelectBoxCheckmarkIcon as CheckmarkIcon, CheckSelectBoxContent as Content, CheckSelectBoxDescription as Description, CheckSelectBoxFooter as Footer, CheckSelectBoxGroup as Group, CheckSelectBoxHiddenInput as HiddenInput, CheckSelectBoxLabel as Label, CheckSelectBoxRoot as Root, CheckSelectBoxTrigger as Trigger, type CheckSelectBoxBodyProps as BodyProps, type CheckSelectBoxCheckmarkControlProps as CheckmarkControlProps, type CheckSelectBoxCheckmarkIconProps as CheckmarkIconProps, type CheckSelectBoxContentProps as ContentProps, type CheckSelectBoxDescriptionProps as DescriptionProps, type CheckSelectBoxFooterProps as FooterProps, type CheckSelectBoxGroupProps as GroupProps, type CheckSelectBoxHiddenInputProps as HiddenInputProps, type CheckSelectBoxLabelProps as LabelProps, type CheckSelectBoxRootProps as RootProps, type CheckSelectBoxTriggerProps as TriggerProps, } from './CheckSelectBox';
2
2
  //# sourceMappingURL=CheckSelectBox.namespace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckSelectBox.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/CheckSelectBox.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,OAAO,EAChC,yBAAyB,IAAI,WAAW,EACxC,mBAAmB,IAAI,KAAK,EAC5B,mBAAmB,IAAI,KAAK,EAC5B,kBAAkB,IAAI,IAAI,EAC1B,KAAK,0BAA0B,IAAI,YAAY,EAC/C,KAAK,8BAA8B,IAAI,gBAAgB,EACvD,KAAK,wBAAwB,IAAI,UAAU,EAC3C,KAAK,wBAAwB,IAAI,UAAU,EAC3C,KAAK,uBAAuB,IAAI,SAAS,GAC1C,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"CheckSelectBox.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/CheckSelectBox.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,IAAI,EAC1B,8BAA8B,IAAI,gBAAgB,EAClD,2BAA2B,IAAI,aAAa,EAC5C,qBAAqB,IAAI,OAAO,EAChC,yBAAyB,IAAI,WAAW,EACxC,oBAAoB,IAAI,MAAM,EAC9B,mBAAmB,IAAI,KAAK,EAC5B,yBAAyB,IAAI,WAAW,EACxC,mBAAmB,IAAI,KAAK,EAC5B,kBAAkB,IAAI,IAAI,EAC1B,qBAAqB,IAAI,OAAO,EAChC,KAAK,uBAAuB,IAAI,SAAS,EACzC,KAAK,mCAAmC,IAAI,qBAAqB,EACjE,KAAK,gCAAgC,IAAI,kBAAkB,EAC3D,KAAK,0BAA0B,IAAI,YAAY,EAC/C,KAAK,8BAA8B,IAAI,gBAAgB,EACvD,KAAK,yBAAyB,IAAI,WAAW,EAC7C,KAAK,wBAAwB,IAAI,UAAU,EAC3C,KAAK,8BAA8B,IAAI,gBAAgB,EACvD,KAAK,wBAAwB,IAAI,UAAU,EAC3C,KAAK,uBAAuB,IAAI,SAAS,EACzC,KAAK,0BAA0B,IAAI,YAAY,GAChD,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- export { CheckSelectBoxContent as Content, CheckSelectBoxDescription as Description, CheckSelectBoxGroup as Group, CheckSelectBoxLabel as Label, CheckSelectBoxRoot as Root } from './CheckSelectBox.js';
1
+ export { CheckSelectBoxBody as Body, CheckSelectBoxCheckmarkControl as CheckmarkControl, CheckSelectBoxCheckmarkIcon as CheckmarkIcon, CheckSelectBoxContent as Content, CheckSelectBoxDescription as Description, CheckSelectBoxFooter as Footer, CheckSelectBoxGroup as Group, CheckSelectBoxHiddenInput as HiddenInput, CheckSelectBoxLabel as Label, CheckSelectBoxRoot as Root, CheckSelectBoxTrigger as Trigger } from './CheckSelectBox.js';
@@ -3,36 +3,139 @@
3
3
 
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
+ const jsxRuntime = require('react/jsx-runtime');
7
+ const reactComposeRefs = require('@radix-ui/react-compose-refs');
6
8
  const selectBox = require('@seed-design/css/recipes/select-box');
7
9
  const selectBoxGroup = require('@seed-design/css/recipes/select-box-group');
10
+ const reactCollapsible = require('@seed-design/react-collapsible');
8
11
  const reactPrimitive = require('@seed-design/react-primitive');
9
12
  const reactRadioGroup = require('@seed-design/react-radio-group');
10
- const createRecipeContext = require('../../utils/createRecipeContext.cjs');
13
+ const React = require('react');
11
14
  const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
12
15
  const createWithStateProps = require('../../utils/createWithStateProps.cjs');
16
+ const clsx = require('clsx');
13
17
 
14
- const { withContext: withGroupContext } = createRecipeContext.createRecipeContext(selectBoxGroup.selectBoxGroup);
15
- const { withContext, withProvider } = createSlotRecipeContext.createSlotRecipeContext(selectBox.selectBox);
18
+ const { PropsProvider, ClassNamesProvider, withContext, useProps, useClassNames } = createSlotRecipeContext.createSlotRecipeContext(selectBox.selectBox);
16
19
  const withStateProps = createWithStateProps.createWithStateProps([reactRadioGroup.useRadioGroupItemContext]);
17
- const RadioSelectBoxRoot = withGroupContext(
18
- reactRadioGroup.RadioGroup.Root
20
+ const FooterContext = React.createContext(null);
21
+ const RadioSelectBoxGroup = React.forwardRef(
22
+ ({ columns = 1, className, style, ...props }, ref) => {
23
+ const [variantProps, otherProps] = selectBoxGroup.selectBoxGroup.splitVariantProps(props);
24
+ const recipeClassName = selectBoxGroup.selectBoxGroup(variantProps);
25
+ const layout = columns === 1 ? "horizontal" : "vertical";
26
+ return /* @__PURE__ */ jsxRuntime.jsx(PropsProvider, { value: { layout }, children: /* @__PURE__ */ jsxRuntime.jsx(
27
+ reactPrimitive.Primitive.div,
28
+ {
29
+ ref,
30
+ "data-columns": columns,
31
+ className: clsx(recipeClassName, className),
32
+ style: {
33
+ ...style,
34
+ "--seed-select-box-group--columns": columns
35
+ },
36
+ ...otherProps
37
+ }
38
+ ) });
39
+ }
19
40
  );
20
- const RadioSelectBoxItem = withProvider(
21
- reactRadioGroup.RadioGroup.Item,
22
- "root"
41
+ function FooterVisibilityProvider({
42
+ children,
43
+ footerVisibility
44
+ }) {
45
+ const { checked } = reactRadioGroup.useRadioGroupItemContext();
46
+ const collapsible = reactCollapsible.useCollapsible({
47
+ open: {
48
+ "when-selected": checked,
49
+ "when-not-selected": !checked
50
+ }[footerVisibility]
51
+ });
52
+ const [isFooterRendered, setIsFooterRendered] = React.useState(false);
53
+ const footerRef = React.useCallback((node) => {
54
+ setIsFooterRendered(!!node);
55
+ }, []);
56
+ return /* @__PURE__ */ jsxRuntime.jsx(reactCollapsible.CollapsibleProvider, { value: collapsible, children: /* @__PURE__ */ jsxRuntime.jsx(FooterContext.Provider, { value: { isFooterRendered, footerRef, footerVisibility }, children }) });
57
+ }
58
+ const RadioSelectBoxItem = React.forwardRef(
59
+ ({ footerVisibility = "when-selected", className, children, ...props }, ref) => {
60
+ const [variantProps, otherProps] = selectBox.selectBox.splitVariantProps(props);
61
+ const classNames = selectBox.selectBox({
62
+ ...useProps(),
63
+ ...variantProps
64
+ });
65
+ return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(
66
+ reactRadioGroup.RadioGroup.Item,
67
+ {
68
+ ref,
69
+ className: clsx(classNames.root, className),
70
+ ...otherProps,
71
+ children: footerVisibility === "always" ? children : /* @__PURE__ */ jsxRuntime.jsx(FooterVisibilityProvider, { footerVisibility, children })
72
+ }
73
+ ) });
74
+ }
75
+ );
76
+ const RadioSelectBoxTrigger = withContext(
77
+ withStateProps(reactPrimitive.Primitive.div),
78
+ "trigger"
23
79
  );
24
80
  const RadioSelectBoxContent = withContext(
25
81
  withStateProps(reactPrimitive.Primitive.div),
26
82
  "content"
27
83
  );
84
+ const RadioSelectBoxBody = withContext(
85
+ withStateProps(reactPrimitive.Primitive.div),
86
+ "body"
87
+ );
28
88
  const RadioSelectBoxLabel = withContext(
29
89
  withStateProps(reactPrimitive.Primitive.div),
30
90
  "label"
31
91
  );
32
92
  const RadioSelectBoxDescription = withContext(withStateProps(reactPrimitive.Primitive.div), "description");
93
+ const RadioSelectBoxHiddenInput = React.forwardRef((props, ref) => {
94
+ const collapsibleContext = reactCollapsible.useCollapsibleContext({ strict: false });
95
+ const footerContext = React.useContext(FooterContext);
96
+ const triggerAriaProps = footerContext?.isFooterRendered ? collapsibleContext?.triggerAriaProps : void 0;
97
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRadioGroup.RadioGroup.ItemHiddenInput, { ref, ...triggerAriaProps, ...props });
98
+ });
99
+ RadioSelectBoxHiddenInput.displayName = "RadioSelectBoxHiddenInput";
100
+ const RadioSelectBoxFooter = React.forwardRef(
101
+ ({ className, children, ...props }, ref) => {
102
+ const classNames = useClassNames();
103
+ const { stateProps } = reactRadioGroup.useRadioGroupItemContext();
104
+ const collapsibleContext = reactCollapsible.useCollapsibleContext({ strict: false });
105
+ const footerContext = React.useContext(FooterContext);
106
+ const composedRef = reactComposeRefs.composeRefs(ref, footerContext?.footerRef ?? null);
107
+ if (collapsibleContext) {
108
+ return /* @__PURE__ */ jsxRuntime.jsx(
109
+ reactCollapsible.Collapsible.Content,
110
+ {
111
+ ref: composedRef,
112
+ className: clsx(classNames.footer, className),
113
+ ...stateProps,
114
+ ...props,
115
+ children
116
+ }
117
+ );
118
+ }
119
+ return /* @__PURE__ */ jsxRuntime.jsx(
120
+ reactPrimitive.Primitive.div,
121
+ {
122
+ ref: composedRef,
123
+ className: clsx(classNames.footer, className),
124
+ ...stateProps,
125
+ ...props,
126
+ children
127
+ }
128
+ );
129
+ }
130
+ );
131
+ RadioSelectBoxFooter.displayName = "RadioSelectBoxFooter";
33
132
 
133
+ exports.RadioSelectBoxBody = RadioSelectBoxBody;
34
134
  exports.RadioSelectBoxContent = RadioSelectBoxContent;
35
135
  exports.RadioSelectBoxDescription = RadioSelectBoxDescription;
136
+ exports.RadioSelectBoxFooter = RadioSelectBoxFooter;
137
+ exports.RadioSelectBoxGroup = RadioSelectBoxGroup;
138
+ exports.RadioSelectBoxHiddenInput = RadioSelectBoxHiddenInput;
36
139
  exports.RadioSelectBoxItem = RadioSelectBoxItem;
37
140
  exports.RadioSelectBoxLabel = RadioSelectBoxLabel;
38
- exports.RadioSelectBoxRoot = RadioSelectBoxRoot;
141
+ exports.RadioSelectBoxTrigger = RadioSelectBoxTrigger;
@@ -1,19 +1,43 @@
1
+ import { SelectBoxVariantProps } from '@seed-design/css/recipes/select-box';
2
+ import { SelectBoxGroupVariantProps } from '@seed-design/css/recipes/select-box-group';
1
3
  import { PrimitiveProps } from '@seed-design/react-primitive';
2
4
  import { RadioGroup as RadioGroupPrimitive } from '@seed-design/react-radio-group';
3
5
  import { ForwardRefExoticComponent, RefAttributes } from 'react';
4
- export interface RadioSelectBoxRootProps extends RadioGroupPrimitive.RootProps {
6
+ export interface RadioSelectBoxGroupProps extends SelectBoxGroupVariantProps, PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
7
+ /**
8
+ * Number of columns in the grid layout. When bigger than 1, child `RadioSelectBoxItem` will have a default layout of "vertical".
9
+ * @default 1
10
+ */
11
+ columns?: number;
5
12
  }
6
- export declare const RadioSelectBoxRoot: ForwardRefExoticComponent<RadioSelectBoxRootProps & RefAttributes<HTMLDivElement>>;
7
- export interface RadioSelectBoxItemProps extends RadioGroupPrimitive.ItemProps {
13
+ export declare const RadioSelectBoxGroup: ForwardRefExoticComponent<RadioSelectBoxGroupProps & RefAttributes<HTMLDivElement>>;
14
+ export interface RadioSelectBoxItemProps extends SelectBoxVariantProps, RadioGroupPrimitive.ItemProps {
15
+ /**
16
+ * Controls when the footer is visible.
17
+ * @default "when-selected"
18
+ */
19
+ footerVisibility?: "when-selected" | "when-not-selected" | "always";
8
20
  }
9
21
  export declare const RadioSelectBoxItem: ForwardRefExoticComponent<RadioSelectBoxItemProps & RefAttributes<HTMLLabelElement>>;
22
+ export interface RadioSelectBoxTriggerProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
23
+ }
24
+ export declare const RadioSelectBoxTrigger: ForwardRefExoticComponent<RadioSelectBoxTriggerProps & RefAttributes<HTMLDivElement>>;
10
25
  export interface RadioSelectBoxContentProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
11
26
  }
12
27
  export declare const RadioSelectBoxContent: ForwardRefExoticComponent<RadioSelectBoxContentProps & RefAttributes<HTMLDivElement>>;
13
- export interface RadioSelectBoxLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {
28
+ export interface RadioSelectBoxBodyProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
29
+ }
30
+ export declare const RadioSelectBoxBody: ForwardRefExoticComponent<RadioSelectBoxBodyProps & RefAttributes<HTMLDivElement>>;
31
+ export interface RadioSelectBoxLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
32
+ }
33
+ export declare const RadioSelectBoxLabel: ForwardRefExoticComponent<RadioSelectBoxLabelProps & RefAttributes<HTMLDivElement>>;
34
+ export interface RadioSelectBoxDescriptionProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
35
+ }
36
+ export declare const RadioSelectBoxDescription: ForwardRefExoticComponent<RadioSelectBoxDescriptionProps & RefAttributes<HTMLDivElement>>;
37
+ export interface RadioSelectBoxHiddenInputProps extends RadioGroupPrimitive.ItemHiddenInputProps {
14
38
  }
15
- export declare const RadioSelectBoxLabel: ForwardRefExoticComponent<RadioSelectBoxLabelProps & RefAttributes<HTMLSpanElement>>;
16
- export interface RadioSelectBoxDescriptionProps extends PrimitiveProps, React.HTMLAttributes<HTMLSpanElement> {
39
+ export declare const RadioSelectBoxHiddenInput: ForwardRefExoticComponent<RadioSelectBoxHiddenInputProps & RefAttributes<HTMLInputElement>>;
40
+ export interface RadioSelectBoxFooterProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
17
41
  }
18
- export declare const RadioSelectBoxDescription: ForwardRefExoticComponent<RadioSelectBoxDescriptionProps & RefAttributes<HTMLSpanElement>>;
42
+ export declare const RadioSelectBoxFooter: ForwardRefExoticComponent<RadioSelectBoxFooterProps & RefAttributes<HTMLDivElement>>;
19
43
  //# sourceMappingURL=RadioSelectBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioSelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/RadioSelectBox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,C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