@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
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { getStrictContext } from "../../../utils/get-strict-context.js";
|
|
4
|
+
import { Highlight, HighlightItem } from "../../primitives/effects/highlight.js";
|
|
5
|
+
import { Button } from "../../../button.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../animate/tooltip.js";
|
|
7
|
+
import { ScrollArea } from "../../../scroll-area.js";
|
|
8
|
+
import { useIsMobile } from "../../../hooks/use-mobile.js";
|
|
9
|
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
|
|
10
|
+
import { Input } from "../../../input/input.js";
|
|
11
|
+
import { Separator } from "../../../separator.js";
|
|
12
|
+
import { Skeleton } from "../../../skeleton.js";
|
|
13
|
+
import * as React$1 from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
16
|
+
import { Slot } from "radix-ui";
|
|
17
|
+
import { cva } from "class-variance-authority";
|
|
18
|
+
//#region src/core/animate-ui/components/radix/sidebar.tsx
|
|
19
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
20
|
+
var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
21
|
+
var SIDEBAR_WIDTH = "var(--espd-sidebar-width)";
|
|
22
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
23
|
+
var SIDEBAR_WIDTH_COLLAPSED = "var(--espd-sidebar-width-collapsed)";
|
|
24
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
25
|
+
var [LocalSidebarProvider, useSidebar] = getStrictContext("SidebarContext");
|
|
26
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
27
|
+
const isMobile = useIsMobile();
|
|
28
|
+
const [openMobile, setOpenMobile] = React$1.useState(false);
|
|
29
|
+
const [_open, _setOpen] = React$1.useState(defaultOpen);
|
|
30
|
+
const open = openProp ?? _open;
|
|
31
|
+
const setOpen = React$1.useCallback((value) => {
|
|
32
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
33
|
+
if (setOpenProp) setOpenProp(openState);
|
|
34
|
+
else _setOpen(openState);
|
|
35
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
36
|
+
}, [setOpenProp, open]);
|
|
37
|
+
const toggleSidebar = React$1.useCallback(() => {
|
|
38
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
39
|
+
}, [
|
|
40
|
+
isMobile,
|
|
41
|
+
setOpen,
|
|
42
|
+
setOpenMobile
|
|
43
|
+
]);
|
|
44
|
+
React$1.useEffect(() => {
|
|
45
|
+
const handleKeyDown = (event) => {
|
|
46
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
toggleSidebar();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
52
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
53
|
+
}, [toggleSidebar]);
|
|
54
|
+
const state = open ? "expanded" : "collapsed";
|
|
55
|
+
return /* @__PURE__ */ jsx(LocalSidebarProvider, {
|
|
56
|
+
value: React$1.useMemo(() => ({
|
|
57
|
+
state,
|
|
58
|
+
open,
|
|
59
|
+
setOpen,
|
|
60
|
+
isMobile,
|
|
61
|
+
openMobile,
|
|
62
|
+
setOpenMobile,
|
|
63
|
+
toggleSidebar
|
|
64
|
+
}), [
|
|
65
|
+
state,
|
|
66
|
+
open,
|
|
67
|
+
setOpen,
|
|
68
|
+
isMobile,
|
|
69
|
+
openMobile,
|
|
70
|
+
setOpenMobile,
|
|
71
|
+
toggleSidebar
|
|
72
|
+
]),
|
|
73
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx("div", {
|
|
74
|
+
"data-slot": "sidebar-wrapper",
|
|
75
|
+
style: {
|
|
76
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
77
|
+
"--sidebar-width-collapsed": SIDEBAR_WIDTH_COLLAPSED,
|
|
78
|
+
...style
|
|
79
|
+
},
|
|
80
|
+
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className),
|
|
81
|
+
...props,
|
|
82
|
+
children
|
|
83
|
+
}) })
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, animateOnHover = true, containerClassName, transition = {
|
|
87
|
+
type: "spring",
|
|
88
|
+
stiffness: 350,
|
|
89
|
+
damping: 35
|
|
90
|
+
}, ...props }) {
|
|
91
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
92
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx(Highlight, {
|
|
93
|
+
enabled: animateOnHover,
|
|
94
|
+
hover: true,
|
|
95
|
+
controlledItems: true,
|
|
96
|
+
mode: "parent",
|
|
97
|
+
containerClassName,
|
|
98
|
+
transition,
|
|
99
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
100
|
+
"data-slot": "sidebar",
|
|
101
|
+
className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
|
|
102
|
+
...props,
|
|
103
|
+
children
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
107
|
+
open: openMobile,
|
|
108
|
+
onOpenChange: setOpenMobile,
|
|
109
|
+
...props,
|
|
110
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
111
|
+
"data-sidebar": "sidebar",
|
|
112
|
+
"data-slot": "sidebar",
|
|
113
|
+
"data-mobile": "true",
|
|
114
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
115
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
116
|
+
side,
|
|
117
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
118
|
+
className: "sr-only",
|
|
119
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
120
|
+
}), /* @__PURE__ */ jsx(Highlight, {
|
|
121
|
+
enabled: animateOnHover,
|
|
122
|
+
hover: true,
|
|
123
|
+
controlledItems: true,
|
|
124
|
+
mode: "parent",
|
|
125
|
+
containerClassName: cn("h-full", containerClassName),
|
|
126
|
+
transition,
|
|
127
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
128
|
+
className: "flex h-full w-full flex-col",
|
|
129
|
+
children
|
|
130
|
+
})
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
136
|
+
"data-state": state,
|
|
137
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
138
|
+
"data-variant": variant,
|
|
139
|
+
"data-side": side,
|
|
140
|
+
"data-slot": "sidebar",
|
|
141
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
142
|
+
"data-slot": "sidebar-gap",
|
|
143
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-[cubic-bezier(0.7,-0.15,0.25,1.15)]", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-collapsed)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-collapsed)")
|
|
144
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
145
|
+
"data-slot": "sidebar-container",
|
|
146
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-[calc(var(--sidebar-width)+1px)] transition-[left,right,width] duration-200 ease-[cubic-bezier(0.75,0,0.25,1)] md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-collapsed)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-collapsed)+1px)] group-data-[side=left]:border-r group-data-[side=right]:border-l border-sidebar-border", className),
|
|
147
|
+
...props,
|
|
148
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
149
|
+
containerClassName: cn("size-full", containerClassName),
|
|
150
|
+
enabled: animateOnHover,
|
|
151
|
+
hover: true,
|
|
152
|
+
controlledItems: true,
|
|
153
|
+
mode: "parent",
|
|
154
|
+
forceUpdateBounds: true,
|
|
155
|
+
transition,
|
|
156
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
157
|
+
"data-sidebar": "sidebar",
|
|
158
|
+
"data-slot": "sidebar-inner",
|
|
159
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
160
|
+
children
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
167
|
+
const { toggleSidebar } = useSidebar();
|
|
168
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
169
|
+
"data-sidebar": "trigger",
|
|
170
|
+
"data-slot": "sidebar-trigger",
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
size: "icon",
|
|
173
|
+
className: cn("size-7", className),
|
|
174
|
+
onClick: (event) => {
|
|
175
|
+
onClick?.(event);
|
|
176
|
+
toggleSidebar();
|
|
177
|
+
},
|
|
178
|
+
...props,
|
|
179
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
180
|
+
className: "sr-only",
|
|
181
|
+
children: "Toggle Sidebar"
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function SidebarRail({ className, ...props }) {
|
|
186
|
+
const { toggleSidebar } = useSidebar();
|
|
187
|
+
return /* @__PURE__ */ jsx("button", {
|
|
188
|
+
"data-sidebar": "rail",
|
|
189
|
+
"data-slot": "sidebar-rail",
|
|
190
|
+
"aria-label": "Toggle Sidebar",
|
|
191
|
+
tabIndex: -1,
|
|
192
|
+
onClick: toggleSidebar,
|
|
193
|
+
title: "Toggle Sidebar",
|
|
194
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
195
|
+
...props
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function SidebarInset({ className, ...props }) {
|
|
199
|
+
return /* @__PURE__ */ jsx("main", {
|
|
200
|
+
"data-slot": "sidebar-inset",
|
|
201
|
+
className: cn("bg-background relative flex w-full flex-1 flex-col", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
202
|
+
...props
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function SidebarInput({ className, ...props }) {
|
|
206
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
207
|
+
"data-slot": "sidebar-input",
|
|
208
|
+
"data-sidebar": "input",
|
|
209
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function SidebarHeader({ className, ...props }) {
|
|
214
|
+
return /* @__PURE__ */ jsx("div", {
|
|
215
|
+
"data-slot": "sidebar-header",
|
|
216
|
+
"data-sidebar": "header",
|
|
217
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function SidebarFooter({ className, ...props }) {
|
|
222
|
+
return /* @__PURE__ */ jsx("div", {
|
|
223
|
+
"data-slot": "sidebar-footer",
|
|
224
|
+
"data-sidebar": "footer",
|
|
225
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
226
|
+
...props
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function SidebarSeparator({ className, ...props }) {
|
|
230
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
231
|
+
"data-slot": "sidebar-separator",
|
|
232
|
+
"data-sidebar": "separator",
|
|
233
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
234
|
+
...props
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function SidebarContent({ className, children, ...props }) {
|
|
238
|
+
return /* @__PURE__ */ jsx("div", {
|
|
239
|
+
"data-slot": "sidebar-content",
|
|
240
|
+
"data-sidebar": "content",
|
|
241
|
+
className: cn("flex min-h-0 flex-1 flex-col group-data-[collapsible=icon]:overflow-hidden", className),
|
|
242
|
+
...props,
|
|
243
|
+
children: /* @__PURE__ */ jsx(ScrollArea, {
|
|
244
|
+
className: "flex-1",
|
|
245
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
246
|
+
className: "flex flex-col gap-2",
|
|
247
|
+
children
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function SidebarGroup({ className, ...props }) {
|
|
253
|
+
return /* @__PURE__ */ jsx("div", {
|
|
254
|
+
"data-slot": "sidebar-group",
|
|
255
|
+
"data-sidebar": "group",
|
|
256
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
257
|
+
...props
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
261
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
262
|
+
"data-slot": "sidebar-group-label",
|
|
263
|
+
"data-sidebar": "group-label",
|
|
264
|
+
className: cn("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-300 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
265
|
+
...props
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
269
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
270
|
+
"data-slot": "sidebar-group-action",
|
|
271
|
+
"data-sidebar": "group-action",
|
|
272
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
273
|
+
...props
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
277
|
+
return /* @__PURE__ */ jsx("div", {
|
|
278
|
+
"data-slot": "sidebar-group-content",
|
|
279
|
+
"data-sidebar": "group-content",
|
|
280
|
+
className: cn("w-full text-sm flex", className),
|
|
281
|
+
...props
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function SidebarMenu({ className, ...props }) {
|
|
285
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
286
|
+
"data-slot": "sidebar-menu",
|
|
287
|
+
"data-sidebar": "menu",
|
|
288
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
289
|
+
...props
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
293
|
+
return /* @__PURE__ */ jsx("li", {
|
|
294
|
+
"data-slot": "sidebar-menu-item",
|
|
295
|
+
"data-sidebar": "menu-item",
|
|
296
|
+
className: cn("group/menu-item relative group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", className),
|
|
297
|
+
...props
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
var sidebarMenuButtonActiveVariants = cva("bg-sidebar-accent text-sidebar-accent-foreground rounded-md", {
|
|
301
|
+
variants: { variant: {
|
|
302
|
+
default: "bg-sidebar-accent text-sidebar-accent-foreground",
|
|
303
|
+
outline: "bg-sidebar-accent text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
304
|
+
} },
|
|
305
|
+
defaultVariants: { variant: "default" }
|
|
306
|
+
});
|
|
307
|
+
var sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] [&:not([data-highlight])]:hover:bg-sidebar-accent [&:not([data-highlight])]:hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground [&:not([data-highlight])]:data-[state=open]:hover:bg-sidebar-accent [&:not([data-highlight])]:data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
308
|
+
variants: {
|
|
309
|
+
variant: {
|
|
310
|
+
default: "[&:not([data-highlight])]:hover:bg-sidebar-accent [&:not([data-highlight])]:hover:text-sidebar-accent-foreground",
|
|
311
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] [&:not([data-highlight])]:hover:bg-sidebar-accent [&:not([data-highlight])]:hover:text-sidebar-accent-foreground [&:not([data-highlight])]:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
312
|
+
},
|
|
313
|
+
size: {
|
|
314
|
+
default: "h-8 text-sm",
|
|
315
|
+
sm: "h-7 text-xs",
|
|
316
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
defaultVariants: {
|
|
320
|
+
variant: "default",
|
|
321
|
+
size: "default"
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
325
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
326
|
+
const { isMobile, state } = useSidebar();
|
|
327
|
+
const button = /* @__PURE__ */ jsx(HighlightItem, {
|
|
328
|
+
activeClassName: sidebarMenuButtonActiveVariants({ variant }),
|
|
329
|
+
children: /* @__PURE__ */ jsx(Comp, {
|
|
330
|
+
"data-slot": "sidebar-menu-button",
|
|
331
|
+
"data-sidebar": "menu-button",
|
|
332
|
+
"data-size": size,
|
|
333
|
+
"data-active": isActive,
|
|
334
|
+
className: cn(sidebarMenuButtonVariants({
|
|
335
|
+
variant,
|
|
336
|
+
size
|
|
337
|
+
}), className),
|
|
338
|
+
...props
|
|
339
|
+
})
|
|
340
|
+
});
|
|
341
|
+
if (!tooltip) return button;
|
|
342
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
343
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
344
|
+
asChild: true,
|
|
345
|
+
children: button
|
|
346
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
347
|
+
hidden: state !== "collapsed" || isMobile,
|
|
348
|
+
...tooltip
|
|
349
|
+
})] });
|
|
350
|
+
}
|
|
351
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
352
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
353
|
+
"data-slot": "sidebar-menu-action",
|
|
354
|
+
"data-sidebar": "menu-action",
|
|
355
|
+
className: cn("z-[1] text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1/2 right-1 flex aspect-square w-5 -translate-y-1/2 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", className),
|
|
356
|
+
...props
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
360
|
+
return /* @__PURE__ */ jsx("div", {
|
|
361
|
+
"data-slot": "sidebar-menu-badge",
|
|
362
|
+
"data-sidebar": "menu-badge",
|
|
363
|
+
className: cn("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
364
|
+
...props
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
368
|
+
const width = React$1.useMemo(() => {
|
|
369
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
370
|
+
}, []);
|
|
371
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
372
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
373
|
+
"data-sidebar": "menu-skeleton",
|
|
374
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
375
|
+
...props,
|
|
376
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
377
|
+
className: "size-4 rounded-md",
|
|
378
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
379
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
380
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
381
|
+
"data-sidebar": "menu-skeleton-text",
|
|
382
|
+
style: { "--skeleton-width": width }
|
|
383
|
+
})]
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
387
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
388
|
+
"data-slot": "sidebar-menu-sub",
|
|
389
|
+
"data-sidebar": "menu-sub",
|
|
390
|
+
className: cn("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className),
|
|
391
|
+
...props
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
395
|
+
return /* @__PURE__ */ jsx("li", {
|
|
396
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
397
|
+
"data-sidebar": "menu-sub-item",
|
|
398
|
+
className: cn("group/menu-sub-item relative", className),
|
|
399
|
+
...props
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
403
|
+
return /* @__PURE__ */ jsx(HighlightItem, {
|
|
404
|
+
activeClassName: "bg-sidebar-accent text-sidebar-accent-foreground rounded-md",
|
|
405
|
+
children: /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
406
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
407
|
+
"data-sidebar": "menu-sub-button",
|
|
408
|
+
"data-size": size,
|
|
409
|
+
"data-active": isActive,
|
|
410
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring [&:not([data-highlight])]:hover:bg-sidebar-accent [&:not([data-highlight])]:hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
411
|
+
...props
|
|
412
|
+
})
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from "../../../../utils/cn.js";
|
|
2
|
+
import { Switch as Switch$1, SwitchIcon, SwitchThumb } from "../../primitives/radix/switch.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/core/animate-ui/components/radix/switch.tsx
|
|
6
|
+
function Switch({ className, pressedWidth = 19, startIcon, endIcon, thumbIcon, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(Switch$1, {
|
|
8
|
+
className: cn("relative peer focus-visible:border-ring focus-visible:ring-ring/50 flex h-5 w-8 px-px shrink-0 items-center justify-start rounded-full border border-transparent shadow-xs outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 data-[state=checked]:justify-end", className),
|
|
9
|
+
...props,
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ jsx(SwitchThumb, {
|
|
12
|
+
className: cn("relative z-10 bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0"),
|
|
13
|
+
pressedAnimation: { width: pressedWidth },
|
|
14
|
+
children: thumbIcon && /* @__PURE__ */ jsx(SwitchIcon, {
|
|
15
|
+
position: "thumb",
|
|
16
|
+
className: "absolute [&_svg]:size-[9px] left-1/2 top-1/2 -translate-1/2 dark:text-neutral-500 text-neutral-400",
|
|
17
|
+
children: thumbIcon
|
|
18
|
+
})
|
|
19
|
+
}),
|
|
20
|
+
startIcon && /* @__PURE__ */ jsx(SwitchIcon, {
|
|
21
|
+
position: "left",
|
|
22
|
+
className: "absolute [&_svg]:size-[9px] left-0.5 top-1/2 -translate-y-1/2 dark:text-neutral-500 text-neutral-400",
|
|
23
|
+
children: startIcon
|
|
24
|
+
}),
|
|
25
|
+
endIcon && /* @__PURE__ */ jsx(SwitchIcon, {
|
|
26
|
+
position: "right",
|
|
27
|
+
className: "absolute [&_svg]:size-[9px] right-0.5 top-1/2 -translate-y-1/2 dark:text-neutral-400 text-neutral-500",
|
|
28
|
+
children: endIcon
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Switch };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { cn } from "../../../../utils/cn.js";
|
|
2
|
+
import { isPresetColor } from "../../../../utils/color.js";
|
|
3
|
+
import { getStrictContext } from "../../../utils/get-strict-context.js";
|
|
4
|
+
import { ToggleGroup as ToggleGroup$1, ToggleGroupHighlight, ToggleGroupHighlightItem, ToggleGroupItem as ToggleGroupItem$1, useToggleGroup as useToggleGroup$1 } from "../../primitives/radix/toggle-group.js";
|
|
5
|
+
import { toggleVariants } from "./toggle.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/core/animate-ui/components/radix/toggle-group.tsx
|
|
9
|
+
/** Matches default `TabsList` highlight + active trigger (see animate/tabs.tsx). */
|
|
10
|
+
var presetSelectedHighlightBg = {
|
|
11
|
+
primary: "bg-primary/10",
|
|
12
|
+
secondary: "bg-secondary/10",
|
|
13
|
+
error: "bg-error/10",
|
|
14
|
+
info: "bg-info/10",
|
|
15
|
+
success: "bg-success/10",
|
|
16
|
+
warning: "bg-warning/10",
|
|
17
|
+
disabled: "bg-disabled/10",
|
|
18
|
+
gray: "bg-gray/10",
|
|
19
|
+
mist: "bg-mist"
|
|
20
|
+
};
|
|
21
|
+
var presetSelectedHighlightBorder = {
|
|
22
|
+
primary: "border border-primary/20",
|
|
23
|
+
secondary: "border border-secondary/20",
|
|
24
|
+
error: "border border-error/20",
|
|
25
|
+
info: "border border-info/20",
|
|
26
|
+
success: "border border-success/20",
|
|
27
|
+
warning: "border border-warning/20",
|
|
28
|
+
disabled: "border border-disabled/20",
|
|
29
|
+
gray: "border border-gray/20",
|
|
30
|
+
mist: "border border-mist-border"
|
|
31
|
+
};
|
|
32
|
+
var presetSelectedText = {
|
|
33
|
+
primary: "data-[state=on]:text-primary",
|
|
34
|
+
secondary: "data-[state=on]:text-secondary",
|
|
35
|
+
error: "data-[state=on]:text-error",
|
|
36
|
+
info: "data-[state=on]:text-info",
|
|
37
|
+
success: "data-[state=on]:text-success",
|
|
38
|
+
warning: "data-[state=on]:text-warning",
|
|
39
|
+
disabled: "data-[state=on]:text-disabled",
|
|
40
|
+
gray: "data-[state=on]:text-gray",
|
|
41
|
+
mist: "data-[state=on]:text-mist-foreground"
|
|
42
|
+
};
|
|
43
|
+
var presetMultipleSelectedSurface = {
|
|
44
|
+
primary: "data-[state=on]:bg-primary/10 data-[state=on]:border-primary/20",
|
|
45
|
+
secondary: "data-[state=on]:bg-secondary/10 data-[state=on]:border-secondary/20",
|
|
46
|
+
error: "data-[state=on]:bg-error/10 data-[state=on]:border-error/20",
|
|
47
|
+
info: "data-[state=on]:bg-info/10 data-[state=on]:border-info/20",
|
|
48
|
+
success: "data-[state=on]:bg-success/10 data-[state=on]:border-success/20",
|
|
49
|
+
warning: "data-[state=on]:bg-warning/10 data-[state=on]:border-warning/20",
|
|
50
|
+
disabled: "data-[state=on]:bg-disabled/10 data-[state=on]:border-disabled/20",
|
|
51
|
+
gray: "data-[state=on]:bg-gray/10 data-[state=on]:border-gray/20",
|
|
52
|
+
mist: "data-[state=on]:bg-mist data-[state=on]:border-mist-border"
|
|
53
|
+
};
|
|
54
|
+
var arbitrarySelectedHighlightClass = "border bg-[color-mix(in_srgb,var(--toggle-group-accent)_10%,transparent)] border-[color-mix(in_srgb,var(--toggle-group-accent)_20%,transparent)]";
|
|
55
|
+
var arbitraryMultipleSelectedSurfaceClass = "data-[state=on]:border data-[state=on]:bg-[color-mix(in_srgb,var(--toggle-group-accent)_10%,transparent)] data-[state=on]:border-[color-mix(in_srgb,var(--toggle-group-accent)_20%,transparent)]";
|
|
56
|
+
function resolveToggleGroupColorTokens(color) {
|
|
57
|
+
if (isPresetColor(color)) return {
|
|
58
|
+
highlightClass: cn(presetSelectedHighlightBg[color], presetSelectedHighlightBorder[color]),
|
|
59
|
+
multipleSelectedSurfaceClass: cn("data-[state=on]:border", presetMultipleSelectedSurface[color]),
|
|
60
|
+
selectedTextClass: presetSelectedText[color]
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
highlightClass: arbitrarySelectedHighlightClass,
|
|
64
|
+
multipleSelectedSurfaceClass: arbitraryMultipleSelectedSurfaceClass,
|
|
65
|
+
selectedTextClass: "data-[state=on]:text-[var(--toggle-group-accent)]",
|
|
66
|
+
arbitraryAccent: color
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
var [ToggleGroupProvider, useToggleGroup] = getStrictContext("ToggleGroupStyledContext");
|
|
70
|
+
/** Horizontal padding + min width; applied after `toggleVariants` so it overrides size defaults. */
|
|
71
|
+
var toggleGroupItemSizeClasses = {
|
|
72
|
+
sm: "px-2.5 min-w-9",
|
|
73
|
+
default: "px-3.5 min-w-10",
|
|
74
|
+
lg: "px-4 min-w-11",
|
|
75
|
+
icon: "px-3 min-w-10"
|
|
76
|
+
};
|
|
77
|
+
function ToggleGroup({ className, size, color = "primary", children, style, ...props }) {
|
|
78
|
+
const colorTokens = React$1.useMemo(() => resolveToggleGroupColorTokens(color), [color]);
|
|
79
|
+
return /* @__PURE__ */ jsx(ToggleGroup$1, {
|
|
80
|
+
"data-size": size,
|
|
81
|
+
className: cn("group/toggle-group flex w-fit items-center gap-0.5 rounded-md border border-input bg-transparent p-1.5 ring-offset-background transition-[box-shadow,border-color] duration-200 ease-in-out", "focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", className),
|
|
82
|
+
style: colorTokens.arbitraryAccent ? {
|
|
83
|
+
...style,
|
|
84
|
+
["--toggle-group-accent"]: colorTokens.arbitraryAccent
|
|
85
|
+
} : style,
|
|
86
|
+
...props,
|
|
87
|
+
children: /* @__PURE__ */ jsx(ToggleGroupProvider, {
|
|
88
|
+
value: {
|
|
89
|
+
size,
|
|
90
|
+
colorTokens
|
|
91
|
+
},
|
|
92
|
+
children: props.type === "single" ? /* @__PURE__ */ jsx(ToggleGroupHighlight, {
|
|
93
|
+
className: cn("rounded-md", colorTokens.highlightClass),
|
|
94
|
+
children
|
|
95
|
+
}) : children
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function ToggleGroupItem({ className, children, size, ...props }) {
|
|
100
|
+
const { size: contextSize, colorTokens } = useToggleGroup();
|
|
101
|
+
const { type } = useToggleGroup$1();
|
|
102
|
+
const itemSize = contextSize ?? size ?? "default";
|
|
103
|
+
return /* @__PURE__ */ jsx(ToggleGroupHighlightItem, {
|
|
104
|
+
value: props.value,
|
|
105
|
+
className: cn(type === "multiple" && "rounded-md"),
|
|
106
|
+
children: /* @__PURE__ */ jsx(ToggleGroupItem$1, {
|
|
107
|
+
"data-size": contextSize || size,
|
|
108
|
+
className: cn(toggleVariants({ size: contextSize || size }), "relative z-10 flex-1 shrink-0 rounded-md border border-transparent shadow-none focus:z-10 focus-visible:z-10", toggleGroupItemSizeClasses[itemSize], colorTokens.selectedTextClass, type === "single" && "data-[state=on]:bg-transparent", type === "multiple" && colorTokens.multipleSelectedSurfaceClass, className),
|
|
109
|
+
...props,
|
|
110
|
+
children
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
//#region src/core/animate-ui/components/radix/toggle.tsx
|
|
5
|
+
var toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted/40 hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,background-color,box-shadow] duration-200 ease-in-out aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-transparent",
|
|
9
|
+
outline: "border border-input bg-transparent shadow-xs hover:bg-accent/40 hover:text-accent-foreground"
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
default: "h-9 px-2 min-w-9",
|
|
13
|
+
sm: "h-8 px-1.5 min-w-8",
|
|
14
|
+
lg: "h-10 px-2.5 min-w-10",
|
|
15
|
+
icon: "size-9"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
size: "default"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { toggleVariants };
|