@lerianstudio/sindarian-ui 1.2.0 → 1.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/chart.d.ts +64 -0
- package/dist/charts/chart.d.ts.map +1 -0
- package/dist/charts/chart.js +232 -0
- package/dist/charts/index.d.ts +3 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/index.js +11 -0
- package/dist/components/breadcrumb/get-breadcrumb-paths.js +5 -2
- package/dist/components/form/date-time-picker-field/index.js +1 -1
- package/dist/components/form/file-upload-field/index.d.ts +52 -0
- package/dist/components/form/file-upload-field/index.d.ts.map +1 -0
- package/dist/components/form/file-upload-field/index.js +64 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +3 -0
- package/dist/components/form/radio-group-field/index.d.ts +32 -0
- package/dist/components/form/radio-group-field/index.d.ts.map +1 -0
- package/dist/components/form/radio-group-field/index.js +36 -0
- package/dist/components/form/renderable-label.d.ts +35 -0
- package/dist/components/form/renderable-label.d.ts.map +1 -0
- package/dist/components/form/renderable-label.js +57 -0
- package/dist/components/form/textarea-field/index.d.ts +31 -0
- package/dist/components/form/textarea-field/index.d.ts.map +1 -0
- package/dist/components/form/textarea-field/index.js +23 -0
- package/dist/components/table/id-table-cell.js +5 -2
- package/dist/components/ui/accordion/index.d.ts +14 -0
- package/dist/components/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/ui/accordion/index.js +62 -0
- package/dist/components/ui/alert-dialog/index.d.ts +15 -0
- package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/index.js +84 -0
- package/dist/components/ui/autocomplete/index.d.ts +1 -1
- package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/components/ui/autocomplete/index.js +45 -9
- package/dist/components/ui/badge/index.d.ts.map +1 -1
- package/dist/components/ui/badge/index.js +2 -2
- package/dist/components/ui/button/index.d.ts.map +1 -1
- package/dist/components/ui/button/index.js +1 -1
- package/dist/components/ui/copy-field/index.d.ts +56 -0
- package/dist/components/ui/copy-field/index.d.ts.map +1 -0
- package/dist/components/ui/copy-field/index.js +155 -0
- package/dist/components/ui/dialog/styles.css +3 -3
- package/dist/components/ui/file-upload/index.d.ts +94 -0
- package/dist/components/ui/file-upload/index.d.ts.map +1 -0
- package/dist/components/ui/file-upload/index.js +237 -0
- package/dist/components/ui/hover-card/index.d.ts +7 -0
- package/dist/components/ui/hover-card/index.d.ts.map +1 -0
- package/dist/components/ui/hover-card/index.js +51 -0
- package/dist/components/ui/icon-button/styles.css +24 -24
- package/dist/components/ui/input/index.d.ts.map +1 -1
- package/dist/components/ui/input/index.js +6 -5
- package/dist/components/ui/input/styles.css +6 -2
- package/dist/components/ui/otp-input/index.d.ts.map +1 -1
- package/dist/components/ui/otp-input/index.js +1 -1
- package/dist/components/ui/qr-code/index.d.ts +26 -0
- package/dist/components/ui/qr-code/index.d.ts.map +1 -0
- package/dist/components/ui/qr-code/index.js +27 -0
- package/dist/components/ui/radio-group/index.d.ts +6 -0
- package/dist/components/ui/radio-group/index.d.ts.map +1 -0
- package/dist/components/ui/radio-group/index.js +48 -0
- package/dist/components/ui/scroll-area/index.d.ts +6 -0
- package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/index.js +49 -0
- package/dist/components/ui/sidebar/index.d.ts +1 -0
- package/dist/components/ui/sidebar/index.d.ts.map +1 -1
- package/dist/components/ui/sidebar/index.js +1 -0
- package/dist/components/ui/sidebar/next-router.cjs +119 -0
- package/dist/components/ui/sidebar/next-router.d.cts +7 -0
- package/dist/components/ui/sidebar/sidebar-item-button.d.ts +2 -2
- package/dist/components/ui/sidebar/sidebar-item-button.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-item-button.js +3 -5
- package/dist/components/ui/sidebar/sidebar-item-icon-button.d.ts +3 -3
- package/dist/components/ui/sidebar/sidebar-item-icon-button.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-item-icon-button.js +5 -7
- package/dist/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-item.js +3 -2
- package/dist/components/ui/sidebar/sidebar-router.d.ts +82 -0
- package/dist/components/ui/sidebar/sidebar-router.d.ts.map +1 -0
- package/dist/components/ui/sidebar/sidebar-router.js +126 -0
- package/dist/components/ui/toast/index.d.ts +1 -1
- package/dist/components/ui/toast/index.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/index.d.ts +18 -0
- package/dist/components/ui/toggle-group/index.d.ts.map +1 -0
- package/dist/components/ui/toggle-group/index.js +87 -0
- package/dist/domain/blotter/index.d.ts +40 -0
- package/dist/domain/blotter/index.d.ts.map +1 -0
- package/dist/domain/blotter/index.js +16 -0
- package/dist/domain/delinquency-aging/aging-buckets.d.ts +57 -0
- package/dist/domain/delinquency-aging/aging-buckets.d.ts.map +1 -0
- package/dist/domain/delinquency-aging/aging-buckets.js +110 -0
- package/dist/domain/delinquency-aging/index.d.ts +71 -0
- package/dist/domain/delinquency-aging/index.d.ts.map +1 -0
- package/dist/domain/delinquency-aging/index.js +213 -0
- package/dist/domain/figure/index.d.ts +30 -0
- package/dist/domain/figure/index.d.ts.map +1 -0
- package/dist/domain/figure/index.js +18 -0
- package/dist/domain/format.d.ts +79 -0
- package/dist/domain/format.d.ts.map +1 -0
- package/dist/domain/format.js +137 -0
- package/dist/domain/index.d.ts +23 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +43 -0
- package/dist/domain/key-id/index.d.ts +31 -0
- package/dist/domain/key-id/index.d.ts.map +1 -0
- package/dist/domain/key-id/index.js +174 -0
- package/dist/domain/ledger-sheet/index.d.ts +45 -0
- package/dist/domain/ledger-sheet/index.d.ts.map +1 -0
- package/dist/domain/ledger-sheet/index.js +28 -0
- package/dist/domain/money-diff.d.ts +28 -0
- package/dist/domain/money-diff.d.ts.map +1 -0
- package/dist/domain/money-diff.js +48 -0
- package/dist/domain/money-math.d.ts +32 -0
- package/dist/domain/money-math.d.ts.map +1 -0
- package/dist/domain/money-math.js +104 -0
- package/dist/domain/money-text/index.d.ts +37 -0
- package/dist/domain/money-text/index.d.ts.map +1 -0
- package/dist/domain/money-text/index.js +115 -0
- package/dist/domain/section-label/index.d.ts +21 -0
- package/dist/domain/section-label/index.d.ts.map +1 -0
- package/dist/domain/section-label/index.js +13 -0
- package/dist/domain/status-rail/index.d.ts +40 -0
- package/dist/domain/status-rail/index.d.ts.map +1 -0
- package/dist/domain/status-rail/index.js +72 -0
- package/dist/domain/threshold-gauge/index.d.ts +84 -0
- package/dist/domain/threshold-gauge/index.d.ts.map +1 -0
- package/dist/domain/threshold-gauge/index.js +157 -0
- package/dist/enterprise/alert-banner/index.d.ts +30 -0
- package/dist/enterprise/alert-banner/index.d.ts.map +1 -0
- package/dist/enterprise/alert-banner/index.js +24 -0
- package/dist/enterprise/app-shell/index.d.ts +61 -0
- package/dist/enterprise/app-shell/index.d.ts.map +1 -0
- package/dist/enterprise/app-shell/index.js +87 -0
- package/dist/enterprise/cursor-pager/index.d.ts +21 -0
- package/dist/enterprise/cursor-pager/index.d.ts.map +1 -0
- package/dist/enterprise/cursor-pager/index.js +26 -0
- package/dist/enterprise/data-table/index.d.ts +88 -0
- package/dist/enterprise/data-table/index.d.ts.map +1 -0
- package/dist/enterprise/data-table/index.js +245 -0
- package/dist/enterprise/date-range-picker/index.d.ts +37 -0
- package/dist/enterprise/date-range-picker/index.d.ts.map +1 -0
- package/dist/enterprise/date-range-picker/index.js +92 -0
- package/dist/enterprise/detail-panel/index.d.ts +54 -0
- package/dist/enterprise/detail-panel/index.d.ts.map +1 -0
- package/dist/enterprise/detail-panel/index.js +20 -0
- package/dist/enterprise/empty-state/index.d.ts +32 -0
- package/dist/enterprise/empty-state/index.d.ts.map +1 -0
- package/dist/enterprise/empty-state/index.js +13 -0
- package/dist/enterprise/index.d.ts +26 -0
- package/dist/enterprise/index.d.ts.map +1 -0
- package/dist/enterprise/index.js +39 -0
- package/dist/enterprise/number-input/index.d.ts +55 -0
- package/dist/enterprise/number-input/index.d.ts.map +1 -0
- package/dist/enterprise/number-input/index.js +252 -0
- package/dist/enterprise/search-input/index.d.ts +32 -0
- package/dist/enterprise/search-input/index.d.ts.map +1 -0
- package/dist/enterprise/search-input/index.js +121 -0
- package/dist/enterprise/stat-card/index.d.ts +43 -0
- package/dist/enterprise/stat-card/index.d.ts.map +1 -0
- package/dist/enterprise/stat-card/index.js +67 -0
- package/dist/enterprise/status-badge/index.d.ts +31 -0
- package/dist/enterprise/status-badge/index.d.ts.map +1 -0
- package/dist/enterprise/status-badge/index.js +120 -0
- package/dist/enterprise/use-is-mobile.d.ts +20 -0
- package/dist/enterprise/use-is-mobile.d.ts.map +1 -0
- package/dist/enterprise/use-is-mobile.js +68 -0
- package/dist/enterprise/virtualized-table/index.d.ts +26 -0
- package/dist/enterprise/virtualized-table/index.d.ts.map +1 -0
- package/dist/enterprise/virtualized-table/index.js +114 -0
- package/dist/esm/charts/chart.d.ts +64 -0
- package/dist/esm/charts/chart.d.ts.map +1 -0
- package/dist/esm/charts/chart.js +191 -0
- package/dist/esm/charts/index.d.ts +3 -0
- package/dist/esm/charts/index.d.ts.map +1 -0
- package/dist/esm/charts/index.js +3 -0
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.d.ts +10 -0
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.d.ts.map +1 -0
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +12 -0
- package/dist/esm/components/breadcrumb/index.d.ts +11 -0
- package/dist/esm/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/esm/components/breadcrumb/index.js +6 -0
- package/dist/esm/components/card/account-card/index.d.ts +32 -0
- package/dist/esm/components/card/account-card/index.d.ts.map +1 -0
- package/dist/esm/components/card/account-card/index.js +53 -0
- package/dist/esm/components/card/basic-card/index.d.ts +6 -0
- package/dist/esm/components/card/basic-card/index.d.ts.map +1 -0
- package/dist/esm/components/card/basic-card/index.js +14 -0
- package/dist/esm/components/card/dashboard-card/index.d.ts +5 -0
- package/dist/esm/components/card/dashboard-card/index.d.ts.map +1 -0
- package/dist/esm/components/card/dashboard-card/index.js +14 -0
- package/dist/esm/components/card/entity-card/index.d.ts +22 -0
- package/dist/esm/components/card/entity-card/index.d.ts.map +1 -0
- package/dist/esm/components/card/entity-card/index.js +48 -0
- package/dist/esm/components/card/index.d.ts +5 -0
- package/dist/esm/components/card/index.d.ts.map +1 -0
- package/dist/esm/components/card/index.js +4 -0
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts +16 -0
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/dialog/confirmation-dialog/index.js +25 -0
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.d.ts +31 -0
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.d.ts.map +1 -0
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +49 -0
- package/dist/esm/components/dialog/index.d.ts +4 -0
- package/dist/esm/components/dialog/index.d.ts.map +1 -0
- package/dist/esm/components/dialog/index.js +3 -0
- package/dist/esm/components/dialog/large-dialog/index.d.ts +11 -0
- package/dist/esm/components/dialog/large-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/dialog/large-dialog/index.js +16 -0
- package/dist/esm/components/entity-box/index.d.ts +17 -0
- package/dist/esm/components/entity-box/index.d.ts.map +1 -0
- package/dist/esm/components/entity-box/index.js +31 -0
- package/dist/esm/components/entity-data-table/index.d.ts +17 -0
- package/dist/esm/components/entity-data-table/index.d.ts.map +1 -0
- package/dist/esm/components/entity-data-table/index.js +17 -0
- package/dist/esm/components/form/combo-box-field/index.d.ts +14 -0
- package/dist/esm/components/form/combo-box-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/combo-box-field/index.js +28 -0
- package/dist/esm/components/form/country-field/index.d.ts +5 -0
- package/dist/esm/components/form/country-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/country-field/index.js +7 -0
- package/dist/esm/components/form/date-picker-field/index.d.ts +21 -0
- package/dist/esm/components/form/date-picker-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/date-picker-field/index.js +38 -0
- package/dist/esm/components/form/date-range-field/index.d.ts +21 -0
- package/dist/esm/components/form/date-range-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/date-range-field/index.js +17 -0
- package/dist/esm/components/form/date-time-picker-field/index.d.ts +23 -0
- package/dist/esm/components/form/date-time-picker-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/date-time-picker-field/index.js +73 -0
- package/dist/esm/components/form/file-upload-field/index.d.ts +52 -0
- package/dist/esm/components/form/file-upload-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/file-upload-field/index.js +60 -0
- package/dist/esm/components/form/index.d.ts +16 -0
- package/dist/esm/components/form/index.d.ts.map +1 -0
- package/dist/esm/components/form/index.js +15 -0
- package/dist/esm/components/form/input-field/index.d.ts +26 -0
- package/dist/esm/components/form/input-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/input-field/index.js +10 -0
- package/dist/esm/components/form/otp-field/index.d.ts +18 -0
- package/dist/esm/components/form/otp-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/otp-field/index.js +15 -0
- package/dist/esm/components/form/pagination-limit-field/index.d.ts +9 -0
- package/dist/esm/components/form/pagination-limit-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/pagination-limit-field/index.js +6 -0
- package/dist/esm/components/form/password-field/index.d.ts +14 -0
- package/dist/esm/components/form/password-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/password-field/index.js +10 -0
- package/dist/esm/components/form/radio-group-field/index.d.ts +32 -0
- package/dist/esm/components/form/radio-group-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/radio-group-field/index.js +32 -0
- package/dist/esm/components/form/renderable-label.d.ts +35 -0
- package/dist/esm/components/form/renderable-label.d.ts.map +1 -0
- package/dist/esm/components/form/renderable-label.js +54 -0
- package/dist/esm/components/form/select-field/index.d.ts +20 -0
- package/dist/esm/components/form/select-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/select-field/index.js +16 -0
- package/dist/esm/components/form/state-field/index.d.ts +10 -0
- package/dist/esm/components/form/state-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/state-field/index.js +35 -0
- package/dist/esm/components/form/switch-field/index.d.ts +15 -0
- package/dist/esm/components/form/switch-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/switch-field/index.js +7 -0
- package/dist/esm/components/form/textarea-field/index.d.ts +31 -0
- package/dist/esm/components/form/textarea-field/index.d.ts.map +1 -0
- package/dist/esm/components/form/textarea-field/index.js +19 -0
- package/dist/esm/components/page/index.d.ts +4 -0
- package/dist/esm/components/page/index.d.ts.map +1 -0
- package/dist/esm/components/page/index.js +11 -0
- package/dist/esm/components/page-header/index.d.ts +33 -0
- package/dist/esm/components/page-header/index.d.ts.map +1 -0
- package/dist/esm/components/page-header/index.js +40 -0
- package/dist/esm/components/pagination/index.d.ts +8 -0
- package/dist/esm/components/pagination/index.d.ts.map +1 -0
- package/dist/esm/components/pagination/index.js +6 -0
- package/dist/esm/components/table/id-table-cell.d.ts +7 -0
- package/dist/esm/components/table/id-table-cell.d.ts.map +1 -0
- package/dist/esm/components/table/id-table-cell.js +12 -0
- package/dist/esm/components/table/index.d.ts +3 -0
- package/dist/esm/components/table/index.d.ts.map +1 -0
- package/dist/esm/components/table/index.js +2 -0
- package/dist/esm/components/table/locked-table-actions.d.ts +7 -0
- package/dist/esm/components/table/locked-table-actions.d.ts.map +1 -0
- package/dist/esm/components/table/locked-table-actions.js +7 -0
- package/dist/esm/components/table/name-table-cell.d.ts +6 -0
- package/dist/esm/components/table/name-table-cell.d.ts.map +1 -0
- package/dist/esm/components/table/name-table-cell.js +6 -0
- package/dist/esm/components/ui/accordion/index.d.ts +14 -0
- package/dist/esm/components/ui/accordion/index.d.ts.map +1 -0
- package/dist/esm/components/ui/accordion/index.js +24 -0
- package/dist/esm/components/ui/alert/index.d.ts +15 -0
- package/dist/esm/components/ui/alert/index.d.ts.map +1 -0
- package/dist/esm/components/ui/alert/index.js +38 -0
- package/dist/esm/components/ui/alert-dialog/index.d.ts +15 -0
- package/dist/esm/components/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/ui/alert-dialog/index.js +39 -0
- package/dist/esm/components/ui/autocomplete/index.d.ts +54 -0
- package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -0
- package/dist/esm/components/ui/autocomplete/index.js +312 -0
- package/dist/esm/components/ui/autosize-textarea/index.d.ts +15 -0
- package/dist/esm/components/ui/autosize-textarea/index.d.ts.map +1 -0
- package/dist/esm/components/ui/autosize-textarea/index.js +51 -0
- package/dist/esm/components/ui/avatar/index.d.ts +7 -0
- package/dist/esm/components/ui/avatar/index.d.ts.map +1 -0
- package/dist/esm/components/ui/avatar/index.js +14 -0
- package/dist/esm/components/ui/badge/index.d.ts +11 -0
- package/dist/esm/components/ui/badge/index.d.ts.map +1 -0
- package/dist/esm/components/ui/badge/index.js +29 -0
- package/dist/esm/components/ui/breadcrumb/index.d.ts +12 -0
- package/dist/esm/components/ui/breadcrumb/index.d.ts.map +1 -0
- package/dist/esm/components/ui/breadcrumb/index.js +27 -0
- package/dist/esm/components/ui/button/index.d.ts +22 -0
- package/dist/esm/components/ui/button/index.d.ts.map +1 -0
- package/dist/esm/components/ui/button/index.js +59 -0
- package/dist/esm/components/ui/calendar/index.d.ts +9 -0
- package/dist/esm/components/ui/calendar/index.d.ts.map +1 -0
- package/dist/esm/components/ui/calendar/index.js +79 -0
- package/dist/esm/components/ui/card/index.d.ts +10 -0
- package/dist/esm/components/ui/card/index.d.ts.map +1 -0
- package/dist/esm/components/ui/card/index.js +24 -0
- package/dist/esm/components/ui/checkbox/index.d.ts +5 -0
- package/dist/esm/components/ui/checkbox/index.d.ts.map +1 -0
- package/dist/esm/components/ui/checkbox/index.js +9 -0
- package/dist/esm/components/ui/collapsible/index.d.ts +6 -0
- package/dist/esm/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/esm/components/ui/collapsible/index.js +13 -0
- package/dist/esm/components/ui/command/index.d.ts +14 -0
- package/dist/esm/components/ui/command/index.d.ts.map +1 -0
- package/dist/esm/components/ui/command/index.js +51 -0
- package/dist/esm/components/ui/copy-field/index.d.ts +56 -0
- package/dist/esm/components/ui/copy-field/index.d.ts.map +1 -0
- package/dist/esm/components/ui/copy-field/index.js +119 -0
- package/dist/esm/components/ui/dialog/index.d.ts +16 -0
- package/dist/esm/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/esm/components/ui/dialog/index.js +36 -0
- package/dist/esm/components/ui/dropdown-menu/index.d.ts +27 -0
- package/dist/esm/components/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/esm/components/ui/dropdown-menu/index.js +57 -0
- package/dist/esm/components/ui/field/index.d.ts +25 -0
- package/dist/esm/components/ui/field/index.d.ts.map +1 -0
- package/dist/esm/components/ui/field/index.js +68 -0
- package/dist/esm/components/ui/file-upload/index.d.ts +94 -0
- package/dist/esm/components/ui/file-upload/index.d.ts.map +1 -0
- package/dist/esm/components/ui/file-upload/index.js +200 -0
- package/dist/esm/components/ui/form.d.ts +39 -0
- package/dist/esm/components/ui/form.d.ts.map +1 -0
- package/dist/esm/components/ui/form.js +67 -0
- package/dist/esm/components/ui/hover-card/index.d.ts +7 -0
- package/dist/esm/components/ui/hover-card/index.d.ts.map +1 -0
- package/dist/esm/components/ui/hover-card/index.js +14 -0
- package/dist/esm/components/ui/icon-button/index.d.ts +13 -0
- package/dist/esm/components/ui/icon-button/index.d.ts.map +1 -0
- package/dist/esm/components/ui/icon-button/index.js +31 -0
- package/dist/esm/components/ui/input/adornment.d.ts +9 -0
- package/dist/esm/components/ui/input/adornment.d.ts.map +1 -0
- package/dist/esm/components/ui/input/adornment.js +17 -0
- package/dist/esm/components/ui/input/index.d.ts +18 -0
- package/dist/esm/components/ui/input/index.d.ts.map +1 -0
- package/dist/esm/components/ui/input/index.js +60 -0
- package/dist/esm/components/ui/label/index.d.ts +7 -0
- package/dist/esm/components/ui/label/index.d.ts.map +1 -0
- package/dist/esm/components/ui/label/index.js +10 -0
- package/dist/esm/components/ui/loading-button/index.d.ts +8 -0
- package/dist/esm/components/ui/loading-button/index.d.ts.map +1 -0
- package/dist/esm/components/ui/loading-button/index.js +7 -0
- package/dist/esm/components/ui/multiple-select/index.d.ts +91 -0
- package/dist/esm/components/ui/multiple-select/index.d.ts.map +1 -0
- package/dist/esm/components/ui/multiple-select/index.js +196 -0
- package/dist/esm/components/ui/otp-input/index.d.ts +13 -0
- package/dist/esm/components/ui/otp-input/index.d.ts.map +1 -0
- package/dist/esm/components/ui/otp-input/index.js +21 -0
- package/dist/esm/components/ui/paper/index.d.ts +4 -0
- package/dist/esm/components/ui/paper/index.d.ts.map +1 -0
- package/dist/esm/components/ui/paper/index.js +5 -0
- package/dist/esm/components/ui/paper-collapsible/index.d.ts +9 -0
- package/dist/esm/components/ui/paper-collapsible/index.d.ts.map +1 -0
- package/dist/esm/components/ui/paper-collapsible/index.js +19 -0
- package/dist/esm/components/ui/popover/index.d.ts +8 -0
- package/dist/esm/components/ui/popover/index.d.ts.map +1 -0
- package/dist/esm/components/ui/popover/index.js +17 -0
- package/dist/esm/components/ui/progress/index.d.ts +8 -0
- package/dist/esm/components/ui/progress/index.d.ts.map +1 -0
- package/dist/esm/components/ui/progress/index.js +8 -0
- package/dist/esm/components/ui/qr-code/index.d.ts +26 -0
- package/dist/esm/components/ui/qr-code/index.d.ts.map +1 -0
- package/dist/esm/components/ui/qr-code/index.js +24 -0
- package/dist/esm/components/ui/radio-group/index.d.ts +6 -0
- package/dist/esm/components/ui/radio-group/index.d.ts.map +1 -0
- package/dist/esm/components/ui/radio-group/index.js +12 -0
- package/dist/esm/components/ui/scroll-area/index.d.ts +6 -0
- package/dist/esm/components/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/esm/components/ui/scroll-area/index.js +13 -0
- package/dist/esm/components/ui/select/index.d.ts +18 -0
- package/dist/esm/components/ui/select/index.d.ts.map +1 -0
- package/dist/esm/components/ui/select/index.js +47 -0
- package/dist/esm/components/ui/separator/index.d.ts +5 -0
- package/dist/esm/components/ui/separator/index.d.ts.map +1 -0
- package/dist/esm/components/ui/separator/index.js +8 -0
- package/dist/esm/components/ui/sheet/index.d.ts +19 -0
- package/dist/esm/components/ui/sheet/index.d.ts.map +1 -0
- package/dist/esm/components/ui/sheet/index.js +59 -0
- package/dist/esm/components/ui/sidebar/index.d.ts +11 -0
- package/dist/esm/components/ui/sidebar/index.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/index.js +10 -0
- package/dist/esm/components/ui/sidebar/next-router.cjs +119 -0
- package/dist/esm/components/ui/sidebar/next-router.d.cts +7 -0
- package/dist/esm/components/ui/sidebar/sidebar-back-button.d.ts +3 -0
- package/dist/esm/components/ui/sidebar/sidebar-back-button.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-back-button.js +5 -0
- package/dist/esm/components/ui/sidebar/sidebar-components.d.ts +23 -0
- package/dist/esm/components/ui/sidebar/sidebar-components.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-components.js +15 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +7 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +12 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-button.d.ts +12 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-button.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-button.js +18 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.d.ts +12 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +44 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.d.ts +12 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +14 -0
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts +13 -0
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-item.js +16 -0
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts +12 -0
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +51 -0
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +3 -0
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-root.js +20 -0
- package/dist/esm/components/ui/sidebar/sidebar-router.d.ts +82 -0
- package/dist/esm/components/ui/sidebar/sidebar-router.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-router.js +89 -0
- package/dist/esm/components/ui/skeleton/index.d.ts +3 -0
- package/dist/esm/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/esm/components/ui/skeleton/index.js +6 -0
- package/dist/esm/components/ui/stepper/index.d.ts +18 -0
- package/dist/esm/components/ui/stepper/index.d.ts.map +1 -0
- package/dist/esm/components/ui/stepper/index.js +20 -0
- package/dist/esm/components/ui/switch/index.d.ts +5 -0
- package/dist/esm/components/ui/switch/index.d.ts.map +1 -0
- package/dist/esm/components/ui/switch/index.js +8 -0
- package/dist/esm/components/ui/table/index.d.ts +21 -0
- package/dist/esm/components/ui/table/index.d.ts.map +1 -0
- package/dist/esm/components/ui/table/index.js +44 -0
- package/dist/esm/components/ui/tabs/index.d.ts +8 -0
- package/dist/esm/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/esm/components/ui/tabs/index.js +17 -0
- package/dist/esm/components/ui/textarea/index.d.ts +4 -0
- package/dist/esm/components/ui/textarea/index.d.ts.map +1 -0
- package/dist/esm/components/ui/textarea/index.js +6 -0
- package/dist/esm/components/ui/time-picker/index.d.ts +18 -0
- package/dist/esm/components/ui/time-picker/index.d.ts.map +1 -0
- package/dist/esm/components/ui/time-picker/index.js +49 -0
- package/dist/esm/components/ui/toast/index.d.ts +18 -0
- package/dist/esm/components/ui/toast/index.d.ts.map +1 -0
- package/dist/esm/components/ui/toast/index.js +2 -0
- package/dist/esm/components/ui/toast/toaster.d.ts +6 -0
- package/dist/esm/components/ui/toast/toaster.d.ts.map +1 -0
- package/dist/esm/components/ui/toast/toaster.js +8 -0
- package/dist/esm/components/ui/toggle-group/index.d.ts +18 -0
- package/dist/esm/components/ui/toggle-group/index.d.ts.map +1 -0
- package/dist/esm/components/ui/toggle-group/index.js +51 -0
- package/dist/esm/components/ui/tooltip/index.d.ts +11 -0
- package/dist/esm/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/esm/components/ui/tooltip/index.js +28 -0
- package/dist/esm/domain/blotter/index.d.ts +40 -0
- package/dist/esm/domain/blotter/index.d.ts.map +1 -0
- package/dist/esm/domain/blotter/index.js +12 -0
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts +57 -0
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts.map +1 -0
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +105 -0
- package/dist/esm/domain/delinquency-aging/index.d.ts +71 -0
- package/dist/esm/domain/delinquency-aging/index.d.ts.map +1 -0
- package/dist/esm/domain/delinquency-aging/index.js +209 -0
- package/dist/esm/domain/figure/index.d.ts +30 -0
- package/dist/esm/domain/figure/index.d.ts.map +1 -0
- package/dist/esm/domain/figure/index.js +14 -0
- package/dist/esm/domain/format.d.ts +79 -0
- package/dist/esm/domain/format.d.ts.map +1 -0
- package/dist/esm/domain/format.js +128 -0
- package/dist/esm/domain/index.d.ts +23 -0
- package/dist/esm/domain/index.d.ts.map +1 -0
- package/dist/esm/domain/index.js +19 -0
- package/dist/esm/domain/key-id/index.d.ts +31 -0
- package/dist/esm/domain/key-id/index.d.ts.map +1 -0
- package/dist/esm/domain/key-id/index.js +169 -0
- package/dist/esm/domain/ledger-sheet/index.d.ts +45 -0
- package/dist/esm/domain/ledger-sheet/index.d.ts.map +1 -0
- package/dist/esm/domain/ledger-sheet/index.js +24 -0
- package/dist/esm/domain/money-diff.d.ts +28 -0
- package/dist/esm/domain/money-diff.d.ts.map +1 -0
- package/dist/esm/domain/money-diff.js +45 -0
- package/dist/esm/domain/money-math.d.ts +32 -0
- package/dist/esm/domain/money-math.d.ts.map +1 -0
- package/dist/esm/domain/money-math.js +98 -0
- package/dist/esm/domain/money-text/index.d.ts +37 -0
- package/dist/esm/domain/money-text/index.d.ts.map +1 -0
- package/dist/esm/domain/money-text/index.js +110 -0
- package/dist/esm/domain/section-label/index.d.ts +21 -0
- package/dist/esm/domain/section-label/index.d.ts.map +1 -0
- package/dist/esm/domain/section-label/index.js +10 -0
- package/dist/esm/domain/status-rail/index.d.ts +40 -0
- package/dist/esm/domain/status-rail/index.d.ts.map +1 -0
- package/dist/esm/domain/status-rail/index.js +67 -0
- package/dist/esm/domain/threshold-gauge/index.d.ts +84 -0
- package/dist/esm/domain/threshold-gauge/index.d.ts.map +1 -0
- package/dist/esm/domain/threshold-gauge/index.js +153 -0
- package/dist/esm/enterprise/alert-banner/index.d.ts +30 -0
- package/dist/esm/enterprise/alert-banner/index.d.ts.map +1 -0
- package/dist/esm/enterprise/alert-banner/index.js +21 -0
- package/dist/esm/enterprise/app-shell/index.d.ts +61 -0
- package/dist/esm/enterprise/app-shell/index.d.ts.map +1 -0
- package/dist/esm/enterprise/app-shell/index.js +51 -0
- package/dist/esm/enterprise/cursor-pager/index.d.ts +21 -0
- package/dist/esm/enterprise/cursor-pager/index.d.ts.map +1 -0
- package/dist/esm/enterprise/cursor-pager/index.js +23 -0
- package/dist/esm/enterprise/data-table/index.d.ts +88 -0
- package/dist/esm/enterprise/data-table/index.d.ts.map +1 -0
- package/dist/esm/enterprise/data-table/index.js +242 -0
- package/dist/esm/enterprise/date-range-picker/index.d.ts +37 -0
- package/dist/esm/enterprise/date-range-picker/index.d.ts.map +1 -0
- package/dist/esm/enterprise/date-range-picker/index.js +89 -0
- package/dist/esm/enterprise/detail-panel/index.d.ts +54 -0
- package/dist/esm/enterprise/detail-panel/index.d.ts.map +1 -0
- package/dist/esm/enterprise/detail-panel/index.js +17 -0
- package/dist/esm/enterprise/empty-state/index.d.ts +32 -0
- package/dist/esm/enterprise/empty-state/index.d.ts.map +1 -0
- package/dist/esm/enterprise/empty-state/index.js +10 -0
- package/dist/esm/enterprise/index.d.ts +26 -0
- package/dist/esm/enterprise/index.d.ts.map +1 -0
- package/dist/esm/enterprise/index.js +22 -0
- package/dist/esm/enterprise/number-input/index.d.ts +55 -0
- package/dist/esm/enterprise/number-input/index.d.ts.map +1 -0
- package/dist/esm/enterprise/number-input/index.js +214 -0
- package/dist/esm/enterprise/search-input/index.d.ts +32 -0
- package/dist/esm/enterprise/search-input/index.d.ts.map +1 -0
- package/dist/esm/enterprise/search-input/index.js +85 -0
- package/dist/esm/enterprise/stat-card/index.d.ts +43 -0
- package/dist/esm/enterprise/stat-card/index.d.ts.map +1 -0
- package/dist/esm/enterprise/stat-card/index.js +64 -0
- package/dist/esm/enterprise/status-badge/index.d.ts +31 -0
- package/dist/esm/enterprise/status-badge/index.d.ts.map +1 -0
- package/dist/esm/enterprise/status-badge/index.js +116 -0
- package/dist/esm/enterprise/use-is-mobile.d.ts +20 -0
- package/dist/esm/enterprise/use-is-mobile.d.ts.map +1 -0
- package/dist/esm/enterprise/use-is-mobile.js +31 -0
- package/dist/esm/enterprise/virtualized-table/index.d.ts +26 -0
- package/dist/esm/enterprise/virtualized-table/index.d.ts.map +1 -0
- package/dist/esm/enterprise/virtualized-table/index.js +111 -0
- package/dist/esm/hooks/use-click-away.d.ts +9 -0
- package/dist/esm/hooks/use-click-away.d.ts.map +1 -0
- package/dist/esm/hooks/use-click-away.js +22 -0
- package/dist/esm/hooks/use-pagination.d.ts +13 -0
- package/dist/esm/hooks/use-pagination.d.ts.map +1 -0
- package/dist/esm/hooks/use-pagination.js +38 -0
- package/dist/esm/hooks/use-stepper.d.ts +11 -0
- package/dist/esm/hooks/use-stepper.d.ts.map +1 -0
- package/dist/esm/hooks/use-stepper.js +22 -0
- package/dist/esm/hooks/use-time.d.ts +6 -0
- package/dist/esm/hooks/use-time.d.ts.map +1 -0
- package/dist/esm/hooks/use-time.js +13 -0
- package/dist/esm/hooks/use-toast.d.ts +31 -0
- package/dist/esm/hooks/use-toast.d.ts.map +1 -0
- package/dist/esm/hooks/use-toast.js +63 -0
- package/dist/esm/index.d.ts +69 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +74 -0
- package/dist/esm/lib/storage/get-storage-object.d.ts +2 -0
- package/dist/esm/lib/storage/get-storage-object.d.ts.map +1 -0
- package/dist/esm/lib/storage/get-storage-object.js +17 -0
- package/dist/esm/lib/storage/get-storage.d.ts +2 -0
- package/dist/esm/lib/storage/get-storage.d.ts.map +1 -0
- package/dist/esm/lib/storage/get-storage.js +14 -0
- package/dist/esm/lib/storage/index.d.ts +3 -0
- package/dist/esm/lib/storage/index.d.ts.map +1 -0
- package/dist/esm/lib/storage/index.js +2 -0
- package/dist/esm/lib/typography.d.ts +17 -0
- package/dist/esm/lib/typography.d.ts.map +1 -0
- package/dist/esm/lib/typography.js +16 -0
- package/dist/esm/lib/utils.d.ts +3 -0
- package/dist/esm/lib/utils.d.ts.map +1 -0
- package/dist/esm/lib/utils.js +5 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/public/countries.json +21210 -0
- package/dist/esm/theme/get-theme-script.d.ts +3 -0
- package/dist/esm/theme/get-theme-script.d.ts.map +1 -0
- package/dist/esm/theme/get-theme-script.js +41 -0
- package/dist/esm/theme/index.d.ts +6 -0
- package/dist/esm/theme/index.d.ts.map +1 -0
- package/dist/esm/theme/index.js +4 -0
- package/dist/esm/theme/mode-toggle.d.ts +25 -0
- package/dist/esm/theme/mode-toggle.d.ts.map +1 -0
- package/dist/esm/theme/mode-toggle.js +45 -0
- package/dist/esm/theme/theme-provider.d.ts +38 -0
- package/dist/esm/theme/theme-provider.d.ts.map +1 -0
- package/dist/esm/theme/theme-provider.js +112 -0
- package/dist/esm/toast/helpers.d.ts +16 -0
- package/dist/esm/toast/helpers.d.ts.map +1 -0
- package/dist/esm/toast/helpers.js +29 -0
- package/dist/esm/toast/index.d.ts +3 -0
- package/dist/esm/toast/index.d.ts.map +1 -0
- package/dist/esm/toast/index.js +4 -0
- package/dist/esm/types/metadata-type.d.ts +2 -0
- package/dist/esm/types/metadata-type.d.ts.map +1 -0
- package/dist/esm/types/metadata-type.js +1 -0
- package/dist/esm/utils/countries.cjs +17 -0
- package/dist/esm/utils/countries.d.cts +14 -0
- package/dist/esm/utils/country-utils.d.ts +17 -0
- package/dist/esm/utils/country-utils.d.ts.map +1 -0
- package/dist/esm/utils/country-utils.js +18 -0
- package/dist/esm/utils/currency-codes.d.ts +5 -0
- package/dist/esm/utils/currency-codes.d.ts.map +1 -0
- package/dist/esm/utils/currency-codes.js +181 -0
- package/dist/globals.css +74 -0
- package/dist/hooks/use-toast.d.ts +1 -1
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +4 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -1
- package/dist/lib/storage/get-storage-object.d.ts.map +1 -1
- package/dist/lib/storage/get-storage-object.js +6 -2
- package/dist/lib/typography.d.ts +17 -0
- package/dist/lib/typography.d.ts.map +1 -0
- package/dist/lib/typography.js +19 -0
- package/dist/public/countries.json +21200 -21200
- package/dist/theme/get-theme-script.d.ts +3 -0
- package/dist/theme/get-theme-script.d.ts.map +1 -0
- package/dist/theme/get-theme-script.js +44 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +11 -0
- package/dist/theme/mode-toggle.d.ts +25 -0
- package/dist/theme/mode-toggle.d.ts.map +1 -0
- package/dist/theme/mode-toggle.js +48 -0
- package/dist/theme/theme-provider.d.ts +38 -0
- package/dist/theme/theme-provider.d.ts.map +1 -0
- package/dist/theme/theme-provider.js +149 -0
- package/dist/toast/helpers.d.ts +16 -0
- package/dist/toast/helpers.d.ts.map +1 -0
- package/dist/toast/helpers.js +34 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.js +10 -0
- package/dist/utils/countries.cjs +17 -0
- package/dist/utils/countries.d.cts +14 -0
- package/dist/utils/country-utils.js +2 -2
- package/package.json +55 -18
- package/dist/components/ui/label/label.stories.d.ts +0 -5
- package/dist/components/ui/label/label.stories.d.ts.map +0 -1
- package/dist/components/ui/label/label.stories.js +0 -24
- package/dist/components/ui/sidebar/sidebar-provider.test.d.ts +0 -2
- package/dist/components/ui/sidebar/sidebar-provider.test.d.ts.map +0 -1
- package/dist/components/ui/sidebar/sidebar-provider.test.js +0 -170
- package/dist/hooks/use-click-away.test.d.ts +0 -2
- package/dist/hooks/use-click-away.test.d.ts.map +0 -1
- package/dist/hooks/use-click-away.test.js +0 -39
- package/dist/hooks/use-stepper.test.d.ts +0 -2
- package/dist/hooks/use-stepper.test.d.ts.map +0 -1
- package/dist/hooks/use-stepper.test.js +0 -45
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.masksByDefault = masksByDefault;
|
|
5
|
+
exports.maskKeyId = maskKeyId;
|
|
6
|
+
exports.KeyId = KeyId;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
/**
|
|
9
|
+
* KeyId — a masked, copyable, traceable identifier for Brazilian rails: a Pix
|
|
10
|
+
* key (CPF / CNPJ / email / phone / EVP-random), an End-to-End id (E2E), an
|
|
11
|
+
* idempotency key, or a generic id.
|
|
12
|
+
*
|
|
13
|
+
* Two jobs at once. PII keys (CPF/CNPJ/email/phone) are masked by default so a
|
|
14
|
+
* shared screen or a screenshot doesn't leak a person's document or contact —
|
|
15
|
+
* the middle of a document is revealed, the identifying head/tail is dotted.
|
|
16
|
+
* Long-but-not-secret ids (EVP/E2E/idempotency/generic) are merely truncated in
|
|
17
|
+
* the MIDDLE so the head and tail — the parts an operator eyeballs against a
|
|
18
|
+
* log — stay legible.
|
|
19
|
+
*
|
|
20
|
+
* <KeyId value="529.982.247-25" kind="pix-cpf" label="Payer" copyable />
|
|
21
|
+
* <KeyId value="E32074158202406211200abc123def456" kind="e2e" copyable />
|
|
22
|
+
*
|
|
23
|
+
* The copy button always lifts the RAW, unmasked value to the clipboard — the
|
|
24
|
+
* mask is a display concern, never a data one. The masked render and the copy
|
|
25
|
+
* affordance are what make this a client component.
|
|
26
|
+
*/
|
|
27
|
+
const lucide_react_1 = require("lucide-react");
|
|
28
|
+
const react_1 = require("react");
|
|
29
|
+
const typography_1 = require("../../lib/typography");
|
|
30
|
+
const utils_1 = require("../../lib/utils");
|
|
31
|
+
/** The dot used to redact a character. A bullet, not an asterisk: it reads as
|
|
32
|
+
* "hidden" without looking like a password field's shouting. */
|
|
33
|
+
const DOT = '•';
|
|
34
|
+
/** Kinds that carry PII and are masked by default. The id-shaped kinds are long
|
|
35
|
+
* but not secret, so they default to revealed (just truncated). */
|
|
36
|
+
const PII_KINDS = new Set([
|
|
37
|
+
'pix-cpf',
|
|
38
|
+
'pix-cnpj',
|
|
39
|
+
'pix-email',
|
|
40
|
+
'pix-phone'
|
|
41
|
+
]);
|
|
42
|
+
/** Whether a kind masks by default (PII) — used when `mask` is not supplied.
|
|
43
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`. */
|
|
44
|
+
function masksByDefault(kind) {
|
|
45
|
+
return PII_KINDS.has(kind);
|
|
46
|
+
}
|
|
47
|
+
/** Keep only the digits — Brazilian documents arrive punctuated or bare. */
|
|
48
|
+
function digitsOf(value) {
|
|
49
|
+
return value.replace(/\D/g, '');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Truncate the MIDDLE of a long value, keeping a head and tail so an operator
|
|
53
|
+
* can eyeball it against a log. Short values are returned whole.
|
|
54
|
+
*/
|
|
55
|
+
function truncateMiddle(value, head = 6, tail = 4) {
|
|
56
|
+
if (value.length <= head + tail + 1)
|
|
57
|
+
return value;
|
|
58
|
+
return `${value.slice(0, head)}…${value.slice(-tail)}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The fallback for a PII value that is MALFORMED for its kind. It must not be
|
|
62
|
+
* `truncateMiddle`: a short malformed value (a CPF missing a digit, a hand-typed
|
|
63
|
+
* document, a name-shaped email that failed the `@` check) is returned WHOLE by
|
|
64
|
+
* truncation, so the "masked" render leaks the very PII the mask exists to hide.
|
|
65
|
+
* A fixed-width dot run reveals nothing — not the content, not even the length.
|
|
66
|
+
*
|
|
67
|
+
* DELIBERATE DIVERGENCE from sindarian-x@0.15.0, which truncated instead. It
|
|
68
|
+
* costs the operator the ability to eyeball a malformed document against a log;
|
|
69
|
+
* that is the correct trade, because the alternative is a screenshot with a real
|
|
70
|
+
* CPF in it. An operator who needs the value passes `mask={false}` explicitly.
|
|
71
|
+
*/
|
|
72
|
+
function redactPii() {
|
|
73
|
+
return DOT.repeat(6);
|
|
74
|
+
}
|
|
75
|
+
/** Mask all but the central block of a digit string, then re-punctuate it. */
|
|
76
|
+
function maskCpf(value) {
|
|
77
|
+
const d = digitsOf(value);
|
|
78
|
+
if (d.length !== 11)
|
|
79
|
+
return redactPii();
|
|
80
|
+
// Reveal the middle two blocks (456.789), dot the leading block and check digits.
|
|
81
|
+
return `${DOT.repeat(3)}.${d.slice(3, 6)}.${d.slice(6, 9)}-${DOT.repeat(2)}`;
|
|
82
|
+
}
|
|
83
|
+
function maskCnpj(value) {
|
|
84
|
+
const d = digitsOf(value);
|
|
85
|
+
if (d.length !== 14)
|
|
86
|
+
return redactPii();
|
|
87
|
+
// Reveal the central registration blocks, dot the head and the check digits.
|
|
88
|
+
return `${DOT.repeat(2)}.${d.slice(2, 5)}.${d.slice(5, 8)}/${d.slice(8, 12)}-${DOT.repeat(2)}`;
|
|
89
|
+
}
|
|
90
|
+
function maskEmail(value) {
|
|
91
|
+
const at = value.indexOf('@');
|
|
92
|
+
if (at <= 0 || at === value.length - 1)
|
|
93
|
+
return redactPii();
|
|
94
|
+
// EXACTLY one '@', or it is not an address and the domain half cannot be
|
|
95
|
+
// trusted to be a domain. `a@private@domain.test` split on the FIRST '@' and
|
|
96
|
+
// published `private@domain.test` verbatim as the "domain" — the local part of
|
|
97
|
+
// a second address, revealed in a view whose whole purpose is to hide it.
|
|
98
|
+
// Malformed PII redacts, exactly like a wrong-length CPF.
|
|
99
|
+
if (value.indexOf('@', at + 1) !== -1)
|
|
100
|
+
return redactPii();
|
|
101
|
+
const first = value.slice(0, 1);
|
|
102
|
+
const domain = value.slice(at + 1);
|
|
103
|
+
return `${first}${DOT.repeat(3)}@${domain}`;
|
|
104
|
+
}
|
|
105
|
+
function maskPhone(value) {
|
|
106
|
+
const d = digitsOf(value);
|
|
107
|
+
// Expect a BR mobile in E.164-ish form: 55 + 2-digit area + 9 subscriber digits.
|
|
108
|
+
if (d.length !== 13 || !d.startsWith('55'))
|
|
109
|
+
return redactPii();
|
|
110
|
+
const area = d.slice(2, 4);
|
|
111
|
+
const last2 = d.slice(-2);
|
|
112
|
+
// Keep country + area, reveal the last two, dot the rest of the subscriber run.
|
|
113
|
+
return `+55 (${area}) ${DOT.repeat(5)}-${DOT.repeat(2)}${last2}`;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Mask a key for display. PII kinds get a structured mask that reveals a
|
|
117
|
+
* non-identifying middle and dots the rest; a value MALFORMED for its kind is
|
|
118
|
+
* redacted outright (see `redactPii`) rather than truncated, so a mask can never
|
|
119
|
+
* fall through to the raw secret. Id-shaped kinds are always middle-truncated
|
|
120
|
+
* (long, not secret). The copy path never uses this — it always sends the raw
|
|
121
|
+
* value.
|
|
122
|
+
*
|
|
123
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`.
|
|
124
|
+
*/
|
|
125
|
+
function maskKeyId(value, kind) {
|
|
126
|
+
switch (kind) {
|
|
127
|
+
case 'pix-cpf':
|
|
128
|
+
return maskCpf(value);
|
|
129
|
+
case 'pix-cnpj':
|
|
130
|
+
return maskCnpj(value);
|
|
131
|
+
case 'pix-email':
|
|
132
|
+
return maskEmail(value);
|
|
133
|
+
case 'pix-phone':
|
|
134
|
+
return maskPhone(value);
|
|
135
|
+
default:
|
|
136
|
+
return truncateMiddle(value);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function KeyId({ value, kind = 'generic', label, mask, copyable = false, className }) {
|
|
140
|
+
const masked = mask ?? masksByDefault(kind);
|
|
141
|
+
const display = masked ? maskKeyId(value, kind) : truncateMiddle(value);
|
|
142
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)('inline-flex min-w-0 items-center gap-2', className), children: [label ? ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(typography_1.LABEL_VOICE_CLASS, 'shrink-0'), children: label })) : null, (0, jsx_runtime_1.jsx)("span", { className: "text-foreground truncate font-mono text-xs tabular-nums",
|
|
143
|
+
// The raw value as a tooltip only when nothing is hidden — never leak a
|
|
144
|
+
// masked PII value through the title attribute.
|
|
145
|
+
title: masked ? undefined : value, children: display }), copyable ? (0, jsx_runtime_1.jsx)(CopyValue, { value: value }) : null] }));
|
|
146
|
+
}
|
|
147
|
+
/** The copy affordance: lifts the RAW value to the clipboard and flips to a
|
|
148
|
+
* check for a beat. The transient confirmation is announced for assistive tech;
|
|
149
|
+
* the icon is paired with a text aria-label so the state isn't color-only. */
|
|
150
|
+
function CopyValue({ value }) {
|
|
151
|
+
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
152
|
+
const copy = () => {
|
|
153
|
+
// ponytail: best-effort clipboard write — no toast, no error surface. The
|
|
154
|
+
// ceiling is silent failure in an insecure context (clipboard unavailable);
|
|
155
|
+
// upgrade path is to lift a result up via an onCopy callback when a caller
|
|
156
|
+
// needs to react.
|
|
157
|
+
//
|
|
158
|
+
// The rejection handler is NOT optional: `writeText` rejects on a denied
|
|
159
|
+
// permission or a non-secure context, and an unhandled rejection in a render
|
|
160
|
+
// tree is a console error at best and a crashed handler at worst. On failure
|
|
161
|
+
// the button simply does not flip to the copied state, so the operator sees
|
|
162
|
+
// that nothing was copied rather than a false confirmation.
|
|
163
|
+
void navigator.clipboard
|
|
164
|
+
?.writeText(value)
|
|
165
|
+
.then(() => {
|
|
166
|
+
setCopied(true);
|
|
167
|
+
setTimeout(() => setCopied(false), 1500);
|
|
168
|
+
})
|
|
169
|
+
.catch(() => {
|
|
170
|
+
setCopied(false);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: copy, "aria-label": copied ? 'Copiado para a área de transferência' : 'Copiar valor', className: "text-muted-foreground hover:text-foreground focus:ring-ring inline-flex size-5 shrink-0 items-center justify-center rounded-sm transition-colors duration-150 ease-out focus:ring-2 focus:outline-none", children: copied ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Check, { "aria-hidden": true, className: "text-system-success size-3" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { "aria-hidden": true, className: "size-3" })) }));
|
|
174
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LedgerSheet + LedgerPanel — the connected-cell layout of the console.
|
|
3
|
+
*
|
|
4
|
+
* Do NOT float hairline cards in whitespace. Build connected sheets: a
|
|
5
|
+
* `bg-border` wrapper with `gap-px`, cells `bg-card`. The 1px gaps reveal the
|
|
6
|
+
* border color as hairline seams, so the panels read as one ruled ledger sheet.
|
|
7
|
+
*
|
|
8
|
+
* <LedgerSheet cols={3}>
|
|
9
|
+
* <LedgerPanel>…</LedgerPanel>
|
|
10
|
+
* <LedgerPanel>…</LedgerPanel>
|
|
11
|
+
* <LedgerPanel>…</LedgerPanel>
|
|
12
|
+
* </LedgerSheet>
|
|
13
|
+
*
|
|
14
|
+
* The `cols` prop drives the responsive column count; on mobile every sheet
|
|
15
|
+
* collapses to a single column. When a panel self-hides, pass the reduced
|
|
16
|
+
* `cols` so the remaining panels stretch (e.g. 3 → 2 when a panel returns null).
|
|
17
|
+
*/
|
|
18
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
19
|
+
/** Desktop column count. Only 1..4 are mapped (Tailwind needs literal class names). */
|
|
20
|
+
type Cols = 1 | 2 | 3 | 4;
|
|
21
|
+
export type LedgerSheetProps = {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
/** Desktop column count (1..4). Mobile always collapses to a single column. */
|
|
24
|
+
cols?: Cols;
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function LedgerSheet({ children, cols, className }: LedgerSheetProps): import("react").JSX.Element;
|
|
28
|
+
export type LedgerPanelProps = {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Render element. Defaults to `section` (a labeled console panel). */
|
|
32
|
+
as?: 'section' | 'div';
|
|
33
|
+
} & Omit<ComponentPropsWithoutRef<'section'>, 'children' | 'className'>;
|
|
34
|
+
/**
|
|
35
|
+
* One cell of a ledger sheet. Flush — no own border or shadow — with `bg-card`,
|
|
36
|
+
* internal `p-5` padding and `flex h-full flex-col gap-4` so panels stretch to
|
|
37
|
+
* equal height. Start each panel with a `<SectionLabel>` as its heading.
|
|
38
|
+
*
|
|
39
|
+
* Remaining props land on the rendered element, so a composed panel can carry
|
|
40
|
+
* its own `data-*` hooks (StatCard's `data-tone`, for one) without wrapping the
|
|
41
|
+
* cell in an extra div that would break the hairline seams.
|
|
42
|
+
*/
|
|
43
|
+
export declare function LedgerPanel({ children, className, as: Tag, ...rest }: LedgerPanelProps): import("react").JSX.Element;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/ledger-sheet/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIhE,uFAAuF;AACvF,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAUzB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAQ,EACR,SAAS,EACV,EAAE,gBAAgB,+BAYlB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,EAAE,CAAC,EAAE,SAAS,GAAG,KAAK,CAAA;CACvB,GAAG,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,CAAA;AAEvE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,EAAE,EAAE,GAAe,EACnB,GAAG,IAAI,EACR,EAAE,gBAAgB,+BASlB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LedgerSheet = LedgerSheet;
|
|
4
|
+
exports.LedgerPanel = LedgerPanel;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const utils_1 = require("../../lib/utils");
|
|
7
|
+
/** Tailwind needs literal class names to survive purge; map cols → class. */
|
|
8
|
+
const COLS_CLASS = {
|
|
9
|
+
1: 'lg:grid-cols-1',
|
|
10
|
+
2: 'lg:grid-cols-2',
|
|
11
|
+
3: 'lg:grid-cols-3',
|
|
12
|
+
4: 'lg:grid-cols-4'
|
|
13
|
+
};
|
|
14
|
+
function LedgerSheet({ children, cols = 1, className }) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)('border-border bg-border grid grid-cols-1 gap-px overflow-hidden rounded-lg border', COLS_CLASS[cols] ?? COLS_CLASS[1], className), children: children }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One cell of a ledger sheet. Flush — no own border or shadow — with `bg-card`,
|
|
19
|
+
* internal `p-5` padding and `flex h-full flex-col gap-4` so panels stretch to
|
|
20
|
+
* equal height. Start each panel with a `<SectionLabel>` as its heading.
|
|
21
|
+
*
|
|
22
|
+
* Remaining props land on the rendered element, so a composed panel can carry
|
|
23
|
+
* its own `data-*` hooks (StatCard's `data-tone`, for one) without wrapping the
|
|
24
|
+
* cell in an extra div that would break the hairline seams.
|
|
25
|
+
*/
|
|
26
|
+
function LedgerPanel({ children, className, as: Tag = 'section', ...rest }) {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(Tag, { className: (0, utils_1.cn)('bg-card flex h-full flex-col gap-4 p-5', className), ...rest, children: children }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Amount } from './money-math';
|
|
2
|
+
/** The money-comparison contract: two sides, a currency, an optional tolerance.
|
|
3
|
+
* Exported so a consumer can name the argument type it is already passing. */
|
|
4
|
+
export type MoneyDiffInput = {
|
|
5
|
+
/** Left amount (canonical decimal string preferred for lossless math). */
|
|
6
|
+
left: Amount;
|
|
7
|
+
/** Right amount. The difference is left − right. */
|
|
8
|
+
right: Amount;
|
|
9
|
+
/** ISO 4217 currency code, e.g. "BRL". Drives the minor-unit scale. */
|
|
10
|
+
currency: string;
|
|
11
|
+
/** Override the currency-derived minor-unit scale. When omitted, the scale
|
|
12
|
+
* derives from the currency (2 for an unknown one), never a hardcoded 2. */
|
|
13
|
+
minorDigits?: number;
|
|
14
|
+
/** Absolute tolerance in MAJOR units. `|left − right| > tolerance` is a breach. */
|
|
15
|
+
tolerance?: Amount;
|
|
16
|
+
/** BCP 47 locale. CURRENTLY UNUSED: `moneyDiff` returns `{ decimal, breach }`
|
|
17
|
+
* and formats nothing, so this value has no effect on the result. It stays in
|
|
18
|
+
* the contract because removing it would break every consumer that passes it
|
|
19
|
+
* (an object literal with an unknown member is an excess-property error), and
|
|
20
|
+
* because the formatting side of the pair — `MoneyText` — takes a locale of
|
|
21
|
+
* its own. Pass the locale THERE, at the point the figure is rendered. */
|
|
22
|
+
locale?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function moneyDiff(money: MoneyDiffInput): {
|
|
25
|
+
decimal: string | null;
|
|
26
|
+
breach: boolean;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=money-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-diff.d.ts","sourceRoot":"","sources":["../../src/domain/money-diff.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;+EAC+E;AAC/E,MAAM,MAAM,cAAc,GAAG;IAC3B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB;iFAC6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;+EAK2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG;IAChD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,OAAO,CAAA;CAChB,CA6BA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moneyDiff = moneyDiff;
|
|
4
|
+
/**
|
|
5
|
+
* moneyDiff — the signed difference between two reconciliation sides, computed
|
|
6
|
+
* on integer minor units and never on floats.
|
|
7
|
+
*
|
|
8
|
+
* THIRD RAIL (money): `left − right` runs through `toMinor` on both operands →
|
|
9
|
+
* BigInt subtraction → `minorToDecimal`, and the tolerance breach test compares
|
|
10
|
+
* MAGNITUDES in minor units. A float subtraction of two decimals would drift by
|
|
11
|
+
* a cent at reconciliation scale, which is the difference between a matched and
|
|
12
|
+
* an unmatched pair.
|
|
13
|
+
*
|
|
14
|
+
* A null `decimal` means an unparseable operand — surfaced, never coerced to
|
|
15
|
+
* zero, so a caller renders the no-value placeholder rather than a fabricated
|
|
16
|
+
* tie.
|
|
17
|
+
*/
|
|
18
|
+
const money_math_1 = require("./money-math");
|
|
19
|
+
function moneyDiff(money) {
|
|
20
|
+
const scale = money.minorDigits ?? (0, money_math_1.minorDigitsOf)(money.currency);
|
|
21
|
+
const l = (0, money_math_1.toMinor)(money.left, scale);
|
|
22
|
+
const r = (0, money_math_1.toMinor)(money.right, scale);
|
|
23
|
+
if (l === null || r === null)
|
|
24
|
+
return { decimal: null, breach: false };
|
|
25
|
+
const diff = l - r;
|
|
26
|
+
// A tolerance that was SUPPLIED but does not parse ('', 'oops', '-.') is not
|
|
27
|
+
// the same thing as no tolerance at all. Degrading to the no-tolerance rule
|
|
28
|
+
// made every nonzero difference a breach, so one typo in a tolerance field
|
|
29
|
+
// turned a reconciled book into a screen of false breaches — the loudest
|
|
30
|
+
// possible wrong answer. A supplied-invalid tolerance is INDETERMINATE,
|
|
31
|
+
// exactly like an unparseable operand: no number, no verdict.
|
|
32
|
+
const supplied = money.tolerance != null;
|
|
33
|
+
const rawTol = supplied ? (0, money_math_1.toMinor)(money.tolerance, scale) : null;
|
|
34
|
+
if (supplied && rawTol === null)
|
|
35
|
+
return { decimal: null, breach: false };
|
|
36
|
+
// A tolerance is a BAND WIDTH, so only its magnitude is meaningful. Taken
|
|
37
|
+
// signed, a negative tolerance made `|diff| > tol` true for every value
|
|
38
|
+
// including an exact tie (0n > -5n), flagging perfectly reconciled pairs as
|
|
39
|
+
// breaches. Normalizing to the magnitude means `-0.05` and `0.05` describe the
|
|
40
|
+
// same band, which is the only reading of a negative tolerance that is not a
|
|
41
|
+
// silent false alarm.
|
|
42
|
+
const tol = rawTol === null ? null : rawTol < 0n ? -rawTol : rawTol;
|
|
43
|
+
const abs = diff < 0n ? -diff : diff;
|
|
44
|
+
// A breach is a magnitude STRICTLY beyond the band; no tolerance → no band, so
|
|
45
|
+
// any nonzero difference is itself the breach.
|
|
46
|
+
const breach = tol === null ? diff !== 0n : abs > tol;
|
|
47
|
+
return { decimal: (0, money_math_1.minorToDecimal)(diff, scale), breach };
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* money-math — exact integer-minor-unit arithmetic for the double-entry third rail.
|
|
3
|
+
*
|
|
4
|
+
* INTERNAL to the domain layer: nothing here is re-exported from
|
|
5
|
+
* `src/domain/index.ts`, so `toMinor`/`Amount`/`sumMinor` are NOT part of
|
|
6
|
+
* `@lerianstudio/sindarian-ui`'s public API. The consumers that need exact money
|
|
7
|
+
* arithmetic reach it through the components that own it (`moneyDiff`,
|
|
8
|
+
* `MoneyText`, `DelinquencyAging`).
|
|
9
|
+
*
|
|
10
|
+
* Amounts parse to integer minor units (BigInt) at a fixed scale; sums never
|
|
11
|
+
* round-trip through IEEE-754. Pass amounts as canonical decimal STRINGS for
|
|
12
|
+
* lossless math — numbers are converted via toFixed, which is float-bounded
|
|
13
|
+
* (fine for display-scale magnitudes, exact for strings).
|
|
14
|
+
*/
|
|
15
|
+
export type Amount = string | number | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Amount -> integer minor units at `scale`, or null if unparseable.
|
|
18
|
+
*
|
|
19
|
+
* `scale` is validated before it reaches `toFixed`/`repeat`: an out-of-range
|
|
20
|
+
* scale (a caller passing `minorDigits: -1`) would throw a RangeError mid-render
|
|
21
|
+
* rather than degrade. It is the single choke point every money path in this
|
|
22
|
+
* layer routes through (`sumMinor`, `moneyDiff`, `delinquencyRate`,
|
|
23
|
+
* `sumBucketTotals`), so guarding it here guards all of them.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toMinor(value: Amount, scale: number): bigint | null;
|
|
26
|
+
/** Sum amounts to minor units; null if ANY operand is unparseable (indeterminate). */
|
|
27
|
+
export declare function sumMinor(values: Amount[], scale: number): bigint | null;
|
|
28
|
+
/** Currency's minor-unit digit count via CLDR (BRL/USD->2, JPY->0, BHD->3), or fallback. */
|
|
29
|
+
export declare function minorDigitsOf(currency: string, fallback?: number): number;
|
|
30
|
+
/** Minor units -> canonical decimal string (lossless), for handing to MoneyText. */
|
|
31
|
+
export declare function minorToDecimal(minor: bigint, scale: number): string;
|
|
32
|
+
//# sourceMappingURL=money-math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-math.d.ts","sourceRoot":"","sources":["../../src/domain/money-math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAcvD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBnE;AAED,sFAAsF;AACtF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQvE;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAWpE;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMnE"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* money-math — exact integer-minor-unit arithmetic for the double-entry third rail.
|
|
4
|
+
*
|
|
5
|
+
* INTERNAL to the domain layer: nothing here is re-exported from
|
|
6
|
+
* `src/domain/index.ts`, so `toMinor`/`Amount`/`sumMinor` are NOT part of
|
|
7
|
+
* `@lerianstudio/sindarian-ui`'s public API. The consumers that need exact money
|
|
8
|
+
* arithmetic reach it through the components that own it (`moneyDiff`,
|
|
9
|
+
* `MoneyText`, `DelinquencyAging`).
|
|
10
|
+
*
|
|
11
|
+
* Amounts parse to integer minor units (BigInt) at a fixed scale; sums never
|
|
12
|
+
* round-trip through IEEE-754. Pass amounts as canonical decimal STRINGS for
|
|
13
|
+
* lossless math — numbers are converted via toFixed, which is float-bounded
|
|
14
|
+
* (fine for display-scale magnitudes, exact for strings).
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.toMinor = toMinor;
|
|
18
|
+
exports.sumMinor = sumMinor;
|
|
19
|
+
exports.minorDigitsOf = minorDigitsOf;
|
|
20
|
+
exports.minorToDecimal = minorToDecimal;
|
|
21
|
+
const format_1 = require("./format");
|
|
22
|
+
// Round half-away-from-zero on the first dropped fraction digit.
|
|
23
|
+
function roundsUp(fraction, scale) {
|
|
24
|
+
return fraction.length > scale && fraction.charCodeAt(scale) - 48 >= 5;
|
|
25
|
+
}
|
|
26
|
+
/** Normalize to a canonical signed decimal: trim, unicode-minus, accounting parens. */
|
|
27
|
+
function canonical(raw) {
|
|
28
|
+
let s = raw.trim().replace(/−/g, '-');
|
|
29
|
+
if (/^\(.*\)$/.test(s))
|
|
30
|
+
s = '-' + s.slice(1, -1).trim(); // (1.23) -> -1.23
|
|
31
|
+
return s;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Amount -> integer minor units at `scale`, or null if unparseable.
|
|
35
|
+
*
|
|
36
|
+
* `scale` is validated before it reaches `toFixed`/`repeat`: an out-of-range
|
|
37
|
+
* scale (a caller passing `minorDigits: -1`) would throw a RangeError mid-render
|
|
38
|
+
* rather than degrade. It is the single choke point every money path in this
|
|
39
|
+
* layer routes through (`sumMinor`, `moneyDiff`, `delinquencyRate`,
|
|
40
|
+
* `sumBucketTotals`), so guarding it here guards all of them.
|
|
41
|
+
*/
|
|
42
|
+
function toMinor(value, scale) {
|
|
43
|
+
if (!(0, format_1.isValidDigitCount)(scale))
|
|
44
|
+
return null;
|
|
45
|
+
if (value === null || value === undefined || value === '')
|
|
46
|
+
return null;
|
|
47
|
+
let s = typeof value === 'number'
|
|
48
|
+
? Number.isFinite(value)
|
|
49
|
+
? value.toFixed(scale)
|
|
50
|
+
: ''
|
|
51
|
+
: canonical(value);
|
|
52
|
+
if (s === '' || s === '-' || s === '.' || !/^-?\d*(\.\d*)?$/.test(s))
|
|
53
|
+
return null;
|
|
54
|
+
const neg = s.startsWith('-');
|
|
55
|
+
if (neg)
|
|
56
|
+
s = s.slice(1);
|
|
57
|
+
const [intPart = '', fracPart = ''] = s.split('.');
|
|
58
|
+
// DELIBERATE DIVERGENCE from sindarian-x@0.15.0: the legacy regex admits a
|
|
59
|
+
// digitless token ('-.', and '.' once the sign is stripped) and coerced it to
|
|
60
|
+
// an exact 0n. A fabricated exact zero is the worst possible answer in
|
|
61
|
+
// reconciliation — it reads as a perfect tie and hides the bad input — so a
|
|
62
|
+
// digitless amount is now indeterminate (null), like every other garbage
|
|
63
|
+
// token. This mirrors the guard the legacy `rateFraction` already had.
|
|
64
|
+
if (intPart === '' && fracPart === '')
|
|
65
|
+
return null;
|
|
66
|
+
const frac = (fracPart + '0'.repeat(scale)).slice(0, scale);
|
|
67
|
+
let minor = BigInt((intPart || '0') + frac);
|
|
68
|
+
if (roundsUp(fracPart, scale))
|
|
69
|
+
minor += 1n;
|
|
70
|
+
return neg ? -minor : minor;
|
|
71
|
+
}
|
|
72
|
+
/** Sum amounts to minor units; null if ANY operand is unparseable (indeterminate). */
|
|
73
|
+
function sumMinor(values, scale) {
|
|
74
|
+
let total = 0n;
|
|
75
|
+
for (const v of values) {
|
|
76
|
+
const m = toMinor(v, scale);
|
|
77
|
+
if (m === null)
|
|
78
|
+
return null;
|
|
79
|
+
total += m;
|
|
80
|
+
}
|
|
81
|
+
return total;
|
|
82
|
+
}
|
|
83
|
+
/** Currency's minor-unit digit count via CLDR (BRL/USD->2, JPY->0, BHD->3), or fallback. */
|
|
84
|
+
function minorDigitsOf(currency, fallback = 2) {
|
|
85
|
+
try {
|
|
86
|
+
const opts = new Intl.NumberFormat('en', {
|
|
87
|
+
style: 'currency',
|
|
88
|
+
currency,
|
|
89
|
+
currencyDisplay: 'code'
|
|
90
|
+
}).resolvedOptions();
|
|
91
|
+
return opts.maximumFractionDigits ?? fallback;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return fallback;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** Minor units -> canonical decimal string (lossless), for handing to MoneyText. */
|
|
98
|
+
function minorToDecimal(minor, scale) {
|
|
99
|
+
const neg = minor < 0n;
|
|
100
|
+
const abs = (neg ? -minor : minor).toString().padStart(scale + 1, '0');
|
|
101
|
+
const intPart = abs.slice(0, abs.length - scale) || '0';
|
|
102
|
+
const fracPart = scale > 0 ? '.' + abs.slice(abs.length - scale) : '';
|
|
103
|
+
return (neg ? '-' : '') + intPart + fracPart;
|
|
104
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type MoneyTextProps = {
|
|
2
|
+
amount: string | number | null | undefined;
|
|
3
|
+
/** ISO 4217 currency code, e.g. "BRL", "USD". */
|
|
4
|
+
currency?: string | null;
|
|
5
|
+
/** Number of fraction digits. Defaults to 2. */
|
|
6
|
+
fractionDigits?: number;
|
|
7
|
+
/** Hide the trailing currency code. */
|
|
8
|
+
hideCurrency?: boolean;
|
|
9
|
+
/** Color negative values red. Defaults to true. */
|
|
10
|
+
signColor?: boolean;
|
|
11
|
+
/** BCP 47 locale for grouping/decimal marks. Defaults to the runtime locale. */
|
|
12
|
+
locale?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Normalize a raw amount into a string the Intl formatter accepts while
|
|
17
|
+
* preserving precision: trim, convert the unicode minus U+2212 to ASCII '-',
|
|
18
|
+
* and rewrite accounting parens `(123.45)` → `-123.45`. Returns null when the
|
|
19
|
+
* input is empty after trimming (→ NO_VALUE upstream).
|
|
20
|
+
*
|
|
21
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeAmount(amount: string | number): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Pure money formatting: normalize the amount, format it via Intl (preserving
|
|
26
|
+
* precision through the ES2020 string overload), and derive sign + finiteness
|
|
27
|
+
* from the formatted parts — so color and glyph can never disagree. Returns
|
|
28
|
+
* null for empty, non-finite, or unparseable input (→ NO_VALUE upstream).
|
|
29
|
+
*
|
|
30
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatMoneyParts(amount: string | number, fractionDigits: number, locale?: string): {
|
|
33
|
+
formatted: string;
|
|
34
|
+
negative: boolean;
|
|
35
|
+
} | null;
|
|
36
|
+
export declare function MoneyText({ amount, currency, fractionDigits, hideCurrency, signColor, locale, className }: MoneyTextProps): import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/money-text/index.tsx"],"names":[],"mappings":"AAwBA,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAC1C,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAOtE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,cAAc,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,MAAM,GACd;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAiDjD;AAED,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAQ,EACR,cAAkB,EAClB,YAAoB,EACpB,SAAgB,EAChB,MAAM,EACN,SAAS,EACV,EAAE,cAAc,+BA8BhB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAmount = normalizeAmount;
|
|
4
|
+
exports.formatMoneyParts = formatMoneyParts;
|
|
5
|
+
exports.MoneyText = MoneyText;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* MoneyText renders a monetary amount with optional ISO currency code,
|
|
9
|
+
* tabular figures so columns line up. The amount is formatted losslessly: when
|
|
10
|
+
* passed as a string, `Intl.NumberFormat.format()` (ES2020+) parses it as an
|
|
11
|
+
* arbitrary-precision value and rounds to `fractionDigits` without ever
|
|
12
|
+
* round-tripping through an IEEE-754 double — so 16+ significant-digit tokens
|
|
13
|
+
* keep every digit. Pass the raw decimal string (not a pre-coerced Number) to
|
|
14
|
+
* preserve that guarantee.
|
|
15
|
+
*
|
|
16
|
+
* The currency code is shown as a suffix rather than a symbol so mixed-currency
|
|
17
|
+
* ledgers stay unambiguous. Negative amounts get the destructive color;
|
|
18
|
+
* null/undefined/empty render the muted no-value placeholder.
|
|
19
|
+
*
|
|
20
|
+
* SIGN COLOR IS NOT THE CREDIT ROLE. `--destructive` marks a negative/alarm
|
|
21
|
+
* amount; `--credit` is the accounting reading of a credit amount. They are two
|
|
22
|
+
* roles, and a consumer layers the credit role on top (matcher's fork passes
|
|
23
|
+
* `signColor={false}` with `tone="credit"` precisely so the two never fight).
|
|
24
|
+
* Collapsing the sign color into `text-credit` would erase that distinction —
|
|
25
|
+
* this class stays `text-destructive`, as in sindarian-x@0.15.0.
|
|
26
|
+
*/
|
|
27
|
+
const utils_1 = require("../../lib/utils");
|
|
28
|
+
const format_1 = require("../format");
|
|
29
|
+
/**
|
|
30
|
+
* Normalize a raw amount into a string the Intl formatter accepts while
|
|
31
|
+
* preserving precision: trim, convert the unicode minus U+2212 to ASCII '-',
|
|
32
|
+
* and rewrite accounting parens `(123.45)` → `-123.45`. Returns null when the
|
|
33
|
+
* input is empty after trimming (→ NO_VALUE upstream).
|
|
34
|
+
*
|
|
35
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`.
|
|
36
|
+
*/
|
|
37
|
+
function normalizeAmount(amount) {
|
|
38
|
+
let s = String(amount).trim();
|
|
39
|
+
if (s === '')
|
|
40
|
+
return null;
|
|
41
|
+
s = s.replace(/−/g, '-');
|
|
42
|
+
const parens = s.match(/^\((.*)\)$/);
|
|
43
|
+
if (parens)
|
|
44
|
+
s = `-${parens[1].trim()}`;
|
|
45
|
+
return s;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Pure money formatting: normalize the amount, format it via Intl (preserving
|
|
49
|
+
* precision through the ES2020 string overload), and derive sign + finiteness
|
|
50
|
+
* from the formatted parts — so color and glyph can never disagree. Returns
|
|
51
|
+
* null for empty, non-finite, or unparseable input (→ NO_VALUE upstream).
|
|
52
|
+
*
|
|
53
|
+
* Internal: exported for its unit tests, never from `src/domain/index.ts`.
|
|
54
|
+
*/
|
|
55
|
+
function formatMoneyParts(amount, fractionDigits, locale) {
|
|
56
|
+
// Reject non-finite numeric inputs (NaN / ±Infinity) before they reach Intl,
|
|
57
|
+
// which would otherwise render literal "NaN" / "∞".
|
|
58
|
+
if (typeof amount === 'number' && !Number.isFinite(amount))
|
|
59
|
+
return null;
|
|
60
|
+
// A caller-supplied digit count reaches Intl directly; an out-of-range one
|
|
61
|
+
// would throw a RangeError and blank the amount instead of degrading to
|
|
62
|
+
// NO_VALUE.
|
|
63
|
+
if (!(0, format_1.isValidDigitCount)(fractionDigits))
|
|
64
|
+
return null;
|
|
65
|
+
const normalized = normalizeAmount(amount);
|
|
66
|
+
if (normalized === null)
|
|
67
|
+
return null;
|
|
68
|
+
// DELIBERATE DIVERGENCE from sindarian-x@0.15.0: an exact zero written with a
|
|
69
|
+
// sign ('-0', '-0.00', '(0)') formatted as "-0.00" and reported negative:true,
|
|
70
|
+
// which painted a zero balance in the destructive sign color. Zero is neither
|
|
71
|
+
// positive nor negative — a signed-zero ledger cell is a rendering artifact of
|
|
72
|
+
// the input notation, never a fact about the money. The sign is dropped for an
|
|
73
|
+
// EXACT zero only; '-0.004' still rounds to "-0.00" and stays negative,
|
|
74
|
+
// because that one really is below zero.
|
|
75
|
+
const exactZero = /\d/.test(normalized) && /^-?0*(\.0*)?$/.test(normalized);
|
|
76
|
+
const forFormat = exactZero ? normalized.replace(/^-/, '') : normalized;
|
|
77
|
+
// A malformed tag would throw a RangeError out of this constructor and take
|
|
78
|
+
// the whole amount down; degrade to the runtime locale instead.
|
|
79
|
+
const formatter = new Intl.NumberFormat((0, format_1.safeLocale)(locale), {
|
|
80
|
+
minimumFractionDigits: fractionDigits,
|
|
81
|
+
maximumFractionDigits: fractionDigits,
|
|
82
|
+
signDisplay: 'auto'
|
|
83
|
+
});
|
|
84
|
+
// The bundled lib types only model a `number | bigint` overload; the ES2020
|
|
85
|
+
// string overload (which preserves precision) is unmodelled, so the
|
|
86
|
+
// normalized amount is cast at the boundary.
|
|
87
|
+
//
|
|
88
|
+
// RUNTIME FLOOR: this relies on a V8 with exact decimal-STRING Intl support
|
|
89
|
+
// (Node >= 20, evergreen browsers) — the whole point is that a 20-digit amount
|
|
90
|
+
// never round-trips through an IEEE-754 double. There is deliberately NO
|
|
91
|
+
// Number-coercion fallback for older runtimes: that fallback would silently
|
|
92
|
+
// reintroduce the precision loss this function exists to prevent.
|
|
93
|
+
const parts = formatter.formatToParts(forFormat);
|
|
94
|
+
// Intl emits a literal "nan"/"∞" part for non-finite values; treat those as
|
|
95
|
+
// no-value rather than rendering them.
|
|
96
|
+
if (parts.some((p) => p.type === 'nan' || p.type === 'infinity'))
|
|
97
|
+
return null;
|
|
98
|
+
return {
|
|
99
|
+
formatted: parts.map((p) => p.value).join(''),
|
|
100
|
+
negative: parts.some((p) => p.type === 'minusSign')
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function MoneyText({ amount, currency, fractionDigits = 2, hideCurrency = false, signColor = true, locale, className }) {
|
|
104
|
+
const noValue = ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)('text-muted-foreground tabular-nums', className), children: format_1.NO_VALUE }));
|
|
105
|
+
if (amount === null || amount === undefined || amount === '')
|
|
106
|
+
return noValue;
|
|
107
|
+
// Sign and finiteness are derived from the formatted parts, not a raw string
|
|
108
|
+
// prefix — so color and glyph can never disagree, and "-0" / "(0)" are
|
|
109
|
+
// treated as the non-negative zero Intl renders.
|
|
110
|
+
const result = formatMoneyParts(amount, fractionDigits, locale);
|
|
111
|
+
if (result === null)
|
|
112
|
+
return noValue;
|
|
113
|
+
const { formatted, negative } = result;
|
|
114
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)('tabular-nums', signColor && negative && 'text-destructive', className), children: [formatted, !hideCurrency && currency ? ((0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground ml-1 text-xs", children: currency })) : null] }));
|
|
115
|
+
}
|