@allxsmith/bestax-bulma 5.23.0 → 5.25.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 (63) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/constants.cjs +30 -0
  4. package/dist/constants.cjs.map +1 -1
  5. package/dist/constants.d.cts +18 -0
  6. package/dist/constants.esm.js +30 -1
  7. package/dist/constants.esm.js.map +1 -1
  8. package/dist/extras.css +1 -1
  9. package/dist/extras.css.map +1 -1
  10. package/dist/index.cjs +6801 -5897
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.esm.js +6797 -5899
  13. package/dist/index.esm.js.map +1 -1
  14. package/dist/types/columns/Columns.d.ts +10 -2
  15. package/dist/types/components/Popover.d.ts +166 -0
  16. package/dist/types/form/DateInput.d.ts +1 -1
  17. package/dist/types/form/DateInputBase.d.ts +33 -3
  18. package/dist/types/form/_pickerInternals/Calendar.d.ts +11 -1
  19. package/dist/types/form/_pickerInternals/dateUtils.d.ts +36 -1
  20. package/dist/types/form/_pickerInternals/formatters.d.ts +2 -0
  21. package/dist/types/form/_pickerInternals/nativeInputSupport.d.ts +11 -0
  22. package/dist/types/form/_pickerInternals/pickerTypes.d.ts +10 -0
  23. package/dist/types/form/_pickerInternals/useSegmentedEntry.d.ts +9 -1
  24. package/dist/types/grid/Grid.d.ts +16 -8
  25. package/dist/types/helpers/Theme.d.ts +1 -1
  26. package/dist/types/helpers/bulmaClassHelpers.d.ts +18 -0
  27. package/dist/types/helpers/useAnchoredPosition.d.ts +59 -0
  28. package/dist/types/helpers/useBulmaClasses.d.ts +3 -3
  29. package/dist/types/helpers/useClientLayoutEffect.d.ts +7 -0
  30. package/dist/types/helpers/useFocusTrap.d.ts +13 -3
  31. package/dist/types/helpers/useSpacingClasses.d.ts +34 -3
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/types-cjs/columns/Columns.d.ts +10 -2
  34. package/dist/types-cjs/components/Popover.d.ts +166 -0
  35. package/dist/types-cjs/form/DateInput.d.ts +1 -1
  36. package/dist/types-cjs/form/DateInputBase.d.ts +33 -3
  37. package/dist/types-cjs/form/_pickerInternals/Calendar.d.ts +11 -1
  38. package/dist/types-cjs/form/_pickerInternals/dateUtils.d.ts +36 -1
  39. package/dist/types-cjs/form/_pickerInternals/formatters.d.ts +2 -0
  40. package/dist/types-cjs/form/_pickerInternals/nativeInputSupport.d.ts +11 -0
  41. package/dist/types-cjs/form/_pickerInternals/pickerTypes.d.ts +10 -0
  42. package/dist/types-cjs/form/_pickerInternals/useSegmentedEntry.d.ts +9 -1
  43. package/dist/types-cjs/grid/Grid.d.ts +16 -8
  44. package/dist/types-cjs/helpers/Theme.d.ts +1 -1
  45. package/dist/types-cjs/helpers/bulmaClassHelpers.d.ts +18 -0
  46. package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +59 -0
  47. package/dist/types-cjs/helpers/useBulmaClasses.d.ts +3 -3
  48. package/dist/types-cjs/helpers/useClientLayoutEffect.d.ts +7 -0
  49. package/dist/types-cjs/helpers/useFocusTrap.d.ts +13 -3
  50. package/dist/types-cjs/helpers/useSpacingClasses.d.ts +34 -3
  51. package/dist/types-cjs/index.d.ts +1 -0
  52. package/dist/versions/bestax-no-dark-mode.css +1 -1
  53. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  54. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  55. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  56. package/dist/versions/bestax-no-helpers.css +1 -1
  57. package/dist/versions/bestax-no-helpers.css.map +1 -1
  58. package/dist/versions/bestax-prefixed.css +1 -1
  59. package/dist/versions/bestax-prefixed.css.map +1 -1
  60. package/package.json +1 -1
  61. package/src/scss/components/_index.scss +1 -0
  62. package/src/scss/components/_popover.scss +144 -0
  63. package/src/scss/form/_dateinput.scss +20 -3
@@ -10,7 +10,7 @@ export type BulmaGapSize = BulmaGapValue;
10
10
  /**
11
11
  * Props for the Columns component.
12
12
  */
13
- export interface ColumnsProps extends React.HTMLAttributes<HTMLDivElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
13
+ export interface ColumnsProps extends React.HTMLAttributes<HTMLDivElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'columnGap' | 'rowGap'> {
14
14
  /** Additional CSS classes for the columns container. */
15
15
  className?: string;
16
16
  /** Text color. */
@@ -31,7 +31,15 @@ export interface ColumnsProps extends React.HTMLAttributes<HTMLDivElement>, Omit
31
31
  isMobile?: boolean;
32
32
  /** Apply columns layout on desktop and up. */
33
33
  isDesktop?: boolean;
34
- /** Gap size for all breakpoints. Same scale as `Grid`'s `gap` prop; wins over `gapSize` if both are set. */
34
+ /**
35
+ * Gap size for all breakpoints, the columns gutter (`is-<value>`). Whole
36
+ * steps of the same scale as `Grid`'s `gap` prop; wins over `gapSize` if
37
+ * both are set.
38
+ *
39
+ * This is not the `gap` helper prop other components take, which renders
40
+ * `is-gap-<value>`: on `Columns` the gutter is padding inside each column,
41
+ * so the helper's CSS `gap` would add to it rather than replace it.
42
+ */
35
43
  gap?: BulmaGapValue;
36
44
  /** Gap size for mobile. Wins over `gapSizeMobile` if both are set. */
37
45
  gapMobile?: BulmaGapValue;
@@ -0,0 +1,166 @@
1
+ import React from 'react';
2
+ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
+ import { ButtonOwnProps } from '../elements/Button.js';
4
+ import type { PickerPosition } from '../form/_pickerInternals/pickerTypes.js';
5
+ /**
6
+ * Where the panel opens against its trigger: below (`bottom-*`) or above
7
+ * (`top-*`), lined up with the trigger's left or right edge. `auto` picks the
8
+ * one that keeps the panel in the viewport, preferring below and lined up on
9
+ * the left. The same union the date and time pickers take.
10
+ */
11
+ export type PopoverPosition = PickerPosition;
12
+ /**
13
+ * Props for the Popover component. `className`, `id`, the other HTML
14
+ * attributes and the helper props land on the wrapper around the trigger,
15
+ * not on the panel; `contentClassName` reaches the panel.
16
+ * @extraProp {string} [className] - Additional classes for the wrapper around the trigger. The panel takes `contentClassName`.
17
+ */
18
+ export interface PopoverProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
19
+ /**
20
+ * The element that opens and closes the popover, such as a `Button`.
21
+ * Popover gives it `aria-haspopup="dialog"`, `aria-expanded`,
22
+ * `aria-controls` while the panel is open, and click and key handlers that
23
+ * run after its own (call `preventDefault()` in yours to keep the popover
24
+ * from toggling). It has to be a single element that passes `onClick` and
25
+ * `onKeyDown` to its DOM node. Enter and Space toggle a trigger the browser
26
+ * doesn't click on its own, and an intrinsic element that isn't already a
27
+ * control (a `<span>`) also gets `role="button"` and `tabIndex={0}` unless
28
+ * it sets them; a component that renders one has to take those itself.
29
+ */
30
+ trigger: React.ReactElement;
31
+ /** The panel's content, usually `Popover.Header`, `Popover.Body` and `Popover.Footer`. */
32
+ children?: React.ReactNode;
33
+ /**
34
+ * Controlled open state. When set, the trigger and every dismissal only
35
+ * report through `onOpenChange`.
36
+ */
37
+ open?: boolean;
38
+ /**
39
+ * Initial open state when uncontrolled. Opening moves focus into the
40
+ * panel, so a popover that starts open takes focus once the page loads.
41
+ * @defaultValue false
42
+ */
43
+ defaultOpen?: boolean;
44
+ /**
45
+ * Called with the state asked for: `true` from the trigger opening it,
46
+ * `false` from the trigger, `Popover.Close`, Escape or an outside
47
+ * `pointerdown`. Fires in both controlled and uncontrolled use.
48
+ */
49
+ onOpenChange?: (open: boolean) => void;
50
+ /**
51
+ * Where the panel opens against the trigger.
52
+ * @defaultValue 'bottom-left'
53
+ */
54
+ position?: PopoverPosition;
55
+ /**
56
+ * Render the panel at the end of `document.body` through `Portal`, fixed to
57
+ * the viewport, so an ancestor's `overflow`, `transform` or stacking context
58
+ * can't clip it. The panel then shows from the commit after hydration,
59
+ * never in server markup. It is measured against the trigger when it opens
60
+ * and on resize and scroll, so it doesn't follow content that changes size
61
+ * while it is open. Theming variables set on an ancestor of the trigger
62
+ * don't reach it there.
63
+ * @defaultValue false
64
+ */
65
+ appendToBody?: boolean;
66
+ /**
67
+ * Keep Tab and Shift+Tab inside the panel while it is open, as the ARIA
68
+ * dialog pattern does for a non-modal dialog. Pointer focus leaves freely
69
+ * and the page stays usable. With `false`, Tab moves past the panel and
70
+ * the popover stays open. Focus moves into the panel on open and back to
71
+ * the trigger on close either way.
72
+ * @defaultValue true
73
+ */
74
+ trapFocus?: boolean;
75
+ /**
76
+ * Close on a `pointerdown` outside the trigger and the panel. Content the
77
+ * panel renders through a portal (a nested `Popover`, a portaled picker)
78
+ * still counts as inside.
79
+ * @defaultValue true
80
+ */
81
+ closeOnClickOutside?: boolean;
82
+ /**
83
+ * Close on Escape while focus is in the panel or on the trigger. A dialog
84
+ * nested in the panel, such as a date picker's calendar, takes its own
85
+ * Escape first, and so does content that calls `preventDefault()` on it.
86
+ * @defaultValue true
87
+ */
88
+ closeOnEscape?: boolean;
89
+ /**
90
+ * The panel's accessible name. Without it the panel is named by its
91
+ * `Popover.Header`, and a development build warns when it has neither.
92
+ */
93
+ ariaLabel?: string;
94
+ /** Additional classes for the panel (`.popover-content`). */
95
+ contentClassName?: string;
96
+ }
97
+ /**
98
+ * Props for the Popover.Header component. Its `id` is the one the panel's
99
+ * `aria-labelledby` names, so it isn't yours to set.
100
+ */
101
+ export interface PopoverHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'id'>, BulmaClassesProps {
102
+ /** Additional CSS classes. */
103
+ className?: string;
104
+ }
105
+ /**
106
+ * The popover's title, which names the panel for assistive technology.
107
+ *
108
+ * @function
109
+ * @param {PopoverHeaderProps} props - Props for the Popover.Header component.
110
+ * @returns {JSX.Element} The header element.
111
+ */
112
+ export declare const PopoverHeader: React.FC<PopoverHeaderProps>;
113
+ /**
114
+ * Props for the Popover.Body component.
115
+ */
116
+ export interface PopoverBodyProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, BulmaClassesProps {
117
+ /** Additional CSS classes. */
118
+ className?: string;
119
+ }
120
+ /**
121
+ * The popover's main content area.
122
+ *
123
+ * @function
124
+ * @param {PopoverBodyProps} props - Props for the Popover.Body component.
125
+ * @returns {JSX.Element} The body element.
126
+ */
127
+ export declare const PopoverBody: React.FC<PopoverBodyProps>;
128
+ /**
129
+ * Props for the Popover.Footer component.
130
+ */
131
+ export interface PopoverFooterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, BulmaClassesProps {
132
+ /** Additional CSS classes. */
133
+ className?: string;
134
+ }
135
+ /**
136
+ * A row of actions along the bottom of the popover, aligned to the end.
137
+ *
138
+ * @function
139
+ * @param {PopoverFooterProps} props - Props for the Popover.Footer component.
140
+ * @returns {JSX.Element} The footer element.
141
+ */
142
+ export declare const PopoverFooter: React.FC<PopoverFooterProps>;
143
+ /**
144
+ * Props for the Popover.Close component: the props of a `Button` rendered as
145
+ * a `<button>`.
146
+ * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a close button inside a form doesn't submit it.
147
+ * @extraProp {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Runs before the popover closes. Call `preventDefault()` to keep it open.
148
+ */
149
+ export interface PopoverCloseProps extends ButtonOwnProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps> {
150
+ }
151
+ /**
152
+ * A `Button` that closes the popover, handing focus back to the trigger.
153
+ *
154
+ * @function
155
+ * @param {PopoverCloseProps} props - Props for the Popover.Close component.
156
+ * @returns {JSX.Element} The close button.
157
+ */
158
+ export declare const PopoverClose: React.FC<PopoverCloseProps>;
159
+ /** Popover with Header, Body, Footer and Close sub-components. */
160
+ export declare const Popover: React.FC<PopoverProps> & {
161
+ Header: React.FC<PopoverHeaderProps>;
162
+ Body: React.FC<PopoverBodyProps>;
163
+ Footer: React.FC<PopoverFooterProps>;
164
+ Close: React.FC<PopoverCloseProps>;
165
+ };
166
+ export default Popover;
@@ -5,7 +5,7 @@ import { DateInputBaseProps } from './DateInputBase.js';
5
5
  /**
6
6
  * Props for the DateInput convenience wrapper. Extends `DateInputBaseProps`
7
7
  * with Field-level (label, horizontal) and Control-level (icons, loading) props.
8
- * @extraProp {string} [name] - Form field name. Forwarded to a hidden ISO-formatted input.
8
+ * @extraProp {string} [name] - Form field name. The text field submits the text it displays. The native input on touch devices submits the ISO value (`YYYY-MM-DD`, or `YYYY-MM` at month granularity), and an `inline` calendar, which has no visible input, submits it from a hidden input (`YYYY-MM-DD`, `YYYY-MM` or `YYYY`).
9
9
  * @extraProp {string} [form] - Form id the input belongs to.
10
10
  * @extraProp {boolean} [required=false] - Marks the input as required.
11
11
  * @extraProp {string} [className] - Additional CSS classes for the input.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
3
- import { PickerPosition, DayOfWeek, PickerLabels } from './_pickerInternals/pickerTypes.js';
3
+ import { PickerPosition, DayOfWeek, DateGranularity, PickerLabels } from './_pickerInternals/pickerTypes.js';
4
4
  import { DateFormatOption } from './_pickerInternals/formatters.js';
5
5
  /**
6
6
  * Props for the raw DateInput base. Use the higher-level `DateInput` for
@@ -28,7 +28,29 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
28
28
  /** Placeholder text for the input. */
29
29
  placeholder?: string;
30
30
  /**
31
- * Token format string or `Intl.DateTimeFormat` options. Default `'YYYY-MM-DD'`.
31
+ * What the calendar shows and what a selection means: `'day'` shows the
32
+ * day grid, `'month'` a grid of the focused year's months whose header
33
+ * steps a year at a time, and `'year'` the year list. A month or year value
34
+ * is the first day of that period at local midnight, so `onChange` gets
35
+ * `new Date(2026, 5, 1)` for June 2026. A `value` elsewhere in the period
36
+ * shows as that period and stays as given until the user picks a period or
37
+ * types a different one. `min`, `max`,
38
+ * `shouldDisableDate` and `unselectableDates` judge whole periods: a month
39
+ * or year can be picked while any day in it can, so a `min` of 15 June
40
+ * still allows June, and June commits as 1 June, earlier than that `min`.
41
+ * The default `format` follows the granularity (`'YYYY-MM'`, `'YYYY'`); a
42
+ * custom `format` with finer tokens still renders them, but typing skips
43
+ * them. `firstDayOfWeek`, `dayNames` and `nearbyMonthDays` only affect the
44
+ * day grid, and an `inline` calendar's hidden form value is `YYYY-MM` or
45
+ * `YYYY`. The `labels` keys `chooseMonth` / `chooseYear` name the launcher
46
+ * and popover, and `prevYear` / `nextYear` the month grid's header buttons.
47
+ * @defaultValue 'day'
48
+ */
49
+ granularity?: DateGranularity;
50
+ /**
51
+ * Token format string or `Intl.DateTimeFormat` options. Defaults to
52
+ * `'YYYY-MM-DD'`, or to `'YYYY-MM'` / `'YYYY'` when `granularity` is
53
+ * `'month'` / `'year'`.
32
54
  * @defaultValue 'YYYY-MM-DD'
33
55
  */
34
56
  format?: DateFormatOption;
@@ -38,7 +60,15 @@ export interface DateInputBaseProps extends Omit<React.InputHTMLAttributes<HTMLI
38
60
  locale?: string;
39
61
  /** Render the calendar inline (no popover). */
40
62
  inline?: boolean;
41
- /** Use `<input type="date">` on coarse-pointer + small-viewport devices. */
63
+ /**
64
+ * Use `<input type="date">` on coarse-pointer + small-viewport devices. At
65
+ * `'month'` granularity it uses `<input type="month">` where the browser
66
+ * implements one, as Chromium browsers, Safari on iOS and Firefox for
67
+ * Android do, and the calendar where it doesn't, as in desktop Firefox.
68
+ * Desktop Safari accepts the type but draws no month control, so forcing
69
+ * `true` there shows a plain text box. HTML has no year input, so `'year'`
70
+ * granularity always renders the calendar.
71
+ */
42
72
  mobileNative?: boolean | 'auto';
43
73
  /** Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. */
44
74
  editable?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DayOfWeek, PickerLabels } from './pickerTypes.js';
2
+ import { DateGranularity, DayOfWeek, PickerLabels } from './pickerTypes.js';
3
3
  export interface CalendarProps {
4
4
  value: Date | null;
5
5
  focusedDate: Date;
@@ -25,8 +25,18 @@ export interface CalendarProps {
25
25
  /**
26
26
  * Inclusive `[min, max]` year range shown in the year-dropdown view.
27
27
  * Defaults to ±100 years around the focused year, clamped by `min`/`max`.
28
+ * At `'year'` granularity the window centres on the year focused when the
29
+ * calendar mounted, so moving focus never reflows the list.
28
30
  */
29
31
  yearsRange?: [number, number];
32
+ /**
33
+ * What a selection means. `'day'` shows the day grid; `'month'` shows a
34
+ * month grid for the focused year, with the year list one header click
35
+ * away for jumping; `'year'` shows the year list as the selection surface.
36
+ * A month or year cell is disabled when every day in it is, and `onSelect`
37
+ * receives the period's first day.
38
+ */
39
+ granularity?: DateGranularity;
30
40
  }
31
41
  export declare const Calendar: React.FC<CalendarProps>;
32
42
  export default Calendar;
@@ -1,4 +1,4 @@
1
- import { DayOfWeek } from './pickerTypes.js';
1
+ import { DateGranularity, DayOfWeek } from './pickerTypes.js';
2
2
  export interface CalendarCell {
3
3
  date: Date;
4
4
  inCurrentMonth: boolean;
@@ -13,6 +13,41 @@ export declare function startOfDay(d: Date): Date;
13
13
  export declare function endOfDay(d: Date): Date;
14
14
  export declare function startOfMonth(d: Date): Date;
15
15
  export declare function endOfMonth(d: Date): Date;
16
+ /**
17
+ * Local midnight on `year`-`month`-`day` (`month` from 0), like the
18
+ * `Date(y, m, d)` constructor except that years 0–99 stay as given rather than
19
+ * turning into 1900–1999.
20
+ */
21
+ export declare function makeDate(year: number, month?: number, day?: number): Date;
22
+ /**
23
+ * First instant of the day, month or year containing `d`. Works by setters on
24
+ * a copy rather than the `Date(y, m, d)` constructor, which reads years 0–99
25
+ * as 1900–1999: segmented typing passes through such years on the way to a
26
+ * four-digit one.
27
+ */
28
+ export declare function startOfPeriod(d: Date, granularity: DateGranularity): Date;
29
+ /** Last instant of the day, month or year containing `d`. */
30
+ export declare function endOfPeriod(d: Date, granularity: DateGranularity): Date;
31
+ /** The rules that make a single calendar day unselectable. */
32
+ export interface DayConstraints {
33
+ min?: Date;
34
+ max?: Date;
35
+ shouldDisableDate?: (d: Date) => boolean;
36
+ unselectableDates?: Date[];
37
+ }
38
+ /**
39
+ * Whether the day `d` falls outside `[min, max]` or is blocked by
40
+ * `shouldDisableDate` / `unselectableDates`. This is the day grid's rule for a
41
+ * disabled cell.
42
+ */
43
+ export declare function isDayUnselectable(d: Date, c: DayConstraints): boolean;
44
+ /**
45
+ * Whether every day of the month or year containing `d` is unselectable, so
46
+ * the period as a whole can't be picked. Walks the period's days and stops at
47
+ * the first selectable one. `min` and `max` count whole days here, so a `min`
48
+ * of 3pm on a month's last day leaves that day, and so its month, selectable.
49
+ */
50
+ export declare function isPeriodUnselectable(d: Date, granularity: DateGranularity, c: DayConstraints): boolean;
16
51
  export declare function addDays(d: Date, n: number): Date;
17
52
  export declare function addMonths(d: Date, n: number): Date;
18
53
  export declare function addYears(d: Date, n: number): Date;
@@ -1,5 +1,7 @@
1
1
  export type DateFormatOption = Intl.DateTimeFormatOptions | string;
2
2
  export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
3
+ export declare const DEFAULT_MONTH_FORMAT = "YYYY-MM";
4
+ export declare const DEFAULT_YEAR_FORMAT = "YYYY";
3
5
  export declare const DEFAULT_TIME_FORMAT_24 = "HH:mm";
4
6
  export declare const DEFAULT_TIME_FORMAT_12 = "hh:mm A";
5
7
  export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Whether this browser implements `<input type={type}>`. A browser that
3
+ * doesn't know a type reads it back as `'text'`, so this sets the type on a
4
+ * detached input and checks what sticks. The answer can't change within a
5
+ * page, so it is worked out once per type.
6
+ *
7
+ * It needs a DOM, so callers ask only after hydration. It also can't see a
8
+ * browser that recognises a type without drawing a control for it: desktop
9
+ * Safari reports `'month'` but shows a plain text box.
10
+ */
11
+ export declare function supportsInputType(type: string): boolean;
@@ -1,6 +1,8 @@
1
1
  export type PickerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'auto';
2
2
  export type HourFormat = '12' | '24';
3
3
  export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
4
+ /** The unit a date picker selects: a day, a month or a year. */
5
+ export type DateGranularity = 'day' | 'month' | 'year';
4
6
  /**
5
7
  * Translatable strings used across all four pickers. Pass via the `labels`
6
8
  * prop to override defaults; consumers manage their own locale-driven mapping.
@@ -8,7 +10,15 @@ export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
8
10
  export interface PickerLabels {
9
11
  prevMonth?: string;
10
12
  nextMonth?: string;
13
+ /** Month grid header: steps back a year. */
14
+ prevYear?: string;
15
+ /** Month grid header: steps forward a year. */
16
+ nextYear?: string;
11
17
  chooseDate?: string;
18
+ /** Launcher and popover name when the picker selects a month. */
19
+ chooseMonth?: string;
20
+ /** Launcher, popover and year list name when the picker selects a year. */
21
+ chooseYear?: string;
12
22
  hours?: string;
13
23
  minutes?: string;
14
24
  seconds?: string;
@@ -1,9 +1,17 @@
1
1
  import React from 'react';
2
2
  import { DateFormatOption } from './formatters.js';
3
- import { SegmentMap } from './segmentMap.js';
3
+ import { SegmentKind, SegmentMap } from './segmentMap.js';
4
4
  export interface UseSegmentedEntryParams {
5
5
  /** Resolved format actually used to render (the host's default format). */
6
6
  format: DateFormatOption;
7
+ /**
8
+ * Segment kinds the caret never stops on: they still render, but arrows,
9
+ * digits and separators pass over them. A month picker skips `'day'` so a
10
+ * format such as `'YYYY-MM-DD'` edits only the year and month. Must be
11
+ * referentially stable. A format left with no editable segment falls back
12
+ * to free-form entry.
13
+ */
14
+ skipKinds?: readonly SegmentKind[];
7
15
  /** Current canonical value (controlled or internal). */
8
16
  value: Date | null;
9
17
  /** Commit a new Date through the host's onChange / internal pipeline. */
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
2
  import { BulmaClassesProps, validColors } from '../helpers/useBulmaClasses.js';
3
+ import type { BulmaGapStep } from '../helpers/bulmaClassHelpers.js';
3
4
  /**
4
- * Allowed gap values for Bulma's 0-8 spacing scale, shared by `Grid` and
5
- * `Columns`. Accepts the value as a number or a numeric string.
5
+ * The whole steps of Bulma's 0-8 gap scale, as `Columns` takes them. Accepts
6
+ * the value as a number or a numeric string.
7
+ *
8
+ * `Grid`'s gap props and the shared `gap`, `columnGap` and `rowGap` helper
9
+ * props take the half steps as well, as `BulmaGapStep`.
6
10
  */
7
11
  export type BulmaGapValue = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
8
12
  /**
@@ -23,12 +27,16 @@ export type BulmaFixedGridColsProp = BulmaFixedGridCols | 'auto';
23
27
  export interface GridProps extends React.HTMLAttributes<HTMLDivElement>, Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
24
28
  /** Use a fixed grid layout (`.fixed-grid > .grid`). */
25
29
  isFixed?: boolean;
26
- /** Main gap for grid (Bulma `is-gap-X`). */
27
- gap?: BulmaGapValue;
28
- /** Column gap for grid (`is-column-gap-X`). */
29
- columnGap?: BulmaGapValue;
30
- /** Row gap for grid (`is-row-gap-X`). */
31
- rowGap?: BulmaGapValue;
30
+ /**
31
+ * Main gap for grid (Bulma `is-gap-X`), a whole or half step of Bulma's gap
32
+ * scale. The same values and class as the `gap` helper prop on every other
33
+ * component.
34
+ */
35
+ gap?: BulmaGapStep;
36
+ /** Column gap for grid (`is-column-gap-X`), on the same scale as `gap`. */
37
+ columnGap?: BulmaGapStep;
38
+ /** Row gap for grid (`is-row-gap-X`), on the same scale as `gap`. */
39
+ rowGap?: BulmaGapStep;
32
40
  /** Minimum column width for the grid (`is-col-min-X`). */
33
41
  minCol?: BulmaMinColValue;
34
42
  /** For fixed grids: explicit column count (`has-X-cols`), or `'auto'` for auto-count. */
@@ -53,7 +53,7 @@ type BulmaVars = Partial<Record<BulmaVarKey, string>>;
53
53
  * @property {string} [dangerS] - Danger color saturation.
54
54
  * @property {string} [dangerL] - Danger color lightness.
55
55
  */
56
- export interface ThemeProps extends Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {
56
+ export interface ThemeProps extends Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'columnGap'> {
57
57
  children: ReactNode;
58
58
  className?: string;
59
59
  /**
@@ -22,6 +22,24 @@ export declare const validSchemeColors: readonly ["scheme-main", "scheme-main-bi
22
22
  * @example '0', '1', 'auto'
23
23
  */
24
24
  export declare const validSizes: readonly ["0", "1", "2", "3", "4", "5", "6", "auto"];
25
+ /**
26
+ * Valid Bulma gap steps, taken by `gap`, `columnGap` and `rowGap`. Each whole
27
+ * step is 0.5rem, so `2` is 1rem and `8` is 4rem, and the half steps sit
28
+ * between them. They render `is-gap-<value>`, `is-column-gap-<value>` and
29
+ * `is-row-gap-<value>`.
30
+ *
31
+ * This is a different scale from `validSizes`: `gap="2"` is 1rem where
32
+ * `m="2"` is 0.5rem.
33
+ * @example '0', '0.5', '2', '8'
34
+ */
35
+ export declare const validGaps: readonly ["0", "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6", "6.5", "7", "7.5", "8"];
36
+ /**
37
+ * A gap step as `gap`, `columnGap` and `rowGap` take it: a value from
38
+ * `validGaps`, or the same step written as a number (`gap={2}`,
39
+ * `gap={1.5}`). `Grid` took its gaps as numbers before the gap helpers were
40
+ * shared, so every gap prop still does.
41
+ */
42
+ export type BulmaGapStep = '0' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '3.5' | '4' | '4.5' | '5' | '5.5' | '6' | '6.5' | '7' | '7.5' | '8' | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5 | 5.5 | 6 | 6.5 | 7 | 7.5 | 8;
25
43
  /**
26
44
  * Valid Bulma text size classes.
27
45
  * @example '1', '2', '3'
@@ -0,0 +1,59 @@
1
+ import type { RefObject } from 'react';
2
+ import type { PickerPosition } from '../form/_pickerInternals/pickerTypes.js';
3
+ /** A corner of the anchor the panel opens from, once `auto` is resolved. */
4
+ export type AnchoredCorner = Exclude<PickerPosition, 'auto'>;
5
+ /**
6
+ * Where the panel goes: the corner it opens from and, when it is fixed to
7
+ * the viewport, its coordinates there.
8
+ */
9
+ export interface AnchoredPosition {
10
+ position: AnchoredCorner;
11
+ top?: number;
12
+ left?: number;
13
+ }
14
+ /**
15
+ * Options for `useAnchoredPosition`.
16
+ */
17
+ export interface UseAnchoredPositionOptions {
18
+ /** Whether the panel is on the page. Nothing is measured while it is not. */
19
+ active: boolean;
20
+ /** The corner asked for, or `auto` to pick one that keeps the panel in the viewport. */
21
+ position: PickerPosition;
22
+ /**
23
+ * Whether the panel is fixed to the viewport (it was portaled away from the
24
+ * anchor), which needs coordinates. Otherwise the panel's CSS places it
25
+ * against the anchor from the corner alone.
26
+ */
27
+ fixed: boolean;
28
+ /**
29
+ * The gap between the anchor and the panel, in pixels, that the hook puts
30
+ * there itself: added to the fixed coordinates and to the room `auto` asks
31
+ * for below the anchor.
32
+ * @defaultValue 4
33
+ */
34
+ offset?: number;
35
+ /**
36
+ * Reads the gap the panel's own stylesheet puts between it and the anchor,
37
+ * in pixels, each time the panel is measured. `auto` leaves room for it as
38
+ * well; the coordinates don't include it, because the stylesheet applies it.
39
+ */
40
+ styledGap?: (panel: HTMLElement) => number;
41
+ }
42
+ /**
43
+ * Places a floating panel against its anchor: resolves `auto` to a corner
44
+ * and, for a panel fixed to the viewport, works out its coordinates. It
45
+ * measures again on resize and on any scroll of the anchor's window (an
46
+ * iframe's, when the anchor renders into one), so a fixed panel follows its
47
+ * anchor. A measurement that changes nothing doesn't render again.
48
+ *
49
+ * Measuring happens in a layout effect, so the panel is placed before it
50
+ * paints. It needs both elements on the page while `active` is on, and
51
+ * keeps the last placement when either is missing.
52
+ *
53
+ * @function useAnchoredPosition
54
+ * @param anchorRef - The element the panel opens from.
55
+ * @param panelRef - The floating panel.
56
+ * @param options - Whether to measure, the corner asked for, and how the panel is placed.
57
+ * @returns The corner the panel opens from, with coordinates when it is fixed.
58
+ */
59
+ export declare function useAnchoredPosition(anchorRef: RefObject<HTMLElement | null>, panelRef: RefObject<HTMLElement | null>, { active, position, fixed, offset, styledGap }: UseAnchoredPositionOptions): AnchoredPosition;
@@ -1,5 +1,5 @@
1
1
  import { type CSSProperties } from 'react';
2
- import { BulmaDisplayProps, BulmaViewportProps } from './bulmaClassHelpers.js';
2
+ import { BulmaDisplayProps, BulmaViewportProps, type BulmaGapStep } from './bulmaClassHelpers.js';
3
3
  import { BulmaColorProps, BulmaColorPropsWithScheme } from './useColorClasses.js';
4
4
  import { BulmaSpacingProps } from './useSpacingClasses.js';
5
5
  import { BulmaTypographyProps } from './useTypographyClasses.js';
@@ -50,8 +50,8 @@ export declare const useBulmaClasses: <T extends object>(props: BulmaClassesProp
50
50
  bulmaHelperStyles?: CSSProperties;
51
51
  rest: Omit<T, keyof BulmaClassesProps>;
52
52
  };
53
- export { validColors, validColorShades, validSchemeColors, validSizes, validTextSizes, validAlignments, validTextTransforms, validTextWeights, validFontFamilies, validDisplays, validVisibilities, validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink, validViewports, validFloats, validOverflows, validAxisOverflows, validInteractions, validCursors, validRadii, validShadows, validResponsives, validPositions, validAspectRatios, } from './bulmaClassHelpers.js';
54
- export type { BulmaViewportProps, BulmaDisplayProps };
53
+ export { validColors, validColorShades, validSchemeColors, validSizes, validGaps, validTextSizes, validAlignments, validTextTransforms, validTextWeights, validFontFamilies, validDisplays, validVisibilities, validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink, validViewports, validFloats, validOverflows, validAxisOverflows, validInteractions, validCursors, validRadii, validShadows, validResponsives, validPositions, validAspectRatios, } from './bulmaClassHelpers.js';
54
+ export type { BulmaViewportProps, BulmaDisplayProps, BulmaGapStep };
55
55
  export * from './useColorClasses.js';
56
56
  export * from './useSpacingClasses.js';
57
57
  export * from './useTypographyClasses.js';
@@ -0,0 +1,7 @@
1
+ import { useEffect } from 'react';
2
+ /**
3
+ * `useLayoutEffect` in the browser, `useEffect` on the server. A server
4
+ * render runs neither, and React 18 warns about a layout effect there, so the
5
+ * server is handed the plain one.
6
+ */
7
+ export declare const useClientLayoutEffect: typeof useEffect;
@@ -1,4 +1,11 @@
1
1
  import type { RefObject } from 'react';
2
+ /**
3
+ * The first tab stop inside `container`, found the way the trap finds it, or
4
+ * `null` when there is none. For a component that moves focus into a panel
5
+ * without trapping it there. `src/index.ts` names its exports from this
6
+ * module, so this one stays internal.
7
+ */
8
+ export declare function firstTabStop(container: HTMLElement): HTMLElement | null;
2
9
  /**
3
10
  * Options for `useFocusTrap`.
4
11
  */
@@ -10,9 +17,12 @@ export interface UseFocusTrapOptions {
10
17
  */
11
18
  active?: boolean;
12
19
  /**
13
- * The element to focus when the trap turns on. Without it, or while it
14
- * points at nothing, focus goes to the first tab stop inside the container,
15
- * and to the container itself when there is none.
20
+ * The element inside the container to focus when the trap turns on. It has
21
+ * to be one that can take focus, so a heading needs `tabIndex={-1}`. When
22
+ * focusing it doesn't put focus inside the container (the ref is empty, or
23
+ * its element is outside, disabled, hidden or can't take focus), focus goes
24
+ * to the first tab stop inside the container, and to the container itself
25
+ * when there is none.
16
26
  */
17
27
  initialFocusRef?: RefObject<HTMLElement | null>;
18
28
  /**
@@ -1,6 +1,6 @@
1
- import { validSizes } from './bulmaClassHelpers.js';
1
+ import { validSizes, type BulmaGapStep } from './bulmaClassHelpers.js';
2
2
  /**
3
- * Props for applying Bulma margin and padding helper classes.
3
+ * Props for applying Bulma margin, padding and gap helper classes.
4
4
  */
5
5
  export interface BulmaSpacingProps {
6
6
  /** Margin (e.g., '0', '1'). */
@@ -31,9 +31,40 @@ export interface BulmaSpacingProps {
31
31
  px?: (typeof validSizes)[number];
32
32
  /** Padding vertical (top and bottom). */
33
33
  py?: (typeof validSizes)[number];
34
+ /**
35
+ * Space between the children of a flex or grid container (`is-gap-<value>`),
36
+ * on Bulma's gap scale: each whole step is 0.5rem, so `gap="2"` is 1rem, with
37
+ * half steps such as `"1.5"` between them. Also takes the step as a number.
38
+ *
39
+ * It sets the CSS `gap`, which does nothing unless the element lays its
40
+ * children out as flex or grid, so pair it with `display="flex"` on most
41
+ * components. The scale is not the margin scale: `m="2"` is 0.5rem.
42
+ *
43
+ * `Grid` and `Columns` declare their own `gap`. `Grid`'s renders the same
44
+ * class; `Columns`' is the columns gutter (`is-<value>`) and takes whole
45
+ * steps only.
46
+ */
47
+ gap?: BulmaGapStep;
48
+ /**
49
+ * Space between columns only (`is-column-gap-<value>`), on the same scale as
50
+ * `gap`. Beside `gap` or `gapless`, it wins on its own axis.
51
+ */
52
+ columnGap?: BulmaGapStep;
53
+ /**
54
+ * Space between rows only (`is-row-gap-<value>`), on the same scale as
55
+ * `gap`. Beside `gap` or `gapless`, it wins on its own axis.
56
+ */
57
+ rowGap?: BulmaGapStep;
58
+ /**
59
+ * Removes the gap between children (`is-gapless`), the shortcut for
60
+ * `gap="0"`; a valid `gap` wins when both are set. `Columns` is the
61
+ * exception: its `gap` is its gutter, and there `gapless` is Bulma's gapless
62
+ * columns modifier, the same as `isGapless`.
63
+ */
64
+ gapless?: boolean;
34
65
  }
35
66
  /**
36
- * A hook that generates Bulma margin and padding helper classes.
67
+ * A hook that generates Bulma margin, padding and gap helper classes.
37
68
  *
38
69
  * @function useSpacingClasses
39
70
  * @param props - Spacing-related Bulma helper props.