tembro 2.0.6 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/calendar/calendar.cjs +1 -1
- package/dist/components/calendar/calendar.d.ts +2 -1
- package/dist/components/calendar/calendar.js +126 -122
- package/dist/components/calendar/date-range-picker.cjs +1 -1
- package/dist/components/calendar/date-range-picker.d.ts +2 -1
- package/dist/components/calendar/date-range-picker.js +39 -39
- package/dist/components/charts/charts.cjs +1 -1
- package/dist/components/charts/charts.d.ts +13 -4
- package/dist/components/charts/charts.js +76 -46
- package/dist/components/charts/progress-ring.cjs +1 -1
- package/dist/components/charts/progress-ring.d.ts +3 -1
- package/dist/components/charts/progress-ring.js +11 -10
- package/dist/components/data-table/data-table-column-visibility-menu.cjs +1 -1
- package/dist/components/data-table/data-table-column-visibility-menu.d.ts +4 -1
- package/dist/components/data-table/data-table-column-visibility-menu.js +36 -8
- package/dist/components/data-table/data-table-toolbar.cjs +1 -1
- package/dist/components/data-table/data-table-toolbar.js +12 -13
- package/dist/components/display/carousel.cjs +1 -1
- package/dist/components/display/carousel.d.ts +9 -1
- package/dist/components/display/carousel.js +123 -81
- package/dist/components/display/code-block.cjs +2 -2
- package/dist/components/display/code-block.d.ts +2 -1
- package/dist/components/display/code-block.js +17 -12
- package/dist/components/display/delta-badge.cjs +1 -1
- package/dist/components/display/delta-badge.d.ts +2 -1
- package/dist/components/display/delta-badge.js +11 -7
- package/dist/components/display/kanban.cjs +1 -1
- package/dist/components/display/kanban.d.ts +4 -1
- package/dist/components/display/kanban.js +60 -33
- package/dist/components/display/metric-grid.cjs +1 -1
- package/dist/components/display/metric-grid.d.ts +1 -0
- package/dist/components/display/metric-grid.js +1 -1
- package/dist/components/display/qr-code.cjs +1 -1
- package/dist/components/display/qr-code.d.ts +2 -1
- package/dist/components/display/qr-code.js +19 -16
- package/dist/components/display/status-legend.cjs +1 -1
- package/dist/components/display/status-legend.js +6 -2
- package/dist/components/display/tag.cjs +1 -1
- package/dist/components/display/tag.d.ts +2 -1
- package/dist/components/display/tag.js +28 -22
- package/dist/components/display/tree-view.cjs +1 -1
- package/dist/components/display/tree-view.d.ts +9 -1
- package/dist/components/display/tree-view.js +104 -40
- package/dist/components/display/trend-card.cjs +1 -1
- package/dist/components/display/trend-card.js +27 -41
- package/dist/components/feedback/alert.cjs +1 -1
- package/dist/components/feedback/alert.d.ts +2 -1
- package/dist/components/feedback/alert.js +6 -6
- package/dist/components/feedback/loading-state.cjs +1 -1
- package/dist/components/feedback/loading-state.d.ts +3 -1
- package/dist/components/feedback/loading-state.js +23 -10
- package/dist/components/feedback/page-state.cjs +1 -1
- package/dist/components/feedback/page-state.d.ts +2 -1
- package/dist/components/feedback/page-state.js +7 -4
- package/dist/components/form/form-field-shell.cjs +1 -1
- package/dist/components/form/form-field-shell.d.ts +4 -2
- package/dist/components/form/form-field-shell.js +57 -41
- package/dist/components/form/form-input.cjs +1 -1
- package/dist/components/form/form-input.js +2 -0
- package/dist/components/form/form-select.cjs +1 -1
- package/dist/components/form/form-select.js +2 -0
- package/dist/components/form/form-switch.cjs +1 -1
- package/dist/components/form/form-switch.d.ts +1 -1
- package/dist/components/form/form-switch.js +58 -54
- package/dist/components/form/form-textarea.cjs +1 -1
- package/dist/components/form/form-textarea.d.ts +1 -1
- package/dist/components/form/form-textarea.js +29 -27
- package/dist/components/layout/app-sidebar.cjs +1 -1
- package/dist/components/layout/app-sidebar.d.ts +1 -0
- package/dist/components/layout/app-sidebar.js +36 -36
- package/dist/components/layout/breadcrumbs.cjs +1 -1
- package/dist/components/layout/breadcrumbs.d.ts +2 -1
- package/dist/components/layout/breadcrumbs.js +7 -7
- package/dist/components/modern/calendar-scheduler.cjs +1 -1
- package/dist/components/modern/calendar-scheduler.d.ts +5 -1
- package/dist/components/modern/calendar-scheduler.js +47 -28
- package/dist/components/modern/dual-list-picker.cjs +1 -1
- package/dist/components/modern/dual-list-picker.d.ts +5 -1
- package/dist/components/modern/dual-list-picker.js +81 -23
- package/dist/components/modern/rich-text-editor.cjs +1 -1
- package/dist/components/modern/rich-text-editor.d.ts +3 -1
- package/dist/components/modern/rich-text-editor.js +12 -9
- package/dist/components/modern/tour.cjs +1 -1
- package/dist/components/modern/tour.d.ts +5 -1
- package/dist/components/modern/tour.js +57 -35
- package/dist/components/navigation/command-bar.cjs +1 -1
- package/dist/components/navigation/command-bar.d.ts +3 -1
- package/dist/components/navigation/command-bar.js +10 -7
- package/dist/components/navigation/demo.cjs +1 -1
- package/dist/components/navigation/demo.js +0 -1
- package/dist/components/navigation/nav-tabs.cjs +1 -1
- package/dist/components/navigation/nav-tabs.js +39 -27
- package/dist/components/navigation/page-tabs.cjs +1 -1
- package/dist/components/navigation/page-tabs.js +41 -30
- package/dist/components/navigation/pagination.cjs +1 -1
- package/dist/components/navigation/pagination.d.ts +7 -1
- package/dist/components/navigation/pagination.js +48 -25
- package/dist/components/notifications/notification-center.cjs +1 -1
- package/dist/components/notifications/notification-center.d.ts +3 -1
- package/dist/components/notifications/notification-center.js +56 -38
- package/dist/components/notifications/toast.cjs +1 -1
- package/dist/components/notifications/toast.d.ts +1 -0
- package/dist/components/notifications/toast.js +4 -0
- package/dist/components/overlay/alert-dialog.cjs +1 -1
- package/dist/components/overlay/alert-dialog.js +1 -1
- package/dist/components/overlay/confirm-dialog.cjs +1 -1
- package/dist/components/overlay/confirm-dialog.d.ts +4 -2
- package/dist/components/overlay/confirm-dialog.js +31 -22
- package/dist/components/overlay/drawer.cjs +1 -1
- package/dist/components/overlay/drawer.d.ts +3 -1
- package/dist/components/overlay/drawer.js +24 -16
- package/dist/components/ui/accordion/index.d.ts +4 -0
- package/dist/components/ui/badge/index.cjs +1 -1
- package/dist/components/ui/badge/index.d.ts +1 -1
- package/dist/components/ui/badge/index.js +2 -1
- package/dist/components/ui/button/index.cjs +1 -1
- package/dist/components/ui/button/index.d.ts +2 -1
- package/dist/components/ui/button/index.js +13 -10
- package/dist/components/ui/dialog/index.cjs +1 -1
- package/dist/components/ui/dialog/index.js +2 -1
- package/dist/components/ui/hover-card.cjs +1 -1
- package/dist/components/ui/hover-card.d.ts +11 -3
- package/dist/components/ui/hover-card.js +29 -24
- package/dist/components/ui/input/index.d.ts +1 -1
- package/dist/components/ui/popover/index.cjs +1 -1
- package/dist/components/ui/popover/index.d.ts +2 -2
- package/dist/components/ui/popover/index.js +6 -5
- package/dist/components/ui/radio-group/index.cjs +1 -1
- package/dist/components/ui/radio-group/index.d.ts +5 -1
- package/dist/components/ui/radio-group/index.js +50 -16
- package/dist/components/ui/right-click-menu/index.cjs +1 -1
- package/dist/components/ui/right-click-menu/index.d.ts +5 -1
- package/dist/components/ui/right-click-menu/index.js +77 -23
- package/dist/components/ui/segmented-control/index.cjs +1 -1
- package/dist/components/ui/segmented-control/index.d.ts +2 -1
- package/dist/components/ui/segmented-control/index.js +23 -11
- package/dist/components/ui/select/index.cjs +1 -1
- package/dist/components/ui/select/index.d.ts +8 -1
- package/dist/components/ui/select/index.js +40 -35
- package/dist/components/ui/switch/index.cjs +1 -1
- package/dist/components/ui/switch/index.d.ts +18 -0
- package/dist/components/ui/switch/index.js +47 -17
- package/dist/components/ui/tabs/index.cjs +1 -1
- package/dist/components/ui/tabs/index.d.ts +14 -4
- package/dist/components/ui/tabs/index.js +11 -8
- package/dist/components/ui/textarea/index.cjs +1 -1
- package/dist/components/ui/textarea/index.d.ts +10 -2
- package/dist/components/ui/textarea/index.js +37 -8
- package/dist/components/ui/textarea.cjs +1 -0
- package/dist/components/ui/textarea.d.ts +1 -0
- package/dist/components/ui/textarea.js +2 -0
- package/dist/components/ui/tooltip/index.cjs +1 -1
- package/dist/components/ui/tooltip/index.d.ts +11 -3
- package/dist/components/ui/tooltip/index.js +41 -20
- package/dist/components/upload/file-upload.cjs +1 -1
- package/dist/components/upload/file-upload.d.ts +8 -1
- package/dist/components/upload/file-upload.js +132 -100
- package/dist/components/upload/image-upload.cjs +1 -1
- package/dist/components/upload/image-upload.d.ts +5 -1
- package/dist/components/upload/image-upload.js +34 -9
- package/dist/index.cjs +1 -1
- package/dist/index.js +31 -31
- package/dist/public-component-surface.cjs +1 -1
- package/dist/public-component-surface.js +15 -0
- package/dist/showcase/component-api-schema.cjs +1 -1
- package/dist/showcase/component-api-schema.js +187 -10
- package/dist/showcase/fallback.cjs +3 -3
- package/dist/showcase/fallback.js +221 -243
- package/dist/showcase/premium/alert/showcase.cjs +1 -1
- package/dist/showcase/premium/alert/showcase.js +1 -0
- package/dist/showcase/premium/app-sidebar/showcase.cjs +1 -1
- package/dist/showcase/premium/app-sidebar/showcase.js +1 -0
- package/dist/showcase/premium/badge/showcase.cjs +1 -1
- package/dist/showcase/premium/badge/showcase.js +7 -0
- package/dist/showcase/premium/badge/types.d.ts +1 -1
- package/dist/showcase/premium/breadcrumbs/showcase.cjs +1 -1
- package/dist/showcase/premium/breadcrumbs/showcase.js +12 -1
- package/dist/showcase/premium/button/mock.cjs +1 -4
- package/dist/showcase/premium/button/mock.js +1 -1
- package/dist/showcase/premium/button/showcase.cjs +1 -1
- package/dist/showcase/premium/button/showcase.js +2 -2
- package/dist/showcase/premium/card/showcase.cjs +1 -1
- package/dist/showcase/premium/card/showcase.js +96 -47
- package/dist/showcase/premium/carousel/showcase.cjs +1 -1
- package/dist/showcase/premium/carousel/showcase.js +76 -49
- package/dist/showcase/premium/command-bar/showcase.cjs +1 -1
- package/dist/showcase/premium/command-bar/showcase.js +2 -0
- package/dist/showcase/premium/data-table/mock.cjs +12 -11
- package/dist/showcase/premium/data-table/mock.js +1 -1
- package/dist/showcase/premium/file-upload/showcase.cjs +1 -1
- package/dist/showcase/premium/file-upload/showcase.js +25 -4
- package/dist/showcase/premium/image-upload/showcase.cjs +1 -1
- package/dist/showcase/premium/image-upload/showcase.js +4 -1
- package/dist/showcase/premium/index.cjs +1 -1
- package/dist/showcase/premium/index.js +396 -402
- package/dist/showcase/premium/loading-state/showcase.cjs +1 -1
- package/dist/showcase/premium/loading-state/showcase.js +3 -1
- package/dist/showcase/premium/metric-grid/showcase.cjs +1 -1
- package/dist/showcase/premium/metric-grid/showcase.js +96 -28
- package/dist/showcase/premium/notification-center/showcase.cjs +1 -1
- package/dist/showcase/premium/notification-center/showcase.js +7 -3
- package/dist/showcase/premium/page-state/showcase.cjs +1 -1
- package/dist/showcase/premium/page-state/showcase.js +5 -1
- package/dist/showcase/premium/pagination/showcase.cjs +1 -1
- package/dist/showcase/premium/pagination/showcase.js +15 -2
- package/dist/showcase/premium/popover/showcase.cjs +1 -1
- package/dist/showcase/premium/popover/showcase.js +85 -50
- package/dist/showcase/premium/radio-group/showcase.cjs +1 -1
- package/dist/showcase/premium/radio-group/showcase.js +27 -4
- package/dist/showcase/premium/right-click-menu/showcase.cjs +1 -1
- package/dist/showcase/premium/right-click-menu/showcase.js +56 -43
- package/dist/showcase/premium/segmented-control/showcase.cjs +1 -1
- package/dist/showcase/premium/segmented-control/showcase.js +1 -0
- package/dist/showcase/premium/select/data.cjs +1 -1
- package/dist/showcase/premium/select/data.js +69 -34
- package/dist/showcase/premium/select/mock.cjs +19 -6
- package/dist/showcase/premium/select/mock.js +3 -2
- package/dist/showcase/premium/select/showcase.cjs +1 -1
- package/dist/showcase/premium/select/showcase.js +43 -18
- package/dist/showcase/premium/select/types.d.ts +3 -0
- package/dist/showcase/premium/statistic/showcase.cjs +1 -1
- package/dist/showcase/premium/statistic/showcase.js +57 -25
- package/dist/showcase/premium/switch/showcase.cjs +1 -1
- package/dist/showcase/premium/switch/showcase.js +25 -14
- package/dist/showcase/premium/tabs/showcase.cjs +1 -1
- package/dist/showcase/premium/tabs/showcase.js +171 -48
- package/dist/showcase/premium/textarea/mock.cjs +12 -4
- package/dist/showcase/premium/textarea/mock.js +1 -1
- package/dist/showcase/premium/textarea/showcase.cjs +1 -1
- package/dist/showcase/premium/textarea/showcase.js +8 -3
- package/dist/showcase/premium/toast/showcase.cjs +1 -1
- package/dist/showcase/premium/toast/showcase.js +32 -6
- package/dist/showcase/premium/types.d.ts +1 -1
- package/dist/showcase/registry-quality.cjs +1 -1
- package/dist/showcase/registry-quality.js +1 -0
- package/dist/showcase/render-registry-preview.cjs +1 -1
- package/dist/showcase/render-registry-preview.js +57 -79
- package/dist/showcase/site-data.cjs +1 -1
- package/dist/showcase/site-data.js +60 -21
- package/dist/showcase/tembro-registry.json.cjs +1 -1
- package/dist/showcase/tembro-registry.json.js +34 -20
- package/dist/showcase/types.d.ts +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/index.cjs +31 -31
- package/packages/cli/vendor/src/components/calendar/calendar.tsx +59 -50
- package/packages/cli/vendor/src/components/calendar/date-range-picker.tsx +7 -4
- package/packages/cli/vendor/src/components/charts/charts.tsx +109 -66
- package/packages/cli/vendor/src/components/charts/progress-ring.tsx +37 -26
- package/packages/cli/vendor/src/components/data-table/data-table-column-visibility-menu.tsx +41 -22
- package/packages/cli/vendor/src/components/data-table/data-table-toolbar.tsx +8 -6
- package/packages/cli/vendor/src/components/display/carousel.tsx +84 -3
- package/packages/cli/vendor/src/components/display/code-block.tsx +22 -2
- package/packages/cli/vendor/src/components/display/delta-badge.tsx +11 -11
- package/packages/cli/vendor/src/components/display/kanban.tsx +103 -57
- package/packages/cli/vendor/src/components/display/metric-grid.tsx +16 -13
- package/packages/cli/vendor/src/components/display/qr-code.tsx +17 -15
- package/packages/cli/vendor/src/components/display/status-legend.tsx +11 -8
- package/packages/cli/vendor/src/components/display/tag.tsx +39 -21
- package/packages/cli/vendor/src/components/display/tree-view.tsx +221 -84
- package/packages/cli/vendor/src/components/display/trend-card.tsx +6 -40
- package/packages/cli/vendor/src/components/feedback/alert.tsx +3 -1
- package/packages/cli/vendor/src/components/feedback/loading-state.tsx +33 -17
- package/packages/cli/vendor/src/components/feedback/page-state.tsx +8 -7
- package/packages/cli/vendor/src/components/form/form-field-shell.tsx +37 -8
- package/packages/cli/vendor/src/components/form/form-input.tsx +2 -0
- package/packages/cli/vendor/src/components/form/form-select.tsx +2 -0
- package/packages/cli/vendor/src/components/form/form-switch.tsx +9 -3
- package/packages/cli/vendor/src/components/form/form-textarea.tsx +6 -2
- package/packages/cli/vendor/src/components/layout/app-sidebar.tsx +3 -1
- package/packages/cli/vendor/src/components/layout/breadcrumbs.tsx +3 -1
- package/packages/cli/vendor/src/components/modern/calendar-scheduler.tsx +28 -13
- package/packages/cli/vendor/src/components/modern/dual-list-picker.tsx +103 -35
- package/packages/cli/vendor/src/components/modern/rich-text-editor.tsx +25 -22
- package/packages/cli/vendor/src/components/modern/tour.tsx +47 -29
- package/packages/cli/vendor/src/components/navigation/command-bar.tsx +6 -0
- package/packages/cli/vendor/src/components/navigation/demo.tsx +0 -1
- package/packages/cli/vendor/src/components/navigation/nav-tabs.tsx +38 -29
- package/packages/cli/vendor/src/components/navigation/page-tabs.tsx +35 -23
- package/packages/cli/vendor/src/components/navigation/pagination.tsx +65 -31
- package/packages/cli/vendor/src/components/notifications/notification-center.tsx +64 -39
- package/packages/cli/vendor/src/components/notifications/toast.tsx +23 -21
- package/packages/cli/vendor/src/components/overlay/alert-dialog.tsx +1 -1
- package/packages/cli/vendor/src/components/overlay/confirm-dialog.tsx +45 -22
- package/packages/cli/vendor/src/components/overlay/drawer.tsx +18 -5
- package/packages/cli/vendor/src/components/ui/accordion/index.tsx +4 -0
- package/packages/cli/vendor/src/components/ui/badge/index.tsx +2 -1
- package/packages/cli/vendor/src/components/ui/button/index.tsx +11 -5
- package/packages/cli/vendor/src/components/ui/dialog/index.tsx +2 -1
- package/packages/cli/vendor/src/components/ui/hover-card.tsx +54 -28
- package/packages/cli/vendor/src/components/ui/popover/index.tsx +10 -8
- package/packages/cli/vendor/src/components/ui/radio-group/index.tsx +55 -6
- package/packages/cli/vendor/src/components/ui/right-click-menu/index.tsx +120 -9
- package/packages/cli/vendor/src/components/ui/segmented-control/index.tsx +29 -3
- package/packages/cli/vendor/src/components/ui/select/index.tsx +64 -31
- package/packages/cli/vendor/src/components/ui/switch/index.tsx +71 -6
- package/packages/cli/vendor/src/components/ui/tabs/index.tsx +22 -6
- package/packages/cli/vendor/src/components/ui/textarea/index.tsx +105 -15
- package/packages/cli/vendor/src/components/ui/textarea.tsx +2 -0
- package/packages/cli/vendor/src/components/ui/tooltip/index.tsx +67 -22
- package/packages/cli/vendor/src/components/upload/file-upload.tsx +120 -57
- package/packages/cli/vendor/src/components/upload/image-upload.tsx +71 -24
- package/packages/cli/vendor/src/public-component-surface.ts +3 -0
- package/packages/cli/vendor/src/showcase/component-api-schema.ts +79 -41
- package/packages/cli/vendor/src/showcase/fallback.tsx +4 -19
- package/packages/cli/vendor/src/showcase/premium/alert/showcase.tsx +1 -0
- package/packages/cli/vendor/src/showcase/premium/app-sidebar/showcase.tsx +1 -0
- package/packages/cli/vendor/src/showcase/premium/badge/showcase.tsx +4 -2
- package/packages/cli/vendor/src/showcase/premium/badge/types.ts +1 -1
- package/packages/cli/vendor/src/showcase/premium/breadcrumbs/showcase.tsx +3 -1
- package/packages/cli/vendor/src/showcase/premium/button/mock.ts +2 -5
- package/packages/cli/vendor/src/showcase/premium/button/showcase.tsx +2 -2
- package/packages/cli/vendor/src/showcase/premium/card/showcase.tsx +26 -1
- package/packages/cli/vendor/src/showcase/premium/carousel/showcase.tsx +19 -3
- package/packages/cli/vendor/src/showcase/premium/command-bar/showcase.tsx +1 -1
- package/packages/cli/vendor/src/showcase/premium/data-table/mock.ts +26 -25
- package/packages/cli/vendor/src/showcase/premium/file-upload/showcase.tsx +21 -1
- package/packages/cli/vendor/src/showcase/premium/image-upload/showcase.tsx +4 -1
- package/packages/cli/vendor/src/showcase/premium/index.ts +0 -2
- package/packages/cli/vendor/src/showcase/premium/loading-state/showcase.tsx +1 -1
- package/packages/cli/vendor/src/showcase/premium/metric-grid/showcase.tsx +36 -4
- package/packages/cli/vendor/src/showcase/premium/notification-center/showcase.tsx +4 -3
- package/packages/cli/vendor/src/showcase/premium/page-state/showcase.tsx +1 -0
- package/packages/cli/vendor/src/showcase/premium/pagination/showcase.tsx +13 -1
- package/packages/cli/vendor/src/showcase/premium/popover/showcase.tsx +27 -11
- package/packages/cli/vendor/src/showcase/premium/radio-group/showcase.tsx +13 -1
- package/packages/cli/vendor/src/showcase/premium/right-click-menu/showcase.tsx +8 -5
- package/packages/cli/vendor/src/showcase/premium/segmented-control/showcase.tsx +1 -0
- package/packages/cli/vendor/src/showcase/premium/select/data.ts +12 -3
- package/packages/cli/vendor/src/showcase/premium/select/mock.ts +4 -4
- package/packages/cli/vendor/src/showcase/premium/select/showcase.tsx +22 -1
- package/packages/cli/vendor/src/showcase/premium/select/types.ts +3 -0
- package/packages/cli/vendor/src/showcase/premium/statistic/showcase.tsx +10 -1
- package/packages/cli/vendor/src/showcase/premium/switch/showcase.tsx +15 -6
- package/packages/cli/vendor/src/showcase/premium/tabs/showcase.tsx +48 -1
- package/packages/cli/vendor/src/showcase/premium/textarea/mock.ts +12 -4
- package/packages/cli/vendor/src/showcase/premium/textarea/showcase.tsx +5 -0
- package/packages/cli/vendor/src/showcase/premium/toast/showcase.tsx +17 -1
- package/packages/cli/vendor/src/showcase/premium/types.ts +1 -1
- package/packages/cli/vendor/src/showcase/registry-quality.ts +3 -2
- package/packages/cli/vendor/src/showcase/render-registry-preview.tsx +0 -15
- package/packages/cli/vendor/src/showcase/site-data.tsx +21 -15
- package/packages/cli/vendor/src/showcase/tembro-registry.json +42 -20
- package/packages/cli/vendor/src/showcase/types.ts +1 -1
- package/registry.json +18 -6
|
@@ -1,62 +1,48 @@
|
|
|
1
1
|
import { cn as e } from "../../lib/utils.js";
|
|
2
2
|
import { Card as t, CardContent as n, CardHeader as r, CardTitle as i } from "../ui/card/index.js";
|
|
3
3
|
import { DeltaBadge as a } from "./delta-badge.js";
|
|
4
|
+
import { Sparkline as o } from "../charts/charts.js";
|
|
4
5
|
import "react";
|
|
5
|
-
import { jsx as
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/display/trend-card.tsx
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
if (!m || m.length < 2) return null;
|
|
10
|
-
let e = Math.min(...m), t = Math.max(...m) - e || 1, n = m.map((n, r) => `${r / (m.length - 1) * 100},${100 - (n - e) / t * 100}`).join(" "), r = d === "up" ? "var(--aui-success,var(--primary))" : d === "down" ? "var(--destructive)" : "var(--muted-foreground)";
|
|
11
|
-
return /* @__PURE__ */ o("div", {
|
|
12
|
-
className: "absolute bottom-0 left-0 right-0 h-12 overflow-hidden opacity-20 pointer-events-none",
|
|
13
|
-
children: /* @__PURE__ */ s("svg", {
|
|
14
|
-
viewBox: "0 0 100 100",
|
|
15
|
-
preserveAspectRatio: "none",
|
|
16
|
-
className: "w-full h-full stroke-2",
|
|
17
|
-
children: [/* @__PURE__ */ o("polyline", {
|
|
18
|
-
points: n,
|
|
19
|
-
fill: "none",
|
|
20
|
-
stroke: r,
|
|
21
|
-
vectorEffect: "non-scaling-stroke"
|
|
22
|
-
}), /* @__PURE__ */ o("polygon", {
|
|
23
|
-
points: `0,100 ${n} 100,100`,
|
|
24
|
-
fill: `color-mix(in srgb, ${r} 20%, transparent)`
|
|
25
|
-
})]
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
return /* @__PURE__ */ s(t, {
|
|
8
|
+
function l({ title: l, value: u, change: d, trend: f, description: p, icon: m, sparkline: h, className: g, ..._ }) {
|
|
9
|
+
return /* @__PURE__ */ c(t, {
|
|
30
10
|
"data-slot": "trend-card",
|
|
31
|
-
className: e("relative overflow-hidden",
|
|
32
|
-
...
|
|
11
|
+
className: e("relative overflow-hidden", g),
|
|
12
|
+
..._,
|
|
33
13
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ c(r, {
|
|
35
15
|
className: "flex flex-row items-center justify-between space-y-0 pb-2",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
16
|
+
children: [/* @__PURE__ */ s(i, {
|
|
37
17
|
className: "text-sm font-medium text-muted-foreground",
|
|
38
|
-
children:
|
|
39
|
-
}),
|
|
18
|
+
children: l
|
|
19
|
+
}), m && /* @__PURE__ */ s("div", {
|
|
40
20
|
className: "text-muted-foreground",
|
|
41
|
-
children:
|
|
21
|
+
children: m
|
|
42
22
|
})]
|
|
43
23
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ c(n, { children: [/* @__PURE__ */ c("div", {
|
|
45
25
|
className: "flex items-baseline gap-2",
|
|
46
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ s("div", {
|
|
47
27
|
className: "text-2xl font-bold",
|
|
48
|
-
children:
|
|
49
|
-
}),
|
|
50
|
-
value:
|
|
51
|
-
trend:
|
|
28
|
+
children: u
|
|
29
|
+
}), d && /* @__PURE__ */ s(a, {
|
|
30
|
+
value: d,
|
|
31
|
+
trend: f
|
|
52
32
|
})]
|
|
53
|
-
}),
|
|
33
|
+
}), p && /* @__PURE__ */ s("p", {
|
|
54
34
|
className: "mt-1 text-xs text-muted-foreground",
|
|
55
|
-
children:
|
|
35
|
+
children: p
|
|
56
36
|
})] }),
|
|
57
|
-
|
|
37
|
+
h && h.length > 1 ? /* @__PURE__ */ s("div", {
|
|
38
|
+
className: "px-6 pb-4",
|
|
39
|
+
children: /* @__PURE__ */ s(o, {
|
|
40
|
+
values: h,
|
|
41
|
+
positive: f !== "down"
|
|
42
|
+
})
|
|
43
|
+
}) : null
|
|
58
44
|
]
|
|
59
45
|
});
|
|
60
46
|
}
|
|
61
47
|
//#endregion
|
|
62
|
-
export {
|
|
48
|
+
export { l as TrendCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={info:{soft:`border-primary/25 bg-primary/5 text-foreground`,outline:`border-primary/35 bg-background text-foreground`,solid:`border-primary bg-primary text-primary-foreground`},success:{soft:`border-emerald-500/25 bg-emerald-500/10 text-foreground`,outline:`border-emerald-500/35 bg-background text-foreground`,solid:`border-emerald-600 bg-emerald-600 text-white`},warning:{soft:`border-amber-500/30 bg-amber-500/10 text-foreground`,outline:`border-amber-500/35 bg-background text-foreground`,solid:`border-amber-500 bg-amber-500 text-amber-950`},destructive:{soft:`border-destructive/30 bg-destructive/10 text-foreground`,outline:`border-destructive/35 bg-background text-foreground`,solid:`border-destructive bg-destructive text-destructive-foreground`},muted:{soft:`border-border bg-muted/50 text-foreground`,outline:`border-border bg-background text-foreground`,solid:`border-border bg-foreground text-background`}},o={info:`text-primary`,success:`text-emerald-600 dark:text-emerald-400`,warning:`text-amber-600 dark:text-amber-400`,destructive:`text-destructive`,muted:`text-muted-foreground`};function s(e){switch(e){case`success`:return(0,i.jsx)(r.CheckCircle2Icon,{className:`size-4`});case`warning`:return(0,i.jsx)(r.TriangleAlertIcon,{className:`size-4`});case`destructive`:return(0,i.jsx)(r.AlertCircleIcon,{className:`size-4`});default:return(0,i.jsx)(r.InfoIcon,{className:`size-4`})}}function c({tone:e=`info`,variant:n=`soft`,size:r=`md`,title:c,description:l,icon:u,action:d,dismissible:f=!1,dismissLabel:p=`Dismiss alert`,onDismiss:m,className:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={info:{soft:`border-primary/25 bg-primary/5 text-foreground`,outline:`border-primary/35 bg-background text-foreground`,solid:`border-primary bg-primary text-primary-foreground`},success:{soft:`border-emerald-500/25 bg-emerald-500/10 text-foreground`,outline:`border-emerald-500/35 bg-background text-foreground`,solid:`border-emerald-600 bg-emerald-600 text-white`},warning:{soft:`border-amber-500/30 bg-amber-500/10 text-foreground`,outline:`border-amber-500/35 bg-background text-foreground`,solid:`border-amber-500 bg-amber-500 text-amber-950`},destructive:{soft:`border-destructive/30 bg-destructive/10 text-foreground`,outline:`border-destructive/35 bg-background text-foreground`,solid:`border-destructive bg-destructive text-destructive-foreground`},muted:{soft:`border-border bg-muted/50 text-foreground`,outline:`border-border bg-background text-foreground`,solid:`border-border bg-foreground text-background`}},o={info:`text-primary`,success:`text-emerald-600 dark:text-emerald-400`,warning:`text-amber-600 dark:text-amber-400`,destructive:`text-destructive`,muted:`text-muted-foreground`};function s(e){switch(e){case`success`:return(0,i.jsx)(r.CheckCircle2Icon,{className:`size-4`});case`warning`:return(0,i.jsx)(r.TriangleAlertIcon,{className:`size-4`});case`destructive`:return(0,i.jsx)(r.AlertCircleIcon,{className:`size-4`});default:return(0,i.jsx)(r.InfoIcon,{className:`size-4`})}}function c({tone:e=`info`,variant:n=`soft`,size:r=`md`,title:c,description:l,icon:u,action:d,dismissible:f=!1,dismissLabel:p=`Dismiss alert`,onDismiss:m,actionsAlign:h=`end`,className:g,children:_,...v}){return(0,i.jsxs)(`div`,{"data-slot":`alert`,"data-size":r,role:e===`destructive`||e===`warning`?`alert`:`status`,className:t.cn(`flex gap-3 rounded-[var(--aui-card-radius,var(--radius-xl))] border p-4 text-sm shadow-[var(--aui-card-shadow,var(--aui-control-shadow,0_1px_0_rgba(255,255,255,0.05)))] data-[size=sm]:p-3`,a[e][n],g),...v,children:[(0,i.jsx)(`div`,{"data-slot":`alert-icon`,className:t.cn(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full border border-current/10 bg-background/55`,n===`solid`&&`bg-white/12 text-current`,o[e]),children:u??s(e)}),(0,i.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[c&&(0,i.jsx)(`div`,{"data-slot":`alert-title`,className:`font-medium leading-none`,children:c}),(l||_)&&(0,i.jsx)(`div`,{"data-slot":`alert-description`,className:t.cn(`text-muted-foreground`,n===`solid`&&`text-current/88`),children:l??_})]}),d||f?(0,i.jsxs)(`div`,{"data-slot":`alert-action`,className:t.cn(`flex shrink-0 items-start gap-2`,h===`start`&&`order-[-1] mr-2`),children:[d,f?(0,i.jsx)(`button`,{type:`button`,"aria-label":p,className:t.cn(`inline-flex size-8 items-center justify-center rounded-full border border-current/10 bg-background/45 text-current transition-opacity hover:opacity-90`,n===`solid`&&`bg-white/12`),onClick:m,children:(0,i.jsx)(`span`,{"aria-hidden":`true`,children:`×`})}):null]}):null]})}exports.Alert=c;
|
|
@@ -11,6 +11,7 @@ export type AlertProps = React.ComponentProps<"div"> & {
|
|
|
11
11
|
dismissible?: boolean;
|
|
12
12
|
dismissLabel?: string;
|
|
13
13
|
onDismiss?: () => void;
|
|
14
|
+
actionsAlign?: "start" | "end";
|
|
14
15
|
};
|
|
15
|
-
declare function Alert({ tone, variant, size, title, description, icon, action, dismissible, dismissLabel, onDismiss, className, children, ...props }: AlertProps): React.JSX.Element;
|
|
16
|
+
declare function Alert({ tone, variant, size, title, description, icon, action, dismissible, dismissLabel, onDismiss, actionsAlign, className, children, ...props }: AlertProps): React.JSX.Element;
|
|
16
17
|
export { Alert };
|
|
@@ -44,13 +44,13 @@ function l(e) {
|
|
|
44
44
|
default: return /* @__PURE__ */ a(r, { className: "size-4" });
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function u({ tone: t = "info", variant: n = "soft", size: r = "md", title: i, description: u, icon: d, action: f, dismissible: p = !1, dismissLabel: m = "Dismiss alert", onDismiss: h,
|
|
47
|
+
function u({ tone: t = "info", variant: n = "soft", size: r = "md", title: i, description: u, icon: d, action: f, dismissible: p = !1, dismissLabel: m = "Dismiss alert", onDismiss: h, actionsAlign: g = "end", className: _, children: v, ...y }) {
|
|
48
48
|
return /* @__PURE__ */ o("div", {
|
|
49
49
|
"data-slot": "alert",
|
|
50
50
|
"data-size": r,
|
|
51
51
|
role: t === "destructive" || t === "warning" ? "alert" : "status",
|
|
52
|
-
className: e("flex gap-3 rounded-[var(--aui-card-radius,var(--radius-xl))] border p-4 text-sm shadow-[var(--aui-card-shadow,var(--aui-control-shadow,0_1px_0_rgba(255,255,255,0.05)))] data-[size=sm]:p-3", s[t][n],
|
|
53
|
-
...
|
|
52
|
+
className: e("flex gap-3 rounded-[var(--aui-card-radius,var(--radius-xl))] border p-4 text-sm shadow-[var(--aui-card-shadow,var(--aui-control-shadow,0_1px_0_rgba(255,255,255,0.05)))] data-[size=sm]:p-3", s[t][n], _),
|
|
53
|
+
...y,
|
|
54
54
|
children: [
|
|
55
55
|
/* @__PURE__ */ a("div", {
|
|
56
56
|
"data-slot": "alert-icon",
|
|
@@ -63,15 +63,15 @@ function u({ tone: t = "info", variant: n = "soft", size: r = "md", title: i, de
|
|
|
63
63
|
"data-slot": "alert-title",
|
|
64
64
|
className: "font-medium leading-none",
|
|
65
65
|
children: i
|
|
66
|
-
}), (u ||
|
|
66
|
+
}), (u || v) && /* @__PURE__ */ a("div", {
|
|
67
67
|
"data-slot": "alert-description",
|
|
68
68
|
className: e("text-muted-foreground", n === "solid" && "text-current/88"),
|
|
69
|
-
children: u ??
|
|
69
|
+
children: u ?? v
|
|
70
70
|
})]
|
|
71
71
|
}),
|
|
72
72
|
f || p ? /* @__PURE__ */ o("div", {
|
|
73
73
|
"data-slot": "alert-action",
|
|
74
|
-
className: "flex shrink-0 items-start gap-2",
|
|
74
|
+
className: e("flex shrink-0 items-start gap-2", g === "start" && "order-[-1] mr-2"),
|
|
75
75
|
children: [f, p ? /* @__PURE__ */ a("button", {
|
|
76
76
|
type: "button",
|
|
77
77
|
"aria-label": m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");function a({className:e,label:n=`Loading...`,description:a,icon:o,...
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");function a({className:e,label:n=`Loading...`,description:a,icon:o,variant:s=`spinner`,progress:c,...l}){return(0,i.jsxs)(`div`,{"data-slot":`loading-state`,className:t.cn(`flex min-h-52 flex-col items-center justify-center gap-4 rounded-[var(--radius-3xl)] border border-border/75 bg-muted/25 p-10 text-center text-muted-foreground shadow-sm ring-1 ring-foreground/4`,e),...l,children:[s===`skeleton`?(0,i.jsxs)(`div`,{className:`grid gap-3`,children:[(0,i.jsx)(`div`,{className:`h-4 w-32 animate-pulse rounded bg-muted`}),(0,i.jsx)(`div`,{className:`h-24 w-64 animate-pulse rounded-[min(var(--radius-xl),16px)] bg-muted/70`})]}):(0,i.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border border-border/70 bg-background/92 shadow-[0_1px_0_rgba(255,255,255,0.08)]`,children:o??(0,i.jsx)(r.Loader2Icon,{className:`size-5 animate-spin`})}),(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[n&&(0,i.jsx)(`div`,{className:`text-base font-semibold tracking-tight text-foreground`,children:n}),a&&(0,i.jsx)(`p`,{className:`max-w-sm text-sm leading-6`,children:a}),s===`progress`&&typeof c==`number`?(0,i.jsx)(`div`,{className:`mx-auto mt-2 h-2 w-full max-w-xs overflow-hidden rounded-full bg-muted/80`,children:(0,i.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${Math.min(Math.max(c,0),100)}%`}})}):null]})]})}exports.LoadingState=a;
|
|
@@ -3,6 +3,8 @@ export type LoadingStateProps = React.ComponentProps<"div"> & {
|
|
|
3
3
|
label?: React.ReactNode;
|
|
4
4
|
description?: React.ReactNode;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
|
+
variant?: "spinner" | "skeleton" | "progress";
|
|
7
|
+
progress?: number;
|
|
6
8
|
};
|
|
7
|
-
declare function LoadingState({ className, label, description, icon, ...props }: LoadingStateProps): React.JSX.Element;
|
|
9
|
+
declare function LoadingState({ className, label, description, icon, variant, progress, ...props }: LoadingStateProps): React.JSX.Element;
|
|
8
10
|
export { LoadingState };
|
|
@@ -3,23 +3,36 @@ import "react";
|
|
|
3
3
|
import { Loader2Icon as t } from "lucide-react";
|
|
4
4
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/feedback/loading-state.tsx
|
|
6
|
-
function i({ className: i, label: a = "Loading...", description: o, icon: s,
|
|
6
|
+
function i({ className: i, label: a = "Loading...", description: o, icon: s, variant: c = "spinner", progress: l, ...u }) {
|
|
7
7
|
return /* @__PURE__ */ r("div", {
|
|
8
8
|
"data-slot": "loading-state",
|
|
9
9
|
className: e("flex min-h-52 flex-col items-center justify-center gap-4 rounded-[var(--radius-3xl)] border border-border/75 bg-muted/25 p-10 text-center text-muted-foreground shadow-sm ring-1 ring-foreground/4", i),
|
|
10
|
-
...
|
|
11
|
-
children: [/* @__PURE__ */
|
|
10
|
+
...u,
|
|
11
|
+
children: [c === "skeleton" ? /* @__PURE__ */ r("div", {
|
|
12
|
+
className: "grid gap-3",
|
|
13
|
+
children: [/* @__PURE__ */ n("div", { className: "h-4 w-32 animate-pulse rounded bg-muted" }), /* @__PURE__ */ n("div", { className: "h-24 w-64 animate-pulse rounded-[min(var(--radius-xl),16px)] bg-muted/70" })]
|
|
14
|
+
}) : /* @__PURE__ */ n("div", {
|
|
12
15
|
className: "flex size-12 items-center justify-center rounded-full border border-border/70 bg-background/92 shadow-[0_1px_0_rgba(255,255,255,0.08)]",
|
|
13
16
|
children: s ?? /* @__PURE__ */ n(t, { className: "size-5 animate-spin" })
|
|
14
17
|
}), /* @__PURE__ */ r("div", {
|
|
15
18
|
className: "grid gap-1.5",
|
|
16
|
-
children: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
children: [
|
|
20
|
+
a && /* @__PURE__ */ n("div", {
|
|
21
|
+
className: "text-base font-semibold tracking-tight text-foreground",
|
|
22
|
+
children: a
|
|
23
|
+
}),
|
|
24
|
+
o && /* @__PURE__ */ n("p", {
|
|
25
|
+
className: "max-w-sm text-sm leading-6",
|
|
26
|
+
children: o
|
|
27
|
+
}),
|
|
28
|
+
c === "progress" && typeof l == "number" ? /* @__PURE__ */ n("div", {
|
|
29
|
+
className: "mx-auto mt-2 h-2 w-full max-w-xs overflow-hidden rounded-full bg-muted/80",
|
|
30
|
+
children: /* @__PURE__ */ n("div", {
|
|
31
|
+
className: "h-full rounded-full bg-primary",
|
|
32
|
+
style: { width: `${Math.min(Math.max(l, 0), 100)}%` }
|
|
33
|
+
})
|
|
34
|
+
}) : null
|
|
35
|
+
]
|
|
23
36
|
})]
|
|
24
37
|
});
|
|
25
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("lucide-react"),a=require("react/jsx-runtime");function o(e){switch(e){case`loading`:return(0,a.jsx)(i.Loader2Icon,{className:`size-8 animate-spin`});case`error`:return(0,a.jsx)(i.AlertCircleIcon,{className:`size-8`});case`success`:return(0,a.jsx)(i.CheckCircle2Icon,{className:`size-8`});case`info`:return(0,a.jsx)(i.InfoIcon,{className:`size-8`});default:return(0,a.jsx)(i.SearchXIcon,{className:`size-8`})}}function s({tone:e=`empty`,title:n,description:r,icon:i,action:s,compact:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/button/index.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("lucide-react"),a=require("react/jsx-runtime");function o(e){switch(e){case`loading`:return(0,a.jsx)(i.Loader2Icon,{className:`size-8 animate-spin`});case`error`:return(0,a.jsx)(i.AlertCircleIcon,{className:`size-8`});case`success`:return(0,a.jsx)(i.CheckCircle2Icon,{className:`size-8`});case`info`:return(0,a.jsx)(i.InfoIcon,{className:`size-8`});default:return(0,a.jsx)(i.SearchXIcon,{className:`size-8`})}}function s({tone:e=`empty`,title:n,description:r,icon:i,action:s,extra:c,compact:l=!1,className:u,...d}){return(0,a.jsxs)(`div`,{"data-slot":`page-state`,role:e===`error`?`alert`:`status`,className:t.cn(`flex flex-col items-center justify-center rounded-[var(--radius-3xl)] border border-border/75 bg-card/96 text-center shadow-sm ring-1 ring-foreground/4`,l?`gap-2 p-6`:`min-h-72 gap-4 p-10`,u),...d,children:[(0,a.jsx)(`div`,{className:`flex size-14 items-center justify-center rounded-full border border-border/70 bg-muted/45 text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.05)]`,children:i??o(e)}),(0,a.jsxs)(`div`,{className:`grid gap-1`,children:[n&&(0,a.jsx)(`div`,{className:`text-base font-semibold tracking-tight text-foreground`,children:n}),r&&(0,a.jsx)(`div`,{className:`max-w-md text-sm leading-6 text-muted-foreground`,children:r})]}),s||c?(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[s,c]}):null]})}function c({retryLabel:e=`Retry`,onRetry:r,action:i,className:o,...c}){return(0,a.jsx)(s,{compact:!0,className:t.cn(`min-h-0`,o),action:i??(r?(0,a.jsx)(n.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:e}):void 0),...c})}exports.InlineState=c,exports.PageState=s;
|
|
@@ -6,9 +6,10 @@ export type PageStateProps = Omit<React.ComponentProps<"div">, "title"> & {
|
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
icon?: React.ReactNode;
|
|
8
8
|
action?: React.ReactNode;
|
|
9
|
+
extra?: React.ReactNode;
|
|
9
10
|
compact?: boolean;
|
|
10
11
|
};
|
|
11
|
-
declare function PageState({ tone, title, description, icon, action, compact, className, ...props }: PageStateProps): React.JSX.Element;
|
|
12
|
+
declare function PageState({ tone, title, description, icon, action, extra, compact, className, ...props }: PageStateProps): React.JSX.Element;
|
|
12
13
|
export type InlineStateProps = Omit<PageStateProps, "compact"> & {
|
|
13
14
|
retryLabel?: React.ReactNode;
|
|
14
15
|
onRetry?: () => void;
|
|
@@ -13,12 +13,12 @@ function l(e) {
|
|
|
13
13
|
default: return /* @__PURE__ */ s(o, { className: "size-8" });
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function u({ tone: t = "empty", title: n, description: r, icon: i, action: a,
|
|
16
|
+
function u({ tone: t = "empty", title: n, description: r, icon: i, action: a, extra: o, compact: u = !1, className: d, ...f }) {
|
|
17
17
|
return /* @__PURE__ */ c("div", {
|
|
18
18
|
"data-slot": "page-state",
|
|
19
19
|
role: t === "error" ? "alert" : "status",
|
|
20
|
-
className: e("flex flex-col items-center justify-center rounded-[var(--radius-3xl)] border border-border/75 bg-card/96 text-center shadow-sm ring-1 ring-foreground/4",
|
|
21
|
-
...
|
|
20
|
+
className: e("flex flex-col items-center justify-center rounded-[var(--radius-3xl)] border border-border/75 bg-card/96 text-center shadow-sm ring-1 ring-foreground/4", u ? "gap-2 p-6" : "min-h-72 gap-4 p-10", d),
|
|
21
|
+
...f,
|
|
22
22
|
children: [
|
|
23
23
|
/* @__PURE__ */ s("div", {
|
|
24
24
|
className: "flex size-14 items-center justify-center rounded-full border border-border/70 bg-muted/45 text-muted-foreground shadow-[0_1px_0_rgba(255,255,255,0.05)]",
|
|
@@ -34,7 +34,10 @@ function u({ tone: t = "empty", title: n, description: r, icon: i, action: a, co
|
|
|
34
34
|
children: r
|
|
35
35
|
})]
|
|
36
36
|
}),
|
|
37
|
-
a
|
|
37
|
+
a || o ? /* @__PURE__ */ c("div", {
|
|
38
|
+
className: "flex flex-wrap items-center justify-center gap-2",
|
|
39
|
+
children: [a, o]
|
|
40
|
+
}) : null
|
|
38
41
|
]
|
|
39
42
|
});
|
|
40
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");function a(e,t={}){let n=`${e}-label`,r=`${e}-description`,i=`${e}-error`;return{labelId:n,descriptionId:r,errorId:i,describedBy:[t.description?r:null,t.error?i:null].filter(Boolean).join(` `)||void 0}}var o={vertical:`grid gap-2`,horizontal:`grid gap-2 sm:grid-cols-[minmax(0,12rem)_1fr] sm:items-start sm:gap-5`,inline:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4`};function s({className:e,label:n,description:a,error:s,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("lucide-react"),i=require("react/jsx-runtime");function a(e,t={}){let n=`${e}-label`,r=`${e}-description`,i=`${e}-error`;return{labelId:n,descriptionId:r,errorId:i,describedBy:[t.description?r:null,t.error?i:null].filter(Boolean).join(` `)||void 0}}var o={vertical:`grid gap-2`,horizontal:`grid gap-2 sm:grid-cols-[minmax(0,12rem)_1fr] sm:items-start sm:gap-5`,inline:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4`};function s({className:e,label:n,description:a,error:s,success:c,loading:l=!1,required:u=!1,htmlFor:d,labelId:f,descriptionId:p,errorId:m,layout:h=`vertical`,descriptionPosition:g=`top`,labelAction:_,requiredIndicator:v=(0,i.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`}),errorIcon:y,showErrorIcon:b=!0,disabled:x=!1,readOnly:S=!1,labelClassName:C,labelRowClassName:w,descriptionClassName:T,errorClassName:E,contentClassName:D,children:O,...k}){let A=!!(n||_),j=a&&g===`top`,M=a&&g===`bottom`,N=y??(0,i.jsx)(r.AlertCircleIcon,{className:`size-3.5`}),P=A?(0,i.jsxs)(`div`,{"data-slot":`form-field-label-row`,className:t.cn(`flex min-w-0 items-center justify-between gap-3`,h===`inline`&&`sm:w-auto`,w),children:[n?(0,i.jsxs)(`label`,{"data-slot":`form-field-label`,htmlFor:d,id:f,className:t.cn(`min-w-0 text-sm font-semibold leading-none tracking-tight text-foreground`,x&&`cursor-not-allowed opacity-60`,S&&`opacity-80`,C),children:[n,u&&v]}):(0,i.jsx)(`span`,{}),_&&(0,i.jsx)(`div`,{"data-slot":`form-field-label-action`,className:`shrink-0 text-sm`,children:_})]}):null,F=a?(0,i.jsx)(`p`,{"data-slot":`form-field-description`,id:p,className:t.cn(`text-sm leading-6 text-muted-foreground`,x&&`opacity-60`,T),children:a}):null,I=(0,i.jsx)(`div`,{"data-slot":`form-field-content`,className:t.cn(`min-w-0 space-y-2`,D),children:O}),L=s?(0,i.jsxs)(`p`,{"data-slot":`form-field-error`,id:m,role:`alert`,"aria-live":`polite`,className:t.cn(`flex items-start gap-2 rounded-[min(var(--radius-xl),16px)] border border-destructive/18 bg-destructive/8 px-3 py-2 text-sm font-medium leading-6 text-destructive`,E),children:[b&&(0,i.jsx)(`span`,{className:`mt-1 shrink-0`,children:N}),(0,i.jsx)(`span`,{className:`min-w-0`,children:s})]}):null,R=c&&!s?(0,i.jsx)(`p`,{"data-slot":`form-field-success`,className:`rounded-[min(var(--radius-xl),16px)] border border-emerald-500/18 bg-emerald-500/8 px-3 py-2 text-sm font-medium leading-6 text-emerald-700 dark:text-emerald-300`,children:c}):null,z=l?(0,i.jsx)(`p`,{"data-slot":`form-field-loading`,className:`text-sm leading-6 text-muted-foreground`,children:`Loading...`}):null;return(0,i.jsx)(`div`,{"data-slot":`form-field-shell`,"data-layout":h,"data-invalid":!!s||void 0,"data-success":!!(c&&!s)||void 0,"data-loading":l||void 0,"data-disabled":x||void 0,"data-readonly":S||void 0,"aria-disabled":x||void 0,className:t.cn(o[h],`rounded-[var(--radius-2xl)]`,e),...k,children:h===`horizontal`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`grid gap-2 sm:pt-2.5`,children:[P,j&&F]}),(0,i.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[I,z,M&&F,R,L]})]}):h===`inline`?(0,i.jsxs)(i.Fragment,{children:[P,(0,i.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-2`,children:[j&&F,I,z,M&&F,R,L]})]}):(0,i.jsxs)(i.Fragment,{children:[P,j&&F,I,z,M&&F,R,L]})})}exports.FormFieldShell=s,exports.resolveFormFieldIds=a;
|
|
@@ -5,6 +5,8 @@ export type FormFieldShellProps = React.ComponentProps<"div"> & {
|
|
|
5
5
|
label?: React.ReactNode;
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
error?: React.ReactNode;
|
|
8
|
+
success?: React.ReactNode;
|
|
9
|
+
loading?: boolean;
|
|
8
10
|
required?: boolean;
|
|
9
11
|
htmlFor?: string;
|
|
10
12
|
labelId?: string;
|
|
@@ -24,7 +26,7 @@ export type FormFieldShellProps = React.ComponentProps<"div"> & {
|
|
|
24
26
|
errorClassName?: string;
|
|
25
27
|
contentClassName?: string;
|
|
26
28
|
};
|
|
27
|
-
export type FormFieldShellControlProps = Pick<FormFieldShellProps, "label" | "description" | "required" | "className" | "htmlFor" | "labelId" | "descriptionId" | "errorId" | "layout" | "descriptionPosition" | "labelAction" | "requiredIndicator" | "errorIcon" | "showErrorIcon" | "disabled" | "readOnly" | "labelClassName" | "labelRowClassName" | "descriptionClassName" | "errorClassName" | "contentClassName">;
|
|
29
|
+
export type FormFieldShellControlProps = Pick<FormFieldShellProps, "label" | "description" | "success" | "loading" | "required" | "className" | "htmlFor" | "labelId" | "descriptionId" | "errorId" | "layout" | "descriptionPosition" | "labelAction" | "requiredIndicator" | "errorIcon" | "showErrorIcon" | "disabled" | "readOnly" | "labelClassName" | "labelRowClassName" | "descriptionClassName" | "errorClassName" | "contentClassName">;
|
|
28
30
|
export type FormFieldMessageState = {
|
|
29
31
|
description?: React.ReactNode;
|
|
30
32
|
error?: React.ReactNode;
|
|
@@ -36,5 +38,5 @@ export type FormFieldResolvedIds = {
|
|
|
36
38
|
describedBy?: string;
|
|
37
39
|
};
|
|
38
40
|
declare function resolveFormFieldIds(id: string, state?: FormFieldMessageState): FormFieldResolvedIds;
|
|
39
|
-
declare function FormFieldShell({ className, label, description, error, required, htmlFor, labelId, descriptionId, errorId, layout, descriptionPosition, labelAction, requiredIndicator, errorIcon, showErrorIcon, disabled, readOnly, labelClassName, labelRowClassName, descriptionClassName, errorClassName, contentClassName, children, ...props }: FormFieldShellProps): React.JSX.Element;
|
|
41
|
+
declare function FormFieldShell({ className, label, description, error, success, loading, required, htmlFor, labelId, descriptionId, errorId, layout, descriptionPosition, labelAction, requiredIndicator, errorIcon, showErrorIcon, disabled, readOnly, labelClassName, labelRowClassName, descriptionClassName, errorClassName, contentClassName, children, ...props }: FormFieldShellProps): React.JSX.Element;
|
|
40
42
|
export { FormFieldShell, resolveFormFieldIds };
|
|
@@ -17,80 +17,96 @@ var o = {
|
|
|
17
17
|
horizontal: "grid gap-2 sm:grid-cols-[minmax(0,12rem)_1fr] sm:items-start sm:gap-5",
|
|
18
18
|
inline: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-4"
|
|
19
19
|
};
|
|
20
|
-
function s({ className: a, label: s, description: c, error: l,
|
|
20
|
+
function s({ className: a, label: s, description: c, error: l, success: u, loading: d = !1, required: f = !1, htmlFor: p, labelId: m, descriptionId: h, errorId: g, layout: _ = "vertical", descriptionPosition: v = "top", labelAction: y, requiredIndicator: b = /* @__PURE__ */ r("span", {
|
|
21
21
|
className: "ml-1 text-destructive",
|
|
22
22
|
children: "*"
|
|
23
|
-
}), errorIcon:
|
|
24
|
-
let
|
|
23
|
+
}), errorIcon: x, showErrorIcon: S = !0, disabled: C = !1, readOnly: w = !1, labelClassName: T, labelRowClassName: E, descriptionClassName: D, errorClassName: O, contentClassName: k, children: A, ...j }) {
|
|
24
|
+
let M = !!(s || y), N = c && v === "top", P = c && v === "bottom", F = x ?? /* @__PURE__ */ r(t, { className: "size-3.5" }), I = M ? /* @__PURE__ */ i("div", {
|
|
25
25
|
"data-slot": "form-field-label-row",
|
|
26
|
-
className: e("flex min-w-0 items-center justify-between gap-3",
|
|
26
|
+
className: e("flex min-w-0 items-center justify-between gap-3", _ === "inline" && "sm:w-auto", E),
|
|
27
27
|
children: [s ? /* @__PURE__ */ i("label", {
|
|
28
28
|
"data-slot": "form-field-label",
|
|
29
|
-
htmlFor:
|
|
30
|
-
id:
|
|
31
|
-
className: e("min-w-0 text-sm font-semibold leading-none tracking-tight text-foreground",
|
|
32
|
-
children: [s,
|
|
33
|
-
}) : /* @__PURE__ */ r("span", {}),
|
|
29
|
+
htmlFor: p,
|
|
30
|
+
id: m,
|
|
31
|
+
className: e("min-w-0 text-sm font-semibold leading-none tracking-tight text-foreground", C && "cursor-not-allowed opacity-60", w && "opacity-80", T),
|
|
32
|
+
children: [s, f && b]
|
|
33
|
+
}) : /* @__PURE__ */ r("span", {}), y && /* @__PURE__ */ r("div", {
|
|
34
34
|
"data-slot": "form-field-label-action",
|
|
35
35
|
className: "shrink-0 text-sm",
|
|
36
|
-
children:
|
|
36
|
+
children: y
|
|
37
37
|
})]
|
|
38
|
-
}) : null,
|
|
38
|
+
}) : null, L = c ? /* @__PURE__ */ r("p", {
|
|
39
39
|
"data-slot": "form-field-description",
|
|
40
|
-
id:
|
|
41
|
-
className: e("text-sm leading-6 text-muted-foreground",
|
|
40
|
+
id: h,
|
|
41
|
+
className: e("text-sm leading-6 text-muted-foreground", C && "opacity-60", D),
|
|
42
42
|
children: c
|
|
43
|
-
}) : null,
|
|
43
|
+
}) : null, R = /* @__PURE__ */ r("div", {
|
|
44
44
|
"data-slot": "form-field-content",
|
|
45
|
-
className: e("min-w-0 space-y-2",
|
|
46
|
-
children:
|
|
47
|
-
}),
|
|
45
|
+
className: e("min-w-0 space-y-2", k),
|
|
46
|
+
children: A
|
|
47
|
+
}), z = l ? /* @__PURE__ */ i("p", {
|
|
48
48
|
"data-slot": "form-field-error",
|
|
49
|
-
id:
|
|
49
|
+
id: g,
|
|
50
50
|
role: "alert",
|
|
51
51
|
"aria-live": "polite",
|
|
52
|
-
className: e("flex items-start gap-2 rounded-[min(var(--radius-xl),16px)] border border-destructive/18 bg-destructive/8 px-3 py-2 text-sm font-medium leading-6 text-destructive",
|
|
53
|
-
children: [
|
|
52
|
+
className: e("flex items-start gap-2 rounded-[min(var(--radius-xl),16px)] border border-destructive/18 bg-destructive/8 px-3 py-2 text-sm font-medium leading-6 text-destructive", O),
|
|
53
|
+
children: [S && /* @__PURE__ */ r("span", {
|
|
54
54
|
className: "mt-1 shrink-0",
|
|
55
|
-
children:
|
|
55
|
+
children: F
|
|
56
56
|
}), /* @__PURE__ */ r("span", {
|
|
57
57
|
className: "min-w-0",
|
|
58
58
|
children: l
|
|
59
59
|
})]
|
|
60
|
+
}) : null, B = u && !l ? /* @__PURE__ */ r("p", {
|
|
61
|
+
"data-slot": "form-field-success",
|
|
62
|
+
className: "rounded-[min(var(--radius-xl),16px)] border border-emerald-500/18 bg-emerald-500/8 px-3 py-2 text-sm font-medium leading-6 text-emerald-700 dark:text-emerald-300",
|
|
63
|
+
children: u
|
|
64
|
+
}) : null, V = d ? /* @__PURE__ */ r("p", {
|
|
65
|
+
"data-slot": "form-field-loading",
|
|
66
|
+
className: "text-sm leading-6 text-muted-foreground",
|
|
67
|
+
children: "Loading..."
|
|
60
68
|
}) : null;
|
|
61
69
|
return /* @__PURE__ */ r("div", {
|
|
62
70
|
"data-slot": "form-field-shell",
|
|
63
|
-
"data-layout":
|
|
71
|
+
"data-layout": _,
|
|
64
72
|
"data-invalid": !!l || void 0,
|
|
65
|
-
"data-
|
|
66
|
-
"data-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
"data-success": !!(u && !l) || void 0,
|
|
74
|
+
"data-loading": d || void 0,
|
|
75
|
+
"data-disabled": C || void 0,
|
|
76
|
+
"data-readonly": w || void 0,
|
|
77
|
+
"aria-disabled": C || void 0,
|
|
78
|
+
className: e(o[_], "rounded-[var(--radius-2xl)]", a),
|
|
79
|
+
...j,
|
|
80
|
+
children: _ === "horizontal" ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i("div", {
|
|
71
81
|
className: "grid gap-2 sm:pt-2.5",
|
|
72
|
-
children: [
|
|
82
|
+
children: [I, N && L]
|
|
73
83
|
}), /* @__PURE__ */ i("div", {
|
|
74
84
|
className: "grid min-w-0 gap-2",
|
|
75
85
|
children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
L
|
|
86
|
+
R,
|
|
87
|
+
V,
|
|
88
|
+
P && L,
|
|
89
|
+
B,
|
|
90
|
+
z
|
|
79
91
|
]
|
|
80
|
-
})] }) :
|
|
92
|
+
})] }) : _ === "inline" ? /* @__PURE__ */ i(n, { children: [I, /* @__PURE__ */ i("div", {
|
|
81
93
|
className: "grid min-w-0 flex-1 gap-2",
|
|
82
94
|
children: [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
L
|
|
95
|
+
N && L,
|
|
96
|
+
R,
|
|
97
|
+
V,
|
|
98
|
+
P && L,
|
|
99
|
+
B,
|
|
100
|
+
z
|
|
87
101
|
]
|
|
88
102
|
})] }) : /* @__PURE__ */ i(n, { children: [
|
|
89
|
-
P,
|
|
90
|
-
j && F,
|
|
91
103
|
I,
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
N && L,
|
|
105
|
+
R,
|
|
106
|
+
V,
|
|
107
|
+
P && L,
|
|
108
|
+
B,
|
|
109
|
+
z
|
|
94
110
|
] })
|
|
95
111
|
});
|
|
96
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../inputs/date-input.cjs"),n=require("../inputs/date-range-input.cjs"),r=require("../inputs/money-input.cjs"),i=require("../inputs/masked-input.cjs"),a=require("../inputs/number-input.cjs"),o=require("../inputs/phone-input.cjs"),s=require("../inputs/quantity-input.cjs"),c=require("../ui/input/index.cjs"),l=require("./form-field-shell.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("react/jsx-runtime"),f=require("react-hook-form");function p(e){return{label:e.label,description:e.description,required:e.required,className:e.className,htmlFor:e.id??e.name,layout:e.layout,descriptionPosition:e.descriptionPosition,labelAction:e.labelAction,requiredIndicator:e.requiredIndicator,errorIcon:e.errorIcon,showErrorIcon:e.showErrorIcon,disabled:e.disabled,readOnly:e.readOnly,labelClassName:e.labelClassName,labelRowClassName:e.labelRowClassName,descriptionClassName:e.descriptionClassName,errorClassName:e.errorClassName,contentClassName:e.contentClassName}}function m(e){let u=e.id??e.name,m=p(e),h=e.kind??`text`,g=e.fieldClassName??`w-full`;return(0,d.jsx)(f.Controller,{control:e.control,name:e.name,rules:e.rules,render:({field:f,fieldState:p})=>{let _=p.error?.message,v=l.resolveFormFieldIds(u,{description:e.description,error:_});if(h===`search`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,onValueChange:N,onBlur:P,...F}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...F,type:`search`,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,inputClassName:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),P?.(e)},onValueChange:e=>{f.onChange(e),N?.(e)}})})}if(h===`password`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,onValueChange:N,onBlur:P,...F}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...F,type:`password`,id:j??u,ref:f.ref,name:f.name,value:f.value??``,disabled:C,readOnly:e.readOnly,inputClassName:A??g,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),P?.(e)},onChange:e=>{let t=e.currentTarget.value;f.onChange(t),N?.(t)},"aria-invalid":p.invalid||void 0})})}if(h===`number`){let{control:t,name:n,label:r,description:i,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onNumberChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(a.NumberInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onNumberChange:e=>{f.onChange(e??N),P?.(e)}})})}if(h===`phone`){let{control:t,name:n,label:r,description:i,required:a,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,valueMode:N=`raw`,countryCode:P=`+998`,maxDigits:F=12,onValueChange:I,onBlur:L,...R}=e,z=f.value==null?``:String(f.value),B=N===`raw`?o.formatPhoneDigits(z,P,F):z;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(o.PhoneInput,{...R,id:j??u,name:f.name,ref:f.ref,value:B,disabled:C,readOnly:e.readOnly,countryCode:P,maxDigits:F,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),L?.(e)},onValueChange:(e,t)=>{let n=N===`raw`?t:e;f.onChange(n),I?.(n,t,e)}})})}if(h===`date`){let{control:n,name:r,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=``,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(t.DateInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e||N),P?.(e)}})})}if(h===`clearable`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=``,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...I,clearable:!0,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e||N),P?.(e)}})})}if(h===`masked`){let{control:t,name:n,label:r,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,valueMode:N=`raw`,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(i.MaskedInput,{...I,id:j??u,name:f.name,ref:f.ref,value:String(f.value??``),disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:(e,t)=>{let n=N===`raw`?t:e;f.onChange(n),P?.(e,t)}})})}if(h===`money`){let{control:t,name:n,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(r.MoneyInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??null,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:(e,t)=>{f.onChange(e??N),P?.(e,t)}})})}if(h===`quantity`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(s.QuantityInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e??N),P?.(e)}})})}if(h===`date-range`){let{control:t,name:r,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:g,requiredIndicator:y,errorIcon:b,showErrorIcon:x,disabled:S,labelClassName:C,labelRowClassName:w,descriptionClassName:T,errorClassName:E,contentClassName:D,fieldClassName:O,id:k,kind:A,onValueChange:j,onBlur:M,...N}=e,P=f.value;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:k??u,children:(0,d.jsx)(n.DateRangeInput,{...N,id:k??u,value:P&&typeof P==`object`?{from:P.from,to:P.to}:{from:``,to:``},fromInputProps:{...N.fromInputProps??{},disabled:S,readOnly:e.readOnly,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0},toInputProps:{...N.toInputProps??{},disabled:S,readOnly:e.readOnly,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0},onValueChange:e=>{f.onChange(e),j?.(e)},"aria-invalid":p.invalid||void 0,onBlur:e=>{f.onBlur(),M?.(e)}})})}let{control:y,name:b,label:x,description:S,required:C,className:w,layout:T,descriptionPosition:E,labelAction:D,requiredIndicator:O,errorIcon:k,showErrorIcon:A,disabled:j,readOnly:M,labelClassName:N,labelRowClassName:P,descriptionClassName:F,errorClassName:I,contentClassName:L,fieldClassName:R,transformIn:z,transformOut:B,id:V,kind:H,onChange:U,onBlur:W,...G}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:V??u,children:(0,d.jsx)(c.Input,{...G,id:V??u,ref:f.ref,name:f.name,value:z?z(f.value):f.value??``,disabled:j,readOnly:M,onBlur:e=>{f.onBlur(),W?.(e)},onChange:e=>{f.onChange(B?B(e):e.target.value),U?.(e)},"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,className:R??g})})}})}exports.FormInput=m;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../inputs/date-input.cjs"),n=require("../inputs/date-range-input.cjs"),r=require("../inputs/money-input.cjs"),i=require("../inputs/masked-input.cjs"),a=require("../inputs/number-input.cjs"),o=require("../inputs/phone-input.cjs"),s=require("../inputs/quantity-input.cjs"),c=require("../ui/input/index.cjs"),l=require("./form-field-shell.cjs");let u=require("react");u=e.__toESM(u,1);let d=require("react/jsx-runtime"),f=require("react-hook-form");function p(e){return{label:e.label,description:e.description,success:e.success,loading:e.loading,required:e.required,className:e.className,htmlFor:e.id??e.name,layout:e.layout,descriptionPosition:e.descriptionPosition,labelAction:e.labelAction,requiredIndicator:e.requiredIndicator,errorIcon:e.errorIcon,showErrorIcon:e.showErrorIcon,disabled:e.disabled,readOnly:e.readOnly,labelClassName:e.labelClassName,labelRowClassName:e.labelRowClassName,descriptionClassName:e.descriptionClassName,errorClassName:e.errorClassName,contentClassName:e.contentClassName}}function m(e){let u=e.id??e.name,m=p(e),h=e.kind??`text`,g=e.fieldClassName??`w-full`;return(0,d.jsx)(f.Controller,{control:e.control,name:e.name,rules:e.rules,render:({field:f,fieldState:p})=>{let _=p.error?.message,v=l.resolveFormFieldIds(u,{description:e.description,error:_});if(h===`search`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,onValueChange:N,onBlur:P,...F}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...F,type:`search`,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,inputClassName:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),P?.(e)},onValueChange:e=>{f.onChange(e),N?.(e)}})})}if(h===`password`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,onValueChange:N,onBlur:P,...F}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...F,type:`password`,id:j??u,ref:f.ref,name:f.name,value:f.value??``,disabled:C,readOnly:e.readOnly,inputClassName:A??g,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),P?.(e)},onChange:e=>{let t=e.currentTarget.value;f.onChange(t),N?.(t)},"aria-invalid":p.invalid||void 0})})}if(h===`number`){let{control:t,name:n,label:r,description:i,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onNumberChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(a.NumberInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onNumberChange:e=>{f.onChange(e??N),P?.(e)}})})}if(h===`phone`){let{control:t,name:n,label:r,description:i,required:a,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,valueMode:N=`raw`,countryCode:P=`+998`,maxDigits:F=12,onValueChange:I,onBlur:L,...R}=e,z=f.value==null?``:String(f.value),B=N===`raw`?o.formatPhoneDigits(z,P,F):z;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(o.PhoneInput,{...R,id:j??u,name:f.name,ref:f.ref,value:B,disabled:C,readOnly:e.readOnly,countryCode:P,maxDigits:F,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),L?.(e)},onValueChange:(e,t)=>{let n=N===`raw`?t:e;f.onChange(n),I?.(n,t,e)}})})}if(h===`date`){let{control:n,name:r,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=``,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(t.DateInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e||N),P?.(e)}})})}if(h===`clearable`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:s,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=``,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(c.Input,{...I,clearable:!0,id:j??u,name:f.name,ref:f.ref,value:f.value??``,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e||N),P?.(e)}})})}if(h===`masked`){let{control:t,name:n,label:r,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,valueMode:N=`raw`,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(i.MaskedInput,{...I,id:j??u,name:f.name,ref:f.ref,value:String(f.value??``),disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:(e,t)=>{let n=N===`raw`?t:e;f.onChange(n),P?.(e,t)}})})}if(h===`money`){let{control:t,name:n,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(r.MoneyInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value??null,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:(e,t)=>{f.onChange(e??N),P?.(e,t)}})})}if(h===`quantity`){let{control:t,name:n,label:r,description:i,required:a,className:o,layout:c,descriptionPosition:h,labelAction:y,requiredIndicator:b,errorIcon:x,showErrorIcon:S,disabled:C,readOnly:w,labelClassName:T,labelRowClassName:E,descriptionClassName:D,errorClassName:O,contentClassName:k,fieldClassName:A,id:j,kind:M,emptyValue:N=null,onValueChange:P,onBlur:F,...I}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:j??u,children:(0,d.jsx)(s.QuantityInput,{...I,id:j??u,name:f.name,ref:f.ref,value:f.value,disabled:C,readOnly:e.readOnly,className:A??g,"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,onBlur:e=>{f.onBlur(),F?.(e)},onValueChange:e=>{f.onChange(e??N),P?.(e)}})})}if(h===`date-range`){let{control:t,name:r,label:i,description:a,required:o,className:s,layout:c,descriptionPosition:h,labelAction:g,requiredIndicator:y,errorIcon:b,showErrorIcon:x,disabled:S,labelClassName:C,labelRowClassName:w,descriptionClassName:T,errorClassName:E,contentClassName:D,fieldClassName:O,id:k,kind:A,onValueChange:j,onBlur:M,...N}=e,P=f.value;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:k??u,children:(0,d.jsx)(n.DateRangeInput,{...N,id:k??u,value:P&&typeof P==`object`?{from:P.from,to:P.to}:{from:``,to:``},fromInputProps:{...N.fromInputProps??{},disabled:S,readOnly:e.readOnly,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0},toInputProps:{...N.toInputProps??{},disabled:S,readOnly:e.readOnly,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0},onValueChange:e=>{f.onChange(e),j?.(e)},"aria-invalid":p.invalid||void 0,onBlur:e=>{f.onBlur(),M?.(e)}})})}let{control:y,name:b,label:x,description:S,required:C,className:w,layout:T,descriptionPosition:E,labelAction:D,requiredIndicator:O,errorIcon:k,showErrorIcon:A,disabled:j,readOnly:M,labelClassName:N,labelRowClassName:P,descriptionClassName:F,errorClassName:I,contentClassName:L,fieldClassName:R,transformIn:z,transformOut:B,id:V,kind:H,onChange:U,onBlur:W,...G}=e;return(0,d.jsx)(l.FormFieldShell,{...m,labelId:v.labelId,descriptionId:v.descriptionId,errorId:v.errorId,error:_,htmlFor:V??u,children:(0,d.jsx)(c.Input,{...G,id:V??u,ref:f.ref,name:f.name,value:z?z(f.value):f.value??``,disabled:j,readOnly:M,onBlur:e=>{f.onBlur(),W?.(e)},onChange:e=>{f.onChange(B?B(e):e.target.value),U?.(e)},"aria-invalid":p.invalid||void 0,"aria-describedby":v.describedBy,"aria-errormessage":_?v.errorId:void 0,className:R??g})})}})}exports.FormInput=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../ui/select/index.cjs"),t=require("../inputs/async-select.cjs"),n=require("./form-field-shell.cjs");let r=require("react/jsx-runtime"),i=require("react-hook-form");function a(e){return{label:e.label,description:e.description,required:e.required,className:e.className,htmlFor:e.name,layout:e.layout,descriptionPosition:e.descriptionPosition,labelAction:e.labelAction,requiredIndicator:e.requiredIndicator,errorIcon:e.errorIcon,showErrorIcon:e.showErrorIcon,disabled:e.disabled,readOnly:e.readOnly,labelClassName:e.labelClassName,labelRowClassName:e.labelRowClassName,descriptionClassName:e.descriptionClassName,errorClassName:e.errorClassName,contentClassName:e.contentClassName}}function o(o){let s=a(o),c=o.kind??`simple`,l=o.fieldClassName??`w-full`;return(0,r.jsx)(i.Controller,{control:o.control,name:o.name,render:({field:i,fieldState:a})=>{let u=a.error?.message,d=n.resolveFormFieldIds(`${o.name}`,{description:o.description,error:u});if(c===`async`){let{control:e,name:a,label:c,description:f,required:p,className:m,layout:h,descriptionPosition:g,labelAction:_,requiredIndicator:v,errorIcon:y,showErrorIcon:b,disabled:x,readOnly:S,labelClassName:C,labelRowClassName:w,descriptionClassName:T,errorClassName:E,contentClassName:D,fieldClassName:O,emptyValue:k,kind:A,onValueChange:j,...M}=o;return(0,r.jsx)(n.FormFieldShell,{...s,labelId:d.labelId,descriptionId:d.descriptionId,errorId:d.errorId,error:u,children:(0,r.jsx)(t.AsyncSelect,{...M,value:i.value==null||i.value===``?void 0:String(i.value),disabled:x||S,"aria-describedby":d.describedBy,"aria-errormessage":u?d.errorId:void 0,onValueChange:(e,t)=>{i.onChange(e??k),j?.(e,t)},triggerClassName:O??l})})}let{control:f,name:p,label:m,description:h,required:g,className:_,layout:v,descriptionPosition:y,labelAction:b,requiredIndicator:x,errorIcon:S,showErrorIcon:C,disabled:w,readOnly:T,labelClassName:E,labelRowClassName:D,descriptionClassName:O,errorClassName:k,contentClassName:A,fieldClassName:j,emptyValue:M,kind:N,onValueChange:P,...F}=o;return(0,r.jsx)(n.FormFieldShell,{...s,labelId:d.labelId,descriptionId:d.descriptionId,errorId:d.errorId,error:u,children:(0,r.jsx)(e.Select,{...F,value:i.value==null?void 0:String(i.value),disabled:w||T,"aria-describedby":d.describedBy,"aria-errormessage":u?d.errorId:void 0,onValueChange:e=>{i.onChange(e||M),P?.(e)},triggerClassName:j??l})})}})}exports.FormSelect=o;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../ui/select/index.cjs"),t=require("../inputs/async-select.cjs"),n=require("./form-field-shell.cjs");let r=require("react/jsx-runtime"),i=require("react-hook-form");function a(e){return{label:e.label,description:e.description,success:e.success,loading:e.loading,required:e.required,className:e.className,htmlFor:e.name,layout:e.layout,descriptionPosition:e.descriptionPosition,labelAction:e.labelAction,requiredIndicator:e.requiredIndicator,errorIcon:e.errorIcon,showErrorIcon:e.showErrorIcon,disabled:e.disabled,readOnly:e.readOnly,labelClassName:e.labelClassName,labelRowClassName:e.labelRowClassName,descriptionClassName:e.descriptionClassName,errorClassName:e.errorClassName,contentClassName:e.contentClassName}}function o(o){let s=a(o),c=o.kind??`simple`,l=o.fieldClassName??`w-full`;return(0,r.jsx)(i.Controller,{control:o.control,name:o.name,render:({field:i,fieldState:a})=>{let u=a.error?.message,d=n.resolveFormFieldIds(`${o.name}`,{description:o.description,error:u});if(c===`async`){let{control:e,name:a,label:c,description:f,required:p,className:m,layout:h,descriptionPosition:g,labelAction:_,requiredIndicator:v,errorIcon:y,showErrorIcon:b,disabled:x,readOnly:S,labelClassName:C,labelRowClassName:w,descriptionClassName:T,errorClassName:E,contentClassName:D,fieldClassName:O,emptyValue:k,kind:A,onValueChange:j,...M}=o;return(0,r.jsx)(n.FormFieldShell,{...s,labelId:d.labelId,descriptionId:d.descriptionId,errorId:d.errorId,error:u,children:(0,r.jsx)(t.AsyncSelect,{...M,value:i.value==null||i.value===``?void 0:String(i.value),disabled:x||S,"aria-describedby":d.describedBy,"aria-errormessage":u?d.errorId:void 0,onValueChange:(e,t)=>{i.onChange(e??k),j?.(e,t)},triggerClassName:O??l})})}let{control:f,name:p,label:m,description:h,required:g,className:_,layout:v,descriptionPosition:y,labelAction:b,requiredIndicator:x,errorIcon:S,showErrorIcon:C,disabled:w,readOnly:T,labelClassName:E,labelRowClassName:D,descriptionClassName:O,errorClassName:k,contentClassName:A,fieldClassName:j,emptyValue:M,kind:N,onValueChange:P,...F}=o;return(0,r.jsx)(n.FormFieldShell,{...s,labelId:d.labelId,descriptionId:d.descriptionId,errorId:d.errorId,error:u,children:(0,r.jsx)(e.Select,{...F,value:i.value==null?void 0:String(i.value),disabled:w||T,"aria-describedby":d.describedBy,"aria-errormessage":u?d.errorId:void 0,onValueChange:e=>{i.onChange(e||M),P?.(e)},triggerClassName:j??l})})}})}exports.FormSelect=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/switch/index.cjs"),r=require("./form-field-shell.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("react-hook-form");function s({control:e,name:i,label:s,description:c,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../ui/switch/index.cjs"),r=require("./form-field-shell.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("react-hook-form");function s({control:e,name:i,label:s,description:c,success:l,loading:u,required:d,className:f,layout:p,descriptionPosition:m,labelAction:h,requiredIndicator:g,errorIcon:_,showErrorIcon:v,disabled:y,readOnly:b,labelClassName:x,labelRowClassName:S,descriptionClassName:C,errorClassName:w,contentClassName:T,fieldClassName:E,labelPlacement:D=`end`,id:O,onCheckedChange:k,...A}){let j=O??i;return(0,a.jsx)(o.Controller,{control:e,name:i,render:({field:e,fieldState:i})=>{let o=i.error?.message,O=r.resolveFormFieldIds(j,{description:c,error:o}),M=s?(0,a.jsxs)(`label`,{id:O.labelId,htmlFor:j,className:t.cn(`text-sm font-medium leading-none`,y&&`opacity-60`,x),children:[s,d&&(g??(0,a.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`}))]}):null,N=(0,a.jsx)(n.Switch,{id:j,ref:e.ref,checked:!!e.value,disabled:y||b,"aria-invalid":i.invalid||void 0,"aria-labelledby":s?O.labelId:void 0,"aria-describedby":O.describedBy,"aria-errormessage":o?O.errorId:void 0,className:E,onBlur:e.onBlur,onCheckedChange:t=>{e.onChange(t),k?.(t)},...A});return D===`start`?(0,a.jsx)(r.FormFieldShell,{label:s,description:c,success:l,loading:u,required:d,error:o,htmlFor:j,labelId:O.labelId,descriptionId:O.descriptionId,errorId:O.errorId,className:f,layout:p,descriptionPosition:m,labelAction:h,requiredIndicator:g,errorIcon:_,showErrorIcon:v,disabled:y,readOnly:b,labelClassName:x,labelRowClassName:S,descriptionClassName:C,errorClassName:w,contentClassName:T,children:N}):(0,a.jsx)(r.FormFieldShell,{error:o,success:l,loading:u,className:f,descriptionId:O.descriptionId,errorId:O.errorId,errorIcon:_,showErrorIcon:v,disabled:y,readOnly:b,errorClassName:w,contentClassName:T,children:(0,a.jsxs)(`div`,{className:`flex items-start gap-3`,children:[N,(s||c||h)&&(0,a.jsxs)(`div`,{className:`grid min-w-0 gap-1`,children:[(s||h)&&(0,a.jsxs)(`div`,{className:t.cn(`flex items-center justify-between gap-2`,S),children:[M,h&&(0,a.jsx)(`div`,{className:`shrink-0 text-sm`,children:h})]}),c&&(0,a.jsx)(`p`,{id:O.descriptionId,className:t.cn(`text-xs text-muted-foreground`,C),children:c})]})]})})}})}exports.FormSwitch=s;
|
|
@@ -10,5 +10,5 @@ export type FormSwitchProps<TFieldValues extends FieldValues = FieldValues, TNam
|
|
|
10
10
|
labelPlacement?: FormSwitchLabelPlacement;
|
|
11
11
|
onCheckedChange?: (checked: boolean) => void;
|
|
12
12
|
};
|
|
13
|
-
declare function FormSwitch<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, label, description, required, className, layout, descriptionPosition, labelAction, requiredIndicator, errorIcon, showErrorIcon, disabled, readOnly, labelClassName, labelRowClassName, descriptionClassName, errorClassName, contentClassName, fieldClassName, labelPlacement, id, onCheckedChange, ...props }: FormSwitchProps<TFieldValues, TName>): React.JSX.Element;
|
|
13
|
+
declare function FormSwitch<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, label, description, success, loading, required, className, layout, descriptionPosition, labelAction, requiredIndicator, errorIcon, showErrorIcon, disabled, readOnly, labelClassName, labelRowClassName, descriptionClassName, errorClassName, contentClassName, fieldClassName, labelPlacement, id, onCheckedChange, ...props }: FormSwitchProps<TFieldValues, TName>): React.JSX.Element;
|
|
14
14
|
export { FormSwitch };
|