@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,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useIsInView } from "../../../hooks/use-is-in-view.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useMotionValue, useSpring } from "motion/react";
|
|
6
|
+
//#region src/core/animate-ui/primitives/texts/counting-number.tsx
|
|
7
|
+
function CountingNumber({ ref, number, fromNumber = 0, padStart = false, inView = false, inViewMargin = "0px", inViewOnce = true, decimalSeparator = ".", transition = {
|
|
8
|
+
stiffness: 90,
|
|
9
|
+
damping: 50
|
|
10
|
+
}, decimalPlaces = 0, delay = 0, initiallyStable = false, ...props }) {
|
|
11
|
+
const { ref: localRef, isInView } = useIsInView(ref, {
|
|
12
|
+
inView,
|
|
13
|
+
inViewOnce,
|
|
14
|
+
inViewMargin
|
|
15
|
+
});
|
|
16
|
+
const numberStr = number.toString();
|
|
17
|
+
const decimals = typeof decimalPlaces === "number" ? decimalPlaces : numberStr.includes(".") ? numberStr.split(".")[1]?.length ?? 0 : 0;
|
|
18
|
+
const motionVal = useMotionValue(initiallyStable ? number : fromNumber);
|
|
19
|
+
const springVal = useSpring(motionVal, transition);
|
|
20
|
+
React$1.useEffect(() => {
|
|
21
|
+
const timeoutId = setTimeout(() => {
|
|
22
|
+
if (isInView) motionVal.set(number);
|
|
23
|
+
}, delay);
|
|
24
|
+
return () => clearTimeout(timeoutId);
|
|
25
|
+
}, [
|
|
26
|
+
isInView,
|
|
27
|
+
number,
|
|
28
|
+
motionVal,
|
|
29
|
+
delay
|
|
30
|
+
]);
|
|
31
|
+
React$1.useEffect(() => {
|
|
32
|
+
const unsubscribe = springVal.on("change", (latest) => {
|
|
33
|
+
if (localRef.current) {
|
|
34
|
+
let formatted = decimals > 0 ? latest.toFixed(decimals) : Math.round(latest).toString();
|
|
35
|
+
if (decimals > 0) formatted = formatted.replace(".", decimalSeparator);
|
|
36
|
+
if (padStart) {
|
|
37
|
+
const finalIntLength = Math.floor(Math.abs(number)).toString().length;
|
|
38
|
+
const [intPart, fracPart] = formatted.split(decimalSeparator);
|
|
39
|
+
const paddedInt = intPart?.padStart(finalIntLength, "0") ?? "";
|
|
40
|
+
formatted = fracPart ? `${paddedInt}${decimalSeparator}${fracPart}` : paddedInt;
|
|
41
|
+
}
|
|
42
|
+
localRef.current.textContent = formatted;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return () => unsubscribe();
|
|
46
|
+
}, [
|
|
47
|
+
springVal,
|
|
48
|
+
decimals,
|
|
49
|
+
padStart,
|
|
50
|
+
number,
|
|
51
|
+
decimalSeparator,
|
|
52
|
+
localRef
|
|
53
|
+
]);
|
|
54
|
+
const finalIntLength = Math.floor(Math.abs(number)).toString().length;
|
|
55
|
+
const formatValue = (val) => {
|
|
56
|
+
let out = decimals > 0 ? val.toFixed(decimals) : Math.round(val).toString();
|
|
57
|
+
if (decimals > 0) out = out.replace(".", decimalSeparator);
|
|
58
|
+
if (padStart) {
|
|
59
|
+
const [intPart, fracPart] = out.split(decimalSeparator);
|
|
60
|
+
const paddedInt = (intPart ?? "").padStart(finalIntLength, "0");
|
|
61
|
+
out = fracPart ? `${paddedInt}${decimalSeparator}${fracPart}` : paddedInt;
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
64
|
+
};
|
|
65
|
+
const zeroText = padStart ? "0".padStart(finalIntLength, "0") + (decimals > 0 ? decimalSeparator + "0".repeat(decimals) : "") : "0" + (decimals > 0 ? decimalSeparator + "0".repeat(decimals) : "");
|
|
66
|
+
const initialText = initiallyStable ? formatValue(number) : zeroText;
|
|
67
|
+
return /* @__PURE__ */ jsx("span", {
|
|
68
|
+
ref: localRef,
|
|
69
|
+
"data-slot": "counting-number",
|
|
70
|
+
...props,
|
|
71
|
+
children: initialText
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { CountingNumber };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5
|
+
//#region src/core/avatar.tsx
|
|
6
|
+
var Avatar = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
7
|
+
ref,
|
|
8
|
+
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
9
|
+
...props
|
|
10
|
+
}));
|
|
11
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
12
|
+
var AvatarImage = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("aspect-square h-full w-full", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
18
|
+
var AvatarFallback = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
19
|
+
ref,
|
|
20
|
+
className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className),
|
|
21
|
+
...props
|
|
22
|
+
}));
|
|
23
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
24
|
+
var AvatarBadge = React$1.forwardRef(({ className, variant = "dot", children, ...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
25
|
+
ref,
|
|
26
|
+
className: cn("pointer-events-none absolute bottom-0 right-0 z-10 box-border rounded-full border-2 border-background shadow-sm", variant === "dot" ? "h-2.5 w-2.5" : "flex h-4 w-4 items-center justify-center bg-background text-foreground [&>svg]:h-2.5 [&>svg]:w-2.5", className),
|
|
27
|
+
...props,
|
|
28
|
+
children
|
|
29
|
+
}));
|
|
30
|
+
AvatarBadge.displayName = "AvatarBadge";
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Avatar, AvatarBadge, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import { resolveVariantStyles } from "../utils/variant.js";
|
|
3
|
+
import { VariantGradientUnderlay } from "../utils/variant-gradient-underlay.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
//#region src/core/badge.tsx
|
|
8
|
+
var badgeVariants = cva("inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2");
|
|
9
|
+
function Badge({ className, variant = "soft", color = "primary", style, children, ...props }) {
|
|
10
|
+
const styles = resolveVariantStyles(variant, color);
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
className: cn(badgeVariants(), styles.container, className),
|
|
13
|
+
style: {
|
|
14
|
+
...styles.containerStyle,
|
|
15
|
+
...style
|
|
16
|
+
},
|
|
17
|
+
...props,
|
|
18
|
+
children: [/* @__PURE__ */ jsx(VariantGradientUnderlay, {
|
|
19
|
+
layers: styles.gradientHoverLayers,
|
|
20
|
+
layersInline: styles.gradientHoverLayersInline,
|
|
21
|
+
silverShine: styles.silverShine,
|
|
22
|
+
silverBorder: styles.silverBorder
|
|
23
|
+
}), children]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
+
//#region src/core/breadcrumb.tsx
|
|
7
|
+
var Breadcrumb = React$1.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", {
|
|
8
|
+
ref,
|
|
9
|
+
"aria-label": "breadcrumb",
|
|
10
|
+
...props
|
|
11
|
+
}));
|
|
12
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
13
|
+
var BreadcrumbList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("ol", {
|
|
14
|
+
ref,
|
|
15
|
+
className: cn("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", className),
|
|
16
|
+
...props
|
|
17
|
+
}));
|
|
18
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
19
|
+
var BreadcrumbItem = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", {
|
|
20
|
+
ref,
|
|
21
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
22
|
+
...props
|
|
23
|
+
}));
|
|
24
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
25
|
+
var BreadcrumbLink = React$1.forwardRef(({ asChild, className, ...props }, ref) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
27
|
+
ref,
|
|
28
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
33
|
+
var BreadcrumbPage = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
34
|
+
ref,
|
|
35
|
+
role: "link",
|
|
36
|
+
"aria-disabled": "true",
|
|
37
|
+
"aria-current": "page",
|
|
38
|
+
className: cn("font-normal text-foreground", className),
|
|
39
|
+
...props
|
|
40
|
+
}));
|
|
41
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
42
|
+
var BreadcrumbSeparator = ({ children, className, ...props }) => /* @__PURE__ */ jsx("li", {
|
|
43
|
+
role: "presentation",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className),
|
|
46
|
+
...props,
|
|
47
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
48
|
+
});
|
|
49
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
50
|
+
var BreadcrumbEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("span", {
|
|
51
|
+
role: "presentation",
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
className: cn("flex h-9 w-9 items-center justify-center", className),
|
|
54
|
+
...props,
|
|
55
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "sr-only",
|
|
57
|
+
children: "More"
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
|
61
|
+
//#endregion
|
|
62
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
//#region src/core/button/button.tsx
|
|
7
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
11
|
+
destructive: "text-destructive [background:color-mix(in_oklab,var(--color-destructive)_15%,transparent)] hover:[background:color-mix(in_oklab,var(--color-destructive)_20%,transparent)]",
|
|
12
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
14
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 px-4 py-2",
|
|
19
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
20
|
+
lg: "h-10 rounded-md px-8",
|
|
21
|
+
icon: "h-9 w-9"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
variant: "default",
|
|
26
|
+
size: "default"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var Button = React$1.forwardRef(({ className, variant, size, asChild = false, type, ...props }, ref) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
31
|
+
className: cn(buttonVariants({
|
|
32
|
+
variant,
|
|
33
|
+
size,
|
|
34
|
+
className
|
|
35
|
+
})),
|
|
36
|
+
ref,
|
|
37
|
+
type: asChild ? type : type ?? "button",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
Button.displayName = "Button";
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/core/button/craft-button.tsx
|
|
7
|
+
/** Resting bg + text per colour (overrides the core Button's default variant via twMerge). */
|
|
8
|
+
var craftButtonBgClasses = {
|
|
9
|
+
primary: "bg-primary text-primary-foreground",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
11
|
+
error: "bg-error text-error-foreground",
|
|
12
|
+
info: "bg-info text-info-foreground",
|
|
13
|
+
success: "bg-success text-success-foreground",
|
|
14
|
+
warning: "bg-warning text-warning-foreground",
|
|
15
|
+
disabled: "bg-disabled text-disabled-foreground",
|
|
16
|
+
gray: "bg-gray text-gray-foreground",
|
|
17
|
+
mist: "bg-mist text-mist-foreground"
|
|
18
|
+
};
|
|
19
|
+
/** Dark-mode hover border per colour. */
|
|
20
|
+
var craftButtonDarkBorderClasses = {
|
|
21
|
+
primary: "dark:hover:border-primary/30",
|
|
22
|
+
secondary: "dark:hover:border-secondary/30",
|
|
23
|
+
error: "dark:hover:border-error/30",
|
|
24
|
+
info: "dark:hover:border-info/30",
|
|
25
|
+
success: "dark:hover:border-success/30",
|
|
26
|
+
warning: "dark:hover:border-warning/30",
|
|
27
|
+
disabled: "dark:hover:border-disabled/30",
|
|
28
|
+
gray: "dark:hover:border-gray/30",
|
|
29
|
+
mist: "dark:hover:border-mist-border/30"
|
|
30
|
+
};
|
|
31
|
+
/** Icon resting text + hover fill per colour. */
|
|
32
|
+
var craftIconColorClasses = {
|
|
33
|
+
primary: "text-primary group-hover:bg-primary group-hover:text-primary-foreground",
|
|
34
|
+
secondary: "text-secondary group-hover:bg-secondary group-hover:text-secondary-foreground",
|
|
35
|
+
error: "text-error group-hover:bg-error group-hover:text-error-foreground",
|
|
36
|
+
info: "text-info group-hover:bg-info group-hover:text-info-foreground",
|
|
37
|
+
success: "text-success group-hover:bg-success group-hover:text-success-foreground",
|
|
38
|
+
warning: "text-warning group-hover:bg-warning group-hover:text-warning-foreground",
|
|
39
|
+
disabled: "text-disabled group-hover:bg-disabled group-hover:text-disabled-foreground",
|
|
40
|
+
gray: "text-gray group-hover:bg-gray group-hover:text-gray-foreground",
|
|
41
|
+
mist: "text-mist-foreground group-hover:bg-mist group-hover:text-mist-foreground"
|
|
42
|
+
};
|
|
43
|
+
var CraftButtonContext = React$1.createContext({});
|
|
44
|
+
function CraftButtonLabel({ children, className }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: cn("group-hover:text-foreground relative z-2 transition-colors duration-500", className),
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function CraftButtonIcon({ children, className }) {
|
|
51
|
+
const { size, color = "primary" } = React$1.useContext(CraftButtonContext);
|
|
52
|
+
const iconSize = size === "lg" ? "size-6" : size === "sm" ? "size-4" : "size-5";
|
|
53
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
54
|
+
className: cn("relative z-1", iconSize, className),
|
|
55
|
+
children: [/* @__PURE__ */ jsx("span", { className: cn("bg-background absolute inset-0 -z-1 rounded-full transition-transform duration-500 group-hover:scale-[15]", iconSize) }), /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: cn("bg-background relative z-2 flex items-center justify-center rounded-full transition-all duration-500", craftIconColorClasses[color], iconSize),
|
|
57
|
+
children
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function CraftButton(props) {
|
|
62
|
+
const { children, size, color = "primary", asChild = false, className, ...rest } = props;
|
|
63
|
+
return /* @__PURE__ */ jsx(CraftButtonContext.Provider, {
|
|
64
|
+
value: {
|
|
65
|
+
size,
|
|
66
|
+
color
|
|
67
|
+
},
|
|
68
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
69
|
+
size,
|
|
70
|
+
asChild,
|
|
71
|
+
className: cn(craftButtonBgClasses[color], "group hover:bg-background relative cursor-pointer overflow-hidden rounded-full duration-500 hover:shadow-md dark:border dark:border-transparent", craftButtonDarkBorderClasses[color], className),
|
|
72
|
+
...rest,
|
|
73
|
+
children
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { CraftButton, CraftButtonIcon, CraftButtonLabel };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import { Separator } from "./separator.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
//#region src/core/button-group.tsx
|
|
7
|
+
var buttonGroupVariants = cva("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
8
|
+
variants: { orientation: {
|
|
9
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
10
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
11
|
+
} },
|
|
12
|
+
defaultVariants: { orientation: "horizontal" }
|
|
13
|
+
});
|
|
14
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
role: "group",
|
|
17
|
+
"data-slot": "button-group",
|
|
18
|
+
"data-orientation": orientation,
|
|
19
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function ButtonGroupText({ className, asChild = false, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
25
|
+
className: cn("bg-muted shadow-xs flex items-center gap-2 rounded-md border px-4 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
31
|
+
"data-slot": "button-group-separator",
|
|
32
|
+
orientation,
|
|
33
|
+
className: cn("bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto", className),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
//#region src/core/button.tsx
|
|
7
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "shadow",
|
|
11
|
+
outline: "border bg-background shadow-sm",
|
|
12
|
+
ghost: "",
|
|
13
|
+
link: "underline-offset-4 hover:underline"
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-9 px-4 py-2",
|
|
17
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
18
|
+
lg: "h-10 rounded-md px-8",
|
|
19
|
+
icon: "h-9 w-9"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
size: "default"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var Button = React$1.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
28
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
29
|
+
className: cn(buttonVariants({
|
|
30
|
+
variant,
|
|
31
|
+
size,
|
|
32
|
+
className
|
|
33
|
+
})),
|
|
34
|
+
ref,
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
Button.displayName = "Button";
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/core/card.tsx
|
|
5
|
+
var Card = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
6
|
+
ref,
|
|
7
|
+
className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
|
|
8
|
+
...props
|
|
9
|
+
}));
|
|
10
|
+
Card.displayName = "Card";
|
|
11
|
+
var CardHeader = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
12
|
+
ref,
|
|
13
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
14
|
+
...props
|
|
15
|
+
}));
|
|
16
|
+
CardHeader.displayName = "CardHeader";
|
|
17
|
+
var CardTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
18
|
+
ref,
|
|
19
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
20
|
+
...props
|
|
21
|
+
}));
|
|
22
|
+
CardTitle.displayName = "CardTitle";
|
|
23
|
+
var CardDescription = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
24
|
+
ref,
|
|
25
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
26
|
+
...props
|
|
27
|
+
}));
|
|
28
|
+
CardDescription.displayName = "CardDescription";
|
|
29
|
+
var CardContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
30
|
+
ref,
|
|
31
|
+
className: cn("p-6 pt-0", className),
|
|
32
|
+
...props
|
|
33
|
+
}));
|
|
34
|
+
CardContent.displayName = "CardContent";
|
|
35
|
+
var CardFooter = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
36
|
+
ref,
|
|
37
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
38
|
+
...props
|
|
39
|
+
}));
|
|
40
|
+
CardFooter.displayName = "CardFooter";
|
|
41
|
+
//#endregion
|
|
42
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../button.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ArrowLeft, ArrowRight } from "lucide-react";
|
|
7
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
8
|
+
//#region src/core/carousel/carousel.tsx
|
|
9
|
+
var CarouselContext = React$1.createContext(null);
|
|
10
|
+
function useCarousel() {
|
|
11
|
+
const context = React$1.useContext(CarouselContext);
|
|
12
|
+
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
var Carousel = React$1.forwardRef(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
|
|
16
|
+
const [carouselRef, api] = useEmblaCarousel({
|
|
17
|
+
...opts,
|
|
18
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
19
|
+
}, plugins);
|
|
20
|
+
const [canScrollPrev, setCanScrollPrev] = React$1.useState(false);
|
|
21
|
+
const [canScrollNext, setCanScrollNext] = React$1.useState(false);
|
|
22
|
+
const onSelect = React$1.useCallback((api) => {
|
|
23
|
+
if (!api) return;
|
|
24
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
25
|
+
setCanScrollNext(api.canScrollNext());
|
|
26
|
+
}, []);
|
|
27
|
+
const scrollPrev = React$1.useCallback(() => {
|
|
28
|
+
api?.scrollPrev();
|
|
29
|
+
}, [api]);
|
|
30
|
+
const scrollNext = React$1.useCallback(() => {
|
|
31
|
+
api?.scrollNext();
|
|
32
|
+
}, [api]);
|
|
33
|
+
const handleKeyDown = React$1.useCallback((event) => {
|
|
34
|
+
const isHorizontal = orientation === "horizontal";
|
|
35
|
+
const prevKey = isHorizontal ? "ArrowLeft" : "ArrowUp";
|
|
36
|
+
const nextKey = isHorizontal ? "ArrowRight" : "ArrowDown";
|
|
37
|
+
if (event.key === prevKey) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
scrollPrev();
|
|
40
|
+
} else if (event.key === nextKey) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
scrollNext();
|
|
43
|
+
}
|
|
44
|
+
}, [
|
|
45
|
+
scrollPrev,
|
|
46
|
+
scrollNext,
|
|
47
|
+
orientation
|
|
48
|
+
]);
|
|
49
|
+
React$1.useEffect(() => {
|
|
50
|
+
if (!api || !setApi) return;
|
|
51
|
+
setApi(api);
|
|
52
|
+
}, [api, setApi]);
|
|
53
|
+
React$1.useEffect(() => {
|
|
54
|
+
if (!api) return;
|
|
55
|
+
onSelect(api);
|
|
56
|
+
api.on("reInit", onSelect);
|
|
57
|
+
api.on("select", onSelect);
|
|
58
|
+
return () => {
|
|
59
|
+
api?.off("select", onSelect);
|
|
60
|
+
api?.off("reInit", onSelect);
|
|
61
|
+
};
|
|
62
|
+
}, [api, onSelect]);
|
|
63
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, {
|
|
64
|
+
value: {
|
|
65
|
+
carouselRef,
|
|
66
|
+
api,
|
|
67
|
+
opts,
|
|
68
|
+
orientation,
|
|
69
|
+
scrollPrev,
|
|
70
|
+
scrollNext,
|
|
71
|
+
canScrollPrev,
|
|
72
|
+
canScrollNext
|
|
73
|
+
},
|
|
74
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
75
|
+
ref,
|
|
76
|
+
onKeyDownCapture: handleKeyDown,
|
|
77
|
+
className: cn("relative", className),
|
|
78
|
+
role: "region",
|
|
79
|
+
"aria-roledescription": "carousel",
|
|
80
|
+
...props,
|
|
81
|
+
children
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
Carousel.displayName = "Carousel";
|
|
86
|
+
var CarouselContent = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
87
|
+
const { carouselRef, orientation } = useCarousel();
|
|
88
|
+
return /* @__PURE__ */ jsx("div", {
|
|
89
|
+
ref: carouselRef,
|
|
90
|
+
className: cn("overflow-hidden", orientation === "vertical" && "h-full"),
|
|
91
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
92
|
+
ref,
|
|
93
|
+
className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col h-full", className),
|
|
94
|
+
...props
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
CarouselContent.displayName = "CarouselContent";
|
|
99
|
+
var CarouselItem = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
100
|
+
const { orientation } = useCarousel();
|
|
101
|
+
return /* @__PURE__ */ jsx("div", {
|
|
102
|
+
ref,
|
|
103
|
+
role: "group",
|
|
104
|
+
"aria-roledescription": "slide",
|
|
105
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className),
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
CarouselItem.displayName = "CarouselItem";
|
|
110
|
+
var CarouselPrevious = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
111
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
112
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
113
|
+
ref,
|
|
114
|
+
type: "button",
|
|
115
|
+
className: cn(buttonVariants({
|
|
116
|
+
variant: "outline",
|
|
117
|
+
size: "icon"
|
|
118
|
+
}), "absolute h-8 w-8 rounded-full", orientation === "horizontal" ? "left-2 top-1/2 -translate-y-1/2" : "top-2 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
119
|
+
disabled: !canScrollPrev,
|
|
120
|
+
onClick: scrollPrev,
|
|
121
|
+
...props,
|
|
122
|
+
children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
123
|
+
className: "sr-only",
|
|
124
|
+
children: "Previous slide"
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
129
|
+
var CarouselNext = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
130
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
131
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
132
|
+
ref,
|
|
133
|
+
type: "button",
|
|
134
|
+
className: cn(buttonVariants({
|
|
135
|
+
variant: "outline",
|
|
136
|
+
size: "icon"
|
|
137
|
+
}), "absolute h-8 w-8 rounded-full", orientation === "horizontal" ? "right-2 top-1/2 -translate-y-1/2" : "bottom-2 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
138
|
+
disabled: !canScrollNext,
|
|
139
|
+
onClick: scrollNext,
|
|
140
|
+
...props,
|
|
141
|
+
children: [/* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
142
|
+
className: "sr-only",
|
|
143
|
+
children: "Next slide"
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
CarouselNext.displayName = "CarouselNext";
|
|
148
|
+
//#endregion
|
|
149
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|