@scattered-light/loomiere-base-ui 0.6.1 → 0.7.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 (100) hide show
  1. package/README.md +135 -5
  2. package/dist/chunk-JUUPOOQQ.js +3723 -0
  3. package/dist/chunk-JUUPOOQQ.js.map +1 -0
  4. package/dist/chunk-M7KJASGK.js +802 -0
  5. package/dist/chunk-M7KJASGK.js.map +1 -0
  6. package/dist/chunk-Y2CPBMFJ.js +147 -0
  7. package/dist/chunk-Y2CPBMFJ.js.map +1 -0
  8. package/dist/custom/collection/index.d.ts +534 -0
  9. package/dist/custom/collection/index.js +1471 -0
  10. package/dist/custom/collection/index.js.map +1 -0
  11. package/dist/custom/index.d.ts +5 -0
  12. package/dist/custom/index.js +4 -0
  13. package/dist/custom/index.js.map +1 -0
  14. package/dist/design-system/components/Badge/README.md +35 -0
  15. package/dist/design-system/components/Badge/preview.html +19 -0
  16. package/dist/design-system/components/Collection/README.md +14 -0
  17. package/dist/design-system/components/CollectionPagination/README.md +15 -0
  18. package/dist/design-system/components/CollectionToolbar/README.md +24 -0
  19. package/dist/design-system/components/DataList/README.md +39 -0
  20. package/dist/design-system/components/DataList/preview.html +475 -0
  21. package/dist/design-system/components/DataTable/README.md +41 -0
  22. package/dist/design-system/components/DataTable/preview.html +475 -0
  23. package/dist/design-system/components/DatePicker/README.md +55 -0
  24. package/dist/design-system/components/DatePicker/preview.html +475 -0
  25. package/dist/design-system/components/EditableList/README.md +33 -0
  26. package/dist/design-system/components/EditableList/preview.html +475 -0
  27. package/dist/design-system/components/EmptyState/README.md +60 -0
  28. package/dist/design-system/components/EmptyState/preview.html +475 -0
  29. package/dist/design-system/components/ListDetail/README.md +43 -0
  30. package/dist/design-system/components/ListDetail/preview.html +475 -0
  31. package/dist/design-system/components/MoneyField/README.md +52 -0
  32. package/dist/design-system/components/MoneyField/preview.html +475 -0
  33. package/dist/design-system/components/Splitter/README.md +42 -0
  34. package/dist/design-system/components/Splitter/preview.html +475 -0
  35. package/dist/design-system/components/Table/README.md +2 -1
  36. package/dist/design-system/components/Table/preview.html +1 -1
  37. package/dist/design-system/components/bundle.js +7 -5
  38. package/dist/design-system/components/index.d.ts +3 -21
  39. package/dist/design-system/components/styles.css +2266 -186
  40. package/dist/index-ChJXlxzq.d.ts +809 -0
  41. package/dist/index.d.ts +3 -21
  42. package/dist/index.js +176 -891
  43. package/dist/index.js.map +1 -1
  44. package/dist/styles/components/Accordion.css +1 -1
  45. package/dist/styles/components/AlertDialog.css +1 -1
  46. package/dist/styles/components/Autocomplete.css +1 -1
  47. package/dist/styles/components/Avatar.css +1 -1
  48. package/dist/styles/components/Button.css +1 -1
  49. package/dist/styles/components/Checkbox.css +1 -1
  50. package/dist/styles/components/CheckboxGroup.css +1 -1
  51. package/dist/styles/components/Collapsible.css +1 -1
  52. package/dist/styles/components/Combobox.css +1 -1
  53. package/dist/styles/components/ContextMenu.css +1 -1
  54. package/dist/styles/components/Dialog.css +1 -1
  55. package/dist/styles/components/Drawer.css +1 -1
  56. package/dist/styles/components/Field.css +1 -1
  57. package/dist/styles/components/Fieldset.css +1 -1
  58. package/dist/styles/components/Form.css +1 -1
  59. package/dist/styles/components/Input.css +1 -1
  60. package/dist/styles/components/Menu.css +1 -1
  61. package/dist/styles/components/Menubar.css +1 -1
  62. package/dist/styles/components/Meter.css +1 -1
  63. package/dist/styles/components/NavigationMenu.css +1 -1
  64. package/dist/styles/components/NumberField.css +1 -1
  65. package/dist/styles/components/OTPField.css +1 -1
  66. package/dist/styles/components/Popover.css +1 -1
  67. package/dist/styles/components/PreviewCard.css +1 -1
  68. package/dist/styles/components/Progress.css +1 -1
  69. package/dist/styles/components/Radio.css +1 -1
  70. package/dist/styles/components/ScrollArea.css +1 -1
  71. package/dist/styles/components/Select.css +1 -1
  72. package/dist/styles/components/Separator.css +1 -1
  73. package/dist/styles/components/Slider.css +1 -1
  74. package/dist/styles/components/Switch.css +1 -1
  75. package/dist/styles/components/Tabs.css +1 -1
  76. package/dist/styles/components/Toast.css +1 -1
  77. package/dist/styles/components/Toggle.css +1 -1
  78. package/dist/styles/components/ToggleGroup.css +1 -1
  79. package/dist/styles/components/Toolbar.css +1 -1
  80. package/dist/styles/components/Tooltip.css +1 -1
  81. package/dist/styles/custom/Badge.css +104 -0
  82. package/dist/styles/custom/Collection.css +15 -0
  83. package/dist/styles/custom/CollectionPagination.css +24 -0
  84. package/dist/styles/custom/CollectionToolbar.css +57 -0
  85. package/dist/styles/custom/DataList.css +123 -0
  86. package/dist/styles/custom/DataTable.css +120 -0
  87. package/dist/styles/custom/DatePicker.css +572 -0
  88. package/dist/styles/custom/EditableList.css +98 -0
  89. package/dist/styles/custom/EmptyState.css +255 -0
  90. package/dist/styles/custom/ListDetail.css +126 -0
  91. package/dist/styles/custom/MoneyField.css +344 -0
  92. package/dist/styles/custom/Splitter.css +207 -0
  93. package/dist/styles/{components → custom}/Table.css +31 -4
  94. package/dist/styles/index.css +12 -2
  95. package/dist/styles/reset/accessibility.css +1 -1
  96. package/dist/styles/reset/reset-accessibility.css +1 -1
  97. package/dist/styles/reset/reset-tailwind.css +1 -1
  98. package/dist/styles/reset/reset.css +1 -1
  99. package/dist/styles/tailwind.css +12 -2
  100. package/package.json +35 -7
@@ -0,0 +1,52 @@
1
+ # MoneyField
2
+
3
+ Loomiere component, not part of Base UI. An amount of money, built on Number field. The value is an integer in minor units (cents, yen, fils) so 0.1 + 0.2 and 1.005 * 100 cannot drift, and so the number matches what a payment API sends. Number field counts in major units; Money field converts at the edge and rounds half away from zero. The default maximum is 10^15 - 1 minor units, so the major amount stays inside 15 significant digits. Changing currency keeps the number the person typed and re-rounds it to the new currency's digits (12.50 USD becomes 13 JPY). There is no exchange rate. When the app controls both the value and the currency, it decides whether to apply that rounding: onValueChange still reports the re-rounded minor units. Keyboard is Number field's: ArrowUp and ArrowDown step one major unit, Shift steps 100 major units, Alt steps one minor unit, Home and End jump to the minimum and maximum. The currency symbol is not in the text, so the caret does not fight it. A fixed symbol is aria-hidden; the currency name is in the input's accessible description. A picker is its own tab stop, before the input when the locale puts the symbol first and after it when the locale puts the symbol last. State on the root: data-currency (USD), data-affix (start or end), data-affix-kind (symbol or picker), data-negative (below zero; set data-color on the field to color it, never on by default), data-align (start or end), data-size (xs, sm, md, lg), data-readonly, plus data-invalid, data-disabled, data-focused and data-scrubbing. The affix (symbol or picker) is drawn inside the field so it can later be lifted into a general Input affix for units, https://, or @. Position comes from the locale, with logical properties so RTL mirrors it. The group, not the input, carries the field border, hover, focus halo, invalid edge and disabled fill, so the affix reads as part of the field.
4
+
5
+ Use `Loomiere.MoneyField`, this package's component: it puts the class names on for you (`import { MoneyField } from '@scattered-light/loomiere-base-ui'`, or from `@scattered-light/loomiere-base-ui/custom`).
6
+
7
+ Not a Base UI part, so there is no base-ui.com page for it.
8
+
9
+ ## Classes
10
+
11
+ | Class | Data attributes it answers to |
12
+ |---|---|
13
+ | `MoneyField` | `data-size`: `xs`, `sm`, `lg`; `data-invalid`; `data-disabled`; `data-affix-kind`: `symbol`; `data-affix`: `start`, `end`; `data-steppers`; `data-align`: `end`, `start`; `data-focused`; `data-readonly`; `data-negative`; `data-color`; `data-scrubbing` |
14
+ | `MoneyFieldGroup` | |
15
+ | `MoneyFieldInput` | |
16
+ | `MoneyFieldAffix` | |
17
+ | `MoneyFieldCurrencyTrigger` | `data-popup-open` |
18
+ | `MoneyFieldSign` | |
19
+ | `MoneyFieldCurrency` | |
20
+ | `MoneyFieldCurrencyField` | |
21
+ | `ComboboxRoot` | |
22
+ | `MoneyFieldCurrencyIcon` | |
23
+ | `MoneyFieldCurrencyPopup` | |
24
+ | `MoneyFieldCurrencyItem` | |
25
+ | `MoneyFieldCurrencySymbol` | |
26
+ | `ComboboxInput` | |
27
+
28
+ Base UI sets the state attributes (`data-checked`, `data-open`, `data-disabled`...) itself. Set `data-size`, `data-emphasis`, `data-variant` and `data-color` yourself; `data-color` takes any palette name (`primary`, `secondary`, `error`...) and repaints the part in it.
29
+
30
+ ## Example
31
+
32
+ From the MoneyField stories (`Default`):
33
+
34
+ ```tsx
35
+ export const Default: Story = {
36
+ render: () => (
37
+ <Labeled>
38
+ <MoneyField currency="USD" defaultValue={123450} name="amount" />
39
+ </Labeled>
40
+ ),
41
+ play: async ({ canvasElement }) => {
42
+ const canvas = within(canvasElement);
43
+ const input = canvas.getByRole('textbox');
44
+ await userEvent.clear(input);
45
+ await userEvent.type(input, '1234.5');
46
+ await userEvent.tab();
47
+ await expect(input).toHaveValue('1,234.50');
48
+ },
49
+ };
50
+ ```
51
+
52
+ The preview also shows `Yen`, `Dinar`, `EuroInGerman`.