@dbcdk/react-components 0.0.103 → 0.0.105
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/dist/assets/logo.cjs +87 -0
- package/dist/assets/logo.js +85 -0
- package/dist/client.cjs +587 -0
- package/dist/client.d.ts +83 -0
- package/dist/client.js +84 -0
- package/dist/components/accordion/Accordion.cjs +117 -0
- package/dist/components/accordion/Accordion.d.ts +5 -2
- package/dist/components/accordion/Accordion.js +111 -0
- package/dist/components/accordion/Accordion.module.css +41 -0
- package/dist/components/accordion/components/AccordionRow.cjs +120 -0
- package/dist/components/accordion/components/AccordionRow.js +114 -0
- package/dist/components/accordion/components/AccordionRow.module.css +133 -0
- package/dist/components/alert/Alert.cjs +52 -0
- package/dist/components/alert/Alert.d.ts +2 -1
- package/dist/components/alert/Alert.js +46 -0
- package/dist/components/alert/Alert.module.css +97 -0
- package/dist/components/app-header/AppHeader.cjs +14 -0
- package/dist/components/app-header/AppHeader.js +8 -0
- package/dist/components/app-header/AppHeader.module.css +74 -0
- package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
- package/dist/components/attribute-chip/AttributeChip.js +16 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.cjs +111 -0
- package/dist/components/avatar/Avatar.js +86 -0
- package/dist/components/avatar/Avatar.module.css +91 -0
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +24 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +18 -0
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +80 -0
- package/dist/components/button/Button.cjs +149 -0
- package/dist/components/button/Button.js +124 -0
- package/dist/components/button/Button.module.css +260 -0
- package/dist/components/button-select/ButtonSelect.cjs +35 -0
- package/dist/components/button-select/ButtonSelect.js +29 -0
- package/dist/components/button-select/ButtonSelect.module.css +40 -0
- package/dist/components/card/Card.cjs +112 -0
- package/dist/components/card/Card.d.ts +2 -1
- package/dist/components/card/Card.js +106 -0
- package/dist/components/card/Card.module.css +187 -0
- package/dist/components/card/components/CardMeta.cjs +62 -0
- package/dist/components/card/components/CardMeta.js +55 -0
- package/dist/components/card/components/CardMeta.module.css +55 -0
- package/dist/components/card-container/CardContainer.cjs +34 -0
- package/dist/components/card-container/CardContainer.js +28 -0
- package/dist/components/card-container/CardContainer.module.css +63 -0
- package/dist/components/chip/Chip.cjs +65 -0
- package/dist/components/chip/Chip.js +59 -0
- package/dist/components/chip/Chip.module.css +236 -0
- package/dist/components/circle/Circle.cjs +33 -0
- package/dist/components/circle/Circle.js +27 -0
- package/dist/components/circle/Circle.module.css +128 -0
- package/dist/components/clear-button/ClearButton.cjs +33 -0
- package/dist/components/clear-button/ClearButton.d.ts +2 -1
- package/dist/components/clear-button/ClearButton.js +27 -0
- package/dist/components/clear-button/ClearButton.module.css +26 -0
- package/dist/components/code-block/CodeBlock.cjs +97 -0
- package/dist/components/code-block/CodeBlock.js +91 -0
- package/dist/components/code-block/CodeBlock.module.css +124 -0
- package/dist/components/copy-button/CopyButton.cjs +139 -0
- package/dist/components/copy-button/CopyButton.js +133 -0
- package/dist/components/copy-button/CopyButton.module.css +22 -0
- package/dist/components/datetime-picker/DateTimePicker.cjs +559 -0
- package/dist/components/datetime-picker/DateTimePicker.js +553 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +155 -0
- package/dist/components/datetime-picker/dateTimeHelpers.cjs +179 -0
- package/dist/components/datetime-picker/dateTimeHelpers.js +160 -0
- package/dist/components/divider/Divider.cjs +22 -0
- package/dist/components/divider/Divider.js +20 -0
- package/dist/components/filter-field/FilterField.cjs +296 -0
- package/dist/components/filter-field/FilterField.js +289 -0
- package/dist/components/filter-field/FilterField.module.css +379 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.cjs +115 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +108 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +59 -0
- package/dist/components/forms/checkbox/Checkbox.cjs +88 -0
- package/dist/components/forms/checkbox/Checkbox.js +82 -0
- package/dist/components/forms/checkbox/Checkbox.module.css +104 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.cjs +121 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +115 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
- package/dist/components/forms/form-select/FormSelect.cjs +191 -0
- package/dist/components/forms/form-select/FormSelect.js +166 -0
- package/dist/components/forms/form-select/FormSelect.module.css +236 -0
- package/dist/components/forms/input/Input.cjs +188 -0
- package/dist/components/forms/input/Input.d.ts +1 -0
- package/dist/components/forms/input/Input.js +182 -0
- package/dist/components/forms/input/Input.module.css +468 -0
- package/dist/components/forms/input-container/InputContainer.cjs +72 -0
- package/dist/components/forms/input-container/InputContainer.js +66 -0
- package/dist/components/forms/input-container/InputContainer.module.css +59 -0
- package/dist/components/forms/multi-select/MultiSelect.cjs +227 -0
- package/dist/components/forms/multi-select/MultiSelect.js +225 -0
- package/dist/components/forms/radio-buttons/RadioButton.cjs +91 -0
- package/dist/components/forms/radio-buttons/RadioButton.js +85 -0
- package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +74 -0
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +72 -0
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +118 -0
- package/dist/components/forms/select/Select.cjs +286 -0
- package/dist/components/forms/select/Select.js +280 -0
- package/dist/components/forms/select/Select.module.css +32 -0
- package/dist/components/forms/text-area/Textarea.cjs +116 -0
- package/dist/components/forms/text-area/Textarea.js +110 -0
- package/dist/components/forms/text-area/Textarea.module.css +70 -0
- package/dist/components/forms/typeahead/Typeahead.cjs +792 -0
- package/dist/components/forms/typeahead/Typeahead.js +768 -0
- package/dist/components/forms/typeahead/Typeahead.module.css +38 -0
- package/dist/components/grid/Grid.cjs +45 -0
- package/dist/components/grid/Grid.js +38 -0
- package/dist/components/grid/Grid.module.css +35 -0
- package/dist/components/headline/CollapsibleHeadline.cjs +89 -0
- package/dist/components/headline/CollapsibleHeadline.d.ts +4 -4
- package/dist/components/headline/CollapsibleHeadline.js +83 -0
- package/dist/components/headline/Headline.cjs +59 -0
- package/dist/components/headline/Headline.js +53 -0
- package/dist/components/headline/Headline.module.css +185 -0
- package/dist/components/hyperlink/Hyperlink.cjs +107 -0
- package/dist/components/hyperlink/Hyperlink.js +82 -0
- package/dist/components/hyperlink/Hyperlink.module.css +121 -0
- package/dist/components/icon/Icon.cjs +27 -0
- package/dist/components/icon/Icon.js +20 -0
- package/dist/components/icon/Icon.module.css +36 -0
- package/dist/components/inline-status/InlineStatus.cjs +39 -0
- package/dist/components/inline-status/InlineStatus.js +33 -0
- package/dist/components/inline-status/InlineStatus.module.css +92 -0
- package/dist/components/interval-select/IntervalSelect.cjs +203 -0
- package/dist/components/interval-select/IntervalSelect.js +201 -0
- package/dist/components/json-viewer/HighlightedText.cjs +13 -0
- package/dist/components/json-viewer/HighlightedText.js +11 -0
- package/dist/components/json-viewer/JsonNode.cjs +124 -0
- package/dist/components/json-viewer/JsonNode.js +118 -0
- package/dist/components/json-viewer/JsonViewer.cjs +164 -0
- package/dist/components/json-viewer/JsonViewer.js +158 -0
- package/dist/components/json-viewer/JsonViewer.module.css +346 -0
- package/dist/components/json-viewer/types.cjs +2 -0
- package/dist/components/json-viewer/types.js +1 -0
- package/dist/components/json-viewer/useClipboardStatus.cjs +15 -0
- package/dist/components/json-viewer/useClipboardStatus.js +13 -0
- package/dist/components/json-viewer/utils.cjs +126 -0
- package/dist/components/json-viewer/utils.js +111 -0
- package/dist/components/media-card/MediaCard.cjs +60 -0
- package/dist/components/media-card/MediaCard.d.ts +19 -0
- package/dist/components/media-card/MediaCard.js +54 -0
- package/dist/components/media-card/MediaCard.module.css +92 -0
- package/dist/components/menu/Menu.cjs +287 -0
- package/dist/components/menu/Menu.js +262 -0
- package/dist/components/menu/Menu.module.css +220 -0
- package/dist/components/meta-bar/MetaBar.cjs +28 -0
- package/dist/components/meta-bar/MetaBar.js +22 -0
- package/dist/components/meta-bar/MetaBar.module.css +27 -0
- package/dist/components/nav-bar/NavBar.cjs +104 -0
- package/dist/components/nav-bar/NavBar.d.ts +4 -3
- package/dist/components/nav-bar/NavBar.js +98 -0
- package/dist/components/nav-bar/NavBar.module.css +225 -0
- package/dist/components/overlay/fade-overlay/FadeOverlay.cjs +30 -0
- package/dist/components/overlay/fade-overlay/FadeOverlay.js +24 -0
- package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +54 -0
- package/dist/components/overlay/modal/Modal.cjs +189 -0
- package/dist/components/overlay/modal/Modal.d.ts +2 -1
- package/dist/components/overlay/modal/Modal.js +183 -0
- package/dist/components/overlay/modal/Modal.module.css +112 -0
- package/dist/components/overlay/modal/provider/ModalProvider.cjs +98 -0
- package/dist/components/overlay/modal/provider/ModalProvider.js +95 -0
- package/dist/components/overlay/side-panel/SidePanel.cjs +173 -0
- package/dist/components/overlay/side-panel/SidePanel.js +167 -0
- package/dist/components/overlay/side-panel/SidePanel.module.css +177 -0
- package/dist/components/overlay/side-panel/useSidePanel.cjs +16 -0
- package/dist/components/overlay/side-panel/useSidePanel.js +14 -0
- package/dist/components/overlay/tooltip/Tooltip.cjs +34 -0
- package/dist/components/overlay/tooltip/Tooltip.js +32 -0
- package/dist/components/overlay/tooltip/Tooltip.module.css +104 -0
- package/dist/components/overlay/tooltip/TooltipProvider.cjs +238 -0
- package/dist/components/overlay/tooltip/TooltipProvider.js +231 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +117 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +115 -0
- package/dist/components/page/Page.cjs +63 -0
- package/dist/components/page/Page.js +57 -0
- package/dist/components/page/Page.module.css +95 -0
- package/dist/components/page-layout/PageLayout.cjs +97 -0
- package/dist/components/page-layout/PageLayout.d.ts +0 -5
- package/dist/components/page-layout/PageLayout.js +91 -0
- package/dist/components/page-layout/PageLayout.module.css +236 -0
- package/dist/components/page-layout/components/footer/Footer.cjs +53 -0
- package/dist/components/page-layout/components/footer/Footer.js +47 -0
- package/dist/components/page-layout/components/footer/Footer.module.css +89 -0
- package/dist/components/pagination/Pagination.cjs +160 -0
- package/dist/components/pagination/Pagination.js +154 -0
- package/dist/components/pagination/Pagination.module.css +25 -0
- package/dist/components/panel/Panel.cjs +38 -0
- package/dist/components/panel/Panel.js +32 -0
- package/dist/components/panel/Panel.module.css +30 -0
- package/dist/components/popover/Popover.cjs +331 -0
- package/dist/components/popover/Popover.js +307 -0
- package/dist/components/popover/Popover.module.css +52 -0
- package/dist/components/search-box/SearchBox.cjs +274 -0
- package/dist/components/search-box/SearchBox.js +268 -0
- package/dist/components/search-box/SearchBox.module.css +27 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +127 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +121 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +174 -0
- package/dist/components/sidebar/Sidebar.cjs +39 -0
- package/dist/components/sidebar/Sidebar.js +37 -0
- package/dist/components/sidebar/components/SidebarItem.cjs +29 -0
- package/dist/components/sidebar/components/SidebarItem.js +27 -0
- package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +133 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +127 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +29 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +214 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +207 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +260 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +54 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +47 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +106 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +61 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +55 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +20 -0
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +97 -0
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +91 -0
- package/dist/components/sidebar/providers/SidebarProvider.cjs +223 -0
- package/dist/components/sidebar/providers/SidebarProvider.js +220 -0
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +442 -0
- package/dist/components/skeleton-loader/SkeletonLoader.js +440 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +42 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +36 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +51 -0
- package/dist/components/split-button/SplitButton.cjs +46 -0
- package/dist/components/split-button/SplitButton.js +40 -0
- package/dist/components/split-button/SplitButton.module.css +32 -0
- package/dist/components/split-pane/SplitPane.cjs +188 -0
- package/dist/components/split-pane/SplitPane.d.ts +2 -1
- package/dist/components/split-pane/SplitPane.js +179 -0
- package/dist/components/split-pane/SplitPane.module.css +118 -0
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +129 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +121 -0
- package/dist/components/stack/Stack.cjs +47 -0
- package/dist/components/stack/Stack.d.ts +1 -1
- package/dist/components/stack/Stack.js +41 -0
- package/dist/components/stack/Stack.module.css +61 -0
- package/dist/components/state-page/StatePage.cjs +48 -0
- package/dist/components/state-page/StatePage.js +42 -0
- package/dist/components/state-page/StatePage.module.css +9 -0
- package/dist/components/state-page/empty.cjs +664 -0
- package/dist/components/state-page/empty.js +662 -0
- package/dist/components/state-page/error.cjs +310 -0
- package/dist/components/state-page/error.js +308 -0
- package/dist/components/state-page/notFound.cjs +243 -0
- package/dist/components/state-page/notFound.js +241 -0
- package/dist/components/sticky-footer-layout/StickyFooterLayout.cjs +98 -0
- package/dist/components/sticky-footer-layout/StickyFooterLayout.js +96 -0
- package/dist/components/table/Table.cjs +216 -0
- package/dist/components/table/Table.js +210 -0
- package/dist/components/table/Table.module.css +534 -0
- package/dist/components/table/Table.types.cjs +2 -0
- package/dist/components/table/Table.types.js +1 -0
- package/dist/components/table/TanstackTable.cjs +172 -0
- package/dist/components/table/TanstackTable.js +147 -0
- package/dist/components/table/components/TableBody.cjs +50 -0
- package/dist/components/table/components/TableBody.js +44 -0
- package/dist/components/table/components/TableHeader.cjs +56 -0
- package/dist/components/table/components/TableHeader.js +50 -0
- package/dist/components/table/components/TableHeaderCell.cjs +69 -0
- package/dist/components/table/components/TableHeaderCell.js +63 -0
- package/dist/components/table/components/TableLoadingBody.cjs +35 -0
- package/dist/components/table/components/TableLoadingBody.js +29 -0
- package/dist/components/table/components/TablePagination.cjs +2 -0
- package/dist/components/table/components/TablePagination.js +1 -0
- package/dist/components/table/components/TableRow.cjs +151 -0
- package/dist/components/table/components/TableRow.js +145 -0
- package/dist/components/table/components/TableSelectionCell.cjs +41 -0
- package/dist/components/table/components/TableSelectionCell.js +35 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +25 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.js +19 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +22 -0
- package/dist/components/table/components/empty-state/EmptyState.cjs +33 -0
- package/dist/components/table/components/empty-state/EmptyState.js +31 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +4 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +139 -0
- package/dist/components/table/components/table-settings/TableSettings.js +137 -0
- package/dist/components/table/hooks/useTableRowInteractions.cjs +46 -0
- package/dist/components/table/hooks/useTableRowInteractions.js +44 -0
- package/dist/components/table/table.classes.cjs +49 -0
- package/dist/components/table/table.classes.js +40 -0
- package/dist/components/table/table.utils.cjs +57 -0
- package/dist/components/table/table.utils.js +45 -0
- package/dist/components/table/tanstackTable.utils.cjs +166 -0
- package/dist/components/table/tanstackTable.utils.js +159 -0
- package/dist/components/tabs/Tabs.cjs +172 -0
- package/dist/components/tabs/Tabs.js +166 -0
- package/dist/components/tabs/Tabs.module.css +261 -0
- package/dist/components/theme-button/ThemeButton.cjs +78 -0
- package/dist/components/theme-button/ThemeButton.js +75 -0
- package/dist/components/toast/Toast.cjs +68 -0
- package/dist/components/toast/Toast.js +62 -0
- package/dist/components/toast/Toast.module.css +161 -0
- package/dist/components/toast/provider/ToastProvider.cjs +105 -0
- package/dist/components/toast/provider/ToastProvider.js +97 -0
- package/dist/components/user-display/UserDisplay.cjs +22 -0
- package/dist/components/user-display/UserDisplay.js +16 -0
- package/dist/components/user-display/UserDisplay.module.css +25 -0
- package/dist/constants/chart-colors.cjs +10 -0
- package/dist/constants/chart-colors.js +8 -0
- package/dist/constants/chart-colors.types.cjs +2 -0
- package/dist/constants/chart-colors.types.js +1 -0
- package/dist/constants/severity.cjs +30 -0
- package/dist/constants/severity.js +26 -0
- package/dist/constants/severity.types.cjs +2 -0
- package/dist/constants/severity.types.js +1 -0
- package/dist/constants/sizes.cjs +11 -0
- package/dist/constants/sizes.js +9 -0
- package/dist/hooks/useDeviceSize.cjs +35 -0
- package/dist/hooks/useDeviceSize.js +33 -0
- package/dist/hooks/useListNavigation.cjs +237 -0
- package/dist/hooks/useListNavigation.js +235 -0
- package/dist/hooks/usePagination.cjs +144 -0
- package/dist/hooks/usePagination.js +142 -0
- package/dist/hooks/useSorting.cjs +119 -0
- package/dist/hooks/useSorting.js +117 -0
- package/dist/hooks/useTableData.cjs +53 -0
- package/dist/hooks/useTableData.js +51 -0
- package/dist/hooks/useTableSelection.cjs +172 -0
- package/dist/hooks/useTableSelection.js +170 -0
- package/dist/hooks/useTableSettings.cjs +90 -0
- package/dist/hooks/useTableSettings.js +87 -0
- package/dist/hooks/useTheme.cjs +64 -0
- package/dist/hooks/useTheme.js +62 -0
- package/dist/hooks/useTimeDuration.cjs +72 -0
- package/dist/hooks/useTimeDuration.js +70 -0
- package/dist/hooks/useViewportFill.cjs +82 -0
- package/dist/hooks/useViewportFill.js +80 -0
- package/dist/index.cjs +161 -12908
- package/dist/index.css +67 -7357
- package/dist/index.d.ts +0 -58
- package/dist/index.js +24 -12809
- package/dist/styles/animation.cjs +9 -0
- package/dist/styles/animation.js +7 -0
- package/dist/styles/themes/dbc/colors.css +5 -0
- package/dist/styles/themes/types.cjs +2 -0
- package/dist/styles/themes/types.js +1 -0
- package/dist/tanstack.cjs +18 -2717
- package/dist/tanstack.js +3 -2701
- package/dist/types/a11y-props.types.cjs +2 -0
- package/dist/types/a11y-props.types.js +1 -0
- package/dist/types/assets.d.cjs +2 -0
- package/dist/types/assets.d.js +1 -0
- package/dist/types/css.d.cjs +2 -0
- package/dist/types/css.d.js +1 -0
- package/dist/types/sizes.types.cjs +2 -0
- package/dist/types/sizes.types.js +1 -0
- package/dist/utils/arrays/nested-filtering.cjs +40 -0
- package/dist/utils/arrays/nested-filtering.js +38 -0
- package/dist/utils/date/formatDate.cjs +35 -0
- package/dist/utils/date/formatDate.js +33 -0
- package/dist/utils/localStorage.utils.cjs +53 -0
- package/dist/utils/localStorage.utils.js +49 -0
- package/dist/utils/text/get-highlighted-segments.cjs +49 -0
- package/dist/utils/text/get-highlighted-segments.js +47 -0
- package/package.json +8 -3
- package/dist/tanstack.css +0 -1385
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var styles = require('./Menu.module.css');
|
|
7
|
+
var Checkbox = require('../forms/checkbox/Checkbox');
|
|
8
|
+
var RadioButton = require('../forms/radio-buttons/RadioButton');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
32
|
+
|
|
33
|
+
const INTERACTIVE_SELECTOR = 'a:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"]):not([aria-disabled="true"]), [role="menuitem"]:not([aria-disabled="true"]), [role="option"]:not([aria-disabled="true"])';
|
|
34
|
+
function getMenuItems(el) {
|
|
35
|
+
return Array.from(el.querySelectorAll(INTERACTIVE_SELECTOR));
|
|
36
|
+
}
|
|
37
|
+
const MenuBase = React__namespace.forwardRef(
|
|
38
|
+
({ children, className, itemRole = "menuitem", gap, onKeyDown, ...props }, ref) => {
|
|
39
|
+
const internalRef = React__namespace.useRef(null);
|
|
40
|
+
const handleKeyDown = (e) => {
|
|
41
|
+
const ul = internalRef.current;
|
|
42
|
+
if (!ul) return;
|
|
43
|
+
const items = getMenuItems(ul);
|
|
44
|
+
if (items.length === 0) return;
|
|
45
|
+
const focused = document.activeElement;
|
|
46
|
+
const currentIndex = items.indexOf(focused);
|
|
47
|
+
let nextIndex = null;
|
|
48
|
+
if (e.key === "ArrowDown") {
|
|
49
|
+
nextIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
|
|
50
|
+
} else if (e.key === "ArrowUp") {
|
|
51
|
+
nextIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
|
|
52
|
+
} else if (e.key === "Home") {
|
|
53
|
+
nextIndex = 0;
|
|
54
|
+
} else if (e.key === "End") {
|
|
55
|
+
nextIndex = items.length - 1;
|
|
56
|
+
}
|
|
57
|
+
if (nextIndex !== null) {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
items[nextIndex].focus();
|
|
60
|
+
}
|
|
61
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"ul",
|
|
65
|
+
{
|
|
66
|
+
ref: (node) => {
|
|
67
|
+
internalRef.current = node;
|
|
68
|
+
if (typeof ref === "function") ref(node);
|
|
69
|
+
else if (ref) ref.current = node;
|
|
70
|
+
},
|
|
71
|
+
role: "menu",
|
|
72
|
+
"data-itemrole": itemRole,
|
|
73
|
+
className: [styles__default.default.container, gap ? styles__default.default.gap : "", className].filter(Boolean).join(" "),
|
|
74
|
+
onKeyDown: handleKeyDown,
|
|
75
|
+
...props,
|
|
76
|
+
children
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
MenuBase.displayName = "Menu";
|
|
82
|
+
const isInteractiveEl = (el) => React__namespace.isValidElement(el) && (typeof el.type === "string" ? el.type === "a" || el.type === "button" : true);
|
|
83
|
+
function applyMenuItemPropsToElement(child, opts) {
|
|
84
|
+
var _a, _b, _c, _d;
|
|
85
|
+
const { active, selected, disabled, role, tabIndex = 0, className } = opts;
|
|
86
|
+
const childClass = [styles__default.default.item, active ? styles__default.default.active : "", selected ? styles__default.default.selected : ""].filter(Boolean).join(" ");
|
|
87
|
+
const nextImmediate = React__namespace.cloneElement(child, {
|
|
88
|
+
className: [child.props.className, styles__default.default.interactiveChild, className].filter(Boolean).join(" ")
|
|
89
|
+
});
|
|
90
|
+
if (typeof child.type === "string" && (child.type === "a" || child.type === "button")) {
|
|
91
|
+
return React__namespace.cloneElement(child, {
|
|
92
|
+
role: (_a = child.props.role) != null ? _a : role,
|
|
93
|
+
tabIndex: (_b = child.props.tabIndex) != null ? _b : tabIndex,
|
|
94
|
+
"aria-selected": selected || void 0,
|
|
95
|
+
"aria-disabled": disabled || void 0,
|
|
96
|
+
className: [child.props.className, styles__default.default.interactive, childClass, className].filter(Boolean).join(" "),
|
|
97
|
+
...child.type === "button" ? { disabled } : {}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return React__namespace.cloneElement(nextImmediate, {
|
|
101
|
+
role: (_c = nextImmediate.props.role) != null ? _c : role,
|
|
102
|
+
tabIndex: (_d = nextImmediate.props.tabIndex) != null ? _d : tabIndex,
|
|
103
|
+
"aria-selected": selected || void 0,
|
|
104
|
+
"aria-disabled": disabled || void 0,
|
|
105
|
+
className: [nextImmediate.props.className, styles__default.default.interactive, childClass].filter(Boolean).join(" "),
|
|
106
|
+
disabled
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const MenuItem = React__namespace.forwardRef(
|
|
110
|
+
({ children, active, selected, disabled, className, itemRole, variant, ...liProps }, ref) => {
|
|
111
|
+
const resolvedRole = itemRole != null ? itemRole : "menuitem";
|
|
112
|
+
const isBordered = variant === "bordered";
|
|
113
|
+
const itemClassName = variant === "danger" ? styles__default.default.itemDanger : void 0;
|
|
114
|
+
const rowClass = [styles__default.default.row, isBordered ? styles__default.default.rowBordered : "", className].filter(Boolean).join(" ");
|
|
115
|
+
if (isInteractiveEl(children)) {
|
|
116
|
+
const child = children;
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, role: "none", className: rowClass, ...liProps, children: applyMenuItemPropsToElement(child, {
|
|
118
|
+
active,
|
|
119
|
+
selected,
|
|
120
|
+
disabled,
|
|
121
|
+
role: resolvedRole,
|
|
122
|
+
className: itemClassName
|
|
123
|
+
}) });
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { ref, role: "none", className: rowClass, ...liProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
"button",
|
|
127
|
+
{
|
|
128
|
+
role: resolvedRole,
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
"aria-selected": selected || void 0,
|
|
131
|
+
"aria-disabled": disabled || void 0,
|
|
132
|
+
className: [
|
|
133
|
+
styles__default.default.interactive,
|
|
134
|
+
styles__default.default.item,
|
|
135
|
+
itemClassName,
|
|
136
|
+
active ? styles__default.default.active : "",
|
|
137
|
+
selected ? styles__default.default.selected : ""
|
|
138
|
+
].filter(Boolean).join(" "),
|
|
139
|
+
type: "button",
|
|
140
|
+
disabled,
|
|
141
|
+
children
|
|
142
|
+
}
|
|
143
|
+
) });
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
MenuItem.displayName = "Menu.Item";
|
|
147
|
+
const MenuCheckItem = React__namespace.forwardRef(
|
|
148
|
+
({
|
|
149
|
+
label,
|
|
150
|
+
checked,
|
|
151
|
+
active,
|
|
152
|
+
disabled,
|
|
153
|
+
interactiveRef,
|
|
154
|
+
interactiveProps,
|
|
155
|
+
onCheckedChange,
|
|
156
|
+
className,
|
|
157
|
+
...liProps
|
|
158
|
+
}, ref) => {
|
|
159
|
+
const isSelected = checked;
|
|
160
|
+
const interactiveClass = [
|
|
161
|
+
styles__default.default.interactiveChild,
|
|
162
|
+
styles__default.default.item,
|
|
163
|
+
active ? styles__default.default.active : "",
|
|
164
|
+
isSelected ? styles__default.default.selected : ""
|
|
165
|
+
].filter(Boolean).join(" ");
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
"li",
|
|
168
|
+
{
|
|
169
|
+
ref,
|
|
170
|
+
role: "none",
|
|
171
|
+
className: [styles__default.default.row, className].filter(Boolean).join(" "),
|
|
172
|
+
...liProps,
|
|
173
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
ref: interactiveRef,
|
|
177
|
+
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
178
|
+
tabIndex: -1,
|
|
179
|
+
"aria-selected": isSelected || void 0,
|
|
180
|
+
"aria-disabled": disabled || void 0,
|
|
181
|
+
className: interactiveClass,
|
|
182
|
+
...interactiveProps,
|
|
183
|
+
onClick: (event) => {
|
|
184
|
+
var _a;
|
|
185
|
+
(_a = interactiveProps == null ? void 0 : interactiveProps.onClick) == null ? void 0 : _a.call(interactiveProps, event);
|
|
186
|
+
if (event.defaultPrevented || disabled) return;
|
|
187
|
+
const target = event.target;
|
|
188
|
+
if (target instanceof Element && target.closest("button") !== null) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
onCheckedChange == null ? void 0 : onCheckedChange(!checked);
|
|
192
|
+
},
|
|
193
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
Checkbox.Checkbox,
|
|
195
|
+
{
|
|
196
|
+
variant: "primary",
|
|
197
|
+
size: "sm",
|
|
198
|
+
noContainer: true,
|
|
199
|
+
checked,
|
|
200
|
+
disabled,
|
|
201
|
+
labelAs: "span",
|
|
202
|
+
label,
|
|
203
|
+
onChange: (next, _e) => onCheckedChange == null ? void 0 : onCheckedChange(next)
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
MenuCheckItem.displayName = "Menu.CheckItem";
|
|
213
|
+
const MenuRadioItem = React__namespace.forwardRef(
|
|
214
|
+
({ name, value, checked, disabled, label, onValueChange, className, ...liProps }, ref) => {
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
"li",
|
|
217
|
+
{
|
|
218
|
+
ref,
|
|
219
|
+
role: "none",
|
|
220
|
+
className: [styles__default.default.row, className].filter(Boolean).join(" "),
|
|
221
|
+
...liProps,
|
|
222
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: styles__default.default.interactiveChild,
|
|
226
|
+
onClick: (event) => {
|
|
227
|
+
var _a;
|
|
228
|
+
if (disabled) return;
|
|
229
|
+
const target = event.target;
|
|
230
|
+
if ((_a = target.closest("label")) != null ? _a : target.closest("input")) return;
|
|
231
|
+
onValueChange == null ? void 0 : onValueChange(value);
|
|
232
|
+
},
|
|
233
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
234
|
+
RadioButton.RadioButton,
|
|
235
|
+
{
|
|
236
|
+
noContainer: true,
|
|
237
|
+
name,
|
|
238
|
+
size: "sm",
|
|
239
|
+
value,
|
|
240
|
+
checked,
|
|
241
|
+
disabled,
|
|
242
|
+
label,
|
|
243
|
+
onChange: (v, _e) => onValueChange == null ? void 0 : onValueChange(v)
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
MenuRadioItem.displayName = "Menu.RadioItem";
|
|
253
|
+
const MenuSeparator = React__namespace.forwardRef(
|
|
254
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
+
"li",
|
|
256
|
+
{
|
|
257
|
+
ref,
|
|
258
|
+
role: "separator",
|
|
259
|
+
className: [styles__default.default.separator, className].filter(Boolean).join(" "),
|
|
260
|
+
...props
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
MenuSeparator.displayName = "Menu.Separator";
|
|
265
|
+
const MenuHeader = React__namespace.forwardRef(
|
|
266
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
267
|
+
"li",
|
|
268
|
+
{
|
|
269
|
+
ref,
|
|
270
|
+
role: "presentation",
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
className: [styles__default.default.header, className].filter(Boolean).join(" "),
|
|
273
|
+
...props,
|
|
274
|
+
children
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
MenuHeader.displayName = "Menu.Header";
|
|
279
|
+
const Menu = Object.assign(MenuBase, {
|
|
280
|
+
Item: MenuItem,
|
|
281
|
+
CheckItem: MenuCheckItem,
|
|
282
|
+
RadioItem: MenuRadioItem,
|
|
283
|
+
Separator: MenuSeparator,
|
|
284
|
+
Header: MenuHeader
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
exports.Menu = Menu;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import styles from './Menu.module.css';
|
|
5
|
+
import { Checkbox } from '../forms/checkbox/Checkbox';
|
|
6
|
+
import { RadioButton } from '../forms/radio-buttons/RadioButton';
|
|
7
|
+
|
|
8
|
+
const INTERACTIVE_SELECTOR = 'a:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"]):not([aria-disabled="true"]), [role="menuitem"]:not([aria-disabled="true"]), [role="option"]:not([aria-disabled="true"])';
|
|
9
|
+
function getMenuItems(el) {
|
|
10
|
+
return Array.from(el.querySelectorAll(INTERACTIVE_SELECTOR));
|
|
11
|
+
}
|
|
12
|
+
const MenuBase = React.forwardRef(
|
|
13
|
+
({ children, className, itemRole = "menuitem", gap, onKeyDown, ...props }, ref) => {
|
|
14
|
+
const internalRef = React.useRef(null);
|
|
15
|
+
const handleKeyDown = (e) => {
|
|
16
|
+
const ul = internalRef.current;
|
|
17
|
+
if (!ul) return;
|
|
18
|
+
const items = getMenuItems(ul);
|
|
19
|
+
if (items.length === 0) return;
|
|
20
|
+
const focused = document.activeElement;
|
|
21
|
+
const currentIndex = items.indexOf(focused);
|
|
22
|
+
let nextIndex = null;
|
|
23
|
+
if (e.key === "ArrowDown") {
|
|
24
|
+
nextIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
|
|
25
|
+
} else if (e.key === "ArrowUp") {
|
|
26
|
+
nextIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
|
|
27
|
+
} else if (e.key === "Home") {
|
|
28
|
+
nextIndex = 0;
|
|
29
|
+
} else if (e.key === "End") {
|
|
30
|
+
nextIndex = items.length - 1;
|
|
31
|
+
}
|
|
32
|
+
if (nextIndex !== null) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
items[nextIndex].focus();
|
|
35
|
+
}
|
|
36
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
"ul",
|
|
40
|
+
{
|
|
41
|
+
ref: (node) => {
|
|
42
|
+
internalRef.current = node;
|
|
43
|
+
if (typeof ref === "function") ref(node);
|
|
44
|
+
else if (ref) ref.current = node;
|
|
45
|
+
},
|
|
46
|
+
role: "menu",
|
|
47
|
+
"data-itemrole": itemRole,
|
|
48
|
+
className: [styles.container, gap ? styles.gap : "", className].filter(Boolean).join(" "),
|
|
49
|
+
onKeyDown: handleKeyDown,
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
MenuBase.displayName = "Menu";
|
|
57
|
+
const isInteractiveEl = (el) => React.isValidElement(el) && (typeof el.type === "string" ? el.type === "a" || el.type === "button" : true);
|
|
58
|
+
function applyMenuItemPropsToElement(child, opts) {
|
|
59
|
+
var _a, _b, _c, _d;
|
|
60
|
+
const { active, selected, disabled, role, tabIndex = 0, className } = opts;
|
|
61
|
+
const childClass = [styles.item, active ? styles.active : "", selected ? styles.selected : ""].filter(Boolean).join(" ");
|
|
62
|
+
const nextImmediate = React.cloneElement(child, {
|
|
63
|
+
className: [child.props.className, styles.interactiveChild, className].filter(Boolean).join(" ")
|
|
64
|
+
});
|
|
65
|
+
if (typeof child.type === "string" && (child.type === "a" || child.type === "button")) {
|
|
66
|
+
return React.cloneElement(child, {
|
|
67
|
+
role: (_a = child.props.role) != null ? _a : role,
|
|
68
|
+
tabIndex: (_b = child.props.tabIndex) != null ? _b : tabIndex,
|
|
69
|
+
"aria-selected": selected || void 0,
|
|
70
|
+
"aria-disabled": disabled || void 0,
|
|
71
|
+
className: [child.props.className, styles.interactive, childClass, className].filter(Boolean).join(" "),
|
|
72
|
+
...child.type === "button" ? { disabled } : {}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return React.cloneElement(nextImmediate, {
|
|
76
|
+
role: (_c = nextImmediate.props.role) != null ? _c : role,
|
|
77
|
+
tabIndex: (_d = nextImmediate.props.tabIndex) != null ? _d : tabIndex,
|
|
78
|
+
"aria-selected": selected || void 0,
|
|
79
|
+
"aria-disabled": disabled || void 0,
|
|
80
|
+
className: [nextImmediate.props.className, styles.interactive, childClass].filter(Boolean).join(" "),
|
|
81
|
+
disabled
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const MenuItem = React.forwardRef(
|
|
85
|
+
({ children, active, selected, disabled, className, itemRole, variant, ...liProps }, ref) => {
|
|
86
|
+
const resolvedRole = itemRole != null ? itemRole : "menuitem";
|
|
87
|
+
const isBordered = variant === "bordered";
|
|
88
|
+
const itemClassName = variant === "danger" ? styles.itemDanger : void 0;
|
|
89
|
+
const rowClass = [styles.row, isBordered ? styles.rowBordered : "", className].filter(Boolean).join(" ");
|
|
90
|
+
if (isInteractiveEl(children)) {
|
|
91
|
+
const child = children;
|
|
92
|
+
return /* @__PURE__ */ jsx("li", { ref, role: "none", className: rowClass, ...liProps, children: applyMenuItemPropsToElement(child, {
|
|
93
|
+
active,
|
|
94
|
+
selected,
|
|
95
|
+
disabled,
|
|
96
|
+
role: resolvedRole,
|
|
97
|
+
className: itemClassName
|
|
98
|
+
}) });
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ jsx("li", { ref, role: "none", className: rowClass, ...liProps, children: /* @__PURE__ */ jsx(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
role: resolvedRole,
|
|
104
|
+
tabIndex: 0,
|
|
105
|
+
"aria-selected": selected || void 0,
|
|
106
|
+
"aria-disabled": disabled || void 0,
|
|
107
|
+
className: [
|
|
108
|
+
styles.interactive,
|
|
109
|
+
styles.item,
|
|
110
|
+
itemClassName,
|
|
111
|
+
active ? styles.active : "",
|
|
112
|
+
selected ? styles.selected : ""
|
|
113
|
+
].filter(Boolean).join(" "),
|
|
114
|
+
type: "button",
|
|
115
|
+
disabled,
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
MenuItem.displayName = "Menu.Item";
|
|
122
|
+
const MenuCheckItem = React.forwardRef(
|
|
123
|
+
({
|
|
124
|
+
label,
|
|
125
|
+
checked,
|
|
126
|
+
active,
|
|
127
|
+
disabled,
|
|
128
|
+
interactiveRef,
|
|
129
|
+
interactiveProps,
|
|
130
|
+
onCheckedChange,
|
|
131
|
+
className,
|
|
132
|
+
...liProps
|
|
133
|
+
}, ref) => {
|
|
134
|
+
const isSelected = checked;
|
|
135
|
+
const interactiveClass = [
|
|
136
|
+
styles.interactiveChild,
|
|
137
|
+
styles.item,
|
|
138
|
+
active ? styles.active : "",
|
|
139
|
+
isSelected ? styles.selected : ""
|
|
140
|
+
].filter(Boolean).join(" ");
|
|
141
|
+
return /* @__PURE__ */ jsx(
|
|
142
|
+
"li",
|
|
143
|
+
{
|
|
144
|
+
ref,
|
|
145
|
+
role: "none",
|
|
146
|
+
className: [styles.row, className].filter(Boolean).join(" "),
|
|
147
|
+
...liProps,
|
|
148
|
+
children: /* @__PURE__ */ jsx(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
ref: interactiveRef,
|
|
152
|
+
role: interactiveProps == null ? void 0 : interactiveProps.role,
|
|
153
|
+
tabIndex: -1,
|
|
154
|
+
"aria-selected": isSelected || void 0,
|
|
155
|
+
"aria-disabled": disabled || void 0,
|
|
156
|
+
className: interactiveClass,
|
|
157
|
+
...interactiveProps,
|
|
158
|
+
onClick: (event) => {
|
|
159
|
+
var _a;
|
|
160
|
+
(_a = interactiveProps == null ? void 0 : interactiveProps.onClick) == null ? void 0 : _a.call(interactiveProps, event);
|
|
161
|
+
if (event.defaultPrevented || disabled) return;
|
|
162
|
+
const target = event.target;
|
|
163
|
+
if (target instanceof Element && target.closest("button") !== null) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
onCheckedChange == null ? void 0 : onCheckedChange(!checked);
|
|
167
|
+
},
|
|
168
|
+
children: /* @__PURE__ */ jsx(
|
|
169
|
+
Checkbox,
|
|
170
|
+
{
|
|
171
|
+
variant: "primary",
|
|
172
|
+
size: "sm",
|
|
173
|
+
noContainer: true,
|
|
174
|
+
checked,
|
|
175
|
+
disabled,
|
|
176
|
+
labelAs: "span",
|
|
177
|
+
label,
|
|
178
|
+
onChange: (next, _e) => onCheckedChange == null ? void 0 : onCheckedChange(next)
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
MenuCheckItem.displayName = "Menu.CheckItem";
|
|
188
|
+
const MenuRadioItem = React.forwardRef(
|
|
189
|
+
({ name, value, checked, disabled, label, onValueChange, className, ...liProps }, ref) => {
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
"li",
|
|
192
|
+
{
|
|
193
|
+
ref,
|
|
194
|
+
role: "none",
|
|
195
|
+
className: [styles.row, className].filter(Boolean).join(" "),
|
|
196
|
+
...liProps,
|
|
197
|
+
children: /* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: styles.interactiveChild,
|
|
201
|
+
onClick: (event) => {
|
|
202
|
+
var _a;
|
|
203
|
+
if (disabled) return;
|
|
204
|
+
const target = event.target;
|
|
205
|
+
if ((_a = target.closest("label")) != null ? _a : target.closest("input")) return;
|
|
206
|
+
onValueChange == null ? void 0 : onValueChange(value);
|
|
207
|
+
},
|
|
208
|
+
children: /* @__PURE__ */ jsx(
|
|
209
|
+
RadioButton,
|
|
210
|
+
{
|
|
211
|
+
noContainer: true,
|
|
212
|
+
name,
|
|
213
|
+
size: "sm",
|
|
214
|
+
value,
|
|
215
|
+
checked,
|
|
216
|
+
disabled,
|
|
217
|
+
label,
|
|
218
|
+
onChange: (v, _e) => onValueChange == null ? void 0 : onValueChange(v)
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
MenuRadioItem.displayName = "Menu.RadioItem";
|
|
228
|
+
const MenuSeparator = React.forwardRef(
|
|
229
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
230
|
+
"li",
|
|
231
|
+
{
|
|
232
|
+
ref,
|
|
233
|
+
role: "separator",
|
|
234
|
+
className: [styles.separator, className].filter(Boolean).join(" "),
|
|
235
|
+
...props
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
);
|
|
239
|
+
MenuSeparator.displayName = "Menu.Separator";
|
|
240
|
+
const MenuHeader = React.forwardRef(
|
|
241
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
242
|
+
"li",
|
|
243
|
+
{
|
|
244
|
+
ref,
|
|
245
|
+
role: "presentation",
|
|
246
|
+
"aria-hidden": "true",
|
|
247
|
+
className: [styles.header, className].filter(Boolean).join(" "),
|
|
248
|
+
...props,
|
|
249
|
+
children
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
MenuHeader.displayName = "Menu.Header";
|
|
254
|
+
const Menu = Object.assign(MenuBase, {
|
|
255
|
+
Item: MenuItem,
|
|
256
|
+
CheckItem: MenuCheckItem,
|
|
257
|
+
RadioItem: MenuRadioItem,
|
|
258
|
+
Separator: MenuSeparator,
|
|
259
|
+
Header: MenuHeader
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export { Menu };
|