@lerianstudio/sindarian-ui 2.0.0-beta.25 → 2.0.0-beta.26
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/charts/chart.js +4 -231
- package/dist/charts/index.js +1 -11
- package/dist/components/breadcrumb/get-breadcrumb-paths.js +1 -18
- package/dist/components/breadcrumb/index.js +1 -37
- package/dist/components/card/account-card/index.js +1 -69
- package/dist/components/card/basic-card/index.js +1 -20
- package/dist/components/card/dashboard-card/index.js +1 -20
- package/dist/components/card/entity-card/index.js +1 -68
- package/dist/components/card/index.js +1 -20
- package/dist/components/dialog/confirmation-dialog/index.js +1 -96
- package/dist/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -55
- package/dist/components/dialog/index.js +1 -19
- package/dist/components/dialog/large-dialog/index.js +1 -21
- package/dist/components/entity-box/index.js +1 -67
- package/dist/components/entity-data-table/index.js +1 -20
- package/dist/components/form/combo-box-field/index.js +1 -35
- package/dist/components/form/country-field/index.js +1 -11
- package/dist/components/form/date-picker-field/index.js +1 -83
- package/dist/components/form/date-range-field/index.js +1 -58
- package/dist/components/form/date-time-picker-field/index.js +1 -114
- package/dist/components/form/file-upload-field/index.js +1 -69
- package/dist/components/form/index.js +1 -31
- package/dist/components/form/input-field/index.js +1 -96
- package/dist/components/form/otp-field/index.js +1 -19
- package/dist/components/form/pagination-limit-field/index.js +1 -10
- package/dist/components/form/password-field/index.js +1 -16
- package/dist/components/form/radio-group-field/index.js +1 -36
- package/dist/components/form/renderable-label.js +1 -57
- package/dist/components/form/select-field/index.js +1 -68
- package/dist/components/form/state-field/index.js +1 -42
- package/dist/components/form/switch-field/index.js +1 -16
- package/dist/components/form/textarea-field/index.js +1 -23
- package/dist/components/page/index.js +1 -20
- package/dist/components/page-header/index.js +1 -80
- package/dist/components/pagination/index.js +1 -10
- package/dist/components/table/id-table-cell.js +1 -109
- package/dist/components/table/index.js +1 -19
- package/dist/components/table/locked-table-actions.js +1 -41
- package/dist/components/table/name-table-cell.js +1 -58
- package/dist/components/ui/accordion/index.js +1 -62
- package/dist/components/ui/alert/index.js +1 -45
- package/dist/components/ui/alert-dialog/index.js +1 -84
- package/dist/components/ui/autocomplete/index.js +1 -440
- package/dist/components/ui/autosize-textarea/index.js +1 -89
- package/dist/components/ui/avatar/index.js +1 -51
- package/dist/components/ui/badge/index.js +1 -83
- package/dist/components/ui/breadcrumb/index.js +1 -35
- package/dist/components/ui/button/index.js +1 -65
- package/dist/components/ui/calendar/index.js +1 -118
- package/dist/components/ui/card/index.js +1 -32
- package/dist/components/ui/checkbox/index.js +1 -44
- package/dist/components/ui/collapsible/index.js +1 -50
- package/dist/components/ui/command/index.js +1 -95
- package/dist/components/ui/copy-field/index.js +1 -163
- package/dist/components/ui/dialog/index.js +1 -80
- package/dist/components/ui/dropdown-menu/index.js +1 -110
- package/dist/components/ui/field/index.js +1 -82
- package/dist/components/ui/file-upload/index.js +1 -574
- package/dist/components/ui/form.js +1 -162
- package/dist/components/ui/hover-card/index.js +1 -51
- package/dist/components/ui/icon-button/index.js +1 -35
- package/dist/components/ui/input/adornment.js +1 -21
- package/dist/components/ui/input/index.js +1 -99
- package/dist/components/ui/label/index.js +1 -45
- package/dist/components/ui/lerian-wordmark/index.js +1 -7
- package/dist/components/ui/loading-button/index.js +1 -9
- package/dist/components/ui/multiple-select/index.js +1 -235
- package/dist/components/ui/otp-input/index.js +1 -62
- package/dist/components/ui/paper/index.js +1 -8
- package/dist/components/ui/paper-collapsible/index.js +1 -24
- package/dist/components/ui/popover/index.js +1 -55
- package/dist/components/ui/progress/index.js +1 -66
- package/dist/components/ui/qr-code/index.js +1 -27
- package/dist/components/ui/radio-group/index.js +1 -48
- package/dist/components/ui/scroll-area/index.js +1 -49
- package/dist/components/ui/select/index.js +1 -119
- package/dist/components/ui/separator/index.js +1 -43
- package/dist/components/ui/sheet/index.js +1 -136
- package/dist/components/ui/sidebar/index.js +1 -27
- package/dist/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/components/ui/sidebar/sidebar-back-button.js +1 -8
- package/dist/components/ui/sidebar/sidebar-components.js +1 -23
- package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -49
- package/dist/components/ui/sidebar/sidebar-item-button.js +1 -21
- package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -52
- package/dist/components/ui/sidebar/sidebar-item-icon-button.js +1 -18
- package/dist/components/ui/sidebar/sidebar-item.js +1 -44
- package/dist/components/ui/sidebar/sidebar-provider.js +1 -201
- package/dist/components/ui/sidebar/sidebar-root.js +1 -130
- package/dist/components/ui/sidebar/sidebar-router.js +1 -126
- package/dist/components/ui/sidebar/sidebar-trigger.js +1 -57
- package/dist/components/ui/skeleton/index.js +1 -8
- package/dist/components/ui/stepper/index.js +1 -29
- package/dist/components/ui/switch/index.js +1 -43
- package/dist/components/ui/table/index.js +1 -56
- package/dist/components/ui/tabs/index.js +1 -55
- package/dist/components/ui/textarea/index.js +1 -8
- package/dist/components/ui/time-picker/index.js +1 -85
- package/dist/components/ui/toast/index.js +1 -3
- package/dist/components/ui/toast/toaster.js +1 -16
- package/dist/components/ui/toggle-group/index.js +1 -156
- package/dist/components/ui/tooltip/index.js +1 -81
- package/dist/domain/blotter/index.js +1 -20
- package/dist/domain/delinquency-aging/aging-buckets.js +1 -120
- package/dist/domain/delinquency-aging/index.js +1 -222
- package/dist/domain/figure/index.js +1 -19
- package/dist/domain/format.js +1 -137
- package/dist/domain/index.js +1 -43
- package/dist/domain/key-id/index.js +1 -174
- package/dist/domain/ledger-sheet/index.js +1 -28
- package/dist/domain/money-diff.js +1 -48
- package/dist/domain/money-math.js +1 -104
- package/dist/domain/money-text/index.js +1 -123
- package/dist/domain/section-label/index.js +1 -17
- package/dist/domain/status-rail/index.js +1 -76
- package/dist/domain/threshold-gauge/index.js +1 -161
- package/dist/enterprise/alert-banner/index.js +1 -24
- package/dist/enterprise/app-shell/index.js +1 -87
- package/dist/enterprise/cursor-pager/index.js +1 -26
- package/dist/enterprise/data-table/column-size.js +1 -103
- package/dist/enterprise/data-table/index.js +1 -345
- package/dist/enterprise/date-range-picker/index.js +1 -115
- package/dist/enterprise/detail-panel/index.js +1 -20
- package/dist/enterprise/empty-state/index.js +1 -14
- package/dist/enterprise/index.js +1 -39
- package/dist/enterprise/number-input/index.js +1 -252
- package/dist/enterprise/search-input/index.js +1 -121
- package/dist/enterprise/stat-card/index.js +1 -75
- package/dist/enterprise/status-badge/index.js +1 -120
- package/dist/enterprise/use-is-mobile.js +1 -68
- package/dist/enterprise/virtualized-table/index.js +1 -141
- package/dist/esm/charts/chart.js +4 -190
- package/dist/esm/charts/index.js +1 -3
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +1 -12
- package/dist/esm/components/breadcrumb/index.js +1 -30
- package/dist/esm/components/card/account-card/index.js +1 -53
- package/dist/esm/components/card/basic-card/index.js +1 -14
- package/dist/esm/components/card/dashboard-card/index.js +1 -14
- package/dist/esm/components/card/entity-card/index.js +1 -52
- package/dist/esm/components/card/index.js +1 -4
- package/dist/esm/components/dialog/confirmation-dialog/index.js +1 -60
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -49
- package/dist/esm/components/dialog/index.js +1 -3
- package/dist/esm/components/dialog/large-dialog/index.js +1 -16
- package/dist/esm/components/entity-box/index.js +1 -56
- package/dist/esm/components/entity-data-table/index.js +1 -17
- package/dist/esm/components/form/combo-box-field/index.js +1 -28
- package/dist/esm/components/form/country-field/index.js +1 -7
- package/dist/esm/components/form/date-picker-field/index.js +1 -43
- package/dist/esm/components/form/date-range-field/index.js +1 -18
- package/dist/esm/components/form/date-time-picker-field/index.js +1 -74
- package/dist/esm/components/form/file-upload-field/index.js +1 -65
- package/dist/esm/components/form/index.js +1 -15
- package/dist/esm/components/form/input-field/index.js +1 -92
- package/dist/esm/components/form/otp-field/index.js +1 -15
- package/dist/esm/components/form/pagination-limit-field/index.js +1 -6
- package/dist/esm/components/form/password-field/index.js +1 -10
- package/dist/esm/components/form/radio-group-field/index.js +1 -32
- package/dist/esm/components/form/renderable-label.js +1 -54
- package/dist/esm/components/form/select-field/index.js +1 -64
- package/dist/esm/components/form/state-field/index.js +1 -35
- package/dist/esm/components/form/switch-field/index.js +1 -12
- package/dist/esm/components/form/textarea-field/index.js +1 -19
- package/dist/esm/components/page/index.js +1 -15
- package/dist/esm/components/page-header/index.js +1 -71
- package/dist/esm/components/pagination/index.js +1 -6
- package/dist/esm/components/table/id-table-cell.js +1 -105
- package/dist/esm/components/table/index.js +1 -3
- package/dist/esm/components/table/locked-table-actions.js +1 -37
- package/dist/esm/components/table/name-table-cell.js +1 -54
- package/dist/esm/components/ui/accordion/index.js +1 -24
- package/dist/esm/components/ui/alert/index.js +1 -38
- package/dist/esm/components/ui/alert-dialog/index.js +1 -39
- package/dist/esm/components/ui/autocomplete/index.js +1 -392
- package/dist/esm/components/ui/autosize-textarea/index.js +1 -51
- package/dist/esm/components/ui/avatar/index.js +1 -14
- package/dist/esm/components/ui/badge/index.js +1 -79
- package/dist/esm/components/ui/breadcrumb/index.js +1 -27
- package/dist/esm/components/ui/button/index.js +1 -60
- package/dist/esm/components/ui/calendar/index.js +1 -82
- package/dist/esm/components/ui/card/index.js +1 -24
- package/dist/esm/components/ui/checkbox/index.js +1 -9
- package/dist/esm/components/ui/collapsible/index.js +1 -13
- package/dist/esm/components/ui/command/index.js +1 -51
- package/dist/esm/components/ui/copy-field/index.js +1 -127
- package/dist/esm/components/ui/dialog/index.js +1 -36
- package/dist/esm/components/ui/dropdown-menu/index.js +1 -60
- package/dist/esm/components/ui/field/index.js +1 -71
- package/dist/esm/components/ui/file-upload/index.js +1 -536
- package/dist/esm/components/ui/form.js +1 -118
- package/dist/esm/components/ui/hover-card/index.js +1 -14
- package/dist/esm/components/ui/icon-button/index.js +1 -31
- package/dist/esm/components/ui/input/adornment.js +1 -17
- package/dist/esm/components/ui/input/index.js +1 -60
- package/dist/esm/components/ui/label/index.js +1 -10
- package/dist/esm/components/ui/lerian-wordmark/index.js +1 -4
- package/dist/esm/components/ui/loading-button/index.js +1 -7
- package/dist/esm/components/ui/multiple-select/index.js +1 -196
- package/dist/esm/components/ui/otp-input/index.js +1 -21
- package/dist/esm/components/ui/paper/index.js +1 -5
- package/dist/esm/components/ui/paper-collapsible/index.js +1 -19
- package/dist/esm/components/ui/popover/index.js +1 -17
- package/dist/esm/components/ui/progress/index.js +1 -31
- package/dist/esm/components/ui/qr-code/index.js +1 -24
- package/dist/esm/components/ui/radio-group/index.js +1 -12
- package/dist/esm/components/ui/scroll-area/index.js +1 -13
- package/dist/esm/components/ui/select/index.js +1 -74
- package/dist/esm/components/ui/separator/index.js +1 -8
- package/dist/esm/components/ui/sheet/index.js +1 -92
- package/dist/esm/components/ui/sidebar/index.js +1 -11
- package/dist/esm/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/esm/components/ui/sidebar/sidebar-back-button.js +1 -5
- package/dist/esm/components/ui/sidebar/sidebar-components.js +1 -15
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -42
- package/dist/esm/components/ui/sidebar/sidebar-item-button.js +1 -18
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -44
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +1 -14
- package/dist/esm/components/ui/sidebar/sidebar-item.js +1 -40
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +1 -193
- package/dist/esm/components/ui/sidebar/sidebar-root.js +1 -126
- package/dist/esm/components/ui/sidebar/sidebar-router.js +1 -89
- package/dist/esm/components/ui/sidebar/sidebar-trigger.js +1 -53
- package/dist/esm/components/ui/skeleton/index.js +1 -6
- package/dist/esm/components/ui/stepper/index.js +1 -20
- package/dist/esm/components/ui/switch/index.js +1 -8
- package/dist/esm/components/ui/table/index.js +1 -44
- package/dist/esm/components/ui/tabs/index.js +1 -17
- package/dist/esm/components/ui/textarea/index.js +1 -6
- package/dist/esm/components/ui/time-picker/index.js +1 -49
- package/dist/esm/components/ui/toast/index.js +1 -2
- package/dist/esm/components/ui/toast/toaster.js +1 -13
- package/dist/esm/components/ui/toggle-group/index.js +1 -120
- package/dist/esm/components/ui/tooltip/index.js +1 -43
- package/dist/esm/domain/blotter/index.js +1 -16
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -115
- package/dist/esm/domain/delinquency-aging/index.js +1 -218
- package/dist/esm/domain/figure/index.js +1 -15
- package/dist/esm/domain/format.js +1 -128
- package/dist/esm/domain/index.js +1 -19
- package/dist/esm/domain/key-id/index.js +1 -169
- package/dist/esm/domain/ledger-sheet/index.js +1 -24
- package/dist/esm/domain/money-diff.js +1 -45
- package/dist/esm/domain/money-math.js +1 -98
- package/dist/esm/domain/money-text/index.js +1 -118
- package/dist/esm/domain/section-label/index.js +1 -14
- package/dist/esm/domain/status-rail/index.js +1 -71
- package/dist/esm/domain/threshold-gauge/index.js +1 -157
- package/dist/esm/enterprise/alert-banner/index.js +1 -21
- package/dist/esm/enterprise/app-shell/index.js +1 -51
- package/dist/esm/enterprise/cursor-pager/index.js +1 -23
- package/dist/esm/enterprise/data-table/column-size.js +1 -97
- package/dist/esm/enterprise/data-table/index.js +1 -342
- package/dist/esm/enterprise/date-range-picker/index.js +1 -112
- package/dist/esm/enterprise/detail-panel/index.js +1 -17
- package/dist/esm/enterprise/empty-state/index.js +1 -11
- package/dist/esm/enterprise/index.js +1 -22
- package/dist/esm/enterprise/number-input/index.js +1 -214
- package/dist/esm/enterprise/search-input/index.js +1 -85
- package/dist/esm/enterprise/stat-card/index.js +1 -72
- package/dist/esm/enterprise/status-badge/index.js +1 -116
- package/dist/esm/enterprise/use-is-mobile.js +1 -31
- package/dist/esm/enterprise/virtualized-table/index.js +1 -138
- package/dist/esm/hooks/use-click-away.js +1 -22
- package/dist/esm/hooks/use-pagination.js +1 -38
- package/dist/esm/hooks/use-stepper.js +1 -22
- package/dist/esm/hooks/use-time.js +1 -13
- package/dist/esm/hooks/use-toast.js +1 -107
- package/dist/esm/index.js +1 -77
- package/dist/esm/lib/storage/get-storage-object.js +1 -17
- package/dist/esm/lib/storage/get-storage.js +1 -14
- package/dist/esm/lib/storage/index.js +1 -2
- package/dist/esm/lib/typography.js +1 -31
- package/dist/esm/lib/utils.js +1 -41
- package/dist/esm/theme/get-theme-script.js +1 -41
- package/dist/esm/theme/index.js +1 -4
- package/dist/esm/theme/mode-toggle.js +1 -45
- package/dist/esm/theme/theme-provider.js +1 -122
- package/dist/esm/toast/helpers.js +1 -36
- package/dist/esm/toast/index.js +1 -4
- package/dist/esm/types/metadata-type.js +1 -1
- package/dist/esm/utils/countries.cjs +1 -17
- package/dist/esm/utils/country-utils.js +1 -18
- package/dist/esm/utils/currency-codes.js +1 -181
- package/dist/hooks/use-click-away.js +1 -29
- package/dist/hooks/use-pagination.js +1 -41
- package/dist/hooks/use-stepper.js +1 -26
- package/dist/hooks/use-time.js +1 -20
- package/dist/hooks/use-toast.js +1 -111
- package/dist/index.js +1 -96
- package/dist/lib/storage/get-storage-object.js +1 -23
- package/dist/lib/storage/get-storage.js +1 -17
- package/dist/lib/storage/index.js +1 -18
- package/dist/lib/typography.js +1 -34
- package/dist/lib/utils.js +1 -45
- package/dist/theme/get-theme-script.js +1 -44
- package/dist/theme/index.js +1 -11
- package/dist/theme/mode-toggle.js +1 -48
- package/dist/theme/theme-provider.js +1 -160
- package/dist/toast/helpers.js +1 -41
- package/dist/toast/index.js +1 -10
- package/dist/types/metadata-type.js +1 -2
- package/dist/utils/countries.cjs +1 -17
- package/dist/utils/country-utils.js +1 -25
- package/dist/utils/currency-codes.js +1 -184
- package/package.json +4 -3
|
@@ -1,14 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmptyState = EmptyState;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const lucide_react_1 = require("lucide-react");
|
|
6
|
-
const typography_1 = require("../../lib/typography");
|
|
7
|
-
const utils_1 = require("../../lib/utils");
|
|
8
|
-
function EmptyState({ icon: Icon = lucide_react_1.Inbox, title, description, action, ruled = false, titleAs, className }) {
|
|
9
|
-
const Title = titleAs ?? (ruled ? 'span' : 'p');
|
|
10
|
-
if (ruled) {
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)("div", { "data-variant": "ruled", className: (0, utils_1.cn)('border-border flex flex-col items-start gap-2 border-t px-3 py-6 text-left', className), children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-muted-foreground flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(Icon, { className: "size-4", "aria-hidden": true }), (0, jsx_runtime_1.jsx)(Title, { className: typography_1.LABEL_VOICE_CLASS, children: title })] }), description ? ((0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground max-w-prose text-sm", children: description })) : null, action ? (0, jsx_runtime_1.jsx)("div", { className: "mt-1", children: action }) : null] }));
|
|
12
|
-
}
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('flex flex-col items-center justify-center gap-3 px-6 py-16 text-center', className), children: [(0, jsx_runtime_1.jsx)("div", { className: "bg-muted flex size-11 items-center justify-center rounded-full", children: (0, jsx_runtime_1.jsx)(Icon, { className: "text-muted-foreground size-5", "aria-hidden": true }) }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsx)(Title, { className: "text-foreground text-sm font-medium", children: title }), description ? ((0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground mx-auto max-w-sm text-sm", children: description })) : null] }), action ? (0, jsx_runtime_1.jsx)("div", { className: "mt-2", children: action }) : null] }));
|
|
14
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EmptyState=EmptyState;const jsx_runtime_1=require("react/jsx-runtime");const lucide_react_1=require("lucide-react");const typography_1=require("../../lib/typography");const utils_1=require("../../lib/utils");function EmptyState({icon:s=lucide_react_1.Inbox,title:r,description:e,action:t,ruled:l=false,titleAs:i,className:a}){const c=i??(l?"span":"p");if(l){return(0,jsx_runtime_1.jsxs)("div",{"data-variant":"ruled",className:(0,utils_1.cn)("border-border flex flex-col items-start gap-2 border-t px-3 py-6 text-left",a),children:[(0,jsx_runtime_1.jsxs)("div",{className:"text-muted-foreground flex items-center gap-2",children:[(0,jsx_runtime_1.jsx)(s,{className:"size-4","aria-hidden":true}),(0,jsx_runtime_1.jsx)(c,{className:typography_1.LABEL_VOICE_CLASS,children:r})]}),e?(0,jsx_runtime_1.jsx)("p",{className:"text-muted-foreground max-w-prose text-sm",children:e}):null,t?(0,jsx_runtime_1.jsx)("div",{className:"mt-1",children:t}):null]})}return(0,jsx_runtime_1.jsxs)("div",{className:(0,utils_1.cn)("flex flex-col items-center justify-center gap-3 px-6 py-16 text-center",a),children:[(0,jsx_runtime_1.jsx)("div",{className:"bg-muted flex size-11 items-center justify-center rounded-full",children:(0,jsx_runtime_1.jsx)(s,{className:"text-muted-foreground size-5","aria-hidden":true})}),(0,jsx_runtime_1.jsxs)("div",{className:"space-y-1",children:[(0,jsx_runtime_1.jsx)(c,{className:"text-foreground text-sm font-medium",children:r}),e?(0,jsx_runtime_1.jsx)("p",{className:"text-muted-foreground mx-auto max-w-sm text-sm",children:e}):null]}),t?(0,jsx_runtime_1.jsx)("div",{className:"mt-2",children:t}):null]})}
|
package/dist/enterprise/index.js
CHANGED
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Owned by lane enterprise — see docs/plans/2026-08-26-sindarian-x-retirement/
|
|
3
|
-
//
|
|
4
|
-
// The composed enterprise layer absorbed from @lerianstudio/sindarian-x@0.15.0.
|
|
5
|
-
// Outer public APIs are byte-compatible with that package; internals are
|
|
6
|
-
// recomposed over sindarian-ui primitives and its design tokens.
|
|
7
|
-
//
|
|
8
|
-
// Names already exported by sindarian-ui are NEVER re-exported here (FC-4):
|
|
9
|
-
// consumers adapt to sindarian-ui's API for Button, Badge, Table*, Sidebar*,
|
|
10
|
-
// EntityBox*, Stepper*, PageHeader, ConfirmationDialog and friends.
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useIsMobile = exports.VirtualizedTable = exports.StatusBadge = exports.DEFAULT_STATUS_VARIANTS = exports.StatCard = exports.SearchInput = exports.NumberInput = exports.EmptyState = exports.DetailPanel = exports.DateRangePicker = exports.DataTable = exports.CursorPager = exports.AppShell = exports.AlertBanner = void 0;
|
|
13
|
-
var alert_banner_1 = require("./alert-banner");
|
|
14
|
-
Object.defineProperty(exports, "AlertBanner", { enumerable: true, get: function () { return alert_banner_1.AlertBanner; } });
|
|
15
|
-
var app_shell_1 = require("./app-shell");
|
|
16
|
-
Object.defineProperty(exports, "AppShell", { enumerable: true, get: function () { return app_shell_1.AppShell; } });
|
|
17
|
-
var cursor_pager_1 = require("./cursor-pager");
|
|
18
|
-
Object.defineProperty(exports, "CursorPager", { enumerable: true, get: function () { return cursor_pager_1.CursorPager; } });
|
|
19
|
-
var data_table_1 = require("./data-table");
|
|
20
|
-
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return data_table_1.DataTable; } });
|
|
21
|
-
var date_range_picker_1 = require("./date-range-picker");
|
|
22
|
-
Object.defineProperty(exports, "DateRangePicker", { enumerable: true, get: function () { return date_range_picker_1.DateRangePicker; } });
|
|
23
|
-
var detail_panel_1 = require("./detail-panel");
|
|
24
|
-
Object.defineProperty(exports, "DetailPanel", { enumerable: true, get: function () { return detail_panel_1.DetailPanel; } });
|
|
25
|
-
var empty_state_1 = require("./empty-state");
|
|
26
|
-
Object.defineProperty(exports, "EmptyState", { enumerable: true, get: function () { return empty_state_1.EmptyState; } });
|
|
27
|
-
var number_input_1 = require("./number-input");
|
|
28
|
-
Object.defineProperty(exports, "NumberInput", { enumerable: true, get: function () { return number_input_1.NumberInput; } });
|
|
29
|
-
var search_input_1 = require("./search-input");
|
|
30
|
-
Object.defineProperty(exports, "SearchInput", { enumerable: true, get: function () { return search_input_1.SearchInput; } });
|
|
31
|
-
var stat_card_1 = require("./stat-card");
|
|
32
|
-
Object.defineProperty(exports, "StatCard", { enumerable: true, get: function () { return stat_card_1.StatCard; } });
|
|
33
|
-
var status_badge_1 = require("./status-badge");
|
|
34
|
-
Object.defineProperty(exports, "DEFAULT_STATUS_VARIANTS", { enumerable: true, get: function () { return status_badge_1.DEFAULT_STATUS_VARIANTS; } });
|
|
35
|
-
Object.defineProperty(exports, "StatusBadge", { enumerable: true, get: function () { return status_badge_1.StatusBadge; } });
|
|
36
|
-
var virtualized_table_1 = require("./virtualized-table");
|
|
37
|
-
Object.defineProperty(exports, "VirtualizedTable", { enumerable: true, get: function () { return virtualized_table_1.VirtualizedTable; } });
|
|
38
|
-
var use_is_mobile_1 = require("./use-is-mobile");
|
|
39
|
-
Object.defineProperty(exports, "useIsMobile", { enumerable: true, get: function () { return use_is_mobile_1.useIsMobile; } });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useIsMobile=exports.VirtualizedTable=exports.StatusBadge=exports.DEFAULT_STATUS_VARIANTS=exports.StatCard=exports.SearchInput=exports.NumberInput=exports.EmptyState=exports.DetailPanel=exports.DateRangePicker=exports.DataTable=exports.CursorPager=exports.AppShell=exports.AlertBanner=void 0;var alert_banner_1=require("./alert-banner");Object.defineProperty(exports,"AlertBanner",{enumerable:true,get:function(){return alert_banner_1.AlertBanner}});var app_shell_1=require("./app-shell");Object.defineProperty(exports,"AppShell",{enumerable:true,get:function(){return app_shell_1.AppShell}});var cursor_pager_1=require("./cursor-pager");Object.defineProperty(exports,"CursorPager",{enumerable:true,get:function(){return cursor_pager_1.CursorPager}});var data_table_1=require("./data-table");Object.defineProperty(exports,"DataTable",{enumerable:true,get:function(){return data_table_1.DataTable}});var date_range_picker_1=require("./date-range-picker");Object.defineProperty(exports,"DateRangePicker",{enumerable:true,get:function(){return date_range_picker_1.DateRangePicker}});var detail_panel_1=require("./detail-panel");Object.defineProperty(exports,"DetailPanel",{enumerable:true,get:function(){return detail_panel_1.DetailPanel}});var empty_state_1=require("./empty-state");Object.defineProperty(exports,"EmptyState",{enumerable:true,get:function(){return empty_state_1.EmptyState}});var number_input_1=require("./number-input");Object.defineProperty(exports,"NumberInput",{enumerable:true,get:function(){return number_input_1.NumberInput}});var search_input_1=require("./search-input");Object.defineProperty(exports,"SearchInput",{enumerable:true,get:function(){return search_input_1.SearchInput}});var stat_card_1=require("./stat-card");Object.defineProperty(exports,"StatCard",{enumerable:true,get:function(){return stat_card_1.StatCard}});var status_badge_1=require("./status-badge");Object.defineProperty(exports,"DEFAULT_STATUS_VARIANTS",{enumerable:true,get:function(){return status_badge_1.DEFAULT_STATUS_VARIANTS}});Object.defineProperty(exports,"StatusBadge",{enumerable:true,get:function(){return status_badge_1.StatusBadge}});var virtualized_table_1=require("./virtualized-table");Object.defineProperty(exports,"VirtualizedTable",{enumerable:true,get:function(){return virtualized_table_1.VirtualizedTable}});var use_is_mobile_1=require("./use-is-mobile");Object.defineProperty(exports,"useIsMobile",{enumerable:true,get:function(){return use_is_mobile_1.useIsMobile}});
|
|
@@ -1,252 +1 @@
|
|
|
1
|
-
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.parseRaw = parseRaw;
|
|
38
|
-
exports.isTransientPartial = isTransientPartial;
|
|
39
|
-
exports.NumberInput = NumberInput;
|
|
40
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
/**
|
|
42
|
-
* NumberInput — a controlled numeric input with +/- steppers.
|
|
43
|
-
*
|
|
44
|
-
* Composes sindarian-ui's Input (the text field) and IconButton (the two
|
|
45
|
-
* steppers). The external contract is a plain `number | null` (null = empty).
|
|
46
|
-
* Steppers step by `step` and clamp the result to [min, max]. While focused the
|
|
47
|
-
* field shows the raw, editable string the user is typing; on blur it reformats
|
|
48
|
-
* the committed number via Intl.NumberFormat(locale, { maximumFractionDigits:
|
|
49
|
-
* precision }) (e.g. 1,234.50). Parsing always emits the raw number, so digits
|
|
50
|
-
* the user types are never silently rewritten mid-edit.
|
|
51
|
-
*/
|
|
52
|
-
const React = __importStar(require("react"));
|
|
53
|
-
const lucide_react_1 = require("lucide-react");
|
|
54
|
-
const format_1 = require("../../domain/format");
|
|
55
|
-
const icon_button_1 = require("../../components/ui/icon-button");
|
|
56
|
-
const input_1 = require("../../components/ui/input");
|
|
57
|
-
const utils_1 = require("../../lib/utils");
|
|
58
|
-
function clamp(value, min, max) {
|
|
59
|
-
let next = value;
|
|
60
|
-
if (typeof min === 'number' && next < min)
|
|
61
|
-
next = min;
|
|
62
|
-
if (typeof max === 'number' && next > max)
|
|
63
|
-
next = max;
|
|
64
|
-
return next;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* `Number.prototype.toFixed` rejects more than 100 fraction digits. Denormals
|
|
68
|
-
* genuinely need more (`decimalPlaces(5e-324)` is 324), so this is a RangeError
|
|
69
|
-
* guard, not a precision policy — no step a person types comes close.
|
|
70
|
-
*/
|
|
71
|
-
const MAX_FIXED_DIGITS = 100;
|
|
72
|
-
/**
|
|
73
|
-
* Fraction digits a number carries, reading exponent notation correctly.
|
|
74
|
-
* `String(1e-7)` is `'1e-7'`, which has no '.' at all, so counting characters
|
|
75
|
-
* after a decimal point reports 0 and silently kills any step below 1e-6.
|
|
76
|
-
* `toExponential()` gives a canonical mantissa/exponent pair instead:
|
|
77
|
-
* 1e-7 -> mantissa '1', exponent -7 -> 7 fraction digits.
|
|
78
|
-
*/
|
|
79
|
-
function decimalPlaces(value) {
|
|
80
|
-
if (!Number.isFinite(value) || Number.isInteger(value))
|
|
81
|
-
return 0;
|
|
82
|
-
const [mantissa, exponent] = value.toExponential().split('e');
|
|
83
|
-
const mantissaDigits = (mantissa.split('.')[1] ?? '').length;
|
|
84
|
-
return Math.max(0, mantissaDigits - Number(exponent));
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Snap a stepped result to the fraction digits its own operands carry, so
|
|
88
|
-
* binary float drift never escapes to the parent: stepping 0.1 by 0.2 must
|
|
89
|
-
* commit 0.3, not 0.30000000000000004.
|
|
90
|
-
*
|
|
91
|
-
* Anchoring on the OPERANDS is what makes this safe at both ends of the range.
|
|
92
|
-
* Rounding to a fixed number of significant digits cannot work: at 1e15 the
|
|
93
|
-
* 15th significant digit is the units place, so 1e15 + 0.5 would snap straight
|
|
94
|
-
* back to 1e15 and the stepper would die. Nor can a "is this change small
|
|
95
|
-
* enough to be noise?" tolerance decide it — 1e15 + 0.125 is exactly
|
|
96
|
-
* representable and must be kept, yet its relative distance from the rounded
|
|
97
|
-
* form (1.25e-16) is SMALLER than genuine drift in 0.1 + 0.2 (1.85e-16), so no
|
|
98
|
-
* threshold separates the two cases. The operands do: `1e15` and `0.5` need one
|
|
99
|
-
* fraction digit between them, `0.1` and `0.2` also one, and rounding each
|
|
100
|
-
* result to its own digit count keeps the first and repairs the second.
|
|
101
|
-
*
|
|
102
|
-
* `toFixed` (not `value * 10 ** digits`) does the rounding: the multiply
|
|
103
|
-
* overflows Number.MAX_SAFE_INTEGER for large values and hands back the very
|
|
104
|
-
* drift it was meant to remove.
|
|
105
|
-
*/
|
|
106
|
-
function snapToStep(value, base, step) {
|
|
107
|
-
if (!Number.isFinite(value))
|
|
108
|
-
return value;
|
|
109
|
-
const digits = Math.min(MAX_FIXED_DIGITS, Math.max(decimalPlaces(base), decimalPlaces(step)));
|
|
110
|
-
return Number(value.toFixed(digits));
|
|
111
|
-
}
|
|
112
|
-
/** The locale's decimal and group separators, derived from a known sample. */
|
|
113
|
-
function localeSeparators(locale) {
|
|
114
|
-
const parts = new Intl.NumberFormat((0, format_1.safeLocale)(locale)).formatToParts(11111.1);
|
|
115
|
-
const decimal = parts.find((p) => p.type === 'decimal')?.value ?? '.';
|
|
116
|
-
const group = parts.find((p) => p.type === 'group')?.value ?? '';
|
|
117
|
-
return { decimal, group };
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Parse the editable string into a number, round-tripping the component's
|
|
121
|
-
* `locale`: strip the locale group separators, swap the locale decimal mark to
|
|
122
|
-
* '.', then `Number()`. Null when empty/unparseable.
|
|
123
|
-
*
|
|
124
|
-
* Internal (not part of the public barrel) but exported for its unit tests —
|
|
125
|
-
* numeric-entry correctness is the load-bearing behavior here.
|
|
126
|
-
*/
|
|
127
|
-
function parseRaw(raw, locale) {
|
|
128
|
-
const trimmed = raw.trim();
|
|
129
|
-
if (trimmed === '')
|
|
130
|
-
return null;
|
|
131
|
-
const { decimal, group } = localeSeparators(locale);
|
|
132
|
-
let normalized = trimmed;
|
|
133
|
-
if (group)
|
|
134
|
-
normalized = normalized.split(group).join('');
|
|
135
|
-
if (decimal !== '.')
|
|
136
|
-
normalized = normalized.split(decimal).join('.');
|
|
137
|
-
if (normalized === '')
|
|
138
|
-
return null;
|
|
139
|
-
const parsed = Number(normalized);
|
|
140
|
-
// NaN is not the only unusable result: `Number('1e999')` and `Number('Infinity')`
|
|
141
|
-
// are both `Infinity`, which passed the NaN check and was committed straight to
|
|
142
|
-
// `onValueChange`. An infinite committed value poisons everything downstream —
|
|
143
|
-
// `clamp` returns it verbatim with no `max`, `toFixed` cannot render it, and a
|
|
144
|
-
// form submits it. A non-finite entry is no number at all, so the committed
|
|
145
|
-
// value stays where it was.
|
|
146
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* A transient partial entry that should not commit yet — a lone sign, a lone
|
|
150
|
-
* decimal mark, sign+decimal, or a value ending in the decimal mark (the user
|
|
151
|
-
* is still typing). Suppressing these keeps the external value from
|
|
152
|
-
* round-tripping through `null` mid-edit.
|
|
153
|
-
*
|
|
154
|
-
* Internal (not part of the public barrel) but exported for its unit tests.
|
|
155
|
-
*/
|
|
156
|
-
function isTransientPartial(raw, locale) {
|
|
157
|
-
const trimmed = raw.trim();
|
|
158
|
-
if (trimmed === '')
|
|
159
|
-
return false;
|
|
160
|
-
const { decimal } = localeSeparators(locale);
|
|
161
|
-
const d = decimal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
162
|
-
return new RegExp(`^-?(${d})?$|${d}$`).test(trimmed);
|
|
163
|
-
}
|
|
164
|
-
function NumberInput({ value, onValueChange, min, max, step = 1, precision, locale, disabled = false, id, className, placeholder, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy }) {
|
|
165
|
-
const [focused, setFocused] = React.useState(false);
|
|
166
|
-
// The string the user is editing. Only authoritative while focused.
|
|
167
|
-
const [draft, setDraft] = React.useState('');
|
|
168
|
-
// A step has to be a POSITIVE FINITE number or the control stops meaning what
|
|
169
|
-
// its buttons say: a negative step makes "+" decrease and "−" increase, a zero
|
|
170
|
-
// or NaN step commits a value that never progresses (and NaN escapes into the
|
|
171
|
-
// form), and an infinite step commits Infinity the moment `max` is unset.
|
|
172
|
-
// None of those is a step, so an unusable one falls back to the documented
|
|
173
|
-
// default of 1 rather than being fed to the arithmetic.
|
|
174
|
-
const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
|
|
175
|
-
const formatter = React.useMemo(() => new Intl.NumberFormat((0, format_1.safeLocale)(locale), {
|
|
176
|
-
maximumFractionDigits: precision ?? 20,
|
|
177
|
-
minimumFractionDigits: precision ?? 0,
|
|
178
|
-
useGrouping: true
|
|
179
|
-
}), [locale, precision]);
|
|
180
|
-
// Blurred display: locale-formatted committed value, or empty.
|
|
181
|
-
const displayValue = focused
|
|
182
|
-
? draft
|
|
183
|
-
: value === null
|
|
184
|
-
? ''
|
|
185
|
-
: formatter.format(value);
|
|
186
|
-
const commit = (next) => {
|
|
187
|
-
onValueChange(next);
|
|
188
|
-
};
|
|
189
|
-
const stepBy = (direction) => {
|
|
190
|
-
const base = value ?? 0;
|
|
191
|
-
// Snap FIRST, then clamp — never the other way round. Snapping rounds to
|
|
192
|
-
// the operands' fraction digits, so snapping a CLAMPED value rounds the
|
|
193
|
-
// bound itself: stepping 0.2 by 0.1 under max 0.25 clamps to 0.25, which
|
|
194
|
-
// then snaps to one digit as 0.3 and escapes the maximum. Clamping last
|
|
195
|
-
// makes the bound the final word, and `clamp` returns it verbatim, so a
|
|
196
|
-
// bound is emitted exactly as the caller gave it.
|
|
197
|
-
const next = clamp(snapToStep(base + direction * safeStep, base, safeStep), min, max);
|
|
198
|
-
commit(next);
|
|
199
|
-
// Seed the draft via the locale formatter so a stepper press doesn't flip
|
|
200
|
-
// the user's separators (e.g. ',' → '.').
|
|
201
|
-
if (focused)
|
|
202
|
-
setDraft(formatter.format(next));
|
|
203
|
-
};
|
|
204
|
-
const onChange = (event) => {
|
|
205
|
-
const raw = event.target.value;
|
|
206
|
-
setDraft(raw);
|
|
207
|
-
// Commit only a genuine clear or a parsed number; suppress transient
|
|
208
|
-
// partials ("-", ".", "-.", trailing separator) so typing a negative or
|
|
209
|
-
// decimal doesn't round-trip the external value through null mid-entry.
|
|
210
|
-
if (raw.trim() === '') {
|
|
211
|
-
commit(null);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (isTransientPartial(raw, locale))
|
|
215
|
-
return;
|
|
216
|
-
const parsed = parseRaw(raw, locale);
|
|
217
|
-
if (parsed !== null)
|
|
218
|
-
commit(parsed);
|
|
219
|
-
};
|
|
220
|
-
// Keyboard stepping (WCAG 2.1.1): the steppers are tabIndex={-1}, so the
|
|
221
|
-
// input owns keyboard interaction per the ARIA spinbutton pattern.
|
|
222
|
-
const onKeyDown = (event) => {
|
|
223
|
-
if (disabled)
|
|
224
|
-
return;
|
|
225
|
-
if (event.key === 'ArrowUp') {
|
|
226
|
-
event.preventDefault();
|
|
227
|
-
stepBy(1);
|
|
228
|
-
}
|
|
229
|
-
else if (event.key === 'ArrowDown') {
|
|
230
|
-
event.preventDefault();
|
|
231
|
-
stepBy(-1);
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
const onFocus = () => {
|
|
235
|
-
setFocused(true);
|
|
236
|
-
// Seed via the locale formatter (not String(value), which forces '.') so
|
|
237
|
-
// focusing doesn't flip the separator the user expects.
|
|
238
|
-
setDraft(value === null ? '' : formatter.format(value));
|
|
239
|
-
};
|
|
240
|
-
const onBlur = () => {
|
|
241
|
-
setFocused(false);
|
|
242
|
-
// Re-clamp the committed value so a typed out-of-range entry settles.
|
|
243
|
-
if (value !== null) {
|
|
244
|
-
const clamped = clamp(value, min, max);
|
|
245
|
-
if (clamped !== value)
|
|
246
|
-
commit(clamped);
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const atMin = typeof min === 'number' && value !== null && value <= min;
|
|
250
|
-
const atMax = typeof max === 'number' && value !== null && value >= max;
|
|
251
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)('inline-flex items-stretch gap-1', className), children: [(0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { className: "shrink-0", type: "button", variant: "outline", disabled: disabled || atMin, "aria-label": `Decrease${ariaLabel ? ` ${ariaLabel}` : ''}`, onClick: () => stepBy(-1), tabIndex: -1, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Minus, { className: "size-4", "aria-hidden": true }) }), (0, jsx_runtime_1.jsx)("div", { className: "w-28 min-w-0", children: (0, jsx_runtime_1.jsx)(input_1.Input, { id: id, inputMode: "decimal", role: "spinbutton", "aria-valuenow": value ?? undefined, "aria-valuemin": min, "aria-valuemax": max, className: "text-right tabular-nums", value: displayValue, placeholder: placeholder, disabled: disabled, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, onChange: onChange, onKeyDown: onKeyDown, onFocus: onFocus, onBlur: onBlur }) }), (0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { className: "shrink-0", type: "button", variant: "outline", disabled: disabled || atMax, "aria-label": `Increase${ariaLabel ? ` ${ariaLabel}` : ''}`, onClick: () => stepBy(1), tabIndex: -1, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "size-4", "aria-hidden": true }) })] }));
|
|
252
|
-
}
|
|
1
|
+
"use client";"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,n,r,e){if(e===void 0)e=r;var i=Object.getOwnPropertyDescriptor(n,r);if(!i||("get"in i?!n.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return n[r]}}}Object.defineProperty(t,e,i)}):(function(t,n,r,e){if(e===void 0)e=r;t[e]=n[r]}));var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,n){Object.defineProperty(t,"default",{enumerable:true,value:n})}):function(t,n){t["default"]=n});var __importStar=this&&this.__importStar||(function(){var t=function(n){t=Object.getOwnPropertyNames||function(r){var e=[];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i))e[e.length]=i;return e};return t(n)};return function(n){if(n&&n.__esModule)return n;var r={};if(n!=null){for(var e=t(n),i=0;i<e.length;i++)if(e[i]!=="default")__createBinding(r,n,e[i])}__setModuleDefault(r,n);return r}})();Object.defineProperty(exports,"__esModule",{value:true});exports.parseRaw=parseRaw;exports.isTransientPartial=isTransientPartial;exports.NumberInput=NumberInput;const jsx_runtime_1=require("react/jsx-runtime");const React=__importStar(require("react"));const lucide_react_1=require("lucide-react");const format_1=require("../../domain/format");const icon_button_1=require("../../components/ui/icon-button");const input_1=require("../../components/ui/input");const utils_1=require("../../lib/utils");function clamp(t,n,r){let e=t;if(typeof n==="number"&&e<n)e=n;if(typeof r==="number"&&e>r)e=r;return e}const MAX_FIXED_DIGITS=100;function decimalPlaces(t){if(!Number.isFinite(t)||Number.isInteger(t))return 0;const[n,r]=t.toExponential().split("e");const e=(n.split(".")[1]??"").length;return Math.max(0,e-Number(r))}function snapToStep(t,n,r){if(!Number.isFinite(t))return t;const e=Math.min(MAX_FIXED_DIGITS,Math.max(decimalPlaces(n),decimalPlaces(r)));return Number(t.toFixed(e))}function localeSeparators(t){const n=new Intl.NumberFormat((0,format_1.safeLocale)(t)).formatToParts(11111.1);const r=n.find(i=>i.type==="decimal")?.value??".";const e=n.find(i=>i.type==="group")?.value??"";return{decimal:r,group:e}}function parseRaw(t,n){const r=t.trim();if(r==="")return null;const{decimal:e,group:i}=localeSeparators(n);let o=r;if(i)o=o.split(i).join("");if(e!==".")o=o.split(e).join(".");if(o==="")return null;const u=Number(o);return Number.isFinite(u)?u:null}function isTransientPartial(t,n){const r=t.trim();if(r==="")return false;const{decimal:e}=localeSeparators(n);const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^-?(${i})?$|${i}$`).test(r)}function NumberInput({value:t,onValueChange:n,min:r,max:e,step:i=1,precision:o,locale:u,disabled:f=false,id:y,className:x,placeholder:N,"aria-label":c,"aria-describedby":j}){const[_,g]=React.useState(false);const[w,m]=React.useState("");const h=Number.isFinite(i)&&i>0?i:1;const b=React.useMemo(()=>new Intl.NumberFormat((0,format_1.safeLocale)(u),{maximumFractionDigits:o??20,minimumFractionDigits:o??0,useGrouping:true}),[u,o]);const D=_?w:t===null?"":b.format(t);const p=s=>{n(s)};const d=s=>{const a=t??0;const l=clamp(snapToStep(a+s*h,a,h),r,e);p(l);if(_)m(b.format(l))};const I=s=>{const a=s.target.value;m(a);if(a.trim()===""){p(null);return}if(isTransientPartial(a,u))return;const l=parseRaw(a,u);if(l!==null)p(l)};const M=s=>{if(f)return;if(s.key==="ArrowUp"){s.preventDefault();d(1)}else if(s.key==="ArrowDown"){s.preventDefault();d(-1)}};const F=()=>{g(true);m(t===null?"":b.format(t))};const O=()=>{g(false);if(t!==null){const s=clamp(t,r,e);if(s!==t)p(s)}};const P=typeof r==="number"&&t!==null&&t<=r;const $=typeof e==="number"&&t!==null&&t>=e;return(0,jsx_runtime_1.jsxs)("div",{className:(0,utils_1.cn)("inline-flex items-stretch gap-1",x),children:[(0,jsx_runtime_1.jsx)(icon_button_1.IconButton,{className:"shrink-0",type:"button",variant:"outline",disabled:f||P,"aria-label":`Decrease${c?` ${c}`:""}`,onClick:()=>d(-1),tabIndex:-1,children:(0,jsx_runtime_1.jsx)(lucide_react_1.Minus,{className:"size-4","aria-hidden":true})}),(0,jsx_runtime_1.jsx)("div",{className:"w-28 min-w-0",children:(0,jsx_runtime_1.jsx)(input_1.Input,{id:y,inputMode:"decimal",role:"spinbutton","aria-valuenow":t??void 0,"aria-valuemin":r,"aria-valuemax":e,className:"text-right tabular-nums",value:D,placeholder:N,disabled:f,"aria-label":c,"aria-describedby":j,onChange:I,onKeyDown:M,onFocus:F,onBlur:O})}),(0,jsx_runtime_1.jsx)(icon_button_1.IconButton,{className:"shrink-0",type:"button",variant:"outline",disabled:f||$,"aria-label":`Increase${c?` ${c}`:""}`,onClick:()=>d(1),tabIndex:-1,children:(0,jsx_runtime_1.jsx)(lucide_react_1.Plus,{className:"size-4","aria-hidden":true})})]})}
|
|
@@ -1,121 +1 @@
|
|
|
1
|
-
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.SearchInput = SearchInput;
|
|
38
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
-
/**
|
|
40
|
-
* SearchInput — the console filter row's text field.
|
|
41
|
-
*
|
|
42
|
-
* A controlled text field with a leading search glyph and a trailing clear
|
|
43
|
-
* button that appears only when there is text. It debounces the *emission*
|
|
44
|
-
* (`onValueChange`) while keeping the visible field perfectly responsive: a
|
|
45
|
-
* local draft mirrors the controlled `value`, every keystroke updates the draft
|
|
46
|
-
* immediately, and a trailing timer flushes the draft to the parent after
|
|
47
|
-
* `debounceMs`. Clearing flushes synchronously (no lingering timer fighting an
|
|
48
|
-
* explicit empty).
|
|
49
|
-
*
|
|
50
|
-
* Composes sindarian-ui's Input via its start/end adornment slots.
|
|
51
|
-
*/
|
|
52
|
-
const React = __importStar(require("react"));
|
|
53
|
-
const lucide_react_1 = require("lucide-react");
|
|
54
|
-
const icon_button_1 = require("../../components/ui/icon-button");
|
|
55
|
-
const input_1 = require("../../components/ui/input");
|
|
56
|
-
const utils_1 = require("../../lib/utils");
|
|
57
|
-
/**
|
|
58
|
-
* Marks "no emission of ours is awaiting its echo". A unique object, not a
|
|
59
|
-
* string: any string sentinel is a value a parent could legitimately pass.
|
|
60
|
-
*/
|
|
61
|
-
const NO_PENDING_ECHO = Symbol('no pending echo');
|
|
62
|
-
function SearchInput({ value, onValueChange, debounceMs = 250, placeholder = 'Search…', 'aria-label': ariaLabel, clearLabel = 'Clear search', disabled = false, className, id, onKeyDown }) {
|
|
63
|
-
// Local draft keeps typing instant; the controlled `value` is the source of
|
|
64
|
-
// truth between edits. When the parent changes `value` out of band (reset,
|
|
65
|
-
// programmatic set), the draft follows.
|
|
66
|
-
const [draft, setDraft] = React.useState(value);
|
|
67
|
-
const timer = React.useRef(null);
|
|
68
|
-
// The value this component last emitted and has not yet seen echoed back. The
|
|
69
|
-
// parent echoes it one render later, by which time the user may already have
|
|
70
|
-
// typed further — syncing the draft to that echo would rewind the field and
|
|
71
|
-
// swallow those keystrokes. Starts as the sentinel rather than `value`, so the
|
|
72
|
-
// initial value is never mistaken for an echo of something we sent.
|
|
73
|
-
const lastEmitted = React.useRef(NO_PENDING_ECHO);
|
|
74
|
-
React.useEffect(() => {
|
|
75
|
-
const isEcho = lastEmitted.current === value;
|
|
76
|
-
// ANY external change consumes the token, echo or not. Consuming it only on
|
|
77
|
-
// a match left a DROPPED emission pending forever: emit "pix", the parent
|
|
78
|
-
// rejects it and holds "", the parent later sets "foo" (draft follows, token
|
|
79
|
-
// still holding "pix"), the parent then sets "pix" — read as our own echo,
|
|
80
|
-
// so the draft stayed on "foo" and the visible field disagreed with the
|
|
81
|
-
// controlled value. A later external change is proof the parent moved on,
|
|
82
|
-
// which invalidates any echo still outstanding.
|
|
83
|
-
lastEmitted.current = NO_PENDING_ECHO;
|
|
84
|
-
// A genuine echo must NOT reach the draft: the parent echoes one render
|
|
85
|
-
// later, by which time the user may have typed further, and syncing would
|
|
86
|
-
// rewind the field and swallow those keystrokes.
|
|
87
|
-
if (isEcho)
|
|
88
|
-
return;
|
|
89
|
-
setDraft(value);
|
|
90
|
-
}, [value]);
|
|
91
|
-
const clearTimer = React.useCallback(() => {
|
|
92
|
-
if (timer.current !== null) {
|
|
93
|
-
clearTimeout(timer.current);
|
|
94
|
-
timer.current = null;
|
|
95
|
-
}
|
|
96
|
-
}, []);
|
|
97
|
-
// Cancel any pending debounced emission on unmount — don't fire a stale
|
|
98
|
-
// search into a parent that's tearing down. (Clearing flushes synchronously
|
|
99
|
-
// via handleClear, so a real clear is never lost.)
|
|
100
|
-
React.useEffect(() => clearTimer, [clearTimer]);
|
|
101
|
-
const handleChange = (event) => {
|
|
102
|
-
const next = event.target.value;
|
|
103
|
-
setDraft(next);
|
|
104
|
-
clearTimer();
|
|
105
|
-
timer.current = setTimeout(() => {
|
|
106
|
-
timer.current = null;
|
|
107
|
-
lastEmitted.current = next;
|
|
108
|
-
onValueChange(next);
|
|
109
|
-
}, debounceMs);
|
|
110
|
-
};
|
|
111
|
-
const handleClear = () => {
|
|
112
|
-
clearTimer();
|
|
113
|
-
setDraft('');
|
|
114
|
-
lastEmitted.current = '';
|
|
115
|
-
onValueChange('');
|
|
116
|
-
};
|
|
117
|
-
const hasValue = draft.length > 0;
|
|
118
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)('relative w-full sm:w-64', className), children: (0, jsx_runtime_1.jsx)(input_1.Input, { id: id, type: "search", role: "searchbox", value: draft, onChange: handleChange, onKeyDown: onKeyDown, placeholder: placeholder, "aria-label": ariaLabel ?? placeholder ?? 'Search', disabled: disabled,
|
|
119
|
-
// The native search clear glyph would duplicate our button.
|
|
120
|
-
className: "[&::-webkit-search-cancel-button]:appearance-none", startAdornment: (0, jsx_runtime_1.jsx)(input_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Search, { "aria-hidden": true }) }), endAdornment: hasValue ? ((0, jsx_runtime_1.jsx)(input_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { type: "button", variant: "plain", size: "small", "aria-label": clearLabel, disabled: disabled, onClick: handleClear, className: "text-muted-foreground hover:text-foreground", children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "size-4", "aria-hidden": true }) }) })) : undefined }) }));
|
|
121
|
-
}
|
|
1
|
+
"use client";"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,u,t){if(t===void 0)t=u;var r=Object.getOwnPropertyDescriptor(e,u);if(!r||("get"in r?!e.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return e[u]}}}Object.defineProperty(n,t,r)}):(function(n,e,u,t){if(t===void 0)t=u;n[t]=e[u]}));var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:true,value:e})}):function(n,e){n["default"]=e});var __importStar=this&&this.__importStar||(function(){var n=function(e){n=Object.getOwnPropertyNames||function(u){var t=[];for(var r in u)if(Object.prototype.hasOwnProperty.call(u,r))t[t.length]=r;return t};return n(e)};return function(e){if(e&&e.__esModule)return e;var u={};if(e!=null){for(var t=n(e),r=0;r<t.length;r++)if(t[r]!=="default")__createBinding(u,e,t[r])}__setModuleDefault(u,e);return u}})();Object.defineProperty(exports,"__esModule",{value:true});exports.SearchInput=SearchInput;const jsx_runtime_1=require("react/jsx-runtime");const React=__importStar(require("react"));const lucide_react_1=require("lucide-react");const icon_button_1=require("../../components/ui/icon-button");const input_1=require("../../components/ui/input");const utils_1=require("../../lib/utils");const NO_PENDING_ECHO=Symbol("no pending echo");function SearchInput({value:n,onValueChange:e,debounceMs:u=250,placeholder:t="Search\u2026","aria-label":r,clearLabel:h="Clear search",disabled:f=false,className:p,id:_,onKeyDown:b}){const[d,s]=React.useState(n);const c=React.useRef(null);const a=React.useRef(NO_PENDING_ECHO);React.useEffect(()=>{const o=a.current===n;a.current=NO_PENDING_ECHO;if(o)return;s(n)},[n]);const i=React.useCallback(()=>{if(c.current!==null){clearTimeout(c.current);c.current=null}},[]);React.useEffect(()=>i,[i]);const m=o=>{const l=o.target.value;s(l);i();c.current=setTimeout(()=>{c.current=null;a.current=l;e(l)},u)};const j=()=>{i();s("");a.current="";e("")};const g=d.length>0;return(0,jsx_runtime_1.jsx)("div",{className:(0,utils_1.cn)("relative w-full sm:w-64",p),children:(0,jsx_runtime_1.jsx)(input_1.Input,{id:_,type:"search",role:"searchbox",value:d,onChange:m,onKeyDown:b,placeholder:t,"aria-label":r??t??"Search",disabled:f,className:"[&::-webkit-search-cancel-button]:appearance-none",startAdornment:(0,jsx_runtime_1.jsx)(input_1.InputAdornment,{position:"start",children:(0,jsx_runtime_1.jsx)(lucide_react_1.Search,{"aria-hidden":true})}),endAdornment:g?(0,jsx_runtime_1.jsx)(input_1.InputAdornment,{position:"end",children:(0,jsx_runtime_1.jsx)(icon_button_1.IconButton,{type:"button",variant:"plain",size:"small","aria-label":h,disabled:f,onClick:j,className:"text-muted-foreground hover:text-foreground",children:(0,jsx_runtime_1.jsx)(lucide_react_1.X,{className:"size-4","aria-hidden":true})})}):void 0})})}
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatCard = StatCard;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const blotter_1 = require("../../domain/blotter");
|
|
6
|
-
const figure_1 = require("../../domain/figure");
|
|
7
|
-
const ledger_sheet_1 = require("../../domain/ledger-sheet");
|
|
8
|
-
const section_label_1 = require("../../domain/section-label");
|
|
9
|
-
const utils_1 = require("../../lib/utils");
|
|
10
|
-
/** Value/delta color per tone. `default` keeps the high-contrast foreground;
|
|
11
|
-
* the rest escalate to a semantic theme token that tracks light/dark.
|
|
12
|
-
*
|
|
13
|
-
* All three escalations read the `-h1a` family, not a mix of `-h1a` and
|
|
14
|
-
* `-text`. `--system-*-text` is the ink of a tinted PILL, measured against its
|
|
15
|
-
* own surface; this card paints on the panel, and `-h1a` is the family gated
|
|
16
|
-
* against `--card` and `--background` in `__tests__/tokens-contract.test.ts`.
|
|
17
|
-
* The two differ by one palette step in dark, so a mixed table gave the three
|
|
18
|
-
* deltas three different weights on the same surface for no reason a reader
|
|
19
|
-
* could see. */
|
|
20
|
-
const TONE_VALUE = {
|
|
21
|
-
default: 'text-foreground',
|
|
22
|
-
success: 'text-system-success-h1a',
|
|
23
|
-
warning: 'text-system-alert-h1a',
|
|
24
|
-
destructive: 'text-system-error-h1a'
|
|
25
|
-
};
|
|
26
|
-
/** Trend stroke color per tone. Resolved through the `--color-*` wrappers (the
|
|
27
|
-
* raw `--chart-N` tokens are bare HSL triples, not usable colors). */
|
|
28
|
-
const TONE_TREND = {
|
|
29
|
-
default: 'var(--color-chart-1)',
|
|
30
|
-
success: 'var(--color-system-success)',
|
|
31
|
-
warning: 'var(--color-system-alert)',
|
|
32
|
-
destructive: 'var(--color-destructive)'
|
|
33
|
-
};
|
|
34
|
-
const TREND_VIEWBOX_WIDTH = 100;
|
|
35
|
-
const TREND_VIEWBOX_HEIGHT = 40;
|
|
36
|
-
/**
|
|
37
|
-
* Chrome-less inline trend: no axes, grid, legend or tooltip. Decorative by
|
|
38
|
-
* construction (`aria-hidden`) — the figure above it carries the meaning.
|
|
39
|
-
* Renders nothing when fewer than two points are plottable.
|
|
40
|
-
*/
|
|
41
|
-
function TrendSpark({ data, dataKey, color }) {
|
|
42
|
-
// Drop absent samples BEFORE coercing: Number(null) and Number('') are both
|
|
43
|
-
// 0, which would draw a phantom dip to the floor where the series simply has
|
|
44
|
-
// no reading.
|
|
45
|
-
const points = [];
|
|
46
|
-
for (const row of data) {
|
|
47
|
-
const raw = row[dataKey];
|
|
48
|
-
if (raw === null || raw === undefined || raw === '')
|
|
49
|
-
continue;
|
|
50
|
-
const n = Number(raw);
|
|
51
|
-
if (Number.isFinite(n))
|
|
52
|
-
points.push(n);
|
|
53
|
-
}
|
|
54
|
-
if (points.length < 2)
|
|
55
|
-
return null;
|
|
56
|
-
const min = Math.min(...points);
|
|
57
|
-
const max = Math.max(...points);
|
|
58
|
-
// A flat series has zero span; pin it to the vertical midline instead of
|
|
59
|
-
// dividing by zero.
|
|
60
|
-
const span = max - min;
|
|
61
|
-
const stepX = TREND_VIEWBOX_WIDTH / (points.length - 1);
|
|
62
|
-
const coords = points.map((n, i) => {
|
|
63
|
-
const x = i * stepX;
|
|
64
|
-
const y = span === 0
|
|
65
|
-
? TREND_VIEWBOX_HEIGHT / 2
|
|
66
|
-
: TREND_VIEWBOX_HEIGHT - ((n - min) / span) * TREND_VIEWBOX_HEIGHT;
|
|
67
|
-
return `${x.toFixed(2)},${y.toFixed(2)}`;
|
|
68
|
-
});
|
|
69
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { "aria-hidden": true, role: "presentation", viewBox: `0 0 ${TREND_VIEWBOX_WIDTH} ${TREND_VIEWBOX_HEIGHT}`, preserveAspectRatio: "none", className: "h-10 w-full", children: [(0, jsx_runtime_1.jsx)("polygon", { points: `0,${TREND_VIEWBOX_HEIGHT} ${coords.join(' ')} ${TREND_VIEWBOX_WIDTH},${TREND_VIEWBOX_HEIGHT}`, fill: color, fillOpacity: 0.15 }), (0, jsx_runtime_1.jsx)("polyline", { points: coords.join(' '), fill: "none", stroke: color, strokeWidth: 1.75, vectorEffect: "non-scaling-stroke" })] }));
|
|
70
|
-
}
|
|
71
|
-
function StatCard({ label, value, delta, tone = 'default', trend, trendKey = 'value', rows, className }) {
|
|
72
|
-
const hasTrend = trend !== undefined && trend.length > 0;
|
|
73
|
-
const hasRows = rows !== undefined && rows.length > 0;
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)(ledger_sheet_1.LedgerPanel, { "data-tone": tone, className: className, children: [(0, jsx_runtime_1.jsx)(section_label_1.SectionLabel, { children: label }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-1", children: [(0, jsx_runtime_1.jsx)(figure_1.Figure, { size: "hero", className: (0, utils_1.cn)('block', TONE_VALUE[tone]), children: value }), delta !== undefined ? ((0, jsx_runtime_1.jsx)("p", { className: (0, utils_1.cn)('text-xs tabular-nums', TONE_VALUE[tone]), children: delta })) : null] }), hasTrend ? ((0, jsx_runtime_1.jsx)(TrendSpark, { data: trend, dataKey: trendKey, color: TONE_TREND[tone] })) : null, hasRows ? ((0, jsx_runtime_1.jsx)(blotter_1.Blotter, { className: "mt-auto", children: rows.map((row, i) => ((0, jsx_runtime_1.jsx)(blotter_1.BlotterRow, { label: row.label, value: row.value }, i))) })) : null] }));
|
|
75
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StatCard=StatCard;const jsx_runtime_1=require("react/jsx-runtime");const blotter_1=require("../../domain/blotter");const figure_1=require("../../domain/figure");const ledger_sheet_1=require("../../domain/ledger-sheet");const section_label_1=require("../../domain/section-label");const utils_1=require("../../lib/utils");const TONE_VALUE={default:"text-foreground",success:"text-system-success-h1a",warning:"text-system-alert-h1a",destructive:"text-system-error-h1a"};const TONE_TREND={default:"var(--color-chart-1)",success:"var(--color-system-success)",warning:"var(--color-system-alert)",destructive:"var(--color-destructive)"};const TREND_VIEWBOX_WIDTH=100;const TREND_VIEWBOX_HEIGHT=40;function TrendSpark({data:c,dataKey:i,color:o}){const e=[];for(const l of c){const t=l[i];if(t===null||t===void 0||t==="")continue;const r=Number(t);if(Number.isFinite(r))e.push(r)}if(e.length<2)return null;const s=Math.min(...e);const u=Math.max(...e);const n=u-s;const d=TREND_VIEWBOX_WIDTH/(e.length-1);const a=e.map((l,t)=>{const r=t*d;const m=n===0?TREND_VIEWBOX_HEIGHT/2:TREND_VIEWBOX_HEIGHT-(l-s)/n*TREND_VIEWBOX_HEIGHT;return`${r.toFixed(2)},${m.toFixed(2)}`});return(0,jsx_runtime_1.jsxs)("svg",{"aria-hidden":true,role:"presentation",viewBox:`0 0 ${TREND_VIEWBOX_WIDTH} ${TREND_VIEWBOX_HEIGHT}`,preserveAspectRatio:"none",className:"h-10 w-full",children:[(0,jsx_runtime_1.jsx)("polygon",{points:`0,${TREND_VIEWBOX_HEIGHT} ${a.join(" ")} ${TREND_VIEWBOX_WIDTH},${TREND_VIEWBOX_HEIGHT}`,fill:o,fillOpacity:.15}),(0,jsx_runtime_1.jsx)("polyline",{points:a.join(" "),fill:"none",stroke:o,strokeWidth:1.75,vectorEffect:"non-scaling-stroke"})]})}function StatCard({label:c,value:i,delta:o,tone:e="default",trend:s,trendKey:u="value",rows:n,className:d}){const a=s!==void 0&&s.length>0;const l=n!==void 0&&n.length>0;return(0,jsx_runtime_1.jsxs)(ledger_sheet_1.LedgerPanel,{"data-tone":e,className:d,children:[(0,jsx_runtime_1.jsx)(section_label_1.SectionLabel,{children:c}),(0,jsx_runtime_1.jsxs)("div",{className:"space-y-1",children:[(0,jsx_runtime_1.jsx)(figure_1.Figure,{size:"hero",className:(0,utils_1.cn)("block",TONE_VALUE[e]),children:i}),o!==void 0?(0,jsx_runtime_1.jsx)("p",{className:(0,utils_1.cn)("text-xs tabular-nums",TONE_VALUE[e]),children:o}):null]}),a?(0,jsx_runtime_1.jsx)(TrendSpark,{data:s,dataKey:u,color:TONE_TREND[e]}):null,l?(0,jsx_runtime_1.jsx)(blotter_1.Blotter,{className:"mt-auto",children:n.map((t,r)=>(0,jsx_runtime_1.jsx)(blotter_1.BlotterRow,{label:t.label,value:t.value},r))}):null]})}
|