@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,309 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { isPresetColor } from "../../utils/color.js";
|
|
4
|
+
import { SilverMetallicBorderOverlay, SilverShineOverlay } from "../../utils/silver-shine.js";
|
|
5
|
+
import { PRESET_GRADIENT_BACKDROP, PRESET_GRADIENT_FRAME, SILVER_GRADIENT_BACKDROP, VARIANT_GRADIENT_BACKDROP_BASE, VARIANT_GRADIENT_HOVER_OVERLAY_CLASS, arbitraryGradientBackgroundImage, resolveVariantStyles } from "../../utils/variant.js";
|
|
6
|
+
import { IconAvatar } from "../icon-avatar/icon-avatar.js";
|
|
7
|
+
import { Typography } from "../typography/typography.js";
|
|
8
|
+
import { TruncatedLineWithTooltip } from "../truncated-line-with-tooltip/truncated-line-with-tooltip.js";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/simple-clickable-card/simple-clickable-card-shared.tsx
|
|
12
|
+
var SIZE_STYLES = {
|
|
13
|
+
sm: {
|
|
14
|
+
rowPad: "p-3",
|
|
15
|
+
gap: "gap-2",
|
|
16
|
+
textGap: "gap-0.5",
|
|
17
|
+
chevronPx: 20,
|
|
18
|
+
avatar: 36,
|
|
19
|
+
iconPx: 18,
|
|
20
|
+
titleVariant: "h6",
|
|
21
|
+
titleSizeClass: "text-xs"
|
|
22
|
+
},
|
|
23
|
+
default: {
|
|
24
|
+
rowPad: "p-4",
|
|
25
|
+
gap: "gap-3",
|
|
26
|
+
textGap: "gap-0.5",
|
|
27
|
+
chevronPx: 24,
|
|
28
|
+
avatar: 44,
|
|
29
|
+
iconPx: 22,
|
|
30
|
+
titleVariant: "h6"
|
|
31
|
+
},
|
|
32
|
+
lg: {
|
|
33
|
+
rowPad: "p-6",
|
|
34
|
+
gap: "gap-4",
|
|
35
|
+
textGap: "gap-1",
|
|
36
|
+
chevronPx: 32,
|
|
37
|
+
avatar: 52,
|
|
38
|
+
iconPx: 26,
|
|
39
|
+
titleVariant: "h5"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function iconSized(icon, iconPx) {
|
|
43
|
+
if (icon == null) return null;
|
|
44
|
+
const dim = {
|
|
45
|
+
width: iconPx,
|
|
46
|
+
height: iconPx
|
|
47
|
+
};
|
|
48
|
+
if (React$1.isValidElement(icon)) {
|
|
49
|
+
const el = icon;
|
|
50
|
+
return React$1.cloneElement(el, {
|
|
51
|
+
className: cn(el.props.className, "shrink-0"),
|
|
52
|
+
style: {
|
|
53
|
+
...el.props.style,
|
|
54
|
+
...dim
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "inline-flex shrink-0 items-center justify-center",
|
|
60
|
+
style: dim,
|
|
61
|
+
children: icon
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Default `IconAvatar` presentation for a card surface.
|
|
66
|
+
*
|
|
67
|
+
* The resolver only steps in for the outer-`solid` case, which needs a special
|
|
68
|
+
* enclosure to keep the icon legible against a same-color surface: it forces
|
|
69
|
+
* the avatar to `variant: "solid"` (same color as the surface) and layers a
|
|
70
|
+
* translucent-foreground bubble on top via `discStyle` — a ~15% white/near-
|
|
71
|
+
* white fill with a ~30% border in the color's `-foreground` token, and the
|
|
72
|
+
* glyph paints in that same foreground. The icon reads as enclosed in an
|
|
73
|
+
* inverted-fill circle.
|
|
74
|
+
*
|
|
75
|
+
* For every other outer variant the resolver returns `variant: undefined`, so
|
|
76
|
+
* each consumer keeps whatever default it had before (`Alert` still opts into
|
|
77
|
+
* a `solid` avatar disc; `SimpleClickableCard` / `SimpleInfoCard` /
|
|
78
|
+
* `IconTextActionCard` still fall through to `IconAvatar`'s `legacy` tinted
|
|
79
|
+
* disc). Explicit `iconAvatarVariant` / `iconAvatarColor` props always win.
|
|
80
|
+
*/
|
|
81
|
+
function resolveIconAvatarDefaults(variant, cardColor) {
|
|
82
|
+
if (variant !== "solid") return {
|
|
83
|
+
color: cardColor,
|
|
84
|
+
variant: void 0
|
|
85
|
+
};
|
|
86
|
+
const foreground = isPresetColor(cardColor) ? `var(--color-${cardColor}-foreground)` : "#ffffff";
|
|
87
|
+
return {
|
|
88
|
+
color: cardColor,
|
|
89
|
+
variant: "solid",
|
|
90
|
+
discStyle: {
|
|
91
|
+
backgroundColor: `color-mix(in srgb, ${foreground} 15%, transparent)`,
|
|
92
|
+
borderColor: `color-mix(in srgb, ${foreground} 30%, transparent)`,
|
|
93
|
+
borderStyle: "solid",
|
|
94
|
+
borderWidth: 1
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function hasRenderableDescription(description) {
|
|
99
|
+
if (description === void 0 || description === null) return false;
|
|
100
|
+
if (typeof description === "string") return description.length > 0;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
function hasRenderableTitle(title) {
|
|
104
|
+
if (title === void 0 || title === null) return false;
|
|
105
|
+
if (typeof title === "string") return title.trim().length > 0;
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
var PRESET_RING_CLASSES = {
|
|
109
|
+
primary: "hover:ring-primary/90 focus-within:ring-primary/90",
|
|
110
|
+
secondary: "hover:ring-secondary/90 focus-within:ring-secondary/90",
|
|
111
|
+
info: "hover:ring-info/90 focus-within:ring-info/90",
|
|
112
|
+
warning: "hover:ring-warning/90 focus-within:ring-warning/90",
|
|
113
|
+
error: "hover:ring-error/90 focus-within:ring-error/90",
|
|
114
|
+
success: "hover:ring-success/90 focus-within:ring-success/90",
|
|
115
|
+
disabled: "hover:ring-disabled/90 focus-within:ring-disabled/90",
|
|
116
|
+
gray: "hover:ring-gray/90 focus-within:ring-gray/90",
|
|
117
|
+
mist: "hover:ring-mist-border focus-within:ring-mist-border"
|
|
118
|
+
};
|
|
119
|
+
/** Ring tint for {@link SimpleInfoCard} shell — keyboard focus only (no hover ring). */
|
|
120
|
+
var PRESET_RING_CLASSES_FOCUS_WITHIN_ONLY = {
|
|
121
|
+
primary: "focus-within:ring-primary/90",
|
|
122
|
+
secondary: "focus-within:ring-secondary/90",
|
|
123
|
+
info: "focus-within:ring-info/90",
|
|
124
|
+
warning: "focus-within:ring-warning/90",
|
|
125
|
+
error: "focus-within:ring-error/90",
|
|
126
|
+
success: "focus-within:ring-success/90",
|
|
127
|
+
disabled: "focus-within:ring-disabled/90",
|
|
128
|
+
gray: "focus-within:ring-gray/90",
|
|
129
|
+
mist: "focus-within:ring-mist-border"
|
|
130
|
+
};
|
|
131
|
+
/** Ring classes when focus stays on a single inner `<button>` (SimpleClickableCard). */
|
|
132
|
+
var PRESET_RING_CLASSES_FOCUS_VISIBLE = {
|
|
133
|
+
primary: "hover:ring-primary/90 focus-visible:ring-primary/90",
|
|
134
|
+
secondary: "hover:ring-secondary/90 focus-visible:ring-secondary/90",
|
|
135
|
+
info: "hover:ring-info/90 focus-visible:ring-info/90",
|
|
136
|
+
warning: "hover:ring-warning/90 focus-visible:ring-warning/90",
|
|
137
|
+
error: "hover:ring-error/90 focus-visible:ring-error/90",
|
|
138
|
+
success: "hover:ring-success/90 focus-visible:ring-success/90",
|
|
139
|
+
disabled: "hover:ring-disabled/90 focus-visible:ring-disabled/90",
|
|
140
|
+
gray: "hover:ring-gray/90 focus-visible:ring-gray/90",
|
|
141
|
+
mist: "hover:ring-mist-border focus-visible:ring-mist-border"
|
|
142
|
+
};
|
|
143
|
+
var ringTransitionClass = "transition-[box-shadow] duration-[1400ms] ease-in-out";
|
|
144
|
+
function useSimpleClickableCardSurface(options) {
|
|
145
|
+
const { variant, color, size } = options;
|
|
146
|
+
const s = SIZE_STYLES[size];
|
|
147
|
+
const styles = resolveVariantStyles(variant, color);
|
|
148
|
+
const isArbitraryGradient = variant === "gradient" && !isPresetColor(color);
|
|
149
|
+
const surfaceStyleWithoutGradientBg = React$1.useMemo(() => {
|
|
150
|
+
if (!isArbitraryGradient || typeof color !== "string") return styles.containerStyle;
|
|
151
|
+
const cs = styles.containerStyle;
|
|
152
|
+
if (!cs) return void 0;
|
|
153
|
+
const { backgroundImage: _, borderColor: __, ...rest } = cs;
|
|
154
|
+
return {
|
|
155
|
+
...rest,
|
|
156
|
+
borderColor: "transparent"
|
|
157
|
+
};
|
|
158
|
+
}, [
|
|
159
|
+
isArbitraryGradient,
|
|
160
|
+
color,
|
|
161
|
+
styles.containerStyle
|
|
162
|
+
]);
|
|
163
|
+
const presetGradientPair = variant === "gradient" && isPresetColor(color) ? PRESET_GRADIENT_BACKDROP[color] : void 0;
|
|
164
|
+
const surfaceContainerClass = variant === "gradient" && isPresetColor(color) ? PRESET_GRADIENT_FRAME[color] : styles.container;
|
|
165
|
+
const presetRingClasses = isPresetColor(color) ? PRESET_RING_CLASSES_FOCUS_VISIBLE[color] : "";
|
|
166
|
+
const ringAccentStyle = React$1.useMemo(() => {
|
|
167
|
+
if (isPresetColor(color)) return void 0;
|
|
168
|
+
if (typeof color !== "string") return void 0;
|
|
169
|
+
return { "--tw-ring-color": `color-mix(in srgb, ${color} 90%, transparent)` };
|
|
170
|
+
}, [color]);
|
|
171
|
+
const iconAvatarDefaults = resolveIconAvatarDefaults(variant, color);
|
|
172
|
+
return {
|
|
173
|
+
s,
|
|
174
|
+
styles,
|
|
175
|
+
isArbitraryGradient,
|
|
176
|
+
surfaceStyleWithoutGradientBg,
|
|
177
|
+
presetGradientPair,
|
|
178
|
+
surfaceContainerClass,
|
|
179
|
+
presetRingClasses,
|
|
180
|
+
ringAccentStyle,
|
|
181
|
+
iconAvatarColor: iconAvatarDefaults.color,
|
|
182
|
+
iconAvatarVariant: iconAvatarDefaults.variant,
|
|
183
|
+
iconAvatarDiscStyle: iconAvatarDefaults.discStyle
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** For SimpleInfoCard shell — ring follows container `focus-within`. */
|
|
187
|
+
function useSimpleClickableCardSurfaceShell(options) {
|
|
188
|
+
const base = useSimpleClickableCardSurface(options);
|
|
189
|
+
const { color } = options;
|
|
190
|
+
const presetRingClassesShell = isPresetColor(color) ? PRESET_RING_CLASSES_FOCUS_WITHIN_ONLY[color] : "";
|
|
191
|
+
return {
|
|
192
|
+
...base,
|
|
193
|
+
presetRingClasses: presetRingClassesShell
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function renderTitleAndDescriptionBlocks(p) {
|
|
197
|
+
const { title, description, truncateTitle = false, truncateDescription = false, s, fgClass, fgStyle, descClass, descStyle } = p;
|
|
198
|
+
const titleIsString = typeof title === "string";
|
|
199
|
+
const descriptionIsString = typeof description === "string";
|
|
200
|
+
const renderTitleTypography = (typoVariant, opts) => /* @__PURE__ */ jsx(Typography, {
|
|
201
|
+
as: "span",
|
|
202
|
+
variant: typoVariant,
|
|
203
|
+
className: cn("min-w-0 text-left", opts.extraTitleClass, fgClass, !opts.truncate && "break-words"),
|
|
204
|
+
style: fgStyle,
|
|
205
|
+
children: title
|
|
206
|
+
});
|
|
207
|
+
let titleBlock = null;
|
|
208
|
+
if (hasRenderableTitle(title)) if (titleIsString && truncateTitle) titleBlock = /* @__PURE__ */ jsx(TruncatedLineWithTooltip, {
|
|
209
|
+
className: "w-full",
|
|
210
|
+
tooltipContent: title,
|
|
211
|
+
children: renderTitleTypography(s.titleVariant, {
|
|
212
|
+
truncate: true,
|
|
213
|
+
extraTitleClass: s.titleSizeClass
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
else if (titleIsString) titleBlock = renderTitleTypography(s.titleVariant, {
|
|
217
|
+
truncate: false,
|
|
218
|
+
extraTitleClass: s.titleSizeClass
|
|
219
|
+
});
|
|
220
|
+
else titleBlock = /* @__PURE__ */ jsx(Typography, {
|
|
221
|
+
as: "div",
|
|
222
|
+
variant: s.titleVariant,
|
|
223
|
+
className: cn("min-w-0 text-left", s.titleSizeClass, fgClass),
|
|
224
|
+
style: fgStyle,
|
|
225
|
+
children: title
|
|
226
|
+
});
|
|
227
|
+
let descriptionBlock = null;
|
|
228
|
+
if (hasRenderableDescription(description)) if (descriptionIsString && truncateDescription) descriptionBlock = /* @__PURE__ */ jsx(TruncatedLineWithTooltip, {
|
|
229
|
+
className: "w-full",
|
|
230
|
+
tooltipContent: description,
|
|
231
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
232
|
+
as: "span",
|
|
233
|
+
variant: "body2",
|
|
234
|
+
className: cn("text-left font-medium", descClass),
|
|
235
|
+
style: descStyle,
|
|
236
|
+
children: description
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
else if (descriptionIsString) descriptionBlock = /* @__PURE__ */ jsx(Typography, {
|
|
240
|
+
as: "span",
|
|
241
|
+
variant: "body2",
|
|
242
|
+
className: cn("break-words text-left font-medium", descClass),
|
|
243
|
+
style: descStyle,
|
|
244
|
+
children: description
|
|
245
|
+
});
|
|
246
|
+
else descriptionBlock = /* @__PURE__ */ jsx("div", {
|
|
247
|
+
className: cn("min-w-0 text-left font-medium", descClass),
|
|
248
|
+
style: descStyle,
|
|
249
|
+
children: description
|
|
250
|
+
});
|
|
251
|
+
return {
|
|
252
|
+
titleBlock,
|
|
253
|
+
descriptionBlock
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function renderLeadingIconRow(options) {
|
|
257
|
+
const { icon, leadingIcon, s, iconAvatarColor, iconAvatarRingColor, iconAvatarVariant, iconAvatarDiscStyle, titleBlock, descriptionBlock, gradientZStyle } = options;
|
|
258
|
+
const defaultLeadingIcon = icon != null ? /* @__PURE__ */ jsx(IconAvatar, {
|
|
259
|
+
size: s.avatar,
|
|
260
|
+
color: iconAvatarColor,
|
|
261
|
+
variant: iconAvatarVariant,
|
|
262
|
+
ring: {
|
|
263
|
+
show: true,
|
|
264
|
+
color: iconAvatarRingColor
|
|
265
|
+
},
|
|
266
|
+
discStyle: iconAvatarDiscStyle,
|
|
267
|
+
children: iconSized(icon, s.iconPx)
|
|
268
|
+
}) : null;
|
|
269
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
270
|
+
className: cn("inline-flex min-w-0 flex-1 items-center", s.gap, gradientZStyle && "relative z-10"),
|
|
271
|
+
children: [leadingIcon ?? defaultLeadingIcon, /* @__PURE__ */ jsxs("div", {
|
|
272
|
+
className: cn("flex min-w-0 flex-1 flex-col justify-center", s.textGap),
|
|
273
|
+
children: [titleBlock, descriptionBlock]
|
|
274
|
+
})]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function renderGradientBackdropLayers(options) {
|
|
278
|
+
const { variant, color, presetGradientPair: presetGradientPairProp, includeHoverGradientOverlay = true } = options;
|
|
279
|
+
const nodes = [];
|
|
280
|
+
/** Silver gradient uses its own lighter backdrop — see `SILVER_GRADIENT_BACKDROP`. */
|
|
281
|
+
const presetGradientPair = presetGradientPairProp ?? (variant === "gradient" && color === "silver" ? SILVER_GRADIENT_BACKDROP : void 0);
|
|
282
|
+
if (presetGradientPair != null) {
|
|
283
|
+
nodes.push(/* @__PURE__ */ jsx("span", {
|
|
284
|
+
"aria-hidden": true,
|
|
285
|
+
className: cn(VARIANT_GRADIENT_BACKDROP_BASE, presetGradientPair.idle)
|
|
286
|
+
}, "idle"));
|
|
287
|
+
if (includeHoverGradientOverlay) nodes.push(/* @__PURE__ */ jsx("span", {
|
|
288
|
+
"aria-hidden": true,
|
|
289
|
+
className: cn(VARIANT_GRADIENT_BACKDROP_BASE, presetGradientPair.hover, VARIANT_GRADIENT_HOVER_OVERLAY_CLASS)
|
|
290
|
+
}, "hover"));
|
|
291
|
+
}
|
|
292
|
+
if (variant === "gradient" && !isPresetColor(color) && typeof color === "string" && color !== "silver") {
|
|
293
|
+
nodes.push(/* @__PURE__ */ jsx("span", {
|
|
294
|
+
"aria-hidden": true,
|
|
295
|
+
className: VARIANT_GRADIENT_BACKDROP_BASE,
|
|
296
|
+
style: { backgroundImage: arbitraryGradientBackgroundImage(color, "idle") }
|
|
297
|
+
}, "arb-idle"));
|
|
298
|
+
if (includeHoverGradientOverlay) nodes.push(/* @__PURE__ */ jsx("span", {
|
|
299
|
+
"aria-hidden": true,
|
|
300
|
+
className: cn(VARIANT_GRADIENT_BACKDROP_BASE, VARIANT_GRADIENT_HOVER_OVERLAY_CLASS),
|
|
301
|
+
style: { backgroundImage: arbitraryGradientBackgroundImage(color, "hover") }
|
|
302
|
+
}, "arb-hover"));
|
|
303
|
+
}
|
|
304
|
+
if (color === "silver" && variant === "gradient") nodes.push(/* @__PURE__ */ jsx(SilverShineOverlay, {}, "silver-shine"));
|
|
305
|
+
if (color === "silver" && variant === "outline") nodes.push(/* @__PURE__ */ jsx(SilverMetallicBorderOverlay, {}, "silver-border"));
|
|
306
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: nodes });
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
export { PRESET_RING_CLASSES, PRESET_RING_CLASSES_FOCUS_VISIBLE, PRESET_RING_CLASSES_FOCUS_WITHIN_ONLY, SIZE_STYLES, hasRenderableDescription, hasRenderableTitle, iconSized, renderGradientBackdropLayers, renderLeadingIconRow, renderTitleAndDescriptionBlocks, resolveIconAvatarDefaults, ringTransitionClass, useSimpleClickableCardSurface, useSimpleClickableCardSurfaceShell };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { TooltipProvider } from "../../core/animate-ui/components/animate/tooltip.js";
|
|
4
|
+
import { renderGradientBackdropLayers, renderLeadingIconRow, renderTitleAndDescriptionBlocks, ringTransitionClass, useSimpleClickableCardSurface } from "./simple-clickable-card-shared.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronRight } from "lucide-react";
|
|
8
|
+
//#region src/components/simple-clickable-card/simple-clickable-card.tsx
|
|
9
|
+
function trailingChevronRow(options) {
|
|
10
|
+
const { icon, leadingIcon, s, iconAvatarColor, iconAvatarRingColor, iconAvatarVariant, iconAvatarDiscStyle, titleBlock, descriptionBlock, variant, fgClass, fgStyle, chevronPx, hideEndIcon, endIcon } = options;
|
|
11
|
+
const leadingInner = renderLeadingIconRow({
|
|
12
|
+
icon,
|
|
13
|
+
leadingIcon,
|
|
14
|
+
s,
|
|
15
|
+
iconAvatarColor,
|
|
16
|
+
iconAvatarRingColor,
|
|
17
|
+
iconAvatarVariant,
|
|
18
|
+
iconAvatarDiscStyle,
|
|
19
|
+
titleBlock,
|
|
20
|
+
descriptionBlock,
|
|
21
|
+
gradientZStyle: false
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
24
|
+
className: cn("inline-flex min-w-0 flex-1 items-center", s.gap, variant === "gradient" && "relative z-10"),
|
|
25
|
+
children: [leadingInner, !hideEndIcon && (endIcon !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "shrink-0",
|
|
27
|
+
children: endIcon
|
|
28
|
+
}) : /* @__PURE__ */ jsx(ChevronRight, {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
size: chevronPx,
|
|
31
|
+
className: cn("shrink-0", fgClass),
|
|
32
|
+
style: fgStyle
|
|
33
|
+
}))]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
var SimpleClickableCard = React$1.forwardRef(({ icon, leadingIcon, title, description, truncateTitle = false, truncateDescription = false, onClick, color = "gray", iconAvatarVariant: iconAvatarVariantProp, iconAvatarColor: iconAvatarColorProp, size = "default", variant = "soft", className, type = "button", disabled, hideEndIcon = false, endIcon, ...rest }, ref) => {
|
|
37
|
+
const { onMouseEnter: onMouseEnterProp, onMouseLeave: onMouseLeaveProp, ...buttonRest } = rest;
|
|
38
|
+
const { s, styles, isArbitraryGradient, surfaceStyleWithoutGradientBg, presetGradientPair, surfaceContainerClass, presetRingClasses, ringAccentStyle, iconAvatarColor: resolvedIconAvatarColor, iconAvatarVariant: resolvedIconAvatarVariant, iconAvatarDiscStyle } = useSimpleClickableCardSurface({
|
|
39
|
+
variant,
|
|
40
|
+
color,
|
|
41
|
+
size
|
|
42
|
+
});
|
|
43
|
+
const iconAvatarColor = iconAvatarColorProp ?? resolvedIconAvatarColor;
|
|
44
|
+
const iconAvatarVariant = iconAvatarVariantProp ?? resolvedIconAvatarVariant;
|
|
45
|
+
const iconAvatarRingColor = iconAvatarColorProp ?? color;
|
|
46
|
+
const resolvedDiscStyle = iconAvatarColorProp == null ? iconAvatarDiscStyle : void 0;
|
|
47
|
+
const fgClass = styles.foreground;
|
|
48
|
+
const fgStyle = styles.foregroundStyle;
|
|
49
|
+
const descClass = styles.description;
|
|
50
|
+
const descStyle = styles.descriptionStyle;
|
|
51
|
+
const { titleBlock, descriptionBlock } = renderTitleAndDescriptionBlocks({
|
|
52
|
+
title,
|
|
53
|
+
description,
|
|
54
|
+
truncateTitle,
|
|
55
|
+
truncateDescription,
|
|
56
|
+
s,
|
|
57
|
+
fgClass,
|
|
58
|
+
fgStyle,
|
|
59
|
+
descClass,
|
|
60
|
+
descStyle
|
|
61
|
+
});
|
|
62
|
+
const gradientLayers = renderGradientBackdropLayers({
|
|
63
|
+
variant,
|
|
64
|
+
color,
|
|
65
|
+
presetGradientPair
|
|
66
|
+
});
|
|
67
|
+
const rowWithChevron = trailingChevronRow({
|
|
68
|
+
icon,
|
|
69
|
+
leadingIcon,
|
|
70
|
+
s,
|
|
71
|
+
iconAvatarColor,
|
|
72
|
+
iconAvatarRingColor,
|
|
73
|
+
iconAvatarVariant,
|
|
74
|
+
iconAvatarDiscStyle: resolvedDiscStyle,
|
|
75
|
+
titleBlock,
|
|
76
|
+
descriptionBlock,
|
|
77
|
+
variant,
|
|
78
|
+
fgClass,
|
|
79
|
+
fgStyle,
|
|
80
|
+
chevronPx: s.chevronPx,
|
|
81
|
+
hideEndIcon,
|
|
82
|
+
endIcon
|
|
83
|
+
});
|
|
84
|
+
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
85
|
+
openDelay: 300,
|
|
86
|
+
closeDelay: 100,
|
|
87
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
88
|
+
ref,
|
|
89
|
+
type,
|
|
90
|
+
disabled,
|
|
91
|
+
onClick,
|
|
92
|
+
onMouseEnter: onMouseEnterProp,
|
|
93
|
+
onMouseLeave: onMouseLeaveProp,
|
|
94
|
+
className: cn("relative isolate inline-flex w-full cursor-pointer items-center overflow-hidden rounded-xl text-left ring-offset-background", ringTransitionClass, variant === "gradient" && "group", "focus-visible:outline-none hover:ring-2 hover:ring-offset-2 focus-visible:ring-2 focus-visible:ring-offset-2", presetRingClasses, "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", s.rowPad, s.gap, surfaceContainerClass, className),
|
|
95
|
+
style: {
|
|
96
|
+
...isArbitraryGradient ? surfaceStyleWithoutGradientBg : styles.containerStyle,
|
|
97
|
+
...ringAccentStyle
|
|
98
|
+
},
|
|
99
|
+
...buttonRest,
|
|
100
|
+
children: [gradientLayers, rowWithChevron]
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
SimpleClickableCard.displayName = "SimpleClickableCard";
|
|
105
|
+
//#endregion
|
|
106
|
+
export { SimpleClickableCard };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { isPresetColor } from "../../utils/color.js";
|
|
4
|
+
import { TooltipProvider } from "../../core/animate-ui/components/animate/tooltip.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../core/popover.js";
|
|
7
|
+
import { renderGradientBackdropLayers, renderLeadingIconRow, renderTitleAndDescriptionBlocks, useSimpleClickableCardSurfaceShell } from "../simple-clickable-card/simple-clickable-card-shared.js";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Info } from "lucide-react";
|
|
11
|
+
//#region src/components/simple-info-card/simple-info-card.tsx
|
|
12
|
+
function hasRenderableInfoContent(content) {
|
|
13
|
+
if (content === void 0 || content === null) return false;
|
|
14
|
+
if (typeof content === "string") return content.trim().length > 0;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Core {@link Button} applies `[&_svg]:size-4`, which overrides Lucide `size`.
|
|
19
|
+
* Must stay aligned with {@link SIZE_STYLES}.chevronPx (`sm` 20 / default 24 / lg 32).
|
|
20
|
+
*/
|
|
21
|
+
var INFO_TRIGGER_SVG_SIZE_CLASS = {
|
|
22
|
+
sm: "[&_svg]:!size-5",
|
|
23
|
+
default: "[&_svg]:!size-6",
|
|
24
|
+
lg: "[&_svg]:!size-7"
|
|
25
|
+
};
|
|
26
|
+
/** Info trigger muted tone on soft/outline/gradient surfaces (accent at 60%). */
|
|
27
|
+
var INFO_ICON_FG_CLASS = {
|
|
28
|
+
primary: "text-primary/60",
|
|
29
|
+
secondary: "text-secondary/60",
|
|
30
|
+
error: "text-error/60",
|
|
31
|
+
info: "text-info/60",
|
|
32
|
+
success: "text-success/60",
|
|
33
|
+
warning: "text-warning/60",
|
|
34
|
+
disabled: "text-disabled/60",
|
|
35
|
+
gray: "text-gray/60",
|
|
36
|
+
mist: "text-mist-secondary"
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Solid surfaces use semantic foreground tokens so the info trigger stays
|
|
40
|
+
* legible against the saturated surface; muted with `/60`.
|
|
41
|
+
*/
|
|
42
|
+
var SOLID_INFO_ICON_FG_CLASS = {
|
|
43
|
+
primary: "text-primary-foreground/60",
|
|
44
|
+
secondary: "text-secondary-foreground/60",
|
|
45
|
+
error: "text-error-foreground/60",
|
|
46
|
+
info: "text-info-foreground/60",
|
|
47
|
+
success: "text-success-foreground/60",
|
|
48
|
+
warning: "text-warning-foreground/60",
|
|
49
|
+
disabled: "text-disabled-foreground/60",
|
|
50
|
+
gray: "text-gray-foreground/60",
|
|
51
|
+
mist: "text-mist-foreground/60"
|
|
52
|
+
};
|
|
53
|
+
function infoTriggerIconFgClass(variant, cardColor, infoButtonColor) {
|
|
54
|
+
if (variant === "solid" && cardColor !== void 0 && isPresetColor(cardColor)) return SOLID_INFO_ICON_FG_CLASS[cardColor];
|
|
55
|
+
if (variant === "solid" && typeof cardColor === "string" && !isPresetColor(cardColor)) return "text-white/60";
|
|
56
|
+
return INFO_ICON_FG_CLASS[infoButtonColor];
|
|
57
|
+
}
|
|
58
|
+
var SimpleInfoCard = React$1.forwardRef(({ icon, title, description, infoContent, truncateTitle = false, truncateDescription = false, color = "gray", iconAvatarVariant: iconAvatarVariantProp, iconAvatarColor: iconAvatarColorProp, size = "default", variant = "soft", className, disabled, popoverSide = "bottom", popoverAlign = "end", infoIconLabel = "More information", ...divRest }, ref) => {
|
|
59
|
+
const { style: userStyle, ...shellDivRest } = divRest;
|
|
60
|
+
const showInfo = hasRenderableInfoContent(infoContent);
|
|
61
|
+
const { s, styles, isArbitraryGradient, surfaceStyleWithoutGradientBg, presetGradientPair, surfaceContainerClass, ringAccentStyle, iconAvatarColor: resolvedIconAvatarColor, iconAvatarVariant: resolvedIconAvatarVariant, iconAvatarDiscStyle } = useSimpleClickableCardSurfaceShell({
|
|
62
|
+
variant,
|
|
63
|
+
color,
|
|
64
|
+
size
|
|
65
|
+
});
|
|
66
|
+
const iconAvatarColor = iconAvatarColorProp ?? resolvedIconAvatarColor;
|
|
67
|
+
const iconAvatarVariant = iconAvatarVariantProp ?? resolvedIconAvatarVariant;
|
|
68
|
+
const iconAvatarRingColor = iconAvatarColorProp ?? color;
|
|
69
|
+
const resolvedDiscStyle = iconAvatarColorProp == null ? iconAvatarDiscStyle : void 0;
|
|
70
|
+
const fgClass = styles.foreground;
|
|
71
|
+
const fgStyle = styles.foregroundStyle;
|
|
72
|
+
const descClass = styles.description;
|
|
73
|
+
const descStyle = styles.descriptionStyle;
|
|
74
|
+
const { titleBlock, descriptionBlock } = renderTitleAndDescriptionBlocks({
|
|
75
|
+
title,
|
|
76
|
+
description,
|
|
77
|
+
truncateTitle,
|
|
78
|
+
truncateDescription,
|
|
79
|
+
s,
|
|
80
|
+
fgClass,
|
|
81
|
+
fgStyle,
|
|
82
|
+
descClass,
|
|
83
|
+
descStyle
|
|
84
|
+
});
|
|
85
|
+
const gradientLayers = renderGradientBackdropLayers({
|
|
86
|
+
variant,
|
|
87
|
+
color,
|
|
88
|
+
presetGradientPair
|
|
89
|
+
});
|
|
90
|
+
const leadingMain = renderLeadingIconRow({
|
|
91
|
+
icon,
|
|
92
|
+
s,
|
|
93
|
+
iconAvatarColor,
|
|
94
|
+
iconAvatarRingColor,
|
|
95
|
+
iconAvatarVariant,
|
|
96
|
+
iconAvatarDiscStyle: resolvedDiscStyle,
|
|
97
|
+
titleBlock,
|
|
98
|
+
descriptionBlock,
|
|
99
|
+
gradientZStyle: false
|
|
100
|
+
});
|
|
101
|
+
const shellStyle = {
|
|
102
|
+
...isArbitraryGradient ? surfaceStyleWithoutGradientBg : styles.containerStyle,
|
|
103
|
+
...ringAccentStyle
|
|
104
|
+
};
|
|
105
|
+
const infoButtonColor = isPresetColor(color) ? color : "gray";
|
|
106
|
+
const primaryBlock = /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: cn("-m-0 inline-flex min-h-0 min-w-0 flex-1 cursor-default select-text items-center rounded-none border-0 bg-transparent text-left outline-none", s.gap, variant === "gradient" && "relative z-10", !showInfo && "w-full min-w-0", showInfo && "min-w-0"),
|
|
108
|
+
children: leadingMain
|
|
109
|
+
});
|
|
110
|
+
const infoTrigger = showInfo ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
111
|
+
asChild: true,
|
|
112
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
113
|
+
type: "button",
|
|
114
|
+
disabled,
|
|
115
|
+
"aria-label": infoIconLabel,
|
|
116
|
+
color: infoButtonColor,
|
|
117
|
+
variant: "ghost",
|
|
118
|
+
size: "icon",
|
|
119
|
+
fullWidth: false,
|
|
120
|
+
hideRingOnHover: true,
|
|
121
|
+
className: cn("shrink-0", INFO_TRIGGER_SVG_SIZE_CLASS[size ?? "default"], infoTriggerIconFgClass(variant, color, infoButtonColor)),
|
|
122
|
+
children: /* @__PURE__ */ jsx(Info, {
|
|
123
|
+
"aria-hidden": true,
|
|
124
|
+
size: s.chevronPx
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
128
|
+
align: popoverAlign,
|
|
129
|
+
side: popoverSide,
|
|
130
|
+
sideOffset: 4,
|
|
131
|
+
children: infoContent
|
|
132
|
+
})] }) : null;
|
|
133
|
+
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
134
|
+
openDelay: 300,
|
|
135
|
+
closeDelay: 100,
|
|
136
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
137
|
+
ref,
|
|
138
|
+
className: cn("relative isolate inline-flex w-full max-w-full items-center overflow-hidden rounded-xl ring-offset-background", variant === "gradient" && "group", disabled && "pointer-events-none opacity-50", s.rowPad, showInfo ? s.gap : void 0, surfaceContainerClass, className),
|
|
139
|
+
style: {
|
|
140
|
+
...shellStyle,
|
|
141
|
+
...userStyle
|
|
142
|
+
},
|
|
143
|
+
...shellDivRest,
|
|
144
|
+
children: [
|
|
145
|
+
gradientLayers,
|
|
146
|
+
primaryBlock,
|
|
147
|
+
infoTrigger
|
|
148
|
+
]
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
SimpleInfoCard.displayName = "SimpleInfoCard";
|
|
153
|
+
//#endregion
|
|
154
|
+
export { SimpleInfoCard };
|