@webiny/admin-ui 6.6.0-alpha.1 → 6.6.0-alpha.11
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/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/Breadcrumbs/Breadcrumbs.js +2 -2
- package/Breadcrumbs/Breadcrumbs.js.map +1 -1
- 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/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/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 +28 -3
- package/DataTable/DataTable.js +105 -20
- 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/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 +14 -17
- 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/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 +15 -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/EmptyState/EmptyState.d.ts +2 -1
- package/EmptyState/EmptyState.js +8 -2
- package/EmptyState/EmptyState.js.map +1 -1
- 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 +1 -1
- 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/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.js +52 -11
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +5 -4
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +9 -66
- 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/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/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/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/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 +1 -0
- package/exports/admin/ui.js +1 -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 +3 -0
- package/index.js +3 -0
- package/package.json +30 -28
- package/theme.css +34 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface SidePanelFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** `light` is the 12px key-hint bar on a subtle fill. */
|
|
4
|
+
variant?: "default" | "light";
|
|
5
|
+
}
|
|
6
|
+
/** The pinned bottom of a `SidePanel`: a composer, or a line of key hints. */
|
|
7
|
+
declare const SidePanelFooterBase: ({ variant, className, ...props }: SidePanelFooterProps) => React.JSX.Element;
|
|
8
|
+
declare const SidePanelFooter: typeof SidePanelFooterBase & {
|
|
9
|
+
original: typeof SidePanelFooterBase;
|
|
10
|
+
originalName: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
} & {
|
|
13
|
+
original: typeof SidePanelFooterBase & {
|
|
14
|
+
original: typeof SidePanelFooterBase;
|
|
15
|
+
originalName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
originalName: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
} & {
|
|
21
|
+
createDecorator: (decorator: import("@webiny/react-composition/types").ComponentDecorator<typeof SidePanelFooterBase & {
|
|
22
|
+
original: typeof SidePanelFooterBase;
|
|
23
|
+
originalName: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
export { SidePanelFooter, type SidePanelFooterProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cn, makeDecoratable } from "../utils.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
const SidePanelFooterBase = ({ variant = "default", className, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
4
|
+
className: cn("flex flex-none flex-col border-t-sm border-neutral-dimmed", "default" === variant && "gap-sm p-md", "light" === variant && "bg-neutral-subtle px-md py-sm-extra text-sm text-neutral-strong", className),
|
|
5
|
+
...props
|
|
6
|
+
});
|
|
7
|
+
const SidePanelFooter = makeDecoratable("SidePanelFooter", SidePanelFooterBase);
|
|
8
|
+
export { SidePanelFooter };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=SidePanelFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidePanel/SidePanelFooter.js","sources":["../../src/SidePanel/SidePanelFooter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\n\ninterface SidePanelFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** `light` is the 12px key-hint bar on a subtle fill. */\n variant?: \"default\" | \"light\";\n}\n\n/** The pinned bottom of a `SidePanel`: a composer, or a line of key hints. */\nconst SidePanelFooterBase = ({\n variant = \"default\",\n className,\n ...props\n}: SidePanelFooterProps) => (\n <div\n className={cn(\n \"flex flex-none flex-col border-t-sm border-neutral-dimmed\",\n variant === \"default\" && \"gap-sm p-md\",\n variant === \"light\" &&\n \"bg-neutral-subtle px-md py-sm-extra text-sm text-neutral-strong\",\n className\n )}\n {...props}\n />\n);\n\nconst SidePanelFooter = makeDecoratable(\"SidePanelFooter\", SidePanelFooterBase);\n\nexport { SidePanelFooter, type SidePanelFooterProps };\n"],"names":["SidePanelFooterBase","variant","className","props","cn","SidePanelFooter","makeDecoratable"],"mappings":";;AAUA,MAAMA,sBAAsB,CAAC,EACzBC,UAAU,SAAS,EACnBC,SAAS,EACT,GAAGC,OACgB,iBACnB,sCAAC;QACG,WAAWC,GACP,6DACAH,AAAY,cAAZA,WAAyB,eACzBA,AAAY,YAAZA,WACI,mEACJC;QAEH,GAAGC,KAAK;;AAIjB,MAAME,kBAAkBC,gBAAgB,mBAAmBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { act, cleanup, render, screen } from "@testing-library/react";
|
|
4
|
+
import { AdminUiProvider } from "../AdminUiProvider/AdminUiProvider.js";
|
|
5
|
+
import { SidebarProvider } from "./components/SidebarProvider.js";
|
|
6
|
+
import { Sidebar } from "./index.js";
|
|
7
|
+
vi.mock("@webiny/icons/assignment.svg", ()=>({
|
|
8
|
+
ReactComponent: ()=>null
|
|
9
|
+
}));
|
|
10
|
+
vi.mock("@webiny/icons/car_rental.svg", ()=>({
|
|
11
|
+
ReactComponent: ()=>null
|
|
12
|
+
}));
|
|
13
|
+
vi.mock("@webiny/icons/chat.svg", ()=>({
|
|
14
|
+
ReactComponent: ()=>null
|
|
15
|
+
}));
|
|
16
|
+
vi.mock("@webiny/icons/check_box.svg", ()=>({
|
|
17
|
+
ReactComponent: ()=>null
|
|
18
|
+
}));
|
|
19
|
+
vi.mock("@webiny/icons/chrome_reader_mode.svg", ()=>({
|
|
20
|
+
ReactComponent: ()=>null
|
|
21
|
+
}));
|
|
22
|
+
vi.mock("@webiny/icons/expand.svg", ()=>({
|
|
23
|
+
ReactComponent: ()=>null
|
|
24
|
+
}));
|
|
25
|
+
vi.mock("@webiny/icons/gite.svg", ()=>({
|
|
26
|
+
ReactComponent: ()=>null
|
|
27
|
+
}));
|
|
28
|
+
vi.mock("@webiny/icons/info.svg", ()=>({
|
|
29
|
+
ReactComponent: ()=>null
|
|
30
|
+
}));
|
|
31
|
+
vi.mock("@webiny/icons/insert_drive_file.svg", ()=>({
|
|
32
|
+
ReactComponent: ()=>null
|
|
33
|
+
}));
|
|
34
|
+
vi.mock("@webiny/icons/keyboard_arrow_down.svg", ()=>({
|
|
35
|
+
ReactComponent: ()=>null
|
|
36
|
+
}));
|
|
37
|
+
vi.mock("@webiny/icons/keyboard_arrow_right.svg", ()=>({
|
|
38
|
+
ReactComponent: ()=>null
|
|
39
|
+
}));
|
|
40
|
+
vi.mock("@webiny/icons/more_vert.svg", ()=>({
|
|
41
|
+
ReactComponent: ()=>null
|
|
42
|
+
}));
|
|
43
|
+
vi.mock("@webiny/icons/push_pin.svg", ()=>({
|
|
44
|
+
ReactComponent: ()=>null
|
|
45
|
+
}));
|
|
46
|
+
vi.mock("@webiny/icons/push_pin_off.svg", ()=>({
|
|
47
|
+
ReactComponent: ()=>null
|
|
48
|
+
}));
|
|
49
|
+
vi.mock("@webiny/icons/summarize.svg", ()=>({
|
|
50
|
+
ReactComponent: ()=>null
|
|
51
|
+
}));
|
|
52
|
+
vi.mock("@webiny/icons/swap_horiz.svg", ()=>({
|
|
53
|
+
ReactComponent: ()=>null
|
|
54
|
+
}));
|
|
55
|
+
vi.mock("@webiny/icons/table_chart.svg", ()=>({
|
|
56
|
+
ReactComponent: ()=>null
|
|
57
|
+
}));
|
|
58
|
+
vi.mock("@webiny/icons/web.svg", ()=>({
|
|
59
|
+
ReactComponent: ()=>null
|
|
60
|
+
}));
|
|
61
|
+
vi.mock("@webiny/icons/width_full.svg", ()=>({
|
|
62
|
+
ReactComponent: ()=>null
|
|
63
|
+
}));
|
|
64
|
+
beforeAll(()=>{
|
|
65
|
+
globalThis.ResizeObserver ??= class {
|
|
66
|
+
observe() {}
|
|
67
|
+
unobserve() {}
|
|
68
|
+
disconnect() {}
|
|
69
|
+
};
|
|
70
|
+
window.matchMedia ??= (q)=>({
|
|
71
|
+
matches: false,
|
|
72
|
+
media: q,
|
|
73
|
+
addEventListener () {},
|
|
74
|
+
removeEventListener () {},
|
|
75
|
+
addListener () {},
|
|
76
|
+
removeListener () {},
|
|
77
|
+
onchange: null,
|
|
78
|
+
dispatchEvent: ()=>false
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
afterEach(cleanup);
|
|
82
|
+
const Menu = ()=>{
|
|
83
|
+
const [state, setState] = react.useState({
|
|
84
|
+
pinned: true,
|
|
85
|
+
expandedSections: [],
|
|
86
|
+
pinnedItems: []
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/ react.createElement(AdminUiProvider, null, /*#__PURE__*/ react.createElement(SidebarProvider, {
|
|
89
|
+
state: state,
|
|
90
|
+
onChangeState: setState
|
|
91
|
+
}, /*#__PURE__*/ react.createElement(Sidebar, {
|
|
92
|
+
title: "Webiny"
|
|
93
|
+
}, /*#__PURE__*/ react.createElement(Sidebar.Item, {
|
|
94
|
+
text: "Website Builder"
|
|
95
|
+
}, /*#__PURE__*/ react.createElement(Sidebar.Link, {
|
|
96
|
+
text: "Layouts",
|
|
97
|
+
to: "/website-builder/layouts"
|
|
98
|
+
})))));
|
|
99
|
+
};
|
|
100
|
+
describe("a sidebar group", ()=>{
|
|
101
|
+
it("carries aria-expanded on its button, and it follows the group", ()=>{
|
|
102
|
+
render(/*#__PURE__*/ react.createElement(Menu, null));
|
|
103
|
+
const group = screen.getByRole("button", {
|
|
104
|
+
name: "Website Builder"
|
|
105
|
+
});
|
|
106
|
+
expect(group.getAttribute("aria-expanded")).toBe("false");
|
|
107
|
+
act(()=>group.click());
|
|
108
|
+
expect(group.getAttribute("aria-expanded")).toBe("true");
|
|
109
|
+
expect(group.getAttribute("aria-controls")).toBeTruthy();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=Sidebar.groups.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar/Sidebar.groups.test.js","sources":["../../src/Sidebar/Sidebar.groups.test.tsx"],"sourcesContent":["// @vitest-environment jsdom\n/**\n * A menu group's button says whether it's open: `aria-expanded` reaches the\n * element. A group is a Collapsible trigger (`asChild`), and its button used to\n * drop what the trigger gave it — assistive tech and scripted UI checks couldn't\n * tell an open group from a closed one, and a click only toggled it.\n */\nimport React from \"react\";\nimport { afterEach, beforeAll, describe, expect, it, vi } from \"vitest\";\nimport { act, cleanup, render, screen } from \"@testing-library/react\";\nimport { AdminUiProvider } from \"~/AdminUiProvider/AdminUiProvider.js\";\nimport { SidebarProvider } from \"~/Sidebar/components/SidebarProvider.js\";\nimport { Sidebar } from \"~/Sidebar/index.js\";\n\n/* No SVG transform in the test runner. */\nvi.mock(\"@webiny/icons/assignment.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/car_rental.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/chat.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/check_box.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/chrome_reader_mode.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/expand.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/gite.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/info.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/insert_drive_file.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/keyboard_arrow_down.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/keyboard_arrow_right.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/more_vert.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/push_pin.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/push_pin_off.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/summarize.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/swap_horiz.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/table_chart.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/web.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/width_full.svg\", () => ({ ReactComponent: () => null }));\n\nbeforeAll(() => {\n globalThis.ResizeObserver ??= class {\n observe() {}\n unobserve() {}\n disconnect() {}\n } as unknown as typeof ResizeObserver;\n window.matchMedia ??= ((q: string) => ({\n matches: false,\n media: q,\n addEventListener() {},\n removeEventListener() {},\n addListener() {},\n removeListener() {},\n onchange: null,\n dispatchEvent: () => false\n })) as unknown as typeof window.matchMedia;\n});\n\nafterEach(cleanup);\n\nconst Menu = () => {\n const [state, setState] = React.useState({\n pinned: true,\n expandedSections: [] as string[],\n pinnedItems: [] as string[]\n });\n return (\n <AdminUiProvider>\n <SidebarProvider state={state} onChangeState={setState}>\n <Sidebar title={\"Webiny\"}>\n <Sidebar.Item text={\"Website Builder\"}>\n <Sidebar.Link text={\"Layouts\"} to={\"/website-builder/layouts\"} />\n </Sidebar.Item>\n </Sidebar>\n </SidebarProvider>\n </AdminUiProvider>\n );\n};\n\ndescribe(\"a sidebar group\", () => {\n it(\"carries aria-expanded on its button, and it follows the group\", () => {\n render(<Menu />);\n const group = screen.getByRole(\"button\", { name: \"Website Builder\" });\n expect(group.getAttribute(\"aria-expanded\")).toBe(\"false\");\n act(() => group.click());\n expect(group.getAttribute(\"aria-expanded\")).toBe(\"true\");\n expect(group.getAttribute(\"aria-controls\")).toBeTruthy();\n });\n});\n"],"names":["vi","beforeAll","globalThis","window","q","afterEach","cleanup","Menu","state","setState","React","AdminUiProvider","SidebarProvider","Sidebar","describe","it","render","group","screen","expect","act"],"mappings":";;;;;;AAeAA,GAAG,IAAI,CAAC,gCAAgC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC5EA,GAAG,IAAI,CAAC,gCAAgC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC5EA,GAAG,IAAI,CAAC,0BAA0B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACtEA,GAAG,IAAI,CAAC,+BAA+B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC3EA,GAAG,IAAI,CAAC,wCAAwC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACpFA,GAAG,IAAI,CAAC,4BAA4B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACxEA,GAAG,IAAI,CAAC,0BAA0B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACtEA,GAAG,IAAI,CAAC,0BAA0B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACtEA,GAAG,IAAI,CAAC,uCAAuC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACnFA,GAAG,IAAI,CAAC,yCAAyC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACrFA,GAAG,IAAI,CAAC,0CAA0C,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACtFA,GAAG,IAAI,CAAC,+BAA+B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC3EA,GAAG,IAAI,CAAC,8BAA8B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC1EA,GAAG,IAAI,CAAC,kCAAkC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC9EA,GAAG,IAAI,CAAC,+BAA+B,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC3EA,GAAG,IAAI,CAAC,gCAAgC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC5EA,GAAG,IAAI,CAAC,iCAAiC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAC7EA,GAAG,IAAI,CAAC,yBAAyB,IAAO;QAAE,gBAAgB,IAAM;IAAK;AACrEA,GAAG,IAAI,CAAC,gCAAgC,IAAO;QAAE,gBAAgB,IAAM;IAAK;AAE5EC,UAAU;IACNC,WAAW,cAAc,KAAK;QAC1B,UAAU,CAAC;QACX,YAAY,CAAC;QACb,aAAa,CAAC;IAClB;IACAC,OAAO,UAAU,KAAM,CAACC,IAAe;YACnC,SAAS;YACT,OAAOA;YACP,qBAAoB;YACpB,wBAAuB;YACvB,gBAAe;YACf,mBAAkB;YAClB,UAAU;YACV,eAAe,IAAM;QACzB;AACJ;AAEAC,UAAUC;AAEV,MAAMC,OAAO;IACT,MAAM,CAACC,OAAOC,SAAS,GAAGC,MAAAA,QAAc,CAAC;QACrC,QAAQ;QACR,kBAAkB,EAAE;QACpB,aAAa,EAAE;IACnB;IACA,OAAO,WAAP,GACI,oBAACC,iBAAeA,MAAAA,WAAAA,GACZ,oBAACC,iBAAeA;QAAC,OAAOJ;QAAO,eAAeC;qBAC1C,oBAACI,SAAOA;QAAC,OAAO;qBACZ,oBAACA,QAAQ,IAAI;QAAC,MAAM;qBAChB,oBAACA,QAAQ,IAAI;QAAC,MAAM;QAAW,IAAI;;AAM3D;AAEAC,SAAS,mBAAmB;IACxBC,GAAG,iEAAiE;QAChEC,OAAO,WAADA,GAAC,oBAACT,MAAIA;QACZ,MAAMU,QAAQC,OAAO,SAAS,CAAC,UAAU;YAAE,MAAM;QAAkB;QACnEC,OAAOF,MAAM,YAAY,CAAC,kBAAkB,IAAI,CAAC;QACjDG,IAAI,IAAMH,MAAM,KAAK;QACrBE,OAAOF,MAAM,YAAY,CAAC,kBAAkB,IAAI,CAAC;QACjDE,OAAOF,MAAM,YAAY,CAAC,kBAAkB,UAAU;IAC1D;AACJ"}
|
|
@@ -9,7 +9,7 @@ const SidebarContent = ({ className, children, ...props })=>{
|
|
|
9
9
|
const { dir, onScroll, ...restProps } = props;
|
|
10
10
|
return /*#__PURE__*/ react.createElement(ScrollArea, {
|
|
11
11
|
"data-sidebar": "content",
|
|
12
|
-
className: cn("flex text-neutral-primary min-h-0 flex-1 flex-col gap-2", className),
|
|
12
|
+
className: cn("flex text-neutral-primary min-h-0 flex-1 flex-col gap-2 [&_[data-radix-scroll-area-viewport]>div]:!block", className),
|
|
13
13
|
...restProps
|
|
14
14
|
}, children);
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar/components/SidebarContent.js","sources":["../../../src/Sidebar/components/SidebarContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\nimport { useSidebar } from \"./SidebarProvider.js\";\n\nconst SidebarContent = ({ className, children, ...props }: React.ComponentProps<\"div\">) => {\n const { state } = useSidebar();\n const isExpanded = state === \"expanded\";\n\n if (isExpanded) {\n // Extract dir and onScroll props to avoid type conflicts with ScrollArea.\n // oxlint-disable-next-line typescript/no-unused-vars\n const { dir, onScroll, ...restProps } = props;\n return (\n <ScrollArea\n data-sidebar=\"content\"\n className={cn(\"flex text-neutral-primary min-h-0 flex-1 flex-col gap-2\"
|
|
1
|
+
{"version":3,"file":"Sidebar/components/SidebarContent.js","sources":["../../../src/Sidebar/components/SidebarContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\nimport { useSidebar } from \"./SidebarProvider.js\";\n\nconst SidebarContent = ({ className, children, ...props }: React.ComponentProps<\"div\">) => {\n const { state } = useSidebar();\n const isExpanded = state === \"expanded\";\n\n if (isExpanded) {\n // Extract dir and onScroll props to avoid type conflicts with ScrollArea.\n // oxlint-disable-next-line typescript/no-unused-vars\n const { dir, onScroll, ...restProps } = props;\n return (\n <ScrollArea\n data-sidebar=\"content\"\n className={cn(\n \"flex text-neutral-primary min-h-0 flex-1 flex-col gap-2 [&_[data-radix-scroll-area-viewport]>div]:!block\",\n className\n )}\n {...restProps}\n >\n {children}\n </ScrollArea>\n );\n }\n\n return (\n <div\n {...props}\n data-sidebar=\"content\"\n className={cn(\n \"flex text-neutral-primary min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden group-data-[state=collapsed]:overflow-hidden\",\n className\n )}\n >\n {children}\n </div>\n );\n};\n\nexport { SidebarContent };\n"],"names":["SidebarContent","className","children","props","state","useSidebar","isExpanded","dir","onScroll","restProps","ScrollArea","cn"],"mappings":";;;;AAKA,MAAMA,iBAAiB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAAoC;IAClF,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,aAAaF,AAAU,eAAVA;IAEnB,IAAIE,YAAY;QAGZ,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAE,GAAGC,WAAW,GAAGN;QACxC,OAAO,WAAP,GACI,oBAACO,YAAUA;YACP,gBAAa;YACb,WAAWC,GACP,4GACAV;YAEH,GAAGQ,SAAS;WAEZP;IAGb;IAEA,OAAO,WAAP,GACI,oBAAC;QACI,GAAGC,KAAK;QACT,gBAAa;QACb,WAAWQ,GACP,0IACAV;OAGHC;AAGb"}
|
|
@@ -56,7 +56,7 @@ const SidebarRoot = ({ side = "left", className, children, ...props })=>{
|
|
|
56
56
|
...props
|
|
57
57
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
58
58
|
"data-sidebar": "sidebar",
|
|
59
|
-
className: "flex h-full w-full py-xs flex-col"
|
|
59
|
+
className: "flex h-full w-full py-xs flex-col overflow-hidden"
|
|
60
60
|
}, children)), /*#__PURE__*/ react.createElement("div", {
|
|
61
61
|
"data-sidebar": "extra-hover-area",
|
|
62
62
|
className: "absolute top-0 left-[theme(spacing.sidebar-collapsed)] h-full w-sm hidden group-data-[state=collapsed]:block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar/components/SidebarRoot.js","sources":["../../../src/Sidebar/components/SidebarRoot.tsx"],"sourcesContent":["import React, { useCallback, useRef } from \"react\";\nimport { cn, cva } from \"~/utils.js\";\nimport { useSidebar } from \"./SidebarProvider.js\";\n\ninterface SidebarRootProps extends React.ComponentProps<\"div\"> {\n side?: \"left\" | \"right\";\n}\n\nconst variants = cva(\"group peer block border-r-sm border-neutral-dimmed bg-neutral-light\", {\n variants: {\n pinned: {\n false: \"fixed top-0 z-sidebar \"\n }\n }\n});\n\nconst SidebarRoot = ({ side = \"left\", className, children, ...props }: SidebarRootProps) => {\n const { state, setExpanded, pinned, expanded } = useSidebar();\n\n const elementRef = useRef<HTMLDivElement>(null);\n\n // With this timeout, we prevent the sidebar glitching (quickly opening/closing) during mouse enter/leave events.\n const timeoutRef = useRef<number | null>(null);\n\n const onMouseEnter = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n // If the sidebar is pinned, we don't want to open the sidebar on mouse enter.\n if (pinned) {\n return;\n }\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n // Add delay before opening to prevent accidental openings\n timeoutRef.current = window.setTimeout(() => {\n // Only set expanded if it's not already expanded\n if (!expanded) {\n setExpanded(true);\n }\n }, 300);\n }, [pinned, setExpanded, expanded]);\n\n const onMouseLeave = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n // If the sidebar is pinned, we don't want to close the sidebar on mouse leave.\n if (pinned) {\n return;\n }\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n // With this timeout, we prevent the sidebar glitching (quickly opening/closing) during mouse enter/leave events.\n timeoutRef.current = window.setTimeout(() => {\n setExpanded(false);\n }, 300);\n }, [pinned, setExpanded]);\n\n return (\n <div\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n ref={elementRef}\n data-state={state}\n data-sidebar={\"root\"}\n data-side={side}\n className={variants({ pinned })}\n >\n <div\n className={cn(\n \"duration-175 relative h-svh w-sidebar-expanded bg-transparent transition-[width] ease-linear duration-175\",\n \"group-data-[side=right]:rotate-180\",\n \"group-data-[state=collapsed]:w-sidebar-collapsed\"\n )}\n />\n <div\n className={cn(\n \"duration-175 fixed inset-y-0 z-sidebar h-svh w-sidebar-expanded transition-[width] ease-linear md:flex\",\n side === \"left\" ? \"left-0\" : \"right-0\",\n \"group-data-[state=collapsed]:w-sidebar-collapsed group-data-[side=left]:border-r-px group-data-[side=right]:border-l-px\",\n className\n )}\n {...props}\n >\n <div
|
|
1
|
+
{"version":3,"file":"Sidebar/components/SidebarRoot.js","sources":["../../../src/Sidebar/components/SidebarRoot.tsx"],"sourcesContent":["import React, { useCallback, useRef } from \"react\";\nimport { cn, cva } from \"~/utils.js\";\nimport { useSidebar } from \"./SidebarProvider.js\";\n\ninterface SidebarRootProps extends React.ComponentProps<\"div\"> {\n side?: \"left\" | \"right\";\n}\n\nconst variants = cva(\"group peer block border-r-sm border-neutral-dimmed bg-neutral-light\", {\n variants: {\n pinned: {\n false: \"fixed top-0 z-sidebar \"\n }\n }\n});\n\nconst SidebarRoot = ({ side = \"left\", className, children, ...props }: SidebarRootProps) => {\n const { state, setExpanded, pinned, expanded } = useSidebar();\n\n const elementRef = useRef<HTMLDivElement>(null);\n\n // With this timeout, we prevent the sidebar glitching (quickly opening/closing) during mouse enter/leave events.\n const timeoutRef = useRef<number | null>(null);\n\n const onMouseEnter = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n // If the sidebar is pinned, we don't want to open the sidebar on mouse enter.\n if (pinned) {\n return;\n }\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n // Add delay before opening to prevent accidental openings\n timeoutRef.current = window.setTimeout(() => {\n // Only set expanded if it's not already expanded\n if (!expanded) {\n setExpanded(true);\n }\n }, 300);\n }, [pinned, setExpanded, expanded]);\n\n const onMouseLeave = useCallback<React.MouseEventHandler<HTMLDivElement>>(() => {\n // If the sidebar is pinned, we don't want to close the sidebar on mouse leave.\n if (pinned) {\n return;\n }\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n // With this timeout, we prevent the sidebar glitching (quickly opening/closing) during mouse enter/leave events.\n timeoutRef.current = window.setTimeout(() => {\n setExpanded(false);\n }, 300);\n }, [pinned, setExpanded]);\n\n return (\n <div\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n ref={elementRef}\n data-state={state}\n data-sidebar={\"root\"}\n data-side={side}\n className={variants({ pinned })}\n >\n <div\n className={cn(\n \"duration-175 relative h-svh w-sidebar-expanded bg-transparent transition-[width] ease-linear duration-175\",\n \"group-data-[side=right]:rotate-180\",\n \"group-data-[state=collapsed]:w-sidebar-collapsed\"\n )}\n />\n <div\n className={cn(\n \"duration-175 fixed inset-y-0 z-sidebar h-svh w-sidebar-expanded transition-[width] ease-linear md:flex\",\n side === \"left\" ? \"left-0\" : \"right-0\",\n \"group-data-[state=collapsed]:w-sidebar-collapsed group-data-[side=left]:border-r-px group-data-[side=right]:border-l-px\",\n className\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"flex h-full w-full py-xs flex-col overflow-hidden\"\n >\n {children}\n </div>\n </div>\n\n <div\n data-sidebar={\"extra-hover-area\"}\n className={\n \"absolute top-0 left-[theme(spacing.sidebar-collapsed)] h-full w-sm hidden group-data-[state=collapsed]:block\"\n }\n />\n </div>\n );\n};\n\nexport { SidebarRoot, type SidebarRootProps };\n"],"names":["variants","cva","SidebarRoot","side","className","children","props","state","setExpanded","pinned","expanded","useSidebar","elementRef","useRef","timeoutRef","onMouseEnter","useCallback","window","onMouseLeave","cn"],"mappings":";;;AAQA,MAAMA,WAAWC,IAAI,uEAAuE;IACxF,UAAU;QACN,QAAQ;YACJ,OAAO;QACX;IACJ;AACJ;AAEA,MAAMC,cAAc,CAAC,EAAEC,OAAO,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAAyB;IACnF,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IAEjD,MAAMC,aAAaC,OAAuB;IAG1C,MAAMC,aAAaD,OAAsB;IAEzC,MAAME,eAAeC,YAAqD;QAEtE,IAAIP,QACA;QAGJ,IAAIK,WAAW,OAAO,EAAE;YACpBG,OAAO,YAAY,CAACH,WAAW,OAAO;YACtCA,WAAW,OAAO,GAAG;QACzB;QAGAA,WAAW,OAAO,GAAGG,OAAO,UAAU,CAAC;YAEnC,IAAI,CAACP,UACDF,YAAY;QAEpB,GAAG;IACP,GAAG;QAACC;QAAQD;QAAaE;KAAS;IAElC,MAAMQ,eAAeF,YAAqD;QAEtE,IAAIP,QACA;QAGJ,IAAIK,WAAW,OAAO,EAAE;YACpBG,OAAO,YAAY,CAACH,WAAW,OAAO;YACtCA,WAAW,OAAO,GAAG;QACzB;QAGAA,WAAW,OAAO,GAAGG,OAAO,UAAU,CAAC;YACnCT,YAAY;QAChB,GAAG;IACP,GAAG;QAACC;QAAQD;KAAY;IAExB,OAAO,WAAP,GACI,oBAAC;QACG,cAAcO;QACd,cAAcG;QACd,KAAKN;QACL,cAAYL;QACZ,gBAAc;QACd,aAAWJ;QACX,WAAWH,SAAS;YAAES;QAAO;qBAE7B,oBAAC;QACG,WAAWU,GACP,6GACA,sCACA;sBAGR,oBAAC;QACG,WAAWA,GACP,0GACAhB,AAAS,WAATA,OAAkB,WAAW,WAC7B,2HACAC;QAEH,GAAGE,KAAK;qBAET,oBAAC;QACG,gBAAa;QACb,WAAU;OAETD,YAAAA,WAAAA,GAIT,oBAAC;QACG,gBAAc;QACd,WACI;;AAKpB"}
|
|
@@ -42,6 +42,7 @@ const SidebarMenuRootButton = ({ className, onClick, variant, active, disabled,
|
|
|
42
42
|
text: badge
|
|
43
43
|
}) : badge)) : /*#__PURE__*/ react.createElement(DivButton, {
|
|
44
44
|
...sharedProps,
|
|
45
|
+
...linkProps,
|
|
45
46
|
disabled: disabled,
|
|
46
47
|
tabIndex: "group-label" === variant ? -1 : void 0
|
|
47
48
|
}, icon, text, badge && ("string" == typeof badge ? /*#__PURE__*/ react.createElement(SidebarMenuItemBadge, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar/components/items/SidebarMenuRootButton.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuRootButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva } from \"~/utils.js\";\nimport type { SidebarMenuItemProps } from \"./SidebarMenuRootItem.js\";\nimport { DivButton } from \"./DivButton.js\";\nimport { SidebarMenuItemBadge } from \"./SidebarMenuItemBadge.js\";\nimport { useAdminUi } from \"~/index.js\";\n\nconst variants = cva(\n [\n \"flex w-full items-center gap-sm rounded-md\",\n \"no-underline! text-neutral-primary cursor-pointer px-sm py-xs-plus text-left\",\n \"text-md outline-none transition-[width,height,padding]\",\n \"whitespace-nowrap overflow-hidden\",\n \"hover:bg-neutral-dark/5\",\n \"group-hover/menu-root-button:bg-neutral-dark/5\",\n \"focus:bg-neutral-dark/5 focus:ring-none focus:ring-transparent\",\n \"data-[active=true]:bg-neutral-dark/5 data-[active=true]:font-semibold data-[active=true]:pointer-events-none\",\n \"group-data-[state=open]/menu-item-collapsible:font-semibold!\"\n ],\n {\n variants: {\n variant: {\n \"group-label\":\n \"text-neutral-muted! uppercase hover:bg-transparent! group-hover/menu-root-button:bg-transparent! focus:bg-transparent! cursor-default!\"\n },\n disabled: {\n true: \"pointer-events-none text-neutral-disabled!\"\n }\n }\n }\n);\n\ntype SidebarMenuButtonBaseProps = Omit<SidebarMenuItemProps, \"children\">;\n\nconst SidebarMenuRootButton = ({\n className,\n onClick,\n variant,\n active,\n disabled,\n icon,\n\n // oxlint-disable-next-line\n pinnedIcon,\n\n action,\n text,\n badge,\n to,\n ...linkProps\n}: SidebarMenuButtonBaseProps) => {\n const sharedProps = {\n \"data-sidebar\": \"menu-button\",\n \"data-active\": active,\n className: variants({ variant, disabled }),\n onClick\n };\n\n const { linkComponent: LinkComponent } = useAdminUi();\n\n const content = to ? (\n <LinkComponent {...sharedProps} to={to} {...linkProps}>\n {icon}\n {text}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </LinkComponent>\n ) : (\n <DivButton\n {...sharedProps}\n disabled={disabled}\n tabIndex={variant === \"group-label\" ? -1 : undefined}\n >\n {icon}\n {text}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </DivButton>\n );\n\n return (\n <div className={cn(\"flex items-center w-full relative group/menu-root-button\", className)}>\n {content}\n {action && (\n <div className=\"absolute top-0 right-0 mr-sm h-full flex items-center\">\n {action}\n </div>\n )}\n </div>\n );\n};\n\nexport { SidebarMenuRootButton };\n"],"names":["variants","cva","SidebarMenuRootButton","className","onClick","variant","active","disabled","icon","pinnedIcon","action","text","badge","to","linkProps","sharedProps","LinkComponent","useAdminUi","content","SidebarMenuItemBadge","DivButton","undefined","cn"],"mappings":";;;;;AAOA,MAAMA,WAAWC,IACb;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,eACI;QACR;QACA,UAAU;YACN,MAAM;QACV;IACJ;AACJ;AAKJ,MAAMC,wBAAwB,CAAC,EAC3BC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,IAAI,EAGJC,UAAU,EAEVC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,EAAE,EACF,GAAGC,WACsB;IACzB,MAAMC,cAAc;QAChB,gBAAgB;QAChB,eAAeT;QACf,WAAWN,SAAS;YAAEK;YAASE;QAAS;QACxCH;IACJ;IAEA,MAAM,EAAE,eAAeY,aAAa,EAAE,GAAGC;IAEzC,MAAMC,UAAUL,KAAK,WAALA,GACZ,oBAACG,eAAAA;QAAe,GAAGD,WAAW;QAAE,IAAIF;QAAK,GAAGC,SAAS;OAChDN,MACAG,MACAC,SAAU,CAAiB,YAAjB,OAAOA,QAAqB,WAAX,GAAW,oBAACO,sBAAoBA;QAAC,MAAMP;SAAYA,KAAI,mBAGvF,oBAACQ,WAASA;QACL,GAAGL,WAAW;
|
|
1
|
+
{"version":3,"file":"Sidebar/components/items/SidebarMenuRootButton.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuRootButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva } from \"~/utils.js\";\nimport type { SidebarMenuItemProps } from \"./SidebarMenuRootItem.js\";\nimport { DivButton } from \"./DivButton.js\";\nimport { SidebarMenuItemBadge } from \"./SidebarMenuItemBadge.js\";\nimport { useAdminUi } from \"~/index.js\";\n\nconst variants = cva(\n [\n \"flex w-full items-center gap-sm rounded-md\",\n \"no-underline! text-neutral-primary cursor-pointer px-sm py-xs-plus text-left\",\n \"text-md outline-none transition-[width,height,padding]\",\n \"whitespace-nowrap overflow-hidden\",\n \"hover:bg-neutral-dark/5\",\n \"group-hover/menu-root-button:bg-neutral-dark/5\",\n \"focus:bg-neutral-dark/5 focus:ring-none focus:ring-transparent\",\n \"data-[active=true]:bg-neutral-dark/5 data-[active=true]:font-semibold data-[active=true]:pointer-events-none\",\n \"group-data-[state=open]/menu-item-collapsible:font-semibold!\"\n ],\n {\n variants: {\n variant: {\n \"group-label\":\n \"text-neutral-muted! uppercase hover:bg-transparent! group-hover/menu-root-button:bg-transparent! focus:bg-transparent! cursor-default!\"\n },\n disabled: {\n true: \"pointer-events-none text-neutral-disabled!\"\n }\n }\n }\n);\n\ntype SidebarMenuButtonBaseProps = Omit<SidebarMenuItemProps, \"children\">;\n\nconst SidebarMenuRootButton = ({\n className,\n onClick,\n variant,\n active,\n disabled,\n icon,\n\n // oxlint-disable-next-line\n pinnedIcon,\n\n action,\n text,\n badge,\n to,\n ...linkProps\n}: SidebarMenuButtonBaseProps) => {\n const sharedProps = {\n \"data-sidebar\": \"menu-button\",\n \"data-active\": active,\n className: variants({ variant, disabled }),\n onClick\n };\n\n const { linkComponent: LinkComponent } = useAdminUi();\n\n const content = to ? (\n <LinkComponent {...sharedProps} to={to} {...linkProps}>\n {icon}\n {text}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </LinkComponent>\n ) : (\n <DivButton\n {...sharedProps}\n // A group's button is a Collapsible trigger (`asChild`): its `aria-expanded`,\n // `aria-controls` and `data-state` come in here, and must reach the element.\n {...linkProps}\n disabled={disabled}\n tabIndex={variant === \"group-label\" ? -1 : undefined}\n >\n {icon}\n {text}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </DivButton>\n );\n\n return (\n <div className={cn(\"flex items-center w-full relative group/menu-root-button\", className)}>\n {content}\n {action && (\n <div className=\"absolute top-0 right-0 mr-sm h-full flex items-center\">\n {action}\n </div>\n )}\n </div>\n );\n};\n\nexport { SidebarMenuRootButton };\n"],"names":["variants","cva","SidebarMenuRootButton","className","onClick","variant","active","disabled","icon","pinnedIcon","action","text","badge","to","linkProps","sharedProps","LinkComponent","useAdminUi","content","SidebarMenuItemBadge","DivButton","undefined","cn"],"mappings":";;;;;AAOA,MAAMA,WAAWC,IACb;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,eACI;QACR;QACA,UAAU;YACN,MAAM;QACV;IACJ;AACJ;AAKJ,MAAMC,wBAAwB,CAAC,EAC3BC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,IAAI,EAGJC,UAAU,EAEVC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,EAAE,EACF,GAAGC,WACsB;IACzB,MAAMC,cAAc;QAChB,gBAAgB;QAChB,eAAeT;QACf,WAAWN,SAAS;YAAEK;YAASE;QAAS;QACxCH;IACJ;IAEA,MAAM,EAAE,eAAeY,aAAa,EAAE,GAAGC;IAEzC,MAAMC,UAAUL,KAAK,WAALA,GACZ,oBAACG,eAAAA;QAAe,GAAGD,WAAW;QAAE,IAAIF;QAAK,GAAGC,SAAS;OAChDN,MACAG,MACAC,SAAU,CAAiB,YAAjB,OAAOA,QAAqB,WAAX,GAAW,oBAACO,sBAAoBA;QAAC,MAAMP;SAAYA,KAAI,mBAGvF,oBAACQ,WAASA;QACL,GAAGL,WAAW;QAGd,GAAGD,SAAS;QACb,UAAUP;QACV,UAAUF,AAAY,kBAAZA,UAA4B,KAAKgB;OAE1Cb,MACAG,MACAC,SAAU,CAAiB,YAAjB,OAAOA,QAAqB,WAAX,GAAW,oBAACO,sBAAoBA;QAAC,MAAMP;SAAYA,KAAI;IAI3F,OAAO,WAAP,GACI,oBAAC;QAAI,WAAWU,GAAG,4DAA4DnB;OAC1Ee,SACAR,UAAU,WAAVA,GACG,oBAAC;QAAI,WAAU;OACVA;AAKrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { cva } from "../../../utils.js";
|
|
2
|
+
import { cn, cva } from "../../../utils.js";
|
|
3
3
|
import { DivButton } from "./DivButton.js";
|
|
4
4
|
import { SidebarMenuItemBadge } from "./SidebarMenuItemBadge.js";
|
|
5
5
|
import { useAdminUi } from "../../../index.js";
|
|
@@ -35,25 +35,28 @@ const SidebarMenuSubButton = ({ onClick, variant, active, disabled, icon, pinned
|
|
|
35
35
|
className: variants({
|
|
36
36
|
variant,
|
|
37
37
|
disabled,
|
|
38
|
-
className
|
|
38
|
+
className: cn(className, action && "pr-xl")
|
|
39
39
|
}),
|
|
40
40
|
onClick
|
|
41
41
|
};
|
|
42
|
+
const textContent = /*#__PURE__*/ react.createElement("span", {
|
|
43
|
+
className: "truncate"
|
|
44
|
+
}, text);
|
|
42
45
|
const content = to ? /*#__PURE__*/ react.createElement(LinkComponent, {
|
|
43
46
|
...sharedProps,
|
|
44
47
|
to: to,
|
|
45
48
|
...linkProps
|
|
46
|
-
}, icon,
|
|
49
|
+
}, icon, textContent, badge && ("string" == typeof badge ? /*#__PURE__*/ react.createElement(SidebarMenuItemBadge, {
|
|
47
50
|
text: badge
|
|
48
51
|
}) : badge)) : /*#__PURE__*/ react.createElement(DivButton, {
|
|
49
52
|
...sharedProps,
|
|
50
53
|
disabled: disabled,
|
|
51
54
|
tabIndex: "group-label" === variant ? -1 : void 0
|
|
52
|
-
}, icon,
|
|
55
|
+
}, icon, textContent, badge && ("string" == typeof badge ? /*#__PURE__*/ react.createElement(SidebarMenuItemBadge, {
|
|
53
56
|
text: badge
|
|
54
57
|
}) : badge));
|
|
55
58
|
return /*#__PURE__*/ react.createElement("div", {
|
|
56
|
-
className: "flex items-center w-full relative group/menu-sub-button"
|
|
59
|
+
className: "flex items-center w-full min-w-0 relative group/menu-sub-button"
|
|
57
60
|
}, content, action && /*#__PURE__*/ react.createElement("div", {
|
|
58
61
|
className: "absolute top-0 right-0 mr-sm h-full flex items-center"
|
|
59
62
|
}, action));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar/components/items/SidebarMenuSubButton.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuSubButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { cva } from \"~/utils.js\";\nimport type { SidebarMenuItemProps } from \"./SidebarMenuRootItem.js\";\nimport { DivButton } from \"./DivButton.js\";\nimport { SidebarMenuItemBadge } from \"./SidebarMenuItemBadge.js\";\nimport { DistributedOmit } from \"type-fest\";\nimport { useAdminUi } from \"~/index.js\";\n\nconst variants = cva(\n [\n \"flex w-full cursor-pointer items-center gap-sm\",\n \"text-md text-neutral-primary no-underline!\",\n \"rounded-md p-xs-plus pr-sm outline-none\",\n \"whitespace-nowrap overflow-hidden\",\n \"hover:bg-neutral-dark/5\",\n \"group-hover/menu-sub-button:bg-neutral-dark/5\",\n \"focus:bg-neutral-dark/5 focus:ring-none focus:ring-transparent\",\n \"data-[active=true]:bg-neutral-dark/5 data-[active=true]:font-semibold data-[active=true]:pointer-events-none\",\n \"group-data-[state=collapsed]:hidden\"\n ],\n {\n variants: {\n variant: {\n \"group-label\": [\n \"uppercase font-semibold text-neutral-muted! text-sm\",\n \"pt-md pb-xs-plus pointer-events-none\",\n \"hover:bg-transparent! group-hover/menu-sub-button:bg-transparent! focus:bg-transparent! cursor-default!\"\n ]\n },\n disabled: {\n true: \"pointer-events-none text-neutral-disabled!\"\n }\n }\n }\n);\n\ntype SidebarMenuSubButtonProps = DistributedOmit<SidebarMenuItemProps, \"children\">;\n\nconst SidebarMenuSubButton = ({\n onClick,\n variant,\n active,\n disabled,\n icon,\n\n // oxlint-disable-next-line\n pinnedIcon,\n\n action,\n text,\n badge,\n className,\n to,\n ...linkProps\n}: SidebarMenuSubButtonProps) => {\n const { linkComponent: LinkComponent } = useAdminUi();\n\n const sharedProps = {\n \"data-sidebar\": \"menu-sub-button\",\n \"data-active\": active,\n className: variants({ variant, disabled, className }),\n onClick\n };\n\n const content = to ? (\n <LinkComponent {...sharedProps} to={to} {...linkProps}>\n {icon}\n {
|
|
1
|
+
{"version":3,"file":"Sidebar/components/items/SidebarMenuSubButton.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuSubButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva } from \"~/utils.js\";\nimport type { SidebarMenuItemProps } from \"./SidebarMenuRootItem.js\";\nimport { DivButton } from \"./DivButton.js\";\nimport { SidebarMenuItemBadge } from \"./SidebarMenuItemBadge.js\";\nimport { DistributedOmit } from \"type-fest\";\nimport { useAdminUi } from \"~/index.js\";\n\nconst variants = cva(\n [\n \"flex w-full cursor-pointer items-center gap-sm\",\n \"text-md text-neutral-primary no-underline!\",\n \"rounded-md p-xs-plus pr-sm outline-none\",\n \"whitespace-nowrap overflow-hidden\",\n \"hover:bg-neutral-dark/5\",\n \"group-hover/menu-sub-button:bg-neutral-dark/5\",\n \"focus:bg-neutral-dark/5 focus:ring-none focus:ring-transparent\",\n \"data-[active=true]:bg-neutral-dark/5 data-[active=true]:font-semibold data-[active=true]:pointer-events-none\",\n \"group-data-[state=collapsed]:hidden\"\n ],\n {\n variants: {\n variant: {\n \"group-label\": [\n \"uppercase font-semibold text-neutral-muted! text-sm\",\n \"pt-md pb-xs-plus pointer-events-none\",\n \"hover:bg-transparent! group-hover/menu-sub-button:bg-transparent! focus:bg-transparent! cursor-default!\"\n ]\n },\n disabled: {\n true: \"pointer-events-none text-neutral-disabled!\"\n }\n }\n }\n);\n\ntype SidebarMenuSubButtonProps = DistributedOmit<SidebarMenuItemProps, \"children\">;\n\nconst SidebarMenuSubButton = ({\n onClick,\n variant,\n active,\n disabled,\n icon,\n\n // oxlint-disable-next-line\n pinnedIcon,\n\n action,\n text,\n badge,\n className,\n to,\n ...linkProps\n}: SidebarMenuSubButtonProps) => {\n const { linkComponent: LinkComponent } = useAdminUi();\n\n const sharedProps = {\n \"data-sidebar\": \"menu-sub-button\",\n \"data-active\": active,\n className: variants({ variant, disabled, className: cn(className, action && \"pr-xl\") }),\n onClick\n };\n\n const textContent = <span className=\"truncate\">{text}</span>;\n\n const content = to ? (\n <LinkComponent {...sharedProps} to={to} {...linkProps}>\n {icon}\n {textContent}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </LinkComponent>\n ) : (\n // We can't use the default button element here because the content of the button\n // can also contain a button, which is not allowed in HTML.\n <DivButton\n {...sharedProps}\n disabled={disabled}\n tabIndex={variant === \"group-label\" ? -1 : undefined}\n >\n {icon}\n {textContent}\n {badge && (typeof badge === \"string\" ? <SidebarMenuItemBadge text={badge} /> : badge)}\n </DivButton>\n );\n\n return (\n <div className={\"flex items-center w-full min-w-0 relative group/menu-sub-button\"}>\n {content}\n\n {action && (\n <div className=\"absolute top-0 right-0 mr-sm h-full flex items-center\">\n {action}\n </div>\n )}\n </div>\n );\n};\n\nexport { SidebarMenuSubButton };\n"],"names":["variants","cva","SidebarMenuSubButton","onClick","variant","active","disabled","icon","pinnedIcon","action","text","badge","className","to","linkProps","LinkComponent","useAdminUi","sharedProps","cn","textContent","content","SidebarMenuItemBadge","DivButton","undefined"],"mappings":";;;;;AAQA,MAAMA,WAAWC,IACb;IACI;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,eAAe;gBACX;gBACA;gBACA;aACH;QACL;QACA,UAAU;YACN,MAAM;QACV;IACJ;AACJ;AAKJ,MAAMC,uBAAuB,CAAC,EAC1BC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,IAAI,EAGJC,UAAU,EAEVC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,EAAE,EACF,GAAGC,WACqB;IACxB,MAAM,EAAE,eAAeC,aAAa,EAAE,GAAGC;IAEzC,MAAMC,cAAc;QAChB,gBAAgB;QAChB,eAAeZ;QACf,WAAWL,SAAS;YAAEI;YAASE;YAAU,WAAWY,GAAGN,WAAWH,UAAU;QAAS;QACrFN;IACJ;IAEA,MAAMgB,cAAc,WAAdA,GAAc,oBAAC;QAAK,WAAU;OAAYT;IAEhD,MAAMU,UAAUP,KAAK,WAALA,GACZ,oBAACE,eAAAA;QAAe,GAAGE,WAAW;QAAE,IAAIJ;QAAK,GAAGC,SAAS;OAChDP,MACAY,aACAR,SAAU,CAAiB,YAAjB,OAAOA,QAAqB,WAAX,GAAW,oBAACU,sBAAoBA;QAAC,MAAMV;SAAYA,KAAI,K,cAKvF,oBAACW,WAASA;QACL,GAAGL,WAAW;QACf,UAAUX;QACV,UAAUF,AAAY,kBAAZA,UAA4B,KAAKmB;OAE1ChB,MACAY,aACAR,SAAU,CAAiB,YAAjB,OAAOA,QAAqB,WAAX,GAAW,oBAACU,sBAAoBA;QAAC,MAAMV;SAAYA,KAAI;IAI3F,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;OACXS,SAEAX,UAAU,WAAVA,GACG,oBAAC;QAAI,WAAU;OACVA;AAKrB"}
|
|
@@ -117,7 +117,7 @@ const SidebarMenuSubItem = ({ children, className, pinnable, action, collapsible
|
|
|
117
117
|
className: "flex items-center gap-xs"
|
|
118
118
|
}, pinAction, chevron) : chevron;
|
|
119
119
|
if (!collapsible) return /*#__PURE__*/ react.createElement("div", {
|
|
120
|
-
className: "flex items-center"
|
|
120
|
+
className: "flex items-center min-w-0"
|
|
121
121
|
}, /*#__PURE__*/ react.createElement(SidebarMenuSubItemIndentation, {
|
|
122
122
|
lvl: currentLevel,
|
|
123
123
|
variant: buttonProps.variant
|
|
@@ -127,7 +127,7 @@ const SidebarMenuSubItem = ({ children, className, pinnable, action, collapsible
|
|
|
127
127
|
open: isSectionExpanded,
|
|
128
128
|
onOpenChange: toggleSectionExpanded
|
|
129
129
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
130
|
-
className: "flex items-center"
|
|
130
|
+
className: "flex items-center min-w-0"
|
|
131
131
|
}, /*#__PURE__*/ react.createElement(SidebarMenuSubItemIndentation, {
|
|
132
132
|
lvl: currentLevel,
|
|
133
133
|
variant: buttonProps.variant
|
|
@@ -153,7 +153,7 @@ const SidebarMenuSubItem = ({ children, className, pinnable, action, collapsible
|
|
|
153
153
|
]);
|
|
154
154
|
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("li", {
|
|
155
155
|
"data-sidebar": "menu-sub-item",
|
|
156
|
-
className: cn("group/menu-sub-item relative flex", className)
|
|
156
|
+
className: cn("group/menu-sub-item relative flex min-w-0", className)
|
|
157
157
|
}, sidebarMenuSubButton), children && !collapsible ? children : null);
|
|
158
158
|
};
|
|
159
159
|
export { SidebarMenuSubItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar/components/items/SidebarMenuSubItem.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuSubItem.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { Collapsible } from \"radix-ui\";\nimport { SidebarMenuSubButton } from \"./SidebarMenuSubButton.js\";\nimport { SidebarMenuSubItemIndentation } from \"./SidebarMenuSubItemIndentation.js\";\nimport { SidebarMenuSub } from \"./SidebarMenuSub.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { ReactComponent as KeyboardArrowRightIcon } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { ReactComponent as PinIcon } from \"@webiny/icons/push_pin.svg\";\nimport { ReactComponent as UnPinIcon } from \"@webiny/icons/push_pin_off.svg\";\nimport { useSidebarMenu } from \"./SidebarMenuProvider.js\";\nimport { type SidebarMenuItemProps } from \"./SidebarMenuItem.js\";\nimport { useSidebar } from \"~/Sidebar/index.js\";\nimport { SidebarMenuItemAction } from \"./SidebarMenuItemAction.js\";\n\nconst SidebarMenuSubItem = ({\n children,\n className,\n pinnable,\n action,\n collapsible = true,\n ...buttonProps\n}: SidebarMenuItemProps) => {\n const { currentLevel, parentIcon } = useSidebarMenu();\n const sidebar = useSidebar();\n const [showChevron, setShowChevron] = useState(false);\n\n const menuItemId = useMemo(() => {\n return btoa(`sidebar-item-${currentLevel}-${buttonProps.text}`);\n }, [buttonProps.text, currentLevel]);\n\n const isSectionExpanded = useMemo(() => {\n return sidebar.isSectionExpanded(menuItemId);\n }, [sidebar.expandedSections]);\n\n const toggleSectionExpanded = useCallback(() => {\n sidebar.toggleSectionExpanded(menuItemId);\n }, [isSectionExpanded]);\n\n const isPinned = sidebar.isItemPinned(menuItemId);\n\n // Icon to use when this item is pinned\n const pinnedItemIcon = useMemo(() => {\n if (buttonProps.pinnedIcon) {\n return buttonProps.pinnedIcon;\n }\n\n return buttonProps.icon || parentIcon;\n }, [buttonProps.pinnedIcon, buttonProps.icon, parentIcon]);\n\n // Register when pinned, unregister when unpinned\n // Re-register when active state changes to keep pinned items in sync\n React.useEffect(() => {\n if (pinnable && isPinned) {\n sidebar.registerPinnedItem({\n id: menuItemId,\n text: buttonProps.text,\n icon: pinnedItemIcon,\n to: buttonProps.to,\n onClick: buttonProps.onClick,\n active: buttonProps.active\n });\n } else if (pinnable && !isPinned) {\n // Only unregister if this item is explicitly unpinned\n sidebar.unregisterPinnedItem(menuItemId);\n }\n }, [pinnable, isPinned, pinnedItemIcon, menuItemId, buttonProps.active]);\n\n const pinAction = useMemo(() => {\n if (!pinnable) {\n return action;\n }\n\n const handlePinClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isPinned) {\n sidebar.unregisterPinnedItem(menuItemId);\n } else {\n sidebar.registerPinnedItem({\n id: menuItemId,\n text: buttonProps.text,\n icon: pinnedItemIcon,\n to: buttonProps.to,\n onClick: buttonProps.onClick,\n active: buttonProps.active\n });\n }\n\n sidebar.toggleItemPinned(menuItemId);\n };\n\n const pinButton = (\n <SidebarMenuItemAction\n element={isPinned ? <UnPinIcon /> : <PinIcon />}\n onClick={handlePinClick}\n showOnHover={true}\n />\n );\n\n // If there's a custom action, combine them\n // Don't modify the custom action - it should keep its original behavior\n if (action) {\n return (\n <div className=\"flex items-center gap-xs\">\n {pinButton}\n {action}\n </div>\n );\n }\n\n return pinButton;\n }, [pinnable, isPinned, pinnedItemIcon, action, sidebar, menuItemId]);\n\n useEffect(() => {\n if (sidebar.expanded) {\n const timer = setTimeout(() => {\n setShowChevron(true);\n }, 100);\n return () => clearTimeout(timer);\n }\n setShowChevron(false);\n return undefined;\n }, [sidebar.expanded]);\n\n const sidebarMenuSubButton = useMemo(() => {\n if (!children) {\n return (\n <>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <SidebarMenuSubButton {...buttonProps} action={pinAction} />\n </>\n );\n }\n\n const chevron = showChevron ? (\n <Icon\n label={\"Expand / Collapse\"}\n size={\"sm\"}\n className={\n \"ml-auto transition-transform duration-100 group-data-[state=open]/menu-sub-item-collapsible:rotate-180 group-data-[state=collapsed]:hidden\"\n }\n color={\"neutral-strong\"}\n data-sidebar={\"menu-item-expanded-indicator\"}\n icon={<KeyboardArrowRightIcon />}\n />\n ) : null;\n\n const collapsibleAction = pinnable ? (\n <div className=\"flex items-center gap-xs\">\n {pinAction}\n {chevron}\n </div>\n ) : (\n chevron\n );\n\n if (!collapsible) {\n return (\n <div className={\"flex items-center\"}>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <SidebarMenuSubButton {...buttonProps} />\n </div>\n );\n }\n\n return (\n <Collapsible.Root\n className=\"w-full group/menu-sub-item-collapsible\"\n open={isSectionExpanded}\n onOpenChange={toggleSectionExpanded}\n >\n <div className={\"flex items-center\"}>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <Collapsible.Trigger asChild>\n <SidebarMenuSubButton\n {...buttonProps}\n action={collapsibleAction}\n className={\n \"group-data-[state=open]/menu-sub-item-collapsible:font-semibold!\"\n }\n />\n </Collapsible.Trigger>\n </div>\n <Collapsible.Content>\n <SidebarMenuSub parentIcon={buttonProps.icon}>{children}</SidebarMenuSub>\n </Collapsible.Content>\n </Collapsible.Root>\n );\n }, [\n children,\n buttonProps,\n currentLevel,\n menuItemId,\n isSectionExpanded,\n toggleSectionExpanded,\n showChevron,\n pinnable,\n pinAction\n ]);\n\n return (\n <>\n <li\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative flex\", className)}\n >\n {sidebarMenuSubButton}\n </li>\n {children && !collapsible ? children : null}\n </>\n );\n};\n\nexport { SidebarMenuSubItem };\n"],"names":["SidebarMenuSubItem","children","className","pinnable","action","collapsible","buttonProps","currentLevel","parentIcon","useSidebarMenu","sidebar","useSidebar","showChevron","setShowChevron","useState","menuItemId","useMemo","btoa","isSectionExpanded","toggleSectionExpanded","useCallback","isPinned","pinnedItemIcon","React","pinAction","handlePinClick","e","pinButton","SidebarMenuItemAction","UnPinIcon","PinIcon","useEffect","timer","setTimeout","clearTimeout","sidebarMenuSubButton","SidebarMenuSubItemIndentation","SidebarMenuSubButton","chevron","Icon","KeyboardArrowRightIcon","collapsibleAction","Collapsible","SidebarMenuSub","cn"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Sidebar/components/items/SidebarMenuSubItem.js","sources":["../../../../src/Sidebar/components/items/SidebarMenuSubItem.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { Collapsible } from \"radix-ui\";\nimport { SidebarMenuSubButton } from \"./SidebarMenuSubButton.js\";\nimport { SidebarMenuSubItemIndentation } from \"./SidebarMenuSubItemIndentation.js\";\nimport { SidebarMenuSub } from \"./SidebarMenuSub.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { ReactComponent as KeyboardArrowRightIcon } from \"@webiny/icons/keyboard_arrow_down.svg\";\nimport { ReactComponent as PinIcon } from \"@webiny/icons/push_pin.svg\";\nimport { ReactComponent as UnPinIcon } from \"@webiny/icons/push_pin_off.svg\";\nimport { useSidebarMenu } from \"./SidebarMenuProvider.js\";\nimport { type SidebarMenuItemProps } from \"./SidebarMenuItem.js\";\nimport { useSidebar } from \"~/Sidebar/index.js\";\nimport { SidebarMenuItemAction } from \"./SidebarMenuItemAction.js\";\n\nconst SidebarMenuSubItem = ({\n children,\n className,\n pinnable,\n action,\n collapsible = true,\n ...buttonProps\n}: SidebarMenuItemProps) => {\n const { currentLevel, parentIcon } = useSidebarMenu();\n const sidebar = useSidebar();\n const [showChevron, setShowChevron] = useState(false);\n\n const menuItemId = useMemo(() => {\n return btoa(`sidebar-item-${currentLevel}-${buttonProps.text}`);\n }, [buttonProps.text, currentLevel]);\n\n const isSectionExpanded = useMemo(() => {\n return sidebar.isSectionExpanded(menuItemId);\n }, [sidebar.expandedSections]);\n\n const toggleSectionExpanded = useCallback(() => {\n sidebar.toggleSectionExpanded(menuItemId);\n }, [isSectionExpanded]);\n\n const isPinned = sidebar.isItemPinned(menuItemId);\n\n // Icon to use when this item is pinned\n const pinnedItemIcon = useMemo(() => {\n if (buttonProps.pinnedIcon) {\n return buttonProps.pinnedIcon;\n }\n\n return buttonProps.icon || parentIcon;\n }, [buttonProps.pinnedIcon, buttonProps.icon, parentIcon]);\n\n // Register when pinned, unregister when unpinned\n // Re-register when active state changes to keep pinned items in sync\n React.useEffect(() => {\n if (pinnable && isPinned) {\n sidebar.registerPinnedItem({\n id: menuItemId,\n text: buttonProps.text,\n icon: pinnedItemIcon,\n to: buttonProps.to,\n onClick: buttonProps.onClick,\n active: buttonProps.active\n });\n } else if (pinnable && !isPinned) {\n // Only unregister if this item is explicitly unpinned\n sidebar.unregisterPinnedItem(menuItemId);\n }\n }, [pinnable, isPinned, pinnedItemIcon, menuItemId, buttonProps.active]);\n\n const pinAction = useMemo(() => {\n if (!pinnable) {\n return action;\n }\n\n const handlePinClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n\n if (isPinned) {\n sidebar.unregisterPinnedItem(menuItemId);\n } else {\n sidebar.registerPinnedItem({\n id: menuItemId,\n text: buttonProps.text,\n icon: pinnedItemIcon,\n to: buttonProps.to,\n onClick: buttonProps.onClick,\n active: buttonProps.active\n });\n }\n\n sidebar.toggleItemPinned(menuItemId);\n };\n\n const pinButton = (\n <SidebarMenuItemAction\n element={isPinned ? <UnPinIcon /> : <PinIcon />}\n onClick={handlePinClick}\n showOnHover={true}\n />\n );\n\n // If there's a custom action, combine them\n // Don't modify the custom action - it should keep its original behavior\n if (action) {\n return (\n <div className=\"flex items-center gap-xs\">\n {pinButton}\n {action}\n </div>\n );\n }\n\n return pinButton;\n }, [pinnable, isPinned, pinnedItemIcon, action, sidebar, menuItemId]);\n\n useEffect(() => {\n if (sidebar.expanded) {\n const timer = setTimeout(() => {\n setShowChevron(true);\n }, 100);\n return () => clearTimeout(timer);\n }\n setShowChevron(false);\n return undefined;\n }, [sidebar.expanded]);\n\n const sidebarMenuSubButton = useMemo(() => {\n if (!children) {\n return (\n <>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <SidebarMenuSubButton {...buttonProps} action={pinAction} />\n </>\n );\n }\n\n const chevron = showChevron ? (\n <Icon\n label={\"Expand / Collapse\"}\n size={\"sm\"}\n className={\n \"ml-auto transition-transform duration-100 group-data-[state=open]/menu-sub-item-collapsible:rotate-180 group-data-[state=collapsed]:hidden\"\n }\n color={\"neutral-strong\"}\n data-sidebar={\"menu-item-expanded-indicator\"}\n icon={<KeyboardArrowRightIcon />}\n />\n ) : null;\n\n const collapsibleAction = pinnable ? (\n <div className=\"flex items-center gap-xs\">\n {pinAction}\n {chevron}\n </div>\n ) : (\n chevron\n );\n\n if (!collapsible) {\n return (\n <div className={\"flex items-center min-w-0\"}>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <SidebarMenuSubButton {...buttonProps} />\n </div>\n );\n }\n\n return (\n <Collapsible.Root\n className=\"w-full group/menu-sub-item-collapsible\"\n open={isSectionExpanded}\n onOpenChange={toggleSectionExpanded}\n >\n <div className={\"flex items-center min-w-0\"}>\n <SidebarMenuSubItemIndentation\n lvl={currentLevel}\n variant={buttonProps.variant}\n />\n <Collapsible.Trigger asChild>\n <SidebarMenuSubButton\n {...buttonProps}\n action={collapsibleAction}\n className={\n \"group-data-[state=open]/menu-sub-item-collapsible:font-semibold!\"\n }\n />\n </Collapsible.Trigger>\n </div>\n <Collapsible.Content>\n <SidebarMenuSub parentIcon={buttonProps.icon}>{children}</SidebarMenuSub>\n </Collapsible.Content>\n </Collapsible.Root>\n );\n }, [\n children,\n buttonProps,\n currentLevel,\n menuItemId,\n isSectionExpanded,\n toggleSectionExpanded,\n showChevron,\n pinnable,\n pinAction\n ]);\n\n return (\n <>\n <li\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative flex min-w-0\", className)}\n >\n {sidebarMenuSubButton}\n </li>\n {children && !collapsible ? children : null}\n </>\n );\n};\n\nexport { SidebarMenuSubItem };\n"],"names":["SidebarMenuSubItem","children","className","pinnable","action","collapsible","buttonProps","currentLevel","parentIcon","useSidebarMenu","sidebar","useSidebar","showChevron","setShowChevron","useState","menuItemId","useMemo","btoa","isSectionExpanded","toggleSectionExpanded","useCallback","isPinned","pinnedItemIcon","React","pinAction","handlePinClick","e","pinButton","SidebarMenuItemAction","UnPinIcon","PinIcon","useEffect","timer","setTimeout","clearTimeout","sidebarMenuSubButton","SidebarMenuSubItemIndentation","SidebarMenuSubButton","chevron","Icon","KeyboardArrowRightIcon","collapsibleAction","Collapsible","SidebarMenuSub","cn"],"mappings":";;;;;;;;;;;;;AAeA,MAAMA,qBAAqB,CAAC,EACxBC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,cAAc,IAAI,EAClB,GAAGC,aACgB;IACnB,MAAM,EAAEC,YAAY,EAAEC,UAAU,EAAE,GAAGC;IACrC,MAAMC,UAAUC;IAChB,MAAM,CAACC,aAAaC,eAAe,GAAGC,SAAS;IAE/C,MAAMC,aAAaC,QAAQ,IAChBC,KAAK,CAAC,aAAa,EAAEV,aAAa,CAAC,EAAED,YAAY,IAAI,EAAE,GAC/D;QAACA,YAAY,IAAI;QAAEC;KAAa;IAEnC,MAAMW,oBAAoBF,QAAQ,IACvBN,QAAQ,iBAAiB,CAACK,aAClC;QAACL,QAAQ,gBAAgB;KAAC;IAE7B,MAAMS,wBAAwBC,YAAY;QACtCV,QAAQ,qBAAqB,CAACK;IAClC,GAAG;QAACG;KAAkB;IAEtB,MAAMG,WAAWX,QAAQ,YAAY,CAACK;IAGtC,MAAMO,iBAAiBN,QAAQ;QAC3B,IAAIV,YAAY,UAAU,EACtB,OAAOA,YAAY,UAAU;QAGjC,OAAOA,YAAY,IAAI,IAAIE;IAC/B,GAAG;QAACF,YAAY,UAAU;QAAEA,YAAY,IAAI;QAAEE;KAAW;IAIzDe,MAAAA,SAAe,CAAC;QACZ,IAAIpB,YAAYkB,UACZX,QAAQ,kBAAkB,CAAC;YACvB,IAAIK;YACJ,MAAMT,YAAY,IAAI;YACtB,MAAMgB;YACN,IAAIhB,YAAY,EAAE;YAClB,SAASA,YAAY,OAAO;YAC5B,QAAQA,YAAY,MAAM;QAC9B;aACG,IAAIH,YAAY,CAACkB,UAEpBX,QAAQ,oBAAoB,CAACK;IAErC,GAAG;QAACZ;QAAUkB;QAAUC;QAAgBP;QAAYT,YAAY,MAAM;KAAC;IAEvE,MAAMkB,YAAYR,QAAQ;QACtB,IAAI,CAACb,UACD,OAAOC;QAGX,MAAMqB,iBAAiB,CAACC;YACpBA,EAAE,eAAe;YACjBA,EAAE,cAAc;YAEhB,IAAIL,UACAX,QAAQ,oBAAoB,CAACK;iBAE7BL,QAAQ,kBAAkB,CAAC;gBACvB,IAAIK;gBACJ,MAAMT,YAAY,IAAI;gBACtB,MAAMgB;gBACN,IAAIhB,YAAY,EAAE;gBAClB,SAASA,YAAY,OAAO;gBAC5B,QAAQA,YAAY,MAAM;YAC9B;YAGJI,QAAQ,gBAAgB,CAACK;QAC7B;QAEA,MAAMY,YAAY,WAAZA,GACF,oBAACC,uBAAqBA;YAClB,SAASP,WAAW,WAAXA,GAAW,oBAACQ,iCAASA,QAAAA,WAAAA,GAAM,oBAACC,6BAAOA;YAC5C,SAASL;YACT,aAAa;;QAMrB,IAAIrB,QACA,OAAO,WAAP,GACI,oBAAC;YAAI,WAAU;WACVuB,WACAvB;QAKb,OAAOuB;IACX,GAAG;QAACxB;QAAUkB;QAAUC;QAAgBlB;QAAQM;QAASK;KAAW;IAEpEgB,UAAU;QACN,IAAIrB,QAAQ,QAAQ,EAAE;YAClB,MAAMsB,QAAQC,WAAW;gBACrBpB,eAAe;YACnB,GAAG;YACH,OAAO,IAAMqB,aAAaF;QAC9B;QACAnB,eAAe;IAEnB,GAAG;QAACH,QAAQ,QAAQ;KAAC;IAErB,MAAMyB,uBAAuBnB,QAAQ;QACjC,IAAI,CAACf,UACD,OAAO,WAAP,GACI,wDACI,oBAACmC,+BAA6BA;YAC1B,KAAK7B;YACL,SAASD,YAAY,OAAO;0BAEhC,oBAAC+B,sBAAoBA;YAAE,GAAG/B,WAAW;YAAE,QAAQkB;;QAK3D,MAAMc,UAAU1B,cAAc,WAAdA,GACZ,oBAAC2B,MAAIA;YACD,OAAO;YACP,MAAM;YACN,WACI;YAEJ,OAAO;YACP,gBAAc;YACd,oBAAM,oBAACC,gBAAsBA;aAEjC;QAEJ,MAAMC,oBAAoBtC,WAAW,WAAXA,GACtB,oBAAC;YAAI,WAAU;WACVqB,WACAc,WAGLA;QAGJ,IAAI,CAACjC,aACD,OAAO,WAAP,GACI,oBAAC;YAAI,WAAW;yBACZ,oBAAC+B,+BAA6BA;YAC1B,KAAK7B;YACL,SAASD,YAAY,OAAO;0BAEhC,oBAAC+B,sBAAyB/B;QAKtC,OAAO,WAAP,GACI,oBAACoC,YAAY,IAAI;YACb,WAAU;YACV,MAAMxB;YACN,cAAcC;yBAEd,oBAAC;YAAI,WAAW;yBACZ,oBAACiB,+BAA6BA;YAC1B,KAAK7B;YACL,SAASD,YAAY,OAAO;0BAEhC,oBAACoC,YAAY,OAAO;YAAC;yBACjB,oBAACL,sBAAoBA;YAChB,GAAG/B,WAAW;YACf,QAAQmC;YACR,WACI;4BAKhB,oBAACC,YAAY,OAAO,sBAChB,oBAACC,gBAAcA;YAAC,YAAYrC,YAAY,IAAI;WAAGL;IAI/D,GAAG;QACCA;QACAK;QACAC;QACAQ;QACAG;QACAC;QACAP;QACAT;QACAqB;KACH;IAED,OAAO,WAAP,GACI,wDACI,oBAAC;QACG,gBAAa;QACb,WAAWoB,GAAG,6CAA6C1C;OAE1DiC,uBAEJlC,YAAY,CAACI,cAAcJ,WAAW;AAGnD"}
|
package/Slider/Slider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Label } from "../Label/index.js";
|
|
2
|
-
import { makeDecoratable } from "../utils.js";
|
|
2
|
+
import { generateId, makeDecoratable } from "../utils.js";
|
|
3
3
|
import { SliderPrimitiveRenderer, SliderValue, useSlider } from "./primitives/index.js";
|
|
4
4
|
import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
|
|
5
5
|
import * as __rspack_external_react from "react";
|
|
@@ -8,6 +8,7 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
|
|
|
8
8
|
}, /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
9
9
|
className: "basis-2/12 pr-sm"
|
|
10
10
|
}, /*#__PURE__*/ __rspack_external_react.createElement(Label, {
|
|
11
|
+
id: props.labelId,
|
|
11
12
|
text: props.label,
|
|
12
13
|
required: props.required,
|
|
13
14
|
disabled: props.disabled,
|
|
@@ -15,7 +16,10 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
|
|
|
15
16
|
weight: "light"
|
|
16
17
|
})), /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
17
18
|
className: "basis-9/12"
|
|
18
|
-
}, /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer,
|
|
19
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer, {
|
|
20
|
+
...props,
|
|
21
|
+
"aria-labelledby": props.labelId
|
|
22
|
+
})), /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
19
23
|
className: "basis-1/12 pl-sm text-right"
|
|
20
24
|
}, /*#__PURE__*/ __rspack_external_react.createElement(SliderValue, {
|
|
21
25
|
value: props.textValue,
|
|
@@ -24,6 +28,7 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
|
|
|
24
28
|
const DecoratableSlider = ({ description, note, hint, validation, labelPosition, ...props })=>{
|
|
25
29
|
const { isValid: validationIsValid, message: validationMessage } = validation || {};
|
|
26
30
|
const invalid = false === validationIsValid;
|
|
31
|
+
const labelId = __rspack_external_react.useMemo(()=>`${generateId()}-label`, []);
|
|
27
32
|
const { vm, changeValue, commitValue } = useSlider(props);
|
|
28
33
|
if ("side" === labelPosition) return /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
29
34
|
className: "w-full"
|
|
@@ -32,6 +37,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
|
|
|
32
37
|
disabled: props.disabled
|
|
33
38
|
}), /*#__PURE__*/ __rspack_external_react.createElement(SliderRendererWithSideValue, {
|
|
34
39
|
...props,
|
|
40
|
+
labelId: labelId,
|
|
35
41
|
...vm,
|
|
36
42
|
invalid: invalid,
|
|
37
43
|
onValueChange: changeValue,
|
|
@@ -47,6 +53,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
|
|
|
47
53
|
return /*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
48
54
|
className: "w-full"
|
|
49
55
|
}, /*#__PURE__*/ __rspack_external_react.createElement(FormComponentLabel, {
|
|
56
|
+
labelId: labelId,
|
|
50
57
|
hint: hint,
|
|
51
58
|
text: /*#__PURE__*/ __rspack_external_react.createElement(Label, {
|
|
52
59
|
text: props.label,
|
|
@@ -61,6 +68,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
|
|
|
61
68
|
}), /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer, {
|
|
62
69
|
...props,
|
|
63
70
|
...vm,
|
|
71
|
+
"aria-labelledby": labelId,
|
|
64
72
|
onValueChange: changeValue,
|
|
65
73
|
onValueCommit: commitValue
|
|
66
74
|
}), /*#__PURE__*/ __rspack_external_react.createElement(FormComponentErrorMessage, {
|
package/Slider/Slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider/Slider.js","sources":["../../src/Slider/Slider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Label } from \"~/Label/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { SliderPrimitiveProps, SliderPrimitiveRendererProps } from \"./primitives/index.js\";\nimport { SliderPrimitiveRenderer, useSlider, SliderValue } 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\n/**\n * Slider Renderer with side label\n */\ninterface SliderRendererWithSideValueProps extends SliderPrimitiveRendererProps {\n label?: React.ReactNode;\n invalid?: boolean;\n required?: boolean;\n}\n\nconst SliderRendererWithSideValue = (props: SliderRendererWithSideValueProps) => {\n return (\n <div className={\"w-full flex flex-row items-center justify-between\"}>\n <div className={\"basis-2/12 pr-sm\"}>\n <Label\n text={props.label}\n required={props.required}\n disabled={props.disabled}\n invalid={props.invalid}\n weight={\"light\"}\n />\n </div>\n <div className={\"basis-9/12\"}>\n <SliderPrimitiveRenderer {...props} />\n </div>\n <div className={\"basis-1/12 pl-sm text-right\"}>\n <SliderValue value={props.textValue} disabled={props.disabled} />\n </div>\n </div>\n );\n};\n\n/**\n * Slider\n */\ntype SliderProps = FormComponentProps &\n SliderPrimitiveProps & {\n labelPosition?: \"top\" | \"side\";\n };\n\nconst DecoratableSlider = ({\n description,\n note,\n hint,\n validation,\n labelPosition,\n ...props\n}: SliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = validationIsValid === false;\n\n const { vm, changeValue, commitValue } = useSlider(props);\n\n if (labelPosition === \"side\") {\n return (\n <div className={\"w-full\"}>\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderRendererWithSideValue\n {...props}\n {...vm}\n invalid={invalid}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\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\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n hint={hint}\n text={<Label text={props.label} value={vm.textValue} />}\n disabled={props.disabled}\n required={props.required}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderPrimitiveRenderer\n {...props}\n {...vm}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\nconst Slider = makeDecoratable(\"Slider\", DecoratableSlider);\n\nexport { Slider, type SliderProps };\n"],"names":["SliderRendererWithSideValue","props","Label","SliderPrimitiveRenderer","SliderValue","DecoratableSlider","description","note","hint","validation","labelPosition","validationIsValid","validationMessage","invalid","vm","changeValue","commitValue","useSlider","FormComponentDescription","FormComponentErrorMessage","FormComponentNote","FormComponentLabel","Slider","makeDecoratable"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Slider/Slider.js","sources":["../../src/Slider/Slider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Label } from \"~/Label/index.js\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { SliderPrimitiveProps, SliderPrimitiveRendererProps } from \"./primitives/index.js\";\nimport { SliderPrimitiveRenderer, useSlider, SliderValue } 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\n/**\n * Slider Renderer with side label\n */\ninterface SliderRendererWithSideValueProps extends SliderPrimitiveRendererProps {\n label?: React.ReactNode;\n /** The side label's id — the thumb names itself with it. */\n labelId?: string;\n invalid?: boolean;\n required?: boolean;\n}\n\nconst SliderRendererWithSideValue = (props: SliderRendererWithSideValueProps) => {\n return (\n <div className={\"w-full flex flex-row items-center justify-between\"}>\n <div className={\"basis-2/12 pr-sm\"}>\n <Label\n id={props.labelId}\n text={props.label}\n required={props.required}\n disabled={props.disabled}\n invalid={props.invalid}\n weight={\"light\"}\n />\n </div>\n <div className={\"basis-9/12\"}>\n <SliderPrimitiveRenderer {...props} aria-labelledby={props.labelId} />\n </div>\n <div className={\"basis-1/12 pl-sm text-right\"}>\n <SliderValue value={props.textValue} disabled={props.disabled} />\n </div>\n </div>\n );\n};\n\n/**\n * Slider\n */\ntype SliderProps = FormComponentProps &\n SliderPrimitiveProps & {\n labelPosition?: \"top\" | \"side\";\n };\n\nconst DecoratableSlider = ({\n description,\n note,\n hint,\n validation,\n labelPosition,\n ...props\n}: SliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = validationIsValid === false;\n /* The thumb (`role=slider`) can't be a `<label for>` target, so it names itself after the label. */\n const labelId = React.useMemo(() => `${generateId()}-label`, []);\n\n const { vm, changeValue, commitValue } = useSlider(props);\n\n if (labelPosition === \"side\") {\n return (\n <div className={\"w-full\"}>\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderRendererWithSideValue\n {...props}\n labelId={labelId}\n {...vm}\n invalid={invalid}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\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\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n labelId={labelId}\n hint={hint}\n text={<Label text={props.label} value={vm.textValue} />}\n disabled={props.disabled}\n required={props.required}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderPrimitiveRenderer\n {...props}\n {...vm}\n aria-labelledby={labelId}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\nconst Slider = makeDecoratable(\"Slider\", DecoratableSlider);\n\nexport { Slider, type SliderProps };\n"],"names":["SliderRendererWithSideValue","props","Label","SliderPrimitiveRenderer","SliderValue","DecoratableSlider","description","note","hint","validation","labelPosition","validationIsValid","validationMessage","invalid","labelId","React","generateId","vm","changeValue","commitValue","useSlider","FormComponentDescription","FormComponentErrorMessage","FormComponentNote","FormComponentLabel","Slider","makeDecoratable"],"mappings":";;;;;AAwBA,MAAMA,8BAA8B,CAACC,QAC1B,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAI,WAAW;qBACZ,sCAACC,OAAKA;QACF,IAAID,MAAM,OAAO;QACjB,MAAMA,MAAM,KAAK;QACjB,UAAUA,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,QAAQ;uBAGhB,sCAAC;QAAI,WAAW;qBACZ,sCAACE,yBAAuBA;QAAE,GAAGF,KAAK;QAAE,mBAAiBA,MAAM,OAAO;uBAEtE,sCAAC;QAAI,WAAW;qBACZ,sCAACG,aAAWA;QAAC,OAAOH,MAAM,SAAS;QAAE,UAAUA,MAAM,QAAQ;;AAc7E,MAAMI,oBAAoB,CAAC,EACvBC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,aAAa,EACb,GAAGT,OACO;IACV,MAAM,EAAE,SAASU,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUF,AAAsB,UAAtBA;IAEhB,MAAMG,UAAUC,wBAAAA,OAAa,CAAC,IAAM,GAAGC,aAAa,MAAM,CAAC,EAAE,EAAE;IAE/D,MAAM,EAAEC,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAUnB;IAEnD,IAAIS,AAAkB,WAAlBA,eACA,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACW,0BAAwBA;QAAC,MAAMf;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACD,6BAA2BA;QACvB,GAAGC,KAAK;QACT,SAASa;QACR,GAAGG,EAAE;QACN,SAASJ;QACT,eAAeK;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMV;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACsB,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUN,MAAM,QAAQ;;IAKnE,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACuB,oBAAkBA;QACf,SAASV;QACT,MAAMN;QACN,oBAAM,sCAACN,OAAKA;YAAC,MAAMD,MAAM,KAAK;YAAE,OAAOgB,GAAG,SAAS;;QACnD,UAAUhB,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASY;sBAEb,sCAACQ,0BAAwBA;QAAC,MAAMf;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACE,yBAAuBA;QACnB,GAAGF,KAAK;QACR,GAAGgB,EAAE;QACN,mBAAiBH;QACjB,eAAeI;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMV;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACsB,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUN,MAAM,QAAQ;;AAGnE;AACA,MAAMwB,SAASC,gBAAgB,UAAUrB"}
|
|
@@ -5,7 +5,7 @@ type SliderRootProps = Omit<SliderPrimitives.SliderProps, "min"> & {
|
|
|
5
5
|
min: number;
|
|
6
6
|
};
|
|
7
7
|
type SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;
|
|
8
|
-
declare const SliderPrimitiveRenderer: ({ tooltipSide, textValue, showTooltip, ...sliderProps }: SliderPrimitiveVm) => React.JSX.Element;
|
|
8
|
+
declare const SliderPrimitiveRenderer: ({ tooltipSide, textValue, showTooltip, "aria-labelledby": labelledBy, ...sliderProps }: SliderPrimitiveVm) => React.JSX.Element;
|
|
9
9
|
interface SliderPrimitiveProps extends Omit<SliderPrimitives.SliderProps, "defaultValue" | "value" | "onValueChange" | "onValueCommit"> {
|
|
10
10
|
onValueChange: (value: number) => void;
|
|
11
11
|
onValueCommit?: (value: number) => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useSlider } from "./useSlider.js";
|
|
2
2
|
import { SliderRoot, SliderThumb, SliderTrack } from "./components/index.js";
|
|
3
3
|
import * as __rspack_external_react from "react";
|
|
4
|
-
const SliderPrimitiveRenderer = ({ tooltipSide, textValue, showTooltip, ...sliderProps })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
|
|
4
|
+
const SliderPrimitiveRenderer = ({ tooltipSide, textValue, showTooltip, "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, sliderProps, /*#__PURE__*/ __rspack_external_react.createElement(SliderTrack, null), /*#__PURE__*/ __rspack_external_react.createElement(SliderThumb, {
|
|
7
|
+
"aria-labelledby": labelledBy,
|
|
7
8
|
textValue: textValue,
|
|
8
9
|
showTooltip: showTooltip,
|
|
9
10
|
tooltipSide: tooltipSide
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider/primitives/SliderPrimitive.js","sources":["../../../src/Slider/primitives/SliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { useSlider } from \"./useSlider.js\";\nimport { SliderRoot, SliderThumb, SliderTrack, type SliderThumbProps } from \"./components/index.js\";\n\ntype SliderRootProps = Omit<SliderPrimitives.SliderProps, \"min\"> & {\n min: number;\n};\n\ntype SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitiveRenderer = ({\n tooltipSide,\n textValue,\n showTooltip,\n ...sliderProps\n}: SliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps}>\n <SliderTrack />\n <SliderThumb\n textValue={textValue}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n />\n </SliderRoot>\n </div>\n );\n};\n\ninterface SliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValueChange: (value: number) => void;\n onValueCommit?: (value: number) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n value?: number;\n}\n\ntype SliderPrimitiveVm = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitive = (props: SliderPrimitiveProps) => {\n const { transformValue, ...restProps } = props;\n const { vm, changeValue, commitValue } = useSlider({
|
|
1
|
+
{"version":3,"file":"Slider/primitives/SliderPrimitive.js","sources":["../../../src/Slider/primitives/SliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { useSlider } from \"./useSlider.js\";\nimport { SliderRoot, SliderThumb, SliderTrack, type SliderThumbProps } from \"./components/index.js\";\n\ntype SliderRootProps = Omit<SliderPrimitives.SliderProps, \"min\"> & {\n min: number;\n};\n\ntype SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitiveRenderer = ({\n tooltipSide,\n textValue,\n showTooltip,\n \"aria-labelledby\": labelledBy,\n ...sliderProps\n}: SliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps}>\n <SliderTrack />\n <SliderThumb\n aria-labelledby={labelledBy}\n textValue={textValue}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n />\n </SliderRoot>\n </div>\n );\n};\n\ninterface SliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValueChange: (value: number) => void;\n onValueCommit?: (value: number) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n value?: number;\n}\n\ntype SliderPrimitiveVm = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitive = (props: SliderPrimitiveProps) => {\n const { transformValue, ...restProps } = props;\n const { vm, changeValue, commitValue } = useSlider({\n ...restProps,\n transformValue\n });\n\n return (\n <SliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n );\n};\n\nexport {\n SliderPrimitive,\n SliderPrimitiveRenderer,\n type SliderPrimitiveVm,\n type SliderPrimitiveProps,\n type SliderPrimitiveRendererProps\n};\n"],"names":["SliderPrimitiveRenderer","tooltipSide","textValue","showTooltip","labelledBy","sliderProps","SliderRoot","SliderTrack","SliderThumb","SliderPrimitive","props","transformValue","restProps","vm","changeValue","commitValue","useSlider"],"mappings":";;;AAWA,MAAMA,0BAA0B,CAAC,EAC7BC,WAAW,EACXC,SAAS,EACTC,WAAW,EACX,mBAAmBC,UAAU,EAC7B,GAAGC,aACa,GACT,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAeD,aAAAA,WAAAA,GACZ,sCAACE,aAAWA,OAAAA,WAAAA,GACZ,sCAACC,aAAWA;QACR,mBAAiBJ;QACjB,WAAWF;QACX,aAAaC;QACb,aAAaF;;AAqBjC,MAAMQ,kBAAkB,CAACC;IACrB,MAAM,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGF;IACzC,MAAM,EAAEG,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAU;QAC/C,GAAGJ,SAAS;QACZD;IACJ;IAEA,OAAO,WAAP,GACI,sCAACX,yBAAuBA;QACnB,GAAGY,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;;AAG3B"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { SliderTooltipProps } from "./SliderTooltip.js";
|
|
3
|
-
type SliderThumbProps = SliderTooltipProps
|
|
4
|
-
|
|
3
|
+
type SliderThumbProps = SliderTooltipProps & {
|
|
4
|
+
/** The thumb is the `role=slider` element, so it carries the label's id — not the root. */
|
|
5
|
+
"aria-labelledby"?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const SliderThumb: ({ textValue, showTooltip, tooltipSide, "aria-labelledby": labelledBy }: SliderThumbProps) => React.JSX.Element;
|
|
5
8
|
export { SliderThumb, type SliderThumbProps };
|