@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
package/dist/switch/Switch.js
CHANGED
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import { ChoiceChrome } from "../checkbox/ChoiceChrome.js";
|
|
3
3
|
import Switch_module_default from "./Switch.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { Switch } from "react-aria-components";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/switch/Switch.tsx
|
|
7
8
|
/** An on and off switch, for settings that apply at once. */
|
|
8
|
-
function Switch$1(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
function Switch$1(t0) {
|
|
10
|
+
const $ = c(22);
|
|
11
|
+
let children;
|
|
12
|
+
let className;
|
|
13
|
+
let description;
|
|
14
|
+
let descriptionClassName;
|
|
15
|
+
let errorsClassName;
|
|
16
|
+
let props;
|
|
17
|
+
let switchClassName;
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
({children, description, errors: t1, className, switchClassName, descriptionClassName, errorsClassName, ...props} = t0);
|
|
21
|
+
$[0] = t0;
|
|
22
|
+
$[1] = children;
|
|
23
|
+
$[2] = className;
|
|
24
|
+
$[3] = description;
|
|
25
|
+
$[4] = descriptionClassName;
|
|
26
|
+
$[5] = errorsClassName;
|
|
27
|
+
$[6] = props;
|
|
28
|
+
$[7] = switchClassName;
|
|
29
|
+
$[8] = t1;
|
|
30
|
+
} else {
|
|
31
|
+
children = $[1];
|
|
32
|
+
className = $[2];
|
|
33
|
+
description = $[3];
|
|
34
|
+
descriptionClassName = $[4];
|
|
35
|
+
errorsClassName = $[5];
|
|
36
|
+
props = $[6];
|
|
37
|
+
switchClassName = $[7];
|
|
38
|
+
t1 = $[8];
|
|
39
|
+
}
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[9] !== t1) {
|
|
42
|
+
t2 = t1 === void 0 ? [] : t1;
|
|
43
|
+
$[9] = t1;
|
|
44
|
+
$[10] = t2;
|
|
45
|
+
} else t2 = $[10];
|
|
46
|
+
const errors = t2;
|
|
47
|
+
let t3;
|
|
48
|
+
if ($[11] !== children || $[12] !== props || $[13] !== switchClassName) {
|
|
49
|
+
t3 = (describedBy) => /* @__PURE__ */ jsxs(Switch, {
|
|
17
50
|
...props,
|
|
18
51
|
"aria-describedby": describedBy,
|
|
19
52
|
className: cx(Switch_module_default.control, switchClassName),
|
|
@@ -25,8 +58,32 @@ function Switch$1({ children, description, errors = [], className, switchClassNa
|
|
|
25
58
|
className: Switch_module_default.label,
|
|
26
59
|
children
|
|
27
60
|
}) : null]
|
|
28
|
-
})
|
|
29
|
-
|
|
61
|
+
});
|
|
62
|
+
$[11] = children;
|
|
63
|
+
$[12] = props;
|
|
64
|
+
$[13] = switchClassName;
|
|
65
|
+
$[14] = t3;
|
|
66
|
+
} else t3 = $[14];
|
|
67
|
+
let t4;
|
|
68
|
+
if ($[15] !== className || $[16] !== description || $[17] !== descriptionClassName || $[18] !== errors || $[19] !== errorsClassName || $[20] !== t3) {
|
|
69
|
+
t4 = /* @__PURE__ */ jsx(ChoiceChrome, {
|
|
70
|
+
component: "switch",
|
|
71
|
+
description,
|
|
72
|
+
errors,
|
|
73
|
+
className,
|
|
74
|
+
descriptionClassName,
|
|
75
|
+
errorsClassName,
|
|
76
|
+
children: t3
|
|
77
|
+
});
|
|
78
|
+
$[15] = className;
|
|
79
|
+
$[16] = description;
|
|
80
|
+
$[17] = descriptionClassName;
|
|
81
|
+
$[18] = errors;
|
|
82
|
+
$[19] = errorsClassName;
|
|
83
|
+
$[20] = t3;
|
|
84
|
+
$[21] = t4;
|
|
85
|
+
} else t4 = $[21];
|
|
86
|
+
return t4;
|
|
30
87
|
}
|
|
31
88
|
//#endregion
|
|
32
89
|
export { Switch$1 as Switch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","names":["Switch","AriaSwitch","styles"],"sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Switch as AriaSwitch, type SwitchProps as AriaSwitchProps } from 'react-aria-components';\n\nimport { ChoiceChrome, type ChoiceChromeProps } from '../checkbox/ChoiceChrome';\nimport { cx } from '../utils/cx';\nimport styles from './Switch.module.css';\n\nexport interface SwitchProps\n extends Omit<AriaSwitchProps, 'className' | 'style' | 'children'>, ChoiceChromeProps {\n /** Label, next to the switch. */\n children?: ReactNode;\n switchClassName?: string;\n}\n\n/** An on and off switch, for settings that apply at once. */\nexport function Switch({\n children,\n description,\n errors = [],\n className,\n switchClassName,\n descriptionClassName,\n errorsClassName,\n ...props\n}: SwitchProps) {\n return (\n <ChoiceChrome\n component=\"switch\"\n description={description}\n errors={errors}\n className={className}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n >\n {(describedBy) => (\n <AriaSwitch\n {...props}\n aria-describedby={describedBy}\n className={cx(styles.control, switchClassName)}\n >\n <span className={styles.track} aria-hidden=\"true\">\n <span className={styles.thumb} />\n </span>\n {children !== undefined ? (\n <span className={styles.label}>{children}</span>\n ) : null}\n </AriaSwitch>\n )}\n </ChoiceChrome>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.js","names":["ReactNode","Switch","AriaSwitch","SwitchProps","AriaSwitchProps","ChoiceChrome","ChoiceChromeProps","cx","styles","Omit","children","switchClassName","t0","$","_c","className","description","descriptionClassName","errorsClassName","props","t1","errors","t2","undefined","t3","describedBy","control","track","thumb","label","t4","Switch","_c","AriaSwitch","styles"],"sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Switch as AriaSwitch, type SwitchProps as AriaSwitchProps } from 'react-aria-components';\n\nimport { ChoiceChrome, type ChoiceChromeProps } from '../checkbox/ChoiceChrome';\nimport { cx } from '../utils/cx';\nimport styles from './Switch.module.css';\n\nexport interface SwitchProps\n extends Omit<AriaSwitchProps, 'className' | 'style' | 'children'>, ChoiceChromeProps {\n /** Label, next to the switch. */\n children?: ReactNode;\n switchClassName?: string;\n}\n\n/** An on and off switch, for settings that apply at once. */\nexport function Switch({\n children,\n description,\n errors = [],\n className,\n switchClassName,\n descriptionClassName,\n errorsClassName,\n ...props\n}: SwitchProps) {\n return (\n <ChoiceChrome\n component=\"switch\"\n description={description}\n errors={errors}\n className={className}\n descriptionClassName={descriptionClassName}\n errorsClassName={errorsClassName}\n >\n {(describedBy) => (\n <AriaSwitch\n {...props}\n aria-describedby={describedBy}\n className={cx(styles.control, switchClassName)}\n >\n <span className={styles.track} aria-hidden=\"true\">\n <span className={styles.thumb} />\n </span>\n {children !== undefined ? (\n <span className={styles.label}>{children}</span>\n ) : null}\n </AriaSwitch>\n )}\n </ChoiceChrome>\n );\n}\n"],"mappings":";;;;;;;;AAeA,SAAOC,SAAAW,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAR;CAAA,IAAAS;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAgB,CAAA,CAAAF,UAAAM,aAAAK,QAAAD,IAAAL,WAAAJ,iBAAAM,sBAAAC,iBAAA,GAAAC,SAAAP;EASTC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAF;EAAAE,EAAA,KAAAO;CAAA,OAAA;EAAAV,WAAAG,EAAA;EAAAE,YAAAF,EAAA;EAAAG,cAAAH,EAAA;EAAAI,uBAAAJ,EAAA;EAAAK,kBAAAL,EAAA;EAAAM,QAAAN,EAAA;EAAAF,kBAAAE,EAAA;EAAAO,KAAAP,EAAA;CAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAO,IAAA;EANVE,KAAAF,OAAAG,KAAAA,IAAA,CAAA,IAAAH;EAAWP,EAAA,KAAAO;EAAAP,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAX,MAAAQ,SAAAC;CAAW,IAAAE;CAAA,IAAAX,EAAA,QAAAH,YAAAG,EAAA,QAAAM,SAAAN,EAAA,QAAAF,iBAAA;EAgBFa,MAAAC,gBACG,qBAACQ,QAAD;GAAW,GACHd;GACcM,oBAAAA;GACP,WAAAlB,GAAGC,sBAAMkB,SAAUf,eAAe;GAHjD,UAAA,CAKI,oBAAA,QAAA;IAAiB,WAAAH,sBAAMmB;IAAoB,eAAA;IACvC,UAAA,oBAAA,QAAA,EAAiB,WAAAnB,sBAAMoB,MAAM,CAAA;GAC1B,CAAA,GACNlB,aAAaa,KAAAA,IACV,oBAAA,QAAA;IAAiB,WAAAf,sBAAMqB;IAASnB;GAAgB,CAAA,IADnD,IARM;;EAYdG,EAAA,MAAAH;EAAAG,EAAA,MAAAM;EAAAN,EAAA,MAAAF;EAAAE,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,QAAAE,aAAAF,EAAA,QAAAG,eAAAH,EAAA,QAAAI,wBAAAJ,EAAA,QAAAQ,UAAAR,EAAA,QAAAK,mBAAAL,EAAA,QAAAW,IAAA;EArBLM,KAAA,oBAAC,cAAD;GACc,WAAA;GACGd;GACLK;GACGN;GACWE;GACLC;GAEhBM,UAAAA;EARQ,CAAA;EAsBEX,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAQ;EAAAR,EAAA,MAAAK;EAAAL,EAAA,MAAAW;EAAAX,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAtBfiB;AAsBe"}
|
package/dist/switch/tokens.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Tokens of Switch. */
|
|
2
|
-
export declare const switchTokens: import("
|
|
2
|
+
export declare const switchTokens: import("../index.js").ComponentTokens<"switch", "panneau-switch-height" | "panneau-switch-width" | "panneau-switch-radius" | "panneau-switch-checked-bg" | "panneau-switch-track-bg" | "panneau-switch-thumb-size" | "panneau-switch-thumb-bg" | "panneau-switch-checked-thumb-bg">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/switch/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Switch. */\nexport const switchTokens = defineComponentTokens('switch', {\n /** Width of the track. */\n width: '2.25rem',\n /** Height of the track. */\n height: '1.25rem',\n /** Background of the track when off. */\n 'track-bg': 'var(--panneau-color-border-control)',\n /** Corner radius of the track and the thumb. */\n radius: 'var(--panneau-radius-full)',\n /** Size of the thumb. */\n 'thumb-size': '1rem',\n /** Background of the thumb when off. */\n 'thumb-bg': 'var(--panneau-color-surface)',\n /** Background of the track when on. */\n 'checked-bg': 'var(--panneau-color-accent)',\n /** Background of the thumb when on. */\n 'checked-thumb-bg': 'var(--panneau-color-accent-text)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","switchTokens","width","height","radius"],"sources":["../../src/switch/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Switch. */\nexport const switchTokens = defineComponentTokens('switch', {\n /** Width of the track. */\n width: '2.25rem',\n /** Height of the track. */\n height: '1.25rem',\n /** Background of the track when off. */\n 'track-bg': 'var(--panneau-color-border-control)',\n /** Corner radius of the track and the thumb. */\n radius: 'var(--panneau-radius-full)',\n /** Size of the thumb. */\n 'thumb-size': '1rem',\n /** Background of the thumb when off. */\n 'thumb-bg': 'var(--panneau-color-surface)',\n /** Background of the track when on. */\n 'checked-bg': 'var(--panneau-color-accent)',\n /** Background of the thumb when on. */\n 'checked-thumb-bg': 'var(--panneau-color-accent-text)',\n});\n"],"mappings":";;;AAGA,IAAaC,eAAeD,sBAAsB,UAAU;;CAExDE,OAAO;;CAEPC,QAAQ;;CAER,YAAY;;CAEZC,QAAQ;;CAER,cAAc;;CAEd,YAAY;;CAEZ,cAAc;;CAEd,oBAAoB;AACxB,CAAC"}
|
package/dist/tabs/Tabs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import Tabs_module_default from "./Tabs.module.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
3
4
|
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { c } from "react/compiler-runtime";
|
|
6
6
|
//#region src/tabs/Tabs.tsx
|
|
7
7
|
/** Tabs: a `TabList` of `Tab`s, then a `TabPanel` per tab, matched by `id`. */
|
|
8
8
|
function Tabs$1(t0) {
|
package/dist/tabs/Tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","names":["Tabs","_c","styles","AriaTabs","TabList","AriaTabList","Tab","AriaTab","TabPanel","AriaTabPanel"],"sources":["../../src/tabs/Tabs.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n type TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n type TabPanelProps as AriaTabPanelProps,\n type TabProps as AriaTabProps,\n Tabs as AriaTabs,\n type TabsProps as AriaTabsProps,\n} from 'react-aria-components';\n\nimport { cx } from '../utils/cx';\nimport styles from './Tabs.module.css';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style'> {\n className?: string;\n}\n\n/** Tabs: a `TabList` of `Tab`s, then a `TabPanel` per tab, matched by `id`. */\nexport function Tabs({ className, ...props }: TabsProps) {\n return <AriaTabs {...props} className={cx('panneau-tabs', styles.tabs, className)} />;\n}\n\nexport interface TabListProps<T extends object> extends Omit<\n AriaTabListProps<T>,\n 'className' | 'style'\n> {\n className?: string;\n}\n\n/** The row of tabs. It scrolls sideways when the tabs don't fit, on phones. */\nexport function TabList<T extends object>({ className, ...props }: TabListProps<T>) {\n return <AriaTabList {...props} className={cx('panneau-tab-list', styles.list, className)} />;\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'className' | 'style' | 'children'> {\n children?: ReactNode;\n className?: string;\n}\n\n/** A tab. Put a `Badge` in it for a count, such as the errors of the panel. */\nexport function Tab({ className, ...props }: TabProps) {\n return <AriaTab {...props} className={cx('panneau-tab', styles.tab, className)} />;\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'className' | 'style'> {\n className?: string;\n}\n\n/**\n * The content of a tab. With `shouldForceMount`, the panel stays mounted (and hidden) when another\n * tab is selected, which keeps the state of its fields.\n */\nexport function TabPanel({ className, ...props }: TabPanelProps) {\n return <AriaTabPanel {...props} className={cx('panneau-tab-panel', styles.panel, className)} />;\n}\n"],"mappings":";;;;;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"Tabs.js","names":["ReactNode","Tab","AriaTab","TabList","AriaTabList","TabListProps","AriaTabListProps","TabPanel","AriaTabPanel","TabPanelProps","AriaTabPanelProps","TabProps","AriaTabProps","Tabs","AriaTabs","TabsProps","AriaTabsProps","cx","styles","Omit","className","t0","$","_c","props","t1","tabs","t2","T","list","children","tab","panel","Tabs","_c","styles","AriaTabs","TabList","AriaTabList","Tab","AriaTab","TabPanel","AriaTabPanel"],"sources":["../../src/tabs/Tabs.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n type TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n type TabPanelProps as AriaTabPanelProps,\n type TabProps as AriaTabProps,\n Tabs as AriaTabs,\n type TabsProps as AriaTabsProps,\n} from 'react-aria-components';\n\nimport { cx } from '../utils/cx';\nimport styles from './Tabs.module.css';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style'> {\n className?: string;\n}\n\n/** Tabs: a `TabList` of `Tab`s, then a `TabPanel` per tab, matched by `id`. */\nexport function Tabs({ className, ...props }: TabsProps) {\n return <AriaTabs {...props} className={cx('panneau-tabs', styles.tabs, className)} />;\n}\n\nexport interface TabListProps<T extends object> extends Omit<\n AriaTabListProps<T>,\n 'className' | 'style'\n> {\n className?: string;\n}\n\n/** The row of tabs. It scrolls sideways when the tabs don't fit, on phones. */\nexport function TabList<T extends object>({ className, ...props }: TabListProps<T>) {\n return <AriaTabList {...props} className={cx('panneau-tab-list', styles.list, className)} />;\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'className' | 'style' | 'children'> {\n children?: ReactNode;\n className?: string;\n}\n\n/** A tab. Put a `Badge` in it for a count, such as the errors of the panel. */\nexport function Tab({ className, ...props }: TabProps) {\n return <AriaTab {...props} className={cx('panneau-tab', styles.tab, className)} />;\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'className' | 'style'> {\n className?: string;\n}\n\n/**\n * The content of a tab. With `shouldForceMount`, the panel stays mounted (and hidden) when another\n * tab is selected, which keeps the state of its fields.\n */\nexport function TabPanel({ className, ...props }: TabPanelProps) {\n return <AriaTabPanel {...props} className={cx('panneau-tab-panel', styles.panel, className)} />;\n}\n"],"mappings":"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"}
|
package/dist/tabs/tokens.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Tokens of Tabs. */
|
|
2
|
-
export declare const tabsTokens: import("
|
|
2
|
+
export declare const tabsTokens: import("../index.js").ComponentTokens<"tabs", "panneau-tabs-gap" | "panneau-tabs-border-color" | "panneau-tabs-tab-padding-x" | "panneau-tabs-tab-font-weight" | "panneau-tabs-tab-color" | "panneau-tabs-indicator-height" | "panneau-tabs-tab-color-selected" | "panneau-tabs-indicator-color">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
package/dist/tabs/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/tabs/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Tabs. */\nexport const tabsTokens = defineComponentTokens('tabs', {\n /** Space between the tab list and the panel. */\n gap: 'var(--panneau-space-4)',\n /** Color of the line under the tab list. */\n 'border-color': 'var(--panneau-color-border)',\n /** Horizontal padding of a tab. */\n 'tab-padding-x': 'var(--panneau-space-3)',\n /** Font weight of a tab. */\n 'tab-font-weight': 'var(--panneau-font-weight-medium)',\n /** Text color of a tab. */\n 'tab-color': 'var(--panneau-color-text-muted)',\n /** Height of the indicator under the selected tab. */\n 'indicator-height': '2px',\n /** Text color of a hovered or selected tab. */\n 'tab-color-selected': 'var(--panneau-color-text)',\n /** Color of the indicator under the selected tab. */\n 'indicator-color': 'var(--panneau-color-accent)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","tabsTokens","gap"],"sources":["../../src/tabs/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Tabs. */\nexport const tabsTokens = defineComponentTokens('tabs', {\n /** Space between the tab list and the panel. */\n gap: 'var(--panneau-space-4)',\n /** Color of the line under the tab list. */\n 'border-color': 'var(--panneau-color-border)',\n /** Horizontal padding of a tab. */\n 'tab-padding-x': 'var(--panneau-space-3)',\n /** Font weight of a tab. */\n 'tab-font-weight': 'var(--panneau-font-weight-medium)',\n /** Text color of a tab. */\n 'tab-color': 'var(--panneau-color-text-muted)',\n /** Height of the indicator under the selected tab. */\n 'indicator-height': '2px',\n /** Text color of a hovered or selected tab. */\n 'tab-color-selected': 'var(--panneau-color-text)',\n /** Color of the indicator under the selected tab. */\n 'indicator-color': 'var(--panneau-color-accent)',\n});\n"],"mappings":";;;AAGA,IAAaC,aAAaD,sBAAsB,QAAQ;;CAEpDE,KAAK;;CAEL,gBAAgB;;CAEhB,iBAAiB;;CAEjB,mBAAmB;;CAEnB,aAAa;;CAEb,oBAAoB;;CAEpB,sBAAsB;;CAEtB,mBAAmB;AACvB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { messages } from "../intl/messages.js";
|
|
|
4
4
|
import { usePanneauIntl } from "../intl/usePanneauIntl.js";
|
|
5
5
|
import Field_module_default from "../field/Field.module.js";
|
|
6
6
|
import TagsInput_module_default from "./TagsInput.module.js";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
7
8
|
import { X } from "lucide-react";
|
|
8
9
|
import { Button, Tag, TagGroup, TagList } from "react-aria-components";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,15 +16,31 @@ import { useId, useState } from "react";
|
|
|
15
16
|
* and a tag already in the list isn't added again. Suggestions complete what is typed; without
|
|
16
17
|
* `allowCustom`, only they can be added.
|
|
17
18
|
*/
|
|
18
|
-
function TagsInput(
|
|
19
|
+
function TagsInput(t0) {
|
|
20
|
+
const $ = c(67);
|
|
21
|
+
const { label, description, errors: t1, value, onChange, onBlur, suggestions: t2, allowCustom: t3, placeholder, name, isRequired, isDisabled, isReadOnly, autoFocus, className, labelClassName, descriptionClassName, errorsClassName, controlClassName } = t0;
|
|
22
|
+
let t4;
|
|
23
|
+
if ($[0] !== t1) {
|
|
24
|
+
t4 = t1 === void 0 ? [] : t1;
|
|
25
|
+
$[0] = t1;
|
|
26
|
+
$[1] = t4;
|
|
27
|
+
} else t4 = $[1];
|
|
28
|
+
const errors = t4;
|
|
29
|
+
const suggestions = t2 === void 0 ? [] : t2;
|
|
30
|
+
const allowCustom = t3 === void 0 ? true : t3;
|
|
19
31
|
const intl = usePanneauIntl();
|
|
20
32
|
const id = useId();
|
|
21
33
|
const [draft, setDraft] = useState("");
|
|
22
|
-
|
|
34
|
+
let t5;
|
|
35
|
+
if ($[2] !== value) {
|
|
36
|
+
t5 = value ?? [];
|
|
37
|
+
$[2] = value;
|
|
38
|
+
$[3] = t5;
|
|
39
|
+
} else t5 = $[3];
|
|
40
|
+
const tags = t5;
|
|
23
41
|
const invalid = errors.length > 0;
|
|
24
42
|
const editable = isDisabled !== true && isReadOnly !== true;
|
|
25
43
|
const labelOf = (tag) => suggestions.find((suggestion) => suggestion.value === tag)?.label ?? tag;
|
|
26
|
-
/** The tag a text adds: the suggestion it names, or the text itself when allowed. */
|
|
27
44
|
const resolve = (text) => {
|
|
28
45
|
const trimmed = text.trim();
|
|
29
46
|
if (trimmed === "") return null;
|
|
@@ -32,127 +49,266 @@ function TagsInput({ label, description, errors = [], value, onChange, onBlur, s
|
|
|
32
49
|
if (suggestion_0 !== void 0) return suggestion_0.value;
|
|
33
50
|
return allowCustom ? trimmed : null;
|
|
34
51
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
texts
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
let t6;
|
|
53
|
+
if ($[4] !== onChange || $[5] !== resolve || $[6] !== tags) {
|
|
54
|
+
t6 = (texts) => {
|
|
55
|
+
const next = [...tags];
|
|
56
|
+
texts.forEach((text_0) => {
|
|
57
|
+
const tag_0 = resolve(text_0);
|
|
58
|
+
if (tag_0 !== null && !next.includes(tag_0)) next.push(tag_0);
|
|
59
|
+
});
|
|
60
|
+
if (next.length !== tags.length) onChange?.(next);
|
|
61
|
+
};
|
|
62
|
+
$[4] = onChange;
|
|
63
|
+
$[5] = resolve;
|
|
64
|
+
$[6] = tags;
|
|
65
|
+
$[7] = t6;
|
|
66
|
+
} else t6 = $[7];
|
|
67
|
+
const add = t6;
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[8] !== onChange || $[9] !== tags) {
|
|
70
|
+
t7 = (removed) => {
|
|
71
|
+
const next_0 = tags.filter((tag_1) => !removed.has(tag_1));
|
|
72
|
+
onChange?.(next_0.length > 0 ? next_0 : null);
|
|
73
|
+
};
|
|
74
|
+
$[8] = onChange;
|
|
75
|
+
$[9] = tags;
|
|
76
|
+
$[10] = t7;
|
|
77
|
+
} else t7 = $[10];
|
|
78
|
+
const remove = t7;
|
|
79
|
+
let t8;
|
|
80
|
+
if ($[11] !== add || $[12] !== draft) {
|
|
81
|
+
t8 = () => {
|
|
55
82
|
if (draft.trim() !== "") {
|
|
83
|
+
add([draft]);
|
|
84
|
+
setDraft("");
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
$[11] = add;
|
|
88
|
+
$[12] = draft;
|
|
89
|
+
$[13] = t8;
|
|
90
|
+
} else t8 = $[13];
|
|
91
|
+
const commit = t8;
|
|
92
|
+
let t9;
|
|
93
|
+
if ($[14] !== commit || $[15] !== draft || $[16] !== remove || $[17] !== tags) {
|
|
94
|
+
t9 = (event) => {
|
|
95
|
+
if (event.key === "Enter" || event.key === "," || event.key === "Tab" && draft !== "") {
|
|
96
|
+
if (draft.trim() !== "") {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
commit();
|
|
99
|
+
} else if (event.key !== "Tab") event.preventDefault();
|
|
100
|
+
} else if (event.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
56
101
|
event.preventDefault();
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
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
|
-
|
|
108
|
-
|
|
102
|
+
remove(/* @__PURE__ */ new Set([tags[tags.length - 1]]));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
$[14] = commit;
|
|
106
|
+
$[15] = draft;
|
|
107
|
+
$[16] = remove;
|
|
108
|
+
$[17] = tags;
|
|
109
|
+
$[18] = t9;
|
|
110
|
+
} else t9 = $[18];
|
|
111
|
+
const onKeyDown = t9;
|
|
112
|
+
let t10;
|
|
113
|
+
if ($[19] !== add) {
|
|
114
|
+
t10 = (event_0) => {
|
|
115
|
+
const text_1 = event_0.clipboardData.getData("text");
|
|
116
|
+
if (/[,\n]/.test(text_1)) {
|
|
117
|
+
event_0.preventDefault();
|
|
118
|
+
add(text_1.split(/[,\n]/));
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
$[19] = add;
|
|
122
|
+
$[20] = t10;
|
|
123
|
+
} else t10 = $[20];
|
|
124
|
+
const onPaste = t10;
|
|
125
|
+
const t11 = description !== void 0 && description !== null ? `${id}-description` : null;
|
|
126
|
+
const t12 = invalid ? `${id}-errors` : null;
|
|
127
|
+
let t13;
|
|
128
|
+
if ($[21] !== t11 || $[22] !== t12) {
|
|
129
|
+
t13 = [t11, t12].filter(_temp);
|
|
130
|
+
$[21] = t11;
|
|
131
|
+
$[22] = t12;
|
|
132
|
+
$[23] = t13;
|
|
133
|
+
} else t13 = $[23];
|
|
134
|
+
const describedBy = t13.join(" ");
|
|
135
|
+
let t14;
|
|
136
|
+
if ($[24] !== className) {
|
|
137
|
+
t14 = cx("panneau-tags-input", Field_module_default.field, className);
|
|
138
|
+
$[24] = className;
|
|
139
|
+
$[25] = t14;
|
|
140
|
+
} else t14 = $[25];
|
|
141
|
+
let t15;
|
|
142
|
+
if ($[26] !== id || $[27] !== isRequired || $[28] !== label || $[29] !== labelClassName) {
|
|
143
|
+
t15 = label !== void 0 && label !== null ? /* @__PURE__ */ jsxs("label", {
|
|
144
|
+
htmlFor: `${id}-input`,
|
|
145
|
+
className: cx(Field_module_default.label, labelClassName),
|
|
146
|
+
children: [label, isRequired === true ? /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: Field_module_default.required,
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
children: "*"
|
|
150
|
+
}) : null]
|
|
151
|
+
}) : null;
|
|
152
|
+
$[26] = id;
|
|
153
|
+
$[27] = isRequired;
|
|
154
|
+
$[28] = label;
|
|
155
|
+
$[29] = labelClassName;
|
|
156
|
+
$[30] = t15;
|
|
157
|
+
} else t15 = $[30];
|
|
158
|
+
let t16;
|
|
159
|
+
if ($[31] !== controlClassName) {
|
|
160
|
+
t16 = cx(Field_module_default.control, TagsInput_module_default.control, controlClassName);
|
|
161
|
+
$[31] = controlClassName;
|
|
162
|
+
$[32] = t16;
|
|
163
|
+
} else t16 = $[32];
|
|
164
|
+
const t17 = invalid || void 0;
|
|
165
|
+
const t18 = isDisabled || void 0;
|
|
166
|
+
const t19 = isReadOnly || void 0;
|
|
167
|
+
let t20;
|
|
168
|
+
if ($[33] !== editable || $[34] !== intl || $[35] !== label || $[36] !== labelOf || $[37] !== remove || $[38] !== tags) {
|
|
169
|
+
t20 = tags.length > 0 ? /* @__PURE__ */ jsx(TagGroup, {
|
|
170
|
+
"aria-label": intl.formatMessage(messages.tags, { label: typeof label === "string" ? label : "" }),
|
|
171
|
+
onRemove: editable ? remove : void 0,
|
|
172
|
+
className: TagsInput_module_default.group,
|
|
173
|
+
children: /* @__PURE__ */ jsx(TagList, {
|
|
174
|
+
className: TagsInput_module_default.list,
|
|
175
|
+
children: tags.map((tag_2) => /* @__PURE__ */ jsxs(Tag, {
|
|
176
|
+
id: tag_2,
|
|
177
|
+
textValue: labelOf(tag_2),
|
|
178
|
+
className: TagsInput_module_default.tag,
|
|
179
|
+
children: [labelOf(tag_2), editable ? /* @__PURE__ */ jsx(Button, {
|
|
180
|
+
slot: "remove",
|
|
181
|
+
className: TagsInput_module_default.remove,
|
|
182
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
183
|
+
icon: X,
|
|
184
|
+
size: "xs"
|
|
109
185
|
})
|
|
110
|
-
}) : null
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
186
|
+
}) : null]
|
|
187
|
+
}, tag_2))
|
|
188
|
+
})
|
|
189
|
+
}) : null;
|
|
190
|
+
$[33] = editable;
|
|
191
|
+
$[34] = intl;
|
|
192
|
+
$[35] = label;
|
|
193
|
+
$[36] = labelOf;
|
|
194
|
+
$[37] = remove;
|
|
195
|
+
$[38] = tags;
|
|
196
|
+
$[39] = t20;
|
|
197
|
+
} else t20 = $[39];
|
|
198
|
+
const t21 = editable ? /* @__PURE__ */ jsx("input", {
|
|
199
|
+
id: `${id}-input`,
|
|
200
|
+
className: cx(Field_module_default.bare, TagsInput_module_default.input),
|
|
201
|
+
value: draft,
|
|
202
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
203
|
+
list: suggestions.length > 0 ? `${id}-suggestions` : void 0,
|
|
204
|
+
autoComplete: "off",
|
|
205
|
+
autoFocus,
|
|
206
|
+
"aria-invalid": invalid || void 0,
|
|
207
|
+
"aria-required": isRequired || void 0,
|
|
208
|
+
"aria-describedby": describedBy !== "" ? describedBy : void 0,
|
|
209
|
+
onChange: (event_1) => setDraft(event_1.target.value),
|
|
210
|
+
onKeyDown,
|
|
211
|
+
onPaste,
|
|
212
|
+
onBlur: () => {
|
|
213
|
+
commit();
|
|
214
|
+
onBlur?.();
|
|
215
|
+
}
|
|
216
|
+
}) : null;
|
|
217
|
+
const t22 = suggestions.length > 0 ? /* @__PURE__ */ jsx("datalist", {
|
|
218
|
+
id: `${id}-suggestions`,
|
|
219
|
+
children: suggestions.filter((suggestion_1) => !tags.includes(suggestion_1.value)).map(_temp2)
|
|
220
|
+
}) : null;
|
|
221
|
+
let t23;
|
|
222
|
+
if ($[40] !== t16 || $[41] !== t17 || $[42] !== t18 || $[43] !== t19 || $[44] !== t20 || $[45] !== t21 || $[46] !== t22) {
|
|
223
|
+
t23 = /* @__PURE__ */ jsxs("div", {
|
|
224
|
+
className: t16,
|
|
225
|
+
"data-invalid": t17,
|
|
226
|
+
"data-disabled": t18,
|
|
227
|
+
"data-readonly": t19,
|
|
228
|
+
children: [
|
|
229
|
+
t20,
|
|
230
|
+
t21,
|
|
231
|
+
t22
|
|
232
|
+
]
|
|
233
|
+
});
|
|
234
|
+
$[40] = t16;
|
|
235
|
+
$[41] = t17;
|
|
236
|
+
$[42] = t18;
|
|
237
|
+
$[43] = t19;
|
|
238
|
+
$[44] = t20;
|
|
239
|
+
$[45] = t21;
|
|
240
|
+
$[46] = t22;
|
|
241
|
+
$[47] = t23;
|
|
242
|
+
} else t23 = $[47];
|
|
243
|
+
let t24;
|
|
244
|
+
if ($[48] !== name || $[49] !== tags) {
|
|
245
|
+
t24 = name !== void 0 ? tags.map((tag_3) => /* @__PURE__ */ jsx("input", {
|
|
246
|
+
type: "hidden",
|
|
247
|
+
name: `${name}[]`,
|
|
248
|
+
value: tag_3
|
|
249
|
+
}, tag_3)) : null;
|
|
250
|
+
$[48] = name;
|
|
251
|
+
$[49] = tags;
|
|
252
|
+
$[50] = t24;
|
|
253
|
+
} else t24 = $[50];
|
|
254
|
+
let t25;
|
|
255
|
+
if ($[51] !== description || $[52] !== descriptionClassName || $[53] !== id) {
|
|
256
|
+
t25 = description !== void 0 && description !== null ? /* @__PURE__ */ jsx("div", {
|
|
257
|
+
id: `${id}-description`,
|
|
258
|
+
className: cx(Field_module_default.description, descriptionClassName),
|
|
259
|
+
children: description
|
|
260
|
+
}) : null;
|
|
261
|
+
$[51] = description;
|
|
262
|
+
$[52] = descriptionClassName;
|
|
263
|
+
$[53] = id;
|
|
264
|
+
$[54] = t25;
|
|
265
|
+
} else t25 = $[54];
|
|
266
|
+
let t26;
|
|
267
|
+
if ($[55] !== errors || $[56] !== errorsClassName || $[57] !== id || $[58] !== invalid) {
|
|
268
|
+
t26 = invalid ? /* @__PURE__ */ jsx("div", {
|
|
269
|
+
id: `${id}-errors`,
|
|
270
|
+
className: cx(Field_module_default.errors, errorsClassName),
|
|
271
|
+
children: errors.map(_temp3)
|
|
272
|
+
}) : null;
|
|
273
|
+
$[55] = errors;
|
|
274
|
+
$[56] = errorsClassName;
|
|
275
|
+
$[57] = id;
|
|
276
|
+
$[58] = invalid;
|
|
277
|
+
$[59] = t26;
|
|
278
|
+
} else t26 = $[59];
|
|
279
|
+
let t27;
|
|
280
|
+
if ($[60] !== t14 || $[61] !== t15 || $[62] !== t23 || $[63] !== t24 || $[64] !== t25 || $[65] !== t26) {
|
|
281
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
282
|
+
className: t14,
|
|
283
|
+
children: [
|
|
284
|
+
t15,
|
|
285
|
+
t23,
|
|
286
|
+
t24,
|
|
287
|
+
t25,
|
|
288
|
+
t26
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
$[60] = t14;
|
|
292
|
+
$[61] = t15;
|
|
293
|
+
$[62] = t23;
|
|
294
|
+
$[63] = t24;
|
|
295
|
+
$[64] = t25;
|
|
296
|
+
$[65] = t26;
|
|
297
|
+
$[66] = t27;
|
|
298
|
+
} else t27 = $[66];
|
|
299
|
+
return t27;
|
|
300
|
+
}
|
|
301
|
+
function _temp3(error, index) {
|
|
302
|
+
return /* @__PURE__ */ jsx("span", {
|
|
303
|
+
className: Field_module_default.error,
|
|
304
|
+
children: error
|
|
305
|
+
}, index);
|
|
306
|
+
}
|
|
307
|
+
function _temp2(suggestion_2) {
|
|
308
|
+
return /* @__PURE__ */ jsx("option", { value: suggestion_2.label ?? suggestion_2.value }, suggestion_2.value);
|
|
309
|
+
}
|
|
310
|
+
function _temp(part) {
|
|
311
|
+
return part !== null;
|
|
156
312
|
}
|
|
157
313
|
//#endregion
|
|
158
314
|
export { TagsInput };
|