@webiny/admin-ui 6.6.0-alpha.0 → 6.6.0-alpha.10
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/Accordion/components/AccordionContent.js +4 -1
- package/Accordion/components/AccordionContent.js.map +1 -1
- package/Accordion/components/AccordionItem.d.ts +1 -0
- package/Accordion/components/AccordionItem.js.map +1 -1
- package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
- package/Accordion/components/AccordionItemDragHandle.js +2 -1
- package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
- package/Accordion/components/AccordionTrigger.js +4 -2
- package/Accordion/components/AccordionTrigger.js.map +1 -1
- package/Alert/Alert.d.ts +1 -20
- package/Alert/Alert.js.map +1 -1
- package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
- package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
- package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
- package/BetaBadge/BetaBadge.d.ts +6 -0
- package/BetaBadge/BetaBadge.js +7 -0
- package/BetaBadge/BetaBadge.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
- package/Breadcrumbs/Breadcrumbs.js +66 -0
- package/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
- package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
- package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
- package/Breadcrumbs/index.d.ts +1 -0
- package/Breadcrumbs/index.js +1 -0
- package/Button/Button.d.ts +1 -1
- package/Button/Button.js +14 -0
- package/Button/Button.js.map +1 -1
- package/Button/Button.mdx +13 -0
- package/Button/Button.stories.d.ts +1 -0
- package/Button/Button.stories.js +10 -2
- package/Button/Button.stories.js.map +1 -1
- package/Button/Button.test.d.ts +1 -0
- package/Button/Button.test.js +28 -0
- package/Button/Button.test.js.map +1 -0
- package/Calendar/calendarClassNames.js +1 -1
- package/Calendar/calendarClassNames.js.map +1 -1
- package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
- package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
- package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
- package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
- package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
- package/CheckboxGroup/CheckboxGroup.js +4 -1
- package/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
- package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
- package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
- package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
- package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
- package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
- package/Code/Code.d.ts +29 -0
- package/Code/Code.js +23 -0
- package/Code/Code.js.map +1 -0
- package/Code/index.d.ts +1 -0
- package/Code/index.js +1 -0
- package/CodeEditor/CodeEditor.js +6 -0
- package/CodeEditor/CodeEditor.js.map +1 -1
- package/CodeEditor/CodeEditorPrimitive.js +3 -1
- package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
- package/ColorPicker/ColorPicker.js +4 -1
- package/ColorPicker/ColorPicker.js.map +1 -1
- package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
- package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
- package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
- package/Command/components/List.d.ts +1 -1
- package/Command/components/List.js +9 -5
- package/Command/components/List.js.map +1 -1
- package/DataTable/DataTable.d.ts +42 -7
- package/DataTable/DataTable.js +122 -26
- package/DataTable/DataTable.js.map +1 -1
- package/DataTable/DataTable.mdx +64 -0
- package/DataTable/DataTable.stories.d.ts +4 -0
- package/DataTable/DataTable.stories.js +40 -1
- package/DataTable/DataTable.stories.js.map +1 -1
- package/DataTable/DataTable.subRows.test.d.ts +1 -0
- package/DataTable/DataTable.subRows.test.js +216 -0
- package/DataTable/DataTable.subRows.test.js.map +1 -0
- package/DataTable/components/ColumnsVisibility.d.ts +5 -4
- package/DataTable/components/ColumnsVisibility.js +7 -3
- package/DataTable/components/ColumnsVisibility.js.map +1 -1
- package/DatePicker/DatePicker.d.ts +5 -2
- package/DatePicker/DatePicker.js +14 -3
- package/DatePicker/DatePicker.js.map +1 -1
- package/DatePicker/DatePicker.stories.d.ts +10 -0
- package/DatePicker/DatePicker.stories.js +44 -1
- package/DatePicker/DatePicker.stories.js.map +1 -1
- package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
- package/DatePicker/primitives/BirthdayPicker.js +355 -0
- package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
- package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
- package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
- package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
- package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
- package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
- package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
- package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
- package/DatePicker/primitives/DateOnlyPicker.js +13 -4
- package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
- package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
- package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
- package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
- package/DatePicker/primitives/DateRangePicker.js +5 -4
- package/DatePicker/primitives/DateRangePicker.js.map +1 -1
- package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
- package/DatePicker/primitives/DateTimePicker.js +27 -18
- package/DatePicker/primitives/DateTimePicker.js.map +1 -1
- package/DatePicker/primitives/MonthPicker.d.ts +1 -1
- package/DatePicker/primitives/MonthPicker.js +2 -1
- package/DatePicker/primitives/MonthPicker.js.map +1 -1
- package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
- package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
- package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
- package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
- package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
- package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
- package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
- package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
- package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
- package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
- package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
- package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
- package/DatePicker/primitives/WeekPicker.d.ts +1 -1
- package/DatePicker/primitives/WeekPicker.js +2 -1
- package/DatePicker/primitives/WeekPicker.js.map +1 -1
- package/DatePicker/primitives/YearPicker.d.ts +1 -1
- package/DatePicker/primitives/YearPicker.js +2 -1
- package/DatePicker/primitives/YearPicker.js.map +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
- package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
- package/DatePicker/primitives/components/TimePicker.js +2 -1
- package/DatePicker/primitives/components/TimePicker.js.map +1 -1
- package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
- package/DatePicker/utils/birthdayHelpers.js +145 -0
- package/DatePicker/utils/birthdayHelpers.js.map +1 -0
- package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
- package/DatePicker/utils/birthdayHelpers.test.js +394 -0
- package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
- package/DatePicker/utils/dateHelpers.d.ts +6 -1
- package/DatePicker/utils/dateHelpers.js +13 -5
- package/DatePicker/utils/dateHelpers.js.map +1 -1
- package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
- package/DatePicker/utils/dateHelpers.test.js +119 -0
- package/DatePicker/utils/dateHelpers.test.js.map +1 -0
- package/DatePicker/utils/index.d.ts +1 -0
- package/DatePicker/utils/index.js +1 -0
- package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
- package/DatePicker/utils/timezoneHelpers.js +32 -0
- package/DatePicker/utils/timezoneHelpers.js.map +1 -0
- package/DatePicker/utils/types.d.ts +17 -2
- package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
- package/DelayedOnChange/DelayedOnChange.js.map +1 -1
- package/Dialog/Dialog.d.ts +8 -7
- package/Dialog/Dialog.js.map +1 -1
- package/Drawer/Drawer.d.ts +10 -6
- package/Drawer/Drawer.js +2 -1
- package/Drawer/Drawer.js.map +1 -1
- package/Drawer/Drawer.stories.d.ts +1 -0
- package/Drawer/Drawer.stories.js +20 -2
- package/Drawer/Drawer.stories.js.map +1 -1
- package/Drawer/components/DrawerHeader.d.ts +2 -2
- package/Drawer/components/DrawerHeader.js +11 -8
- package/Drawer/components/DrawerHeader.js.map +1 -1
- package/Drawer/components/Icon.d.ts +1 -1
- package/Drawer/components/Icon.js +3 -4
- package/Drawer/components/Icon.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuItem.d.ts +5 -0
- package/DropdownMenu/components/DropdownMenuItem.js +3 -2
- package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
- package/EmptyState/EmptyState.d.ts +2 -1
- package/EmptyState/EmptyState.js +8 -2
- package/EmptyState/EmptyState.js.map +1 -1
- package/FilePicker/FilePicker.d.ts +12 -12
- package/FilePicker/FilePicker.js +6 -1
- package/FilePicker/FilePicker.js.map +1 -1
- package/FilePicker/FilePicker.stories.d.ts +6 -0
- package/FilePicker/FilePicker.stories.js +24 -1
- package/FilePicker/FilePicker.stories.js.map +1 -1
- package/FilePicker/primitives/FilePickerPrimitive.d.ts +13 -13
- package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
- package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
- package/FilePicker/primitives/components/Label.d.ts +3 -1
- package/FilePicker/primitives/components/Label.js +2 -1
- package/FilePicker/primitives/components/Label.js.map +1 -1
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +13 -2
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +6 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +54 -12
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +11 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +8 -61
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
- package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
- package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
- package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
- package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
- package/FilePicker/primitives/components/previews/fileName.js +26 -0
- package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
- package/FilePicker/primitives/components/previews/index.d.ts +1 -0
- package/FilePicker/primitives/components/previews/index.js +1 -0
- package/FormComponent/Label.d.ts +6 -1
- package/FormComponent/Label.js +5 -2
- package/FormComponent/Label.js.map +1 -1
- package/FormComponent/labels.test.d.ts +1 -0
- package/FormComponent/labels.test.js +276 -0
- package/FormComponent/labels.test.js.map +1 -0
- package/Icon/Icon.d.ts +6 -1
- package/Icon/Icon.js.map +1 -1
- package/IconPicker/IconPicker.js +6 -1
- package/IconPicker/IconPicker.js.map +1 -1
- package/IconPicker/domains/IconPickerIcon.js +1 -1
- package/IconPicker/domains/IconPickerIcon.js.map +1 -1
- package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
- package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
- package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
- package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
- package/ImageEditor/AspectRatioPreview.d.ts +16 -0
- package/ImageEditor/AspectRatioPreview.js +26 -0
- package/ImageEditor/AspectRatioPreview.js.map +1 -0
- package/ImageEditor/CropHotspotEditor.d.ts +22 -0
- package/ImageEditor/CropHotspotEditor.js +402 -0
- package/ImageEditor/CropHotspotEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.d.ts +18 -0
- package/ImageEditor/ImageEditor.js +151 -0
- package/ImageEditor/ImageEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.stories.d.ts +6 -0
- package/ImageEditor/ImageEditor.stories.js +42 -0
- package/ImageEditor/ImageEditor.stories.js.map +1 -0
- package/ImageEditor/MetaFields.d.ts +12 -0
- package/ImageEditor/MetaFields.js +20 -0
- package/ImageEditor/MetaFields.js.map +1 -0
- package/ImageEditor/SectionLabel.d.ts +8 -0
- package/ImageEditor/SectionLabel.js +7 -0
- package/ImageEditor/SectionLabel.js.map +1 -0
- package/ImageEditor/geometry.d.ts +46 -0
- package/ImageEditor/geometry.js +126 -0
- package/ImageEditor/geometry.js.map +1 -0
- package/ImageEditor/index.d.ts +3 -0
- package/ImageEditor/index.js +3 -0
- package/ImageEditor/types.d.ts +52 -0
- package/ImageEditor/types.js +35 -0
- package/ImageEditor/types.js.map +1 -0
- package/Input/InputPrimitive.d.ts +4 -4
- package/Input/InputPrimitive.js +0 -1
- package/Input/InputPrimitive.js.map +1 -1
- package/Kbd/Kbd.d.ts +35 -0
- package/Kbd/Kbd.js +34 -0
- package/Kbd/Kbd.js.map +1 -0
- package/Kbd/index.d.ts +1 -0
- package/Kbd/index.js +1 -0
- package/Link/Link.d.ts +1 -1
- package/Link/Link.js +1 -1
- package/Link/Link.js.map +1 -1
- package/Markdown/Markdown.d.ts +47 -0
- package/Markdown/Markdown.js +17 -0
- package/Markdown/Markdown.js.map +1 -0
- package/Markdown/index.d.ts +1 -0
- package/Markdown/index.js +1 -0
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
- package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
- package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
- package/MultiFilePicker/MultiFilePicker.d.ts +12 -12
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +12 -12
- package/MultiSelect/MultiSelect.js +6 -1
- package/MultiSelect/MultiSelect.js.map +1 -1
- package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
- package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
- package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
- package/Popover/Popover.stories.d.ts +7 -0
- package/Popover/Popover.stories.js +24 -1
- package/Popover/Popover.stories.js.map +1 -1
- package/Popover/primitives/components/PopoverContent.js +6 -1
- package/Popover/primitives/components/PopoverContent.js.map +1 -1
- package/RadioGroup/RadioGroup.js +4 -1
- package/RadioGroup/RadioGroup.js.map +1 -1
- package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
- package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
- package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
- package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
- package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
- package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
- package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
- package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
- package/RangeSlider/RangeSlider.js +4 -1
- package/RangeSlider/RangeSlider.js.map +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
- package/ScrollArea/ScrollArea.d.ts +16 -2
- package/ScrollArea/ScrollArea.js +19 -5
- package/ScrollArea/ScrollArea.js.map +1 -1
- package/SegmentedControl/SegmentedControl.js +4 -1
- package/SegmentedControl/SegmentedControl.js.map +1 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
- package/Select/Select.js +6 -1
- package/Select/Select.js.map +1 -1
- package/Select/primitives/SelectPrimitive.d.ts +4 -0
- package/Select/primitives/SelectPrimitive.js +4 -2
- package/Select/primitives/SelectPrimitive.js.map +1 -1
- package/Select/primitives/components/SelectContent.js +4 -6
- package/Select/primitives/components/SelectContent.js.map +1 -1
- package/SidePanel/SidePanel.d.ts +46 -0
- package/SidePanel/SidePanel.js +47 -0
- package/SidePanel/SidePanel.js.map +1 -0
- package/SidePanel/SidePanelBody.d.ts +37 -0
- package/SidePanel/SidePanelBody.js +14 -0
- package/SidePanel/SidePanelBody.js.map +1 -0
- package/SidePanel/SidePanelFooter.d.ts +27 -0
- package/SidePanel/SidePanelFooter.js +10 -0
- package/SidePanel/SidePanelFooter.js.map +1 -0
- package/SidePanel/index.d.ts +3 -0
- package/SidePanel/index.js +3 -0
- package/Sidebar/Sidebar.groups.test.d.ts +1 -0
- package/Sidebar/Sidebar.groups.test.js +113 -0
- package/Sidebar/Sidebar.groups.test.js.map +1 -0
- package/Sidebar/components/SidebarContent.js +1 -1
- package/Sidebar/components/SidebarContent.js.map +1 -1
- package/Sidebar/components/SidebarRoot.js +1 -1
- package/Sidebar/components/SidebarRoot.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
- package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
- package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
- package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
- package/Slider/Slider.js +10 -2
- package/Slider/Slider.js.map +1 -1
- package/Slider/primitives/SliderPrimitive.d.ts +1 -1
- package/Slider/primitives/SliderPrimitive.js +2 -1
- package/Slider/primitives/SliderPrimitive.js.map +1 -1
- package/Slider/primitives/components/SliderThumb.d.ts +5 -2
- package/Slider/primitives/components/SliderThumb.js +2 -1
- package/Slider/primitives/components/SliderThumb.js.map +1 -1
- package/Switch/Switch.d.ts +4 -4
- package/Switch/Switch.js +21 -7
- package/Switch/Switch.js.map +1 -1
- package/Switch/domains/SwitchItemDto.d.ts +1 -1
- package/Switch/primitives/SwitchPrimitive.js +4 -3
- package/Switch/primitives/SwitchPrimitive.js.map +1 -1
- package/Tabs/Tabs.d.ts +7 -2
- package/Tabs/Tabs.js +29 -11
- package/Tabs/Tabs.js.map +1 -1
- package/Tabs/Tabs.mdx +27 -0
- package/Tabs/Tabs.stories.d.ts +1 -0
- package/Tabs/Tabs.stories.js +19 -1
- package/Tabs/Tabs.stories.js.map +1 -1
- package/Tag/Tag.d.ts +1 -1
- package/Tag/Tag.js +5 -0
- package/Tag/Tag.js.map +1 -1
- package/Tag/TagIcon.js +7 -1
- package/Tag/TagIcon.js.map +1 -1
- package/Tags/primitives/TagsPrimitive.d.ts +2 -2
- package/Tags/primitives/TagsPrimitive.js.map +1 -1
- package/Toast/useToast.stories.js.map +1 -1
- package/ToggleGroup/ToggleGroup.js +4 -1
- package/ToggleGroup/ToggleGroup.js.map +1 -1
- package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
- package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
- package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
- package/Tree/useTree.js +6 -2
- package/Tree/useTree.js.map +1 -1
- package/exports/admin/ui.d.ts +2 -0
- package/exports/admin/ui.js +2 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useEscapeScrollLock.d.ts +13 -0
- package/hooks/useEscapeScrollLock.js +21 -0
- package/hooks/useEscapeScrollLock.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +7 -0
- package/package.json +31 -29
- package/theme.css +43 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider/RangeSlider.js","sources":["../../src/RangeSlider/RangeSlider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { RangeSliderPrimitiveProps } from \"./primitives/index.js\";\nimport {\n RangeSliderPrimitiveRenderer,\n RangeSliderValue,\n useRangeSlider\n} from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype RangeSliderProps = RangeSliderPrimitiveProps &\n FormComponentProps & {\n label: React.ReactNode;\n valueConverter?: (value: number) => string;\n };\n\nconst DecoratableRangeSlider = ({\n description,\n note,\n hint,\n validation,\n ...props\n}: RangeSliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = React.useMemo(() => validationIsValid === false, [validationIsValid]);\n const { onValuesChange, onValuesCommit, ...restProps } = props;\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n text={props.label}\n hint={hint}\n required={props.required}\n disabled={props.disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <div className={\"flex flex-row items-center justify-between\"}>\n <div className={\"basis-1/12 pr-xxs\"}>\n <RangeSliderValue value={vm.textValues[0]} disabled={props.disabled} />\n </div>\n <div className={\"basis-10/12\"}>\n <RangeSliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n </div>\n <div className={\"basis-1/12 pl-xxs text-right\"}>\n <RangeSliderValue value={vm.textValues[1]} disabled={props.disabled} />\n </div>\n </div>\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\n\nconst RangeSlider = makeDecoratable(\"RangeSlider\", DecoratableRangeSlider);\n\nexport { RangeSlider, type RangeSliderProps };\n"],"names":["DecoratableRangeSlider","description","note","hint","validation","props","validationIsValid","validationMessage","invalid","React","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider","FormComponentLabel","FormComponentDescription","RangeSliderValue","RangeSliderPrimitiveRenderer","FormComponentErrorMessage","FormComponentNote","RangeSlider","makeDecoratable"],"mappings":";;;;AAsBA,MAAMA,yBAAyB,CAAC,EAC5BC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,UAAU,EACV,GAAGC,OACY;IACf,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,wBAAAA,OAAa,CAAC,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;
|
|
1
|
+
{"version":3,"file":"RangeSlider/RangeSlider.js","sources":["../../src/RangeSlider/RangeSlider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { RangeSliderPrimitiveProps } from \"./primitives/index.js\";\nimport {\n RangeSliderPrimitiveRenderer,\n RangeSliderValue,\n useRangeSlider\n} from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype RangeSliderProps = RangeSliderPrimitiveProps &\n FormComponentProps & {\n label: React.ReactNode;\n valueConverter?: (value: number) => string;\n };\n\nconst DecoratableRangeSlider = ({\n description,\n note,\n hint,\n validation,\n ...props\n}: RangeSliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = React.useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The control can't be a `<label for>` target, so it names itself after the label. */\n const labelId = React.useMemo(() => `${generateId()}-label`, []);\n const { onValuesChange, onValuesCommit, ...restProps } = props;\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n labelId={labelId}\n text={props.label}\n hint={hint}\n required={props.required}\n disabled={props.disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <div className={\"flex flex-row items-center justify-between\"}>\n <div className={\"basis-1/12 pr-xxs\"}>\n <RangeSliderValue value={vm.textValues[0]} disabled={props.disabled} />\n </div>\n <div className={\"basis-10/12\"}>\n <RangeSliderPrimitiveRenderer\n aria-labelledby={labelId}\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n </div>\n <div className={\"basis-1/12 pl-xxs text-right\"}>\n <RangeSliderValue value={vm.textValues[1]} disabled={props.disabled} />\n </div>\n </div>\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\n\nconst RangeSlider = makeDecoratable(\"RangeSlider\", DecoratableRangeSlider);\n\nexport { RangeSlider, type RangeSliderProps };\n"],"names":["DecoratableRangeSlider","description","note","hint","validation","props","validationIsValid","validationMessage","invalid","React","labelId","generateId","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider","FormComponentLabel","FormComponentDescription","RangeSliderValue","RangeSliderPrimitiveRenderer","FormComponentErrorMessage","FormComponentNote","RangeSlider","makeDecoratable"],"mappings":";;;;AAsBA,MAAMA,yBAAyB,CAAC,EAC5BC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,UAAU,EACV,GAAGC,OACY;IACf,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,wBAAAA,OAAa,CAAC,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAEpF,MAAMI,UAAUD,wBAAAA,OAAa,CAAC,IAAM,GAAGE,aAAa,MAAM,CAAC,EAAE,EAAE;IAC/D,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGT;IACzD,MAAM,EAAEU,EAAE,EAAEC,YAAY,EAAEC,YAAY,EAAE,GAAGC,eAAe;QACtD,GAAGJ,SAAS;QACZF;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACM,oBAAkBA;QACf,SAAST;QACT,MAAML,MAAM,KAAK;QACjB,MAAMF;QACN,UAAUE,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASG;sBAEb,sCAACY,0BAAwBA;QAAC,MAAMnB;QAAa,UAAUI,MAAM,QAAQ;sBACrE,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAI,WAAW;qBACZ,sCAACgB,kBAAgBA;QAAC,OAAON,GAAG,UAAU,CAAC,EAAE;QAAE,UAAUV,MAAM,QAAQ;uBAEvE,sCAAC;QAAI,WAAW;qBACZ,sCAACiB,8BAA4BA;QACzB,mBAAiBZ;QAChB,GAAGI,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;uBAGvB,sCAAC;QAAI,WAAW;qBACZ,sCAACI,kBAAgBA;QAAC,OAAON,GAAG,UAAU,CAAC,EAAE;QAAE,UAAUV,MAAM,QAAQ;wBAG3E,sCAACkB,2BAAyBA;QACtB,MAAMhB;QACN,SAASC;QACT,UAAUH,MAAM,QAAQ;sBAE5B,sCAACmB,mBAAiBA;QAAC,MAAMtB;QAAM,UAAUG,MAAM,QAAQ;;AAGnE;AAEA,MAAMoB,cAAcC,gBAAgB,eAAe1B"}
|
|
@@ -24,7 +24,7 @@ interface RangeSliderPrimitiveVm extends RangeSliderPrimitiveRootProps, Omit<Ran
|
|
|
24
24
|
/**
|
|
25
25
|
* RangeSliderRenderer
|
|
26
26
|
*/
|
|
27
|
-
declare const RangeSliderPrimitiveRenderer: ({ tooltipSide, textValues, showTooltip, values, ...sliderProps }: RangeSliderPrimitiveVm) => React.JSX.Element;
|
|
27
|
+
declare const RangeSliderPrimitiveRenderer: ({ tooltipSide, textValues, showTooltip, values, "aria-labelledby": labelledBy, ...sliderProps }: RangeSliderPrimitiveVm) => React.JSX.Element;
|
|
28
28
|
/**
|
|
29
29
|
* RangeSlider
|
|
30
30
|
*/
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { SliderRoot, SliderThumb, SliderTrack } from "../../Slider/index.js";
|
|
2
2
|
import { useRangeSlider } from "./useRangeSlider.js";
|
|
3
3
|
import * as __rspack_external_react from "react";
|
|
4
|
-
const RangeSliderPrimitiveRenderer = ({ tooltipSide, textValues, showTooltip, values, ...sliderProps })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
4
|
+
const RangeSliderPrimitiveRenderer = ({ tooltipSide, textValues, showTooltip, values, "aria-labelledby": labelledBy, ...sliderProps })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
5
5
|
className: "flex h-md w-full"
|
|
6
6
|
}, /*#__PURE__*/ __rspack_external_react.createElement(SliderRoot, {
|
|
7
7
|
...sliderProps,
|
|
8
8
|
value: values
|
|
9
9
|
}, /*#__PURE__*/ __rspack_external_react.createElement(SliderTrack, null), /*#__PURE__*/ __rspack_external_react.createElement(SliderThumb, {
|
|
10
|
+
"aria-labelledby": labelledBy,
|
|
10
11
|
showTooltip: showTooltip,
|
|
11
12
|
tooltipSide: tooltipSide,
|
|
12
13
|
textValue: textValues[0]
|
|
13
14
|
}), /*#__PURE__*/ __rspack_external_react.createElement(SliderThumb, {
|
|
15
|
+
"aria-labelledby": labelledBy,
|
|
14
16
|
showTooltip: showTooltip,
|
|
15
17
|
tooltipSide: tooltipSide,
|
|
16
18
|
textValue: textValues[1]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider/primitives/RangeSliderPrimitive.js","sources":["../../../src/RangeSlider/primitives/RangeSliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { SliderRoot, SliderThumb, type SliderThumbProps, SliderTrack } from \"~/Slider/index.js\";\nimport { useRangeSlider } from \"./useRangeSlider.js\";\n\ninterface RangeSliderPrimitiveRootProps extends Omit<\n SliderPrimitives.SliderProps,\n \"min\" | \"max\" | \"value\"\n> {\n /**\n * Array of numbers representing the current values of the range slider.\n */\n values: number[];\n /**\n * Minimum value of the range slider.\n */\n min: number;\n /**\n * Maximum value of the range slider.\n */\n max: number;\n}\n\ninterface RangeSliderPrimitiveThumbProps extends Omit<SliderThumbProps, \"labelValue\"> {\n textValues: string[];\n}\n\ninterface RangeSliderPrimitiveVm\n extends RangeSliderPrimitiveRootProps, Omit<RangeSliderPrimitiveThumbProps, \"textValue\"> {\n textValues: string[];\n}\n\n/**\n * RangeSliderRenderer\n */\n\nconst RangeSliderPrimitiveRenderer = ({\n tooltipSide,\n textValues,\n showTooltip,\n values,\n ...sliderProps\n}: RangeSliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps} value={values}>\n <SliderTrack />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[0]}\n />\n <SliderThumb\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[1]}\n />\n </SliderRoot>\n </div>\n );\n};\n\n/**\n * RangeSlider\n */\ninterface RangeSliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValuesChange: (values: number[]) => void;\n onValuesCommit?: (values: number[]) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n values?: number[];\n}\n\nconst RangeSliderPrimitive = (props: RangeSliderPrimitiveProps) => {\n const { transformValue, onValuesChange, onValuesCommit, ...restProps } = props; // Rename transformValue to _ to avoid Oxlint warning\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n transformValue,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <RangeSliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n );\n};\n\nexport {\n RangeSliderPrimitive,\n RangeSliderPrimitiveRenderer,\n type RangeSliderPrimitiveProps,\n type RangeSliderPrimitiveVm\n};\n"],"names":["RangeSliderPrimitiveRenderer","tooltipSide","textValues","showTooltip","values","sliderProps","SliderRoot","SliderTrack","SliderThumb","RangeSliderPrimitive","props","transformValue","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider"],"mappings":";;;AAoCA,MAAMA,+BAA+B,CAAC,EAClCC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,MAAM,EACN,GAAGC,aACkB,GACd,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAUA;QAAE,GAAGD,WAAW;QAAE,
|
|
1
|
+
{"version":3,"file":"RangeSlider/primitives/RangeSliderPrimitive.js","sources":["../../../src/RangeSlider/primitives/RangeSliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { SliderRoot, SliderThumb, type SliderThumbProps, SliderTrack } from \"~/Slider/index.js\";\nimport { useRangeSlider } from \"./useRangeSlider.js\";\n\ninterface RangeSliderPrimitiveRootProps extends Omit<\n SliderPrimitives.SliderProps,\n \"min\" | \"max\" | \"value\"\n> {\n /**\n * Array of numbers representing the current values of the range slider.\n */\n values: number[];\n /**\n * Minimum value of the range slider.\n */\n min: number;\n /**\n * Maximum value of the range slider.\n */\n max: number;\n}\n\ninterface RangeSliderPrimitiveThumbProps extends Omit<SliderThumbProps, \"labelValue\"> {\n textValues: string[];\n}\n\ninterface RangeSliderPrimitiveVm\n extends RangeSliderPrimitiveRootProps, Omit<RangeSliderPrimitiveThumbProps, \"textValue\"> {\n textValues: string[];\n}\n\n/**\n * RangeSliderRenderer\n */\n\nconst RangeSliderPrimitiveRenderer = ({\n tooltipSide,\n textValues,\n showTooltip,\n values,\n \"aria-labelledby\": labelledBy,\n ...sliderProps\n}: RangeSliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps} value={values}>\n <SliderTrack />\n {/* Both ends are named by the field's label. */}\n <SliderThumb\n aria-labelledby={labelledBy}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[0]}\n />\n <SliderThumb\n aria-labelledby={labelledBy}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n textValue={textValues[1]}\n />\n </SliderRoot>\n </div>\n );\n};\n\n/**\n * RangeSlider\n */\ninterface RangeSliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValuesChange: (values: number[]) => void;\n onValuesCommit?: (values: number[]) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n values?: number[];\n}\n\nconst RangeSliderPrimitive = (props: RangeSliderPrimitiveProps) => {\n const { transformValue, onValuesChange, onValuesCommit, ...restProps } = props; // Rename transformValue to _ to avoid Oxlint warning\n const { vm, changeValues, commitValues } = useRangeSlider({\n ...restProps,\n transformValue,\n onValuesChange,\n onValuesCommit\n });\n\n return (\n <RangeSliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValues}\n onValueCommit={commitValues}\n />\n );\n};\n\nexport {\n RangeSliderPrimitive,\n RangeSliderPrimitiveRenderer,\n type RangeSliderPrimitiveProps,\n type RangeSliderPrimitiveVm\n};\n"],"names":["RangeSliderPrimitiveRenderer","tooltipSide","textValues","showTooltip","values","labelledBy","sliderProps","SliderRoot","SliderTrack","SliderThumb","RangeSliderPrimitive","props","transformValue","onValuesChange","onValuesCommit","restProps","vm","changeValues","commitValues","useRangeSlider"],"mappings":";;;AAoCA,MAAMA,+BAA+B,CAAC,EAClCC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,MAAM,EACN,mBAAmBC,UAAU,EAC7B,GAAGC,aACkB,GACd,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAUA;QAAE,GAAGD,WAAW;QAAE,OAAOF;qBAChC,sCAACI,aAAWA,OAAAA,WAAAA,GAEZ,sCAACC,aAAWA;QACR,mBAAiBJ;QACjB,aAAaF;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;sBAE5B,sCAACO,aAAWA;QACR,mBAAiBJ;QACjB,aAAaF;QACb,aAAaF;QACb,WAAWC,UAAU,CAAC,EAAE;;AAsB5C,MAAMQ,uBAAuB,CAACC;IAC1B,MAAM,EAAEC,cAAc,EAAEC,cAAc,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGJ;IACzE,MAAM,EAAEK,EAAE,EAAEC,YAAY,EAAEC,YAAY,EAAE,GAAGC,eAAe;QACtD,GAAGJ,SAAS;QACZH;QACAC;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,sCAACd,8BAA4BA;QACxB,GAAGe,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;;AAG3B"}
|
|
@@ -13,7 +13,21 @@ export interface ScrollPosition {
|
|
|
13
13
|
interface ScrollAreaProps extends Omit<React.ComponentProps<typeof ScrollAreaPrimitive.Root>, "onScroll"> {
|
|
14
14
|
onScrollPositionChange?: (position: ScrollPosition) => void;
|
|
15
15
|
onScroll?: (position: ScrollPosition) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Classes for the scrolling element itself. Put the height limit here when the area has to grow
|
|
18
|
+
* with its content up to a maximum, instead of filling a parent of a known height.
|
|
19
|
+
*/
|
|
20
|
+
viewportClassName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Native scroll handler for the scrolling element, for callers that need the event itself.
|
|
23
|
+
* `onScroll` reports positions instead.
|
|
24
|
+
*/
|
|
25
|
+
onViewportScroll?: React.UIEventHandler<HTMLDivElement>;
|
|
26
|
+
/**
|
|
27
|
+
* Ref to the scrolling element, for callers that scroll it themselves.
|
|
28
|
+
*/
|
|
29
|
+
viewportRef?: React.Ref<HTMLDivElement>;
|
|
16
30
|
}
|
|
17
|
-
declare function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...props }: ScrollAreaProps): React.JSX.Element;
|
|
18
|
-
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
|
|
31
|
+
declare function ScrollArea({ className, children, onScrollPositionChange, onScroll, viewportClassName, onViewportScroll, viewportRef: externalViewportRef, type, ...props }: ScrollAreaProps): React.JSX.Element;
|
|
32
|
+
declare function ScrollBar({ className, orientation, onMouseDown, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
|
|
19
33
|
export { ScrollArea, ScrollBar };
|
package/ScrollArea/ScrollArea.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { cn } from "../utils.js";
|
|
2
2
|
import * as __rspack_external_react from "react";
|
|
3
3
|
import * as __rspack_external__radix_ui_react_scroll_area_bdec1136 from "@radix-ui/react-scroll-area";
|
|
4
|
-
function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...props }) {
|
|
4
|
+
function ScrollArea({ className, children, onScrollPositionChange, onScroll, viewportClassName, onViewportScroll, viewportRef: externalViewportRef, type = "auto", ...props }) {
|
|
5
5
|
const viewportRef = __rspack_external_react.useRef(null);
|
|
6
|
+
const setViewportRef = __rspack_external_react.useCallback((element)=>{
|
|
7
|
+
viewportRef.current = element;
|
|
8
|
+
if ("function" == typeof externalViewportRef) externalViewportRef(element);
|
|
9
|
+
else if (externalViewportRef) externalViewportRef.current = element;
|
|
10
|
+
}, [
|
|
11
|
+
externalViewportRef
|
|
12
|
+
]);
|
|
6
13
|
__rspack_external_react.useEffect(()=>{
|
|
7
14
|
const viewport = viewportRef.current;
|
|
8
15
|
if (!viewport || !onScrollPositionChange && !onScroll) return;
|
|
@@ -30,19 +37,26 @@ function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...
|
|
|
30
37
|
]);
|
|
31
38
|
return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Root, {
|
|
32
39
|
"data-slot": "scroll-area",
|
|
40
|
+
type: type,
|
|
33
41
|
className: cn("relative", className),
|
|
34
42
|
...props
|
|
35
43
|
}, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Viewport, {
|
|
36
|
-
ref:
|
|
44
|
+
ref: setViewportRef,
|
|
37
45
|
"data-slot": "scroll-area-viewport",
|
|
38
|
-
|
|
46
|
+
onScroll: onViewportScroll,
|
|
47
|
+
className: cn("relative focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1", viewportClassName)
|
|
39
48
|
}, children), /*#__PURE__*/ __rspack_external_react.createElement(ScrollBar, null), /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Corner, null));
|
|
40
49
|
}
|
|
41
|
-
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
50
|
+
function ScrollBar({ className, orientation = "vertical", onMouseDown, ...props }) {
|
|
51
|
+
const handleMouseDown = (event)=>{
|
|
52
|
+
onMouseDown?.(event);
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
};
|
|
42
55
|
return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.ScrollAreaScrollbar, {
|
|
43
56
|
"data-slot": "scroll-area-scrollbar",
|
|
44
57
|
orientation: orientation,
|
|
45
|
-
|
|
58
|
+
onMouseDown: handleMouseDown,
|
|
59
|
+
className: cn("flex touch-none transition-colors select-none", "vertical" === orientation && "h-full w-[10px] p-[2px]", "horizontal" === orientation && "h-[10px] flex-col p-[2px]", className),
|
|
46
60
|
...props
|
|
47
61
|
}, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.ScrollAreaThumb, {
|
|
48
62
|
"data-slot": "scroll-area-thumb",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={
|
|
1
|
+
{"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n /**\n * Classes for the scrolling element itself. Put the height limit here when the area has to grow\n * with its content up to a maximum, instead of filling a parent of a known height.\n */\n viewportClassName?: string;\n /**\n * Native scroll handler for the scrolling element, for callers that need the event itself.\n * `onScroll` reports positions instead.\n */\n onViewportScroll?: React.UIEventHandler<HTMLDivElement>;\n /**\n * Ref to the scrolling element, for callers that scroll it themselves.\n */\n viewportRef?: React.Ref<HTMLDivElement>;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n viewportClassName,\n onViewportScroll,\n viewportRef: externalViewportRef,\n /*\n * Radix would only show the scrollbar once the pointer is inside. Showing it whenever there is\n * more content is the same rule the rest of the admin follows, a Select included.\n */\n type = \"auto\",\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement | null>(null);\n\n // The internal ref drives the scroll listener below; a caller's ref gets the same element.\n const setViewportRef = React.useCallback(\n (element: HTMLDivElement | null) => {\n viewportRef.current = element;\n if (typeof externalViewportRef === \"function\") {\n externalViewportRef(element);\n } else if (externalViewportRef) {\n (externalViewportRef as React.MutableRefObject<HTMLDivElement | null>).current =\n element;\n }\n },\n [externalViewportRef]\n );\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n type={type}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setViewportRef}\n data-slot=\"scroll-area-viewport\"\n onScroll={onViewportScroll}\n /*\n * `relative` makes the viewport the containing block of absolutely positioned content,\n * such as an Icon's hidden label. Without it, that content anchored to the root, was\n * not clipped by the viewport, and stretched whatever held the scroll area: a drawer\n * body could then be scrolled past its end into empty space.\n */\n className={cn(\n \"relative focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\",\n viewportClassName\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n onMouseDown,\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseDown?.(event);\n\n /*\n * Grabbing a scrollbar must not move focus. An autocomplete closes its list the moment its\n * input blurs, so without this, dragging the thumb dismisses the list under the pointer.\n */\n event.preventDefault();\n };\n\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n onMouseDown={handleMouseDown}\n className={cn(\n \"flex touch-none transition-colors select-none\",\n orientation === \"vertical\" && \"h-full w-[10px] p-[2px]\",\n orientation === \"horizontal\" && \"h-[10px] flex-col p-[2px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"bg-neutral-strong/70 relative flex-1 rounded-full\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n"],"names":["ScrollArea","className","children","onScrollPositionChange","onScroll","viewportClassName","onViewportScroll","externalViewportRef","type","props","viewportRef","React","setViewportRef","element","viewport","handleScroll","scrollTop","scrollLeft","scrollHeight","scrollWidth","clientHeight","clientWidth","position","ScrollAreaPrimitive","cn","ScrollBar","orientation","onMouseDown","handleMouseDown","event"],"mappings":";;;AAqCA,SAASA,WAAW,EAChBC,SAAS,EACTC,QAAQ,EACRC,sBAAsB,EACtBC,QAAQ,EACRC,iBAAiB,EACjBC,gBAAgB,EAChB,aAAaC,mBAAmB,EAKhCC,OAAO,MAAM,EACb,GAAGC,OACW;IACd,MAAMC,cAAcC,wBAAAA,MAAY,CAAwB;IAGxD,MAAMC,iBAAiBD,wBAAAA,WAAiB,CACpC,CAACE;QACGH,YAAY,OAAO,GAAGG;QACtB,IAAI,AAA+B,cAA/B,OAAON,qBACPA,oBAAoBM;aACjB,IAAIN,qBACNA,oBAAsE,OAAO,GAC1EM;IAEZ,GACA;QAACN;KAAoB;IAGzBI,wBAAAA,SAAe,CAAC;QACZ,MAAMG,WAAWJ,YAAY,OAAO;QACpC,IAAI,CAACI,YAAa,CAACX,0BAA0B,CAACC,UAC1C;QAIJ,MAAMW,eAAe;YACjB,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,WAAW,EAAEC,YAAY,EAAEC,WAAW,EAAE,GACjFP;YAEJ,MAAMQ,WAA2B;gBAC7B,KAAKJ,eAAeE,eAAeJ,YAAaE,CAAAA,eAAeE,YAAW,IAAK;gBAC/E,MAAMD,cAAcE,cAAcJ,aAAcE,CAAAA,cAAcE,WAAU,IAAK;gBAC7EL;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACJ;YAEAlB,yBAAyBmB;YACzBlB,WAAWkB;QACf;QAGAP;QAEAD,SAAS,gBAAgB,CAAC,UAAUC;QACpC,OAAO,IAAMD,SAAS,mBAAmB,CAAC,UAAUC;IACxD,GAAG;QAACZ;QAAwBC;KAAS;IAErC,OAAO,WAAP,GACI,sCAACmB,uDAAAA,IAAwB;QACrB,aAAU;QACV,MAAMf;QACN,WAAWgB,GAAG,YAAYvB;QACzB,GAAGQ,KAAK;qBAET,sCAACc,uDAAAA,QAA4B;QACzB,KAAKX;QACL,aAAU;QACV,UAAUN;QAOV,WAAWkB,GACP,+JACAnB;OAGHH,WAAAA,WAAAA,GAEL,sCAACuB,WAASA,OAAAA,WAAAA,GACV,sCAACF,uDAAAA,MAA0B;AAGvC;AAEA,SAASE,UAAU,EACfxB,SAAS,EACTyB,cAAc,UAAU,EACxBC,WAAW,EACX,GAAGlB,OACgE;IACnE,MAAMmB,kBAAkB,CAACC;QACrBF,cAAcE;QAMdA,MAAM,cAAc;IACxB;IAEA,OAAO,WAAP,GACI,sCAACN,uDAAAA,mBAAuC;QACpC,aAAU;QACV,aAAaG;QACb,aAAaE;QACb,WAAWJ,GACP,iDACAE,AAAgB,eAAhBA,eAA8B,2BAC9BA,AAAgB,iBAAhBA,eAAgC,6BAChCzB;QAEH,GAAGQ,KAAK;qBAET,sCAACc,uDAAAA,eAAmC;QAChC,aAAU;QACV,WAAU;;AAI1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react, { useMemo } from "react";
|
|
2
|
-
import { makeDecoratable, withStaticProps } from "../utils.js";
|
|
2
|
+
import { generateId, makeDecoratable, withStaticProps } from "../utils.js";
|
|
3
3
|
import { SegmentedControlTabs } from "./SegmentedControlTabs.js";
|
|
4
4
|
import { SegmentedControlPrimitive } from "./primitives/index.js";
|
|
5
5
|
import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
|
|
@@ -8,9 +8,11 @@ const DecoratableSegmentedControl = ({ label, description, note, hint, required,
|
|
|
8
8
|
const invalid = useMemo(()=>false === validationIsValid, [
|
|
9
9
|
validationIsValid
|
|
10
10
|
]);
|
|
11
|
+
const labelId = useMemo(()=>`${generateId()}-label`, []);
|
|
11
12
|
return /*#__PURE__*/ react.createElement("div", {
|
|
12
13
|
className: "w-full"
|
|
13
14
|
}, /*#__PURE__*/ react.createElement(FormComponentLabel, {
|
|
15
|
+
labelId: labelId,
|
|
14
16
|
text: label,
|
|
15
17
|
hint: hint,
|
|
16
18
|
required: required,
|
|
@@ -26,6 +28,7 @@ const DecoratableSegmentedControl = ({ label, description, note, hint, required,
|
|
|
26
28
|
disabled: disabled,
|
|
27
29
|
className: "mt-none mb-xs-plus"
|
|
28
30
|
}), /*#__PURE__*/ react.createElement(SegmentedControlPrimitive, {
|
|
31
|
+
"aria-labelledby": labelId,
|
|
29
32
|
...props,
|
|
30
33
|
disabled: disabled
|
|
31
34
|
}), /*#__PURE__*/ react.createElement(FormComponentNote, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl/SegmentedControl.js","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { SegmentedControlTabs } from \"./SegmentedControlTabs.js\";\nimport type { SegmentedControlPrimitiveProps } from \"./primitives/index.js\";\nimport { SegmentedControlPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SegmentedControlProps = SegmentedControlPrimitiveProps & FormComponentProps;\n\nconst DecoratableSegmentedControl = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SegmentedControlProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className=\"w-full\">\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className=\"mb-xs-plus\"\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className=\"mt-none mb-xs-plus\"\n />\n <SegmentedControlPrimitive {...props} disabled={disabled} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst BaseSegmentedControl = makeDecoratable(\"SegmentedControl\", DecoratableSegmentedControl);\n\nconst SegmentedControl = withStaticProps(BaseSegmentedControl, {\n Tabs: SegmentedControlTabs\n});\n\nexport { SegmentedControl, type SegmentedControlProps };\n"],"names":["DecoratableSegmentedControl","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","SegmentedControlPrimitive","FormComponentNote","BaseSegmentedControl","makeDecoratable","SegmentedControl","withStaticProps","SegmentedControlTabs"],"mappings":";;;;;AAeA,MAAMA,8BAA8B,CAAC,EACjCC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACiB;IACpB,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,
|
|
1
|
+
{"version":3,"file":"SegmentedControl/SegmentedControl.js","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, withStaticProps, generateId } from \"~/utils.js\";\nimport { SegmentedControlTabs } from \"./SegmentedControlTabs.js\";\nimport type { SegmentedControlPrimitiveProps } from \"./primitives/index.js\";\nimport { SegmentedControlPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SegmentedControlProps = SegmentedControlPrimitiveProps & FormComponentProps;\n\nconst DecoratableSegmentedControl = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SegmentedControlProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The control can't be a `<label for>` target, so it names itself after the label. */\n const labelId = useMemo(() => `${generateId()}-label`, []);\n\n return (\n <div className=\"w-full\">\n <FormComponentLabel\n labelId={labelId}\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className=\"mb-xs-plus\"\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className=\"mt-none mb-xs-plus\"\n />\n <SegmentedControlPrimitive aria-labelledby={labelId} {...props} disabled={disabled} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst BaseSegmentedControl = makeDecoratable(\"SegmentedControl\", DecoratableSegmentedControl);\n\nconst SegmentedControl = withStaticProps(BaseSegmentedControl, {\n Tabs: SegmentedControlTabs\n});\n\nexport { SegmentedControl, type SegmentedControlProps };\n"],"names":["DecoratableSegmentedControl","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","labelId","generateId","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","SegmentedControlPrimitive","FormComponentNote","BaseSegmentedControl","makeDecoratable","SegmentedControl","withStaticProps","SegmentedControlTabs"],"mappings":";;;;;AAeA,MAAMA,8BAA8B,CAAC,EACjCC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACiB;IACpB,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,MAAMI,UAAUD,QAAQ,IAAM,GAAGE,aAAa,MAAM,CAAC,EAAE,EAAE;IAEzD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,oBAAkBA;QACf,SAASF;QACT,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACK,0BAAwBA;QACrB,MAAMd;QACN,UAAUI;QACV,WAAU;sBAEd,oBAACW,2BAAyBA;QACtB,MAAMP;QACN,SAASC;QACT,UAAUL;QACV,WAAU;sBAEd,oBAACY,2BAAyBA;QAAC,mBAAiBL;QAAU,GAAGL,KAAK;QAAE,UAAUF;sBAC1E,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AAEA,MAAMc,uBAAuBC,gBAAgB,oBAAoBrB;AAEjE,MAAMsB,mBAAmBC,gBAAgBH,sBAAsB;IAC3D,MAAMI;AACV"}
|
|
@@ -36,6 +36,10 @@ interface SegmentedControlPrimitiveProps {
|
|
|
36
36
|
* Stretch the control to fill its container width, with buttons sharing space equally.
|
|
37
37
|
*/
|
|
38
38
|
fullWidth?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The id of the label that names the group.
|
|
41
|
+
*/
|
|
42
|
+
"aria-labelledby"?: string;
|
|
39
43
|
}
|
|
40
44
|
interface SegmentedControlVm {
|
|
41
45
|
items: SegmentedControlItemFormatted[];
|
|
@@ -44,7 +48,7 @@ interface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {
|
|
|
44
48
|
items: SegmentedControlItemFormatted[];
|
|
45
49
|
changeValue: (value: string) => void;
|
|
46
50
|
}
|
|
47
|
-
declare const SegmentedControlRenderer: ({ items, changeValue, value, variant, className, disabled, fullWidth }: SegmentedControlRendererProps) => React.JSX.Element;
|
|
51
|
+
declare const SegmentedControlRenderer: ({ items, changeValue, value, variant, className, disabled, fullWidth, "aria-labelledby": labelledBy }: SegmentedControlRendererProps) => React.JSX.Element;
|
|
48
52
|
/**
|
|
49
53
|
* Segmented Control Primitive Component
|
|
50
54
|
*/
|
|
@@ -65,8 +65,9 @@ const SegmentedControlItemButton = ({ item, isActive, onValueChange, variant, cl
|
|
|
65
65
|
label: String(item.label),
|
|
66
66
|
color: "neutral-strong"
|
|
67
67
|
}), item.label);
|
|
68
|
-
const SegmentedControlRenderer = ({ items, changeValue, value, variant = "light", className, disabled, fullWidth })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
68
|
+
const SegmentedControlRenderer = ({ items, changeValue, value, variant = "light", className, disabled, fullWidth, "aria-labelledby": labelledBy })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
69
69
|
role: "radiogroup",
|
|
70
|
+
"aria-labelledby": labelledBy,
|
|
70
71
|
className: cn(segmentedControlRootVariants({
|
|
71
72
|
variant
|
|
72
73
|
}), fullWidth && "flex w-full", className)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl/primitives/SegmentedControlPrimitive.js","sources":["../../../src/SegmentedControl/primitives/SegmentedControlPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport type {\n SegmentedControlItemParams,\n SegmentedControlItemFormatted\n} from \"../domains/index.js\";\nimport { useSegmentedControl } from \"./useSegmentedControl.js\";\nimport { Icon } from \"~/Icon/index.js\";\n\n/**\n * Segmented Control Item Button\n */\nconst segmentedControlItemVariants = cva(\n [\n \"inline-flex items-center justify-center whitespace-nowrap transition-colors cursor-pointer relative rounded-md\",\n \"text-md px-sm-extra py-xs [&>svg]:size-md gap-xs\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed focus-visible:ring-offset-0\",\n \"disabled:opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed\"\n ],\n {\n variants: {\n variant: {\n light: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n dimmed: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n ghost: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:bg-neutral-dark/5\",\n \"hover:data-[state=inactive]:bg-neutral-dark/5\",\n \"active:data-[state=inactive]:bg-neutral-dark/5\"\n ]\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n }\n);\n\nconst segmentedControlRootVariants = cva(\"inline-flex rounded-md p-xxs gap-xs\", {\n variants: {\n variant: {\n light: \"bg-neutral-light\",\n dimmed: \"bg-neutral-dimmed\",\n ghost: \"\"\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n});\n\ninterface SegmentedControlItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\"\n> {\n item: SegmentedControlItemFormatted;\n isActive: boolean;\n onValueChange: (value: string) => void;\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n}\n\nconst SegmentedControlItemButton = ({\n item,\n isActive,\n onValueChange,\n variant,\n className,\n ...props\n}: SegmentedControlItemProps) => {\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={isActive}\n data-state={isActive ? \"active\" : \"inactive\"}\n disabled={item.disabled}\n onClick={() => onValueChange(item.value)}\n className={cn(segmentedControlItemVariants({ variant }), className)}\n {...props}\n >\n {item.icon && (\n <Icon\n icon={item.icon}\n size={\"sm\"}\n label={String(item.label)}\n color={\"neutral-strong\"}\n />\n )}\n {item.label}\n </button>\n );\n};\n\n/**\n * Segmented Control Primitive\n */\ninterface SegmentedControlPrimitiveProps {\n items: SegmentedControlItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The selected value.\n */\n value?: string;\n /**\n * Visual style variant.\n */\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n /**\n * Additional class name.\n */\n className?: string;\n /**\n * Disabled state for all items.\n */\n disabled?: boolean;\n /**\n * Stretch the control to fill its container width, with buttons sharing space equally.\n */\n fullWidth?: boolean;\n}\n\ninterface SegmentedControlVm {\n items: SegmentedControlItemFormatted[];\n}\n\ninterface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {\n items: SegmentedControlItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst SegmentedControlRenderer = ({\n items,\n changeValue,\n value,\n variant = \"light\",\n className,\n disabled,\n fullWidth\n}: SegmentedControlRendererProps) => {\n return (\n <div\n role=\"radiogroup\"\n className={cn(\n segmentedControlRootVariants({ variant }),\n fullWidth && \"flex w-full\",\n className\n )}\n >\n {items.map(item => (\n <SegmentedControlItemButton\n key={item.id}\n item={{ ...item, disabled: disabled || item.disabled }}\n isActive={value === item.value}\n onValueChange={changeValue}\n variant={variant}\n className={fullWidth ? \"flex-1\" : undefined}\n />\n ))}\n </div>\n );\n};\n\n/**\n * Segmented Control Primitive Component\n */\nconst SegmentedControlPrimitive = (props: SegmentedControlPrimitiveProps) => {\n const { vm, changeValue } = useSegmentedControl(props);\n return <SegmentedControlRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\nexport {\n SegmentedControlPrimitive,\n SegmentedControlRenderer,\n type SegmentedControlPrimitiveProps,\n type SegmentedControlVm\n};\n"],"names":["segmentedControlItemVariants","cva","segmentedControlRootVariants","SegmentedControlItemButton","item","isActive","onValueChange","variant","className","props","cn","Icon","String","SegmentedControlRenderer","items","changeValue","value","disabled","fullWidth","undefined","SegmentedControlPrimitive","vm","useSegmentedControl"],"mappings":";;;;AAYA,MAAMA,+BAA+BC,IACjC;IACI;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;aACH;YACD,QAAQ;gBACJ;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;QACL;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAGJ,MAAMC,+BAA+BD,IAAI,uCAAuC;IAC5E,UAAU;QACN,SAAS;YACL,OAAO;YACP,QAAQ;YACR,OAAO;QACX;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAYA,MAAME,6BAA6B,CAAC,EAChCC,IAAI,EACJC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACT,GAAGC,OACqB,GACjB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,MAAK;QACL,gBAAcJ;QACd,cAAYA,WAAW,WAAW;QAClC,UAAUD,KAAK,QAAQ;QACvB,SAAS,IAAME,cAAcF,KAAK,KAAK;QACvC,WAAWM,GAAGV,6BAA6B;YAAEO;QAAQ,IAAIC;QACxD,GAAGC,KAAK;OAERL,KAAK,IAAI,IAAI,WAAJ,GACN,sCAACO,MAAIA;QACD,MAAMP,KAAK,IAAI;QACf,MAAM;QACN,OAAOQ,OAAOR,KAAK,KAAK;QACxB,OAAO;QAGdA,KAAK,KAAK;
|
|
1
|
+
{"version":3,"file":"SegmentedControl/primitives/SegmentedControlPrimitive.js","sources":["../../../src/SegmentedControl/primitives/SegmentedControlPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport type {\n SegmentedControlItemParams,\n SegmentedControlItemFormatted\n} from \"../domains/index.js\";\nimport { useSegmentedControl } from \"./useSegmentedControl.js\";\nimport { Icon } from \"~/Icon/index.js\";\n\n/**\n * Segmented Control Item Button\n */\nconst segmentedControlItemVariants = cva(\n [\n \"inline-flex items-center justify-center whitespace-nowrap transition-colors cursor-pointer relative rounded-md\",\n \"text-md px-sm-extra py-xs [&>svg]:size-md gap-xs\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed focus-visible:ring-offset-0\",\n \"disabled:opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed\"\n ],\n {\n variants: {\n variant: {\n light: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n dimmed: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n ghost: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:bg-neutral-dark/5\",\n \"hover:data-[state=inactive]:bg-neutral-dark/5\",\n \"active:data-[state=inactive]:bg-neutral-dark/5\"\n ]\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n }\n);\n\nconst segmentedControlRootVariants = cva(\"inline-flex rounded-md p-xxs gap-xs\", {\n variants: {\n variant: {\n light: \"bg-neutral-light\",\n dimmed: \"bg-neutral-dimmed\",\n ghost: \"\"\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n});\n\ninterface SegmentedControlItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\"\n> {\n item: SegmentedControlItemFormatted;\n isActive: boolean;\n onValueChange: (value: string) => void;\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n}\n\nconst SegmentedControlItemButton = ({\n item,\n isActive,\n onValueChange,\n variant,\n className,\n ...props\n}: SegmentedControlItemProps) => {\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={isActive}\n data-state={isActive ? \"active\" : \"inactive\"}\n disabled={item.disabled}\n onClick={() => onValueChange(item.value)}\n className={cn(segmentedControlItemVariants({ variant }), className)}\n {...props}\n >\n {item.icon && (\n <Icon\n icon={item.icon}\n size={\"sm\"}\n label={String(item.label)}\n color={\"neutral-strong\"}\n />\n )}\n {item.label}\n </button>\n );\n};\n\n/**\n * Segmented Control Primitive\n */\ninterface SegmentedControlPrimitiveProps {\n items: SegmentedControlItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The selected value.\n */\n value?: string;\n /**\n * Visual style variant.\n */\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n /**\n * Additional class name.\n */\n className?: string;\n /**\n * Disabled state for all items.\n */\n disabled?: boolean;\n /**\n * Stretch the control to fill its container width, with buttons sharing space equally.\n */\n fullWidth?: boolean;\n /**\n * The id of the label that names the group.\n */\n \"aria-labelledby\"?: string;\n}\n\ninterface SegmentedControlVm {\n items: SegmentedControlItemFormatted[];\n}\n\ninterface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {\n items: SegmentedControlItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst SegmentedControlRenderer = ({\n items,\n changeValue,\n value,\n variant = \"light\",\n className,\n disabled,\n fullWidth,\n \"aria-labelledby\": labelledBy\n}: SegmentedControlRendererProps) => {\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={labelledBy}\n className={cn(\n segmentedControlRootVariants({ variant }),\n fullWidth && \"flex w-full\",\n className\n )}\n >\n {items.map(item => (\n <SegmentedControlItemButton\n key={item.id}\n item={{ ...item, disabled: disabled || item.disabled }}\n isActive={value === item.value}\n onValueChange={changeValue}\n variant={variant}\n className={fullWidth ? \"flex-1\" : undefined}\n />\n ))}\n </div>\n );\n};\n\n/**\n * Segmented Control Primitive Component\n */\nconst SegmentedControlPrimitive = (props: SegmentedControlPrimitiveProps) => {\n const { vm, changeValue } = useSegmentedControl(props);\n return <SegmentedControlRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\nexport {\n SegmentedControlPrimitive,\n SegmentedControlRenderer,\n type SegmentedControlPrimitiveProps,\n type SegmentedControlVm\n};\n"],"names":["segmentedControlItemVariants","cva","segmentedControlRootVariants","SegmentedControlItemButton","item","isActive","onValueChange","variant","className","props","cn","Icon","String","SegmentedControlRenderer","items","changeValue","value","disabled","fullWidth","labelledBy","undefined","SegmentedControlPrimitive","vm","useSegmentedControl"],"mappings":";;;;AAYA,MAAMA,+BAA+BC,IACjC;IACI;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;aACH;YACD,QAAQ;gBACJ;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;QACL;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAGJ,MAAMC,+BAA+BD,IAAI,uCAAuC;IAC5E,UAAU;QACN,SAAS;YACL,OAAO;YACP,QAAQ;YACR,OAAO;QACX;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAYA,MAAME,6BAA6B,CAAC,EAChCC,IAAI,EACJC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACT,GAAGC,OACqB,GACjB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,MAAK;QACL,gBAAcJ;QACd,cAAYA,WAAW,WAAW;QAClC,UAAUD,KAAK,QAAQ;QACvB,SAAS,IAAME,cAAcF,KAAK,KAAK;QACvC,WAAWM,GAAGV,6BAA6B;YAAEO;QAAQ,IAAIC;QACxD,GAAGC,KAAK;OAERL,KAAK,IAAI,IAAI,WAAJ,GACN,sCAACO,MAAIA;QACD,MAAMP,KAAK,IAAI;QACf,MAAM;QACN,OAAOQ,OAAOR,KAAK,KAAK;QACxB,OAAO;QAGdA,KAAK,KAAK;AAiDvB,MAAMS,2BAA2B,CAAC,EAC9BC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLT,UAAU,OAAO,EACjBC,SAAS,EACTS,QAAQ,EACRC,SAAS,EACT,mBAAmBC,UAAU,EACD,GACrB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,mBAAiBA;QACjB,WAAWT,GACPR,6BAA6B;YAAEK;QAAQ,IACvCW,aAAa,eACbV;OAGHM,MAAM,GAAG,CAACV,CAAAA,OAAAA,WAAAA,GACP,sCAACD,4BAA0BA;YACvB,KAAKC,KAAK,EAAE;YACZ,MAAM;gBAAE,GAAGA,IAAI;gBAAE,UAAUa,YAAYb,KAAK,QAAQ;YAAC;YACrD,UAAUY,UAAUZ,KAAK,KAAK;YAC9B,eAAeW;YACf,SAASR;YACT,WAAWW,YAAY,WAAWE;;AAUtD,MAAMC,4BAA4B,CAACZ;IAC/B,MAAM,EAAEa,EAAE,EAAEP,WAAW,EAAE,GAAGQ,oBAAoBd;IAChD,OAAO,WAAP,GAAO,sCAACI,0BAAwBA;QAAE,GAAGJ,KAAK;QAAE,OAAOa,GAAG,KAAK;QAAE,aAAaP;;AAC9E"}
|
package/Select/Select.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react, { useMemo } from "react";
|
|
2
|
-
import { makeDecoratable } from "../utils.js";
|
|
2
|
+
import { generateId, makeDecoratable } from "../utils.js";
|
|
3
3
|
import { SelectPrimitive } from "./primitives/index.js";
|
|
4
4
|
import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
|
|
5
5
|
const DecoratableSelect = ({ label, description, note, hint, required, disabled, validation, ...props })=>{
|
|
@@ -7,9 +7,13 @@ const DecoratableSelect = ({ label, description, note, hint, required, disabled,
|
|
|
7
7
|
const invalid = useMemo(()=>false === validationIsValid, [
|
|
8
8
|
validationIsValid
|
|
9
9
|
]);
|
|
10
|
+
const id = useMemo(()=>generateId(props.id), [
|
|
11
|
+
props.id
|
|
12
|
+
]);
|
|
10
13
|
return /*#__PURE__*/ react.createElement("div", {
|
|
11
14
|
className: "w-full"
|
|
12
15
|
}, /*#__PURE__*/ react.createElement(FormComponentLabel, {
|
|
16
|
+
htmlFor: id,
|
|
13
17
|
text: label,
|
|
14
18
|
hint: hint,
|
|
15
19
|
required: required,
|
|
@@ -20,6 +24,7 @@ const DecoratableSelect = ({ label, description, note, hint, required, disabled,
|
|
|
20
24
|
disabled: disabled
|
|
21
25
|
}), /*#__PURE__*/ react.createElement(SelectPrimitive, {
|
|
22
26
|
...props,
|
|
27
|
+
id: id,
|
|
23
28
|
disabled: disabled,
|
|
24
29
|
invalid: invalid
|
|
25
30
|
}), /*#__PURE__*/ react.createElement(FormComponentErrorMessage, {
|
package/Select/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select/Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { SelectPrimitiveProps } from \"./primitives/index.js\";\nimport { SelectPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SelectProps = SelectPrimitiveProps & FormComponentProps;\n\nconst DecoratableSelect = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SelectProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <SelectPrimitive {...props} disabled={disabled} invalid={invalid} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst Select = makeDecoratable(\"Select\", DecoratableSelect);\n\nexport { Select, type SelectProps };\n"],"names":["DecoratableSelect","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","SelectPrimitive","FormComponentErrorMessage","FormComponentNote","Select","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,oBAAoB,CAAC,EACvBC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACO;IACV,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,
|
|
1
|
+
{"version":3,"file":"Select/Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { SelectPrimitiveProps } from \"./primitives/index.js\";\nimport { SelectPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SelectProps = SelectPrimitiveProps & FormComponentProps;\n\nconst DecoratableSelect = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SelectProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The label names the trigger, so `getByLabelText` / `{ label }` find the select. */\n const id = useMemo(() => generateId(props.id), [props.id]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n htmlFor={id}\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <SelectPrimitive {...props} id={id} disabled={disabled} invalid={invalid} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst Select = makeDecoratable(\"Select\", DecoratableSelect);\n\nexport { Select, type SelectProps };\n"],"names":["DecoratableSelect","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","id","generateId","FormComponentLabel","FormComponentDescription","SelectPrimitive","FormComponentErrorMessage","FormComponentNote","Select","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,oBAAoB,CAAC,EACvBC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACO;IACV,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,MAAMI,KAAKD,QAAQ,IAAME,WAAWN,MAAM,EAAE,GAAG;QAACA,MAAM,EAAE;KAAC;IAEzD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACO,oBAAkBA;QACf,SAASF;QACT,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACK,0BAAwBA;QAAC,MAAMd;QAAa,UAAUI;sBACvD,oBAACW,iBAAeA;QAAE,GAAGT,KAAK;QAAE,IAAIK;QAAI,UAAUP;QAAU,SAASK;sBACjE,oBAACO,2BAAyBA;QACtB,MAAMR;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AACA,MAAMc,SAASC,gBAAgB,UAAUrB"}
|
|
@@ -31,6 +31,10 @@ interface SelectPrimitiveProps {
|
|
|
31
31
|
* Whether to display the reset action button.
|
|
32
32
|
*/
|
|
33
33
|
displayResetAction?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The trigger's id — what a `<label htmlFor>` points at.
|
|
36
|
+
*/
|
|
37
|
+
id?: string;
|
|
34
38
|
/**
|
|
35
39
|
* Indicates if the field is disabled.
|
|
36
40
|
*/
|
|
@@ -8,7 +8,7 @@ import * as __rspack_external_react from "react";
|
|
|
8
8
|
const SelectRoot = Select.Root;
|
|
9
9
|
const SelectGroup = Select.Group;
|
|
10
10
|
const SelectValue = Select.Value;
|
|
11
|
-
const Trigger = ({ hasValue, size, variant, startIcon, endIcon, invalid, onValueReset, disabled, displayResetAction, ...props })=>{
|
|
11
|
+
const Trigger = ({ id, hasValue, size, variant, startIcon, endIcon, invalid, onValueReset, disabled, displayResetAction, ...props })=>{
|
|
12
12
|
const resetButton = __rspack_external_react.useMemo(()=>{
|
|
13
13
|
if (!hasValue || !displayResetAction) return;
|
|
14
14
|
return /*#__PURE__*/ __rspack_external_react.createElement(IconButton, {
|
|
@@ -34,6 +34,7 @@ const Trigger = ({ hasValue, size, variant, startIcon, endIcon, invalid, onValue
|
|
|
34
34
|
variant
|
|
35
35
|
]);
|
|
36
36
|
return /*#__PURE__*/ __rspack_external_react.createElement(SelectTrigger, {
|
|
37
|
+
id: id,
|
|
37
38
|
size: size,
|
|
38
39
|
variant: variant,
|
|
39
40
|
invalid: invalid,
|
|
@@ -71,7 +72,7 @@ const SelectPrimitiveRenderer = ({ selectRootProps, selectTriggerProps, selectOp
|
|
|
71
72
|
}), /*#__PURE__*/ __rspack_external_react.createElement(SelectOptions, selectOptionsProps));
|
|
72
73
|
const SelectPrimitive = (props)=>{
|
|
73
74
|
const { vm, changeValue, resetValue } = useSelect(props);
|
|
74
|
-
const { size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;
|
|
75
|
+
const { id, size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;
|
|
75
76
|
return /*#__PURE__*/ __rspack_external_react.createElement(SelectPrimitiveRenderer, {
|
|
76
77
|
selectRootProps: {
|
|
77
78
|
...selectRootProps,
|
|
@@ -80,6 +81,7 @@ const SelectPrimitive = (props)=>{
|
|
|
80
81
|
},
|
|
81
82
|
selectTriggerProps: {
|
|
82
83
|
...vm.selectTrigger,
|
|
84
|
+
id,
|
|
83
85
|
size,
|
|
84
86
|
variant,
|
|
85
87
|
startIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select/primitives/SelectPrimitive.js","sources":["../../../src/Select/primitives/SelectPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { type VariantProps } from \"~/utils.js\";\nimport { useSelect } from \"./useSelect.js\";\nimport type { SelectOptionDto, SelectOptionFormatted } from \"../domains/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport type { selectTriggerVariants } from \"./components/index.js\";\nimport {\n SelectContent,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger\n} from \"./components/index.js\";\n\nconst SelectRoot = SelectPrimitives.Root;\n\nconst SelectGroup = SelectPrimitives.Group;\n\nconst SelectValue = SelectPrimitives.Value;\n\n/**\n * Trigger\n */\ntype SelectTriggerVm = {\n placeholder: string;\n hasValue: boolean;\n displayResetAction: boolean;\n};\n\ntype SelectTriggerProps = SelectPrimitives.SelectValueProps &\n SelectTriggerVm & {\n size: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n invalid: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n startIcon?: React.ReactElement;\n endIcon?: React.ReactElement;\n onValueReset: () => void;\n disabled?: boolean;\n };\n\nconst Trigger = ({\n hasValue,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n onValueReset,\n disabled,\n displayResetAction,\n ...props\n}: SelectTriggerProps) => {\n const resetButton = React.useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, onValueReset, disabled, displayResetAction, variant]);\n\n return (\n <SelectTrigger\n size={size}\n variant={variant}\n invalid={invalid}\n startIcon={startIcon}\n endIcon={endIcon}\n resetButton={resetButton}\n >\n <div className={\"flex-1 text-left truncate\"}>\n <SelectValue {...props} />\n </div>\n </SelectTrigger>\n );\n};\n\n/**\n * SelectOptions\n */\ntype SelectOptionsVm = {\n options: SelectOptionFormatted[];\n};\n\ntype SelectOptionsProps = SelectOptionsVm;\n\nconst SelectOptions = (props: SelectOptionsProps) => {\n const renderOptions = React.useCallback((items: SelectOptionFormatted[]) => {\n return items.map((item, index) => {\n const elements = [];\n\n if (item.options.length > 0) {\n // Render as a group if there are nested options\n elements.push(\n <SelectGroup key={`group-${index}`}>\n <SelectLabel>{item.label}</SelectLabel>\n {renderOptions(item.options)}\n </SelectGroup>\n );\n }\n\n if (item.value) {\n // Render as a select item if there are no nested options\n elements.push(\n <SelectItem\n key={`item-${item.value}`}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </SelectItem>\n );\n }\n\n // Conditionally render the separator if hasSeparator is true\n if (item.separator) {\n elements.push(<SelectSeparator key={`separator-${item.value ?? index}`} />);\n }\n\n return elements;\n });\n }, []);\n\n return <SelectContent>{renderOptions(props.options)}</SelectContent>;\n};\n\n/**\n * SelectRenderer\n */\nexport type SelectRootVm = {\n value: string;\n};\n\ntype SelectRootProps = Omit<SelectPrimitives.SelectProps, \"onValueChange\">;\n\ntype SelectRendererProps = {\n selectRootProps: SelectRootProps;\n selectTriggerProps: Omit<SelectTriggerProps, \"onValueReset\">;\n selectOptionsProps: SelectOptionsProps;\n onValueChange: (value: string) => void;\n onValueReset: () => void;\n};\n\nconst SelectPrimitiveRenderer = ({\n selectRootProps,\n selectTriggerProps,\n selectOptionsProps,\n onValueChange,\n onValueReset\n}: SelectRendererProps) => {\n return (\n <SelectRoot {...selectRootProps} onValueChange={onValueChange}>\n <Trigger {...selectTriggerProps} onValueReset={onValueReset} />\n <SelectOptions {...selectOptionsProps} />\n </SelectRoot>\n );\n};\n\n/**\n * Select\n */\ntype SelectOption = SelectOptionDto | string;\n\ninterface SelectPrimitiveProps {\n /**\n * Whether to display the reset action button.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Icon to display at the end of the select trigger.\n */\n endIcon?: React.ReactElement;\n /**\n * Whether the select input is invalid.\n */\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n /**\n * Callback function called when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback function called when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback function called when the value is reset.\n */\n onValueReset?: () => void;\n /**\n * Array of options to display in the select dropdown.\n */\n options?: SelectOption[];\n /**\n * Placeholder text to display when no value is selected.\n */\n placeholder?: string;\n /**\n * Size variant of the select trigger.\n */\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n /**\n * Icon to display at the start of the select trigger.\n */\n startIcon?: React.ReactElement;\n /**\n * The value of the select input.\n */\n value?: string;\n /**\n * Style variant of the select trigger.\n */\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\nconst SelectPrimitive = (props: SelectPrimitiveProps) => {\n const { vm, changeValue, resetValue } = useSelect(props);\n const { size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;\n\n return (\n <SelectPrimitiveRenderer\n selectRootProps={{ ...selectRootProps, ...vm.selectRoot, disabled }}\n selectTriggerProps={{\n ...vm.selectTrigger,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n disabled\n }}\n selectOptionsProps={vm.selectOptions}\n onValueChange={changeValue}\n onValueReset={resetValue}\n />\n );\n};\n\nexport {\n SelectPrimitive,\n type SelectPrimitiveProps,\n type SelectOptionsVm,\n type SelectTriggerVm,\n type SelectOption\n};\n"],"names":["SelectRoot","SelectPrimitives","SelectGroup","SelectValue","Trigger","hasValue","size","variant","startIcon","endIcon","invalid","onValueReset","disabled","displayResetAction","props","resetButton","React","IconButton","event","Icon","Close","SelectTrigger","SelectOptions","renderOptions","items","item","index","elements","SelectLabel","SelectItem","SelectSeparator","SelectContent","SelectPrimitiveRenderer","selectRootProps","selectTriggerProps","selectOptionsProps","onValueChange","SelectPrimitive","vm","changeValue","resetValue","useSelect"],"mappings":";;;;;;;AAiBA,MAAMA,aAAaC,OAAAA,IAAqB;AAExC,MAAMC,cAAcD,OAAAA,KAAsB;AAE1C,MAAME,cAAcF,OAAAA,KAAsB;AAsB1C,MAAMG,UAAU,CAAC,EACbC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,OACc;IACjB,MAAMC,cAAcC,wBAAAA,OAAa,CAAC;QAC9B,IAAI,CAACX,YAAY,CAACQ,oBACd;QAGJ,OAAO,WAAP,GACI,sCAACI,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBP;YACJ;YACA,oBACI,sCAAC,4BACG,sCAACQ,MAAIA;gBACD,oBAAM,sCAACC,gBAAKA;gBACZ,OAAO;gBACP,OAAOb,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUK;YACV;;IAGZ,GAAG;QAACP;QAAUM;QAAcC;QAAUC;QAAoBN;KAAQ;IAElE,OAAO,WAAP,GACI,sCAACc,eAAaA;QACV,MAAMf;QACN,SAASC;QACT,SAASG;QACT,WAAWF;QACX,SAASC;QACT,aAAaM;qBAEb,sCAAC;QAAI,WAAW;qBACZ,sCAACZ,aAAgBW;AAIjC;AAWA,MAAMQ,gBAAgB,CAACR;IACnB,MAAMS,gBAAgBP,wBAAAA,WAAiB,CAAC,CAACQ,QAC9BA,MAAM,GAAG,CAAC,CAACC,MAAMC;YACpB,MAAMC,WAAW,EAAE;YAEnB,IAAIF,KAAK,OAAO,CAAC,MAAM,GAAG,GAEtBE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACzB,aAAWA;gBAAC,KAAK,CAAC,MAAM,EAAEwB,OAAO;6BAC9B,sCAACE,aAAWA,MAAEH,KAAK,KAAK,GACvBF,cAAcE,KAAK,OAAO;YAKvC,IAAIA,KAAK,KAAK,EAEVE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACE,YAAUA;gBACP,KAAK,CAAC,KAAK,EAAEJ,KAAK,KAAK,EAAE;gBACzB,OAAOA,KAAK,KAAK;gBACjB,UAAUA,KAAK,QAAQ;eAEtBA,KAAK,KAAK;YAMvB,IAAIA,KAAK,SAAS,EACdE,SAAS,IAAI,CAAC,WAAD,GAAC,sCAACG,iBAAeA;gBAAC,KAAK,CAAC,UAAU,EAAEL,KAAK,KAAK,IAAIC,OAAO;;YAG1E,OAAOC;QACX,IACD,EAAE;IAEL,OAAO,WAAP,GAAO,sCAACI,eAAaA,MAAER,cAAcT,MAAM,OAAO;AACtD;AAmBA,MAAMkB,0BAA0B,CAAC,EAC7BC,eAAe,EACfC,kBAAkB,EAClBC,kBAAkB,EAClBC,aAAa,EACbzB,YAAY,EACM,GACX,WAAP,GACI,sCAACX,YAAUA;QAAE,GAAGiC,eAAe;QAAE,eAAeG;qBAC5C,sCAAChC,SAAOA;QAAE,GAAG8B,kBAAkB;QAAE,cAAcvB;sBAC/C,sCAACW,eAAkBa;AAiE/B,MAAME,kBAAkB,CAACvB;IACrB,MAAM,EAAEwB,EAAE,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAGC,UAAU3B;IAClD,MAAM,EAAER,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEE,QAAQ,EAAE,GAAGqB,iBAAiB,GAAGnB;IAErF,OAAO,WAAP,GACI,sCAACkB,yBAAuBA;QACpB,iBAAiB;YAAE,GAAGC,eAAe;YAAE,GAAGK,GAAG,UAAU;YAAE1B;QAAS;QAClE,oBAAoB;YAChB,GAAG0B,GAAG,aAAa;YACnBhC;YACAC;YACAC;YACAC;YACAC;YACAE;QACJ;QACA,oBAAoB0B,GAAG,aAAa;QACpC,eAAeC;QACf,cAAcC;;AAG1B"}
|
|
1
|
+
{"version":3,"file":"Select/primitives/SelectPrimitive.js","sources":["../../../src/Select/primitives/SelectPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { type VariantProps } from \"~/utils.js\";\nimport { useSelect } from \"./useSelect.js\";\nimport type { SelectOptionDto, SelectOptionFormatted } from \"../domains/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport type { selectTriggerVariants } from \"./components/index.js\";\nimport {\n SelectContent,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger\n} from \"./components/index.js\";\n\nconst SelectRoot = SelectPrimitives.Root;\n\nconst SelectGroup = SelectPrimitives.Group;\n\nconst SelectValue = SelectPrimitives.Value;\n\n/**\n * Trigger\n */\ntype SelectTriggerVm = {\n placeholder: string;\n hasValue: boolean;\n displayResetAction: boolean;\n};\n\ntype SelectTriggerProps = SelectPrimitives.SelectValueProps &\n SelectTriggerVm & {\n size: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n invalid: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n startIcon?: React.ReactElement;\n endIcon?: React.ReactElement;\n onValueReset: () => void;\n disabled?: boolean;\n /** Lands on the trigger — the `combobox` a label names — not on the value inside it. */\n id?: string;\n };\n\nconst Trigger = ({\n id,\n hasValue,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n onValueReset,\n disabled,\n displayResetAction,\n ...props\n}: SelectTriggerProps) => {\n const resetButton = React.useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, onValueReset, disabled, displayResetAction, variant]);\n\n return (\n <SelectTrigger\n id={id}\n size={size}\n variant={variant}\n invalid={invalid}\n startIcon={startIcon}\n endIcon={endIcon}\n resetButton={resetButton}\n >\n <div className={\"flex-1 text-left truncate\"}>\n <SelectValue {...props} />\n </div>\n </SelectTrigger>\n );\n};\n\n/**\n * SelectOptions\n */\ntype SelectOptionsVm = {\n options: SelectOptionFormatted[];\n};\n\ntype SelectOptionsProps = SelectOptionsVm;\n\nconst SelectOptions = (props: SelectOptionsProps) => {\n const renderOptions = React.useCallback((items: SelectOptionFormatted[]) => {\n return items.map((item, index) => {\n const elements = [];\n\n if (item.options.length > 0) {\n // Render as a group if there are nested options\n elements.push(\n <SelectGroup key={`group-${index}`}>\n <SelectLabel>{item.label}</SelectLabel>\n {renderOptions(item.options)}\n </SelectGroup>\n );\n }\n\n if (item.value) {\n // Render as a select item if there are no nested options\n elements.push(\n <SelectItem\n key={`item-${item.value}`}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </SelectItem>\n );\n }\n\n // Conditionally render the separator if hasSeparator is true\n if (item.separator) {\n elements.push(<SelectSeparator key={`separator-${item.value ?? index}`} />);\n }\n\n return elements;\n });\n }, []);\n\n return <SelectContent>{renderOptions(props.options)}</SelectContent>;\n};\n\n/**\n * SelectRenderer\n */\nexport type SelectRootVm = {\n value: string;\n};\n\ntype SelectRootProps = Omit<SelectPrimitives.SelectProps, \"onValueChange\">;\n\ntype SelectRendererProps = {\n selectRootProps: SelectRootProps;\n selectTriggerProps: Omit<SelectTriggerProps, \"onValueReset\">;\n selectOptionsProps: SelectOptionsProps;\n onValueChange: (value: string) => void;\n onValueReset: () => void;\n};\n\nconst SelectPrimitiveRenderer = ({\n selectRootProps,\n selectTriggerProps,\n selectOptionsProps,\n onValueChange,\n onValueReset\n}: SelectRendererProps) => {\n return (\n <SelectRoot {...selectRootProps} onValueChange={onValueChange}>\n <Trigger {...selectTriggerProps} onValueReset={onValueReset} />\n <SelectOptions {...selectOptionsProps} />\n </SelectRoot>\n );\n};\n\n/**\n * Select\n */\ntype SelectOption = SelectOptionDto | string;\n\ninterface SelectPrimitiveProps {\n /**\n * Whether to display the reset action button.\n */\n displayResetAction?: boolean;\n /**\n * The trigger's id — what a `<label htmlFor>` points at.\n */\n id?: string;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Icon to display at the end of the select trigger.\n */\n endIcon?: React.ReactElement;\n /**\n * Whether the select input is invalid.\n */\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n /**\n * Callback function called when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback function called when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback function called when the value is reset.\n */\n onValueReset?: () => void;\n /**\n * Array of options to display in the select dropdown.\n */\n options?: SelectOption[];\n /**\n * Placeholder text to display when no value is selected.\n */\n placeholder?: string;\n /**\n * Size variant of the select trigger.\n */\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n /**\n * Icon to display at the start of the select trigger.\n */\n startIcon?: React.ReactElement;\n /**\n * The value of the select input.\n */\n value?: string;\n /**\n * Style variant of the select trigger.\n */\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\nconst SelectPrimitive = (props: SelectPrimitiveProps) => {\n const { vm, changeValue, resetValue } = useSelect(props);\n const { id, size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;\n\n return (\n <SelectPrimitiveRenderer\n selectRootProps={{ ...selectRootProps, ...vm.selectRoot, disabled }}\n selectTriggerProps={{\n ...vm.selectTrigger,\n id,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n disabled\n }}\n selectOptionsProps={vm.selectOptions}\n onValueChange={changeValue}\n onValueReset={resetValue}\n />\n );\n};\n\nexport {\n SelectPrimitive,\n type SelectPrimitiveProps,\n type SelectOptionsVm,\n type SelectTriggerVm,\n type SelectOption\n};\n"],"names":["SelectRoot","SelectPrimitives","SelectGroup","SelectValue","Trigger","id","hasValue","size","variant","startIcon","endIcon","invalid","onValueReset","disabled","displayResetAction","props","resetButton","React","IconButton","event","Icon","Close","SelectTrigger","SelectOptions","renderOptions","items","item","index","elements","SelectLabel","SelectItem","SelectSeparator","SelectContent","SelectPrimitiveRenderer","selectRootProps","selectTriggerProps","selectOptionsProps","onValueChange","SelectPrimitive","vm","changeValue","resetValue","useSelect"],"mappings":";;;;;;;AAiBA,MAAMA,aAAaC,OAAAA,IAAqB;AAExC,MAAMC,cAAcD,OAAAA,KAAsB;AAE1C,MAAME,cAAcF,OAAAA,KAAsB;AAwB1C,MAAMG,UAAU,CAAC,EACbC,EAAE,EACFC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,OACc;IACjB,MAAMC,cAAcC,wBAAAA,OAAa,CAAC;QAC9B,IAAI,CAACX,YAAY,CAACQ,oBACd;QAGJ,OAAO,WAAP,GACI,sCAACI,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBP;YACJ;YACA,oBACI,sCAAC,4BACG,sCAACQ,MAAIA;gBACD,oBAAM,sCAACC,gBAAKA;gBACZ,OAAO;gBACP,OAAOb,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUK;YACV;;IAGZ,GAAG;QAACP;QAAUM;QAAcC;QAAUC;QAAoBN;KAAQ;IAElE,OAAO,WAAP,GACI,sCAACc,eAAaA;QACV,IAAIjB;QACJ,MAAME;QACN,SAASC;QACT,SAASG;QACT,WAAWF;QACX,SAASC;QACT,aAAaM;qBAEb,sCAAC;QAAI,WAAW;qBACZ,sCAACb,aAAgBY;AAIjC;AAWA,MAAMQ,gBAAgB,CAACR;IACnB,MAAMS,gBAAgBP,wBAAAA,WAAiB,CAAC,CAACQ,QAC9BA,MAAM,GAAG,CAAC,CAACC,MAAMC;YACpB,MAAMC,WAAW,EAAE;YAEnB,IAAIF,KAAK,OAAO,CAAC,MAAM,GAAG,GAEtBE,SAAS,IAAI,CAAC,WAAD,GACT,sCAAC1B,aAAWA;gBAAC,KAAK,CAAC,MAAM,EAAEyB,OAAO;6BAC9B,sCAACE,aAAWA,MAAEH,KAAK,KAAK,GACvBF,cAAcE,KAAK,OAAO;YAKvC,IAAIA,KAAK,KAAK,EAEVE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACE,YAAUA;gBACP,KAAK,CAAC,KAAK,EAAEJ,KAAK,KAAK,EAAE;gBACzB,OAAOA,KAAK,KAAK;gBACjB,UAAUA,KAAK,QAAQ;eAEtBA,KAAK,KAAK;YAMvB,IAAIA,KAAK,SAAS,EACdE,SAAS,IAAI,CAAC,WAAD,GAAC,sCAACG,iBAAeA;gBAAC,KAAK,CAAC,UAAU,EAAEL,KAAK,KAAK,IAAIC,OAAO;;YAG1E,OAAOC;QACX,IACD,EAAE;IAEL,OAAO,WAAP,GAAO,sCAACI,eAAaA,MAAER,cAAcT,MAAM,OAAO;AACtD;AAmBA,MAAMkB,0BAA0B,CAAC,EAC7BC,eAAe,EACfC,kBAAkB,EAClBC,kBAAkB,EAClBC,aAAa,EACbzB,YAAY,EACM,GACX,WAAP,GACI,sCAACZ,YAAUA;QAAE,GAAGkC,eAAe;QAAE,eAAeG;qBAC5C,sCAACjC,SAAOA;QAAE,GAAG+B,kBAAkB;QAAE,cAAcvB;sBAC/C,sCAACW,eAAkBa;AAqE/B,MAAME,kBAAkB,CAACvB;IACrB,MAAM,EAAEwB,EAAE,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAGC,UAAU3B;IAClD,MAAM,EAAEV,EAAE,EAAEE,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEE,QAAQ,EAAE,GAAGqB,iBAAiB,GAAGnB;IAEzF,OAAO,WAAP,GACI,sCAACkB,yBAAuBA;QACpB,iBAAiB;YAAE,GAAGC,eAAe;YAAE,GAAGK,GAAG,UAAU;YAAE1B;QAAS;QAClE,oBAAoB;YAChB,GAAG0B,GAAG,aAAa;YACnBlC;YACAE;YACAC;YACAC;YACAC;YACAC;YACAE;QACJ;QACA,oBAAoB0B,GAAG,aAAa;QACpC,eAAeC;QACf,cAAcC;;AAG1B"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Select } from "radix-ui";
|
|
2
2
|
import { cn } from "../../../utils.js";
|
|
3
|
-
import { SelectScrollUpButton } from "./SelectScrollUpButton.js";
|
|
4
|
-
import { SelectScrollDownButton } from "./SelectScrollDownButton.js";
|
|
5
3
|
import * as __rspack_external_react from "react";
|
|
6
4
|
const SelectContent = ({ className, children, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement(Select.Portal, null, /*#__PURE__*/ __rspack_external_react.createElement(Select.Content, {
|
|
7
5
|
className: cn([
|
|
8
|
-
"relative z-popover max-h-
|
|
6
|
+
"relative z-popover max-h-[250px] min-w-56 shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong",
|
|
9
7
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
10
8
|
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"
|
|
11
9
|
], className),
|
|
12
10
|
position: "popper",
|
|
13
11
|
...props
|
|
14
|
-
}, /*#__PURE__*/ __rspack_external_react.createElement(
|
|
12
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Select.Viewport, {
|
|
15
13
|
className: cn([
|
|
16
|
-
"py-
|
|
14
|
+
"py-sm",
|
|
17
15
|
"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"
|
|
18
16
|
])
|
|
19
|
-
}, children)
|
|
17
|
+
}, children)));
|
|
20
18
|
export { SelectContent };
|
|
21
19
|
|
|
22
20
|
//# sourceMappingURL=SelectContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select/primitives/components/SelectContent.js","sources":["../../../../src/Select/primitives/components/SelectContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\
|
|
1
|
+
{"version":3,"file":"Select/primitives/components/SelectContent.js","sources":["../../../../src/Select/primitives/components/SelectContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\n\ntype SelectContentProps = SelectPrimitives.SelectContentProps;\n\nconst SelectContent = ({ className, children, ...props }: SelectContentProps) => (\n <SelectPrimitives.Portal>\n <SelectPrimitives.Content\n className={cn(\n [\n \"relative z-popover max-h-[250px] min-w-56 shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\"\n ],\n className\n )}\n position={\"popper\"}\n {...props}\n >\n {/* Two things keep this scrollbar in line with the one in the autocomplete popovers.\n No scroll buttons, because they come and go with the scroll position, taking the\n viewport height and the size of the thumb with them. And the padding on the\n viewport rather than around it, so the scrollbar runs the full height of the list. */}\n <SelectPrimitives.Viewport\n className={cn([\n \"py-sm\",\n \"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)\"\n ])}\n >\n {children}\n </SelectPrimitives.Viewport>\n </SelectPrimitives.Content>\n </SelectPrimitives.Portal>\n);\n\nexport { SelectContent, type SelectContentProps };\n"],"names":["SelectContent","className","children","props","SelectPrimitives","cn"],"mappings":";;;AAMA,MAAMA,gBAAgB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAA2B,iBACxE,sCAACC,OAAAA,MAAuB,sBACpB,sCAACA,OAAAA,OAAwB;QACrB,WAAWC,GACP;YACI;YACA;YACA;SACH,EACDJ;QAEJ,UAAU;QACT,GAAGE,KAAK;qBAMT,sCAACC,OAAAA,QAAyB;QACtB,WAAWC,GAAG;YACV;YACA;SACH;OAEAH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface SidePanelProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
|
|
3
|
+
title: React.ReactNode;
|
|
4
|
+
/** A 20px icon ahead of the title. */
|
|
5
|
+
icon?: React.ReactElement;
|
|
6
|
+
/** Shows a back button, for a panel that has drilled into one item. */
|
|
7
|
+
onBack?: () => void;
|
|
8
|
+
backLabel?: string;
|
|
9
|
+
/** After the title: a small tertiary button and the few ghost icon buttons that matter. */
|
|
10
|
+
headerEnd?: React.ReactNode;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
closeLabel?: string;
|
|
13
|
+
/** A fixed row under the header that does not scroll, such as a search field. */
|
|
14
|
+
headerExtra?: React.ReactNode;
|
|
15
|
+
width?: React.CSSProperties["width"];
|
|
16
|
+
/** `SidePanelBody`, then an optional `SidePanelFooter`. */
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A panel docked beside the page that stays open while people keep working. Unlike a Drawer it has no
|
|
21
|
+
* backdrop and does not trap focus: the page narrows to make room. Below 1024px it covers the page
|
|
22
|
+
* instead, so the host has to be the positioned element the panel sits in.
|
|
23
|
+
*
|
|
24
|
+
* Esc closes it only while focus is inside it, since the page beside it is still in use.
|
|
25
|
+
*/
|
|
26
|
+
declare const SidePanelBase: ({ title, icon, onBack, backLabel, headerEnd, onClose, closeLabel, headerExtra, width, className, style, children, ...props }: SidePanelProps) => React.JSX.Element;
|
|
27
|
+
declare const SidePanel: typeof SidePanelBase & {
|
|
28
|
+
original: typeof SidePanelBase;
|
|
29
|
+
originalName: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
} & {
|
|
32
|
+
original: typeof SidePanelBase & {
|
|
33
|
+
original: typeof SidePanelBase;
|
|
34
|
+
originalName: string;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
originalName: string;
|
|
38
|
+
displayName: string;
|
|
39
|
+
} & {
|
|
40
|
+
createDecorator: (decorator: import("@webiny/react-composition/types").ComponentDecorator<typeof SidePanelBase & {
|
|
41
|
+
original: typeof SidePanelBase;
|
|
42
|
+
originalName: string;
|
|
43
|
+
displayName: string;
|
|
44
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
45
|
+
};
|
|
46
|
+
export { SidePanel, type SidePanelProps };
|