@panneau/ui 5.0.0-alpha.2 → 5.0.0-alpha.20
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 +144 -15
- 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 +20 -6
- package/dist/button/Button.d.ts.map +1 -1
- package/dist/button/Button.js +169 -22
- package/dist/button/Button.js.map +1 -1
- package/dist/button/LinkButton.d.ts +22 -0
- package/dist/button/LinkButton.d.ts.map +1 -0
- package/dist/button/LinkButton.js +113 -0
- package/dist/button/LinkButton.js.map +1 -0
- 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.css +9 -9
- package/dist/checkbox/Checkbox.d.ts +1 -1
- package/dist/checkbox/Checkbox.js +87 -26
- package/dist/checkbox/Checkbox.js.map +1 -1
- package/dist/checkbox/Checkbox.module.js +3 -3
- package/dist/checkbox/Checkbox.module.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.css +10 -0
- package/dist/combo-box/ComboBox.d.ts +7 -2
- package/dist/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/combo-box/ComboBox.js +310 -78
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/combo-box/ComboBox.module.js +4 -2
- package/dist/combo-box/ComboBox.module.js.map +1 -1
- package/dist/command-palette/CommandPalette.css +299 -0
- package/dist/command-palette/CommandPalette.d.ts +37 -0
- package/dist/command-palette/CommandPalette.d.ts.map +1 -0
- package/dist/command-palette/CommandPalette.js +497 -0
- package/dist/command-palette/CommandPalette.js.map +1 -0
- package/dist/command-palette/CommandPalette.module.js +62 -0
- package/dist/command-palette/CommandPalette.module.js.map +1 -0
- package/dist/command-palette/match.d.ts +39 -0
- package/dist/command-palette/match.d.ts.map +1 -0
- package/dist/command-palette/match.js +44 -0
- package/dist/command-palette/match.js.map +1 -0
- package/dist/command-palette/tokens.d.ts +3 -0
- package/dist/command-palette/tokens.d.ts.map +1 -0
- package/dist/command-palette/tokens.js +23 -0
- package/dist/command-palette/tokens.js.map +1 -0
- package/dist/command-palette/useCommandShortcut.d.ts +12 -0
- package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
- package/dist/command-palette/useCommandShortcut.js +48 -0
- package/dist/command-palette/useCommandShortcut.js.map +1 -0
- 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.css +40 -0
- package/dist/date-picker/DatePicker.d.ts +3 -2
- package/dist/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/date-picker/DatePicker.js +279 -72
- package/dist/date-picker/DatePicker.js.map +1 -1
- package/dist/date-picker/DatePicker.module.js +5 -1
- package/dist/date-picker/DatePicker.module.js.map +1 -1
- package/dist/date-picker/calendarTokens.d.ts +1 -1
- package/dist/date-picker/calendarTokens.js.map +1 -1
- package/dist/date-range-picker/DateRangePicker.css +37 -0
- package/dist/date-range-picker/DateRangePicker.d.ts +41 -0
- package/dist/date-range-picker/DateRangePicker.d.ts.map +1 -0
- package/dist/date-range-picker/DateRangePicker.js +438 -0
- package/dist/date-range-picker/DateRangePicker.js.map +1 -0
- package/dist/date-range-picker/DateRangePicker.module.js +20 -0
- package/dist/date-range-picker/DateRangePicker.module.js.map +1 -0
- package/dist/dialog/Dialog.css +41 -2
- package/dist/dialog/Dialog.d.ts +15 -3
- package/dist/dialog/Dialog.d.ts.map +1 -1
- package/dist/dialog/Dialog.js +161 -32
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/Dialog.module.js +10 -2
- package/dist/dialog/Dialog.module.js.map +1 -1
- package/dist/dialog/tokens.d.ts +1 -1
- package/dist/dialog/tokens.d.ts.map +1 -1
- package/dist/dialog/tokens.js +2 -0
- 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/Field.css +26 -0
- package/dist/field/Field.module.js +6 -2
- package/dist/field/Field.module.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.d.ts +6 -1
- package/dist/field/Fieldset.d.ts.map +1 -1
- package/dist/field/Fieldset.js +132 -33
- 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 +9 -0
- package/dist/icon/lucideIconLoader.d.ts.map +1 -0
- package/dist/icon/lucideIconLoader.js +22 -0
- package/dist/icon/lucideIconLoader.js.map +1 -0
- package/dist/icon/namedIcons.d.ts +16 -9
- package/dist/icon/namedIcons.d.ts.map +1 -1
- package/dist/icon/namedIcons.js +121 -46
- 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 +65 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- 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/line-chart/LineChart.css +84 -0
- package/dist/line-chart/LineChart.d.ts +26 -0
- package/dist/line-chart/LineChart.d.ts.map +1 -0
- package/dist/line-chart/LineChart.js +327 -0
- package/dist/line-chart/LineChart.js.map +1 -0
- package/dist/line-chart/LineChart.module.js +28 -0
- package/dist/line-chart/LineChart.module.js.map +1 -0
- package/dist/line-chart/tokens.d.ts +3 -0
- package/dist/line-chart/tokens.d.ts.map +1 -0
- package/dist/line-chart/tokens.js +19 -0
- package/dist/line-chart/tokens.js.map +1 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/menu/Menu.css +84 -0
- package/dist/menu/Menu.d.ts +34 -7
- 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/named-icons/index.d.ts +2 -0
- package/dist/named-icons/index.d.ts.map +1 -0
- package/dist/named-icons/index.js +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js +136 -0
- package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
- package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/conversion.js +116 -0
- package/dist/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/manipulation.js +206 -0
- package/dist/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/queries.js +26 -0
- package/dist/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/string.js +19 -0
- package/dist/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/utils.js +8 -0
- package/dist/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
- package/dist/number-input/NumberInput.css +18 -0
- 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/NumberInput.module.js +3 -1
- package/dist/number-input/NumberInput.module.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.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.css +5 -0
- package/dist/popover/Popover.d.ts.map +1 -1
- package/dist/popover/Popover.js +116 -20
- package/dist/popover/Popover.js.map +1 -1
- package/dist/popover/Popover.module.js +4 -2
- package/dist/popover/Popover.module.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.css +90 -0
- package/dist/radio-group/RadioGroup.d.ts +24 -5
- 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.css +24 -0
- package/dist/root/PanneauRoot.d.ts +40 -4
- package/dist/root/PanneauRoot.d.ts.map +1 -1
- package/dist/root/PanneauRoot.js +284 -82
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/PanneauRoot.module.js.map +1 -1
- package/dist/root/ThemeScope.d.ts +1 -1
- package/dist/root/ThemeScope.d.ts.map +1 -1
- package/dist/root/ThemeScope.js +110 -27
- package/dist/root/ThemeScope.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.css +83 -0
- package/dist/segmented-control/SegmentedControl.d.ts +35 -0
- package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
- package/dist/segmented-control/SegmentedControl.js +142 -0
- package/dist/segmented-control/SegmentedControl.js.map +1 -0
- package/dist/segmented-control/SegmentedControl.module.js +16 -0
- package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
- package/dist/segmented-control/tokens.d.ts +3 -0
- package/dist/segmented-control/tokens.d.ts.map +1 -0
- package/dist/segmented-control/tokens.js +29 -0
- package/dist/segmented-control/tokens.js.map +1 -0
- package/dist/select/ListBox.css +75 -1
- package/dist/select/ListBox.module.js +9 -3
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/select/Select.d.ts +14 -1
- package/dist/select/Select.d.ts.map +1 -1
- package/dist/select/Select.js +335 -92
- package/dist/select/Select.js.map +1 -1
- package/dist/select/listBoxTokens.d.ts +1 -1
- package/dist/select/listBoxTokens.d.ts.map +1 -1
- package/dist/select/listBoxTokens.js +2 -0
- 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.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/stat/Stat.css +45 -0
- package/dist/stat/Stat.d.ts +27 -0
- package/dist/stat/Stat.d.ts.map +1 -0
- package/dist/stat/Stat.js +87 -0
- package/dist/stat/Stat.js.map +1 -0
- package/dist/stat/Stat.module.js +18 -0
- package/dist/stat/Stat.module.js.map +1 -0
- package/dist/stat/tokens.d.ts +3 -0
- package/dist/stat/tokens.d.ts.map +1 -0
- package/dist/stat/tokens.js +21 -0
- package/dist/stat/tokens.js.map +1 -0
- package/dist/switch/Switch.css +8 -8
- package/dist/switch/Switch.d.ts +1 -1
- package/dist/switch/Switch.js +69 -12
- package/dist/switch/Switch.js.map +1 -1
- package/dist/switch/Switch.module.js +3 -2
- package/dist/switch/Switch.module.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.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.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.css +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-area/TextArea.module.js +3 -3
- package/dist/text-area/TextArea.module.js.map +1 -1
- package/dist/text-input/TextInput.d.ts +7 -3
- package/dist/text-input/TextInput.d.ts.map +1 -1
- package/dist/text-input/TextInput.js +164 -47
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/Tone.css +14 -0
- package/dist/theme/Tone.module.js +4 -2
- package/dist/theme/Tone.module.js.map +1 -1
- package/dist/theme/bootstrap.d.ts +2 -2
- package/dist/theme/bootstrap.d.ts.map +1 -1
- package/dist/theme/bootstrap.js +6 -0
- 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.d.ts.map +1 -1
- package/dist/theme/checkTheme.js +24 -0
- 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 +10 -3
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +14 -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/index.js +1 -1
- package/dist/theme/semanticTokens.d.ts +1 -1
- package/dist/theme/semanticTokens.d.ts.map +1 -1
- package/dist/theme/semanticTokens.js +6 -0
- 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 +15 -3
- package/dist/theme/tones.d.ts.map +1 -1
- package/dist/theme/tones.js +14 -2
- 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.css +131 -15
- package/dist/toast/Toast.d.ts +47 -10
- package/dist/toast/Toast.d.ts.map +1 -1
- package/dist/toast/Toast.js +191 -66
- package/dist/toast/Toast.js.map +1 -1
- package/dist/toast/Toast.module.js +5 -3
- package/dist/toast/Toast.module.js.map +1 -1
- package/dist/toast/tokens.d.ts +1 -1
- package/dist/toast/tokens.js +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/dist/utils/events.d.ts +4 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +9 -0
- package/dist/utils/events.js.map +1 -0
- package/package.json +10 -5
package/dist/root/ThemeScope.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import PanneauRoot_module_default from "./PanneauRoot.module.js";
|
|
3
3
|
import { PortalProvider, ScopeContext, useThemeStyles } from "./PanneauRoot.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { use, useState } from "react";
|
|
6
7
|
//#region src/root/ThemeScope.tsx
|
|
@@ -13,35 +14,117 @@ import { use, useState } from "react";
|
|
|
13
14
|
* What it doesn't set comes from its parent: a scope with only a density keeps the colors of the
|
|
14
15
|
* theme around it.
|
|
15
16
|
*/
|
|
16
|
-
function ThemeScope(
|
|
17
|
+
function ThemeScope(t0) {
|
|
18
|
+
const $ = c(32);
|
|
19
|
+
let children;
|
|
20
|
+
let className;
|
|
21
|
+
let colorScheme;
|
|
22
|
+
let density;
|
|
23
|
+
let props;
|
|
24
|
+
let t1;
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[0] !== t0) {
|
|
27
|
+
({as: t1, theme: t2, colorScheme, density, className, children, ...props} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = children;
|
|
30
|
+
$[2] = className;
|
|
31
|
+
$[3] = colorScheme;
|
|
32
|
+
$[4] = density;
|
|
33
|
+
$[5] = props;
|
|
34
|
+
$[6] = t1;
|
|
35
|
+
$[7] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
children = $[1];
|
|
38
|
+
className = $[2];
|
|
39
|
+
colorScheme = $[3];
|
|
40
|
+
density = $[4];
|
|
41
|
+
props = $[5];
|
|
42
|
+
t1 = $[6];
|
|
43
|
+
t2 = $[7];
|
|
44
|
+
}
|
|
45
|
+
const Element = t1 === void 0 ? "div" : t1;
|
|
46
|
+
const theme = t2 === void 0 ? null : t2;
|
|
17
47
|
const parent = use(ScopeContext);
|
|
18
48
|
const [container, setContainer] = useState(null);
|
|
19
|
-
const { scope, styles: themeStyles } = useThemeStyles(theme);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
]
|
|
44
|
-
}
|
|
49
|
+
const { scope, styles: themeStyles } = useThemeStyles(theme, parent.nonce);
|
|
50
|
+
const t3 = colorScheme ?? parent.colorScheme;
|
|
51
|
+
const t4 = density ?? parent.density;
|
|
52
|
+
let t5;
|
|
53
|
+
if ($[8] !== parent.nonce || $[9] !== t3 || $[10] !== t4) {
|
|
54
|
+
t5 = {
|
|
55
|
+
colorScheme: t3,
|
|
56
|
+
density: t4,
|
|
57
|
+
nonce: parent.nonce
|
|
58
|
+
};
|
|
59
|
+
$[8] = parent.nonce;
|
|
60
|
+
$[9] = t3;
|
|
61
|
+
$[10] = t4;
|
|
62
|
+
$[11] = t5;
|
|
63
|
+
} else t5 = $[11];
|
|
64
|
+
const effective = t5;
|
|
65
|
+
const t6 = colorScheme !== void 0 && PanneauRoot_module_default.scheme;
|
|
66
|
+
const t7 = density !== void 0 && PanneauRoot_module_default.density;
|
|
67
|
+
let t8;
|
|
68
|
+
if ($[12] !== className || $[13] !== t6 || $[14] !== t7) {
|
|
69
|
+
t8 = cx("panneau-theme-scope", PanneauRoot_module_default.scope, t6, t7, className);
|
|
70
|
+
$[12] = className;
|
|
71
|
+
$[13] = t6;
|
|
72
|
+
$[14] = t7;
|
|
73
|
+
$[15] = t8;
|
|
74
|
+
} else t8 = $[15];
|
|
75
|
+
let t9;
|
|
76
|
+
if ($[16] !== children || $[17] !== container) {
|
|
77
|
+
t9 = /* @__PURE__ */ jsx(PortalProvider, {
|
|
78
|
+
value: container,
|
|
79
|
+
children
|
|
80
|
+
});
|
|
81
|
+
$[16] = children;
|
|
82
|
+
$[17] = container;
|
|
83
|
+
$[18] = t9;
|
|
84
|
+
} else t9 = $[18];
|
|
85
|
+
let t10;
|
|
86
|
+
if ($[19] !== effective || $[20] !== t9) {
|
|
87
|
+
t10 = /* @__PURE__ */ jsx(ScopeContext, {
|
|
88
|
+
value: effective,
|
|
89
|
+
children: t9
|
|
90
|
+
});
|
|
91
|
+
$[19] = effective;
|
|
92
|
+
$[20] = t9;
|
|
93
|
+
$[21] = t10;
|
|
94
|
+
} else t10 = $[21];
|
|
95
|
+
let t11;
|
|
96
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
+
t11 = /* @__PURE__ */ jsx("div", {
|
|
98
|
+
ref: setContainer,
|
|
99
|
+
className: PanneauRoot_module_default.portal
|
|
100
|
+
});
|
|
101
|
+
$[22] = t11;
|
|
102
|
+
} else t11 = $[22];
|
|
103
|
+
let t12;
|
|
104
|
+
if ($[23] !== Element || $[24] !== effective.colorScheme || $[25] !== effective.density || $[26] !== props || $[27] !== scope || $[28] !== t10 || $[29] !== t8 || $[30] !== themeStyles) {
|
|
105
|
+
t12 = /* @__PURE__ */ jsxs(Element, {
|
|
106
|
+
...props,
|
|
107
|
+
className: t8,
|
|
108
|
+
"data-color-scheme": effective.colorScheme,
|
|
109
|
+
"data-density": effective.density,
|
|
110
|
+
"data-panneau-theme": scope,
|
|
111
|
+
children: [
|
|
112
|
+
themeStyles,
|
|
113
|
+
t10,
|
|
114
|
+
t11
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
$[23] = Element;
|
|
118
|
+
$[24] = effective.colorScheme;
|
|
119
|
+
$[25] = effective.density;
|
|
120
|
+
$[26] = props;
|
|
121
|
+
$[27] = scope;
|
|
122
|
+
$[28] = t10;
|
|
123
|
+
$[29] = t8;
|
|
124
|
+
$[30] = themeStyles;
|
|
125
|
+
$[31] = t12;
|
|
126
|
+
} else t12 = $[31];
|
|
127
|
+
return t12;
|
|
45
128
|
}
|
|
46
129
|
//#endregion
|
|
47
130
|
export { ThemeScope };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeScope.js","names":["styles"],"sources":["../../src/root/ThemeScope.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, use, useState } from 'react';\n\nimport type { ColorScheme, Density, Theme } from '../theme/theme';\nimport { cx } from '../utils/cx';\nimport { PortalProvider, ScopeContext, useThemeStyles } from './PanneauRoot';\nimport styles from './PanneauRoot.module.css';\n\nexport interface ThemeScopeProps extends HTMLAttributes<HTMLElement> {\n /** Element to render. Defaults to `div`. */\n as?: 'div' | 'section' | 'aside' | 'nav' | 'header' | 'footer' | 'main' | 'article';\n /** A theme for the subtree, over the theme of the root. */\n theme?: Theme | null;\n /** A color scheme for the subtree. Inherited by default. */\n colorScheme?: ColorScheme;\n /** A density for the subtree. Inherited by default. */\n density?: Density;\n children?: ReactNode;\n}\n\n/**\n * Applies a theme, a color scheme or a density to a subtree, like `data-bs-theme` on any element:\n * a dark sidebar in a light app, a compact table, a preview in another brand's colors. Overlays\n * opened inside it render in its own container, so that they keep its tokens. It must be inside a\n * `PanneauRoot`.\n *\n * What it doesn't set comes from its parent: a scope with only a density keeps the colors of the\n * theme around it.\n */\nexport function ThemeScope({\n as: Element = 'div',\n theme = null,\n colorScheme,\n density,\n className,\n children,\n ...props\n}: ThemeScopeProps) {\n const parent = use(ScopeContext);\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const { scope, styles: themeStyles } = useThemeStyles(theme);\n // The effective values are always written, so that the dark and density rules of a theme apply.\n // Only those set here take the default tokens back (`.scheme`, `.density`).\n const effective = {\n colorScheme: colorScheme ?? parent.colorScheme,\n density: density ?? parent.density,\n };\n return (\n <Element\n {...props}\n className={cx(\n 'panneau-theme-scope',\n styles.scope,\n colorScheme !== undefined && styles.scheme,\n density !== undefined && styles.density,\n className,\n )}\n data-color-scheme={effective.colorScheme}\n data-density={effective.density}\n data-panneau-theme={scope}\n >\n {themeStyles}\n <ScopeContext value={effective}>\n <PortalProvider value={container}>{children}</PortalProvider>\n </ScopeContext>\n <div ref={setContainer} className={styles.portal} />\n </Element>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeScope.js","names":["HTMLAttributes","ReactNode","use","useState","ColorScheme","Density","Theme","cx","PortalProvider","ScopeContext","useThemeStyles","styles","ThemeScopeProps","HTMLElement","as","theme","colorScheme","density","children","ThemeScope","t0","$","_c","className","props","t1","t2","Element","undefined","parent","container","setContainer","scope","themeStyles","nonce","t3","t4","t5","effective","t6","scheme","t7","t8","t9","t10","t11","Symbol","for","portal","t12","_c","styles"],"sources":["../../src/root/ThemeScope.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, use, useState } from 'react';\n\nimport type { ColorScheme, Density, Theme } from '../theme/theme';\nimport { cx } from '../utils/cx';\nimport { PortalProvider, ScopeContext, useThemeStyles } from './PanneauRoot';\nimport styles from './PanneauRoot.module.css';\n\nexport interface ThemeScopeProps extends HTMLAttributes<HTMLElement> {\n /** Element to render. Defaults to `div`. */\n as?: 'div' | 'section' | 'aside' | 'nav' | 'header' | 'footer' | 'main' | 'article';\n /** A theme for the subtree, over the theme of the root. */\n theme?: Theme | null;\n /** A color scheme for the subtree. Inherited by default. */\n colorScheme?: ColorScheme;\n /** A density for the subtree. Inherited by default. */\n density?: Density;\n children?: ReactNode;\n}\n\n/**\n * Applies a theme, a color scheme or a density to a subtree, like `data-bs-theme` on any element:\n * a dark sidebar in a light app, a compact table, a preview in another brand's colors. Overlays\n * opened inside it render in its own container, so that they keep its tokens. It must be inside a\n * `PanneauRoot`.\n *\n * What it doesn't set comes from its parent: a scope with only a density keeps the colors of the\n * theme around it.\n */\nexport function ThemeScope({\n as: Element = 'div',\n theme = null,\n colorScheme,\n density,\n className,\n children,\n ...props\n}: ThemeScopeProps) {\n const parent = use(ScopeContext);\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const { scope, styles: themeStyles } = useThemeStyles(theme, parent.nonce);\n // The effective values are always written, so that the dark and density rules of a theme apply.\n // Only those set here take the default tokens back (`.scheme`, `.density`).\n const effective = {\n colorScheme: colorScheme ?? parent.colorScheme,\n density: density ?? parent.density,\n nonce: parent.nonce,\n };\n return (\n <Element\n {...props}\n className={cx(\n 'panneau-theme-scope',\n styles.scope,\n colorScheme !== undefined && styles.scheme,\n density !== undefined && styles.density,\n className,\n )}\n data-color-scheme={effective.colorScheme}\n data-density={effective.density}\n data-panneau-theme={scope}\n >\n {themeStyles}\n <ScopeContext value={effective}>\n <PortalProvider value={container}>{children}</PortalProvider>\n </ScopeContext>\n <div ref={setContainer} className={styles.portal} />\n </Element>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,SAAOmB,WAAAC,IAAA;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AY,aAAA;EAjBxDgB,MAAA,qBAAC,SAAD;GAAQ,GACAzB;GACO,WAAAkB;GAOQ,qBAAAJ,UAAStB;GACd,gBAAAsB,UAASrB;GACHe,sBAAAA;GAXxB,UAAA;IAaKC;IACDW;IAGAC;GAjBI;;EAkBExB,EAAA,MAAAM;EAAAN,EAAA,MAAAiB,UAAAtB;EAAAK,EAAA,MAAAiB,UAAArB;EAAAI,EAAA,MAAAG;EAAAH,EAAA,MAAAW;EAAAX,EAAA,MAAAuB;EAAAvB,EAAA,MAAAqB;EAAArB,EAAA,MAAAY;EAAAZ,EAAA,MAAA4B;CAAA,OAAAA,MAAA5B,EAAA;CAAA,OAlBV4B;AAkBU"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.panneau-segmented-control-group {
|
|
2
|
+
--segmented-control-height: var(--panneau-control-height);
|
|
3
|
+
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
gap: 2px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
padding: var(--panneau-segmented-control-padding, 2px);
|
|
8
|
+
background-color: var(--panneau-segmented-control-bg, var(--panneau-color-surface-sunken));
|
|
9
|
+
border: var(--panneau-border-width) solid
|
|
10
|
+
var(--panneau-segmented-control-border-color, var(--panneau-color-border));
|
|
11
|
+
border-radius: var(--panneau-segmented-control-radius, var(--panneau-radius-md));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.panneau-segmented-control-sm {
|
|
15
|
+
--segmented-control-height: var(--panneau-control-height-sm);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.panneau-segmented-control-full-width {
|
|
19
|
+
display: flex;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.panneau-segmented-control-segment {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
flex: 0 1 auto;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: var(--panneau-space-2);
|
|
29
|
+
min-width: 0;
|
|
30
|
+
min-height: calc(
|
|
31
|
+
var(--segmented-control-height) - 2 * var(--panneau-segmented-control-padding, 2px) - 2 *
|
|
32
|
+
var(--panneau-border-width)
|
|
33
|
+
);
|
|
34
|
+
padding: 0 var(--panneau-segmented-control-segment-padding-x, var(--panneau-space-3));
|
|
35
|
+
font: inherit;
|
|
36
|
+
font-size: var(--panneau-font-size-control);
|
|
37
|
+
font-weight: var(
|
|
38
|
+
--panneau-segmented-control-segment-font-weight,
|
|
39
|
+
var(--panneau-font-weight-medium)
|
|
40
|
+
);
|
|
41
|
+
line-height: var(--panneau-line-height-tight);
|
|
42
|
+
color: var(--panneau-segmented-control-segment-color, var(--panneau-color-text-muted));
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
background: transparent;
|
|
46
|
+
border: 0;
|
|
47
|
+
border-radius: calc(
|
|
48
|
+
var(--panneau-segmented-control-radius, var(--panneau-radius-md)) -
|
|
49
|
+
var(--panneau-segmented-control-padding, 2px)
|
|
50
|
+
);
|
|
51
|
+
outline: none;
|
|
52
|
+
transition:
|
|
53
|
+
background-color var(--panneau-duration),
|
|
54
|
+
color var(--panneau-duration);
|
|
55
|
+
-webkit-tap-highlight-color: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.panneau-segmented-control-full-width .panneau-segmented-control-segment {
|
|
59
|
+
flex: 1 1 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.panneau-segmented-control-segment[data-hovered],
|
|
63
|
+
.panneau-segmented-control-segment[data-selected] {
|
|
64
|
+
color: var(--panneau-segmented-control-segment-color-selected, var(--panneau-color-text));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.panneau-segmented-control-segment[data-selected] {
|
|
68
|
+
background-color: var(
|
|
69
|
+
--panneau-segmented-control-segment-bg-selected,
|
|
70
|
+
var(--panneau-color-surface-raised)
|
|
71
|
+
);
|
|
72
|
+
box-shadow: var(--panneau-segmented-control-segment-shadow-selected, var(--panneau-shadow-sm));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.panneau-segmented-control-segment[data-focus-visible] {
|
|
76
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
77
|
+
outline-offset: 1px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.panneau-segmented-control-segment[data-disabled] {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IconComponent } from '../icon/Icon.js';
|
|
3
|
+
/** One choice of a segmented control. */
|
|
4
|
+
export interface SegmentedControlOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/** Text for typeahead and assistive technologies, when `label` isn't a string. */
|
|
8
|
+
textValue?: string;
|
|
9
|
+
icon?: IconComponent;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SegmentedControlProps {
|
|
13
|
+
options: readonly SegmentedControlOption[];
|
|
14
|
+
/** The selected option. Controlled with `onChange`. */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** The option selected first, when uncontrolled. Defaults to the first one. */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
/** Accessible name of the group. Without a visible label, it is required. */
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
'aria-labelledby'?: string;
|
|
22
|
+
size?: 'sm' | 'md';
|
|
23
|
+
/** Takes the width of its container, with segments of equal width. */
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
segmentClassName?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A row of a few choices, one of which is always selected: a view, a mode, a library. For more
|
|
31
|
+
* than four or five choices, or long labels, use a `Select`. It is a radio group for assistive
|
|
32
|
+
* technologies, moved through with the arrow keys.
|
|
33
|
+
*/
|
|
34
|
+
export declare function SegmentedControl({ options, value, defaultValue, onChange, size, fullWidth, isDisabled, className, segmentClassName, ...props }: SegmentedControlProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../src/segmented-control/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAIxD,yCAAyC;AACzC,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,IAAW,EACX,SAAiB,EACjB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,GAAG,KAAK,EACX,EAAE,qBAAqB,+BA6CvB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { cx } from "../utils/cx.js";
|
|
2
|
+
import { Icon } from "../icon/Icon.js";
|
|
3
|
+
import SegmentedControl_module_default from "./SegmentedControl.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
//#region src/segmented-control/SegmentedControl.tsx
|
|
9
|
+
/**
|
|
10
|
+
* A row of a few choices, one of which is always selected: a view, a mode, a library. For more
|
|
11
|
+
* than four or five choices, or long labels, use a `Select`. It is a radio group for assistive
|
|
12
|
+
* technologies, moved through with the arrow keys.
|
|
13
|
+
*/
|
|
14
|
+
function SegmentedControl(t0) {
|
|
15
|
+
const $ = c(37);
|
|
16
|
+
let className;
|
|
17
|
+
let defaultValue;
|
|
18
|
+
let isDisabled;
|
|
19
|
+
let onChange;
|
|
20
|
+
let options;
|
|
21
|
+
let props;
|
|
22
|
+
let segmentClassName;
|
|
23
|
+
let t1;
|
|
24
|
+
let t2;
|
|
25
|
+
let value;
|
|
26
|
+
if ($[0] !== t0) {
|
|
27
|
+
({options, value, defaultValue, onChange, size: t1, fullWidth: t2, isDisabled, className, segmentClassName, ...props} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = className;
|
|
30
|
+
$[2] = defaultValue;
|
|
31
|
+
$[3] = isDisabled;
|
|
32
|
+
$[4] = onChange;
|
|
33
|
+
$[5] = options;
|
|
34
|
+
$[6] = props;
|
|
35
|
+
$[7] = segmentClassName;
|
|
36
|
+
$[8] = t1;
|
|
37
|
+
$[9] = t2;
|
|
38
|
+
$[10] = value;
|
|
39
|
+
} else {
|
|
40
|
+
className = $[1];
|
|
41
|
+
defaultValue = $[2];
|
|
42
|
+
isDisabled = $[3];
|
|
43
|
+
onChange = $[4];
|
|
44
|
+
options = $[5];
|
|
45
|
+
props = $[6];
|
|
46
|
+
segmentClassName = $[7];
|
|
47
|
+
t1 = $[8];
|
|
48
|
+
t2 = $[9];
|
|
49
|
+
value = $[10];
|
|
50
|
+
}
|
|
51
|
+
const size = t1 === void 0 ? "md" : t1;
|
|
52
|
+
const fullWidth = t2 === void 0 ? false : t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[11] !== defaultValue || $[12] !== options) {
|
|
55
|
+
t3 = () => defaultValue ?? options.find(_temp)?.value;
|
|
56
|
+
$[11] = defaultValue;
|
|
57
|
+
$[12] = options;
|
|
58
|
+
$[13] = t3;
|
|
59
|
+
} else t3 = $[13];
|
|
60
|
+
const [uncontrolled, setUncontrolled] = useState(t3);
|
|
61
|
+
const selected = value ?? uncontrolled;
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[14] !== selected) {
|
|
64
|
+
t4 = selected !== void 0 ? [selected] : [];
|
|
65
|
+
$[14] = selected;
|
|
66
|
+
$[15] = t4;
|
|
67
|
+
} else t4 = $[15];
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[16] !== onChange || $[17] !== selected) {
|
|
70
|
+
t5 = (keys) => {
|
|
71
|
+
const [key] = [...keys];
|
|
72
|
+
if (key === void 0 || String(key) === selected) return;
|
|
73
|
+
setUncontrolled(String(key));
|
|
74
|
+
onChange?.(String(key));
|
|
75
|
+
};
|
|
76
|
+
$[16] = onChange;
|
|
77
|
+
$[17] = selected;
|
|
78
|
+
$[18] = t5;
|
|
79
|
+
} else t5 = $[18];
|
|
80
|
+
const t6 = SegmentedControl_module_default[size];
|
|
81
|
+
const t7 = fullWidth && SegmentedControl_module_default.fullWidth;
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[19] !== className || $[20] !== t6 || $[21] !== t7) {
|
|
84
|
+
t8 = cx("panneau-segmented-control", SegmentedControl_module_default.group, t6, t7, className);
|
|
85
|
+
$[19] = className;
|
|
86
|
+
$[20] = t6;
|
|
87
|
+
$[21] = t7;
|
|
88
|
+
$[22] = t8;
|
|
89
|
+
} else t8 = $[22];
|
|
90
|
+
let t9;
|
|
91
|
+
if ($[23] !== options || $[24] !== segmentClassName || $[25] !== size) {
|
|
92
|
+
let t10;
|
|
93
|
+
if ($[27] !== segmentClassName || $[28] !== size) {
|
|
94
|
+
t10 = (option_0) => /* @__PURE__ */ jsxs(ToggleButton, {
|
|
95
|
+
id: option_0.value,
|
|
96
|
+
isDisabled: option_0.isDisabled,
|
|
97
|
+
...option_0.textValue !== void 0 ? { "aria-label": option_0.textValue } : {},
|
|
98
|
+
className: cx("panneau-segment", SegmentedControl_module_default.segment, segmentClassName),
|
|
99
|
+
children: [option_0.icon !== void 0 ? /* @__PURE__ */ jsx(Icon, {
|
|
100
|
+
icon: option_0.icon,
|
|
101
|
+
size: size === "sm" ? "sm" : "md"
|
|
102
|
+
}) : null, option_0.label]
|
|
103
|
+
}, option_0.value);
|
|
104
|
+
$[27] = segmentClassName;
|
|
105
|
+
$[28] = size;
|
|
106
|
+
$[29] = t10;
|
|
107
|
+
} else t10 = $[29];
|
|
108
|
+
t9 = options.map(t10);
|
|
109
|
+
$[23] = options;
|
|
110
|
+
$[24] = segmentClassName;
|
|
111
|
+
$[25] = size;
|
|
112
|
+
$[26] = t9;
|
|
113
|
+
} else t9 = $[26];
|
|
114
|
+
let t10;
|
|
115
|
+
if ($[30] !== isDisabled || $[31] !== props || $[32] !== t4 || $[33] !== t5 || $[34] !== t8 || $[35] !== t9) {
|
|
116
|
+
t10 = /* @__PURE__ */ jsx(ToggleButtonGroup, {
|
|
117
|
+
...props,
|
|
118
|
+
selectionMode: "single",
|
|
119
|
+
disallowEmptySelection: true,
|
|
120
|
+
isDisabled,
|
|
121
|
+
selectedKeys: t4,
|
|
122
|
+
onSelectionChange: t5,
|
|
123
|
+
className: t8,
|
|
124
|
+
children: t9
|
|
125
|
+
});
|
|
126
|
+
$[30] = isDisabled;
|
|
127
|
+
$[31] = props;
|
|
128
|
+
$[32] = t4;
|
|
129
|
+
$[33] = t5;
|
|
130
|
+
$[34] = t8;
|
|
131
|
+
$[35] = t9;
|
|
132
|
+
$[36] = t10;
|
|
133
|
+
} else t10 = $[36];
|
|
134
|
+
return t10;
|
|
135
|
+
}
|
|
136
|
+
function _temp(option) {
|
|
137
|
+
return option.isDisabled !== true;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { SegmentedControl };
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","names":["ReactNode","useState","ToggleButton","ToggleButtonGroup","Icon","IconComponent","cx","styles","SegmentedControlOption","value","label","textValue","icon","isDisabled","SegmentedControlProps","options","defaultValue","onChange","size","fullWidth","className","segmentClassName","SegmentedControl","t0","$","_c","props","t1","t2","undefined","t3","find","_temp","uncontrolled","setUncontrolled","selected","t4","t5","keys","key","String","t6","t7","t8","group","t9","t10","option_0","option","segment","map","_c","styles"],"sources":["../../src/segmented-control/SegmentedControl.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { ToggleButton, ToggleButtonGroup } from 'react-aria-components';\n\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { cx } from '../utils/cx';\nimport styles from './SegmentedControl.module.css';\n\n/** One choice of a segmented control. */\nexport interface SegmentedControlOption {\n value: string;\n label: ReactNode;\n /** Text for typeahead and assistive technologies, when `label` isn't a string. */\n textValue?: string;\n icon?: IconComponent;\n isDisabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n options: readonly SegmentedControlOption[];\n /** The selected option. Controlled with `onChange`. */\n value?: string;\n /** The option selected first, when uncontrolled. Defaults to the first one. */\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Accessible name of the group. Without a visible label, it is required. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n size?: 'sm' | 'md';\n /** Takes the width of its container, with segments of equal width. */\n fullWidth?: boolean;\n isDisabled?: boolean;\n className?: string;\n segmentClassName?: string;\n}\n\n/**\n * A row of a few choices, one of which is always selected: a view, a mode, a library. For more\n * than four or five choices, or long labels, use a `Select`. It is a radio group for assistive\n * technologies, moved through with the arrow keys.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onChange,\n size = 'md',\n fullWidth = false,\n isDisabled,\n className,\n segmentClassName,\n ...props\n}: SegmentedControlProps) {\n const [uncontrolled, setUncontrolled] = useState(\n () => defaultValue ?? options.find((option) => option.isDisabled !== true)?.value,\n );\n const selected = value ?? uncontrolled;\n return (\n <ToggleButtonGroup\n {...props}\n selectionMode=\"single\"\n disallowEmptySelection\n isDisabled={isDisabled}\n selectedKeys={selected !== undefined ? [selected] : []}\n onSelectionChange={(keys) => {\n const [key] = [...keys];\n // React Aria reports the selected segment again when it is pressed.\n if (key === undefined || String(key) === selected) {\n return;\n }\n setUncontrolled(String(key));\n onChange?.(String(key));\n }}\n className={cx(\n 'panneau-segmented-control',\n styles.group,\n styles[size],\n fullWidth && styles.fullWidth,\n className,\n )}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n id={option.value}\n isDisabled={option.isDisabled}\n {...(option.textValue !== undefined ? { 'aria-label': option.textValue } : {})}\n className={cx('panneau-segment', styles.segment, segmentClassName)}\n >\n {option.icon !== undefined ? (\n <Icon icon={option.icon} size={size === 'sm' ? 'sm' : 'md'} />\n ) : null}\n {option.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAOsB,iBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAL;CAAA,IAAAJ;CAAA,IAAAH;CAAA,IAAAI;CAAA,IAAAF;CAAA,IAAAW;CAAA,IAAAL;CAAA,IAAAM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GAAAA,SAAMvC,KADF;GAYhBe,EAAA,MAAAH;GAAAG,EAAA,MAAAN;GAAAM,EAAA,MAAAsB;EAAA,OAAAA,MAAAtB,EAAA;EAbAqB,KAAA9B,QAAOmC,IAAKJ,GAaZ;EAACtB,EAAA,MAAAT;EAAAS,EAAA,MAAAH;EAAAG,EAAA,MAAAN;EAAAM,EAAA,MAAAqB;CAAA,OAAAA,KAAArB,EAAA;CAAA,IAAAsB;CAAA,IAAAtB,EAAA,QAAAX,cAAAW,EAAA,QAAAE,SAAAF,EAAA,QAAAY,MAAAZ,EAAA,QAAAa,MAAAb,EAAA,QAAAmB,MAAAnB,EAAA,QAAAqB,IAAA;EApCNC,MAAA,oBAAC,mBAAD;GAAkB,GACVpB;GACU,eAAA;GACd,wBAAA;GACYb;GACE,cAAAuB;GACK,mBAAAC;GASR,WAAAM;GAQVE,UAAAA;EAvBa,CAAA;EAqCErB,EAAA,MAAAX;EAAAW,EAAA,MAAAE;EAAAF,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;EAAAb,EAAA,MAAAmB;EAAAnB,EAAA,MAAAqB;EAAArB,EAAA,MAAAsB;CAAA,OAAAA,MAAAtB,EAAA;CAAA,OArCpBsB;AAqCoB;AAtDrB,SAAAd,MAAAgB,QAAA;CAAA,OAagDA,OAAMnC,eAAgB;AAAI"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./SegmentedControl.css";
|
|
2
|
+
//#region src/segmented-control/SegmentedControl.module.css
|
|
3
|
+
var group = "panneau-segmented-control-group";
|
|
4
|
+
var sm = "panneau-segmented-control-sm";
|
|
5
|
+
var fullWidth = "panneau-segmented-control-full-width";
|
|
6
|
+
var segment = "panneau-segmented-control-segment";
|
|
7
|
+
var SegmentedControl_module_default = {
|
|
8
|
+
group,
|
|
9
|
+
sm,
|
|
10
|
+
fullWidth,
|
|
11
|
+
segment
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SegmentedControl_module_default as default, fullWidth, group, segment, sm };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=SegmentedControl.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.module.js","names":[],"sources":["../../src/segmented-control/SegmentedControl.module.css"],"sourcesContent":[".group {\n --segmented-control-height: var(--panneau-control-height);\n\n display: inline-flex;\n gap: 2px;\n max-width: 100%;\n padding: var(--panneau-segmented-control-padding, 2px);\n background-color: var(--panneau-segmented-control-bg, var(--panneau-color-surface-sunken));\n border: var(--panneau-border-width) solid\n var(--panneau-segmented-control-border-color, var(--panneau-color-border));\n border-radius: var(--panneau-segmented-control-radius, var(--panneau-radius-md));\n}\n\n.sm {\n --segmented-control-height: var(--panneau-control-height-sm);\n}\n\n.fullWidth {\n display: flex;\n width: 100%;\n}\n\n.segment {\n display: inline-flex;\n flex: 0 1 auto;\n align-items: center;\n justify-content: center;\n gap: var(--panneau-space-2);\n min-width: 0;\n min-height: calc(\n var(--segmented-control-height) - 2 * var(--panneau-segmented-control-padding, 2px) - 2 *\n var(--panneau-border-width)\n );\n padding: 0 var(--panneau-segmented-control-segment-padding-x, var(--panneau-space-3));\n font: inherit;\n font-size: var(--panneau-font-size-control);\n font-weight: var(\n --panneau-segmented-control-segment-font-weight,\n var(--panneau-font-weight-medium)\n );\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-segmented-control-segment-color, var(--panneau-color-text-muted));\n white-space: nowrap;\n cursor: pointer;\n background: transparent;\n border: 0;\n border-radius: calc(\n var(--panneau-segmented-control-radius, var(--panneau-radius-md)) -\n var(--panneau-segmented-control-padding, 2px)\n );\n outline: none;\n transition:\n background-color var(--panneau-duration),\n color var(--panneau-duration);\n -webkit-tap-highlight-color: transparent;\n}\n\n.fullWidth .segment {\n flex: 1 1 0;\n}\n\n.segment[data-hovered],\n.segment[data-selected] {\n color: var(--panneau-segmented-control-segment-color-selected, var(--panneau-color-text));\n}\n\n.segment[data-selected] {\n background-color: var(\n --panneau-segmented-control-segment-bg-selected,\n var(--panneau-color-surface-raised)\n );\n box-shadow: var(--panneau-segmented-control-segment-shadow-selected, var(--panneau-shadow-sm));\n}\n\n.segment[data-focus-visible] {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 1px;\n}\n\n.segment[data-disabled] {\n cursor: not-allowed;\n opacity: 0.5;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Tokens of SegmentedControl. */
|
|
2
|
+
export declare const segmentedControlTokens: import("../index.js").ComponentTokens<"segmented-control", "panneau-segmented-control-radius" | "panneau-segmented-control-padding" | "panneau-segmented-control-bg" | "panneau-segmented-control-border-color" | "panneau-segmented-control-segment-padding-x" | "panneau-segmented-control-segment-font-weight" | "panneau-segmented-control-segment-color" | "panneau-segmented-control-segment-color-selected" | "panneau-segmented-control-segment-bg-selected" | "panneau-segmented-control-segment-shadow-selected">;
|
|
3
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/segmented-control/tokens.ts"],"names":[],"mappings":"AAEA,kCAAkC;AAClC,eAAO,MAAM,sBAAsB,ofAqBjC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineComponentTokens } from "../theme/componentTokens.js";
|
|
2
|
+
//#region src/segmented-control/tokens.ts
|
|
3
|
+
/** Tokens of SegmentedControl. */
|
|
4
|
+
var segmentedControlTokens = defineComponentTokens("segmented-control", {
|
|
5
|
+
/** Background of the group, behind the segments. */
|
|
6
|
+
bg: "var(--panneau-color-surface-sunken)",
|
|
7
|
+
/** Color of the border around the group. */
|
|
8
|
+
"border-color": "var(--panneau-color-border)",
|
|
9
|
+
/** Corner radius of the group. */
|
|
10
|
+
radius: "var(--panneau-radius-md)",
|
|
11
|
+
/** Space between the group's border and its segments. */
|
|
12
|
+
padding: "2px",
|
|
13
|
+
/** Horizontal padding of a segment. */
|
|
14
|
+
"segment-padding-x": "var(--panneau-space-3)",
|
|
15
|
+
/** Font weight of a segment. */
|
|
16
|
+
"segment-font-weight": "var(--panneau-font-weight-medium)",
|
|
17
|
+
/** Text color of a segment. */
|
|
18
|
+
"segment-color": "var(--panneau-color-text-muted)",
|
|
19
|
+
/** Text color of the selected segment, and of a hovered one. */
|
|
20
|
+
"segment-color-selected": "var(--panneau-color-text)",
|
|
21
|
+
/** Background of the selected segment. */
|
|
22
|
+
"segment-bg-selected": "var(--panneau-color-surface-raised)",
|
|
23
|
+
/** Shadow of the selected segment. */
|
|
24
|
+
"segment-shadow-selected": "var(--panneau-shadow-sm)"
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { segmentedControlTokens };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","segmentedControlTokens","bg","radius","padding"],"sources":["../../src/segmented-control/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of SegmentedControl. */\nexport const segmentedControlTokens = defineComponentTokens('segmented-control', {\n /** Background of the group, behind the segments. */\n bg: 'var(--panneau-color-surface-sunken)',\n /** Color of the border around the group. */\n 'border-color': 'var(--panneau-color-border)',\n /** Corner radius of the group. */\n radius: 'var(--panneau-radius-md)',\n /** Space between the group's border and its segments. */\n padding: '2px',\n /** Horizontal padding of a segment. */\n 'segment-padding-x': 'var(--panneau-space-3)',\n /** Font weight of a segment. */\n 'segment-font-weight': 'var(--panneau-font-weight-medium)',\n /** Text color of a segment. */\n 'segment-color': 'var(--panneau-color-text-muted)',\n /** Text color of the selected segment, and of a hovered one. */\n 'segment-color-selected': 'var(--panneau-color-text)',\n /** Background of the selected segment. */\n 'segment-bg-selected': 'var(--panneau-color-surface-raised)',\n /** Shadow of the selected segment. */\n 'segment-shadow-selected': 'var(--panneau-shadow-sm)',\n});\n"],"mappings":";;;AAGA,IAAaC,yBAAyBD,sBAAsB,qBAAqB;;CAE7EE,IAAI;;CAEJ,gBAAgB;;CAEhBC,QAAQ;;CAERC,SAAS;;CAET,qBAAqB;;CAErB,uBAAuB;;CAEvB,iBAAiB;;CAEjB,0BAA0B;;CAE1B,uBAAuB;;CAEvB,2BAA2B;AAC/B,CAAC"}
|
package/dist/select/ListBox.css
CHANGED
|
@@ -47,18 +47,31 @@
|
|
|
47
47
|
display: flex;
|
|
48
48
|
flex: 1 1 auto;
|
|
49
49
|
flex-direction: column;
|
|
50
|
+
gap: 0.125rem;
|
|
50
51
|
min-width: 0;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
/* An option with a description has two lines: more room above and below them. */
|
|
55
|
+
.panneau-list-box-item:has(.panneau-list-box-item-description) {
|
|
56
|
+
padding-block: var(--panneau-list-box-item-padding-y-described, var(--panneau-space-2));
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
.panneau-list-box-item-label {
|
|
54
60
|
overflow-wrap: anywhere;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
.panneau-list-box-item-description {
|
|
58
|
-
font-size: var(--panneau-font-size-
|
|
64
|
+
font-size: var(--panneau-font-size-xs);
|
|
65
|
+
line-height: var(--panneau-line-height-tight);
|
|
59
66
|
color: var(--panneau-color-text-muted);
|
|
60
67
|
}
|
|
61
68
|
|
|
69
|
+
/* Decorative content before a label: a flag. */
|
|
70
|
+
.panneau-list-box-prefix {
|
|
71
|
+
flex: 0 0 auto;
|
|
72
|
+
line-height: 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
.panneau-list-box-check {
|
|
63
76
|
flex: 0 0 auto;
|
|
64
77
|
width: 1rem;
|
|
@@ -96,6 +109,67 @@
|
|
|
96
109
|
white-space: nowrap;
|
|
97
110
|
}
|
|
98
111
|
|
|
112
|
+
/* The chosen option, in the trigger: its description follows its label on the same line. */
|
|
113
|
+
.panneau-list-box-value .panneau-list-box-item-text {
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
align-items: baseline;
|
|
116
|
+
gap: var(--panneau-space-2);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.panneau-list-box-value .panneau-list-box-item-label,
|
|
120
|
+
.panneau-list-box-value .panneau-list-box-item-description {
|
|
121
|
+
flex: 0 1 auto;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
text-overflow: ellipsis;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* A flex box rather than an inline one: inside the block of the value, an inline box sits on a
|
|
128
|
+
line of text, whose strut pushed the label below the middle of the trigger. */
|
|
129
|
+
.panneau-list-box-value-text {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: var(--panneau-space-2);
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* The check marks the chosen option in the list: the trigger shows the option without it. */
|
|
137
|
+
.panneau-list-box-value .panneau-list-box-check {
|
|
138
|
+
display: none;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* A select inside another control: the button alone, the height of the control, with a line
|
|
142
|
+
between it and the rest of the control. */
|
|
143
|
+
.panneau-list-box-bare-trigger {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
align-self: stretch;
|
|
147
|
+
min-width: 0;
|
|
148
|
+
padding: 0 var(--panneau-space-2) 0 0;
|
|
149
|
+
font: inherit;
|
|
150
|
+
color: var(--panneau-color-text);
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
background: transparent;
|
|
153
|
+
border: 0;
|
|
154
|
+
border-inline-end: var(--panneau-border-width) solid var(--panneau-color-border);
|
|
155
|
+
border-radius: 0;
|
|
156
|
+
outline: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.panneau-list-box-bare-trigger[data-focus-visible] {
|
|
160
|
+
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
161
|
+
outline-offset: 2px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.panneau-list-box-bare-trigger[data-disabled] {
|
|
165
|
+
cursor: default;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* A select that can't be changed, inside a control that can't either: its value alone. */
|
|
169
|
+
.panneau-list-box-bare-trigger[data-disabled] .panneau-list-box-chevron {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
99
173
|
.panneau-list-box-value[data-placeholder] {
|
|
100
174
|
color: var(--panneau-color-text-muted);
|
|
101
175
|
}
|