@dbcdk/react-components 0.0.167 → 0.0.169
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/package.json +1 -1
- package/dist/assets/logo.cjs +0 -87
- package/dist/assets/logo.d.ts +0 -2
- package/dist/assets/logo.js +0 -85
- package/dist/client.cjs +0 -629
- package/dist/client.d.ts +0 -89
- package/dist/client.js +0 -90
- package/dist/components/accordion/Accordion.cjs +0 -127
- package/dist/components/accordion/Accordion.d.ts +0 -36
- package/dist/components/accordion/Accordion.js +0 -121
- package/dist/components/accordion/Accordion.module.css +0 -41
- package/dist/components/accordion/components/AccordionRow.cjs +0 -129
- package/dist/components/accordion/components/AccordionRow.d.ts +0 -14
- package/dist/components/accordion/components/AccordionRow.js +0 -123
- package/dist/components/accordion/components/AccordionRow.module.css +0 -129
- package/dist/components/alert/Alert.cjs +0 -52
- package/dist/components/alert/Alert.d.ts +0 -14
- package/dist/components/alert/Alert.js +0 -46
- package/dist/components/alert/Alert.module.css +0 -102
- package/dist/components/app-header/AppHeader.cjs +0 -14
- package/dist/components/app-header/AppHeader.d.ts +0 -8
- package/dist/components/app-header/AppHeader.js +0 -8
- package/dist/components/app-header/AppHeader.module.css +0 -74
- package/dist/components/attribute-chip/AttributeChip.cjs +0 -36
- package/dist/components/attribute-chip/AttributeChip.d.ts +0 -11
- package/dist/components/attribute-chip/AttributeChip.js +0 -30
- package/dist/components/attribute-chip/AttributeChip.module.css +0 -64
- package/dist/components/avatar/Avatar.cjs +0 -111
- package/dist/components/avatar/Avatar.d.ts +0 -17
- package/dist/components/avatar/Avatar.js +0 -86
- package/dist/components/avatar/Avatar.module.css +0 -91
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -24
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +0 -12
- package/dist/components/breadcrumbs/Breadcrumbs.js +0 -18
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -77
- package/dist/components/button/Button.cjs +0 -150
- package/dist/components/button/Button.d.ts +0 -18
- package/dist/components/button/Button.js +0 -125
- package/dist/components/button/Button.module.css +0 -266
- package/dist/components/button-select/ButtonSelect.cjs +0 -35
- package/dist/components/button-select/ButtonSelect.d.ts +0 -16
- package/dist/components/button-select/ButtonSelect.js +0 -29
- package/dist/components/button-select/ButtonSelect.module.css +0 -40
- package/dist/components/card/Card.cjs +0 -109
- package/dist/components/card/Card.d.ts +0 -37
- package/dist/components/card/Card.js +0 -103
- package/dist/components/card/Card.module.css +0 -191
- package/dist/components/card/components/CardMeta.cjs +0 -62
- package/dist/components/card/components/CardMeta.d.ts +0 -16
- package/dist/components/card/components/CardMeta.js +0 -55
- package/dist/components/card/components/CardMeta.module.css +0 -55
- package/dist/components/card-container/CardContainer.cjs +0 -34
- package/dist/components/card-container/CardContainer.d.ts +0 -12
- package/dist/components/card-container/CardContainer.js +0 -28
- package/dist/components/card-container/CardContainer.module.css +0 -63
- package/dist/components/chip/Chip.cjs +0 -65
- package/dist/components/chip/Chip.d.ts +0 -16
- package/dist/components/chip/Chip.js +0 -59
- package/dist/components/chip/Chip.module.css +0 -247
- package/dist/components/circle/Circle.cjs +0 -39
- package/dist/components/circle/Circle.d.ts +0 -14
- package/dist/components/circle/Circle.js +0 -33
- package/dist/components/circle/Circle.module.css +0 -138
- package/dist/components/clear-button/ClearButton.cjs +0 -33
- package/dist/components/clear-button/ClearButton.d.ts +0 -8
- package/dist/components/clear-button/ClearButton.js +0 -27
- package/dist/components/clear-button/ClearButton.module.css +0 -26
- package/dist/components/code-block/CodeBlock.cjs +0 -107
- package/dist/components/code-block/CodeBlock.d.ts +0 -11
- package/dist/components/code-block/CodeBlock.js +0 -101
- package/dist/components/code-block/CodeBlock.module.css +0 -135
- package/dist/components/copy-button/CopyButton.cjs +0 -139
- package/dist/components/copy-button/CopyButton.d.ts +0 -13
- package/dist/components/copy-button/CopyButton.js +0 -133
- package/dist/components/copy-button/CopyButton.module.css +0 -22
- package/dist/components/datetime-picker/DateTimePicker.cjs +0 -563
- package/dist/components/datetime-picker/DateTimePicker.d.ts +0 -66
- package/dist/components/datetime-picker/DateTimePicker.js +0 -557
- package/dist/components/datetime-picker/DateTimePicker.module.css +0 -155
- package/dist/components/datetime-picker/dateTimeHelpers.cjs +0 -185
- package/dist/components/datetime-picker/dateTimeHelpers.d.ts +0 -37
- package/dist/components/datetime-picker/dateTimeHelpers.js +0 -166
- package/dist/components/divider/Divider.cjs +0 -22
- package/dist/components/divider/Divider.d.ts +0 -5
- package/dist/components/divider/Divider.js +0 -20
- package/dist/components/environment-banner/EnvironmentBanner.cjs +0 -20
- package/dist/components/environment-banner/EnvironmentBanner.d.ts +0 -13
- package/dist/components/environment-banner/EnvironmentBanner.js +0 -14
- package/dist/components/environment-banner/EnvironmentBanner.module.css +0 -54
- package/dist/components/filter-field/FilterField.cjs +0 -291
- package/dist/components/filter-field/FilterField.d.ts +0 -37
- package/dist/components/filter-field/FilterField.js +0 -284
- package/dist/components/filter-field/FilterField.module.css +0 -379
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.cjs +0 -115
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +0 -35
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +0 -108
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +0 -59
- package/dist/components/forms/checkbox/Checkbox.cjs +0 -99
- package/dist/components/forms/checkbox/Checkbox.d.ts +0 -39
- package/dist/components/forms/checkbox/Checkbox.js +0 -93
- package/dist/components/forms/checkbox/Checkbox.module.css +0 -110
- package/dist/components/forms/checkbox-group/CheckboxGroup.cjs +0 -121
- package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +0 -47
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +0 -115
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +0 -115
- package/dist/components/forms/file-upload/FileUpload.cjs +0 -127
- package/dist/components/forms/file-upload/FileUpload.d.ts +0 -18
- package/dist/components/forms/file-upload/FileUpload.js +0 -121
- package/dist/components/forms/file-upload/FileUpload.module.css +0 -75
- package/dist/components/forms/form-select/FormSelect.cjs +0 -191
- package/dist/components/forms/form-select/FormSelect.d.ts +0 -35
- package/dist/components/forms/form-select/FormSelect.js +0 -166
- package/dist/components/forms/form-select/FormSelect.module.css +0 -236
- package/dist/components/forms/input/Input.cjs +0 -190
- package/dist/components/forms/input/Input.d.ts +0 -37
- package/dist/components/forms/input/Input.js +0 -184
- package/dist/components/forms/input/Input.module.css +0 -478
- package/dist/components/forms/input-container/InputContainer.cjs +0 -72
- package/dist/components/forms/input-container/InputContainer.d.ts +0 -18
- package/dist/components/forms/input-container/InputContainer.js +0 -66
- package/dist/components/forms/input-container/InputContainer.module.css +0 -59
- package/dist/components/forms/multi-select/MultiSelect.cjs +0 -229
- package/dist/components/forms/multi-select/MultiSelect.d.ts +0 -26
- package/dist/components/forms/multi-select/MultiSelect.js +0 -227
- package/dist/components/forms/radio-buttons/RadioButton.cjs +0 -94
- package/dist/components/forms/radio-buttons/RadioButton.d.ts +0 -46
- package/dist/components/forms/radio-buttons/RadioButton.js +0 -88
- package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +0 -74
- package/dist/components/forms/radio-buttons/RadioButtonGroup.d.ts +0 -25
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +0 -72
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +0 -131
- package/dist/components/forms/select/Select.cjs +0 -287
- package/dist/components/forms/select/Select.d.ts +0 -24
- package/dist/components/forms/select/Select.js +0 -281
- package/dist/components/forms/select/Select.module.css +0 -41
- package/dist/components/forms/switch/Switch.cjs +0 -93
- package/dist/components/forms/switch/Switch.d.ts +0 -37
- package/dist/components/forms/switch/Switch.js +0 -87
- package/dist/components/forms/switch/Switch.module.css +0 -89
- package/dist/components/forms/text-area/Textarea.cjs +0 -118
- package/dist/components/forms/text-area/Textarea.d.ts +0 -17
- package/dist/components/forms/text-area/Textarea.js +0 -112
- package/dist/components/forms/text-area/Textarea.module.css +0 -70
- package/dist/components/forms/typeahead/Typeahead.cjs +0 -792
- package/dist/components/forms/typeahead/Typeahead.d.ts +0 -40
- package/dist/components/forms/typeahead/Typeahead.js +0 -768
- package/dist/components/forms/typeahead/Typeahead.module.css +0 -38
- package/dist/components/grid/Grid.cjs +0 -58
- package/dist/components/grid/Grid.d.ts +0 -29
- package/dist/components/grid/Grid.js +0 -51
- package/dist/components/grid/Grid.module.css +0 -44
- package/dist/components/headline/CollapsibleHeadline.cjs +0 -84
- package/dist/components/headline/CollapsibleHeadline.d.ts +0 -25
- package/dist/components/headline/CollapsibleHeadline.js +0 -78
- package/dist/components/headline/Headline.cjs +0 -59
- package/dist/components/headline/Headline.d.ts +0 -20
- package/dist/components/headline/Headline.js +0 -53
- package/dist/components/headline/Headline.module.css +0 -167
- package/dist/components/highlighted-text/HighlightedText.cjs +0 -21
- package/dist/components/highlighted-text/HighlightedText.d.ts +0 -7
- package/dist/components/highlighted-text/HighlightedText.js +0 -19
- package/dist/components/hyperlink/Hyperlink.cjs +0 -113
- package/dist/components/hyperlink/Hyperlink.d.ts +0 -24
- package/dist/components/hyperlink/Hyperlink.js +0 -88
- package/dist/components/hyperlink/Hyperlink.module.css +0 -121
- package/dist/components/icon/Icon.cjs +0 -39
- package/dist/components/icon/Icon.d.ts +0 -14
- package/dist/components/icon/Icon.js +0 -32
- package/dist/components/icon/Icon.module.css +0 -50
- package/dist/components/inline-status/InlineStatus.cjs +0 -39
- package/dist/components/inline-status/InlineStatus.d.ts +0 -11
- package/dist/components/inline-status/InlineStatus.js +0 -33
- package/dist/components/inline-status/InlineStatus.module.css +0 -98
- package/dist/components/interval-select/IntervalSelect.cjs +0 -203
- package/dist/components/interval-select/IntervalSelect.d.ts +0 -37
- package/dist/components/interval-select/IntervalSelect.js +0 -201
- package/dist/components/json-viewer/JsonNode.cjs +0 -124
- package/dist/components/json-viewer/JsonNode.d.ts +0 -3
- package/dist/components/json-viewer/JsonNode.js +0 -118
- package/dist/components/json-viewer/JsonViewer.cjs +0 -164
- package/dist/components/json-viewer/JsonViewer.d.ts +0 -4
- package/dist/components/json-viewer/JsonViewer.js +0 -158
- package/dist/components/json-viewer/JsonViewer.module.css +0 -346
- package/dist/components/json-viewer/types.cjs +0 -2
- package/dist/components/json-viewer/types.d.ts +0 -33
- package/dist/components/json-viewer/types.js +0 -1
- package/dist/components/json-viewer/useClipboardStatus.cjs +0 -15
- package/dist/components/json-viewer/useClipboardStatus.d.ts +0 -4
- package/dist/components/json-viewer/useClipboardStatus.js +0 -13
- package/dist/components/json-viewer/utils.cjs +0 -126
- package/dist/components/json-viewer/utils.d.ts +0 -17
- package/dist/components/json-viewer/utils.js +0 -111
- package/dist/components/lightbox/Lightbox.cjs +0 -291
- package/dist/components/lightbox/Lightbox.d.ts +0 -36
- package/dist/components/lightbox/Lightbox.js +0 -285
- package/dist/components/lightbox/Lightbox.module.css +0 -214
- package/dist/components/media-card/MediaCard.cjs +0 -87
- package/dist/components/media-card/MediaCard.d.ts +0 -21
- package/dist/components/media-card/MediaCard.js +0 -80
- package/dist/components/media-card/MediaCard.module.css +0 -91
- package/dist/components/menu/Menu.cjs +0 -455
- package/dist/components/menu/Menu.d.ts +0 -102
- package/dist/components/menu/Menu.js +0 -430
- package/dist/components/menu/Menu.module.css +0 -286
- package/dist/components/meta-bar/MetaBar.cjs +0 -28
- package/dist/components/meta-bar/MetaBar.d.ts +0 -12
- package/dist/components/meta-bar/MetaBar.js +0 -22
- package/dist/components/meta-bar/MetaBar.module.css +0 -27
- package/dist/components/metric-tile/MetricTile.cjs +0 -33
- package/dist/components/metric-tile/MetricTile.d.ts +0 -15
- package/dist/components/metric-tile/MetricTile.js +0 -27
- package/dist/components/metric-tile/MetricTile.module.css +0 -103
- package/dist/components/nav-bar/NavBar.cjs +0 -107
- package/dist/components/nav-bar/NavBar.d.ts +0 -44
- package/dist/components/nav-bar/NavBar.js +0 -101
- package/dist/components/nav-bar/NavBar.module.css +0 -243
- package/dist/components/overlay/fade-overlay/FadeOverlay.cjs +0 -30
- package/dist/components/overlay/fade-overlay/FadeOverlay.d.ts +0 -13
- package/dist/components/overlay/fade-overlay/FadeOverlay.js +0 -24
- package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +0 -54
- package/dist/components/overlay/modal/Modal.cjs +0 -191
- package/dist/components/overlay/modal/Modal.d.ts +0 -29
- package/dist/components/overlay/modal/Modal.js +0 -185
- package/dist/components/overlay/modal/Modal.module.css +0 -112
- package/dist/components/overlay/modal/provider/ModalProvider.cjs +0 -98
- package/dist/components/overlay/modal/provider/ModalProvider.d.ts +0 -23
- package/dist/components/overlay/modal/provider/ModalProvider.js +0 -95
- package/dist/components/overlay/side-panel/SidePanel.cjs +0 -173
- package/dist/components/overlay/side-panel/SidePanel.d.ts +0 -25
- package/dist/components/overlay/side-panel/SidePanel.js +0 -167
- package/dist/components/overlay/side-panel/SidePanel.module.css +0 -177
- package/dist/components/overlay/side-panel/useSidePanel.cjs +0 -16
- package/dist/components/overlay/side-panel/useSidePanel.d.ts +0 -5
- package/dist/components/overlay/side-panel/useSidePanel.js +0 -14
- package/dist/components/overlay/tooltip/Tooltip.cjs +0 -56
- package/dist/components/overlay/tooltip/Tooltip.d.ts +0 -12
- package/dist/components/overlay/tooltip/Tooltip.js +0 -54
- package/dist/components/overlay/tooltip/Tooltip.module.css +0 -104
- package/dist/components/overlay/tooltip/TooltipProvider.cjs +0 -238
- package/dist/components/overlay/tooltip/TooltipProvider.d.ts +0 -20
- package/dist/components/overlay/tooltip/TooltipProvider.js +0 -231
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +0 -117
- package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +0 -28
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +0 -115
- package/dist/components/page/Page.cjs +0 -64
- package/dist/components/page/Page.d.ts +0 -21
- package/dist/components/page/Page.js +0 -58
- package/dist/components/page/Page.module.css +0 -95
- package/dist/components/page-layout/PageLayout.cjs +0 -126
- package/dist/components/page-layout/PageLayout.d.ts +0 -47
- package/dist/components/page-layout/PageLayout.js +0 -120
- package/dist/components/page-layout/PageLayout.module.css +0 -333
- package/dist/components/page-layout/components/footer/Footer.cjs +0 -53
- package/dist/components/page-layout/components/footer/Footer.d.ts +0 -14
- package/dist/components/page-layout/components/footer/Footer.js +0 -47
- package/dist/components/page-layout/components/footer/Footer.module.css +0 -86
- package/dist/components/pagination/Pagination.cjs +0 -161
- package/dist/components/pagination/Pagination.d.ts +0 -21
- package/dist/components/pagination/Pagination.js +0 -155
- package/dist/components/pagination/Pagination.module.css +0 -25
- package/dist/components/panel/Panel.cjs +0 -38
- package/dist/components/panel/Panel.d.ts +0 -13
- package/dist/components/panel/Panel.js +0 -32
- package/dist/components/panel/Panel.module.css +0 -30
- package/dist/components/popover/Popover.cjs +0 -331
- package/dist/components/popover/Popover.d.ts +0 -27
- package/dist/components/popover/Popover.js +0 -307
- package/dist/components/popover/Popover.module.css +0 -52
- package/dist/components/search-box/SearchBox.cjs +0 -297
- package/dist/components/search-box/SearchBox.d.ts +0 -30
- package/dist/components/search-box/SearchBox.js +0 -291
- package/dist/components/search-box/SearchBox.module.css +0 -27
- package/dist/components/section-label/SectionLabel.cjs +0 -18
- package/dist/components/section-label/SectionLabel.d.ts +0 -5
- package/dist/components/section-label/SectionLabel.js +0 -12
- package/dist/components/section-label/SectionLabel.module.css +0 -12
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -130
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +0 -27
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +0 -124
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +0 -187
- package/dist/components/sidebar/Sidebar.cjs +0 -41
- package/dist/components/sidebar/Sidebar.d.ts +0 -23
- package/dist/components/sidebar/Sidebar.js +0 -39
- package/dist/components/sidebar/components/SidebarItem.cjs +0 -29
- package/dist/components/sidebar/components/SidebarItem.d.ts +0 -11
- package/dist/components/sidebar/components/SidebarItem.js +0 -27
- package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -153
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +0 -13
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +0 -147
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -47
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +0 -220
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +0 -18
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +0 -213
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -293
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -54
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +0 -13
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +0 -47
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +0 -117
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -61
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +0 -4
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +0 -55
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -20
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -96
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.d.ts +0 -7
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +0 -90
- package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -223
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +0 -34
- package/dist/components/sidebar/providers/SidebarProvider.js +0 -220
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -442
- package/dist/components/skeleton-loader/SkeletonLoader.d.ts +0 -9
- package/dist/components/skeleton-loader/SkeletonLoader.js +0 -440
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.d.ts +0 -11
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +0 -36
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -55
- package/dist/components/split-button/SplitButton.cjs +0 -46
- package/dist/components/split-button/SplitButton.d.ts +0 -16
- package/dist/components/split-button/SplitButton.js +0 -40
- package/dist/components/split-button/SplitButton.module.css +0 -32
- package/dist/components/split-pane/SplitPane.cjs +0 -191
- package/dist/components/split-pane/SplitPane.d.ts +0 -21
- package/dist/components/split-pane/SplitPane.js +0 -182
- package/dist/components/split-pane/SplitPane.module.css +0 -118
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +0 -129
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +0 -24
- package/dist/components/split-pane/provider/SplitPaneContext.js +0 -121
- package/dist/components/stack/Stack.cjs +0 -56
- package/dist/components/stack/Stack.d.ts +0 -26
- package/dist/components/stack/Stack.js +0 -50
- package/dist/components/stack/Stack.module.css +0 -77
- package/dist/components/state-page/StatePage.cjs +0 -48
- package/dist/components/state-page/StatePage.d.ts +0 -10
- package/dist/components/state-page/StatePage.js +0 -42
- package/dist/components/state-page/StatePage.module.css +0 -9
- package/dist/components/state-page/empty.cjs +0 -664
- package/dist/components/state-page/empty.d.ts +0 -2
- package/dist/components/state-page/empty.js +0 -662
- package/dist/components/state-page/error.cjs +0 -310
- package/dist/components/state-page/error.d.ts +0 -2
- package/dist/components/state-page/error.js +0 -308
- package/dist/components/state-page/notFound.cjs +0 -243
- package/dist/components/state-page/notFound.d.ts +0 -2
- package/dist/components/state-page/notFound.js +0 -241
- package/dist/components/sticky-footer-layout/StickyFooterLayout.cjs +0 -98
- package/dist/components/sticky-footer-layout/StickyFooterLayout.d.ts +0 -14
- package/dist/components/sticky-footer-layout/StickyFooterLayout.js +0 -96
- package/dist/components/table/Table.cjs +0 -240
- package/dist/components/table/Table.d.ts +0 -4
- package/dist/components/table/Table.js +0 -234
- package/dist/components/table/Table.module.css +0 -704
- package/dist/components/table/Table.types.cjs +0 -2
- package/dist/components/table/Table.types.d.ts +0 -91
- package/dist/components/table/Table.types.js +0 -1
- package/dist/components/table/TanstackTable.cjs +0 -191
- package/dist/components/table/TanstackTable.d.ts +0 -15
- package/dist/components/table/TanstackTable.js +0 -166
- package/dist/components/table/components/TableBody.cjs +0 -58
- package/dist/components/table/components/TableBody.d.ts +0 -28
- package/dist/components/table/components/TableBody.js +0 -52
- package/dist/components/table/components/TableHeader.cjs +0 -56
- package/dist/components/table/components/TableHeader.d.ts +0 -16
- package/dist/components/table/components/TableHeader.js +0 -50
- package/dist/components/table/components/TableHeaderCell.cjs +0 -68
- package/dist/components/table/components/TableHeaderCell.d.ts +0 -12
- package/dist/components/table/components/TableHeaderCell.js +0 -62
- package/dist/components/table/components/TablePagination.cjs +0 -2
- package/dist/components/table/components/TablePagination.d.ts +0 -0
- package/dist/components/table/components/TablePagination.js +0 -1
- package/dist/components/table/components/TableRow.cjs +0 -287
- package/dist/components/table/components/TableRow.d.ts +0 -28
- package/dist/components/table/components/TableRow.js +0 -281
- package/dist/components/table/components/TableSelectionCell.cjs +0 -41
- package/dist/components/table/components/TableSelectionCell.d.ts +0 -9
- package/dist/components/table/components/TableSelectionCell.js +0 -35
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -25
- package/dist/components/table/components/column-resizer/ColumnResizer.d.ts +0 -7
- package/dist/components/table/components/column-resizer/ColumnResizer.js +0 -19
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +0 -24
- package/dist/components/table/components/empty-state/EmptyState.cjs +0 -33
- package/dist/components/table/components/empty-state/EmptyState.d.ts +0 -21
- package/dist/components/table/components/empty-state/EmptyState.js +0 -31
- package/dist/components/table/components/empty-state/EmptyState.module.css +0 -4
- package/dist/components/table/components/table-settings/TableSettings.cjs +0 -139
- package/dist/components/table/components/table-settings/TableSettings.d.ts +0 -18
- package/dist/components/table/components/table-settings/TableSettings.js +0 -137
- package/dist/components/table/hooks/useTableRowInteractions.cjs +0 -47
- package/dist/components/table/hooks/useTableRowInteractions.d.ts +0 -15
- package/dist/components/table/hooks/useTableRowInteractions.js +0 -45
- package/dist/components/table/table.classes.cjs +0 -49
- package/dist/components/table/table.classes.d.ts +0 -10
- package/dist/components/table/table.classes.js +0 -40
- package/dist/components/table/table.utils.cjs +0 -59
- package/dist/components/table/table.utils.d.ts +0 -18
- package/dist/components/table/table.utils.js +0 -46
- package/dist/components/table/tanstackTable.utils.cjs +0 -181
- package/dist/components/table/tanstackTable.utils.d.ts +0 -29
- package/dist/components/table/tanstackTable.utils.js +0 -174
- package/dist/components/tabs/Tabs.cjs +0 -187
- package/dist/components/tabs/Tabs.d.ts +0 -52
- package/dist/components/tabs/Tabs.js +0 -181
- package/dist/components/tabs/Tabs.module.css +0 -263
- package/dist/components/theme-button/ThemeButton.cjs +0 -75
- package/dist/components/theme-button/ThemeButton.d.ts +0 -8
- package/dist/components/theme-button/ThemeButton.js +0 -72
- package/dist/components/toast/Toast.cjs +0 -68
- package/dist/components/toast/Toast.d.ts +0 -15
- package/dist/components/toast/Toast.js +0 -62
- package/dist/components/toast/Toast.module.css +0 -165
- package/dist/components/toast/provider/ToastProvider.cjs +0 -105
- package/dist/components/toast/provider/ToastProvider.d.ts +0 -24
- package/dist/components/toast/provider/ToastProvider.js +0 -97
- package/dist/components/user-display/UserDisplay.cjs +0 -22
- package/dist/components/user-display/UserDisplay.d.ts +0 -10
- package/dist/components/user-display/UserDisplay.js +0 -16
- package/dist/components/user-display/UserDisplay.module.css +0 -25
- package/dist/constants/chart-colors.cjs +0 -10
- package/dist/constants/chart-colors.d.ts +0 -2
- package/dist/constants/chart-colors.js +0 -8
- package/dist/constants/chart-colors.types.cjs +0 -2
- package/dist/constants/chart-colors.types.d.ts +0 -3
- package/dist/constants/chart-colors.types.js +0 -1
- package/dist/constants/severity.cjs +0 -33
- package/dist/constants/severity.d.ts +0 -4
- package/dist/constants/severity.js +0 -29
- package/dist/constants/severity.types.cjs +0 -2
- package/dist/constants/severity.types.d.ts +0 -1
- package/dist/constants/severity.types.js +0 -1
- package/dist/constants/sizes.cjs +0 -11
- package/dist/constants/sizes.d.ts +0 -2
- package/dist/constants/sizes.js +0 -9
- package/dist/hooks/useDeviceSize.cjs +0 -33
- package/dist/hooks/useDeviceSize.d.ts +0 -2
- package/dist/hooks/useDeviceSize.js +0 -31
- package/dist/hooks/useListNavigation.cjs +0 -237
- package/dist/hooks/useListNavigation.d.ts +0 -24
- package/dist/hooks/useListNavigation.js +0 -235
- package/dist/hooks/usePagination.cjs +0 -144
- package/dist/hooks/usePagination.d.ts +0 -38
- package/dist/hooks/usePagination.js +0 -142
- package/dist/hooks/usePersistentState.cjs +0 -60
- package/dist/hooks/usePersistentState.d.ts +0 -33
- package/dist/hooks/usePersistentState.js +0 -58
- package/dist/hooks/useSorting.cjs +0 -120
- package/dist/hooks/useSorting.d.ts +0 -50
- package/dist/hooks/useSorting.js +0 -117
- package/dist/hooks/useTableData.cjs +0 -75
- package/dist/hooks/useTableData.d.ts +0 -42
- package/dist/hooks/useTableData.js +0 -73
- package/dist/hooks/useTableSelection.cjs +0 -172
- package/dist/hooks/useTableSelection.d.ts +0 -27
- package/dist/hooks/useTableSelection.js +0 -170
- package/dist/hooks/useTableSettings.cjs +0 -90
- package/dist/hooks/useTableSettings.d.ts +0 -26
- package/dist/hooks/useTableSettings.js +0 -87
- package/dist/hooks/useTheme.cjs +0 -64
- package/dist/hooks/useTheme.d.ts +0 -7
- package/dist/hooks/useTheme.js +0 -62
- package/dist/hooks/useTimeDuration.cjs +0 -75
- package/dist/hooks/useTimeDuration.d.ts +0 -26
- package/dist/hooks/useTimeDuration.js +0 -73
- package/dist/hooks/useViewportFill.cjs +0 -82
- package/dist/hooks/useViewportFill.d.ts +0 -13
- package/dist/hooks/useViewportFill.js +0 -80
- package/dist/index.cjs +0 -292
- package/dist/index.css +0 -75
- package/dist/index.d.ts +0 -42
- package/dist/index.js +0 -41
- package/dist/styles/animation.cjs +0 -9
- package/dist/styles/animation.d.ts +0 -5
- package/dist/styles/animation.js +0 -7
- package/dist/styles/css-helper-classes/flex.css +0 -113
- package/dist/styles/css-helper-classes/spacing.css +0 -312
- package/dist/styles/css-helper-classes/typography.css +0 -11
- package/dist/styles/fonts/Roboto/OFL.txt +0 -93
- package/dist/styles/fonts/Roboto/README.txt +0 -118
- package/dist/styles/fonts/Roboto/Roboto-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Tajawal/OFL.txt +0 -93
- package/dist/styles/fonts/Tajawal/Tajawal-Black.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Bold.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Light.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Medium.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Regular.ttf +0 -0
- package/dist/styles/styles.css +0 -377
- package/dist/styles/themes/dbc/base.css +0 -141
- package/dist/styles/themes/dbc/colors.css +0 -320
- package/dist/styles/themes/filmstriben-budget/theme.css +0 -22
- package/dist/styles/themes/types.cjs +0 -2
- package/dist/styles/themes/types.d.ts +0 -16
- package/dist/styles/themes/types.js +0 -1
- package/dist/styles.css +0 -377
- package/dist/tanstack.cjs +0 -26
- package/dist/tanstack.d.ts +0 -3
- package/dist/tanstack.js +0 -3
- package/dist/themes/dbc.css +0 -3
- package/dist/themes/filmstriben-budget.css +0 -3
- package/dist/types/a11y-props.types.cjs +0 -2
- package/dist/types/a11y-props.types.d.ts +0 -8
- package/dist/types/a11y-props.types.js +0 -1
- package/dist/types/assets.d.cjs +0 -2
- package/dist/types/assets.d.js +0 -1
- package/dist/types/css.d.cjs +0 -2
- package/dist/types/css.d.js +0 -1
- package/dist/types/sizes.types.cjs +0 -2
- package/dist/types/sizes.types.d.ts +0 -2
- package/dist/types/sizes.types.js +0 -1
- package/dist/utils/arrays/nested-filtering.cjs +0 -40
- package/dist/utils/arrays/nested-filtering.d.ts +0 -9
- package/dist/utils/arrays/nested-filtering.js +0 -38
- package/dist/utils/cookie.utils.cjs +0 -44
- package/dist/utils/cookie.utils.d.ts +0 -19
- package/dist/utils/cookie.utils.js +0 -40
- package/dist/utils/date/formatDate.cjs +0 -49
- package/dist/utils/date/formatDate.d.ts +0 -28
- package/dist/utils/date/formatDate.js +0 -47
- package/dist/utils/localStorage.utils.cjs +0 -53
- package/dist/utils/localStorage.utils.d.ts +0 -19
- package/dist/utils/localStorage.utils.js +0 -49
- package/dist/utils/text/get-highlighted-segments.cjs +0 -49
- package/dist/utils/text/get-highlighted-segments.d.ts +0 -5
- package/dist/utils/text/get-highlighted-segments.js +0 -47
|
@@ -1,768 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useRef, useId, useMemo, useState, useLayoutEffect, useEffect } from 'react';
|
|
5
|
-
import { Chip } from '../../../components/chip/Chip';
|
|
6
|
-
import { Input } from '../../../components/forms/input/Input';
|
|
7
|
-
import { Menu } from '../../../components/menu/Menu';
|
|
8
|
-
import { Popover } from '../../../components/popover/Popover';
|
|
9
|
-
import styles from './Typeahead.module.css';
|
|
10
|
-
|
|
11
|
-
function parseLengthToPx(value, referenceFontSize = 16) {
|
|
12
|
-
if (!value) return 0;
|
|
13
|
-
const trimmed = value.trim();
|
|
14
|
-
if (!trimmed) return 0;
|
|
15
|
-
if (trimmed.endsWith("px")) {
|
|
16
|
-
const n2 = Number.parseFloat(trimmed);
|
|
17
|
-
return Number.isFinite(n2) ? n2 : 0;
|
|
18
|
-
}
|
|
19
|
-
if (trimmed.endsWith("rem")) {
|
|
20
|
-
const n2 = Number.parseFloat(trimmed);
|
|
21
|
-
if (!Number.isFinite(n2)) return 0;
|
|
22
|
-
const rootFont = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || "16");
|
|
23
|
-
return n2 * (Number.isFinite(rootFont) ? rootFont : 16);
|
|
24
|
-
}
|
|
25
|
-
if (trimmed.endsWith("em")) {
|
|
26
|
-
const n2 = Number.parseFloat(trimmed);
|
|
27
|
-
return Number.isFinite(n2) ? n2 * referenceFontSize : 0;
|
|
28
|
-
}
|
|
29
|
-
const n = Number.parseFloat(trimmed);
|
|
30
|
-
return Number.isFinite(n) ? n : 0;
|
|
31
|
-
}
|
|
32
|
-
function getOuterWidthWithMargins(element) {
|
|
33
|
-
if (!(element instanceof HTMLElement)) return 0;
|
|
34
|
-
const rect = element.getBoundingClientRect();
|
|
35
|
-
const styles2 = window.getComputedStyle(element);
|
|
36
|
-
const marginLeft = Number.parseFloat(styles2.marginLeft || "0");
|
|
37
|
-
const marginRight = Number.parseFloat(styles2.marginRight || "0");
|
|
38
|
-
return Math.ceil(rect.width + marginLeft + marginRight);
|
|
39
|
-
}
|
|
40
|
-
function getInputFontShorthand(inputStyles) {
|
|
41
|
-
return inputStyles.font || [
|
|
42
|
-
inputStyles.fontStyle,
|
|
43
|
-
inputStyles.fontVariant,
|
|
44
|
-
inputStyles.fontWeight,
|
|
45
|
-
inputStyles.fontStretch,
|
|
46
|
-
inputStyles.fontSize,
|
|
47
|
-
inputStyles.lineHeight !== "normal" ? `/${inputStyles.lineHeight}` : "",
|
|
48
|
-
inputStyles.fontFamily
|
|
49
|
-
].filter(Boolean).join(" ");
|
|
50
|
-
}
|
|
51
|
-
function measureFitContentWidth(input, text, minWidth) {
|
|
52
|
-
const field = input.closest('[data-forminput="field"]');
|
|
53
|
-
if (!field) return null;
|
|
54
|
-
const inputStyles = window.getComputedStyle(input);
|
|
55
|
-
const fieldStyles = window.getComputedStyle(field);
|
|
56
|
-
const canvas = document.createElement("canvas");
|
|
57
|
-
const ctx = canvas.getContext("2d");
|
|
58
|
-
if (!ctx) return null;
|
|
59
|
-
ctx.font = getInputFontShorthand(inputStyles);
|
|
60
|
-
const textWidth = Math.ceil(ctx.measureText(text).width);
|
|
61
|
-
const inputFontSize = Number.parseFloat(inputStyles.fontSize || "16");
|
|
62
|
-
const inputPaddingLeft = Number.parseFloat(inputStyles.paddingLeft || "0");
|
|
63
|
-
const inputPaddingRight = Number.parseFloat(inputStyles.paddingRight || "0");
|
|
64
|
-
const borderLeft = Number.parseFloat(fieldStyles.borderLeftWidth || "0");
|
|
65
|
-
const borderRight = Number.parseFloat(fieldStyles.borderRightWidth || "0");
|
|
66
|
-
const startAdornmentWidth = getOuterWidthWithMargins(
|
|
67
|
-
field.querySelector('[data-input-role="start-adornment"]')
|
|
68
|
-
);
|
|
69
|
-
const endAdornmentWidth = getOuterWidthWithMargins(
|
|
70
|
-
field.querySelector('[data-input-role="end-adornment"]')
|
|
71
|
-
);
|
|
72
|
-
const iconWidth = getOuterWidthWithMargins(field.querySelector('[data-input-role="icon"]'));
|
|
73
|
-
const breathingRoom = 6;
|
|
74
|
-
const nextWidth = Math.ceil(
|
|
75
|
-
borderLeft + borderRight + iconWidth + startAdornmentWidth + inputPaddingLeft + textWidth + breathingRoom + inputPaddingRight + endAdornmentWidth
|
|
76
|
-
);
|
|
77
|
-
return Math.max(parseLengthToPx(minWidth, inputFontSize) || 120, nextWidth);
|
|
78
|
-
}
|
|
79
|
-
function Typeahead({
|
|
80
|
-
options,
|
|
81
|
-
mode = "single",
|
|
82
|
-
multiValueDisplayMode = "chips",
|
|
83
|
-
multiSelectedValuesDisplayMode = "hidden",
|
|
84
|
-
multiSelectedValueChipContent = "label",
|
|
85
|
-
selectedValue = null,
|
|
86
|
-
onChange,
|
|
87
|
-
placeholder,
|
|
88
|
-
variant = "outlined",
|
|
89
|
-
disabled = false,
|
|
90
|
-
fullWidth = false,
|
|
91
|
-
onClear,
|
|
92
|
-
emptyMessage = "Ingen resultater",
|
|
93
|
-
filterOptions,
|
|
94
|
-
inputProps,
|
|
95
|
-
inputSize,
|
|
96
|
-
width,
|
|
97
|
-
minWidth,
|
|
98
|
-
popoverWidth,
|
|
99
|
-
autoComplete,
|
|
100
|
-
autoCorrect,
|
|
101
|
-
autoCapitalize,
|
|
102
|
-
spellCheck,
|
|
103
|
-
popoverAnchorRef,
|
|
104
|
-
fitContent = false,
|
|
105
|
-
enableHotkey = false
|
|
106
|
-
}) {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
const rootRef = useRef(null);
|
|
109
|
-
const triggerWrapperRef = useRef(null);
|
|
110
|
-
const inputRef = useRef(null);
|
|
111
|
-
const popoverContentRef = useRef(null);
|
|
112
|
-
const interactingWithOptionsRef = useRef(false);
|
|
113
|
-
const justClearedRef = useRef(false);
|
|
114
|
-
const locallyClearedRef = useRef(false);
|
|
115
|
-
const listboxId = useId();
|
|
116
|
-
const {
|
|
117
|
-
onFocus: inputPropsOnFocus,
|
|
118
|
-
onBlur: inputPropsOnBlur,
|
|
119
|
-
onKeyDown: inputPropsOnKeyDown,
|
|
120
|
-
onMouseDown: inputPropsOnMouseDown,
|
|
121
|
-
onClear: inputPropsOnClear,
|
|
122
|
-
startAdornment: inputPropsStartAdornment,
|
|
123
|
-
endAdornment: inputPropsEndAdornment,
|
|
124
|
-
...passthroughInputProps
|
|
125
|
-
} = inputProps != null ? inputProps : {};
|
|
126
|
-
const selectedOption = useMemo(() => {
|
|
127
|
-
var _a2;
|
|
128
|
-
if (mode === "multi") return null;
|
|
129
|
-
return (_a2 = options.find((option) => option.value === selectedValue)) != null ? _a2 : null;
|
|
130
|
-
}, [options, selectedValue, mode]);
|
|
131
|
-
const selectedOptions = useMemo(() => {
|
|
132
|
-
if (mode !== "multi" || !Array.isArray(selectedValue)) return [];
|
|
133
|
-
return options.filter((option) => selectedValue.includes(option.value));
|
|
134
|
-
}, [options, selectedValue, mode]);
|
|
135
|
-
const [open, setOpen] = useState(false);
|
|
136
|
-
const [inputValue, setInputValue] = useState(
|
|
137
|
-
mode === "multi" ? "" : (_a = selectedOption == null ? void 0 : selectedOption.label) != null ? _a : ""
|
|
138
|
-
);
|
|
139
|
-
const [query, setQuery] = useState("");
|
|
140
|
-
const [activeIndex, setActiveIndex] = useState(-1);
|
|
141
|
-
const [hideSelectedHighlight, setHideSelectedHighlight] = useState(false);
|
|
142
|
-
const clearJustClearedAfterEventCycle = React.useCallback(() => {
|
|
143
|
-
requestAnimationFrame(() => {
|
|
144
|
-
justClearedRef.current = false;
|
|
145
|
-
});
|
|
146
|
-
}, []);
|
|
147
|
-
const getSelectedValueChipLabel = React.useCallback(
|
|
148
|
-
(option) => {
|
|
149
|
-
switch (multiSelectedValueChipContent) {
|
|
150
|
-
case "value":
|
|
151
|
-
return String(option.value);
|
|
152
|
-
case "value-label":
|
|
153
|
-
return `${String(option.value)} - ${option.label}`;
|
|
154
|
-
case "label":
|
|
155
|
-
default:
|
|
156
|
-
return option.label;
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
[multiSelectedValueChipContent]
|
|
160
|
-
);
|
|
161
|
-
let filteredOptions;
|
|
162
|
-
if (filterOptions) {
|
|
163
|
-
filteredOptions = filterOptions(options, query);
|
|
164
|
-
} else {
|
|
165
|
-
const normalizedQuery = query.trim().toLocaleLowerCase();
|
|
166
|
-
if (!normalizedQuery) {
|
|
167
|
-
filteredOptions = options;
|
|
168
|
-
} else {
|
|
169
|
-
filteredOptions = options.filter(
|
|
170
|
-
(option) => option.label.toLocaleLowerCase().includes(normalizedQuery)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const commitSelection = React.useCallback(
|
|
175
|
-
(option) => {
|
|
176
|
-
var _a2, _b2;
|
|
177
|
-
locallyClearedRef.current = false;
|
|
178
|
-
setHideSelectedHighlight(false);
|
|
179
|
-
if (mode === "multi") {
|
|
180
|
-
if (!option) return;
|
|
181
|
-
const nextValues = Array.isArray(selectedValue) ? [...selectedValue] : [];
|
|
182
|
-
const idx = nextValues.indexOf(option.value);
|
|
183
|
-
if (idx > -1) {
|
|
184
|
-
nextValues.splice(idx, 1);
|
|
185
|
-
} else {
|
|
186
|
-
nextValues.push(option.value);
|
|
187
|
-
}
|
|
188
|
-
onChange(nextValues);
|
|
189
|
-
if (filteredOptions.length > 1) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
setInputValue("");
|
|
193
|
-
setQuery("");
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
onChange((_a2 = option == null ? void 0 : option.value) != null ? _a2 : null);
|
|
197
|
-
setInputValue((_b2 = option == null ? void 0 : option.label) != null ? _b2 : "");
|
|
198
|
-
setQuery("");
|
|
199
|
-
setOpen(false);
|
|
200
|
-
setActiveIndex(-1);
|
|
201
|
-
},
|
|
202
|
-
[mode, selectedValue, onChange, filteredOptions.length]
|
|
203
|
-
);
|
|
204
|
-
const multiSelectionAdornment = mode === "multi" && selectedOptions.length > 0 ? multiValueDisplayMode === "count" ? /* @__PURE__ */ jsxs("span", { className: `dbc-muted-text dbc-sm-text ${styles.countAdornment}`, children: [
|
|
205
|
-
"(",
|
|
206
|
-
selectedOptions.length,
|
|
207
|
-
")"
|
|
208
|
-
] }) : (() => {
|
|
209
|
-
const MAX_CHIPS = 2;
|
|
210
|
-
const chipsToShow = selectedOptions.slice(0, MAX_CHIPS);
|
|
211
|
-
const extraCount = selectedOptions.length - MAX_CHIPS;
|
|
212
|
-
return /* @__PURE__ */ jsxs("div", { className: styles.chipRow, children: [
|
|
213
|
-
chipsToShow.map((option) => /* @__PURE__ */ jsx(
|
|
214
|
-
Chip,
|
|
215
|
-
{
|
|
216
|
-
size: "sm",
|
|
217
|
-
type: "rounded",
|
|
218
|
-
onClose: () => commitSelection(option),
|
|
219
|
-
children: option.label
|
|
220
|
-
},
|
|
221
|
-
option.value
|
|
222
|
-
)),
|
|
223
|
-
extraCount > 0 && /* @__PURE__ */ jsxs("span", { className: "dbc-muted-text dbc-sm-text dbc-px-xxs", children: [
|
|
224
|
-
"+",
|
|
225
|
-
extraCount
|
|
226
|
-
] })
|
|
227
|
-
] });
|
|
228
|
-
})() : void 0;
|
|
229
|
-
const usesCountAdornment = mode === "multi" && multiValueDisplayMode === "count" && selectedOptions.length > 0;
|
|
230
|
-
const resolvedInputSize = (_b = inputSize != null ? inputSize : inputProps == null ? void 0 : inputProps.inputSize) != null ? _b : "md";
|
|
231
|
-
const shouldFitContent = fitContent && mode === "single";
|
|
232
|
-
const [fittedWidthPx, setFittedWidthPx] = useState(null);
|
|
233
|
-
const visibleSingleValueText = useMemo(() => {
|
|
234
|
-
if (!shouldFitContent) return "";
|
|
235
|
-
return inputValue || (selectedOption == null ? void 0 : selectedOption.label) || placeholder || "";
|
|
236
|
-
}, [shouldFitContent, inputValue, selectedOption, placeholder]);
|
|
237
|
-
useLayoutEffect(() => {
|
|
238
|
-
if (!shouldFitContent) return;
|
|
239
|
-
const input = inputRef.current;
|
|
240
|
-
if (!input) return;
|
|
241
|
-
let cancelled = false;
|
|
242
|
-
const frameId = requestAnimationFrame(() => {
|
|
243
|
-
const nextWidth = measureFitContentWidth(input, visibleSingleValueText, minWidth);
|
|
244
|
-
if (!cancelled && nextWidth != null) {
|
|
245
|
-
setFittedWidthPx((current) => current !== nextWidth ? nextWidth : current);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
const fonts = document.fonts;
|
|
249
|
-
if (fonts == null ? void 0 : fonts.ready) {
|
|
250
|
-
void fonts.ready.then(() => {
|
|
251
|
-
if (cancelled) return;
|
|
252
|
-
const liveInput = inputRef.current;
|
|
253
|
-
if (!liveInput) return;
|
|
254
|
-
const nextWidth = measureFitContentWidth(liveInput, visibleSingleValueText, minWidth);
|
|
255
|
-
if (nextWidth != null) {
|
|
256
|
-
setFittedWidthPx((current) => current !== nextWidth ? nextWidth : current);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return () => {
|
|
261
|
-
cancelled = true;
|
|
262
|
-
cancelAnimationFrame(frameId);
|
|
263
|
-
};
|
|
264
|
-
}, [
|
|
265
|
-
shouldFitContent,
|
|
266
|
-
visibleSingleValueText,
|
|
267
|
-
minWidth,
|
|
268
|
-
inputPropsStartAdornment,
|
|
269
|
-
inputPropsEndAdornment
|
|
270
|
-
]);
|
|
271
|
-
const measuredRootWidth = useMemo(() => {
|
|
272
|
-
if (!shouldFitContent) return void 0;
|
|
273
|
-
if (fittedWidthPx == null) return minWidth != null ? minWidth : "120px";
|
|
274
|
-
return `${fittedWidthPx}px`;
|
|
275
|
-
}, [shouldFitContent, fittedWidthPx, minWidth]);
|
|
276
|
-
const shouldStretchInput = !width && (fullWidth || shouldFitContent);
|
|
277
|
-
useEffect(() => {
|
|
278
|
-
if (!enableHotkey) return;
|
|
279
|
-
function handleKeyDown2(event) {
|
|
280
|
-
var _a2;
|
|
281
|
-
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
282
|
-
event.preventDefault();
|
|
283
|
-
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
window.addEventListener("keydown", handleKeyDown2);
|
|
287
|
-
return () => window.removeEventListener("keydown", handleKeyDown2);
|
|
288
|
-
}, [enableHotkey]);
|
|
289
|
-
useEffect(() => {
|
|
290
|
-
var _a2;
|
|
291
|
-
if (justClearedRef.current || locallyClearedRef.current) return;
|
|
292
|
-
if (mode === "multi") {
|
|
293
|
-
setInputValue("");
|
|
294
|
-
setQuery("");
|
|
295
|
-
} else {
|
|
296
|
-
setInputValue((_a2 = selectedOption == null ? void 0 : selectedOption.label) != null ? _a2 : "");
|
|
297
|
-
}
|
|
298
|
-
}, [selectedOption, mode]);
|
|
299
|
-
const getSelectedIndex = React.useCallback(
|
|
300
|
-
(items) => {
|
|
301
|
-
if (items.length === 0) return -1;
|
|
302
|
-
if (locallyClearedRef.current) return 0;
|
|
303
|
-
if (mode === "multi") {
|
|
304
|
-
if (!Array.isArray(selectedValue) || selectedValue.length === 0) return 0;
|
|
305
|
-
const firstSelectedIndex = items.findIndex((option) => selectedValue.includes(option.value));
|
|
306
|
-
return firstSelectedIndex >= 0 ? firstSelectedIndex : 0;
|
|
307
|
-
}
|
|
308
|
-
const singleSelectedIndex = items.findIndex((option) => option.value === selectedValue);
|
|
309
|
-
return singleSelectedIndex >= 0 ? singleSelectedIndex : 0;
|
|
310
|
-
},
|
|
311
|
-
[mode, selectedValue]
|
|
312
|
-
);
|
|
313
|
-
useEffect(() => {
|
|
314
|
-
setActiveIndex((current) => {
|
|
315
|
-
if (filteredOptions.length === 0) return -1;
|
|
316
|
-
if (locallyClearedRef.current) return 0;
|
|
317
|
-
if (current < 0) return getSelectedIndex(filteredOptions);
|
|
318
|
-
return Math.min(current, filteredOptions.length - 1);
|
|
319
|
-
});
|
|
320
|
-
}, [filteredOptions, getSelectedIndex]);
|
|
321
|
-
useEffect(() => {
|
|
322
|
-
var _a2, _b2;
|
|
323
|
-
if (!open || activeIndex < 0) return;
|
|
324
|
-
const activeEl = (_a2 = document.getElementById(listboxId)) == null ? void 0 : _a2.querySelector(`#${CSS.escape(`${listboxId}-option-${activeIndex}`)}`);
|
|
325
|
-
(_b2 = activeEl == null ? void 0 : activeEl.scrollIntoView) == null ? void 0 : _b2.call(activeEl, { block: "nearest" });
|
|
326
|
-
}, [open, activeIndex, filteredOptions, listboxId]);
|
|
327
|
-
const getFocusableElements = React.useCallback(() => {
|
|
328
|
-
const selector = [
|
|
329
|
-
"a[href]",
|
|
330
|
-
"button:not([disabled])",
|
|
331
|
-
"input:not([disabled])",
|
|
332
|
-
"select:not([disabled])",
|
|
333
|
-
"textarea:not([disabled])",
|
|
334
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
335
|
-
].join(",");
|
|
336
|
-
const seen = /* @__PURE__ */ new Set();
|
|
337
|
-
const focusables = [];
|
|
338
|
-
for (const container of [rootRef.current, popoverContentRef.current]) {
|
|
339
|
-
if (!container) continue;
|
|
340
|
-
const elements = container.matches(selector) ? [container] : Array.from(container.querySelectorAll(selector));
|
|
341
|
-
for (const element of elements) {
|
|
342
|
-
if (seen.has(element) || element.getAttribute("aria-hidden") === "true" || element.tabIndex < 0) {
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
seen.add(element);
|
|
346
|
-
focusables.push(element);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return focusables;
|
|
350
|
-
}, []);
|
|
351
|
-
const isFocusWithinTypeahead = React.useCallback((target) => {
|
|
352
|
-
var _a2, _b2;
|
|
353
|
-
if (!(target instanceof Node)) return false;
|
|
354
|
-
return Boolean(((_a2 = rootRef.current) == null ? void 0 : _a2.contains(target)) || ((_b2 = popoverContentRef.current) == null ? void 0 : _b2.contains(target)));
|
|
355
|
-
}, []);
|
|
356
|
-
const handleTabKeyDown = React.useCallback(
|
|
357
|
-
(event) => {
|
|
358
|
-
var _a2, _b2, _c;
|
|
359
|
-
if (event.key !== "Tab" || !open) return;
|
|
360
|
-
const focusables = getFocusableElements();
|
|
361
|
-
if (focusables.length === 0) return;
|
|
362
|
-
const eventTarget = event.target instanceof HTMLElement ? event.target : document.activeElement;
|
|
363
|
-
const activeElement = eventTarget && focusables.includes(eventTarget) ? eventTarget : (_a2 = document.activeElement) != null ? _a2 : null;
|
|
364
|
-
const activeIndexInScope = activeElement ? focusables.indexOf(activeElement) : -1;
|
|
365
|
-
if (mode === "multi") {
|
|
366
|
-
if (activeIndexInScope === -1) {
|
|
367
|
-
event.preventDefault();
|
|
368
|
-
(_b2 = focusables[0]) == null ? void 0 : _b2.focus();
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
event.preventDefault();
|
|
372
|
-
const nextIndex = event.shiftKey ? (activeIndexInScope - 1 + focusables.length) % focusables.length : (activeIndexInScope + 1) % focusables.length;
|
|
373
|
-
(_c = focusables[nextIndex]) == null ? void 0 : _c.focus();
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
setOpen(false);
|
|
377
|
-
setActiveIndex(-1);
|
|
378
|
-
},
|
|
379
|
-
[open, getFocusableElements, mode]
|
|
380
|
-
);
|
|
381
|
-
const handleInputChange = (nextValue) => {
|
|
382
|
-
if (justClearedRef.current) return;
|
|
383
|
-
locallyClearedRef.current = false;
|
|
384
|
-
setHideSelectedHighlight(false);
|
|
385
|
-
setInputValue(nextValue);
|
|
386
|
-
setQuery(nextValue);
|
|
387
|
-
if (!open) setOpen(true);
|
|
388
|
-
if (mode === "multi") return;
|
|
389
|
-
const exactMatch = options.find((option) => option.label === nextValue);
|
|
390
|
-
if (!exactMatch && selectedValue !== null) {
|
|
391
|
-
onChange(null);
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
const handleBlur = (nextFocusedTarget) => {
|
|
395
|
-
if (justClearedRef.current || locallyClearedRef.current) {
|
|
396
|
-
setInputValue("");
|
|
397
|
-
setQuery("");
|
|
398
|
-
setOpen(false);
|
|
399
|
-
setActiveIndex(-1);
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (isFocusWithinTypeahead(nextFocusedTarget)) return;
|
|
403
|
-
if (mode === "multi") {
|
|
404
|
-
if (interactingWithOptionsRef.current) {
|
|
405
|
-
interactingWithOptionsRef.current = false;
|
|
406
|
-
setInputValue("");
|
|
407
|
-
setQuery("");
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
setInputValue("");
|
|
411
|
-
setQuery("");
|
|
412
|
-
setOpen(false);
|
|
413
|
-
setActiveIndex(-1);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const exactLabelMatch = options.find((option) => option.label === inputValue);
|
|
417
|
-
if (exactLabelMatch) {
|
|
418
|
-
commitSelection(exactLabelMatch);
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (selectedOption) {
|
|
422
|
-
setInputValue(selectedOption.label);
|
|
423
|
-
} else {
|
|
424
|
-
setInputValue("");
|
|
425
|
-
}
|
|
426
|
-
setQuery("");
|
|
427
|
-
setOpen(false);
|
|
428
|
-
setActiveIndex(-1);
|
|
429
|
-
};
|
|
430
|
-
const openWithAllOptions = React.useCallback(() => {
|
|
431
|
-
if (justClearedRef.current) return;
|
|
432
|
-
setQuery("");
|
|
433
|
-
setOpen(true);
|
|
434
|
-
setActiveIndex(getSelectedIndex(options));
|
|
435
|
-
}, [getSelectedIndex, options]);
|
|
436
|
-
const openWithCurrentFilter = React.useCallback(() => {
|
|
437
|
-
if (justClearedRef.current) return;
|
|
438
|
-
setOpen(true);
|
|
439
|
-
setActiveIndex(getSelectedIndex(filteredOptions));
|
|
440
|
-
}, [getSelectedIndex, filteredOptions]);
|
|
441
|
-
const prepareSingleSearchInput = React.useCallback(() => {
|
|
442
|
-
if (mode !== "single" || !selectedOption || justClearedRef.current) return;
|
|
443
|
-
setInputValue("");
|
|
444
|
-
setQuery("");
|
|
445
|
-
}, [mode, selectedOption]);
|
|
446
|
-
const handleOpen = React.useCallback(() => {
|
|
447
|
-
if (justClearedRef.current) return;
|
|
448
|
-
if (mode === "single" && selectedOption && !locallyClearedRef.current) {
|
|
449
|
-
prepareSingleSearchInput();
|
|
450
|
-
openWithAllOptions();
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
openWithCurrentFilter();
|
|
454
|
-
}, [mode, selectedOption, prepareSingleSearchInput, openWithAllOptions, openWithCurrentFilter]);
|
|
455
|
-
const handleTriggerMouseDown = React.useCallback(
|
|
456
|
-
(e) => {
|
|
457
|
-
var _a2;
|
|
458
|
-
inputPropsOnMouseDown == null ? void 0 : inputPropsOnMouseDown(e);
|
|
459
|
-
if (e.defaultPrevented) return;
|
|
460
|
-
if (justClearedRef.current) {
|
|
461
|
-
e.preventDefault();
|
|
462
|
-
e.stopPropagation();
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
const isAlreadyFocused = document.activeElement === inputRef.current;
|
|
466
|
-
if (isAlreadyFocused && open) {
|
|
467
|
-
e.preventDefault();
|
|
468
|
-
setOpen(false);
|
|
469
|
-
setActiveIndex(-1);
|
|
470
|
-
setQuery("");
|
|
471
|
-
setInputValue(
|
|
472
|
-
mode === "single" && !locallyClearedRef.current ? (_a2 = selectedOption == null ? void 0 : selectedOption.label) != null ? _a2 : "" : ""
|
|
473
|
-
);
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
if (isAlreadyFocused && mode === "single" && selectedOption && !locallyClearedRef.current) {
|
|
477
|
-
prepareSingleSearchInput();
|
|
478
|
-
setOpen(true);
|
|
479
|
-
setActiveIndex(getSelectedIndex(options));
|
|
480
|
-
} else if (isAlreadyFocused && !open) {
|
|
481
|
-
setOpen(true);
|
|
482
|
-
setActiveIndex(getSelectedIndex(filteredOptions));
|
|
483
|
-
}
|
|
484
|
-
},
|
|
485
|
-
[
|
|
486
|
-
inputPropsOnMouseDown,
|
|
487
|
-
open,
|
|
488
|
-
mode,
|
|
489
|
-
selectedOption,
|
|
490
|
-
prepareSingleSearchInput,
|
|
491
|
-
getSelectedIndex,
|
|
492
|
-
options,
|
|
493
|
-
filteredOptions
|
|
494
|
-
]
|
|
495
|
-
);
|
|
496
|
-
const handleChevronMouseDown = React.useCallback(
|
|
497
|
-
(e) => {
|
|
498
|
-
var _a2, _b2;
|
|
499
|
-
e.preventDefault();
|
|
500
|
-
e.stopPropagation();
|
|
501
|
-
if (justClearedRef.current) return;
|
|
502
|
-
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
503
|
-
if (open) {
|
|
504
|
-
setOpen(false);
|
|
505
|
-
setActiveIndex(-1);
|
|
506
|
-
setQuery("");
|
|
507
|
-
setInputValue(
|
|
508
|
-
mode === "single" && !locallyClearedRef.current ? (_b2 = selectedOption == null ? void 0 : selectedOption.label) != null ? _b2 : "" : ""
|
|
509
|
-
);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
handleOpen();
|
|
513
|
-
},
|
|
514
|
-
[open, mode, selectedOption, handleOpen]
|
|
515
|
-
);
|
|
516
|
-
const handleKeyDown = (e) => {
|
|
517
|
-
switch (e.key) {
|
|
518
|
-
case "ArrowDown":
|
|
519
|
-
e.preventDefault();
|
|
520
|
-
if (!open) {
|
|
521
|
-
handleOpen();
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
setActiveIndex((index) => {
|
|
525
|
-
if (filteredOptions.length === 0) return -1;
|
|
526
|
-
if (index < 0) return getSelectedIndex(filteredOptions);
|
|
527
|
-
return Math.min(index + 1, filteredOptions.length - 1);
|
|
528
|
-
});
|
|
529
|
-
return;
|
|
530
|
-
case "ArrowUp":
|
|
531
|
-
e.preventDefault();
|
|
532
|
-
if (!open) {
|
|
533
|
-
handleOpen();
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
setActiveIndex((index) => {
|
|
537
|
-
if (filteredOptions.length === 0) return -1;
|
|
538
|
-
if (index < 0) return filteredOptions.length - 1;
|
|
539
|
-
return Math.max(index - 1, 0);
|
|
540
|
-
});
|
|
541
|
-
return;
|
|
542
|
-
case "Home":
|
|
543
|
-
if (!open || filteredOptions.length === 0) return;
|
|
544
|
-
e.preventDefault();
|
|
545
|
-
setActiveIndex(0);
|
|
546
|
-
return;
|
|
547
|
-
case "End":
|
|
548
|
-
if (!open || filteredOptions.length === 0) return;
|
|
549
|
-
e.preventDefault();
|
|
550
|
-
setActiveIndex(filteredOptions.length - 1);
|
|
551
|
-
return;
|
|
552
|
-
case "Enter":
|
|
553
|
-
if (!open) return;
|
|
554
|
-
e.preventDefault();
|
|
555
|
-
if (activeIndex >= 0 && filteredOptions[activeIndex]) {
|
|
556
|
-
commitSelection(filteredOptions[activeIndex]);
|
|
557
|
-
}
|
|
558
|
-
return;
|
|
559
|
-
case "Escape":
|
|
560
|
-
e.preventDefault();
|
|
561
|
-
e.stopPropagation();
|
|
562
|
-
setOpen(false);
|
|
563
|
-
setActiveIndex(-1);
|
|
564
|
-
setQuery("");
|
|
565
|
-
setInputValue(
|
|
566
|
-
mode === "single" && selectedOption && !locallyClearedRef.current ? selectedOption.label : ""
|
|
567
|
-
);
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
return /* @__PURE__ */ jsxs(
|
|
572
|
-
"div",
|
|
573
|
-
{
|
|
574
|
-
ref: rootRef,
|
|
575
|
-
style: {
|
|
576
|
-
display: "flex",
|
|
577
|
-
flexDirection: "column",
|
|
578
|
-
gap: mode === "multi" && multiSelectedValuesDisplayMode === "below-input" && selectedOptions.length > 0 ? 8 : 0,
|
|
579
|
-
width: width != null ? width : fullWidth ? "100%" : shouldFitContent ? measuredRootWidth : void 0,
|
|
580
|
-
flex: width ? "0 0 auto" : fullWidth || shouldFitContent ? "1 1 auto" : void 0,
|
|
581
|
-
minWidth: width ? void 0 : shouldFitContent ? measuredRootWidth : 0,
|
|
582
|
-
maxWidth: width ? void 0 : shouldFitContent ? "100%" : void 0
|
|
583
|
-
},
|
|
584
|
-
children: [
|
|
585
|
-
/* @__PURE__ */ jsx(
|
|
586
|
-
Popover,
|
|
587
|
-
{
|
|
588
|
-
open,
|
|
589
|
-
minWidth: popoverWidth != null ? popoverWidth : minWidth,
|
|
590
|
-
matchTriggerWidth: true,
|
|
591
|
-
fillTrigger: true,
|
|
592
|
-
anchorRef: popoverAnchorRef != null ? popoverAnchorRef : triggerWrapperRef,
|
|
593
|
-
onOpenChange: (nextOpen) => {
|
|
594
|
-
if (justClearedRef.current) {
|
|
595
|
-
setOpen(false);
|
|
596
|
-
setActiveIndex(-1);
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
setOpen(nextOpen);
|
|
600
|
-
if (nextOpen) {
|
|
601
|
-
if (mode === "single" && selectedOption && !locallyClearedRef.current) {
|
|
602
|
-
setQuery("");
|
|
603
|
-
setActiveIndex(getSelectedIndex(options));
|
|
604
|
-
} else {
|
|
605
|
-
setActiveIndex(getSelectedIndex(filteredOptions));
|
|
606
|
-
}
|
|
607
|
-
} else {
|
|
608
|
-
setActiveIndex(-1);
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
fullWidth,
|
|
612
|
-
autoFocusContent: false,
|
|
613
|
-
returnFocus: false,
|
|
614
|
-
overlayRef: popoverContentRef,
|
|
615
|
-
trigger: (openPopover, icon) => {
|
|
616
|
-
var _a2, _b2, _c, _d;
|
|
617
|
-
return /* @__PURE__ */ jsx(
|
|
618
|
-
"div",
|
|
619
|
-
{
|
|
620
|
-
ref: triggerWrapperRef,
|
|
621
|
-
onMouseDown: (e) => {
|
|
622
|
-
const target = e.target;
|
|
623
|
-
if (justClearedRef.current) {
|
|
624
|
-
e.preventDefault();
|
|
625
|
-
e.stopPropagation();
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
if (target.closest('input, button, [data-input-role="clear"]')) return;
|
|
629
|
-
handleChevronMouseDown(e);
|
|
630
|
-
},
|
|
631
|
-
children: /* @__PURE__ */ jsx(
|
|
632
|
-
Input,
|
|
633
|
-
{
|
|
634
|
-
...passthroughInputProps,
|
|
635
|
-
ref: inputRef,
|
|
636
|
-
value: inputValue,
|
|
637
|
-
startAdornment: multiSelectionAdornment || inputPropsStartAdornment ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
638
|
-
multiSelectionAdornment,
|
|
639
|
-
inputPropsStartAdornment
|
|
640
|
-
] }) : void 0,
|
|
641
|
-
endAdornment: inputPropsEndAdornment || icon ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
642
|
-
inputPropsEndAdornment,
|
|
643
|
-
icon ? /* @__PURE__ */ jsx("span", { className: styles.chevronButton, onMouseDown: handleChevronMouseDown, children: icon }) : null
|
|
644
|
-
] }) : void 0,
|
|
645
|
-
onFocus: (e) => {
|
|
646
|
-
inputPropsOnFocus == null ? void 0 : inputPropsOnFocus(e);
|
|
647
|
-
if (e.defaultPrevented) return;
|
|
648
|
-
if (justClearedRef.current) return;
|
|
649
|
-
handleOpen();
|
|
650
|
-
openPopover(e);
|
|
651
|
-
},
|
|
652
|
-
onMouseDown: handleTriggerMouseDown,
|
|
653
|
-
onChange: (e) => handleInputChange(e.currentTarget.value),
|
|
654
|
-
onBlur: (e) => {
|
|
655
|
-
inputPropsOnBlur == null ? void 0 : inputPropsOnBlur(e);
|
|
656
|
-
if (e.defaultPrevented) return;
|
|
657
|
-
handleBlur(e.relatedTarget);
|
|
658
|
-
},
|
|
659
|
-
onKeyDown: (e) => {
|
|
660
|
-
inputPropsOnKeyDown == null ? void 0 : inputPropsOnKeyDown(e);
|
|
661
|
-
if (e.defaultPrevented) return;
|
|
662
|
-
handleTabKeyDown(e);
|
|
663
|
-
if (e.defaultPrevented) return;
|
|
664
|
-
handleKeyDown(e);
|
|
665
|
-
},
|
|
666
|
-
placeholder,
|
|
667
|
-
variant,
|
|
668
|
-
inputSize: resolvedInputSize,
|
|
669
|
-
width: width != null ? width : shouldFitContent ? void 0 : inputProps == null ? void 0 : inputProps.width,
|
|
670
|
-
autoComplete: (_a2 = autoComplete != null ? autoComplete : inputProps == null ? void 0 : inputProps.autoComplete) != null ? _a2 : "off",
|
|
671
|
-
autoCorrect: (_b2 = autoCorrect != null ? autoCorrect : inputProps == null ? void 0 : inputProps.autoCorrect) != null ? _b2 : "off",
|
|
672
|
-
autoCapitalize: (_c = autoCapitalize != null ? autoCapitalize : inputProps == null ? void 0 : inputProps.autoCapitalize) != null ? _c : "none",
|
|
673
|
-
spellCheck: (_d = spellCheck != null ? spellCheck : inputProps == null ? void 0 : inputProps.spellCheck) != null ? _d : false,
|
|
674
|
-
disabled,
|
|
675
|
-
fullWidth: shouldStretchInput,
|
|
676
|
-
inputClassName: [
|
|
677
|
-
inputProps == null ? void 0 : inputProps.inputClassName,
|
|
678
|
-
styles.typeaheadInput,
|
|
679
|
-
usesCountAdornment ? styles.inputWithoutStartPadding : ""
|
|
680
|
-
].filter(Boolean).join(" "),
|
|
681
|
-
onClear: (event) => {
|
|
682
|
-
var _a3, _b3;
|
|
683
|
-
(_a3 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a3.call(event);
|
|
684
|
-
(_b3 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _b3.call(event);
|
|
685
|
-
justClearedRef.current = true;
|
|
686
|
-
locallyClearedRef.current = true;
|
|
687
|
-
setHideSelectedHighlight(true);
|
|
688
|
-
setOpen(false);
|
|
689
|
-
setInputValue("");
|
|
690
|
-
setQuery("");
|
|
691
|
-
setActiveIndex(-1);
|
|
692
|
-
inputPropsOnClear == null ? void 0 : inputPropsOnClear();
|
|
693
|
-
if (onClear) {
|
|
694
|
-
onClear();
|
|
695
|
-
} else {
|
|
696
|
-
onChange(mode === "multi" ? [] : null);
|
|
697
|
-
}
|
|
698
|
-
clearJustClearedAfterEventCycle();
|
|
699
|
-
},
|
|
700
|
-
role: "combobox",
|
|
701
|
-
"aria-expanded": open,
|
|
702
|
-
"aria-controls": listboxId,
|
|
703
|
-
"aria-autocomplete": "list",
|
|
704
|
-
"aria-activedescendant": open && activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0
|
|
705
|
-
}
|
|
706
|
-
)
|
|
707
|
-
}
|
|
708
|
-
);
|
|
709
|
-
},
|
|
710
|
-
children: /* @__PURE__ */ jsx(Menu, { role: "listbox", id: listboxId, children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => {
|
|
711
|
-
const isActive = index === activeIndex;
|
|
712
|
-
const isSelected = mode === "multi" ? Array.isArray(selectedValue) && selectedValue.includes(option.value) : option.value === selectedValue && !hideSelectedHighlight;
|
|
713
|
-
const optionId = `${listboxId}-option-${index}`;
|
|
714
|
-
return mode === "multi" ? /* @__PURE__ */ jsx(
|
|
715
|
-
Menu.CheckItem,
|
|
716
|
-
{
|
|
717
|
-
checked: isSelected,
|
|
718
|
-
active: isActive,
|
|
719
|
-
interactiveProps: {
|
|
720
|
-
id: optionId,
|
|
721
|
-
role: "option",
|
|
722
|
-
onMouseEnter: () => setActiveIndex(index),
|
|
723
|
-
onMouseDown: (e) => {
|
|
724
|
-
interactingWithOptionsRef.current = true;
|
|
725
|
-
e.preventDefault();
|
|
726
|
-
},
|
|
727
|
-
onKeyDown: (e) => handleTabKeyDown(e)
|
|
728
|
-
},
|
|
729
|
-
label: /* @__PURE__ */ jsx("span", { children: option.label }),
|
|
730
|
-
onCheckedChange: () => commitSelection(option)
|
|
731
|
-
},
|
|
732
|
-
option.value
|
|
733
|
-
) : /* @__PURE__ */ jsx(Menu.Item, { active: isActive, selected: isSelected, children: /* @__PURE__ */ jsx(
|
|
734
|
-
"button",
|
|
735
|
-
{
|
|
736
|
-
id: optionId,
|
|
737
|
-
type: "button",
|
|
738
|
-
role: "option",
|
|
739
|
-
"aria-selected": isSelected,
|
|
740
|
-
onMouseEnter: () => setActiveIndex(index),
|
|
741
|
-
onMouseDown: (e) => {
|
|
742
|
-
e.preventDefault();
|
|
743
|
-
},
|
|
744
|
-
onKeyDown: (e) => handleTabKeyDown(e),
|
|
745
|
-
onClick: () => commitSelection(option),
|
|
746
|
-
children: /* @__PURE__ */ jsx("span", { children: option.label })
|
|
747
|
-
}
|
|
748
|
-
) }, option.value);
|
|
749
|
-
}) : /* @__PURE__ */ jsx(Menu.Item, { disabled: true, children: emptyMessage }) })
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
mode === "multi" && multiSelectedValuesDisplayMode === "below-input" && selectedOptions.length > 0 && /* @__PURE__ */ jsx("div", { className: styles.selectedValues, children: selectedOptions.map((option) => /* @__PURE__ */ jsx(
|
|
753
|
-
Chip,
|
|
754
|
-
{
|
|
755
|
-
size: "sm",
|
|
756
|
-
type: "default",
|
|
757
|
-
severity: "neutral",
|
|
758
|
-
onClose: () => commitSelection(option),
|
|
759
|
-
children: getSelectedValueChipLabel(option)
|
|
760
|
-
},
|
|
761
|
-
option.value
|
|
762
|
-
)) })
|
|
763
|
-
]
|
|
764
|
-
}
|
|
765
|
-
);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
export { Typeahead };
|