@panneau/ui 5.0.0-alpha.5 → 5.0.0-alpha.7
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 +77 -1
- package/dist/alert/Alert.js +108 -40
- package/dist/alert/Alert.js.map +1 -1
- package/dist/alert/tokens.js.map +1 -1
- package/dist/badge/Badge.js +34 -6
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/tokens.js.map +1 -1
- package/dist/button/Button.js +111 -17
- package/dist/button/Button.js.map +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.js.map +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.js.map +1 -1
- package/dist/combo-box/ComboBox.js +291 -79
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/command-palette/CommandPalette.js +463 -160
- package/dist/command-palette/CommandPalette.js.map +1 -1
- package/dist/command-palette/match.js.map +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.js.map +1 -1
- package/dist/date-picker/DatePicker.js +234 -73
- package/dist/date-picker/DatePicker.js.map +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.js.map +1 -1
- package/dist/disclosure/Disclosure.js +132 -28
- package/dist/disclosure/Disclosure.js.map +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.js.map +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.js.map +1 -1
- package/dist/field/tokens.js.map +1 -1
- package/dist/grid/Grid.js +123 -14
- package/dist/grid/Grid.js.map +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.js.map +1 -1
- package/dist/icon/Icon.js +36 -11
- package/dist/icon/Icon.js.map +1 -1
- package/dist/icon/lucideIconLoader.js.map +1 -1
- package/dist/icon/namedIcons.js +87 -26
- package/dist/icon/namedIcons.js.map +1 -1
- package/dist/icon-button/IconButton.js +70 -13
- package/dist/icon-button/IconButton.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/inline/Inline.js +65 -7
- package/dist/inline/Inline.js.map +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.css +84 -0
- package/dist/menu/Menu.d.ts +33 -6
- package/dist/menu/Menu.d.ts.map +1 -1
- package/dist/menu/Menu.js +243 -32
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/Menu.module.js +22 -0
- package/dist/menu/Menu.module.js.map +1 -0
- package/dist/menu/tokens.d.ts +3 -0
- package/dist/menu/tokens.d.ts.map +1 -0
- package/dist/menu/tokens.js +31 -0
- package/dist/menu/tokens.js.map +1 -0
- package/dist/number-input/NumberInput.css +18 -0
- package/dist/number-input/NumberInput.js +232 -60
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/NumberInput.module.js +3 -1
- package/dist/number-input/NumberInput.module.js.map +1 -1
- package/dist/number-input/tokens.js.map +1 -1
- package/dist/pill-trigger/PillTrigger.css +104 -0
- package/dist/pill-trigger/PillTrigger.d.ts +20 -0
- package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
- package/dist/pill-trigger/PillTrigger.js +94 -0
- package/dist/pill-trigger/PillTrigger.js.map +1 -0
- package/dist/pill-trigger/PillTrigger.module.js +18 -0
- package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
- package/dist/pill-trigger/tokens.d.ts +3 -0
- package/dist/pill-trigger/tokens.d.ts.map +1 -0
- package/dist/pill-trigger/tokens.js +37 -0
- package/dist/pill-trigger/tokens.js.map +1 -0
- package/dist/popover/Popover.js +109 -18
- package/dist/popover/Popover.js.map +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.js.map +1 -1
- package/dist/radio-group/RadioGroup.css +90 -0
- package/dist/radio-group/RadioGroup.d.ts +22 -3
- package/dist/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/radio-group/RadioGroup.js +214 -43
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/RadioGroup.module.js +12 -2
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +2 -2
- package/dist/radio-group/tokens.d.ts.map +1 -1
- package/dist/radio-group/tokens.js +22 -2
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/root/PanneauRoot.js +197 -49
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/ThemeScope.js +107 -26
- package/dist/root/ThemeScope.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.js +120 -22
- package/dist/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/segmented-control/tokens.js.map +1 -1
- package/dist/select/ListBox.css +15 -0
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/select/Select.js +298 -92
- package/dist/select/Select.js.map +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.css +84 -0
- package/dist/slider/Slider.d.ts +20 -0
- package/dist/slider/Slider.d.ts.map +1 -0
- package/dist/slider/Slider.js +248 -0
- package/dist/slider/Slider.js.map +1 -0
- package/dist/slider/Slider.module.js +20 -0
- package/dist/slider/Slider.module.js.map +1 -0
- package/dist/spinner/Spinner.js +49 -9
- package/dist/spinner/Spinner.js.map +1 -1
- package/dist/spinner/tokens.js.map +1 -1
- package/dist/stack/Stack.js +60 -7
- package/dist/stack/Stack.js.map +1 -1
- package/dist/stack/tokens.js.map +1 -1
- package/dist/switch/Switch.js +68 -11
- package/dist/switch/Switch.js.map +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.js.map +1 -1
- package/dist/tags-input/TagsInput.css +60 -0
- package/dist/tags-input/TagsInput.d.ts +32 -0
- package/dist/tags-input/TagsInput.d.ts.map +1 -0
- package/dist/tags-input/TagsInput.js +316 -0
- package/dist/tags-input/TagsInput.js.map +1 -0
- package/dist/tags-input/TagsInput.module.js +20 -0
- package/dist/tags-input/TagsInput.module.js.map +1 -0
- package/dist/text/Text.js +70 -5
- package/dist/text/Text.js.map +1 -1
- package/dist/text/tokens.js.map +1 -1
- package/dist/text-area/TextArea.js +135 -28
- package/dist/text-area/TextArea.js.map +1 -1
- package/dist/text-input/TextInput.js +164 -49
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/bootstrap.js.map +1 -1
- package/dist/theme/chartColors.js.map +1 -1
- package/dist/theme/checkTheme.js.map +1 -1
- package/dist/theme/cli.js.map +1 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/colorVision.js.map +1 -1
- package/dist/theme/componentTokens.js.map +1 -1
- package/dist/theme/components.d.ts +4 -1
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +6 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/defineTheme.js.map +1 -1
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/semanticTokens.js.map +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/toneClass.js.map +1 -1
- package/dist/theme/tones.js.map +1 -1
- package/dist/time-input/TimeInput.js +138 -31
- package/dist/time-input/TimeInput.js.map +1 -1
- package/dist/toast/Toast.js +1 -1
- package/dist/toast/Toast.js.map +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.js.map +1 -1
- package/dist/utils/cx.js.map +1 -1
- package/package.json +3 -3
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":";;;;;;;AAoBA,SAAOa,OAAAQ,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAH;CAAA,IAAAI;CAAA,IAAAF,EAAA,OAAAD,IAAA;EAAc,CAAA,CAAAD,WAAA,GAAA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UAAD;GAAa,GAAKlB;GAAkB,WAAAC;EAAgD,CAAA;EAAIH,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAxFK;AAAwF"}
|
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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* The tags as chips in the control, before the input. */
|
|
2
|
+
|
|
3
|
+
.panneau-tags-input-control.panneau-tags-input-control {
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
gap: var(--panneau-space-1);
|
|
6
|
+
height: auto;
|
|
7
|
+
padding-block: var(--panneau-space-1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.panneau-tags-input-group {
|
|
11
|
+
display: contents;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.panneau-tags-input-list {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.panneau-tags-input-tag {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--panneau-space-1);
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
padding: 0.125rem var(--panneau-space-1) 0.125rem var(--panneau-space-2);
|
|
24
|
+
font-size: var(--panneau-font-size-sm);
|
|
25
|
+
line-height: var(--panneau-line-height-tight);
|
|
26
|
+
color: var(--panneau-color-text);
|
|
27
|
+
background-color: var(--panneau-color-surface-sunken);
|
|
28
|
+
border: var(--panneau-border-width) solid var(--panneau-color-border);
|
|
29
|
+
border-radius: var(--panneau-radius-full);
|
|
30
|
+
outline: none;
|
|
31
|
+
overflow-wrap: anywhere;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.panneau-tags-input-tag[data-focus-visible] {
|
|
35
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
36
|
+
outline-offset: 1px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.panneau-tags-input-remove {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
padding: 0.125rem;
|
|
44
|
+
color: var(--panneau-color-text-muted);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
background: none;
|
|
47
|
+
border: 0;
|
|
48
|
+
border-radius: var(--panneau-radius-full);
|
|
49
|
+
outline: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.panneau-tags-input-remove[data-hovered] {
|
|
53
|
+
color: var(--panneau-color-text);
|
|
54
|
+
background-color: var(--panneau-color-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.panneau-tags-input-input {
|
|
58
|
+
flex: 1 1 6rem;
|
|
59
|
+
min-width: 6rem;
|
|
60
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type FieldChromeProps } from '../field/FieldParts';
|
|
2
|
+
/** A suggested tag: its value, and the label shown for it. */
|
|
3
|
+
export interface TagSuggestion {
|
|
4
|
+
value: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TagsInputProps extends FieldChromeProps {
|
|
8
|
+
/** The tags, or `null` when there are none. */
|
|
9
|
+
value?: readonly string[] | null;
|
|
10
|
+
/** Called with the tags, or `null` when the last one is removed. */
|
|
11
|
+
onChange?: (value: string[] | null) => void;
|
|
12
|
+
onBlur?: () => void;
|
|
13
|
+
/** Tags offered as the user types. */
|
|
14
|
+
suggestions?: readonly TagSuggestion[];
|
|
15
|
+
/** Whether tags outside the suggestions are allowed. Defaults to true. */
|
|
16
|
+
allowCustom?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
isRequired?: boolean;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
isReadOnly?: boolean;
|
|
22
|
+
autoFocus?: boolean;
|
|
23
|
+
controlClassName?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A list of words. Enter, Tab or a comma adds what is typed, Backspace in the empty input removes
|
|
27
|
+
* the last tag, and pasting a list separated by commas or lines adds each one. Tags are trimmed,
|
|
28
|
+
* and a tag already in the list isn't added again. Suggestions complete what is typed; without
|
|
29
|
+
* `allowCustom`, only they can be added.
|
|
30
|
+
*/
|
|
31
|
+
export declare function TagsInput({ label, description, errors, value, onChange, onBlur, suggestions, allowCustom, placeholder, name, isRequired, isDisabled, isReadOnly, autoFocus, className, labelClassName, descriptionClassName, errorsClassName, controlClassName, }: TagsInputProps): import("react").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=TagsInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagsInput.d.ts","sourceRoot":"","sources":["../../src/tags-input/TagsInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,qBAAqB,CAAC;AAOzE,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,+CAA+C;IAC/C,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACtB,KAAK,EACL,WAAW,EACX,MAAW,EACX,KAAK,EACL,QAAQ,EACR,MAAM,EACN,WAAgB,EAChB,WAAkB,EAClB,WAAW,EACX,IAAI,EACJ,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,GACnB,EAAE,cAAc,+BAyLhB"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { cx } from "../utils/cx.js";
|
|
2
|
+
import { Icon } from "../icon/Icon.js";
|
|
3
|
+
import { messages } from "../intl/messages.js";
|
|
4
|
+
import { usePanneauIntl } from "../intl/usePanneauIntl.js";
|
|
5
|
+
import Field_module_default from "../field/Field.module.js";
|
|
6
|
+
import TagsInput_module_default from "./TagsInput.module.js";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { X } from "lucide-react";
|
|
9
|
+
import { Button, Tag, TagGroup, TagList } from "react-aria-components";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useId, useState } from "react";
|
|
12
|
+
//#region src/tags-input/TagsInput.tsx
|
|
13
|
+
/**
|
|
14
|
+
* A list of words. Enter, Tab or a comma adds what is typed, Backspace in the empty input removes
|
|
15
|
+
* the last tag, and pasting a list separated by commas or lines adds each one. Tags are trimmed,
|
|
16
|
+
* and a tag already in the list isn't added again. Suggestions complete what is typed; without
|
|
17
|
+
* `allowCustom`, only they can be added.
|
|
18
|
+
*/
|
|
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;
|
|
31
|
+
const intl = usePanneauIntl();
|
|
32
|
+
const id = useId();
|
|
33
|
+
const [draft, setDraft] = useState("");
|
|
34
|
+
let t5;
|
|
35
|
+
if ($[2] !== value) {
|
|
36
|
+
t5 = value ?? [];
|
|
37
|
+
$[2] = value;
|
|
38
|
+
$[3] = t5;
|
|
39
|
+
} else t5 = $[3];
|
|
40
|
+
const tags = t5;
|
|
41
|
+
const invalid = errors.length > 0;
|
|
42
|
+
const editable = isDisabled !== true && isReadOnly !== true;
|
|
43
|
+
const labelOf = (tag) => suggestions.find((suggestion) => suggestion.value === tag)?.label ?? tag;
|
|
44
|
+
const resolve = (text) => {
|
|
45
|
+
const trimmed = text.trim();
|
|
46
|
+
if (trimmed === "") return null;
|
|
47
|
+
const lower = trimmed.toLocaleLowerCase();
|
|
48
|
+
const suggestion_0 = suggestions.find((candidate) => candidate.value.toLocaleLowerCase() === lower || (candidate.label ?? "").toLocaleLowerCase() === lower);
|
|
49
|
+
if (suggestion_0 !== void 0) return suggestion_0.value;
|
|
50
|
+
return allowCustom ? trimmed : null;
|
|
51
|
+
};
|
|
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 = () => {
|
|
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) {
|
|
101
|
+
event.preventDefault();
|
|
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"
|
|
185
|
+
})
|
|
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;
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
export { TagsInput };
|
|
315
|
+
|
|
316
|
+
//# sourceMappingURL=TagsInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagsInput.js","names":["X","ClipboardEvent","KeyboardEvent","useId","useState","Button","Tag","TagGroup","TagList","FieldChromeProps","fieldStyles","Icon","messages","usePanneauIntl","cx","styles","TagSuggestion","value","label","TagsInputProps","onChange","onBlur","suggestions","allowCustom","placeholder","name","isRequired","isDisabled","isReadOnly","autoFocus","controlClassName","TagsInput","t0","$","_c","description","errors","t1","t2","t3","className","labelClassName","descriptionClassName","errorsClassName","t4","undefined","intl","id","draft","setDraft","t5","tags","invalid","length","editable","labelOf","tag","find","suggestion","resolve","text","trimmed","trim","lower","toLocaleLowerCase","suggestion_0","candidate","t6","texts","next","forEach","text_0","tag_0","includes","push","add","t7","removed","next_0","filter","tag_1","has","remove","t8","commit","t9","event","key","preventDefault","Set","onKeyDown","t10","event_0","text_1","clipboardData","getData","test","split","onPaste","t11","t12","t13","_temp","describedBy","join","t14","field","t15","required","t16","control","t17","t18","t19","t20","formatMessage","group","list","map","tag_2","t21","bare","input","event_1","target","t22","suggestion_1","_temp2","t23","t24","tag_3","t25","t26","_temp3","t27","error","index","suggestion_2","part","_c","fieldStyles","styles"],"sources":["../../src/tags-input/TagsInput.tsx"],"sourcesContent":["import { X } from 'lucide-react';\nimport { type ClipboardEvent, type KeyboardEvent, useId, useState } from 'react';\nimport { Button, Tag, TagGroup, TagList } from 'react-aria-components';\n\nimport { type FieldChromeProps, fieldStyles } from '../field/FieldParts';\nimport { Icon } from '../icon/Icon';\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { cx } from '../utils/cx';\nimport styles from './TagsInput.module.css';\n\n/** A suggested tag: its value, and the label shown for it. */\nexport interface TagSuggestion {\n value: string;\n label?: string;\n}\n\nexport interface TagsInputProps extends FieldChromeProps {\n /** The tags, or `null` when there are none. */\n value?: readonly string[] | null;\n /** Called with the tags, or `null` when the last one is removed. */\n onChange?: (value: string[] | null) => void;\n onBlur?: () => void;\n /** Tags offered as the user types. */\n suggestions?: readonly TagSuggestion[];\n /** Whether tags outside the suggestions are allowed. Defaults to true. */\n allowCustom?: boolean;\n placeholder?: string;\n name?: string;\n isRequired?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n autoFocus?: boolean;\n controlClassName?: string;\n}\n\n/**\n * A list of words. Enter, Tab or a comma adds what is typed, Backspace in the empty input removes\n * the last tag, and pasting a list separated by commas or lines adds each one. Tags are trimmed,\n * and a tag already in the list isn't added again. Suggestions complete what is typed; without\n * `allowCustom`, only they can be added.\n */\nexport function TagsInput({\n label,\n description,\n errors = [],\n value,\n onChange,\n onBlur,\n suggestions = [],\n allowCustom = true,\n placeholder,\n name,\n isRequired,\n isDisabled,\n isReadOnly,\n autoFocus,\n className,\n labelClassName,\n descriptionClassName,\n errorsClassName,\n controlClassName,\n}: TagsInputProps) {\n const intl = usePanneauIntl();\n const id = useId();\n const [draft, setDraft] = useState('');\n const tags = value ?? [];\n const invalid = errors.length > 0;\n const editable = isDisabled !== true && isReadOnly !== true;\n const labelOf = (tag: string) =>\n suggestions.find((suggestion) => suggestion.value === tag)?.label ?? tag;\n\n /** The tag a text adds: the suggestion it names, or the text itself when allowed. */\n const resolve = (text: string): string | null => {\n const trimmed = text.trim();\n if (trimmed === '') {\n return null;\n }\n const lower = trimmed.toLocaleLowerCase();\n const suggestion = suggestions.find(\n (candidate) =>\n candidate.value.toLocaleLowerCase() === lower ||\n (candidate.label ?? '').toLocaleLowerCase() === lower,\n );\n if (suggestion !== undefined) {\n return suggestion.value;\n }\n return allowCustom ? trimmed : null;\n };\n\n const add = (texts: readonly string[]) => {\n const next = [...tags];\n texts.forEach((text) => {\n const tag = resolve(text);\n if (tag !== null && !next.includes(tag)) {\n next.push(tag);\n }\n });\n if (next.length !== tags.length) {\n onChange?.(next);\n }\n };\n\n const remove = (removed: ReadonlySet<string | number>) => {\n const next = tags.filter((tag) => !removed.has(tag));\n onChange?.(next.length > 0 ? next : null);\n };\n\n const commit = () => {\n if (draft.trim() !== '') {\n add([draft]);\n setDraft('');\n }\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ',' || (event.key === 'Tab' && draft !== '')) {\n if (draft.trim() !== '') {\n event.preventDefault();\n commit();\n } else if (event.key !== 'Tab') {\n event.preventDefault();\n }\n } else if (event.key === 'Backspace' && draft === '' && tags.length > 0) {\n event.preventDefault();\n remove(new Set([tags[tags.length - 1] as string]));\n }\n };\n\n const onPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n const text = event.clipboardData.getData('text');\n if (/[,\\n]/.test(text)) {\n event.preventDefault();\n add(text.split(/[,\\n]/));\n }\n };\n\n const describedBy = [\n description !== undefined && description !== null ? `${id}-description` : null,\n invalid ? `${id}-errors` : null,\n ]\n .filter((part) => part !== null)\n .join(' ');\n\n return (\n <div className={cx('panneau-tags-input', fieldStyles.field, className)}>\n {label !== undefined && label !== null ? (\n <label htmlFor={`${id}-input`} className={cx(fieldStyles.label, labelClassName)}>\n {label}\n {isRequired === true ? (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n ) : null}\n </label>\n ) : null}\n <div\n className={cx(fieldStyles.control, styles.control, controlClassName)}\n data-invalid={invalid || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n >\n {tags.length > 0 ? (\n <TagGroup\n aria-label={intl.formatMessage(messages.tags, {\n label: typeof label === 'string' ? label : '',\n })}\n onRemove={editable ? remove : undefined}\n className={styles.group}\n >\n <TagList className={styles.list}>\n {tags.map((tag) => (\n <Tag\n key={tag}\n id={tag}\n textValue={labelOf(tag)}\n className={styles.tag}\n >\n {labelOf(tag)}\n {editable ? (\n <Button slot=\"remove\" className={styles.remove}>\n <Icon icon={X} size=\"xs\" />\n </Button>\n ) : null}\n </Tag>\n ))}\n </TagList>\n </TagGroup>\n ) : null}\n {editable ? (\n <input\n id={`${id}-input`}\n className={cx(fieldStyles.bare, styles.input)}\n value={draft}\n placeholder={tags.length === 0 ? placeholder : undefined}\n list={suggestions.length > 0 ? `${id}-suggestions` : undefined}\n autoComplete=\"off\"\n autoFocus={autoFocus}\n aria-invalid={invalid || undefined}\n aria-required={isRequired || undefined}\n aria-describedby={describedBy !== '' ? describedBy : undefined}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={onKeyDown}\n onPaste={onPaste}\n onBlur={() => {\n commit();\n onBlur?.();\n }}\n />\n ) : null}\n {suggestions.length > 0 ? (\n <datalist id={`${id}-suggestions`}>\n {suggestions\n .filter((suggestion) => !tags.includes(suggestion.value))\n .map((suggestion) => (\n <option\n key={suggestion.value}\n value={suggestion.label ?? suggestion.value}\n />\n ))}\n </datalist>\n ) : null}\n </div>\n {name !== undefined\n ? tags.map((tag) => (\n <input key={tag} type=\"hidden\" name={`${name}[]`} value={tag} />\n ))\n : null}\n {description !== undefined && description !== null ? (\n <div\n id={`${id}-description`}\n className={cx(fieldStyles.description, descriptionClassName)}\n >\n {description}\n </div>\n ) : null}\n {invalid ? (\n <div id={`${id}-errors`} className={cx(fieldStyles.errors, errorsClassName)}>\n {errors.map((error, index) => (\n <span key={index} className={fieldStyles.error}>\n {error}\n </span>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,SAAO+B,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAmB,MAAA,EAAAhB,OAAAiB,aAAAC,QAAAC,IAAApB,OAAAG,UAAAC,QAAAC,aAAAgB,IAAAf,aAAAgB,IAAAf,aAAAC,MAAAC,YAAAC,YAAAC,YAAAC,WAAAW,WAAAC,gBAAAC,sBAAAC,iBAAAb,qBAAAE;CAoBT,IAAAY;CAAA,IAAAX,EAAA,OAAAI,IAAA;EAjBbO,KAAAP,OAAAQ,KAAAA,IAAA,CAAA,IAAAR;EAAWJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAX,MAAAG,SAAAQ;CAIA,MAAAtB,cAAAgB,OAAAO,KAAAA,IAAA,CAAA,IAAAP;CACA,MAAAf,cAAAgB,OAAAM,KAAAA,IAAA,OAAAN;CAaA,MAAAO,OAAajC,eAAe;CAC5B,MAAAkC,KAAW5C,MAAM;CACjB,MAAA,CAAA6C,OAAAC,YAA0B7C,SAAS,EAA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AAMkF,IAAKe,MAIX;EACC,CAAA,IAPT;EAQOpG,EAAA,MAAAG;EAAAH,EAAA,MAAAU;EAAAV,EAAA,MAAAc;EAAAd,EAAA,MAAAmB;EAAAnB,EAAA,MAAAmG;CAAA,OAAAA,MAAAnG,EAAA;CAAA,IAAAqG;CAAA,IAAArG,EAAA,QAAAwE,OAAAxE,EAAA,QAAA0E,OAAA1E,EAAA,QAAA+F,OAAA/F,EAAA,QAAAgG,OAAAhG,EAAA,QAAAkG,OAAAlG,EAAA,QAAAmG,KAAA;EAnGZE,MAAA,qBAAA,OAAA;GAAgB,WAAA7B;GAAhB,UAAA;IACKE;IAUDqB;IAmECC;IAKAE;IAQAC;GASC;;EAAAnG,EAAA,MAAAwE;EAAAxE,EAAA,MAAA0E;EAAA1E,EAAA,MAAA+F;EAAA/F,EAAA,MAAAgG;EAAAhG,EAAA,MAAAkG;EAAAlG,EAAA,MAAAmG;EAAAnG,EAAA,MAAAqG;CAAA,OAAAA,MAAArG,EAAA;CAAA,OApGNqG;AAoGM;AA3MP,SAAAD,OAAAE,OAAAC,OAAA;CAAA,OAqMiB,oBAAA,QAAA;EAA6B,WAAA9H,qBAAW6H;EACnCA,UAAAA;CACE,GAFIC,KAEJ;AAAA;AAvMxB,SAAAT,OAAAU,cAAA;CAAA,OA6KyB,oBAAA,UAAA,EAEW,OAAA/E,aAAUxC,SAAUwC,aAAUzC,MAAM,GADtCyC,aAAUzC,KAC4B;AAC7C;AAhL3B,SAAAqF,MAAAoC,MAAA;CAAA,OAmGmBA,SAAS;AAAI"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "./TagsInput.css";
|
|
2
|
+
//#region src/tags-input/TagsInput.module.css
|
|
3
|
+
var control = "panneau-tags-input-control";
|
|
4
|
+
var group = "panneau-tags-input-group";
|
|
5
|
+
var list = "panneau-tags-input-list";
|
|
6
|
+
var tag = "panneau-tags-input-tag";
|
|
7
|
+
var remove = "panneau-tags-input-remove";
|
|
8
|
+
var input = "panneau-tags-input-input";
|
|
9
|
+
var TagsInput_module_default = {
|
|
10
|
+
control,
|
|
11
|
+
group,
|
|
12
|
+
list,
|
|
13
|
+
tag,
|
|
14
|
+
remove,
|
|
15
|
+
input
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { control, TagsInput_module_default as default, group, input, list, remove, tag };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=TagsInput.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TagsInput.module.js","names":[],"sources":["../../src/tags-input/TagsInput.module.css"],"sourcesContent":["/* The tags as chips in the control, before the input. */\n\n.control.control {\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n height: auto;\n padding-block: var(--panneau-space-1);\n}\n\n.group {\n display: contents;\n}\n\n.list {\n display: contents;\n}\n\n.tag {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-1);\n max-width: 100%;\n padding: 0.125rem var(--panneau-space-1) 0.125rem var(--panneau-space-2);\n font-size: var(--panneau-font-size-sm);\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n background-color: var(--panneau-color-surface-sunken);\n border: var(--panneau-border-width) solid var(--panneau-color-border);\n border-radius: var(--panneau-radius-full);\n outline: none;\n overflow-wrap: anywhere;\n}\n\n.tag[data-focus-visible] {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 1px;\n}\n\n.remove {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0.125rem;\n color: var(--panneau-color-text-muted);\n cursor: pointer;\n background: none;\n border: 0;\n border-radius: var(--panneau-radius-full);\n outline: none;\n}\n\n.remove[data-hovered] {\n color: var(--panneau-color-text);\n background-color: var(--panneau-color-hover);\n}\n\n.input {\n flex: 1 1 6rem;\n min-width: 6rem;\n}\n"],"mappings":""}
|
package/dist/text/Text.js
CHANGED
|
@@ -1,14 +1,79 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import { toneClass } from "../theme/toneClass.js";
|
|
3
3
|
import Text_module_default from "./Text.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
//#region src/text/Text.tsx
|
|
6
7
|
/** Text in the sizes, weights and font roles of the theme. */
|
|
7
|
-
function Text(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
function Text(t0) {
|
|
9
|
+
const $ = c(24);
|
|
10
|
+
let className;
|
|
11
|
+
let family;
|
|
12
|
+
let props;
|
|
13
|
+
let size;
|
|
14
|
+
let t1;
|
|
15
|
+
let t2;
|
|
16
|
+
let t3;
|
|
17
|
+
let t4;
|
|
18
|
+
let tone;
|
|
19
|
+
let weight;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
({as: t1, size, weight, family, tone, muted: t2, numeric: t3, truncate: t4, className, ...props} = t0);
|
|
22
|
+
$[0] = t0;
|
|
23
|
+
$[1] = className;
|
|
24
|
+
$[2] = family;
|
|
25
|
+
$[3] = props;
|
|
26
|
+
$[4] = size;
|
|
27
|
+
$[5] = t1;
|
|
28
|
+
$[6] = t2;
|
|
29
|
+
$[7] = t3;
|
|
30
|
+
$[8] = t4;
|
|
31
|
+
$[9] = tone;
|
|
32
|
+
$[10] = weight;
|
|
33
|
+
} else {
|
|
34
|
+
className = $[1];
|
|
35
|
+
family = $[2];
|
|
36
|
+
props = $[3];
|
|
37
|
+
size = $[4];
|
|
38
|
+
t1 = $[5];
|
|
39
|
+
t2 = $[6];
|
|
40
|
+
t3 = $[7];
|
|
41
|
+
t4 = $[8];
|
|
42
|
+
tone = $[9];
|
|
43
|
+
weight = $[10];
|
|
44
|
+
}
|
|
45
|
+
const Element = t1 === void 0 ? "p" : t1;
|
|
46
|
+
const muted = t2 === void 0 ? false : t2;
|
|
47
|
+
const numeric = t3 === void 0 ? false : t3;
|
|
48
|
+
const truncate = t4 === void 0 ? false : t4;
|
|
49
|
+
const t5 = size !== void 0 && Text_module_default[`size-${size}`];
|
|
50
|
+
const t6 = weight !== void 0 && Text_module_default[`weight-${weight}`];
|
|
51
|
+
const t7 = family !== void 0 && Text_module_default[`family-${family}`];
|
|
52
|
+
let t8;
|
|
53
|
+
if ($[11] !== className || $[12] !== muted || $[13] !== numeric || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 || $[17] !== tone || $[18] !== truncate) {
|
|
54
|
+
t8 = cx("panneau-text", Text_module_default.text, t5, t6, t7, tone !== void 0 && toneClass(tone), tone !== void 0 && Text_module_default.toned, muted && Text_module_default.muted, numeric && Text_module_default.numeric, truncate && Text_module_default.truncate, className);
|
|
55
|
+
$[11] = className;
|
|
56
|
+
$[12] = muted;
|
|
57
|
+
$[13] = numeric;
|
|
58
|
+
$[14] = t5;
|
|
59
|
+
$[15] = t6;
|
|
60
|
+
$[16] = t7;
|
|
61
|
+
$[17] = tone;
|
|
62
|
+
$[18] = truncate;
|
|
63
|
+
$[19] = t8;
|
|
64
|
+
} else t8 = $[19];
|
|
65
|
+
let t9;
|
|
66
|
+
if ($[20] !== Element || $[21] !== props || $[22] !== t8) {
|
|
67
|
+
t9 = /* @__PURE__ */ jsx(Element, {
|
|
68
|
+
...props,
|
|
69
|
+
className: t8
|
|
70
|
+
});
|
|
71
|
+
$[20] = Element;
|
|
72
|
+
$[21] = props;
|
|
73
|
+
$[22] = t8;
|
|
74
|
+
$[23] = t9;
|
|
75
|
+
} else t9 = $[23];
|
|
76
|
+
return t9;
|
|
12
77
|
}
|
|
13
78
|
//#endregion
|
|
14
79
|
export { Text };
|
package/dist/text/Text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":["styles"],"sources":["../../src/text/Text.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Text.module.css';\n\n/** A size of the font scale of the theme. */\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** A font role of the theme. */\nexport type TextFamily = 'body' | 'heading' | 'display' | 'mono';\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n /** Element to render. Defaults to `p`. */\n as?: 'p' | 'span' | 'div' | 'small' | 'strong' | 'em';\n /** Font size, from the scale of the theme. Inherited by default. */\n size?: TextSize;\n /** Inherited by default. */\n weight?: 'normal' | 'medium' | 'bold';\n /** Font role. Inherited by default. */\n family?: TextFamily;\n /** Colors the text with a tone (`success`, `danger`…), readable on surfaces. */\n tone?: Tone;\n /** The muted text color, for secondary information. */\n muted?: boolean;\n /** Digits of equal width, so that numbers line up: stats, dates, ids. */\n numeric?: boolean;\n /** Keeps the text on one line, cut with an ellipsis. */\n truncate?: boolean;\n}\n\n/** Text in the sizes, weights and font roles of the theme. */\nexport function Text({\n as: Element = 'p',\n size,\n weight,\n family,\n tone,\n muted = false,\n numeric = false,\n truncate = false,\n className,\n ...props\n}: TextProps) {\n return (\n <Element\n {...props}\n className={cx(\n 'panneau-text',\n styles.text,\n size !== undefined && styles[`size-${size}`],\n weight !== undefined && styles[`weight-${weight}`],\n family !== undefined && styles[`family-${family}`],\n tone !== undefined && toneClass(tone),\n tone !== undefined && styles.toned,\n muted && styles.muted,\n numeric && styles.numeric,\n truncate && styles.truncate,\n className,\n )}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Text.js","names":["HTMLAttributes","toneClass","Tone","cx","styles","TextSize","TextFamily","TextProps","HTMLElement","as","size","weight","family","tone","muted","numeric","truncate","Text","t0","$","_c","className","props","t1","t2","t3","t4","Element","undefined","t5","t6","t7","t8","text","toned","t9","_c","styles"],"sources":["../../src/text/Text.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Text.module.css';\n\n/** A size of the font scale of the theme. */\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** A font role of the theme. */\nexport type TextFamily = 'body' | 'heading' | 'display' | 'mono';\n\nexport interface TextProps extends HTMLAttributes<HTMLElement> {\n /** Element to render. Defaults to `p`. */\n as?: 'p' | 'span' | 'div' | 'small' | 'strong' | 'em';\n /** Font size, from the scale of the theme. Inherited by default. */\n size?: TextSize;\n /** Inherited by default. */\n weight?: 'normal' | 'medium' | 'bold';\n /** Font role. Inherited by default. */\n family?: TextFamily;\n /** Colors the text with a tone (`success`, `danger`…), readable on surfaces. */\n tone?: Tone;\n /** The muted text color, for secondary information. */\n muted?: boolean;\n /** Digits of equal width, so that numbers line up: stats, dates, ids. */\n numeric?: boolean;\n /** Keeps the text on one line, cut with an ellipsis. */\n truncate?: boolean;\n}\n\n/** Text in the sizes, weights and font roles of the theme. */\nexport function Text({\n as: Element = 'p',\n size,\n weight,\n family,\n tone,\n muted = false,\n numeric = false,\n truncate = false,\n className,\n ...props\n}: TextProps) {\n return (\n <Element\n {...props}\n className={cx(\n 'panneau-text',\n styles.text,\n size !== undefined && styles[`size-${size}`],\n weight !== undefined && styles[`weight-${weight}`],\n family !== undefined && styles[`family-${family}`],\n tone !== undefined && toneClass(tone),\n tone !== undefined && styles.toned,\n muted && styles.muted,\n numeric && styles.numeric,\n truncate && styles.truncate,\n className,\n )}\n />\n );\n}\n"],"mappings":";;;;;;;AAiCA,SAAOiB,KAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAZ;CAAA,IAAAa;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAb;CAAA,IAAAF;CAAA,IAAAQ,EAAA,OAAAD,IAAA;EAAc,CAAA,CAAAT,IAAAc,IAAAb,MAAAC,QAAAC,QAAAC,MAAAC,OAAAU,IAAAT,SAAAU,IAAAT,UAAAU,IAAAL,WAAA,GAAAC,SAAAJ;EAW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BK,SACJ;EAACF,EAAA,MAAAE;EAAAF,EAAA,MAAAL;EAAAK,EAAA,MAAAJ;EAAAI,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAY;EAAAZ,EAAA,MAAAN;EAAAM,EAAA,MAAAH;EAAAG,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,QAAAQ,WAAAR,EAAA,QAAAG,SAAAH,EAAA,QAAAa,IAAA;EAdLG,KAAA,oBAAC,SAAD;GAAQ,GACAb;GACO,WAAAU;EAYV,CAAA;EACHb,EAAA,MAAAQ;EAAAR,EAAA,MAAAG;EAAAH,EAAA,MAAAa;EAAAb,EAAA,MAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,OAfFgB;AAeE"}
|
package/dist/text/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/text/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Text. */\nexport const textTokens = defineComponentTokens('text', {\n /** Color of muted text. */\n 'muted-color': 'var(--panneau-color-text-muted)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","textTokens"],"sources":["../../src/text/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Text. */\nexport const textTokens = defineComponentTokens('text', {\n /** Color of muted text. */\n 'muted-color': 'var(--panneau-color-text-muted)',\n});\n"],"mappings":";;;AAGA,IAAaC,aAAaD,sBAAsB,QAAQ;;AAEpD,eAAe,kCACnB,CAAC"}
|