@allxsmith/bestax-bulma 5.26.5 → 5.26.6
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.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +222 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +222 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/types/form/Numberinput.d.ts +8 -1
- package/dist/types/form/_pickerInternals/Calendar.d.ts +45 -4
- package/dist/types/form/_pickerInternals/dateUtils.d.ts +17 -0
- package/dist/types/form/_pickerInternals/pickerTypes.d.ts +14 -0
- package/dist/types/helpers/statusRegion.d.ts +1 -0
- package/dist/types-cjs/form/Numberinput.d.ts +8 -1
- package/dist/types-cjs/form/_pickerInternals/Calendar.d.ts +45 -4
- package/dist/types-cjs/form/_pickerInternals/dateUtils.d.ts +17 -0
- package/dist/types-cjs/form/_pickerInternals/pickerTypes.d.ts +14 -0
- package/dist/types-cjs/helpers/statusRegion.d.ts +1 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/form/_dateinput.scss +8 -1
|
@@ -45,7 +45,14 @@ export interface NumberinputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
45
45
|
controlsRounded?: boolean;
|
|
46
46
|
/** Uses compact button spacing. */
|
|
47
47
|
compact?: boolean;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Renders the plusminus controls without a `.field` row of their own, so
|
|
50
|
+
* they join the row of a `Field` with `hasAddons` or `grouped` they sit
|
|
51
|
+
* in. On by default inside a `Field`, unless a `Control` is anywhere above
|
|
52
|
+
* it: a `Control` stacks its children, so there the controls keep their
|
|
53
|
+
* own row.
|
|
54
|
+
* @defaultValue auto
|
|
55
|
+
*/
|
|
49
56
|
bare?: boolean;
|
|
50
57
|
/** Style variant for the control buttons. */
|
|
51
58
|
variant?: NumberinputVariant;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DateGranularity, DayOfWeek, PickerLabels } from './pickerTypes.js';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DateGranularity, DateRangeValue, DayOfWeek, PickerLabels } from './pickerTypes.js';
|
|
3
|
+
/** What every calendar takes, whichever way it picks. */
|
|
4
|
+
interface CalendarBaseProps {
|
|
5
5
|
focusedDate: Date;
|
|
6
|
-
onSelect: (d: Date) => void;
|
|
7
6
|
onFocusedDateChange: (d: Date) => void;
|
|
8
7
|
/**
|
|
9
8
|
* Earliest selectable date. One before year 1, or none, counts as the start
|
|
@@ -47,6 +46,48 @@ export interface CalendarProps {
|
|
|
47
46
|
*/
|
|
48
47
|
granularity?: DateGranularity;
|
|
49
48
|
}
|
|
49
|
+
/** A calendar that picks one day, month or year. */
|
|
50
|
+
interface CalendarSingleProps {
|
|
51
|
+
/** The selected date. */
|
|
52
|
+
value: Date | null;
|
|
53
|
+
/** Called with a picked date, or the first day of a picked period. */
|
|
54
|
+
onSelect: (d: Date) => void;
|
|
55
|
+
range?: never;
|
|
56
|
+
onRangeSelect?: never;
|
|
57
|
+
allowDisabledInRange?: never;
|
|
58
|
+
}
|
|
59
|
+
/** A calendar that picks a range of days. */
|
|
60
|
+
interface CalendarRangeProps {
|
|
61
|
+
/**
|
|
62
|
+
* The committed range, start first, which turns on range mode. The day grid
|
|
63
|
+
* then picks two days: the first pick marks a start inside the calendar and
|
|
64
|
+
* commits nothing, and the second calls `onRangeSelect` with both ends. A
|
|
65
|
+
* pick that cannot end the range starts a new one instead: one before the
|
|
66
|
+
* start, or one past a disabled day unless `allowDisabledInRange` is set.
|
|
67
|
+
* While a start is pending the grid previews the range to the hovered day,
|
|
68
|
+
* or to the focused day, and hides the committed one. A range with a start
|
|
69
|
+
* and no end opens with that start pending. Escape takes back a pending pick
|
|
70
|
+
* and stops there, so a popover around the calendar stays open; a pending
|
|
71
|
+
* start that came from `range` is not a pick, and Escape goes on.
|
|
72
|
+
*/
|
|
73
|
+
range: DateRangeValue;
|
|
74
|
+
/** Called with both ends once the second day is picked. */
|
|
75
|
+
onRangeSelect: (start: Date, end: Date) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Let a range include days that `shouldDisableDate` or `unselectableDates`
|
|
78
|
+
* disable. Its ends can still not be such days.
|
|
79
|
+
*/
|
|
80
|
+
allowDisabledInRange?: boolean;
|
|
81
|
+
/** Only the day grid picks a range. */
|
|
82
|
+
granularity?: 'day';
|
|
83
|
+
value?: never;
|
|
84
|
+
onSelect?: never;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The calendar picks one date through `value` and `onSelect`, or a range
|
|
88
|
+
* through `range` and `onRangeSelect`, and its props take exactly one pair.
|
|
89
|
+
*/
|
|
90
|
+
export type CalendarProps = CalendarBaseProps & (CalendarSingleProps | CalendarRangeProps);
|
|
50
91
|
/**
|
|
51
92
|
* Selects the calendar's focused cell, the one tab stop of whichever grid or
|
|
52
93
|
* year list is on show, for a popover to put focus on as it opens. It runs
|
|
@@ -60,6 +60,23 @@ export declare function isDayUnselectable(d: Date, c: DayConstraints): boolean;
|
|
|
60
60
|
* of 3pm on a month's last day leaves that day, and so its month, selectable.
|
|
61
61
|
*/
|
|
62
62
|
export declare function isPeriodUnselectable(d: Date, granularity: DateGranularity, c: DayConstraints): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The most days {@link canCloseRange} walks between a range's ends, about
|
|
65
|
+
* eleven years. A span it would have to walk further is refused, so the check
|
|
66
|
+
* stays cheap enough to run on every pointer move over the calendar.
|
|
67
|
+
*/
|
|
68
|
+
export declare const RANGE_WALK_LIMIT = 4000;
|
|
69
|
+
/**
|
|
70
|
+
* Whether `end` can close a range that opens on `start`: it falls on `start`'s
|
|
71
|
+
* day or later, and, unless `allowDisabled`, no day between the two is one
|
|
72
|
+
* that `shouldDisableDate` or `unselectableDates` disables. Checking that
|
|
73
|
+
* walks the days between, so with either rule set and `allowDisabled` off,
|
|
74
|
+
* an `end` more than {@link RANGE_WALK_LIMIT} days after `start` is refused.
|
|
75
|
+
* The ends' own constraints, `min` and `max` among them, are the caller's to
|
|
76
|
+
* check. Bounds can't fall between two days inside them, so they are not
|
|
77
|
+
* walked.
|
|
78
|
+
*/
|
|
79
|
+
export declare function canCloseRange(start: Date, end: Date, c: DayConstraints, allowDisabled?: boolean): boolean;
|
|
63
80
|
export declare function addDays(d: Date, n: number): Date;
|
|
64
81
|
export declare function addMonths(d: Date, n: number): Date;
|
|
65
82
|
export declare function addYears(d: Date, n: number): Date;
|
|
@@ -3,6 +3,11 @@ export type HourFormat = '12' | '24';
|
|
|
3
3
|
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
4
|
/** The unit a date picker selects: a day, a month or a year. */
|
|
5
5
|
export type DateGranularity = 'day' | 'month' | 'year';
|
|
6
|
+
/**
|
|
7
|
+
* A range of days, start first. Either end may be `null` while the range is
|
|
8
|
+
* half filled, and `[null, null]` is empty.
|
|
9
|
+
*/
|
|
10
|
+
export type DateRangeValue = [Date | null, Date | null];
|
|
6
11
|
/**
|
|
7
12
|
* Translatable strings used across all four pickers. Pass via the `labels`
|
|
8
13
|
* prop to override defaults; consumers manage their own locale-driven mapping.
|
|
@@ -19,6 +24,15 @@ export interface PickerLabels {
|
|
|
19
24
|
chooseMonth?: string;
|
|
20
25
|
/** Launcher, popover and year list name when the picker selects a year. */
|
|
21
26
|
chooseYear?: string;
|
|
27
|
+
/** Range picking: names the start of a range, in the calendar and the field. */
|
|
28
|
+
rangeStart?: string;
|
|
29
|
+
/** Range picking: names the end of a range, in the calendar and the field. */
|
|
30
|
+
rangeEnd?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Range picking: describes the day a pending range would end on, the one
|
|
33
|
+
* the pointer or the keyboard is on, until it is picked.
|
|
34
|
+
*/
|
|
35
|
+
rangePreviewEnd?: string;
|
|
22
36
|
hours?: string;
|
|
23
37
|
minutes?: string;
|
|
24
38
|
seconds?: string;
|
|
@@ -13,6 +13,7 @@ export declare const announceDelay = 100;
|
|
|
13
13
|
* again.
|
|
14
14
|
*/
|
|
15
15
|
export declare const announcementLifetime = 1000;
|
|
16
|
+
export declare const visuallyHidden: React.CSSProperties;
|
|
16
17
|
/**
|
|
17
18
|
* Reads an element out roughly the way a screen reader would: its text, with
|
|
18
19
|
* an element's `aria-label`, or an image's `alt`, standing in for what's
|
|
@@ -45,7 +45,14 @@ export interface NumberinputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
45
45
|
controlsRounded?: boolean;
|
|
46
46
|
/** Uses compact button spacing. */
|
|
47
47
|
compact?: boolean;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Renders the plusminus controls without a `.field` row of their own, so
|
|
50
|
+
* they join the row of a `Field` with `hasAddons` or `grouped` they sit
|
|
51
|
+
* in. On by default inside a `Field`, unless a `Control` is anywhere above
|
|
52
|
+
* it: a `Control` stacks its children, so there the controls keep their
|
|
53
|
+
* own row.
|
|
54
|
+
* @defaultValue auto
|
|
55
|
+
*/
|
|
49
56
|
bare?: boolean;
|
|
50
57
|
/** Style variant for the control buttons. */
|
|
51
58
|
variant?: NumberinputVariant;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DateGranularity, DayOfWeek, PickerLabels } from './pickerTypes.js';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DateGranularity, DateRangeValue, DayOfWeek, PickerLabels } from './pickerTypes.js';
|
|
3
|
+
/** What every calendar takes, whichever way it picks. */
|
|
4
|
+
interface CalendarBaseProps {
|
|
5
5
|
focusedDate: Date;
|
|
6
|
-
onSelect: (d: Date) => void;
|
|
7
6
|
onFocusedDateChange: (d: Date) => void;
|
|
8
7
|
/**
|
|
9
8
|
* Earliest selectable date. One before year 1, or none, counts as the start
|
|
@@ -47,6 +46,48 @@ export interface CalendarProps {
|
|
|
47
46
|
*/
|
|
48
47
|
granularity?: DateGranularity;
|
|
49
48
|
}
|
|
49
|
+
/** A calendar that picks one day, month or year. */
|
|
50
|
+
interface CalendarSingleProps {
|
|
51
|
+
/** The selected date. */
|
|
52
|
+
value: Date | null;
|
|
53
|
+
/** Called with a picked date, or the first day of a picked period. */
|
|
54
|
+
onSelect: (d: Date) => void;
|
|
55
|
+
range?: never;
|
|
56
|
+
onRangeSelect?: never;
|
|
57
|
+
allowDisabledInRange?: never;
|
|
58
|
+
}
|
|
59
|
+
/** A calendar that picks a range of days. */
|
|
60
|
+
interface CalendarRangeProps {
|
|
61
|
+
/**
|
|
62
|
+
* The committed range, start first, which turns on range mode. The day grid
|
|
63
|
+
* then picks two days: the first pick marks a start inside the calendar and
|
|
64
|
+
* commits nothing, and the second calls `onRangeSelect` with both ends. A
|
|
65
|
+
* pick that cannot end the range starts a new one instead: one before the
|
|
66
|
+
* start, or one past a disabled day unless `allowDisabledInRange` is set.
|
|
67
|
+
* While a start is pending the grid previews the range to the hovered day,
|
|
68
|
+
* or to the focused day, and hides the committed one. A range with a start
|
|
69
|
+
* and no end opens with that start pending. Escape takes back a pending pick
|
|
70
|
+
* and stops there, so a popover around the calendar stays open; a pending
|
|
71
|
+
* start that came from `range` is not a pick, and Escape goes on.
|
|
72
|
+
*/
|
|
73
|
+
range: DateRangeValue;
|
|
74
|
+
/** Called with both ends once the second day is picked. */
|
|
75
|
+
onRangeSelect: (start: Date, end: Date) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Let a range include days that `shouldDisableDate` or `unselectableDates`
|
|
78
|
+
* disable. Its ends can still not be such days.
|
|
79
|
+
*/
|
|
80
|
+
allowDisabledInRange?: boolean;
|
|
81
|
+
/** Only the day grid picks a range. */
|
|
82
|
+
granularity?: 'day';
|
|
83
|
+
value?: never;
|
|
84
|
+
onSelect?: never;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The calendar picks one date through `value` and `onSelect`, or a range
|
|
88
|
+
* through `range` and `onRangeSelect`, and its props take exactly one pair.
|
|
89
|
+
*/
|
|
90
|
+
export type CalendarProps = CalendarBaseProps & (CalendarSingleProps | CalendarRangeProps);
|
|
50
91
|
/**
|
|
51
92
|
* Selects the calendar's focused cell, the one tab stop of whichever grid or
|
|
52
93
|
* year list is on show, for a popover to put focus on as it opens. It runs
|
|
@@ -60,6 +60,23 @@ export declare function isDayUnselectable(d: Date, c: DayConstraints): boolean;
|
|
|
60
60
|
* of 3pm on a month's last day leaves that day, and so its month, selectable.
|
|
61
61
|
*/
|
|
62
62
|
export declare function isPeriodUnselectable(d: Date, granularity: DateGranularity, c: DayConstraints): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The most days {@link canCloseRange} walks between a range's ends, about
|
|
65
|
+
* eleven years. A span it would have to walk further is refused, so the check
|
|
66
|
+
* stays cheap enough to run on every pointer move over the calendar.
|
|
67
|
+
*/
|
|
68
|
+
export declare const RANGE_WALK_LIMIT = 4000;
|
|
69
|
+
/**
|
|
70
|
+
* Whether `end` can close a range that opens on `start`: it falls on `start`'s
|
|
71
|
+
* day or later, and, unless `allowDisabled`, no day between the two is one
|
|
72
|
+
* that `shouldDisableDate` or `unselectableDates` disables. Checking that
|
|
73
|
+
* walks the days between, so with either rule set and `allowDisabled` off,
|
|
74
|
+
* an `end` more than {@link RANGE_WALK_LIMIT} days after `start` is refused.
|
|
75
|
+
* The ends' own constraints, `min` and `max` among them, are the caller's to
|
|
76
|
+
* check. Bounds can't fall between two days inside them, so they are not
|
|
77
|
+
* walked.
|
|
78
|
+
*/
|
|
79
|
+
export declare function canCloseRange(start: Date, end: Date, c: DayConstraints, allowDisabled?: boolean): boolean;
|
|
63
80
|
export declare function addDays(d: Date, n: number): Date;
|
|
64
81
|
export declare function addMonths(d: Date, n: number): Date;
|
|
65
82
|
export declare function addYears(d: Date, n: number): Date;
|
|
@@ -3,6 +3,11 @@ export type HourFormat = '12' | '24';
|
|
|
3
3
|
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
4
|
/** The unit a date picker selects: a day, a month or a year. */
|
|
5
5
|
export type DateGranularity = 'day' | 'month' | 'year';
|
|
6
|
+
/**
|
|
7
|
+
* A range of days, start first. Either end may be `null` while the range is
|
|
8
|
+
* half filled, and `[null, null]` is empty.
|
|
9
|
+
*/
|
|
10
|
+
export type DateRangeValue = [Date | null, Date | null];
|
|
6
11
|
/**
|
|
7
12
|
* Translatable strings used across all four pickers. Pass via the `labels`
|
|
8
13
|
* prop to override defaults; consumers manage their own locale-driven mapping.
|
|
@@ -19,6 +24,15 @@ export interface PickerLabels {
|
|
|
19
24
|
chooseMonth?: string;
|
|
20
25
|
/** Launcher, popover and year list name when the picker selects a year. */
|
|
21
26
|
chooseYear?: string;
|
|
27
|
+
/** Range picking: names the start of a range, in the calendar and the field. */
|
|
28
|
+
rangeStart?: string;
|
|
29
|
+
/** Range picking: names the end of a range, in the calendar and the field. */
|
|
30
|
+
rangeEnd?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Range picking: describes the day a pending range would end on, the one
|
|
33
|
+
* the pointer or the keyboard is on, until it is picked.
|
|
34
|
+
*/
|
|
35
|
+
rangePreviewEnd?: string;
|
|
22
36
|
hours?: string;
|
|
23
37
|
minutes?: string;
|
|
24
38
|
seconds?: string;
|
|
@@ -13,6 +13,7 @@ export declare const announceDelay = 100;
|
|
|
13
13
|
* again.
|
|
14
14
|
*/
|
|
15
15
|
export declare const announcementLifetime = 1000;
|
|
16
|
+
export declare const visuallyHidden: React.CSSProperties;
|
|
16
17
|
/**
|
|
17
18
|
* Reads an element out roughly the way a screen reader would: its text, with
|
|
18
19
|
* an element's `aria-label`, or an image's `alt`, standing in for what's
|