@handijitcom/ui 1.0.0 → 1.1.0

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.
Files changed (107) hide show
  1. package/README.md +34 -32
  2. package/build/calendar.cjs.map +1 -1
  3. package/build/calendar.js.map +1 -1
  4. package/build/charts.cjs +1 -1
  5. package/build/charts.cjs.map +1 -1
  6. package/build/charts.js +1 -1
  7. package/build/charts.js.map +1 -1
  8. package/build/chat.cjs +1 -1
  9. package/build/chat.cjs.map +1 -1
  10. package/build/chat.js +1 -1
  11. package/build/chat.js.map +1 -1
  12. package/build/components/MoneyInput/index.cjs.map +1 -1
  13. package/build/components/MoneyInput/index.d.cts +1 -1
  14. package/build/components/MoneyInput/index.d.ts +1 -1
  15. package/build/components/MoneyInput/index.js.map +1 -1
  16. package/build/constants/breakpoint.constants.cjs +1 -1
  17. package/build/constants/breakpoint.constants.cjs.map +1 -1
  18. package/build/constants/breakpoint.constants.d.cts +1 -1
  19. package/build/constants/breakpoint.constants.d.ts +1 -1
  20. package/build/constants/breakpoint.constants.js +1 -1
  21. package/build/constants/breakpoint.constants.js.map +1 -1
  22. package/build/constants/scale.constants.cjs.map +1 -1
  23. package/build/constants/scale.constants.d.cts +2 -3
  24. package/build/constants/scale.constants.d.ts +2 -3
  25. package/build/constants/scale.constants.js.map +1 -1
  26. package/build/design/fonts/LICENSE-archivo.txt +93 -0
  27. package/build/design/fonts/LICENSE-ibm-plex-mono.txt +93 -0
  28. package/build/design/fonts/LICENSE-inter.txt +93 -0
  29. package/build/design/fonts/archivo-latin-ext-wdth-normal.woff2 +0 -0
  30. package/build/design/fonts/archivo-latin-wdth-normal.woff2 +0 -0
  31. package/build/design/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  32. package/build/design/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  33. package/build/design/fonts/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  34. package/build/design/fonts/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  35. package/build/design/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  36. package/build/design/fonts/inter-latin-wght-normal.woff2 +0 -0
  37. package/build/design/fonts.css +75 -0
  38. package/build/design/fonts.d.css.ts +1 -0
  39. package/build/design/index.cjs +778 -0
  40. package/build/design/index.cjs.map +1 -0
  41. package/build/design/index.d.cts +263 -0
  42. package/build/design/index.d.mts +263 -0
  43. package/build/design/index.mjs +751 -0
  44. package/build/design/index.mjs.map +1 -0
  45. package/build/design/index.umd.cjs +2 -0
  46. package/build/design/index.umd.cjs.map +1 -0
  47. package/build/design/logos/horizontal.svg +1 -0
  48. package/build/design/logos/mark.svg +1 -0
  49. package/build/design/tokens.css +477 -0
  50. package/build/design/tokens.d.css.ts +1 -0
  51. package/build/design/tokens.json +542 -0
  52. package/build/design/tokens.scss +616 -0
  53. package/build/helpers/scaled-number.helper.cjs.map +1 -1
  54. package/build/helpers/scaled-number.helper.d.cts +3 -4
  55. package/build/helpers/scaled-number.helper.d.ts +3 -4
  56. package/build/helpers/scaled-number.helper.js.map +1 -1
  57. package/build/helpers/theme.helper.cjs +1 -1
  58. package/build/helpers/theme.helper.cjs.map +1 -1
  59. package/build/helpers/theme.helper.d.cts +2 -2
  60. package/build/helpers/theme.helper.d.ts +2 -2
  61. package/build/helpers/theme.helper.js +1 -1
  62. package/build/helpers/theme.helper.js.map +1 -1
  63. package/build/hooks/useUiTheme.cjs +1 -1
  64. package/build/hooks/useUiTheme.cjs.map +1 -1
  65. package/build/hooks/useUiTheme.d.cts +1 -1
  66. package/build/hooks/useUiTheme.d.ts +1 -1
  67. package/build/hooks/useUiTheme.js +1 -1
  68. package/build/hooks/useUiTheme.js.map +1 -1
  69. package/build/hooks/useUiTokens.cjs +1 -1
  70. package/build/hooks/useUiTokens.cjs.map +1 -1
  71. package/build/hooks/useUiTokens.d.cts +2 -2
  72. package/build/hooks/useUiTokens.d.ts +2 -2
  73. package/build/hooks/useUiTokens.js +1 -1
  74. package/build/hooks/useUiTokens.js.map +1 -1
  75. package/build/index.cjs +1 -1
  76. package/build/index.d.cts +1 -1
  77. package/build/index.d.ts +1 -1
  78. package/build/index.js +1 -1
  79. package/build/scss/_index.scss +1 -1
  80. package/build/scss/_variables.scss +3 -3
  81. package/build/theme/UiProvider.cjs.map +1 -1
  82. package/build/theme/UiProvider.d.cts +1 -1
  83. package/build/theme/UiProvider.d.ts +1 -1
  84. package/build/theme/UiProvider.js.map +1 -1
  85. package/build/theme/UiThemeScript.cjs +1 -1
  86. package/build/theme/UiThemeScript.cjs.map +1 -1
  87. package/build/theme/UiThemeScript.d.cts +1 -1
  88. package/build/theme/UiThemeScript.d.ts +1 -1
  89. package/build/theme/UiThemeScript.js +1 -1
  90. package/build/theme/UiThemeScript.js.map +1 -1
  91. package/build/types/calendar/Calendar/index.d.cts +2 -2
  92. package/build/types/calendar/Calendar/index.d.ts +2 -2
  93. package/build/types/calendar/core/time.d.cts +1 -1
  94. package/build/types/calendar/core/time.d.ts +1 -1
  95. package/build/types/calendar/core/types.d.cts +1 -1
  96. package/build/types/calendar/core/types.d.ts +1 -1
  97. package/build/types/calendar/index.d.cts +1 -1
  98. package/build/types/calendar/index.d.ts +1 -1
  99. package/build/types/charts/core/palette.d.cts +1 -1
  100. package/build/types/charts/core/palette.d.ts +1 -1
  101. package/build/types/chat/Legend/index.d.cts +1 -1
  102. package/build/types/chat/Legend/index.d.ts +1 -1
  103. package/build/types/theme.type.d.cts +2 -2
  104. package/build/types/theme.type.d.ts +2 -2
  105. package/build/types/types/theme.type.d.cts +2 -2
  106. package/build/types/types/theme.type.d.ts +2 -2
  107. package/package.json +30 -6
@@ -0,0 +1,616 @@
1
+ // @handijit/design — generated from the TypeScript tokens. Do not edit.
2
+
3
+ @use "sass:map";
4
+
5
+ $hd-cobalt-50: var(--hd-cobalt-50);
6
+ $hd-cobalt-100: var(--hd-cobalt-100);
7
+ $hd-cobalt-200: var(--hd-cobalt-200);
8
+ $hd-cobalt-300: var(--hd-cobalt-300);
9
+ $hd-cobalt-400: var(--hd-cobalt-400);
10
+ $hd-cobalt-500: var(--hd-cobalt-500);
11
+ $hd-cobalt-600: var(--hd-cobalt-600);
12
+ $hd-cobalt-700: var(--hd-cobalt-700);
13
+ $hd-cobalt-800: var(--hd-cobalt-800);
14
+ $hd-cobalt-900: var(--hd-cobalt-900);
15
+ $hd-cobalt-950: var(--hd-cobalt-950);
16
+ $hd-coral-50: var(--hd-coral-50);
17
+ $hd-coral-100: var(--hd-coral-100);
18
+ $hd-coral-200: var(--hd-coral-200);
19
+ $hd-coral-300: var(--hd-coral-300);
20
+ $hd-coral-400: var(--hd-coral-400);
21
+ $hd-coral-500: var(--hd-coral-500);
22
+ $hd-coral-600: var(--hd-coral-600);
23
+ $hd-coral-700: var(--hd-coral-700);
24
+ $hd-coral-800: var(--hd-coral-800);
25
+ $hd-coral-900: var(--hd-coral-900);
26
+ $hd-coral-950: var(--hd-coral-950);
27
+ $hd-turquoise-50: var(--hd-turquoise-50);
28
+ $hd-turquoise-100: var(--hd-turquoise-100);
29
+ $hd-turquoise-200: var(--hd-turquoise-200);
30
+ $hd-turquoise-300: var(--hd-turquoise-300);
31
+ $hd-turquoise-400: var(--hd-turquoise-400);
32
+ $hd-turquoise-500: var(--hd-turquoise-500);
33
+ $hd-turquoise-600: var(--hd-turquoise-600);
34
+ $hd-turquoise-700: var(--hd-turquoise-700);
35
+ $hd-turquoise-800: var(--hd-turquoise-800);
36
+ $hd-turquoise-900: var(--hd-turquoise-900);
37
+ $hd-turquoise-950: var(--hd-turquoise-950);
38
+ $hd-success-50: var(--hd-success-50);
39
+ $hd-success-100: var(--hd-success-100);
40
+ $hd-success-200: var(--hd-success-200);
41
+ $hd-success-300: var(--hd-success-300);
42
+ $hd-success-400: var(--hd-success-400);
43
+ $hd-success-500: var(--hd-success-500);
44
+ $hd-success-600: var(--hd-success-600);
45
+ $hd-success-700: var(--hd-success-700);
46
+ $hd-success-800: var(--hd-success-800);
47
+ $hd-success-900: var(--hd-success-900);
48
+ $hd-success-950: var(--hd-success-950);
49
+ $hd-warning-50: var(--hd-warning-50);
50
+ $hd-warning-100: var(--hd-warning-100);
51
+ $hd-warning-200: var(--hd-warning-200);
52
+ $hd-warning-300: var(--hd-warning-300);
53
+ $hd-warning-400: var(--hd-warning-400);
54
+ $hd-warning-500: var(--hd-warning-500);
55
+ $hd-warning-600: var(--hd-warning-600);
56
+ $hd-warning-700: var(--hd-warning-700);
57
+ $hd-warning-800: var(--hd-warning-800);
58
+ $hd-warning-900: var(--hd-warning-900);
59
+ $hd-warning-950: var(--hd-warning-950);
60
+ $hd-danger-50: var(--hd-danger-50);
61
+ $hd-danger-100: var(--hd-danger-100);
62
+ $hd-danger-200: var(--hd-danger-200);
63
+ $hd-danger-300: var(--hd-danger-300);
64
+ $hd-danger-400: var(--hd-danger-400);
65
+ $hd-danger-500: var(--hd-danger-500);
66
+ $hd-danger-600: var(--hd-danger-600);
67
+ $hd-danger-700: var(--hd-danger-700);
68
+ $hd-danger-800: var(--hd-danger-800);
69
+ $hd-danger-900: var(--hd-danger-900);
70
+ $hd-danger-950: var(--hd-danger-950);
71
+ $hd-violet-50: var(--hd-violet-50);
72
+ $hd-violet-100: var(--hd-violet-100);
73
+ $hd-violet-200: var(--hd-violet-200);
74
+ $hd-violet-300: var(--hd-violet-300);
75
+ $hd-violet-400: var(--hd-violet-400);
76
+ $hd-violet-500: var(--hd-violet-500);
77
+ $hd-violet-600: var(--hd-violet-600);
78
+ $hd-violet-700: var(--hd-violet-700);
79
+ $hd-violet-800: var(--hd-violet-800);
80
+ $hd-violet-900: var(--hd-violet-900);
81
+ $hd-violet-950: var(--hd-violet-950);
82
+ $hd-magenta-50: var(--hd-magenta-50);
83
+ $hd-magenta-100: var(--hd-magenta-100);
84
+ $hd-magenta-200: var(--hd-magenta-200);
85
+ $hd-magenta-300: var(--hd-magenta-300);
86
+ $hd-magenta-400: var(--hd-magenta-400);
87
+ $hd-magenta-500: var(--hd-magenta-500);
88
+ $hd-magenta-600: var(--hd-magenta-600);
89
+ $hd-magenta-700: var(--hd-magenta-700);
90
+ $hd-magenta-800: var(--hd-magenta-800);
91
+ $hd-magenta-900: var(--hd-magenta-900);
92
+ $hd-magenta-950: var(--hd-magenta-950);
93
+ $hd-slate-0: var(--hd-slate-0);
94
+ $hd-slate-25: var(--hd-slate-25);
95
+ $hd-slate-50: var(--hd-slate-50);
96
+ $hd-slate-100: var(--hd-slate-100);
97
+ $hd-slate-200: var(--hd-slate-200);
98
+ $hd-slate-300: var(--hd-slate-300);
99
+ $hd-slate-400: var(--hd-slate-400);
100
+ $hd-slate-500: var(--hd-slate-500);
101
+ $hd-slate-600: var(--hd-slate-600);
102
+ $hd-slate-700: var(--hd-slate-700);
103
+ $hd-slate-800: var(--hd-slate-800);
104
+ $hd-slate-900: var(--hd-slate-900);
105
+ $hd-slate-950: var(--hd-slate-950);
106
+ $hd-font-display: var(--hd-font-display);
107
+ $hd-font-body: var(--hd-font-body);
108
+ $hd-font-mono: var(--hd-font-mono);
109
+ $hd-font-weight-regular: var(--hd-font-weight-regular);
110
+ $hd-font-weight-medium: var(--hd-font-weight-medium);
111
+ $hd-font-weight-semibold: var(--hd-font-weight-semibold);
112
+ $hd-font-weight-bold: var(--hd-font-weight-bold);
113
+ $hd-type-display-size: var(--hd-type-display-size);
114
+ $hd-type-display-line-height: var(--hd-type-display-line-height);
115
+ $hd-type-display-weight: var(--hd-type-display-weight);
116
+ $hd-type-display-letter-spacing: var(--hd-type-display-letter-spacing);
117
+ $hd-type-display-stretch: var(--hd-type-display-stretch);
118
+ $hd-type-h1-size: var(--hd-type-h1-size);
119
+ $hd-type-h1-line-height: var(--hd-type-h1-line-height);
120
+ $hd-type-h1-weight: var(--hd-type-h1-weight);
121
+ $hd-type-h1-letter-spacing: var(--hd-type-h1-letter-spacing);
122
+ $hd-type-h1-stretch: var(--hd-type-h1-stretch);
123
+ $hd-type-h2-size: var(--hd-type-h2-size);
124
+ $hd-type-h2-line-height: var(--hd-type-h2-line-height);
125
+ $hd-type-h2-weight: var(--hd-type-h2-weight);
126
+ $hd-type-h2-letter-spacing: var(--hd-type-h2-letter-spacing);
127
+ $hd-type-h2-stretch: var(--hd-type-h2-stretch);
128
+ $hd-type-h3-size: var(--hd-type-h3-size);
129
+ $hd-type-h3-line-height: var(--hd-type-h3-line-height);
130
+ $hd-type-h3-weight: var(--hd-type-h3-weight);
131
+ $hd-type-h3-letter-spacing: var(--hd-type-h3-letter-spacing);
132
+ $hd-type-h3-stretch: var(--hd-type-h3-stretch);
133
+ $hd-type-h4-size: var(--hd-type-h4-size);
134
+ $hd-type-h4-line-height: var(--hd-type-h4-line-height);
135
+ $hd-type-h4-weight: var(--hd-type-h4-weight);
136
+ $hd-type-h4-letter-spacing: var(--hd-type-h4-letter-spacing);
137
+ $hd-type-h4-stretch: var(--hd-type-h4-stretch);
138
+ $hd-type-lead-size: var(--hd-type-lead-size);
139
+ $hd-type-lead-line-height: var(--hd-type-lead-line-height);
140
+ $hd-type-lead-weight: var(--hd-type-lead-weight);
141
+ $hd-type-lead-letter-spacing: var(--hd-type-lead-letter-spacing);
142
+ $hd-type-lead-stretch: var(--hd-type-lead-stretch);
143
+ $hd-type-body-size: var(--hd-type-body-size);
144
+ $hd-type-body-line-height: var(--hd-type-body-line-height);
145
+ $hd-type-body-weight: var(--hd-type-body-weight);
146
+ $hd-type-body-letter-spacing: var(--hd-type-body-letter-spacing);
147
+ $hd-type-body-stretch: var(--hd-type-body-stretch);
148
+ $hd-type-small-size: var(--hd-type-small-size);
149
+ $hd-type-small-line-height: var(--hd-type-small-line-height);
150
+ $hd-type-small-weight: var(--hd-type-small-weight);
151
+ $hd-type-small-letter-spacing: var(--hd-type-small-letter-spacing);
152
+ $hd-type-small-stretch: var(--hd-type-small-stretch);
153
+ $hd-type-caption-size: var(--hd-type-caption-size);
154
+ $hd-type-caption-line-height: var(--hd-type-caption-line-height);
155
+ $hd-type-caption-weight: var(--hd-type-caption-weight);
156
+ $hd-type-caption-letter-spacing: var(--hd-type-caption-letter-spacing);
157
+ $hd-type-caption-stretch: var(--hd-type-caption-stretch);
158
+ $hd-type-code-size: var(--hd-type-code-size);
159
+ $hd-type-code-line-height: var(--hd-type-code-line-height);
160
+ $hd-type-code-weight: var(--hd-type-code-weight);
161
+ $hd-type-code-letter-spacing: var(--hd-type-code-letter-spacing);
162
+ $hd-type-code-stretch: var(--hd-type-code-stretch);
163
+ $hd-space-0: var(--hd-space-0);
164
+ $hd-space-1: var(--hd-space-1);
165
+ $hd-space-2: var(--hd-space-2);
166
+ $hd-space-3: var(--hd-space-3);
167
+ $hd-space-4: var(--hd-space-4);
168
+ $hd-space-5: var(--hd-space-5);
169
+ $hd-space-6: var(--hd-space-6);
170
+ $hd-space-8: var(--hd-space-8);
171
+ $hd-space-10: var(--hd-space-10);
172
+ $hd-space-12: var(--hd-space-12);
173
+ $hd-space-16: var(--hd-space-16);
174
+ $hd-space-20: var(--hd-space-20);
175
+ $hd-space-24: var(--hd-space-24);
176
+ $hd-radius-xs: var(--hd-radius-xs);
177
+ $hd-radius-sm: var(--hd-radius-sm);
178
+ $hd-radius-md: var(--hd-radius-md);
179
+ $hd-radius-lg: var(--hd-radius-lg);
180
+ $hd-radius-pill: var(--hd-radius-pill);
181
+ $hd-duration-fast: var(--hd-duration-fast);
182
+ $hd-duration-base: var(--hd-duration-base);
183
+ $hd-duration-slow: var(--hd-duration-slow);
184
+ $hd-ease-standard: var(--hd-ease-standard);
185
+ $hd-ease-enter: var(--hd-ease-enter);
186
+ $hd-ease-exit: var(--hd-ease-exit);
187
+ $hd-z-base: var(--hd-z-base);
188
+ $hd-z-raised: var(--hd-z-raised);
189
+ $hd-z-sticky: var(--hd-z-sticky);
190
+ $hd-z-dropdown: var(--hd-z-dropdown);
191
+ $hd-z-overlay: var(--hd-z-overlay);
192
+ $hd-z-modal: var(--hd-z-modal);
193
+ $hd-z-popover: var(--hd-z-popover);
194
+ $hd-z-toast: var(--hd-z-toast);
195
+ $hd-z-tooltip: var(--hd-z-tooltip);
196
+ $hd-bg-page: var(--hd-bg-page);
197
+ $hd-bg-surface: var(--hd-bg-surface);
198
+ $hd-bg-raised: var(--hd-bg-raised);
199
+ $hd-bg-inset: var(--hd-bg-inset);
200
+ $hd-bg-overlay: var(--hd-bg-overlay);
201
+ $hd-bg-disabled: var(--hd-bg-disabled);
202
+ $hd-border: var(--hd-border);
203
+ $hd-border-strong: var(--hd-border-strong);
204
+ $hd-border-control: var(--hd-border-control);
205
+ $hd-text: var(--hd-text);
206
+ $hd-text-2: var(--hd-text-2);
207
+ $hd-text-3: var(--hd-text-3);
208
+ $hd-text-disabled: var(--hd-text-disabled);
209
+ $hd-primary: var(--hd-primary);
210
+ $hd-primary-hover: var(--hd-primary-hover);
211
+ $hd-primary-active: var(--hd-primary-active);
212
+ $hd-on-primary: var(--hd-on-primary);
213
+ $hd-primary-soft: var(--hd-primary-soft);
214
+ $hd-primary-soft-hover: var(--hd-primary-soft-hover);
215
+ $hd-primary-line: var(--hd-primary-line);
216
+ $hd-primary-text: var(--hd-primary-text);
217
+ $hd-accent: var(--hd-accent);
218
+ $hd-accent-hover: var(--hd-accent-hover);
219
+ $hd-accent-active: var(--hd-accent-active);
220
+ $hd-on-accent: var(--hd-on-accent);
221
+ $hd-accent-soft: var(--hd-accent-soft);
222
+ $hd-accent-text: var(--hd-accent-text);
223
+ $hd-highlight: var(--hd-highlight);
224
+ $hd-on-highlight: var(--hd-on-highlight);
225
+ $hd-highlight-soft: var(--hd-highlight-soft);
226
+ $hd-highlight-text: var(--hd-highlight-text);
227
+ $hd-focus: var(--hd-focus);
228
+ $hd-selection-bg: var(--hd-selection-bg);
229
+ $hd-success-bg: var(--hd-success-bg);
230
+ $hd-success-fg: var(--hd-success-fg);
231
+ $hd-success-line: var(--hd-success-line);
232
+ $hd-success-solid: var(--hd-success-solid);
233
+ $hd-success-on-solid: var(--hd-success-on-solid);
234
+ $hd-warning-bg: var(--hd-warning-bg);
235
+ $hd-warning-fg: var(--hd-warning-fg);
236
+ $hd-warning-line: var(--hd-warning-line);
237
+ $hd-warning-solid: var(--hd-warning-solid);
238
+ $hd-warning-on-solid: var(--hd-warning-on-solid);
239
+ $hd-danger-bg: var(--hd-danger-bg);
240
+ $hd-danger-fg: var(--hd-danger-fg);
241
+ $hd-danger-line: var(--hd-danger-line);
242
+ $hd-danger-solid: var(--hd-danger-solid);
243
+ $hd-danger-on-solid: var(--hd-danger-on-solid);
244
+ $hd-info-bg: var(--hd-info-bg);
245
+ $hd-info-fg: var(--hd-info-fg);
246
+ $hd-info-line: var(--hd-info-line);
247
+ $hd-info-solid: var(--hd-info-solid);
248
+ $hd-info-on-solid: var(--hd-info-on-solid);
249
+ $hd-chart-1: var(--hd-chart-1);
250
+ $hd-chart-2: var(--hd-chart-2);
251
+ $hd-chart-3: var(--hd-chart-3);
252
+ $hd-chart-4: var(--hd-chart-4);
253
+ $hd-chart-5: var(--hd-chart-5);
254
+ $hd-chart-6: var(--hd-chart-6);
255
+ $hd-band-bg: var(--hd-band-bg);
256
+ $hd-band-deep: var(--hd-band-deep);
257
+ $hd-band-line: var(--hd-band-line);
258
+ $hd-band-line-strong: var(--hd-band-line-strong);
259
+ $hd-band-text: var(--hd-band-text);
260
+ $hd-band-text-2: var(--hd-band-text-2);
261
+ $hd-shadow-color: var(--hd-shadow-color);
262
+ $hd-shadow-alpha: var(--hd-shadow-alpha);
263
+ $hd-shadow-1: var(--hd-shadow-1);
264
+ $hd-shadow-2: var(--hd-shadow-2);
265
+ $hd-shadow-3: var(--hd-shadow-3);
266
+ $hd-scrim: var(--hd-scrim);
267
+
268
+ $hd-tokens: (
269
+ "cobalt-50": var(--hd-cobalt-50),
270
+ "cobalt-100": var(--hd-cobalt-100),
271
+ "cobalt-200": var(--hd-cobalt-200),
272
+ "cobalt-300": var(--hd-cobalt-300),
273
+ "cobalt-400": var(--hd-cobalt-400),
274
+ "cobalt-500": var(--hd-cobalt-500),
275
+ "cobalt-600": var(--hd-cobalt-600),
276
+ "cobalt-700": var(--hd-cobalt-700),
277
+ "cobalt-800": var(--hd-cobalt-800),
278
+ "cobalt-900": var(--hd-cobalt-900),
279
+ "cobalt-950": var(--hd-cobalt-950),
280
+ "coral-50": var(--hd-coral-50),
281
+ "coral-100": var(--hd-coral-100),
282
+ "coral-200": var(--hd-coral-200),
283
+ "coral-300": var(--hd-coral-300),
284
+ "coral-400": var(--hd-coral-400),
285
+ "coral-500": var(--hd-coral-500),
286
+ "coral-600": var(--hd-coral-600),
287
+ "coral-700": var(--hd-coral-700),
288
+ "coral-800": var(--hd-coral-800),
289
+ "coral-900": var(--hd-coral-900),
290
+ "coral-950": var(--hd-coral-950),
291
+ "turquoise-50": var(--hd-turquoise-50),
292
+ "turquoise-100": var(--hd-turquoise-100),
293
+ "turquoise-200": var(--hd-turquoise-200),
294
+ "turquoise-300": var(--hd-turquoise-300),
295
+ "turquoise-400": var(--hd-turquoise-400),
296
+ "turquoise-500": var(--hd-turquoise-500),
297
+ "turquoise-600": var(--hd-turquoise-600),
298
+ "turquoise-700": var(--hd-turquoise-700),
299
+ "turquoise-800": var(--hd-turquoise-800),
300
+ "turquoise-900": var(--hd-turquoise-900),
301
+ "turquoise-950": var(--hd-turquoise-950),
302
+ "success-50": var(--hd-success-50),
303
+ "success-100": var(--hd-success-100),
304
+ "success-200": var(--hd-success-200),
305
+ "success-300": var(--hd-success-300),
306
+ "success-400": var(--hd-success-400),
307
+ "success-500": var(--hd-success-500),
308
+ "success-600": var(--hd-success-600),
309
+ "success-700": var(--hd-success-700),
310
+ "success-800": var(--hd-success-800),
311
+ "success-900": var(--hd-success-900),
312
+ "success-950": var(--hd-success-950),
313
+ "warning-50": var(--hd-warning-50),
314
+ "warning-100": var(--hd-warning-100),
315
+ "warning-200": var(--hd-warning-200),
316
+ "warning-300": var(--hd-warning-300),
317
+ "warning-400": var(--hd-warning-400),
318
+ "warning-500": var(--hd-warning-500),
319
+ "warning-600": var(--hd-warning-600),
320
+ "warning-700": var(--hd-warning-700),
321
+ "warning-800": var(--hd-warning-800),
322
+ "warning-900": var(--hd-warning-900),
323
+ "warning-950": var(--hd-warning-950),
324
+ "danger-50": var(--hd-danger-50),
325
+ "danger-100": var(--hd-danger-100),
326
+ "danger-200": var(--hd-danger-200),
327
+ "danger-300": var(--hd-danger-300),
328
+ "danger-400": var(--hd-danger-400),
329
+ "danger-500": var(--hd-danger-500),
330
+ "danger-600": var(--hd-danger-600),
331
+ "danger-700": var(--hd-danger-700),
332
+ "danger-800": var(--hd-danger-800),
333
+ "danger-900": var(--hd-danger-900),
334
+ "danger-950": var(--hd-danger-950),
335
+ "violet-50": var(--hd-violet-50),
336
+ "violet-100": var(--hd-violet-100),
337
+ "violet-200": var(--hd-violet-200),
338
+ "violet-300": var(--hd-violet-300),
339
+ "violet-400": var(--hd-violet-400),
340
+ "violet-500": var(--hd-violet-500),
341
+ "violet-600": var(--hd-violet-600),
342
+ "violet-700": var(--hd-violet-700),
343
+ "violet-800": var(--hd-violet-800),
344
+ "violet-900": var(--hd-violet-900),
345
+ "violet-950": var(--hd-violet-950),
346
+ "magenta-50": var(--hd-magenta-50),
347
+ "magenta-100": var(--hd-magenta-100),
348
+ "magenta-200": var(--hd-magenta-200),
349
+ "magenta-300": var(--hd-magenta-300),
350
+ "magenta-400": var(--hd-magenta-400),
351
+ "magenta-500": var(--hd-magenta-500),
352
+ "magenta-600": var(--hd-magenta-600),
353
+ "magenta-700": var(--hd-magenta-700),
354
+ "magenta-800": var(--hd-magenta-800),
355
+ "magenta-900": var(--hd-magenta-900),
356
+ "magenta-950": var(--hd-magenta-950),
357
+ "slate-0": var(--hd-slate-0),
358
+ "slate-25": var(--hd-slate-25),
359
+ "slate-50": var(--hd-slate-50),
360
+ "slate-100": var(--hd-slate-100),
361
+ "slate-200": var(--hd-slate-200),
362
+ "slate-300": var(--hd-slate-300),
363
+ "slate-400": var(--hd-slate-400),
364
+ "slate-500": var(--hd-slate-500),
365
+ "slate-600": var(--hd-slate-600),
366
+ "slate-700": var(--hd-slate-700),
367
+ "slate-800": var(--hd-slate-800),
368
+ "slate-900": var(--hd-slate-900),
369
+ "slate-950": var(--hd-slate-950),
370
+ "font-display": var(--hd-font-display),
371
+ "font-body": var(--hd-font-body),
372
+ "font-mono": var(--hd-font-mono),
373
+ "font-weight-regular": var(--hd-font-weight-regular),
374
+ "font-weight-medium": var(--hd-font-weight-medium),
375
+ "font-weight-semibold": var(--hd-font-weight-semibold),
376
+ "font-weight-bold": var(--hd-font-weight-bold),
377
+ "type-display-size": var(--hd-type-display-size),
378
+ "type-display-line-height": var(--hd-type-display-line-height),
379
+ "type-display-weight": var(--hd-type-display-weight),
380
+ "type-display-letter-spacing": var(--hd-type-display-letter-spacing),
381
+ "type-display-stretch": var(--hd-type-display-stretch),
382
+ "type-h1-size": var(--hd-type-h1-size),
383
+ "type-h1-line-height": var(--hd-type-h1-line-height),
384
+ "type-h1-weight": var(--hd-type-h1-weight),
385
+ "type-h1-letter-spacing": var(--hd-type-h1-letter-spacing),
386
+ "type-h1-stretch": var(--hd-type-h1-stretch),
387
+ "type-h2-size": var(--hd-type-h2-size),
388
+ "type-h2-line-height": var(--hd-type-h2-line-height),
389
+ "type-h2-weight": var(--hd-type-h2-weight),
390
+ "type-h2-letter-spacing": var(--hd-type-h2-letter-spacing),
391
+ "type-h2-stretch": var(--hd-type-h2-stretch),
392
+ "type-h3-size": var(--hd-type-h3-size),
393
+ "type-h3-line-height": var(--hd-type-h3-line-height),
394
+ "type-h3-weight": var(--hd-type-h3-weight),
395
+ "type-h3-letter-spacing": var(--hd-type-h3-letter-spacing),
396
+ "type-h3-stretch": var(--hd-type-h3-stretch),
397
+ "type-h4-size": var(--hd-type-h4-size),
398
+ "type-h4-line-height": var(--hd-type-h4-line-height),
399
+ "type-h4-weight": var(--hd-type-h4-weight),
400
+ "type-h4-letter-spacing": var(--hd-type-h4-letter-spacing),
401
+ "type-h4-stretch": var(--hd-type-h4-stretch),
402
+ "type-lead-size": var(--hd-type-lead-size),
403
+ "type-lead-line-height": var(--hd-type-lead-line-height),
404
+ "type-lead-weight": var(--hd-type-lead-weight),
405
+ "type-lead-letter-spacing": var(--hd-type-lead-letter-spacing),
406
+ "type-lead-stretch": var(--hd-type-lead-stretch),
407
+ "type-body-size": var(--hd-type-body-size),
408
+ "type-body-line-height": var(--hd-type-body-line-height),
409
+ "type-body-weight": var(--hd-type-body-weight),
410
+ "type-body-letter-spacing": var(--hd-type-body-letter-spacing),
411
+ "type-body-stretch": var(--hd-type-body-stretch),
412
+ "type-small-size": var(--hd-type-small-size),
413
+ "type-small-line-height": var(--hd-type-small-line-height),
414
+ "type-small-weight": var(--hd-type-small-weight),
415
+ "type-small-letter-spacing": var(--hd-type-small-letter-spacing),
416
+ "type-small-stretch": var(--hd-type-small-stretch),
417
+ "type-caption-size": var(--hd-type-caption-size),
418
+ "type-caption-line-height": var(--hd-type-caption-line-height),
419
+ "type-caption-weight": var(--hd-type-caption-weight),
420
+ "type-caption-letter-spacing": var(--hd-type-caption-letter-spacing),
421
+ "type-caption-stretch": var(--hd-type-caption-stretch),
422
+ "type-code-size": var(--hd-type-code-size),
423
+ "type-code-line-height": var(--hd-type-code-line-height),
424
+ "type-code-weight": var(--hd-type-code-weight),
425
+ "type-code-letter-spacing": var(--hd-type-code-letter-spacing),
426
+ "type-code-stretch": var(--hd-type-code-stretch),
427
+ "space-0": var(--hd-space-0),
428
+ "space-1": var(--hd-space-1),
429
+ "space-2": var(--hd-space-2),
430
+ "space-3": var(--hd-space-3),
431
+ "space-4": var(--hd-space-4),
432
+ "space-5": var(--hd-space-5),
433
+ "space-6": var(--hd-space-6),
434
+ "space-8": var(--hd-space-8),
435
+ "space-10": var(--hd-space-10),
436
+ "space-12": var(--hd-space-12),
437
+ "space-16": var(--hd-space-16),
438
+ "space-20": var(--hd-space-20),
439
+ "space-24": var(--hd-space-24),
440
+ "radius-xs": var(--hd-radius-xs),
441
+ "radius-sm": var(--hd-radius-sm),
442
+ "radius-md": var(--hd-radius-md),
443
+ "radius-lg": var(--hd-radius-lg),
444
+ "radius-pill": var(--hd-radius-pill),
445
+ "duration-fast": var(--hd-duration-fast),
446
+ "duration-base": var(--hd-duration-base),
447
+ "duration-slow": var(--hd-duration-slow),
448
+ "ease-standard": var(--hd-ease-standard),
449
+ "ease-enter": var(--hd-ease-enter),
450
+ "ease-exit": var(--hd-ease-exit),
451
+ "z-base": var(--hd-z-base),
452
+ "z-raised": var(--hd-z-raised),
453
+ "z-sticky": var(--hd-z-sticky),
454
+ "z-dropdown": var(--hd-z-dropdown),
455
+ "z-overlay": var(--hd-z-overlay),
456
+ "z-modal": var(--hd-z-modal),
457
+ "z-popover": var(--hd-z-popover),
458
+ "z-toast": var(--hd-z-toast),
459
+ "z-tooltip": var(--hd-z-tooltip),
460
+ "bg-page": var(--hd-bg-page),
461
+ "bg-surface": var(--hd-bg-surface),
462
+ "bg-raised": var(--hd-bg-raised),
463
+ "bg-inset": var(--hd-bg-inset),
464
+ "bg-overlay": var(--hd-bg-overlay),
465
+ "bg-disabled": var(--hd-bg-disabled),
466
+ "border": var(--hd-border),
467
+ "border-strong": var(--hd-border-strong),
468
+ "border-control": var(--hd-border-control),
469
+ "text": var(--hd-text),
470
+ "text-2": var(--hd-text-2),
471
+ "text-3": var(--hd-text-3),
472
+ "text-disabled": var(--hd-text-disabled),
473
+ "primary": var(--hd-primary),
474
+ "primary-hover": var(--hd-primary-hover),
475
+ "primary-active": var(--hd-primary-active),
476
+ "on-primary": var(--hd-on-primary),
477
+ "primary-soft": var(--hd-primary-soft),
478
+ "primary-soft-hover": var(--hd-primary-soft-hover),
479
+ "primary-line": var(--hd-primary-line),
480
+ "primary-text": var(--hd-primary-text),
481
+ "accent": var(--hd-accent),
482
+ "accent-hover": var(--hd-accent-hover),
483
+ "accent-active": var(--hd-accent-active),
484
+ "on-accent": var(--hd-on-accent),
485
+ "accent-soft": var(--hd-accent-soft),
486
+ "accent-text": var(--hd-accent-text),
487
+ "highlight": var(--hd-highlight),
488
+ "on-highlight": var(--hd-on-highlight),
489
+ "highlight-soft": var(--hd-highlight-soft),
490
+ "highlight-text": var(--hd-highlight-text),
491
+ "focus": var(--hd-focus),
492
+ "selection-bg": var(--hd-selection-bg),
493
+ "success-bg": var(--hd-success-bg),
494
+ "success-fg": var(--hd-success-fg),
495
+ "success-line": var(--hd-success-line),
496
+ "success-solid": var(--hd-success-solid),
497
+ "success-on-solid": var(--hd-success-on-solid),
498
+ "warning-bg": var(--hd-warning-bg),
499
+ "warning-fg": var(--hd-warning-fg),
500
+ "warning-line": var(--hd-warning-line),
501
+ "warning-solid": var(--hd-warning-solid),
502
+ "warning-on-solid": var(--hd-warning-on-solid),
503
+ "danger-bg": var(--hd-danger-bg),
504
+ "danger-fg": var(--hd-danger-fg),
505
+ "danger-line": var(--hd-danger-line),
506
+ "danger-solid": var(--hd-danger-solid),
507
+ "danger-on-solid": var(--hd-danger-on-solid),
508
+ "info-bg": var(--hd-info-bg),
509
+ "info-fg": var(--hd-info-fg),
510
+ "info-line": var(--hd-info-line),
511
+ "info-solid": var(--hd-info-solid),
512
+ "info-on-solid": var(--hd-info-on-solid),
513
+ "chart-1": var(--hd-chart-1),
514
+ "chart-2": var(--hd-chart-2),
515
+ "chart-3": var(--hd-chart-3),
516
+ "chart-4": var(--hd-chart-4),
517
+ "chart-5": var(--hd-chart-5),
518
+ "chart-6": var(--hd-chart-6),
519
+ "band-bg": var(--hd-band-bg),
520
+ "band-deep": var(--hd-band-deep),
521
+ "band-line": var(--hd-band-line),
522
+ "band-line-strong": var(--hd-band-line-strong),
523
+ "band-text": var(--hd-band-text),
524
+ "band-text-2": var(--hd-band-text-2),
525
+ "shadow-color": var(--hd-shadow-color),
526
+ "shadow-alpha": var(--hd-shadow-alpha),
527
+ "shadow-1": var(--hd-shadow-1),
528
+ "shadow-2": var(--hd-shadow-2),
529
+ "shadow-3": var(--hd-shadow-3),
530
+ "scrim": var(--hd-scrim),
531
+ );
532
+
533
+ $hd-breakpoint-sm: 640px;
534
+ $hd-breakpoint-md: 768px;
535
+ $hd-breakpoint-lg: 1024px;
536
+ $hd-breakpoint-xl: 1280px;
537
+
538
+ $hd-breakpoints: (
539
+ "sm": 640px,
540
+ "md": 768px,
541
+ "lg": 1024px,
542
+ "xl": 1280px,
543
+ );
544
+
545
+ $hd-type-fonts: (
546
+ "display": "display",
547
+ "h1": "display",
548
+ "h2": "display",
549
+ "h3": "display",
550
+ "h4": "display",
551
+ "lead": "body",
552
+ "body": "body",
553
+ "small": "body",
554
+ "caption": "body",
555
+ "code": "mono",
556
+ );
557
+
558
+ /// The pixel value of a breakpoint; fails the build on an unknown name.
559
+ @function hd-breakpoint($name) {
560
+ @if not map.has-key($hd-breakpoints, $name) {
561
+ @error "hd-breakpoint: unknown breakpoint `#{$name}`. Expected one of #{map.keys($hd-breakpoints)}.";
562
+ }
563
+
564
+ @return map.get($hd-breakpoints, $name);
565
+ }
566
+
567
+ /// A `var()` reference to a token; fails the build on an unknown name.
568
+ @function hd-var($name) {
569
+ @if not map.has-key($hd-tokens, $name) {
570
+ @error "hd-var: unknown token `#{$name}`.";
571
+ }
572
+
573
+ @return map.get($hd-tokens, $name);
574
+ }
575
+
576
+ /// Styles from the breakpoint upwards.
577
+ @mixin hd-up($breakpoint) {
578
+ @media (min-width: hd-breakpoint($breakpoint)) {
579
+ @content;
580
+ }
581
+ }
582
+
583
+ /// Styles below the breakpoint.
584
+ @mixin hd-down($breakpoint) {
585
+ @media (max-width: (hd-breakpoint($breakpoint) - 0.02px)) {
586
+ @content;
587
+ }
588
+ }
589
+
590
+ /// Styles from one breakpoint up to (not including) another.
591
+ @mixin hd-between($from, $to) {
592
+ @media (min-width: hd-breakpoint($from)) and (max-width: (hd-breakpoint($to) - 0.02px)) {
593
+ @content;
594
+ }
595
+ }
596
+
597
+ /// Styles for readers who asked the system to reduce motion.
598
+ @mixin hd-reduced-motion {
599
+ @media (prefers-reduced-motion: reduce) {
600
+ @content;
601
+ }
602
+ }
603
+
604
+ /// Sets family, size, line height, weight, tracking and width of a type role.
605
+ @mixin hd-type($role) {
606
+ @if not map.has-key($hd-type-fonts, $role) {
607
+ @error "hd-type: unknown type role `#{$role}`. Expected one of #{map.keys($hd-type-fonts)}.";
608
+ }
609
+
610
+ font-family: var(--hd-font-#{map.get($hd-type-fonts, $role)});
611
+ font-size: var(--hd-type-#{$role}-size);
612
+ line-height: var(--hd-type-#{$role}-line-height);
613
+ font-weight: var(--hd-type-#{$role}-weight);
614
+ letter-spacing: var(--hd-type-#{$role}-letter-spacing);
615
+ font-stretch: var(--hd-type-#{$role}-stretch);
616
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"scaled-number.helper.cjs","sources":["../../src/helpers/scaled-number.helper.ts"],"sourcesContent":["/**\n * A SCALED INTEGER as a person types and reads it — the text side of `ScaledInput` (2.4).\n *\n * The value is a safe integer that carries `scaleDigits` decimal places (`123456` at 2 is\n * \"1.234,56\"): the scaled types of the data contract (`Kurus`, `Qty4`, `Price4`, `Rate6`, `Pct2`).\n * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,\n * so \"0,1\" at 2 is exactly `10`, never `10.000000000000002`.\n *\n * ⚠ The GRAMMAR is the one of `@handijit/app-kit` `parseDecimal` (data contract §4.3), on\n * purpose and pinned by the same vectors in `__tests__/helpers/scaled-number.helper.test.ts`:\n * the comma is the decimal point; with a comma, dots may only group the whole part by three;\n * without one, a dot followed by groups of three groups thousands (\"1.250\" is 1250) unless the\n * first group starts with zero (\"0.250\" is 0,25), and any other single dot is the point (\"12.5\"\n * is 12,5 — the dot key of a number pad). `ui` is a platform package and cannot import app-kit or\n * `@handijit/decimal`; the two copies must say the same thing, and the test is where they meet.\n */\n\n/** Text the field cannot hold: the keystroke that produced it is refused. */\nexport const REFUSED = Symbol('refused');\n\nexport type ScaledReadOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places a person may type (≤ `scaleDigits`). */\n maxFractionDigits: number;\n /** The smallest value; a minus sign is refused when it is 0 or more. */\n min: number;\n /** The largest value; a keystroke past it is refused. */\n max: number;\n};\n\n/**\n * What the typed text means: a scaled integer, `null` (nothing yet, or a number still being\n * typed that is not one on its own: \"-\", \",\", \"1.250.0\"), or `REFUSED` (no number starts this\n * way, or it has more decimals than allowed, or it is out of range).\n */\nexport type ScaledReading = number | null | typeof REFUSED;\n\n/** The whole part grouped by three, every group complete: \"1.250\", \"12.345.678\". */\nconst THOUSANDS = /^[1-9]\\d{0,2}(\\.\\d{3})+$/;\n/** On the way to `THOUSANDS`: the last group may still be short (\"1.250.0\"). */\nconst THOUSANDS_PREFIX = /^[1-9]\\d{0,2}(\\.\\d{3})*\\.\\d{0,3}$/;\n\n/**\n * Drops spaces anywhere and signs around the number (a currency code, \"%\", a plus) — a pasted\n * \"1.234,56 TL\" reads. A letter INSIDE the number stays and refuses it: \"1e3\" is not 13.\n */\nexport const cleanScaledText = (input: string): string =>\n input.replace(/\\s/g, '').replace(/^[^\\d.,-]+|[^\\d.,-]+$/g, '');\n\n/** Sign, whole digits and fraction digits of a complete number, or `null`. */\nconst split = (text: string): { isNegative: boolean; whole: string; fraction: string } | null => {\n const isNegative = text.startsWith('-');\n const body = isNegative ? text.slice(1) : text;\n const [whole, fraction, ...more] = body.split(',') as [string, ...string[]];\n\n if (more.length > 0 || body.includes('-')) return null;\n\n if (fraction !== undefined) {\n if (fraction.includes('.')) return null;\n if (whole.includes('.') && !THOUSANDS.test(whole)) return null;\n\n return { isNegative, whole: whole.replaceAll('.', ''), fraction };\n }\n\n if (THOUSANDS.test(whole)) return { isNegative, whole: whole.replaceAll('.', ''), fraction: '' };\n\n const [integer, point, ...rest] = whole.split('.') as [string, ...string[]];\n if (rest.length > 0) return null;\n\n return { isNegative, whole: integer, fraction: point ?? '' };\n};\n\n/** Reads typed text as a scaled integer; see `ScaledReading`. */\nexport const readScaledText = (input: string, options: ScaledReadOptions): ScaledReading => {\n const text = cleanScaledText(input);\n if (/[^\\d.,-]/.test(text)) return REFUSED;\n const parts = split(text);\n\n if (!parts) {\n /* Not a number, but maybe the start of one: \"1.250.0\" on the way to \"1.250.000\". */\n const body = text.startsWith('-') ? text.slice(1) : text;\n return THOUSANDS_PREFIX.test(body) && (options.min < 0 || !text.startsWith('-'))\n ? null\n : REFUSED;\n }\n\n const { isNegative, whole, fraction } = parts;\n if (isNegative && options.min >= 0) return REFUSED;\n const allowedFraction = Math.min(options.maxFractionDigits, options.scaleDigits);\n if (fraction.length > allowedFraction) return REFUSED;\n /* A whole-number field takes no decimal comma at all — \"3,\" would wait for a digit it refuses. */\n if (allowedFraction === 0 && text.includes(',')) return REFUSED;\n if (whole === '' && fraction === '') return null;\n\n const magnitude = BigInt(`${whole}${fraction.padEnd(options.scaleDigits, '0')}`);\n const signed = isNegative ? -magnitude : magnitude;\n\n const isTooLarge = signed > BigInt(Math.trunc(options.max));\n /* Under a positive `min` the field still takes the digits on the way up (\"0\" towards \"5\"). */\n const isTooSmall = signed < BigInt(Math.trunc(Math.min(options.min, 0)));\n if (isTooLarge || isTooSmall) return REFUSED;\n\n /* No negative zero: \"-0\" is 0. */\n return Number(signed) + 0;\n};\n\nexport type ScaledFormatOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places always shown (\"12,50\" at 2); trailing zeros past them are dropped. */\n minFractionDigits: number;\n /** Groups the whole part by three with a dot (\"1.234,5\"); off while the field is edited. */\n isGrouped: boolean;\n};\n\n/**\n * A scaled integer as text: `123450` at 2 → \"1.234,50\" (min 2) or \"1234,5\" (min 0, ungrouped).\n * Every carried digit that is not a trailing zero is shown — the field never hides part of the\n * value it holds.\n */\nexport const formatScaledValue = (value: number, options: ScaledFormatOptions): string => {\n const { scaleDigits, minFractionDigits, isGrouped } = options;\n const digits = String(Math.abs(value)).padStart(scaleDigits + 1, '0');\n const whole = digits.slice(0, digits.length - scaleDigits);\n const fraction = digits.slice(digits.length - scaleDigits).replace(/0+$/, '');\n const shownFraction = fraction.padEnd(Math.min(minFractionDigits, scaleDigits), '0');\n const shownWhole = isGrouped ? whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.') : whole;\n const sign = value < 0 ? '-' : '';\n\n return `${sign}${shownWhole}${shownFraction === '' ? '' : `,${shownFraction}`}`;\n};\n"],"names":["REFUSED","THOUSANDS","THOUSANDS_PREFIX","cleanScaledText","input","split","text","isNegative","body","whole","fraction","more","integer","point","rest","readScaledText","options","parts","allowedFraction","magnitude","signed","isTooLarge","isTooSmall","formatScaledValue","value","scaleDigits","minFractionDigits","isGrouped","digits","shownFraction","shownWhole"],"mappings":"gFAkBO,MAAMA,EAAU,OAAO,SAAS,EAqBjCC,EAAY,2BAEZC,EAAmB,oCAMZC,EAAmBC,GAC9BA,EAAM,QAAQ,MAAO,EAAE,EAAE,QAAQ,yBAA0B,EAAE,EAGzDC,EAASC,GAAkF,CAC/F,MAAMC,EAAaD,EAAK,WAAW,GAAG,EAChCE,EAAOD,EAAaD,EAAK,MAAM,CAAC,EAAIA,EACpC,CAACG,EAAOC,EAAU,GAAGC,CAAI,EAAIH,EAAK,MAAM,GAAG,EAEjD,GAAIG,EAAK,OAAS,GAAKH,EAAK,SAAS,GAAG,EAAG,OAAO,KAElD,GAAIE,IAAa,OAEf,OADIA,EAAS,SAAS,GAAG,GACrBD,EAAM,SAAS,GAAG,GAAK,CAACR,EAAU,KAAKQ,CAAK,EAAU,KAEnD,CAAE,WAAAF,EAAY,MAAOE,EAAM,WAAW,IAAK,EAAE,EAAG,SAAAC,CAAA,EAGzD,GAAIT,EAAU,KAAKQ,CAAK,QAAU,CAAE,WAAAF,EAAY,MAAOE,EAAM,WAAW,IAAK,EAAE,EAAG,SAAU,EAAA,EAE5F,KAAM,CAACG,EAASC,EAAO,GAAGC,CAAI,EAAIL,EAAM,MAAM,GAAG,EACjD,OAAIK,EAAK,OAAS,EAAU,KAErB,CAAE,WAAAP,EAAY,MAAOK,EAAS,SAAUC,GAAS,EAAA,CAC1D,EAGaE,EAAiB,CAACX,EAAeY,IAA8C,CAC1F,MAAMV,EAAOH,EAAgBC,CAAK,EAClC,GAAI,WAAW,KAAKE,CAAI,EAAG,OAAON,EAClC,MAAMiB,EAAQZ,EAAMC,CAAI,EAExB,GAAI,CAACW,EAAO,CAEV,MAAMT,EAAOF,EAAK,WAAW,GAAG,EAAIA,EAAK,MAAM,CAAC,EAAIA,EACpD,OAAOJ,EAAiB,KAAKM,CAAI,IAAMQ,EAAQ,IAAM,GAAK,CAACV,EAAK,WAAW,GAAG,GAC1E,KACAN,CACN,CAEA,KAAM,CAAE,WAAAO,EAAY,MAAAE,EAAO,SAAAC,CAAA,EAAaO,EACxC,GAAIV,GAAcS,EAAQ,KAAO,EAAG,OAAOhB,EAC3C,MAAMkB,EAAkB,KAAK,IAAIF,EAAQ,kBAAmBA,EAAQ,WAAW,EAG/E,GAFIN,EAAS,OAASQ,GAElBA,IAAoB,GAAKZ,EAAK,SAAS,GAAG,EAAG,OAAON,EACxD,GAAIS,IAAU,IAAMC,IAAa,GAAI,OAAO,KAE5C,MAAMS,EAAY,OAAO,GAAGV,CAAK,GAAGC,EAAS,OAAOM,EAAQ,YAAa,GAAG,CAAC,EAAE,EACzEI,EAASb,EAAa,CAACY,EAAYA,EAEnCE,EAAaD,EAAS,OAAO,KAAK,MAAMJ,EAAQ,GAAG,CAAC,EAEpDM,EAAaF,EAAS,OAAO,KAAK,MAAM,KAAK,IAAIJ,EAAQ,IAAK,CAAC,CAAC,CAAC,EACvE,OAAIK,GAAcC,EAAmBtB,EAG9B,OAAOoB,CAAM,EAAI,CAC1B,EAgBaG,EAAoB,CAACC,EAAeR,IAAyC,CACxF,KAAM,CAAE,YAAAS,EAAa,kBAAAC,EAAmB,UAAAC,CAAA,EAAcX,EAChDY,EAAS,OAAO,KAAK,IAAIJ,CAAK,CAAC,EAAE,SAASC,EAAc,EAAG,GAAG,EAC9DhB,EAAQmB,EAAO,MAAM,EAAGA,EAAO,OAASH,CAAW,EAEnDI,EADWD,EAAO,MAAMA,EAAO,OAASH,CAAW,EAAE,QAAQ,MAAO,EAAE,EAC7C,OAAO,KAAK,IAAIC,EAAmBD,CAAW,EAAG,GAAG,EAC7EK,EAAaH,EAAYlB,EAAM,QAAQ,wBAAyB,GAAG,EAAIA,EAG7E,MAAO,GAFMe,EAAQ,EAAI,IAAM,EAEjB,GAAGM,CAAU,GAAGD,IAAkB,GAAK,GAAK,IAAIA,CAAa,EAAE,EAC/E"}
1
+ {"version":3,"file":"scaled-number.helper.cjs","sources":["../../src/helpers/scaled-number.helper.ts"],"sourcesContent":["/**\n * A SCALED INTEGER as a person types and reads it — the text side of `ScaledInput` (2.4).\n *\n * The value is a safe integer that carries `scaleDigits` decimal places (`123456` at 2 is\n * \"1.234,56\"): the scaled types of the data contract (`Kurus`, `Qty4`, `Price4`, `Rate6`, `Pct2`).\n * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,\n * so \"0,1\" at 2 is exactly `10`, never `10.000000000000002`.\n *\n * ⚠ The GRAMMAR is the data contract's (§4.3), pinned by the vectors in `__tests__/helpers/scaled-number.helper.test.ts`:\n * the comma is the decimal point; with a comma, dots may only group the whole part by three;\n * without one, a dot followed by groups of three groups thousands (\"1.250\" is 1250) unless the\n * first group starts with zero (\"0.250\" is 0,25), and any other single dot is the point (\"12.5\"\n * is 12,5 — the dot key of a number pad). `ui` depends on no decimal library; the test table is the\n * reference for the grammar.\n */\n\n/** Text the field cannot hold: the keystroke that produced it is refused. */\nexport const REFUSED = Symbol('refused');\n\nexport type ScaledReadOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places a person may type (≤ `scaleDigits`). */\n maxFractionDigits: number;\n /** The smallest value; a minus sign is refused when it is 0 or more. */\n min: number;\n /** The largest value; a keystroke past it is refused. */\n max: number;\n};\n\n/**\n * What the typed text means: a scaled integer, `null` (nothing yet, or a number still being\n * typed that is not one on its own: \"-\", \",\", \"1.250.0\"), or `REFUSED` (no number starts this\n * way, or it has more decimals than allowed, or it is out of range).\n */\nexport type ScaledReading = number | null | typeof REFUSED;\n\n/** The whole part grouped by three, every group complete: \"1.250\", \"12.345.678\". */\nconst THOUSANDS = /^[1-9]\\d{0,2}(\\.\\d{3})+$/;\n/** On the way to `THOUSANDS`: the last group may still be short (\"1.250.0\"). */\nconst THOUSANDS_PREFIX = /^[1-9]\\d{0,2}(\\.\\d{3})*\\.\\d{0,3}$/;\n\n/**\n * Drops spaces anywhere and signs around the number (a currency code, \"%\", a plus) — a pasted\n * \"1.234,56 TL\" reads. A letter INSIDE the number stays and refuses it: \"1e3\" is not 13.\n */\nexport const cleanScaledText = (input: string): string =>\n input.replace(/\\s/g, '').replace(/^[^\\d.,-]+|[^\\d.,-]+$/g, '');\n\n/** Sign, whole digits and fraction digits of a complete number, or `null`. */\nconst split = (text: string): { isNegative: boolean; whole: string; fraction: string } | null => {\n const isNegative = text.startsWith('-');\n const body = isNegative ? text.slice(1) : text;\n const [whole, fraction, ...more] = body.split(',') as [string, ...string[]];\n\n if (more.length > 0 || body.includes('-')) return null;\n\n if (fraction !== undefined) {\n if (fraction.includes('.')) return null;\n if (whole.includes('.') && !THOUSANDS.test(whole)) return null;\n\n return { isNegative, whole: whole.replaceAll('.', ''), fraction };\n }\n\n if (THOUSANDS.test(whole)) return { isNegative, whole: whole.replaceAll('.', ''), fraction: '' };\n\n const [integer, point, ...rest] = whole.split('.') as [string, ...string[]];\n if (rest.length > 0) return null;\n\n return { isNegative, whole: integer, fraction: point ?? '' };\n};\n\n/** Reads typed text as a scaled integer; see `ScaledReading`. */\nexport const readScaledText = (input: string, options: ScaledReadOptions): ScaledReading => {\n const text = cleanScaledText(input);\n if (/[^\\d.,-]/.test(text)) return REFUSED;\n const parts = split(text);\n\n if (!parts) {\n /* Not a number, but maybe the start of one: \"1.250.0\" on the way to \"1.250.000\". */\n const body = text.startsWith('-') ? text.slice(1) : text;\n return THOUSANDS_PREFIX.test(body) && (options.min < 0 || !text.startsWith('-'))\n ? null\n : REFUSED;\n }\n\n const { isNegative, whole, fraction } = parts;\n if (isNegative && options.min >= 0) return REFUSED;\n const allowedFraction = Math.min(options.maxFractionDigits, options.scaleDigits);\n if (fraction.length > allowedFraction) return REFUSED;\n /* A whole-number field takes no decimal comma at all — \"3,\" would wait for a digit it refuses. */\n if (allowedFraction === 0 && text.includes(',')) return REFUSED;\n if (whole === '' && fraction === '') return null;\n\n const magnitude = BigInt(`${whole}${fraction.padEnd(options.scaleDigits, '0')}`);\n const signed = isNegative ? -magnitude : magnitude;\n\n const isTooLarge = signed > BigInt(Math.trunc(options.max));\n /* Under a positive `min` the field still takes the digits on the way up (\"0\" towards \"5\"). */\n const isTooSmall = signed < BigInt(Math.trunc(Math.min(options.min, 0)));\n if (isTooLarge || isTooSmall) return REFUSED;\n\n /* No negative zero: \"-0\" is 0. */\n return Number(signed) + 0;\n};\n\nexport type ScaledFormatOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places always shown (\"12,50\" at 2); trailing zeros past them are dropped. */\n minFractionDigits: number;\n /** Groups the whole part by three with a dot (\"1.234,5\"); off while the field is edited. */\n isGrouped: boolean;\n};\n\n/**\n * A scaled integer as text: `123450` at 2 → \"1.234,50\" (min 2) or \"1234,5\" (min 0, ungrouped).\n * Every carried digit that is not a trailing zero is shown — the field never hides part of the\n * value it holds.\n */\nexport const formatScaledValue = (value: number, options: ScaledFormatOptions): string => {\n const { scaleDigits, minFractionDigits, isGrouped } = options;\n const digits = String(Math.abs(value)).padStart(scaleDigits + 1, '0');\n const whole = digits.slice(0, digits.length - scaleDigits);\n const fraction = digits.slice(digits.length - scaleDigits).replace(/0+$/, '');\n const shownFraction = fraction.padEnd(Math.min(minFractionDigits, scaleDigits), '0');\n const shownWhole = isGrouped ? whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.') : whole;\n const sign = value < 0 ? '-' : '';\n\n return `${sign}${shownWhole}${shownFraction === '' ? '' : `,${shownFraction}`}`;\n};\n"],"names":["REFUSED","THOUSANDS","THOUSANDS_PREFIX","cleanScaledText","input","split","text","isNegative","body","whole","fraction","more","integer","point","rest","readScaledText","options","parts","allowedFraction","magnitude","signed","isTooLarge","isTooSmall","formatScaledValue","value","scaleDigits","minFractionDigits","isGrouped","digits","shownFraction","shownWhole"],"mappings":"gFAiBO,MAAMA,EAAU,OAAO,SAAS,EAqBjCC,EAAY,2BAEZC,EAAmB,oCAMZC,EAAmBC,GAC9BA,EAAM,QAAQ,MAAO,EAAE,EAAE,QAAQ,yBAA0B,EAAE,EAGzDC,EAASC,GAAkF,CAC/F,MAAMC,EAAaD,EAAK,WAAW,GAAG,EAChCE,EAAOD,EAAaD,EAAK,MAAM,CAAC,EAAIA,EACpC,CAACG,EAAOC,EAAU,GAAGC,CAAI,EAAIH,EAAK,MAAM,GAAG,EAEjD,GAAIG,EAAK,OAAS,GAAKH,EAAK,SAAS,GAAG,EAAG,OAAO,KAElD,GAAIE,IAAa,OAEf,OADIA,EAAS,SAAS,GAAG,GACrBD,EAAM,SAAS,GAAG,GAAK,CAACR,EAAU,KAAKQ,CAAK,EAAU,KAEnD,CAAE,WAAAF,EAAY,MAAOE,EAAM,WAAW,IAAK,EAAE,EAAG,SAAAC,CAAA,EAGzD,GAAIT,EAAU,KAAKQ,CAAK,QAAU,CAAE,WAAAF,EAAY,MAAOE,EAAM,WAAW,IAAK,EAAE,EAAG,SAAU,EAAA,EAE5F,KAAM,CAACG,EAASC,EAAO,GAAGC,CAAI,EAAIL,EAAM,MAAM,GAAG,EACjD,OAAIK,EAAK,OAAS,EAAU,KAErB,CAAE,WAAAP,EAAY,MAAOK,EAAS,SAAUC,GAAS,EAAA,CAC1D,EAGaE,EAAiB,CAACX,EAAeY,IAA8C,CAC1F,MAAMV,EAAOH,EAAgBC,CAAK,EAClC,GAAI,WAAW,KAAKE,CAAI,EAAG,OAAON,EAClC,MAAMiB,EAAQZ,EAAMC,CAAI,EAExB,GAAI,CAACW,EAAO,CAEV,MAAMT,EAAOF,EAAK,WAAW,GAAG,EAAIA,EAAK,MAAM,CAAC,EAAIA,EACpD,OAAOJ,EAAiB,KAAKM,CAAI,IAAMQ,EAAQ,IAAM,GAAK,CAACV,EAAK,WAAW,GAAG,GAC1E,KACAN,CACN,CAEA,KAAM,CAAE,WAAAO,EAAY,MAAAE,EAAO,SAAAC,CAAA,EAAaO,EACxC,GAAIV,GAAcS,EAAQ,KAAO,EAAG,OAAOhB,EAC3C,MAAMkB,EAAkB,KAAK,IAAIF,EAAQ,kBAAmBA,EAAQ,WAAW,EAG/E,GAFIN,EAAS,OAASQ,GAElBA,IAAoB,GAAKZ,EAAK,SAAS,GAAG,EAAG,OAAON,EACxD,GAAIS,IAAU,IAAMC,IAAa,GAAI,OAAO,KAE5C,MAAMS,EAAY,OAAO,GAAGV,CAAK,GAAGC,EAAS,OAAOM,EAAQ,YAAa,GAAG,CAAC,EAAE,EACzEI,EAASb,EAAa,CAACY,EAAYA,EAEnCE,EAAaD,EAAS,OAAO,KAAK,MAAMJ,EAAQ,GAAG,CAAC,EAEpDM,EAAaF,EAAS,OAAO,KAAK,MAAM,KAAK,IAAIJ,EAAQ,IAAK,CAAC,CAAC,CAAC,EACvE,OAAIK,GAAcC,EAAmBtB,EAG9B,OAAOoB,CAAM,EAAI,CAC1B,EAgBaG,EAAoB,CAACC,EAAeR,IAAyC,CACxF,KAAM,CAAE,YAAAS,EAAa,kBAAAC,EAAmB,UAAAC,CAAA,EAAcX,EAChDY,EAAS,OAAO,KAAK,IAAIJ,CAAK,CAAC,EAAE,SAASC,EAAc,EAAG,GAAG,EAC9DhB,EAAQmB,EAAO,MAAM,EAAGA,EAAO,OAASH,CAAW,EAEnDI,EADWD,EAAO,MAAMA,EAAO,OAASH,CAAW,EAAE,QAAQ,MAAO,EAAE,EAC7C,OAAO,KAAK,IAAIC,EAAmBD,CAAW,EAAG,GAAG,EAC7EK,EAAaH,EAAYlB,EAAM,QAAQ,wBAAyB,GAAG,EAAIA,EAG7E,MAAO,GAFMe,EAAQ,EAAI,IAAM,EAEjB,GAAGM,CAAU,GAAGD,IAAkB,GAAK,GAAK,IAAIA,CAAa,EAAE,EAC/E"}
@@ -6,13 +6,12 @@
6
6
  * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,
7
7
  * so "0,1" at 2 is exactly `10`, never `10.000000000000002`.
8
8
  *
9
- * ⚠ The GRAMMAR is the one of `@handijit/app-kit` `parseDecimal` (data contract §4.3), on
10
- * purpose and pinned by the same vectors in `__tests__/helpers/scaled-number.helper.test.ts`:
9
+ * ⚠ The GRAMMAR is the data contract's (§4.3), pinned by the vectors in `__tests__/helpers/scaled-number.helper.test.ts`:
11
10
  * the comma is the decimal point; with a comma, dots may only group the whole part by three;
12
11
  * without one, a dot followed by groups of three groups thousands ("1.250" is 1250) unless the
13
12
  * first group starts with zero ("0.250" is 0,25), and any other single dot is the point ("12.5"
14
- * is 12,5 — the dot key of a number pad). `ui` is a platform package and cannot import app-kit or
15
- * `@handijit/decimal`; the two copies must say the same thing, and the test is where they meet.
13
+ * is 12,5 — the dot key of a number pad). `ui` depends on no decimal library; the test table is the
14
+ * reference for the grammar.
16
15
  */
17
16
  /** Text the field cannot hold: the keystroke that produced it is refused. */
18
17
  export declare const REFUSED: unique symbol;