@allxsmith/bestax-bulma 5.52.0 → 5.54.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 (145) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Avatars.js +7 -2
  4. package/dist/esm/components/Avatars.js.map +1 -1
  5. package/dist/esm/components/Badge.js +7 -2
  6. package/dist/esm/components/Badge.js.map +1 -1
  7. package/dist/esm/components/Command.js +19 -9
  8. package/dist/esm/components/Command.js.map +1 -1
  9. package/dist/esm/components/Modal.js +2 -1
  10. package/dist/esm/components/Modal.js.map +1 -1
  11. package/dist/esm/components/Pagination.js +9 -1
  12. package/dist/esm/components/Pagination.js.map +1 -1
  13. package/dist/esm/components/Sidebar.js +3 -1
  14. package/dist/esm/components/Sidebar.js.map +1 -1
  15. package/dist/esm/components/Steps.js +5 -1
  16. package/dist/esm/components/Steps.js.map +1 -1
  17. package/dist/esm/components/Toast.js +8 -5
  18. package/dist/esm/components/Toast.js.map +1 -1
  19. package/dist/esm/elements/Notification.js +4 -2
  20. package/dist/esm/elements/Notification.js.map +1 -1
  21. package/dist/esm/elements/RingProgress.js +6 -1
  22. package/dist/esm/elements/RingProgress.js.map +1 -1
  23. package/dist/esm/form/Autocomplete.js +7 -2
  24. package/dist/esm/form/Autocomplete.js.map +1 -1
  25. package/dist/esm/form/Checkbox.js +3 -2
  26. package/dist/esm/form/Checkbox.js.map +1 -1
  27. package/dist/esm/form/CheckboxCard.js +3 -2
  28. package/dist/esm/form/CheckboxCard.js.map +1 -1
  29. package/dist/esm/form/Combobox.js +10 -4
  30. package/dist/esm/form/Combobox.js.map +1 -1
  31. package/dist/esm/form/DateInputBase.js +15 -6
  32. package/dist/esm/form/DateInputBase.js.map +1 -1
  33. package/dist/esm/form/DateRangeInputBase.js +15 -5
  34. package/dist/esm/form/DateRangeInputBase.js.map +1 -1
  35. package/dist/esm/form/DateTimeInputBase.js +15 -6
  36. package/dist/esm/form/DateTimeInputBase.js.map +1 -1
  37. package/dist/esm/form/Fieldset.js +64 -0
  38. package/dist/esm/form/Fieldset.js.map +1 -0
  39. package/dist/esm/form/File.js +4 -1
  40. package/dist/esm/form/File.js.map +1 -1
  41. package/dist/esm/form/FormContext.js +17 -1
  42. package/dist/esm/form/FormContext.js.map +1 -1
  43. package/dist/esm/form/InputBase.js +3 -2
  44. package/dist/esm/form/InputBase.js.map +1 -1
  45. package/dist/esm/form/Numberinput.js +3 -2
  46. package/dist/esm/form/Numberinput.js.map +1 -1
  47. package/dist/esm/form/PinInput.js +3 -2
  48. package/dist/esm/form/PinInput.js.map +1 -1
  49. package/dist/esm/form/Radio.js +3 -2
  50. package/dist/esm/form/Radio.js.map +1 -1
  51. package/dist/esm/form/RadioCard.js +3 -2
  52. package/dist/esm/form/RadioCard.js.map +1 -1
  53. package/dist/esm/form/Rate.js +12 -3
  54. package/dist/esm/form/Rate.js.map +1 -1
  55. package/dist/esm/form/SelectBase.js +3 -2
  56. package/dist/esm/form/SelectBase.js.map +1 -1
  57. package/dist/esm/form/Slider.js +10 -6
  58. package/dist/esm/form/Slider.js.map +1 -1
  59. package/dist/esm/form/Switch.js +3 -1
  60. package/dist/esm/form/Switch.js.map +1 -1
  61. package/dist/esm/form/Taginput.js +12 -5
  62. package/dist/esm/form/Taginput.js.map +1 -1
  63. package/dist/esm/form/TextAreaBase.js +3 -2
  64. package/dist/esm/form/TextAreaBase.js.map +1 -1
  65. package/dist/esm/form/TimeInputBase.js +13 -6
  66. package/dist/esm/form/TimeInputBase.js.map +1 -1
  67. package/dist/esm/form/_pickerInternals/PickerPopover.js +4 -2
  68. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  69. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +80 -0
  70. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -0
  71. package/dist/esm/helpers/LocaleProvider.js +156 -0
  72. package/dist/esm/helpers/LocaleProvider.js.map +1 -0
  73. package/dist/esm/helpers/localeFormat.js +108 -0
  74. package/dist/esm/helpers/localeFormat.js.map +1 -0
  75. package/dist/esm/helpers/localeInfo.js +109 -0
  76. package/dist/esm/helpers/localeInfo.js.map +1 -0
  77. package/dist/esm/helpers/portal.js +14 -1
  78. package/dist/esm/helpers/portal.js.map +1 -1
  79. package/dist/extras.css +1 -1
  80. package/dist/extras.css.map +1 -1
  81. package/dist/index.cjs +690 -73
  82. package/dist/index.cjs.map +1 -1
  83. package/dist/index.esm.js +2 -0
  84. package/dist/index.esm.js.map +1 -1
  85. package/dist/types/components/Avatars.d.ts +1 -1
  86. package/dist/types/components/Badge.d.ts +1 -1
  87. package/dist/types/components/Command.d.ts +4 -2
  88. package/dist/types/components/Pagination.d.ts +3 -0
  89. package/dist/types/components/Steps.d.ts +4 -1
  90. package/dist/types/elements/RingProgress.d.ts +3 -2
  91. package/dist/types/form/Autocomplete.d.ts +6 -1
  92. package/dist/types/form/Combobox.d.ts +3 -2
  93. package/dist/types/form/DateInputBase.d.ts +25 -3
  94. package/dist/types/form/DateRangeInputBase.d.ts +25 -3
  95. package/dist/types/form/DateTimeInputBase.d.ts +25 -3
  96. package/dist/types/form/Fieldset.d.ts +86 -0
  97. package/dist/types/form/File.d.ts +2 -1
  98. package/dist/types/form/FormContext.d.ts +12 -0
  99. package/dist/types/form/Rate.d.ts +4 -1
  100. package/dist/types/form/Slider.d.ts +9 -2
  101. package/dist/types/form/Taginput.d.ts +8 -2
  102. package/dist/types/form/TimeInputBase.d.ts +5 -1
  103. package/dist/types/form/_pickerInternals/PickerPopover.d.ts +6 -0
  104. package/dist/types/form/_pickerInternals/useLocaleDefaults.d.ts +49 -0
  105. package/dist/types/helpers/LocaleProvider.d.ts +131 -0
  106. package/dist/types/helpers/localeFormat.d.ts +26 -0
  107. package/dist/types/helpers/localeInfo.d.ts +23 -0
  108. package/dist/types/helpers/portal.d.ts +11 -0
  109. package/dist/types/index.d.ts +3 -0
  110. package/dist/types-cjs/components/Avatars.d.ts +1 -1
  111. package/dist/types-cjs/components/Badge.d.ts +1 -1
  112. package/dist/types-cjs/components/Command.d.ts +4 -2
  113. package/dist/types-cjs/components/Pagination.d.ts +3 -0
  114. package/dist/types-cjs/components/Steps.d.ts +4 -1
  115. package/dist/types-cjs/elements/RingProgress.d.ts +3 -2
  116. package/dist/types-cjs/form/Autocomplete.d.ts +6 -1
  117. package/dist/types-cjs/form/Combobox.d.ts +3 -2
  118. package/dist/types-cjs/form/DateInputBase.d.ts +25 -3
  119. package/dist/types-cjs/form/DateRangeInputBase.d.ts +25 -3
  120. package/dist/types-cjs/form/DateTimeInputBase.d.ts +25 -3
  121. package/dist/types-cjs/form/Fieldset.d.ts +86 -0
  122. package/dist/types-cjs/form/File.d.ts +2 -1
  123. package/dist/types-cjs/form/FormContext.d.ts +12 -0
  124. package/dist/types-cjs/form/Rate.d.ts +4 -1
  125. package/dist/types-cjs/form/Slider.d.ts +9 -2
  126. package/dist/types-cjs/form/Taginput.d.ts +8 -2
  127. package/dist/types-cjs/form/TimeInputBase.d.ts +5 -1
  128. package/dist/types-cjs/form/_pickerInternals/PickerPopover.d.ts +6 -0
  129. package/dist/types-cjs/form/_pickerInternals/useLocaleDefaults.d.ts +49 -0
  130. package/dist/types-cjs/helpers/LocaleProvider.d.ts +131 -0
  131. package/dist/types-cjs/helpers/localeFormat.d.ts +26 -0
  132. package/dist/types-cjs/helpers/localeInfo.d.ts +23 -0
  133. package/dist/types-cjs/helpers/portal.d.ts +11 -0
  134. package/dist/types-cjs/index.d.ts +3 -0
  135. package/dist/versions/bestax-no-dark-mode.css +1 -1
  136. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  137. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  138. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  139. package/dist/versions/bestax-no-helpers.css +1 -1
  140. package/dist/versions/bestax-no-helpers.css.map +1 -1
  141. package/dist/versions/bestax-prefixed.css +1 -1
  142. package/dist/versions/bestax-prefixed.css.map +1 -1
  143. package/package.json +1 -1
  144. package/src/scss/form/_fieldset.scss +108 -0
  145. package/src/scss/form/_index.scss +1 -0
@@ -0,0 +1,26 @@
1
+ /** Formats a number for display, with `Intl.NumberFormat` options. */
2
+ export type NumberFormatter = (value: number, options?: Intl.NumberFormatOptions) => string;
3
+ /** Whether `text` contains `query`, as the locale compares letters. */
4
+ export type TextMatcher = (text: string, query: string) => boolean;
5
+ /**
6
+ * A formatter for numbers shown on screen, in the locale of the
7
+ * `LocaleProvider` around the component, or `null` outside one that gives a
8
+ * locale. Formatters are kept per set of options, since building one is the
9
+ * expensive part.
10
+ *
11
+ * @param own - The component's own locale, such as a picker's `locale`,
12
+ * which wins inside a provider.
13
+ */
14
+ export declare function useNumberFormat(own?: string): NumberFormatter | null;
15
+ /**
16
+ * A matcher for filtering a list by what was typed, in the locale of the
17
+ * `LocaleProvider` around the component, or `null` outside one that gives a
18
+ * locale. It compares with `Intl.Collator` at `usage: 'search'` and
19
+ * `sensitivity: 'base'`, so it ignores case and accents where the language
20
+ * treats the letters as the same: "cafe" finds "Café", while in Swedish "a"
21
+ * doesn't find "å", a letter of its own there. Marks the language ignores
22
+ * count for nothing on either side, so in Arabic محمد finds مُحَمَّد and the
23
+ * other way round. An empty query, or one of nothing but such marks,
24
+ * matches everything.
25
+ */
26
+ export declare function useLocaleMatcher(): TextMatcher | null;
@@ -0,0 +1,23 @@
1
+ import type { DayOfWeek } from '../form/_pickerInternals/pickerTypes.js';
2
+ /**
3
+ * The canonical form of a BCP 47 tag (`"en-us"` becomes `"en-US"`), or
4
+ * `undefined` for an empty or missing one. Throws a `RangeError` for a tag
5
+ * `Intl` refuses, as `Intl.DateTimeFormat` would.
6
+ */
7
+ export declare function canonicalLocale(tag: string | undefined): string | undefined;
8
+ /**
9
+ * The direction a locale's script is written in: from `Intl.Locale`'s text
10
+ * info, else from the script `maximize()` fills in, else from the language.
11
+ *
12
+ * @param locale - A canonical tag, as `canonicalLocale` returns.
13
+ */
14
+ export declare function localeDirection(locale: string): 'ltr' | 'rtl';
15
+ /**
16
+ * The day a locale's week starts on, 0 for Sunday, as `getWeekInfo()` reads
17
+ * it: the tag's `-u-fw-` keyword, else the region its `-u-rg-` keyword names,
18
+ * else its own region or the one `maximize()` fills in, looked up in CLDR's
19
+ * week data, where a region not listed starts on Monday.
20
+ *
21
+ * @param locale - A canonical tag, as `canonicalLocale` returns.
22
+ */
23
+ export declare function localeFirstDay(locale: string): DayOfWeek;
@@ -75,6 +75,17 @@ export interface PortalProps {
75
75
  * also reaches what the library's components portal, such as Popover's
76
76
  * `appendToBody` panel or a `Modal` with `portal`.
77
77
  *
78
+ * Inside a `LocaleProvider`, the children keep its `dir` and `lang`. A
79
+ * container inside the provider's own wrapper takes the children as they
80
+ * are, and they follow the provider through the page. Any other,
81
+ * `document.body` included, gets them inside one `<div>` carrying the
82
+ * provider's values, with `display: contents` so it adds no box. It is
83
+ * still an element, so content that must be the container's direct child,
84
+ * a `<tr>` in a `<tbody>`, or that a direct-child selector styles, belongs
85
+ * in a container inside the provider. Which of the two is settled when the
86
+ * children mount, so a change of locale updates them in place rather than
87
+ * remounting them.
88
+ *
78
89
  * Tab order and focus follow the DOM too. Content portaled from inside a
79
90
  * focus trap is no longer inside the trapped element, so the trap neither
80
91
  * reaches it nor holds focus there: render nested overlays inside the
@@ -78,6 +78,7 @@ export * from './form/CheckboxCard.js';
78
78
  export * from './form/Checkboxes.js';
79
79
  export * from './form/Control.js';
80
80
  export * from './form/Field.js';
81
+ export * from './form/Fieldset.js';
81
82
  export * from './form/File.js';
82
83
  export * from './form/Radio.js';
83
84
  export * from './form/RadioCard.js';
@@ -133,6 +134,8 @@ export type { ClientOnlyProps } from './helpers/ClientOnly.js';
133
134
  export { useIsHydrated } from './helpers/useIsHydrated.js';
134
135
  export { Portal } from './helpers/portal.js';
135
136
  export type { PortalProps } from './helpers/portal.js';
137
+ export { LocaleProvider, useLocale } from './helpers/LocaleProvider.js';
138
+ export type { LocaleContextValue, LocaleProviderProps, TextDirection, } from './helpers/LocaleProvider.js';
136
139
  export { useFocusTrap } from './helpers/useFocusTrap.js';
137
140
  export type { UseFocusTrapOptions } from './helpers/useFocusTrap.js';
138
141
  export * from './layout/Container.js';
@@ -19,7 +19,7 @@ export interface AvatarsProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
19
19
  spacing?: AvatarsSpacing | number;
20
20
  /** Lay the avatars out side by side (non-overlapping), using `spacing` as the gap. */
21
21
  spaced?: boolean;
22
- /** Builds the surplus avatar's accessible name from the hidden count, for localization. Default: `` `${count} more` ``. */
22
+ /** Builds the surplus avatar's accessible name from the hidden count, for localization. Default: `` `${count} more` ``. Inside a `LocaleProvider` with a `locale`, the visible `+count` and the count in the default name are written the way that locale writes numbers. */
23
23
  surplusLabel?: (count: number) => string;
24
24
  /** `Avatar` elements to render inside the group. */
25
25
  children?: React.ReactNode;
@@ -15,7 +15,7 @@ export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
15
15
  className?: string;
16
16
  /** Additional CSS classes applied to the badge pill itself (unprefixed, like `Tooltip`'s `tooltipClassName`). */
17
17
  badgeClassName?: string;
18
- /** Count, short text, or a custom node to display; omit with `dot` for a plain dot. `max`/`showZero` apply only to numeric content. */
18
+ /** Count, short text, or a custom node to display; omit with `dot` for a plain dot. `max`/`showZero` apply only to numeric content. A numeric count is written the way the `locale` of a `LocaleProvider` around it writes numbers. */
19
19
  content?: React.ReactNode;
20
20
  /** Numeric `content` above this renders as `"{max}+"`. A negative or non-integer value falls back to the default. */
21
21
  max?: number;
@@ -74,8 +74,10 @@ export interface CommandActionsProps extends CommandBaseProps {
74
74
  /**
75
75
  * The actions, for a Command that renders the field, the list, the groups
76
76
  * and the empty message itself. Typing filters them by label, keywords and
77
- * description, ignoring case, with label matches first. Leave it out to
78
- * build the Command from parts.
77
+ * description, ignoring case, with label matches first. Inside a
78
+ * `LocaleProvider` with a `locale`, it ignores accents too where that
79
+ * language does, so "cafe" finds "Café". Leave it out to build the
80
+ * Command from parts.
79
81
  */
80
82
  actions: CommandAction[];
81
83
  /**
@@ -61,6 +61,9 @@ export interface PaginationProps extends React.HTMLAttributes<HTMLElement>, Omit
61
61
  /**
62
62
  * The accessible name of a page's link, when rendering from `total`, since
63
63
  * its content is only the number (`page => 'Page ' + page` by default).
64
+ * Inside a `LocaleProvider` with a `locale`, the number on the link, and
65
+ * in the default name, is written the way that locale writes numbers, so
66
+ * the name still holds the text on screen.
64
67
  */
65
68
  getPageLabel?: (page: number) => string;
66
69
  /** Additional CSS classes. */
@@ -105,7 +105,10 @@ export interface StepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, '
105
105
  clickable?: boolean;
106
106
  /** Click handler */
107
107
  onClick?: () => void;
108
- /** Step number to display in marker (1-indexed) */
108
+ /**
109
+ * Step number to display in marker (1-indexed), written the way the
110
+ * `locale` of a `LocaleProvider` around it writes numbers.
111
+ */
109
112
  stepNumber?: number;
110
113
  /**
111
114
  * Icon shown when the step is completed.
@@ -35,8 +35,9 @@ export interface RingProgressProps extends Omit<React.HTMLAttributes<HTMLDivElem
35
35
  * Several values around one ring, in order clockwise from the top, each
36
36
  * with its own color and label. The ring is then an image whose name
37
37
  * writes them out, such as "Storage: Documents 40%, Photos 15%", since a
38
- * screen reader can't take several values from one element. A total over
39
- * `max` fills the ring and stops.
38
+ * screen reader can't take several values from one element. Inside a
39
+ * `LocaleProvider` with a `locale`, the shares are written as that locale
40
+ * writes a percentage. A total over `max` fills the ring and stops.
40
41
  */
41
42
  sections?: RingProgressSection[];
42
43
  /**
@@ -27,7 +27,12 @@ export interface AutocompleteProps extends Omit<React.HTMLAttributes<HTMLDivElem
27
27
  };
28
28
  /** Applied to the inner text input (the labellable control), not the wrapper div. */
29
29
  id?: string;
30
- /** The options data to display (required). */
30
+ /**
31
+ * The options data to display (required). The list shows the options that
32
+ * contain what's typed, ignoring case, and inside a `LocaleProvider` with a
33
+ * `locale`, ignoring accents too where that language does, so "cafe" finds
34
+ * "Café".
35
+ */
31
36
  data: AutocompleteItem[] | string[];
32
37
  /** The current input value (controlled). */
33
38
  value?: string;
@@ -174,8 +174,9 @@ export interface ComboboxSingleDataProps extends ComboboxDataBaseProps {
174
174
  * The items, for a Combobox that renders the field, the menu, the list,
175
175
  * the groups and the empty message itself. A string is an item whose label
176
176
  * is its value, and an object is `{ value, label?, disabled?, group? }`.
177
- * Typing filters the items by label, ignoring case, and the Combobox keeps
178
- * the value. Leave it out to build the Combobox from parts.
177
+ * Typing filters the items by label, ignoring case, and inside a
178
+ * `LocaleProvider` with a `locale`, ignoring accents too where that
179
+ * language does, so "cafe" finds "Café". The Combobox keeps the value. Leave it out to build the Combobox from parts.
179
180
  */
180
181
  data: (string | ComboboxItemData)[];
181
182
  /**
@@ -68,7 +68,15 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
68
68
  * format leaves out, such as the time of day.
69
69
  */
70
70
  parse?: (s: string) => Date | null;
71
- /** BCP-47 locale tag for day/month names and Intl formatting. */
71
+ /**
72
+ * BCP-47 locale tag for day/month names and Intl formatting. Unset, it is
73
+ * the `locale` of a `LocaleProvider` around the picker, and with neither,
74
+ * `Intl` uses the runtime's own locale. On a server render that is the
75
+ * server's, so an `inline` calendar rendered there names its days in the
76
+ * server's language and the browser's own render names them in the
77
+ * browser's: give it a locale, here or through a `LocaleProvider`, where
78
+ * the two can differ.
79
+ */
72
80
  locale?: string;
73
81
  /** Render the calendar inline (no popover). */
74
82
  inline?: boolean;
@@ -119,9 +127,23 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
119
127
  shouldDisableDate?: (d: Date) => boolean;
120
128
  /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. */
121
129
  unselectableDates?: Date[];
122
- /** Day the week starts on (0 = Sunday). */
130
+ /**
131
+ * Day the week starts on (0 = Sunday). Unset inside a `LocaleProvider`,
132
+ * it is the first day of the week in the picker's locale, its own `locale`
133
+ * or else the provider's, such as Monday for `"de"`. Elsewhere, with no
134
+ * locale from either, or with seven `dayNames` of your own, it is Sunday:
135
+ * set it with `dayNames` to start the week on another day.
136
+ * @defaultValue 0
137
+ */
123
138
  firstDayOfWeek?: DayOfWeek;
124
- /** Override the 7 day-name labels (in calendar order, post-rotation). */
139
+ /**
140
+ * Override the 7 day-name labels (in calendar order, post-rotation). They
141
+ * are shown exactly as given, from the first column, so they have to start
142
+ * on the day the week does. With them, an unset `firstDayOfWeek` stays
143
+ * Sunday even inside a `LocaleProvider`, so names written Sunday first keep
144
+ * matching their columns; to start on the locale's day, set
145
+ * `firstDayOfWeek` too and list the names from that day.
146
+ */
125
147
  dayNames?: string[];
126
148
  /** Override the 12 month-name labels. */
127
149
  monthNames?: string[];
@@ -52,7 +52,15 @@ export interface DateRangeInputBaseProps extends Omit<React.HTMLAttributes<HTMLD
52
52
  * Enter and leaving an input call it only if the user changed its text.
53
53
  */
54
54
  parse?: (s: string) => Date | null;
55
- /** BCP-47 locale tag for day/month names and Intl formatting. */
55
+ /**
56
+ * BCP-47 locale tag for day/month names and Intl formatting. Unset, it is
57
+ * the `locale` of a `LocaleProvider` around the picker, and with neither,
58
+ * `Intl` uses the runtime's own locale. On a server render that is the
59
+ * server's, so an `inline` calendar rendered there names its days in the
60
+ * server's language and the browser's own render names them in the
61
+ * browser's: give it a locale, here or through a `LocaleProvider`, where
62
+ * the two can differ.
63
+ */
56
64
  locale?: string;
57
65
  /**
58
66
  * Render the calendar inline, with no inputs and no popover. The hidden
@@ -115,9 +123,23 @@ export interface DateRangeInputBaseProps extends Omit<React.HTMLAttributes<HTMLD
115
123
  * between, so off, a span too long to walk is refused as well.
116
124
  */
117
125
  allowDisabledInRange?: boolean;
118
- /** Day the week starts on (0 = Sunday). */
126
+ /**
127
+ * Day the week starts on (0 = Sunday). Unset inside a `LocaleProvider`,
128
+ * it is the first day of the week in the picker's locale, its own `locale`
129
+ * or else the provider's, such as Monday for `"de"`. Elsewhere, with no
130
+ * locale from either, or with seven `dayNames` of your own, it is Sunday:
131
+ * set it with `dayNames` to start the week on another day.
132
+ * @defaultValue 0
133
+ */
119
134
  firstDayOfWeek?: DayOfWeek;
120
- /** Override the 7 day-name labels (in calendar order, post-rotation). */
135
+ /**
136
+ * Override the 7 day-name labels (in calendar order, post-rotation). They
137
+ * are shown exactly as given, from the first column, so they have to start
138
+ * on the day the week does. With them, an unset `firstDayOfWeek` stays
139
+ * Sunday even inside a `LocaleProvider`, so names written Sunday first keep
140
+ * matching their columns; to start on the locale's day, set
141
+ * `firstDayOfWeek` too and list the names from that day.
142
+ */
121
143
  dayNames?: string[];
122
144
  /** Override the 12 month-name labels. */
123
145
  monthNames?: string[];
@@ -49,7 +49,15 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
49
49
  * keeps what the format leaves out, such as seconds.
50
50
  */
51
51
  parse?: (s: string) => Date | null;
52
- /** BCP-47 locale tag. */
52
+ /**
53
+ * BCP-47 locale tag for day/month names and Intl formatting. Unset, it is
54
+ * the `locale` of a `LocaleProvider` around the picker, and with neither,
55
+ * `Intl` uses the runtime's own locale. On a server render that is the
56
+ * server's, so an `inline` calendar rendered there names its days in the
57
+ * server's language and the browser's own render names them in the
58
+ * browser's: give it a locale, here or through a `LocaleProvider`, where
59
+ * the two can differ.
60
+ */
53
61
  locale?: string;
54
62
  /** Render the panel inline (no popover). */
55
63
  inline?: boolean;
@@ -96,9 +104,23 @@ export interface DateTimeInputBaseProps extends Omit<React.InputHTMLAttributes<H
96
104
  shouldDisableDate?: (d: Date) => boolean;
97
105
  /** Convenience array of disabled dates, matched by calendar day; also rejected by manual typing. */
98
106
  unselectableDates?: Date[];
99
- /** Day the calendar week starts on. */
107
+ /**
108
+ * Day the week starts on (0 = Sunday). Unset inside a `LocaleProvider`,
109
+ * it is the first day of the week in the picker's locale, its own `locale`
110
+ * or else the provider's, such as Monday for `"de"`. Elsewhere, with no
111
+ * locale from either, or with seven `dayNames` of your own, it is Sunday:
112
+ * set it with `dayNames` to start the week on another day.
113
+ * @defaultValue 0
114
+ */
100
115
  firstDayOfWeek?: DayOfWeek;
101
- /** Override the 7 day-name labels. */
116
+ /**
117
+ * Override the 7 day-name labels (in calendar order, post-rotation). They
118
+ * are shown exactly as given, from the first column, so they have to start
119
+ * on the day the week does. With them, an unset `firstDayOfWeek` stays
120
+ * Sunday even inside a `LocaleProvider`, so names written Sunday first keep
121
+ * matching their columns; to start on the locale's day, set
122
+ * `firstDayOfWeek` too and list the names from that day.
123
+ */
102
124
  dayNames?: string[];
103
125
  /** Override the 12 month-name labels. */
104
126
  monthNames?: string[];
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
3
+ import type { FormFieldProps } from './fieldProps.js';
4
+ /** The looks a Fieldset comes in. */
5
+ export type FieldsetVariant = 'default' | 'filled' | 'unstyled';
6
+ /**
7
+ * Props for the Fieldset component. The helper props, the other attributes
8
+ * and the `ref` land on its `<fieldset>`.
9
+ *
10
+ * @extraProp {React.Ref<HTMLFieldSetElement>} [ref] - Ref forwarded to the `<fieldset>`, whose `elements` lists the controls inside.
11
+ * @extraProp {string} [aria-describedby] - Ids of more text that describes the group. The `message`'s id is added after them.
12
+ * @extraProp {string} [name] - The fieldset's name in its form's `elements`. Nothing is submitted under it.
13
+ */
14
+ export interface FieldsetProps extends Omit<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, 'color'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
15
+ /**
16
+ * The group's name, shown in a `<legend>`, which names the fieldset with no
17
+ * ids to wire. The `default` and `filled` variants draw it on the border,
18
+ * and `unstyled` above the content. Controls you put in it, such as a
19
+ * `Checkbox` that turns the section on, stay enabled when the Fieldset is
20
+ * disabled, as the browser leaves them.
21
+ */
22
+ legend?: React.ReactNode;
23
+ /** Props for the `<legend>`, such as an `id` or a `className`. */
24
+ legendProps?: React.HTMLAttributes<HTMLLegendElement>;
25
+ /**
26
+ * The look: `default` draws a border round the group, `filled` adds a
27
+ * tinted background, and `unstyled` draws no box at all, which suits a
28
+ * Fieldset that's there to name or disable a group.
29
+ */
30
+ variant?: FieldsetVariant;
31
+ /**
32
+ * Disables every control inside. The browser disables the native ones and
33
+ * leaves them out of the form's data, and each bestax input with a
34
+ * `disabled` prop takes this as that prop's default, which also stops
35
+ * widgets the browser doesn't reach, such as `Rate`'s stars and the time
36
+ * wheels, and gives them their disabled look. An input's own `disabled`
37
+ * still wins when you set it, though the browser keeps its native parts
38
+ * disabled whatever it says. Links and `LinkButton`s stay operable, as in
39
+ * plain HTML.
40
+ */
41
+ disabled?: boolean;
42
+ /**
43
+ * Help text under the group. It describes the fieldset through
44
+ * `aria-describedby`, alongside any ids you pass there. Nothing passes it
45
+ * to the inputs, so each still shows its own errors.
46
+ */
47
+ message?: React.ReactNode;
48
+ /** Bulma color for the message. */
49
+ messageColor?: FormFieldProps['messageColor'];
50
+ /** Text color helper, for the text in the group. The legend keeps its own color. */
51
+ textColor?: (typeof validColors)[number] | 'inherit' | 'current';
52
+ /** Background color helper. */
53
+ bgColor?: (typeof validColors)[number] | 'inherit' | 'current';
54
+ /** Additional CSS classes. */
55
+ className?: string;
56
+ /** The group's content, such as `Field`s and inputs. */
57
+ children?: React.ReactNode;
58
+ }
59
+ /**
60
+ * The `Fieldset` component groups a section of a form in a native
61
+ * `<fieldset>`, named by its `legend`, which a `disabled` switches off as a
62
+ * whole.
63
+ *
64
+ * It starts its own Field scope: inside it, nothing reads as inside a
65
+ * `Field` or `Control`, so the convenience inputs render their own `Field`,
66
+ * and a labeled `Field` around the Fieldset names nothing in it.
67
+ *
68
+ * @function
69
+ * @param {FieldsetProps} props - Props for the Fieldset component.
70
+ * @returns {JSX.Element} The rendered fieldset.
71
+ *
72
+ * @example
73
+ * <Fieldset legend="Shipping address" message="We only ship within the EU.">
74
+ * <Input label="Street" name="street" />
75
+ * <Input label="City" name="city" />
76
+ * </Fieldset>
77
+ *
78
+ * @example
79
+ * // A form that's saving
80
+ * <Fieldset disabled={saving} variant="unstyled">
81
+ * <Input label="Name" name="name" />
82
+ * <Rate label="Rating" name="rating" />
83
+ * </Fieldset>
84
+ */
85
+ export declare const Fieldset: React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<HTMLFieldSetElement>>;
86
+ export default Fieldset;
@@ -66,7 +66,8 @@ export interface FileProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
66
66
  fileName?: string;
67
67
  /**
68
68
  * Builds the text `hasName` shows when several files are picked, from their count, for
69
- * localization. Default: `` `${count} files` ``. A single pick shows its file's name.
69
+ * localization. Default: `` `${count} files` ``, with the count written the way the `locale`
70
+ * of a `LocaleProvider` around it writes numbers. A single pick shows its file's name.
70
71
  */
71
72
  pickedFilesLabel?: (count: number) => string;
72
73
  }
@@ -14,6 +14,18 @@ export declare const useInsideControl: () => boolean;
14
14
  export declare const FieldProvider: React.Provider<boolean>;
15
15
  /** Provider for Control context — used internally by Control component. */
16
16
  export declare const ControlProvider: React.Provider<boolean>;
17
+ /**
18
+ * An input's `disabled`: its own prop when the caller set one, otherwise
19
+ * whether a disabled `Fieldset` holds it. A `<fieldset disabled>` disables the
20
+ * native controls inside on its own, and this carries the same state to what
21
+ * the browser doesn't reach, such as Rate's stars, the time wheels, and the
22
+ * `is-disabled` classes. The content of a Fieldset's legend reads the state
23
+ * from outside that Fieldset, as the browser leaves the first legend's
24
+ * controls enabled. Internal; not part of the public API.
25
+ */
26
+ export declare const useFieldsetDisabled: (disabled: boolean | undefined) => boolean;
27
+ /** Provider for a Fieldset's disabled state, used internally by Fieldset. */
28
+ export declare const FieldsetDisabledProvider: React.Provider<boolean>;
17
29
  /** The wrapper props that change what its own `Field` renders. */
18
30
  interface FieldShapingProps {
19
31
  /** Rendered as the `Field`'s label. */
@@ -53,7 +53,10 @@ export interface RateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
53
53
  size?: RateSize;
54
54
  /** Whether the rating is disabled. */
55
55
  disabled?: boolean;
56
- /** Show the numeric score next to stars. */
56
+ /**
57
+ * Show the numeric score next to stars, written the way the `locale` of a
58
+ * `LocaleProvider` around it writes numbers.
59
+ */
57
60
  showScore?: boolean;
58
61
  /** Show custom text based on value. */
59
62
  showText?: boolean;
@@ -52,11 +52,18 @@ interface SliderBaseProps extends Omit<React.InputHTMLAttributes<HTMLInputElemen
52
52
  marks?: SliderMark[];
53
53
  /** Orientation of the slider. */
54
54
  orientation?: SliderOrientation;
55
- /** Function to scale the displayed value. */
55
+ /**
56
+ * Function to scale the displayed value. With it, and no `getAriaValueText`,
57
+ * the scaled value is also the thumb's `aria-valuetext`.
58
+ */
56
59
  scale?: (value: number) => number;
57
60
  /** Function to generate the `aria-valuetext` attribute. */
58
61
  getAriaValueText?: (value: number) => string;
59
- /** Format function for output display. */
62
+ /**
63
+ * Format function for output display. Without it, the output shows the
64
+ * value as it is, or inside a `LocaleProvider` with a `locale`, written
65
+ * the way that locale writes numbers, to at most three decimals.
66
+ */
60
67
  formatOutput?: (value: number) => string;
61
68
  }
62
69
  /**
@@ -42,7 +42,10 @@ export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
42
42
  * Autocomplete suggestions. With `data` set, even to an empty array, the
43
43
  * text input is a `role="combobox"` that controls the suggestion list and
44
44
  * points `aria-activedescendant` at the highlighted suggestion. Without it
45
- * there's no list, so the input stays a plain text field.
45
+ * there's no list, so the input stays a plain text field. The list shows
46
+ * the suggestions that contain what's typed, ignoring case, and inside a
47
+ * `LocaleProvider` with a `locale`, ignoring accents too where that
48
+ * language does, so "cafe" finds "Café".
46
49
  */
47
50
  data?: string[];
48
51
  /** Placeholder text when no tags. */
@@ -81,7 +84,10 @@ export interface TaginputProps extends Omit<React.HTMLAttributes<HTMLDivElement>
81
84
  rounded?: boolean;
82
85
  /** Truncates long tag text with ellipsis. */
83
86
  ellipsis?: boolean;
84
- /** Shows a counter of the number of tags. */
87
+ /**
88
+ * Shows a counter of the number of tags, written the way the `locale` of
89
+ * a `LocaleProvider` around it writes numbers.
90
+ */
85
91
  hasCounter?: boolean;
86
92
  /**
87
93
  * Characters that split pasted text into tags. Each part goes through the
@@ -42,7 +42,11 @@ export interface TimeInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
42
42
  * keeps what the format leaves out, such as seconds and the date.
43
43
  */
44
44
  parse?: (s: string) => Date | null;
45
- /** BCP-47 locale tag for Intl formatting. */
45
+ /**
46
+ * BCP-47 locale tag for Intl formatting. Unset, it is the `locale` of a
47
+ * `LocaleProvider` around the picker, and with neither, `Intl` uses the
48
+ * runtime's own locale.
49
+ */
46
50
  locale?: string;
47
51
  /** Render the spinner inline (no popover). */
48
52
  inline?: boolean;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type PortalLocale } from '../../helpers/LocaleProvider.js';
2
3
  import { PickerPosition } from './pickerTypes.js';
3
4
  export interface PickerPopoverProps {
4
5
  isOpen: boolean;
@@ -29,6 +30,11 @@ export interface PickerPopoverProps {
29
30
  * nothing matches, or the match can't take focus, the first tab stop does.
30
31
  */
31
32
  initialFocusSelector?: string;
33
+ /**
34
+ * The `dir` and `lang` the panel carries when it portals, in place of a
35
+ * `LocaleProvider`'s: the picker's own, from `usePickerLocaleScope`.
36
+ */
37
+ localeScope?: PortalLocale;
32
38
  }
33
39
  export declare const PickerPopover: React.FC<PickerPopoverProps>;
34
40
  export default PickerPopover;
@@ -0,0 +1,49 @@
1
+ import { type PortalLocale } from '../../helpers/LocaleProvider.js';
2
+ import type { DayOfWeek } from './pickerTypes.js';
3
+ /**
4
+ * A picker's locale: its own `locale`, else the one a `LocaleProvider` around
5
+ * it sets, else `undefined`, which leaves `Intl` to use the runtime's.
6
+ */
7
+ export declare function usePickerLocale(own: string | undefined): string | undefined;
8
+ /** Where a picker's own language and direction go, inside a `LocaleProvider`. */
9
+ export interface PickerLocaleScope {
10
+ /**
11
+ * The `lang` and `dir` for the picker's root, so what renders inside it,
12
+ * an inline calendar or a popover in place, follows them. Empty unless the
13
+ * picker has a `locale` of its own.
14
+ */
15
+ rootAttrs: {
16
+ lang?: string;
17
+ dir?: string;
18
+ };
19
+ /** What its portaled panel carries; unset outside a provider. */
20
+ panel?: PortalLocale;
21
+ }
22
+ /**
23
+ * A picker's language and direction inside a `LocaleProvider`, by the rule a
24
+ * nested provider follows: its `lang` is its own `locale`, else the
25
+ * provider's, and its `dir` is the `dir` passed to it, else its own locale's
26
+ * direction when it has one, else the provider's. Outside a provider it
27
+ * changes nothing. A `locale` `Intl` refuses counts as none here, since the
28
+ * picker's own formatting reports it.
29
+ */
30
+ export declare function usePickerLocaleScope(ownLocale: string | undefined, ownDir: string | undefined): PickerLocaleScope;
31
+ /**
32
+ * Whether a picker's `dayNames` replace the calendar's own, which `Calendar`
33
+ * does only for a full week of seven.
34
+ */
35
+ export declare function hasOwnDayNames(dayNames: string[] | undefined): boolean;
36
+ /**
37
+ * The day a picker's week starts on: its own `firstDayOfWeek`, else, inside a
38
+ * `LocaleProvider`, the first day of the locale the picker uses, else Sunday.
39
+ * Outside a provider it stays Sunday whatever the locale, as it always has,
40
+ * and so does a picker inside one with no locale from either, since the
41
+ * runtime's own differs between the server and the browser.
42
+ *
43
+ * It also stays Sunday for a picker that brings its own `dayNames`. The
44
+ * calendar shows those exactly as given, in calendar order, and before the
45
+ * provider an unset `firstDayOfWeek` was always Sunday, so names written
46
+ * Sunday first would sit a day or more off their columns if the week moved
47
+ * under them.
48
+ */
49
+ export declare function usePickerFirstDayOfWeek(own: DayOfWeek | undefined, locale: string | undefined, hasDayNames: boolean): DayOfWeek;