@lerianstudio/sindarian-ui 2.0.0-beta.24 → 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 (337) 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.d.ts.map +1 -1
  11. package/dist/components/dialog/confirmation-dialog/index.js +1 -96
  12. package/dist/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -55
  13. package/dist/components/dialog/index.js +1 -19
  14. package/dist/components/dialog/large-dialog/index.d.ts +2 -2
  15. package/dist/components/dialog/large-dialog/index.d.ts.map +1 -1
  16. package/dist/components/dialog/large-dialog/index.js +1 -21
  17. package/dist/components/entity-box/index.js +1 -67
  18. package/dist/components/entity-data-table/index.js +1 -20
  19. package/dist/components/form/combo-box-field/index.js +1 -35
  20. package/dist/components/form/country-field/index.js +1 -11
  21. package/dist/components/form/date-picker-field/index.js +1 -83
  22. package/dist/components/form/date-range-field/index.js +1 -58
  23. package/dist/components/form/date-time-picker-field/index.js +1 -114
  24. package/dist/components/form/file-upload-field/index.js +1 -69
  25. package/dist/components/form/index.js +1 -31
  26. package/dist/components/form/input-field/index.js +1 -96
  27. package/dist/components/form/otp-field/index.js +1 -19
  28. package/dist/components/form/pagination-limit-field/index.js +1 -10
  29. package/dist/components/form/password-field/index.d.ts.map +1 -1
  30. package/dist/components/form/password-field/index.js +1 -16
  31. package/dist/components/form/radio-group-field/index.js +1 -36
  32. package/dist/components/form/renderable-label.js +1 -57
  33. package/dist/components/form/select-field/index.js +1 -68
  34. package/dist/components/form/state-field/index.js +1 -42
  35. package/dist/components/form/switch-field/index.js +1 -16
  36. package/dist/components/form/textarea-field/index.js +1 -23
  37. package/dist/components/page/index.js +1 -20
  38. package/dist/components/page-header/index.js +1 -80
  39. package/dist/components/pagination/index.js +1 -10
  40. package/dist/components/table/id-table-cell.js +1 -109
  41. package/dist/components/table/index.js +1 -19
  42. package/dist/components/table/locked-table-actions.js +1 -41
  43. package/dist/components/table/name-table-cell.js +1 -58
  44. package/dist/components/ui/accordion/index.js +1 -62
  45. package/dist/components/ui/alert/index.js +1 -45
  46. package/dist/components/ui/alert-dialog/index.js +1 -84
  47. package/dist/components/ui/autocomplete/index.js +1 -440
  48. package/dist/components/ui/autosize-textarea/index.js +1 -89
  49. package/dist/components/ui/avatar/index.js +1 -51
  50. package/dist/components/ui/badge/index.js +1 -83
  51. package/dist/components/ui/breadcrumb/index.js +1 -35
  52. package/dist/components/ui/button/index.js +1 -65
  53. package/dist/components/ui/button/styles.css +2 -1
  54. package/dist/components/ui/calendar/index.js +1 -118
  55. package/dist/components/ui/card/index.js +1 -32
  56. package/dist/components/ui/checkbox/index.js +1 -44
  57. package/dist/components/ui/collapsible/index.js +1 -50
  58. package/dist/components/ui/command/index.js +1 -95
  59. package/dist/components/ui/copy-field/index.js +1 -163
  60. package/dist/components/ui/dialog/index.d.ts +4 -1
  61. package/dist/components/ui/dialog/index.d.ts.map +1 -1
  62. package/dist/components/ui/dialog/index.js +1 -80
  63. package/dist/components/ui/dialog/styles.css +2 -1
  64. package/dist/components/ui/dropdown-menu/index.js +1 -110
  65. package/dist/components/ui/field/index.js +1 -82
  66. package/dist/components/ui/file-upload/index.js +1 -574
  67. package/dist/components/ui/form.js +1 -162
  68. package/dist/components/ui/hover-card/index.js +1 -51
  69. package/dist/components/ui/icon-button/index.js +1 -35
  70. package/dist/components/ui/input/adornment.js +1 -21
  71. package/dist/components/ui/input/index.js +1 -99
  72. package/dist/components/ui/input/styles.css +29 -12
  73. package/dist/components/ui/label/index.js +1 -45
  74. package/dist/components/ui/lerian-wordmark/index.js +1 -7
  75. package/dist/components/ui/loading-button/index.js +1 -9
  76. package/dist/components/ui/multiple-select/index.js +1 -235
  77. package/dist/components/ui/otp-input/index.js +1 -62
  78. package/dist/components/ui/paper/index.js +1 -8
  79. package/dist/components/ui/paper-collapsible/index.js +1 -24
  80. package/dist/components/ui/popover/index.js +1 -55
  81. package/dist/components/ui/progress/index.js +1 -66
  82. package/dist/components/ui/qr-code/index.js +1 -27
  83. package/dist/components/ui/radio-group/index.js +1 -48
  84. package/dist/components/ui/scroll-area/index.js +1 -49
  85. package/dist/components/ui/select/index.js +1 -119
  86. package/dist/components/ui/select/styles.css +6 -3
  87. package/dist/components/ui/separator/index.js +1 -43
  88. package/dist/components/ui/sheet/index.d.ts +7 -2
  89. package/dist/components/ui/sheet/index.d.ts.map +1 -1
  90. package/dist/components/ui/sheet/index.js +1 -136
  91. package/dist/components/ui/sidebar/index.js +1 -27
  92. package/dist/components/ui/sidebar/next-router.cjs +1 -119
  93. package/dist/components/ui/sidebar/sidebar-back-button.js +1 -8
  94. package/dist/components/ui/sidebar/sidebar-components.js +1 -23
  95. package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -49
  96. package/dist/components/ui/sidebar/sidebar-item-button.js +1 -21
  97. package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -52
  98. package/dist/components/ui/sidebar/sidebar-item-icon-button.js +1 -18
  99. package/dist/components/ui/sidebar/sidebar-item.js +1 -44
  100. package/dist/components/ui/sidebar/sidebar-provider.js +1 -201
  101. package/dist/components/ui/sidebar/sidebar-root.d.ts +3 -1
  102. package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  103. package/dist/components/ui/sidebar/sidebar-root.js +1 -130
  104. package/dist/components/ui/sidebar/sidebar-router.js +1 -126
  105. package/dist/components/ui/sidebar/sidebar-trigger.js +1 -57
  106. package/dist/components/ui/skeleton/index.js +1 -8
  107. package/dist/components/ui/stepper/index.js +1 -29
  108. package/dist/components/ui/switch/index.js +1 -43
  109. package/dist/components/ui/table/index.js +1 -56
  110. package/dist/components/ui/tabs/index.js +1 -55
  111. package/dist/components/ui/textarea/index.js +1 -8
  112. package/dist/components/ui/time-picker/index.js +1 -85
  113. package/dist/components/ui/toast/index.js +1 -3
  114. package/dist/components/ui/toast/toaster.js +1 -16
  115. package/dist/components/ui/toggle-group/index.js +1 -156
  116. package/dist/components/ui/tooltip/index.js +1 -81
  117. package/dist/domain/blotter/index.js +1 -20
  118. package/dist/domain/delinquency-aging/aging-buckets.js +1 -120
  119. package/dist/domain/delinquency-aging/index.js +1 -222
  120. package/dist/domain/figure/index.js +1 -19
  121. package/dist/domain/format.js +1 -137
  122. package/dist/domain/index.js +1 -43
  123. package/dist/domain/key-id/index.js +1 -174
  124. package/dist/domain/ledger-sheet/index.js +1 -28
  125. package/dist/domain/money-diff.js +1 -48
  126. package/dist/domain/money-math.js +1 -104
  127. package/dist/domain/money-text/index.js +1 -123
  128. package/dist/domain/section-label/index.js +1 -17
  129. package/dist/domain/status-rail/index.js +1 -76
  130. package/dist/domain/threshold-gauge/index.js +1 -161
  131. package/dist/enterprise/alert-banner/index.js +1 -24
  132. package/dist/enterprise/app-shell/index.js +1 -87
  133. package/dist/enterprise/cursor-pager/index.js +1 -26
  134. package/dist/enterprise/data-table/column-size.js +1 -103
  135. package/dist/enterprise/data-table/index.d.ts.map +1 -1
  136. package/dist/enterprise/data-table/index.js +1 -345
  137. package/dist/enterprise/date-range-picker/index.js +1 -115
  138. package/dist/enterprise/detail-panel/index.js +1 -20
  139. package/dist/enterprise/empty-state/index.d.ts +6 -1
  140. package/dist/enterprise/empty-state/index.d.ts.map +1 -1
  141. package/dist/enterprise/empty-state/index.js +1 -13
  142. package/dist/enterprise/index.js +1 -39
  143. package/dist/enterprise/number-input/index.js +1 -252
  144. package/dist/enterprise/search-input/index.js +1 -121
  145. package/dist/enterprise/stat-card/index.js +1 -75
  146. package/dist/enterprise/status-badge/index.js +1 -120
  147. package/dist/enterprise/use-is-mobile.js +1 -68
  148. package/dist/enterprise/virtualized-table/index.js +1 -141
  149. package/dist/esm/charts/chart.js +4 -190
  150. package/dist/esm/charts/index.js +1 -3
  151. package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +1 -12
  152. package/dist/esm/components/breadcrumb/index.js +1 -30
  153. package/dist/esm/components/card/account-card/index.js +1 -53
  154. package/dist/esm/components/card/basic-card/index.js +1 -14
  155. package/dist/esm/components/card/dashboard-card/index.js +1 -14
  156. package/dist/esm/components/card/entity-card/index.js +1 -52
  157. package/dist/esm/components/card/index.js +1 -4
  158. package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
  159. package/dist/esm/components/dialog/confirmation-dialog/index.js +1 -60
  160. package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -49
  161. package/dist/esm/components/dialog/index.js +1 -3
  162. package/dist/esm/components/dialog/large-dialog/index.d.ts +2 -2
  163. package/dist/esm/components/dialog/large-dialog/index.d.ts.map +1 -1
  164. package/dist/esm/components/dialog/large-dialog/index.js +1 -16
  165. package/dist/esm/components/entity-box/index.js +1 -56
  166. package/dist/esm/components/entity-data-table/index.js +1 -17
  167. package/dist/esm/components/form/combo-box-field/index.js +1 -28
  168. package/dist/esm/components/form/country-field/index.js +1 -7
  169. package/dist/esm/components/form/date-picker-field/index.js +1 -43
  170. package/dist/esm/components/form/date-range-field/index.js +1 -18
  171. package/dist/esm/components/form/date-time-picker-field/index.js +1 -74
  172. package/dist/esm/components/form/file-upload-field/index.js +1 -65
  173. package/dist/esm/components/form/index.js +1 -15
  174. package/dist/esm/components/form/input-field/index.js +1 -92
  175. package/dist/esm/components/form/otp-field/index.js +1 -15
  176. package/dist/esm/components/form/pagination-limit-field/index.js +1 -6
  177. package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
  178. package/dist/esm/components/form/password-field/index.js +1 -10
  179. package/dist/esm/components/form/radio-group-field/index.js +1 -32
  180. package/dist/esm/components/form/renderable-label.js +1 -54
  181. package/dist/esm/components/form/select-field/index.js +1 -64
  182. package/dist/esm/components/form/state-field/index.js +1 -35
  183. package/dist/esm/components/form/switch-field/index.js +1 -12
  184. package/dist/esm/components/form/textarea-field/index.js +1 -19
  185. package/dist/esm/components/page/index.js +1 -15
  186. package/dist/esm/components/page-header/index.js +1 -71
  187. package/dist/esm/components/pagination/index.js +1 -6
  188. package/dist/esm/components/table/id-table-cell.js +1 -105
  189. package/dist/esm/components/table/index.js +1 -3
  190. package/dist/esm/components/table/locked-table-actions.js +1 -37
  191. package/dist/esm/components/table/name-table-cell.js +1 -54
  192. package/dist/esm/components/ui/accordion/index.js +1 -24
  193. package/dist/esm/components/ui/alert/index.js +1 -38
  194. package/dist/esm/components/ui/alert-dialog/index.js +1 -39
  195. package/dist/esm/components/ui/autocomplete/index.js +1 -392
  196. package/dist/esm/components/ui/autosize-textarea/index.js +1 -51
  197. package/dist/esm/components/ui/avatar/index.js +1 -14
  198. package/dist/esm/components/ui/badge/index.js +1 -79
  199. package/dist/esm/components/ui/breadcrumb/index.js +1 -27
  200. package/dist/esm/components/ui/button/index.js +1 -60
  201. package/dist/esm/components/ui/calendar/index.js +1 -82
  202. package/dist/esm/components/ui/card/index.js +1 -24
  203. package/dist/esm/components/ui/checkbox/index.js +1 -9
  204. package/dist/esm/components/ui/collapsible/index.js +1 -13
  205. package/dist/esm/components/ui/command/index.js +1 -51
  206. package/dist/esm/components/ui/copy-field/index.js +1 -127
  207. package/dist/esm/components/ui/dialog/index.d.ts +4 -1
  208. package/dist/esm/components/ui/dialog/index.d.ts.map +1 -1
  209. package/dist/esm/components/ui/dialog/index.js +1 -36
  210. package/dist/esm/components/ui/dropdown-menu/index.js +1 -60
  211. package/dist/esm/components/ui/field/index.js +1 -71
  212. package/dist/esm/components/ui/file-upload/index.js +1 -536
  213. package/dist/esm/components/ui/form.js +1 -118
  214. package/dist/esm/components/ui/hover-card/index.js +1 -14
  215. package/dist/esm/components/ui/icon-button/index.js +1 -31
  216. package/dist/esm/components/ui/input/adornment.js +1 -17
  217. package/dist/esm/components/ui/input/index.js +1 -60
  218. package/dist/esm/components/ui/label/index.js +1 -10
  219. package/dist/esm/components/ui/lerian-wordmark/index.js +1 -4
  220. package/dist/esm/components/ui/loading-button/index.js +1 -7
  221. package/dist/esm/components/ui/multiple-select/index.js +1 -196
  222. package/dist/esm/components/ui/otp-input/index.js +1 -21
  223. package/dist/esm/components/ui/paper/index.js +1 -5
  224. package/dist/esm/components/ui/paper-collapsible/index.js +1 -19
  225. package/dist/esm/components/ui/popover/index.js +1 -17
  226. package/dist/esm/components/ui/progress/index.js +1 -31
  227. package/dist/esm/components/ui/qr-code/index.js +1 -24
  228. package/dist/esm/components/ui/radio-group/index.js +1 -12
  229. package/dist/esm/components/ui/scroll-area/index.js +1 -13
  230. package/dist/esm/components/ui/select/index.js +1 -74
  231. package/dist/esm/components/ui/separator/index.js +1 -8
  232. package/dist/esm/components/ui/sheet/index.d.ts +7 -2
  233. package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
  234. package/dist/esm/components/ui/sheet/index.js +1 -92
  235. package/dist/esm/components/ui/sidebar/index.js +1 -11
  236. package/dist/esm/components/ui/sidebar/next-router.cjs +1 -119
  237. package/dist/esm/components/ui/sidebar/sidebar-back-button.js +1 -5
  238. package/dist/esm/components/ui/sidebar/sidebar-components.js +1 -15
  239. package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -42
  240. package/dist/esm/components/ui/sidebar/sidebar-item-button.js +1 -18
  241. package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -44
  242. package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +1 -14
  243. package/dist/esm/components/ui/sidebar/sidebar-item.js +1 -40
  244. package/dist/esm/components/ui/sidebar/sidebar-provider.js +1 -193
  245. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +3 -1
  246. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  247. package/dist/esm/components/ui/sidebar/sidebar-root.js +1 -126
  248. package/dist/esm/components/ui/sidebar/sidebar-router.js +1 -89
  249. package/dist/esm/components/ui/sidebar/sidebar-trigger.js +1 -53
  250. package/dist/esm/components/ui/skeleton/index.js +1 -6
  251. package/dist/esm/components/ui/stepper/index.js +1 -20
  252. package/dist/esm/components/ui/switch/index.js +1 -8
  253. package/dist/esm/components/ui/table/index.js +1 -44
  254. package/dist/esm/components/ui/tabs/index.js +1 -17
  255. package/dist/esm/components/ui/textarea/index.js +1 -6
  256. package/dist/esm/components/ui/time-picker/index.js +1 -49
  257. package/dist/esm/components/ui/toast/index.js +1 -2
  258. package/dist/esm/components/ui/toast/toaster.js +1 -13
  259. package/dist/esm/components/ui/toggle-group/index.js +1 -120
  260. package/dist/esm/components/ui/tooltip/index.js +1 -43
  261. package/dist/esm/domain/blotter/index.js +1 -16
  262. package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -115
  263. package/dist/esm/domain/delinquency-aging/index.js +1 -218
  264. package/dist/esm/domain/figure/index.js +1 -15
  265. package/dist/esm/domain/format.js +1 -128
  266. package/dist/esm/domain/index.js +1 -19
  267. package/dist/esm/domain/key-id/index.js +1 -169
  268. package/dist/esm/domain/ledger-sheet/index.js +1 -24
  269. package/dist/esm/domain/money-diff.js +1 -45
  270. package/dist/esm/domain/money-math.js +1 -98
  271. package/dist/esm/domain/money-text/index.js +1 -118
  272. package/dist/esm/domain/section-label/index.js +1 -14
  273. package/dist/esm/domain/status-rail/index.js +1 -71
  274. package/dist/esm/domain/threshold-gauge/index.js +1 -157
  275. package/dist/esm/enterprise/alert-banner/index.js +1 -21
  276. package/dist/esm/enterprise/app-shell/index.js +1 -51
  277. package/dist/esm/enterprise/cursor-pager/index.js +1 -23
  278. package/dist/esm/enterprise/data-table/column-size.js +1 -97
  279. package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
  280. package/dist/esm/enterprise/data-table/index.js +1 -342
  281. package/dist/esm/enterprise/date-range-picker/index.js +1 -112
  282. package/dist/esm/enterprise/detail-panel/index.js +1 -17
  283. package/dist/esm/enterprise/empty-state/index.d.ts +6 -1
  284. package/dist/esm/enterprise/empty-state/index.d.ts.map +1 -1
  285. package/dist/esm/enterprise/empty-state/index.js +1 -10
  286. package/dist/esm/enterprise/index.js +1 -22
  287. package/dist/esm/enterprise/number-input/index.js +1 -214
  288. package/dist/esm/enterprise/search-input/index.js +1 -85
  289. package/dist/esm/enterprise/stat-card/index.js +1 -72
  290. package/dist/esm/enterprise/status-badge/index.js +1 -116
  291. package/dist/esm/enterprise/use-is-mobile.js +1 -31
  292. package/dist/esm/enterprise/virtualized-table/index.js +1 -138
  293. package/dist/esm/hooks/use-click-away.js +1 -22
  294. package/dist/esm/hooks/use-pagination.js +1 -38
  295. package/dist/esm/hooks/use-stepper.js +1 -22
  296. package/dist/esm/hooks/use-time.js +1 -13
  297. package/dist/esm/hooks/use-toast.js +1 -107
  298. package/dist/esm/index.js +1 -77
  299. package/dist/esm/lib/storage/get-storage-object.js +1 -17
  300. package/dist/esm/lib/storage/get-storage.js +1 -14
  301. package/dist/esm/lib/storage/index.js +1 -2
  302. package/dist/esm/lib/typography.js +1 -31
  303. package/dist/esm/lib/utils.js +1 -41
  304. package/dist/esm/theme/get-theme-script.js +1 -41
  305. package/dist/esm/theme/index.js +1 -4
  306. package/dist/esm/theme/mode-toggle.js +1 -45
  307. package/dist/esm/theme/theme-provider.js +1 -122
  308. package/dist/esm/toast/helpers.js +1 -36
  309. package/dist/esm/toast/index.js +1 -4
  310. package/dist/esm/types/metadata-type.js +1 -1
  311. package/dist/esm/utils/countries.cjs +1 -17
  312. package/dist/esm/utils/country-utils.js +1 -18
  313. package/dist/esm/utils/currency-codes.js +1 -181
  314. package/dist/globals.css +1 -0
  315. package/dist/hooks/use-click-away.js +1 -29
  316. package/dist/hooks/use-pagination.js +1 -41
  317. package/dist/hooks/use-stepper.js +1 -26
  318. package/dist/hooks/use-time.js +1 -20
  319. package/dist/hooks/use-toast.js +1 -111
  320. package/dist/index.js +1 -96
  321. package/dist/lib/storage/get-storage-object.js +1 -23
  322. package/dist/lib/storage/get-storage.js +1 -17
  323. package/dist/lib/storage/index.js +1 -18
  324. package/dist/lib/typography.js +1 -34
  325. package/dist/lib/utils.js +1 -45
  326. package/dist/theme/get-theme-script.js +1 -44
  327. package/dist/theme/index.js +1 -11
  328. package/dist/theme/mode-toggle.js +1 -48
  329. package/dist/theme/theme-provider.js +1 -160
  330. package/dist/toast/helpers.js +1 -41
  331. package/dist/toast/index.js +1 -10
  332. package/dist/tokens.css +7 -4
  333. package/dist/types/metadata-type.js +1 -2
  334. package/dist/utils/countries.cjs +1 -17
  335. package/dist/utils/country-utils.js +1 -25
  336. package/dist/utils/currency-codes.js +1 -184
  337. 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}));
package/dist/globals.css CHANGED
@@ -110,6 +110,7 @@
110
110
 
111
111
  --color-destructive: hsl(var(--destructive));
112
112
  --color-destructive-foreground: hsl(var(--destructive-foreground));
113
+ --color-destructive-hover: hsl(var(--destructive-hover));
113
114
 
114
115
  --color-muted: hsl(var(--muted));
115
116
  --color-muted-foreground: hsl(var(--muted-foreground));
@@ -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;