paris 0.24.0 → 0.25.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/CHANGELOG.md +50 -0
- package/README.md +2 -2
- package/dist/stories/accordion/Accordion.module.scss.js +1 -1
- package/dist/stories/accordionselect/{AccordionSelect.module.css → AccordionSelect.css} +3 -0
- package/dist/stories/accordionselect/AccordionSelect.d.ts +15 -14
- package/dist/stories/accordionselect/AccordionSelect.js +8 -3
- package/dist/stories/accordionselect/AccordionSelect.js.map +1 -1
- package/dist/stories/accordionselect/AccordionSelect.module.scss.js +1 -1
- package/dist/stories/avatar/Avatar.module.scss.js +1 -1
- package/dist/stories/button/{Button.module.css → Button.css} +17 -0
- package/dist/stories/button/Button.js +2 -1
- package/dist/stories/button/Button.js.map +1 -1
- package/dist/stories/button/Button.module.scss.js +6 -2
- package/dist/stories/button/Button.module.scss.js.map +1 -1
- package/dist/stories/callout/Callout.module.scss.js +1 -1
- package/dist/stories/card/Card.module.scss.js +1 -1
- package/dist/stories/cardbutton/{CardButton.module.css → CardButton.css} +1 -1
- package/dist/stories/cardbutton/CardButton.d.ts +9 -1
- package/dist/stories/cardbutton/CardButton.js +5 -2
- package/dist/stories/cardbutton/CardButton.js.map +1 -1
- package/dist/stories/cardbutton/CardButton.module.scss.js +1 -1
- package/dist/stories/checkbox/{Checkbox.module.css → Checkbox.css} +14 -0
- package/dist/stories/checkbox/Checkbox.d.ts +30 -2
- package/dist/stories/checkbox/Checkbox.js +91 -83
- package/dist/stories/checkbox/Checkbox.js.map +1 -1
- package/dist/stories/checkbox/Checkbox.module.scss.js +1 -1
- package/dist/stories/codeinput/CodeInput.d.ts +1 -2
- package/dist/stories/codeinput/CodeInput.js +100 -93
- package/dist/stories/codeinput/CodeInput.js.map +1 -1
- package/dist/stories/codeinput/CodeInput.module.scss.js +1 -1
- package/dist/stories/combobox/Combobox.d.ts +9 -4
- package/dist/stories/combobox/Combobox.js +13 -2
- package/dist/stories/combobox/Combobox.js.map +1 -1
- package/dist/stories/dialog/Dialog.module.scss.js +1 -1
- package/dist/stories/drawer/Drawer.d.ts +9 -0
- package/dist/stories/drawer/Drawer.js +11 -0
- package/dist/stories/drawer/Drawer.js.map +1 -1
- package/dist/stories/drawer/Drawer.module.scss.js +1 -1
- package/dist/stories/field/Field.js +6 -6
- package/dist/stories/field/Field.js.map +1 -1
- package/dist/stories/informationaltooltip/InformationalTooltip.module.scss.js +1 -1
- package/dist/stories/input/Input.d.ts +39 -2
- package/dist/stories/input/Input.js.map +1 -1
- package/dist/stories/input/Input.module.scss.js +1 -1
- package/dist/stories/markdown/Markdown.module.scss.js +1 -1
- package/dist/stories/markdowneditor/FixedToolbar.module.scss.js +1 -1
- package/dist/stories/markdowneditor/FloatingToolbar.module.scss.js +1 -1
- package/dist/stories/markdowneditor/LinkPopover.module.scss.js +1 -1
- package/dist/stories/markdowneditor/MarkdownEditor.d.ts +10 -2
- package/dist/stories/markdowneditor/MarkdownEditor.js +5 -4
- package/dist/stories/markdowneditor/MarkdownEditor.js.map +1 -1
- package/dist/stories/markdowneditor/MarkdownEditor.module.scss.js +1 -1
- package/dist/stories/markdowneditor/ToolbarButton.module.scss.js +1 -1
- package/dist/stories/menu/{Menu.module.css → Menu.css} +3 -0
- package/dist/stories/menu/Menu.d.ts +5 -2
- package/dist/stories/menu/Menu.js +4 -10
- package/dist/stories/menu/Menu.js.map +1 -1
- package/dist/stories/menu/Menu.module.scss.js +1 -1
- package/dist/stories/popover/Popover.module.scss.js +1 -1
- package/dist/stories/select/{Select.module.css → Select.css} +3 -0
- package/dist/stories/select/Select.d.ts +19 -14
- package/dist/stories/select/Select.js +249 -240
- package/dist/stories/select/Select.js.map +1 -1
- package/dist/stories/select/Select.module.scss.js +1 -1
- package/dist/stories/styledlink/StyledLink.module.scss.js +1 -1
- package/dist/stories/table/Table.module.scss.js +1 -1
- package/dist/stories/tabs/Tabs.d.ts +10 -4
- package/dist/stories/tabs/Tabs.js +1 -3
- package/dist/stories/tabs/Tabs.js.map +1 -1
- package/dist/stories/tabs/Tabs.module.scss.js +1 -1
- package/dist/stories/tag/Tag.module.scss.js +1 -1
- package/dist/stories/text/Text.module.scss.js +1 -1
- package/dist/stories/text/Typography.module.css.js +1 -1
- package/dist/stories/tilt/Tilt.module.scss.js +1 -1
- package/dist/stories/toast/Toast.module.scss.js +1 -1
- package/dist/stories/utility/TextWhenString.d.ts +3 -3
- package/dist/stories/utility/TextWhenString.js +2 -3
- package/dist/stories/utility/TextWhenString.js.map +1 -1
- package/dist/styles.css +41 -1
- package/package.json +2 -2
- /package/dist/stories/accordion/{Accordion.module.css → Accordion.css} +0 -0
- /package/dist/stories/avatar/{Avatar.module.css → Avatar.css} +0 -0
- /package/dist/stories/callout/{Callout.module.css → Callout.css} +0 -0
- /package/dist/stories/card/{Card.module.css → Card.css} +0 -0
- /package/dist/stories/codeinput/{CodeInput.module.css → CodeInput.css} +0 -0
- /package/dist/stories/dialog/{Dialog.module.css → Dialog.css} +0 -0
- /package/dist/stories/drawer/{Drawer.module.css → Drawer.css} +0 -0
- /package/dist/stories/informationaltooltip/{InformationalTooltip.module.css → InformationalTooltip.css} +0 -0
- /package/dist/stories/input/{Input.module.css → Input.css} +0 -0
- /package/dist/stories/markdown/{Markdown.module.css → Markdown.css} +0 -0
- /package/dist/stories/markdowneditor/{FixedToolbar.module.css → FixedToolbar.css} +0 -0
- /package/dist/stories/markdowneditor/{FloatingToolbar.module.css → FloatingToolbar.css} +0 -0
- /package/dist/stories/markdowneditor/{LinkPopover.module.css → LinkPopover.css} +0 -0
- /package/dist/stories/markdowneditor/{MarkdownEditor.module.css → MarkdownEditor.css} +0 -0
- /package/dist/stories/markdowneditor/{ToolbarButton.module.css → ToolbarButton.css} +0 -0
- /package/dist/stories/popover/{Popover.module.css → Popover.css} +0 -0
- /package/dist/stories/styledlink/{StyledLink.module.css → StyledLink.css} +0 -0
- /package/dist/stories/table/{Table.module.css → Table.css} +0 -0
- /package/dist/stories/tabs/{Tabs.module.css → Tabs.css} +0 -0
- /package/dist/stories/tag/{Tag.module.css → Tag.css} +0 -0
- /package/dist/stories/text/{Text.module.css → Text.css} +0 -0
- /package/dist/stories/text/{Typography.module.css → Typography.css} +0 -0
- /package/dist/stories/tilt/{Tilt.module.css → Tilt.css} +0 -0
- /package/dist/stories/toast/{Toast.module.css → Toast.css} +0 -0
|
@@ -19,265 +19,274 @@ import { theme, pget } from '../theme/themes.js';
|
|
|
19
19
|
import { TextWhenString } from '../utility/TextWhenString.js';
|
|
20
20
|
import styles from './Select.module.scss.js';
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const SelectRender = ({
|
|
23
|
+
options,
|
|
24
|
+
value,
|
|
25
|
+
defaultValue,
|
|
26
|
+
onChange,
|
|
27
|
+
label,
|
|
28
|
+
status,
|
|
29
|
+
hideLabel,
|
|
30
|
+
description,
|
|
31
|
+
hideDescription,
|
|
32
|
+
descriptionPosition,
|
|
33
|
+
placeholder,
|
|
34
|
+
startEnhancer,
|
|
35
|
+
endEnhancer,
|
|
36
|
+
disabled,
|
|
37
|
+
kind = "listbox",
|
|
38
|
+
maxHeight = 320,
|
|
39
|
+
hasOptionBorder = false,
|
|
40
|
+
multiple = false,
|
|
41
|
+
multipleItemsName,
|
|
42
|
+
segmentedHeight = "compact",
|
|
43
|
+
onOpenChange,
|
|
44
|
+
overrides
|
|
45
|
+
}, ref) => {
|
|
46
|
+
const inputID = useId();
|
|
47
|
+
const multiItems = multipleItemsName || "items";
|
|
48
|
+
const listboxButtonRef = ref;
|
|
49
|
+
const radioGroupRef = ref;
|
|
50
|
+
const [resolvedValue, setResolvedValue] = useControllableState({
|
|
25
51
|
value,
|
|
26
|
-
defaultValue,
|
|
27
|
-
onChange
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
endEnhancer,
|
|
37
|
-
disabled,
|
|
38
|
-
kind = "listbox",
|
|
39
|
-
maxHeight = 320,
|
|
40
|
-
hasOptionBorder = false,
|
|
41
|
-
multiple = false,
|
|
42
|
-
multipleItemsName,
|
|
43
|
-
segmentedHeight = "compact",
|
|
44
|
-
onOpenChange,
|
|
45
|
-
overrides
|
|
46
|
-
}, ref) => {
|
|
47
|
-
const inputID = useId();
|
|
48
|
-
const multiItems = multipleItemsName || "items";
|
|
49
|
-
const [resolvedValue, setResolvedValue] = useControllableState({
|
|
50
|
-
value,
|
|
51
|
-
defaultValue: defaultValue ?? (multiple ? [] : null),
|
|
52
|
-
onChange
|
|
53
|
-
});
|
|
54
|
-
const listboxValue = resolvedValue;
|
|
55
|
-
const listboxOnChange = setResolvedValue;
|
|
56
|
-
const singleValue = resolvedValue;
|
|
57
|
-
const singleOnChange = setResolvedValue;
|
|
58
|
-
const buttonText = () => {
|
|
59
|
-
if (!resolvedValue || resolvedValue.length === 0) {
|
|
60
|
-
return placeholder || "Select an option";
|
|
52
|
+
defaultValue: defaultValue ?? (multiple ? [] : null),
|
|
53
|
+
onChange: (next) => {
|
|
54
|
+
if (multiple) {
|
|
55
|
+
const ids = next ?? [];
|
|
56
|
+
const selected = ids.map((id) => options.find((o) => o.id === id)).filter((o) => Boolean(o));
|
|
57
|
+
onChange?.(selected.length ? selected : null);
|
|
58
|
+
} else {
|
|
59
|
+
const id = next;
|
|
60
|
+
const selected = id != null ? options.find((o) => o.id === id) ?? null : null;
|
|
61
|
+
onChange?.(selected);
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const listboxValue = resolvedValue;
|
|
66
|
+
const listboxOnChange = setResolvedValue;
|
|
67
|
+
const singleValue = resolvedValue;
|
|
68
|
+
const singleOnChange = setResolvedValue;
|
|
69
|
+
const buttonText = () => {
|
|
70
|
+
if (!resolvedValue || resolvedValue.length === 0) {
|
|
71
|
+
return placeholder || "Select an option";
|
|
72
|
+
}
|
|
73
|
+
if (!multiple) {
|
|
74
|
+
return options?.find((o) => o.id === resolvedValue)?.node;
|
|
75
|
+
}
|
|
76
|
+
if (resolvedValue && resolvedValue.length === 1) {
|
|
77
|
+
return options?.find((o) => o.id === resolvedValue[0])?.node;
|
|
78
|
+
}
|
|
79
|
+
if (resolvedValue.length === options.length) {
|
|
80
|
+
return `All ${multiItems}`;
|
|
81
|
+
}
|
|
82
|
+
return `${resolvedValue.length} ${multiItems}`;
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ jsxs(
|
|
85
|
+
Field,
|
|
86
|
+
{
|
|
87
|
+
htmlFor: inputID,
|
|
88
|
+
label,
|
|
89
|
+
hideLabel,
|
|
90
|
+
description,
|
|
91
|
+
hideDescription,
|
|
92
|
+
descriptionPosition,
|
|
93
|
+
disabled,
|
|
94
|
+
overrides: {
|
|
95
|
+
container: overrides?.container,
|
|
96
|
+
label: overrides?.label,
|
|
97
|
+
description: overrides?.description
|
|
98
|
+
},
|
|
99
|
+
children: [
|
|
100
|
+
kind === "listbox" && /* @__PURE__ */ jsx(Listbox, { as: "div", value: listboxValue, onChange: listboxOnChange, multiple, children: ({ open }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(OpenChangeEffect, { open, onOpenChange }),
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
ListboxButton,
|
|
104
|
+
{
|
|
105
|
+
ref: listboxButtonRef,
|
|
106
|
+
id: inputID,
|
|
107
|
+
...overrides?.selectInput,
|
|
108
|
+
"aria-disabled": disabled,
|
|
109
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
110
|
+
className: clsx(
|
|
111
|
+
overrides?.selectInput?.className,
|
|
112
|
+
inputStyles.inputContainer,
|
|
113
|
+
styles.listboxButton,
|
|
114
|
+
styles.field
|
|
115
|
+
),
|
|
116
|
+
children: [
|
|
117
|
+
!!startEnhancer && /* @__PURE__ */ jsx(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
...overrides?.startEnhancerContainer,
|
|
121
|
+
className: clsx(
|
|
122
|
+
inputStyles.enhancer,
|
|
123
|
+
overrides?.startEnhancerContainer?.className
|
|
124
|
+
),
|
|
125
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
126
|
+
children: !!startEnhancer && /* @__PURE__ */ jsx(
|
|
127
|
+
MemoizedEnhancer,
|
|
128
|
+
{
|
|
129
|
+
enhancer: startEnhancer,
|
|
130
|
+
size: parseInt(
|
|
131
|
+
pget("typography.styles.paragraphSmall.fontSize") || theme.typography.styles.paragraphSmall.fontSize,
|
|
132
|
+
10
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
103
137
|
),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
...overrides?.startEnhancerContainer,
|
|
109
|
-
className: clsx(
|
|
110
|
-
inputStyles.enhancer,
|
|
111
|
-
overrides?.startEnhancerContainer?.className
|
|
112
|
-
),
|
|
113
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
114
|
-
children: !!startEnhancer && /* @__PURE__ */ jsx(
|
|
115
|
-
MemoizedEnhancer,
|
|
116
|
-
{
|
|
117
|
-
enhancer: startEnhancer,
|
|
118
|
-
size: parseInt(
|
|
119
|
-
pget("typography.styles.paragraphSmall.fontSize") || theme.typography.styles.paragraphSmall.fontSize,
|
|
120
|
-
10
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
buttonText(),
|
|
127
|
-
endEnhancer ? /* @__PURE__ */ jsx(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
...overrides?.endEnhancerContainer,
|
|
131
|
-
className: clsx(
|
|
132
|
-
inputStyles.enhancer,
|
|
133
|
-
overrides?.endEnhancerContainer?.className
|
|
134
|
-
),
|
|
135
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
136
|
-
children: !!endEnhancer && /* @__PURE__ */ jsx(
|
|
137
|
-
MemoizedEnhancer,
|
|
138
|
-
{
|
|
139
|
-
enhancer: endEnhancer,
|
|
140
|
-
size: parseInt(
|
|
141
|
-
pget("typography.styles.paragraphSmall.fontSize") || theme.typography.styles.paragraphSmall.fontSize,
|
|
142
|
-
10
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
) : /* @__PURE__ */ jsx(
|
|
148
|
-
FontAwesomeIcon,
|
|
149
|
-
{
|
|
150
|
-
className: clsx(inputStyles.enhancer, styles.chevron),
|
|
151
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
152
|
-
width: "10px",
|
|
153
|
-
icon: faChevronDown
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
/* @__PURE__ */ jsx(
|
|
160
|
-
ListboxOptions,
|
|
161
|
-
{
|
|
162
|
-
anchor: "bottom start",
|
|
163
|
-
transition: true,
|
|
164
|
-
className: clsx(overrides?.optionsContainer, styles.options),
|
|
165
|
-
style: {
|
|
166
|
-
"--options-maxHeight": `${maxHeight}px`
|
|
167
|
-
},
|
|
168
|
-
children: (options || []).map((option) => /* @__PURE__ */ jsxs(
|
|
169
|
-
ListboxOption,
|
|
138
|
+
buttonText(),
|
|
139
|
+
endEnhancer ? /* @__PURE__ */ jsx(
|
|
140
|
+
"div",
|
|
170
141
|
{
|
|
171
|
-
|
|
142
|
+
...overrides?.endEnhancerContainer,
|
|
172
143
|
className: clsx(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
hasOptionBorder && styles.optionBorder
|
|
144
|
+
inputStyles.enhancer,
|
|
145
|
+
overrides?.endEnhancerContainer?.className
|
|
176
146
|
),
|
|
177
|
-
|
|
178
|
-
children:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
as: "div",
|
|
200
|
-
className: clsx(styles.radioOption),
|
|
201
|
-
value: option.id,
|
|
202
|
-
disabled: option.disabled || false,
|
|
203
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
204
|
-
children: [
|
|
205
|
-
/* @__PURE__ */ jsx("div", { className: styles.radioCircle }),
|
|
206
|
-
/* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphXSmall", children: option.node })
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
option.id
|
|
210
|
-
))
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
kind === "card" && /* @__PURE__ */ jsx(
|
|
214
|
-
RadioGroup,
|
|
215
|
-
{
|
|
216
|
-
ref,
|
|
217
|
-
as: "div",
|
|
218
|
-
className: styles.cardContainer,
|
|
219
|
-
value: singleValue,
|
|
220
|
-
onChange: singleOnChange,
|
|
221
|
-
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
222
|
-
Radio,
|
|
223
|
-
{
|
|
224
|
-
as: "div",
|
|
225
|
-
className: clsx(styles.cardOption),
|
|
226
|
-
value: option.id,
|
|
227
|
-
disabled: option.disabled || false,
|
|
228
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
229
|
-
children: /* @__PURE__ */ jsx(
|
|
230
|
-
"div",
|
|
231
|
-
{
|
|
232
|
-
className: clsx(styles.cardSurface, typeof option.node === "string" && styles.text),
|
|
233
|
-
children: /* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphSmall", children: option.node })
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
},
|
|
237
|
-
option.id
|
|
238
|
-
))
|
|
147
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
148
|
+
children: !!endEnhancer && /* @__PURE__ */ jsx(
|
|
149
|
+
MemoizedEnhancer,
|
|
150
|
+
{
|
|
151
|
+
enhancer: endEnhancer,
|
|
152
|
+
size: parseInt(
|
|
153
|
+
pget("typography.styles.paragraphSmall.fontSize") || theme.typography.styles.paragraphSmall.fontSize,
|
|
154
|
+
10
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
) : /* @__PURE__ */ jsx(
|
|
160
|
+
FontAwesomeIcon,
|
|
161
|
+
{
|
|
162
|
+
className: clsx(inputStyles.enhancer, styles.chevron),
|
|
163
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
164
|
+
width: "10px",
|
|
165
|
+
icon: faChevronDown
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
]
|
|
239
169
|
}
|
|
240
170
|
),
|
|
241
|
-
|
|
242
|
-
|
|
171
|
+
/* @__PURE__ */ jsx(
|
|
172
|
+
ListboxOptions,
|
|
243
173
|
{
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
className: styles.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
174
|
+
anchor: "bottom start",
|
|
175
|
+
transition: true,
|
|
176
|
+
className: clsx(overrides?.optionsContainer, styles.options),
|
|
177
|
+
style: {
|
|
178
|
+
"--options-maxHeight": `${maxHeight}px`
|
|
179
|
+
},
|
|
180
|
+
children: (options || []).map((option) => /* @__PURE__ */ jsxs(
|
|
181
|
+
ListboxOption,
|
|
251
182
|
{
|
|
252
|
-
as: "div",
|
|
253
|
-
className: clsx(styles.segmentedOption, styles[segmentedHeight]),
|
|
254
183
|
value: option.id,
|
|
184
|
+
className: clsx(
|
|
185
|
+
overrides?.option,
|
|
186
|
+
styles.option,
|
|
187
|
+
hasOptionBorder && styles.optionBorder
|
|
188
|
+
),
|
|
255
189
|
disabled: option.disabled || false,
|
|
256
|
-
"data-status": disabled ? "disabled" : status || "default",
|
|
257
190
|
children: [
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
{
|
|
261
|
-
className: styles.segmentedBackground,
|
|
262
|
-
layoutId: `${inputID}-segmented-selected`,
|
|
263
|
-
transition: {
|
|
264
|
-
ease: [0.42, 0, 0.58, 1],
|
|
265
|
-
duration: 0.25
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphXSmall", weight: "medium", className: styles.segmentedText, children: option.node })
|
|
191
|
+
typeof option.node === "string" ? /* @__PURE__ */ jsx(Text, { as: "span", kind: "paragraphSmall", children: option.node }) : option.node,
|
|
192
|
+
/* @__PURE__ */ jsx(Icon, { icon: Check, size: 12, className: styles.check })
|
|
270
193
|
]
|
|
271
194
|
},
|
|
272
195
|
option.id
|
|
273
196
|
))
|
|
274
197
|
}
|
|
275
198
|
)
|
|
276
|
-
]
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
199
|
+
] }) }),
|
|
200
|
+
kind === "radio" && /* @__PURE__ */ jsx(
|
|
201
|
+
RadioGroup,
|
|
202
|
+
{
|
|
203
|
+
ref: radioGroupRef,
|
|
204
|
+
as: "div",
|
|
205
|
+
tabIndex: -1,
|
|
206
|
+
className: styles.radioContainer,
|
|
207
|
+
value: singleValue,
|
|
208
|
+
onChange: singleOnChange,
|
|
209
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
210
|
+
Radio,
|
|
211
|
+
{
|
|
212
|
+
as: "div",
|
|
213
|
+
className: clsx(styles.radioOption),
|
|
214
|
+
value: option.id,
|
|
215
|
+
disabled: option.disabled || false,
|
|
216
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx("div", { className: styles.radioCircle }),
|
|
219
|
+
/* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphXSmall", children: option.node })
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
option.id
|
|
223
|
+
))
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
kind === "card" && /* @__PURE__ */ jsx(
|
|
227
|
+
RadioGroup,
|
|
228
|
+
{
|
|
229
|
+
ref: radioGroupRef,
|
|
230
|
+
as: "div",
|
|
231
|
+
tabIndex: -1,
|
|
232
|
+
className: styles.cardContainer,
|
|
233
|
+
value: singleValue,
|
|
234
|
+
onChange: singleOnChange,
|
|
235
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
236
|
+
Radio,
|
|
237
|
+
{
|
|
238
|
+
as: "div",
|
|
239
|
+
className: clsx(styles.cardOption),
|
|
240
|
+
value: option.id,
|
|
241
|
+
disabled: option.disabled || false,
|
|
242
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
243
|
+
children: /* @__PURE__ */ jsx("div", { className: clsx(styles.cardSurface, typeof option.node === "string" && styles.text), children: /* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphSmall", children: option.node }) })
|
|
244
|
+
},
|
|
245
|
+
option.id
|
|
246
|
+
))
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
kind === "segmented" && /* @__PURE__ */ jsx(
|
|
250
|
+
RadioGroup,
|
|
251
|
+
{
|
|
252
|
+
ref: radioGroupRef,
|
|
253
|
+
as: "div",
|
|
254
|
+
tabIndex: -1,
|
|
255
|
+
className: styles.segmentedContainer,
|
|
256
|
+
value: singleValue ?? options[0].id,
|
|
257
|
+
onChange: singleOnChange,
|
|
258
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
259
|
+
Radio,
|
|
260
|
+
{
|
|
261
|
+
as: "div",
|
|
262
|
+
className: clsx(styles.segmentedOption, styles[segmentedHeight]),
|
|
263
|
+
value: option.id,
|
|
264
|
+
disabled: option.disabled || false,
|
|
265
|
+
"data-status": disabled ? "disabled" : status || "default",
|
|
266
|
+
children: [
|
|
267
|
+
(option.id === resolvedValue || !resolvedValue && option.id === options[0].id) && /* @__PURE__ */ jsx(
|
|
268
|
+
motion.div,
|
|
269
|
+
{
|
|
270
|
+
className: styles.segmentedBackground,
|
|
271
|
+
layoutId: `${inputID}-segmented-selected`,
|
|
272
|
+
transition: {
|
|
273
|
+
ease: [0.42, 0, 0.58, 1],
|
|
274
|
+
duration: 0.25
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ jsx(TextWhenString, { kind: "paragraphXSmall", weight: "medium", className: styles.segmentedText, children: option.node })
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
option.id
|
|
282
|
+
))
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
const Select = forwardRef(SelectRender);
|
|
281
290
|
|
|
282
291
|
export { Select };
|
|
283
292
|
//# sourceMappingURL=Select.js.map
|