@panneau/ui 5.0.0-alpha.6 → 5.0.0-alpha.8
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/README.md +24 -1
- package/dist/alert/Alert.d.ts +2 -2
- package/dist/alert/Alert.js +108 -40
- package/dist/alert/Alert.js.map +1 -1
- package/dist/alert/tokens.d.ts +1 -1
- package/dist/alert/tokens.js.map +1 -1
- package/dist/badge/Badge.d.ts +1 -1
- package/dist/badge/Badge.js +34 -6
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/tokens.d.ts +1 -1
- package/dist/badge/tokens.js.map +1 -1
- package/dist/button/Button.d.ts +3 -3
- package/dist/button/Button.js +111 -17
- package/dist/button/Button.js.map +1 -1
- package/dist/button/tokens.d.ts +1 -1
- package/dist/button/tokens.js.map +1 -1
- package/dist/card/Card.js +76 -23
- package/dist/card/Card.js.map +1 -1
- package/dist/card/tokens.d.ts +1 -1
- package/dist/card/tokens.js.map +1 -1
- package/dist/checkbox/Checkbox.d.ts +1 -1
- package/dist/checkbox/Checkbox.js +86 -25
- package/dist/checkbox/Checkbox.js.map +1 -1
- package/dist/checkbox/ChoiceChrome.js +82 -21
- package/dist/checkbox/ChoiceChrome.js.map +1 -1
- package/dist/checkbox/tokens.d.ts +1 -1
- package/dist/checkbox/tokens.js.map +1 -1
- package/dist/combo-box/ComboBox.d.ts +1 -1
- package/dist/combo-box/ComboBox.js +291 -79
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/command-palette/CommandPalette.d.ts +1 -1
- package/dist/command-palette/CommandPalette.js +463 -160
- package/dist/command-palette/CommandPalette.js.map +1 -1
- package/dist/command-palette/match.d.ts +1 -1
- package/dist/command-palette/match.js.map +1 -1
- package/dist/command-palette/tokens.d.ts +1 -1
- package/dist/command-palette/tokens.js.map +1 -1
- package/dist/command-palette/useCommandShortcut.js +31 -12
- package/dist/command-palette/useCommandShortcut.js.map +1 -1
- package/dist/container/Container.js +48 -5
- package/dist/container/Container.js.map +1 -1
- package/dist/container/tokens.d.ts +1 -1
- package/dist/container/tokens.js.map +1 -1
- package/dist/date-picker/DatePicker.d.ts +1 -1
- package/dist/date-picker/DatePicker.js +234 -73
- package/dist/date-picker/DatePicker.js.map +1 -1
- package/dist/date-picker/calendarTokens.d.ts +1 -1
- package/dist/date-picker/calendarTokens.js.map +1 -1
- package/dist/dialog/Dialog.js +161 -45
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/tokens.d.ts +1 -1
- package/dist/dialog/tokens.js.map +1 -1
- package/dist/disclosure/Disclosure.js +132 -28
- package/dist/disclosure/Disclosure.js.map +1 -1
- package/dist/disclosure/tokens.d.ts +1 -1
- package/dist/disclosure/tokens.js.map +1 -1
- package/dist/divider/Divider.js +55 -11
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/tokens.d.ts +1 -1
- package/dist/divider/tokens.js.map +1 -1
- package/dist/field/FieldParts.d.ts +1 -1
- package/dist/field/FieldParts.js +69 -15
- package/dist/field/FieldParts.js.map +1 -1
- package/dist/field/Fieldset.js +99 -32
- package/dist/field/Fieldset.js.map +1 -1
- package/dist/field/inputTokens.d.ts +1 -1
- package/dist/field/inputTokens.js.map +1 -1
- package/dist/field/tokens.d.ts +1 -1
- package/dist/field/tokens.js.map +1 -1
- package/dist/grid/Grid.d.ts +1 -1
- package/dist/grid/Grid.js +123 -14
- package/dist/grid/Grid.js.map +1 -1
- package/dist/grid/tokens.d.ts +1 -1
- package/dist/grid/tokens.js.map +1 -1
- package/dist/heading/Heading.js +41 -6
- package/dist/heading/Heading.js.map +1 -1
- package/dist/heading/tokens.d.ts +1 -1
- package/dist/heading/tokens.js.map +1 -1
- package/dist/icon/Icon.js +36 -11
- package/dist/icon/Icon.js.map +1 -1
- package/dist/icon/lucideIconLoader.d.ts +1 -1
- package/dist/icon/lucideIconLoader.js.map +1 -1
- package/dist/icon/namedIcons.d.ts +1 -1
- package/dist/icon/namedIcons.js +87 -26
- package/dist/icon/namedIcons.js.map +1 -1
- package/dist/icon-button/IconButton.d.ts +2 -2
- package/dist/icon-button/IconButton.js +70 -13
- package/dist/icon-button/IconButton.js.map +1 -1
- package/dist/index.d.ts +61 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/inline/Inline.d.ts +1 -1
- package/dist/inline/Inline.js +65 -7
- package/dist/inline/Inline.js.map +1 -1
- package/dist/inline/tokens.d.ts +1 -1
- package/dist/inline/tokens.js.map +1 -1
- package/dist/intl/usePanneauIntl.js.map +1 -1
- package/dist/layout/responsive.js.map +1 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/menu/Menu.d.ts +1 -1
- package/dist/menu/Menu.js +170 -44
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/tokens.d.ts +1 -1
- package/dist/menu/tokens.js.map +1 -1
- package/dist/named-icons/index.d.ts +1 -1
- package/dist/number-input/NumberInput.d.ts +1 -1
- package/dist/number-input/NumberInput.js +232 -60
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/tokens.d.ts +1 -1
- package/dist/number-input/tokens.js.map +1 -1
- package/dist/pill-trigger/PillTrigger.js +76 -20
- package/dist/pill-trigger/PillTrigger.js.map +1 -1
- package/dist/pill-trigger/tokens.d.ts +1 -1
- package/dist/pill-trigger/tokens.js.map +1 -1
- package/dist/popover/Popover.js +109 -18
- package/dist/popover/Popover.js.map +1 -1
- package/dist/popover/tokens.d.ts +1 -1
- package/dist/popover/tokens.js.map +1 -1
- package/dist/prose/Prose.js +36 -5
- package/dist/prose/Prose.js.map +1 -1
- package/dist/prose/tokens.d.ts +1 -1
- package/dist/prose/tokens.js.map +1 -1
- package/dist/radio-group/RadioGroup.d.ts +2 -2
- package/dist/radio-group/RadioGroup.js +211 -61
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +1 -1
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/root/PanneauRoot.d.ts +9 -3
- package/dist/root/PanneauRoot.d.ts.map +1 -1
- package/dist/root/PanneauRoot.js +212 -49
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/ThemeScope.d.ts +1 -1
- package/dist/root/ThemeScope.js +107 -26
- package/dist/root/ThemeScope.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.d.ts +1 -1
- package/dist/segmented-control/SegmentedControl.js +120 -22
- package/dist/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/segmented-control/tokens.d.ts +1 -1
- package/dist/segmented-control/tokens.js.map +1 -1
- package/dist/select/Select.d.ts +1 -1
- package/dist/select/Select.js +298 -92
- package/dist/select/Select.js.map +1 -1
- package/dist/select/listBoxTokens.d.ts +1 -1
- package/dist/select/listBoxTokens.js.map +1 -1
- package/dist/skeleton/LoadingRegion.d.ts +16 -0
- package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
- package/dist/skeleton/LoadingRegion.js +65 -0
- package/dist/skeleton/LoadingRegion.js.map +1 -0
- package/dist/skeleton/Skeleton.css +62 -0
- package/dist/skeleton/Skeleton.d.ts +25 -0
- package/dist/skeleton/Skeleton.d.ts.map +1 -0
- package/dist/skeleton/Skeleton.js +106 -0
- package/dist/skeleton/Skeleton.js.map +1 -0
- package/dist/skeleton/Skeleton.module.js +22 -0
- package/dist/skeleton/Skeleton.module.js.map +1 -0
- package/dist/skeleton/tokens.d.ts +3 -0
- package/dist/skeleton/tokens.d.ts.map +1 -0
- package/dist/skeleton/tokens.js +15 -0
- package/dist/skeleton/tokens.js.map +1 -0
- package/dist/slider/Slider.d.ts +1 -1
- package/dist/slider/Slider.js +222 -44
- package/dist/slider/Slider.js.map +1 -1
- package/dist/spinner/Spinner.js +49 -9
- package/dist/spinner/Spinner.js.map +1 -1
- package/dist/spinner/tokens.d.ts +1 -1
- package/dist/spinner/tokens.js.map +1 -1
- package/dist/stack/Stack.d.ts +1 -1
- package/dist/stack/Stack.js +60 -7
- package/dist/stack/Stack.js.map +1 -1
- package/dist/stack/tokens.d.ts +1 -1
- package/dist/stack/tokens.js.map +1 -1
- package/dist/switch/Switch.d.ts +1 -1
- package/dist/switch/Switch.js +68 -11
- package/dist/switch/Switch.js.map +1 -1
- package/dist/switch/tokens.d.ts +1 -1
- package/dist/switch/tokens.js.map +1 -1
- package/dist/tabs/Tabs.js +1 -1
- package/dist/tabs/Tabs.js.map +1 -1
- package/dist/tabs/tokens.d.ts +1 -1
- package/dist/tabs/tokens.js.map +1 -1
- package/dist/tags-input/TagsInput.d.ts +1 -1
- package/dist/tags-input/TagsInput.js +277 -121
- package/dist/tags-input/TagsInput.js.map +1 -1
- package/dist/text/Text.d.ts +1 -1
- package/dist/text/Text.js +70 -5
- package/dist/text/Text.js.map +1 -1
- package/dist/text/tokens.d.ts +1 -1
- package/dist/text/tokens.js.map +1 -1
- package/dist/text-area/TextArea.d.ts +1 -1
- package/dist/text-area/TextArea.js +135 -28
- package/dist/text-area/TextArea.js.map +1 -1
- package/dist/text-input/TextInput.d.ts +1 -1
- package/dist/text-input/TextInput.js +164 -49
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/bootstrap.d.ts +2 -2
- package/dist/theme/bootstrap.js.map +1 -1
- package/dist/theme/chartColors.js.map +1 -1
- package/dist/theme/checkTheme.d.ts +2 -2
- package/dist/theme/checkTheme.js.map +1 -1
- package/dist/theme/cli.d.ts +2 -2
- package/dist/theme/cli.js.map +1 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/colorVision.d.ts +1 -1
- package/dist/theme/colorVision.js.map +1 -1
- package/dist/theme/componentTokens.js.map +1 -1
- package/dist/theme/components.d.ts +1 -0
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +2 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/defineTheme.d.ts +5 -5
- package/dist/theme/defineTheme.js.map +1 -1
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/index.d.ts +12 -12
- package/dist/theme/semanticTokens.js.map +1 -1
- package/dist/theme/theme.d.ts +2 -2
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/toneClass.d.ts +1 -1
- package/dist/theme/toneClass.js.map +1 -1
- package/dist/theme/tones.d.ts +1 -1
- package/dist/theme/tones.js.map +1 -1
- package/dist/time-input/TimeInput.d.ts +1 -1
- package/dist/time-input/TimeInput.js +138 -31
- package/dist/time-input/TimeInput.js.map +1 -1
- package/dist/toast/Toast.d.ts +1 -1
- package/dist/toast/Toast.js +1 -1
- package/dist/toast/Toast.js.map +1 -1
- package/dist/toast/tokens.d.ts +1 -1
- package/dist/toast/tokens.js.map +1 -1
- package/dist/tooltip/Tooltip.js +38 -8
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/tokens.d.ts +1 -1
- package/dist/tooltip/tokens.js.map +1 -1
- package/dist/utils/cx.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import { Icon } from "../icon/Icon.js";
|
|
3
3
|
import SegmentedControl_module_default from "./SegmentedControl.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { useState } from "react";
|
|
@@ -10,33 +11,130 @@ import { useState } from "react";
|
|
|
10
11
|
* than four or five choices, or long labels, use a `Select`. It is a radio group for assistive
|
|
11
12
|
* technologies, moved through with the arrow keys.
|
|
12
13
|
*/
|
|
13
|
-
function SegmentedControl(
|
|
14
|
-
const
|
|
14
|
+
function SegmentedControl(t0) {
|
|
15
|
+
const $ = c(37);
|
|
16
|
+
let className;
|
|
17
|
+
let defaultValue;
|
|
18
|
+
let isDisabled;
|
|
19
|
+
let onChange;
|
|
20
|
+
let options;
|
|
21
|
+
let props;
|
|
22
|
+
let segmentClassName;
|
|
23
|
+
let t1;
|
|
24
|
+
let t2;
|
|
25
|
+
let value;
|
|
26
|
+
if ($[0] !== t0) {
|
|
27
|
+
({options, value, defaultValue, onChange, size: t1, fullWidth: t2, isDisabled, className, segmentClassName, ...props} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = className;
|
|
30
|
+
$[2] = defaultValue;
|
|
31
|
+
$[3] = isDisabled;
|
|
32
|
+
$[4] = onChange;
|
|
33
|
+
$[5] = options;
|
|
34
|
+
$[6] = props;
|
|
35
|
+
$[7] = segmentClassName;
|
|
36
|
+
$[8] = t1;
|
|
37
|
+
$[9] = t2;
|
|
38
|
+
$[10] = value;
|
|
39
|
+
} else {
|
|
40
|
+
className = $[1];
|
|
41
|
+
defaultValue = $[2];
|
|
42
|
+
isDisabled = $[3];
|
|
43
|
+
onChange = $[4];
|
|
44
|
+
options = $[5];
|
|
45
|
+
props = $[6];
|
|
46
|
+
segmentClassName = $[7];
|
|
47
|
+
t1 = $[8];
|
|
48
|
+
t2 = $[9];
|
|
49
|
+
value = $[10];
|
|
50
|
+
}
|
|
51
|
+
const size = t1 === void 0 ? "md" : t1;
|
|
52
|
+
const fullWidth = t2 === void 0 ? false : t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[11] !== defaultValue || $[12] !== options) {
|
|
55
|
+
t3 = () => defaultValue ?? options.find(_temp)?.value;
|
|
56
|
+
$[11] = defaultValue;
|
|
57
|
+
$[12] = options;
|
|
58
|
+
$[13] = t3;
|
|
59
|
+
} else t3 = $[13];
|
|
60
|
+
const [uncontrolled, setUncontrolled] = useState(t3);
|
|
15
61
|
const selected = value ?? uncontrolled;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[14] !== selected) {
|
|
64
|
+
t4 = selected !== void 0 ? [selected] : [];
|
|
65
|
+
$[14] = selected;
|
|
66
|
+
$[15] = t4;
|
|
67
|
+
} else t4 = $[15];
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[16] !== onChange || $[17] !== selected) {
|
|
70
|
+
t5 = (keys) => {
|
|
23
71
|
const [key] = [...keys];
|
|
24
72
|
if (key === void 0 || String(key) === selected) return;
|
|
25
73
|
setUncontrolled(String(key));
|
|
26
74
|
onChange?.(String(key));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
};
|
|
76
|
+
$[16] = onChange;
|
|
77
|
+
$[17] = selected;
|
|
78
|
+
$[18] = t5;
|
|
79
|
+
} else t5 = $[18];
|
|
80
|
+
const t6 = SegmentedControl_module_default[size];
|
|
81
|
+
const t7 = fullWidth && SegmentedControl_module_default.fullWidth;
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[19] !== className || $[20] !== t6 || $[21] !== t7) {
|
|
84
|
+
t8 = cx("panneau-segmented-control", SegmentedControl_module_default.group, t6, t7, className);
|
|
85
|
+
$[19] = className;
|
|
86
|
+
$[20] = t6;
|
|
87
|
+
$[21] = t7;
|
|
88
|
+
$[22] = t8;
|
|
89
|
+
} else t8 = $[22];
|
|
90
|
+
let t9;
|
|
91
|
+
if ($[23] !== options || $[24] !== segmentClassName || $[25] !== size) {
|
|
92
|
+
let t10;
|
|
93
|
+
if ($[27] !== segmentClassName || $[28] !== size) {
|
|
94
|
+
t10 = (option_0) => /* @__PURE__ */ jsxs(ToggleButton, {
|
|
95
|
+
id: option_0.value,
|
|
96
|
+
isDisabled: option_0.isDisabled,
|
|
97
|
+
...option_0.textValue !== void 0 ? { "aria-label": option_0.textValue } : {},
|
|
98
|
+
className: cx("panneau-segment", SegmentedControl_module_default.segment, segmentClassName),
|
|
99
|
+
children: [option_0.icon !== void 0 ? /* @__PURE__ */ jsx(Icon, {
|
|
100
|
+
icon: option_0.icon,
|
|
101
|
+
size: size === "sm" ? "sm" : "md"
|
|
102
|
+
}) : null, option_0.label]
|
|
103
|
+
}, option_0.value);
|
|
104
|
+
$[27] = segmentClassName;
|
|
105
|
+
$[28] = size;
|
|
106
|
+
$[29] = t10;
|
|
107
|
+
} else t10 = $[29];
|
|
108
|
+
t9 = options.map(t10);
|
|
109
|
+
$[23] = options;
|
|
110
|
+
$[24] = segmentClassName;
|
|
111
|
+
$[25] = size;
|
|
112
|
+
$[26] = t9;
|
|
113
|
+
} else t9 = $[26];
|
|
114
|
+
let t10;
|
|
115
|
+
if ($[30] !== isDisabled || $[31] !== props || $[32] !== t4 || $[33] !== t5 || $[34] !== t8 || $[35] !== t9) {
|
|
116
|
+
t10 = /* @__PURE__ */ jsx(ToggleButtonGroup, {
|
|
117
|
+
...props,
|
|
118
|
+
selectionMode: "single",
|
|
119
|
+
disallowEmptySelection: true,
|
|
120
|
+
isDisabled,
|
|
121
|
+
selectedKeys: t4,
|
|
122
|
+
onSelectionChange: t5,
|
|
123
|
+
className: t8,
|
|
124
|
+
children: t9
|
|
125
|
+
});
|
|
126
|
+
$[30] = isDisabled;
|
|
127
|
+
$[31] = props;
|
|
128
|
+
$[32] = t4;
|
|
129
|
+
$[33] = t5;
|
|
130
|
+
$[34] = t8;
|
|
131
|
+
$[35] = t9;
|
|
132
|
+
$[36] = t10;
|
|
133
|
+
} else t10 = $[36];
|
|
134
|
+
return t10;
|
|
135
|
+
}
|
|
136
|
+
function _temp(option) {
|
|
137
|
+
return option.isDisabled !== true;
|
|
40
138
|
}
|
|
41
139
|
//#endregion
|
|
42
140
|
export { SegmentedControl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.js","names":["option","styles"],"sources":["../../src/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { ToggleButton, ToggleButtonGroup } from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { cx } from '../utils/cx';\nimport styles from './SegmentedControl.module.css';\n\n/** One choice of a segmented control. */\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** Text for typeahead and assistive technologies, when `label` isn't a string. */\n textValue?: string;\n icon?: IconComponent;\n isDisabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: readonly SegmentedControlOption[];\n /** The selected option. Controlled with `onChange`. */\n value?: string;\n /** The option selected first, when uncontrolled. Defaults to the first one. */\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Accessible name of the group. Without a visible label, it is required. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n size?: 'sm' | 'md';\n /** Takes the width of its container, with segments of equal width. */\n fullWidth?: boolean;\n isDisabled?: boolean;\n className?: string;\n segmentClassName?: string;\n}\n\n/**\n * A row of a few choices, one of which is always selected: a view, a mode, a library. For more\n * than four or five choices, or long labels, use a `Select`. It is a radio group for assistive\n * technologies, moved through with the arrow keys.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = 'md',\n fullWidth = false,\n isDisabled,\n className,\n segmentClassName,\n ...props\n}: SegmentedControlProps) {\n const [uncontrolled, setUncontrolled] = useState(\n () => defaultValue ?? options.find((option) => option.isDisabled !== true)?.value,\n );\n const selected = value ?? uncontrolled;\n return (\n <ToggleButtonGroup\n {...props}\n selectionMode=\"single\"\n disallowEmptySelection\n isDisabled={isDisabled}\n selectedKeys={selected !== undefined ? [selected] : []}\n onSelectionChange={(keys) => {\n const [key] = [...keys];\n // React Aria reports the selected segment again when it is pressed.\n if (key === undefined || String(key) === selected) {\n return;\n }\n setUncontrolled(String(key));\n onChange?.(String(key));\n }}\n className={cx(\n 'panneau-segmented-control',\n styles.group,\n styles[size],\n fullWidth && styles.fullWidth,\n className,\n )}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n {...(option.textValue !== undefined ? { 'aria-label': option.textValue } : {})}\n className={cx('panneau-segment', styles.segment, segmentClassName)}\n >\n {option.icon !== undefined ? (\n <Icon icon={option.icon} size={size === 'sm' ? 'sm' : 'md'} />\n ) : null}\n {option.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","names":["ReactNode","useState","ToggleButton","ToggleButtonGroup","Icon","IconComponent","cx","styles","SegmentedControlOption","value","label","textValue","icon","isDisabled","SegmentedControlProps","options","defaultValue","onChange","size","fullWidth","className","segmentClassName","SegmentedControl","t0","$","_c","props","t1","t2","undefined","t3","find","_temp","uncontrolled","setUncontrolled","selected","t4","t5","keys","key","String","t6","t7","t8","group","t9","t10","option_0","option","segment","map","_c","styles"],"sources":["../../src/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { ToggleButton, ToggleButtonGroup } from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { cx } from '../utils/cx';\nimport styles from './SegmentedControl.module.css';\n\n/** One choice of a segmented control. */\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** Text for typeahead and assistive technologies, when `label` isn't a string. */\n textValue?: string;\n icon?: IconComponent;\n isDisabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: readonly SegmentedControlOption[];\n /** The selected option. Controlled with `onChange`. */\n value?: string;\n /** The option selected first, when uncontrolled. Defaults to the first one. */\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Accessible name of the group. Without a visible label, it is required. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n size?: 'sm' | 'md';\n /** Takes the width of its container, with segments of equal width. */\n fullWidth?: boolean;\n isDisabled?: boolean;\n className?: string;\n segmentClassName?: string;\n}\n\n/**\n * A row of a few choices, one of which is always selected: a view, a mode, a library. For more\n * than four or five choices, or long labels, use a `Select`. It is a radio group for assistive\n * technologies, moved through with the arrow keys.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = 'md',\n fullWidth = false,\n isDisabled,\n className,\n segmentClassName,\n ...props\n}: SegmentedControlProps) {\n const [uncontrolled, setUncontrolled] = useState(\n () => defaultValue ?? options.find((option) => option.isDisabled !== true)?.value,\n );\n const selected = value ?? uncontrolled;\n return (\n <ToggleButtonGroup\n {...props}\n selectionMode=\"single\"\n disallowEmptySelection\n isDisabled={isDisabled}\n selectedKeys={selected !== undefined ? [selected] : []}\n onSelectionChange={(keys) => {\n const [key] = [...keys];\n // React Aria reports the selected segment again when it is pressed.\n if (key === undefined || String(key) === selected) {\n return;\n }\n setUncontrolled(String(key));\n onChange?.(String(key));\n }}\n className={cx(\n 'panneau-segmented-control',\n styles.group,\n styles[size],\n fullWidth && styles.fullWidth,\n className,\n )}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n {...(option.textValue !== undefined ? { 'aria-label': option.textValue } : {})}\n className={cx('panneau-segment', styles.segment, segmentClassName)}\n >\n {option.icon !== undefined ? (\n <Icon icon={option.icon} size={size === 'sm' ? 'sm' : 'md'} />\n ) : null}\n {option.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Tokens of SegmentedControl. */
|
|
2
|
-
export declare const segmentedControlTokens: import("
|
|
2
|
+
export declare const segmentedControlTokens: import("../index.js").ComponentTokens<"segmented-control", "panneau-segmented-control-radius" | "panneau-segmented-control-padding" | "panneau-segmented-control-bg" | "panneau-segmented-control-border-color" | "panneau-segmented-control-segment-padding-x" | "panneau-segmented-control-segment-font-weight" | "panneau-segmented-control-segment-color" | "panneau-segmented-control-segment-color-selected" | "panneau-segmented-control-segment-bg-selected" | "panneau-segmented-control-segment-shadow-selected">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/segmented-control/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of SegmentedControl. */\nexport const segmentedControlTokens = defineComponentTokens('segmented-control', {\n /** Background of the group, behind the segments. */\n bg: 'var(--panneau-color-surface-sunken)',\n /** Color of the border around the group. */\n 'border-color': 'var(--panneau-color-border)',\n /** Corner radius of the group. */\n radius: 'var(--panneau-radius-md)',\n /** Space between the group's border and its segments. */\n padding: '2px',\n /** Horizontal padding of a segment. */\n 'segment-padding-x': 'var(--panneau-space-3)',\n /** Font weight of a segment. */\n 'segment-font-weight': 'var(--panneau-font-weight-medium)',\n /** Text color of a segment. */\n 'segment-color': 'var(--panneau-color-text-muted)',\n /** Text color of the selected segment, and of a hovered one. */\n 'segment-color-selected': 'var(--panneau-color-text)',\n /** Background of the selected segment. */\n 'segment-bg-selected': 'var(--panneau-color-surface-raised)',\n /** Shadow of the selected segment. */\n 'segment-shadow-selected': 'var(--panneau-shadow-sm)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","segmentedControlTokens","bg","radius","padding"],"sources":["../../src/segmented-control/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of SegmentedControl. */\nexport const segmentedControlTokens = defineComponentTokens('segmented-control', {\n /** Background of the group, behind the segments. */\n bg: 'var(--panneau-color-surface-sunken)',\n /** Color of the border around the group. */\n 'border-color': 'var(--panneau-color-border)',\n /** Corner radius of the group. */\n radius: 'var(--panneau-radius-md)',\n /** Space between the group's border and its segments. */\n padding: '2px',\n /** Horizontal padding of a segment. */\n 'segment-padding-x': 'var(--panneau-space-3)',\n /** Font weight of a segment. */\n 'segment-font-weight': 'var(--panneau-font-weight-medium)',\n /** Text color of a segment. */\n 'segment-color': 'var(--panneau-color-text-muted)',\n /** Text color of the selected segment, and of a hovered one. */\n 'segment-color-selected': 'var(--panneau-color-text)',\n /** Background of the selected segment. */\n 'segment-bg-selected': 'var(--panneau-color-surface-raised)',\n /** Shadow of the selected segment. */\n 'segment-shadow-selected': 'var(--panneau-shadow-sm)',\n});\n"],"mappings":";;;AAGA,IAAaC,yBAAyBD,sBAAsB,qBAAqB;;CAE7EE,IAAI;;CAEJ,gBAAgB;;CAEhBC,QAAQ;;CAERC,SAAS;;CAET,qBAAqB;;CAErB,uBAAuB;;CAEvB,iBAAiB;;CAEjB,0BAA0B;;CAE1B,uBAAuB;;CAEvB,2BAA2B;AAC/B,CAAC"}
|
package/dist/select/Select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FieldChromeProps } from '../field/FieldParts';
|
|
1
|
+
import { type FieldChromeProps } from '../field/FieldParts.js';
|
|
2
2
|
/** The value of an option. */
|
|
3
3
|
export type OptionValue = string | number | boolean;
|
|
4
4
|
/** A choice of a select, a radio group or a combo box. Same shape as the protocol's `Option`. */
|
package/dist/select/Select.js
CHANGED
|
@@ -6,6 +6,7 @@ import Field_module_default from "../field/Field.module.js";
|
|
|
6
6
|
import { FieldDescription, FieldErrors, FieldLabel } from "../field/FieldParts.js";
|
|
7
7
|
import { PopoverSurface } from "../popover/Popover.js";
|
|
8
8
|
import ListBox_module_default from "./ListBox.module.js";
|
|
9
|
+
import { c } from "react/compiler-runtime";
|
|
9
10
|
import { Check, ChevronDown } from "lucide-react";
|
|
10
11
|
import { Button, ListBox, ListBoxItem, Select, SelectValue, Text } from "react-aria-components";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -24,111 +25,316 @@ function valueOf(options, key) {
|
|
|
24
25
|
* numbers or booleans. Unless `isRequired`, a single select has an empty choice first.
|
|
25
26
|
*/
|
|
26
27
|
function Select$1(props) {
|
|
28
|
+
const $ = c(86);
|
|
27
29
|
const intl = usePanneauIntl();
|
|
28
|
-
const { options, label, description, errors
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
const { options, label, description, errors: t0, isRequired: t1, isDisabled, name, autoFocus, onBlur, id, className, labelClassName, descriptionClassName, errorsClassName, triggerClassName, popoverClassName } = props;
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[0] !== t0) {
|
|
33
|
+
t2 = t0 === void 0 ? [] : t0;
|
|
34
|
+
$[0] = t0;
|
|
35
|
+
$[1] = t2;
|
|
36
|
+
} else t2 = $[1];
|
|
37
|
+
const errors = t2;
|
|
38
|
+
const isRequired = t1 === void 0 ? false : t1;
|
|
39
|
+
let T0;
|
|
40
|
+
let T1;
|
|
41
|
+
let shared;
|
|
42
|
+
let t10;
|
|
43
|
+
let t3;
|
|
44
|
+
let t4;
|
|
45
|
+
let t5;
|
|
46
|
+
let t6;
|
|
47
|
+
let t7;
|
|
48
|
+
let t8;
|
|
49
|
+
let t9;
|
|
50
|
+
if ($[2] !== autoFocus || $[3] !== className || $[4] !== description || $[5] !== descriptionClassName || $[6] !== errors || $[7] !== errorsClassName || $[8] !== id || $[9] !== intl || $[10] !== isDisabled || $[11] !== isRequired || $[12] !== label || $[13] !== labelClassName || $[14] !== name || $[15] !== onBlur || $[16] !== options || $[17] !== popoverClassName || $[18] !== props || $[19] !== triggerClassName) {
|
|
51
|
+
const placeholder = props.placeholder ?? intl.formatMessage(messages.selectPlaceholder);
|
|
52
|
+
const invalid = errors.length > 0;
|
|
53
|
+
const items = options.map(_temp);
|
|
54
|
+
const withEmpty = props.multiple !== true && !isRequired;
|
|
55
|
+
let t11;
|
|
56
|
+
if ($[31] !== onBlur) {
|
|
57
|
+
t11 = onBlur !== void 0 ? () => onBlur() : void 0;
|
|
58
|
+
$[31] = onBlur;
|
|
59
|
+
$[32] = t11;
|
|
60
|
+
} else t11 = $[32];
|
|
61
|
+
shared = {
|
|
62
|
+
id,
|
|
63
|
+
name,
|
|
64
|
+
autoFocus,
|
|
65
|
+
isDisabled,
|
|
51
66
|
isRequired,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
isInvalid: invalid,
|
|
68
|
+
placeholder,
|
|
69
|
+
"aria-label": props["aria-label"],
|
|
70
|
+
validationBehavior: "aria",
|
|
71
|
+
onBlur: t11,
|
|
72
|
+
disabledKeys: items.filter(_temp2).map(_temp3),
|
|
73
|
+
className: cx("panneau-select", Field_module_default.field, className)
|
|
74
|
+
};
|
|
75
|
+
if ($[33] !== isRequired || $[34] !== label || $[35] !== labelClassName) {
|
|
76
|
+
t7 = /* @__PURE__ */ jsx(FieldLabel, {
|
|
77
|
+
isRequired,
|
|
78
|
+
className: labelClassName,
|
|
79
|
+
children: label
|
|
80
|
+
});
|
|
81
|
+
$[33] = isRequired;
|
|
82
|
+
$[34] = label;
|
|
83
|
+
$[35] = labelClassName;
|
|
84
|
+
$[36] = t7;
|
|
85
|
+
} else t7 = $[36];
|
|
86
|
+
let t12;
|
|
87
|
+
if ($[37] !== triggerClassName) {
|
|
88
|
+
t12 = cx(Field_module_default.control, ListBox_module_default.trigger, triggerClassName);
|
|
89
|
+
$[37] = triggerClassName;
|
|
90
|
+
$[38] = t12;
|
|
91
|
+
} else t12 = $[38];
|
|
92
|
+
let t13;
|
|
93
|
+
let t14;
|
|
94
|
+
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
|
|
95
|
+
t13 = /* @__PURE__ */ jsx(SelectValue, { className: ListBox_module_default.value });
|
|
96
|
+
t14 = /* @__PURE__ */ jsx(Icon, {
|
|
58
97
|
icon: ChevronDown,
|
|
59
98
|
className: ListBox_module_default.chevron
|
|
99
|
+
});
|
|
100
|
+
$[39] = t13;
|
|
101
|
+
$[40] = t14;
|
|
102
|
+
} else {
|
|
103
|
+
t13 = $[39];
|
|
104
|
+
t14 = $[40];
|
|
105
|
+
}
|
|
106
|
+
if ($[41] !== t12) {
|
|
107
|
+
t8 = /* @__PURE__ */ jsxs(Button, {
|
|
108
|
+
className: t12,
|
|
109
|
+
children: [t13, t14]
|
|
110
|
+
});
|
|
111
|
+
$[41] = t12;
|
|
112
|
+
$[42] = t8;
|
|
113
|
+
} else t8 = $[42];
|
|
114
|
+
if ($[43] !== description || $[44] !== descriptionClassName) {
|
|
115
|
+
t9 = /* @__PURE__ */ jsx(FieldDescription, {
|
|
116
|
+
className: descriptionClassName,
|
|
117
|
+
children: description
|
|
118
|
+
});
|
|
119
|
+
$[43] = description;
|
|
120
|
+
$[44] = descriptionClassName;
|
|
121
|
+
$[45] = t9;
|
|
122
|
+
} else t9 = $[45];
|
|
123
|
+
if ($[46] !== errors || $[47] !== errorsClassName) {
|
|
124
|
+
t10 = /* @__PURE__ */ jsx(FieldErrors, {
|
|
125
|
+
errors,
|
|
126
|
+
className: errorsClassName
|
|
127
|
+
});
|
|
128
|
+
$[46] = errors;
|
|
129
|
+
$[47] = errorsClassName;
|
|
130
|
+
$[48] = t10;
|
|
131
|
+
} else t10 = $[48];
|
|
132
|
+
T1 = PopoverSurface;
|
|
133
|
+
t6 = popoverClassName;
|
|
134
|
+
T0 = ListBox;
|
|
135
|
+
t3 = ListBox_module_default.listBox;
|
|
136
|
+
t4 = withEmpty ? /* @__PURE__ */ jsxs(ListBoxItem, {
|
|
137
|
+
id: EMPTY_KEY,
|
|
138
|
+
textValue: placeholder,
|
|
139
|
+
className: ListBox_module_default.item,
|
|
140
|
+
children: [/* @__PURE__ */ jsx("span", { className: ListBox_module_default.check }), /* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: ListBox_module_default.placeholder,
|
|
142
|
+
children: placeholder
|
|
60
143
|
})]
|
|
61
|
-
})
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
144
|
+
}) : null;
|
|
145
|
+
t5 = items.map(_temp4);
|
|
146
|
+
$[2] = autoFocus;
|
|
147
|
+
$[3] = className;
|
|
148
|
+
$[4] = description;
|
|
149
|
+
$[5] = descriptionClassName;
|
|
150
|
+
$[6] = errors;
|
|
151
|
+
$[7] = errorsClassName;
|
|
152
|
+
$[8] = id;
|
|
153
|
+
$[9] = intl;
|
|
154
|
+
$[10] = isDisabled;
|
|
155
|
+
$[11] = isRequired;
|
|
156
|
+
$[12] = label;
|
|
157
|
+
$[13] = labelClassName;
|
|
158
|
+
$[14] = name;
|
|
159
|
+
$[15] = onBlur;
|
|
160
|
+
$[16] = options;
|
|
161
|
+
$[17] = popoverClassName;
|
|
162
|
+
$[18] = props;
|
|
163
|
+
$[19] = triggerClassName;
|
|
164
|
+
$[20] = T0;
|
|
165
|
+
$[21] = T1;
|
|
166
|
+
$[22] = shared;
|
|
167
|
+
$[23] = t10;
|
|
168
|
+
$[24] = t3;
|
|
169
|
+
$[25] = t4;
|
|
170
|
+
$[26] = t5;
|
|
171
|
+
$[27] = t6;
|
|
172
|
+
$[28] = t7;
|
|
173
|
+
$[29] = t8;
|
|
174
|
+
$[30] = t9;
|
|
175
|
+
} else {
|
|
176
|
+
T0 = $[20];
|
|
177
|
+
T1 = $[21];
|
|
178
|
+
shared = $[22];
|
|
179
|
+
t10 = $[23];
|
|
180
|
+
t3 = $[24];
|
|
181
|
+
t4 = $[25];
|
|
182
|
+
t5 = $[26];
|
|
183
|
+
t6 = $[27];
|
|
184
|
+
t7 = $[28];
|
|
185
|
+
t8 = $[29];
|
|
186
|
+
t9 = $[30];
|
|
187
|
+
}
|
|
188
|
+
let t11;
|
|
189
|
+
if ($[49] !== T0 || $[50] !== t3 || $[51] !== t4 || $[52] !== t5) {
|
|
190
|
+
t11 = /* @__PURE__ */ jsxs(T0, {
|
|
191
|
+
className: t3,
|
|
192
|
+
children: [t4, t5]
|
|
193
|
+
});
|
|
194
|
+
$[49] = T0;
|
|
195
|
+
$[50] = t3;
|
|
196
|
+
$[51] = t4;
|
|
197
|
+
$[52] = t5;
|
|
198
|
+
$[53] = t11;
|
|
199
|
+
} else t11 = $[53];
|
|
200
|
+
let t12;
|
|
201
|
+
if ($[54] !== T1 || $[55] !== t11 || $[56] !== t6) {
|
|
202
|
+
t12 = /* @__PURE__ */ jsx(T1, {
|
|
203
|
+
className: t6,
|
|
204
|
+
children: t11
|
|
205
|
+
});
|
|
206
|
+
$[54] = T1;
|
|
207
|
+
$[55] = t11;
|
|
208
|
+
$[56] = t6;
|
|
209
|
+
$[57] = t12;
|
|
210
|
+
} else t12 = $[57];
|
|
211
|
+
let t13;
|
|
212
|
+
if ($[58] !== t10 || $[59] !== t12 || $[60] !== t7 || $[61] !== t8 || $[62] !== t9) {
|
|
213
|
+
t13 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
214
|
+
t7,
|
|
215
|
+
t8,
|
|
216
|
+
t9,
|
|
217
|
+
t10,
|
|
218
|
+
t12
|
|
219
|
+
] });
|
|
220
|
+
$[58] = t10;
|
|
221
|
+
$[59] = t12;
|
|
222
|
+
$[60] = t7;
|
|
223
|
+
$[61] = t8;
|
|
224
|
+
$[62] = t9;
|
|
225
|
+
$[63] = t13;
|
|
226
|
+
} else t13 = $[63];
|
|
227
|
+
const content = t13;
|
|
108
228
|
if (props.multiple === true) {
|
|
109
229
|
const { value, onChange } = props;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
value: value !== void 0 ? value.flatMap((item_2) => {
|
|
230
|
+
let t14;
|
|
231
|
+
if ($[64] !== options || $[65] !== value) {
|
|
232
|
+
t14 = value !== void 0 ? value.flatMap((item_2) => {
|
|
114
233
|
const key = keyOf(options, item_2);
|
|
115
234
|
return key !== null ? [key] : [];
|
|
116
|
-
}) : void 0
|
|
117
|
-
|
|
235
|
+
}) : void 0;
|
|
236
|
+
$[64] = options;
|
|
237
|
+
$[65] = value;
|
|
238
|
+
$[66] = t14;
|
|
239
|
+
} else t14 = $[66];
|
|
240
|
+
let t15;
|
|
241
|
+
if ($[67] !== onChange || $[68] !== options) {
|
|
242
|
+
t15 = (keys) => onChange?.(keys.flatMap((key_0) => {
|
|
118
243
|
const item_3 = valueOf(options, key_0);
|
|
119
244
|
return item_3 !== null ? [item_3] : [];
|
|
120
|
-
}))
|
|
121
|
-
|
|
122
|
-
|
|
245
|
+
}));
|
|
246
|
+
$[67] = onChange;
|
|
247
|
+
$[68] = options;
|
|
248
|
+
$[69] = t15;
|
|
249
|
+
} else t15 = $[69];
|
|
250
|
+
let t16;
|
|
251
|
+
if ($[70] !== content || $[71] !== shared || $[72] !== t14 || $[73] !== t15) {
|
|
252
|
+
t16 = /* @__PURE__ */ jsx(Select, {
|
|
253
|
+
...shared,
|
|
254
|
+
selectionMode: "multiple",
|
|
255
|
+
value: t14,
|
|
256
|
+
onChange: t15,
|
|
257
|
+
children: content
|
|
258
|
+
});
|
|
259
|
+
$[70] = content;
|
|
260
|
+
$[71] = shared;
|
|
261
|
+
$[72] = t14;
|
|
262
|
+
$[73] = t15;
|
|
263
|
+
$[74] = t16;
|
|
264
|
+
} else t16 = $[74];
|
|
265
|
+
return t16;
|
|
123
266
|
}
|
|
124
267
|
const { value: value_0, onChange: onChange_0 } = props;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
268
|
+
let t14;
|
|
269
|
+
if ($[75] !== options || $[76] !== value_0) {
|
|
270
|
+
t14 = value_0 !== void 0 ? value_0 !== null ? keyOf(options, value_0) : null : void 0;
|
|
271
|
+
$[75] = options;
|
|
272
|
+
$[76] = value_0;
|
|
273
|
+
$[77] = t14;
|
|
274
|
+
} else t14 = $[77];
|
|
275
|
+
let t15;
|
|
276
|
+
if ($[78] !== onChange_0 || $[79] !== options) {
|
|
277
|
+
t15 = (key_1) => onChange_0?.(valueOf(options, key_1));
|
|
278
|
+
$[78] = onChange_0;
|
|
279
|
+
$[79] = options;
|
|
280
|
+
$[80] = t15;
|
|
281
|
+
} else t15 = $[80];
|
|
282
|
+
let t16;
|
|
283
|
+
if ($[81] !== content || $[82] !== shared || $[83] !== t14 || $[84] !== t15) {
|
|
284
|
+
t16 = /* @__PURE__ */ jsx(Select, {
|
|
285
|
+
...shared,
|
|
286
|
+
selectionMode: "single",
|
|
287
|
+
value: t14,
|
|
288
|
+
onChange: t15,
|
|
289
|
+
children: content
|
|
290
|
+
});
|
|
291
|
+
$[81] = content;
|
|
292
|
+
$[82] = shared;
|
|
293
|
+
$[83] = t14;
|
|
294
|
+
$[84] = t15;
|
|
295
|
+
$[85] = t16;
|
|
296
|
+
} else t16 = $[85];
|
|
297
|
+
return t16;
|
|
298
|
+
}
|
|
299
|
+
function _temp4(item_1) {
|
|
300
|
+
return /* @__PURE__ */ jsx(ListBoxItem, {
|
|
301
|
+
id: item_1.key,
|
|
302
|
+
textValue: item_1.label,
|
|
303
|
+
className: ListBox_module_default.item,
|
|
304
|
+
children: (t0) => {
|
|
305
|
+
const { isSelected } = t0;
|
|
306
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
307
|
+
className: ListBox_module_default.check,
|
|
308
|
+
children: isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
309
|
+
icon: Check,
|
|
310
|
+
size: "sm"
|
|
311
|
+
}) : null
|
|
312
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
313
|
+
className: ListBox_module_default.itemText,
|
|
314
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
315
|
+
slot: "label",
|
|
316
|
+
className: ListBox_module_default.itemLabel,
|
|
317
|
+
children: item_1.label
|
|
318
|
+
}), item_1.description !== void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
319
|
+
slot: "description",
|
|
320
|
+
className: ListBox_module_default.itemDescription,
|
|
321
|
+
children: item_1.description
|
|
322
|
+
}) : null]
|
|
323
|
+
})] });
|
|
324
|
+
}
|
|
325
|
+
}, item_1.key);
|
|
326
|
+
}
|
|
327
|
+
function _temp3(item_0) {
|
|
328
|
+
return item_0.key;
|
|
329
|
+
}
|
|
330
|
+
function _temp2(item) {
|
|
331
|
+
return item.disabled === true;
|
|
332
|
+
}
|
|
333
|
+
function _temp(option, index) {
|
|
334
|
+
return {
|
|
335
|
+
...option,
|
|
336
|
+
key: String(index)
|
|
337
|
+
};
|
|
132
338
|
}
|
|
133
339
|
//#endregion
|
|
134
340
|
export { Select$1 as Select };
|