@espressif/dashboard-ui-components 1.10.0 → 1.11.0
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/CHANGELOG.md +65 -0
- package/dist/_vendor/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/_vendor/@radix-ui/react-checkbox/dist/index.js +185 -0
- package/dist/_vendor/@radix-ui/react-compose-refs/dist/index.js +28 -0
- package/dist/_vendor/@radix-ui/react-context/dist/index.js +68 -0
- package/dist/_vendor/@radix-ui/react-presence/dist/index.js +127 -0
- package/dist/_vendor/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/_vendor/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/_vendor/@radix-ui/react-use-layout-effect/dist/index.js +5 -0
- package/dist/_vendor/@radix-ui/react-use-previous/dist/index.js +17 -0
- package/dist/_vendor/@radix-ui/react-use-size/dist/index.js +39 -0
- package/dist/_vendor/lottie-react/build/index.es.js +537 -0
- package/dist/_vendor/lottie-web/build/player/lottie.js +14149 -0
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/assets/illustrations/bulb-cloud-drawing.js +4 -0
- package/dist/assets/illustrations/rm-dashboard-update.js +4 -0
- package/dist/assets/illustrations/rm-data-download.js +4 -0
- package/dist/assets/logos/espressif/espressif-no-text.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text-dm.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text.js +4 -0
- package/dist/assets/logos/insights/insights-no-text.js +4 -0
- package/dist/assets/logos/insights/insights-with-text-dm.js +4 -0
- package/dist/assets/logos/insights/insights-with-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-no-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text-dm.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-no-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-no-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text-dm.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-no-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-no-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text.js +4 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.constants.js +18 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.js +24 -0
- package/dist/common/animated-rainmaker-logo/rainmaker-c-logo.js +50 -0
- package/dist/common/animated-rainmaker-logo/use-animated-rainmaker-logo-animation.js +85 -0
- package/dist/common/app-logo/app-logo.js +59 -0
- package/dist/common/app-logo/logo-config.js +297 -0
- package/dist/common/copyright-card/copyright-card.js +39 -0
- package/dist/common/footer-card/footer-card.js +22 -0
- package/dist/common/index.js +8 -8
- package/dist/common/my-account-menu/my-account-menu.js +32 -0
- package/dist/common/page-loader/page-loader.js +21 -0
- package/dist/common/profile-card/profile-card.js +26 -0
- package/dist/components/accordion/accordion.js +52 -0
- package/dist/components/advanced-search-box/advanced-search-box.js +106 -0
- package/dist/components/alert/alert.js +85 -0
- package/dist/components/animated-containers/pop-collection-item.js +28 -0
- package/dist/components/async-multi-select/async-multi-select.js +199 -0
- package/dist/components/avatar/avatar.js +41 -0
- package/dist/components/button/button.js +191 -0
- package/dist/components/button/flash-button.js +110 -0
- package/dist/components/button/invert-button.js +13 -0
- package/dist/components/calendar/calendar.js +105 -0
- package/dist/components/cards/animated-card/animated-card-animations.js +57 -0
- package/dist/components/cards/animated-card/animated-card.js +42 -0
- package/dist/components/cards/basic-details-card.js +46 -0
- package/dist/components/cards/collapsible-card.js +48 -0
- package/dist/components/cards/no-data-card/no-data-card.js +30 -0
- package/dist/components/cards/section-card.js +265 -0
- package/dist/components/cards/simple-card.js +24 -0
- package/dist/components/carousel/carousel.js +158 -0
- package/dist/components/chart/area-chart.js +135 -0
- package/dist/components/chart/bar-chart.js +151 -0
- package/dist/components/chart/chart-colors.js +85 -0
- package/dist/components/chart/chart-series-data.js +53 -0
- package/dist/components/chart/chart.js +147 -0
- package/dist/components/chart/chart.types.js +7 -0
- package/dist/components/chart/composed-chart.js +182 -0
- package/dist/components/chart/donut-chart.js +177 -0
- package/dist/components/chart/line-chart.js +137 -0
- package/dist/components/chart/treemap-chart.js +294 -0
- package/dist/components/circular-progress/circular-progress.js +125 -0
- package/dist/components/code-editor/code-editor.js +235 -0
- package/dist/components/code-editor/code-editor.utils.js +122 -0
- package/dist/components/code-editor/use-code-editor-keys.js +79 -0
- package/dist/components/code-editor/use-highlighted-html.js +102 -0
- package/dist/components/confirmation-dialog/confirmation-dialog.js +72 -0
- package/dist/components/content-container/content-container.js +20 -0
- package/dist/components/copiable-text/copiable-text.js +46 -0
- package/dist/components/data-table/data-table.js +186 -0
- package/dist/components/data-table/responsive-columns.js +65 -0
- package/dist/components/data-table/row-actions.js +27 -0
- package/dist/components/data-table/sticky-columns.js +71 -0
- package/dist/components/data-table/table-body.js +57 -0
- package/dist/components/data-table/table-header.js +21 -0
- package/dist/components/date-picker/date-picker.js +95 -0
- package/dist/components/date-range-picker/date-range-picker.js +301 -0
- package/dist/components/date-range-picker/presets.js +174 -0
- package/dist/components/date-time-picker/date-time-picker.js +144 -0
- package/dist/components/date-time-picker/date-time-picker.utils.js +32 -0
- package/dist/components/device-icon/device-icon.config.js +194 -0
- package/dist/components/device-icon/device-icon.js +17 -0
- package/dist/components/device-icon/icons/air-conditioner.js +22 -0
- package/dist/components/device-icon/icons/blind.js +24 -0
- package/dist/components/device-icon/icons/dimmer.js +14 -0
- package/dist/components/device-icon/icons/extension-board.js +42 -0
- package/dist/components/device-icon/icons/fan.js +14 -0
- package/dist/components/device-icon/icons/knob.js +14 -0
- package/dist/components/device-icon/icons/led-strip.js +22 -0
- package/dist/components/device-icon/icons/light.js +14 -0
- package/dist/components/device-icon/icons/refrigerator.js +18 -0
- package/dist/components/device-icon/icons/retro-switch.js +18 -0
- package/dist/components/device-icon/icons/router.js +20 -0
- package/dist/components/device-icon/icons/sensor.js +20 -0
- package/dist/components/device-icon/icons/socket.js +19 -0
- package/dist/components/device-icon/icons/switch.js +19 -0
- package/dist/components/device-icon/icons/thermostat.js +21 -0
- package/dist/components/device-icon/icons/washing-machine.js +22 -0
- package/dist/components/device-icon/match-device.js +61 -0
- package/dist/components/dynamic-list/dynamic-list.js +445 -0
- package/dist/components/error-display/full-size-error/full-size-error.js +20 -0
- package/dist/components/error-display/inline-error/inline-error.js +12 -0
- package/dist/components/file-input/file-input.js +318 -0
- package/dist/components/file-upload/file-upload.js +317 -0
- package/dist/components/filters-bar/filters-bar.js +36 -0
- package/dist/components/fullscreen-dialog/fullscreen-dialog.js +68 -0
- package/dist/components/icon-avatar/icon-avatar.js +130 -0
- package/dist/components/icon-text-action-card/icon-text-action-card.js +190 -0
- package/dist/components/illustration/illustration-registry.js +37 -0
- package/dist/components/illustration/illustration-variants.js +21 -0
- package/dist/components/illustration/illustration.js +68 -0
- package/dist/components/index.d.ts +0 -20
- package/dist/components/index.js +134 -6
- package/dist/components/key-value-manager/key-value-manager-add-popover.js +126 -0
- package/dist/components/key-value-manager/key-value-manager-field.js +47 -0
- package/dist/components/key-value-manager/key-value-manager-table.js +188 -0
- package/dist/components/key-value-manager/key-value-manager.js +111 -0
- package/dist/components/key-value-manager/key-value-manager.props.js +28 -0
- package/dist/components/key-value-manager/key-value-manager.utils.js +21 -0
- package/dist/components/link/link.js +67 -0
- package/dist/components/list/dropdown-list-item.js +60 -0
- package/dist/components/list/list-item.utils.js +76 -0
- package/dist/components/list/list.js +49 -0
- package/dist/components/list/list.props.js +27 -0
- package/dist/components/list/standard-list-item.js +66 -0
- package/dist/components/list-details/list-details-item-button.js +46 -0
- package/dist/components/list-details/list-details-item-dropdown.js +112 -0
- package/dist/components/list-details/list-details-item-strip.js +125 -0
- package/dist/components/list-details/list-details.js +148 -0
- package/dist/components/lottie-animation-container/lottie-animation-container.js +31 -0
- package/dist/components/lottie-animations/animation-data/access-denied.js +3980 -0
- package/dist/components/lottie-animations/animation-data/active.js +825 -0
- package/dist/components/lottie-animations/animation-data/bar-chart.js +610 -0
- package/dist/components/lottie-animations/animation-data/chart-loading.js +5368 -0
- package/dist/components/lottie-animations/animation-data/cloud-download.js +1660 -0
- package/dist/components/lottie-animations/animation-data/cloud-sync.js +932 -0
- package/dist/components/lottie-animations/animation-data/coud-upload.js +7060 -0
- package/dist/components/lottie-animations/animation-data/cross-throb.js +1506 -0
- package/dist/components/lottie-animations/animation-data/dashboard-loading.js +14330 -0
- package/dist/components/lottie-animations/animation-data/error-spread-out.js +5567 -0
- package/dist/components/lottie-animations/animation-data/error.js +1211 -0
- package/dist/components/lottie-animations/animation-data/green-success.js +14826 -0
- package/dist/components/lottie-animations/animation-data/inactive.js +723 -0
- package/dist/components/lottie-animations/animation-data/light.js +2678 -0
- package/dist/components/lottie-animations/animation-data/lock.js +900 -0
- package/dist/components/lottie-animations/animation-data/lock2.js +1686 -0
- package/dist/components/lottie-animations/animation-data/locked.js +641 -0
- package/dist/components/lottie-animations/animation-data/search-error.js +954 -0
- package/dist/components/lottie-animations/animation-data/security.js +4121 -0
- package/dist/components/lottie-animations/animation-data/success.js +404 -0
- package/dist/components/lottie-animations/animation-data/verification-in-progress.js +10138 -0
- package/dist/components/lottie-animations/animation-data/warning.js +843 -0
- package/dist/components/lottie-animations/verification-in-progress/verification-in-progress.js +19 -0
- package/dist/components/markdown-content/markdown-content.components.js +114 -0
- package/dist/components/markdown-content/markdown-content.js +39 -0
- package/dist/components/menu/menu.js +19 -0
- package/dist/components/monospace-content/monospace-content.js +80 -0
- package/dist/components/nav-bar/nav-bar-details-panel.js +51 -0
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +105 -0
- package/dist/components/nav-bar/nav-bar.js +449 -0
- package/dist/components/nav-bar/use-nav-bar-overflow.js +74 -0
- package/dist/components/nav-bar/use-nav-bar-scroll.js +42 -0
- package/dist/components/overflow-badge-list/overflow-badge-list.js +58 -0
- package/dist/components/page-container/page-container-skeleton.js +72 -0
- package/dist/components/page-container/page-container.js +93 -0
- package/dist/components/pagination/pagination.js +96 -0
- package/dist/components/pagination/pagination.props.js +16 -0
- package/dist/components/progress-bar/progress-bar.js +106 -0
- package/dist/components/radio-group/radio-group.js +41 -0
- package/dist/components/requirement-list/requirement-list.js +83 -0
- package/dist/components/scrollable-sections/scrollable-sections.js +270 -0
- package/dist/components/search-box/search-box.js +54 -0
- package/dist/components/search-field-shell.js +24 -0
- package/dist/components/selectable-card-list/checkbox-card-list.js +85 -0
- package/dist/components/selectable-card-list/radio-card-list.js +99 -0
- package/dist/components/selectable-card-list/selectable-card-list-shared.js +135 -0
- package/dist/components/selectable-card-list/selectable-card-list.js +34 -0
- package/dist/components/sidebar/sidebar.js +344 -0
- package/dist/components/sidebar/types.js +6 -0
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +309 -0
- package/dist/components/simple-clickable-card/simple-clickable-card.js +106 -0
- package/dist/components/simple-info-card/simple-info-card.js +154 -0
- package/dist/components/simple-list/simple-list.js +146 -0
- package/dist/components/simple-paginated-list/simple-paginated-list.js +178 -0
- package/dist/components/simplified-date/simplified-date.js +56 -0
- package/dist/components/skeletons/table-skeleton.js +16 -0
- package/dist/components/spinner/spinner.js +25 -0
- package/dist/components/stat-card/stat-card.js +206 -0
- package/dist/components/status-badge/status-badge.js +108 -0
- package/dist/components/status-card-list/status-card-list.js +282 -0
- package/dist/components/tag/tag.js +144 -0
- package/dist/components/tag-input/tag-input.js +161 -0
- package/dist/components/text-effects/glitch-effect/glitch-text.js +115 -0
- package/dist/components/text-effects/gradient-text/gradient-text.js +32 -0
- package/dist/components/text-effects/highlight-text/highlight-text.js +35 -0
- package/dist/components/text-effects/parse-text-markup.js +53 -0
- package/dist/components/text-effects/shimmer-text/shimmer-text.js +67 -0
- package/dist/components/time-picker/time-picker.js +23 -0
- package/dist/components/toast/toast.js +126 -0
- package/dist/components/togglable-items-list/togglable-items-list.js +28 -0
- package/dist/components/tooltip/tooltip.js +21 -0
- package/dist/components/transfer-list/transfer-list.js +413 -0
- package/dist/components/truncated-line-with-tooltip/truncated-line-with-tooltip.js +61 -0
- package/dist/components/typography/typography-variants.js +41 -0
- package/dist/components/typography/typography.js +15 -0
- package/dist/components/user-type-badge/user-type-badge.js +40 -0
- package/dist/components/user-type-badge/user-type-badge.registry.js +17 -0
- package/dist/components/vertical-stepper/vertical-stepper.js +171 -0
- package/dist/core/alert.js +33 -0
- package/dist/core/animate-ui/components/animate/code-header.js +30 -0
- package/dist/core/animate-ui/components/animate/code.js +35 -0
- package/dist/core/animate-ui/components/animate/tabs.js +188 -0
- package/dist/core/animate-ui/components/animate/tooltip.js +39 -0
- package/dist/core/animate-ui/components/base/preview-card.js +29 -0
- package/dist/core/animate-ui/components/base/progress.js +32 -0
- package/dist/core/animate-ui/components/base/radio.js +24 -0
- package/dist/core/animate-ui/components/buttons/copy.js +95 -0
- package/dist/core/animate-ui/components/radix/accordion.js +36 -0
- package/dist/core/animate-ui/components/radix/dialog.js +60 -0
- package/dist/core/animate-ui/components/radix/dropdown-menu.js +129 -0
- package/dist/core/animate-ui/components/radix/sheet.js +110 -0
- package/dist/core/animate-ui/components/radix/sidebar.js +416 -0
- package/dist/core/animate-ui/components/radix/switch.js +34 -0
- package/dist/core/animate-ui/components/radix/toggle-group.js +115 -0
- package/dist/core/animate-ui/components/radix/toggle.js +24 -0
- package/dist/core/animate-ui/primitives/animate/code-block.js +131 -0
- package/dist/core/animate-ui/primitives/animate/escape-html.js +7 -0
- package/dist/core/animate-ui/primitives/animate/shiki-highlighter.js +64 -0
- package/dist/core/animate-ui/primitives/animate/slot.js +39 -0
- package/dist/core/animate-ui/primitives/animate/tabs.js +202 -0
- package/dist/core/animate-ui/primitives/animate/tooltip.js +351 -0
- package/dist/core/animate-ui/primitives/base/preview-card.js +107 -0
- package/dist/core/animate-ui/primitives/base/progress.js +60 -0
- package/dist/core/animate-ui/primitives/base/radio.js +83 -0
- package/dist/core/animate-ui/primitives/buttons/button.js +15 -0
- package/dist/core/animate-ui/primitives/effects/highlight.js +407 -0
- package/dist/core/animate-ui/primitives/radix/accordion.js +76 -0
- package/dist/core/animate-ui/primitives/radix/dialog.js +136 -0
- package/dist/core/animate-ui/primitives/radix/dropdown-menu.js +305 -0
- package/dist/core/animate-ui/primitives/radix/sheet.js +165 -0
- package/dist/core/animate-ui/primitives/radix/switch.js +86 -0
- package/dist/core/animate-ui/primitives/radix/toggle-group.js +100 -0
- package/dist/core/animate-ui/primitives/texts/counting-number.js +75 -0
- package/dist/core/avatar.js +32 -0
- package/dist/core/badge.js +27 -0
- package/dist/core/breadcrumb.js +62 -0
- package/dist/core/button/button.js +43 -0
- package/dist/core/button/craft-button.js +78 -0
- package/dist/core/button-group.js +38 -0
- package/dist/core/button.js +40 -0
- package/dist/core/card.js +42 -0
- package/dist/core/carousel/carousel.js +149 -0
- package/dist/core/checkbox/motion-checkbox.js +103 -0
- package/dist/core/collapsible.js +54 -0
- package/dist/core/combobox/combobox.js +85 -0
- package/dist/core/command.js +61 -0
- package/dist/core/field-end-icons.js +36 -0
- package/dist/core/field-label-row.js +33 -0
- package/dist/core/form.js +92 -0
- package/dist/core/hooks/use-controlled-state.js +27 -0
- package/dist/core/hooks/use-data-state.js +39 -0
- package/dist/core/hooks/use-is-in-view.js +18 -0
- package/dist/core/hooks/use-mobile.js +19 -0
- package/dist/core/hooks/use-reveal-on-scroll-up.js +141 -0
- package/dist/core/hooks/use-scroll-overflow.js +50 -0
- package/dist/core/index.js +18 -52
- package/dist/core/input/input-password.js +30 -0
- package/dist/core/input/input.js +147 -0
- package/dist/core/input-otp/input-otp.js +183 -0
- package/dist/core/label.js +15 -0
- package/dist/core/popover.js +31 -0
- package/dist/core/scroll-area.js +42 -0
- package/dist/core/select.js +121 -0
- package/dist/core/separator.js +40 -0
- package/dist/core/skeleton.js +11 -0
- package/dist/core/table.js +59 -0
- package/dist/core/textarea/textarea.js +97 -0
- package/dist/core/utils/get-strict-context.js +18 -0
- package/dist/index.js +148 -9
- package/dist/layouts/entry-layout/entry-layout-bg.js +4 -0
- package/dist/layouts/entry-layout/entry-layout.js +52 -0
- package/dist/layouts/index.js +7 -6
- package/dist/layouts/workspace-layout/account-menu/account-menu.js +108 -0
- package/dist/layouts/workspace-layout/breadcrumbs/derive-breadcrumbs.js +37 -0
- package/dist/layouts/workspace-layout/breadcrumbs/workspace-breadcrumbs.js +22 -0
- package/dist/layouts/workspace-layout/footer/footer.js +15 -0
- package/dist/layouts/workspace-layout/header/header.js +54 -0
- package/dist/layouts/workspace-layout/workspace-layout.js +157 -0
- package/dist/tailwind-preset.js +3 -4
- package/dist/utils/cn.js +8 -0
- package/dist/utils/color.js +72 -0
- package/dist/utils/index.js +3 -2
- package/dist/utils/path-match.js +17 -0
- package/dist/utils/silver-shine.js +63 -0
- package/dist/utils/variant-gradient-underlay.js +45 -0
- package/dist/utils/variant.js +426 -0
- package/package.json +7 -4
- package/dist/chunk-2GDYZAKR.js +0 -505
- package/dist/chunk-ALCWXFUC.js +0 -733
- package/dist/chunk-CDHBLANU.js +0 -59
- package/dist/chunk-LUESSJAF.js +0 -70068
- package/dist/chunk-TMORRNEB.js +0 -323
- package/dist/chunk-TRTQSARU.js +0 -31
- package/dist/chunk-VU4CZ76T.js +0 -43
- package/dist/chunk-XNLCVHBC.js +0 -364
- package/dist/chunk-Z4776NRY.js +0 -4347
- package/src/assets/illustrations/add-to-group.svg +0 -32
- package/src/assets/illustrations/chip.svg +0 -51
- package/src/assets/illustrations/create-new-group.svg +0 -27
- package/src/assets/illustrations/new-ota.svg +0 -61
- package/src/assets/illustrations/secured-key.svg +0 -48
- /package/dist/assets/{entry-layout-bg-JPI7GJ42.webp → entry-layout-bg-DUM0UhT3.webp} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { PRESET_GRADIENT_BACKDROP, PRESET_GRADIENT_FRAME, VARIANTS, VARIANT_GRADIENT_BACKDROP_BASE, VARIANT_GRADIENT_DURATION_CLASS, VARIANT_GRADIENT_HOVER_OVERLAY_CLASS, VARIANT_GRADIENT_TRANSITION_DURATION_MS, arbitraryGradientBackgroundImage, resolveVariantStyles } from "../utils/variant.js";
|
|
2
|
+
import { Accordion } from "./accordion/accordion.js";
|
|
3
|
+
import Avatar from "./avatar/avatar.js";
|
|
4
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../core/animate-ui/components/radix/dropdown-menu.js";
|
|
5
|
+
import { LIST_CLASS_NAMES } from "./list/list.props.js";
|
|
6
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../core/collapsible.js";
|
|
7
|
+
import List from "./list/list.js";
|
|
8
|
+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../core/card.js";
|
|
9
|
+
import { SimpleCard } from "./cards/simple-card.js";
|
|
10
|
+
import { BasicDetailsCard } from "./cards/basic-details-card.js";
|
|
11
|
+
import { illustrationRegistry, illustrationsById, parseSvgViewBoxAspectRatio } from "./illustration/illustration-registry.js";
|
|
12
|
+
import { Illustration } from "./illustration/illustration.js";
|
|
13
|
+
import NoDataCard from "./cards/no-data-card/no-data-card.js";
|
|
14
|
+
import { CollapsibleCard } from "./cards/collapsible-card.js";
|
|
15
|
+
import { buttonVariants } from "../core/button.js";
|
|
16
|
+
import { Tooltip as Tooltip$1, TooltipContent, TooltipProvider, TooltipTrigger } from "../core/animate-ui/components/animate/tooltip.js";
|
|
17
|
+
import Tooltip from "./tooltip/tooltip.js";
|
|
18
|
+
import { Button } from "./button/button.js";
|
|
19
|
+
import { InvertButton } from "./button/invert-button.js";
|
|
20
|
+
import { FlashButton } from "./button/flash-button.js";
|
|
21
|
+
import { CopyButton } from "../core/animate-ui/components/buttons/copy.js";
|
|
22
|
+
import { SectionCard } from "./cards/section-card.js";
|
|
23
|
+
import { LottieAnimationContainer } from "./lottie-animation-container/lottie-animation-container.js";
|
|
24
|
+
import { animatedCardAnimations, animatedCardTypeKeys } from "./cards/animated-card/animated-card-animations.js";
|
|
25
|
+
import { AnimatedCard } from "./cards/animated-card/animated-card.js";
|
|
26
|
+
import { ScrollArea, ScrollBar } from "../core/scroll-area.js";
|
|
27
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../core/popover.js";
|
|
28
|
+
import { ListDetails } from "./list-details/list-details.js";
|
|
29
|
+
import Menu from "./menu/menu.js";
|
|
30
|
+
import { useIsMobile } from "../core/hooks/use-mobile.js";
|
|
31
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "../core/animate-ui/components/radix/sheet.js";
|
|
32
|
+
import { NavBar } from "./nav-bar/nav-bar.js";
|
|
33
|
+
import { Input } from "../core/input/input.js";
|
|
34
|
+
import { InputPassword } from "../core/input/input-password.js";
|
|
35
|
+
import { Separator } from "../core/separator.js";
|
|
36
|
+
import { Skeleton } from "../core/skeleton.js";
|
|
37
|
+
import { Sidebar as Sidebar$1, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "../core/animate-ui/components/radix/sidebar.js";
|
|
38
|
+
import { isSidebarGroup } from "./sidebar/types.js";
|
|
39
|
+
import Sidebar from "./sidebar/sidebar.js";
|
|
40
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "../core/select.js";
|
|
41
|
+
import { Tabs, TabsContent, TabsContents, TabsList, TabsTrigger } from "../core/animate-ui/components/animate/tabs.js";
|
|
42
|
+
import { ScrollableSections } from "./scrollable-sections/scrollable-sections.js";
|
|
43
|
+
import { Label } from "../core/label.js";
|
|
44
|
+
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "../core/form.js";
|
|
45
|
+
import { IconAvatar } from "./icon-avatar/icon-avatar.js";
|
|
46
|
+
import { TYPOGRAPHY_VARIANTS, typographyDefaultElement, typographyVariantClasses } from "./typography/typography-variants.js";
|
|
47
|
+
import { Typography } from "./typography/typography.js";
|
|
48
|
+
import { FileUpload } from "./file-upload/file-upload.js";
|
|
49
|
+
import { FileInput } from "./file-input/file-input.js";
|
|
50
|
+
import { Checkbox } from "../core/checkbox/motion-checkbox.js";
|
|
51
|
+
import { Switch } from "../core/animate-ui/components/radix/switch.js";
|
|
52
|
+
import { ToggleGroup, ToggleGroupItem } from "../core/animate-ui/components/radix/toggle-group.js";
|
|
53
|
+
import { RadioGroup } from "./radio-group/radio-group.js";
|
|
54
|
+
import { SelectableCardList } from "./selectable-card-list/selectable-card-list.js";
|
|
55
|
+
import { StatusCardList } from "./status-card-list/status-card-list.js";
|
|
56
|
+
import { VerticalStepper } from "./vertical-stepper/vertical-stepper.js";
|
|
57
|
+
import { Badge, badgeVariants } from "../core/badge.js";
|
|
58
|
+
import { Spinner } from "./spinner/spinner.js";
|
|
59
|
+
import { StatCard } from "./stat-card/stat-card.js";
|
|
60
|
+
import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from "../core/button-group.js";
|
|
61
|
+
import { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from "./chart/chart.js";
|
|
62
|
+
import { CHART_CATEGORY_COLORS, CHART_SERIES_COLORS, DEFAULT_CHART_SERIES_COLORS, buildSeriesChartConfig, getChartSeriesColor } from "./chart/chart-colors.js";
|
|
63
|
+
import { BarChart } from "./chart/bar-chart.js";
|
|
64
|
+
import { AreaChart } from "./chart/area-chart.js";
|
|
65
|
+
import { LineChart } from "./chart/line-chart.js";
|
|
66
|
+
import { ComposedChart } from "./chart/composed-chart.js";
|
|
67
|
+
import { DonutChart } from "./chart/donut-chart.js";
|
|
68
|
+
import { TreemapChart } from "./chart/treemap-chart.js";
|
|
69
|
+
import { InputOTP, InputOTPSeparator } from "../core/input-otp/input-otp.js";
|
|
70
|
+
import { Carousel } from "./carousel/carousel.js";
|
|
71
|
+
import { Textarea } from "../core/textarea/textarea.js";
|
|
72
|
+
import { AsyncCombobox } from "../core/combobox/combobox.js";
|
|
73
|
+
import { AsyncMultiSelect } from "./async-multi-select/async-multi-select.js";
|
|
74
|
+
import { Calendar, CalendarDayButton } from "./calendar/calendar.js";
|
|
75
|
+
import { DatePicker } from "./date-picker/date-picker.js";
|
|
76
|
+
import { TimePicker } from "./time-picker/time-picker.js";
|
|
77
|
+
import { DateTimePicker } from "./date-time-picker/date-time-picker.js";
|
|
78
|
+
import { PRESET_IDS, PRESET_LABELS, ROLLING_PRESET_IDS, computeDateRange } from "./date-range-picker/presets.js";
|
|
79
|
+
import { DateRangePicker } from "./date-range-picker/date-range-picker.js";
|
|
80
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../core/breadcrumb.js";
|
|
81
|
+
import { SimplifiedDate } from "./simplified-date/simplified-date.js";
|
|
82
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "../core/table.js";
|
|
83
|
+
import { Link } from "./link/link.js";
|
|
84
|
+
import SearchBox from "./search-box/search-box.js";
|
|
85
|
+
import FiltersBar from "./filters-bar/filters-bar.js";
|
|
86
|
+
import AdvancedSearchBox from "./advanced-search-box/advanced-search-box.js";
|
|
87
|
+
import { TogglableItemsList } from "./togglable-items-list/togglable-items-list.js";
|
|
88
|
+
import { Pagination } from "./pagination/pagination.js";
|
|
89
|
+
import { DEFAULT_PAGE_SIZE_OPTIONS } from "./pagination/pagination.props.js";
|
|
90
|
+
import { CopiableText } from "./copiable-text/copiable-text.js";
|
|
91
|
+
import { TableSkeleton } from "./skeletons/table-skeleton.js";
|
|
92
|
+
import { DataTable } from "./data-table/data-table.js";
|
|
93
|
+
import { DataTableRowActions } from "./data-table/row-actions.js";
|
|
94
|
+
import { DeviceIcon } from "./device-icon/device-icon.js";
|
|
95
|
+
import { userTypeBadgeRegistry, userTypeBadgeUserTypes } from "./user-type-badge/user-type-badge.registry.js";
|
|
96
|
+
import { UserTypeBadge, userTypeBadgeSizeVariants } from "./user-type-badge/user-type-badge.js";
|
|
97
|
+
import { StatusBadge, statusBadgeSizeVariants } from "./status-badge/status-badge.js";
|
|
98
|
+
import { Tag } from "./tag/tag.js";
|
|
99
|
+
import { TagInput } from "./tag-input/tag-input.js";
|
|
100
|
+
import { TransferList } from "./transfer-list/transfer-list.js";
|
|
101
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "../core/animate-ui/components/radix/dialog.js";
|
|
102
|
+
import { IconTextActionCard } from "./icon-text-action-card/icon-text-action-card.js";
|
|
103
|
+
import { Alert } from "./alert/alert.js";
|
|
104
|
+
import { ConfirmationDialog } from "./confirmation-dialog/confirmation-dialog.js";
|
|
105
|
+
import { PreviewCard, PreviewCardBackdrop, PreviewCardPanel, PreviewCardTrigger } from "../core/animate-ui/components/base/preview-card.js";
|
|
106
|
+
import { Code } from "../core/animate-ui/components/animate/code.js";
|
|
107
|
+
import { MonospaceContent } from "./monospace-content/monospace-content.js";
|
|
108
|
+
import { SimpleList } from "./simple-list/simple-list.js";
|
|
109
|
+
import { DynamicList } from "./dynamic-list/dynamic-list.js";
|
|
110
|
+
import { KeyValueManager } from "./key-value-manager/key-value-manager.js";
|
|
111
|
+
import { RequirementList } from "./requirement-list/requirement-list.js";
|
|
112
|
+
import { SimplePaginatedList } from "./simple-paginated-list/simple-paginated-list.js";
|
|
113
|
+
import { Toast, Toaster, toast } from "./toast/toast.js";
|
|
114
|
+
import { MarkdownContent } from "./markdown-content/markdown-content.js";
|
|
115
|
+
import { OverflowBadgeList } from "./overflow-badge-list/overflow-badge-list.js";
|
|
116
|
+
import { PopCollectionItem } from "./animated-containers/pop-collection-item.js";
|
|
117
|
+
import { FullscreenDialog } from "./fullscreen-dialog/fullscreen-dialog.js";
|
|
118
|
+
import { VerificationInProgress } from "./lottie-animations/verification-in-progress/verification-in-progress.js";
|
|
119
|
+
import { CircularProgress } from "./circular-progress/circular-progress.js";
|
|
120
|
+
import { ProgressBar } from "./progress-bar/progress-bar.js";
|
|
121
|
+
import { FullSizeError } from "./error-display/full-size-error/full-size-error.js";
|
|
122
|
+
import { InlineError } from "./error-display/inline-error/inline-error.js";
|
|
123
|
+
import { SimpleClickableCard } from "./simple-clickable-card/simple-clickable-card.js";
|
|
124
|
+
import { SimpleInfoCard } from "./simple-info-card/simple-info-card.js";
|
|
125
|
+
import { GlitchText } from "./text-effects/glitch-effect/glitch-text.js";
|
|
126
|
+
import { GradientText } from "./text-effects/gradient-text/gradient-text.js";
|
|
127
|
+
import { HighlightText } from "./text-effects/highlight-text/highlight-text.js";
|
|
128
|
+
import { ShimmeringText } from "./text-effects/shimmer-text/shimmer-text.js";
|
|
129
|
+
import { parseTextMarkup } from "./text-effects/parse-text-markup.js";
|
|
130
|
+
import { CodeEditor } from "./code-editor/code-editor.js";
|
|
131
|
+
import { ContentContainer } from "./content-container/content-container.js";
|
|
132
|
+
import PageContainer from "./page-container/page-container.js";
|
|
133
|
+
import PageContainerSkeleton from "./page-container/page-container-skeleton.js";
|
|
134
|
+
export { Accordion, AdvancedSearchBox, Alert, AnimatedCard, AreaChart, AsyncCombobox, AsyncMultiSelect, Avatar, Badge, BarChart, BasicDetailsCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_CATEGORY_COLORS, CHART_SERIES_COLORS, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, CircularProgress, Code, CodeEditor, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, ComposedChart, ConfirmationDialog, ContentContainer, CopiableText, CopyButton, DEFAULT_CHART_SERIES_COLORS, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, DataTableRowActions, DatePicker, DateRangePicker, DateTimePicker, DeviceIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DonutChart, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicList, FileInput, FileUpload, FiltersBar, FlashButton, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FullSizeError, FullscreenDialog, GlitchText, GradientText, HighlightText, IconAvatar, IconTextActionCard, Illustration, InlineError, Input, InputOTP, InputOTPSeparator, InputPassword, InvertButton, KeyValueManager, LIST_CLASS_NAMES, Label, LineChart, Link, List, ListDetails, LottieAnimationContainer, MarkdownContent, Menu, MonospaceContent, NavBar, NoDataCard, OverflowBadgeList, PRESET_GRADIENT_BACKDROP, PRESET_GRADIENT_FRAME, PRESET_IDS, PRESET_LABELS, PageContainer, PageContainerSkeleton, Pagination, PopCollectionItem, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreviewCard, PreviewCardBackdrop, PreviewCardPanel, PreviewCardTrigger, ProgressBar, ROLLING_PRESET_IDS, RadioGroup, RequirementList, ScrollArea, ScrollBar, ScrollableSections, SearchBox, SectionCard, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCardList, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShimmeringText, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, Sidebar$1 as SidebarPrimitive, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SimpleCard, SimpleClickableCard, SimpleInfoCard, SimpleList, SimplePaginatedList, SimplifiedDate, Skeleton, Spinner, StatCard, StatusBadge, StatusCardList, Switch, TYPOGRAPHY_VARIANTS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSkeleton, Tabs, TabsContent, TabsContents, TabsList, TabsTrigger, Tag, TagInput, Textarea, TimePicker, Toast, Toaster, TogglableItemsList, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, Tooltip$1 as TooltipRoot, TooltipTrigger, TransferList, TreemapChart, Typography, UserTypeBadge, VARIANTS, VARIANT_GRADIENT_BACKDROP_BASE, VARIANT_GRADIENT_DURATION_CLASS, VARIANT_GRADIENT_HOVER_OVERLAY_CLASS, VARIANT_GRADIENT_TRANSITION_DURATION_MS, VerificationInProgress, VerticalStepper, animatedCardAnimations, animatedCardTypeKeys, arbitraryGradientBackgroundImage, badgeVariants, buildSeriesChartConfig, buttonGroupVariants, buttonVariants, computeDateRange, getChartSeriesColor, illustrationRegistry, illustrationsById, isSidebarGroup, parseSvgViewBoxAspectRatio, parseTextMarkup, resolveVariantStyles, statusBadgeSizeVariants, toast, typographyDefaultElement, typographyVariantClasses, useFormField, useIsMobile, useSidebar, userTypeBadgeRegistry, userTypeBadgeSizeVariants, userTypeBadgeUserTypes };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Button } from "../button/button.js";
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../core/popover.js";
|
|
5
|
+
import { KeyValueManagerField } from "./key-value-manager-field.js";
|
|
6
|
+
import { validateField } from "./key-value-manager.utils.js";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { ArrowRight, Plus } from "lucide-react";
|
|
10
|
+
//#region src/components/key-value-manager/key-value-manager-add-popover.tsx
|
|
11
|
+
function KeyValueManagerAddPopover({ items, meta, labels, maxAllowed, onUpdate, triggerClassName }) {
|
|
12
|
+
const [open, setOpen] = useState(false);
|
|
13
|
+
const [draftKey, setDraftKey] = useState("");
|
|
14
|
+
const [draftValue, setDraftValue] = useState("");
|
|
15
|
+
const [keyError, setKeyError] = useState(false);
|
|
16
|
+
const [valueError, setValueError] = useState(false);
|
|
17
|
+
const [showSuccess, setShowSuccess] = useState(false);
|
|
18
|
+
const atLimit = maxAllowed !== void 0 && items.length >= maxAllowed;
|
|
19
|
+
const resetFormState = () => {
|
|
20
|
+
setDraftKey("");
|
|
21
|
+
setDraftValue("");
|
|
22
|
+
setKeyError(false);
|
|
23
|
+
setValueError(false);
|
|
24
|
+
setShowSuccess(false);
|
|
25
|
+
};
|
|
26
|
+
const handleOpenChange = (nextOpen) => {
|
|
27
|
+
setOpen(nextOpen);
|
|
28
|
+
if (!nextOpen) resetFormState();
|
|
29
|
+
};
|
|
30
|
+
const handleFieldChange = (field, value) => {
|
|
31
|
+
setShowSuccess(false);
|
|
32
|
+
if (field === "key") {
|
|
33
|
+
setDraftKey(value);
|
|
34
|
+
if (keyError) setKeyError(false);
|
|
35
|
+
} else {
|
|
36
|
+
setDraftValue(value);
|
|
37
|
+
if (valueError) setValueError(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const handleAdd = () => {
|
|
41
|
+
setShowSuccess(false);
|
|
42
|
+
const trimmedKey = draftKey.trim();
|
|
43
|
+
const trimmedValue = draftValue.trim();
|
|
44
|
+
const nextKeyError = !trimmedKey || !validateField(trimmedKey, meta?.key);
|
|
45
|
+
const nextValueError = !trimmedValue || !validateField(trimmedValue, meta?.value);
|
|
46
|
+
if (nextKeyError || nextValueError) {
|
|
47
|
+
setKeyError(nextKeyError);
|
|
48
|
+
setValueError(nextValueError);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (items.some((item) => item.key === trimmedKey)) {
|
|
52
|
+
setKeyError(true);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
onUpdate([...items, {
|
|
56
|
+
key: trimmedKey,
|
|
57
|
+
value: trimmedValue
|
|
58
|
+
}]);
|
|
59
|
+
setDraftKey("");
|
|
60
|
+
setDraftValue("");
|
|
61
|
+
setKeyError(false);
|
|
62
|
+
setValueError(false);
|
|
63
|
+
setShowSuccess(true);
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
66
|
+
open,
|
|
67
|
+
onOpenChange: handleOpenChange,
|
|
68
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
69
|
+
asChild: true,
|
|
70
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
71
|
+
type: "button",
|
|
72
|
+
variant: "ghost",
|
|
73
|
+
color: "primary",
|
|
74
|
+
fullWidth: false,
|
|
75
|
+
disabled: atLimit,
|
|
76
|
+
className: cn("shrink-0 max-sm:size-9 max-sm:gap-0 max-sm:px-0", triggerClassName),
|
|
77
|
+
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
78
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: "max-sm:sr-only",
|
|
80
|
+
children: labels.add
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
84
|
+
align: "end",
|
|
85
|
+
className: "w-80 space-y-4",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(KeyValueManagerField, {
|
|
88
|
+
field: "key",
|
|
89
|
+
label: labels.keyLabel,
|
|
90
|
+
value: draftKey,
|
|
91
|
+
meta: meta?.key,
|
|
92
|
+
error: keyError,
|
|
93
|
+
errorMessage: labels.keyErrorMessage,
|
|
94
|
+
selectPlaceholder: labels.selectPlaceholder,
|
|
95
|
+
onChange: (value) => handleFieldChange("key", value)
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(KeyValueManagerField, {
|
|
98
|
+
field: "value",
|
|
99
|
+
label: labels.valueLabel,
|
|
100
|
+
value: draftValue,
|
|
101
|
+
meta: meta?.value,
|
|
102
|
+
error: valueError,
|
|
103
|
+
errorMessage: labels.valueErrorMessage,
|
|
104
|
+
selectPlaceholder: labels.selectPlaceholder,
|
|
105
|
+
onChange: (value) => handleFieldChange("value", value)
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsxs("div", {
|
|
108
|
+
className: "flex flex-col gap-2",
|
|
109
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
110
|
+
type: "button",
|
|
111
|
+
color: "primary",
|
|
112
|
+
fullWidth: false,
|
|
113
|
+
onClick: handleAdd,
|
|
114
|
+
endIcon: /* @__PURE__ */ jsx(ArrowRight, {}),
|
|
115
|
+
children: labels.add
|
|
116
|
+
}), showSuccess ? /* @__PURE__ */ jsx("p", {
|
|
117
|
+
className: cn("text-sm text-success"),
|
|
118
|
+
children: labels.successMessage
|
|
119
|
+
}) : null]
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { KeyValueManagerAddPopover };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Input } from "../../core/input/input.js";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../core/select.js";
|
|
4
|
+
import { Textarea } from "../../core/textarea/textarea.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/key-value-manager/key-value-manager-field.tsx
|
|
7
|
+
/**
|
|
8
|
+
* One field of the add popover: a select when `meta.options` is set, otherwise
|
|
9
|
+
* an input for the key and a textarea for the value.
|
|
10
|
+
*/
|
|
11
|
+
function KeyValueManagerField({ field, label, value, meta, error, errorMessage, selectPlaceholder, onChange }) {
|
|
12
|
+
const errorContent = error ? errorMessage : void 0;
|
|
13
|
+
if (meta?.options) return /* @__PURE__ */ jsxs(Select, {
|
|
14
|
+
value: value || void 0,
|
|
15
|
+
onValueChange: onChange,
|
|
16
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
17
|
+
label,
|
|
18
|
+
size: "sm",
|
|
19
|
+
error,
|
|
20
|
+
errorContent,
|
|
21
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: selectPlaceholder })
|
|
22
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: meta.options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
23
|
+
value: option,
|
|
24
|
+
children: option
|
|
25
|
+
}, option)) })]
|
|
26
|
+
}, value ? "selected" : "empty");
|
|
27
|
+
if (field === "key") return /* @__PURE__ */ jsx(Input, {
|
|
28
|
+
label,
|
|
29
|
+
value,
|
|
30
|
+
charLimit: meta?.maxLength,
|
|
31
|
+
error,
|
|
32
|
+
size: "sm",
|
|
33
|
+
errorContent,
|
|
34
|
+
onChange: (e) => onChange(e.target.value)
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsx(Textarea, {
|
|
37
|
+
label,
|
|
38
|
+
value,
|
|
39
|
+
charLimit: meta?.maxLength,
|
|
40
|
+
error,
|
|
41
|
+
errorContent,
|
|
42
|
+
onChange: (e) => onChange(e.target.value),
|
|
43
|
+
size: "sm"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { KeyValueManagerField };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { BasicDetailsCard } from "../cards/basic-details-card.js";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../core/table.js";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronLeft, ChevronRight, Trash2 } from "lucide-react";
|
|
9
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
10
|
+
//#region src/components/key-value-manager/key-value-manager-table.tsx
|
|
11
|
+
var slideTransition = {
|
|
12
|
+
duration: .15,
|
|
13
|
+
ease: [
|
|
14
|
+
.22,
|
|
15
|
+
1,
|
|
16
|
+
.36,
|
|
17
|
+
1
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
var slideVariants = {
|
|
21
|
+
enter: (dir) => ({
|
|
22
|
+
x: dir > 0 ? "100%" : "-100%",
|
|
23
|
+
opacity: 1
|
|
24
|
+
}),
|
|
25
|
+
center: {
|
|
26
|
+
x: 0,
|
|
27
|
+
opacity: 1
|
|
28
|
+
},
|
|
29
|
+
exit: (dir) => ({
|
|
30
|
+
x: dir > 0 ? "-100%" : "100%",
|
|
31
|
+
opacity: 1
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
function KeyValueManagerTable({ rows, itemsPerPage = 10, hasSearchQuery, onDelete, keyLabel, valueLabel, actionLabel, emptyItems, emptySearch }) {
|
|
35
|
+
const [page, setPage] = useState(0);
|
|
36
|
+
const [direction, setDirection] = useState(1);
|
|
37
|
+
const pageSize = Math.max(1, itemsPerPage);
|
|
38
|
+
const totalPages = Math.max(1, Math.ceil(rows.length / pageSize));
|
|
39
|
+
const showPagination = rows.length > pageSize;
|
|
40
|
+
const pageRows = rows.slice(page * pageSize, (page + 1) * pageSize);
|
|
41
|
+
const hasPrev = page > 0;
|
|
42
|
+
const hasNext = page < totalPages - 1;
|
|
43
|
+
const noRows = rows.length === 0;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setPage((current) => Math.min(current, Math.max(0, totalPages - 1)));
|
|
46
|
+
}, [
|
|
47
|
+
rows,
|
|
48
|
+
pageSize,
|
|
49
|
+
totalPages
|
|
50
|
+
]);
|
|
51
|
+
const goPrev = () => {
|
|
52
|
+
if (!hasPrev || noRows) return;
|
|
53
|
+
setDirection(-1);
|
|
54
|
+
setPage((current) => current - 1);
|
|
55
|
+
};
|
|
56
|
+
const goNext = () => {
|
|
57
|
+
if (!hasNext || noRows) return;
|
|
58
|
+
setDirection(1);
|
|
59
|
+
setPage((current) => current + 1);
|
|
60
|
+
};
|
|
61
|
+
const deleteButton = (item, sourceIndex, className) => /* @__PURE__ */ jsx(Button, {
|
|
62
|
+
type: "button",
|
|
63
|
+
variant: "ghost",
|
|
64
|
+
color: "error",
|
|
65
|
+
size: "icon",
|
|
66
|
+
fullWidth: false,
|
|
67
|
+
"aria-label": `Delete ${item.key}`,
|
|
68
|
+
className,
|
|
69
|
+
onClick: () => onDelete(sourceIndex),
|
|
70
|
+
children: /* @__PURE__ */ jsx(Trash2, {
|
|
71
|
+
className: "h-4 w-4",
|
|
72
|
+
"aria-hidden": true
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
const emptyMessage = hasSearchQuery ? emptySearch : emptyItems;
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
77
|
+
className: "w-full",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: "overflow-hidden sm:hidden",
|
|
81
|
+
children: noRows ? /* @__PURE__ */ jsx("p", {
|
|
82
|
+
className: "py-8 text-center text-sm text-muted-foreground",
|
|
83
|
+
children: emptyMessage
|
|
84
|
+
}) : /* @__PURE__ */ jsx(AnimatePresence, {
|
|
85
|
+
mode: "wait",
|
|
86
|
+
custom: direction,
|
|
87
|
+
initial: false,
|
|
88
|
+
children: /* @__PURE__ */ jsx(motion.ul, {
|
|
89
|
+
custom: direction,
|
|
90
|
+
variants: slideVariants,
|
|
91
|
+
initial: "enter",
|
|
92
|
+
animate: "center",
|
|
93
|
+
exit: "exit",
|
|
94
|
+
transition: slideTransition,
|
|
95
|
+
className: "divide-y divide-border",
|
|
96
|
+
children: pageRows.map(({ item, sourceIndex }) => /* @__PURE__ */ jsx("li", {
|
|
97
|
+
className: "py-3",
|
|
98
|
+
children: /* @__PURE__ */ jsx(BasicDetailsCard, {
|
|
99
|
+
primaryText: /* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: "block truncate",
|
|
101
|
+
children: item.key
|
|
102
|
+
}),
|
|
103
|
+
secondaryText: item.value,
|
|
104
|
+
action: deleteButton(item, sourceIndex)
|
|
105
|
+
})
|
|
106
|
+
}, `${sourceIndex}-${item.key}`))
|
|
107
|
+
}, page)
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsxs(Table, {
|
|
111
|
+
containerClassName: "hidden sm:block",
|
|
112
|
+
children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(TableHead, { children: keyLabel }),
|
|
114
|
+
/* @__PURE__ */ jsx(TableHead, { children: valueLabel }),
|
|
115
|
+
/* @__PURE__ */ jsx(TableHead, {
|
|
116
|
+
className: "w-12 text-right",
|
|
117
|
+
children: actionLabel
|
|
118
|
+
})
|
|
119
|
+
] }) }), /* @__PURE__ */ jsx(TableBody, { children: noRows ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
120
|
+
colSpan: 3,
|
|
121
|
+
className: "py-8 text-center text-muted-foreground",
|
|
122
|
+
children: emptyMessage
|
|
123
|
+
}) }) : /* @__PURE__ */ jsx(AnimatePresence, {
|
|
124
|
+
mode: "wait",
|
|
125
|
+
custom: direction,
|
|
126
|
+
children: /* @__PURE__ */ jsx(motion.tr, {
|
|
127
|
+
custom: direction,
|
|
128
|
+
variants: slideVariants,
|
|
129
|
+
initial: "enter",
|
|
130
|
+
animate: "center",
|
|
131
|
+
exit: "exit",
|
|
132
|
+
transition: slideTransition,
|
|
133
|
+
className: "contents",
|
|
134
|
+
children: pageRows.map(({ item, sourceIndex }) => /* @__PURE__ */ jsxs(TableRow, {
|
|
135
|
+
className: "group",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
138
|
+
className: "max-w-[200px] truncate font-medium",
|
|
139
|
+
children: item.key
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
142
|
+
className: "max-w-[300px] truncate",
|
|
143
|
+
children: item.value
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
146
|
+
className: "text-right",
|
|
147
|
+
children: deleteButton(item, sourceIndex, cn("transition-opacity [@media(hover:hover)]:pointer-events-none [@media(hover:hover)]:opacity-0", "group-hover:pointer-events-auto group-hover:opacity-100", "focus-visible:opacity-100"))
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}, `${sourceIndex}-${item.key}`))
|
|
151
|
+
}, page)
|
|
152
|
+
}) })]
|
|
153
|
+
}),
|
|
154
|
+
showPagination ? /* @__PURE__ */ jsxs("div", {
|
|
155
|
+
className: "mt-3 flex justify-end gap-1 px-2",
|
|
156
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
157
|
+
type: "button",
|
|
158
|
+
variant: "ghost",
|
|
159
|
+
color: "primary",
|
|
160
|
+
size: "icon",
|
|
161
|
+
fullWidth: false,
|
|
162
|
+
"aria-label": "Previous page",
|
|
163
|
+
disabled: noRows || !hasPrev,
|
|
164
|
+
onClick: goPrev,
|
|
165
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {
|
|
166
|
+
className: "text-primary",
|
|
167
|
+
"aria-hidden": true
|
|
168
|
+
})
|
|
169
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
170
|
+
type: "button",
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
color: "primary",
|
|
173
|
+
size: "icon",
|
|
174
|
+
fullWidth: false,
|
|
175
|
+
"aria-label": "Next page",
|
|
176
|
+
disabled: noRows || !hasNext,
|
|
177
|
+
onClick: goNext,
|
|
178
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {
|
|
179
|
+
className: "text-primary",
|
|
180
|
+
"aria-hidden": true
|
|
181
|
+
})
|
|
182
|
+
})]
|
|
183
|
+
}) : null
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { KeyValueManagerTable };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Button } from "../button/button.js";
|
|
4
|
+
import SearchBox from "../search-box/search-box.js";
|
|
5
|
+
import { filterKeyValueRows } from "./key-value-manager.utils.js";
|
|
6
|
+
import { KeyValueManagerAddPopover } from "./key-value-manager-add-popover.js";
|
|
7
|
+
import { KeyValueManagerTable } from "./key-value-manager-table.js";
|
|
8
|
+
import { resolveKeyValueManagerLabels } from "./key-value-manager.props.js";
|
|
9
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Search, X } from "lucide-react";
|
|
12
|
+
//#region src/components/key-value-manager/key-value-manager.tsx
|
|
13
|
+
function KeyValueManager({ items, meta, onUpdate, maxAllowed, itemsPerPage = 10, labels: labelsProp, className }) {
|
|
14
|
+
const labels = resolveKeyValueManagerLabels(labelsProp);
|
|
15
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
16
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
17
|
+
const [searchBoxKey, setSearchBoxKey] = useState(0);
|
|
18
|
+
const toolbarRef = useRef(null);
|
|
19
|
+
const searchButtonRef = useRef(null);
|
|
20
|
+
const returnFocusRef = useRef(false);
|
|
21
|
+
const searchExpanded = searchOpen || searchQuery !== "";
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (searchOpen) toolbarRef.current?.querySelector("input")?.focus();
|
|
24
|
+
}, [searchOpen]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!searchExpanded && returnFocusRef.current) {
|
|
27
|
+
returnFocusRef.current = false;
|
|
28
|
+
searchButtonRef.current?.focus();
|
|
29
|
+
}
|
|
30
|
+
}, [searchExpanded]);
|
|
31
|
+
const closeSearch = () => {
|
|
32
|
+
returnFocusRef.current = true;
|
|
33
|
+
setSearchOpen(false);
|
|
34
|
+
setSearchQuery("");
|
|
35
|
+
setSearchBoxKey((key) => key + 1);
|
|
36
|
+
};
|
|
37
|
+
const filteredRows = useMemo(() => filterKeyValueRows(items, searchQuery), [items, searchQuery]);
|
|
38
|
+
const handleDelete = (sourceIndex) => {
|
|
39
|
+
onUpdate(items.filter((_, index) => index !== sourceIndex));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: cn("flex w-full flex-col gap-4", className),
|
|
43
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
44
|
+
ref: toolbarRef,
|
|
45
|
+
className: "flex items-center gap-3 max-sm:gap-1",
|
|
46
|
+
onKeyDown: (e) => {
|
|
47
|
+
const inToolbar = toolbarRef.current?.contains(e.target);
|
|
48
|
+
if (e.key === "Escape" && searchOpen && inToolbar) closeSearch();
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("div", { className: cn("flex-1 sm:hidden", searchExpanded && "hidden") }),
|
|
52
|
+
/* @__PURE__ */ jsx(Button, {
|
|
53
|
+
type: "button",
|
|
54
|
+
variant: "ghost",
|
|
55
|
+
color: "primary",
|
|
56
|
+
size: "icon",
|
|
57
|
+
fullWidth: false,
|
|
58
|
+
ref: searchButtonRef,
|
|
59
|
+
"aria-label": labels.search,
|
|
60
|
+
className: cn("sm:hidden", searchExpanded && "hidden"),
|
|
61
|
+
onClick: () => setSearchOpen(true),
|
|
62
|
+
children: /* @__PURE__ */ jsx(Search, {
|
|
63
|
+
className: "h-4 w-4",
|
|
64
|
+
"aria-hidden": true
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ jsx(SearchBox, {
|
|
68
|
+
className: cn("min-w-0 flex-1", !searchExpanded && "max-sm:hidden"),
|
|
69
|
+
placeholder: labels.search,
|
|
70
|
+
onSearch: setSearchQuery,
|
|
71
|
+
onClear: () => setSearchQuery(""),
|
|
72
|
+
onValueChange: setSearchQuery
|
|
73
|
+
}, searchBoxKey),
|
|
74
|
+
/* @__PURE__ */ jsx(Button, {
|
|
75
|
+
type: "button",
|
|
76
|
+
variant: "ghost",
|
|
77
|
+
color: "gray",
|
|
78
|
+
size: "icon",
|
|
79
|
+
fullWidth: false,
|
|
80
|
+
"aria-label": labels.closeSearch,
|
|
81
|
+
className: cn("shrink-0 sm:hidden", !searchExpanded && "hidden"),
|
|
82
|
+
onClick: closeSearch,
|
|
83
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
84
|
+
className: "h-4 w-4",
|
|
85
|
+
"aria-hidden": true
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsx(KeyValueManagerAddPopover, {
|
|
89
|
+
items,
|
|
90
|
+
meta,
|
|
91
|
+
labels,
|
|
92
|
+
maxAllowed,
|
|
93
|
+
onUpdate,
|
|
94
|
+
triggerClassName: cn(searchExpanded && "max-sm:hidden")
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}), /* @__PURE__ */ jsx(KeyValueManagerTable, {
|
|
98
|
+
rows: filteredRows,
|
|
99
|
+
itemsPerPage,
|
|
100
|
+
hasSearchQuery: searchQuery.trim().length > 0,
|
|
101
|
+
onDelete: handleDelete,
|
|
102
|
+
keyLabel: labels.keyLabel,
|
|
103
|
+
valueLabel: labels.valueLabel,
|
|
104
|
+
actionLabel: labels.actionLabel,
|
|
105
|
+
emptyItems: labels.emptyItems,
|
|
106
|
+
emptySearch: labels.emptySearch
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { KeyValueManager };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/components/key-value-manager/key-value-manager.props.ts
|
|
2
|
+
var STATIC_DEFAULT_LABELS = {
|
|
3
|
+
add: "Add",
|
|
4
|
+
closeSearch: "Close search",
|
|
5
|
+
keyErrorMessage: "Invalid key",
|
|
6
|
+
valueErrorMessage: "Invalid value",
|
|
7
|
+
successMessage: "Added successfully",
|
|
8
|
+
keyLabel: "Key",
|
|
9
|
+
valueLabel: "Value",
|
|
10
|
+
actionLabel: "Action",
|
|
11
|
+
emptyItems: "No items",
|
|
12
|
+
emptySearch: "No matches",
|
|
13
|
+
selectPlaceholder: "Select"
|
|
14
|
+
};
|
|
15
|
+
({ ...STATIC_DEFAULT_LABELS }), `${STATIC_DEFAULT_LABELS.keyLabel.toLowerCase()}${STATIC_DEFAULT_LABELS.valueLabel.toLowerCase()}`;
|
|
16
|
+
function resolveKeyValueManagerLabels(labels) {
|
|
17
|
+
const merged = {
|
|
18
|
+
...STATIC_DEFAULT_LABELS,
|
|
19
|
+
...labels
|
|
20
|
+
};
|
|
21
|
+
const search = labels?.search ?? `Search ${merged.keyLabel.toLowerCase()} or ${merged.valueLabel.toLowerCase()}`;
|
|
22
|
+
return {
|
|
23
|
+
...merged,
|
|
24
|
+
search
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { resolveKeyValueManagerLabels };
|