@espressif/dashboard-ui-components 1.10.0 → 1.11.1
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 +75 -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 +16 -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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CheckboxCardList } from "./checkbox-card-list.js";
|
|
3
|
+
import { RadioCardList } from "./radio-card-list.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/selectable-card-list/selectable-card-list.tsx
|
|
6
|
+
function SelectableCardList(props) {
|
|
7
|
+
const { data, size = "default", className, name, form, element = "auto", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = props;
|
|
8
|
+
if (props.allowMultiple === true) return /* @__PURE__ */ jsx(CheckboxCardList, {
|
|
9
|
+
data,
|
|
10
|
+
value: props.value,
|
|
11
|
+
onChange: props.onChange,
|
|
12
|
+
size,
|
|
13
|
+
className,
|
|
14
|
+
ariaLabel,
|
|
15
|
+
ariaLabelledBy,
|
|
16
|
+
name,
|
|
17
|
+
form,
|
|
18
|
+
element
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx(RadioCardList, {
|
|
21
|
+
data,
|
|
22
|
+
value: props.value,
|
|
23
|
+
onChange: props.onChange,
|
|
24
|
+
size,
|
|
25
|
+
className,
|
|
26
|
+
ariaLabel,
|
|
27
|
+
ariaLabelledBy,
|
|
28
|
+
name,
|
|
29
|
+
form,
|
|
30
|
+
element
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { SelectableCardList };
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../../core/animate-ui/components/radix/dropdown-menu.js";
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../core/collapsible.js";
|
|
4
|
+
import Tooltip from "../tooltip/tooltip.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { Sidebar as Sidebar$1, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarHeader, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, useSidebar } from "../../core/animate-ui/components/radix/sidebar.js";
|
|
7
|
+
import { isPathPrefixOf } from "../../utils/path-match.js";
|
|
8
|
+
import { isSidebarGroup } from "./types.js";
|
|
9
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { ChevronDown, ChevronRight, Circle, CircleDot, X } from "lucide-react";
|
|
12
|
+
//#region src/components/sidebar/sidebar.tsx
|
|
13
|
+
/** Overrides SidebarGroup default `p-2` vertical padding so group height matches the trigger row */
|
|
14
|
+
var sidebarGroupClassName = "py-0 px-2";
|
|
15
|
+
/**
|
|
16
|
+
* Single source of truth for nav icon size (16x16) — group icons, item icons, chevrons
|
|
17
|
+
* and `endAction` icons alike, in every sidebar state.
|
|
18
|
+
*
|
|
19
|
+
* Applied to the *row* rather than to each icon, and with a descendant (`&_svg`) rather
|
|
20
|
+
* than a child (`&>svg`) selector: rows render through `asChild` with a
|
|
21
|
+
* `<span className="contents">` inside, so icons sit at grandchild depth where the
|
|
22
|
+
* primitives' own `[&>svg]:size-4` never matches. The `:not([class*='size-'])` guard
|
|
23
|
+
* keeps a deliberate per-icon `size-*` override working — same idiom as `dropdown-menu`.
|
|
24
|
+
*/
|
|
25
|
+
var rowIconClass = "[&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0";
|
|
26
|
+
/**
|
|
27
|
+
* One type scale for every nav row. Set as an inline style, not a Tailwind class:
|
|
28
|
+
* `SidebarMenuButton` is used with `asChild`, and both the highlight effect and
|
|
29
|
+
* app-supplied `linkComponent`s drop a forwarded `style`, so it has to live on an
|
|
30
|
+
* element this file owns. `--espd-sidebar-item-font-size` is the public override hook.
|
|
31
|
+
*/
|
|
32
|
+
var rowFontStyle = {
|
|
33
|
+
fontSize: "var(--espd-sidebar-item-font-size, 0.875rem)",
|
|
34
|
+
lineHeight: "1.25rem"
|
|
35
|
+
};
|
|
36
|
+
/** Group title in the collapsed-sidebar flyout — same scale as the rows by default. */
|
|
37
|
+
var flyoutGroupLabelStyle = {
|
|
38
|
+
fontSize: "var(--espd-sidebar-flyout-group-label-font-size, 0.875rem)",
|
|
39
|
+
lineHeight: "1.25rem"
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Nav icon for a group or an item. Deliberately sets no size — that comes from the
|
|
43
|
+
* row's {@link rowIconClass}. Items with no `icon` get a neutral placeholder glyph so
|
|
44
|
+
* that a collapsed icon-only row still shows an icon; on the selected row that
|
|
45
|
+
* placeholder becomes a filled `CircleDot` at full opacity, so the current page is
|
|
46
|
+
* still identifiable in the collapsed sidebar where labels are hidden.
|
|
47
|
+
*/
|
|
48
|
+
function ItemIcon({ icon: Icon, active, className }) {
|
|
49
|
+
if (Icon) return /* @__PURE__ */ jsx(Icon, { className });
|
|
50
|
+
if (active) return /* @__PURE__ */ jsx(CircleDot, { className });
|
|
51
|
+
return /* @__PURE__ */ jsx(Circle, { className: cn("opacity-50", className) });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Radix selects an item on Enter/Space by clicking the item element itself, which
|
|
55
|
+
* never reaches the link inside it. Forward clicks that land on the row (keyboard
|
|
56
|
+
* selection, or a pointer on the row's padding) to the link so they navigate too.
|
|
57
|
+
*/
|
|
58
|
+
function forwardRowClickToLink(e) {
|
|
59
|
+
if (e.target !== e.currentTarget) return;
|
|
60
|
+
e.currentTarget.firstElementChild?.click();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Flyout menu items for a group. A click anywhere on a row calls onItemClick (capture
|
|
64
|
+
* phase, since router links preventDefault their clicks and Radix then skips its own
|
|
65
|
+
* select-and-close); onItemPointerDown fires on a pointer press anywhere on the row.
|
|
66
|
+
*/
|
|
67
|
+
function GroupMenuItems({ group, isSelected, linkComponent: LinkComponent, onItemClick, onItemPointerDown }) {
|
|
68
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(DropdownMenuLabel, {
|
|
70
|
+
className: cn("flex items-center gap-2 px-3 py-2 font-normal text-muted-foreground", rowIconClass),
|
|
71
|
+
style: flyoutGroupLabelStyle,
|
|
72
|
+
children: [group.icon ? /* @__PURE__ */ jsx(ItemIcon, {
|
|
73
|
+
icon: group.icon,
|
|
74
|
+
className: "text-foreground"
|
|
75
|
+
}) : null, /* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "truncate",
|
|
77
|
+
children: group.label
|
|
78
|
+
})]
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
81
|
+
group.items.map((item) => {
|
|
82
|
+
const active = isSelected(item.path);
|
|
83
|
+
return /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
84
|
+
className: active ? "bg-accent" : "",
|
|
85
|
+
style: rowFontStyle,
|
|
86
|
+
onPointerDown: onItemPointerDown,
|
|
87
|
+
onClickCapture: onItemClick,
|
|
88
|
+
onClick: forwardRowClickToLink,
|
|
89
|
+
children: /* @__PURE__ */ jsxs(LinkComponent, {
|
|
90
|
+
to: item.path,
|
|
91
|
+
className: "flex items-center gap-2 cursor-pointer w-full",
|
|
92
|
+
children: [/* @__PURE__ */ jsx(ItemIcon, {
|
|
93
|
+
icon: item.icon,
|
|
94
|
+
active
|
|
95
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: active ? "font-semibold" : "font-medium",
|
|
97
|
+
children: item.label
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
}, item.id);
|
|
101
|
+
})
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Collapsed sidebar (icon-only): group rendered as a single icon with flyout Menu.
|
|
106
|
+
* Uses controlled DropdownMenu so clicking an item closes the menu.
|
|
107
|
+
*/
|
|
108
|
+
function CollapsedSidebarGroup({ group, isSelected, linkComponent: LinkComponent }) {
|
|
109
|
+
const [open, setOpen] = useState(false);
|
|
110
|
+
const pickedWithPointer = useRef(false);
|
|
111
|
+
return /* @__PURE__ */ jsx(SidebarGroup, {
|
|
112
|
+
className: sidebarGroupClassName,
|
|
113
|
+
children: /* @__PURE__ */ jsx(SidebarMenu, {
|
|
114
|
+
className: "w-auto",
|
|
115
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
116
|
+
open,
|
|
117
|
+
onOpenChange: (next) => {
|
|
118
|
+
if (next) pickedWithPointer.current = false;
|
|
119
|
+
setOpen(next);
|
|
120
|
+
},
|
|
121
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
122
|
+
asChild: true,
|
|
123
|
+
children: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
124
|
+
size: "sm",
|
|
125
|
+
tooltip: group.label,
|
|
126
|
+
className: rowIconClass,
|
|
127
|
+
children: /* @__PURE__ */ jsx(ItemIcon, { icon: group.icon })
|
|
128
|
+
})
|
|
129
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
130
|
+
side: "right",
|
|
131
|
+
align: "start",
|
|
132
|
+
sideOffset: 8,
|
|
133
|
+
className: "z-50 max-w-xs rounded-2xl shadow-lg will-change-[opacity,transform] py-1.5 overflow-visible select-none",
|
|
134
|
+
style: { minWidth: 180 },
|
|
135
|
+
onCloseAutoFocus: (e) => {
|
|
136
|
+
if (pickedWithPointer.current) e.preventDefault();
|
|
137
|
+
},
|
|
138
|
+
children: /* @__PURE__ */ jsx(GroupMenuItems, {
|
|
139
|
+
group,
|
|
140
|
+
isSelected,
|
|
141
|
+
linkComponent: LinkComponent,
|
|
142
|
+
onItemClick: () => setOpen(false),
|
|
143
|
+
onItemPointerDown: () => {
|
|
144
|
+
pickedWithPointer.current = true;
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
})]
|
|
148
|
+
}) })
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
var groupHeaderClass = cn("flex w-full items-center gap-2 rounded-md p-2 h-7 overflow-hidden font-medium text-sidebar-foreground hover:bg-sidebar-accent/50 transition-colors cursor-pointer", rowIconClass);
|
|
153
|
+
/**
|
|
154
|
+
* Expanded sidebar group with inline collapsible items.
|
|
155
|
+
* Clicking the group header toggles expand/collapse. No flyout menus here —
|
|
156
|
+
* flyouts are only used in CollapsedSidebarGroup (icon-only sidebar state).
|
|
157
|
+
*/
|
|
158
|
+
function ExpandedSidebarGroup({ group, isGroupOpen, onToggle, renderMenuItem }) {
|
|
159
|
+
return /* @__PURE__ */ jsx(Collapsible, {
|
|
160
|
+
open: isGroupOpen,
|
|
161
|
+
onOpenChange: onToggle,
|
|
162
|
+
children: /* @__PURE__ */ jsxs(SidebarGroup, {
|
|
163
|
+
className: sidebarGroupClassName,
|
|
164
|
+
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
165
|
+
asChild: true,
|
|
166
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
className: groupHeaderClass,
|
|
169
|
+
style: rowFontStyle,
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ jsx(ItemIcon, { icon: group.icon }),
|
|
172
|
+
/* @__PURE__ */ jsx("span", {
|
|
173
|
+
className: "truncate",
|
|
174
|
+
children: group.label
|
|
175
|
+
}),
|
|
176
|
+
isGroupOpen ? /* @__PURE__ */ jsx(ChevronDown, { className: "ml-auto transition-transform" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto transition-transform" })
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, {
|
|
180
|
+
className: "pl-6 pt-1",
|
|
181
|
+
children: group.items.map((item) => renderMenuItem(item))
|
|
182
|
+
}) }) })]
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Single top-level link: no collapsible, same row styling as nested items.
|
|
188
|
+
*/
|
|
189
|
+
function TopLevelLinkRow({ item, isCollapsed, isMobile, renderMenuItem }) {
|
|
190
|
+
return /* @__PURE__ */ jsx(SidebarGroup, {
|
|
191
|
+
className: sidebarGroupClassName,
|
|
192
|
+
children: /* @__PURE__ */ jsx(SidebarMenu, {
|
|
193
|
+
className: isCollapsed && !isMobile ? "w-auto" : void 0,
|
|
194
|
+
children: renderMenuItem(item)
|
|
195
|
+
})
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function Sidebar({ items, currentPath, header, headerHeight, footer, linkComponent: LinkComponent, collapsible = "icon", variant = "sidebar", focusActiveGroup = false }) {
|
|
199
|
+
const { state, isMobile, setOpenMobile } = useSidebar();
|
|
200
|
+
const isCollapsed = state === "collapsed";
|
|
201
|
+
/** On mobile the sidebar is a sheet overlaying the page: navigating away should dismiss it. */
|
|
202
|
+
const closeMobileSidebar = () => {
|
|
203
|
+
if (isMobile) setOpenMobile(false);
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Id of the group whose {@link SidebarItemConfig.path} is the currently-selected
|
|
207
|
+
* route (using the same segment-aware match as row highlighting). `null` when no
|
|
208
|
+
* group owns the active path — e.g. the active route lives on a top-level link,
|
|
209
|
+
* or nothing is selected yet.
|
|
210
|
+
*/
|
|
211
|
+
const activeGroupId = useMemo(() => {
|
|
212
|
+
for (const entry of items) {
|
|
213
|
+
if (!isSidebarGroup(entry)) continue;
|
|
214
|
+
if (entry.items.some((item) => isPathPrefixOf(item.path, currentPath))) return entry.id;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}, [items, currentPath]);
|
|
218
|
+
const [expandedGroups, setExpandedGroups] = useState(() => {
|
|
219
|
+
if (focusActiveGroup && activeGroupId) return /* @__PURE__ */ new Set([activeGroupId]);
|
|
220
|
+
const set = /* @__PURE__ */ new Set();
|
|
221
|
+
for (const entry of items) if (isSidebarGroup(entry) && entry.defaultExpanded !== false) set.add(entry.id);
|
|
222
|
+
return set;
|
|
223
|
+
});
|
|
224
|
+
/**
|
|
225
|
+
* In focus-active mode, whenever the *active group* changes (i.e. the user
|
|
226
|
+
* navigates into a different group), collapse everything else and expand only
|
|
227
|
+
* the new active group. Navigating within the same group leaves any manual
|
|
228
|
+
* expansions the user made in place.
|
|
229
|
+
*/
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
if (!focusActiveGroup || !activeGroupId) return;
|
|
232
|
+
setExpandedGroups(/* @__PURE__ */ new Set([activeGroupId]));
|
|
233
|
+
}, [focusActiveGroup, activeGroupId]);
|
|
234
|
+
const toggleGroup = (id, open) => {
|
|
235
|
+
setExpandedGroups((prev) => {
|
|
236
|
+
const next = new Set(prev);
|
|
237
|
+
if (open) next.add(id);
|
|
238
|
+
else next.delete(id);
|
|
239
|
+
return next;
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Segment-aware so sibling routes with a shared prefix stay independent: at
|
|
244
|
+
* `/components/input-password` only that row lights up, not `/components/input` too.
|
|
245
|
+
* A nested route still selects its parent row (`/nodes/42` selects `/nodes`).
|
|
246
|
+
*/
|
|
247
|
+
const isSelected = (path) => {
|
|
248
|
+
return isPathPrefixOf(path, currentPath);
|
|
249
|
+
};
|
|
250
|
+
const renderMenuItem = (item) => {
|
|
251
|
+
const EndActionIcon = item.endAction?.icon;
|
|
252
|
+
const active = isSelected(item.path);
|
|
253
|
+
return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
254
|
+
asChild: true,
|
|
255
|
+
isActive: active,
|
|
256
|
+
size: "sm",
|
|
257
|
+
tooltip: item.label,
|
|
258
|
+
className: cn(rowIconClass, active && "bg-sidebar-accent text-sidebar-accent-foreground", item.endAction && "pr-8"),
|
|
259
|
+
children: /* @__PURE__ */ jsx(LinkComponent, {
|
|
260
|
+
to: item.path,
|
|
261
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
262
|
+
className: "contents",
|
|
263
|
+
onClick: closeMobileSidebar,
|
|
264
|
+
children: [/* @__PURE__ */ jsx(ItemIcon, {
|
|
265
|
+
icon: item.icon,
|
|
266
|
+
active
|
|
267
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
268
|
+
className: cn("whitespace-nowrap max-w-[168px] truncate", active ? "font-semibold text-sidebar-accent-foreground" : "font-medium text-sidebar-foreground"),
|
|
269
|
+
style: rowFontStyle,
|
|
270
|
+
children: item.label
|
|
271
|
+
})]
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
}), item.endAction && EndActionIcon && /* @__PURE__ */ jsx(Tooltip, {
|
|
275
|
+
content: item.endAction.tooltip,
|
|
276
|
+
side: "right",
|
|
277
|
+
sideOffset: 8,
|
|
278
|
+
children: /* @__PURE__ */ jsx(SidebarMenuAction, {
|
|
279
|
+
asChild: true,
|
|
280
|
+
className: cn(rowIconClass, "right-1.5"),
|
|
281
|
+
children: /* @__PURE__ */ jsx(LinkComponent, {
|
|
282
|
+
to: item.endAction.path,
|
|
283
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
284
|
+
className: "contents",
|
|
285
|
+
onClick: closeMobileSidebar,
|
|
286
|
+
children: /* @__PURE__ */ jsx(EndActionIcon, {})
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
})] }, item.id);
|
|
291
|
+
};
|
|
292
|
+
const renderGroup = (group) => {
|
|
293
|
+
if (isCollapsed && !isMobile) return /* @__PURE__ */ jsx(CollapsedSidebarGroup, {
|
|
294
|
+
group,
|
|
295
|
+
isSelected,
|
|
296
|
+
linkComponent: LinkComponent
|
|
297
|
+
}, group.id);
|
|
298
|
+
return /* @__PURE__ */ jsx(ExpandedSidebarGroup, {
|
|
299
|
+
group,
|
|
300
|
+
isGroupOpen: expandedGroups.has(group.id),
|
|
301
|
+
onToggle: (open) => toggleGroup(group.id, open),
|
|
302
|
+
renderMenuItem
|
|
303
|
+
}, group.id);
|
|
304
|
+
};
|
|
305
|
+
const renderEntry = (entry) => {
|
|
306
|
+
if (!isSidebarGroup(entry)) return /* @__PURE__ */ jsx(TopLevelLinkRow, {
|
|
307
|
+
item: entry,
|
|
308
|
+
isCollapsed,
|
|
309
|
+
isMobile,
|
|
310
|
+
renderMenuItem
|
|
311
|
+
}, entry.id);
|
|
312
|
+
return renderGroup(entry);
|
|
313
|
+
};
|
|
314
|
+
return /* @__PURE__ */ jsxs(Sidebar$1, {
|
|
315
|
+
collapsible,
|
|
316
|
+
variant,
|
|
317
|
+
children: [
|
|
318
|
+
(header || isMobile) && /* @__PURE__ */ jsxs(SidebarHeader, {
|
|
319
|
+
className: cn(headerHeight ? "flex flex-row items-center gap-0 px-2 py-0 box-border shrink-0" : "flex items-start", isMobile ? "justify-between" : "justify-center"),
|
|
320
|
+
style: headerHeight ? {
|
|
321
|
+
height: headerHeight,
|
|
322
|
+
minHeight: headerHeight
|
|
323
|
+
} : void 0,
|
|
324
|
+
children: [header, isMobile && /* @__PURE__ */ jsxs(Button, {
|
|
325
|
+
variant: "ghost",
|
|
326
|
+
size: "icon",
|
|
327
|
+
className: "size-8 shrink-0 ml-auto text-sidebar-foreground",
|
|
328
|
+
onClick: () => setOpenMobile(false),
|
|
329
|
+
children: [/* @__PURE__ */ jsx(X, { className: "size-5" }), /* @__PURE__ */ jsx("span", {
|
|
330
|
+
className: "sr-only",
|
|
331
|
+
children: "Close sidebar"
|
|
332
|
+
})]
|
|
333
|
+
})]
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx(SidebarContent, {
|
|
336
|
+
className: "overflow-hidden",
|
|
337
|
+
children: items.map((entry) => renderEntry(entry))
|
|
338
|
+
}),
|
|
339
|
+
footer && /* @__PURE__ */ jsx(SidebarFooter, { children: footer })
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
export { Sidebar as default };
|