@lerianstudio/sindarian-ui 2.0.0-beta.25 → 2.0.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/charts/chart.js +4 -231
  2. package/dist/charts/index.js +1 -11
  3. package/dist/components/breadcrumb/get-breadcrumb-paths.js +1 -18
  4. package/dist/components/breadcrumb/index.js +1 -37
  5. package/dist/components/card/account-card/index.js +1 -69
  6. package/dist/components/card/basic-card/index.js +1 -20
  7. package/dist/components/card/dashboard-card/index.js +1 -20
  8. package/dist/components/card/entity-card/index.js +1 -68
  9. package/dist/components/card/index.js +1 -20
  10. package/dist/components/dialog/confirmation-dialog/index.js +1 -96
  11. package/dist/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -55
  12. package/dist/components/dialog/index.js +1 -19
  13. package/dist/components/dialog/large-dialog/index.js +1 -21
  14. package/dist/components/entity-box/index.js +1 -67
  15. package/dist/components/entity-data-table/index.js +1 -20
  16. package/dist/components/form/combo-box-field/index.js +1 -35
  17. package/dist/components/form/country-field/index.js +1 -11
  18. package/dist/components/form/date-picker-field/index.js +1 -83
  19. package/dist/components/form/date-range-field/index.js +1 -58
  20. package/dist/components/form/date-time-picker-field/index.js +1 -114
  21. package/dist/components/form/file-upload-field/index.js +1 -69
  22. package/dist/components/form/index.js +1 -31
  23. package/dist/components/form/input-field/index.js +1 -96
  24. package/dist/components/form/otp-field/index.js +1 -19
  25. package/dist/components/form/pagination-limit-field/index.js +1 -10
  26. package/dist/components/form/password-field/index.js +1 -16
  27. package/dist/components/form/radio-group-field/index.js +1 -36
  28. package/dist/components/form/renderable-label.js +1 -57
  29. package/dist/components/form/select-field/index.js +1 -68
  30. package/dist/components/form/state-field/index.js +1 -42
  31. package/dist/components/form/switch-field/index.js +1 -16
  32. package/dist/components/form/textarea-field/index.js +1 -23
  33. package/dist/components/page/index.js +1 -20
  34. package/dist/components/page-header/index.js +1 -80
  35. package/dist/components/pagination/index.js +1 -10
  36. package/dist/components/table/id-table-cell.js +1 -109
  37. package/dist/components/table/index.js +1 -19
  38. package/dist/components/table/locked-table-actions.js +1 -41
  39. package/dist/components/table/name-table-cell.js +1 -58
  40. package/dist/components/ui/accordion/index.js +1 -62
  41. package/dist/components/ui/alert/index.js +1 -45
  42. package/dist/components/ui/alert-dialog/index.js +1 -84
  43. package/dist/components/ui/autocomplete/index.js +1 -440
  44. package/dist/components/ui/autosize-textarea/index.js +1 -89
  45. package/dist/components/ui/avatar/index.js +1 -51
  46. package/dist/components/ui/badge/index.js +1 -83
  47. package/dist/components/ui/breadcrumb/index.js +1 -35
  48. package/dist/components/ui/button/index.js +1 -65
  49. package/dist/components/ui/calendar/index.js +1 -118
  50. package/dist/components/ui/card/index.js +1 -32
  51. package/dist/components/ui/checkbox/index.js +1 -44
  52. package/dist/components/ui/collapsible/index.js +1 -50
  53. package/dist/components/ui/command/index.js +1 -95
  54. package/dist/components/ui/copy-field/index.js +1 -163
  55. package/dist/components/ui/dialog/index.js +1 -80
  56. package/dist/components/ui/dropdown-menu/index.js +1 -110
  57. package/dist/components/ui/field/index.js +1 -82
  58. package/dist/components/ui/file-upload/index.js +1 -574
  59. package/dist/components/ui/form.js +1 -162
  60. package/dist/components/ui/hover-card/index.js +1 -51
  61. package/dist/components/ui/icon-button/index.js +1 -35
  62. package/dist/components/ui/input/adornment.js +1 -21
  63. package/dist/components/ui/input/index.js +1 -99
  64. package/dist/components/ui/label/index.js +1 -45
  65. package/dist/components/ui/lerian-wordmark/index.js +1 -7
  66. package/dist/components/ui/loading-button/index.js +1 -9
  67. package/dist/components/ui/multiple-select/index.js +1 -235
  68. package/dist/components/ui/otp-input/index.js +1 -62
  69. package/dist/components/ui/paper/index.js +1 -8
  70. package/dist/components/ui/paper-collapsible/index.js +1 -24
  71. package/dist/components/ui/popover/index.js +1 -55
  72. package/dist/components/ui/progress/index.js +1 -66
  73. package/dist/components/ui/qr-code/index.js +1 -27
  74. package/dist/components/ui/radio-group/index.js +1 -48
  75. package/dist/components/ui/scroll-area/index.js +1 -49
  76. package/dist/components/ui/select/index.js +1 -119
  77. package/dist/components/ui/separator/index.js +1 -43
  78. package/dist/components/ui/sheet/index.js +1 -136
  79. package/dist/components/ui/sidebar/index.js +1 -27
  80. package/dist/components/ui/sidebar/next-router.cjs +1 -119
  81. package/dist/components/ui/sidebar/sidebar-back-button.js +1 -8
  82. package/dist/components/ui/sidebar/sidebar-components.js +1 -23
  83. package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -49
  84. package/dist/components/ui/sidebar/sidebar-item-button.js +1 -21
  85. package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -52
  86. package/dist/components/ui/sidebar/sidebar-item-icon-button.js +1 -18
  87. package/dist/components/ui/sidebar/sidebar-item.js +1 -44
  88. package/dist/components/ui/sidebar/sidebar-provider.js +1 -201
  89. package/dist/components/ui/sidebar/sidebar-root.js +1 -130
  90. package/dist/components/ui/sidebar/sidebar-router.js +1 -126
  91. package/dist/components/ui/sidebar/sidebar-trigger.js +1 -57
  92. package/dist/components/ui/skeleton/index.js +1 -8
  93. package/dist/components/ui/stepper/index.js +1 -29
  94. package/dist/components/ui/switch/index.js +1 -43
  95. package/dist/components/ui/table/index.js +1 -56
  96. package/dist/components/ui/tabs/index.js +1 -55
  97. package/dist/components/ui/textarea/index.js +1 -8
  98. package/dist/components/ui/time-picker/index.js +1 -85
  99. package/dist/components/ui/toast/index.js +1 -3
  100. package/dist/components/ui/toast/toaster.js +1 -16
  101. package/dist/components/ui/toggle-group/index.js +1 -156
  102. package/dist/components/ui/tooltip/index.js +1 -81
  103. package/dist/domain/blotter/index.js +1 -20
  104. package/dist/domain/delinquency-aging/aging-buckets.js +1 -120
  105. package/dist/domain/delinquency-aging/index.js +1 -222
  106. package/dist/domain/figure/index.js +1 -19
  107. package/dist/domain/format.js +1 -137
  108. package/dist/domain/index.js +1 -43
  109. package/dist/domain/key-id/index.js +1 -174
  110. package/dist/domain/ledger-sheet/index.js +1 -28
  111. package/dist/domain/money-diff.js +1 -48
  112. package/dist/domain/money-math.js +1 -104
  113. package/dist/domain/money-text/index.js +1 -123
  114. package/dist/domain/section-label/index.js +1 -17
  115. package/dist/domain/status-rail/index.js +1 -76
  116. package/dist/domain/threshold-gauge/index.js +1 -161
  117. package/dist/enterprise/alert-banner/index.js +1 -24
  118. package/dist/enterprise/app-shell/index.js +1 -87
  119. package/dist/enterprise/cursor-pager/index.js +1 -26
  120. package/dist/enterprise/data-table/column-size.js +1 -103
  121. package/dist/enterprise/data-table/index.js +1 -345
  122. package/dist/enterprise/date-range-picker/index.js +1 -115
  123. package/dist/enterprise/detail-panel/index.js +1 -20
  124. package/dist/enterprise/empty-state/index.js +1 -14
  125. package/dist/enterprise/index.js +1 -39
  126. package/dist/enterprise/number-input/index.js +1 -252
  127. package/dist/enterprise/search-input/index.js +1 -121
  128. package/dist/enterprise/stat-card/index.js +1 -75
  129. package/dist/enterprise/status-badge/index.js +1 -120
  130. package/dist/enterprise/use-is-mobile.js +1 -68
  131. package/dist/enterprise/virtualized-table/index.js +1 -141
  132. package/dist/esm/charts/chart.js +4 -190
  133. package/dist/esm/charts/index.js +1 -3
  134. package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +1 -12
  135. package/dist/esm/components/breadcrumb/index.js +1 -30
  136. package/dist/esm/components/card/account-card/index.js +1 -53
  137. package/dist/esm/components/card/basic-card/index.js +1 -14
  138. package/dist/esm/components/card/dashboard-card/index.js +1 -14
  139. package/dist/esm/components/card/entity-card/index.js +1 -52
  140. package/dist/esm/components/card/index.js +1 -4
  141. package/dist/esm/components/dialog/confirmation-dialog/index.js +1 -60
  142. package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -49
  143. package/dist/esm/components/dialog/index.js +1 -3
  144. package/dist/esm/components/dialog/large-dialog/index.js +1 -16
  145. package/dist/esm/components/entity-box/index.js +1 -56
  146. package/dist/esm/components/entity-data-table/index.js +1 -17
  147. package/dist/esm/components/form/combo-box-field/index.js +1 -28
  148. package/dist/esm/components/form/country-field/index.js +1 -7
  149. package/dist/esm/components/form/date-picker-field/index.js +1 -43
  150. package/dist/esm/components/form/date-range-field/index.js +1 -18
  151. package/dist/esm/components/form/date-time-picker-field/index.js +1 -74
  152. package/dist/esm/components/form/file-upload-field/index.js +1 -65
  153. package/dist/esm/components/form/index.js +1 -15
  154. package/dist/esm/components/form/input-field/index.js +1 -92
  155. package/dist/esm/components/form/otp-field/index.js +1 -15
  156. package/dist/esm/components/form/pagination-limit-field/index.js +1 -6
  157. package/dist/esm/components/form/password-field/index.js +1 -10
  158. package/dist/esm/components/form/radio-group-field/index.js +1 -32
  159. package/dist/esm/components/form/renderable-label.js +1 -54
  160. package/dist/esm/components/form/select-field/index.js +1 -64
  161. package/dist/esm/components/form/state-field/index.js +1 -35
  162. package/dist/esm/components/form/switch-field/index.js +1 -12
  163. package/dist/esm/components/form/textarea-field/index.js +1 -19
  164. package/dist/esm/components/page/index.js +1 -15
  165. package/dist/esm/components/page-header/index.js +1 -71
  166. package/dist/esm/components/pagination/index.js +1 -6
  167. package/dist/esm/components/table/id-table-cell.js +1 -105
  168. package/dist/esm/components/table/index.js +1 -3
  169. package/dist/esm/components/table/locked-table-actions.js +1 -37
  170. package/dist/esm/components/table/name-table-cell.js +1 -54
  171. package/dist/esm/components/ui/accordion/index.js +1 -24
  172. package/dist/esm/components/ui/alert/index.js +1 -38
  173. package/dist/esm/components/ui/alert-dialog/index.js +1 -39
  174. package/dist/esm/components/ui/autocomplete/index.js +1 -392
  175. package/dist/esm/components/ui/autosize-textarea/index.js +1 -51
  176. package/dist/esm/components/ui/avatar/index.js +1 -14
  177. package/dist/esm/components/ui/badge/index.js +1 -79
  178. package/dist/esm/components/ui/breadcrumb/index.js +1 -27
  179. package/dist/esm/components/ui/button/index.js +1 -60
  180. package/dist/esm/components/ui/calendar/index.js +1 -82
  181. package/dist/esm/components/ui/card/index.js +1 -24
  182. package/dist/esm/components/ui/checkbox/index.js +1 -9
  183. package/dist/esm/components/ui/collapsible/index.js +1 -13
  184. package/dist/esm/components/ui/command/index.js +1 -51
  185. package/dist/esm/components/ui/copy-field/index.js +1 -127
  186. package/dist/esm/components/ui/dialog/index.js +1 -36
  187. package/dist/esm/components/ui/dropdown-menu/index.js +1 -60
  188. package/dist/esm/components/ui/field/index.js +1 -71
  189. package/dist/esm/components/ui/file-upload/index.js +1 -536
  190. package/dist/esm/components/ui/form.js +1 -118
  191. package/dist/esm/components/ui/hover-card/index.js +1 -14
  192. package/dist/esm/components/ui/icon-button/index.js +1 -31
  193. package/dist/esm/components/ui/input/adornment.js +1 -17
  194. package/dist/esm/components/ui/input/index.js +1 -60
  195. package/dist/esm/components/ui/label/index.js +1 -10
  196. package/dist/esm/components/ui/lerian-wordmark/index.js +1 -4
  197. package/dist/esm/components/ui/loading-button/index.js +1 -7
  198. package/dist/esm/components/ui/multiple-select/index.js +1 -196
  199. package/dist/esm/components/ui/otp-input/index.js +1 -21
  200. package/dist/esm/components/ui/paper/index.js +1 -5
  201. package/dist/esm/components/ui/paper-collapsible/index.js +1 -19
  202. package/dist/esm/components/ui/popover/index.js +1 -17
  203. package/dist/esm/components/ui/progress/index.js +1 -31
  204. package/dist/esm/components/ui/qr-code/index.js +1 -24
  205. package/dist/esm/components/ui/radio-group/index.js +1 -12
  206. package/dist/esm/components/ui/scroll-area/index.js +1 -13
  207. package/dist/esm/components/ui/select/index.js +1 -74
  208. package/dist/esm/components/ui/separator/index.js +1 -8
  209. package/dist/esm/components/ui/sheet/index.js +1 -92
  210. package/dist/esm/components/ui/sidebar/index.js +1 -11
  211. package/dist/esm/components/ui/sidebar/next-router.cjs +1 -119
  212. package/dist/esm/components/ui/sidebar/sidebar-back-button.js +1 -5
  213. package/dist/esm/components/ui/sidebar/sidebar-components.js +1 -15
  214. package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -42
  215. package/dist/esm/components/ui/sidebar/sidebar-item-button.js +1 -18
  216. package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -44
  217. package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +1 -14
  218. package/dist/esm/components/ui/sidebar/sidebar-item.js +1 -40
  219. package/dist/esm/components/ui/sidebar/sidebar-provider.js +1 -193
  220. package/dist/esm/components/ui/sidebar/sidebar-root.js +1 -126
  221. package/dist/esm/components/ui/sidebar/sidebar-router.js +1 -89
  222. package/dist/esm/components/ui/sidebar/sidebar-trigger.js +1 -53
  223. package/dist/esm/components/ui/skeleton/index.js +1 -6
  224. package/dist/esm/components/ui/stepper/index.js +1 -20
  225. package/dist/esm/components/ui/switch/index.js +1 -8
  226. package/dist/esm/components/ui/table/index.js +1 -44
  227. package/dist/esm/components/ui/tabs/index.js +1 -17
  228. package/dist/esm/components/ui/textarea/index.js +1 -6
  229. package/dist/esm/components/ui/time-picker/index.js +1 -49
  230. package/dist/esm/components/ui/toast/index.js +1 -2
  231. package/dist/esm/components/ui/toast/toaster.js +1 -13
  232. package/dist/esm/components/ui/toggle-group/index.js +1 -120
  233. package/dist/esm/components/ui/tooltip/index.js +1 -43
  234. package/dist/esm/domain/blotter/index.js +1 -16
  235. package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -115
  236. package/dist/esm/domain/delinquency-aging/index.js +1 -218
  237. package/dist/esm/domain/figure/index.js +1 -15
  238. package/dist/esm/domain/format.js +1 -128
  239. package/dist/esm/domain/index.js +1 -19
  240. package/dist/esm/domain/key-id/index.js +1 -169
  241. package/dist/esm/domain/ledger-sheet/index.js +1 -24
  242. package/dist/esm/domain/money-diff.js +1 -45
  243. package/dist/esm/domain/money-math.js +1 -98
  244. package/dist/esm/domain/money-text/index.js +1 -118
  245. package/dist/esm/domain/section-label/index.js +1 -14
  246. package/dist/esm/domain/status-rail/index.js +1 -71
  247. package/dist/esm/domain/threshold-gauge/index.js +1 -157
  248. package/dist/esm/enterprise/alert-banner/index.js +1 -21
  249. package/dist/esm/enterprise/app-shell/index.js +1 -51
  250. package/dist/esm/enterprise/cursor-pager/index.js +1 -23
  251. package/dist/esm/enterprise/data-table/column-size.js +1 -97
  252. package/dist/esm/enterprise/data-table/index.js +1 -342
  253. package/dist/esm/enterprise/date-range-picker/index.js +1 -112
  254. package/dist/esm/enterprise/detail-panel/index.js +1 -17
  255. package/dist/esm/enterprise/empty-state/index.js +1 -11
  256. package/dist/esm/enterprise/index.js +1 -22
  257. package/dist/esm/enterprise/number-input/index.js +1 -214
  258. package/dist/esm/enterprise/search-input/index.js +1 -85
  259. package/dist/esm/enterprise/stat-card/index.js +1 -72
  260. package/dist/esm/enterprise/status-badge/index.js +1 -116
  261. package/dist/esm/enterprise/use-is-mobile.js +1 -31
  262. package/dist/esm/enterprise/virtualized-table/index.js +1 -138
  263. package/dist/esm/hooks/use-click-away.js +1 -22
  264. package/dist/esm/hooks/use-pagination.js +1 -38
  265. package/dist/esm/hooks/use-stepper.js +1 -22
  266. package/dist/esm/hooks/use-time.js +1 -13
  267. package/dist/esm/hooks/use-toast.js +1 -107
  268. package/dist/esm/index.js +1 -77
  269. package/dist/esm/lib/storage/get-storage-object.js +1 -17
  270. package/dist/esm/lib/storage/get-storage.js +1 -14
  271. package/dist/esm/lib/storage/index.js +1 -2
  272. package/dist/esm/lib/typography.js +1 -31
  273. package/dist/esm/lib/utils.js +1 -41
  274. package/dist/esm/theme/get-theme-script.js +1 -41
  275. package/dist/esm/theme/index.js +1 -4
  276. package/dist/esm/theme/mode-toggle.js +1 -45
  277. package/dist/esm/theme/theme-provider.js +1 -122
  278. package/dist/esm/toast/helpers.js +1 -36
  279. package/dist/esm/toast/index.js +1 -4
  280. package/dist/esm/types/metadata-type.js +1 -1
  281. package/dist/esm/utils/countries.cjs +1 -17
  282. package/dist/esm/utils/country-utils.js +1 -18
  283. package/dist/esm/utils/currency-codes.js +1 -181
  284. package/dist/hooks/use-click-away.js +1 -29
  285. package/dist/hooks/use-pagination.js +1 -41
  286. package/dist/hooks/use-stepper.js +1 -26
  287. package/dist/hooks/use-time.js +1 -20
  288. package/dist/hooks/use-toast.js +1 -111
  289. package/dist/index.js +1 -96
  290. package/dist/lib/storage/get-storage-object.js +1 -23
  291. package/dist/lib/storage/get-storage.js +1 -17
  292. package/dist/lib/storage/index.js +1 -18
  293. package/dist/lib/typography.js +1 -34
  294. package/dist/lib/utils.js +1 -45
  295. package/dist/theme/get-theme-script.js +1 -44
  296. package/dist/theme/index.js +1 -11
  297. package/dist/theme/mode-toggle.js +1 -48
  298. package/dist/theme/theme-provider.js +1 -160
  299. package/dist/toast/helpers.js +1 -41
  300. package/dist/toast/index.js +1 -10
  301. package/dist/types/metadata-type.js +1 -2
  302. package/dist/utils/countries.cjs +1 -17
  303. package/dist/utils/country-utils.js +1 -25
  304. package/dist/utils/currency-codes.js +1 -184
  305. package/package.json +4 -3
@@ -1,45 +1 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Monitor, Moon, Sun } from 'lucide-react';
4
- import { cn } from '../lib/utils.js';
5
- import { useTheme } from './theme-provider.js';
6
- const SEGMENTS = [
7
- { value: 'light', icon: Sun },
8
- { value: 'system', icon: Monitor },
9
- { value: 'dark', icon: Moon }
10
- ];
11
- const DEFAULT_LABELS = {
12
- light: 'Light',
13
- system: 'System',
14
- dark: 'Dark',
15
- group: 'Theme'
16
- };
17
- /**
18
- * Merge overrides over the defaults, IGNORING blank ones. A plain spread lets
19
- * `labels={{ light: '' }}` win, and every segment here is icon-only — so a blank
20
- * override leaves a button (or the whole group) with `aria-label=""`, which names
21
- * it "" AND suppresses the element's other naming routes. That is strictly worse
22
- * than the missing translation it came from: an untranslated English label is
23
- * usable, a nameless button is not. A blank string is a missing value, not a
24
- * chosen one.
25
- */
26
- function resolveLabels(labels) {
27
- const resolved = { ...DEFAULT_LABELS };
28
- for (const key of Object.keys(DEFAULT_LABELS)) {
29
- const override = labels?.[key];
30
- if (override?.trim())
31
- resolved[key] = override;
32
- }
33
- return resolved;
34
- }
35
- export function ModeToggle({ labels, className }) {
36
- const { theme, setTheme } = useTheme();
37
- const resolved = resolveLabels(labels);
38
- return (_jsx("div", { role: "group", "aria-label": resolved.group, className: cn('border-input bg-card grid w-fit grid-cols-3 rounded-md border p-0.5 shadow-[var(--shadow-card)]', className), children: SEGMENTS.map(({ value, icon: Icon }) => {
39
- const active = value === theme;
40
- const label = resolved[value];
41
- return (_jsx("button", { type: "button", "aria-pressed": active, "aria-label": label, title: label, onClick: () => setTheme(value), className: cn('focus-visible:ring-ring flex items-center justify-center rounded-sm px-2 py-1.5 transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:outline-none', active
42
- ? 'bg-secondary text-secondary-foreground'
43
- : 'text-muted-foreground hover:text-foreground'), children: _jsx(Icon, { className: "size-4", "aria-hidden": true }) }, value));
44
- }) }));
45
- }
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import{Monitor as m,Moon as f,Sun as g}from"lucide-react";import{cn as d}from"../lib/utils.js";import{useTheme as p}from"./theme-provider.js";const b=[{value:"light",icon:g},{value:"system",icon:m},{value:"dark",icon:f}];const l={light:"Light",system:"System",dark:"Dark",group:"Theme"};function h(s){const e={...l};for(const o of Object.keys(l)){const r=s?.[o];if(r?.trim())e[o]=r}return e}export function ModeToggle({labels:s,className:e}){const{theme:o,setTheme:r}=p();const i=h(s);return n("div",{role:"group","aria-label":i.group,className:d("border-input bg-card grid w-fit grid-cols-3 rounded-md border p-0.5 shadow-[var(--shadow-card)]",e),children:b.map(({value:t,icon:u})=>{const c=t===o;const a=i[t];return n("button",{type:"button","aria-pressed":c,"aria-label":a,title:a,onClick:()=>r(t),className:d("focus-visible:ring-ring flex items-center justify-center rounded-sm px-2 py-1.5 transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:outline-none",c?"bg-secondary text-secondary-foreground":"text-muted-foreground hover:text-foreground"),children:n(u,{className:"size-4","aria-hidden":true})},t)})})}
@@ -1,122 +1 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- /**
4
- * ThemeProvider — owns theme preference ('light' | 'dark' | 'system'),
5
- * persists it to localStorage, applies the `.dark` class on
6
- * `document.documentElement`, and resolves 'system' via
7
- * `prefers-color-scheme`.
8
- *
9
- * SSR-safe: state initializes to `defaultTheme` and never reads
10
- * window/localStorage during render. The persisted value is read inside an
11
- * effect on mount, so first paint uses `defaultTheme`. Pair with
12
- * `getThemeScript` in the document <head> to remove the flash before paint.
13
- *
14
- * Same-tab sync is handled by React context (every consumer reads the same
15
- * provider state); cross-tab sync rides the native `storage` event. While the
16
- * preference is 'system', `matchMedia('change')` keeps the resolved value live.
17
- * Theme switches are instant by design — no global color transition.
18
- */
19
- import * as React from 'react';
20
- const DARK_QUERY = '(prefers-color-scheme: dark)';
21
- function isThemePreference(value) {
22
- return value === 'light' || value === 'dark' || value === 'system';
23
- }
24
- function systemPrefersDark() {
25
- if (typeof window === 'undefined' ||
26
- typeof window.matchMedia !== 'function') {
27
- return false;
28
- }
29
- return window.matchMedia(DARK_QUERY).matches;
30
- }
31
- const ThemeContext = React.createContext(null);
32
- export function ThemeProvider({ children, storageKey = 'sindarian.theme', defaultTheme = 'system' }) {
33
- const [theme, setThemeState] = React.useState(defaultTheme);
34
- const [resolvedTheme, setResolvedTheme] = React.useState(defaultTheme === 'dark' ? 'dark' : 'light');
35
- const setTheme = React.useCallback((next) => {
36
- setThemeState(next);
37
- if (typeof window === 'undefined')
38
- return;
39
- try {
40
- window.localStorage.setItem(storageKey, next);
41
- }
42
- catch {
43
- // Storage unavailable (private mode, quota). In-memory state still works.
44
- }
45
- }, [storageKey]);
46
- // Read the persisted preference once on mount (effect, never render).
47
- React.useEffect(() => {
48
- if (typeof window === 'undefined')
49
- return;
50
- try {
51
- const stored = window.localStorage.getItem(storageKey);
52
- if (isThemePreference(stored))
53
- setThemeState(stored);
54
- }
55
- catch {
56
- // Ignore; keep defaultTheme.
57
- }
58
- }, [storageKey]);
59
- // Apply the resolved class; while 'system', track prefers-color-scheme live.
60
- React.useEffect(() => {
61
- if (typeof document === 'undefined')
62
- return;
63
- const apply = (dark) => {
64
- document.documentElement.classList.toggle('dark', dark);
65
- setResolvedTheme(dark ? 'dark' : 'light');
66
- };
67
- apply(theme === 'system' ? systemPrefersDark() : theme === 'dark');
68
- if (theme !== 'system' || typeof window.matchMedia !== 'function') {
69
- return;
70
- }
71
- const media = window.matchMedia(DARK_QUERY);
72
- const onChange = (event) => apply(event.matches);
73
- media.addEventListener('change', onChange);
74
- return () => media.removeEventListener('change', onChange);
75
- }, [theme]);
76
- // Cross-tab sync: the native `storage` event only fires in OTHER tabs.
77
- React.useEffect(() => {
78
- if (typeof window === 'undefined')
79
- return;
80
- const onStorage = (event) => {
81
- // WHICH STORE first, then which key. Only the store the preference lives
82
- // in may change it: a sessionStorage event carrying the SAME key would
83
- // otherwise mutate a localStorage-backed preference. `storageArea` is
84
- // absent only on a hand-dispatched synthetic event — apps use those for
85
- // same-tab sync — and one of those is not attributable to any store, so it
86
- // is allowed through rather than silently dropped.
87
- if (event.storageArea != null &&
88
- event.storageArea !== window.localStorage)
89
- return;
90
- // A null key means another tab called `clear()` on the whole store, so the
91
- // stored preference is gone even though it is not named. Returning early
92
- // on that left the provider holding a deleted preference — and the wrong
93
- // `dark` class on the document. Fall through with newValue null, which
94
- // lands on the fallback.
95
- if (event.key !== null && event.key !== storageKey)
96
- return;
97
- setThemeState(isThemePreference(event.newValue) ? event.newValue : defaultTheme);
98
- };
99
- window.addEventListener('storage', onStorage);
100
- return () => window.removeEventListener('storage', onStorage);
101
- }, [storageKey, defaultTheme]);
102
- const value = React.useMemo(() => ({ theme, setTheme, resolvedTheme }), [theme, setTheme, resolvedTheme]);
103
- return _jsx(ThemeContext.Provider, { value: value, children: children });
104
- }
105
- /** Reads the theme context. Throws if used outside a ThemeProvider. */
106
- export function useTheme() {
107
- const context = React.useContext(ThemeContext);
108
- if (context === null) {
109
- throw new Error('useTheme must be used within a ThemeProvider');
110
- }
111
- return context;
112
- }
113
- /**
114
- * Reads the theme context without requiring a provider — `undefined` when
115
- * there is none. For library components that should follow the theme when one
116
- * exists but must not force every consumer to mount a ThemeProvider (Toaster).
117
- * Not re-exported from the package barrel: consumers use `useTheme`, whose
118
- * throw is the intended signal that the provider is missing.
119
- */
120
- export function useOptionalTheme() {
121
- return React.useContext(ThemeContext) ?? undefined;
122
- }
1
+ "use client";import{jsx as g}from"react/jsx-runtime";import*as t from"react";const w="(prefers-color-scheme: dark)";function l(r){return r==="light"||r==="dark"||r==="system"}function y(){if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}return window.matchMedia(w).matches}const u=t.createContext(null);export function ThemeProvider({children:r,storageKey:o="sindarian.theme",defaultTheme:s="system"}){const[i,d]=t.useState(s);const[a,h]=t.useState(s==="dark"?"dark":"light");const f=t.useCallback(e=>{d(e);if(typeof window==="undefined")return;try{window.localStorage.setItem(o,e)}catch{}},[o]);t.useEffect(()=>{if(typeof window==="undefined")return;try{const e=window.localStorage.getItem(o);if(l(e))d(e)}catch{}},[o]);t.useEffect(()=>{if(typeof document==="undefined")return;const e=c=>{document.documentElement.classList.toggle("dark",c);h(c?"dark":"light")};e(i==="system"?y():i==="dark");if(i!=="system"||typeof window.matchMedia!=="function"){return}const n=window.matchMedia(w);const m=c=>e(c.matches);n.addEventListener("change",m);return()=>n.removeEventListener("change",m)},[i]);t.useEffect(()=>{if(typeof window==="undefined")return;const e=n=>{if(n.storageArea!=null&&n.storageArea!==window.localStorage)return;if(n.key!==null&&n.key!==o)return;d(l(n.newValue)?n.newValue:s)};window.addEventListener("storage",e);return()=>window.removeEventListener("storage",e)},[o,s]);const p=t.useMemo(()=>({theme:i,setTheme:f,resolvedTheme:a}),[i,f,a]);return g(u.Provider,{value:p,children:r})}export function useTheme(){const r=t.useContext(u);if(r===null){throw new Error("useTheme must be used within a ThemeProvider")}return r}export function useOptionalTheme(){return t.useContext(u)??void 0}
@@ -1,36 +1 @@
1
- 'use client';
2
- /**
3
- * Severity toast helpers — thin wrappers over sindarian-ui's own toast
4
- * machinery (`@/hooks/use-toast`), which renders through `<Toaster />`.
5
- *
6
- * The bare `toast` is deliberately NOT re-exported here: sindarian-ui already
7
- * exports it from the main barrel, and one name must resolve to one function.
8
- * Call `toast({ title, description, variant })` directly when a helper does not
9
- * fit.
10
- *
11
- * Variant mapping — one helper per severity, onto sindarian-ui's own variants:
12
- *
13
- * successToast → 'success' (green)
14
- * errorToast → 'destructive' (red)
15
- * warningToast → 'warning' (amber)
16
- */
17
- import { toast } from '../hooks/use-toast.js';
18
- function raise(variant, title, description, opts) {
19
- toast({
20
- action: opts?.action,
21
- variant,
22
- title,
23
- description,
24
- duration: opts?.duration,
25
- id: opts?.id
26
- });
27
- }
28
- export function successToast(title, description, opts) {
29
- raise('success', title, description, opts);
30
- }
31
- export function errorToast(title, description, opts) {
32
- raise('destructive', title, description, opts);
33
- }
34
- export function warningToast(title, description, opts) {
35
- raise('warning', title, description, opts);
36
- }
1
+ "use client";import{toast as c}from"../hooks/use-toast.js";function r(t,n,i,o){c({action:o?.action,variant:t,title:n,description:i,duration:o?.duration,id:o?.id})}export function successToast(t,n,i){r("success",t,n,i)}export function errorToast(t,n,i){r("destructive",t,n,i)}export function warningToast(t,n,i){r("warning",t,n,i)}
@@ -1,4 +1 @@
1
- // Owned by lane theme-toasts-charts — see docs/plans/2026-08-26-sindarian-x-retirement/
2
- // NOTE: the bare `toast` is NOT re-exported here — sindarian-ui's main barrel
3
- // already exports it from `@/hooks/use-toast`.
4
- export { successToast, errorToast, warningToast } from './helpers.js';
1
+ export{successToast,errorToast,warningToast}from"./helpers.js";
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1,17 +1 @@
1
- 'use strict'
2
-
3
- /**
4
- * The country/state dataset, loaded through CommonJS on purpose.
5
- *
6
- * A plain `import ... from './countries.json'` compiles fine, but Node's ESM
7
- * loader rejects it without an `with { type: 'json' }` attribute — and that
8
- * attribute cannot be written once for a dual build: TypeScript refuses it in
9
- * any file that compiles to a `require` call (TS2856). Since a JSON `require`
10
- * needs no attribute in either output, the one-line load lives here, in a
11
- * `.cjs` file that is CommonJS inside `dist/` and inside `dist/esm/` alike.
12
- *
13
- * Without this, `import '@lerianstudio/sindarian-ui'` throws
14
- * ERR_IMPORT_ATTRIBUTE_MISSING under any native-ESM consumer — Vitest, which
15
- * externalises ESM dependencies, being the one the apps actually hit.
16
- */
17
- module.exports = require('../public/countries.json')
1
+ "use strict";module.exports=require("../public/countries.json");
@@ -1,18 +1 @@
1
- import countriesJson from './countries.cjs';
2
- const getCountries = () => {
3
- return countriesJson.map((country) => ({
4
- code: country.code2,
5
- name: country.name,
6
- states: country.states.map((state) => ({
7
- name: state.name,
8
- code: state.code
9
- }))
10
- }));
11
- };
12
- const getStateCountry = (country) => {
13
- const selectedCountry = getCountries().find((countryItem) => countryItem.code === country || countryItem.name === country);
14
- if (!selectedCountry)
15
- return [];
16
- return selectedCountry.states || [];
17
- };
18
- export { getCountries, getStateCountry };
1
+ import s from"./countries.cjs";const o=()=>{return s.map(e=>({code:e.code2,name:e.name,states:e.states.map(t=>({name:t.name,code:t.code}))}))};const a=e=>{const t=o().find(n=>n.code===e||n.name===e);if(!t)return[];return t.states||[]};export{o as getCountries,a as getStateCountry};
@@ -1,181 +1 @@
1
- export const currencyCodes = [
2
- 'AED',
3
- 'AFN',
4
- 'ALL',
5
- 'AMD',
6
- 'ANG',
7
- 'AOA',
8
- 'ARS',
9
- 'AUD',
10
- 'AWG',
11
- 'AZN',
12
- 'BAM',
13
- 'BBD',
14
- 'BDT',
15
- 'BGN',
16
- 'BHD',
17
- 'BIF',
18
- 'BMD',
19
- 'BND',
20
- 'BOB',
21
- 'BOV',
22
- 'BRL',
23
- 'BSD',
24
- 'BTN',
25
- 'BWP',
26
- 'BYR',
27
- 'BZD',
28
- 'CAD',
29
- 'CDF',
30
- 'CHE',
31
- 'CHF',
32
- 'CHW',
33
- 'CLF',
34
- 'CLP',
35
- 'CNY',
36
- 'COP',
37
- 'COU',
38
- 'CRC',
39
- 'CUC',
40
- 'CUP',
41
- 'CVE',
42
- 'CZK',
43
- 'DJF',
44
- 'DKK',
45
- 'DOP',
46
- 'DZD',
47
- 'EGP',
48
- 'ERN',
49
- 'ETB',
50
- 'EUR',
51
- 'FJD',
52
- 'FKP',
53
- 'GBP',
54
- 'GEL',
55
- 'GHS',
56
- 'GIP',
57
- 'GMD',
58
- 'GNF',
59
- 'GTQ',
60
- 'GYD',
61
- 'HKD',
62
- 'HNL',
63
- 'HRK',
64
- 'HTG',
65
- 'HUF',
66
- 'IDR',
67
- 'ILS',
68
- 'INR',
69
- 'IQD',
70
- 'IRR',
71
- 'ISK',
72
- 'JMD',
73
- 'JOD',
74
- 'JPY',
75
- 'KES',
76
- 'KGS',
77
- 'KHR',
78
- 'KMF',
79
- 'KPW',
80
- 'KRW',
81
- 'KWD',
82
- 'KYD',
83
- 'KZT',
84
- 'LAK',
85
- 'LBP',
86
- 'LKR',
87
- 'LRD',
88
- 'LSL',
89
- 'LTL',
90
- 'LVL',
91
- 'LYD',
92
- 'MAD',
93
- 'MDL',
94
- 'MGA',
95
- 'MKD',
96
- 'MMK',
97
- 'MNT',
98
- 'MOP',
99
- 'MRO',
100
- 'MUR',
101
- 'MVR',
102
- 'MWK',
103
- 'MXN',
104
- 'MXV',
105
- 'MYR',
106
- 'MZN',
107
- 'NAD',
108
- 'NGN',
109
- 'NIO',
110
- 'NOK',
111
- 'NPR',
112
- 'NZD',
113
- 'OMR',
114
- 'PAB',
115
- 'PEN',
116
- 'PGK',
117
- 'PHP',
118
- 'PKR',
119
- 'PLN',
120
- 'PYG',
121
- 'QAR',
122
- 'RON',
123
- 'RSD',
124
- 'RUB',
125
- 'RWF',
126
- 'SAR',
127
- 'SBD',
128
- 'SCR',
129
- 'SDG',
130
- 'SEK',
131
- 'SGD',
132
- 'SHP',
133
- 'SLL',
134
- 'SOS',
135
- 'SRD',
136
- 'SSP',
137
- 'STD',
138
- 'SYP',
139
- 'SZL',
140
- 'THB',
141
- 'TJS',
142
- 'TMT',
143
- 'TND',
144
- 'TOP',
145
- 'TRY',
146
- 'TTD',
147
- 'TWD',
148
- 'TZS',
149
- 'UAH',
150
- 'UGX',
151
- 'USD',
152
- 'USN',
153
- 'USS',
154
- 'UYI',
155
- 'UYU',
156
- 'UZS',
157
- 'VEF',
158
- 'VND',
159
- 'VUV',
160
- 'WST',
161
- 'XAF',
162
- 'XAG',
163
- 'XAU',
164
- 'XBA',
165
- 'XBB',
166
- 'XBC',
167
- 'XBD',
168
- 'XCD',
169
- 'XDR',
170
- 'XFU',
171
- 'XOF',
172
- 'XPD',
173
- 'XPF',
174
- 'XPT',
175
- 'XTS',
176
- 'XXX',
177
- 'YER',
178
- 'ZAR',
179
- 'ZMW'
180
- ];
181
- export const currencyObjects = currencyCodes.map((code) => ({ code }));
1
+ export const currencyCodes=["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYR","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LVL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRO","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STD","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","USS","UYI","UYU","UZS","VEF","VND","VUV","WST","XAF","XAG","XAU","XBA","XBB","XBC","XBD","XCD","XDR","XFU","XOF","XPD","XPF","XPT","XTS","XXX","YER","ZAR","ZMW"];export const currencyObjects=currencyCodes.map(D=>({code:D}));
@@ -1,29 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useClickAway = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- /**
9
- * Detects clicks outside of a specified component and triggers a callback function.
10
- *
11
- * @param ref Component reference
12
- * @param onClickAway Callback function to be called when a click is detected outside the component
13
- */
14
- const useClickAway = (ref, onClickAway) => {
15
- const handleClick = react_1.default.useCallback((event) => {
16
- if (ref.current && !ref.current.contains(event.target)) {
17
- onClickAway(event);
18
- }
19
- }, [ref, onClickAway]);
20
- react_1.default.useEffect(() => {
21
- document.addEventListener('mousedown', handleClick);
22
- document.addEventListener('touchend', handleClick);
23
- return () => {
24
- document.removeEventListener('mousedown', handleClick);
25
- document.removeEventListener('touchend', handleClick);
26
- };
27
- }, [ref, handleClick]);
28
- };
29
- exports.useClickAway = useClickAway;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(exports,"__esModule",{value:true});exports.useClickAway=void 0;const react_1=__importDefault(require("react"));const useClickAway=(e,u)=>{const t=react_1.default.useCallback(n=>{if(e.current&&!e.current.contains(n.target)){u(n)}},[e,u]);react_1.default.useEffect(()=>{document.addEventListener("mousedown",t);document.addEventListener("touchend",t);return()=>{document.removeEventListener("mousedown",t);document.removeEventListener("touchend",t)}},[e,t])};exports.useClickAway=useClickAway;
@@ -1,41 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePagination = usePagination;
4
- const react_1 = require("react");
5
- function usePagination({ total = 1 }) {
6
- const [page, _setPage] = (0, react_1.useState)(1);
7
- const [limit, _setLimit] = (0, react_1.useState)(10);
8
- const totalPages = Math.ceil(total / limit);
9
- const nextPage = () => {
10
- if (page + 1 > totalPages) {
11
- return;
12
- }
13
- _setPage((page) => page + 1);
14
- };
15
- const previousPage = () => {
16
- if (page - 1 < 1) {
17
- return;
18
- }
19
- _setPage((page) => page - 1);
20
- };
21
- const setPage = (page) => {
22
- if (page < 1 || page > totalPages) {
23
- return;
24
- }
25
- _setPage(page);
26
- };
27
- const setLimit = (limit) => {
28
- if (limit < 1) {
29
- return;
30
- }
31
- _setLimit(limit);
32
- };
33
- return {
34
- page,
35
- limit,
36
- setLimit,
37
- setPage,
38
- nextPage,
39
- previousPage
40
- };
41
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.usePagination=usePagination;const react_1=require("react");function usePagination({total:i=1}){const[e,s]=(0,react_1.useState)(1);const[n,o]=(0,react_1.useState)(10);const r=Math.ceil(i/n);const u=()=>{if(e+1>r){return}s(t=>t+1)};const a=()=>{if(e-1<1){return}s(t=>t-1)};const c=t=>{if(t<1||t>r){return}s(t)};const P=t=>{if(t<1){return}o(t)};return{page:e,limit:n,setLimit:P,setPage:c,nextPage:u,previousPage:a}}
@@ -1,26 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStepper = void 0;
4
- const react_1 = require("react");
5
- const useStepper = ({ defaultStep = 0, maxSteps = 2 }) => {
6
- const [step, setStep] = (0, react_1.useState)(defaultStep);
7
- const handleNext = () => {
8
- if (maxSteps && step >= maxSteps - 1) {
9
- return;
10
- }
11
- setStep((prev) => prev + 1);
12
- };
13
- const handlePrevious = () => {
14
- if (step <= 0) {
15
- return;
16
- }
17
- setStep((prev) => prev - 1);
18
- };
19
- return {
20
- step,
21
- setStep,
22
- handleNext,
23
- handlePrevious
24
- };
25
- };
26
- exports.useStepper = useStepper;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useStepper=void 0;const react_1=require("react");const useStepper=({defaultStep:u=0,maxSteps:s=2})=>{const[e,t]=(0,react_1.useState)(u);const o=()=>{if(s&&e>=s-1){return}t(r=>r+1)};const n=()=>{if(e<=0){return}t(r=>r-1)};return{step:e,setStep:t,handleNext:o,handlePrevious:n}};exports.useStepper=useStepper;
@@ -1,20 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useTime = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const useTime = ({ interval = 1000, onUpdate }) => {
9
- const [time, setTime] = react_1.default.useState(new Date());
10
- react_1.default.useEffect(() => {
11
- const timer = setInterval(() => {
12
- const newTime = new Date();
13
- setTime(newTime);
14
- onUpdate?.(newTime);
15
- }, interval);
16
- return () => clearInterval(timer);
17
- }, [interval, onUpdate]);
18
- return time;
19
- };
20
- exports.useTime = useTime;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(exports,"__esModule",{value:true});exports.useTime=void 0;const react_1=__importDefault(require("react"));const useTime=({interval:e=1e3,onUpdate:t})=>{const[s,u]=react_1.default.useState(new Date);react_1.default.useEffect(()=>{const i=setInterval(()=>{const r=new Date;u(r);t?.(r)},e);return()=>clearInterval(i)},[e,t]);return s};exports.useTime=useTime;