@dbcdk/react-components 0.0.102 → 0.0.104
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 +103 -0
- package/dist/components/accordion/Accordion.js +97 -0
- package/dist/components/accordion/Accordion.module.css +41 -0
- package/dist/components/accordion/components/AccordionRow.cjs +115 -0
- package/dist/components/accordion/components/AccordionRow.js +109 -0
- package/dist/components/accordion/components/AccordionRow.module.css +99 -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 +80 -0
- package/dist/components/headline/CollapsibleHeadline.js +74 -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.d.ts +1 -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 +95 -0
- package/dist/components/nav-bar/NavBar.d.ts +1 -1
- package/dist/components/nav-bar/NavBar.js +89 -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 +177 -0
- package/dist/components/split-pane/SplitPane.js +168 -0
- package/dist/components/split-pane/SplitPane.module.css +111 -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 -12901
- package/dist/index.css +67 -7228
- package/dist/index.d.ts +0 -58
- package/dist/index.js +24 -12802
- 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 -2652
- package/dist/tanstack.js +3 -2636
- 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 -1271
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var Button = require('../../components/button/Button');
|
|
8
|
+
var ClearButton = require('../../components/clear-button/ClearButton');
|
|
9
|
+
var InputContainer = require('../../components/forms/input-container/InputContainer');
|
|
10
|
+
var Menu = require('../../components/menu/Menu');
|
|
11
|
+
var useTooltipTrigger = require('../../components/overlay/tooltip/useTooltipTrigger');
|
|
12
|
+
var Popover = require('../../components/popover/Popover');
|
|
13
|
+
var dateTimeHelpers = require('../datetime-picker/dateTimeHelpers');
|
|
14
|
+
|
|
15
|
+
function IntervalSelect({
|
|
16
|
+
// InputContainer props
|
|
17
|
+
label,
|
|
18
|
+
error,
|
|
19
|
+
helpText,
|
|
20
|
+
orientation = "vertical",
|
|
21
|
+
labelWidth = "160px",
|
|
22
|
+
fullWidth = true,
|
|
23
|
+
required,
|
|
24
|
+
// tooltip
|
|
25
|
+
tooltip,
|
|
26
|
+
tooltipPlacement = "right",
|
|
27
|
+
// IntervalSelect props
|
|
28
|
+
id,
|
|
29
|
+
options,
|
|
30
|
+
selectedValue,
|
|
31
|
+
onChange,
|
|
32
|
+
baseDate,
|
|
33
|
+
placeholder = "V\xE6lg interval",
|
|
34
|
+
size,
|
|
35
|
+
variant = "outlined",
|
|
36
|
+
onClear,
|
|
37
|
+
dataCy,
|
|
38
|
+
disabled
|
|
39
|
+
}) {
|
|
40
|
+
const generatedId = react.useId();
|
|
41
|
+
const controlId = id != null ? id : `interval-select-${generatedId}`;
|
|
42
|
+
const describedById = `${controlId}-desc`;
|
|
43
|
+
const listboxId = `${controlId}-listbox`;
|
|
44
|
+
const popoverRef = react.useRef(null);
|
|
45
|
+
const optionRefs = react.useRef([]);
|
|
46
|
+
const selectedIndex = react.useMemo(
|
|
47
|
+
() => options.findIndex((o) => o.minutesAgo === selectedValue),
|
|
48
|
+
[options, selectedValue]
|
|
49
|
+
);
|
|
50
|
+
const [activeIndex, setActiveIndex] = react.useState(selectedIndex >= 0 ? selectedIndex : 0);
|
|
51
|
+
react.useEffect(() => {
|
|
52
|
+
var _a;
|
|
53
|
+
(_a = optionRefs.current[activeIndex]) == null ? void 0 : _a.focus();
|
|
54
|
+
}, [activeIndex]);
|
|
55
|
+
const selected = react.useMemo(
|
|
56
|
+
() => {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = options.find((o) => o.minutesAgo === selectedValue)) != null ? _a : null;
|
|
59
|
+
},
|
|
60
|
+
[options, selectedValue]
|
|
61
|
+
);
|
|
62
|
+
const tooltipEnabled = Boolean(tooltip);
|
|
63
|
+
const { triggerProps, id: tooltipId } = useTooltipTrigger.useTooltipTrigger({
|
|
64
|
+
content: tooltipEnabled ? tooltip : null,
|
|
65
|
+
placement: tooltipPlacement,
|
|
66
|
+
offset: 8
|
|
67
|
+
});
|
|
68
|
+
const describedBy = (() => {
|
|
69
|
+
const ids = [];
|
|
70
|
+
if (error || helpText) ids.push(describedById);
|
|
71
|
+
if (tooltipEnabled) ids.push(tooltipId);
|
|
72
|
+
return ids.length ? ids.join(" ") : void 0;
|
|
73
|
+
})();
|
|
74
|
+
const handleCommit = (opt) => {
|
|
75
|
+
var _a;
|
|
76
|
+
const base = baseDate != null ? baseDate : /* @__PURE__ */ new Date();
|
|
77
|
+
const dateLocal = new Date(base.getTime() - opt.minutesAgo * 6e4);
|
|
78
|
+
const isoUtc = dateTimeHelpers.isoFromLocalDate(dateLocal);
|
|
79
|
+
onChange(isoUtc, { minutesAgo: opt.minutesAgo, option: opt, dateLocal });
|
|
80
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
81
|
+
};
|
|
82
|
+
const handleKeyDown = (e) => {
|
|
83
|
+
var _a;
|
|
84
|
+
switch (e.key) {
|
|
85
|
+
case "ArrowDown":
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
setActiveIndex((i) => Math.min(i + 1, options.length - 1));
|
|
88
|
+
break;
|
|
89
|
+
case "ArrowUp":
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
setActiveIndex((i) => Math.max(i - 1, 0));
|
|
92
|
+
break;
|
|
93
|
+
case "Home":
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
setActiveIndex(0);
|
|
96
|
+
break;
|
|
97
|
+
case "End":
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
setActiveIndex(options.length - 1);
|
|
100
|
+
break;
|
|
101
|
+
case "Enter":
|
|
102
|
+
case " ":
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
if (options[activeIndex]) handleCommit(options[activeIndex]);
|
|
105
|
+
break;
|
|
106
|
+
case "Escape":
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
113
|
+
InputContainer.InputContainer,
|
|
114
|
+
{
|
|
115
|
+
label,
|
|
116
|
+
htmlFor: controlId,
|
|
117
|
+
fullWidth,
|
|
118
|
+
error,
|
|
119
|
+
helpText,
|
|
120
|
+
orientation,
|
|
121
|
+
labelWidth,
|
|
122
|
+
required,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
Popover.Popover,
|
|
126
|
+
{
|
|
127
|
+
ref: popoverRef,
|
|
128
|
+
contentId: listboxId,
|
|
129
|
+
trigger: (onClick, icon, isOpen) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
Button.Button,
|
|
131
|
+
{
|
|
132
|
+
disabled,
|
|
133
|
+
...tooltipEnabled ? triggerProps : {},
|
|
134
|
+
id: controlId,
|
|
135
|
+
"data-cy": dataCy != null ? dataCy : "interval-select-button",
|
|
136
|
+
onKeyDown: handleKeyDown,
|
|
137
|
+
fullWidth,
|
|
138
|
+
variant,
|
|
139
|
+
onClick: (e) => {
|
|
140
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
141
|
+
onClick(e);
|
|
142
|
+
},
|
|
143
|
+
size,
|
|
144
|
+
type: "button",
|
|
145
|
+
"aria-haspopup": "listbox",
|
|
146
|
+
"aria-expanded": !!isOpen,
|
|
147
|
+
"aria-controls": listboxId,
|
|
148
|
+
"aria-invalid": Boolean(error) || void 0,
|
|
149
|
+
"aria-describedby": describedBy,
|
|
150
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs",
|
|
154
|
+
style: { width: "100%" },
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: selected ? selected.label : placeholder }),
|
|
157
|
+
onClear && selected && /* @__PURE__ */ jsxRuntime.jsx(ClearButton.ClearButton, { onClick: onClear }),
|
|
158
|
+
icon
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { id: listboxId, onKeyDown: handleKeyDown, role: "listbox", children: options.map((opt, index) => {
|
|
165
|
+
const isSelected = opt.minutesAgo === selectedValue;
|
|
166
|
+
const isActive = index === activeIndex;
|
|
167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
+
Menu.Menu.Item,
|
|
169
|
+
{
|
|
170
|
+
active: isActive,
|
|
171
|
+
selected: isSelected,
|
|
172
|
+
itemRole: "option",
|
|
173
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
ref: (el) => {
|
|
177
|
+
optionRefs.current[index] = el;
|
|
178
|
+
},
|
|
179
|
+
type: "button",
|
|
180
|
+
tabIndex: isActive ? 0 : -1,
|
|
181
|
+
"aria-selected": isSelected,
|
|
182
|
+
onClick: () => handleCommit(opt),
|
|
183
|
+
onFocus: () => setActiveIndex(index),
|
|
184
|
+
style: { display: "flex", alignItems: "center", width: "100%" },
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isSelected ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) : null }),
|
|
187
|
+
opt.label
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
},
|
|
192
|
+
opt.minutesAgo
|
|
193
|
+
);
|
|
194
|
+
}) })
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
(error || helpText) && /* @__PURE__ */ jsxRuntime.jsx("span", { id: describedById, style: { display: "none" }, children: error != null ? error : helpText })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
exports.IntervalSelect = IntervalSelect;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Check } from 'lucide-react';
|
|
4
|
+
import { useId, useRef, useMemo, useState, useEffect } from 'react';
|
|
5
|
+
import { Button } from '../../components/button/Button';
|
|
6
|
+
import { ClearButton } from '../../components/clear-button/ClearButton';
|
|
7
|
+
import { InputContainer } from '../../components/forms/input-container/InputContainer';
|
|
8
|
+
import { Menu } from '../../components/menu/Menu';
|
|
9
|
+
import { useTooltipTrigger } from '../../components/overlay/tooltip/useTooltipTrigger';
|
|
10
|
+
import { Popover } from '../../components/popover/Popover';
|
|
11
|
+
import { isoFromLocalDate } from '../datetime-picker/dateTimeHelpers';
|
|
12
|
+
|
|
13
|
+
function IntervalSelect({
|
|
14
|
+
// InputContainer props
|
|
15
|
+
label,
|
|
16
|
+
error,
|
|
17
|
+
helpText,
|
|
18
|
+
orientation = "vertical",
|
|
19
|
+
labelWidth = "160px",
|
|
20
|
+
fullWidth = true,
|
|
21
|
+
required,
|
|
22
|
+
// tooltip
|
|
23
|
+
tooltip,
|
|
24
|
+
tooltipPlacement = "right",
|
|
25
|
+
// IntervalSelect props
|
|
26
|
+
id,
|
|
27
|
+
options,
|
|
28
|
+
selectedValue,
|
|
29
|
+
onChange,
|
|
30
|
+
baseDate,
|
|
31
|
+
placeholder = "V\xE6lg interval",
|
|
32
|
+
size,
|
|
33
|
+
variant = "outlined",
|
|
34
|
+
onClear,
|
|
35
|
+
dataCy,
|
|
36
|
+
disabled
|
|
37
|
+
}) {
|
|
38
|
+
const generatedId = useId();
|
|
39
|
+
const controlId = id != null ? id : `interval-select-${generatedId}`;
|
|
40
|
+
const describedById = `${controlId}-desc`;
|
|
41
|
+
const listboxId = `${controlId}-listbox`;
|
|
42
|
+
const popoverRef = useRef(null);
|
|
43
|
+
const optionRefs = useRef([]);
|
|
44
|
+
const selectedIndex = useMemo(
|
|
45
|
+
() => options.findIndex((o) => o.minutesAgo === selectedValue),
|
|
46
|
+
[options, selectedValue]
|
|
47
|
+
);
|
|
48
|
+
const [activeIndex, setActiveIndex] = useState(selectedIndex >= 0 ? selectedIndex : 0);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = optionRefs.current[activeIndex]) == null ? void 0 : _a.focus();
|
|
52
|
+
}, [activeIndex]);
|
|
53
|
+
const selected = useMemo(
|
|
54
|
+
() => {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = options.find((o) => o.minutesAgo === selectedValue)) != null ? _a : null;
|
|
57
|
+
},
|
|
58
|
+
[options, selectedValue]
|
|
59
|
+
);
|
|
60
|
+
const tooltipEnabled = Boolean(tooltip);
|
|
61
|
+
const { triggerProps, id: tooltipId } = useTooltipTrigger({
|
|
62
|
+
content: tooltipEnabled ? tooltip : null,
|
|
63
|
+
placement: tooltipPlacement,
|
|
64
|
+
offset: 8
|
|
65
|
+
});
|
|
66
|
+
const describedBy = (() => {
|
|
67
|
+
const ids = [];
|
|
68
|
+
if (error || helpText) ids.push(describedById);
|
|
69
|
+
if (tooltipEnabled) ids.push(tooltipId);
|
|
70
|
+
return ids.length ? ids.join(" ") : void 0;
|
|
71
|
+
})();
|
|
72
|
+
const handleCommit = (opt) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const base = baseDate != null ? baseDate : /* @__PURE__ */ new Date();
|
|
75
|
+
const dateLocal = new Date(base.getTime() - opt.minutesAgo * 6e4);
|
|
76
|
+
const isoUtc = isoFromLocalDate(dateLocal);
|
|
77
|
+
onChange(isoUtc, { minutesAgo: opt.minutesAgo, option: opt, dateLocal });
|
|
78
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
79
|
+
};
|
|
80
|
+
const handleKeyDown = (e) => {
|
|
81
|
+
var _a;
|
|
82
|
+
switch (e.key) {
|
|
83
|
+
case "ArrowDown":
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
setActiveIndex((i) => Math.min(i + 1, options.length - 1));
|
|
86
|
+
break;
|
|
87
|
+
case "ArrowUp":
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
setActiveIndex((i) => Math.max(i - 1, 0));
|
|
90
|
+
break;
|
|
91
|
+
case "Home":
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
setActiveIndex(0);
|
|
94
|
+
break;
|
|
95
|
+
case "End":
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
setActiveIndex(options.length - 1);
|
|
98
|
+
break;
|
|
99
|
+
case "Enter":
|
|
100
|
+
case " ":
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
if (options[activeIndex]) handleCommit(options[activeIndex]);
|
|
103
|
+
break;
|
|
104
|
+
case "Escape":
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return /* @__PURE__ */ jsxs(
|
|
111
|
+
InputContainer,
|
|
112
|
+
{
|
|
113
|
+
label,
|
|
114
|
+
htmlFor: controlId,
|
|
115
|
+
fullWidth,
|
|
116
|
+
error,
|
|
117
|
+
helpText,
|
|
118
|
+
orientation,
|
|
119
|
+
labelWidth,
|
|
120
|
+
required,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
Popover,
|
|
124
|
+
{
|
|
125
|
+
ref: popoverRef,
|
|
126
|
+
contentId: listboxId,
|
|
127
|
+
trigger: (onClick, icon, isOpen) => /* @__PURE__ */ jsx(
|
|
128
|
+
Button,
|
|
129
|
+
{
|
|
130
|
+
disabled,
|
|
131
|
+
...tooltipEnabled ? triggerProps : {},
|
|
132
|
+
id: controlId,
|
|
133
|
+
"data-cy": dataCy != null ? dataCy : "interval-select-button",
|
|
134
|
+
onKeyDown: handleKeyDown,
|
|
135
|
+
fullWidth,
|
|
136
|
+
variant,
|
|
137
|
+
onClick: (e) => {
|
|
138
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
139
|
+
onClick(e);
|
|
140
|
+
},
|
|
141
|
+
size,
|
|
142
|
+
type: "button",
|
|
143
|
+
"aria-haspopup": "listbox",
|
|
144
|
+
"aria-expanded": !!isOpen,
|
|
145
|
+
"aria-controls": listboxId,
|
|
146
|
+
"aria-invalid": Boolean(error) || void 0,
|
|
147
|
+
"aria-describedby": describedBy,
|
|
148
|
+
children: /* @__PURE__ */ jsxs(
|
|
149
|
+
"span",
|
|
150
|
+
{
|
|
151
|
+
className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs",
|
|
152
|
+
style: { width: "100%" },
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsx("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: selected ? selected.label : placeholder }),
|
|
155
|
+
onClear && selected && /* @__PURE__ */ jsx(ClearButton, { onClick: onClear }),
|
|
156
|
+
icon
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
children: /* @__PURE__ */ jsx(Menu, { id: listboxId, onKeyDown: handleKeyDown, role: "listbox", children: options.map((opt, index) => {
|
|
163
|
+
const isSelected = opt.minutesAgo === selectedValue;
|
|
164
|
+
const isActive = index === activeIndex;
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
Menu.Item,
|
|
167
|
+
{
|
|
168
|
+
active: isActive,
|
|
169
|
+
selected: isSelected,
|
|
170
|
+
itemRole: "option",
|
|
171
|
+
children: /* @__PURE__ */ jsxs(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
ref: (el) => {
|
|
175
|
+
optionRefs.current[index] = el;
|
|
176
|
+
},
|
|
177
|
+
type: "button",
|
|
178
|
+
tabIndex: isActive ? 0 : -1,
|
|
179
|
+
"aria-selected": isSelected,
|
|
180
|
+
onClick: () => handleCommit(opt),
|
|
181
|
+
onFocus: () => setActiveIndex(index),
|
|
182
|
+
style: { display: "flex", alignItems: "center", width: "100%" },
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isSelected ? /* @__PURE__ */ jsx(Check, {}) : null }),
|
|
185
|
+
opt.label
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
opt.minutesAgo
|
|
191
|
+
);
|
|
192
|
+
}) })
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
(error || helpText) && /* @__PURE__ */ jsx("span", { id: describedById, style: { display: "none" }, children: error != null ? error : helpText })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export { IntervalSelect };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var getHighlightedSegments = require('../../utils/text/get-highlighted-segments');
|
|
6
|
+
|
|
7
|
+
function HighlightedText({ text, query }) {
|
|
8
|
+
return getHighlightedSegments.getHighlightedSegments(text, query).map(
|
|
9
|
+
(segment, index) => segment.matched ? /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "dbc-highlight", children: segment.text }, `${segment.text}-${index}`) : /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: segment.text }, `${segment.text}-${index}`)
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.HighlightedText = HighlightedText;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { getHighlightedSegments } from '../../utils/text/get-highlighted-segments';
|
|
4
|
+
|
|
5
|
+
function HighlightedText({ text, query }) {
|
|
6
|
+
return getHighlightedSegments(text, query).map(
|
|
7
|
+
(segment, index) => segment.matched ? /* @__PURE__ */ jsx("mark", { className: "dbc-highlight", children: segment.text }, `${segment.text}-${index}`) : /* @__PURE__ */ jsx(Fragment, { children: segment.text }, `${segment.text}-${index}`)
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { HighlightedText };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
6
|
+
var utils = require('./utils');
|
|
7
|
+
var HighlightedText = require('./HighlightedText');
|
|
8
|
+
var styles = require('./JsonViewer.module.css');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
13
|
+
|
|
14
|
+
function JsonNode({
|
|
15
|
+
keyName,
|
|
16
|
+
path,
|
|
17
|
+
value,
|
|
18
|
+
depth,
|
|
19
|
+
defaultExpandedDepth,
|
|
20
|
+
query,
|
|
21
|
+
matches,
|
|
22
|
+
expandedNodeIds,
|
|
23
|
+
onToggleNode,
|
|
24
|
+
copiedId,
|
|
25
|
+
onCopy
|
|
26
|
+
}) {
|
|
27
|
+
const nodeId = utils.getNodeId(path);
|
|
28
|
+
const nodeType = utils.getValueType(value);
|
|
29
|
+
const match = matches.get(nodeId);
|
|
30
|
+
const shouldRender = query ? Boolean(match) : true;
|
|
31
|
+
const forceOpen = query ? Boolean(match == null ? void 0 : match.descendant) : false;
|
|
32
|
+
if (!shouldRender) return null;
|
|
33
|
+
if (nodeType !== "array" && nodeType !== "object") {
|
|
34
|
+
const primitive = value;
|
|
35
|
+
const valueLabel = utils.formatPrimitive(primitive);
|
|
36
|
+
const rawValue = utils.getPrimitiveRawValue(primitive);
|
|
37
|
+
const copied = copiedId === nodeId;
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: styles__default.default.node,
|
|
42
|
+
style: { ["--json-indent"]: depth },
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.row, "data-match": (match == null ? void 0 : match.self) || void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: styles__default.default.valueButton,
|
|
49
|
+
onClick: () => onCopy(nodeId, rawValue),
|
|
50
|
+
title: copied ? "Kopieret" : "Kopi\xE9r v\xE6rdi",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.rowLabel, children: [
|
|
53
|
+
keyName !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.keyChunk, children: [
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.key, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: keyName, query }) }),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.punctuation, children: ":" })
|
|
56
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.rootLabel, children: "$" }),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: [styles__default.default.value, styles__default.default[`value${utils.capitalize(nodeType)}`]].join(" "), children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: valueLabel, query }) })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.copyState, "aria-live": "polite", children: [
|
|
60
|
+
copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { "aria-hidden": "true" }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: copied ? "Kopieret" : "Kopi\xE9r" })
|
|
62
|
+
] })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
) }),
|
|
66
|
+
query && !(match == null ? void 0 : match.self) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.pathHint, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: utils.getPathLabel(path), query }) }) : null
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const entries = utils.isJsonArray(value) ? value.map((item, index) => [String(index), item]) : utils.isJsonObject(value) ? Object.entries(value) : [];
|
|
72
|
+
const summary = utils.getSummary(value);
|
|
73
|
+
const expanded = query || forceOpen ? true : expandedNodeIds.has(nodeId);
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: styles__default.default.node,
|
|
78
|
+
style: { ["--json-indent"]: depth },
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.row, "data-match": (match == null ? void 0 : match.self) || void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
className: styles__default.default.toggle,
|
|
85
|
+
onClick: () => onToggleNode(nodeId),
|
|
86
|
+
"aria-expanded": expanded,
|
|
87
|
+
children: [
|
|
88
|
+
expanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { "aria-hidden": "true" }),
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.rowLabel, children: [
|
|
90
|
+
keyName !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.keyChunk, children: [
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.key, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: keyName, query }) }),
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.punctuation, children: ":" })
|
|
93
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.rootLabel, children: "$" }),
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.bracket, children: utils.isJsonArray(value) ? "[" : "{" }),
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.summary, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: summary, query }) }),
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.bracket, children: utils.isJsonArray(value) ? "]" : "}" })
|
|
97
|
+
] })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
) }),
|
|
101
|
+
query && !(match == null ? void 0 : match.self) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.pathHint, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightedText.HighlightedText, { text: utils.getPathLabel(path), query }) }) : null,
|
|
102
|
+
expanded ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.children, role: depth === 0 ? "group" : void 0, children: entries.map(([childKey, childValue]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
103
|
+
JsonNode,
|
|
104
|
+
{
|
|
105
|
+
keyName: utils.isJsonArray(value) ? `[${childKey}]` : childKey,
|
|
106
|
+
path: [...path, childKey],
|
|
107
|
+
value: childValue,
|
|
108
|
+
depth: depth + 1,
|
|
109
|
+
defaultExpandedDepth,
|
|
110
|
+
query,
|
|
111
|
+
matches,
|
|
112
|
+
expandedNodeIds,
|
|
113
|
+
onToggleNode,
|
|
114
|
+
copiedId,
|
|
115
|
+
onCopy
|
|
116
|
+
},
|
|
117
|
+
`${nodeId}-${childKey}`
|
|
118
|
+
)) }) : null
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.JsonNode = JsonNode;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Check, Copy, ChevronDown, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { getNodeId, getValueType, formatPrimitive, getPrimitiveRawValue, capitalize, getPathLabel, isJsonArray, isJsonObject, getSummary } from './utils';
|
|
5
|
+
import { HighlightedText } from './HighlightedText';
|
|
6
|
+
import styles from './JsonViewer.module.css';
|
|
7
|
+
|
|
8
|
+
function JsonNode({
|
|
9
|
+
keyName,
|
|
10
|
+
path,
|
|
11
|
+
value,
|
|
12
|
+
depth,
|
|
13
|
+
defaultExpandedDepth,
|
|
14
|
+
query,
|
|
15
|
+
matches,
|
|
16
|
+
expandedNodeIds,
|
|
17
|
+
onToggleNode,
|
|
18
|
+
copiedId,
|
|
19
|
+
onCopy
|
|
20
|
+
}) {
|
|
21
|
+
const nodeId = getNodeId(path);
|
|
22
|
+
const nodeType = getValueType(value);
|
|
23
|
+
const match = matches.get(nodeId);
|
|
24
|
+
const shouldRender = query ? Boolean(match) : true;
|
|
25
|
+
const forceOpen = query ? Boolean(match == null ? void 0 : match.descendant) : false;
|
|
26
|
+
if (!shouldRender) return null;
|
|
27
|
+
if (nodeType !== "array" && nodeType !== "object") {
|
|
28
|
+
const primitive = value;
|
|
29
|
+
const valueLabel = formatPrimitive(primitive);
|
|
30
|
+
const rawValue = getPrimitiveRawValue(primitive);
|
|
31
|
+
const copied = copiedId === nodeId;
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: styles.node,
|
|
36
|
+
style: { ["--json-indent"]: depth },
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: styles.row, "data-match": (match == null ? void 0 : match.self) || void 0, children: /* @__PURE__ */ jsxs(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
className: styles.valueButton,
|
|
43
|
+
onClick: () => onCopy(nodeId, rawValue),
|
|
44
|
+
title: copied ? "Kopieret" : "Kopi\xE9r v\xE6rdi",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("span", { className: styles.rowLabel, children: [
|
|
47
|
+
keyName !== void 0 ? /* @__PURE__ */ jsxs("span", { className: styles.keyChunk, children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: styles.key, children: /* @__PURE__ */ jsx(HighlightedText, { text: keyName, query }) }),
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: styles.punctuation, children: ":" })
|
|
50
|
+
] }) : /* @__PURE__ */ jsx("span", { className: styles.rootLabel, children: "$" }),
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: [styles.value, styles[`value${capitalize(nodeType)}`]].join(" "), children: /* @__PURE__ */ jsx(HighlightedText, { text: valueLabel, query }) })
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsxs("span", { className: styles.copyState, "aria-live": "polite", children: [
|
|
54
|
+
copied ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": "true" }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { children: copied ? "Kopieret" : "Kopi\xE9r" })
|
|
56
|
+
] })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
) }),
|
|
60
|
+
query && !(match == null ? void 0 : match.self) ? /* @__PURE__ */ jsx("div", { className: styles.pathHint, children: /* @__PURE__ */ jsx(HighlightedText, { text: getPathLabel(path), query }) }) : null
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
const entries = isJsonArray(value) ? value.map((item, index) => [String(index), item]) : isJsonObject(value) ? Object.entries(value) : [];
|
|
66
|
+
const summary = getSummary(value);
|
|
67
|
+
const expanded = query || forceOpen ? true : expandedNodeIds.has(nodeId);
|
|
68
|
+
return /* @__PURE__ */ jsxs(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: styles.node,
|
|
72
|
+
style: { ["--json-indent"]: depth },
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: styles.row, "data-match": (match == null ? void 0 : match.self) || void 0, children: /* @__PURE__ */ jsxs(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
type: "button",
|
|
78
|
+
className: styles.toggle,
|
|
79
|
+
onClick: () => onToggleNode(nodeId),
|
|
80
|
+
"aria-expanded": expanded,
|
|
81
|
+
children: [
|
|
82
|
+
expanded ? /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" }),
|
|
83
|
+
/* @__PURE__ */ jsxs("span", { className: styles.rowLabel, children: [
|
|
84
|
+
keyName !== void 0 ? /* @__PURE__ */ jsxs("span", { className: styles.keyChunk, children: [
|
|
85
|
+
/* @__PURE__ */ jsx("span", { className: styles.key, children: /* @__PURE__ */ jsx(HighlightedText, { text: keyName, query }) }),
|
|
86
|
+
/* @__PURE__ */ jsx("span", { className: styles.punctuation, children: ":" })
|
|
87
|
+
] }) : /* @__PURE__ */ jsx("span", { className: styles.rootLabel, children: "$" }),
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: styles.bracket, children: isJsonArray(value) ? "[" : "{" }),
|
|
89
|
+
/* @__PURE__ */ jsx("span", { className: styles.summary, children: /* @__PURE__ */ jsx(HighlightedText, { text: summary, query }) }),
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: styles.bracket, children: isJsonArray(value) ? "]" : "}" })
|
|
91
|
+
] })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
) }),
|
|
95
|
+
query && !(match == null ? void 0 : match.self) ? /* @__PURE__ */ jsx("div", { className: styles.pathHint, children: /* @__PURE__ */ jsx(HighlightedText, { text: getPathLabel(path), query }) }) : null,
|
|
96
|
+
expanded ? /* @__PURE__ */ jsx("div", { className: styles.children, role: depth === 0 ? "group" : void 0, children: entries.map(([childKey, childValue]) => /* @__PURE__ */ jsx(
|
|
97
|
+
JsonNode,
|
|
98
|
+
{
|
|
99
|
+
keyName: isJsonArray(value) ? `[${childKey}]` : childKey,
|
|
100
|
+
path: [...path, childKey],
|
|
101
|
+
value: childValue,
|
|
102
|
+
depth: depth + 1,
|
|
103
|
+
defaultExpandedDepth,
|
|
104
|
+
query,
|
|
105
|
+
matches,
|
|
106
|
+
expandedNodeIds,
|
|
107
|
+
onToggleNode,
|
|
108
|
+
copiedId,
|
|
109
|
+
onCopy
|
|
110
|
+
},
|
|
111
|
+
`${nodeId}-${childKey}`
|
|
112
|
+
)) }) : null
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { JsonNode };
|