@eifi1/ui-kit 0.21.0 → 0.23.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 (320) hide show
  1. package/README.md +42 -25
  2. package/dist/chart.d.ts +19 -14
  3. package/dist/components/account-chips.d.ts +10 -3
  4. package/dist/components/account-chips.js +5 -2
  5. package/dist/components/account-chips.js.map +1 -1
  6. package/dist/components/account-settings.d.ts +33 -2
  7. package/dist/components/account-settings.js +43 -21
  8. package/dist/components/account-settings.js.map +1 -1
  9. package/dist/components/amount-input.d.ts +53 -14
  10. package/dist/components/amount-input.js +17 -28
  11. package/dist/components/amount-input.js.map +1 -1
  12. package/dist/components/autocomplete.d.ts +29 -0
  13. package/dist/components/autocomplete.js +134 -104
  14. package/dist/components/autocomplete.js.map +1 -1
  15. package/dist/components/button-group.d.ts +19 -14
  16. package/dist/components/calculator.d.ts +19 -14
  17. package/dist/components/checkbox-group.d.ts +104 -0
  18. package/dist/components/checkbox-group.js +111 -0
  19. package/dist/components/checkbox-group.js.map +1 -0
  20. package/dist/components/checkbox.d.ts +19 -0
  21. package/dist/components/checkbox.js +30 -7
  22. package/dist/components/checkbox.js.map +1 -1
  23. package/dist/components/chip.d.ts +18 -0
  24. package/dist/components/chip.js +47 -10
  25. package/dist/components/chip.js.map +1 -1
  26. package/dist/components/column-mapper.d.ts +182 -0
  27. package/dist/components/column-mapper.js +375 -0
  28. package/dist/components/column-mapper.js.map +1 -0
  29. package/dist/components/combobox-core.d.ts +39 -2
  30. package/dist/components/combobox-core.js +29 -6
  31. package/dist/components/combobox-core.js.map +1 -1
  32. package/dist/components/combobox.d.ts +91 -2
  33. package/dist/components/combobox.js +454 -308
  34. package/dist/components/combobox.js.map +1 -1
  35. package/dist/components/confirm-dialog.d.ts +69 -161
  36. package/dist/components/confirm-dialog.js +7 -8
  37. package/dist/components/confirm-dialog.js.map +1 -1
  38. package/dist/components/copy-button.d.ts +16 -11
  39. package/dist/components/country-select.d.ts +167 -0
  40. package/dist/components/country-select.js +293 -0
  41. package/dist/components/country-select.js.map +1 -0
  42. package/dist/components/currency-select.d.ts +17 -1
  43. package/dist/components/currency-select.js +56 -23
  44. package/dist/components/currency-select.js.map +1 -1
  45. package/dist/components/danger-confirm.d.ts +69 -166
  46. package/dist/components/danger-confirm.js +144 -50
  47. package/dist/components/danger-confirm.js.map +1 -1
  48. package/dist/components/data-table-cells.d.ts +1 -2
  49. package/dist/components/data-table-filter-popover.d.ts +1 -2
  50. package/dist/components/data-table-filters.d.ts +1 -2
  51. package/dist/components/data-table-labels.d.ts +4 -97
  52. package/dist/components/data-table-labels.js +9 -1
  53. package/dist/components/data-table-labels.js.map +1 -1
  54. package/dist/components/data-table-pagination.d.ts +3 -1
  55. package/dist/components/data-table.d.ts +1 -2
  56. package/dist/components/data-table.js +98 -3
  57. package/dist/components/data-table.js.map +1 -1
  58. package/dist/components/date-picker.d.ts +66 -5
  59. package/dist/components/date-picker.js +378 -66
  60. package/dist/components/date-picker.js.map +1 -1
  61. package/dist/components/entity-combobox.d.ts +42 -1
  62. package/dist/components/entity-combobox.js +154 -113
  63. package/dist/components/entity-combobox.js.map +1 -1
  64. package/dist/components/facing-pair.d.ts +19 -14
  65. package/dist/components/field-parts.d.ts +224 -0
  66. package/dist/components/field-parts.js +156 -0
  67. package/dist/components/field-parts.js.map +1 -0
  68. package/dist/components/field-strip.d.ts +105 -0
  69. package/dist/components/field-strip.js +46 -0
  70. package/dist/components/field-strip.js.map +1 -0
  71. package/dist/components/file-button.d.ts +19 -14
  72. package/dist/components/file-button.js +13 -3
  73. package/dist/components/file-button.js.map +1 -1
  74. package/dist/components/file-dropzone.d.ts +41 -15
  75. package/dist/components/file-dropzone.js +57 -34
  76. package/dist/components/file-dropzone.js.map +1 -1
  77. package/dist/components/form-actions.d.ts +18 -13
  78. package/dist/components/form-actions.js +69 -5
  79. package/dist/components/form-actions.js.map +1 -1
  80. package/dist/components/iban-input.d.ts +69 -0
  81. package/dist/components/iban-input.js +125 -0
  82. package/dist/components/iban-input.js.map +1 -0
  83. package/dist/components/icon-picker.d.ts +21 -2
  84. package/dist/components/icon-picker.js +19 -4
  85. package/dist/components/icon-picker.js.map +1 -1
  86. package/dist/components/inline-edit-field.d.ts +167 -0
  87. package/dist/components/inline-edit-field.js +293 -0
  88. package/dist/components/inline-edit-field.js.map +1 -0
  89. package/dist/components/language-select.d.ts +130 -0
  90. package/dist/components/language-select.js +18 -0
  91. package/dist/components/language-select.js.map +1 -0
  92. package/dist/components/line-items.d.ts +25 -3
  93. package/dist/components/line-items.js +55 -46
  94. package/dist/components/line-items.js.map +1 -1
  95. package/dist/components/list.d.ts +25 -0
  96. package/dist/components/list.js +16 -5
  97. package/dist/components/list.js.map +1 -1
  98. package/dist/components/money-field.d.ts +32 -14
  99. package/dist/components/money-field.js.map +1 -1
  100. package/dist/components/month-picker.d.ts +52 -4
  101. package/dist/components/month-picker.js +291 -86
  102. package/dist/components/month-picker.js.map +1 -1
  103. package/dist/components/multi-entity-combobox.d.ts +26 -1
  104. package/dist/components/multi-entity-combobox.js +143 -102
  105. package/dist/components/multi-entity-combobox.js.map +1 -1
  106. package/dist/components/multi-select.d.ts +8 -1
  107. package/dist/components/multi-select.js +9 -4
  108. package/dist/components/multi-select.js.map +1 -1
  109. package/dist/components/number-field.d.ts +34 -19
  110. package/dist/components/number-field.js +6 -20
  111. package/dist/components/number-field.js.map +1 -1
  112. package/dist/components/number-input.d.ts +79 -19
  113. package/dist/components/number-input.js +90 -38
  114. package/dist/components/number-input.js.map +1 -1
  115. package/dist/components/numpad-sheet.d.ts +19 -14
  116. package/dist/components/one-time-code-input.d.ts +100 -0
  117. package/dist/components/one-time-code-input.js +137 -0
  118. package/dist/components/one-time-code-input.js.map +1 -0
  119. package/dist/components/phone-input.d.ts +69 -0
  120. package/dist/components/phone-input.js +171 -0
  121. package/dist/components/phone-input.js.map +1 -0
  122. package/dist/components/reauth-dialog.d.ts +2 -2
  123. package/dist/components/reauth-dialog.js +6 -8
  124. package/dist/components/reauth-dialog.js.map +1 -1
  125. package/dist/components/series-chart.d.ts +19 -14
  126. package/dist/components/settings-fields.d.ts +19 -14
  127. package/dist/components/share-card.d.ts +16 -11
  128. package/dist/components/sign-chip.d.ts +66 -0
  129. package/dist/components/sign-chip.js +39 -0
  130. package/dist/components/sign-chip.js.map +1 -0
  131. package/dist/components/swatch-picker.d.ts +43 -2
  132. package/dist/components/swatch-picker.js +80 -32
  133. package/dist/components/swatch-picker.js.map +1 -1
  134. package/dist/components/switch.d.ts +19 -0
  135. package/dist/components/switch.js +24 -6
  136. package/dist/components/switch.js.map +1 -1
  137. package/dist/components/text-link.d.ts +18 -13
  138. package/dist/components/tile-radio.d.ts +88 -13
  139. package/dist/components/tile-radio.js +28 -11
  140. package/dist/components/tile-radio.js.map +1 -1
  141. package/dist/components/time-input.d.ts +24 -15
  142. package/dist/components/time-input.js.map +1 -1
  143. package/dist/components/toggle-group.d.ts +47 -1
  144. package/dist/components/toggle-group.js +110 -69
  145. package/dist/components/toggle-group.js.map +1 -1
  146. package/dist/components/trigger-aria.d.ts +3 -0
  147. package/dist/components/trigger-aria.js +3 -1
  148. package/dist/components/trigger-aria.js.map +1 -1
  149. package/dist/components/ui.d.ts +16 -11
  150. package/dist/components/ui.js +284 -88
  151. package/dist/components/ui.js.map +1 -1
  152. package/dist/components/use-table-state.d.ts +1 -2
  153. package/dist/{data-table-3mi2R3so.d.ts → data-table-labels-B7OdnM0S.d.ts} +140 -3
  154. package/dist/data-table.d.ts +1 -2
  155. package/dist/data-table.js +2 -1
  156. package/dist/data-table.js.map +1 -1
  157. package/dist/feedback/feedback-attachment.d.ts +1 -1
  158. package/dist/feedback/feedback-attachment.js +348 -41
  159. package/dist/feedback/feedback-attachment.js.map +1 -1
  160. package/dist/feedback/feedback-dialog.d.ts +1 -1
  161. package/dist/feedback/feedback-dialog.js.map +1 -1
  162. package/dist/feedback/feedback-inbox.d.ts +3 -2
  163. package/dist/feedback/feedback-inbox.js.map +1 -1
  164. package/dist/feedback/feedback-thread.d.ts +68 -253
  165. package/dist/feedback/feedback-thread.js +46 -10
  166. package/dist/feedback/feedback-thread.js.map +1 -1
  167. package/dist/{kit-labels-D1J2_jyD.d.ts → feedback-BxeQVzwq.d.ts} +1206 -20
  168. package/dist/{feedback-attachment-WFiXJ8We.d.ts → feedback-attachment-fGAzZPf0.d.ts} +178 -11
  169. package/dist/feedback.d.ts +66 -2
  170. package/dist/hooks/use-file-drop.d.ts +19 -14
  171. package/dist/i18n/defaults.d.ts +19 -14
  172. package/dist/i18n/defaults.js +19 -2
  173. package/dist/i18n/defaults.js.map +1 -1
  174. package/dist/i18n/german.d.ts +19 -14
  175. package/dist/i18n/german.js +84 -5
  176. package/dist/i18n/german.js.map +1 -1
  177. package/dist/i18n/kit-labels.d.ts +15 -10
  178. package/dist/i18n/kit-labels.js +8 -2
  179. package/dist/i18n/kit-labels.js.map +1 -1
  180. package/dist/i18n/languages.d.ts +19 -14
  181. package/dist/i18n/locales/de-CH.d.ts +19 -14
  182. package/dist/i18n/locales/en.d.ts +19 -14
  183. package/dist/i18n/locales/en.js +16 -0
  184. package/dist/i18n/locales/en.js.map +1 -1
  185. package/dist/i18n/locales/es.d.ts +19 -14
  186. package/dist/i18n/locales/es.js +83 -5
  187. package/dist/i18n/locales/es.js.map +1 -1
  188. package/dist/i18n/locales/fr.d.ts +19 -14
  189. package/dist/i18n/locales/fr.js +82 -5
  190. package/dist/i18n/locales/fr.js.map +1 -1
  191. package/dist/i18n/locales/hu.d.ts +19 -14
  192. package/dist/i18n/locales/hu.js +85 -5
  193. package/dist/i18n/locales/hu.js.map +1 -1
  194. package/dist/i18n/locales/it.d.ts +19 -14
  195. package/dist/i18n/locales/it.js +84 -5
  196. package/dist/i18n/locales/it.js.map +1 -1
  197. package/dist/i18n/locales/zh.d.ts +19 -14
  198. package/dist/i18n/locales/zh.js +80 -5
  199. package/dist/i18n/locales/zh.js.map +1 -1
  200. package/dist/i18n/review.d.ts +19 -14
  201. package/dist/i18n/review.js +27 -1
  202. package/dist/i18n/review.js.map +1 -1
  203. package/dist/index.d.ts +21 -10
  204. package/dist/index.js +73 -2
  205. package/dist/index.js.map +1 -1
  206. package/dist/lib/column-mapping.d.ts +81 -0
  207. package/dist/lib/column-mapping.js +108 -0
  208. package/dist/lib/column-mapping.js.map +1 -0
  209. package/dist/lib/countries.d.ts +43 -0
  210. package/dist/lib/countries.js +39 -0
  211. package/dist/lib/countries.js.map +1 -0
  212. package/dist/lib/decimal-marks.d.ts +46 -0
  213. package/dist/lib/decimal-marks.js +40 -0
  214. package/dist/lib/decimal-marks.js.map +1 -0
  215. package/dist/lib/iban.d.ts +98 -0
  216. package/dist/lib/iban.js +154 -0
  217. package/dist/lib/iban.js.map +1 -0
  218. package/dist/lib/isin.d.ts +30 -0
  219. package/dist/lib/isin.js +36 -0
  220. package/dist/lib/isin.js.map +1 -0
  221. package/dist/lib/phone.d.ts +69 -0
  222. package/dist/lib/phone.js +121 -0
  223. package/dist/lib/phone.js.map +1 -0
  224. package/dist/lib/table-text.d.ts +109 -1
  225. package/dist/lib/table-text.js +122 -1
  226. package/dist/lib/table-text.js.map +1 -1
  227. package/dist/rhf/fields.d.ts +233 -18
  228. package/dist/rhf/fields.js +456 -3
  229. package/dist/rhf/fields.js.map +1 -1
  230. package/dist/rhf/form.d.ts +19 -14
  231. package/dist/rhf.d.ts +22 -15
  232. package/dist/rhf.js.map +1 -1
  233. package/dist/shell/app-shell.d.ts +18 -13
  234. package/dist/shell/top-bar-brand.d.ts +19 -14
  235. package/dist/shell/topbar-action-menu.d.ts +36 -3
  236. package/dist/shell/topbar-action-menu.js +74 -33
  237. package/dist/shell/topbar-action-menu.js.map +1 -1
  238. package/dist/shell.d.ts +18 -13
  239. package/dist/table-text.d.ts +1 -1
  240. package/dist/tour/tour.js +20 -24
  241. package/dist/tour/tour.js.map +1 -1
  242. package/dist/wizard/stepper-nav.d.ts +49 -16
  243. package/dist/wizard/stepper-nav.js +4 -0
  244. package/dist/wizard/stepper-nav.js.map +1 -1
  245. package/dist/wizard.d.ts +19 -14
  246. package/package.json +1 -1
  247. package/src/components/account-chips.tsx +17 -3
  248. package/src/components/account-settings.tsx +92 -26
  249. package/src/components/amount-input.tsx +68 -56
  250. package/src/components/autocomplete.tsx +198 -114
  251. package/src/components/checkbox-group.tsx +229 -0
  252. package/src/components/checkbox.tsx +72 -8
  253. package/src/components/chip.tsx +80 -10
  254. package/src/components/column-mapper.tsx +666 -0
  255. package/src/components/combobox-core.tsx +82 -9
  256. package/src/components/combobox.tsx +661 -340
  257. package/src/components/confirm-dialog.tsx +12 -8
  258. package/src/components/country-select.tsx +556 -0
  259. package/src/components/currency-select.tsx +109 -33
  260. package/src/components/danger-confirm.tsx +429 -82
  261. package/src/components/data-table-labels.ts +16 -1
  262. package/src/components/data-table.tsx +175 -6
  263. package/src/components/date-picker.tsx +595 -71
  264. package/src/components/entity-combobox.tsx +235 -124
  265. package/src/components/field-parts.tsx +403 -0
  266. package/src/components/field-strip.tsx +149 -0
  267. package/src/components/file-button.tsx +36 -3
  268. package/src/components/file-dropzone.tsx +106 -38
  269. package/src/components/form-actions.tsx +147 -6
  270. package/src/components/iban-input.tsx +231 -0
  271. package/src/components/icon-picker.tsx +47 -6
  272. package/src/components/inline-edit-field.tsx +533 -0
  273. package/src/components/language-select.tsx +78 -0
  274. package/src/components/line-items.tsx +35 -2
  275. package/src/components/list.tsx +55 -6
  276. package/src/components/money-field.tsx +13 -0
  277. package/src/components/month-picker.tsx +400 -63
  278. package/src/components/multi-entity-combobox.tsx +207 -120
  279. package/src/components/multi-select.tsx +80 -58
  280. package/src/components/number-field.tsx +28 -46
  281. package/src/components/number-input.tsx +210 -43
  282. package/src/components/one-time-code-input.tsx +288 -0
  283. package/src/components/phone-input.tsx +299 -0
  284. package/src/components/reauth-dialog.tsx +17 -18
  285. package/src/components/sign-chip.tsx +103 -0
  286. package/src/components/swatch-picker.tsx +143 -31
  287. package/src/components/switch.tsx +58 -7
  288. package/src/components/tile-radio.tsx +145 -29
  289. package/src/components/time-input.tsx +8 -1
  290. package/src/components/toggle-group.tsx +206 -73
  291. package/src/components/trigger-aria.ts +5 -0
  292. package/src/components/ui.tsx +479 -138
  293. package/src/data-table.ts +2 -1
  294. package/src/feedback/feedback-attachment.tsx +597 -46
  295. package/src/feedback/feedback-dialog.tsx +9 -3
  296. package/src/feedback/feedback-inbox.tsx +3 -2
  297. package/src/feedback/feedback-thread.tsx +113 -9
  298. package/src/i18n/defaults.ts +18 -1
  299. package/src/i18n/german.ts +89 -0
  300. package/src/i18n/kit-labels.tsx +82 -2
  301. package/src/i18n/locales/en.ts +36 -4
  302. package/src/i18n/locales/es.ts +87 -0
  303. package/src/i18n/locales/fr.ts +87 -0
  304. package/src/i18n/locales/hu.ts +83 -0
  305. package/src/i18n/locales/it.ts +88 -0
  306. package/src/i18n/locales/zh.ts +76 -0
  307. package/src/i18n/review.ts +26 -0
  308. package/src/index.ts +71 -3
  309. package/src/lib/column-mapping.ts +234 -0
  310. package/src/lib/countries.ts +91 -0
  311. package/src/lib/decimal-marks.ts +99 -0
  312. package/src/lib/iban.ts +171 -0
  313. package/src/lib/isin.ts +62 -0
  314. package/src/lib/phone.ts +211 -0
  315. package/src/lib/table-text.ts +271 -0
  316. package/src/rhf/fields.tsx +860 -9
  317. package/src/rhf.ts +3 -1
  318. package/src/shell/topbar-action-menu.tsx +134 -38
  319. package/src/tour/tour.tsx +66 -28
  320. package/src/wizard/stepper-nav.tsx +35 -1
@@ -1,11 +1,25 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useLayoutEffect, useRef, useState } from "react";
4
+ import {
5
+ useController
6
+ } from "react-hook-form";
4
7
  import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./form.js";
5
8
  import { Input, Select, Textarea } from "../components/ui.js";
6
9
  import { NumberField } from "../components/number-field.js";
7
10
  import { AmountInput } from "../components/amount-input.js";
8
- import { DatePicker } from "../components/date-picker.js";
11
+ import {
12
+ DatePicker,
13
+ DateRangePicker
14
+ } from "../components/date-picker.js";
15
+ import { TimeInput } from "../components/time-input.js";
16
+ import { IbanInput } from "../components/iban-input.js";
17
+ import { PhoneInput } from "../components/phone-input.js";
18
+ import { CountrySelect } from "../components/country-select.js";
19
+ import { MonthPicker } from "../components/month-picker.js";
20
+ import {
21
+ ToggleGroup
22
+ } from "../components/toggle-group.js";
9
23
  import { Checkbox } from "../components/checkbox.js";
10
24
  import { EntityCombobox } from "../components/entity-combobox.js";
11
25
  import { Combobox } from "../components/combobox.js";
@@ -394,6 +408,351 @@ function RhfDateField({
394
408
  }
395
409
  );
396
410
  }
411
+ function RhfDateRangePicker({
412
+ fromName,
413
+ toName,
414
+ control,
415
+ fromRules,
416
+ toRules,
417
+ label,
418
+ hint,
419
+ required,
420
+ disabled,
421
+ excludeWhenDisabled,
422
+ className,
423
+ inputClassName,
424
+ emptyValue = "",
425
+ ...pickerProps
426
+ }) {
427
+ const rhfDisabled = excludeWhenDisabled ? disabled : void 0;
428
+ const to = useController({
429
+ name: toName,
430
+ control,
431
+ rules: toRules,
432
+ disabled: rhfDisabled
433
+ });
434
+ return /* @__PURE__ */ jsx(
435
+ FormField,
436
+ {
437
+ control,
438
+ name: fromName,
439
+ rules: fromRules,
440
+ disabled: rhfDisabled,
441
+ render: ({ field, fieldState }) => /* @__PURE__ */ jsx(FormItem, { className, children: /* @__PURE__ */ jsx(
442
+ RangeBody,
443
+ {
444
+ from: field,
445
+ fromState: fieldState,
446
+ to: to.field,
447
+ toState: to.fieldState,
448
+ label,
449
+ hint,
450
+ required,
451
+ disabled: Boolean(disabled),
452
+ emptyValue,
453
+ inputClassName,
454
+ pickerProps
455
+ }
456
+ ) })
457
+ }
458
+ );
459
+ }
460
+ function RangeBody({
461
+ from,
462
+ fromState,
463
+ to,
464
+ toState,
465
+ label,
466
+ hint,
467
+ required,
468
+ disabled,
469
+ emptyValue,
470
+ inputClassName,
471
+ pickerProps
472
+ }) {
473
+ const { id, formItemId, formMessageId, describedBy } = useFormField();
474
+ useFocusHandle(from.ref, () => document.getElementById(formItemId));
475
+ useFocusHandle(to.ref, () => document.getElementById(formItemId));
476
+ const invalid = fromState.invalid || toState.invalid;
477
+ const messages = [fromState.error?.message, toState.error?.message].filter(
478
+ (m, i, all) => typeof m === "string" && m !== "" && all.indexOf(m) === i
479
+ );
480
+ const messageIds = messages.map((_, i) => `${formMessageId}-${i}`);
481
+ const fromValue = from.value;
482
+ const toValue = to.value;
483
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
484
+ hasContent(label) && // FormLabel colours from the START's error alone (its context is that field);
485
+ // the pair's state says it here.
486
+ /* @__PURE__ */ jsx(FormLabel, { id: `${id}-label`, required, "data-error": invalid || void 0, children: label }),
487
+ /* @__PURE__ */ jsx(
488
+ DateRangePicker,
489
+ {
490
+ ...pickerProps,
491
+ id: formItemId,
492
+ "aria-describedby": [pickerProps["aria-describedby"], describedBy, ...messageIds].filter(Boolean).join(" ") || void 0,
493
+ "aria-invalid": invalid || void 0,
494
+ "aria-required": required || void 0,
495
+ from: typeof fromValue === "string" ? fromValue : "",
496
+ to: typeof toValue === "string" ? toValue : "",
497
+ onChange: (f, t) => {
498
+ from.onChange(f === "" ? emptyValue : f);
499
+ to.onChange(t === "" ? emptyValue : t);
500
+ if (t !== "" || f === "") {
501
+ from.onBlur();
502
+ to.onBlur();
503
+ }
504
+ },
505
+ disabled: disabled || from.disabled || to.disabled,
506
+ invalid,
507
+ className: inputClassName ?? "w-full"
508
+ }
509
+ ),
510
+ hasContent(hint) && /* @__PURE__ */ jsx(FormDescription, { children: hint }),
511
+ messages.map((message, i) => (
512
+ // FormMessage's look and its rule: no `role="alert"` — read when focus reaches
513
+ // the trigger, which names these in its description.
514
+ /* @__PURE__ */ jsx(
515
+ "p",
516
+ {
517
+ id: messageIds[i],
518
+ "data-slot": "form-message",
519
+ className: "text-[11px] leading-tight text-[var(--danger)]",
520
+ children: message
521
+ },
522
+ message
523
+ )
524
+ ))
525
+ ] });
526
+ }
527
+ function RhfTimeInput({
528
+ name,
529
+ control,
530
+ rules,
531
+ label,
532
+ hint,
533
+ required,
534
+ disabled,
535
+ excludeWhenDisabled,
536
+ className,
537
+ emptyValue = "",
538
+ ...timeProps
539
+ }) {
540
+ return /* @__PURE__ */ jsx(
541
+ RhfField,
542
+ {
543
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
544
+ render: ({ field, invalid }) => {
545
+ const value = field.value;
546
+ return /* @__PURE__ */ jsx(
547
+ TimeInput,
548
+ {
549
+ "aria-required": required || void 0,
550
+ ...timeProps,
551
+ name: field.name,
552
+ ref: field.ref,
553
+ value: typeof value === "string" ? value : "",
554
+ onValueChange: (v) => field.onChange(v === "" ? emptyValue : v),
555
+ onBlur: field.onBlur,
556
+ disabled: field.disabled,
557
+ invalid
558
+ }
559
+ );
560
+ }
561
+ }
562
+ );
563
+ }
564
+ function RhfIbanInput({
565
+ name,
566
+ control,
567
+ rules,
568
+ label,
569
+ hint,
570
+ required,
571
+ disabled,
572
+ excludeWhenDisabled,
573
+ className,
574
+ ...ibanProps
575
+ }) {
576
+ return /* @__PURE__ */ jsx(
577
+ RhfField,
578
+ {
579
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
580
+ render: ({ field, invalid }) => {
581
+ const value = field.value;
582
+ return /* @__PURE__ */ jsx(
583
+ IbanInput,
584
+ {
585
+ "aria-required": required || void 0,
586
+ ...ibanProps,
587
+ name: field.name,
588
+ ref: field.ref,
589
+ value: typeof value === "string" ? value : "",
590
+ onValueChange: field.onChange,
591
+ onBlur: field.onBlur,
592
+ disabled: field.disabled,
593
+ invalid
594
+ }
595
+ );
596
+ }
597
+ }
598
+ );
599
+ }
600
+ function RhfPhoneInput({
601
+ name,
602
+ control,
603
+ rules,
604
+ label,
605
+ hint,
606
+ required,
607
+ disabled,
608
+ excludeWhenDisabled,
609
+ className,
610
+ ...phoneProps
611
+ }) {
612
+ return /* @__PURE__ */ jsx(
613
+ RhfField,
614
+ {
615
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
616
+ render: ({ field, invalid }) => {
617
+ const value = field.value;
618
+ return /* @__PURE__ */ jsx(
619
+ PhoneInput,
620
+ {
621
+ "aria-required": required || void 0,
622
+ ...phoneProps,
623
+ name: field.name,
624
+ ref: field.ref,
625
+ value: typeof value === "string" ? value : "",
626
+ onValueChange: field.onChange,
627
+ onBlur: field.onBlur,
628
+ disabled: field.disabled,
629
+ invalid
630
+ }
631
+ );
632
+ }
633
+ }
634
+ );
635
+ }
636
+ function RhfCountrySelect({
637
+ name,
638
+ control,
639
+ rules,
640
+ label,
641
+ hint,
642
+ required,
643
+ disabled,
644
+ excludeWhenDisabled,
645
+ className,
646
+ clearable,
647
+ clearValue = null,
648
+ selectClassName,
649
+ labels,
650
+ ...countryProps
651
+ }) {
652
+ const labelled = hasContent(label);
653
+ const ownLabels = typeof label === "string" ? { country: label, ...labels } : labels;
654
+ return /* @__PURE__ */ jsx(
655
+ RhfField,
656
+ {
657
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
658
+ render: ({ field, invalid, labelId }) => {
659
+ const value = field.value;
660
+ return (
661
+ // FormControl clones this element with `id` / `aria-describedby` /
662
+ // `aria-invalid`, which the picker routes to its trigger.
663
+ /* @__PURE__ */ jsx(
664
+ CountrySelect,
665
+ {
666
+ "aria-required": required || void 0,
667
+ "aria-labelledby": labelled ? labelId : void 0,
668
+ ...countryProps,
669
+ labels: ownLabels,
670
+ className: selectClassName,
671
+ ref: field.ref,
672
+ value: typeof value === "string" ? value : null,
673
+ clearable,
674
+ onChange: (code) => field.onChange(code ?? clearValue),
675
+ onBlur: field.onBlur,
676
+ disabled: field.disabled,
677
+ invalid
678
+ }
679
+ )
680
+ );
681
+ }
682
+ }
683
+ );
684
+ }
685
+ function MonthControl({
686
+ field,
687
+ invalid,
688
+ id,
689
+ valueAsNumber,
690
+ mode,
691
+ inputClassName,
692
+ pickerProps,
693
+ required,
694
+ ...aria
695
+ }) {
696
+ useFocusHandle(field.ref, () => document.getElementById(id));
697
+ const value = field.value;
698
+ return /* @__PURE__ */ jsx(
699
+ MonthPicker,
700
+ {
701
+ ...pickerProps,
702
+ ...aria,
703
+ "aria-required": required || void 0,
704
+ id,
705
+ mode,
706
+ value: value === null || value === void 0 ? "" : String(value),
707
+ onChange: (key) => {
708
+ field.onChange(mode === "year" && valueAsNumber ? Number(key) : key);
709
+ field.onBlur();
710
+ },
711
+ disabled: field.disabled,
712
+ invalid,
713
+ className: inputClassName
714
+ }
715
+ );
716
+ }
717
+ function RhfMonthPicker({
718
+ name,
719
+ control,
720
+ rules,
721
+ label,
722
+ hint,
723
+ required,
724
+ disabled,
725
+ excludeWhenDisabled,
726
+ className,
727
+ inputClassName,
728
+ mode,
729
+ valueAsNumber,
730
+ ...pickerProps
731
+ }) {
732
+ return /* @__PURE__ */ jsx(
733
+ RhfField,
734
+ {
735
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
736
+ render: ({ field, invalid, id }) => (
737
+ // FormControl clones this element with `aria-describedby` / `aria-invalid`,
738
+ // which MonthControl hands on to the picker's trigger.
739
+ /* @__PURE__ */ jsx(
740
+ MonthControl,
741
+ {
742
+ field,
743
+ invalid,
744
+ id,
745
+ mode,
746
+ valueAsNumber,
747
+ inputClassName,
748
+ pickerProps,
749
+ required
750
+ }
751
+ )
752
+ )
753
+ }
754
+ );
755
+ }
397
756
  function RhfSelect({
398
757
  name,
399
758
  control,
@@ -476,6 +835,93 @@ function RhfCheckbox({
476
835
  }
477
836
  );
478
837
  }
838
+ function RhfToggleGroup({
839
+ name,
840
+ control,
841
+ rules,
842
+ label,
843
+ hint,
844
+ required,
845
+ disabled,
846
+ excludeWhenDisabled,
847
+ className,
848
+ ...groupProps
849
+ }) {
850
+ const labelled = hasContent(label);
851
+ return /* @__PURE__ */ jsx(
852
+ RhfField,
853
+ {
854
+ ...{ name, control, rules, label, hint, required, disabled, excludeWhenDisabled, className },
855
+ asControl: false,
856
+ render: ({ field, invalid, id, labelId, describedBy }) => /* @__PURE__ */ jsx(
857
+ ToggleControl,
858
+ {
859
+ field,
860
+ invalid,
861
+ required,
862
+ id,
863
+ labelledBy: labelled ? labelId : void 0,
864
+ describedBy,
865
+ groupProps
866
+ }
867
+ )
868
+ }
869
+ );
870
+ }
871
+ function ToggleControl({
872
+ field,
873
+ invalid,
874
+ required,
875
+ id,
876
+ labelledBy,
877
+ describedBy,
878
+ groupProps
879
+ }) {
880
+ const { groupClassName, emptyValue, allowEmpty, semantics, caption, ...rest } = groupProps;
881
+ useFocusHandle(field.ref, () => {
882
+ const group = document.getElementById(id);
883
+ return group?.querySelector('button[tabindex="0"], button[aria-pressed="true"]') ?? group?.querySelector("button");
884
+ });
885
+ const onBlur = (e) => {
886
+ if (!e.currentTarget.contains(e.relatedTarget)) field.onBlur();
887
+ };
888
+ const raw = field.value;
889
+ const value = raw === null || raw === void 0 || raw === "" ? null : String(raw);
890
+ const common = {
891
+ ...rest,
892
+ id,
893
+ className: groupClassName,
894
+ "aria-labelledby": labelledBy,
895
+ "aria-describedby": describedBy,
896
+ "aria-invalid": invalid || void 0,
897
+ disabled: field.disabled,
898
+ onBlur
899
+ };
900
+ if (allowEmpty) {
901
+ return /* @__PURE__ */ jsx(
902
+ ToggleGroup,
903
+ {
904
+ ...common,
905
+ allowEmpty: true,
906
+ caption,
907
+ value,
908
+ onChange: (v) => field.onChange(v ?? emptyValue ?? null)
909
+ }
910
+ );
911
+ }
912
+ return /* @__PURE__ */ jsx(
913
+ ToggleGroup,
914
+ {
915
+ ...common,
916
+ allowEmpty: false,
917
+ semantics,
918
+ caption,
919
+ "aria-required": required && semantics !== "pressed" ? true : void 0,
920
+ value: value ?? "",
921
+ onChange: (v) => field.onChange(v)
922
+ }
923
+ );
924
+ }
479
925
  function EntityControl({
480
926
  field,
481
927
  invalid,
@@ -618,14 +1064,21 @@ function TextComboControl({
618
1064
  export {
619
1065
  RhfCheckbox,
620
1066
  RhfCombobox,
1067
+ RhfCountrySelect,
621
1068
  RhfDateField,
1069
+ RhfDateRangePicker,
622
1070
  RhfField,
1071
+ RhfIbanInput,
623
1072
  RhfIntegerField,
624
1073
  RhfMoneyField,
1074
+ RhfMonthPicker,
625
1075
  RhfNumberField,
1076
+ RhfPhoneInput,
626
1077
  RhfSelect,
627
1078
  RhfTextCombobox,
628
1079
  RhfTextField,
629
- RhfTextarea
1080
+ RhfTextarea,
1081
+ RhfTimeInput,
1082
+ RhfToggleGroup
630
1083
  };
631
1084
  //# sourceMappingURL=fields.js.map