@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,413 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Button } from "../button/button.js";
|
|
4
|
+
import { SectionCard } from "../cards/section-card.js";
|
|
5
|
+
import { Checkbox } from "../../core/checkbox/motion-checkbox.js";
|
|
6
|
+
import SearchBox from "../search-box/search-box.js";
|
|
7
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { ChevronsLeft, ChevronsRight, Search, X } from "lucide-react";
|
|
10
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
11
|
+
//#region src/components/transfer-list/transfer-list.tsx
|
|
12
|
+
var rowTransition = {
|
|
13
|
+
duration: .25,
|
|
14
|
+
ease: [
|
|
15
|
+
.4,
|
|
16
|
+
0,
|
|
17
|
+
.2,
|
|
18
|
+
1
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
var headerTransition = {
|
|
22
|
+
duration: .2,
|
|
23
|
+
ease: [
|
|
24
|
+
.4,
|
|
25
|
+
0,
|
|
26
|
+
.2,
|
|
27
|
+
1
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
var headerContentVariants = {
|
|
31
|
+
enter: {
|
|
32
|
+
opacity: 0,
|
|
33
|
+
x: 8
|
|
34
|
+
},
|
|
35
|
+
center: {
|
|
36
|
+
opacity: 1,
|
|
37
|
+
x: 0
|
|
38
|
+
},
|
|
39
|
+
exit: {
|
|
40
|
+
opacity: 0,
|
|
41
|
+
x: -8
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var sourceRowVariants = {
|
|
45
|
+
enter: {
|
|
46
|
+
opacity: 0,
|
|
47
|
+
x: 32
|
|
48
|
+
},
|
|
49
|
+
center: {
|
|
50
|
+
opacity: 1,
|
|
51
|
+
x: 0
|
|
52
|
+
},
|
|
53
|
+
exit: {
|
|
54
|
+
opacity: 0,
|
|
55
|
+
x: 32
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var targetRowVariants = {
|
|
59
|
+
enter: {
|
|
60
|
+
opacity: 0,
|
|
61
|
+
x: -32
|
|
62
|
+
},
|
|
63
|
+
center: {
|
|
64
|
+
opacity: 1,
|
|
65
|
+
x: 0
|
|
66
|
+
},
|
|
67
|
+
exit: {
|
|
68
|
+
opacity: 0,
|
|
69
|
+
x: -32
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function FormFieldMirrors({ name, form, value }) {
|
|
73
|
+
if (name == null || name === "") return null;
|
|
74
|
+
return /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: "hidden",
|
|
76
|
+
"aria-hidden": true,
|
|
77
|
+
children: value.map((id) => /* @__PURE__ */ jsx("input", {
|
|
78
|
+
type: "hidden",
|
|
79
|
+
name,
|
|
80
|
+
value: id,
|
|
81
|
+
form
|
|
82
|
+
}, id))
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function filterItemsByQuery(items, query, getLabel) {
|
|
86
|
+
const q = query.trim().toLowerCase();
|
|
87
|
+
if (q === "") return items;
|
|
88
|
+
return items.filter((item) => getLabel(item).toLowerCase().includes(q));
|
|
89
|
+
}
|
|
90
|
+
function TransferListItems({ filteredItems, items, selectedIds, getItemId, getItemLabel, isItemDisabled, renderItem, disabled, rowVariants, onChecked }) {
|
|
91
|
+
if (filteredItems.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
92
|
+
className: "px-1 py-2 text-sm text-muted-foreground",
|
|
93
|
+
children: items.length === 0 ? "No items" : "No matching items"
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
96
|
+
initial: false,
|
|
97
|
+
children: filteredItems.map((item) => {
|
|
98
|
+
const id = getItemId(item);
|
|
99
|
+
const label = getItemLabel(item);
|
|
100
|
+
const itemDisabled = disabled || isItemDisabled(item);
|
|
101
|
+
const checked = selectedIds.has(id);
|
|
102
|
+
return /* @__PURE__ */ jsxs(motion.label, {
|
|
103
|
+
layout: true,
|
|
104
|
+
variants: rowVariants,
|
|
105
|
+
initial: "enter",
|
|
106
|
+
animate: "center",
|
|
107
|
+
exit: "exit",
|
|
108
|
+
transition: rowTransition,
|
|
109
|
+
className: cn("flex cursor-pointer items-center gap-2 rounded-md px-1 py-1.5", itemDisabled ? "cursor-not-allowed opacity-50" : "hover:bg-muted/50"),
|
|
110
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
111
|
+
checked,
|
|
112
|
+
disabled: itemDisabled,
|
|
113
|
+
onCheckedChange: (state) => onChecked(id, state),
|
|
114
|
+
"aria-label": label
|
|
115
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
116
|
+
className: "min-w-0 flex-1 text-sm text-foreground",
|
|
117
|
+
children: renderItem?.(item) ?? label
|
|
118
|
+
})]
|
|
119
|
+
}, id);
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function TransferListPanel({ title, titleId, items, selectedIds, onSelectionChange, getItemId, getItemLabel, isItemDisabled, renderItem, searchable, disabled, side, maxHeight }) {
|
|
124
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
125
|
+
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
126
|
+
const searchContainerRef = useRef(null);
|
|
127
|
+
const rowVariants = side === "source" ? sourceRowVariants : targetRowVariants;
|
|
128
|
+
const heightConstrained = maxHeight != null;
|
|
129
|
+
const filteredItems = useMemo(() => filterItemsByQuery(items, searchQuery, getItemLabel), [
|
|
130
|
+
items,
|
|
131
|
+
searchQuery,
|
|
132
|
+
getItemLabel
|
|
133
|
+
]);
|
|
134
|
+
const selectableFilteredItems = useMemo(() => filteredItems.filter((item) => !disabled && !isItemDisabled(item)), [
|
|
135
|
+
filteredItems,
|
|
136
|
+
disabled,
|
|
137
|
+
isItemDisabled
|
|
138
|
+
]);
|
|
139
|
+
const selectableFilteredIds = useMemo(() => selectableFilteredItems.map((item) => getItemId(item)), [selectableFilteredItems, getItemId]);
|
|
140
|
+
const selectedSelectableCount = useMemo(() => selectableFilteredIds.filter((id) => selectedIds.has(id)).length, [selectableFilteredIds, selectedIds]);
|
|
141
|
+
const selectAllChecked = selectableFilteredIds.length === 0 ? false : selectedSelectableCount === selectableFilteredIds.length ? true : selectedSelectableCount > 0 ? "indeterminate" : false;
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (!isSearchOpen) return;
|
|
144
|
+
requestAnimationFrame(() => {
|
|
145
|
+
searchContainerRef.current?.querySelector("input")?.focus();
|
|
146
|
+
});
|
|
147
|
+
}, [isSearchOpen]);
|
|
148
|
+
const handleSelectAll = (state) => {
|
|
149
|
+
const next = new Set(selectedIds);
|
|
150
|
+
const allSelected = selectableFilteredIds.length > 0 && selectableFilteredIds.every((id) => next.has(id));
|
|
151
|
+
if (state === false || allSelected) for (const id of selectableFilteredIds) next.delete(id);
|
|
152
|
+
else for (const id of selectableFilteredIds) next.add(id);
|
|
153
|
+
onSelectionChange(next);
|
|
154
|
+
};
|
|
155
|
+
const handleOpenSearch = () => {
|
|
156
|
+
setIsSearchOpen(true);
|
|
157
|
+
};
|
|
158
|
+
const handleCloseSearch = () => {
|
|
159
|
+
setIsSearchOpen(false);
|
|
160
|
+
setSearchQuery("");
|
|
161
|
+
};
|
|
162
|
+
const handleChecked = (id, state) => {
|
|
163
|
+
const next = new Set(selectedIds);
|
|
164
|
+
if (state === true) next.add(id);
|
|
165
|
+
else next.delete(id);
|
|
166
|
+
onSelectionChange(next);
|
|
167
|
+
};
|
|
168
|
+
const listItems = /* @__PURE__ */ jsx(TransferListItems, {
|
|
169
|
+
filteredItems,
|
|
170
|
+
items,
|
|
171
|
+
selectedIds,
|
|
172
|
+
getItemId,
|
|
173
|
+
getItemLabel,
|
|
174
|
+
isItemDisabled,
|
|
175
|
+
renderItem,
|
|
176
|
+
disabled,
|
|
177
|
+
rowVariants,
|
|
178
|
+
onChecked: handleChecked
|
|
179
|
+
});
|
|
180
|
+
return /* @__PURE__ */ jsx(SectionCard, {
|
|
181
|
+
allowCollapse: false,
|
|
182
|
+
defaultOpen: true,
|
|
183
|
+
color: "mist",
|
|
184
|
+
primaryText: /* @__PURE__ */ jsxs("div", {
|
|
185
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
186
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
187
|
+
checked: selectAllChecked,
|
|
188
|
+
disabled: disabled || selectableFilteredIds.length === 0,
|
|
189
|
+
onCheckedChange: handleSelectAll,
|
|
190
|
+
"aria-label": `Select all in ${title}`
|
|
191
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
192
|
+
className: "relative min-w-0 flex-1",
|
|
193
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
194
|
+
mode: "wait",
|
|
195
|
+
initial: false,
|
|
196
|
+
children: !isSearchOpen || !searchable ? /* @__PURE__ */ jsx(motion.span, {
|
|
197
|
+
id: titleId,
|
|
198
|
+
className: "block min-w-0 truncate",
|
|
199
|
+
variants: headerContentVariants,
|
|
200
|
+
initial: "enter",
|
|
201
|
+
animate: "center",
|
|
202
|
+
exit: "exit",
|
|
203
|
+
transition: headerTransition,
|
|
204
|
+
children: title
|
|
205
|
+
}, "title") : /* @__PURE__ */ jsx(motion.div, {
|
|
206
|
+
ref: searchContainerRef,
|
|
207
|
+
className: "min-w-0 flex-1",
|
|
208
|
+
variants: headerContentVariants,
|
|
209
|
+
initial: "enter",
|
|
210
|
+
animate: "center",
|
|
211
|
+
exit: "exit",
|
|
212
|
+
transition: headerTransition,
|
|
213
|
+
children: /* @__PURE__ */ jsx(SearchBox, {
|
|
214
|
+
size: "sm",
|
|
215
|
+
className: "w-full",
|
|
216
|
+
placeholder: `Search ${title.toLowerCase()}...`,
|
|
217
|
+
onSearch: setSearchQuery,
|
|
218
|
+
onClear: () => setSearchQuery(""),
|
|
219
|
+
onValueChange: setSearchQuery
|
|
220
|
+
})
|
|
221
|
+
}, "search")
|
|
222
|
+
})
|
|
223
|
+
})]
|
|
224
|
+
}),
|
|
225
|
+
actions: searchable ? /* @__PURE__ */ jsx(AnimatePresence, {
|
|
226
|
+
mode: "wait",
|
|
227
|
+
initial: false,
|
|
228
|
+
children: !isSearchOpen ? /* @__PURE__ */ jsx(motion.div, {
|
|
229
|
+
initial: {
|
|
230
|
+
opacity: 0,
|
|
231
|
+
scale: .9
|
|
232
|
+
},
|
|
233
|
+
animate: {
|
|
234
|
+
opacity: 1,
|
|
235
|
+
scale: 1
|
|
236
|
+
},
|
|
237
|
+
exit: {
|
|
238
|
+
opacity: 0,
|
|
239
|
+
scale: .9
|
|
240
|
+
},
|
|
241
|
+
transition: headerTransition,
|
|
242
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
243
|
+
type: "button",
|
|
244
|
+
variant: "ghost",
|
|
245
|
+
size: "icon",
|
|
246
|
+
color: "mist",
|
|
247
|
+
disabled,
|
|
248
|
+
"aria-label": `Search ${title}`,
|
|
249
|
+
onClick: handleOpenSearch,
|
|
250
|
+
children: /* @__PURE__ */ jsx(Search, { "aria-hidden": true })
|
|
251
|
+
})
|
|
252
|
+
}, "search-action") : /* @__PURE__ */ jsx(motion.div, {
|
|
253
|
+
initial: {
|
|
254
|
+
opacity: 0,
|
|
255
|
+
scale: .9
|
|
256
|
+
},
|
|
257
|
+
animate: {
|
|
258
|
+
opacity: 1,
|
|
259
|
+
scale: 1
|
|
260
|
+
},
|
|
261
|
+
exit: {
|
|
262
|
+
opacity: 0,
|
|
263
|
+
scale: .9
|
|
264
|
+
},
|
|
265
|
+
transition: headerTransition,
|
|
266
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
267
|
+
type: "button",
|
|
268
|
+
variant: "ghost",
|
|
269
|
+
size: "icon",
|
|
270
|
+
color: "error",
|
|
271
|
+
"aria-label": "Cancel search",
|
|
272
|
+
onClick: handleCloseSearch,
|
|
273
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": true })
|
|
274
|
+
})
|
|
275
|
+
}, "cancel-action")
|
|
276
|
+
}) : void 0,
|
|
277
|
+
fillHeight: heightConstrained,
|
|
278
|
+
style: heightConstrained ? { maxHeight } : void 0,
|
|
279
|
+
className: cn("min-w-0 flex-1", heightConstrained && "overflow-hidden", searchable && "[&_.section-card-header+*]:!py-1", searchable && "[&_.section-card-header]:!py-1"),
|
|
280
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
281
|
+
role: "group",
|
|
282
|
+
"aria-labelledby": titleId,
|
|
283
|
+
className: cn("flex flex-col", heightConstrained && "min-h-0 flex-1"),
|
|
284
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
285
|
+
className: cn("flex flex-col gap-1 overflow-x-hidden pr-2", heightConstrained && "min-h-0 flex-1 overflow-y-auto"),
|
|
286
|
+
children: listItems
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function TransferList({ sourceItems, targetItems, getItemId, getItemLabel, onChange, renderItem, searchable = true, disabled = false, sourceTitle, targetTitle, className, name, form, isItemDisabled, ariaLabel = "Transfer list", maxHeight }) {
|
|
292
|
+
const resolveId = getItemId ?? ((item) => item.id);
|
|
293
|
+
const resolveLabel = getItemLabel ?? ((item) => item.label);
|
|
294
|
+
const resolveDisabled = isItemDisabled ?? ((item) => Boolean(item.disabled));
|
|
295
|
+
const [sourceSelectedIds, setSourceSelectedIds] = useState(() => /* @__PURE__ */ new Set());
|
|
296
|
+
const [targetSelectedIds, setTargetSelectedIds] = useState(() => /* @__PURE__ */ new Set());
|
|
297
|
+
const [liveMessage, setLiveMessage] = useState("");
|
|
298
|
+
const sourceTitleId = useId();
|
|
299
|
+
const targetTitleId = useId();
|
|
300
|
+
const selectedSourceItems = useMemo(() => sourceItems.filter((item) => sourceSelectedIds.has(resolveId(item)) && !resolveDisabled(item)), [
|
|
301
|
+
sourceItems,
|
|
302
|
+
sourceSelectedIds,
|
|
303
|
+
resolveId,
|
|
304
|
+
resolveDisabled
|
|
305
|
+
]);
|
|
306
|
+
const selectedTargetItems = useMemo(() => targetItems.filter((item) => targetSelectedIds.has(resolveId(item)) && !resolveDisabled(item)), [
|
|
307
|
+
targetItems,
|
|
308
|
+
targetSelectedIds,
|
|
309
|
+
resolveId,
|
|
310
|
+
resolveDisabled
|
|
311
|
+
]);
|
|
312
|
+
const canMoveToTarget = !disabled && selectedSourceItems.length > 0;
|
|
313
|
+
const canMoveToSource = !disabled && selectedTargetItems.length > 0;
|
|
314
|
+
const hiddenFieldValues = useMemo(() => targetItems.map((item) => resolveId(item)), [targetItems, resolveId]);
|
|
315
|
+
const announce = (message) => {
|
|
316
|
+
setLiveMessage("");
|
|
317
|
+
requestAnimationFrame(() => setLiveMessage(message));
|
|
318
|
+
};
|
|
319
|
+
const handleMoveToTarget = () => {
|
|
320
|
+
if (!canMoveToTarget) return;
|
|
321
|
+
const count = selectedSourceItems.length;
|
|
322
|
+
onChange([...targetItems, ...selectedSourceItems]);
|
|
323
|
+
setSourceSelectedIds(/* @__PURE__ */ new Set());
|
|
324
|
+
setTargetSelectedIds(/* @__PURE__ */ new Set());
|
|
325
|
+
announce(`${count} item${count === 1 ? "" : "s"} moved to ${targetTitle}`);
|
|
326
|
+
};
|
|
327
|
+
const handleMoveToSource = () => {
|
|
328
|
+
if (!canMoveToSource) return;
|
|
329
|
+
const removeIds = new Set(selectedTargetItems.map((item) => resolveId(item)));
|
|
330
|
+
const count = removeIds.size;
|
|
331
|
+
onChange(targetItems.filter((item) => !removeIds.has(resolveId(item))));
|
|
332
|
+
setSourceSelectedIds(/* @__PURE__ */ new Set());
|
|
333
|
+
setTargetSelectedIds(/* @__PURE__ */ new Set());
|
|
334
|
+
announce(`${count} item${count === 1 ? "" : "s"} moved to ${sourceTitle}`);
|
|
335
|
+
};
|
|
336
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
337
|
+
role: "group",
|
|
338
|
+
"aria-label": ariaLabel,
|
|
339
|
+
className: cn("flex w-full flex-col items-stretch gap-4 md:flex-row", className),
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ jsx(FormFieldMirrors, {
|
|
342
|
+
name,
|
|
343
|
+
form,
|
|
344
|
+
value: hiddenFieldValues
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsx(TransferListPanel, {
|
|
347
|
+
title: sourceTitle,
|
|
348
|
+
titleId: sourceTitleId,
|
|
349
|
+
items: sourceItems,
|
|
350
|
+
selectedIds: sourceSelectedIds,
|
|
351
|
+
onSelectionChange: setSourceSelectedIds,
|
|
352
|
+
getItemId: resolveId,
|
|
353
|
+
getItemLabel: resolveLabel,
|
|
354
|
+
isItemDisabled: resolveDisabled,
|
|
355
|
+
renderItem,
|
|
356
|
+
searchable,
|
|
357
|
+
disabled,
|
|
358
|
+
side: "source",
|
|
359
|
+
maxHeight
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ jsxs("div", {
|
|
362
|
+
className: "flex shrink-0 flex-row items-center justify-center gap-3 self-center md:flex-col",
|
|
363
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
364
|
+
type: "button",
|
|
365
|
+
variant: "default",
|
|
366
|
+
size: "icon",
|
|
367
|
+
disabled: !canMoveToTarget,
|
|
368
|
+
"aria-label": `Move selected to ${targetTitle}`,
|
|
369
|
+
onClick: handleMoveToTarget,
|
|
370
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, {
|
|
371
|
+
className: "max-md:rotate-90",
|
|
372
|
+
"aria-hidden": true
|
|
373
|
+
})
|
|
374
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
375
|
+
type: "button",
|
|
376
|
+
variant: "outline",
|
|
377
|
+
size: "icon",
|
|
378
|
+
color: "error",
|
|
379
|
+
disabled: !canMoveToSource,
|
|
380
|
+
"aria-label": `Move selected to ${sourceTitle}`,
|
|
381
|
+
onClick: handleMoveToSource,
|
|
382
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, {
|
|
383
|
+
className: "max-md:rotate-90",
|
|
384
|
+
"aria-hidden": true
|
|
385
|
+
})
|
|
386
|
+
})]
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ jsx(TransferListPanel, {
|
|
389
|
+
title: targetTitle,
|
|
390
|
+
titleId: targetTitleId,
|
|
391
|
+
items: targetItems,
|
|
392
|
+
selectedIds: targetSelectedIds,
|
|
393
|
+
onSelectionChange: setTargetSelectedIds,
|
|
394
|
+
getItemId: resolveId,
|
|
395
|
+
getItemLabel: resolveLabel,
|
|
396
|
+
isItemDisabled: resolveDisabled,
|
|
397
|
+
renderItem,
|
|
398
|
+
searchable,
|
|
399
|
+
disabled,
|
|
400
|
+
side: "target",
|
|
401
|
+
maxHeight
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ jsx("div", {
|
|
404
|
+
className: "sr-only",
|
|
405
|
+
"aria-live": "polite",
|
|
406
|
+
"aria-atomic": "true",
|
|
407
|
+
children: liveMessage
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
export { TransferList };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../core/animate-ui/components/animate/tooltip.js";
|
|
4
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/truncated-line-with-tooltip/truncated-line-with-tooltip.tsx
|
|
7
|
+
function hasTooltipContent(content) {
|
|
8
|
+
if (content == null) return false;
|
|
9
|
+
if (typeof content === "string") return content.length > 0;
|
|
10
|
+
if (typeof content === "number") return true;
|
|
11
|
+
if (typeof content === "boolean") return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Single-line truncation with tooltip when overflow (measured via DOM).
|
|
16
|
+
* Wrap in {@link TooltipProvider} at the tree root when using tooltips.
|
|
17
|
+
*/
|
|
18
|
+
function TruncatedLineWithTooltip({ className, tooltipContent, children }) {
|
|
19
|
+
const textRef = useRef(null);
|
|
20
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
21
|
+
const measure = useCallback(() => {
|
|
22
|
+
const el = textRef.current;
|
|
23
|
+
if (!el) return;
|
|
24
|
+
setIsTruncated(el.scrollWidth > el.clientWidth + 1);
|
|
25
|
+
}, []);
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
measure();
|
|
28
|
+
}, [
|
|
29
|
+
measure,
|
|
30
|
+
children,
|
|
31
|
+
tooltipContent
|
|
32
|
+
]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
35
|
+
const el = textRef.current;
|
|
36
|
+
const ro = new ResizeObserver(measure);
|
|
37
|
+
if (el) ro.observe(el);
|
|
38
|
+
return () => ro.disconnect();
|
|
39
|
+
}, [measure]);
|
|
40
|
+
const line = /* @__PURE__ */ jsx("span", {
|
|
41
|
+
ref: textRef,
|
|
42
|
+
className: cn("block min-w-0 truncate", className),
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
if (!(isTruncated && hasTooltipContent(tooltipContent))) return line;
|
|
46
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
47
|
+
side: "top",
|
|
48
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
49
|
+
className: "block min-w-0 w-full cursor-inherit text-left",
|
|
50
|
+
children: line
|
|
51
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
52
|
+
className: "max-w-sm",
|
|
53
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "break-words",
|
|
55
|
+
children: tooltipContent
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { TruncatedLineWithTooltip };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/components/typography/typography-variants.ts
|
|
2
|
+
var TYPOGRAPHY_VARIANTS = [
|
|
3
|
+
"h1",
|
|
4
|
+
"h2",
|
|
5
|
+
"h3",
|
|
6
|
+
"h4",
|
|
7
|
+
"h5",
|
|
8
|
+
"h6",
|
|
9
|
+
"body1",
|
|
10
|
+
"body2",
|
|
11
|
+
"subtitle1",
|
|
12
|
+
"subtitle2"
|
|
13
|
+
];
|
|
14
|
+
/** Tailwind classes per variant — edit here to tune the type scale. */
|
|
15
|
+
var typographyVariantClasses = {
|
|
16
|
+
h1: "text-3xl font-bold tracking-tight",
|
|
17
|
+
h2: "text-2xl font-bold tracking-tight",
|
|
18
|
+
h3: "text-xl font-semibold tracking-tight",
|
|
19
|
+
h4: "text-lg font-semibold",
|
|
20
|
+
h5: "text-base font-semibold",
|
|
21
|
+
h6: "text-sm font-semibold",
|
|
22
|
+
subtitle1: "text-sm font-medium text-muted-foreground",
|
|
23
|
+
subtitle2: "text-xs font-medium text-muted-foreground",
|
|
24
|
+
body1: "text-base leading-relaxed",
|
|
25
|
+
body2: "text-sm leading-normal"
|
|
26
|
+
};
|
|
27
|
+
/** Default semantic tag per variant (Material UI–aligned). */
|
|
28
|
+
var typographyDefaultElement = {
|
|
29
|
+
h1: "h1",
|
|
30
|
+
h2: "h2",
|
|
31
|
+
h3: "h3",
|
|
32
|
+
h4: "h4",
|
|
33
|
+
h5: "h5",
|
|
34
|
+
h6: "h6",
|
|
35
|
+
subtitle1: "h6",
|
|
36
|
+
subtitle2: "h6",
|
|
37
|
+
body1: "p",
|
|
38
|
+
body2: "p"
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { TYPOGRAPHY_VARIANTS, typographyDefaultElement, typographyVariantClasses };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { typographyDefaultElement, typographyVariantClasses } from "./typography-variants.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
//#region src/components/typography/typography.tsx
|
|
5
|
+
var Typography = React$1.forwardRef(function Typography({ variant = "body1", as, className, children, ...rest }, ref) {
|
|
6
|
+
const Component = as ?? typographyDefaultElement[variant];
|
|
7
|
+
return React$1.createElement(Component, {
|
|
8
|
+
ref,
|
|
9
|
+
className: cn("text-foreground", typographyVariantClasses[variant], className),
|
|
10
|
+
...rest
|
|
11
|
+
}, children);
|
|
12
|
+
});
|
|
13
|
+
Typography.displayName = "Typography";
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Typography };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Badge } from "../../core/badge.js";
|
|
3
|
+
import { userTypeBadgeRegistry } from "./user-type-badge.registry.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
//#region src/components/user-type-badge/user-type-badge.tsx
|
|
8
|
+
var userTypeBadgeSizeVariants = cva("inline-flex font-medium tracking-tight shadow-none transition-shadow duration-200 ease-out hover:shadow-sm [&_svg]:shrink-0", {
|
|
9
|
+
variants: { size: {
|
|
10
|
+
sm: "gap-1 px-1.5 py-0.5 text-xs [&_svg]:size-3",
|
|
11
|
+
default: "gap-1.5 px-2 py-1 text-sm [&_svg]:size-3.5",
|
|
12
|
+
lg: "gap-2 px-2.5 py-1.5 text-base [&_svg]:size-4"
|
|
13
|
+
} },
|
|
14
|
+
defaultVariants: { size: "default" }
|
|
15
|
+
});
|
|
16
|
+
var userTypeBadgeMetallicClasses = cn("relative isolate overflow-hidden border border-white/20", "shadow-[inset_0_1px_0_rgba(255,255,255,0.30),inset_0_-1px_0_rgba(0,0,0,0.22)]", "before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit]", "before:bg-[linear-gradient(135deg,rgba(255,255,255,0.24)_0%,rgba(255,255,255,0.04)_36%,rgba(0,0,0,0.16)_72%,rgba(255,255,255,0.12)_100%)]", "after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:border after:border-white/15", "after:bg-[linear-gradient(315deg,rgba(255,255,255,0.24)_0%,rgba(255,255,255,0.04)_36%,rgba(0,0,0,0.16)_72%,rgba(255,255,255,0.12)_100%)]", "after:opacity-0 after:transition-opacity after:duration-[1800ms] after:ease-in-out hover:after:opacity-100");
|
|
17
|
+
var UserTypeBadge = React$1.forwardRef(({ userType, size = "default", className, ...props }, ref) => {
|
|
18
|
+
const { color, icon: Icon, label } = userTypeBadgeRegistry[userType];
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
ref,
|
|
21
|
+
className: "inline-block",
|
|
22
|
+
...props,
|
|
23
|
+
children: /* @__PURE__ */ jsxs(Badge, {
|
|
24
|
+
variant: "solid",
|
|
25
|
+
color,
|
|
26
|
+
className: cn(userTypeBadgeSizeVariants({ size }), userTypeBadgeMetallicClasses, className),
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
28
|
+
"aria-hidden": true,
|
|
29
|
+
className: "relative z-10",
|
|
30
|
+
strokeWidth: 2.25
|
|
31
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: "relative z-10 [text-shadow:0_1px_1px_rgba(0,0,0,0.20)]",
|
|
33
|
+
children: label
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
UserTypeBadge.displayName = "UserTypeBadge";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { UserTypeBadge, userTypeBadgeSizeVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Crown, ShieldCheck } from "lucide-react";
|
|
2
|
+
//#region src/components/user-type-badge/user-type-badge.registry.ts
|
|
3
|
+
var userTypeBadgeRegistry = {
|
|
4
|
+
admin: {
|
|
5
|
+
label: "Admin",
|
|
6
|
+
color: "secondary",
|
|
7
|
+
icon: ShieldCheck
|
|
8
|
+
},
|
|
9
|
+
super_admin: {
|
|
10
|
+
label: "Super admin",
|
|
11
|
+
color: "error",
|
|
12
|
+
icon: Crown
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var userTypeBadgeUserTypes = Object.keys(userTypeBadgeRegistry);
|
|
16
|
+
//#endregion
|
|
17
|
+
export { userTypeBadgeRegistry, userTypeBadgeUserTypes };
|