@iyulab/components 1.37.0 → 1.38.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 (108) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/components/UFloatingElement.d.ts +7 -3
  3. package/dist/components/UFloatingElement.js +1 -1
  4. package/dist/plugins/vite-plugin-react-wrapper.js +31 -11
  5. package/dist/react/UAlert.d.ts +3 -3
  6. package/dist/react/UAlert.js +1 -1
  7. package/dist/react/UAvatar.d.ts +1 -1
  8. package/dist/react/UAvatar.js +1 -1
  9. package/dist/react/UBadge.d.ts +1 -1
  10. package/dist/react/UBadge.js +1 -1
  11. package/dist/react/UBreadcrumb.d.ts +1 -1
  12. package/dist/react/UBreadcrumb.js +1 -1
  13. package/dist/react/UBreadcrumbItem.d.ts +2 -2
  14. package/dist/react/UBreadcrumbItem.js +1 -1
  15. package/dist/react/UButton.d.ts +1 -1
  16. package/dist/react/UButton.js +1 -1
  17. package/dist/react/UButtonGroup.d.ts +1 -1
  18. package/dist/react/UButtonGroup.js +1 -1
  19. package/dist/react/UCard.d.ts +1 -1
  20. package/dist/react/UCard.js +1 -1
  21. package/dist/react/UCarousel.d.ts +1 -1
  22. package/dist/react/UCarousel.js +1 -1
  23. package/dist/react/UCheckbox.d.ts +1 -1
  24. package/dist/react/UCheckbox.js +1 -1
  25. package/dist/react/UChip.d.ts +3 -3
  26. package/dist/react/UChip.js +1 -1
  27. package/dist/react/UCopyButton.d.ts +1 -1
  28. package/dist/react/UCopyButton.js +1 -1
  29. package/dist/react/UDatePicker.d.ts +1 -1
  30. package/dist/react/UDatePicker.js +1 -1
  31. package/dist/react/UDialog.d.ts +3 -3
  32. package/dist/react/UDialog.js +1 -1
  33. package/dist/react/UDivider.d.ts +1 -1
  34. package/dist/react/UDivider.js +1 -1
  35. package/dist/react/UDrawer.d.ts +3 -3
  36. package/dist/react/UDrawer.js +1 -1
  37. package/dist/react/UExpander.d.ts +3 -3
  38. package/dist/react/UExpander.js +1 -1
  39. package/dist/react/UField.d.ts +1 -1
  40. package/dist/react/UField.js +1 -1
  41. package/dist/react/UFileInput.d.ts +1 -1
  42. package/dist/react/UFileInput.js +1 -1
  43. package/dist/react/UForm.d.ts +1 -1
  44. package/dist/react/UForm.js +1 -1
  45. package/dist/react/UIcon.d.ts +1 -1
  46. package/dist/react/UIcon.js +1 -1
  47. package/dist/react/UIconButton.d.ts +1 -1
  48. package/dist/react/UIconButton.js +1 -1
  49. package/dist/react/UInput.d.ts +1 -1
  50. package/dist/react/UInput.js +1 -1
  51. package/dist/react/UMenu.d.ts +1 -1
  52. package/dist/react/UMenu.js +1 -1
  53. package/dist/react/UMenuItem.d.ts +2 -2
  54. package/dist/react/UMenuItem.js +1 -1
  55. package/dist/react/UOption.d.ts +1 -1
  56. package/dist/react/UOption.js +1 -1
  57. package/dist/react/UPanel.d.ts +1 -1
  58. package/dist/react/UPanel.js +1 -1
  59. package/dist/react/UPopover.d.ts +3 -3
  60. package/dist/react/UPopover.js +1 -1
  61. package/dist/react/UProgressBar.d.ts +1 -1
  62. package/dist/react/UProgressBar.js +1 -1
  63. package/dist/react/UProgressRing.d.ts +1 -1
  64. package/dist/react/UProgressRing.js +1 -1
  65. package/dist/react/URadio.d.ts +1 -1
  66. package/dist/react/URadio.js +1 -1
  67. package/dist/react/URating.d.ts +1 -1
  68. package/dist/react/URating.js +1 -1
  69. package/dist/react/USelect.d.ts +1 -1
  70. package/dist/react/USelect.js +1 -1
  71. package/dist/react/USkeleton.d.ts +1 -1
  72. package/dist/react/USkeleton.js +1 -1
  73. package/dist/react/USlider.d.ts +1 -1
  74. package/dist/react/USlider.js +1 -1
  75. package/dist/react/USpinner.d.ts +1 -1
  76. package/dist/react/USpinner.js +1 -1
  77. package/dist/react/USplitPanel.d.ts +2 -2
  78. package/dist/react/USplitPanel.js +1 -1
  79. package/dist/react/USwitch.d.ts +1 -1
  80. package/dist/react/USwitch.js +1 -1
  81. package/dist/react/UTab.d.ts +2 -2
  82. package/dist/react/UTab.js +1 -1
  83. package/dist/react/UTabPanel.d.ts +1 -1
  84. package/dist/react/UTabPanel.js +1 -1
  85. package/dist/react/UTag.d.ts +1 -1
  86. package/dist/react/UTag.js +1 -1
  87. package/dist/react/UText.d.ts +1 -1
  88. package/dist/react/UText.js +1 -1
  89. package/dist/react/UTextarea.d.ts +1 -1
  90. package/dist/react/UTextarea.js +1 -1
  91. package/dist/react/UTooltip.d.ts +3 -3
  92. package/dist/react/UTooltip.js +1 -1
  93. package/dist/react/UTree.d.ts +1 -1
  94. package/dist/react/UTree.js +1 -1
  95. package/dist/react/UTreeItem.d.ts +5 -5
  96. package/dist/react/UTreeItem.js +1 -1
  97. package/dist/utilities/Locale.d.ts +1 -1
  98. package/dist/utilities/Locale.js +13 -3
  99. package/dist/utilities/format.d.ts +7 -2
  100. package/dist/utilities/format.js +7 -2
  101. package/package.json +2 -1
  102. package/skills/iyulab-components/SKILL.md +1 -0
  103. package/skills/iyulab-components/references/components/popover.md +5 -1
  104. package/skills/iyulab-components/references/components/tooltip.md +5 -1
  105. package/skills/iyulab-components/references/utilities/browser-storage.md +5 -0
  106. package/skills/iyulab-components/references/utilities/elements.md +17 -0
  107. package/skills/iyulab-components/references/utilities/format.md +73 -0
  108. package/skills/iyulab-components/references/utilities/locale.md +5 -1
@@ -0,0 +1,73 @@
1
+ # format
2
+
3
+ ```ts
4
+ import { formatNumber, formatCurrency, formatDate } from '@iyulab/components';
5
+ ```
6
+
7
+ Thin wrappers over `Intl.NumberFormat` / `Intl.DateTimeFormat` that default to the
8
+ library's active locale (`Locale.get()`), so numbers and dates rendered by your app match
9
+ the ones the components render themselves.
10
+
11
+ They add no formatting rules of their own — everything `Intl` accepts is passed straight
12
+ through. Reach for them instead of calling `Intl` directly when you want the active locale
13
+ applied without threading it through every call site.
14
+
15
+ ## Functions
16
+
17
+ ### `formatNumber(value, options?, locale?)`
18
+
19
+ ```ts
20
+ formatNumber(1234.5); // active locale
21
+ formatNumber(0.42, { style: 'percent' }); // '42%'
22
+ formatNumber(1234.5, { maximumFractionDigits: 0 }, 'de-DE');
23
+ ```
24
+
25
+ `options` is `Intl.NumberFormatOptions`. `locale` overrides the active locale for this call
26
+ only.
27
+
28
+ ---
29
+
30
+ ### `formatCurrency(value, currency, options?, locale?)`
31
+
32
+ ```ts
33
+ formatCurrency(1234.5, 'USD'); // '$1,234.50' in an en locale
34
+ formatCurrency(1234.5, 'KRW');
35
+ ```
36
+
37
+ `currency` is **required and has no default** — which currency an amount is in is domain
38
+ knowledge this utility will not guess.
39
+
40
+ ⚠ An invalid currency code throws `RangeError` rather than degrading (see the note under
41
+ `formatDate`). Pass a valid ISO 4217 code.
42
+
43
+ If `options` contains `currency` or `style`, those win over the `currency` argument.
44
+
45
+ ---
46
+
47
+ ### `formatDate(value, options?, locale?)`
48
+
49
+ ```ts
50
+ formatDate(new Date());
51
+ formatDate('2026-03-14', { dateStyle: 'long' });
52
+ formatDate(order.createdAt, { dateStyle: 'short', timeStyle: 'short' });
53
+ ```
54
+
55
+ Accepts a `Date` or an ISO `YYYY-MM-DD` string. **The string form is parsed as local time,
56
+ not UTC** — `'2026-03-14'` is midnight where the user is, so a date never shifts a day
57
+ across time zones the way `new Date('2026-03-14')` does.
58
+
59
+ A value that cannot be resolved to a real date — a malformed string, or an already-invalid
60
+ `Date` — returns `String(value)` instead of throwing. `Intl.DateTimeFormat.format()` throws
61
+ `RangeError` on an invalid date, and this runs inside render paths where an uncaught throw
62
+ blanks the whole component; showing the raw value is the lesser failure.
63
+
64
+ That degrade is **deliberately not symmetric** with `formatCurrency`: a date arrives as
65
+ data (an API, a user, a stale cache), so a bad one is an expected runtime state; a currency
66
+ code is written at the call site, so a bad one is a bug worth surfacing.
67
+
68
+ ## Locale
69
+
70
+ All three read `Locale.get()` when `locale` is omitted, so they follow whatever
71
+ [`Locale`](./locale.md) resolved — `<html lang>` first, then the browser language. Pass
72
+ `locale` explicitly only when one value must be formatted differently from the rest of the
73
+ page (a currency shown in its home locale, for example).
@@ -10,7 +10,11 @@ Locale registry utility for library-generated validation messages.
10
10
 
11
11
  Built in: `en`, `ko`, `ja`, `zh-CN`, `zh-TW`, `es`, `fr`, `de`, `pt-BR`, `vi`, `th`, `id`, `ru`, `ar`.
12
12
 
13
- Initial locale is auto-detected from `navigator.language` / `document.documentElement.lang`, with English fallback.
13
+ Initial locale is auto-detected from `document.documentElement.lang` first, then
14
+ `navigator.language`, with English fallback. `<html lang>` wins because it is the author's
15
+ declaration of the document's language and is what assistive technology uses to pick
16
+ pronunciation rules (WCAG 3.1.1 / 3.1.2); the browser language is the user-preference
17
+ fallback for when no such declaration exists. Call `Locale.set()` to override either.
14
18
 
15
19
  ## API
16
20