@espressif/dashboard-ui-components 1.10.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/dist/_vendor/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/_vendor/@radix-ui/react-checkbox/dist/index.js +185 -0
- package/dist/_vendor/@radix-ui/react-compose-refs/dist/index.js +28 -0
- package/dist/_vendor/@radix-ui/react-context/dist/index.js +68 -0
- package/dist/_vendor/@radix-ui/react-presence/dist/index.js +127 -0
- package/dist/_vendor/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/_vendor/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/_vendor/@radix-ui/react-use-layout-effect/dist/index.js +5 -0
- package/dist/_vendor/@radix-ui/react-use-previous/dist/index.js +17 -0
- package/dist/_vendor/@radix-ui/react-use-size/dist/index.js +39 -0
- package/dist/_vendor/lottie-react/build/index.es.js +537 -0
- package/dist/_vendor/lottie-web/build/player/lottie.js +14149 -0
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/assets/illustrations/bulb-cloud-drawing.js +4 -0
- package/dist/assets/illustrations/rm-dashboard-update.js +4 -0
- package/dist/assets/illustrations/rm-data-download.js +4 -0
- package/dist/assets/logos/espressif/espressif-no-text.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text-dm.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text.js +4 -0
- package/dist/assets/logos/insights/insights-no-text.js +4 -0
- package/dist/assets/logos/insights/insights-with-text-dm.js +4 -0
- package/dist/assets/logos/insights/insights-with-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-no-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text-dm.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-no-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-no-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text-dm.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-no-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-no-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text.js +4 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.constants.js +18 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.js +24 -0
- package/dist/common/animated-rainmaker-logo/rainmaker-c-logo.js +50 -0
- package/dist/common/animated-rainmaker-logo/use-animated-rainmaker-logo-animation.js +85 -0
- package/dist/common/app-logo/app-logo.js +59 -0
- package/dist/common/app-logo/logo-config.js +297 -0
- package/dist/common/copyright-card/copyright-card.js +39 -0
- package/dist/common/footer-card/footer-card.js +22 -0
- package/dist/common/index.js +8 -8
- package/dist/common/my-account-menu/my-account-menu.js +32 -0
- package/dist/common/page-loader/page-loader.js +21 -0
- package/dist/common/profile-card/profile-card.js +26 -0
- package/dist/components/accordion/accordion.js +52 -0
- package/dist/components/advanced-search-box/advanced-search-box.js +106 -0
- package/dist/components/alert/alert.js +85 -0
- package/dist/components/animated-containers/pop-collection-item.js +28 -0
- package/dist/components/async-multi-select/async-multi-select.js +199 -0
- package/dist/components/avatar/avatar.js +41 -0
- package/dist/components/button/button.js +191 -0
- package/dist/components/button/flash-button.js +110 -0
- package/dist/components/button/invert-button.js +13 -0
- package/dist/components/calendar/calendar.js +105 -0
- package/dist/components/cards/animated-card/animated-card-animations.js +57 -0
- package/dist/components/cards/animated-card/animated-card.js +42 -0
- package/dist/components/cards/basic-details-card.js +46 -0
- package/dist/components/cards/collapsible-card.js +48 -0
- package/dist/components/cards/no-data-card/no-data-card.js +30 -0
- package/dist/components/cards/section-card.js +265 -0
- package/dist/components/cards/simple-card.js +24 -0
- package/dist/components/carousel/carousel.js +158 -0
- package/dist/components/chart/area-chart.js +135 -0
- package/dist/components/chart/bar-chart.js +151 -0
- package/dist/components/chart/chart-colors.js +85 -0
- package/dist/components/chart/chart-series-data.js +53 -0
- package/dist/components/chart/chart.js +147 -0
- package/dist/components/chart/chart.types.js +7 -0
- package/dist/components/chart/composed-chart.js +182 -0
- package/dist/components/chart/donut-chart.js +177 -0
- package/dist/components/chart/line-chart.js +137 -0
- package/dist/components/chart/treemap-chart.js +294 -0
- package/dist/components/circular-progress/circular-progress.js +125 -0
- package/dist/components/code-editor/code-editor.js +235 -0
- package/dist/components/code-editor/code-editor.utils.js +122 -0
- package/dist/components/code-editor/use-code-editor-keys.js +79 -0
- package/dist/components/code-editor/use-highlighted-html.js +102 -0
- package/dist/components/confirmation-dialog/confirmation-dialog.js +72 -0
- package/dist/components/content-container/content-container.js +20 -0
- package/dist/components/copiable-text/copiable-text.js +46 -0
- package/dist/components/data-table/data-table.js +186 -0
- package/dist/components/data-table/responsive-columns.js +65 -0
- package/dist/components/data-table/row-actions.js +27 -0
- package/dist/components/data-table/sticky-columns.js +71 -0
- package/dist/components/data-table/table-body.js +57 -0
- package/dist/components/data-table/table-header.js +21 -0
- package/dist/components/date-picker/date-picker.js +95 -0
- package/dist/components/date-range-picker/date-range-picker.js +301 -0
- package/dist/components/date-range-picker/presets.js +174 -0
- package/dist/components/date-time-picker/date-time-picker.js +144 -0
- package/dist/components/date-time-picker/date-time-picker.utils.js +32 -0
- package/dist/components/device-icon/device-icon.config.js +194 -0
- package/dist/components/device-icon/device-icon.js +17 -0
- package/dist/components/device-icon/icons/air-conditioner.js +22 -0
- package/dist/components/device-icon/icons/blind.js +24 -0
- package/dist/components/device-icon/icons/dimmer.js +14 -0
- package/dist/components/device-icon/icons/extension-board.js +42 -0
- package/dist/components/device-icon/icons/fan.js +14 -0
- package/dist/components/device-icon/icons/knob.js +14 -0
- package/dist/components/device-icon/icons/led-strip.js +22 -0
- package/dist/components/device-icon/icons/light.js +14 -0
- package/dist/components/device-icon/icons/refrigerator.js +18 -0
- package/dist/components/device-icon/icons/retro-switch.js +18 -0
- package/dist/components/device-icon/icons/router.js +20 -0
- package/dist/components/device-icon/icons/sensor.js +20 -0
- package/dist/components/device-icon/icons/socket.js +19 -0
- package/dist/components/device-icon/icons/switch.js +19 -0
- package/dist/components/device-icon/icons/thermostat.js +21 -0
- package/dist/components/device-icon/icons/washing-machine.js +22 -0
- package/dist/components/device-icon/match-device.js +61 -0
- package/dist/components/dynamic-list/dynamic-list.js +445 -0
- package/dist/components/error-display/full-size-error/full-size-error.js +20 -0
- package/dist/components/error-display/inline-error/inline-error.js +12 -0
- package/dist/components/file-input/file-input.js +318 -0
- package/dist/components/file-upload/file-upload.js +317 -0
- package/dist/components/filters-bar/filters-bar.js +36 -0
- package/dist/components/fullscreen-dialog/fullscreen-dialog.js +68 -0
- package/dist/components/icon-avatar/icon-avatar.js +130 -0
- package/dist/components/icon-text-action-card/icon-text-action-card.js +190 -0
- package/dist/components/illustration/illustration-registry.js +37 -0
- package/dist/components/illustration/illustration-variants.js +21 -0
- package/dist/components/illustration/illustration.js +68 -0
- package/dist/components/index.d.ts +0 -20
- package/dist/components/index.js +134 -6
- package/dist/components/key-value-manager/key-value-manager-add-popover.js +126 -0
- package/dist/components/key-value-manager/key-value-manager-field.js +47 -0
- package/dist/components/key-value-manager/key-value-manager-table.js +188 -0
- package/dist/components/key-value-manager/key-value-manager.js +111 -0
- package/dist/components/key-value-manager/key-value-manager.props.js +28 -0
- package/dist/components/key-value-manager/key-value-manager.utils.js +21 -0
- package/dist/components/link/link.js +67 -0
- package/dist/components/list/dropdown-list-item.js +60 -0
- package/dist/components/list/list-item.utils.js +76 -0
- package/dist/components/list/list.js +49 -0
- package/dist/components/list/list.props.js +27 -0
- package/dist/components/list/standard-list-item.js +66 -0
- package/dist/components/list-details/list-details-item-button.js +46 -0
- package/dist/components/list-details/list-details-item-dropdown.js +112 -0
- package/dist/components/list-details/list-details-item-strip.js +125 -0
- package/dist/components/list-details/list-details.js +148 -0
- package/dist/components/lottie-animation-container/lottie-animation-container.js +31 -0
- package/dist/components/lottie-animations/animation-data/access-denied.js +3980 -0
- package/dist/components/lottie-animations/animation-data/active.js +825 -0
- package/dist/components/lottie-animations/animation-data/bar-chart.js +610 -0
- package/dist/components/lottie-animations/animation-data/chart-loading.js +5368 -0
- package/dist/components/lottie-animations/animation-data/cloud-download.js +1660 -0
- package/dist/components/lottie-animations/animation-data/cloud-sync.js +932 -0
- package/dist/components/lottie-animations/animation-data/coud-upload.js +7060 -0
- package/dist/components/lottie-animations/animation-data/cross-throb.js +1506 -0
- package/dist/components/lottie-animations/animation-data/dashboard-loading.js +14330 -0
- package/dist/components/lottie-animations/animation-data/error-spread-out.js +5567 -0
- package/dist/components/lottie-animations/animation-data/error.js +1211 -0
- package/dist/components/lottie-animations/animation-data/green-success.js +14826 -0
- package/dist/components/lottie-animations/animation-data/inactive.js +723 -0
- package/dist/components/lottie-animations/animation-data/light.js +2678 -0
- package/dist/components/lottie-animations/animation-data/lock.js +900 -0
- package/dist/components/lottie-animations/animation-data/lock2.js +1686 -0
- package/dist/components/lottie-animations/animation-data/locked.js +641 -0
- package/dist/components/lottie-animations/animation-data/search-error.js +954 -0
- package/dist/components/lottie-animations/animation-data/security.js +4121 -0
- package/dist/components/lottie-animations/animation-data/success.js +404 -0
- package/dist/components/lottie-animations/animation-data/verification-in-progress.js +10138 -0
- package/dist/components/lottie-animations/animation-data/warning.js +843 -0
- package/dist/components/lottie-animations/verification-in-progress/verification-in-progress.js +19 -0
- package/dist/components/markdown-content/markdown-content.components.js +114 -0
- package/dist/components/markdown-content/markdown-content.js +39 -0
- package/dist/components/menu/menu.js +19 -0
- package/dist/components/monospace-content/monospace-content.js +80 -0
- package/dist/components/nav-bar/nav-bar-details-panel.js +51 -0
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +105 -0
- package/dist/components/nav-bar/nav-bar.js +449 -0
- package/dist/components/nav-bar/use-nav-bar-overflow.js +74 -0
- package/dist/components/nav-bar/use-nav-bar-scroll.js +42 -0
- package/dist/components/overflow-badge-list/overflow-badge-list.js +58 -0
- package/dist/components/page-container/page-container-skeleton.js +72 -0
- package/dist/components/page-container/page-container.js +93 -0
- package/dist/components/pagination/pagination.js +96 -0
- package/dist/components/pagination/pagination.props.js +16 -0
- package/dist/components/progress-bar/progress-bar.js +106 -0
- package/dist/components/radio-group/radio-group.js +41 -0
- package/dist/components/requirement-list/requirement-list.js +83 -0
- package/dist/components/scrollable-sections/scrollable-sections.js +270 -0
- package/dist/components/search-box/search-box.js +54 -0
- package/dist/components/search-field-shell.js +24 -0
- package/dist/components/selectable-card-list/checkbox-card-list.js +85 -0
- package/dist/components/selectable-card-list/radio-card-list.js +99 -0
- package/dist/components/selectable-card-list/selectable-card-list-shared.js +135 -0
- package/dist/components/selectable-card-list/selectable-card-list.js +34 -0
- package/dist/components/sidebar/sidebar.js +344 -0
- package/dist/components/sidebar/types.js +6 -0
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +309 -0
- package/dist/components/simple-clickable-card/simple-clickable-card.js +106 -0
- package/dist/components/simple-info-card/simple-info-card.js +154 -0
- package/dist/components/simple-list/simple-list.js +146 -0
- package/dist/components/simple-paginated-list/simple-paginated-list.js +178 -0
- package/dist/components/simplified-date/simplified-date.js +56 -0
- package/dist/components/skeletons/table-skeleton.js +16 -0
- package/dist/components/spinner/spinner.js +25 -0
- package/dist/components/stat-card/stat-card.js +206 -0
- package/dist/components/status-badge/status-badge.js +108 -0
- package/dist/components/status-card-list/status-card-list.js +282 -0
- package/dist/components/tag/tag.js +144 -0
- package/dist/components/tag-input/tag-input.js +161 -0
- package/dist/components/text-effects/glitch-effect/glitch-text.js +115 -0
- package/dist/components/text-effects/gradient-text/gradient-text.js +32 -0
- package/dist/components/text-effects/highlight-text/highlight-text.js +35 -0
- package/dist/components/text-effects/parse-text-markup.js +53 -0
- package/dist/components/text-effects/shimmer-text/shimmer-text.js +67 -0
- package/dist/components/time-picker/time-picker.js +23 -0
- package/dist/components/toast/toast.js +126 -0
- package/dist/components/togglable-items-list/togglable-items-list.js +28 -0
- package/dist/components/tooltip/tooltip.js +21 -0
- package/dist/components/transfer-list/transfer-list.js +413 -0
- package/dist/components/truncated-line-with-tooltip/truncated-line-with-tooltip.js +61 -0
- package/dist/components/typography/typography-variants.js +41 -0
- package/dist/components/typography/typography.js +15 -0
- package/dist/components/user-type-badge/user-type-badge.js +40 -0
- package/dist/components/user-type-badge/user-type-badge.registry.js +17 -0
- package/dist/components/vertical-stepper/vertical-stepper.js +171 -0
- package/dist/core/alert.js +33 -0
- package/dist/core/animate-ui/components/animate/code-header.js +30 -0
- package/dist/core/animate-ui/components/animate/code.js +35 -0
- package/dist/core/animate-ui/components/animate/tabs.js +188 -0
- package/dist/core/animate-ui/components/animate/tooltip.js +39 -0
- package/dist/core/animate-ui/components/base/preview-card.js +29 -0
- package/dist/core/animate-ui/components/base/progress.js +32 -0
- package/dist/core/animate-ui/components/base/radio.js +24 -0
- package/dist/core/animate-ui/components/buttons/copy.js +95 -0
- package/dist/core/animate-ui/components/radix/accordion.js +36 -0
- package/dist/core/animate-ui/components/radix/dialog.js +60 -0
- package/dist/core/animate-ui/components/radix/dropdown-menu.js +129 -0
- package/dist/core/animate-ui/components/radix/sheet.js +110 -0
- package/dist/core/animate-ui/components/radix/sidebar.js +416 -0
- package/dist/core/animate-ui/components/radix/switch.js +34 -0
- package/dist/core/animate-ui/components/radix/toggle-group.js +115 -0
- package/dist/core/animate-ui/components/radix/toggle.js +24 -0
- package/dist/core/animate-ui/primitives/animate/code-block.js +131 -0
- package/dist/core/animate-ui/primitives/animate/escape-html.js +7 -0
- package/dist/core/animate-ui/primitives/animate/shiki-highlighter.js +64 -0
- package/dist/core/animate-ui/primitives/animate/slot.js +39 -0
- package/dist/core/animate-ui/primitives/animate/tabs.js +202 -0
- package/dist/core/animate-ui/primitives/animate/tooltip.js +351 -0
- package/dist/core/animate-ui/primitives/base/preview-card.js +107 -0
- package/dist/core/animate-ui/primitives/base/progress.js +60 -0
- package/dist/core/animate-ui/primitives/base/radio.js +83 -0
- package/dist/core/animate-ui/primitives/buttons/button.js +16 -0
- package/dist/core/animate-ui/primitives/effects/highlight.js +407 -0
- package/dist/core/animate-ui/primitives/radix/accordion.js +76 -0
- package/dist/core/animate-ui/primitives/radix/dialog.js +136 -0
- package/dist/core/animate-ui/primitives/radix/dropdown-menu.js +305 -0
- package/dist/core/animate-ui/primitives/radix/sheet.js +165 -0
- package/dist/core/animate-ui/primitives/radix/switch.js +86 -0
- package/dist/core/animate-ui/primitives/radix/toggle-group.js +100 -0
- package/dist/core/animate-ui/primitives/texts/counting-number.js +75 -0
- package/dist/core/avatar.js +32 -0
- package/dist/core/badge.js +27 -0
- package/dist/core/breadcrumb.js +62 -0
- package/dist/core/button/button.js +43 -0
- package/dist/core/button/craft-button.js +78 -0
- package/dist/core/button-group.js +38 -0
- package/dist/core/button.js +40 -0
- package/dist/core/card.js +42 -0
- package/dist/core/carousel/carousel.js +149 -0
- package/dist/core/checkbox/motion-checkbox.js +103 -0
- package/dist/core/collapsible.js +54 -0
- package/dist/core/combobox/combobox.js +85 -0
- package/dist/core/command.js +61 -0
- package/dist/core/field-end-icons.js +36 -0
- package/dist/core/field-label-row.js +33 -0
- package/dist/core/form.js +92 -0
- package/dist/core/hooks/use-controlled-state.js +27 -0
- package/dist/core/hooks/use-data-state.js +39 -0
- package/dist/core/hooks/use-is-in-view.js +18 -0
- package/dist/core/hooks/use-mobile.js +19 -0
- package/dist/core/hooks/use-reveal-on-scroll-up.js +141 -0
- package/dist/core/hooks/use-scroll-overflow.js +50 -0
- package/dist/core/index.js +18 -52
- package/dist/core/input/input-password.js +30 -0
- package/dist/core/input/input.js +147 -0
- package/dist/core/input-otp/input-otp.js +183 -0
- package/dist/core/label.js +15 -0
- package/dist/core/popover.js +31 -0
- package/dist/core/scroll-area.js +42 -0
- package/dist/core/select.js +121 -0
- package/dist/core/separator.js +40 -0
- package/dist/core/skeleton.js +11 -0
- package/dist/core/table.js +59 -0
- package/dist/core/textarea/textarea.js +97 -0
- package/dist/core/utils/get-strict-context.js +18 -0
- package/dist/index.js +148 -9
- package/dist/layouts/entry-layout/entry-layout-bg.js +4 -0
- package/dist/layouts/entry-layout/entry-layout.js +52 -0
- package/dist/layouts/index.js +7 -6
- package/dist/layouts/workspace-layout/account-menu/account-menu.js +108 -0
- package/dist/layouts/workspace-layout/breadcrumbs/derive-breadcrumbs.js +37 -0
- package/dist/layouts/workspace-layout/breadcrumbs/workspace-breadcrumbs.js +22 -0
- package/dist/layouts/workspace-layout/footer/footer.js +15 -0
- package/dist/layouts/workspace-layout/header/header.js +54 -0
- package/dist/layouts/workspace-layout/workspace-layout.js +157 -0
- package/dist/tailwind-preset.js +3 -4
- package/dist/utils/cn.js +8 -0
- package/dist/utils/color.js +72 -0
- package/dist/utils/index.js +3 -2
- package/dist/utils/path-match.js +17 -0
- package/dist/utils/silver-shine.js +63 -0
- package/dist/utils/variant-gradient-underlay.js +45 -0
- package/dist/utils/variant.js +426 -0
- package/package.json +7 -4
- package/dist/chunk-2GDYZAKR.js +0 -505
- package/dist/chunk-ALCWXFUC.js +0 -733
- package/dist/chunk-CDHBLANU.js +0 -59
- package/dist/chunk-LUESSJAF.js +0 -70068
- package/dist/chunk-TMORRNEB.js +0 -323
- package/dist/chunk-TRTQSARU.js +0 -31
- package/dist/chunk-VU4CZ76T.js +0 -43
- package/dist/chunk-XNLCVHBC.js +0 -364
- package/dist/chunk-Z4776NRY.js +0 -4347
- package/src/assets/illustrations/add-to-group.svg +0 -32
- package/src/assets/illustrations/chip.svg +0 -51
- package/src/assets/illustrations/create-new-group.svg +0 -27
- package/src/assets/illustrations/new-ota.svg +0 -61
- package/src/assets/illustrations/secured-key.svg +0 -48
- /package/dist/assets/{entry-layout-bg-JPI7GJ42.webp → entry-layout-bg-DUM0UhT3.webp} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { endOfDay, endOfMonth, endOfWeek, endOfYear, startOfDay, startOfMonth, startOfWeek, startOfYear, sub } from "date-fns";
|
|
2
|
+
//#region src/components/date-range-picker/presets.ts
|
|
3
|
+
var PRESET_IDS = [
|
|
4
|
+
"today",
|
|
5
|
+
"yesterday",
|
|
6
|
+
"this-week",
|
|
7
|
+
"last-week",
|
|
8
|
+
"this-month",
|
|
9
|
+
"last-month",
|
|
10
|
+
"this-year",
|
|
11
|
+
"last-year",
|
|
12
|
+
"last-1-hour",
|
|
13
|
+
"last-24-hours",
|
|
14
|
+
"last-1-day",
|
|
15
|
+
"past-7-days",
|
|
16
|
+
"last-7-days",
|
|
17
|
+
"last-14-days",
|
|
18
|
+
"last-15-days",
|
|
19
|
+
"past-30-days",
|
|
20
|
+
"last-30-days",
|
|
21
|
+
"last-4-weeks",
|
|
22
|
+
"last-90-days",
|
|
23
|
+
"last-3-months",
|
|
24
|
+
"last-6-months",
|
|
25
|
+
"last-1-year",
|
|
26
|
+
"last-5-years"
|
|
27
|
+
];
|
|
28
|
+
var PRESET_LABELS = {
|
|
29
|
+
"today": "Today",
|
|
30
|
+
"yesterday": "Yesterday",
|
|
31
|
+
"this-week": "This week",
|
|
32
|
+
"last-week": "Last week",
|
|
33
|
+
"this-month": "This month",
|
|
34
|
+
"last-month": "Last month",
|
|
35
|
+
"this-year": "This year",
|
|
36
|
+
"last-year": "Last year",
|
|
37
|
+
"last-1-hour": "Last 1 hour",
|
|
38
|
+
"last-24-hours": "Last 24 hours",
|
|
39
|
+
"last-1-day": "Last 1 day",
|
|
40
|
+
"past-7-days": "Past 7 days",
|
|
41
|
+
"last-7-days": "Last 7 days",
|
|
42
|
+
"last-14-days": "Last 14 days",
|
|
43
|
+
"last-15-days": "Last 15 days",
|
|
44
|
+
"past-30-days": "Past 30 days",
|
|
45
|
+
"last-30-days": "Last 30 days",
|
|
46
|
+
"last-4-weeks": "Last 4 weeks",
|
|
47
|
+
"last-90-days": "Last 90 days",
|
|
48
|
+
"last-3-months": "Last 3 months",
|
|
49
|
+
"last-6-months": "Last 6 months",
|
|
50
|
+
"last-1-year": "Last 1 year",
|
|
51
|
+
"last-5-years": "Last 5 years"
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Presets that end at the current moment instead of snapping to day
|
|
55
|
+
* boundaries. `past-7-days` and `past-30-days` include today, unlike
|
|
56
|
+
* `last-7-days` and `last-30-days`, which end yesterday at 23:59.
|
|
57
|
+
*/
|
|
58
|
+
var ROLLING_PRESET_IDS = [
|
|
59
|
+
"last-1-hour",
|
|
60
|
+
"last-24-hours",
|
|
61
|
+
"past-7-days",
|
|
62
|
+
"past-30-days"
|
|
63
|
+
];
|
|
64
|
+
function computeDateRange(id) {
|
|
65
|
+
const now = /* @__PURE__ */ new Date();
|
|
66
|
+
switch (id) {
|
|
67
|
+
case "today": return {
|
|
68
|
+
startDate: startOfDay(now),
|
|
69
|
+
endDate: endOfDay(now)
|
|
70
|
+
};
|
|
71
|
+
case "yesterday": {
|
|
72
|
+
const yesterday = sub(now, { days: 1 });
|
|
73
|
+
return {
|
|
74
|
+
startDate: startOfDay(yesterday),
|
|
75
|
+
endDate: endOfDay(yesterday)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
case "this-week": return {
|
|
79
|
+
startDate: startOfWeek(now),
|
|
80
|
+
endDate: endOfDay(now)
|
|
81
|
+
};
|
|
82
|
+
case "last-week": {
|
|
83
|
+
const prev = sub(now, { weeks: 1 });
|
|
84
|
+
return {
|
|
85
|
+
startDate: startOfWeek(prev),
|
|
86
|
+
endDate: endOfWeek(prev)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
case "this-month": return {
|
|
90
|
+
startDate: startOfMonth(now),
|
|
91
|
+
endDate: endOfDay(now)
|
|
92
|
+
};
|
|
93
|
+
case "last-month": {
|
|
94
|
+
const prev = sub(now, { months: 1 });
|
|
95
|
+
return {
|
|
96
|
+
startDate: startOfMonth(prev),
|
|
97
|
+
endDate: endOfMonth(prev)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
case "this-year": return {
|
|
101
|
+
startDate: startOfYear(now),
|
|
102
|
+
endDate: endOfDay(now)
|
|
103
|
+
};
|
|
104
|
+
case "last-year": {
|
|
105
|
+
const prev = sub(now, { years: 1 });
|
|
106
|
+
return {
|
|
107
|
+
startDate: startOfYear(prev),
|
|
108
|
+
endDate: endOfYear(prev)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
case "last-1-day": return {
|
|
112
|
+
startDate: startOfDay(sub(now, { days: 1 })),
|
|
113
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
114
|
+
};
|
|
115
|
+
case "last-7-days": return {
|
|
116
|
+
startDate: startOfDay(sub(now, { days: 7 })),
|
|
117
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
118
|
+
};
|
|
119
|
+
case "last-14-days": return {
|
|
120
|
+
startDate: startOfDay(sub(now, { days: 14 })),
|
|
121
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
122
|
+
};
|
|
123
|
+
case "last-15-days": return {
|
|
124
|
+
startDate: startOfDay(sub(now, { days: 15 })),
|
|
125
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
126
|
+
};
|
|
127
|
+
case "last-30-days": return {
|
|
128
|
+
startDate: startOfDay(sub(now, { days: 30 })),
|
|
129
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
130
|
+
};
|
|
131
|
+
case "last-4-weeks": return {
|
|
132
|
+
startDate: startOfDay(sub(now, { days: 28 })),
|
|
133
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
134
|
+
};
|
|
135
|
+
case "last-90-days": return {
|
|
136
|
+
startDate: startOfDay(sub(now, { days: 90 })),
|
|
137
|
+
endDate: endOfDay(sub(now, { days: 1 }))
|
|
138
|
+
};
|
|
139
|
+
case "last-3-months": return {
|
|
140
|
+
startDate: startOfMonth(sub(now, { months: 3 })),
|
|
141
|
+
endDate: endOfMonth(sub(now, { months: 1 }))
|
|
142
|
+
};
|
|
143
|
+
case "last-6-months": return {
|
|
144
|
+
startDate: startOfMonth(sub(now, { months: 6 })),
|
|
145
|
+
endDate: endOfMonth(sub(now, { months: 1 }))
|
|
146
|
+
};
|
|
147
|
+
case "last-1-year": return {
|
|
148
|
+
startDate: startOfMonth(sub(now, { years: 1 })),
|
|
149
|
+
endDate: endOfMonth(now)
|
|
150
|
+
};
|
|
151
|
+
case "last-5-years": return {
|
|
152
|
+
startDate: startOfMonth(sub(now, { years: 5 })),
|
|
153
|
+
endDate: endOfMonth(now)
|
|
154
|
+
};
|
|
155
|
+
case "last-1-hour": return {
|
|
156
|
+
startDate: sub(now, { hours: 1 }),
|
|
157
|
+
endDate: now
|
|
158
|
+
};
|
|
159
|
+
case "last-24-hours": return {
|
|
160
|
+
startDate: sub(now, { hours: 24 }),
|
|
161
|
+
endDate: now
|
|
162
|
+
};
|
|
163
|
+
case "past-7-days": return {
|
|
164
|
+
startDate: sub(now, { days: 7 }),
|
|
165
|
+
endDate: now
|
|
166
|
+
};
|
|
167
|
+
case "past-30-days": return {
|
|
168
|
+
startDate: sub(now, { days: 30 }),
|
|
169
|
+
endDate: now
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
export { PRESET_IDS, PRESET_LABELS, ROLLING_PRESET_IDS, computeDateRange };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../core/popover.js";
|
|
4
|
+
import { Input } from "../../core/input/input.js";
|
|
5
|
+
import { Calendar } from "../calendar/calendar.js";
|
|
6
|
+
import { FIELD_ICON_SIZE, FieldEndIcons, fieldEndPaddingClassName } from "../../core/field-end-icons.js";
|
|
7
|
+
import { TimePicker } from "../time-picker/time-picker.js";
|
|
8
|
+
import { DEFAULT_TIME, DEFAULT_TIME_STEP_SECONDS, formatTimeOfDay, isValidTimeString, mergeDateAndTime } from "./date-time-picker.utils.js";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { CalendarIcon } from "lucide-react";
|
|
12
|
+
import { format } from "date-fns";
|
|
13
|
+
//#region src/components/date-time-picker/date-time-picker.tsx
|
|
14
|
+
var OPEN_KEYS = /* @__PURE__ */ new Set([
|
|
15
|
+
"Enter",
|
|
16
|
+
" ",
|
|
17
|
+
"ArrowDown"
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* One read-only input that opens a dropdown holding a `Calendar` and a
|
|
21
|
+
* `TimePicker`. Both edit a single `Date`.
|
|
22
|
+
*
|
|
23
|
+
* The time input is driven by a local draft string so a time typed before a
|
|
24
|
+
* day is picked is kept, and so an incomplete time (the browser reports `""`
|
|
25
|
+
* mid-edit) never snaps the committed value. Picking a day keeps the dropdown
|
|
26
|
+
* open so the time can be set in the same interaction.
|
|
27
|
+
*/
|
|
28
|
+
function DateTimePicker(props) {
|
|
29
|
+
const { value, onChange, defaultValue, defaultTime = DEFAULT_TIME, timeStep = DEFAULT_TIME_STEP_SECONDS, clearable = false, clearLabel = "Clear", timeAriaLabel = "Time", formatDate, placeholder = "Pick date and time", label, size, hideIcon = false, disabled = false, required = false, rounded = false, error, errorContent, hintContent, calendarProps, open: controlledOpen, onOpenChange, name, className } = props;
|
|
30
|
+
const isControlled = "value" in props;
|
|
31
|
+
const [uncontrolledValue, setUncontrolledValue] = React$1.useState(defaultValue);
|
|
32
|
+
const current = isControlled ? value : uncontrolledValue;
|
|
33
|
+
const isOpenControlled = controlledOpen !== void 0;
|
|
34
|
+
const [internalOpen, setInternalOpen] = React$1.useState(false);
|
|
35
|
+
const isOpen = isOpenControlled ? controlledOpen : internalOpen;
|
|
36
|
+
const setOpen = (nextOpen) => {
|
|
37
|
+
if (!isOpenControlled) setInternalOpen(nextOpen);
|
|
38
|
+
onOpenChange?.(nextOpen);
|
|
39
|
+
};
|
|
40
|
+
const [draftTime, setDraftTime] = React$1.useState(() => current ? formatTimeOfDay(current, timeStep) : "");
|
|
41
|
+
const currentMs = current?.getTime();
|
|
42
|
+
React$1.useEffect(() => {
|
|
43
|
+
if (currentMs === void 0) return;
|
|
44
|
+
setDraftTime(formatTimeOfDay(new Date(currentMs), timeStep));
|
|
45
|
+
}, [currentMs, timeStep]);
|
|
46
|
+
const commit = (next) => {
|
|
47
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
48
|
+
onChange?.(next);
|
|
49
|
+
};
|
|
50
|
+
const handleDaySelect = (day) => {
|
|
51
|
+
if (!day) {
|
|
52
|
+
commit(void 0);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
commit(mergeDateAndTime(day, isValidTimeString(draftTime) ? draftTime : defaultTime));
|
|
56
|
+
};
|
|
57
|
+
const handleTimeChange = (event) => {
|
|
58
|
+
const nextTime = event.target.value;
|
|
59
|
+
setDraftTime(nextTime);
|
|
60
|
+
if (current && isValidTimeString(nextTime)) commit(mergeDateAndTime(current, nextTime));
|
|
61
|
+
};
|
|
62
|
+
const handleTimeBlur = () => {
|
|
63
|
+
if (current && !isValidTimeString(draftTime)) setDraftTime(formatTimeOfDay(current, timeStep));
|
|
64
|
+
};
|
|
65
|
+
const handleClear = (event) => {
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
setDraftTime("");
|
|
68
|
+
commit(void 0);
|
|
69
|
+
};
|
|
70
|
+
const handleTriggerKeyDown = (event) => {
|
|
71
|
+
if (disabled || !OPEN_KEYS.has(event.key)) return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
setOpen(true);
|
|
74
|
+
};
|
|
75
|
+
const displayValue = current ? (formatDate ?? ((d) => format(d, "PPP, p")))(current) : "";
|
|
76
|
+
const showClear = clearable && !disabled && current !== void 0;
|
|
77
|
+
const endIcon = /* @__PURE__ */ jsx(FieldEndIcons, {
|
|
78
|
+
onClear: showClear ? handleClear : void 0,
|
|
79
|
+
clearLabel,
|
|
80
|
+
icon: hideIcon ? void 0 : /* @__PURE__ */ jsx(CalendarIcon, {
|
|
81
|
+
size: FIELD_ICON_SIZE,
|
|
82
|
+
className: "text-muted-foreground"
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
86
|
+
className: cn("flex-1", className),
|
|
87
|
+
children: [/* @__PURE__ */ jsxs(Popover, {
|
|
88
|
+
open: isOpen,
|
|
89
|
+
onOpenChange: setOpen,
|
|
90
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
91
|
+
asChild: true,
|
|
92
|
+
disabled,
|
|
93
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
94
|
+
type: "text",
|
|
95
|
+
readOnly: true,
|
|
96
|
+
value: displayValue,
|
|
97
|
+
placeholder,
|
|
98
|
+
label,
|
|
99
|
+
size,
|
|
100
|
+
disabled,
|
|
101
|
+
required,
|
|
102
|
+
rounded,
|
|
103
|
+
error,
|
|
104
|
+
errorContent,
|
|
105
|
+
hintContent,
|
|
106
|
+
endIcon,
|
|
107
|
+
onKeyDown: handleTriggerKeyDown,
|
|
108
|
+
"aria-haspopup": "dialog",
|
|
109
|
+
className: cn("cursor-pointer read-only:bg-background", fieldEndPaddingClassName(showClear, !hideIcon), !displayValue && "text-muted-foreground")
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
112
|
+
align: "start",
|
|
113
|
+
className: "w-auto overflow-hidden rounded-2xl p-1 shadow-lg",
|
|
114
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
115
|
+
mode: "single",
|
|
116
|
+
selected: current,
|
|
117
|
+
onSelect: handleDaySelect,
|
|
118
|
+
defaultMonth: current,
|
|
119
|
+
showOutsideDays: true,
|
|
120
|
+
captionLayout: "dropdown",
|
|
121
|
+
...calendarProps
|
|
122
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: "border-t border-border px-3 pb-3 pt-3",
|
|
124
|
+
children: /* @__PURE__ */ jsx(TimePicker, {
|
|
125
|
+
"aria-label": timeAriaLabel,
|
|
126
|
+
value: draftTime,
|
|
127
|
+
onChange: handleTimeChange,
|
|
128
|
+
onBlur: handleTimeBlur,
|
|
129
|
+
step: timeStep,
|
|
130
|
+
size,
|
|
131
|
+
disabled
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
})]
|
|
135
|
+
}), name && /* @__PURE__ */ jsx("input", {
|
|
136
|
+
type: "hidden",
|
|
137
|
+
name,
|
|
138
|
+
value: current?.toISOString() ?? ""
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
DateTimePicker.displayName = "DateTimePicker";
|
|
143
|
+
//#endregion
|
|
144
|
+
export { DateTimePicker };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { format, isValid, set, startOfDay } from "date-fns";
|
|
2
|
+
//#region src/components/date-time-picker/date-time-picker.utils.ts
|
|
3
|
+
/** `HH:mm` or `HH:mm:ss`, 24-hour clock — the value shape of a native time input. */
|
|
4
|
+
var TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/;
|
|
5
|
+
var DEFAULT_TIME = "00:00";
|
|
6
|
+
var DEFAULT_TIME_STEP_SECONDS = 60;
|
|
7
|
+
function isValidTimeString(time) {
|
|
8
|
+
return TIME_RE.test(time);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Applies a `HH:mm[:ss]` wall-clock time to the calendar day of `date`.
|
|
12
|
+
* Falls back to midnight when `time` is not a valid time string.
|
|
13
|
+
*/
|
|
14
|
+
function mergeDateAndTime(date, time) {
|
|
15
|
+
const match = TIME_RE.exec(time);
|
|
16
|
+
if (!match) return startOfDay(date);
|
|
17
|
+
return set(startOfDay(date), {
|
|
18
|
+
hours: Number(match[1]),
|
|
19
|
+
minutes: Number(match[2]),
|
|
20
|
+
seconds: match[3] === void 0 ? 0 : Number(match[3])
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Formats the time-of-day of `date` for a native time input. A step below
|
|
25
|
+
* 60 seconds needs the seconds field, otherwise the browser rejects the value.
|
|
26
|
+
*/
|
|
27
|
+
function formatTimeOfDay(date, timeStep) {
|
|
28
|
+
if (!isValid(date)) return "";
|
|
29
|
+
return format(date, timeStep < 60 ? "HH:mm:ss" : "HH:mm");
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DEFAULT_TIME, DEFAULT_TIME_STEP_SECONDS, TIME_RE, formatTimeOfDay, isValidTimeString, mergeDateAndTime };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { AirConditionerIcon } from "./icons/air-conditioner.js";
|
|
2
|
+
import { BlindIcon } from "./icons/blind.js";
|
|
3
|
+
import { DimmerIcon } from "./icons/dimmer.js";
|
|
4
|
+
import { ExtensionBoardIcon } from "./icons/extension-board.js";
|
|
5
|
+
import { FanIcon } from "./icons/fan.js";
|
|
6
|
+
import { KnobIcon } from "./icons/knob.js";
|
|
7
|
+
import { LedStripIcon } from "./icons/led-strip.js";
|
|
8
|
+
import { LightIcon } from "./icons/light.js";
|
|
9
|
+
import { RefrigeratorIcon } from "./icons/refrigerator.js";
|
|
10
|
+
import { RetroSwitchIcon } from "./icons/retro-switch.js";
|
|
11
|
+
import { RouterIcon } from "./icons/router.js";
|
|
12
|
+
import { SensorIcon } from "./icons/sensor.js";
|
|
13
|
+
import { SocketIcon } from "./icons/socket.js";
|
|
14
|
+
import { SwitchIcon } from "./icons/switch.js";
|
|
15
|
+
import { ThermostatIcon } from "./icons/thermostat.js";
|
|
16
|
+
import { WashingMachineIcon } from "./icons/washing-machine.js";
|
|
17
|
+
//#region src/components/device-icon/device-icon.config.ts
|
|
18
|
+
/**
|
|
19
|
+
* To add a new device icon:
|
|
20
|
+
* 1. Add the SVG file to src/assets/devices/
|
|
21
|
+
* 2. Create a React component in ./icons/ following the existing pattern
|
|
22
|
+
* 3. Export it from ./icons/index.ts
|
|
23
|
+
* 4. Add an entry here with relevant keywords
|
|
24
|
+
*/
|
|
25
|
+
var deviceIconRegistry = {
|
|
26
|
+
AirConditioner: {
|
|
27
|
+
component: AirConditionerIcon,
|
|
28
|
+
keywords: [
|
|
29
|
+
"air conditioner",
|
|
30
|
+
"ac",
|
|
31
|
+
"aircon",
|
|
32
|
+
"cooling",
|
|
33
|
+
"air-conditioner",
|
|
34
|
+
"airconditioner"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
Blind: {
|
|
38
|
+
component: BlindIcon,
|
|
39
|
+
keywords: [
|
|
40
|
+
"blind",
|
|
41
|
+
"blinds",
|
|
42
|
+
"curtain",
|
|
43
|
+
"shade",
|
|
44
|
+
"shutter",
|
|
45
|
+
"roller blind",
|
|
46
|
+
"window cover"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
Dimmer: {
|
|
50
|
+
component: DimmerIcon,
|
|
51
|
+
keywords: [
|
|
52
|
+
"dimmer",
|
|
53
|
+
"dim",
|
|
54
|
+
"brightness",
|
|
55
|
+
"dimmable"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
ExtensionBoard: {
|
|
59
|
+
component: ExtensionBoardIcon,
|
|
60
|
+
keywords: [
|
|
61
|
+
"extension board",
|
|
62
|
+
"extension",
|
|
63
|
+
"power strip",
|
|
64
|
+
"multi plug",
|
|
65
|
+
"surge protector",
|
|
66
|
+
"extension-board"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
Fan: {
|
|
70
|
+
component: FanIcon,
|
|
71
|
+
keywords: [
|
|
72
|
+
"fan",
|
|
73
|
+
"ceiling fan",
|
|
74
|
+
"exhaust",
|
|
75
|
+
"blower",
|
|
76
|
+
"ventilator"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
Knob: {
|
|
80
|
+
component: KnobIcon,
|
|
81
|
+
keywords: [
|
|
82
|
+
"knob",
|
|
83
|
+
"dial",
|
|
84
|
+
"rotary",
|
|
85
|
+
"regulator"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
LedStrip: {
|
|
89
|
+
component: LedStripIcon,
|
|
90
|
+
keywords: [
|
|
91
|
+
"led strip",
|
|
92
|
+
"led",
|
|
93
|
+
"strip light",
|
|
94
|
+
"rgb",
|
|
95
|
+
"led-strip",
|
|
96
|
+
"ledstrip",
|
|
97
|
+
"light strip"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
Light: {
|
|
101
|
+
component: LightIcon,
|
|
102
|
+
keywords: [
|
|
103
|
+
"light",
|
|
104
|
+
"lightbulb",
|
|
105
|
+
"bulb",
|
|
106
|
+
"lamp",
|
|
107
|
+
"lite",
|
|
108
|
+
"tubelight",
|
|
109
|
+
"tube light"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
Refrigerator: {
|
|
113
|
+
component: RefrigeratorIcon,
|
|
114
|
+
keywords: [
|
|
115
|
+
"refrigerator",
|
|
116
|
+
"fridge",
|
|
117
|
+
"freezer",
|
|
118
|
+
"cooler"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
RetroSwitch: {
|
|
122
|
+
component: RetroSwitchIcon,
|
|
123
|
+
keywords: [
|
|
124
|
+
"retro switch",
|
|
125
|
+
"retro",
|
|
126
|
+
"vintage switch",
|
|
127
|
+
"retro-switch",
|
|
128
|
+
"retroswitch"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
Router: {
|
|
132
|
+
component: RouterIcon,
|
|
133
|
+
keywords: [
|
|
134
|
+
"router",
|
|
135
|
+
"wifi",
|
|
136
|
+
"modem",
|
|
137
|
+
"gateway",
|
|
138
|
+
"access point",
|
|
139
|
+
"wi-fi"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
Sensor: {
|
|
143
|
+
component: SensorIcon,
|
|
144
|
+
keywords: [
|
|
145
|
+
"sensor",
|
|
146
|
+
"detector",
|
|
147
|
+
"probe",
|
|
148
|
+
"motion sensor",
|
|
149
|
+
"pir"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
Socket: {
|
|
153
|
+
component: SocketIcon,
|
|
154
|
+
keywords: [
|
|
155
|
+
"socket",
|
|
156
|
+
"outlet",
|
|
157
|
+
"plug",
|
|
158
|
+
"power point",
|
|
159
|
+
"wall socket"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
Switch: {
|
|
163
|
+
component: SwitchIcon,
|
|
164
|
+
keywords: [
|
|
165
|
+
"switch",
|
|
166
|
+
"toggle",
|
|
167
|
+
"on off",
|
|
168
|
+
"swtch",
|
|
169
|
+
"on/off"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
Thermostat: {
|
|
173
|
+
component: ThermostatIcon,
|
|
174
|
+
keywords: [
|
|
175
|
+
"thermostat",
|
|
176
|
+
"temperature",
|
|
177
|
+
"climate",
|
|
178
|
+
"hvac",
|
|
179
|
+
"temp control"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
WashingMachine: {
|
|
183
|
+
component: WashingMachineIcon,
|
|
184
|
+
keywords: [
|
|
185
|
+
"washing machine",
|
|
186
|
+
"washer",
|
|
187
|
+
"laundry",
|
|
188
|
+
"washing-machine",
|
|
189
|
+
"washingmachine"
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
//#endregion
|
|
194
|
+
export { deviceIconRegistry };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { resolveColor } from "../../utils/color.js";
|
|
3
|
+
import { matchDevice } from "./match-device.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/device-icon/device-icon.tsx
|
|
6
|
+
function DeviceIcon({ type, size = 18, color, fallback: Fallback, className }) {
|
|
7
|
+
const Icon = matchDevice(type) ?? Fallback;
|
|
8
|
+
if (!Icon) return null;
|
|
9
|
+
const resolved = color ? resolveColor(color, "text") : void 0;
|
|
10
|
+
return /* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: cn("inline-flex", resolved?.className, className),
|
|
12
|
+
style: resolved?.style,
|
|
13
|
+
children: /* @__PURE__ */ jsx(Icon, { size })
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { DeviceIcon };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/device-icon/icons/air-conditioner.tsx
|
|
3
|
+
function AirConditionerIcon({ size = 18 }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
5
|
+
width: size,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 800 759.42",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ jsx("path", { d: "m669.22,400.82H129.14C57.8,400.82,0,343.02,0,271.67V33.96C0,15.35,15.35,0,33.96,0h732.08c18.61,0,33.96,15.35,33.96,33.96v237.71c-1.63,71.35-59.43,129.14-130.78,129.14ZM66.29,67.92v203.76c0,33.96,28.9,62.86,62.86,62.86h540.08c33.96,0,62.86-28.9,62.86-62.86V67.92H66.29Z" }),
|
|
12
|
+
/* @__PURE__ */ jsx("path", { d: "m630.2,256.49H168.16c-18.61,0-33.96-15.35-33.96-33.96s15.18-33.96,33.96-33.96h462.04c18.61,0,33.96,15.35,33.96,33.96s-15.35,33.96-33.96,33.96Z" }),
|
|
13
|
+
/* @__PURE__ */ jsxs("g", { children: [
|
|
14
|
+
/* @__PURE__ */ jsx("path", { d: "m195.27,759.18c-18.61-3.43-28.9-22.04-25.47-39.02,8.49-37.39,0-56-10.12-79.84-11.92-28.9-27.1-66.29,0-122.29,8.49-16.98,27.1-23.84,44.08-15.35,16.98,8.49,23.84,27.1,15.35,44.08-13.55,28.9-8.49,42.45,1.63,67.92,10.12,27.1,25.47,62.86,13.55,120.65-3.27,13.71-16.16,25.31-39.02,23.84Z" }),
|
|
15
|
+
/* @__PURE__ */ jsx("path", { d: "m402.61,759.18c-18.61-3.43-28.9-22.04-25.47-39.02,8.49-37.39,0-56-10.12-79.84-11.92-28.9-27.1-66.29,0-122.29,8.49-16.98,27.1-23.84,44.08-15.35,16.98,8.49,23.84,27.1,15.35,44.08-13.55,28.9-8.49,42.45,1.63,67.92,10.12,27.1,25.47,62.86,13.55,120.65-3.43,13.71-17.63,25.96-39.02,23.84Z" }),
|
|
16
|
+
/* @__PURE__ */ jsx("path", { d: "m609.8,759.18c-18.61-3.43-28.9-22.04-25.47-39.02,8.49-37.39,0-56-10.12-79.84-11.92-28.9-27.1-66.29,0-122.29,8.49-16.98,27.1-23.84,44.08-15.35s23.84,27.1,15.35,44.08c-13.55,28.9-8.49,42.45,1.63,67.92,10.12,27.1,25.47,62.86,13.55,120.65-3.43,13.71-17.14,25.63-39.02,23.84Z" })
|
|
17
|
+
] })
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { AirConditionerIcon };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/device-icon/icons/blind.tsx
|
|
3
|
+
function BlindIcon({ size = 18 }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
5
|
+
width: size,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 488.13 450",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ jsx("path", { d: "m448.56,64H39.56V0h409v64Z" }),
|
|
12
|
+
/* @__PURE__ */ jsx("path", { d: "m468.88,51.25H19.25C8.66,51.25,0,42.59,0,32h0C0,21.41,8.66,12.75,19.25,12.75h449.63c10.59,0,19.25,8.66,19.25,19.25h0c0,10.59-8.66,19.25-19.25,19.25Z" }),
|
|
13
|
+
/* @__PURE__ */ jsx("path", { d: "m408.06,146H80.06v-51.19h328v51.19Z" }),
|
|
14
|
+
/* @__PURE__ */ jsx("path", { d: "m408.06,228.12H80.06v-51.19h328v51.19Z" }),
|
|
15
|
+
/* @__PURE__ */ jsx("path", { d: "m408.06,309.12H80.06v-51.19h328v51.19Z" }),
|
|
16
|
+
/* @__PURE__ */ jsx("path", { d: "m408.06,390.12H80.06v-51.19h328v51.19Z" }),
|
|
17
|
+
/* @__PURE__ */ jsx("path", { d: "m448.56,450H39.56v-29h409v29Z" }),
|
|
18
|
+
/* @__PURE__ */ jsx("path", { d: "m458.12,322.5c0,12.43-6.49,22.5-14.5,22.5s-14.5-10.07-14.5-22.5,6.49-22.5,14.5-22.5,14.5,10.07,14.5,22.5Z" }),
|
|
19
|
+
/* @__PURE__ */ jsx("path", { d: "m448.62,310h-10V94h10v216Z" })
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { BlindIcon };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/device-icon/icons/dimmer.tsx
|
|
3
|
+
function DimmerIcon({ size = 18 }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
5
|
+
width: size,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 753.17 753.17",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m376.58,753.17c-50.83,0-100.15-9.96-146.59-29.61-44.85-18.97-85.12-46.12-119.69-80.69-34.58-34.58-61.72-74.85-80.69-119.69C9.96,476.73,0,427.41,0,376.58s9.96-100.15,29.61-146.59c18.97-44.85,46.12-85.12,80.69-119.69s74.85-61.72,119.69-80.69C276.44,9.96,325.76,0,376.58,0s100.15,9.96,146.59,29.61c44.85,18.97,85.12,46.12,119.69,80.69,34.57,34.58,61.72,74.85,80.69,119.69,19.64,46.45,29.61,95.77,29.61,146.59s-9.96,100.15-29.61,146.59c-18.97,44.85-46.12,85.12-80.69,119.69-34.58,34.57-74.85,61.72-119.69,80.69-46.45,19.64-95.77,29.61-146.59,29.61Zm0-693.17c-84.56,0-164.06,32.93-223.86,92.73-59.79,59.79-92.73,139.3-92.73,223.86s32.93,164.06,92.73,223.86c59.79,59.79,139.3,92.72,223.86,92.72s164.06-32.93,223.86-92.72,92.72-139.3,92.72-223.86-32.93-164.06-92.72-223.86c-59.79-59.79-139.3-92.73-223.86-92.73Z" }), /* @__PURE__ */ jsx("path", { d: "m244.11,569.94c-6.79,0-13.42-2.3-18.76-6.59-50.75-40.68-82.62-98.68-89.75-163.33-7.12-64.65,11.35-128.2,52.03-178.96,40.68-50.75,98.68-82.62,163.33-89.75,64.65-7.12,128.2,11.36,178.96,52.03,12.93,10.36,15.01,29.24,4.65,42.17l-267.05,333.19c-4.98,6.21-12.21,10.19-20.12,11.06-1.1.12-2.19.18-3.29.18Zm133.88-380.12c-6.79,0-13.61.37-20.45,1.13-48.72,5.37-92.43,29.39-123.09,67.63-56.89,70.98-52.33,171.68,6.55,237.27l226.48-282.57c-27.31-15.41-57.96-23.47-89.48-23.47Z" })]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { DimmerIcon };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/device-icon/icons/extension-board.tsx
|
|
3
|
+
function ExtensionBoardIcon({ size = 18 }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
5
|
+
width: size,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 795.86 797.25",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ jsx("path", { d: "m377.63,0v711.25h184.71v37.29H154.88v-220.2h99.05v-117.95h-20.46l27.49-107.29h-46.3v-67.05h-48.8v67.05h-70.76v-67.05h-48.8v67.05H0l27.49,107.29H7.03v117.95h99.05v268.91h505.07v-86.01h184.71V0h-418.23Zm-179.53,351.81l-15.01,58.58h-105.24l-15.01-58.58h135.25Zm-142.28,127.81v-20.52h149.3v20.52H55.83Zm691.23,182.91h-320.63V48.72h320.63v613.82h0Z" }),
|
|
12
|
+
/* @__PURE__ */ jsx("path", { d: "m586.74,377.26c-70.28,0-127.46,57.08-127.46,127.24s57.18,127.24,127.46,127.24,127.46-57.08,127.46-127.24-57.18-127.24-127.46-127.24Zm0,205.76c-43.37,0-78.66-35.22-78.66-78.52s35.29-78.52,78.66-78.52,78.66,35.22,78.66,78.52-35.28,78.52-78.66,78.52Z" }),
|
|
13
|
+
/* @__PURE__ */ jsx("rect", {
|
|
14
|
+
x: "603.83",
|
|
15
|
+
y: "488.14",
|
|
16
|
+
width: "31.72",
|
|
17
|
+
height: "31.66"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("rect", {
|
|
20
|
+
x: "537.95",
|
|
21
|
+
y: "488.14",
|
|
22
|
+
width: "31.72",
|
|
23
|
+
height: "31.66"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsx("path", { d: "m586.74,86.15c-70.28,0-127.46,57.08-127.46,127.24s57.18,127.24,127.46,127.24,127.46-57.08,127.46-127.24-57.18-127.24-127.46-127.24Zm0,205.76c-43.37,0-78.66-35.22-78.66-78.52s35.29-78.52,78.66-78.52,78.66,35.22,78.66,78.52-35.28,78.52-78.66,78.52Z" }),
|
|
26
|
+
/* @__PURE__ */ jsx("rect", {
|
|
27
|
+
x: "603.83",
|
|
28
|
+
y: "197.04",
|
|
29
|
+
width: "31.72",
|
|
30
|
+
height: "31.66"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx("rect", {
|
|
33
|
+
x: "537.95",
|
|
34
|
+
y: "197.04",
|
|
35
|
+
width: "31.72",
|
|
36
|
+
height: "31.66"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { ExtensionBoardIcon };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/device-icon/icons/fan.tsx
|
|
3
|
+
function FanIcon({ size = 18 }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
5
|
+
width: size,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 512 512",
|
|
8
|
+
fill: "currentColor",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: /* @__PURE__ */ jsx("path", { d: "m500.49,287.13c-10.14-14.45-26-24.08-43.5-26.4l-133.94-17.77s-.03-.05-.04-.07l51.58-124.88c6.74-16.32,6.34-34.86-1.11-50.88-7.46-16.05-21.42-28.34-38.3-33.72-25.53-8.14-52.16-12.27-79.18-12.27s-53.66,4.12-79.18,12.27c-16.88,5.38-30.84,17.68-38.3,33.72-7.44,16.01-7.85,34.56-1.11,50.88l51.58,124.88s-.03.05-.04.07l-133.94,17.77c-17.5,2.32-33.36,11.94-43.5,26.4-10.17,14.49-13.83,32.72-10.06,50.03,5.72,26.18,15.46,51.31,28.97,74.7,13.51,23.4,30.4,44.41,50.21,62.44,11.72,10.67,27.07,16.56,42.8,16.56,1.85,0,3.7-.08,5.56-.24,17.59-1.56,33.85-10.48,44.61-24.48l82.33-107.08h.14l82.33,107.08c10.76,14,27.02,22.92,44.61,24.48,1.85.16,3.7.24,5.56.24,15.73,0,31.07-5.89,42.8-16.56,19.81-18.03,36.71-39.04,50.21-62.44,13.51-23.4,23.25-48.53,28.97-74.7,3.78-17.31.11-35.55-10.06-50.03h.01-.01ZM176.44,101.88c-2.28-5.51-2.15-11.53.37-16.94,2.53-5.45,7.09-9.46,12.83-11.29,21.37-6.81,43.69-10.27,66.35-10.27s44.98,3.45,66.35,10.27c5.74,1.83,10.3,5.84,12.83,11.29,2.52,5.41,2.65,11.43.37,16.94l-45.51,110.2c-10.28-5.05-21.83-7.9-34.03-7.9s-23.76,2.85-34.03,7.9l-45.52-110.2h0Zm-36.34,338.51c-3.63,4.73-8.91,7.63-14.85,8.15-5.98.53-11.74-1.41-16.19-5.47-16.59-15.1-30.74-32.7-42.07-52.32s-19.49-40.68-24.28-62.6c-1.29-5.89-.09-11.84,3.36-16.76,3.43-4.89,8.57-8,14.48-8.79l118.2-15.68c1.66,24.52,14.78,45.94,34.04,58.94l-72.68,94.52h0Zm122.38-124.17s-.05,0-.07.01c-2.08.38-4.22.59-6.42.59s-4.34-.21-6.42-.6h-.06c-16.32-3.05-28.72-17.4-28.72-34.59,0-19.41,15.79-35.2,35.2-35.2s35.2,15.79,35.2,35.2c0,17.19-12.39,31.54-28.71,34.59h0Zm206.79,11.94c-4.78,21.91-12.95,42.97-24.28,62.59s-25.48,37.23-42.07,52.32c-4.46,4.06-10.22,5.99-16.19,5.47-5.94-.52-11.22-3.42-14.85-8.15l-72.68-94.52c19.26-12.99,32.37-34.42,34.03-58.94l118.2,15.68c5.91.78,11.06,3.91,14.48,8.79,3.45,4.92,4.65,10.87,3.36,16.76h0Z" })
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { FanIcon };
|