@ug666/ui-react 0.2.0 → 0.3.0-beta.2
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/dist/THIRD_PARTY_NOTICES.txt +98 -0
- package/dist/aliases.d.ts +107 -0
- package/dist/aliases.d.ts.map +1 -0
- package/dist/blocks/feature-grid.d.ts +48 -0
- package/dist/blocks/feature-grid.d.ts.map +1 -0
- package/dist/blocks/index.cjs +1 -238
- package/dist/blocks/index.cjs.map +1 -1
- package/dist/blocks/index.d.ts +6 -84
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +1 -153
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/landing-hero.d.ts +61 -0
- package/dist/blocks/landing-hero.d.ts.map +1 -0
- package/dist/chunk-2EJWWTLH.cjs +1 -0
- package/dist/chunk-2EJWWTLH.cjs.map +1 -0
- package/dist/chunk-D63UPGP5.cjs +1 -0
- package/dist/chunk-D63UPGP5.cjs.map +1 -0
- package/dist/chunk-J4NAYP4L.cjs +1 -0
- package/dist/chunk-J4NAYP4L.cjs.map +1 -0
- package/dist/chunk-JY5S7YLF.cjs +1 -0
- package/dist/chunk-JY5S7YLF.cjs.map +1 -0
- package/dist/chunk-NRCPYVJW.js +1 -0
- package/dist/chunk-NRCPYVJW.js.map +1 -0
- package/dist/chunk-PXVCZ6AZ.js +1 -0
- package/dist/chunk-PXVCZ6AZ.js.map +1 -0
- package/dist/chunk-PZ4UH6BC.js +1 -0
- package/dist/chunk-PZ4UH6BC.js.map +1 -0
- package/dist/chunk-UBZ2ZCEJ.cjs +1 -0
- package/dist/chunk-UBZ2ZCEJ.cjs.map +1 -0
- package/dist/chunk-UEJM2SLH.js +1 -0
- package/dist/chunk-UEJM2SLH.js.map +1 -0
- package/dist/chunk-UESSLLSC.js +1 -0
- package/dist/chunk-UESSLLSC.js.map +1 -0
- package/dist/chunk-VDBATAZ3.js +1 -0
- package/dist/chunk-VDBATAZ3.js.map +1 -0
- package/dist/chunk-WQHHSYYD.js +1 -0
- package/dist/chunk-WQHHSYYD.js.map +1 -0
- package/dist/chunk-X4EMYHLY.cjs +1 -0
- package/dist/chunk-X4EMYHLY.cjs.map +1 -0
- package/dist/chunk-XN7GQRSF.js +1 -0
- package/dist/chunk-XN7GQRSF.js.map +1 -0
- package/dist/chunk-XVFRKGM7.cjs +1 -0
- package/dist/chunk-XVFRKGM7.cjs.map +1 -0
- package/dist/chunk-ZDO5A2IZ.cjs +1 -0
- package/dist/chunk-ZDO5A2IZ.cjs.map +1 -0
- package/dist/components/accordion.d.ts +65 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/alert.d.ts +23 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/autocomplete.d.ts +21 -0
- package/dist/components/autocomplete.d.ts.map +1 -0
- package/dist/components/avatar-group.d.ts +20 -0
- package/dist/components/avatar-group.d.ts.map +1 -0
- package/dist/components/avatar.d.ts +34 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/backtop.d.ts +11 -0
- package/dist/components/backtop.d.ts.map +1 -0
- package/dist/components/badge.d.ts +33 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/bar-chart.d.ts +23 -0
- package/dist/components/bar-chart.d.ts.map +1 -0
- package/dist/components/breadcrumb.d.ts +37 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/button-group.d.ts +26 -0
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button.d.ts +45 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/calendar.d.ts +40 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/card.d.ts +33 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/carousel.d.ts +29 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/cascader.d.ts +54 -0
- package/dist/components/cascader.d.ts.map +1 -0
- package/dist/components/checkbox-group-context.d.ts +14 -0
- package/dist/components/checkbox-group-context.d.ts.map +1 -0
- package/dist/components/checkbox-group.d.ts +18 -0
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox.d.ts +32 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/collapsible.d.ts +23 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/color-picker.d.ts +19 -0
- package/dist/components/color-picker.d.ts.map +1 -0
- package/dist/components/config-provider.d.ts +31 -0
- package/dist/components/config-provider.d.ts.map +1 -0
- package/dist/components/container.d.ts +27 -0
- package/dist/components/container.d.ts.map +1 -0
- package/dist/components/context/form-context.d.ts +41 -0
- package/dist/components/context/form-context.d.ts.map +1 -0
- package/dist/components/context-menu.d.ts +39 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/data-panel.d.ts +38 -0
- package/dist/components/data-panel.d.ts.map +1 -0
- package/dist/components/date-picker.d.ts +16 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/date-range-picker.d.ts +42 -0
- package/dist/components/date-range-picker.d.ts.map +1 -0
- package/dist/components/date-time-picker.d.ts +12 -0
- package/dist/components/date-time-picker.d.ts.map +1 -0
- package/dist/components/descriptions.d.ts +40 -0
- package/dist/components/descriptions.d.ts.map +1 -0
- package/dist/components/dialog.d.ts +64 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dock.d.ts +29 -0
- package/dist/components/dock.d.ts.map +1 -0
- package/dist/components/donut-chart.d.ts +30 -0
- package/dist/components/donut-chart.d.ts.map +1 -0
- package/dist/components/drawer.d.ts +47 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/dropdown.d.ts +50 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/empty-state.d.ts +27 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/fab.d.ts +38 -0
- package/dist/components/fab.d.ts.map +1 -0
- package/dist/components/fieldset.d.ts +13 -0
- package/dist/components/fieldset.d.ts.map +1 -0
- package/dist/components/file-input.d.ts +17 -0
- package/dist/components/file-input.d.ts.map +1 -0
- package/dist/components/form.d.ts +127 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/gauge-chart.d.ts +19 -0
- package/dist/components/gauge-chart.d.ts.map +1 -0
- package/dist/components/heatmap-chart.d.ts +28 -0
- package/dist/components/heatmap-chart.d.ts.map +1 -0
- package/dist/components/icon.d.ts +16 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/image-viewer.d.ts +15 -0
- package/dist/components/image-viewer.d.ts.map +1 -0
- package/dist/components/image.d.ts +14 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/index.cjs +1 -3993
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +107 -1096
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +1 -330
- package/dist/components/indicator.d.ts +20 -0
- package/dist/components/indicator.d.ts.map +1 -0
- package/dist/components/infinite-scroll.d.ts +20 -0
- package/dist/components/infinite-scroll.d.ts.map +1 -0
- package/dist/components/input.d.ts +28 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/join.d.ts +20 -0
- package/dist/components/join.d.ts.map +1 -0
- package/dist/components/kbd.d.ts +8 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/label.d.ts +18 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/layout.d.ts +34 -0
- package/dist/components/layout.d.ts.map +1 -0
- package/dist/components/link.d.ts +18 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/list.d.ts +21 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/loading.d.ts +10 -0
- package/dist/components/loading.d.ts.map +1 -0
- package/dist/components/modal.d.ts +63 -0
- package/dist/components/modal.d.ts.map +1 -0
- package/dist/components/navbar.d.ts +23 -0
- package/dist/components/navbar.d.ts.map +1 -0
- package/dist/components/navigation-menu.d.ts +54 -0
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/notification.d.ts +22 -0
- package/dist/components/notification.d.ts.map +1 -0
- package/dist/components/number-input.d.ts +35 -0
- package/dist/components/number-input.d.ts.map +1 -0
- package/dist/components/otp-input.d.ts +45 -0
- package/dist/components/otp-input.d.ts.map +1 -0
- package/dist/components/pagination.d.ts +19 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/popconfirm.d.ts +20 -0
- package/dist/components/popconfirm.d.ts.map +1 -0
- package/dist/components/popover.d.ts +37 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/radar-chart.d.ts +24 -0
- package/dist/components/radar-chart.d.ts.map +1 -0
- package/dist/components/radial-progress.d.ts +18 -0
- package/dist/components/radial-progress.d.ts.map +1 -0
- package/dist/components/radio.d.ts +79 -0
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/ranking-list.d.ts +31 -0
- package/dist/components/ranking-list.d.ts.map +1 -0
- package/dist/components/rating.d.ts +20 -0
- package/dist/components/rating.d.ts.map +1 -0
- package/dist/components/result.d.ts +13 -0
- package/dist/components/result.d.ts.map +1 -0
- package/dist/components/scrollbar.d.ts +29 -0
- package/dist/components/scrollbar.d.ts.map +1 -0
- package/dist/components/select.d.ts +48 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/separator.d.ts +28 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/sheet.d.ts +35 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sidebar.d.ts +84 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/skeleton.d.ts +16 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/slider.d.ts +44 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/space.d.ts +19 -0
- package/dist/components/space.d.ts.map +1 -0
- package/dist/components/spinner.d.ts +22 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/splitter.d.ts +52 -0
- package/dist/components/splitter.d.ts.map +1 -0
- package/dist/components/stack.d.ts +16 -0
- package/dist/components/stack.d.ts.map +1 -0
- package/dist/components/stacked-bar-chart.d.ts +25 -0
- package/dist/components/stacked-bar-chart.d.ts.map +1 -0
- package/dist/components/statistic-card.d.ts +50 -0
- package/dist/components/statistic-card.d.ts.map +1 -0
- package/dist/components/statistic.d.ts +35 -0
- package/dist/components/statistic.d.ts.map +1 -0
- package/dist/components/steps.d.ts +35 -0
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/switch.d.ts +49 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/table.d.ts +46 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/tabs.d.ts +40 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tag.d.ts +29 -0
- package/dist/components/tag.d.ts.map +1 -0
- package/dist/components/text.d.ts +16 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/textarea.d.ts +26 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/theme-controller.d.ts +24 -0
- package/dist/components/theme-controller.d.ts.map +1 -0
- package/dist/components/time-picker.d.ts +8 -0
- package/dist/components/time-picker.d.ts.map +1 -0
- package/dist/components/time-range-picker.d.ts +30 -0
- package/dist/components/time-range-picker.d.ts.map +1 -0
- package/dist/components/time-select.d.ts +15 -0
- package/dist/components/time-select.d.ts.map +1 -0
- package/dist/components/timeline.d.ts +22 -0
- package/dist/components/timeline.d.ts.map +1 -0
- package/dist/components/toast.d.ts +72 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/tooltip.d.ts +32 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/transfer.d.ts +51 -0
- package/dist/components/transfer.d.ts.map +1 -0
- package/dist/components/tree-select.d.ts +29 -0
- package/dist/components/tree-select.d.ts.map +1 -0
- package/dist/components/tree.d.ts +56 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/trend-chart.d.ts +43 -0
- package/dist/components/trend-chart.d.ts.map +1 -0
- package/dist/components/upload.d.ts +28 -0
- package/dist/components/upload.d.ts.map +1 -0
- package/dist/hooks/index.cjs +1 -352
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +19 -231
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +1 -32
- package/dist/hooks/use-click-outside.d.ts +9 -0
- package/dist/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +12 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-debounce.d.ts +7 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-escape-key.d.ts +17 -0
- package/dist/hooks/use-escape-key.d.ts.map +1 -0
- package/dist/hooks/use-event-listener.d.ts +27 -0
- package/dist/hooks/use-event-listener.d.ts.map +1 -0
- package/dist/hooks/use-form.d.ts +49 -0
- package/dist/hooks/use-form.d.ts.map +1 -0
- package/dist/hooks/use-hotkeys.d.ts +30 -0
- package/dist/hooks/use-hotkeys.d.ts.map +1 -0
- package/dist/hooks/use-interval.d.ts +19 -0
- package/dist/hooks/use-interval.d.ts.map +1 -0
- package/dist/hooks/use-local-storage.d.ts +9 -0
- package/dist/hooks/use-local-storage.d.ts.map +1 -0
- package/dist/hooks/use-media-query.d.ts +8 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-mounted.d.ts +18 -0
- package/dist/hooks/use-mounted.d.ts.map +1 -0
- package/dist/hooks/use-pagination.d.ts +36 -0
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-timeout.d.ts +19 -0
- package/dist/hooks/use-timeout.d.ts.map +1 -0
- package/dist/hooks/use-toggle.d.ts +9 -0
- package/dist/hooks/use-toggle.d.ts.map +1 -0
- package/dist/index.cjs +1 -4499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +120 -294
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -539
- package/dist/index.js.map +1 -1
- package/dist/internal/admin-horizontal-navigation.d.ts +9 -0
- package/dist/internal/admin-horizontal-navigation.d.ts.map +1 -0
- package/dist/internal/button-group-context.d.ts +11 -0
- package/dist/internal/button-group-context.d.ts.map +1 -0
- package/dist/internal/cn.d.ts +8 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/data-table-header.d.ts +20 -0
- package/dist/internal/data-table-header.d.ts.map +1 -0
- package/dist/internal/date-mode-panel.d.ts +9 -0
- package/dist/internal/date-mode-panel.d.ts.map +1 -0
- package/dist/internal/date-time-control.d.ts +33 -0
- package/dist/internal/date-time-control.d.ts.map +1 -0
- package/dist/internal/date-time-range-control.d.ts +27 -0
- package/dist/internal/date-time-range-control.d.ts.map +1 -0
- package/dist/internal/option-window.d.ts +9 -0
- package/dist/internal/option-window.d.ts.map +1 -0
- package/dist/internal/sidebar-navigation.d.ts +55 -0
- package/dist/internal/sidebar-navigation.d.ts.map +1 -0
- package/dist/internal/time-panel.d.ts +8 -0
- package/dist/internal/time-panel.d.ts.map +1 -0
- package/dist/internal/use-cascader-lazy.d.ts +8 -0
- package/dist/internal/use-cascader-lazy.d.ts.map +1 -0
- package/dist/internal/use-floating-layout-observer.d.ts +8 -0
- package/dist/internal/use-floating-layout-observer.d.ts.map +1 -0
- package/dist/internal/use-overlay-focus.d.ts +9 -0
- package/dist/internal/use-overlay-focus.d.ts.map +1 -0
- package/dist/internal/use-portal-container.d.ts +2 -0
- package/dist/internal/use-portal-container.d.ts.map +1 -0
- package/dist/internal/use-presence.d.ts +13 -0
- package/dist/internal/use-presence.d.ts.map +1 -0
- package/dist/internal/use-transfer-remote.d.ts +20 -0
- package/dist/internal/use-transfer-remote.d.ts.map +1 -0
- package/dist/internal/use-tree-data.d.ts +8 -0
- package/dist/internal/use-tree-data.d.ts.map +1 -0
- package/dist/patterns/admin-shell.d.ts +118 -0
- package/dist/patterns/admin-shell.d.ts.map +1 -0
- package/dist/patterns/app-tabs.d.ts +33 -0
- package/dist/patterns/app-tabs.d.ts.map +1 -0
- package/dist/patterns/attachment-list.d.ts +36 -0
- package/dist/patterns/attachment-list.d.ts.map +1 -0
- package/dist/patterns/confirm-dialog.d.ts +50 -0
- package/dist/patterns/confirm-dialog.d.ts.map +1 -0
- package/dist/patterns/conversation-list.d.ts +27 -0
- package/dist/patterns/conversation-list.d.ts.map +1 -0
- package/dist/patterns/copy-field.d.ts +35 -0
- package/dist/patterns/copy-field.d.ts.map +1 -0
- package/dist/patterns/data-table-identity.d.ts +14 -0
- package/dist/patterns/data-table-identity.d.ts.map +1 -0
- package/dist/patterns/data-table-toolbar.d.ts +18 -0
- package/dist/patterns/data-table-toolbar.d.ts.map +1 -0
- package/dist/patterns/data-table.d.ts +69 -0
- package/dist/patterns/data-table.d.ts.map +1 -0
- package/dist/patterns/index.cjs +1 -758
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.ts +18 -158
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +1 -320
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/message.d.ts +30 -0
- package/dist/patterns/message.d.ts.map +1 -0
- package/dist/patterns/page-header.d.ts +41 -0
- package/dist/patterns/page-header.d.ts.map +1 -0
- package/dist/patterns/prompt-composer.d.ts +55 -0
- package/dist/patterns/prompt-composer.d.ts.map +1 -0
- package/dist/patterns/quick-access.d.ts +39 -0
- package/dist/patterns/quick-access.d.ts.map +1 -0
- package/dist/patterns/selection-list.d.ts +34 -0
- package/dist/patterns/selection-list.d.ts.map +1 -0
- package/dist/patterns/theme-configurator-dialog.d.ts +21 -0
- package/dist/patterns/theme-configurator-dialog.d.ts.map +1 -0
- package/dist/patterns/theme-configurator.d.ts +24 -0
- package/dist/patterns/theme-configurator.d.ts.map +1 -0
- package/dist/patterns/tree-table.d.ts +18 -0
- package/dist/patterns/tree-table.d.ts.map +1 -0
- package/dist/primitives/index.cjs +1 -384
- package/dist/primitives/index.cjs.map +1 -1
- package/dist/primitives/index.d.ts +26 -135
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +1 -56
- package/dist/styles.css +2 -2499
- package/dist/theme.cjs +1 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.ts +46 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +1 -0
- package/dist/theme.js.map +1 -0
- package/dist/themes/default.css +1 -0
- package/dist/themes/mecha.css +1 -0
- package/dist/themes/minimal.css +1 -0
- package/dist/tokens.css +2 -86
- package/package.json +24 -18
- package/dist/blocks/index.d.cts +0 -86
- package/dist/button-CaLZig8j.d.cts +0 -22
- package/dist/button-CaLZig8j.d.ts +0 -22
- package/dist/chunk-2IVRUJKO.js +0 -377
- package/dist/chunk-2IVRUJKO.js.map +0 -1
- package/dist/chunk-73WQAE3E.js +0 -3003
- package/dist/chunk-73WQAE3E.js.map +0 -1
- package/dist/chunk-MGXIF756.js +0 -313
- package/dist/chunk-MGXIF756.js.map +0 -1
- package/dist/chunk-RUDEZA5Q.js +0 -62
- package/dist/chunk-RUDEZA5Q.js.map +0 -1
- package/dist/chunk-S45GP6IB.js +0 -254
- package/dist/chunk-S45GP6IB.js.map +0 -1
- package/dist/components/index.d.cts +0 -1097
- package/dist/hooks/index.d.cts +0 -232
- package/dist/index.d.cts +0 -297
- package/dist/labs/index.cjs +0 -34
- package/dist/labs/index.cjs.map +0 -1
- package/dist/labs/index.d.cts +0 -12
- package/dist/labs/index.d.ts +0 -12
- package/dist/labs/index.js +0 -9
- package/dist/labs/index.js.map +0 -1
- package/dist/patterns/index.d.cts +0 -158
- package/dist/primitives/index.d.cts +0 -137
- package/dist/sidebar-vl00Z2o-.d.cts +0 -93
- package/dist/sidebar-vl00Z2o-.d.ts +0 -93
package/dist/index.cjs
CHANGED
|
@@ -1,4499 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
Accordion: () => Accordion,
|
|
25
|
-
AccordionContent: () => AccordionContent,
|
|
26
|
-
AccordionItem: () => AccordionItem,
|
|
27
|
-
AccordionTrigger: () => AccordionTrigger,
|
|
28
|
-
Alert: () => Alert,
|
|
29
|
-
AlertDescription: () => AlertDescription,
|
|
30
|
-
AlertTitle: () => AlertTitle,
|
|
31
|
-
Avatar: () => Avatar,
|
|
32
|
-
AvatarFallback: () => AvatarFallback,
|
|
33
|
-
AvatarGroup: () => AvatarGroup,
|
|
34
|
-
AvatarImage: () => AvatarImage,
|
|
35
|
-
Badge: () => Badge,
|
|
36
|
-
Breadcrumb: () => Breadcrumb,
|
|
37
|
-
BreadcrumbItem: () => BreadcrumbItem,
|
|
38
|
-
BreadcrumbLink: () => BreadcrumbLink,
|
|
39
|
-
BreadcrumbSeparator: () => BreadcrumbSeparator,
|
|
40
|
-
Button: () => Button,
|
|
41
|
-
Card: () => Card,
|
|
42
|
-
CardContent: () => CardContent,
|
|
43
|
-
CardDescription: () => CardDescription,
|
|
44
|
-
CardFooter: () => CardFooter,
|
|
45
|
-
CardHeader: () => CardHeader,
|
|
46
|
-
CardTitle: () => CardTitle,
|
|
47
|
-
Checkbox: () => Checkbox,
|
|
48
|
-
ContextMenu: () => ContextMenu,
|
|
49
|
-
ContextMenuContent: () => ContextMenuContent,
|
|
50
|
-
ContextMenuItem: () => ContextMenuItem,
|
|
51
|
-
ContextMenuSeparator: () => ContextMenuSeparator,
|
|
52
|
-
ContextMenuTrigger: () => ContextMenuTrigger,
|
|
53
|
-
Descriptions: () => Descriptions,
|
|
54
|
-
DescriptionsItem: () => DescriptionsItem,
|
|
55
|
-
Dialog: () => Dialog,
|
|
56
|
-
Drawer: () => Drawer,
|
|
57
|
-
DrawerClose: () => DrawerClose,
|
|
58
|
-
DrawerContent: () => DrawerContent,
|
|
59
|
-
DrawerDescription: () => DrawerDescription,
|
|
60
|
-
DrawerFooter: () => DrawerFooter,
|
|
61
|
-
DrawerHeader: () => DrawerHeader,
|
|
62
|
-
DrawerTitle: () => DrawerTitle,
|
|
63
|
-
DropdownContent: () => DropdownContent,
|
|
64
|
-
DropdownItem: () => DropdownItem,
|
|
65
|
-
DropdownMenu: () => DropdownMenu,
|
|
66
|
-
DropdownSeparator: () => DropdownSeparator,
|
|
67
|
-
DropdownTrigger: () => DropdownTrigger,
|
|
68
|
-
EmptyState: () => EmptyState,
|
|
69
|
-
Form: () => Form,
|
|
70
|
-
FormControl: () => FormControl,
|
|
71
|
-
FormDescription: () => FormDescription,
|
|
72
|
-
FormField: () => FormField,
|
|
73
|
-
FormItem: () => FormItem,
|
|
74
|
-
FormLabel: () => FormLabel,
|
|
75
|
-
FormMessage: () => FormMessage,
|
|
76
|
-
Input: () => Input,
|
|
77
|
-
Label: () => Label,
|
|
78
|
-
Modal: () => Modal,
|
|
79
|
-
ModalCloseButton: () => ModalCloseButton,
|
|
80
|
-
ModalContent: () => ModalContent,
|
|
81
|
-
ModalFooter: () => ModalFooter,
|
|
82
|
-
ModalHeader: () => ModalHeader,
|
|
83
|
-
ModalTitle: () => ModalTitle,
|
|
84
|
-
NavigationMenu: () => NavigationMenu,
|
|
85
|
-
NavigationMenuContent: () => NavigationMenuContent,
|
|
86
|
-
NavigationMenuItem: () => NavigationMenuItem,
|
|
87
|
-
NavigationMenuLink: () => NavigationMenuLink,
|
|
88
|
-
NavigationMenuTrigger: () => NavigationMenuTrigger,
|
|
89
|
-
NumberInput: () => NumberInput,
|
|
90
|
-
OTPInput: () => OTPInput,
|
|
91
|
-
Pagination: () => Pagination,
|
|
92
|
-
Popover: () => Popover,
|
|
93
|
-
PopoverContent: () => PopoverContent,
|
|
94
|
-
PopoverTrigger: () => PopoverTrigger,
|
|
95
|
-
Progress: () => Progress,
|
|
96
|
-
Radio: () => Radio,
|
|
97
|
-
RadioGroup: () => RadioGroup,
|
|
98
|
-
Select: () => Select,
|
|
99
|
-
Separator: () => Separator,
|
|
100
|
-
Sheet: () => Sheet,
|
|
101
|
-
Sidebar: () => Sidebar,
|
|
102
|
-
Skeleton: () => Skeleton,
|
|
103
|
-
Slider: () => Slider,
|
|
104
|
-
Spinner: () => Spinner,
|
|
105
|
-
Statistic: () => Statistic,
|
|
106
|
-
Steps: () => Steps,
|
|
107
|
-
Switch: () => Switch,
|
|
108
|
-
Table: () => Table,
|
|
109
|
-
TableBody: () => TableBody,
|
|
110
|
-
TableCell: () => TableCell,
|
|
111
|
-
TableHead: () => TableHead,
|
|
112
|
-
TableHeader: () => TableHeader,
|
|
113
|
-
TableRow: () => TableRow,
|
|
114
|
-
Tabs: () => Tabs,
|
|
115
|
-
TabsContent: () => TabsContent,
|
|
116
|
-
TabsList: () => TabsList,
|
|
117
|
-
TabsTrigger: () => TabsTrigger,
|
|
118
|
-
Tag: () => Tag,
|
|
119
|
-
Textarea: () => Textarea,
|
|
120
|
-
Toaster: () => Toaster,
|
|
121
|
-
Tooltip: () => Tooltip,
|
|
122
|
-
TooltipContent: () => TooltipContent,
|
|
123
|
-
TooltipTrigger: () => TooltipTrigger,
|
|
124
|
-
UGAccordion: () => Accordion,
|
|
125
|
-
UGAccordionContent: () => AccordionContent,
|
|
126
|
-
UGAccordionItem: () => AccordionItem,
|
|
127
|
-
UGAccordionTrigger: () => AccordionTrigger,
|
|
128
|
-
UGAlert: () => Alert,
|
|
129
|
-
UGAlertDescription: () => AlertDescription,
|
|
130
|
-
UGAlertTitle: () => AlertTitle,
|
|
131
|
-
UGAvatar: () => Avatar,
|
|
132
|
-
UGAvatarFallback: () => AvatarFallback,
|
|
133
|
-
UGAvatarGroup: () => AvatarGroup,
|
|
134
|
-
UGAvatarImage: () => AvatarImage,
|
|
135
|
-
UGBadge: () => Badge,
|
|
136
|
-
UGBreadcrumb: () => Breadcrumb,
|
|
137
|
-
UGBreadcrumbItem: () => BreadcrumbItem,
|
|
138
|
-
UGBreadcrumbLink: () => BreadcrumbLink,
|
|
139
|
-
UGBreadcrumbSeparator: () => BreadcrumbSeparator,
|
|
140
|
-
UGButton: () => Button,
|
|
141
|
-
UGCard: () => Card,
|
|
142
|
-
UGCardContent: () => CardContent,
|
|
143
|
-
UGCardDescription: () => CardDescription,
|
|
144
|
-
UGCardFooter: () => CardFooter,
|
|
145
|
-
UGCardHeader: () => CardHeader,
|
|
146
|
-
UGCardTitle: () => CardTitle,
|
|
147
|
-
UGCheckbox: () => Checkbox,
|
|
148
|
-
UGContextMenu: () => ContextMenu,
|
|
149
|
-
UGContextMenuContent: () => ContextMenuContent,
|
|
150
|
-
UGContextMenuItem: () => ContextMenuItem,
|
|
151
|
-
UGContextMenuSeparator: () => ContextMenuSeparator,
|
|
152
|
-
UGContextMenuTrigger: () => ContextMenuTrigger,
|
|
153
|
-
UGDescriptions: () => Descriptions,
|
|
154
|
-
UGDescriptionsItem: () => DescriptionsItem,
|
|
155
|
-
UGDialog: () => Dialog,
|
|
156
|
-
UGDrawer: () => Drawer,
|
|
157
|
-
UGDrawerClose: () => DrawerClose,
|
|
158
|
-
UGDrawerContent: () => DrawerContent,
|
|
159
|
-
UGDrawerDescription: () => DrawerDescription,
|
|
160
|
-
UGDrawerFooter: () => DrawerFooter,
|
|
161
|
-
UGDrawerHeader: () => DrawerHeader,
|
|
162
|
-
UGDrawerTitle: () => DrawerTitle,
|
|
163
|
-
UGDropdown: () => DropdownMenu,
|
|
164
|
-
UGDropdownContent: () => DropdownContent,
|
|
165
|
-
UGDropdownItem: () => DropdownItem,
|
|
166
|
-
UGDropdownMenu: () => DropdownMenu,
|
|
167
|
-
UGDropdownSeparator: () => DropdownSeparator,
|
|
168
|
-
UGDropdownTrigger: () => DropdownTrigger,
|
|
169
|
-
UGEmptyState: () => EmptyState,
|
|
170
|
-
UGForm: () => Form,
|
|
171
|
-
UGFormControl: () => FormControl,
|
|
172
|
-
UGFormDescription: () => FormDescription,
|
|
173
|
-
UGFormField: () => FormField,
|
|
174
|
-
UGFormItem: () => FormItem,
|
|
175
|
-
UGFormLabel: () => FormLabel,
|
|
176
|
-
UGFormMessage: () => FormMessage,
|
|
177
|
-
UGInput: () => Input,
|
|
178
|
-
UGLabel: () => Label,
|
|
179
|
-
UGModal: () => Modal,
|
|
180
|
-
UGModalCloseButton: () => ModalCloseButton,
|
|
181
|
-
UGModalContent: () => ModalContent,
|
|
182
|
-
UGModalFooter: () => ModalFooter,
|
|
183
|
-
UGModalHeader: () => ModalHeader,
|
|
184
|
-
UGModalTitle: () => ModalTitle,
|
|
185
|
-
UGNavigationMenu: () => NavigationMenu,
|
|
186
|
-
UGNavigationMenuContent: () => NavigationMenuContent,
|
|
187
|
-
UGNavigationMenuItem: () => NavigationMenuItem,
|
|
188
|
-
UGNavigationMenuLink: () => NavigationMenuLink,
|
|
189
|
-
UGNavigationMenuTrigger: () => NavigationMenuTrigger,
|
|
190
|
-
UGNumberInput: () => NumberInput,
|
|
191
|
-
UGOTPInput: () => OTPInput,
|
|
192
|
-
UGPagination: () => Pagination,
|
|
193
|
-
UGPopover: () => Popover,
|
|
194
|
-
UGPopoverContent: () => PopoverContent,
|
|
195
|
-
UGPopoverTrigger: () => PopoverTrigger,
|
|
196
|
-
UGProgress: () => Progress,
|
|
197
|
-
UGRadio: () => Radio,
|
|
198
|
-
UGRadioGroup: () => RadioGroup,
|
|
199
|
-
UGSelect: () => Select,
|
|
200
|
-
UGSeparator: () => Separator,
|
|
201
|
-
UGSheet: () => Sheet,
|
|
202
|
-
UGSidebar: () => Sidebar,
|
|
203
|
-
UGSkeleton: () => Skeleton,
|
|
204
|
-
UGSlider: () => Slider,
|
|
205
|
-
UGSpinner: () => Spinner,
|
|
206
|
-
UGStatistic: () => Statistic,
|
|
207
|
-
UGSteps: () => Steps,
|
|
208
|
-
UGSwitch: () => Switch,
|
|
209
|
-
UGTable: () => Table,
|
|
210
|
-
UGTableBody: () => TableBody,
|
|
211
|
-
UGTableCell: () => TableCell,
|
|
212
|
-
UGTableHead: () => TableHead,
|
|
213
|
-
UGTableHeader: () => TableHeader,
|
|
214
|
-
UGTableRow: () => TableRow,
|
|
215
|
-
UGTabs: () => Tabs,
|
|
216
|
-
UGTabsContent: () => TabsContent,
|
|
217
|
-
UGTabsList: () => TabsList,
|
|
218
|
-
UGTabsTrigger: () => TabsTrigger,
|
|
219
|
-
UGTag: () => Tag,
|
|
220
|
-
UGTextarea: () => Textarea,
|
|
221
|
-
UGToaster: () => Toaster,
|
|
222
|
-
UGTooltip: () => Tooltip,
|
|
223
|
-
UGTooltipContent: () => TooltipContent,
|
|
224
|
-
UGTooltipTrigger: () => TooltipTrigger,
|
|
225
|
-
badgeVariants: () => badgeVariants,
|
|
226
|
-
buttonVariants: () => buttonVariants,
|
|
227
|
-
checkboxVariants: () => checkboxVariants,
|
|
228
|
-
cn: () => cn,
|
|
229
|
-
numberInputVariants: () => numberInputVariants,
|
|
230
|
-
reactComponentLayers: () => reactComponentLayers,
|
|
231
|
-
tagVariants: () => tagVariants,
|
|
232
|
-
theme: () => theme,
|
|
233
|
-
toast: () => toast,
|
|
234
|
-
ugBadgeVariants: () => badgeVariants,
|
|
235
|
-
ugButtonVariants: () => buttonVariants,
|
|
236
|
-
ugCheckboxVariants: () => checkboxVariants,
|
|
237
|
-
ugNumberInputVariants: () => numberInputVariants,
|
|
238
|
-
ugTagVariants: () => tagVariants,
|
|
239
|
-
useClickOutside: () => useClickOutside,
|
|
240
|
-
useCopyToClipboard: () => useCopyToClipboard,
|
|
241
|
-
useDebounce: () => useDebounce,
|
|
242
|
-
useEventListener: () => useEventListener,
|
|
243
|
-
useForm: () => useForm,
|
|
244
|
-
useHotkeys: () => useHotkeys,
|
|
245
|
-
useInterval: () => useInterval,
|
|
246
|
-
useLocalStorage: () => useLocalStorage,
|
|
247
|
-
useMediaQuery: () => useMediaQuery,
|
|
248
|
-
useMounted: () => useMounted,
|
|
249
|
-
usePagination: () => usePagination,
|
|
250
|
-
useTimeout: () => useTimeout,
|
|
251
|
-
useToggle: () => useToggle
|
|
252
|
-
});
|
|
253
|
-
module.exports = __toCommonJS(index_exports);
|
|
254
|
-
|
|
255
|
-
// src/components/button.tsx
|
|
256
|
-
var import_react = require("react");
|
|
257
|
-
var import_lucide_react = require("lucide-react");
|
|
258
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
259
|
-
|
|
260
|
-
// src/internal/cn.ts
|
|
261
|
-
var import_clsx = require("clsx");
|
|
262
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
263
|
-
function cn(...inputs) {
|
|
264
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// src/components/button.tsx
|
|
268
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
269
|
-
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
270
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-[background,border-color,color,box-shadow,transform] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
271
|
-
{
|
|
272
|
-
variants: {
|
|
273
|
-
variant: {
|
|
274
|
-
default: "bg-primary text-primary-fg shadow-sm hover:bg-primary-hover hover:shadow-md focus-visible:ring-ring",
|
|
275
|
-
destructive: "bg-danger text-danger-fg shadow-sm hover:bg-danger-hover hover:shadow-md focus-visible:ring-danger",
|
|
276
|
-
outline: "border border-border-strong bg-surface-1 text-text-primary shadow-sm hover:border-primary/55 hover:bg-surface-2 focus-visible:ring-ring/30",
|
|
277
|
-
secondary: "border border-border-base bg-surface-2 text-text-primary shadow-sm hover:bg-surface-3 focus-visible:ring-ring/30",
|
|
278
|
-
ghost: "text-text-primary hover:bg-surface-2 focus-visible:ring-ring/30",
|
|
279
|
-
link: "text-text-primary underline-offset-4 hover:underline focus-visible:ring-ring/30"
|
|
280
|
-
},
|
|
281
|
-
size: {
|
|
282
|
-
default: "h-9 px-4 py-2",
|
|
283
|
-
sm: "h-8 px-3 text-xs",
|
|
284
|
-
lg: "h-11 px-5 text-base",
|
|
285
|
-
icon: "h-9 w-9"
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
defaultVariants: {
|
|
289
|
-
variant: "default",
|
|
290
|
-
size: "default"
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
var Button = (0, import_react.forwardRef)(
|
|
295
|
-
({ className, variant, size, loading = false, disabled, children, ...props }, ref) => {
|
|
296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
297
|
-
"button",
|
|
298
|
-
{
|
|
299
|
-
ref,
|
|
300
|
-
className: cn(buttonVariants({ variant, size }), className),
|
|
301
|
-
disabled: disabled || loading,
|
|
302
|
-
...props,
|
|
303
|
-
children: [
|
|
304
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "animate-spin", size: 16 }),
|
|
305
|
-
children
|
|
306
|
-
]
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
Button.displayName = "Button";
|
|
312
|
-
|
|
313
|
-
// src/components/input.tsx
|
|
314
|
-
var import_react2 = require("react");
|
|
315
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
316
|
-
var Input = (0, import_react2.forwardRef)(
|
|
317
|
-
({ className, label, error, helperText, id, ...props }, ref) => {
|
|
318
|
-
const generatedId = (0, import_react2.useId)();
|
|
319
|
-
const inputId = id ?? generatedId;
|
|
320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
321
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
322
|
-
"label",
|
|
323
|
-
{
|
|
324
|
-
htmlFor: inputId,
|
|
325
|
-
className: "text-sm font-medium text-text-primary",
|
|
326
|
-
children: label
|
|
327
|
-
}
|
|
328
|
-
),
|
|
329
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
330
|
-
"input",
|
|
331
|
-
{
|
|
332
|
-
ref,
|
|
333
|
-
id: inputId,
|
|
334
|
-
className: cn(
|
|
335
|
-
"flex h-9 w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
|
|
336
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
337
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
338
|
-
error ? "border-danger focus-visible:ring-danger" : "border-border-strong focus-visible:ring-ring/30",
|
|
339
|
-
className
|
|
340
|
-
),
|
|
341
|
-
...props
|
|
342
|
-
}
|
|
343
|
-
),
|
|
344
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-danger", children: error }),
|
|
345
|
-
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
|
|
346
|
-
] });
|
|
347
|
-
}
|
|
348
|
-
);
|
|
349
|
-
Input.displayName = "Input";
|
|
350
|
-
|
|
351
|
-
// src/components/label.tsx
|
|
352
|
-
var import_react3 = require("react");
|
|
353
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
354
|
-
var Label = (0, import_react3.forwardRef)(({ className, required, children, ...props }, ref) => {
|
|
355
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
356
|
-
"label",
|
|
357
|
-
{
|
|
358
|
-
ref,
|
|
359
|
-
className: cn(
|
|
360
|
-
"leading-none text-sm font-medium text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
361
|
-
className
|
|
362
|
-
),
|
|
363
|
-
...props,
|
|
364
|
-
children: [
|
|
365
|
-
children,
|
|
366
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "ml-0.5 text-danger", "aria-hidden": "true", children: "*" })
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
});
|
|
371
|
-
Label.displayName = "Label";
|
|
372
|
-
|
|
373
|
-
// src/components/card.tsx
|
|
374
|
-
var import_react4 = require("react");
|
|
375
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
376
|
-
var Card = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
377
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("rounded-lg border border-border-base bg-surface-1 shadow-sm", className), ...props });
|
|
378
|
-
});
|
|
379
|
-
var CardHeader = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
380
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex flex-col gap-1 px-5 py-4 border-b border-border-base", className), ...props });
|
|
381
|
-
});
|
|
382
|
-
var CardTitle = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { ref, className: cn("leading-none font-semibold text-text-primary", className), ...props });
|
|
384
|
-
});
|
|
385
|
-
var CardDescription = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
|
|
387
|
-
});
|
|
388
|
-
var CardContent = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("px-5 py-4", className), ...props });
|
|
390
|
-
});
|
|
391
|
-
var CardFooter = (0, import_react4.forwardRef)(({ className, ...props }, ref) => {
|
|
392
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("flex items-center px-5 py-4 border-t border-border-base", className), ...props });
|
|
393
|
-
});
|
|
394
|
-
Card.displayName = "Card";
|
|
395
|
-
CardHeader.displayName = "CardHeader";
|
|
396
|
-
CardTitle.displayName = "CardTitle";
|
|
397
|
-
CardDescription.displayName = "CardDescription";
|
|
398
|
-
CardContent.displayName = "CardContent";
|
|
399
|
-
CardFooter.displayName = "CardFooter";
|
|
400
|
-
|
|
401
|
-
// src/components/badge.tsx
|
|
402
|
-
var import_react5 = require("react");
|
|
403
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
404
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
405
|
-
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
406
|
-
"inline-flex min-h-6 items-center rounded-md px-2.5 py-0.5 text-xs font-semibold leading-none transition-colors",
|
|
407
|
-
{
|
|
408
|
-
variants: {
|
|
409
|
-
variant: {
|
|
410
|
-
default: "border border-primary/20 bg-primary-soft text-primary-soft-fg",
|
|
411
|
-
secondary: "border border-border-base bg-surface-2 text-text-primary",
|
|
412
|
-
destructive: "border border-danger/20 bg-danger-soft text-danger-soft-fg",
|
|
413
|
-
outline: "border border-border-strong bg-transparent text-text-primary",
|
|
414
|
-
success: "border border-success/20 bg-success-soft text-success-soft-fg",
|
|
415
|
-
warning: "border border-warning/20 bg-warning-soft text-warning-soft-fg"
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
defaultVariants: {
|
|
419
|
-
variant: "default"
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
);
|
|
423
|
-
var Badge = (0, import_react5.forwardRef)(({ className, variant, ...props }, ref) => {
|
|
424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref, className: cn(badgeVariants({ variant }), className), ...props });
|
|
425
|
-
});
|
|
426
|
-
Badge.displayName = "Badge";
|
|
427
|
-
|
|
428
|
-
// src/components/tag.tsx
|
|
429
|
-
var import_react6 = require("react");
|
|
430
|
-
var import_lucide_react2 = require("lucide-react");
|
|
431
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
432
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
433
|
-
var tagVariants = (0, import_class_variance_authority3.cva)(
|
|
434
|
-
"inline-flex items-center gap-1.5 rounded-md border font-medium leading-none transition-colors",
|
|
435
|
-
{
|
|
436
|
-
variants: {
|
|
437
|
-
variant: {
|
|
438
|
-
default: "border-border-base bg-surface-2 text-text-primary",
|
|
439
|
-
primary: "border-primary/20 bg-primary-soft text-primary-soft-fg",
|
|
440
|
-
success: "border-success/20 bg-success-soft text-success-soft-fg",
|
|
441
|
-
warning: "border-warning/20 bg-warning-soft text-warning-soft-fg",
|
|
442
|
-
destructive: "border-danger/20 bg-danger-soft text-danger-soft-fg",
|
|
443
|
-
outline: "border-border-strong bg-transparent text-text-primary"
|
|
444
|
-
},
|
|
445
|
-
size: {
|
|
446
|
-
sm: "min-h-6 px-2 text-[11px]",
|
|
447
|
-
default: "min-h-7 px-2.5 text-xs"
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
defaultVariants: {
|
|
451
|
-
variant: "default",
|
|
452
|
-
size: "default"
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
);
|
|
456
|
-
var Tag = (0, import_react6.forwardRef)(
|
|
457
|
-
({ variant, size, closable = false, disabled = false, color, onClose, className, children, style, ...props }, ref) => {
|
|
458
|
-
const customStyle = color ? { backgroundColor: color, color: "hsl(var(--primary-fg))", borderColor: color, ...style } : style ?? {};
|
|
459
|
-
function handleClose(event) {
|
|
460
|
-
event.stopPropagation();
|
|
461
|
-
if (!disabled) {
|
|
462
|
-
onClose?.(event);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
466
|
-
"span",
|
|
467
|
-
{
|
|
468
|
-
ref,
|
|
469
|
-
className: cn(tagVariants({ variant, size }), disabled && "cursor-not-allowed opacity-50", className),
|
|
470
|
-
style: customStyle,
|
|
471
|
-
...props,
|
|
472
|
-
children: [
|
|
473
|
-
children,
|
|
474
|
-
closable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
475
|
-
"button",
|
|
476
|
-
{
|
|
477
|
-
type: "button",
|
|
478
|
-
onClick: handleClose,
|
|
479
|
-
disabled,
|
|
480
|
-
className: "-mr-1 inline-flex h-4 w-4 items-center justify-center rounded-sm opacity-70 transition hover:bg-surface-3 hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:pointer-events-none",
|
|
481
|
-
"aria-label": "\u5173\u95ED\u6807\u7B7E",
|
|
482
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.X, { size: 10, strokeWidth: 2.5 })
|
|
483
|
-
}
|
|
484
|
-
)
|
|
485
|
-
]
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
);
|
|
490
|
-
Tag.displayName = "Tag";
|
|
491
|
-
|
|
492
|
-
// src/components/modal.tsx
|
|
493
|
-
var import_react9 = require("react");
|
|
494
|
-
var import_react_dom = require("react-dom");
|
|
495
|
-
var import_lucide_react3 = require("lucide-react");
|
|
496
|
-
|
|
497
|
-
// src/hooks/use-escape-key.ts
|
|
498
|
-
var import_react7 = require("react");
|
|
499
|
-
function useEscapeKey(open, onEscape) {
|
|
500
|
-
const handleEscape = (0, import_react7.useCallback)(
|
|
501
|
-
(e) => {
|
|
502
|
-
if (e.key === "Escape") onEscape();
|
|
503
|
-
},
|
|
504
|
-
[onEscape]
|
|
505
|
-
);
|
|
506
|
-
(0, import_react7.useEffect)(() => {
|
|
507
|
-
if (!open || typeof document === "undefined") return;
|
|
508
|
-
document.addEventListener("keydown", handleEscape);
|
|
509
|
-
document.body.style.overflow = "hidden";
|
|
510
|
-
return () => {
|
|
511
|
-
document.removeEventListener("keydown", handleEscape);
|
|
512
|
-
document.body.style.overflow = "";
|
|
513
|
-
};
|
|
514
|
-
}, [open, handleEscape]);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
// src/internal/use-portal-container.ts
|
|
518
|
-
var import_react8 = require("react");
|
|
519
|
-
function usePortalContainer() {
|
|
520
|
-
const [container, setContainer] = (0, import_react8.useState)(null);
|
|
521
|
-
(0, import_react8.useEffect)(() => {
|
|
522
|
-
if (typeof document === "undefined") return;
|
|
523
|
-
setContainer(document.body);
|
|
524
|
-
}, []);
|
|
525
|
-
return container;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
// src/components/modal.tsx
|
|
529
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
530
|
-
var Modal = (0, import_react9.forwardRef)(({ open, onClose, children, className }, ref) => {
|
|
531
|
-
useEscapeKey(open, onClose);
|
|
532
|
-
const portalContainer = usePortalContainer();
|
|
533
|
-
if (!open || !portalContainer) return null;
|
|
534
|
-
return (0, import_react_dom.createPortal)(
|
|
535
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
536
|
-
"div",
|
|
537
|
-
{
|
|
538
|
-
ref,
|
|
539
|
-
className: cn(
|
|
540
|
-
"fixed inset-0 z-[80] flex items-center justify-center p-4",
|
|
541
|
-
className
|
|
542
|
-
),
|
|
543
|
-
role: "dialog",
|
|
544
|
-
"aria-modal": "true",
|
|
545
|
-
children: [
|
|
546
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
className: "absolute inset-0 bg-overlay",
|
|
550
|
-
onClick: onClose,
|
|
551
|
-
"aria-hidden": "true"
|
|
552
|
-
}
|
|
553
|
-
),
|
|
554
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "relative z-10", children })
|
|
555
|
-
]
|
|
556
|
-
}
|
|
557
|
-
),
|
|
558
|
-
portalContainer
|
|
559
|
-
);
|
|
560
|
-
});
|
|
561
|
-
var ModalContent = (0, import_react9.forwardRef)(({ className, maxWidth = "max-w-lg", children, ...props }, ref) => {
|
|
562
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex max-h-[85vh] w-full flex-col rounded-lg border border-border-base bg-surface-1 shadow-xl", maxWidth, className), ...props, children });
|
|
563
|
-
});
|
|
564
|
-
var ModalHeader = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
|
|
565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex shrink-0 items-center justify-between border-b border-border-base px-6 py-4", className), ...props });
|
|
566
|
-
});
|
|
567
|
-
var ModalTitle = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
|
|
568
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { ref, className: cn("text-lg font-semibold text-text-primary", className), ...props });
|
|
569
|
-
});
|
|
570
|
-
var ModalFooter = (0, import_react9.forwardRef)(({ className, ...props }, ref) => {
|
|
571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("flex shrink-0 items-center justify-end gap-2 border-t border-border-base px-6 py-4", className), ...props });
|
|
572
|
-
});
|
|
573
|
-
var ModalCloseButton = (0, import_react9.forwardRef)(({ onClick, className, type = "button", ...props }, ref) => {
|
|
574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
575
|
-
"button",
|
|
576
|
-
{
|
|
577
|
-
ref,
|
|
578
|
-
type,
|
|
579
|
-
onClick,
|
|
580
|
-
className: cn(
|
|
581
|
-
"rounded-md p-1 text-text-tertiary transition-colors hover:bg-surface-3 hover:text-text-secondary",
|
|
582
|
-
className
|
|
583
|
-
),
|
|
584
|
-
"aria-label": "\u5173\u95ED",
|
|
585
|
-
...props,
|
|
586
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.X, { size: 18 })
|
|
587
|
-
}
|
|
588
|
-
);
|
|
589
|
-
});
|
|
590
|
-
Modal.displayName = "Modal";
|
|
591
|
-
ModalContent.displayName = "ModalContent";
|
|
592
|
-
ModalHeader.displayName = "ModalHeader";
|
|
593
|
-
ModalTitle.displayName = "ModalTitle";
|
|
594
|
-
ModalFooter.displayName = "ModalFooter";
|
|
595
|
-
ModalCloseButton.displayName = "ModalCloseButton";
|
|
596
|
-
|
|
597
|
-
// src/components/dialog.tsx
|
|
598
|
-
var import_react10 = require("react");
|
|
599
|
-
var import_react_dom2 = require("react-dom");
|
|
600
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
601
|
-
var CONFIRM_VARIANT_CLASSES = {
|
|
602
|
-
default: "bg-primary text-primary-fg hover:bg-primary-hover focus-visible:ring-ring",
|
|
603
|
-
destructive: "bg-danger text-danger-fg hover:bg-danger-hover focus-visible:ring-danger"
|
|
604
|
-
};
|
|
605
|
-
var Dialog = (0, import_react10.forwardRef)(
|
|
606
|
-
({
|
|
607
|
-
open,
|
|
608
|
-
onOpenChange,
|
|
609
|
-
title,
|
|
610
|
-
description,
|
|
611
|
-
variant = "default",
|
|
612
|
-
cancelText = "\u53D6\u6D88",
|
|
613
|
-
confirmText = "\u786E\u8BA4",
|
|
614
|
-
onConfirm,
|
|
615
|
-
onCancel,
|
|
616
|
-
className
|
|
617
|
-
}, ref) => {
|
|
618
|
-
const portalContainer = usePortalContainer();
|
|
619
|
-
const handleClose = (0, import_react10.useCallback)(() => {
|
|
620
|
-
onOpenChange(false);
|
|
621
|
-
}, [onOpenChange]);
|
|
622
|
-
const handleCancel = (0, import_react10.useCallback)(() => {
|
|
623
|
-
onCancel?.();
|
|
624
|
-
handleClose();
|
|
625
|
-
}, [onCancel, handleClose]);
|
|
626
|
-
const handleConfirm = (0, import_react10.useCallback)(() => {
|
|
627
|
-
onConfirm?.();
|
|
628
|
-
handleClose();
|
|
629
|
-
}, [onConfirm, handleClose]);
|
|
630
|
-
useEscapeKey(open, handleCancel);
|
|
631
|
-
if (!open || !portalContainer) return null;
|
|
632
|
-
return (0, import_react_dom2.createPortal)(
|
|
633
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
634
|
-
"div",
|
|
635
|
-
{
|
|
636
|
-
ref,
|
|
637
|
-
className: cn(
|
|
638
|
-
"fixed inset-0 z-[90] flex items-center justify-center p-4",
|
|
639
|
-
className
|
|
640
|
-
),
|
|
641
|
-
role: "alertdialog",
|
|
642
|
-
"aria-modal": "true",
|
|
643
|
-
"aria-labelledby": "dialog-title",
|
|
644
|
-
"aria-describedby": description ? "dialog-description" : void 0,
|
|
645
|
-
children: [
|
|
646
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
647
|
-
"div",
|
|
648
|
-
{
|
|
649
|
-
className: "absolute inset-0 bg-overlay",
|
|
650
|
-
onClick: handleCancel,
|
|
651
|
-
"aria-hidden": "true"
|
|
652
|
-
}
|
|
653
|
-
),
|
|
654
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative z-10 w-full max-w-sm rounded-lg border border-border-base bg-surface-1 shadow-xl", children: [
|
|
655
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "px-6 pt-6 pb-4", children: [
|
|
656
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
657
|
-
"h2",
|
|
658
|
-
{
|
|
659
|
-
id: "dialog-title",
|
|
660
|
-
className: "text-base font-bold text-text-primary",
|
|
661
|
-
children: title
|
|
662
|
-
}
|
|
663
|
-
),
|
|
664
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
665
|
-
"p",
|
|
666
|
-
{
|
|
667
|
-
id: "dialog-description",
|
|
668
|
-
className: "mt-2 text-sm text-text-secondary",
|
|
669
|
-
children: description
|
|
670
|
-
}
|
|
671
|
-
)
|
|
672
|
-
] }),
|
|
673
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-end gap-2 border-t border-border-subtle px-6 py-4", children: [
|
|
674
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
675
|
-
"button",
|
|
676
|
-
{
|
|
677
|
-
type: "button",
|
|
678
|
-
onClick: handleCancel,
|
|
679
|
-
className: cn(
|
|
680
|
-
"inline-flex h-9 items-center justify-center rounded-md border border-border-strong bg-surface-1 px-4 text-sm font-medium text-text-secondary transition-colors",
|
|
681
|
-
"hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring/30"
|
|
682
|
-
),
|
|
683
|
-
children: cancelText
|
|
684
|
-
}
|
|
685
|
-
),
|
|
686
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
687
|
-
"button",
|
|
688
|
-
{
|
|
689
|
-
type: "button",
|
|
690
|
-
onClick: handleConfirm,
|
|
691
|
-
className: cn(
|
|
692
|
-
"inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors",
|
|
693
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
694
|
-
CONFIRM_VARIANT_CLASSES[variant]
|
|
695
|
-
),
|
|
696
|
-
children: confirmText
|
|
697
|
-
}
|
|
698
|
-
)
|
|
699
|
-
] })
|
|
700
|
-
] })
|
|
701
|
-
]
|
|
702
|
-
}
|
|
703
|
-
),
|
|
704
|
-
portalContainer
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
);
|
|
708
|
-
Dialog.displayName = "Dialog";
|
|
709
|
-
|
|
710
|
-
// src/components/drawer.tsx
|
|
711
|
-
var import_react11 = require("react");
|
|
712
|
-
var import_react_dom3 = require("react-dom");
|
|
713
|
-
var import_lucide_react4 = require("lucide-react");
|
|
714
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
715
|
-
var DrawerContext = (0, import_react11.createContext)(null);
|
|
716
|
-
function useDrawerContext() {
|
|
717
|
-
const ctx = (0, import_react11.useContext)(DrawerContext);
|
|
718
|
-
if (!ctx) throw new Error("Drawer \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Drawer> \u5185\u4F7F\u7528");
|
|
719
|
-
return ctx;
|
|
720
|
-
}
|
|
721
|
-
var SIDE_CLASSES = {
|
|
722
|
-
right: "inset-y-0 right-0 h-full w-80 max-w-full translate-x-0",
|
|
723
|
-
left: "inset-y-0 left-0 h-full w-80 max-w-full translate-x-0",
|
|
724
|
-
top: "inset-x-0 top-0 w-full h-auto max-h-[80vh] translate-y-0",
|
|
725
|
-
bottom: "inset-x-0 bottom-0 w-full h-auto max-h-[80vh] translate-y-0"
|
|
726
|
-
};
|
|
727
|
-
var Drawer = ({ open, onOpenChange, side = "right", children }) => {
|
|
728
|
-
useEscapeKey(open, () => onOpenChange(false));
|
|
729
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DrawerContext.Provider, { value: { open, onOpenChange, side }, children });
|
|
730
|
-
};
|
|
731
|
-
Drawer.displayName = "Drawer";
|
|
732
|
-
var DrawerContent = (0, import_react11.forwardRef)(({ className, children, ...props }, ref) => {
|
|
733
|
-
const { open, onOpenChange, side } = useDrawerContext();
|
|
734
|
-
const portalContainer = usePortalContainer();
|
|
735
|
-
if (!open || !portalContainer) return null;
|
|
736
|
-
return (0, import_react_dom3.createPortal)(
|
|
737
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fixed inset-0 z-50", role: "dialog", "aria-modal": "true", children: [
|
|
738
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
739
|
-
"div",
|
|
740
|
-
{
|
|
741
|
-
className: "absolute inset-0 bg-overlay transition-opacity",
|
|
742
|
-
onClick: () => onOpenChange(false),
|
|
743
|
-
"aria-hidden": "true"
|
|
744
|
-
}
|
|
745
|
-
),
|
|
746
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
747
|
-
"div",
|
|
748
|
-
{
|
|
749
|
-
ref,
|
|
750
|
-
className: cn(
|
|
751
|
-
"absolute flex flex-col bg-surface-1 shadow-xl transition-transform duration-300 ease-in-out",
|
|
752
|
-
SIDE_CLASSES[side],
|
|
753
|
-
className
|
|
754
|
-
),
|
|
755
|
-
onClick: (e) => e.stopPropagation(),
|
|
756
|
-
...props,
|
|
757
|
-
children
|
|
758
|
-
}
|
|
759
|
-
)
|
|
760
|
-
] }),
|
|
761
|
-
portalContainer
|
|
762
|
-
);
|
|
763
|
-
});
|
|
764
|
-
DrawerContent.displayName = "DrawerContent";
|
|
765
|
-
var DrawerHeader = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
|
|
766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
767
|
-
"div",
|
|
768
|
-
{
|
|
769
|
-
ref,
|
|
770
|
-
className: cn("flex flex-col gap-1.5 border-b border-border-base px-6 py-4", className),
|
|
771
|
-
...props
|
|
772
|
-
}
|
|
773
|
-
);
|
|
774
|
-
});
|
|
775
|
-
DrawerHeader.displayName = "DrawerHeader";
|
|
776
|
-
var DrawerTitle = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
|
|
777
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { ref, className: cn("text-lg font-semibold text-text-primary", className), ...props });
|
|
778
|
-
});
|
|
779
|
-
DrawerTitle.displayName = "DrawerTitle";
|
|
780
|
-
var DrawerDescription = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
|
|
781
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { ref, className: cn("text-sm text-text-secondary", className), ...props });
|
|
782
|
-
});
|
|
783
|
-
DrawerDescription.displayName = "DrawerDescription";
|
|
784
|
-
var DrawerFooter = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
|
|
785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
786
|
-
"div",
|
|
787
|
-
{
|
|
788
|
-
ref,
|
|
789
|
-
className: cn("mt-auto flex items-center justify-end gap-2 border-t border-border-base px-6 py-4", className),
|
|
790
|
-
...props
|
|
791
|
-
}
|
|
792
|
-
);
|
|
793
|
-
});
|
|
794
|
-
DrawerFooter.displayName = "DrawerFooter";
|
|
795
|
-
var DrawerClose = (0, import_react11.forwardRef)(({ className, children, type = "button", ...props }, ref) => {
|
|
796
|
-
const { onOpenChange } = useDrawerContext();
|
|
797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
798
|
-
"button",
|
|
799
|
-
{
|
|
800
|
-
ref,
|
|
801
|
-
type,
|
|
802
|
-
onClick: () => onOpenChange(false),
|
|
803
|
-
className: cn(
|
|
804
|
-
"inline-flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium text-text-secondary transition-colors hover:bg-surface-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30",
|
|
805
|
-
className
|
|
806
|
-
),
|
|
807
|
-
...props,
|
|
808
|
-
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.X, { size: 18 })
|
|
809
|
-
}
|
|
810
|
-
);
|
|
811
|
-
});
|
|
812
|
-
DrawerClose.displayName = "DrawerClose";
|
|
813
|
-
|
|
814
|
-
// src/components/table.tsx
|
|
815
|
-
var import_react12 = require("react");
|
|
816
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
817
|
-
var Table = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
818
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
819
|
-
"table",
|
|
820
|
-
{
|
|
821
|
-
ref,
|
|
822
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
823
|
-
...props
|
|
824
|
-
}
|
|
825
|
-
) });
|
|
826
|
-
});
|
|
827
|
-
var TableHeader = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
828
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { ref, className: cn("[&_tr]:border-b border-border-base", className), ...props });
|
|
829
|
-
});
|
|
830
|
-
var TableBody = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
831
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
|
|
832
|
-
});
|
|
833
|
-
var TableRow = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
834
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ref, className: cn("border-b border-border-base transition-colors hover:bg-surface-2", className), ...props });
|
|
835
|
-
});
|
|
836
|
-
var TableHead = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { ref, className: cn("h-10 px-4 text-left align-middle font-medium text-text-secondary [&:has([role=checkbox])]:pr-0", className), ...props });
|
|
838
|
-
});
|
|
839
|
-
var TableCell = (0, import_react12.forwardRef)(({ className, ...props }, ref) => {
|
|
840
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ref, className: cn("px-4 py-3 align-middle text-text-primary [&:has([role=checkbox])]:pr-0", className), ...props });
|
|
841
|
-
});
|
|
842
|
-
Table.displayName = "Table";
|
|
843
|
-
TableHeader.displayName = "TableHeader";
|
|
844
|
-
TableBody.displayName = "TableBody";
|
|
845
|
-
TableRow.displayName = "TableRow";
|
|
846
|
-
TableHead.displayName = "TableHead";
|
|
847
|
-
TableCell.displayName = "TableCell";
|
|
848
|
-
|
|
849
|
-
// src/components/toast.tsx
|
|
850
|
-
var import_react13 = require("react");
|
|
851
|
-
var import_react_dom4 = require("react-dom");
|
|
852
|
-
var import_lucide_react5 = require("lucide-react");
|
|
853
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
854
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
855
|
-
var toastItems = [];
|
|
856
|
-
var toastTimers = /* @__PURE__ */ new Map();
|
|
857
|
-
function notify() {
|
|
858
|
-
listeners.forEach((fn) => fn([...toastItems]));
|
|
859
|
-
}
|
|
860
|
-
function addToast(message, type) {
|
|
861
|
-
const id = Math.random().toString(36).slice(2);
|
|
862
|
-
toastItems = [...toastItems, { id, message, type }];
|
|
863
|
-
notify();
|
|
864
|
-
const timer = setTimeout(() => removeToast(id), 3e3);
|
|
865
|
-
toastTimers.set(id, timer);
|
|
866
|
-
}
|
|
867
|
-
function removeToast(id) {
|
|
868
|
-
const timer = toastTimers.get(id);
|
|
869
|
-
if (timer) {
|
|
870
|
-
clearTimeout(timer);
|
|
871
|
-
toastTimers.delete(id);
|
|
872
|
-
}
|
|
873
|
-
toastItems = toastItems.filter((t) => t.id !== id);
|
|
874
|
-
notify();
|
|
875
|
-
}
|
|
876
|
-
var toast = {
|
|
877
|
-
success: (message) => addToast(message, "success"),
|
|
878
|
-
error: (message) => addToast(message, "error"),
|
|
879
|
-
info: (message) => addToast(message, "info")
|
|
880
|
-
};
|
|
881
|
-
var typeStyles = {
|
|
882
|
-
success: "bg-success-soft border-success/30 text-success-soft-fg",
|
|
883
|
-
error: "bg-danger-soft border-danger/30 text-danger-soft-fg",
|
|
884
|
-
info: "bg-info-soft border-info/30 text-info-soft-fg"
|
|
885
|
-
};
|
|
886
|
-
var typeLabel = {
|
|
887
|
-
success: "\u6210\u529F",
|
|
888
|
-
error: "\u9519\u8BEF",
|
|
889
|
-
info: "\u63D0\u793A"
|
|
890
|
-
};
|
|
891
|
-
var Toaster = (0, import_react13.forwardRef)(({ className, ...props }, ref) => {
|
|
892
|
-
const [items, setItems] = (0, import_react13.useState)([]);
|
|
893
|
-
const mountedRef = (0, import_react13.useRef)(true);
|
|
894
|
-
const portalContainer = usePortalContainer();
|
|
895
|
-
const handleUpdate = (0, import_react13.useCallback)((next) => {
|
|
896
|
-
if (mountedRef.current) {
|
|
897
|
-
setItems(next);
|
|
898
|
-
}
|
|
899
|
-
}, []);
|
|
900
|
-
(0, import_react13.useEffect)(() => {
|
|
901
|
-
listeners.add(handleUpdate);
|
|
902
|
-
return () => {
|
|
903
|
-
mountedRef.current = false;
|
|
904
|
-
listeners.delete(handleUpdate);
|
|
905
|
-
};
|
|
906
|
-
}, [handleUpdate]);
|
|
907
|
-
if (items.length === 0 || !portalContainer) return null;
|
|
908
|
-
return (0, import_react_dom4.createPortal)(
|
|
909
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
910
|
-
"div",
|
|
911
|
-
{
|
|
912
|
-
ref,
|
|
913
|
-
className: cn("fixed top-4 right-4 z-[9999] flex w-80 flex-col gap-2", className),
|
|
914
|
-
role: "region",
|
|
915
|
-
"aria-label": "\u901A\u77E5",
|
|
916
|
-
...props,
|
|
917
|
-
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
918
|
-
"div",
|
|
919
|
-
{
|
|
920
|
-
className: cn(
|
|
921
|
-
"flex items-start justify-between gap-2 rounded-md border px-4 py-3 text-sm shadow-md",
|
|
922
|
-
typeStyles[item.type]
|
|
923
|
-
),
|
|
924
|
-
role: "alert",
|
|
925
|
-
children: [
|
|
926
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
927
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "font-semibold", children: [
|
|
928
|
-
typeLabel[item.type],
|
|
929
|
-
"\uFF1A"
|
|
930
|
-
] }),
|
|
931
|
-
item.message
|
|
932
|
-
] }),
|
|
933
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
934
|
-
"button",
|
|
935
|
-
{
|
|
936
|
-
type: "button",
|
|
937
|
-
onClick: () => removeToast(item.id),
|
|
938
|
-
className: "mt-0.5 shrink-0 opacity-60 hover:opacity-100 transition-opacity",
|
|
939
|
-
"aria-label": "\u5173\u95ED\u901A\u77E5",
|
|
940
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.X, { size: 14 })
|
|
941
|
-
}
|
|
942
|
-
)
|
|
943
|
-
]
|
|
944
|
-
},
|
|
945
|
-
item.id
|
|
946
|
-
))
|
|
947
|
-
}
|
|
948
|
-
),
|
|
949
|
-
portalContainer
|
|
950
|
-
);
|
|
951
|
-
});
|
|
952
|
-
Toaster.displayName = "Toaster";
|
|
953
|
-
|
|
954
|
-
// src/components/sidebar.tsx
|
|
955
|
-
var import_react14 = require("react");
|
|
956
|
-
var import_lucide_react6 = require("lucide-react");
|
|
957
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
958
|
-
var variantStyles = {
|
|
959
|
-
primary: {
|
|
960
|
-
container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
|
|
961
|
-
active: "bg-primary/10 text-primary shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-6 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-primary",
|
|
962
|
-
inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
|
|
963
|
-
divider: "border-border-base",
|
|
964
|
-
icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
|
|
965
|
-
activeIcon: "bg-primary/15 text-primary"
|
|
966
|
-
},
|
|
967
|
-
dark: {
|
|
968
|
-
container: "border-r border-border-base bg-surface-1 text-text-primary shadow-sm",
|
|
969
|
-
active: "bg-primary/10 text-primary shadow-sm ring-1 ring-primary/20 before:absolute before:left-0 before:top-1/2 before:h-6 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-primary",
|
|
970
|
-
inactive: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
|
|
971
|
-
divider: "border-border-base",
|
|
972
|
-
icon: "bg-transparent text-text-tertiary group-hover:bg-surface-3 group-hover:text-primary",
|
|
973
|
-
activeIcon: "bg-primary/15 text-primary"
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
function getItemKey(item, index, parentKey) {
|
|
977
|
-
return item.id ?? item.href ?? `${parentKey}-${index}-${item.label}`;
|
|
978
|
-
}
|
|
979
|
-
function itemHasActiveChild(item) {
|
|
980
|
-
return Boolean(item.children?.some((child) => child.active || itemHasActiveChild(child)));
|
|
981
|
-
}
|
|
982
|
-
function normalizeSearch(value) {
|
|
983
|
-
return value.toLowerCase().replace(/\s+/g, "");
|
|
984
|
-
}
|
|
985
|
-
function filterSidebarItems(items, query) {
|
|
986
|
-
if (!query) return items;
|
|
987
|
-
return items.reduce((result, item) => {
|
|
988
|
-
const children = item.children ? filterSidebarItems(item.children, query) : [];
|
|
989
|
-
const matched = normalizeSearch(item.label).includes(query);
|
|
990
|
-
if (matched || children.length > 0) {
|
|
991
|
-
result.push({ ...item, children });
|
|
992
|
-
}
|
|
993
|
-
return result;
|
|
994
|
-
}, []);
|
|
995
|
-
}
|
|
996
|
-
var Sidebar = (0, import_react14.forwardRef)(
|
|
997
|
-
({
|
|
998
|
-
items,
|
|
999
|
-
variant = "primary",
|
|
1000
|
-
collapsed,
|
|
1001
|
-
defaultCollapsed = false,
|
|
1002
|
-
onCollapsedChange,
|
|
1003
|
-
collapsible = false,
|
|
1004
|
-
searchable = false,
|
|
1005
|
-
searchPlaceholder = "\u641C\u7D22\u83DC\u5355...",
|
|
1006
|
-
responsive = false,
|
|
1007
|
-
mobileOpen = false,
|
|
1008
|
-
onMobileOpenChange,
|
|
1009
|
-
header,
|
|
1010
|
-
footer,
|
|
1011
|
-
className
|
|
1012
|
-
}, ref) => {
|
|
1013
|
-
const styles = variantStyles[variant];
|
|
1014
|
-
const [internalCollapsed, setInternalCollapsed] = (0, import_react14.useState)(defaultCollapsed);
|
|
1015
|
-
const [expandedKeys, setExpandedKeys] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
|
|
1016
|
-
const [query, setQuery] = (0, import_react14.useState)("");
|
|
1017
|
-
const effectiveCollapsed = collapsed ?? internalCollapsed;
|
|
1018
|
-
const normalizedQuery = normalizeSearch(query);
|
|
1019
|
-
const visibleItems = (0, import_react14.useMemo)(() => filterSidebarItems(items, normalizedQuery), [items, normalizedQuery]);
|
|
1020
|
-
function setCollapsedState(nextCollapsed) {
|
|
1021
|
-
setInternalCollapsed(nextCollapsed);
|
|
1022
|
-
onCollapsedChange?.(nextCollapsed);
|
|
1023
|
-
}
|
|
1024
|
-
function toggleExpanded(key) {
|
|
1025
|
-
setExpandedKeys((current) => {
|
|
1026
|
-
const next = new Set(current);
|
|
1027
|
-
if (next.has(key)) {
|
|
1028
|
-
next.delete(key);
|
|
1029
|
-
} else {
|
|
1030
|
-
next.add(key);
|
|
1031
|
-
}
|
|
1032
|
-
return next;
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
function closeMobile() {
|
|
1036
|
-
onMobileOpenChange?.(false);
|
|
1037
|
-
}
|
|
1038
|
-
function renderItems(list, depth = 0, parentKey = "root") {
|
|
1039
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: cn("flex flex-col gap-1", depth === 0 ? "px-2.5" : "ml-6 mt-1 border-l border-border-base pl-2"), children: list.map((item, index) => {
|
|
1040
|
-
const key = getItemKey(item, index, parentKey);
|
|
1041
|
-
const hasChildren = Boolean(item.children?.length);
|
|
1042
|
-
const active = Boolean(item.active || itemHasActiveChild(item));
|
|
1043
|
-
const expanded = !effectiveCollapsed && hasChildren && (normalizedQuery.length > 0 || active || expandedKeys.has(key));
|
|
1044
|
-
const itemContent = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1045
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1046
|
-
"span",
|
|
1047
|
-
{
|
|
1048
|
-
className: cn(
|
|
1049
|
-
"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors",
|
|
1050
|
-
active ? styles.activeIcon : styles.icon
|
|
1051
|
-
),
|
|
1052
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(item.icon, { size: 16 })
|
|
1053
|
-
}
|
|
1054
|
-
),
|
|
1055
|
-
!effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
|
|
1056
|
-
!effectiveCollapsed && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1057
|
-
import_lucide_react6.ChevronDown,
|
|
1058
|
-
{
|
|
1059
|
-
size: 15,
|
|
1060
|
-
className: cn("shrink-0 text-text-tertiary transition-transform", expanded && "rotate-180"),
|
|
1061
|
-
"aria-hidden": "true"
|
|
1062
|
-
}
|
|
1063
|
-
)
|
|
1064
|
-
] });
|
|
1065
|
-
const itemClassName = cn(
|
|
1066
|
-
"group relative flex min-w-0 items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm font-medium outline-none transition-all duration-150 focus-visible:ring-2 focus-visible:ring-primary/35",
|
|
1067
|
-
effectiveCollapsed && "justify-center px-2",
|
|
1068
|
-
active ? styles.active : styles.inactive
|
|
1069
|
-
);
|
|
1070
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
|
|
1071
|
-
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1072
|
-
"button",
|
|
1073
|
-
{
|
|
1074
|
-
type: "button",
|
|
1075
|
-
className: cn("w-full", itemClassName),
|
|
1076
|
-
"aria-expanded": expanded,
|
|
1077
|
-
title: effectiveCollapsed ? item.label : void 0,
|
|
1078
|
-
onClick: () => toggleExpanded(key),
|
|
1079
|
-
children: itemContent
|
|
1080
|
-
}
|
|
1081
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1082
|
-
"a",
|
|
1083
|
-
{
|
|
1084
|
-
href: item.href ?? "#",
|
|
1085
|
-
"aria-current": item.active ? "page" : void 0,
|
|
1086
|
-
className: itemClassName,
|
|
1087
|
-
title: effectiveCollapsed ? item.label : void 0,
|
|
1088
|
-
onClick: closeMobile,
|
|
1089
|
-
children: itemContent
|
|
1090
|
-
}
|
|
1091
|
-
),
|
|
1092
|
-
expanded && item.children ? renderItems(item.children, depth + 1, key) : null
|
|
1093
|
-
] }, key);
|
|
1094
|
-
}) });
|
|
1095
|
-
}
|
|
1096
|
-
const sidebar = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1097
|
-
"aside",
|
|
1098
|
-
{
|
|
1099
|
-
ref,
|
|
1100
|
-
className: cn(
|
|
1101
|
-
"flex flex-col overflow-hidden transition-all duration-300",
|
|
1102
|
-
styles.container,
|
|
1103
|
-
effectiveCollapsed ? "w-[72px]" : "w-64",
|
|
1104
|
-
responsive && [
|
|
1105
|
-
"fixed inset-y-0 left-0 z-50 md:relative md:inset-auto md:z-auto",
|
|
1106
|
-
mobileOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"
|
|
1107
|
-
],
|
|
1108
|
-
className
|
|
1109
|
-
),
|
|
1110
|
-
children: [
|
|
1111
|
-
(header || collapsible || responsive && mobileOpen) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1112
|
-
"div",
|
|
1113
|
-
{
|
|
1114
|
-
className: cn(
|
|
1115
|
-
"flex border-b px-3 py-3",
|
|
1116
|
-
styles.divider,
|
|
1117
|
-
effectiveCollapsed ? "justify-center" : "items-center gap-2"
|
|
1118
|
-
),
|
|
1119
|
-
children: [
|
|
1120
|
-
!effectiveCollapsed && header ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "min-w-0 flex-1", children: header }) : null,
|
|
1121
|
-
collapsible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1122
|
-
"button",
|
|
1123
|
-
{
|
|
1124
|
-
type: "button",
|
|
1125
|
-
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border-base bg-surface-2 text-text-secondary transition-colors hover:border-primary/40 hover:text-text-primary",
|
|
1126
|
-
"aria-label": effectiveCollapsed ? "\u5C55\u5F00\u4FA7\u8FB9\u680F" : "\u6298\u53E0\u4FA7\u8FB9\u680F",
|
|
1127
|
-
onClick: () => setCollapsedState(!effectiveCollapsed),
|
|
1128
|
-
children: effectiveCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.PanelLeftOpen, { size: 17 }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.PanelLeftClose, { size: 17 })
|
|
1129
|
-
}
|
|
1130
|
-
),
|
|
1131
|
-
responsive && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1132
|
-
"button",
|
|
1133
|
-
{
|
|
1134
|
-
type: "button",
|
|
1135
|
-
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border-base bg-surface-2 text-text-secondary transition-colors hover:border-primary/40 hover:text-text-primary md:hidden",
|
|
1136
|
-
"aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F",
|
|
1137
|
-
onClick: closeMobile,
|
|
1138
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { size: 17 })
|
|
1139
|
-
}
|
|
1140
|
-
)
|
|
1141
|
-
]
|
|
1142
|
-
}
|
|
1143
|
-
),
|
|
1144
|
-
searchable && !effectiveCollapsed && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("border-b px-3 py-3", styles.divider), children: [
|
|
1145
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "sr-only", htmlFor: "ug-sidebar-search", children: "\u641C\u7D22\u83DC\u5355" }),
|
|
1146
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
|
|
1147
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary", "aria-hidden": "true" }),
|
|
1148
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1149
|
-
"input",
|
|
1150
|
-
{
|
|
1151
|
-
id: "ug-sidebar-search",
|
|
1152
|
-
value: query,
|
|
1153
|
-
onChange: (event) => setQuery(event.target.value),
|
|
1154
|
-
placeholder: searchPlaceholder,
|
|
1155
|
-
autoComplete: "off",
|
|
1156
|
-
className: "h-10 w-full rounded-lg border border-border-base bg-surface-0 px-3 pl-9 pr-9 text-sm text-text-primary outline-none transition-colors placeholder:text-text-tertiary focus:border-primary focus:ring-2 focus:ring-primary/20",
|
|
1157
|
-
type: "text",
|
|
1158
|
-
role: "searchbox"
|
|
1159
|
-
}
|
|
1160
|
-
),
|
|
1161
|
-
query ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1162
|
-
"button",
|
|
1163
|
-
{
|
|
1164
|
-
type: "button",
|
|
1165
|
-
className: "absolute right-1 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-text-tertiary transition-colors hover:bg-surface-2 hover:text-text-primary",
|
|
1166
|
-
"aria-label": "\u6E05\u7A7A\u641C\u7D22",
|
|
1167
|
-
onClick: () => setQuery(""),
|
|
1168
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { size: 14 })
|
|
1169
|
-
}
|
|
1170
|
-
) : null
|
|
1171
|
-
] })
|
|
1172
|
-
] }),
|
|
1173
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("nav", { className: "flex-1 overflow-y-auto py-3.5", children: visibleItems.length > 0 ? renderItems(visibleItems) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mx-3 rounded-lg border border-dashed border-border-base bg-surface-0 px-3 py-3 text-sm text-text-tertiary", children: "\u6CA1\u6709\u5339\u914D\u7684\u83DC\u5355" }) }),
|
|
1174
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1175
|
-
"div",
|
|
1176
|
-
{
|
|
1177
|
-
className: cn(
|
|
1178
|
-
"border-t px-2.5 py-3",
|
|
1179
|
-
styles.divider,
|
|
1180
|
-
effectiveCollapsed && "flex justify-center"
|
|
1181
|
-
),
|
|
1182
|
-
children: footer
|
|
1183
|
-
}
|
|
1184
|
-
)
|
|
1185
|
-
]
|
|
1186
|
-
}
|
|
1187
|
-
);
|
|
1188
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1189
|
-
responsive && mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1190
|
-
"button",
|
|
1191
|
-
{
|
|
1192
|
-
type: "button",
|
|
1193
|
-
className: "fixed inset-0 z-40 bg-overlay md:hidden",
|
|
1194
|
-
"aria-label": "\u5173\u95ED\u4FA7\u8FB9\u680F\u906E\u7F69",
|
|
1195
|
-
onClick: closeMobile
|
|
1196
|
-
}
|
|
1197
|
-
) : null,
|
|
1198
|
-
sidebar
|
|
1199
|
-
] });
|
|
1200
|
-
}
|
|
1201
|
-
);
|
|
1202
|
-
Sidebar.displayName = "Sidebar";
|
|
1203
|
-
|
|
1204
|
-
// src/components/pagination.tsx
|
|
1205
|
-
var import_react15 = require("react");
|
|
1206
|
-
var import_lucide_react7 = require("lucide-react");
|
|
1207
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1208
|
-
function getPageNumbers(page, totalPages) {
|
|
1209
|
-
if (totalPages <= 5) {
|
|
1210
|
-
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
1211
|
-
}
|
|
1212
|
-
if (page <= 3) {
|
|
1213
|
-
return [1, 2, 3, "...", totalPages];
|
|
1214
|
-
}
|
|
1215
|
-
if (page >= totalPages - 2) {
|
|
1216
|
-
return [1, "...", totalPages - 2, totalPages - 1, totalPages];
|
|
1217
|
-
}
|
|
1218
|
-
return [1, "...", page, "...", totalPages];
|
|
1219
|
-
}
|
|
1220
|
-
var Pagination = (0, import_react15.forwardRef)(({ page, totalPages, onPageChange, className }, ref) => {
|
|
1221
|
-
const pageNumbers = getPageNumbers(page, totalPages);
|
|
1222
|
-
const btnBase = "inline-flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg px-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 disabled:pointer-events-none disabled:opacity-40";
|
|
1223
|
-
const btnGhost = "border border-border-strong bg-surface-1 text-text-primary hover:border-primary/60 hover:bg-surface-2";
|
|
1224
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref, className: cn("flex max-w-full flex-wrap items-center gap-1", className), children: [
|
|
1225
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1226
|
-
"button",
|
|
1227
|
-
{
|
|
1228
|
-
type: "button",
|
|
1229
|
-
className: cn(btnBase, btnGhost),
|
|
1230
|
-
disabled: page <= 1,
|
|
1231
|
-
onClick: () => onPageChange(page - 1),
|
|
1232
|
-
"aria-label": "\u4E0A\u4E00\u9875",
|
|
1233
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronLeft, { size: 16 })
|
|
1234
|
-
}
|
|
1235
|
-
),
|
|
1236
|
-
pageNumbers.map(
|
|
1237
|
-
(p, idx) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "inline-flex h-8 min-w-6 shrink-0 items-center justify-center text-text-tertiary select-none", children: "\u2026" }, `ellipsis-${idx}`) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1238
|
-
"button",
|
|
1239
|
-
{
|
|
1240
|
-
type: "button",
|
|
1241
|
-
className: cn(
|
|
1242
|
-
btnBase,
|
|
1243
|
-
p === page ? "bg-primary text-primary-fg shadow-sm" : btnGhost
|
|
1244
|
-
),
|
|
1245
|
-
onClick: () => onPageChange(p),
|
|
1246
|
-
"aria-current": p === page ? "page" : void 0,
|
|
1247
|
-
children: p
|
|
1248
|
-
},
|
|
1249
|
-
p
|
|
1250
|
-
)
|
|
1251
|
-
),
|
|
1252
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1253
|
-
"button",
|
|
1254
|
-
{
|
|
1255
|
-
type: "button",
|
|
1256
|
-
className: cn(btnBase, btnGhost),
|
|
1257
|
-
disabled: page >= totalPages,
|
|
1258
|
-
onClick: () => onPageChange(page + 1),
|
|
1259
|
-
"aria-label": "\u4E0B\u4E00\u9875",
|
|
1260
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronRight, { size: 16 })
|
|
1261
|
-
}
|
|
1262
|
-
)
|
|
1263
|
-
] });
|
|
1264
|
-
});
|
|
1265
|
-
Pagination.displayName = "Pagination";
|
|
1266
|
-
|
|
1267
|
-
// src/components/select.tsx
|
|
1268
|
-
var import_react16 = require("react");
|
|
1269
|
-
var import_lucide_react8 = require("lucide-react");
|
|
1270
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1271
|
-
var Select = (0, import_react16.forwardRef)(
|
|
1272
|
-
({
|
|
1273
|
-
className,
|
|
1274
|
-
label,
|
|
1275
|
-
error,
|
|
1276
|
-
helperText,
|
|
1277
|
-
options,
|
|
1278
|
-
placeholder,
|
|
1279
|
-
id,
|
|
1280
|
-
value,
|
|
1281
|
-
defaultValue,
|
|
1282
|
-
onChange,
|
|
1283
|
-
disabled,
|
|
1284
|
-
name,
|
|
1285
|
-
required,
|
|
1286
|
-
...props
|
|
1287
|
-
}, ref) => {
|
|
1288
|
-
const generatedId = (0, import_react16.useId)();
|
|
1289
|
-
const selectId = id ?? generatedId;
|
|
1290
|
-
const listboxId = `${selectId}-listbox`;
|
|
1291
|
-
const rootRef = (0, import_react16.useRef)(null);
|
|
1292
|
-
const hiddenSelectRef = (0, import_react16.useRef)(null);
|
|
1293
|
-
const isControlled = value !== void 0;
|
|
1294
|
-
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
1295
|
-
const [internalValue, setInternalValue] = (0, import_react16.useState)(() => String(defaultValue ?? ""));
|
|
1296
|
-
const selectedValue = String(isControlled ? value : internalValue);
|
|
1297
|
-
const selectedOption = (0, import_react16.useMemo)(
|
|
1298
|
-
() => options.find((option) => String(option.value) === selectedValue),
|
|
1299
|
-
[options, selectedValue]
|
|
1300
|
-
);
|
|
1301
|
-
function setSelectRef(node) {
|
|
1302
|
-
hiddenSelectRef.current = node;
|
|
1303
|
-
if (typeof ref === "function") {
|
|
1304
|
-
ref(node);
|
|
1305
|
-
} else if (ref) {
|
|
1306
|
-
ref.current = node;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
function handleSelect(nextValue) {
|
|
1310
|
-
if (disabled) return;
|
|
1311
|
-
if (!isControlled) {
|
|
1312
|
-
setInternalValue(nextValue);
|
|
1313
|
-
}
|
|
1314
|
-
if (hiddenSelectRef.current) {
|
|
1315
|
-
hiddenSelectRef.current.value = nextValue;
|
|
1316
|
-
onChange?.({ target: hiddenSelectRef.current, currentTarget: hiddenSelectRef.current });
|
|
1317
|
-
}
|
|
1318
|
-
setOpen(false);
|
|
1319
|
-
}
|
|
1320
|
-
function toggleOpen() {
|
|
1321
|
-
if (disabled) return;
|
|
1322
|
-
setOpen((current) => !current);
|
|
1323
|
-
}
|
|
1324
|
-
function handleTriggerKeyDown(event) {
|
|
1325
|
-
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {
|
|
1326
|
-
event.preventDefault();
|
|
1327
|
-
setOpen(true);
|
|
1328
|
-
return;
|
|
1329
|
-
}
|
|
1330
|
-
if (event.key === "Escape") {
|
|
1331
|
-
event.preventDefault();
|
|
1332
|
-
setOpen(false);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
(0, import_react16.useEffect)(() => {
|
|
1336
|
-
if (!open) return;
|
|
1337
|
-
function handlePointerDown(event) {
|
|
1338
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
1339
|
-
setOpen(false);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
function handleKeyDown(event) {
|
|
1343
|
-
if (event.key === "Escape") {
|
|
1344
|
-
setOpen(false);
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
1348
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
1349
|
-
return () => {
|
|
1350
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
1351
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
1352
|
-
};
|
|
1353
|
-
}, [open]);
|
|
1354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: rootRef, className: "relative flex flex-col gap-1.5", children: [
|
|
1355
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: selectId, className: "text-sm font-medium text-text-primary", children: label }),
|
|
1356
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1357
|
-
"select",
|
|
1358
|
-
{
|
|
1359
|
-
ref: setSelectRef,
|
|
1360
|
-
id: `${selectId}-native`,
|
|
1361
|
-
name,
|
|
1362
|
-
value: selectedValue,
|
|
1363
|
-
required,
|
|
1364
|
-
disabled,
|
|
1365
|
-
tabIndex: -1,
|
|
1366
|
-
"aria-hidden": "true",
|
|
1367
|
-
className: "sr-only",
|
|
1368
|
-
onChange,
|
|
1369
|
-
...props,
|
|
1370
|
-
children: [
|
|
1371
|
-
placeholder && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: placeholder }),
|
|
1372
|
-
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1373
|
-
]
|
|
1374
|
-
}
|
|
1375
|
-
),
|
|
1376
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative", children: [
|
|
1377
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1378
|
-
"button",
|
|
1379
|
-
{
|
|
1380
|
-
type: "button",
|
|
1381
|
-
id: selectId,
|
|
1382
|
-
disabled,
|
|
1383
|
-
"aria-haspopup": "listbox",
|
|
1384
|
-
"aria-expanded": open,
|
|
1385
|
-
"aria-controls": listboxId,
|
|
1386
|
-
className: cn(
|
|
1387
|
-
"flex h-10 w-full items-center justify-between rounded-lg border bg-surface-1 px-3 py-2 text-left text-sm leading-5 text-text-primary shadow-sm",
|
|
1388
|
-
"transition-colors hover:border-primary/60",
|
|
1389
|
-
"focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/25 focus-visible:ring-offset-1 focus-visible:ring-offset-surface-0",
|
|
1390
|
-
"disabled:cursor-not-allowed disabled:bg-surface-2 disabled:text-text-tertiary disabled:opacity-70",
|
|
1391
|
-
error ? "border-danger focus-visible:ring-danger/25" : "border-border-strong",
|
|
1392
|
-
className
|
|
1393
|
-
),
|
|
1394
|
-
onClick: toggleOpen,
|
|
1395
|
-
onKeyDown: handleTriggerKeyDown,
|
|
1396
|
-
children: [
|
|
1397
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("truncate", !selectedOption && "text-text-tertiary"), children: selectedOption?.label ?? placeholder ?? "\u8BF7\u9009\u62E9" }),
|
|
1398
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1399
|
-
import_lucide_react8.ChevronDown,
|
|
1400
|
-
{
|
|
1401
|
-
"aria-hidden": "true",
|
|
1402
|
-
className: cn("h-4 w-4 shrink-0 text-text-tertiary transition-transform", open && "rotate-180")
|
|
1403
|
-
}
|
|
1404
|
-
)
|
|
1405
|
-
]
|
|
1406
|
-
}
|
|
1407
|
-
),
|
|
1408
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1409
|
-
"div",
|
|
1410
|
-
{
|
|
1411
|
-
id: listboxId,
|
|
1412
|
-
role: "listbox",
|
|
1413
|
-
className: "absolute left-0 right-0 top-full z-[70] mt-1 max-h-60 overflow-auto rounded-lg border border-border-strong bg-surface-1 p-1 shadow-xl",
|
|
1414
|
-
children: [
|
|
1415
|
-
placeholder && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1416
|
-
"button",
|
|
1417
|
-
{
|
|
1418
|
-
type: "button",
|
|
1419
|
-
role: "option",
|
|
1420
|
-
"aria-selected": selectedValue === "",
|
|
1421
|
-
className: cn(
|
|
1422
|
-
"flex w-full items-center rounded-md px-2.5 py-2 text-left text-sm text-text-tertiary transition-colors hover:bg-surface-2",
|
|
1423
|
-
selectedValue === "" && "bg-surface-2 text-text-primary"
|
|
1424
|
-
),
|
|
1425
|
-
onClick: () => handleSelect(""),
|
|
1426
|
-
children: placeholder
|
|
1427
|
-
}
|
|
1428
|
-
),
|
|
1429
|
-
options.map((option) => {
|
|
1430
|
-
const optionValue = String(option.value);
|
|
1431
|
-
const selected = optionValue === selectedValue;
|
|
1432
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1433
|
-
"button",
|
|
1434
|
-
{
|
|
1435
|
-
type: "button",
|
|
1436
|
-
role: "option",
|
|
1437
|
-
"aria-selected": selected,
|
|
1438
|
-
className: cn(
|
|
1439
|
-
"flex w-full items-center rounded-md px-2.5 py-2 text-left text-sm text-text-primary transition-colors hover:bg-surface-2",
|
|
1440
|
-
selected && "bg-primary-soft text-primary-soft-fg"
|
|
1441
|
-
),
|
|
1442
|
-
onClick: () => handleSelect(optionValue),
|
|
1443
|
-
children: option.label
|
|
1444
|
-
},
|
|
1445
|
-
option.value
|
|
1446
|
-
);
|
|
1447
|
-
})
|
|
1448
|
-
]
|
|
1449
|
-
}
|
|
1450
|
-
)
|
|
1451
|
-
] }),
|
|
1452
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-danger", children: error }),
|
|
1453
|
-
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
|
|
1454
|
-
] });
|
|
1455
|
-
}
|
|
1456
|
-
);
|
|
1457
|
-
Select.displayName = "Select";
|
|
1458
|
-
|
|
1459
|
-
// src/components/spinner.tsx
|
|
1460
|
-
var import_react17 = require("react");
|
|
1461
|
-
var import_lucide_react9 = require("lucide-react");
|
|
1462
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
1463
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1464
|
-
var spinnerVariants = (0, import_class_variance_authority4.cva)("animate-spin text-text-tertiary", {
|
|
1465
|
-
variants: {
|
|
1466
|
-
size: {
|
|
1467
|
-
sm: "h-4 w-4",
|
|
1468
|
-
md: "h-6 w-6",
|
|
1469
|
-
lg: "h-10 w-10"
|
|
1470
|
-
}
|
|
1471
|
-
},
|
|
1472
|
-
defaultVariants: {
|
|
1473
|
-
size: "md"
|
|
1474
|
-
}
|
|
1475
|
-
});
|
|
1476
|
-
var Spinner = (0, import_react17.forwardRef)(({ className, size, label = "\u52A0\u8F7D\u4E2D", ...props }, ref) => {
|
|
1477
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1478
|
-
import_lucide_react9.Loader2,
|
|
1479
|
-
{
|
|
1480
|
-
ref,
|
|
1481
|
-
className: cn(spinnerVariants({ size }), className),
|
|
1482
|
-
"aria-label": label,
|
|
1483
|
-
role: "status",
|
|
1484
|
-
...props
|
|
1485
|
-
}
|
|
1486
|
-
);
|
|
1487
|
-
});
|
|
1488
|
-
Spinner.displayName = "Spinner";
|
|
1489
|
-
|
|
1490
|
-
// src/components/checkbox.tsx
|
|
1491
|
-
var import_react18 = require("react");
|
|
1492
|
-
var import_lucide_react10 = require("lucide-react");
|
|
1493
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1494
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1495
|
-
var checkboxVariants = (0, import_class_variance_authority5.cva)(
|
|
1496
|
-
"peer inline-flex shrink-0 items-center justify-center rounded-md border shadow-sm transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
1497
|
-
{
|
|
1498
|
-
variants: {
|
|
1499
|
-
size: {
|
|
1500
|
-
sm: "h-4 w-4",
|
|
1501
|
-
default: "h-[18px] w-[18px]",
|
|
1502
|
-
lg: "h-5 w-5"
|
|
1503
|
-
},
|
|
1504
|
-
state: {
|
|
1505
|
-
unchecked: "border-border-strong bg-surface-1 text-transparent hover:border-primary/70 hover:bg-surface-2",
|
|
1506
|
-
checked: "border-primary bg-primary text-primary-fg",
|
|
1507
|
-
indeterminate: "border-primary bg-primary text-primary-fg"
|
|
1508
|
-
}
|
|
1509
|
-
},
|
|
1510
|
-
defaultVariants: {
|
|
1511
|
-
size: "default",
|
|
1512
|
-
state: "unchecked"
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
);
|
|
1516
|
-
var Checkbox = (0, import_react18.forwardRef)(
|
|
1517
|
-
({
|
|
1518
|
-
className,
|
|
1519
|
-
size,
|
|
1520
|
-
checked,
|
|
1521
|
-
indeterminate = false,
|
|
1522
|
-
disabled,
|
|
1523
|
-
label,
|
|
1524
|
-
labelClassName,
|
|
1525
|
-
onCheckedChange,
|
|
1526
|
-
id,
|
|
1527
|
-
...props
|
|
1528
|
-
}, ref) => {
|
|
1529
|
-
const innerRef = (0, import_react18.useRef)(null);
|
|
1530
|
-
const generatedId = (0, import_react18.useId)();
|
|
1531
|
-
const inputId = id ?? generatedId;
|
|
1532
|
-
(0, import_react18.useEffect)(() => {
|
|
1533
|
-
if (innerRef.current) {
|
|
1534
|
-
innerRef.current.indeterminate = indeterminate;
|
|
1535
|
-
}
|
|
1536
|
-
}, [indeterminate]);
|
|
1537
|
-
const state = indeterminate ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
1538
|
-
const iconSize = size === "sm" ? 11 : size === "lg" ? 14 : 12;
|
|
1539
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "relative inline-flex", children: [
|
|
1540
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1541
|
-
"input",
|
|
1542
|
-
{
|
|
1543
|
-
ref: (node) => {
|
|
1544
|
-
innerRef.current = node;
|
|
1545
|
-
if (typeof ref === "function") ref(node);
|
|
1546
|
-
else if (ref) ref.current = node;
|
|
1547
|
-
},
|
|
1548
|
-
id: inputId,
|
|
1549
|
-
type: "checkbox",
|
|
1550
|
-
className: "peer sr-only",
|
|
1551
|
-
checked: checked ?? false,
|
|
1552
|
-
disabled,
|
|
1553
|
-
onChange: (e) => onCheckedChange?.(e.target.checked),
|
|
1554
|
-
...props
|
|
1555
|
-
}
|
|
1556
|
-
),
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1558
|
-
"span",
|
|
1559
|
-
{
|
|
1560
|
-
"aria-hidden": "true",
|
|
1561
|
-
className: cn(checkboxVariants({ size, state }), className),
|
|
1562
|
-
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Minus, { size: iconSize }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Check, { size: iconSize }) : null
|
|
1563
|
-
}
|
|
1564
|
-
)
|
|
1565
|
-
] });
|
|
1566
|
-
if (label === void 0 || label === null) return control;
|
|
1567
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1568
|
-
"label",
|
|
1569
|
-
{
|
|
1570
|
-
htmlFor: inputId,
|
|
1571
|
-
className: cn(
|
|
1572
|
-
"inline-flex min-h-5 cursor-pointer items-center gap-2.5 text-sm leading-5 text-text-primary select-none",
|
|
1573
|
-
disabled && "cursor-not-allowed opacity-60",
|
|
1574
|
-
labelClassName
|
|
1575
|
-
),
|
|
1576
|
-
children: [
|
|
1577
|
-
control,
|
|
1578
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pt-px", children: label })
|
|
1579
|
-
]
|
|
1580
|
-
}
|
|
1581
|
-
);
|
|
1582
|
-
}
|
|
1583
|
-
);
|
|
1584
|
-
Checkbox.displayName = "Checkbox";
|
|
1585
|
-
|
|
1586
|
-
// src/components/radio.tsx
|
|
1587
|
-
var import_react19 = require("react");
|
|
1588
|
-
var import_class_variance_authority6 = require("class-variance-authority");
|
|
1589
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1590
|
-
var RadioGroupContext = (0, import_react19.createContext)(null);
|
|
1591
|
-
function useRadioGroupContext() {
|
|
1592
|
-
return (0, import_react19.useContext)(RadioGroupContext);
|
|
1593
|
-
}
|
|
1594
|
-
var radioVariants = (0, import_class_variance_authority6.cva)(
|
|
1595
|
-
"relative inline-flex shrink-0 items-center justify-center rounded-full border shadow-sm transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-0 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
1596
|
-
{
|
|
1597
|
-
variants: {
|
|
1598
|
-
size: {
|
|
1599
|
-
sm: "h-4 w-4",
|
|
1600
|
-
default: "h-[18px] w-[18px]",
|
|
1601
|
-
lg: "h-5 w-5"
|
|
1602
|
-
},
|
|
1603
|
-
checked: {
|
|
1604
|
-
true: "border-primary bg-surface-1",
|
|
1605
|
-
false: "border-border-strong bg-surface-1 hover:border-primary/70 hover:bg-surface-2"
|
|
1606
|
-
}
|
|
1607
|
-
},
|
|
1608
|
-
defaultVariants: {
|
|
1609
|
-
size: "default",
|
|
1610
|
-
checked: false
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
);
|
|
1614
|
-
var Radio = (0, import_react19.forwardRef)(
|
|
1615
|
-
({
|
|
1616
|
-
className,
|
|
1617
|
-
size,
|
|
1618
|
-
value,
|
|
1619
|
-
checked: checkedProp,
|
|
1620
|
-
disabled: disabledProp,
|
|
1621
|
-
label,
|
|
1622
|
-
name: nameProp,
|
|
1623
|
-
onChange,
|
|
1624
|
-
id,
|
|
1625
|
-
...props
|
|
1626
|
-
}, ref) => {
|
|
1627
|
-
const group = useRadioGroupContext();
|
|
1628
|
-
const generatedId = (0, import_react19.useId)();
|
|
1629
|
-
const inputId = id ?? generatedId;
|
|
1630
|
-
const isChecked = group ? group.value === value : checkedProp ?? false;
|
|
1631
|
-
const isDisabled = group ? group.disabled || (disabledProp ?? false) : disabledProp ?? false;
|
|
1632
|
-
const inputName = group ? group.name : nameProp;
|
|
1633
|
-
function handleChange() {
|
|
1634
|
-
if (group) {
|
|
1635
|
-
group.onValueChange(value);
|
|
1636
|
-
} else {
|
|
1637
|
-
onChange?.(value);
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
const dotSize = size === "sm" ? "h-1.5 w-1.5" : size === "lg" ? "h-2.5 w-2.5" : "h-2 w-2";
|
|
1641
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "relative inline-flex", children: [
|
|
1642
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1643
|
-
"input",
|
|
1644
|
-
{
|
|
1645
|
-
ref,
|
|
1646
|
-
id: inputId,
|
|
1647
|
-
type: "radio",
|
|
1648
|
-
className: "peer sr-only",
|
|
1649
|
-
value,
|
|
1650
|
-
checked: isChecked,
|
|
1651
|
-
disabled: isDisabled,
|
|
1652
|
-
name: inputName,
|
|
1653
|
-
onChange: handleChange,
|
|
1654
|
-
...props
|
|
1655
|
-
}
|
|
1656
|
-
),
|
|
1657
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1658
|
-
"span",
|
|
1659
|
-
{
|
|
1660
|
-
"aria-hidden": "true",
|
|
1661
|
-
className: cn(radioVariants({ size, checked: isChecked }), className),
|
|
1662
|
-
children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("rounded-full bg-primary", dotSize) })
|
|
1663
|
-
}
|
|
1664
|
-
)
|
|
1665
|
-
] });
|
|
1666
|
-
if (label === void 0 || label === null) return control;
|
|
1667
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1668
|
-
"label",
|
|
1669
|
-
{
|
|
1670
|
-
htmlFor: inputId,
|
|
1671
|
-
className: cn(
|
|
1672
|
-
"inline-flex min-h-5 cursor-pointer items-center gap-2.5 text-sm leading-5 text-text-primary select-none",
|
|
1673
|
-
isDisabled && "cursor-not-allowed opacity-60"
|
|
1674
|
-
),
|
|
1675
|
-
children: [
|
|
1676
|
-
control,
|
|
1677
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pt-px", children: label })
|
|
1678
|
-
]
|
|
1679
|
-
}
|
|
1680
|
-
);
|
|
1681
|
-
}
|
|
1682
|
-
);
|
|
1683
|
-
Radio.displayName = "Radio";
|
|
1684
|
-
var RadioGroup = (0, import_react19.forwardRef)(
|
|
1685
|
-
({
|
|
1686
|
-
className,
|
|
1687
|
-
value: valueProp,
|
|
1688
|
-
defaultValue,
|
|
1689
|
-
onValueChange,
|
|
1690
|
-
disabled = false,
|
|
1691
|
-
name,
|
|
1692
|
-
orientation = "vertical",
|
|
1693
|
-
children,
|
|
1694
|
-
...props
|
|
1695
|
-
}, ref) => {
|
|
1696
|
-
const [uncontrolledValue, setUncontrolledValue] = (0, import_react19.useState)(defaultValue);
|
|
1697
|
-
const isControlled = valueProp !== void 0;
|
|
1698
|
-
const currentValue = isControlled ? valueProp : uncontrolledValue;
|
|
1699
|
-
function handleValueChange(newValue) {
|
|
1700
|
-
if (!isControlled) {
|
|
1701
|
-
setUncontrolledValue(newValue);
|
|
1702
|
-
}
|
|
1703
|
-
onValueChange?.(newValue);
|
|
1704
|
-
}
|
|
1705
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1706
|
-
RadioGroupContext.Provider,
|
|
1707
|
-
{
|
|
1708
|
-
value: {
|
|
1709
|
-
value: currentValue,
|
|
1710
|
-
onValueChange: handleValueChange,
|
|
1711
|
-
name,
|
|
1712
|
-
disabled
|
|
1713
|
-
},
|
|
1714
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1715
|
-
"div",
|
|
1716
|
-
{
|
|
1717
|
-
ref,
|
|
1718
|
-
role: "radiogroup",
|
|
1719
|
-
className: cn(
|
|
1720
|
-
"flex",
|
|
1721
|
-
orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-x-5 gap-y-2.5",
|
|
1722
|
-
className
|
|
1723
|
-
),
|
|
1724
|
-
...props,
|
|
1725
|
-
children
|
|
1726
|
-
}
|
|
1727
|
-
)
|
|
1728
|
-
}
|
|
1729
|
-
);
|
|
1730
|
-
}
|
|
1731
|
-
);
|
|
1732
|
-
RadioGroup.displayName = "RadioGroup";
|
|
1733
|
-
|
|
1734
|
-
// src/components/slider.tsx
|
|
1735
|
-
var import_react20 = require("react");
|
|
1736
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1737
|
-
var Slider = (0, import_react20.forwardRef)(
|
|
1738
|
-
({
|
|
1739
|
-
className,
|
|
1740
|
-
value: valueProp,
|
|
1741
|
-
defaultValue = 0,
|
|
1742
|
-
min = 0,
|
|
1743
|
-
max = 100,
|
|
1744
|
-
step = 1,
|
|
1745
|
-
disabled = false,
|
|
1746
|
-
showValue = false,
|
|
1747
|
-
onValueChange,
|
|
1748
|
-
...props
|
|
1749
|
-
}, ref) => {
|
|
1750
|
-
const isControlled = valueProp !== void 0;
|
|
1751
|
-
const [uncontrolledValue, setUncontrolledValue] = (0, import_react20.useState)(defaultValue);
|
|
1752
|
-
const currentValue = isControlled ? valueProp : uncontrolledValue;
|
|
1753
|
-
const fillPercent = max === min ? 0 : (currentValue - min) / (max - min) * 100;
|
|
1754
|
-
function updateValue(nextValue) {
|
|
1755
|
-
if (!isControlled) {
|
|
1756
|
-
setUncontrolledValue(nextValue);
|
|
1757
|
-
}
|
|
1758
|
-
onValueChange?.(nextValue);
|
|
1759
|
-
}
|
|
1760
|
-
function handleInput(e) {
|
|
1761
|
-
updateValue(Number(e.currentTarget.value));
|
|
1762
|
-
}
|
|
1763
|
-
function handleChange(e) {
|
|
1764
|
-
const newValue = Number(e.target.value);
|
|
1765
|
-
if (newValue === currentValue) {
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1768
|
-
updateValue(newValue);
|
|
1769
|
-
}
|
|
1770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("flex flex-col gap-1.5", className), children: [
|
|
1771
|
-
showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "self-start text-xs font-semibold leading-none text-text-primary", children: currentValue }),
|
|
1772
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative flex h-6 w-full items-center", children: [
|
|
1773
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pointer-events-none absolute h-2 w-full overflow-hidden rounded-full bg-surface-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1774
|
-
"div",
|
|
1775
|
-
{
|
|
1776
|
-
className: "h-full rounded-full bg-primary transition-all",
|
|
1777
|
-
style: { width: `${fillPercent}%` }
|
|
1778
|
-
}
|
|
1779
|
-
) }),
|
|
1780
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1781
|
-
"input",
|
|
1782
|
-
{
|
|
1783
|
-
ref,
|
|
1784
|
-
type: "range",
|
|
1785
|
-
min,
|
|
1786
|
-
max,
|
|
1787
|
-
step,
|
|
1788
|
-
value: currentValue,
|
|
1789
|
-
disabled,
|
|
1790
|
-
onInput: handleInput,
|
|
1791
|
-
onChange: handleChange,
|
|
1792
|
-
className: cn(
|
|
1793
|
-
"relative h-6 w-full cursor-pointer appearance-none bg-transparent",
|
|
1794
|
-
// thumb 样式
|
|
1795
|
-
"[&::-webkit-slider-thumb]:h-[18px] [&::-webkit-slider-thumb]:w-[18px] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-surface-1 [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110",
|
|
1796
|
-
"[&::-moz-range-thumb]:h-[18px] [&::-moz-range-thumb]:w-[18px] [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary [&::-moz-range-thumb]:bg-surface-1 [&::-moz-range-thumb]:shadow-md",
|
|
1797
|
-
// track 透明(用自定义 div 代替)
|
|
1798
|
-
"[&::-webkit-slider-runnable-track]:bg-transparent",
|
|
1799
|
-
"[&::-moz-range-track]:bg-transparent",
|
|
1800
|
-
// focus
|
|
1801
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0",
|
|
1802
|
-
// disabled
|
|
1803
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
1804
|
-
),
|
|
1805
|
-
...props
|
|
1806
|
-
}
|
|
1807
|
-
)
|
|
1808
|
-
] })
|
|
1809
|
-
] });
|
|
1810
|
-
}
|
|
1811
|
-
);
|
|
1812
|
-
Slider.displayName = "Slider";
|
|
1813
|
-
|
|
1814
|
-
// src/components/number-input.tsx
|
|
1815
|
-
var import_react21 = require("react");
|
|
1816
|
-
var import_lucide_react11 = require("lucide-react");
|
|
1817
|
-
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1818
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1819
|
-
var numberInputVariants = (0, import_class_variance_authority7.cva)(
|
|
1820
|
-
"inline-flex items-center overflow-hidden rounded-lg border border-border-strong bg-surface-1 shadow-sm transition-colors focus-within:border-primary focus-within:ring-2 focus-within:ring-ring/25 has-[:disabled]:pointer-events-none has-[:disabled]:opacity-60",
|
|
1821
|
-
{
|
|
1822
|
-
variants: {
|
|
1823
|
-
size: {
|
|
1824
|
-
sm: "h-8 text-xs",
|
|
1825
|
-
default: "h-9 text-sm",
|
|
1826
|
-
lg: "h-11 text-base"
|
|
1827
|
-
}
|
|
1828
|
-
},
|
|
1829
|
-
defaultVariants: {
|
|
1830
|
-
size: "default"
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
);
|
|
1834
|
-
var NumberInput = (0, import_react21.forwardRef)(
|
|
1835
|
-
({
|
|
1836
|
-
className,
|
|
1837
|
-
size,
|
|
1838
|
-
value: valueProp,
|
|
1839
|
-
defaultValue = 0,
|
|
1840
|
-
min,
|
|
1841
|
-
max,
|
|
1842
|
-
step = 1,
|
|
1843
|
-
precision = 0,
|
|
1844
|
-
disabled = false,
|
|
1845
|
-
placeholder,
|
|
1846
|
-
onValueChange,
|
|
1847
|
-
...props
|
|
1848
|
-
}, ref) => {
|
|
1849
|
-
const isControlled = valueProp !== void 0;
|
|
1850
|
-
const [uncontrolledValue, setUncontrolledValue] = (0, import_react21.useState)(defaultValue);
|
|
1851
|
-
const currentValue = isControlled ? valueProp : uncontrolledValue;
|
|
1852
|
-
function clamp(val) {
|
|
1853
|
-
let result = val;
|
|
1854
|
-
if (min !== void 0) result = Math.max(min, result);
|
|
1855
|
-
if (max !== void 0) result = Math.min(max, result);
|
|
1856
|
-
return result;
|
|
1857
|
-
}
|
|
1858
|
-
function format(val) {
|
|
1859
|
-
return val.toFixed(precision);
|
|
1860
|
-
}
|
|
1861
|
-
function commit(newVal) {
|
|
1862
|
-
const clamped = clamp(Number(newVal.toFixed(precision)));
|
|
1863
|
-
if (!isControlled) {
|
|
1864
|
-
setUncontrolledValue(clamped);
|
|
1865
|
-
}
|
|
1866
|
-
onValueChange?.(clamped);
|
|
1867
|
-
}
|
|
1868
|
-
function handleDecrement() {
|
|
1869
|
-
commit(currentValue - step);
|
|
1870
|
-
}
|
|
1871
|
-
function handleIncrement() {
|
|
1872
|
-
commit(currentValue + step);
|
|
1873
|
-
}
|
|
1874
|
-
function handleInputChange(e) {
|
|
1875
|
-
const parsed = parseFloat(e.target.value);
|
|
1876
|
-
if (!Number.isNaN(parsed)) {
|
|
1877
|
-
commit(parsed);
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
function handleBlur(e) {
|
|
1881
|
-
const parsed = parseFloat(e.target.value);
|
|
1882
|
-
if (!Number.isNaN(parsed)) {
|
|
1883
|
-
commit(parsed);
|
|
1884
|
-
} else {
|
|
1885
|
-
if (!isControlled) {
|
|
1886
|
-
setUncontrolledValue(uncontrolledValue);
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
const atMin = min !== void 0 && currentValue <= min;
|
|
1891
|
-
const atMax = max !== void 0 && currentValue >= max;
|
|
1892
|
-
const btnBase = "inline-flex shrink-0 items-center justify-center bg-surface-2 text-text-secondary transition-colors hover:bg-surface-3 hover:text-text-primary disabled:pointer-events-none disabled:opacity-40";
|
|
1893
|
-
const btnSizeCls = size === "sm" ? "h-8 w-7" : size === "lg" ? "h-11 w-10" : "h-9 w-9";
|
|
1894
|
-
const iconSize = size === "sm" ? 12 : size === "lg" ? 16 : 14;
|
|
1895
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn(numberInputVariants({ size }), className), children: [
|
|
1896
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1897
|
-
"button",
|
|
1898
|
-
{
|
|
1899
|
-
type: "button",
|
|
1900
|
-
"aria-label": "\u51CF\u5C11\u6570\u503C",
|
|
1901
|
-
disabled: disabled || atMin,
|
|
1902
|
-
onClick: handleDecrement,
|
|
1903
|
-
className: cn(btnBase, btnSizeCls, "border-r border-border-base"),
|
|
1904
|
-
tabIndex: -1,
|
|
1905
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.Minus, { size: iconSize })
|
|
1906
|
-
}
|
|
1907
|
-
),
|
|
1908
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1909
|
-
"input",
|
|
1910
|
-
{
|
|
1911
|
-
ref,
|
|
1912
|
-
type: "number",
|
|
1913
|
-
className: cn(
|
|
1914
|
-
"min-w-0 flex-1 bg-transparent px-2 text-center font-medium text-text-primary outline-none",
|
|
1915
|
-
"placeholder:text-text-tertiary",
|
|
1916
|
-
// 隐藏原生 spinner
|
|
1917
|
-
"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
1918
|
-
),
|
|
1919
|
-
value: format(currentValue),
|
|
1920
|
-
disabled,
|
|
1921
|
-
placeholder,
|
|
1922
|
-
min,
|
|
1923
|
-
max,
|
|
1924
|
-
step,
|
|
1925
|
-
onChange: handleInputChange,
|
|
1926
|
-
onBlur: handleBlur,
|
|
1927
|
-
...props
|
|
1928
|
-
}
|
|
1929
|
-
),
|
|
1930
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1931
|
-
"button",
|
|
1932
|
-
{
|
|
1933
|
-
type: "button",
|
|
1934
|
-
"aria-label": "\u589E\u52A0\u6570\u503C",
|
|
1935
|
-
disabled: disabled || atMax,
|
|
1936
|
-
onClick: handleIncrement,
|
|
1937
|
-
className: cn(btnBase, btnSizeCls, "border-l border-border-base"),
|
|
1938
|
-
tabIndex: -1,
|
|
1939
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.Plus, { size: iconSize })
|
|
1940
|
-
}
|
|
1941
|
-
)
|
|
1942
|
-
] });
|
|
1943
|
-
}
|
|
1944
|
-
);
|
|
1945
|
-
NumberInput.displayName = "NumberInput";
|
|
1946
|
-
|
|
1947
|
-
// src/components/otp-input.tsx
|
|
1948
|
-
var import_react22 = require("react");
|
|
1949
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1950
|
-
var OTPInput = (0, import_react22.forwardRef)(
|
|
1951
|
-
({
|
|
1952
|
-
value,
|
|
1953
|
-
onValueChange,
|
|
1954
|
-
length = 6,
|
|
1955
|
-
disabled = false,
|
|
1956
|
-
onComplete,
|
|
1957
|
-
className
|
|
1958
|
-
}, ref) => {
|
|
1959
|
-
const inputRefs = (0, import_react22.useRef)([]);
|
|
1960
|
-
const focusAt = (0, import_react22.useCallback)((index) => {
|
|
1961
|
-
const el = inputRefs.current[index];
|
|
1962
|
-
if (el) {
|
|
1963
|
-
el.focus();
|
|
1964
|
-
el.setSelectionRange(el.value.length, el.value.length);
|
|
1965
|
-
}
|
|
1966
|
-
}, []);
|
|
1967
|
-
const updateValueAt = (0, import_react22.useCallback)(
|
|
1968
|
-
(index, char) => {
|
|
1969
|
-
const chars = value.padEnd(length, "").split("").slice(0, length);
|
|
1970
|
-
chars[index] = char;
|
|
1971
|
-
const next = chars.join("");
|
|
1972
|
-
onValueChange(next);
|
|
1973
|
-
if (char && next.replace(/\s/g, "").length === length && !next.includes(" ")) {
|
|
1974
|
-
onComplete?.(next);
|
|
1975
|
-
}
|
|
1976
|
-
},
|
|
1977
|
-
[value, length, onValueChange, onComplete]
|
|
1978
|
-
);
|
|
1979
|
-
const handleChange = (0, import_react22.useCallback)(
|
|
1980
|
-
(index, e) => {
|
|
1981
|
-
const raw = e.target.value;
|
|
1982
|
-
const digit = raw.replace(/\D/g, "").slice(-1);
|
|
1983
|
-
updateValueAt(index, digit);
|
|
1984
|
-
if (digit && index < length - 1) {
|
|
1985
|
-
focusAt(index + 1);
|
|
1986
|
-
}
|
|
1987
|
-
},
|
|
1988
|
-
[length, updateValueAt, focusAt]
|
|
1989
|
-
);
|
|
1990
|
-
const handleKeyDown = (0, import_react22.useCallback)(
|
|
1991
|
-
(index, e) => {
|
|
1992
|
-
if (e.key === "ArrowLeft") {
|
|
1993
|
-
e.preventDefault();
|
|
1994
|
-
if (index > 0) focusAt(index - 1);
|
|
1995
|
-
} else if (e.key === "ArrowRight") {
|
|
1996
|
-
e.preventDefault();
|
|
1997
|
-
if (index < length - 1) focusAt(index + 1);
|
|
1998
|
-
} else if (e.key === "Backspace") {
|
|
1999
|
-
e.preventDefault();
|
|
2000
|
-
const current = value[index] ?? "";
|
|
2001
|
-
if (current) {
|
|
2002
|
-
updateValueAt(index, "");
|
|
2003
|
-
} else if (index > 0) {
|
|
2004
|
-
updateValueAt(index - 1, "");
|
|
2005
|
-
focusAt(index - 1);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
},
|
|
2009
|
-
[value, length, focusAt, updateValueAt]
|
|
2010
|
-
);
|
|
2011
|
-
const handlePaste = (0, import_react22.useCallback)(
|
|
2012
|
-
(e) => {
|
|
2013
|
-
e.preventDefault();
|
|
2014
|
-
const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
|
|
2015
|
-
if (!pasted) return;
|
|
2016
|
-
const chars = pasted.padEnd(length, "").split("").slice(0, length);
|
|
2017
|
-
const next = chars.join("");
|
|
2018
|
-
onValueChange(next);
|
|
2019
|
-
const nextFocus = Math.min(pasted.length, length - 1);
|
|
2020
|
-
focusAt(nextFocus);
|
|
2021
|
-
if (pasted.length === length) {
|
|
2022
|
-
onComplete?.(next);
|
|
2023
|
-
}
|
|
2024
|
-
},
|
|
2025
|
-
[length, onValueChange, onComplete, focusAt]
|
|
2026
|
-
);
|
|
2027
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2028
|
-
"div",
|
|
2029
|
-
{
|
|
2030
|
-
ref,
|
|
2031
|
-
className: cn("flex items-center gap-2", className),
|
|
2032
|
-
role: "group",
|
|
2033
|
-
"aria-label": "\u9A8C\u8BC1\u7801\u8F93\u5165",
|
|
2034
|
-
children: Array.from({ length }, (_, i) => {
|
|
2035
|
-
const char = value[i] ?? "";
|
|
2036
|
-
const isFocused = false;
|
|
2037
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2038
|
-
"input",
|
|
2039
|
-
{
|
|
2040
|
-
ref: (el) => {
|
|
2041
|
-
inputRefs.current[i] = el;
|
|
2042
|
-
},
|
|
2043
|
-
type: "text",
|
|
2044
|
-
inputMode: "numeric",
|
|
2045
|
-
pattern: "[0-9]",
|
|
2046
|
-
maxLength: 1,
|
|
2047
|
-
value: char,
|
|
2048
|
-
disabled,
|
|
2049
|
-
"aria-label": `\u9A8C\u8BC1\u7801\u7B2C ${i + 1} \u4F4D`,
|
|
2050
|
-
className: cn(
|
|
2051
|
-
"h-10 w-10 rounded-md border text-center text-sm font-medium text-text-primary transition-colors",
|
|
2052
|
-
"outline-none focus:border-primary focus:ring-2 focus:ring-ring/20",
|
|
2053
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
2054
|
-
char ? "border-border-strong" : "border-border-base"
|
|
2055
|
-
),
|
|
2056
|
-
onChange: (e) => handleChange(i, e),
|
|
2057
|
-
onKeyDown: (e) => handleKeyDown(i, e),
|
|
2058
|
-
onPaste: handlePaste,
|
|
2059
|
-
onClick: (e) => e.target.select()
|
|
2060
|
-
},
|
|
2061
|
-
i
|
|
2062
|
-
);
|
|
2063
|
-
})
|
|
2064
|
-
}
|
|
2065
|
-
);
|
|
2066
|
-
}
|
|
2067
|
-
);
|
|
2068
|
-
OTPInput.displayName = "OTPInput";
|
|
2069
|
-
|
|
2070
|
-
// src/components/form.tsx
|
|
2071
|
-
var import_react23 = require("react");
|
|
2072
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2073
|
-
var FormFieldContext = (0, import_react23.createContext)(null);
|
|
2074
|
-
function useFormFieldContext() {
|
|
2075
|
-
const ctx = (0, import_react23.useContext)(FormFieldContext);
|
|
2076
|
-
if (!ctx) {
|
|
2077
|
-
throw new Error("FormField \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <FormField> \u5185\u4F7F\u7528");
|
|
2078
|
-
}
|
|
2079
|
-
return ctx;
|
|
2080
|
-
}
|
|
2081
|
-
var Form = (0, import_react23.forwardRef)(
|
|
2082
|
-
({ className, onSubmit, children, ...props }, ref) => {
|
|
2083
|
-
function handleSubmit(event) {
|
|
2084
|
-
event.preventDefault();
|
|
2085
|
-
onSubmit?.(event);
|
|
2086
|
-
}
|
|
2087
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2088
|
-
"form",
|
|
2089
|
-
{
|
|
2090
|
-
ref,
|
|
2091
|
-
className: cn(className),
|
|
2092
|
-
onSubmit: handleSubmit,
|
|
2093
|
-
...props,
|
|
2094
|
-
children
|
|
2095
|
-
}
|
|
2096
|
-
);
|
|
2097
|
-
}
|
|
2098
|
-
);
|
|
2099
|
-
Form.displayName = "Form";
|
|
2100
|
-
var FormField = (0, import_react23.forwardRef)(
|
|
2101
|
-
({ name, error, className, children, ...props }, ref) => {
|
|
2102
|
-
const generatedId = (0, import_react23.useId)();
|
|
2103
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FormFieldContext.Provider, { value: { name, error, id: generatedId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: cn(className), ...props, children }) });
|
|
2104
|
-
}
|
|
2105
|
-
);
|
|
2106
|
-
FormField.displayName = "FormField";
|
|
2107
|
-
var FormItem = (0, import_react23.forwardRef)(
|
|
2108
|
-
({ className, children, ...props }, ref) => {
|
|
2109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2110
|
-
"div",
|
|
2111
|
-
{
|
|
2112
|
-
ref,
|
|
2113
|
-
className: cn("flex flex-col gap-1.5", className),
|
|
2114
|
-
...props,
|
|
2115
|
-
children
|
|
2116
|
-
}
|
|
2117
|
-
);
|
|
2118
|
-
}
|
|
2119
|
-
);
|
|
2120
|
-
FormItem.displayName = "FormItem";
|
|
2121
|
-
var FormLabel = (0, import_react23.forwardRef)(
|
|
2122
|
-
({ className, required, children, htmlFor, ...props }, ref) => {
|
|
2123
|
-
const ctx = useFormFieldContext();
|
|
2124
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2125
|
-
Label,
|
|
2126
|
-
{
|
|
2127
|
-
ref,
|
|
2128
|
-
htmlFor: htmlFor ?? ctx.id,
|
|
2129
|
-
required,
|
|
2130
|
-
className: cn(className),
|
|
2131
|
-
...props,
|
|
2132
|
-
children
|
|
2133
|
-
}
|
|
2134
|
-
);
|
|
2135
|
-
}
|
|
2136
|
-
);
|
|
2137
|
-
FormLabel.displayName = "FormLabel";
|
|
2138
|
-
function FormControl({ children }) {
|
|
2139
|
-
const ctx = useFormFieldContext();
|
|
2140
|
-
const descriptionId = `${ctx.id}-description`;
|
|
2141
|
-
const messageId = `${ctx.id}-message`;
|
|
2142
|
-
return (0, import_react23.cloneElement)(children, {
|
|
2143
|
-
id: ctx.id,
|
|
2144
|
-
"aria-describedby": ctx.error ? `${descriptionId} ${messageId}` : descriptionId,
|
|
2145
|
-
"aria-invalid": ctx.error ? true : void 0
|
|
2146
|
-
});
|
|
2147
|
-
}
|
|
2148
|
-
FormControl.displayName = "FormControl";
|
|
2149
|
-
var FormDescription = (0, import_react23.forwardRef)(
|
|
2150
|
-
({ className, children, ...props }, ref) => {
|
|
2151
|
-
const ctx = useFormFieldContext();
|
|
2152
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2153
|
-
"p",
|
|
2154
|
-
{
|
|
2155
|
-
ref,
|
|
2156
|
-
id: `${ctx.id}-description`,
|
|
2157
|
-
className: cn("text-xs text-text-secondary", className),
|
|
2158
|
-
...props,
|
|
2159
|
-
children
|
|
2160
|
-
}
|
|
2161
|
-
);
|
|
2162
|
-
}
|
|
2163
|
-
);
|
|
2164
|
-
FormDescription.displayName = "FormDescription";
|
|
2165
|
-
var FormMessage = (0, import_react23.forwardRef)(
|
|
2166
|
-
({ className, children, ...props }, ref) => {
|
|
2167
|
-
const ctx = useFormFieldContext();
|
|
2168
|
-
const message = ctx.error ?? (typeof children === "string" ? children : void 0);
|
|
2169
|
-
if (!message) return null;
|
|
2170
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2171
|
-
"p",
|
|
2172
|
-
{
|
|
2173
|
-
ref,
|
|
2174
|
-
id: `${ctx.id}-message`,
|
|
2175
|
-
className: cn("text-xs text-danger-soft-fg", className),
|
|
2176
|
-
role: "alert",
|
|
2177
|
-
...props,
|
|
2178
|
-
children: message
|
|
2179
|
-
}
|
|
2180
|
-
);
|
|
2181
|
-
}
|
|
2182
|
-
);
|
|
2183
|
-
FormMessage.displayName = "FormMessage";
|
|
2184
|
-
|
|
2185
|
-
// src/components/tabs.tsx
|
|
2186
|
-
var import_react24 = require("react");
|
|
2187
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2188
|
-
var TabsContext = (0, import_react24.createContext)(null);
|
|
2189
|
-
function useTabsContext() {
|
|
2190
|
-
const ctx = (0, import_react24.useContext)(TabsContext);
|
|
2191
|
-
if (!ctx) throw new Error("Tabs \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Tabs> \u5185\u4F7F\u7528");
|
|
2192
|
-
return ctx;
|
|
2193
|
-
}
|
|
2194
|
-
var Tabs = (0, import_react24.forwardRef)(({ value, onValueChange, children, className }, ref) => {
|
|
2195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TabsContext.Provider, { value: { value, onValueChange }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, className: cn("w-full", className), children }) });
|
|
2196
|
-
});
|
|
2197
|
-
var TabsList = (0, import_react24.forwardRef)(({ className, children, ...props }, ref) => {
|
|
2198
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2199
|
-
"div",
|
|
2200
|
-
{
|
|
2201
|
-
ref,
|
|
2202
|
-
role: "tablist",
|
|
2203
|
-
className: cn("inline-flex w-full items-center gap-0 border-b border-border-base", className),
|
|
2204
|
-
...props,
|
|
2205
|
-
children
|
|
2206
|
-
}
|
|
2207
|
-
);
|
|
2208
|
-
});
|
|
2209
|
-
var TabsTrigger = (0, import_react24.forwardRef)(({ value, className, children, ...props }, ref) => {
|
|
2210
|
-
const { value: activeValue, onValueChange } = useTabsContext();
|
|
2211
|
-
const isActive = activeValue === value;
|
|
2212
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2213
|
-
"button",
|
|
2214
|
-
{
|
|
2215
|
-
ref,
|
|
2216
|
-
type: "button",
|
|
2217
|
-
role: "tab",
|
|
2218
|
-
"aria-selected": isActive,
|
|
2219
|
-
tabIndex: isActive ? 0 : -1,
|
|
2220
|
-
onClick: () => onValueChange(value),
|
|
2221
|
-
className: cn(
|
|
2222
|
-
"relative px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
|
|
2223
|
-
"after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-full after:transition-colors",
|
|
2224
|
-
isActive ? "text-text-primary after:bg-primary" : "text-text-secondary hover:text-text-primary after:bg-transparent",
|
|
2225
|
-
className
|
|
2226
|
-
),
|
|
2227
|
-
...props,
|
|
2228
|
-
children
|
|
2229
|
-
}
|
|
2230
|
-
);
|
|
2231
|
-
});
|
|
2232
|
-
var TabsContent = (0, import_react24.forwardRef)(({ value, className, children, ...props }, ref) => {
|
|
2233
|
-
const { value: activeValue } = useTabsContext();
|
|
2234
|
-
if (activeValue !== value) return null;
|
|
2235
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2236
|
-
"div",
|
|
2237
|
-
{
|
|
2238
|
-
ref,
|
|
2239
|
-
role: "tabpanel",
|
|
2240
|
-
tabIndex: 0,
|
|
2241
|
-
className: cn("mt-4 focus-visible:outline-none", className),
|
|
2242
|
-
...props,
|
|
2243
|
-
children
|
|
2244
|
-
}
|
|
2245
|
-
);
|
|
2246
|
-
});
|
|
2247
|
-
Tabs.displayName = "Tabs";
|
|
2248
|
-
TabsList.displayName = "TabsList";
|
|
2249
|
-
TabsTrigger.displayName = "TabsTrigger";
|
|
2250
|
-
TabsContent.displayName = "TabsContent";
|
|
2251
|
-
|
|
2252
|
-
// src/components/accordion.tsx
|
|
2253
|
-
var import_react25 = require("react");
|
|
2254
|
-
var import_lucide_react12 = require("lucide-react");
|
|
2255
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2256
|
-
var AccordionContext = (0, import_react25.createContext)(null);
|
|
2257
|
-
var AccordionItemContext = (0, import_react25.createContext)(null);
|
|
2258
|
-
function useAccordionContext() {
|
|
2259
|
-
const ctx = (0, import_react25.useContext)(AccordionContext);
|
|
2260
|
-
if (!ctx) throw new Error("Accordion \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Accordion> \u5185\u4F7F\u7528");
|
|
2261
|
-
return ctx;
|
|
2262
|
-
}
|
|
2263
|
-
function useAccordionItemContext() {
|
|
2264
|
-
const ctx = (0, import_react25.useContext)(AccordionItemContext);
|
|
2265
|
-
if (!ctx) throw new Error("AccordionTrigger/AccordionContent \u5FC5\u987B\u5728 <AccordionItem> \u5185\u4F7F\u7528");
|
|
2266
|
-
return ctx;
|
|
2267
|
-
}
|
|
2268
|
-
var Accordion = (0, import_react25.forwardRef)(
|
|
2269
|
-
(props, ref) => {
|
|
2270
|
-
const { type, children, className, ...rest } = props;
|
|
2271
|
-
const isSingle = type === "single";
|
|
2272
|
-
const singleProps = isSingle ? props : null;
|
|
2273
|
-
const multiProps = !isSingle ? props : null;
|
|
2274
|
-
const [internalSingle, setInternalSingle] = (0, import_react25.useState)(singleProps?.defaultValue ?? "");
|
|
2275
|
-
const [internalMulti, setInternalMulti] = (0, import_react25.useState)(multiProps?.defaultValue ?? []);
|
|
2276
|
-
const isControlledSingle = isSingle && singleProps?.value !== void 0;
|
|
2277
|
-
const isControlledMulti = !isSingle && multiProps?.value !== void 0;
|
|
2278
|
-
const value = isSingle ? isControlledSingle ? singleProps.value ?? "" : internalSingle : isControlledMulti ? multiProps.value ?? [] : internalMulti;
|
|
2279
|
-
const collapsible = isSingle ? singleProps?.collapsible ?? false : false;
|
|
2280
|
-
function handleValueChange(itemValue) {
|
|
2281
|
-
if (isSingle) {
|
|
2282
|
-
const current = value;
|
|
2283
|
-
const next = current === itemValue && collapsible ? "" : itemValue;
|
|
2284
|
-
if (!isControlledSingle) setInternalSingle(next);
|
|
2285
|
-
singleProps?.onValueChange?.(next);
|
|
2286
|
-
} else {
|
|
2287
|
-
const current = value;
|
|
2288
|
-
const next = current.includes(itemValue) ? current.filter((v) => v !== itemValue) : [...current, itemValue];
|
|
2289
|
-
if (!isControlledMulti) setInternalMulti(next);
|
|
2290
|
-
multiProps?.onValueChange?.(next);
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
const { defaultValue: _dv, onValueChange: _ov, collapsible: _col, ...domRest } = rest;
|
|
2294
|
-
void _dv;
|
|
2295
|
-
void _ov;
|
|
2296
|
-
void _col;
|
|
2297
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionContext.Provider, { value: { type, value, onValueChange: handleValueChange, collapsible }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: cn("w-full divide-y divide-border-base rounded-md border border-border-base", className), ...domRest, children }) });
|
|
2298
|
-
}
|
|
2299
|
-
);
|
|
2300
|
-
Accordion.displayName = "Accordion";
|
|
2301
|
-
var AccordionItem = (0, import_react25.forwardRef)(({ value, className, children, ...props }, ref) => {
|
|
2302
|
-
const { value: activeValue, type } = useAccordionContext();
|
|
2303
|
-
const isOpen = type === "single" ? activeValue === value : activeValue.includes(value);
|
|
2304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AccordionItemContext.Provider, { value: { value, isOpen }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: cn("", className), ...props, children }) });
|
|
2305
|
-
});
|
|
2306
|
-
AccordionItem.displayName = "AccordionItem";
|
|
2307
|
-
var AccordionTrigger = (0, import_react25.forwardRef)(({ className, children, ...props }, ref) => {
|
|
2308
|
-
const { onValueChange } = useAccordionContext();
|
|
2309
|
-
const { value, isOpen } = useAccordionItemContext();
|
|
2310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2311
|
-
"button",
|
|
2312
|
-
{
|
|
2313
|
-
ref,
|
|
2314
|
-
type: "button",
|
|
2315
|
-
"aria-expanded": isOpen,
|
|
2316
|
-
onClick: () => onValueChange(value),
|
|
2317
|
-
className: cn(
|
|
2318
|
-
"flex w-full items-center justify-between px-4 py-3 text-left text-sm font-medium text-text-primary transition-colors hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-inset",
|
|
2319
|
-
className
|
|
2320
|
-
),
|
|
2321
|
-
...props,
|
|
2322
|
-
children: [
|
|
2323
|
-
children,
|
|
2324
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2325
|
-
import_lucide_react12.ChevronDown,
|
|
2326
|
-
{
|
|
2327
|
-
size: 16,
|
|
2328
|
-
className: cn("shrink-0 text-text-secondary transition-transform duration-200", isOpen && "rotate-180")
|
|
2329
|
-
}
|
|
2330
|
-
)
|
|
2331
|
-
]
|
|
2332
|
-
}
|
|
2333
|
-
);
|
|
2334
|
-
});
|
|
2335
|
-
AccordionTrigger.displayName = "AccordionTrigger";
|
|
2336
|
-
var AccordionContent = (0, import_react25.forwardRef)(({ className, children, ...props }, ref) => {
|
|
2337
|
-
const { isOpen } = useAccordionItemContext();
|
|
2338
|
-
if (!isOpen) return null;
|
|
2339
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2340
|
-
"div",
|
|
2341
|
-
{
|
|
2342
|
-
ref,
|
|
2343
|
-
className: cn("px-4 pb-4 pt-1 text-sm text-text-secondary", className),
|
|
2344
|
-
...props,
|
|
2345
|
-
children
|
|
2346
|
-
}
|
|
2347
|
-
);
|
|
2348
|
-
});
|
|
2349
|
-
AccordionContent.displayName = "AccordionContent";
|
|
2350
|
-
|
|
2351
|
-
// src/components/steps.tsx
|
|
2352
|
-
var import_react26 = require("react");
|
|
2353
|
-
var import_lucide_react13 = require("lucide-react");
|
|
2354
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2355
|
-
var Steps = (0, import_react26.forwardRef)(
|
|
2356
|
-
({ current, items, direction = "horizontal", status = "process", className, ...props }, ref) => {
|
|
2357
|
-
const isHorizontal = direction === "horizontal";
|
|
2358
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2359
|
-
"div",
|
|
2360
|
-
{
|
|
2361
|
-
ref,
|
|
2362
|
-
className: cn(
|
|
2363
|
-
isHorizontal ? "flex items-start" : "flex flex-col gap-1",
|
|
2364
|
-
className
|
|
2365
|
-
),
|
|
2366
|
-
...props,
|
|
2367
|
-
children: items.map((item, index) => {
|
|
2368
|
-
const isFinished = index < current || index === current && status === "finish";
|
|
2369
|
-
const isCurrent = index === current && status !== "finish";
|
|
2370
|
-
const isError = index === current && status === "error";
|
|
2371
|
-
const isLast = index === items.length - 1;
|
|
2372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2373
|
-
"div",
|
|
2374
|
-
{
|
|
2375
|
-
className: cn(
|
|
2376
|
-
isHorizontal ? "flex flex-1 items-start" : "flex items-start"
|
|
2377
|
-
),
|
|
2378
|
-
children: [
|
|
2379
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("flex", isHorizontal ? "flex-col items-center" : "items-start"), children: [
|
|
2380
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2381
|
-
"div",
|
|
2382
|
-
{
|
|
2383
|
-
className: cn(
|
|
2384
|
-
"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold shadow-sm transition-colors",
|
|
2385
|
-
isFinished && "border-primary bg-primary text-primary-fg shadow-primary/20",
|
|
2386
|
-
isCurrent && !isError && "border-primary bg-primary-soft text-primary-soft-fg shadow-primary/10",
|
|
2387
|
-
isError && "border-danger bg-danger-soft text-danger-soft-fg shadow-danger/10",
|
|
2388
|
-
!isFinished && !isCurrent && !isError && "border-border-strong bg-surface-1 text-text-tertiary"
|
|
2389
|
-
),
|
|
2390
|
-
children: isFinished ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Check, { size: 16, strokeWidth: 2.5 }) : item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: index + 1 })
|
|
2391
|
-
}
|
|
2392
|
-
),
|
|
2393
|
-
!isLast && !isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2394
|
-
"div",
|
|
2395
|
-
{
|
|
2396
|
-
className: cn(
|
|
2397
|
-
"ml-[17px] mt-1 w-0.5 flex-1 self-stretch rounded-full",
|
|
2398
|
-
isFinished ? "bg-primary" : "bg-border-strong"
|
|
2399
|
-
),
|
|
2400
|
-
style: { minHeight: "26px" }
|
|
2401
|
-
}
|
|
2402
|
-
)
|
|
2403
|
-
] }),
|
|
2404
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2405
|
-
"div",
|
|
2406
|
-
{
|
|
2407
|
-
className: cn(
|
|
2408
|
-
isHorizontal ? "mt-2 text-center" : "ml-3.5 pb-5",
|
|
2409
|
-
isLast && !isHorizontal && "pb-0"
|
|
2410
|
-
),
|
|
2411
|
-
children: [
|
|
2412
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2413
|
-
"p",
|
|
2414
|
-
{
|
|
2415
|
-
className: cn(
|
|
2416
|
-
"text-sm font-semibold leading-5",
|
|
2417
|
-
isFinished && "text-text-primary",
|
|
2418
|
-
isCurrent && !isError && "text-primary",
|
|
2419
|
-
isError && "text-danger",
|
|
2420
|
-
!isFinished && !isCurrent && !isError && "text-text-tertiary"
|
|
2421
|
-
),
|
|
2422
|
-
children: item.title
|
|
2423
|
-
}
|
|
2424
|
-
),
|
|
2425
|
-
item.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2426
|
-
"p",
|
|
2427
|
-
{
|
|
2428
|
-
className: cn(
|
|
2429
|
-
"mt-0.5 text-xs leading-5",
|
|
2430
|
-
isError ? "text-danger" : "text-text-secondary"
|
|
2431
|
-
),
|
|
2432
|
-
children: item.description
|
|
2433
|
-
}
|
|
2434
|
-
)
|
|
2435
|
-
]
|
|
2436
|
-
}
|
|
2437
|
-
),
|
|
2438
|
-
!isLast && isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2439
|
-
"div",
|
|
2440
|
-
{
|
|
2441
|
-
className: cn(
|
|
2442
|
-
"mx-2 mt-4 h-0.5 flex-1",
|
|
2443
|
-
isFinished ? "bg-primary" : "bg-border-base"
|
|
2444
|
-
)
|
|
2445
|
-
}
|
|
2446
|
-
)
|
|
2447
|
-
]
|
|
2448
|
-
},
|
|
2449
|
-
index
|
|
2450
|
-
);
|
|
2451
|
-
})
|
|
2452
|
-
}
|
|
2453
|
-
);
|
|
2454
|
-
}
|
|
2455
|
-
);
|
|
2456
|
-
Steps.displayName = "Steps";
|
|
2457
|
-
|
|
2458
|
-
// src/components/dropdown.tsx
|
|
2459
|
-
var import_react27 = require("react");
|
|
2460
|
-
var import_react_dom5 = require("react-dom");
|
|
2461
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2462
|
-
var DropdownContext = (0, import_react27.createContext)(null);
|
|
2463
|
-
function assignRef(ref, value) {
|
|
2464
|
-
if (typeof ref === "function") {
|
|
2465
|
-
ref(value);
|
|
2466
|
-
return;
|
|
2467
|
-
}
|
|
2468
|
-
if (ref) {
|
|
2469
|
-
ref.current = value;
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
|
-
function useDropdownContext() {
|
|
2473
|
-
const ctx = (0, import_react27.useContext)(DropdownContext);
|
|
2474
|
-
if (!ctx) throw new Error("Dropdown \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <DropdownMenu> \u5185\u4F7F\u7528");
|
|
2475
|
-
return ctx;
|
|
2476
|
-
}
|
|
2477
|
-
var DropdownMenu = (0, import_react27.forwardRef)(({ children, className }, ref) => {
|
|
2478
|
-
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
2479
|
-
const triggerRef = (0, import_react27.useRef)(null);
|
|
2480
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownContext.Provider, { value: { open, setOpen, triggerRef }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("relative inline-block", className), children }) });
|
|
2481
|
-
});
|
|
2482
|
-
var DropdownTrigger = (0, import_react27.forwardRef)(({ children, className }, ref) => {
|
|
2483
|
-
const { setOpen, open, triggerRef } = useDropdownContext();
|
|
2484
|
-
const handleRef = (0, import_react27.useCallback)(
|
|
2485
|
-
(node) => {
|
|
2486
|
-
triggerRef.current = node;
|
|
2487
|
-
assignRef(ref, node);
|
|
2488
|
-
},
|
|
2489
|
-
[ref, triggerRef]
|
|
2490
|
-
);
|
|
2491
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2492
|
-
"div",
|
|
2493
|
-
{
|
|
2494
|
-
ref: handleRef,
|
|
2495
|
-
className: cn("inline-flex cursor-pointer", className),
|
|
2496
|
-
onClick: () => setOpen(!open),
|
|
2497
|
-
children
|
|
2498
|
-
}
|
|
2499
|
-
);
|
|
2500
|
-
});
|
|
2501
|
-
var DropdownContent = (0, import_react27.forwardRef)(({ children, className, align = "start" }, ref) => {
|
|
2502
|
-
const { open, setOpen, triggerRef } = useDropdownContext();
|
|
2503
|
-
const contentRef = (0, import_react27.useRef)(null);
|
|
2504
|
-
const portalContainer = usePortalContainer();
|
|
2505
|
-
const [position, setPosition] = (0, import_react27.useState)({ top: 0, left: 0 });
|
|
2506
|
-
const handleRef = (0, import_react27.useCallback)(
|
|
2507
|
-
(node) => {
|
|
2508
|
-
contentRef.current = node;
|
|
2509
|
-
assignRef(ref, node);
|
|
2510
|
-
},
|
|
2511
|
-
[ref]
|
|
2512
|
-
);
|
|
2513
|
-
const updatePosition = (0, import_react27.useCallback)(() => {
|
|
2514
|
-
if (!triggerRef.current) return;
|
|
2515
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
2516
|
-
const top = rect.bottom + window.scrollY + 4;
|
|
2517
|
-
const left = align === "end" ? rect.right + window.scrollX - (contentRef.current?.offsetWidth ?? 0) : rect.left + window.scrollX;
|
|
2518
|
-
setPosition({ top, left });
|
|
2519
|
-
}, [align, triggerRef]);
|
|
2520
|
-
(0, import_react27.useEffect)(() => {
|
|
2521
|
-
if (!open) return;
|
|
2522
|
-
updatePosition();
|
|
2523
|
-
}, [open, updatePosition]);
|
|
2524
|
-
(0, import_react27.useEffect)(() => {
|
|
2525
|
-
if (!open) return;
|
|
2526
|
-
function handleClickOutside(e) {
|
|
2527
|
-
if (contentRef.current && !contentRef.current.contains(e.target) && triggerRef.current && !triggerRef.current.contains(e.target)) {
|
|
2528
|
-
setOpen(false);
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
2532
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2533
|
-
}, [open, setOpen, triggerRef]);
|
|
2534
|
-
if (!open || !portalContainer) return null;
|
|
2535
|
-
return (0, import_react_dom5.createPortal)(
|
|
2536
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2537
|
-
"div",
|
|
2538
|
-
{
|
|
2539
|
-
ref: handleRef,
|
|
2540
|
-
style: { top: position.top, left: position.left },
|
|
2541
|
-
className: cn(
|
|
2542
|
-
"absolute z-50 min-w-44 overflow-hidden rounded-lg border border-border-base bg-surface-1 p-1 text-text-primary shadow-xl",
|
|
2543
|
-
className
|
|
2544
|
-
),
|
|
2545
|
-
children
|
|
2546
|
-
}
|
|
2547
|
-
),
|
|
2548
|
-
portalContainer
|
|
2549
|
-
);
|
|
2550
|
-
});
|
|
2551
|
-
var DropdownItem = (0, import_react27.forwardRef)(({ children, className, destructive = false, onClick, ...props }, ref) => {
|
|
2552
|
-
const { setOpen } = useDropdownContext();
|
|
2553
|
-
function handleClick(e) {
|
|
2554
|
-
setOpen(false);
|
|
2555
|
-
onClick?.(e);
|
|
2556
|
-
}
|
|
2557
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2558
|
-
"button",
|
|
2559
|
-
{
|
|
2560
|
-
ref,
|
|
2561
|
-
type: "button",
|
|
2562
|
-
className: cn(
|
|
2563
|
-
"flex min-h-8 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm leading-none transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
2564
|
-
destructive ? "text-danger hover:bg-danger-soft focus-visible:bg-danger-soft" : "text-text-primary hover:bg-surface-2 focus-visible:bg-surface-2",
|
|
2565
|
-
className
|
|
2566
|
-
),
|
|
2567
|
-
onClick: handleClick,
|
|
2568
|
-
...props,
|
|
2569
|
-
children
|
|
2570
|
-
}
|
|
2571
|
-
);
|
|
2572
|
-
});
|
|
2573
|
-
var DropdownSeparator = (0, import_react27.forwardRef)(({ className, ...props }, ref) => {
|
|
2574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className: cn("-mx-1 my-1 h-px bg-border-base", className), ...props });
|
|
2575
|
-
});
|
|
2576
|
-
DropdownMenu.displayName = "DropdownMenu";
|
|
2577
|
-
DropdownTrigger.displayName = "DropdownTrigger";
|
|
2578
|
-
DropdownContent.displayName = "DropdownContent";
|
|
2579
|
-
DropdownItem.displayName = "DropdownItem";
|
|
2580
|
-
DropdownSeparator.displayName = "DropdownSeparator";
|
|
2581
|
-
|
|
2582
|
-
// src/components/popover.tsx
|
|
2583
|
-
var import_react28 = require("react");
|
|
2584
|
-
var import_react_dom6 = require("react-dom");
|
|
2585
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2586
|
-
var PopoverContext = (0, import_react28.createContext)(null);
|
|
2587
|
-
function usePopoverContext() {
|
|
2588
|
-
const ctx = (0, import_react28.useContext)(PopoverContext);
|
|
2589
|
-
if (!ctx) throw new Error("Popover \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Popover> \u5185\u4F7F\u7528");
|
|
2590
|
-
return ctx;
|
|
2591
|
-
}
|
|
2592
|
-
function assignRef2(ref, value) {
|
|
2593
|
-
if (typeof ref === "function") {
|
|
2594
|
-
ref(value);
|
|
2595
|
-
return;
|
|
2596
|
-
}
|
|
2597
|
-
if (ref) {
|
|
2598
|
-
ref.current = value;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
var Popover = ({ open: controlledOpen, defaultOpen = false, onOpenChange, children }) => {
|
|
2602
|
-
const [internalOpen, setInternalOpen] = (0, import_react28.useState)(defaultOpen);
|
|
2603
|
-
const triggerRef = (0, import_react28.useRef)(null);
|
|
2604
|
-
const isControlled = controlledOpen !== void 0;
|
|
2605
|
-
const open = isControlled ? controlledOpen : internalOpen;
|
|
2606
|
-
const setOpen = (0, import_react28.useCallback)(
|
|
2607
|
-
(value) => {
|
|
2608
|
-
if (!isControlled) setInternalOpen(value);
|
|
2609
|
-
onOpenChange?.(value);
|
|
2610
|
-
},
|
|
2611
|
-
[isControlled, onOpenChange]
|
|
2612
|
-
);
|
|
2613
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverContext.Provider, { value: { open, setOpen, triggerRef }, children });
|
|
2614
|
-
};
|
|
2615
|
-
Popover.displayName = "Popover";
|
|
2616
|
-
var PopoverTrigger = (0, import_react28.forwardRef)(({ children, className }, ref) => {
|
|
2617
|
-
const { setOpen, open, triggerRef } = usePopoverContext();
|
|
2618
|
-
const handleRef = (0, import_react28.useCallback)(
|
|
2619
|
-
(node) => {
|
|
2620
|
-
triggerRef.current = node;
|
|
2621
|
-
assignRef2(ref, node);
|
|
2622
|
-
},
|
|
2623
|
-
[ref, triggerRef]
|
|
2624
|
-
);
|
|
2625
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2626
|
-
"div",
|
|
2627
|
-
{
|
|
2628
|
-
ref: handleRef,
|
|
2629
|
-
className: cn("inline-flex", className),
|
|
2630
|
-
onClick: () => setOpen(!open),
|
|
2631
|
-
children
|
|
2632
|
-
}
|
|
2633
|
-
);
|
|
2634
|
-
});
|
|
2635
|
-
PopoverTrigger.displayName = "PopoverTrigger";
|
|
2636
|
-
function calcPosition(triggerRect, contentEl, side, align, sideOffset) {
|
|
2637
|
-
const cw = contentEl.offsetWidth;
|
|
2638
|
-
const ch = contentEl.offsetHeight;
|
|
2639
|
-
let top = 0;
|
|
2640
|
-
let left = 0;
|
|
2641
|
-
if (side === "bottom") {
|
|
2642
|
-
top = triggerRect.bottom + window.scrollY + sideOffset;
|
|
2643
|
-
} else if (side === "top") {
|
|
2644
|
-
top = triggerRect.top + window.scrollY - ch - sideOffset;
|
|
2645
|
-
} else if (side === "left") {
|
|
2646
|
-
top = triggerRect.top + window.scrollY + triggerRect.height / 2 - ch / 2;
|
|
2647
|
-
left = triggerRect.left + window.scrollX - cw - sideOffset;
|
|
2648
|
-
return { top, left };
|
|
2649
|
-
} else {
|
|
2650
|
-
top = triggerRect.top + window.scrollY + triggerRect.height / 2 - ch / 2;
|
|
2651
|
-
left = triggerRect.right + window.scrollX + sideOffset;
|
|
2652
|
-
return { top, left };
|
|
2653
|
-
}
|
|
2654
|
-
if (align === "start") {
|
|
2655
|
-
left = triggerRect.left + window.scrollX;
|
|
2656
|
-
} else if (align === "end") {
|
|
2657
|
-
left = triggerRect.right + window.scrollX - cw;
|
|
2658
|
-
} else {
|
|
2659
|
-
left = triggerRect.left + window.scrollX + triggerRect.width / 2 - cw / 2;
|
|
2660
|
-
}
|
|
2661
|
-
return { top, left };
|
|
2662
|
-
}
|
|
2663
|
-
var PopoverContent = (0, import_react28.forwardRef)(
|
|
2664
|
-
({ children, className, side = "bottom", align = "center", sideOffset = 4, ...props }, ref) => {
|
|
2665
|
-
const { open, setOpen, triggerRef } = usePopoverContext();
|
|
2666
|
-
const contentRef = (0, import_react28.useRef)(null);
|
|
2667
|
-
const portalContainer = usePortalContainer();
|
|
2668
|
-
const [pos, setPos] = (0, import_react28.useState)({ top: 0, left: 0 });
|
|
2669
|
-
const handleRef = (0, import_react28.useCallback)(
|
|
2670
|
-
(node) => {
|
|
2671
|
-
contentRef.current = node;
|
|
2672
|
-
assignRef2(ref, node);
|
|
2673
|
-
},
|
|
2674
|
-
[ref]
|
|
2675
|
-
);
|
|
2676
|
-
const updatePos = (0, import_react28.useCallback)(() => {
|
|
2677
|
-
if (!triggerRef.current || !contentRef.current) return;
|
|
2678
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
2679
|
-
setPos(calcPosition(rect, contentRef.current, side, align, sideOffset));
|
|
2680
|
-
}, [side, align, sideOffset, triggerRef]);
|
|
2681
|
-
(0, import_react28.useEffect)(() => {
|
|
2682
|
-
if (open) updatePos();
|
|
2683
|
-
}, [open, updatePos]);
|
|
2684
|
-
(0, import_react28.useEffect)(() => {
|
|
2685
|
-
if (!open) return;
|
|
2686
|
-
function handleMouseDown(e) {
|
|
2687
|
-
if (contentRef.current && !contentRef.current.contains(e.target) && triggerRef.current && !triggerRef.current.contains(e.target)) {
|
|
2688
|
-
setOpen(false);
|
|
2689
|
-
}
|
|
2690
|
-
}
|
|
2691
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
2692
|
-
return () => document.removeEventListener("mousedown", handleMouseDown);
|
|
2693
|
-
}, [open, setOpen, triggerRef]);
|
|
2694
|
-
if (!open || !portalContainer) return null;
|
|
2695
|
-
return (0, import_react_dom6.createPortal)(
|
|
2696
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2697
|
-
"div",
|
|
2698
|
-
{
|
|
2699
|
-
ref: handleRef,
|
|
2700
|
-
style: { top: pos.top, left: pos.left },
|
|
2701
|
-
className: cn(
|
|
2702
|
-
"absolute z-50 min-w-40 rounded-md border border-border-base bg-surface-1 p-3 shadow-lg",
|
|
2703
|
-
className
|
|
2704
|
-
),
|
|
2705
|
-
...props,
|
|
2706
|
-
children
|
|
2707
|
-
}
|
|
2708
|
-
),
|
|
2709
|
-
portalContainer
|
|
2710
|
-
);
|
|
2711
|
-
}
|
|
2712
|
-
);
|
|
2713
|
-
PopoverContent.displayName = "PopoverContent";
|
|
2714
|
-
|
|
2715
|
-
// src/components/context-menu.tsx
|
|
2716
|
-
var import_react29 = require("react");
|
|
2717
|
-
var import_react_dom7 = require("react-dom");
|
|
2718
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2719
|
-
var ContextMenuContext = (0, import_react29.createContext)(null);
|
|
2720
|
-
function useContextMenuContext() {
|
|
2721
|
-
const ctx = (0, import_react29.useContext)(ContextMenuContext);
|
|
2722
|
-
if (!ctx) throw new Error("ContextMenu \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <ContextMenu> \u5185\u4F7F\u7528");
|
|
2723
|
-
return ctx;
|
|
2724
|
-
}
|
|
2725
|
-
function assignRef3(ref, value) {
|
|
2726
|
-
if (typeof ref === "function") {
|
|
2727
|
-
ref(value);
|
|
2728
|
-
return;
|
|
2729
|
-
}
|
|
2730
|
-
if (ref) {
|
|
2731
|
-
ref.current = value;
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
var ContextMenu = (0, import_react29.forwardRef)(
|
|
2735
|
-
({ children, className }, ref) => {
|
|
2736
|
-
const [open, setOpen] = (0, import_react29.useState)(false);
|
|
2737
|
-
const [position, setPosition] = (0, import_react29.useState)({ x: 0, y: 0 });
|
|
2738
|
-
const openAt = (0, import_react29.useCallback)((pos) => {
|
|
2739
|
-
setPosition(pos);
|
|
2740
|
-
setOpen(true);
|
|
2741
|
-
}, []);
|
|
2742
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextMenuContext.Provider, { value: { open, position, setOpen, openAt }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: cn("relative", className), children }) });
|
|
2743
|
-
}
|
|
2744
|
-
);
|
|
2745
|
-
var ContextMenuTrigger = (0, import_react29.forwardRef)(
|
|
2746
|
-
({ children, className, ...props }, ref) => {
|
|
2747
|
-
const { openAt } = useContextMenuContext();
|
|
2748
|
-
function handleContextMenu(e) {
|
|
2749
|
-
e.preventDefault();
|
|
2750
|
-
openAt({ x: e.clientX, y: e.clientY });
|
|
2751
|
-
}
|
|
2752
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2753
|
-
"div",
|
|
2754
|
-
{
|
|
2755
|
-
ref,
|
|
2756
|
-
className: cn(className),
|
|
2757
|
-
onContextMenu: handleContextMenu,
|
|
2758
|
-
...props,
|
|
2759
|
-
children
|
|
2760
|
-
}
|
|
2761
|
-
);
|
|
2762
|
-
}
|
|
2763
|
-
);
|
|
2764
|
-
var ContextMenuContent = (0, import_react29.forwardRef)(
|
|
2765
|
-
({ children, className, ...props }, ref) => {
|
|
2766
|
-
const { open, position, setOpen } = useContextMenuContext();
|
|
2767
|
-
const contentRef = (0, import_react29.useRef)(null);
|
|
2768
|
-
const portalContainer = usePortalContainer();
|
|
2769
|
-
const handleRef = (0, import_react29.useCallback)(
|
|
2770
|
-
(node) => {
|
|
2771
|
-
contentRef.current = node;
|
|
2772
|
-
assignRef3(ref, node);
|
|
2773
|
-
},
|
|
2774
|
-
[ref]
|
|
2775
|
-
);
|
|
2776
|
-
(0, import_react29.useEffect)(() => {
|
|
2777
|
-
if (!open) return;
|
|
2778
|
-
function handleMouseDown(e) {
|
|
2779
|
-
if (contentRef.current && !contentRef.current.contains(e.target)) {
|
|
2780
|
-
setOpen(false);
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
function handleKeyDown(e) {
|
|
2784
|
-
if (e.key === "Escape") {
|
|
2785
|
-
setOpen(false);
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
2789
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
2790
|
-
return () => {
|
|
2791
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
2792
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
2793
|
-
};
|
|
2794
|
-
}, [open, setOpen]);
|
|
2795
|
-
if (!open || !portalContainer) return null;
|
|
2796
|
-
return (0, import_react_dom7.createPortal)(
|
|
2797
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2798
|
-
"div",
|
|
2799
|
-
{
|
|
2800
|
-
ref: handleRef,
|
|
2801
|
-
style: { top: position.y, left: position.x },
|
|
2802
|
-
className: cn(
|
|
2803
|
-
"fixed z-50 min-w-40 rounded-md border border-border-base bg-surface-1 py-1 shadow-lg",
|
|
2804
|
-
className
|
|
2805
|
-
),
|
|
2806
|
-
...props,
|
|
2807
|
-
children
|
|
2808
|
-
}
|
|
2809
|
-
),
|
|
2810
|
-
portalContainer
|
|
2811
|
-
);
|
|
2812
|
-
}
|
|
2813
|
-
);
|
|
2814
|
-
var ContextMenuItem = (0, import_react29.forwardRef)(
|
|
2815
|
-
({ children, className, destructive = false, onClick, ...props }, ref) => {
|
|
2816
|
-
const { setOpen } = useContextMenuContext();
|
|
2817
|
-
function handleClick(e) {
|
|
2818
|
-
setOpen(false);
|
|
2819
|
-
onClick?.(e);
|
|
2820
|
-
}
|
|
2821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2822
|
-
"button",
|
|
2823
|
-
{
|
|
2824
|
-
ref,
|
|
2825
|
-
type: "button",
|
|
2826
|
-
className: cn(
|
|
2827
|
-
"w-full px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:bg-surface-3",
|
|
2828
|
-
destructive ? "text-danger hover:bg-danger-soft/10" : "text-text-primary hover:bg-surface-3",
|
|
2829
|
-
className
|
|
2830
|
-
),
|
|
2831
|
-
onClick: handleClick,
|
|
2832
|
-
...props,
|
|
2833
|
-
children
|
|
2834
|
-
}
|
|
2835
|
-
);
|
|
2836
|
-
}
|
|
2837
|
-
);
|
|
2838
|
-
var ContextMenuSeparator = (0, import_react29.forwardRef)(
|
|
2839
|
-
({ className, ...props }, ref) => {
|
|
2840
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: cn("my-1 h-px bg-border-base", className), ...props });
|
|
2841
|
-
}
|
|
2842
|
-
);
|
|
2843
|
-
ContextMenu.displayName = "ContextMenu";
|
|
2844
|
-
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
2845
|
-
ContextMenuContent.displayName = "ContextMenuContent";
|
|
2846
|
-
ContextMenuItem.displayName = "ContextMenuItem";
|
|
2847
|
-
ContextMenuSeparator.displayName = "ContextMenuSeparator";
|
|
2848
|
-
|
|
2849
|
-
// src/components/navigation-menu.tsx
|
|
2850
|
-
var import_react30 = require("react");
|
|
2851
|
-
var import_lucide_react14 = require("lucide-react");
|
|
2852
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2853
|
-
var NavigationMenuContext = (0, import_react30.createContext)(null);
|
|
2854
|
-
function useNavigationMenuContext() {
|
|
2855
|
-
const ctx = (0, import_react30.useContext)(NavigationMenuContext);
|
|
2856
|
-
if (!ctx) throw new Error("NavigationMenu \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <NavigationMenu> \u5185\u4F7F\u7528");
|
|
2857
|
-
return ctx;
|
|
2858
|
-
}
|
|
2859
|
-
var NavigationMenuItemContext = (0, import_react30.createContext)(null);
|
|
2860
|
-
function useNavigationMenuItemContext() {
|
|
2861
|
-
const ctx = (0, import_react30.useContext)(NavigationMenuItemContext);
|
|
2862
|
-
if (!ctx) throw new Error("NavigationMenuTrigger/Content \u5FC5\u987B\u5728 <NavigationMenuItem> \u5185\u4F7F\u7528");
|
|
2863
|
-
return ctx;
|
|
2864
|
-
}
|
|
2865
|
-
var _idCounter = 0;
|
|
2866
|
-
var NavigationMenu = (0, import_react30.forwardRef)(
|
|
2867
|
-
({ className, children, ...props }, ref) => {
|
|
2868
|
-
const [activeItem, setActiveItem] = (0, import_react30.useState)(null);
|
|
2869
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NavigationMenuContext.Provider, { value: { activeItem, setActiveItem }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2870
|
-
"nav",
|
|
2871
|
-
{
|
|
2872
|
-
ref,
|
|
2873
|
-
className: cn("relative flex items-center gap-1", className),
|
|
2874
|
-
...props,
|
|
2875
|
-
children
|
|
2876
|
-
}
|
|
2877
|
-
) });
|
|
2878
|
-
}
|
|
2879
|
-
);
|
|
2880
|
-
var NavigationMenuItem = (0, import_react30.forwardRef)(
|
|
2881
|
-
({ className, children, ...props }, ref) => {
|
|
2882
|
-
const itemIdRef = (0, import_react30.useRef)(`nav-item-${++_idCounter}`);
|
|
2883
|
-
const { activeItem, setActiveItem } = useNavigationMenuContext();
|
|
2884
|
-
const isOpen = activeItem === itemIdRef.current;
|
|
2885
|
-
const handleMouseEnter = (0, import_react30.useCallback)(() => {
|
|
2886
|
-
setActiveItem(itemIdRef.current);
|
|
2887
|
-
}, [setActiveItem]);
|
|
2888
|
-
const handleMouseLeave = (0, import_react30.useCallback)(() => {
|
|
2889
|
-
setActiveItem(null);
|
|
2890
|
-
}, [setActiveItem]);
|
|
2891
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NavigationMenuItemContext.Provider, { value: { itemId: itemIdRef.current }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2892
|
-
"div",
|
|
2893
|
-
{
|
|
2894
|
-
ref,
|
|
2895
|
-
className: cn("relative", className),
|
|
2896
|
-
onMouseEnter: handleMouseEnter,
|
|
2897
|
-
onMouseLeave: handleMouseLeave,
|
|
2898
|
-
"data-state": isOpen ? "open" : "closed",
|
|
2899
|
-
...props,
|
|
2900
|
-
children
|
|
2901
|
-
}
|
|
2902
|
-
) });
|
|
2903
|
-
}
|
|
2904
|
-
);
|
|
2905
|
-
var NavigationMenuLink = (0, import_react30.forwardRef)(
|
|
2906
|
-
({ className, active = false, children, ...props }, ref) => {
|
|
2907
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2908
|
-
"a",
|
|
2909
|
-
{
|
|
2910
|
-
ref,
|
|
2911
|
-
className: cn(
|
|
2912
|
-
"inline-flex items-center rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
|
|
2913
|
-
active ? "bg-surface-3 text-text-primary" : "text-text-secondary hover:bg-surface-3 hover:text-text-primary",
|
|
2914
|
-
className
|
|
2915
|
-
),
|
|
2916
|
-
...props,
|
|
2917
|
-
children
|
|
2918
|
-
}
|
|
2919
|
-
);
|
|
2920
|
-
}
|
|
2921
|
-
);
|
|
2922
|
-
var NavigationMenuTrigger = (0, import_react30.forwardRef)(
|
|
2923
|
-
({ className, children, ...props }, ref) => {
|
|
2924
|
-
const { activeItem } = useNavigationMenuContext();
|
|
2925
|
-
const { itemId } = useNavigationMenuItemContext();
|
|
2926
|
-
const isOpen = activeItem === itemId;
|
|
2927
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2928
|
-
"button",
|
|
2929
|
-
{
|
|
2930
|
-
ref,
|
|
2931
|
-
type: "button",
|
|
2932
|
-
"aria-expanded": isOpen,
|
|
2933
|
-
className: cn(
|
|
2934
|
-
"inline-flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1",
|
|
2935
|
-
isOpen ? "bg-surface-3 text-text-primary" : "text-text-secondary hover:bg-surface-3 hover:text-text-primary",
|
|
2936
|
-
className
|
|
2937
|
-
),
|
|
2938
|
-
...props,
|
|
2939
|
-
children: [
|
|
2940
|
-
children,
|
|
2941
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2942
|
-
import_lucide_react14.ChevronDown,
|
|
2943
|
-
{
|
|
2944
|
-
size: 14,
|
|
2945
|
-
className: cn("transition-transform duration-200", isOpen && "rotate-180")
|
|
2946
|
-
}
|
|
2947
|
-
)
|
|
2948
|
-
]
|
|
2949
|
-
}
|
|
2950
|
-
);
|
|
2951
|
-
}
|
|
2952
|
-
);
|
|
2953
|
-
var NavigationMenuContent = (0, import_react30.forwardRef)(
|
|
2954
|
-
({ className, children, ...props }, ref) => {
|
|
2955
|
-
const { activeItem } = useNavigationMenuContext();
|
|
2956
|
-
const { itemId } = useNavigationMenuItemContext();
|
|
2957
|
-
const isOpen = activeItem === itemId;
|
|
2958
|
-
if (!isOpen) return null;
|
|
2959
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2960
|
-
"div",
|
|
2961
|
-
{
|
|
2962
|
-
ref,
|
|
2963
|
-
className: cn(
|
|
2964
|
-
"absolute left-0 top-full z-50 mt-1 min-w-40 rounded-md border border-border-base bg-surface-1 py-1 shadow-lg",
|
|
2965
|
-
className
|
|
2966
|
-
),
|
|
2967
|
-
...props,
|
|
2968
|
-
children
|
|
2969
|
-
}
|
|
2970
|
-
);
|
|
2971
|
-
}
|
|
2972
|
-
);
|
|
2973
|
-
NavigationMenu.displayName = "NavigationMenu";
|
|
2974
|
-
NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
2975
|
-
NavigationMenuLink.displayName = "NavigationMenuLink";
|
|
2976
|
-
NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
|
|
2977
|
-
NavigationMenuContent.displayName = "NavigationMenuContent";
|
|
2978
|
-
|
|
2979
|
-
// src/components/avatar.tsx
|
|
2980
|
-
var import_react31 = require("react");
|
|
2981
|
-
var import_lucide_react15 = require("lucide-react");
|
|
2982
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
2983
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2984
|
-
var AvatarContext = (0, import_react31.createContext)(null);
|
|
2985
|
-
function useAvatarContext(componentName) {
|
|
2986
|
-
const ctx = (0, import_react31.useContext)(AvatarContext);
|
|
2987
|
-
if (!ctx) {
|
|
2988
|
-
throw new Error(`<${componentName}> \u5FC5\u987B\u5728 <Avatar> \u5185\u4F7F\u7528`);
|
|
2989
|
-
}
|
|
2990
|
-
return ctx;
|
|
2991
|
-
}
|
|
2992
|
-
var avatarVariants = (0, import_class_variance_authority8.cva)(
|
|
2993
|
-
"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-surface-3",
|
|
2994
|
-
{
|
|
2995
|
-
variants: {
|
|
2996
|
-
size: {
|
|
2997
|
-
sm: "h-8 w-8 text-xs",
|
|
2998
|
-
md: "h-10 w-10 text-sm",
|
|
2999
|
-
lg: "h-14 w-14 text-base",
|
|
3000
|
-
xl: "h-20 w-20 text-xl"
|
|
3001
|
-
}
|
|
3002
|
-
},
|
|
3003
|
-
defaultVariants: { size: "md" }
|
|
3004
|
-
}
|
|
3005
|
-
);
|
|
3006
|
-
var Avatar = (0, import_react31.forwardRef)(
|
|
3007
|
-
({ size, className, children, ...props }, ref) => {
|
|
3008
|
-
const [imageLoadingStatus, setImageLoadingStatus] = (0, import_react31.useState)("idle");
|
|
3009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AvatarContext.Provider, { value: { imageLoadingStatus, setImageLoadingStatus }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { ref, className: cn(avatarVariants({ size }), className), ...props, children }) });
|
|
3010
|
-
}
|
|
3011
|
-
);
|
|
3012
|
-
var AvatarImage = (0, import_react31.forwardRef)(
|
|
3013
|
-
({ src, alt = "", className, onLoad, onError, ...props }, ref) => {
|
|
3014
|
-
const { imageLoadingStatus, setImageLoadingStatus } = useAvatarContext("AvatarImage");
|
|
3015
|
-
(0, import_react31.useEffect)(() => {
|
|
3016
|
-
if (!src) {
|
|
3017
|
-
setImageLoadingStatus("error");
|
|
3018
|
-
return;
|
|
3019
|
-
}
|
|
3020
|
-
setImageLoadingStatus("loading");
|
|
3021
|
-
}, [src, setImageLoadingStatus]);
|
|
3022
|
-
if (imageLoadingStatus !== "loaded" && imageLoadingStatus !== "loading") {
|
|
3023
|
-
return null;
|
|
3024
|
-
}
|
|
3025
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3026
|
-
"img",
|
|
3027
|
-
{
|
|
3028
|
-
ref,
|
|
3029
|
-
src,
|
|
3030
|
-
alt,
|
|
3031
|
-
onLoad: (event) => {
|
|
3032
|
-
setImageLoadingStatus("loaded");
|
|
3033
|
-
onLoad?.(event);
|
|
3034
|
-
},
|
|
3035
|
-
onError: (event) => {
|
|
3036
|
-
setImageLoadingStatus("error");
|
|
3037
|
-
onError?.(event);
|
|
3038
|
-
},
|
|
3039
|
-
className: cn(
|
|
3040
|
-
"h-full w-full object-cover",
|
|
3041
|
-
imageLoadingStatus === "loading" && "invisible",
|
|
3042
|
-
className
|
|
3043
|
-
),
|
|
3044
|
-
...props
|
|
3045
|
-
}
|
|
3046
|
-
);
|
|
3047
|
-
}
|
|
3048
|
-
);
|
|
3049
|
-
var AvatarFallback = (0, import_react31.forwardRef)(
|
|
3050
|
-
({ className, children, ...props }, ref) => {
|
|
3051
|
-
const { imageLoadingStatus } = useAvatarContext("AvatarFallback");
|
|
3052
|
-
if (imageLoadingStatus === "loaded") return null;
|
|
3053
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3054
|
-
"span",
|
|
3055
|
-
{
|
|
3056
|
-
ref,
|
|
3057
|
-
className: cn(
|
|
3058
|
-
"absolute inset-0 flex items-center justify-center font-medium text-text-secondary",
|
|
3059
|
-
className
|
|
3060
|
-
),
|
|
3061
|
-
...props,
|
|
3062
|
-
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.User, { size: 16 })
|
|
3063
|
-
}
|
|
3064
|
-
);
|
|
3065
|
-
}
|
|
3066
|
-
);
|
|
3067
|
-
Avatar.displayName = "Avatar";
|
|
3068
|
-
AvatarImage.displayName = "AvatarImage";
|
|
3069
|
-
AvatarFallback.displayName = "AvatarFallback";
|
|
3070
|
-
|
|
3071
|
-
// src/components/avatar-group.tsx
|
|
3072
|
-
var import_react32 = require("react");
|
|
3073
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3074
|
-
var SIZE_CLASSES = {
|
|
3075
|
-
sm: "h-8 w-8 text-xs",
|
|
3076
|
-
default: "h-10 w-10 text-sm",
|
|
3077
|
-
lg: "h-14 w-14 text-base"
|
|
3078
|
-
};
|
|
3079
|
-
var RING_SIZE_CLASSES = {
|
|
3080
|
-
sm: "ring-2",
|
|
3081
|
-
default: "ring-2",
|
|
3082
|
-
lg: "ring-[3px]"
|
|
3083
|
-
};
|
|
3084
|
-
var OVERLAP_CLASSES = {
|
|
3085
|
-
sm: "-ml-1.5",
|
|
3086
|
-
default: "-ml-2",
|
|
3087
|
-
lg: "-ml-3"
|
|
3088
|
-
};
|
|
3089
|
-
var AvatarGroup = (0, import_react32.forwardRef)(
|
|
3090
|
-
({ max = 5, size = "default", className, children, ...props }, ref) => {
|
|
3091
|
-
const allItems = import_react32.Children.toArray(children).filter(import_react32.isValidElement);
|
|
3092
|
-
const visibleItems = allItems.slice(0, max);
|
|
3093
|
-
const overflowCount = allItems.length - max;
|
|
3094
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3095
|
-
"div",
|
|
3096
|
-
{
|
|
3097
|
-
ref,
|
|
3098
|
-
className: cn("flex max-w-full items-center overflow-hidden py-0.5", className),
|
|
3099
|
-
...props,
|
|
3100
|
-
children: [
|
|
3101
|
-
visibleItems.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3102
|
-
"span",
|
|
3103
|
-
{
|
|
3104
|
-
className: cn(
|
|
3105
|
-
"relative inline-flex shrink-0 overflow-hidden rounded-full border border-border-base bg-surface-2 ring-surface-1",
|
|
3106
|
-
SIZE_CLASSES[size],
|
|
3107
|
-
RING_SIZE_CLASSES[size],
|
|
3108
|
-
idx > 0 && OVERLAP_CLASSES[size]
|
|
3109
|
-
),
|
|
3110
|
-
children: child
|
|
3111
|
-
},
|
|
3112
|
-
idx
|
|
3113
|
-
)),
|
|
3114
|
-
overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3115
|
-
"span",
|
|
3116
|
-
{
|
|
3117
|
-
className: cn(
|
|
3118
|
-
"relative inline-flex shrink-0 items-center justify-center rounded-full border border-border-base bg-surface-2 font-medium text-text-secondary ring-surface-1",
|
|
3119
|
-
SIZE_CLASSES[size],
|
|
3120
|
-
RING_SIZE_CLASSES[size],
|
|
3121
|
-
OVERLAP_CLASSES[size]
|
|
3122
|
-
),
|
|
3123
|
-
"aria-label": `\u8FD8\u6709 ${overflowCount} \u4EBA`,
|
|
3124
|
-
children: [
|
|
3125
|
-
"+",
|
|
3126
|
-
overflowCount
|
|
3127
|
-
]
|
|
3128
|
-
}
|
|
3129
|
-
)
|
|
3130
|
-
]
|
|
3131
|
-
}
|
|
3132
|
-
);
|
|
3133
|
-
}
|
|
3134
|
-
);
|
|
3135
|
-
AvatarGroup.displayName = "AvatarGroup";
|
|
3136
|
-
|
|
3137
|
-
// src/components/tooltip.tsx
|
|
3138
|
-
var import_react33 = require("react");
|
|
3139
|
-
var import_react_dom8 = require("react-dom");
|
|
3140
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3141
|
-
var TooltipContext = (0, import_react33.createContext)(null);
|
|
3142
|
-
function assignRef4(ref, value) {
|
|
3143
|
-
if (typeof ref === "function") {
|
|
3144
|
-
ref(value);
|
|
3145
|
-
return;
|
|
3146
|
-
}
|
|
3147
|
-
if (ref) {
|
|
3148
|
-
ref.current = value;
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
function useTooltipContext() {
|
|
3152
|
-
const ctx = (0, import_react33.useContext)(TooltipContext);
|
|
3153
|
-
if (!ctx) throw new Error("Tooltip \u5B50\u7EC4\u4EF6\u5FC5\u987B\u5728 <Tooltip> \u5185\u4F7F\u7528");
|
|
3154
|
-
return ctx;
|
|
3155
|
-
}
|
|
3156
|
-
var Tooltip = (0, import_react33.forwardRef)(({ children, className }, ref) => {
|
|
3157
|
-
const [open, setOpen] = (0, import_react33.useState)(false);
|
|
3158
|
-
const triggerRef = (0, import_react33.useRef)(null);
|
|
3159
|
-
const delayRef = (0, import_react33.useRef)(null);
|
|
3160
|
-
(0, import_react33.useEffect)(() => {
|
|
3161
|
-
return () => {
|
|
3162
|
-
if (delayRef.current) {
|
|
3163
|
-
clearTimeout(delayRef.current);
|
|
3164
|
-
}
|
|
3165
|
-
};
|
|
3166
|
-
}, []);
|
|
3167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContext.Provider, { value: { open, setOpen, triggerRef, delayRef }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { ref, className: cn("relative inline-flex", className), children }) });
|
|
3168
|
-
});
|
|
3169
|
-
var TooltipTrigger = (0, import_react33.forwardRef)(({ children, className }, ref) => {
|
|
3170
|
-
const { setOpen, triggerRef, delayRef } = useTooltipContext();
|
|
3171
|
-
const handleRef = (0, import_react33.useCallback)(
|
|
3172
|
-
(node) => {
|
|
3173
|
-
triggerRef.current = node;
|
|
3174
|
-
assignRef4(ref, node);
|
|
3175
|
-
},
|
|
3176
|
-
[ref, triggerRef]
|
|
3177
|
-
);
|
|
3178
|
-
function handleMouseEnter() {
|
|
3179
|
-
delayRef.current = setTimeout(() => setOpen(true), 200);
|
|
3180
|
-
}
|
|
3181
|
-
function handleMouseLeave() {
|
|
3182
|
-
if (delayRef.current) clearTimeout(delayRef.current);
|
|
3183
|
-
setOpen(false);
|
|
3184
|
-
}
|
|
3185
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3186
|
-
"span",
|
|
3187
|
-
{
|
|
3188
|
-
ref: handleRef,
|
|
3189
|
-
className: cn("inline-flex", className),
|
|
3190
|
-
onMouseEnter: handleMouseEnter,
|
|
3191
|
-
onMouseLeave: handleMouseLeave,
|
|
3192
|
-
children
|
|
3193
|
-
}
|
|
3194
|
-
);
|
|
3195
|
-
});
|
|
3196
|
-
var arrowPositionClasses = {
|
|
3197
|
-
top: "after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-text-primary",
|
|
3198
|
-
bottom: "after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-b-text-primary",
|
|
3199
|
-
left: "after:absolute after:left-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-l-text-primary",
|
|
3200
|
-
right: "after:absolute after:right-full after:top-1/2 after:-translate-y-1/2 after:border-4 after:border-transparent after:border-r-text-primary"
|
|
3201
|
-
};
|
|
3202
|
-
var TooltipContent = (0, import_react33.forwardRef)(({ children, side = "top", className }, ref) => {
|
|
3203
|
-
const { open, triggerRef } = useTooltipContext();
|
|
3204
|
-
const contentRef = (0, import_react33.useRef)(null);
|
|
3205
|
-
const portalContainer = usePortalContainer();
|
|
3206
|
-
const [pos, setPos] = (0, import_react33.useState)({ top: 0, left: 0 });
|
|
3207
|
-
const handleRef = (0, import_react33.useCallback)(
|
|
3208
|
-
(node) => {
|
|
3209
|
-
contentRef.current = node;
|
|
3210
|
-
assignRef4(ref, node);
|
|
3211
|
-
},
|
|
3212
|
-
[ref]
|
|
3213
|
-
);
|
|
3214
|
-
const updatePos = (0, import_react33.useCallback)(() => {
|
|
3215
|
-
if (!triggerRef.current || !contentRef.current) return;
|
|
3216
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
3217
|
-
const cw = contentRef.current.offsetWidth;
|
|
3218
|
-
const ch = contentRef.current.offsetHeight;
|
|
3219
|
-
const gap = 8;
|
|
3220
|
-
let top = 0;
|
|
3221
|
-
let left = 0;
|
|
3222
|
-
if (side === "top") {
|
|
3223
|
-
top = rect.top + window.scrollY - ch - gap;
|
|
3224
|
-
left = rect.left + window.scrollX + rect.width / 2 - cw / 2;
|
|
3225
|
-
} else if (side === "bottom") {
|
|
3226
|
-
top = rect.bottom + window.scrollY + gap;
|
|
3227
|
-
left = rect.left + window.scrollX + rect.width / 2 - cw / 2;
|
|
3228
|
-
} else if (side === "left") {
|
|
3229
|
-
top = rect.top + window.scrollY + rect.height / 2 - ch / 2;
|
|
3230
|
-
left = rect.left + window.scrollX - cw - gap;
|
|
3231
|
-
} else {
|
|
3232
|
-
top = rect.top + window.scrollY + rect.height / 2 - ch / 2;
|
|
3233
|
-
left = rect.right + window.scrollX + gap;
|
|
3234
|
-
}
|
|
3235
|
-
setPos({ top, left });
|
|
3236
|
-
}, [side, triggerRef]);
|
|
3237
|
-
(0, import_react33.useEffect)(() => {
|
|
3238
|
-
if (open) updatePos();
|
|
3239
|
-
}, [open, updatePos]);
|
|
3240
|
-
if (!open || !portalContainer) return null;
|
|
3241
|
-
return (0, import_react_dom8.createPortal)(
|
|
3242
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3243
|
-
"div",
|
|
3244
|
-
{
|
|
3245
|
-
ref: handleRef,
|
|
3246
|
-
style: { top: pos.top, left: pos.left },
|
|
3247
|
-
className: cn(
|
|
3248
|
-
"absolute z-50 rounded-md bg-text-primary px-2.5 py-1.5 text-xs text-surface-1 shadow-md",
|
|
3249
|
-
arrowPositionClasses[side],
|
|
3250
|
-
className
|
|
3251
|
-
),
|
|
3252
|
-
children
|
|
3253
|
-
}
|
|
3254
|
-
),
|
|
3255
|
-
portalContainer
|
|
3256
|
-
);
|
|
3257
|
-
});
|
|
3258
|
-
Tooltip.displayName = "Tooltip";
|
|
3259
|
-
TooltipTrigger.displayName = "TooltipTrigger";
|
|
3260
|
-
TooltipContent.displayName = "TooltipContent";
|
|
3261
|
-
|
|
3262
|
-
// src/components/alert.tsx
|
|
3263
|
-
var import_react34 = require("react");
|
|
3264
|
-
var import_lucide_react16 = require("lucide-react");
|
|
3265
|
-
var import_class_variance_authority9 = require("class-variance-authority");
|
|
3266
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3267
|
-
var alertVariants = (0, import_class_variance_authority9.cva)(
|
|
3268
|
-
"relative flex gap-3 rounded-md border-l-4 p-4",
|
|
3269
|
-
{
|
|
3270
|
-
variants: {
|
|
3271
|
-
variant: {
|
|
3272
|
-
default: "border-l-primary bg-info-soft text-info-soft-fg",
|
|
3273
|
-
info: "border-l-info bg-info-soft text-info-soft-fg",
|
|
3274
|
-
success: "border-l-success bg-success-soft text-success-soft-fg",
|
|
3275
|
-
warning: "border-l-warning bg-warning-soft text-warning-soft-fg",
|
|
3276
|
-
destructive: "border-l-danger bg-danger-soft text-danger-soft-fg"
|
|
3277
|
-
}
|
|
3278
|
-
},
|
|
3279
|
-
defaultVariants: { variant: "default" }
|
|
3280
|
-
}
|
|
3281
|
-
);
|
|
3282
|
-
var iconMap = {
|
|
3283
|
-
default: import_lucide_react16.AlertCircle,
|
|
3284
|
-
info: import_lucide_react16.Info,
|
|
3285
|
-
success: import_lucide_react16.CheckCircle,
|
|
3286
|
-
warning: import_lucide_react16.AlertTriangle,
|
|
3287
|
-
destructive: import_lucide_react16.AlertCircle
|
|
3288
|
-
};
|
|
3289
|
-
var iconColorMap = {
|
|
3290
|
-
default: "text-info",
|
|
3291
|
-
info: "text-info",
|
|
3292
|
-
success: "text-success",
|
|
3293
|
-
warning: "text-warning",
|
|
3294
|
-
destructive: "text-danger"
|
|
3295
|
-
};
|
|
3296
|
-
var Alert = (0, import_react34.forwardRef)(
|
|
3297
|
-
({ variant = "default", className, children, ...props }, ref) => {
|
|
3298
|
-
const Icon = iconMap[variant ?? "default"];
|
|
3299
|
-
const iconColor = iconColorMap[variant ?? "default"];
|
|
3300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3301
|
-
"div",
|
|
3302
|
-
{
|
|
3303
|
-
ref,
|
|
3304
|
-
role: "alert",
|
|
3305
|
-
className: cn(alertVariants({ variant }), className),
|
|
3306
|
-
...props,
|
|
3307
|
-
children: [
|
|
3308
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { size: 18, className: cn("mt-0.5 shrink-0", iconColor) }),
|
|
3309
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-0.5", children })
|
|
3310
|
-
]
|
|
3311
|
-
}
|
|
3312
|
-
);
|
|
3313
|
-
}
|
|
3314
|
-
);
|
|
3315
|
-
var AlertTitle = (0, import_react34.forwardRef)(({ className, ...props }, ref) => {
|
|
3316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: cn("text-sm font-semibold leading-5", className), ...props });
|
|
3317
|
-
});
|
|
3318
|
-
var AlertDescription = (0, import_react34.forwardRef)(({ className, ...props }, ref) => {
|
|
3319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { ref, className: cn("text-sm leading-5 opacity-90", className), ...props });
|
|
3320
|
-
});
|
|
3321
|
-
Alert.displayName = "Alert";
|
|
3322
|
-
AlertTitle.displayName = "AlertTitle";
|
|
3323
|
-
AlertDescription.displayName = "AlertDescription";
|
|
3324
|
-
|
|
3325
|
-
// src/components/breadcrumb.tsx
|
|
3326
|
-
var import_react35 = require("react");
|
|
3327
|
-
var import_lucide_react17 = require("lucide-react");
|
|
3328
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3329
|
-
var Breadcrumb = (0, import_react35.forwardRef)(({ className, children, ...props }, ref) => {
|
|
3330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("nav", { ref, "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A", className: cn(className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ol", { className: "flex flex-wrap items-center gap-0 text-sm text-text-secondary", children }) });
|
|
3331
|
-
});
|
|
3332
|
-
var BreadcrumbItem = (0, import_react35.forwardRef)(({ className, ...props }, ref) => {
|
|
3333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { ref, className: cn("flex items-center gap-1", className), ...props });
|
|
3334
|
-
});
|
|
3335
|
-
var BreadcrumbLink = (0, import_react35.forwardRef)(
|
|
3336
|
-
({ current = false, className, children, href, ...props }, ref) => {
|
|
3337
|
-
if (current) {
|
|
3338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-current": "page", className: cn("font-medium text-text-primary", className), children });
|
|
3339
|
-
}
|
|
3340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3341
|
-
"a",
|
|
3342
|
-
{
|
|
3343
|
-
ref,
|
|
3344
|
-
href,
|
|
3345
|
-
className: cn("transition-colors hover:text-text-primary", className),
|
|
3346
|
-
...props,
|
|
3347
|
-
children
|
|
3348
|
-
}
|
|
3349
|
-
);
|
|
3350
|
-
}
|
|
3351
|
-
);
|
|
3352
|
-
var BreadcrumbSeparator = (0, import_react35.forwardRef)(
|
|
3353
|
-
({ className, children, ...props }, ref) => {
|
|
3354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3355
|
-
"li",
|
|
3356
|
-
{
|
|
3357
|
-
ref,
|
|
3358
|
-
role: "presentation",
|
|
3359
|
-
"aria-hidden": "true",
|
|
3360
|
-
className: cn("text-text-tertiary", className),
|
|
3361
|
-
...props,
|
|
3362
|
-
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.ChevronRight, { size: 14 })
|
|
3363
|
-
}
|
|
3364
|
-
);
|
|
3365
|
-
}
|
|
3366
|
-
);
|
|
3367
|
-
Breadcrumb.displayName = "Breadcrumb";
|
|
3368
|
-
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
3369
|
-
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
3370
|
-
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
3371
|
-
|
|
3372
|
-
// src/components/switch.tsx
|
|
3373
|
-
var import_react36 = require("react");
|
|
3374
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3375
|
-
var Switch = (0, import_react36.forwardRef)(
|
|
3376
|
-
({
|
|
3377
|
-
checked,
|
|
3378
|
-
onCheckedChange,
|
|
3379
|
-
disabled = false,
|
|
3380
|
-
label,
|
|
3381
|
-
labelPlacement = "right",
|
|
3382
|
-
className,
|
|
3383
|
-
id,
|
|
3384
|
-
...props
|
|
3385
|
-
}, ref) => {
|
|
3386
|
-
const generatedId = (0, import_react36.useId)();
|
|
3387
|
-
const switchId = id ?? generatedId;
|
|
3388
|
-
const track = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3389
|
-
"button",
|
|
3390
|
-
{
|
|
3391
|
-
ref,
|
|
3392
|
-
id: switchId,
|
|
3393
|
-
type: "button",
|
|
3394
|
-
role: "switch",
|
|
3395
|
-
"aria-checked": checked,
|
|
3396
|
-
disabled,
|
|
3397
|
-
onClick: () => !disabled && onCheckedChange(!checked),
|
|
3398
|
-
className: cn(
|
|
3399
|
-
"relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent p-0.5 shadow-sm transition-colors duration-200",
|
|
3400
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0",
|
|
3401
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3402
|
-
checked ? "bg-primary hover:bg-primary-hover" : "bg-surface-3 hover:bg-border-strong",
|
|
3403
|
-
className
|
|
3404
|
-
),
|
|
3405
|
-
...props,
|
|
3406
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3407
|
-
"span",
|
|
3408
|
-
{
|
|
3409
|
-
className: cn(
|
|
3410
|
-
"pointer-events-none block h-5 w-5 rounded-full bg-primary-fg shadow-md ring-0 transition-transform duration-200",
|
|
3411
|
-
checked ? "translate-x-5" : "translate-x-0"
|
|
3412
|
-
)
|
|
3413
|
-
}
|
|
3414
|
-
)
|
|
3415
|
-
}
|
|
3416
|
-
);
|
|
3417
|
-
if (!label) return track;
|
|
3418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3419
|
-
"label",
|
|
3420
|
-
{
|
|
3421
|
-
htmlFor: switchId,
|
|
3422
|
-
className: cn(
|
|
3423
|
-
"inline-flex cursor-pointer items-center gap-2.5 text-sm font-medium leading-5 text-text-primary",
|
|
3424
|
-
disabled && "cursor-not-allowed opacity-50"
|
|
3425
|
-
),
|
|
3426
|
-
children: [
|
|
3427
|
-
labelPlacement === "left" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label }),
|
|
3428
|
-
track,
|
|
3429
|
-
labelPlacement === "right" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: label })
|
|
3430
|
-
]
|
|
3431
|
-
}
|
|
3432
|
-
);
|
|
3433
|
-
}
|
|
3434
|
-
);
|
|
3435
|
-
Switch.displayName = "Switch";
|
|
3436
|
-
|
|
3437
|
-
// src/components/textarea.tsx
|
|
3438
|
-
var import_react37 = require("react");
|
|
3439
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3440
|
-
var Textarea = (0, import_react37.forwardRef)(
|
|
3441
|
-
({ className, label, error, helperText, id, rows = 3, ...props }, ref) => {
|
|
3442
|
-
const generatedId = (0, import_react37.useId)();
|
|
3443
|
-
const textareaId = id ?? generatedId;
|
|
3444
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
3445
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { htmlFor: textareaId, className: "text-sm font-medium text-text-primary", children: label }),
|
|
3446
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3447
|
-
"textarea",
|
|
3448
|
-
{
|
|
3449
|
-
ref,
|
|
3450
|
-
id: textareaId,
|
|
3451
|
-
rows,
|
|
3452
|
-
className: cn(
|
|
3453
|
-
"w-full rounded-md border bg-surface-1 px-3 py-2 text-sm text-text-primary placeholder:text-text-tertiary",
|
|
3454
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1",
|
|
3455
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3456
|
-
"resize-y",
|
|
3457
|
-
error ? "border-danger focus-visible:ring-danger" : "border-border-strong focus-visible:ring-ring/30",
|
|
3458
|
-
className
|
|
3459
|
-
),
|
|
3460
|
-
...props
|
|
3461
|
-
}
|
|
3462
|
-
),
|
|
3463
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-xs text-danger", children: error }),
|
|
3464
|
-
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-xs text-text-secondary", children: helperText })
|
|
3465
|
-
] });
|
|
3466
|
-
}
|
|
3467
|
-
);
|
|
3468
|
-
Textarea.displayName = "Textarea";
|
|
3469
|
-
|
|
3470
|
-
// src/components/skeleton.tsx
|
|
3471
|
-
var import_react38 = require("react");
|
|
3472
|
-
var import_class_variance_authority10 = require("class-variance-authority");
|
|
3473
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3474
|
-
var skeletonVariants = (0, import_class_variance_authority10.cva)(
|
|
3475
|
-
"animate-pulse bg-surface-3",
|
|
3476
|
-
{
|
|
3477
|
-
variants: {
|
|
3478
|
-
variant: {
|
|
3479
|
-
text: "h-4 w-full rounded",
|
|
3480
|
-
circle: "rounded-full",
|
|
3481
|
-
rect: "rounded-md"
|
|
3482
|
-
}
|
|
3483
|
-
},
|
|
3484
|
-
defaultVariants: { variant: "rect" }
|
|
3485
|
-
}
|
|
3486
|
-
);
|
|
3487
|
-
var Skeleton = (0, import_react38.forwardRef)(({ variant, className, ...props }, ref) => {
|
|
3488
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref, className: cn(skeletonVariants({ variant }), className), "aria-hidden": "true", ...props });
|
|
3489
|
-
});
|
|
3490
|
-
Skeleton.displayName = "Skeleton";
|
|
3491
|
-
|
|
3492
|
-
// src/components/progress.tsx
|
|
3493
|
-
var import_react39 = require("react");
|
|
3494
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3495
|
-
var progressColorClasses = {
|
|
3496
|
-
primary: "bg-primary",
|
|
3497
|
-
success: "bg-success",
|
|
3498
|
-
warning: "bg-warning",
|
|
3499
|
-
danger: "bg-danger",
|
|
3500
|
-
info: "bg-info"
|
|
3501
|
-
};
|
|
3502
|
-
var Progress = (0, import_react39.forwardRef)(({
|
|
3503
|
-
value,
|
|
3504
|
-
max = 100,
|
|
3505
|
-
showLabel = false,
|
|
3506
|
-
color = "primary",
|
|
3507
|
-
className,
|
|
3508
|
-
...props
|
|
3509
|
-
}, ref) => {
|
|
3510
|
-
const clamped = Math.min(Math.max(value, 0), max);
|
|
3511
|
-
const percent = Math.round(clamped / max * 100);
|
|
3512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref, className: cn("flex items-center gap-3", className), ...props, children: [
|
|
3513
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3514
|
-
"div",
|
|
3515
|
-
{
|
|
3516
|
-
role: "progressbar",
|
|
3517
|
-
"aria-valuenow": clamped,
|
|
3518
|
-
"aria-valuemin": 0,
|
|
3519
|
-
"aria-valuemax": max,
|
|
3520
|
-
className: "h-2 w-full overflow-hidden rounded-full bg-surface-2",
|
|
3521
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3522
|
-
"div",
|
|
3523
|
-
{
|
|
3524
|
-
className: cn("h-full rounded-full transition-all duration-500 ease-out", progressColorClasses[color]),
|
|
3525
|
-
style: { width: `${percent}%` }
|
|
3526
|
-
}
|
|
3527
|
-
)
|
|
3528
|
-
}
|
|
3529
|
-
),
|
|
3530
|
-
showLabel && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "shrink-0 text-xs font-medium text-text-secondary tabular-nums w-9 text-right", children: [
|
|
3531
|
-
percent,
|
|
3532
|
-
"%"
|
|
3533
|
-
] })
|
|
3534
|
-
] });
|
|
3535
|
-
});
|
|
3536
|
-
Progress.displayName = "Progress";
|
|
3537
|
-
|
|
3538
|
-
// src/components/sheet.tsx
|
|
3539
|
-
var import_react40 = require("react");
|
|
3540
|
-
var import_react_dom9 = require("react-dom");
|
|
3541
|
-
var import_lucide_react18 = require("lucide-react");
|
|
3542
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3543
|
-
var Sheet = (0, import_react40.forwardRef)(({ open, onClose, side = "right", title, children, className }, ref) => {
|
|
3544
|
-
useEscapeKey(open, onClose);
|
|
3545
|
-
const portalContainer = usePortalContainer();
|
|
3546
|
-
if (!open || !portalContainer) return null;
|
|
3547
|
-
return (0, import_react_dom9.createPortal)(
|
|
3548
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "fixed inset-0 z-50 flex", role: "dialog", "aria-modal": "true", children: [
|
|
3549
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3550
|
-
"div",
|
|
3551
|
-
{
|
|
3552
|
-
className: "absolute inset-0 bg-overlay transition-opacity",
|
|
3553
|
-
onClick: onClose,
|
|
3554
|
-
"aria-hidden": "true"
|
|
3555
|
-
}
|
|
3556
|
-
),
|
|
3557
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3558
|
-
"div",
|
|
3559
|
-
{
|
|
3560
|
-
ref,
|
|
3561
|
-
className: cn(
|
|
3562
|
-
"relative flex h-full w-80 max-w-full flex-col bg-surface-1 shadow-xl",
|
|
3563
|
-
"transition-transform duration-300 ease-in-out",
|
|
3564
|
-
side === "right" ? "ml-auto translate-x-0" : "mr-auto translate-x-0",
|
|
3565
|
-
className
|
|
3566
|
-
),
|
|
3567
|
-
children: [
|
|
3568
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between border-b border-border-base px-5 py-4", children: [
|
|
3569
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: "text-base font-semibold text-text-primary", children: title }),
|
|
3570
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3571
|
-
"button",
|
|
3572
|
-
{
|
|
3573
|
-
type: "button",
|
|
3574
|
-
onClick: onClose,
|
|
3575
|
-
className: "rounded-md p-1 text-text-tertiary hover:bg-surface-3 hover:text-text-secondary transition-colors",
|
|
3576
|
-
"aria-label": "\u5173\u95ED",
|
|
3577
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react18.X, { size: 18 })
|
|
3578
|
-
}
|
|
3579
|
-
)
|
|
3580
|
-
] }),
|
|
3581
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex-1 overflow-y-auto px-5 py-4", children })
|
|
3582
|
-
]
|
|
3583
|
-
}
|
|
3584
|
-
)
|
|
3585
|
-
] }),
|
|
3586
|
-
portalContainer
|
|
3587
|
-
);
|
|
3588
|
-
});
|
|
3589
|
-
Sheet.displayName = "Sheet";
|
|
3590
|
-
|
|
3591
|
-
// src/components/empty-state.tsx
|
|
3592
|
-
var import_react41 = require("react");
|
|
3593
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3594
|
-
var EmptyState = (0, import_react41.forwardRef)(
|
|
3595
|
-
({ icon: Icon, title, description, action, className, ...props }, ref) => {
|
|
3596
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3597
|
-
"div",
|
|
3598
|
-
{
|
|
3599
|
-
ref,
|
|
3600
|
-
className: cn(
|
|
3601
|
-
"flex flex-col items-center justify-center gap-3 py-16 text-center",
|
|
3602
|
-
className
|
|
3603
|
-
),
|
|
3604
|
-
...props,
|
|
3605
|
-
children: [
|
|
3606
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-surface-2", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { size: 28, className: "text-text-tertiary" }) }),
|
|
3607
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
3608
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-base font-semibold text-text-primary", children: title }),
|
|
3609
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "max-w-xs text-sm text-text-secondary", children: description })
|
|
3610
|
-
] }),
|
|
3611
|
-
action && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "mt-1", children: action })
|
|
3612
|
-
]
|
|
3613
|
-
}
|
|
3614
|
-
);
|
|
3615
|
-
}
|
|
3616
|
-
);
|
|
3617
|
-
EmptyState.displayName = "EmptyState";
|
|
3618
|
-
|
|
3619
|
-
// src/components/separator.tsx
|
|
3620
|
-
var import_react42 = require("react");
|
|
3621
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3622
|
-
var ORIENTATION_CLASSES = {
|
|
3623
|
-
horizontal: "h-px w-full bg-border-base",
|
|
3624
|
-
vertical: "w-px h-full bg-border-base"
|
|
3625
|
-
};
|
|
3626
|
-
var Separator = (0, import_react42.forwardRef)(
|
|
3627
|
-
({ orientation = "horizontal", className, ...props }, ref) => {
|
|
3628
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3629
|
-
"div",
|
|
3630
|
-
{
|
|
3631
|
-
ref,
|
|
3632
|
-
role: "separator",
|
|
3633
|
-
"aria-orientation": orientation,
|
|
3634
|
-
className: cn(ORIENTATION_CLASSES[orientation], className),
|
|
3635
|
-
...props
|
|
3636
|
-
}
|
|
3637
|
-
);
|
|
3638
|
-
}
|
|
3639
|
-
);
|
|
3640
|
-
Separator.displayName = "Separator";
|
|
3641
|
-
|
|
3642
|
-
// src/components/descriptions.tsx
|
|
3643
|
-
var import_react43 = require("react");
|
|
3644
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3645
|
-
var SIZE_LABEL_CLASSES = {
|
|
3646
|
-
sm: "px-3 py-2 text-xs",
|
|
3647
|
-
default: "px-3.5 py-2.5 text-sm",
|
|
3648
|
-
lg: "px-4 py-3 text-base"
|
|
3649
|
-
};
|
|
3650
|
-
var SIZE_VALUE_CLASSES = {
|
|
3651
|
-
sm: "px-3 py-2 text-xs",
|
|
3652
|
-
default: "px-3.5 py-2.5 text-sm",
|
|
3653
|
-
lg: "px-4 py-3 text-base"
|
|
3654
|
-
};
|
|
3655
|
-
var DescriptionsItem = (0, import_react43.forwardRef)(
|
|
3656
|
-
({ label, children, className, span: _span, ...props }, ref) => {
|
|
3657
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className, ...props, children: [
|
|
3658
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-text-secondary", children: label }),
|
|
3659
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-text-primary", children })
|
|
3660
|
-
] });
|
|
3661
|
-
}
|
|
3662
|
-
);
|
|
3663
|
-
DescriptionsItem.displayName = "DescriptionsItem";
|
|
3664
|
-
var Descriptions = (0, import_react43.forwardRef)(
|
|
3665
|
-
({ column = 2, bordered = false, size = "default", title, className, children, ...props }, ref) => {
|
|
3666
|
-
const items = import_react43.Children.toArray(children).filter(
|
|
3667
|
-
(child) => (0, import_react43.isValidElement)(child) && child.type.displayName === "DescriptionsItem"
|
|
3668
|
-
);
|
|
3669
|
-
if (bordered) {
|
|
3670
|
-
const rows = [];
|
|
3671
|
-
let currentRow = [];
|
|
3672
|
-
let currentColCount = 0;
|
|
3673
|
-
for (const item of items) {
|
|
3674
|
-
const span = item.props.span ?? 1;
|
|
3675
|
-
if (currentColCount + span > column) {
|
|
3676
|
-
rows.push(currentRow);
|
|
3677
|
-
currentRow = [];
|
|
3678
|
-
currentColCount = 0;
|
|
3679
|
-
}
|
|
3680
|
-
currentRow.push({ label: item.props.label, value: item.props.children, span });
|
|
3681
|
-
currentColCount += span;
|
|
3682
|
-
}
|
|
3683
|
-
if (currentRow.length > 0) rows.push(currentRow);
|
|
3684
|
-
const labelColumnWidth = column === 1 ? "34%" : `${Math.max(12, 100 / (column * 2))}%`;
|
|
3685
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
3686
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "mb-3 text-base font-semibold text-text-primary", children: title }),
|
|
3687
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "overflow-hidden rounded-lg border border-border-base bg-surface-1", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("table", { className: "w-full table-fixed border-separate border-spacing-0", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { children: row.map((cell, cellIdx) => {
|
|
3688
|
-
const hasRowDivider = rowIdx < rows.length - 1;
|
|
3689
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react43.Fragment, { children: [
|
|
3690
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3691
|
-
"td",
|
|
3692
|
-
{
|
|
3693
|
-
className: cn(
|
|
3694
|
-
"border-r border-border-base bg-surface-2/80 font-medium text-text-secondary",
|
|
3695
|
-
hasRowDivider && "border-b",
|
|
3696
|
-
SIZE_LABEL_CLASSES[size]
|
|
3697
|
-
),
|
|
3698
|
-
style: { width: labelColumnWidth },
|
|
3699
|
-
children: cell.label
|
|
3700
|
-
}
|
|
3701
|
-
),
|
|
3702
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3703
|
-
"td",
|
|
3704
|
-
{
|
|
3705
|
-
className: cn(
|
|
3706
|
-
"break-words font-medium text-text-primary",
|
|
3707
|
-
hasRowDivider && "border-b border-border-base",
|
|
3708
|
-
SIZE_VALUE_CLASSES[size]
|
|
3709
|
-
),
|
|
3710
|
-
colSpan: cell.span > 1 ? cell.span * 2 - 1 : 1,
|
|
3711
|
-
children: cell.value
|
|
3712
|
-
}
|
|
3713
|
-
)
|
|
3714
|
-
] }, `${rowIdx}-${cellIdx}`);
|
|
3715
|
-
}) }, rowIdx)) }) }) })
|
|
3716
|
-
] });
|
|
3717
|
-
}
|
|
3718
|
-
const GRID_COLS = {
|
|
3719
|
-
1: "grid-cols-1",
|
|
3720
|
-
2: "grid-cols-2",
|
|
3721
|
-
3: "grid-cols-3",
|
|
3722
|
-
4: "grid-cols-4"
|
|
3723
|
-
};
|
|
3724
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
3725
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "mb-3 text-base font-semibold text-text-primary", children: title }),
|
|
3726
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn("grid gap-x-6 gap-y-4", GRID_COLS[column]), children: items.map((item, idx) => {
|
|
3727
|
-
const span = item.props.span ?? 1;
|
|
3728
|
-
const colSpanClass = span === 2 ? "col-span-2" : span === 3 ? "col-span-3" : span === 4 ? "col-span-4" : "";
|
|
3729
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cn("flex flex-col gap-0.5", colSpanClass, item.props.className), children: [
|
|
3730
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: cn("font-medium text-text-secondary", size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-xs"), children: item.props.label }),
|
|
3731
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: cn("text-text-primary", size === "sm" ? "text-sm" : size === "lg" ? "text-base" : "text-sm"), children: item.props.children })
|
|
3732
|
-
] }, idx);
|
|
3733
|
-
}) })
|
|
3734
|
-
] });
|
|
3735
|
-
}
|
|
3736
|
-
);
|
|
3737
|
-
Descriptions.displayName = "Descriptions";
|
|
3738
|
-
|
|
3739
|
-
// src/components/statistic.tsx
|
|
3740
|
-
var import_react44 = require("react");
|
|
3741
|
-
var import_lucide_react19 = require("lucide-react");
|
|
3742
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3743
|
-
var SIZE_TITLE_CLASSES = {
|
|
3744
|
-
sm: "text-xs",
|
|
3745
|
-
default: "text-sm",
|
|
3746
|
-
lg: "text-base"
|
|
3747
|
-
};
|
|
3748
|
-
var SIZE_VALUE_CLASSES2 = {
|
|
3749
|
-
sm: "text-2xl",
|
|
3750
|
-
default: "text-3xl",
|
|
3751
|
-
lg: "text-4xl"
|
|
3752
|
-
};
|
|
3753
|
-
var SIZE_SUFFIX_CLASSES = {
|
|
3754
|
-
sm: "text-xs",
|
|
3755
|
-
default: "text-sm",
|
|
3756
|
-
lg: "text-base"
|
|
3757
|
-
};
|
|
3758
|
-
var TREND_ICON_COLOR = {
|
|
3759
|
-
up: "text-success",
|
|
3760
|
-
down: "text-danger",
|
|
3761
|
-
flat: "text-text-secondary"
|
|
3762
|
-
};
|
|
3763
|
-
var TREND_TEXT_COLOR = {
|
|
3764
|
-
up: "text-success",
|
|
3765
|
-
down: "text-danger",
|
|
3766
|
-
flat: "text-text-secondary"
|
|
3767
|
-
};
|
|
3768
|
-
function formatValue(value, precision) {
|
|
3769
|
-
if (typeof value === "string") return value;
|
|
3770
|
-
return new Intl.NumberFormat("zh-CN", {
|
|
3771
|
-
minimumFractionDigits: precision ?? 0,
|
|
3772
|
-
maximumFractionDigits: precision ?? 0
|
|
3773
|
-
}).format(value);
|
|
3774
|
-
}
|
|
3775
|
-
var Statistic = (0, import_react44.forwardRef)(
|
|
3776
|
-
({ title, value, precision, prefix, suffix, trend, change, size = "default", className, ...props }, ref) => {
|
|
3777
|
-
const TrendIcon = trend === "up" ? import_lucide_react19.TrendingUp : trend === "down" ? import_lucide_react19.TrendingDown : trend === "flat" ? import_lucide_react19.Minus : null;
|
|
3778
|
-
const iconSize = size === "sm" ? 14 : size === "lg" ? 18 : 16;
|
|
3779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
|
|
3780
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("font-medium text-text-secondary", SIZE_TITLE_CLASSES[size]), children: title }),
|
|
3781
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-baseline gap-1", children: [
|
|
3782
|
-
prefix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-text-primary", SIZE_SUFFIX_CLASSES[size]), children: prefix }),
|
|
3783
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("font-bold tabular-nums text-text-primary", SIZE_VALUE_CLASSES2[size]), children: formatValue(value, precision) }),
|
|
3784
|
-
suffix && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-text-secondary", SIZE_SUFFIX_CLASSES[size]), children: suffix })
|
|
3785
|
-
] }),
|
|
3786
|
-
(trend || change) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3787
|
-
TrendIcon && trend && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TrendIcon, { size: iconSize, className: TREND_ICON_COLOR[trend] }),
|
|
3788
|
-
change && trend && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: cn("text-xs font-medium", TREND_TEXT_COLOR[trend]), children: change })
|
|
3789
|
-
] })
|
|
3790
|
-
] });
|
|
3791
|
-
}
|
|
3792
|
-
);
|
|
3793
|
-
Statistic.displayName = "Statistic";
|
|
3794
|
-
|
|
3795
|
-
// src/theme.ts
|
|
3796
|
-
var theme = {
|
|
3797
|
-
colors: {
|
|
3798
|
-
primary: {
|
|
3799
|
-
DEFAULT: "hsl(var(--primary))",
|
|
3800
|
-
hover: "hsl(var(--primary-hover))",
|
|
3801
|
-
active: "hsl(var(--primary-active))",
|
|
3802
|
-
foreground: "hsl(var(--primary-fg))",
|
|
3803
|
-
soft: "hsl(var(--primary-soft) / 0.12)",
|
|
3804
|
-
softForeground: "hsl(var(--primary-soft-fg))"
|
|
3805
|
-
},
|
|
3806
|
-
success: {
|
|
3807
|
-
DEFAULT: "hsl(var(--success))",
|
|
3808
|
-
hover: "hsl(var(--success-hover))",
|
|
3809
|
-
foreground: "hsl(var(--success-fg))",
|
|
3810
|
-
soft: "hsl(var(--success-soft) / 0.12)",
|
|
3811
|
-
softForeground: "hsl(var(--success-soft-fg))"
|
|
3812
|
-
},
|
|
3813
|
-
warning: {
|
|
3814
|
-
DEFAULT: "hsl(var(--warning))",
|
|
3815
|
-
hover: "hsl(var(--warning-hover))",
|
|
3816
|
-
foreground: "hsl(var(--warning-fg))",
|
|
3817
|
-
soft: "hsl(var(--warning-soft) / 0.12)",
|
|
3818
|
-
softForeground: "hsl(var(--warning-soft-fg))"
|
|
3819
|
-
},
|
|
3820
|
-
danger: {
|
|
3821
|
-
DEFAULT: "hsl(var(--danger))",
|
|
3822
|
-
hover: "hsl(var(--danger-hover))",
|
|
3823
|
-
foreground: "hsl(var(--danger-fg))",
|
|
3824
|
-
soft: "hsl(var(--danger-soft) / 0.12)",
|
|
3825
|
-
softForeground: "hsl(var(--danger-soft-fg))"
|
|
3826
|
-
},
|
|
3827
|
-
info: {
|
|
3828
|
-
DEFAULT: "hsl(var(--info))",
|
|
3829
|
-
hover: "hsl(var(--info-hover))",
|
|
3830
|
-
foreground: "hsl(var(--info-fg))",
|
|
3831
|
-
soft: "hsl(var(--info-soft) / 0.12)",
|
|
3832
|
-
softForeground: "hsl(var(--info-soft-fg))"
|
|
3833
|
-
},
|
|
3834
|
-
surface: {
|
|
3835
|
-
0: "hsl(var(--surface-0))",
|
|
3836
|
-
1: "hsl(var(--surface-1))",
|
|
3837
|
-
2: "hsl(var(--surface-2))",
|
|
3838
|
-
3: "hsl(var(--surface-3))"
|
|
3839
|
-
},
|
|
3840
|
-
text: {
|
|
3841
|
-
primary: "hsl(var(--text-primary))",
|
|
3842
|
-
secondary: "hsl(var(--text-secondary))",
|
|
3843
|
-
tertiary: "hsl(var(--text-tertiary))",
|
|
3844
|
-
inverted: "hsl(var(--text-inverted))"
|
|
3845
|
-
},
|
|
3846
|
-
border: {
|
|
3847
|
-
strong: "hsl(var(--border-strong))",
|
|
3848
|
-
base: "hsl(var(--border-base))",
|
|
3849
|
-
subtle: "hsl(var(--border-subtle))"
|
|
3850
|
-
},
|
|
3851
|
-
ring: "hsl(var(--ring))",
|
|
3852
|
-
overlay: "hsl(var(--overlay) / var(--overlay-alpha))"
|
|
3853
|
-
},
|
|
3854
|
-
radius: { sm: "var(--radius-sm)", md: "var(--radius-md)", lg: "var(--radius-lg)", xl: "var(--radius-xl)", full: "9999px" },
|
|
3855
|
-
fontFamily: { sans: "var(--font-sans)", mono: "var(--font-mono)" }
|
|
3856
|
-
};
|
|
3857
|
-
|
|
3858
|
-
// src/component-layers.ts
|
|
3859
|
-
var reactComponentLayers = [
|
|
3860
|
-
{
|
|
3861
|
-
id: "primitives",
|
|
3862
|
-
label: "\u57FA\u7840\u7EC4\u4EF6",
|
|
3863
|
-
description: "\u6700\u5C0F\u53EF\u590D\u7528\u89C6\u89C9\u5355\u5143\uFF0C\u8D1F\u8D23\u6309\u94AE\u3001\u5BB9\u5668\u3001\u6807\u7B7E\u3001\u5206\u9694\u548C\u52A0\u8F7D\u57FA\u7840\u72B6\u6001\u3002",
|
|
3864
|
-
components: [
|
|
3865
|
-
{ name: "UGButton", route: "/react/components/button" },
|
|
3866
|
-
{ name: "UGInput", route: "/react/components/input" },
|
|
3867
|
-
{ name: "UGLabel", route: "/react/components/label" },
|
|
3868
|
-
{ name: "UGCard", route: "/react/components/card" },
|
|
3869
|
-
{ name: "UGBadge", route: "/react/components/badge" },
|
|
3870
|
-
{ name: "UGTag", route: "/react/components/tag" },
|
|
3871
|
-
{ name: "UGSeparator", route: "/react/components/separator" },
|
|
3872
|
-
{ name: "UGSpinner", route: "/react/components/spinner" }
|
|
3873
|
-
]
|
|
3874
|
-
},
|
|
3875
|
-
{
|
|
3876
|
-
id: "forms",
|
|
3877
|
-
label: "\u8868\u5355\u8F93\u5165",
|
|
3878
|
-
description: "\u6536\u96C6\u3001\u6821\u9A8C\u548C\u7F16\u8F91\u7528\u6237\u8F93\u5165\uFF0C\u8981\u6C42\u6807\u7B7E\u3001\u5E2E\u52A9\u6587\u672C\u3001\u9519\u8BEF\u72B6\u6001\u7A33\u5B9A\u5BF9\u9F50\u3002",
|
|
3879
|
-
components: [
|
|
3880
|
-
{ name: "UGTextarea", route: "/react/components/textarea" },
|
|
3881
|
-
{ name: "UGSelect", route: "/react/components/select" },
|
|
3882
|
-
{ name: "UGCheckbox", route: "/react/components/checkbox" },
|
|
3883
|
-
{ name: "UGRadio", route: "/react/components/radio" },
|
|
3884
|
-
{ name: "UGSwitch", route: "/react/components/switch" },
|
|
3885
|
-
{ name: "UGSlider", route: "/react/components/slider" },
|
|
3886
|
-
{ name: "UGNumberInput", route: "/react/components/number-input" },
|
|
3887
|
-
{ name: "UGOTPInput", route: "/react/components/otp-input" },
|
|
3888
|
-
{ name: "UGForm", route: "/react/components/form" }
|
|
3889
|
-
]
|
|
3890
|
-
},
|
|
3891
|
-
{
|
|
3892
|
-
id: "navigation",
|
|
3893
|
-
label: "\u5BFC\u822A\u6D41\u7A0B",
|
|
3894
|
-
description: "\u9875\u9762\u5B9A\u4F4D\u3001\u533A\u57DF\u5207\u6362\u3001\u5206\u9875\u548C\u6D41\u7A0B\u8868\u8FBE\uFF0C\u8981\u6C42\u9009\u4E2D\u6001\u660E\u786E\u4E14\u79FB\u52A8\u7AEF\u4E0D\u6EA2\u51FA\u3002",
|
|
3895
|
-
components: [
|
|
3896
|
-
{ name: "UGTabs", route: "/react/components/tabs" },
|
|
3897
|
-
{ name: "UGBreadcrumb", route: "/react/components/breadcrumb" },
|
|
3898
|
-
{ name: "UGPagination", route: "/react/components/pagination" },
|
|
3899
|
-
{ name: "UGNavigationMenu", route: "/react/components/navigation-menu" },
|
|
3900
|
-
{ name: "UGSidebar", route: "/react/components/sidebar" },
|
|
3901
|
-
{ name: "UGSteps", route: "/react/components/steps" }
|
|
3902
|
-
]
|
|
3903
|
-
},
|
|
3904
|
-
{
|
|
3905
|
-
id: "overlays",
|
|
3906
|
-
label: "\u6D6E\u5C42\u5F39\u5C42",
|
|
3907
|
-
description: "\u4E34\u65F6\u627F\u8F7D\u64CD\u4F5C\u548C\u4E0A\u4E0B\u6587\u4FE1\u606F\uFF0C\u8981\u6C42\u5B9A\u4F4D\u3001\u5173\u95ED\u3001\u7126\u70B9\u548C\u906E\u7F69\u884C\u4E3A\u53EF\u9760\u3002",
|
|
3908
|
-
components: [
|
|
3909
|
-
{ name: "UGModal", route: "/react/components/modal" },
|
|
3910
|
-
{ name: "UGDialog", route: "/react/components/dialog" },
|
|
3911
|
-
{ name: "UGDrawer", route: "/react/components/drawer" },
|
|
3912
|
-
{ name: "UGSheet", route: "/react/components/sheet" },
|
|
3913
|
-
{ name: "UGDropdownMenu", route: "/react/components/dropdown" },
|
|
3914
|
-
{ name: "UGContextMenu", route: "/react/components/context-menu" },
|
|
3915
|
-
{ name: "UGPopover", route: "/react/components/popover" },
|
|
3916
|
-
{ name: "UGTooltip", route: "/react/components/tooltip" }
|
|
3917
|
-
]
|
|
3918
|
-
},
|
|
3919
|
-
{
|
|
3920
|
-
id: "feedback",
|
|
3921
|
-
label: "\u53CD\u9988\u72B6\u6001",
|
|
3922
|
-
description: "\u8868\u8FBE\u6210\u529F\u3001\u8B66\u544A\u3001\u9519\u8BEF\u3001\u7A7A\u72B6\u6001\u548C\u52A0\u8F7D\u8FC7\u7A0B\uFF0C\u8981\u6C42\u8BED\u4E49\u6587\u6848\u548C\u89C6\u89C9\u72B6\u6001\u4E00\u81F4\u3002",
|
|
3923
|
-
components: [
|
|
3924
|
-
{ name: "UGAlert", route: "/react/components/alert" },
|
|
3925
|
-
{ name: "UGToaster", route: "/react/components/toast" },
|
|
3926
|
-
{ name: "UGProgress", route: "/react/components/progress" },
|
|
3927
|
-
{ name: "UGSkeleton", route: "/react/components/skeleton" },
|
|
3928
|
-
{ name: "UGEmptyState", route: "/react/components/empty-state" }
|
|
3929
|
-
]
|
|
3930
|
-
},
|
|
3931
|
-
{
|
|
3932
|
-
id: "data",
|
|
3933
|
-
label: "\u6570\u636E\u5C55\u793A",
|
|
3934
|
-
description: "\u5C55\u793A\u5217\u8868\u3001\u5BF9\u8C61\u8BE6\u60C5\u3001\u5934\u50CF\u3001\u6307\u6807\u548C\u6298\u53E0\u4FE1\u606F\uFF0C\u8981\u6C42\u5BC6\u5EA6\u6E05\u6670\u4E14\u6587\u672C\u4E0D\u6324\u51FA\u3002",
|
|
3935
|
-
components: [
|
|
3936
|
-
{ name: "UGTable", route: "/react/components/table" },
|
|
3937
|
-
{ name: "UGDescriptions", route: "/react/components/descriptions" },
|
|
3938
|
-
{ name: "UGStatistic", route: "/react/components/statistic" },
|
|
3939
|
-
{ name: "UGAvatar", route: "/react/components/avatar" },
|
|
3940
|
-
{ name: "UGAvatarGroup", route: "/react/components/avatar-group" },
|
|
3941
|
-
{ name: "UGAccordion", route: "/react/components/accordion" }
|
|
3942
|
-
]
|
|
3943
|
-
},
|
|
3944
|
-
{
|
|
3945
|
-
id: "patterns",
|
|
3946
|
-
label: "\u6846\u67B6\u6A21\u5F0F",
|
|
3947
|
-
description: "\u540E\u53F0\u3001\u5DE5\u5177\u578B\u548C\u8DE8\u4E1A\u52A1\u901A\u7528\u6A21\u5F0F\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/patterns \u4F7F\u7528\u3002",
|
|
3948
|
-
components: [
|
|
3949
|
-
{ name: "UGAdminShell", route: "/react/patterns#adminshell" },
|
|
3950
|
-
{ name: "UGPageHeader", route: "/react/patterns#pageheader" },
|
|
3951
|
-
{ name: "UGCopyField", route: "/react/patterns#copyfield" },
|
|
3952
|
-
{ name: "UGConfirmDialog", route: "/react/patterns#confirmdialog" }
|
|
3953
|
-
]
|
|
3954
|
-
},
|
|
3955
|
-
{
|
|
3956
|
-
id: "blocks",
|
|
3957
|
-
label: "\u5C55\u793A\u533A\u5757",
|
|
3958
|
-
description: "\u5C55\u793A\u9875\u3001\u4EA7\u54C1\u9875\u548C\u4ECB\u7ECD\u9875\u533A\u5757\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/blocks \u4F7F\u7528\u3002",
|
|
3959
|
-
components: [
|
|
3960
|
-
{ name: "UGLandingHero", route: "/react/blocks#landinghero" },
|
|
3961
|
-
{ name: "UGFeatureGrid", route: "/react/blocks#featuregrid" }
|
|
3962
|
-
]
|
|
3963
|
-
},
|
|
3964
|
-
{
|
|
3965
|
-
id: "labs",
|
|
3966
|
-
label: "\u5B9E\u9A8C\u7EC4\u4EF6",
|
|
3967
|
-
description: "\u5C1A\u672A\u7A33\u5B9A\u627F\u8BFA\u7684\u5B9E\u9A8C\u7EC4\u4EF6\uFF0C\u901A\u8FC7\u5B50\u5165\u53E3 @ug666/ui-react/labs \u4F7F\u7528\u3002",
|
|
3968
|
-
components: []
|
|
3969
|
-
}
|
|
3970
|
-
];
|
|
3971
|
-
|
|
3972
|
-
// src/hooks/use-debounce.ts
|
|
3973
|
-
var import_react45 = require("react");
|
|
3974
|
-
function useDebounce(value, delay = 300) {
|
|
3975
|
-
const [debounced, setDebounced] = (0, import_react45.useState)(value);
|
|
3976
|
-
(0, import_react45.useEffect)(() => {
|
|
3977
|
-
const timer = setTimeout(() => setDebounced(value), delay);
|
|
3978
|
-
return () => clearTimeout(timer);
|
|
3979
|
-
}, [value, delay]);
|
|
3980
|
-
return debounced;
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
// src/hooks/use-local-storage.ts
|
|
3984
|
-
var import_react46 = require("react");
|
|
3985
|
-
function useLocalStorage(key, initialValue) {
|
|
3986
|
-
const [storedValue, setStoredValue] = (0, import_react46.useState)(() => {
|
|
3987
|
-
if (typeof window === "undefined") return initialValue;
|
|
3988
|
-
try {
|
|
3989
|
-
const item = window.localStorage.getItem(key);
|
|
3990
|
-
return item ? JSON.parse(item) : initialValue;
|
|
3991
|
-
} catch {
|
|
3992
|
-
return initialValue;
|
|
3993
|
-
}
|
|
3994
|
-
});
|
|
3995
|
-
const setValue = (0, import_react46.useCallback)((value) => {
|
|
3996
|
-
setStoredValue((prev) => {
|
|
3997
|
-
const next = value instanceof Function ? value(prev) : value;
|
|
3998
|
-
if (typeof window !== "undefined") {
|
|
3999
|
-
window.localStorage.setItem(key, JSON.stringify(next));
|
|
4000
|
-
}
|
|
4001
|
-
return next;
|
|
4002
|
-
});
|
|
4003
|
-
}, [key]);
|
|
4004
|
-
const removeValue = (0, import_react46.useCallback)(() => {
|
|
4005
|
-
setStoredValue(initialValue);
|
|
4006
|
-
if (typeof window !== "undefined") {
|
|
4007
|
-
window.localStorage.removeItem(key);
|
|
4008
|
-
}
|
|
4009
|
-
}, [key, initialValue]);
|
|
4010
|
-
return [storedValue, setValue, removeValue];
|
|
4011
|
-
}
|
|
4012
|
-
|
|
4013
|
-
// src/hooks/use-media-query.ts
|
|
4014
|
-
var import_react47 = require("react");
|
|
4015
|
-
function useMediaQuery(query) {
|
|
4016
|
-
const [matches, setMatches] = (0, import_react47.useState)(() => {
|
|
4017
|
-
if (typeof window === "undefined") return false;
|
|
4018
|
-
return window.matchMedia(query).matches;
|
|
4019
|
-
});
|
|
4020
|
-
(0, import_react47.useEffect)(() => {
|
|
4021
|
-
if (typeof window === "undefined") return;
|
|
4022
|
-
const mediaQueryList = window.matchMedia(query);
|
|
4023
|
-
setMatches(mediaQueryList.matches);
|
|
4024
|
-
const handleChange = (event) => {
|
|
4025
|
-
setMatches(event.matches);
|
|
4026
|
-
};
|
|
4027
|
-
mediaQueryList.addEventListener("change", handleChange);
|
|
4028
|
-
return () => mediaQueryList.removeEventListener("change", handleChange);
|
|
4029
|
-
}, [query]);
|
|
4030
|
-
return matches;
|
|
4031
|
-
}
|
|
4032
|
-
|
|
4033
|
-
// src/hooks/use-click-outside.ts
|
|
4034
|
-
var import_react48 = require("react");
|
|
4035
|
-
function useClickOutside(ref, handler) {
|
|
4036
|
-
(0, import_react48.useEffect)(() => {
|
|
4037
|
-
const handleMouseDown = (event) => {
|
|
4038
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
4039
|
-
handler();
|
|
4040
|
-
}
|
|
4041
|
-
};
|
|
4042
|
-
const handleTouchStart = (event) => {
|
|
4043
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
4044
|
-
handler();
|
|
4045
|
-
}
|
|
4046
|
-
};
|
|
4047
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
4048
|
-
document.addEventListener("touchstart", handleTouchStart);
|
|
4049
|
-
return () => {
|
|
4050
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
4051
|
-
document.removeEventListener("touchstart", handleTouchStart);
|
|
4052
|
-
};
|
|
4053
|
-
}, [ref, handler]);
|
|
4054
|
-
}
|
|
4055
|
-
|
|
4056
|
-
// src/hooks/use-copy-to-clipboard.ts
|
|
4057
|
-
var import_react49 = require("react");
|
|
4058
|
-
function useCopyToClipboard() {
|
|
4059
|
-
const [copied, setCopied] = (0, import_react49.useState)(false);
|
|
4060
|
-
const timerRef = (0, import_react49.useRef)(null);
|
|
4061
|
-
(0, import_react49.useEffect)(() => {
|
|
4062
|
-
return () => {
|
|
4063
|
-
if (timerRef.current) {
|
|
4064
|
-
clearTimeout(timerRef.current);
|
|
4065
|
-
}
|
|
4066
|
-
};
|
|
4067
|
-
}, []);
|
|
4068
|
-
const copy = (0, import_react49.useCallback)(async (text) => {
|
|
4069
|
-
if (typeof navigator === "undefined" || !navigator.clipboard) {
|
|
4070
|
-
console.error("\u526A\u8D34\u677F API \u4E0D\u53EF\u7528");
|
|
4071
|
-
return;
|
|
4072
|
-
}
|
|
4073
|
-
try {
|
|
4074
|
-
await navigator.clipboard.writeText(text);
|
|
4075
|
-
setCopied(true);
|
|
4076
|
-
if (timerRef.current) {
|
|
4077
|
-
clearTimeout(timerRef.current);
|
|
4078
|
-
}
|
|
4079
|
-
timerRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
4080
|
-
} catch (error) {
|
|
4081
|
-
console.error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25:", error);
|
|
4082
|
-
}
|
|
4083
|
-
}, []);
|
|
4084
|
-
return { copied, copy };
|
|
4085
|
-
}
|
|
4086
|
-
|
|
4087
|
-
// src/hooks/use-toggle.ts
|
|
4088
|
-
var import_react50 = require("react");
|
|
4089
|
-
function useToggle(initial = false) {
|
|
4090
|
-
const [value, setValue] = (0, import_react50.useState)(initial);
|
|
4091
|
-
const toggle = (0, import_react50.useCallback)(() => {
|
|
4092
|
-
setValue((prev) => !prev);
|
|
4093
|
-
}, []);
|
|
4094
|
-
return [value, toggle, setValue];
|
|
4095
|
-
}
|
|
4096
|
-
|
|
4097
|
-
// src/hooks/use-pagination.ts
|
|
4098
|
-
var import_react51 = require("react");
|
|
4099
|
-
function usePagination({
|
|
4100
|
-
total,
|
|
4101
|
-
pageSize = 10,
|
|
4102
|
-
initialPage = 1
|
|
4103
|
-
}) {
|
|
4104
|
-
const totalPages = (0, import_react51.useMemo)(
|
|
4105
|
-
() => Math.max(1, Math.ceil(total / pageSize)),
|
|
4106
|
-
[total, pageSize]
|
|
4107
|
-
);
|
|
4108
|
-
const [page, setPageState] = (0, import_react51.useState)(
|
|
4109
|
-
() => Math.min(Math.max(1, initialPage), Math.max(1, Math.ceil(total / pageSize)))
|
|
4110
|
-
);
|
|
4111
|
-
(0, import_react51.useEffect)(() => {
|
|
4112
|
-
setPageState((prev) => Math.min(prev, totalPages));
|
|
4113
|
-
}, [totalPages]);
|
|
4114
|
-
const setPage = (0, import_react51.useCallback)(
|
|
4115
|
-
(p) => {
|
|
4116
|
-
setPageState(Math.min(Math.max(1, p), totalPages));
|
|
4117
|
-
},
|
|
4118
|
-
[totalPages]
|
|
4119
|
-
);
|
|
4120
|
-
const nextPage = (0, import_react51.useCallback)(() => {
|
|
4121
|
-
setPageState((prev) => Math.min(prev + 1, totalPages));
|
|
4122
|
-
}, [totalPages]);
|
|
4123
|
-
const prevPage = (0, import_react51.useCallback)(() => {
|
|
4124
|
-
setPageState((prev) => Math.max(prev - 1, 1));
|
|
4125
|
-
}, []);
|
|
4126
|
-
const startIndex = (page - 1) * pageSize;
|
|
4127
|
-
const endIndex = Math.min(startIndex + pageSize, total);
|
|
4128
|
-
return {
|
|
4129
|
-
page,
|
|
4130
|
-
totalPages,
|
|
4131
|
-
setPage,
|
|
4132
|
-
nextPage,
|
|
4133
|
-
prevPage,
|
|
4134
|
-
hasNext: page < totalPages,
|
|
4135
|
-
hasPrev: page > 1,
|
|
4136
|
-
startIndex,
|
|
4137
|
-
endIndex
|
|
4138
|
-
};
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
|
-
// src/hooks/use-form.ts
|
|
4142
|
-
var import_react52 = require("react");
|
|
4143
|
-
function useForm(initialValues) {
|
|
4144
|
-
const [values, setValues] = (0, import_react52.useState)(initialValues);
|
|
4145
|
-
const [errors, setErrors] = (0, import_react52.useState)({});
|
|
4146
|
-
const isDirty = (0, import_react52.useMemo)(
|
|
4147
|
-
() => Object.keys(initialValues).some(
|
|
4148
|
-
(key) => values[key] !== initialValues[key]
|
|
4149
|
-
),
|
|
4150
|
-
[values, initialValues]
|
|
4151
|
-
);
|
|
4152
|
-
const handleChange = (0, import_react52.useCallback)((name, value) => {
|
|
4153
|
-
setValues((prev) => ({ ...prev, [name]: value }));
|
|
4154
|
-
setErrors((prev) => {
|
|
4155
|
-
if (!prev[name]) return prev;
|
|
4156
|
-
const next = { ...prev };
|
|
4157
|
-
delete next[name];
|
|
4158
|
-
return next;
|
|
4159
|
-
});
|
|
4160
|
-
}, []);
|
|
4161
|
-
const setError = (0, import_react52.useCallback)((name, message) => {
|
|
4162
|
-
setErrors((prev) => ({ ...prev, [name]: message }));
|
|
4163
|
-
}, []);
|
|
4164
|
-
const clearErrors = (0, import_react52.useCallback)(() => {
|
|
4165
|
-
setErrors({});
|
|
4166
|
-
}, []);
|
|
4167
|
-
const reset = (0, import_react52.useCallback)(() => {
|
|
4168
|
-
setValues(initialValues);
|
|
4169
|
-
setErrors({});
|
|
4170
|
-
}, [initialValues]);
|
|
4171
|
-
return { values, errors, handleChange, setError, clearErrors, reset, isDirty };
|
|
4172
|
-
}
|
|
4173
|
-
|
|
4174
|
-
// src/hooks/use-mounted.ts
|
|
4175
|
-
var import_react53 = require("react");
|
|
4176
|
-
function useMounted() {
|
|
4177
|
-
const [mounted, setMounted] = (0, import_react53.useState)(false);
|
|
4178
|
-
(0, import_react53.useEffect)(() => {
|
|
4179
|
-
setMounted(true);
|
|
4180
|
-
}, []);
|
|
4181
|
-
return mounted;
|
|
4182
|
-
}
|
|
4183
|
-
|
|
4184
|
-
// src/hooks/use-interval.ts
|
|
4185
|
-
var import_react54 = require("react");
|
|
4186
|
-
function useInterval(callback, delay) {
|
|
4187
|
-
const savedCallback = (0, import_react54.useRef)(callback);
|
|
4188
|
-
(0, import_react54.useEffect)(() => {
|
|
4189
|
-
savedCallback.current = callback;
|
|
4190
|
-
}, [callback]);
|
|
4191
|
-
(0, import_react54.useEffect)(() => {
|
|
4192
|
-
if (delay === null) return;
|
|
4193
|
-
const id = setInterval(() => savedCallback.current(), delay);
|
|
4194
|
-
return () => clearInterval(id);
|
|
4195
|
-
}, [delay]);
|
|
4196
|
-
}
|
|
4197
|
-
|
|
4198
|
-
// src/hooks/use-timeout.ts
|
|
4199
|
-
var import_react55 = require("react");
|
|
4200
|
-
function useTimeout(callback, delay) {
|
|
4201
|
-
const savedCallback = (0, import_react55.useRef)(callback);
|
|
4202
|
-
(0, import_react55.useEffect)(() => {
|
|
4203
|
-
savedCallback.current = callback;
|
|
4204
|
-
}, [callback]);
|
|
4205
|
-
(0, import_react55.useEffect)(() => {
|
|
4206
|
-
if (delay === null) return;
|
|
4207
|
-
const id = setTimeout(() => savedCallback.current(), delay);
|
|
4208
|
-
return () => clearTimeout(id);
|
|
4209
|
-
}, [delay]);
|
|
4210
|
-
}
|
|
4211
|
-
|
|
4212
|
-
// src/hooks/use-hotkeys.ts
|
|
4213
|
-
var import_react56 = require("react");
|
|
4214
|
-
function parseHotkey(keys) {
|
|
4215
|
-
const parts = keys.toLowerCase().split("+").map((s) => s.trim());
|
|
4216
|
-
const ctrl = parts.includes("ctrl");
|
|
4217
|
-
const meta = parts.includes("cmd") || parts.includes("meta");
|
|
4218
|
-
const alt = parts.includes("alt");
|
|
4219
|
-
const shift = parts.includes("shift");
|
|
4220
|
-
const key = parts.find(
|
|
4221
|
-
(p) => !["ctrl", "cmd", "meta", "alt", "shift"].includes(p)
|
|
4222
|
-
) ?? "";
|
|
4223
|
-
return { ctrl, meta, alt, shift, key };
|
|
4224
|
-
}
|
|
4225
|
-
function useHotkeys(keys, callback, options = {}) {
|
|
4226
|
-
const { preventDefault = false, target = null } = options;
|
|
4227
|
-
const savedCallback = (0, import_react56.useRef)(callback);
|
|
4228
|
-
(0, import_react56.useEffect)(() => {
|
|
4229
|
-
savedCallback.current = callback;
|
|
4230
|
-
}, [callback]);
|
|
4231
|
-
(0, import_react56.useEffect)(() => {
|
|
4232
|
-
const parsed = parseHotkey(keys);
|
|
4233
|
-
const eventTarget = target ?? window;
|
|
4234
|
-
function handler(event) {
|
|
4235
|
-
const eventKey = event.key.toLowerCase();
|
|
4236
|
-
const match = eventKey === parsed.key && event.ctrlKey === parsed.ctrl && event.metaKey === parsed.meta && event.altKey === parsed.alt && event.shiftKey === parsed.shift;
|
|
4237
|
-
if (match) {
|
|
4238
|
-
if (preventDefault) event.preventDefault();
|
|
4239
|
-
savedCallback.current(event);
|
|
4240
|
-
}
|
|
4241
|
-
}
|
|
4242
|
-
eventTarget.addEventListener("keydown", handler);
|
|
4243
|
-
return () => {
|
|
4244
|
-
eventTarget.removeEventListener("keydown", handler);
|
|
4245
|
-
};
|
|
4246
|
-
}, [keys, preventDefault, target]);
|
|
4247
|
-
}
|
|
4248
|
-
|
|
4249
|
-
// src/hooks/use-event-listener.ts
|
|
4250
|
-
var import_react57 = require("react");
|
|
4251
|
-
function useEventListener(event, handler, target) {
|
|
4252
|
-
const savedHandler = (0, import_react57.useRef)(handler);
|
|
4253
|
-
(0, import_react57.useEffect)(() => {
|
|
4254
|
-
savedHandler.current = handler;
|
|
4255
|
-
}, [handler]);
|
|
4256
|
-
(0, import_react57.useEffect)(() => {
|
|
4257
|
-
if (target === null) return;
|
|
4258
|
-
const eventTarget = target ?? window;
|
|
4259
|
-
function listener(event2) {
|
|
4260
|
-
savedHandler.current(event2);
|
|
4261
|
-
}
|
|
4262
|
-
eventTarget.addEventListener(event, listener);
|
|
4263
|
-
return () => {
|
|
4264
|
-
eventTarget.removeEventListener(event, listener);
|
|
4265
|
-
};
|
|
4266
|
-
}, [event, target]);
|
|
4267
|
-
}
|
|
4268
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
4269
|
-
0 && (module.exports = {
|
|
4270
|
-
Accordion,
|
|
4271
|
-
AccordionContent,
|
|
4272
|
-
AccordionItem,
|
|
4273
|
-
AccordionTrigger,
|
|
4274
|
-
Alert,
|
|
4275
|
-
AlertDescription,
|
|
4276
|
-
AlertTitle,
|
|
4277
|
-
Avatar,
|
|
4278
|
-
AvatarFallback,
|
|
4279
|
-
AvatarGroup,
|
|
4280
|
-
AvatarImage,
|
|
4281
|
-
Badge,
|
|
4282
|
-
Breadcrumb,
|
|
4283
|
-
BreadcrumbItem,
|
|
4284
|
-
BreadcrumbLink,
|
|
4285
|
-
BreadcrumbSeparator,
|
|
4286
|
-
Button,
|
|
4287
|
-
Card,
|
|
4288
|
-
CardContent,
|
|
4289
|
-
CardDescription,
|
|
4290
|
-
CardFooter,
|
|
4291
|
-
CardHeader,
|
|
4292
|
-
CardTitle,
|
|
4293
|
-
Checkbox,
|
|
4294
|
-
ContextMenu,
|
|
4295
|
-
ContextMenuContent,
|
|
4296
|
-
ContextMenuItem,
|
|
4297
|
-
ContextMenuSeparator,
|
|
4298
|
-
ContextMenuTrigger,
|
|
4299
|
-
Descriptions,
|
|
4300
|
-
DescriptionsItem,
|
|
4301
|
-
Dialog,
|
|
4302
|
-
Drawer,
|
|
4303
|
-
DrawerClose,
|
|
4304
|
-
DrawerContent,
|
|
4305
|
-
DrawerDescription,
|
|
4306
|
-
DrawerFooter,
|
|
4307
|
-
DrawerHeader,
|
|
4308
|
-
DrawerTitle,
|
|
4309
|
-
DropdownContent,
|
|
4310
|
-
DropdownItem,
|
|
4311
|
-
DropdownMenu,
|
|
4312
|
-
DropdownSeparator,
|
|
4313
|
-
DropdownTrigger,
|
|
4314
|
-
EmptyState,
|
|
4315
|
-
Form,
|
|
4316
|
-
FormControl,
|
|
4317
|
-
FormDescription,
|
|
4318
|
-
FormField,
|
|
4319
|
-
FormItem,
|
|
4320
|
-
FormLabel,
|
|
4321
|
-
FormMessage,
|
|
4322
|
-
Input,
|
|
4323
|
-
Label,
|
|
4324
|
-
Modal,
|
|
4325
|
-
ModalCloseButton,
|
|
4326
|
-
ModalContent,
|
|
4327
|
-
ModalFooter,
|
|
4328
|
-
ModalHeader,
|
|
4329
|
-
ModalTitle,
|
|
4330
|
-
NavigationMenu,
|
|
4331
|
-
NavigationMenuContent,
|
|
4332
|
-
NavigationMenuItem,
|
|
4333
|
-
NavigationMenuLink,
|
|
4334
|
-
NavigationMenuTrigger,
|
|
4335
|
-
NumberInput,
|
|
4336
|
-
OTPInput,
|
|
4337
|
-
Pagination,
|
|
4338
|
-
Popover,
|
|
4339
|
-
PopoverContent,
|
|
4340
|
-
PopoverTrigger,
|
|
4341
|
-
Progress,
|
|
4342
|
-
Radio,
|
|
4343
|
-
RadioGroup,
|
|
4344
|
-
Select,
|
|
4345
|
-
Separator,
|
|
4346
|
-
Sheet,
|
|
4347
|
-
Sidebar,
|
|
4348
|
-
Skeleton,
|
|
4349
|
-
Slider,
|
|
4350
|
-
Spinner,
|
|
4351
|
-
Statistic,
|
|
4352
|
-
Steps,
|
|
4353
|
-
Switch,
|
|
4354
|
-
Table,
|
|
4355
|
-
TableBody,
|
|
4356
|
-
TableCell,
|
|
4357
|
-
TableHead,
|
|
4358
|
-
TableHeader,
|
|
4359
|
-
TableRow,
|
|
4360
|
-
Tabs,
|
|
4361
|
-
TabsContent,
|
|
4362
|
-
TabsList,
|
|
4363
|
-
TabsTrigger,
|
|
4364
|
-
Tag,
|
|
4365
|
-
Textarea,
|
|
4366
|
-
Toaster,
|
|
4367
|
-
Tooltip,
|
|
4368
|
-
TooltipContent,
|
|
4369
|
-
TooltipTrigger,
|
|
4370
|
-
UGAccordion,
|
|
4371
|
-
UGAccordionContent,
|
|
4372
|
-
UGAccordionItem,
|
|
4373
|
-
UGAccordionTrigger,
|
|
4374
|
-
UGAlert,
|
|
4375
|
-
UGAlertDescription,
|
|
4376
|
-
UGAlertTitle,
|
|
4377
|
-
UGAvatar,
|
|
4378
|
-
UGAvatarFallback,
|
|
4379
|
-
UGAvatarGroup,
|
|
4380
|
-
UGAvatarImage,
|
|
4381
|
-
UGBadge,
|
|
4382
|
-
UGBreadcrumb,
|
|
4383
|
-
UGBreadcrumbItem,
|
|
4384
|
-
UGBreadcrumbLink,
|
|
4385
|
-
UGBreadcrumbSeparator,
|
|
4386
|
-
UGButton,
|
|
4387
|
-
UGCard,
|
|
4388
|
-
UGCardContent,
|
|
4389
|
-
UGCardDescription,
|
|
4390
|
-
UGCardFooter,
|
|
4391
|
-
UGCardHeader,
|
|
4392
|
-
UGCardTitle,
|
|
4393
|
-
UGCheckbox,
|
|
4394
|
-
UGContextMenu,
|
|
4395
|
-
UGContextMenuContent,
|
|
4396
|
-
UGContextMenuItem,
|
|
4397
|
-
UGContextMenuSeparator,
|
|
4398
|
-
UGContextMenuTrigger,
|
|
4399
|
-
UGDescriptions,
|
|
4400
|
-
UGDescriptionsItem,
|
|
4401
|
-
UGDialog,
|
|
4402
|
-
UGDrawer,
|
|
4403
|
-
UGDrawerClose,
|
|
4404
|
-
UGDrawerContent,
|
|
4405
|
-
UGDrawerDescription,
|
|
4406
|
-
UGDrawerFooter,
|
|
4407
|
-
UGDrawerHeader,
|
|
4408
|
-
UGDrawerTitle,
|
|
4409
|
-
UGDropdown,
|
|
4410
|
-
UGDropdownContent,
|
|
4411
|
-
UGDropdownItem,
|
|
4412
|
-
UGDropdownMenu,
|
|
4413
|
-
UGDropdownSeparator,
|
|
4414
|
-
UGDropdownTrigger,
|
|
4415
|
-
UGEmptyState,
|
|
4416
|
-
UGForm,
|
|
4417
|
-
UGFormControl,
|
|
4418
|
-
UGFormDescription,
|
|
4419
|
-
UGFormField,
|
|
4420
|
-
UGFormItem,
|
|
4421
|
-
UGFormLabel,
|
|
4422
|
-
UGFormMessage,
|
|
4423
|
-
UGInput,
|
|
4424
|
-
UGLabel,
|
|
4425
|
-
UGModal,
|
|
4426
|
-
UGModalCloseButton,
|
|
4427
|
-
UGModalContent,
|
|
4428
|
-
UGModalFooter,
|
|
4429
|
-
UGModalHeader,
|
|
4430
|
-
UGModalTitle,
|
|
4431
|
-
UGNavigationMenu,
|
|
4432
|
-
UGNavigationMenuContent,
|
|
4433
|
-
UGNavigationMenuItem,
|
|
4434
|
-
UGNavigationMenuLink,
|
|
4435
|
-
UGNavigationMenuTrigger,
|
|
4436
|
-
UGNumberInput,
|
|
4437
|
-
UGOTPInput,
|
|
4438
|
-
UGPagination,
|
|
4439
|
-
UGPopover,
|
|
4440
|
-
UGPopoverContent,
|
|
4441
|
-
UGPopoverTrigger,
|
|
4442
|
-
UGProgress,
|
|
4443
|
-
UGRadio,
|
|
4444
|
-
UGRadioGroup,
|
|
4445
|
-
UGSelect,
|
|
4446
|
-
UGSeparator,
|
|
4447
|
-
UGSheet,
|
|
4448
|
-
UGSidebar,
|
|
4449
|
-
UGSkeleton,
|
|
4450
|
-
UGSlider,
|
|
4451
|
-
UGSpinner,
|
|
4452
|
-
UGStatistic,
|
|
4453
|
-
UGSteps,
|
|
4454
|
-
UGSwitch,
|
|
4455
|
-
UGTable,
|
|
4456
|
-
UGTableBody,
|
|
4457
|
-
UGTableCell,
|
|
4458
|
-
UGTableHead,
|
|
4459
|
-
UGTableHeader,
|
|
4460
|
-
UGTableRow,
|
|
4461
|
-
UGTabs,
|
|
4462
|
-
UGTabsContent,
|
|
4463
|
-
UGTabsList,
|
|
4464
|
-
UGTabsTrigger,
|
|
4465
|
-
UGTag,
|
|
4466
|
-
UGTextarea,
|
|
4467
|
-
UGToaster,
|
|
4468
|
-
UGTooltip,
|
|
4469
|
-
UGTooltipContent,
|
|
4470
|
-
UGTooltipTrigger,
|
|
4471
|
-
badgeVariants,
|
|
4472
|
-
buttonVariants,
|
|
4473
|
-
checkboxVariants,
|
|
4474
|
-
cn,
|
|
4475
|
-
numberInputVariants,
|
|
4476
|
-
reactComponentLayers,
|
|
4477
|
-
tagVariants,
|
|
4478
|
-
theme,
|
|
4479
|
-
toast,
|
|
4480
|
-
ugBadgeVariants,
|
|
4481
|
-
ugButtonVariants,
|
|
4482
|
-
ugCheckboxVariants,
|
|
4483
|
-
ugNumberInputVariants,
|
|
4484
|
-
ugTagVariants,
|
|
4485
|
-
useClickOutside,
|
|
4486
|
-
useCopyToClipboard,
|
|
4487
|
-
useDebounce,
|
|
4488
|
-
useEventListener,
|
|
4489
|
-
useForm,
|
|
4490
|
-
useHotkeys,
|
|
4491
|
-
useInterval,
|
|
4492
|
-
useLocalStorage,
|
|
4493
|
-
useMediaQuery,
|
|
4494
|
-
useMounted,
|
|
4495
|
-
usePagination,
|
|
4496
|
-
useTimeout,
|
|
4497
|
-
useToggle
|
|
4498
|
-
});
|
|
4499
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./chunk-ZDO5A2IZ.cjs"),t=require("./chunk-D63UPGP5.cjs"),r=require("./chunk-JY5S7YLF.cjs"),o=require("./chunk-2EJWWTLH.cjs"),a=require("./chunk-X4EMYHLY.cjs"),s=require("./chunk-UBZ2ZCEJ.cjs"),p=require("./chunk-J4NAYP4L.cjs"),i=require("./chunk-XVFRKGM7.cjs");exports.Accordion=e.Accordion,exports.AccordionContent=e.AccordionContent,exports.AccordionItem=e.AccordionItem,exports.AccordionTrigger=e.AccordionTrigger,exports.Alert=r.Alert,exports.AlertDescription=r.AlertDescription,exports.AlertTitle=r.AlertTitle,exports.Aside=s.Aside,exports.Autocomplete=e.Autocomplete,exports.Avatar=e.Avatar,exports.AvatarFallback=e.AvatarFallback,exports.AvatarGroup=e.AvatarGroup,exports.AvatarImage=e.AvatarImage,exports.Backtop=e.Backtop,exports.Badge=s.Badge,exports.BarChart=e.BarChart,exports.Breadcrumb=e.Breadcrumb,exports.BreadcrumbItem=e.BreadcrumbItem,exports.BreadcrumbLink=e.BreadcrumbLink,exports.BreadcrumbSeparator=e.BreadcrumbSeparator,exports.Button=i.Button,exports.ButtonGroup=s.ButtonGroup,exports.Card=s.Card,exports.CardContent=s.CardContent,exports.CardDescription=s.CardDescription,exports.CardFooter=s.CardFooter,exports.CardHeader=s.CardHeader,exports.CardTitle=s.CardTitle,exports.Cascader=e.Cascader,exports.Checkbox=r.Checkbox,exports.CheckboxGroup=r.CheckboxGroup,exports.Col=s.Col,exports.Collapsible=e.Collapsible,exports.CollapsibleContent=e.CollapsibleContent,exports.CollapsibleTrigger=e.CollapsibleTrigger,exports.ColorPicker=e.ColorPicker,exports.ConfigProvider=i.ConfigProvider,exports.Container=s.Container,exports.ContextMenu=e.ContextMenu,exports.ContextMenuContent=e.ContextMenuContent,exports.ContextMenuItem=e.ContextMenuItem,exports.ContextMenuSeparator=e.ContextMenuSeparator,exports.ContextMenuTrigger=e.ContextMenuTrigger,exports.DataPanel=e.DataPanel,exports.DatePicker=e.DatePicker,exports.DateRangePicker=e.DateRangePicker,exports.DateTimePicker=e.DateTimePicker,exports.Descriptions=e.Descriptions,exports.DescriptionsItem=e.DescriptionsItem,exports.Dialog=e.Dialog,exports.Dock=e.Dock,exports.DockItem=e.DockItem,exports.DockLabel=e.DockLabel,exports.DonutChart=e.DonutChart,exports.Drawer=e.Drawer,exports.DrawerBody=e.DrawerBody,exports.DrawerClose=e.DrawerClose,exports.DrawerContent=e.DrawerContent,exports.DrawerDescription=e.DrawerDescription,exports.DrawerFooter=e.DrawerFooter,exports.DrawerHeader=e.DrawerHeader,exports.DrawerTitle=e.DrawerTitle,exports.DropdownContent=e.DropdownContent,exports.DropdownItem=e.DropdownItem,exports.DropdownMenu=e.DropdownMenu,exports.DropdownRadioItem=e.DropdownRadioItem,exports.DropdownSeparator=e.DropdownSeparator,exports.DropdownTrigger=e.DropdownTrigger,exports.EmptyState=r.EmptyState,exports.Fab=e.Fab,exports.FabAction=e.FabAction,exports.FabActions=e.FabActions,exports.FabTrigger=e.FabTrigger,exports.Fieldset=r.Fieldset,exports.FieldsetDescription=r.FieldsetDescription,exports.FieldsetLegend=r.FieldsetLegend,exports.FileInput=e.FileInput,exports.Footer=s.Footer,exports.Form=e.Form,exports.FormControl=e.FormControl,exports.FormDescription=e.FormDescription,exports.FormField=e.FormField,exports.FormItem=e.FormItem,exports.FormLabel=e.FormLabel,exports.FormMessage=e.FormMessage,exports.GaugeChart=e.GaugeChart,exports.Header=s.Header,exports.HeatmapChart=e.HeatmapChart,exports.Icon=s.Icon,exports.Image=e.Image,exports.ImageViewer=e.ImageViewer,exports.Indicator=s.Indicator,exports.IndicatorItem=s.IndicatorItem,exports.InfiniteScroll=e.InfiniteScroll,exports.Input=p.Input,exports.Join=s.Join,exports.JoinItem=s.JoinItem,exports.Kbd=s.Kbd,exports.Label=s.Label,exports.Link=s.Link,exports.List=e.List,exports.ListItem=e.ListItem,exports.ListItemActions=e.ListItemActions,exports.ListItemContent=e.ListItemContent,exports.ListItemDescription=e.ListItemDescription,exports.ListItemTitle=e.ListItemTitle,exports.Loading=e.Loading,exports.Main=s.Main,exports.Modal=r.Modal,exports.ModalBody=r.ModalBody,exports.ModalCloseButton=r.ModalCloseButton,exports.ModalContent=r.ModalContent,exports.ModalFooter=r.ModalFooter,exports.ModalHeader=r.ModalHeader,exports.ModalTitle=r.ModalTitle,exports.Navbar=e.Navbar,exports.NavbarCenter=e.NavbarCenter,exports.NavbarEnd=e.NavbarEnd,exports.NavbarSection=e.NavbarSection,exports.NavbarStart=e.NavbarStart,exports.NavigationMenu=r.NavigationMenu,exports.NavigationMenuContent=r.NavigationMenuContent,exports.NavigationMenuItem=r.NavigationMenuItem,exports.NavigationMenuLink=r.NavigationMenuLink,exports.NavigationMenuTrigger=r.NavigationMenuTrigger,exports.Notification=e.Notification,exports.NumberInput=e.NumberInput,exports.OTPInput=e.OTPInput,exports.Pagination=r.Pagination,exports.Popconfirm=e.Popconfirm,exports.Popover=e.Popover,exports.PopoverContent=e.PopoverContent,exports.PopoverTrigger=e.PopoverTrigger,exports.Progress=e.Progress,exports.RadarChart=e.RadarChart,exports.RadialProgress=e.RadialProgress,exports.Radio=r.Radio,exports.RadioGroup=r.RadioGroup,exports.RankingList=e.RankingList,exports.Rating=e.Rating,exports.Result=e.Result,exports.Row=s.Row,exports.Scrollbar=s.Scrollbar,exports.Select=r.Select,exports.Separator=s.Separator,exports.Sheet=e.Sheet,exports.Sidebar=r.Sidebar,exports.Skeleton=r.Skeleton,exports.Slider=e.Slider,exports.Space=s.Space,exports.Spinner=s.Spinner,exports.Splitter=s.Splitter,exports.SplitterPanel=s.SplitterPanel,exports.Stack=s.Stack,exports.StackedBarChart=e.StackedBarChart,exports.Statistic=e.Statistic,exports.StatisticCard=e.StatisticCard,exports.Steps=e.Steps,exports.Switch=e.Switch,exports.Table=r.Table,exports.TableBody=r.TableBody,exports.TableCell=r.TableCell,exports.TableHead=r.TableHead,exports.TableHeader=r.TableHeader,exports.TableRow=r.TableRow,exports.Tabs=r.Tabs,exports.TabsContent=r.TabsContent,exports.TabsList=r.TabsList,exports.TabsTrigger=r.TabsTrigger,exports.Tag=s.Tag,exports.Text=s.Text,exports.Textarea=r.Textarea,exports.ThemeController=e.ThemeController,exports.TimePicker=e.TimePicker,exports.TimeRangePicker=e.TimeRangePicker,exports.TimeSelect=e.TimeSelect,exports.Timeline=e.Timeline,exports.TimelineContent=e.TimelineContent,exports.TimelineDescription=e.TimelineDescription,exports.TimelineItem=e.TimelineItem,exports.TimelineMarker=e.TimelineMarker,exports.TimelineTime=e.TimelineTime,exports.TimelineTitle=e.TimelineTitle,exports.Toaster=e.Toaster,exports.Tooltip=r.Tooltip,exports.TooltipContent=r.TooltipContent,exports.TooltipTrigger=r.TooltipTrigger,exports.Transfer=e.Transfer,exports.Tree=e.Tree,exports.TreeSelect=e.TreeSelect,exports.TrendChart=e.TrendChart,exports.UGAccordion=e.Accordion,exports.UGAccordionContent=e.AccordionContent,exports.UGAccordionItem=e.AccordionItem,exports.UGAccordionTrigger=e.AccordionTrigger,exports.UGAlert=r.Alert,exports.UGAlertDescription=r.AlertDescription,exports.UGAlertTitle=r.AlertTitle,exports.UGAside=s.Aside,exports.UGAutocomplete=e.Autocomplete,exports.UGAvatar=e.Avatar,exports.UGAvatarFallback=e.AvatarFallback,exports.UGAvatarGroup=e.AvatarGroup,exports.UGAvatarImage=e.AvatarImage,exports.UGBacktop=e.Backtop,exports.UGBadge=s.Badge,exports.UGBarChart=e.BarChart,exports.UGBreadcrumb=e.Breadcrumb,exports.UGBreadcrumbItem=e.BreadcrumbItem,exports.UGBreadcrumbLink=e.BreadcrumbLink,exports.UGBreadcrumbSeparator=e.BreadcrumbSeparator,exports.UGButton=i.Button,exports.UGButtonGroup=s.ButtonGroup,exports.UGCalendar=e.Calendar,exports.UGCard=s.Card,exports.UGCardContent=s.CardContent,exports.UGCardDescription=s.CardDescription,exports.UGCardFooter=s.CardFooter,exports.UGCardHeader=s.CardHeader,exports.UGCardTitle=s.CardTitle,exports.UGCarousel=e.Carousel,exports.UGCarouselItem=e.CarouselItem,exports.UGCascader=e.Cascader,exports.UGCheckbox=r.Checkbox,exports.UGCheckboxGroup=r.CheckboxGroup,exports.UGCol=s.Col,exports.UGCollapsible=e.Collapsible,exports.UGCollapsibleContent=e.CollapsibleContent,exports.UGCollapsibleTrigger=e.CollapsibleTrigger,exports.UGColorPicker=e.ColorPicker,exports.UGConfigProvider=i.ConfigProvider,exports.UGContainer=s.Container,exports.UGContextMenu=e.ContextMenu,exports.UGContextMenuContent=e.ContextMenuContent,exports.UGContextMenuItem=e.ContextMenuItem,exports.UGContextMenuSeparator=e.ContextMenuSeparator,exports.UGContextMenuTrigger=e.ContextMenuTrigger,exports.UGDataPanel=e.DataPanel,exports.UGDatePicker=e.DatePicker,exports.UGDateRangePicker=e.DateRangePicker,exports.UGDateTimePicker=e.DateTimePicker,exports.UGDescriptions=e.Descriptions,exports.UGDescriptionsItem=e.DescriptionsItem,exports.UGDialog=e.Dialog,exports.UGDock=e.Dock,exports.UGDockItem=e.DockItem,exports.UGDockLabel=e.DockLabel,exports.UGDonutChart=e.DonutChart,exports.UGDrawer=e.Drawer,exports.UGDrawerBody=e.DrawerBody,exports.UGDrawerClose=e.DrawerClose,exports.UGDrawerContent=e.DrawerContent,exports.UGDrawerDescription=e.DrawerDescription,exports.UGDrawerFooter=e.DrawerFooter,exports.UGDrawerHeader=e.DrawerHeader,exports.UGDrawerTitle=e.DrawerTitle,exports.UGDropdown=e.DropdownMenu,exports.UGDropdownContent=e.DropdownContent,exports.UGDropdownItem=e.DropdownItem,exports.UGDropdownMenu=e.DropdownMenu,exports.UGDropdownRadioItem=e.DropdownRadioItem,exports.UGDropdownSeparator=e.DropdownSeparator,exports.UGDropdownTrigger=e.DropdownTrigger,exports.UGEmptyState=r.EmptyState,exports.UGFab=e.Fab,exports.UGFabAction=e.FabAction,exports.UGFabActions=e.FabActions,exports.UGFabTrigger=e.FabTrigger,exports.UGFieldset=r.Fieldset,exports.UGFieldsetDescription=r.FieldsetDescription,exports.UGFieldsetLegend=r.FieldsetLegend,exports.UGFileInput=e.FileInput,exports.UGFooter=s.Footer,exports.UGForm=e.Form,exports.UGFormControl=e.FormControl,exports.UGFormDescription=e.FormDescription,exports.UGFormField=e.FormField,exports.UGFormItem=e.FormItem,exports.UGFormLabel=e.FormLabel,exports.UGFormMessage=e.FormMessage,exports.UGGaugeChart=e.GaugeChart,exports.UGHeader=s.Header,exports.UGHeatmapChart=e.HeatmapChart,exports.UGIcon=s.Icon,exports.UGImage=e.Image,exports.UGImageViewer=e.ImageViewer,exports.UGIndicator=s.Indicator,exports.UGIndicatorItem=s.IndicatorItem,exports.UGInfiniteScroll=e.InfiniteScroll,exports.UGInput=p.Input,exports.UGJoin=s.Join,exports.UGJoinItem=s.JoinItem,exports.UGKbd=s.Kbd,exports.UGLabel=s.Label,exports.UGLink=s.Link,exports.UGList=e.List,exports.UGListItem=e.ListItem,exports.UGListItemActions=e.ListItemActions,exports.UGListItemContent=e.ListItemContent,exports.UGListItemDescription=e.ListItemDescription,exports.UGListItemTitle=e.ListItemTitle,exports.UGLoading=e.Loading,exports.UGMain=s.Main,exports.UGModal=r.Modal,exports.UGModalBody=r.ModalBody,exports.UGModalCloseButton=r.ModalCloseButton,exports.UGModalContent=r.ModalContent,exports.UGModalFooter=r.ModalFooter,exports.UGModalHeader=r.ModalHeader,exports.UGModalTitle=r.ModalTitle,exports.UGNavbar=e.Navbar,exports.UGNavbarCenter=e.NavbarCenter,exports.UGNavbarEnd=e.NavbarEnd,exports.UGNavbarSection=e.NavbarSection,exports.UGNavbarStart=e.NavbarStart,exports.UGNavigationMenu=r.NavigationMenu,exports.UGNavigationMenuContent=r.NavigationMenuContent,exports.UGNavigationMenuItem=r.NavigationMenuItem,exports.UGNavigationMenuLink=r.NavigationMenuLink,exports.UGNavigationMenuTrigger=r.NavigationMenuTrigger,exports.UGNotification=e.Notification,exports.UGNumberInput=e.NumberInput,exports.UGOTPInput=e.OTPInput,exports.UGPagination=r.Pagination,exports.UGPopconfirm=e.Popconfirm,exports.UGPopover=e.Popover,exports.UGPopoverContent=e.PopoverContent,exports.UGPopoverTrigger=e.PopoverTrigger,exports.UGProgress=e.Progress,exports.UGRadarChart=e.RadarChart,exports.UGRadialProgress=e.RadialProgress,exports.UGRadio=r.Radio,exports.UGRadioGroup=r.RadioGroup,exports.UGRankingList=e.RankingList,exports.UGRating=e.Rating,exports.UGResult=e.Result,exports.UGRow=s.Row,exports.UGScrollbar=s.Scrollbar,exports.UGSelect=r.Select,exports.UGSeparator=s.Separator,exports.UGSheet=e.Sheet,exports.UGSidebar=r.Sidebar,exports.UGSkeleton=r.Skeleton,exports.UGSlider=e.Slider,exports.UGSpace=s.Space,exports.UGSpinner=s.Spinner,exports.UGSplitter=s.Splitter,exports.UGSplitterPanel=s.SplitterPanel,exports.UGStack=s.Stack,exports.UGStackedBarChart=e.StackedBarChart,exports.UGStatistic=e.Statistic,exports.UGStatisticCard=e.StatisticCard,exports.UGSteps=e.Steps,exports.UGSwitch=e.Switch,exports.UGTable=r.Table,exports.UGTableBody=r.TableBody,exports.UGTableCell=r.TableCell,exports.UGTableHead=r.TableHead,exports.UGTableHeader=r.TableHeader,exports.UGTableRow=r.TableRow,exports.UGTabs=r.Tabs,exports.UGTabsContent=r.TabsContent,exports.UGTabsList=r.TabsList,exports.UGTabsTrigger=r.TabsTrigger,exports.UGTag=s.Tag,exports.UGText=s.Text,exports.UGTextarea=r.Textarea,exports.UGThemeController=e.ThemeController,exports.UGTimePicker=e.TimePicker,exports.UGTimeRangePicker=e.TimeRangePicker,exports.UGTimeSelect=e.TimeSelect,exports.UGTimeline=e.Timeline,exports.UGTimelineContent=e.TimelineContent,exports.UGTimelineDescription=e.TimelineDescription,exports.UGTimelineItem=e.TimelineItem,exports.UGTimelineMarker=e.TimelineMarker,exports.UGTimelineTime=e.TimelineTime,exports.UGTimelineTitle=e.TimelineTitle,exports.UGToaster=e.Toaster,exports.UGTooltip=r.Tooltip,exports.UGTooltipContent=r.TooltipContent,exports.UGTooltipTrigger=r.TooltipTrigger,exports.UGTransfer=e.Transfer,exports.UGTree=e.Tree,exports.UGTreeSelect=e.TreeSelect,exports.UGTrendChart=e.TrendChart,exports.UGUpload=e.Upload,exports.Upload=e.Upload,exports.badgeVariants=s.badgeVariants,exports.buttonVariants=i.buttonVariants,exports.checkboxVariants=r.checkboxVariants,exports.cn=i.cn,exports.createToastStore=e.createToastStore,exports.numberInputVariants=e.numberInputVariants,exports.tagVariants=s.tagVariants,exports.theme=o.theme,exports.toast=e.toast,exports.ugBadgeVariants=s.badgeVariants,exports.ugButtonVariants=i.buttonVariants,exports.ugCheckboxVariants=r.checkboxVariants,exports.ugNumberInputVariants=e.numberInputVariants,exports.ugTagVariants=s.tagVariants,exports.useClickOutside=t.useClickOutside,exports.useCopyToClipboard=t.useCopyToClipboard,exports.useDebounce=t.useDebounce,exports.useEventListener=t.useEventListener,exports.useForm=t.useForm,exports.useHotkeys=t.useHotkeys,exports.useInterval=t.useInterval,exports.useLocalStorage=t.useLocalStorage,exports.useMediaQuery=a.useMediaQuery,exports.useMounted=t.useMounted,exports.usePagination=t.usePagination,exports.useTimeout=t.useTimeout,exports.useToggle=t.useToggle,exports.useUIConfig=i.useUIConfig;//# sourceMappingURL=index.cjs.map
|