@espressif/dashboard-ui-components 1.9.1 → 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 +179 -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 +159 -63
- 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.d.ts +1 -1
- 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-ABBHGIFI.js +0 -733
- package/dist/chunk-HIUBSBAP.js +0 -59
- package/dist/chunk-OKB2WTX7.js +0 -363
- package/dist/chunk-P6F6UWV2.js +0 -323
- package/dist/chunk-TRTQSARU.js +0 -31
- package/dist/chunk-VU4CZ76T.js +0 -43
- package/dist/chunk-XFYL5IZU.js +0 -69604
- package/dist/chunk-XW6Z6VO4.js +0 -505
- package/dist/chunk-ZFYUONPY.js +0 -4321
- 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,105 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { buttonVariants } from "../../core/button.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
6
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
7
|
+
//#region src/components/calendar/calendar.tsx
|
|
8
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
|
|
9
|
+
const defaultClassNames = getDefaultClassNames();
|
|
10
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
11
|
+
showOutsideDays,
|
|
12
|
+
className: cn("group/calendar bg-background p-3 [--cell-size:2rem]", className),
|
|
13
|
+
captionLayout,
|
|
14
|
+
formatters: {
|
|
15
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
16
|
+
...formatters
|
|
17
|
+
},
|
|
18
|
+
classNames: {
|
|
19
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
20
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
21
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
22
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
23
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-[var(--cell-size)] p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
24
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-[var(--cell-size)] p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
25
|
+
month_caption: cn("flex h-[var(--cell-size)] w-full items-center justify-center px-[var(--cell-size)]", defaultClassNames.month_caption),
|
|
26
|
+
dropdowns: cn("flex h-[var(--cell-size)] w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
27
|
+
dropdown_root: cn("relative rounded-md has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50", defaultClassNames.dropdown_root),
|
|
28
|
+
dropdown: cn("absolute inset-0 opacity-0", defaultClassNames.dropdown),
|
|
29
|
+
caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
30
|
+
table: "w-full border-collapse",
|
|
31
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
32
|
+
weekday: cn("flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
33
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
34
|
+
week_number_header: cn("w-[var(--cell-size)] select-none", defaultClassNames.week_number_header),
|
|
35
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
36
|
+
day: cn("group/day relative aspect-square h-full w-full p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md", defaultClassNames.day),
|
|
37
|
+
range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
|
|
38
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
39
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
40
|
+
today: cn("rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
41
|
+
outside: cn("text-disabled aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
42
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
43
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
44
|
+
...classNames
|
|
45
|
+
},
|
|
46
|
+
components: {
|
|
47
|
+
Root: ({ className: rootClassName, rootRef, ...rootProps }) => {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
"data-slot": "calendar",
|
|
50
|
+
ref: rootRef,
|
|
51
|
+
className: cn(rootClassName),
|
|
52
|
+
...rootProps
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
Chevron: ({ className: chevronClassName, orientation, ...chevronProps }) => {
|
|
56
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
57
|
+
className: cn("size-4", chevronClassName),
|
|
58
|
+
...chevronProps
|
|
59
|
+
});
|
|
60
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
61
|
+
className: cn("size-4", chevronClassName),
|
|
62
|
+
...chevronProps
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
65
|
+
className: cn("size-4", chevronClassName),
|
|
66
|
+
...chevronProps
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
DayButton: CalendarDayButton,
|
|
70
|
+
WeekNumber: ({ children, ...weekProps }) => {
|
|
71
|
+
return /* @__PURE__ */ jsx("td", {
|
|
72
|
+
...weekProps,
|
|
73
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
74
|
+
className: "flex size-[var(--cell-size)] items-center justify-center text-center",
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
...components
|
|
80
|
+
},
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function CalendarDayButton({ className: dayClassName, day, modifiers, ...props }) {
|
|
85
|
+
const ref = React$1.useRef(null);
|
|
86
|
+
React$1.useEffect(() => {
|
|
87
|
+
if (modifiers.focused) ref.current?.focus();
|
|
88
|
+
}, [modifiers.focused]);
|
|
89
|
+
return /* @__PURE__ */ jsx("button", {
|
|
90
|
+
ref,
|
|
91
|
+
"data-day": day.date.toLocaleDateString(),
|
|
92
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
93
|
+
"data-range-start": modifiers.range_start,
|
|
94
|
+
"data-range-end": modifiers.range_end,
|
|
95
|
+
"data-range-middle": modifiers.range_middle,
|
|
96
|
+
className: cn(buttonVariants({
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
size: "icon"
|
|
99
|
+
}), "flex aspect-square size-auto w-full min-w-[var(--cell-size)] flex-col gap-1 leading-none font-normal", "group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50", "data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground", "data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground", "data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground", "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground", "[&>span]:text-xs [&>span]:opacity-70", dayClassName),
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
Calendar.displayName = "Calendar";
|
|
104
|
+
//#endregion
|
|
105
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import access_denied_default from "../../lottie-animations/animation-data/access-denied.js";
|
|
2
|
+
import active_default from "../../lottie-animations/animation-data/active.js";
|
|
3
|
+
import bar_chart_default from "../../lottie-animations/animation-data/bar-chart.js";
|
|
4
|
+
import chart_loading_default from "../../lottie-animations/animation-data/chart-loading.js";
|
|
5
|
+
import cloud_download_default from "../../lottie-animations/animation-data/cloud-download.js";
|
|
6
|
+
import cloud_sync_default from "../../lottie-animations/animation-data/cloud-sync.js";
|
|
7
|
+
import coud_upload_default from "../../lottie-animations/animation-data/coud-upload.js";
|
|
8
|
+
import cross_throb_default from "../../lottie-animations/animation-data/cross-throb.js";
|
|
9
|
+
import dashboard_loading_default from "../../lottie-animations/animation-data/dashboard-loading.js";
|
|
10
|
+
import error_default from "../../lottie-animations/animation-data/error.js";
|
|
11
|
+
import error_spread_out_default from "../../lottie-animations/animation-data/error-spread-out.js";
|
|
12
|
+
import green_success_default from "../../lottie-animations/animation-data/green-success.js";
|
|
13
|
+
import inactive_default from "../../lottie-animations/animation-data/inactive.js";
|
|
14
|
+
import light_default from "../../lottie-animations/animation-data/light.js";
|
|
15
|
+
import lock_default from "../../lottie-animations/animation-data/lock.js";
|
|
16
|
+
import lock2_default from "../../lottie-animations/animation-data/lock2.js";
|
|
17
|
+
import locked_default from "../../lottie-animations/animation-data/locked.js";
|
|
18
|
+
import search_error_default from "../../lottie-animations/animation-data/search-error.js";
|
|
19
|
+
import security_default from "../../lottie-animations/animation-data/security.js";
|
|
20
|
+
import success_default from "../../lottie-animations/animation-data/success.js";
|
|
21
|
+
import warning_default from "../../lottie-animations/animation-data/warning.js";
|
|
22
|
+
//#region src/components/cards/animated-card/animated-card-animations.ts
|
|
23
|
+
/**
|
|
24
|
+
* Central registry for AnimatedCard Lottie assets.
|
|
25
|
+
*
|
|
26
|
+
* Adding a new animation:
|
|
27
|
+
* 1. Drop `my-animation.json` in `src/components/lottie-animations/animation-data/` (kebab-case filename).
|
|
28
|
+
* 2. Import it below and add one entry: `myAnimation: myAnimationJson,` (camelCase key).
|
|
29
|
+
* 3. `AnimatedCardType` updates automatically.
|
|
30
|
+
*/
|
|
31
|
+
var animatedCardAnimations = {
|
|
32
|
+
accessDenied: access_denied_default,
|
|
33
|
+
active: active_default,
|
|
34
|
+
barChart: bar_chart_default,
|
|
35
|
+
chartLoading: chart_loading_default,
|
|
36
|
+
cloudDownload: cloud_download_default,
|
|
37
|
+
cloudSync: cloud_sync_default,
|
|
38
|
+
coudUpload: coud_upload_default,
|
|
39
|
+
crossThrob: cross_throb_default,
|
|
40
|
+
dashboardLoading: dashboard_loading_default,
|
|
41
|
+
error: error_default,
|
|
42
|
+
errorSpreadOut: error_spread_out_default,
|
|
43
|
+
greenSuccess: green_success_default,
|
|
44
|
+
inactive: inactive_default,
|
|
45
|
+
light: light_default,
|
|
46
|
+
lock: lock_default,
|
|
47
|
+
lock2: lock2_default,
|
|
48
|
+
locked: locked_default,
|
|
49
|
+
searchError: search_error_default,
|
|
50
|
+
security: security_default,
|
|
51
|
+
success: success_default,
|
|
52
|
+
warning: warning_default
|
|
53
|
+
};
|
|
54
|
+
/** All valid `type` values (same keys as `animatedCardAnimations`), for selects and tests. */
|
|
55
|
+
var animatedCardTypeKeys = Object.keys(animatedCardAnimations);
|
|
56
|
+
//#endregion
|
|
57
|
+
export { animatedCardAnimations, animatedCardTypeKeys };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../../../utils/cn.js";
|
|
2
|
+
import { Card, CardContent } from "../../../core/card.js";
|
|
3
|
+
import { LottieAnimationContainer } from "../../lottie-animation-container/lottie-animation-container.js";
|
|
4
|
+
import { animatedCardAnimations } from "./animated-card-animations.js";
|
|
5
|
+
import { AnimatedRainmakerLogo } from "../../../common/animated-rainmaker-logo/animated-rainmaker-logo.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/cards/animated-card/animated-card.tsx
|
|
8
|
+
var cardBaseClassName = "w-auto w-full";
|
|
9
|
+
var cardTransparentClassName = "border-0 bg-transparent shadow-none";
|
|
10
|
+
var contentDefaultClassName = "flex flex-col items-center gap-5 py-8 text-center";
|
|
11
|
+
function AnimatedCard({ type, iconSize, transparent = true, children, actions, className, contentClassName }) {
|
|
12
|
+
const animationData = type === "rainmaker-logo" ? null : animatedCardAnimations[type];
|
|
13
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
14
|
+
className: cn(cardBaseClassName, transparent && cardTransparentClassName, className),
|
|
15
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
16
|
+
className: cn(contentDefaultClassName, contentClassName),
|
|
17
|
+
children: [
|
|
18
|
+
type === "rainmaker-logo" ? /* @__PURE__ */ jsx(AnimatedRainmakerLogo, { style: {
|
|
19
|
+
width: iconSize,
|
|
20
|
+
height: iconSize
|
|
21
|
+
} }) : animationData != null ? /* @__PURE__ */ jsx(LottieAnimationContainer, {
|
|
22
|
+
animationData,
|
|
23
|
+
height: iconSize,
|
|
24
|
+
width: iconSize
|
|
25
|
+
}) : null,
|
|
26
|
+
children != null && /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: "text-base text-foreground w-full",
|
|
28
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx("p", {
|
|
29
|
+
className: "text-center font-medium",
|
|
30
|
+
children
|
|
31
|
+
}) : children
|
|
32
|
+
}),
|
|
33
|
+
actions != null && /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "w-full",
|
|
35
|
+
children: actions
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { AnimatedCard };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Avatar, AvatarFallback } from "../../core/avatar.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/cards/basic-details-card.tsx
|
|
5
|
+
var content = (icon, primaryText, secondaryText) => /* @__PURE__ */ jsxs(Fragment, { children: [icon != null && /* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AvatarFallback, {
|
|
6
|
+
className: "text-xs flex items-center justify-center gap-1 border",
|
|
7
|
+
children: icon
|
|
8
|
+
}) }), /* @__PURE__ */ jsxs("div", {
|
|
9
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
10
|
+
children: [primaryText != null && /* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: "text-sm font-semibold",
|
|
12
|
+
children: primaryText
|
|
13
|
+
}), secondaryText != null && /* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "truncate text-sm text-muted-foreground",
|
|
15
|
+
children: secondaryText
|
|
16
|
+
})]
|
|
17
|
+
})] });
|
|
18
|
+
function BasicDetailsCard({ icon, primaryText, secondaryText, action, className, onClick }) {
|
|
19
|
+
const rootClassName = cn("flex items-center gap-4", className);
|
|
20
|
+
if (onClick != null) return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
role: "button",
|
|
22
|
+
tabIndex: 0,
|
|
23
|
+
className: cn(rootClassName, "cursor-pointer ring-offset-background transition-all duration-300 hover:ring-2 hover:ring-offset-2 hover:ring-primary/90 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/90"),
|
|
24
|
+
onClick,
|
|
25
|
+
onKeyDown: (e) => {
|
|
26
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
onClick(e);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
children: [content(icon, primaryText, secondaryText), action != null && /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "shrink-0",
|
|
33
|
+
onClick: (e) => e.stopPropagation(),
|
|
34
|
+
children: action
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: rootClassName,
|
|
39
|
+
children: [content(icon, primaryText, secondaryText), action != null && /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: "shrink-0",
|
|
41
|
+
children: action
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { BasicDetailsCard };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../core/collapsible.js";
|
|
4
|
+
import { Card, CardHeader } from "../../core/card.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
8
|
+
//#region src/components/cards/collapsible-card.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Card with a clickable header that toggles a body region.
|
|
11
|
+
*
|
|
12
|
+
* The body is the `CollapsibleContent` child. Its mount lifecycle is the
|
|
13
|
+
* Radix Collapsible default: unmounted while closed, mounted on expand,
|
|
14
|
+
* unmounted again on collapse, remounted on the next expand. See the JSDoc on
|
|
15
|
+
* `CollapsibleContent` in `src/core/collapsible.tsx` for the full rules and
|
|
16
|
+
* the JSX eager-evaluation caveat.
|
|
17
|
+
*/
|
|
18
|
+
function CollapsibleCard({ children, className, defaultOpen = false }) {
|
|
19
|
+
const childArray = React$1.Children.toArray(children);
|
|
20
|
+
const contentChild = childArray.find((child) => React$1.isValidElement(child) && child.type === CollapsibleContent);
|
|
21
|
+
const titleChild = childArray.find((child) => React$1.isValidElement(child) && child.type !== CollapsibleContent);
|
|
22
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
23
|
+
className: cn("bg-transparent shadow-none rounded-md", className),
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Collapsible, {
|
|
25
|
+
defaultOpen,
|
|
26
|
+
className: "group",
|
|
27
|
+
children: [/* @__PURE__ */ jsx(CardHeader, {
|
|
28
|
+
className: "p-3 border-b border-transparent group-data-[state=open]:border-border",
|
|
29
|
+
children: /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
30
|
+
asChild: true,
|
|
31
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
32
|
+
type: "button",
|
|
33
|
+
className: "flex w-full min-w-0 items-center justify-between gap-2 rounded-md text-left outline-none ring-offset-background transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
34
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "min-w-0 flex-1 [&>div]:font-medium [&>div]:text-sm",
|
|
36
|
+
children: titleChild
|
|
37
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: "flex h-4 w-4 shrink-0 items-center justify-center",
|
|
39
|
+
children: [/* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 shrink-0 group-data-[state=open]:hidden" }), /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4 shrink-0 group-data-[state=closed]:hidden" })]
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}), contentChild && React$1.cloneElement(contentChild, { className: cn("px-4 pb-6 pt-4", contentChild.props.className) })]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CollapsibleCard };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cn } from "../../../utils/cn.js";
|
|
2
|
+
import { Card, CardContent } from "../../../core/card.js";
|
|
3
|
+
import { Illustration } from "../../illustration/illustration.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/cards/no-data-card/no-data-card.tsx
|
|
6
|
+
function NoDataCard({ illustration, hideIllustration = false, heading, description, action, className }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
8
|
+
className: cn("w-auto bg-transparent border-none shadow-none", className),
|
|
9
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
10
|
+
className: "flex flex-col items-center gap-4 py-8 text-center",
|
|
11
|
+
children: [
|
|
12
|
+
!hideIllustration && /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: "flex w-full shrink-0 justify-center",
|
|
14
|
+
children: illustration ?? /* @__PURE__ */ jsx(Illustration, { type: "no-search-results" })
|
|
15
|
+
}),
|
|
16
|
+
heading != null && /* @__PURE__ */ jsx("div", {
|
|
17
|
+
className: "text-lg font-semibold",
|
|
18
|
+
children: heading
|
|
19
|
+
}),
|
|
20
|
+
description != null && /* @__PURE__ */ jsx("p", {
|
|
21
|
+
className: "text-sm text-muted-foreground",
|
|
22
|
+
children: description
|
|
23
|
+
}),
|
|
24
|
+
action != null && /* @__PURE__ */ jsx("div", { children: action })
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { NoDataCard as default };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { isPresetColor } from "../../utils/color.js";
|
|
4
|
+
import { resolveVariantStyles } from "../../utils/variant.js";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../core/collapsible.js";
|
|
6
|
+
import { Card } from "../../core/card.js";
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../core/animate-ui/components/animate/tooltip.js";
|
|
8
|
+
import { Button } from "../button/button.js";
|
|
9
|
+
import { VariantGradientUnderlay } from "../../utils/variant-gradient-underlay.js";
|
|
10
|
+
import { Children, cloneElement, isValidElement, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
13
|
+
//#region src/components/cards/section-card.tsx
|
|
14
|
+
var sizeStyles = {
|
|
15
|
+
sm: {
|
|
16
|
+
pad: "p-3",
|
|
17
|
+
headerRowPadY: "py-3",
|
|
18
|
+
headerRowGapY: "gap-y-2",
|
|
19
|
+
headerTriggerPad: "-my-3 py-3 pl-3",
|
|
20
|
+
headerRightPad: "pl-3 pr-3",
|
|
21
|
+
gap: "gap-2",
|
|
22
|
+
primaryTypography: "text-xs font-semibold",
|
|
23
|
+
secondaryTypography: "text-xs",
|
|
24
|
+
primary: "text-xs font-semibold text-foreground",
|
|
25
|
+
secondary: "text-xs text-muted-foreground",
|
|
26
|
+
icon: "h-[18px] w-[18px] shrink-0",
|
|
27
|
+
chevron: "h-[18px] w-[18px]",
|
|
28
|
+
collapseTrigger: "h-[18px] w-[18px] min-h-[18px] min-w-[18px] !p-0 [&_svg]:!h-[18px] [&_svg]:!w-[18px] [&_svg]:!min-h-0 [&_svg]:!min-w-0"
|
|
29
|
+
},
|
|
30
|
+
default: {
|
|
31
|
+
pad: "p-4",
|
|
32
|
+
headerRowPadY: "py-4",
|
|
33
|
+
headerRowGapY: "gap-y-3",
|
|
34
|
+
headerTriggerPad: "-my-4 py-4 pl-4",
|
|
35
|
+
headerRightPad: "pl-3 pr-4",
|
|
36
|
+
gap: "gap-3",
|
|
37
|
+
primaryTypography: "text-sm font-semibold",
|
|
38
|
+
secondaryTypography: "text-sm",
|
|
39
|
+
primary: "text-sm font-semibold text-foreground",
|
|
40
|
+
secondary: "text-sm text-muted-foreground",
|
|
41
|
+
icon: "h-6 w-6 shrink-0",
|
|
42
|
+
chevron: "h-6 w-6",
|
|
43
|
+
collapseTrigger: "h-6 w-6 min-h-6 min-w-6 !p-0 [&_svg]:!h-6 [&_svg]:!w-6 [&_svg]:!min-h-0 [&_svg]:!min-w-0"
|
|
44
|
+
},
|
|
45
|
+
lg: {
|
|
46
|
+
pad: "p-6",
|
|
47
|
+
headerRowPadY: "py-6",
|
|
48
|
+
headerRowGapY: "gap-y-4",
|
|
49
|
+
headerTriggerPad: "-my-6 py-6 pl-6",
|
|
50
|
+
headerRightPad: "pl-3 pr-6",
|
|
51
|
+
gap: "gap-4",
|
|
52
|
+
primaryTypography: "text-base font-semibold",
|
|
53
|
+
secondaryTypography: "text-sm",
|
|
54
|
+
primary: "text-base font-semibold text-foreground",
|
|
55
|
+
secondary: "text-sm text-muted-foreground",
|
|
56
|
+
icon: "h-8 w-8 shrink-0",
|
|
57
|
+
chevron: "h-8 w-8",
|
|
58
|
+
collapseTrigger: "h-8 w-8 min-h-8 min-w-8 !p-0 [&_svg]:!h-8 [&_svg]:!w-8 [&_svg]:!min-h-0 [&_svg]:!min-w-0"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/** Merges size-based icon classes; size classes win over any `className` on the node. */
|
|
62
|
+
function iconSizedForSection(icon, iconClass) {
|
|
63
|
+
if (icon == null) return null;
|
|
64
|
+
if (isValidElement(icon)) {
|
|
65
|
+
const el = icon;
|
|
66
|
+
const prev = el.props.className;
|
|
67
|
+
return cloneElement(el, { className: cn(prev, iconClass) });
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: cn("inline-flex items-center justify-center", iconClass),
|
|
71
|
+
children: icon
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
var HEADER_WRAP_ROW_CLASS = "flex-wrap";
|
|
75
|
+
var HEADER_MAIN_BASIS_CLASS = "basis-48";
|
|
76
|
+
var HEADER_RIGHT_CLASS = "ml-auto max-w-full shrink-0";
|
|
77
|
+
var cardClassName = "rounded-lg border-border bg-card shadow-none overflow-hidden";
|
|
78
|
+
function hasTooltipContent(content) {
|
|
79
|
+
if (content == null) return false;
|
|
80
|
+
if (typeof content === "string") return content.length > 0;
|
|
81
|
+
if (typeof content === "number") return true;
|
|
82
|
+
if (typeof content === "boolean") return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
function hasRenderableContent(content) {
|
|
86
|
+
if (!hasTooltipContent(content)) return false;
|
|
87
|
+
return Children.count(content) > 0;
|
|
88
|
+
}
|
|
89
|
+
function TruncatedLineWithTooltip({ className, textStyle, tooltipContent, children }) {
|
|
90
|
+
const textRef = useRef(null);
|
|
91
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
92
|
+
const measure = useCallback(() => {
|
|
93
|
+
const el = textRef.current;
|
|
94
|
+
if (!el) return;
|
|
95
|
+
setIsTruncated(el.scrollWidth > el.clientWidth + 1);
|
|
96
|
+
}, []);
|
|
97
|
+
useLayoutEffect(() => {
|
|
98
|
+
measure();
|
|
99
|
+
}, [
|
|
100
|
+
measure,
|
|
101
|
+
children,
|
|
102
|
+
tooltipContent
|
|
103
|
+
]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
106
|
+
const el = textRef.current;
|
|
107
|
+
const ro = new ResizeObserver(measure);
|
|
108
|
+
if (el) ro.observe(el);
|
|
109
|
+
return () => ro.disconnect();
|
|
110
|
+
}, [measure]);
|
|
111
|
+
const line = /* @__PURE__ */ jsx("span", {
|
|
112
|
+
ref: textRef,
|
|
113
|
+
className: cn("block min-w-0 truncate", className),
|
|
114
|
+
style: textStyle,
|
|
115
|
+
children
|
|
116
|
+
});
|
|
117
|
+
if (!(isTruncated && hasTooltipContent(tooltipContent))) return line;
|
|
118
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
119
|
+
side: "top",
|
|
120
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
121
|
+
className: "block min-w-0 w-full cursor-inherit text-left",
|
|
122
|
+
children: line
|
|
123
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
124
|
+
className: "max-w-sm",
|
|
125
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "break-words",
|
|
127
|
+
children: tooltipContent
|
|
128
|
+
})
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function SectionCard({ icon, primaryText, secondaryText, truncateSecondaryText = true, actions, allowCollapse = true, hideCollapseIcon = false, defaultOpen = true, open: controlledOpen, size = "default", variant = "outline", color = "gray", children, className, style, fillHeight = false, onOpenChange }) {
|
|
133
|
+
const s = sizeStyles[size];
|
|
134
|
+
const resolvedColor = color;
|
|
135
|
+
const variantStyles = variant != null ? resolveVariantStyles(variant, resolvedColor) : null;
|
|
136
|
+
const collapseButtonColor = variantStyles != null && isPresetColor(resolvedColor) ? resolvedColor : "gray";
|
|
137
|
+
const primaryClass = variantStyles != null ? cn(s.primaryTypography, variantStyles.foreground) : s.primary;
|
|
138
|
+
const secondaryClass = variantStyles != null ? cn(s.secondaryTypography, variantStyles.description) : s.secondary;
|
|
139
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
setUncontrolledOpen(defaultOpen);
|
|
142
|
+
}, [defaultOpen]);
|
|
143
|
+
const isOpenControlled = controlledOpen !== void 0;
|
|
144
|
+
const open = isOpenControlled ? controlledOpen : uncontrolledOpen;
|
|
145
|
+
const toggleLabel = typeof primaryText === "string" ? `Toggle ${primaryText}` : "Toggle section";
|
|
146
|
+
const hasPrimaryText = hasRenderableContent(primaryText);
|
|
147
|
+
const hasSecondaryText = hasRenderableContent(secondaryText);
|
|
148
|
+
const hasHeaderText = hasPrimaryText || hasSecondaryText;
|
|
149
|
+
const hasIcon = hasRenderableContent(icon);
|
|
150
|
+
const showCollapseIcon = allowCollapse && !hideCollapseIcon;
|
|
151
|
+
const hasHeaderRight = hasRenderableContent(actions) || showCollapseIcon;
|
|
152
|
+
const headerMainPad = hasHeaderRight ? cn(s.headerTriggerPad, HEADER_MAIN_BASIS_CLASS) : s.pad;
|
|
153
|
+
const headerRowClass = cn("flex min-w-0 items-center justify-between", hasHeaderRight && cn(HEADER_WRAP_ROW_CLASS, s.headerRowPadY, s.headerRowGapY));
|
|
154
|
+
const isHeaderRequired = hasIcon || hasHeaderText || hasHeaderRight;
|
|
155
|
+
const hasBody = hasRenderableContent(children);
|
|
156
|
+
const headerMain = /* @__PURE__ */ jsxs(Fragment$1, { children: [hasIcon && /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: "flex shrink-0 self-center items-center justify-center",
|
|
158
|
+
style: variantStyles?.foregroundStyle,
|
|
159
|
+
children: iconSizedForSection(icon, cn(s.icon, variantStyles?.foreground))
|
|
160
|
+
}), hasHeaderText && /* @__PURE__ */ jsxs("div", {
|
|
161
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
162
|
+
children: [hasPrimaryText && /* @__PURE__ */ jsx("div", {
|
|
163
|
+
className: cn("break-words", primaryClass),
|
|
164
|
+
style: variantStyles?.foregroundStyle,
|
|
165
|
+
children: primaryText
|
|
166
|
+
}), hasSecondaryText && (truncateSecondaryText ? /* @__PURE__ */ jsx(TruncatedLineWithTooltip, {
|
|
167
|
+
className: secondaryClass,
|
|
168
|
+
textStyle: variantStyles?.descriptionStyle,
|
|
169
|
+
tooltipContent: secondaryText,
|
|
170
|
+
children: secondaryText
|
|
171
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
172
|
+
className: cn("block min-w-0 break-words", secondaryClass),
|
|
173
|
+
style: variantStyles?.descriptionStyle,
|
|
174
|
+
children: secondaryText
|
|
175
|
+
}))]
|
|
176
|
+
})] });
|
|
177
|
+
const chevronButton = /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
178
|
+
asChild: true,
|
|
179
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
180
|
+
type: "button",
|
|
181
|
+
variant: "ghost",
|
|
182
|
+
size: "icon",
|
|
183
|
+
color: collapseButtonColor,
|
|
184
|
+
className: s.collapseTrigger,
|
|
185
|
+
"aria-label": toggleLabel,
|
|
186
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
187
|
+
className: "flex shrink-0 items-center justify-center",
|
|
188
|
+
children: [/* @__PURE__ */ jsx(ChevronDown, {
|
|
189
|
+
className: cn(s.chevron, "shrink-0", open && "hidden", variantStyles?.foreground),
|
|
190
|
+
style: variantStyles?.foregroundStyle,
|
|
191
|
+
"aria-hidden": true
|
|
192
|
+
}), /* @__PURE__ */ jsx(ChevronUp, {
|
|
193
|
+
className: cn(s.chevron, "shrink-0", !open && "hidden", variantStyles?.foreground),
|
|
194
|
+
style: variantStyles?.foregroundStyle,
|
|
195
|
+
"aria-hidden": true
|
|
196
|
+
})]
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
});
|
|
200
|
+
const headerRight = hasHeaderRight ? /* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: cn("flex items-center gap-2", HEADER_RIGHT_CLASS, s.headerRightPad),
|
|
202
|
+
children: [actions, showCollapseIcon ? chevronButton : null]
|
|
203
|
+
}) : null;
|
|
204
|
+
const header = allowCollapse ? /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: headerRowClass,
|
|
206
|
+
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
207
|
+
asChild: true,
|
|
208
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
209
|
+
type: "button",
|
|
210
|
+
className: cn("section-card-header", "flex min-w-0 flex-1 items-center text-left rounded-md", headerMainPad, s.gap, "cursor-pointer outline-none transition-colors hover:bg-muted/50", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
|
|
211
|
+
"aria-label": toggleLabel,
|
|
212
|
+
children: headerMain
|
|
213
|
+
})
|
|
214
|
+
}), headerRight]
|
|
215
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
216
|
+
className: headerRowClass,
|
|
217
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
218
|
+
className: cn("section-card-header", "flex min-w-0 flex-1 items-center", s.gap, headerMainPad),
|
|
219
|
+
children: headerMain
|
|
220
|
+
}), headerRight]
|
|
221
|
+
});
|
|
222
|
+
const body = hasBody ? /* @__PURE__ */ jsx("div", {
|
|
223
|
+
className: cn("section-card-body", isHeaderRequired && "border-t border-border", variant === "outline" && "dark:border-border/45", fillHeight && "flex min-h-0 flex-1 flex-col", s.pad),
|
|
224
|
+
children
|
|
225
|
+
}) : null;
|
|
226
|
+
const isGradientVariant = variant === "gradient";
|
|
227
|
+
const cardSurfaceClass = variantStyles != null ? cn("rounded-lg shadow-none overflow-hidden", fillHeight && "flex min-h-0 flex-col", variantStyles.container, isGradientVariant && "border-transparent", className) : cn(cardClassName, fillHeight && "flex min-h-0 flex-col", className);
|
|
228
|
+
const cardSurfaceStyle = variantStyles != null && isGradientVariant ? {
|
|
229
|
+
...variantStyles.containerStyle,
|
|
230
|
+
borderColor: "transparent",
|
|
231
|
+
...style
|
|
232
|
+
} : {
|
|
233
|
+
...variantStyles?.containerStyle,
|
|
234
|
+
...style
|
|
235
|
+
};
|
|
236
|
+
const gradientUnderlay = variantStyles?.gradientHoverLayers != null || variantStyles?.gradientHoverLayersInline != null || variantStyles?.silverShine === true || variantStyles?.silverBorder === true ? /* @__PURE__ */ jsx(VariantGradientUnderlay, {
|
|
237
|
+
layers: variantStyles?.gradientHoverLayers,
|
|
238
|
+
layersInline: variantStyles?.gradientHoverLayersInline,
|
|
239
|
+
silverShine: variantStyles?.silverShine,
|
|
240
|
+
silverBorder: variantStyles?.silverBorder
|
|
241
|
+
}) : null;
|
|
242
|
+
if (allowCollapse) return /* @__PURE__ */ jsxs(Card, {
|
|
243
|
+
className: cardSurfaceClass,
|
|
244
|
+
style: cardSurfaceStyle,
|
|
245
|
+
children: [gradientUnderlay, /* @__PURE__ */ jsxs(Collapsible, {
|
|
246
|
+
open,
|
|
247
|
+
onOpenChange: (next) => {
|
|
248
|
+
if (!isOpenControlled) setUncontrolledOpen(next);
|
|
249
|
+
onOpenChange?.(next);
|
|
250
|
+
},
|
|
251
|
+
children: [isHeaderRequired ? header : null, hasBody ? /* @__PURE__ */ jsx(CollapsibleContent, { children: body }) : null]
|
|
252
|
+
})]
|
|
253
|
+
});
|
|
254
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
255
|
+
className: cardSurfaceClass,
|
|
256
|
+
style: cardSurfaceStyle,
|
|
257
|
+
children: [
|
|
258
|
+
gradientUnderlay,
|
|
259
|
+
isHeaderRequired ? header : null,
|
|
260
|
+
body
|
|
261
|
+
]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
export { SectionCard };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../../core/card.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/cards/simple-card.tsx
|
|
6
|
+
var SimpleCard = React$1.forwardRef(({ noShadow, noBorder, transparent, title, description, children, className }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
8
|
+
ref,
|
|
9
|
+
className: cn(noShadow && "shadow-none", noBorder && "border-0", transparent && "bg-transparent", className),
|
|
10
|
+
children: [(title || description) && /* @__PURE__ */ jsxs(CardHeader, {
|
|
11
|
+
className: "space-y-1",
|
|
12
|
+
children: [title && /* @__PURE__ */ jsx(CardTitle, {
|
|
13
|
+
className: "text-2xl",
|
|
14
|
+
children: title
|
|
15
|
+
}), description && /* @__PURE__ */ jsx(CardDescription, {
|
|
16
|
+
className: "text-sm tracking-normal",
|
|
17
|
+
children: description
|
|
18
|
+
})]
|
|
19
|
+
}), /* @__PURE__ */ jsx(CardContent, { children })]
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
SimpleCard.displayName = "SimpleCard";
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SimpleCard };
|