@pingux/astro 2.69.0 → 2.70.0-alpha.1
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/lib/cjs/components/AccordionItem/AccordionItem.d.ts +1 -1
- package/lib/cjs/components/AccordionItem/AccordionItem.js +1 -1
- package/lib/cjs/components/Calendar/Calendar.js +4 -0
- package/lib/cjs/components/Calendar/Calendar.mdx +1 -1
- package/lib/cjs/components/Calendar/Calendar.test.js +1 -4
- package/lib/cjs/components/Calendar/CalendarCell.js +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.test.js +62 -6
- package/lib/cjs/components/Grid/Grid.d.ts +4 -0
- package/lib/cjs/components/Grid/Grid.js +24 -0
- package/lib/cjs/components/Grid/Grid.mdx +13 -0
- package/lib/cjs/components/Grid/Grid.stories.d.ts +5 -0
- package/lib/cjs/components/Grid/Grid.stories.js +72 -0
- package/lib/cjs/components/Grid/Grid.styles.d.ts +2 -0
- package/lib/cjs/components/Grid/Grid.styles.js +9 -0
- package/lib/cjs/components/Grid/Grid.test.d.ts +1 -0
- package/lib/cjs/components/Grid/Grid.test.js +27 -0
- package/lib/cjs/components/Grid/index.d.ts +1 -0
- package/lib/cjs/components/Grid/index.js +14 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.d.ts +7 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.js +100 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.mdx +39 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.stories.d.ts +103 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.stories.js +131 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.styles.d.ts +104 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.styles.js +118 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.test.d.ts +1 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendar.test.js +217 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarCell.d.ts +4 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarCell.js +96 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarGrid.d.ts +4 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarGrid.js +70 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarHeader.d.ts +4 -0
- package/lib/cjs/components/RangeCalendar/RangeCalendarHeader.js +85 -0
- package/lib/cjs/components/RangeCalendar/index.d.ts +2 -0
- package/lib/cjs/components/RangeCalendar/index.js +33 -0
- package/lib/cjs/components/Tabs/Tabs.js +10 -5
- package/lib/cjs/components/Tabs/Tabs.stories.js +4 -2
- package/lib/cjs/index.d.ts +5 -2
- package/lib/cjs/index.js +92 -65
- package/lib/cjs/styles/theme.js +1 -0
- package/lib/cjs/styles/variants/index.js +8 -0
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/types/calendar.d.ts +51 -16
- package/lib/cjs/types/grid.d.ts +21 -0
- package/lib/cjs/types/grid.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +43 -32
- package/lib/components/AccordionItem/AccordionItem.js +0 -3
- package/lib/components/Calendar/Calendar.js +4 -0
- package/lib/components/Calendar/Calendar.mdx +1 -1
- package/lib/components/Calendar/Calendar.test.js +1 -4
- package/lib/components/Calendar/CalendarCell.js +1 -1
- package/lib/components/DatePicker/DatePicker.test.js +62 -6
- package/lib/components/Grid/Grid.js +14 -0
- package/lib/components/Grid/Grid.mdx +13 -0
- package/lib/components/Grid/Grid.stories.js +62 -0
- package/lib/components/Grid/Grid.styles.js +1 -0
- package/lib/components/Grid/Grid.test.js +24 -0
- package/lib/components/Grid/index.js +1 -0
- package/lib/components/RangeCalendar/RangeCalendar.js +86 -0
- package/lib/components/RangeCalendar/RangeCalendar.mdx +39 -0
- package/lib/components/RangeCalendar/RangeCalendar.stories.js +112 -0
- package/lib/components/RangeCalendar/RangeCalendar.styles.js +110 -0
- package/lib/components/RangeCalendar/RangeCalendar.test.js +208 -0
- package/lib/components/RangeCalendar/RangeCalendarCell.js +82 -0
- package/lib/components/RangeCalendar/RangeCalendarGrid.js +61 -0
- package/lib/components/RangeCalendar/RangeCalendarHeader.js +76 -0
- package/lib/components/RangeCalendar/index.js +2 -0
- package/lib/components/Tabs/Tabs.js +10 -5
- package/lib/components/Tabs/Tabs.stories.js +4 -2
- package/lib/index.js +5 -2
- package/lib/styles/theme.js +2 -1
- package/lib/styles/variants/index.js +1 -0
- package/lib/styles/variants/variants.js +2 -0
- package/lib/types/grid.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +13 -10
@@ -1,24 +1,31 @@
|
|
1
1
|
import { Key } from 'react';
|
2
2
|
import type { CalendarDate, CalendarDateTime, ZonedDateTime } from '@internationalized/date';
|
3
|
-
import { type CalendarState } from '@react-stately/calendar';
|
3
|
+
import { type CalendarState, type RangeCalendarState } from '@react-stately/calendar';
|
4
|
+
import type { AriaButtonProps } from '@react-types/button';
|
5
|
+
import type { DOMAttributes as AriaDOMAttributes } from '@react-types/shared';
|
4
6
|
import { DOMAttributes } from './shared/dom';
|
5
7
|
import { TestingAttributes } from './shared/test';
|
6
8
|
import { BoxProps } from './box';
|
7
9
|
export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
|
8
|
-
type calendarGridStateProps = CalendarState;
|
10
|
+
type calendarGridStateProps = CalendarState | RangeCalendarState;
|
11
|
+
type MappedDateValue<T> = T extends ZonedDateTime ? ZonedDateTime : T extends CalendarDateTime ? CalendarDateTime : T extends CalendarDate ? CalendarDate : never;
|
9
12
|
export interface RangeValue<T> {
|
10
13
|
/** The start value of the range. */
|
11
14
|
start: T;
|
12
15
|
/** The end value of the range. */
|
13
16
|
end: T;
|
14
17
|
}
|
15
|
-
export
|
16
|
-
|
17
|
-
|
18
|
+
export type StringOrRangeValue = RangeValue<DateValue> | {
|
19
|
+
start: string;
|
20
|
+
end: string;
|
21
|
+
};
|
22
|
+
export interface CalendarBaseProps extends BoxProps, TestingAttributes {
|
18
23
|
/** Prop to provide a custom default focused date (uncontrolled) */
|
19
|
-
defaultFocusedValue?: DateValue;
|
20
|
-
/**
|
21
|
-
|
24
|
+
defaultFocusedValue?: DateValue | string;
|
25
|
+
/** The maximum allowed date that a user may select. */
|
26
|
+
maxValue?: DateValue | string;
|
27
|
+
/** The minimum allowed date that a user may select. */
|
28
|
+
minValue?: DateValue | string;
|
22
29
|
/** custom week days for other calendars */
|
23
30
|
customWeekDays?: string[];
|
24
31
|
/** Whether the element should receive focus on render. */
|
@@ -31,39 +38,67 @@ export interface CalendarProps extends BoxProps, TestingAttributes {
|
|
31
38
|
*
|
32
39
|
* (date?: DateValue) => boolean
|
33
40
|
*/
|
34
|
-
isDateUnavailable?: (date:
|
41
|
+
isDateUnavailable?: (date: DateValue) => boolean;
|
35
42
|
/** Whether the calendar is disabled. */
|
36
43
|
isDisabled?: boolean;
|
37
44
|
/** Whether the calendar dates are only focusable. */
|
38
45
|
isReadOnly?: boolean;
|
39
46
|
/** Whether user input is required on the input before form submission. */
|
40
47
|
isRequired?: boolean;
|
41
|
-
/** The maximum allowed date that a user may select. */
|
42
|
-
maxValue?: DateValue | string;
|
43
|
-
/** The minimum allowed date that a user may select. */
|
44
|
-
minValue?: DateValue | string;
|
45
48
|
/** Handler that is called when the element loses focus. */
|
46
49
|
onBlur?: () => void;
|
47
|
-
/** Handler that is called when the element's selection state changes. */
|
48
|
-
onChange?: () => void;
|
49
50
|
/** Handler that is called when the element receives focus. */
|
50
51
|
onFocus?: () => void;
|
51
52
|
/** Handler that is called when the element's focus status changes. */
|
52
|
-
onFocusChange?: () => void;
|
53
|
+
onFocusChange?: (date: CalendarDate) => void;
|
53
54
|
/** Handler that is called when a key is pressed. */
|
54
55
|
onKeyDown?: () => void;
|
55
56
|
/** Handler that is called when a key is released. */
|
56
57
|
onKeyUp?: () => void;
|
57
58
|
}
|
59
|
+
export interface CalendarProps extends Omit<CalendarBaseProps, 'onChange'> {
|
60
|
+
/** Prop to provide a custom default date (uncontrolled) */
|
61
|
+
defaultValue?: DateValue | string;
|
62
|
+
/** Prop to provide a custom default focused date (uncontrolled) */
|
63
|
+
value?: DateValue | string;
|
64
|
+
/** Handler that is called when the value changes. */
|
65
|
+
onChange?: (value: MappedDateValue<DateValue>) => void;
|
66
|
+
}
|
67
|
+
export interface RangeCalendarProps extends Omit<CalendarBaseProps, 'onChange'> {
|
68
|
+
/** Prop to provide a custom default date (uncontrolled) */
|
69
|
+
defaultValue?: StringOrRangeValue | null;
|
70
|
+
/** The currently selected date range. */
|
71
|
+
value?: StringOrRangeValue | null;
|
72
|
+
/** Handler that is called when the value changes. */
|
73
|
+
onChange?: (value: RangeValue<MappedDateValue<DateValue>>) => void;
|
74
|
+
}
|
75
|
+
export interface RangeCalendarHeaderProps {
|
76
|
+
state: RangeCalendarState;
|
77
|
+
calendarProps: AriaDOMAttributes;
|
78
|
+
prevButtonProps: AriaButtonProps;
|
79
|
+
nextButtonProps: AriaButtonProps;
|
80
|
+
}
|
58
81
|
export interface CalendarGridProps {
|
59
82
|
/** State object that is passed in from the useCalendar hook */
|
60
83
|
state: calendarGridStateProps;
|
61
84
|
/** Custom week days for other international calendars */
|
62
85
|
customWeekDays?: Array<string>;
|
63
86
|
}
|
87
|
+
export interface RangeCalendarGridProps {
|
88
|
+
/** State object that is passed in from the useRangeCalendar hook */
|
89
|
+
state: RangeCalendarState;
|
90
|
+
/** The offset to apply to the calendar */
|
91
|
+
offset?: object;
|
92
|
+
}
|
64
93
|
export interface CalendarCellProps extends DOMAttributes {
|
65
94
|
state: calendarGridStateProps;
|
66
95
|
date: object;
|
67
96
|
key?: Key;
|
68
97
|
}
|
98
|
+
export interface RangeCalendarCellProps extends DOMAttributes {
|
99
|
+
state: RangeCalendarState;
|
100
|
+
date: object;
|
101
|
+
key?: Key;
|
102
|
+
currentMonth: CalendarDate;
|
103
|
+
}
|
69
104
|
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { GridProps as ThemeUIGridProps, ResponsiveStyleValue } from 'theme-ui';
|
2
|
+
export interface GridProps extends ThemeUIGridProps {
|
3
|
+
/**
|
4
|
+
* Minimum width of child elements
|
5
|
+
*/
|
6
|
+
width?: ResponsiveStyleValue<string | number>;
|
7
|
+
/**
|
8
|
+
* *Cannot be used in conjunction with the width prop*
|
9
|
+
*
|
10
|
+
* Number of equally-sized columns, or [grid syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) string values, to use for the layout
|
11
|
+
*/
|
12
|
+
columns?: ResponsiveStyleValue<string | number>;
|
13
|
+
/**
|
14
|
+
* Space between child elements
|
15
|
+
*/
|
16
|
+
gap?: ResponsiveStyleValue<string | number>;
|
17
|
+
/**
|
18
|
+
* Auto-repeat track behaviour (default is fit)
|
19
|
+
*/
|
20
|
+
repeat?: 'fit' | 'fill';
|
21
|
+
}
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -172,8 +172,19 @@ _forEachInstanceProperty(_context15 = _Object$keys(_fieldHelperText)).call(_cont
|
|
172
172
|
}
|
173
173
|
});
|
174
174
|
});
|
175
|
+
var _grid = require("./grid");
|
176
|
+
_forEachInstanceProperty(_context16 = _Object$keys(_grid)).call(_context16, function (key) {
|
177
|
+
if (key === "default" || key === "__esModule") return;
|
178
|
+
if (key in exports && exports[key] === _grid[key]) return;
|
179
|
+
_Object$defineProperty(exports, key, {
|
180
|
+
enumerable: true,
|
181
|
+
get: function get() {
|
182
|
+
return _grid[key];
|
183
|
+
}
|
184
|
+
});
|
185
|
+
});
|
175
186
|
var _helpHint = require("./helpHint");
|
176
|
-
_forEachInstanceProperty(
|
187
|
+
_forEachInstanceProperty(_context17 = _Object$keys(_helpHint)).call(_context17, function (key) {
|
177
188
|
if (key === "default" || key === "__esModule") return;
|
178
189
|
if (key in exports && exports[key] === _helpHint[key]) return;
|
179
190
|
_Object$defineProperty(exports, key, {
|
@@ -184,7 +195,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_helpHint)).call(_context16,
|
|
184
195
|
});
|
185
196
|
});
|
186
197
|
var _icon = require("./icon");
|
187
|
-
_forEachInstanceProperty(
|
198
|
+
_forEachInstanceProperty(_context18 = _Object$keys(_icon)).call(_context18, function (key) {
|
188
199
|
if (key === "default" || key === "__esModule") return;
|
189
200
|
if (key in exports && exports[key] === _icon[key]) return;
|
190
201
|
_Object$defineProperty(exports, key, {
|
@@ -195,7 +206,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_icon)).call(_context17, func
|
|
195
206
|
});
|
196
207
|
});
|
197
208
|
var _iconBadge = require("./iconBadge");
|
198
|
-
_forEachInstanceProperty(
|
209
|
+
_forEachInstanceProperty(_context19 = _Object$keys(_iconBadge)).call(_context19, function (key) {
|
199
210
|
if (key === "default" || key === "__esModule") return;
|
200
211
|
if (key in exports && exports[key] === _iconBadge[key]) return;
|
201
212
|
_Object$defineProperty(exports, key, {
|
@@ -206,7 +217,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_iconBadge)).call(_context18,
|
|
206
217
|
});
|
207
218
|
});
|
208
219
|
var _iconButton = require("./iconButton");
|
209
|
-
_forEachInstanceProperty(
|
220
|
+
_forEachInstanceProperty(_context20 = _Object$keys(_iconButton)).call(_context20, function (key) {
|
210
221
|
if (key === "default" || key === "__esModule") return;
|
211
222
|
if (key in exports && exports[key] === _iconButton[key]) return;
|
212
223
|
_Object$defineProperty(exports, key, {
|
@@ -217,7 +228,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_iconButton)).call(_context19
|
|
217
228
|
});
|
218
229
|
});
|
219
230
|
var _iconButtonToggle = require("./iconButtonToggle");
|
220
|
-
_forEachInstanceProperty(
|
231
|
+
_forEachInstanceProperty(_context21 = _Object$keys(_iconButtonToggle)).call(_context21, function (key) {
|
221
232
|
if (key === "default" || key === "__esModule") return;
|
222
233
|
if (key in exports && exports[key] === _iconButtonToggle[key]) return;
|
223
234
|
_Object$defineProperty(exports, key, {
|
@@ -228,7 +239,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_iconButtonToggle)).call(_con
|
|
228
239
|
});
|
229
240
|
});
|
230
241
|
var _input = require("./input");
|
231
|
-
_forEachInstanceProperty(
|
242
|
+
_forEachInstanceProperty(_context22 = _Object$keys(_input)).call(_context22, function (key) {
|
232
243
|
if (key === "default" || key === "__esModule") return;
|
233
244
|
if (key in exports && exports[key] === _input[key]) return;
|
234
245
|
_Object$defineProperty(exports, key, {
|
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_input)).call(_context21, fun
|
|
239
250
|
});
|
240
251
|
});
|
241
252
|
var _item = require("./item");
|
242
|
-
_forEachInstanceProperty(
|
253
|
+
_forEachInstanceProperty(_context23 = _Object$keys(_item)).call(_context23, function (key) {
|
243
254
|
if (key === "default" || key === "__esModule") return;
|
244
255
|
if (key in exports && exports[key] === _item[key]) return;
|
245
256
|
_Object$defineProperty(exports, key, {
|
@@ -250,7 +261,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_item)).call(_context22, func
|
|
250
261
|
});
|
251
262
|
});
|
252
263
|
var _label = require("./label");
|
253
|
-
_forEachInstanceProperty(
|
264
|
+
_forEachInstanceProperty(_context24 = _Object$keys(_label)).call(_context24, function (key) {
|
254
265
|
if (key === "default" || key === "__esModule") return;
|
255
266
|
if (key in exports && exports[key] === _label[key]) return;
|
256
267
|
_Object$defineProperty(exports, key, {
|
@@ -261,7 +272,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_label)).call(_context23, fun
|
|
261
272
|
});
|
262
273
|
});
|
263
274
|
var _link = require("./link");
|
264
|
-
_forEachInstanceProperty(
|
275
|
+
_forEachInstanceProperty(_context25 = _Object$keys(_link)).call(_context25, function (key) {
|
265
276
|
if (key === "default" || key === "__esModule") return;
|
266
277
|
if (key in exports && exports[key] === _link[key]) return;
|
267
278
|
_Object$defineProperty(exports, key, {
|
@@ -272,7 +283,7 @@ _forEachInstanceProperty(_context24 = _Object$keys(_link)).call(_context24, func
|
|
272
283
|
});
|
273
284
|
});
|
274
285
|
var _listBox = require("./listBox");
|
275
|
-
_forEachInstanceProperty(
|
286
|
+
_forEachInstanceProperty(_context26 = _Object$keys(_listBox)).call(_context26, function (key) {
|
276
287
|
if (key === "default" || key === "__esModule") return;
|
277
288
|
if (key in exports && exports[key] === _listBox[key]) return;
|
278
289
|
_Object$defineProperty(exports, key, {
|
@@ -283,7 +294,7 @@ _forEachInstanceProperty(_context25 = _Object$keys(_listBox)).call(_context25, f
|
|
283
294
|
});
|
284
295
|
});
|
285
296
|
var _listItem = require("./listItem");
|
286
|
-
_forEachInstanceProperty(
|
297
|
+
_forEachInstanceProperty(_context27 = _Object$keys(_listItem)).call(_context27, function (key) {
|
287
298
|
if (key === "default" || key === "__esModule") return;
|
288
299
|
if (key in exports && exports[key] === _listItem[key]) return;
|
289
300
|
_Object$defineProperty(exports, key, {
|
@@ -294,7 +305,7 @@ _forEachInstanceProperty(_context26 = _Object$keys(_listItem)).call(_context26,
|
|
294
305
|
});
|
295
306
|
});
|
296
307
|
var _loader = require("./loader");
|
297
|
-
_forEachInstanceProperty(
|
308
|
+
_forEachInstanceProperty(_context28 = _Object$keys(_loader)).call(_context28, function (key) {
|
298
309
|
if (key === "default" || key === "__esModule") return;
|
299
310
|
if (key in exports && exports[key] === _loader[key]) return;
|
300
311
|
_Object$defineProperty(exports, key, {
|
@@ -305,7 +316,7 @@ _forEachInstanceProperty(_context27 = _Object$keys(_loader)).call(_context27, fu
|
|
305
316
|
});
|
306
317
|
});
|
307
318
|
var _menu = require("./menu");
|
308
|
-
_forEachInstanceProperty(
|
319
|
+
_forEachInstanceProperty(_context29 = _Object$keys(_menu)).call(_context29, function (key) {
|
309
320
|
if (key === "default" || key === "__esModule") return;
|
310
321
|
if (key in exports && exports[key] === _menu[key]) return;
|
311
322
|
_Object$defineProperty(exports, key, {
|
@@ -316,7 +327,7 @@ _forEachInstanceProperty(_context28 = _Object$keys(_menu)).call(_context28, func
|
|
316
327
|
});
|
317
328
|
});
|
318
329
|
var _menuItem = require("./menuItem");
|
319
|
-
_forEachInstanceProperty(
|
330
|
+
_forEachInstanceProperty(_context30 = _Object$keys(_menuItem)).call(_context30, function (key) {
|
320
331
|
if (key === "default" || key === "__esModule") return;
|
321
332
|
if (key in exports && exports[key] === _menuItem[key]) return;
|
322
333
|
_Object$defineProperty(exports, key, {
|
@@ -327,7 +338,7 @@ _forEachInstanceProperty(_context29 = _Object$keys(_menuItem)).call(_context29,
|
|
327
338
|
});
|
328
339
|
});
|
329
340
|
var _messages = require("./messages");
|
330
|
-
_forEachInstanceProperty(
|
341
|
+
_forEachInstanceProperty(_context31 = _Object$keys(_messages)).call(_context31, function (key) {
|
331
342
|
if (key === "default" || key === "__esModule") return;
|
332
343
|
if (key in exports && exports[key] === _messages[key]) return;
|
333
344
|
_Object$defineProperty(exports, key, {
|
@@ -338,7 +349,7 @@ _forEachInstanceProperty(_context30 = _Object$keys(_messages)).call(_context30,
|
|
338
349
|
});
|
339
350
|
});
|
340
351
|
var _Modal = require("./Modal");
|
341
|
-
_forEachInstanceProperty(
|
352
|
+
_forEachInstanceProperty(_context32 = _Object$keys(_Modal)).call(_context32, function (key) {
|
342
353
|
if (key === "default" || key === "__esModule") return;
|
343
354
|
if (key in exports && exports[key] === _Modal[key]) return;
|
344
355
|
_Object$defineProperty(exports, key, {
|
@@ -349,7 +360,7 @@ _forEachInstanceProperty(_context31 = _Object$keys(_Modal)).call(_context31, fun
|
|
349
360
|
});
|
350
361
|
});
|
351
362
|
var _navBar = require("./navBar");
|
352
|
-
_forEachInstanceProperty(
|
363
|
+
_forEachInstanceProperty(_context33 = _Object$keys(_navBar)).call(_context33, function (key) {
|
353
364
|
if (key === "default" || key === "__esModule") return;
|
354
365
|
if (key in exports && exports[key] === _navBar[key]) return;
|
355
366
|
_Object$defineProperty(exports, key, {
|
@@ -360,7 +371,7 @@ _forEachInstanceProperty(_context32 = _Object$keys(_navBar)).call(_context32, fu
|
|
360
371
|
});
|
361
372
|
});
|
362
373
|
var _overlayPanel = require("./overlayPanel");
|
363
|
-
_forEachInstanceProperty(
|
374
|
+
_forEachInstanceProperty(_context34 = _Object$keys(_overlayPanel)).call(_context34, function (key) {
|
364
375
|
if (key === "default" || key === "__esModule") return;
|
365
376
|
if (key in exports && exports[key] === _overlayPanel[key]) return;
|
366
377
|
_Object$defineProperty(exports, key, {
|
@@ -371,7 +382,7 @@ _forEachInstanceProperty(_context33 = _Object$keys(_overlayPanel)).call(_context
|
|
371
382
|
});
|
372
383
|
});
|
373
384
|
var _popoverContainer = require("./popoverContainer");
|
374
|
-
_forEachInstanceProperty(
|
385
|
+
_forEachInstanceProperty(_context35 = _Object$keys(_popoverContainer)).call(_context35, function (key) {
|
375
386
|
if (key === "default" || key === "__esModule") return;
|
376
387
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
377
388
|
_Object$defineProperty(exports, key, {
|
@@ -382,7 +393,7 @@ _forEachInstanceProperty(_context34 = _Object$keys(_popoverContainer)).call(_con
|
|
382
393
|
});
|
383
394
|
});
|
384
395
|
var _popoverMenu = require("./popoverMenu");
|
385
|
-
_forEachInstanceProperty(
|
396
|
+
_forEachInstanceProperty(_context36 = _Object$keys(_popoverMenu)).call(_context36, function (key) {
|
386
397
|
if (key === "default" || key === "__esModule") return;
|
387
398
|
if (key in exports && exports[key] === _popoverMenu[key]) return;
|
388
399
|
_Object$defineProperty(exports, key, {
|
@@ -393,7 +404,7 @@ _forEachInstanceProperty(_context35 = _Object$keys(_popoverMenu)).call(_context3
|
|
393
404
|
});
|
394
405
|
});
|
395
406
|
var _progressBar = require("./progressBar");
|
396
|
-
_forEachInstanceProperty(
|
407
|
+
_forEachInstanceProperty(_context37 = _Object$keys(_progressBar)).call(_context37, function (key) {
|
397
408
|
if (key === "default" || key === "__esModule") return;
|
398
409
|
if (key in exports && exports[key] === _progressBar[key]) return;
|
399
410
|
_Object$defineProperty(exports, key, {
|
@@ -404,7 +415,7 @@ _forEachInstanceProperty(_context36 = _Object$keys(_progressBar)).call(_context3
|
|
404
415
|
});
|
405
416
|
});
|
406
417
|
var _requirementsList = require("./requirementsList");
|
407
|
-
_forEachInstanceProperty(
|
418
|
+
_forEachInstanceProperty(_context38 = _Object$keys(_requirementsList)).call(_context38, function (key) {
|
408
419
|
if (key === "default" || key === "__esModule") return;
|
409
420
|
if (key in exports && exports[key] === _requirementsList[key]) return;
|
410
421
|
_Object$defineProperty(exports, key, {
|
@@ -415,7 +426,7 @@ _forEachInstanceProperty(_context37 = _Object$keys(_requirementsList)).call(_con
|
|
415
426
|
});
|
416
427
|
});
|
417
428
|
var _rockerButtonGroup = require("./rockerButtonGroup");
|
418
|
-
_forEachInstanceProperty(
|
429
|
+
_forEachInstanceProperty(_context39 = _Object$keys(_rockerButtonGroup)).call(_context39, function (key) {
|
419
430
|
if (key === "default" || key === "__esModule") return;
|
420
431
|
if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
|
421
432
|
_Object$defineProperty(exports, key, {
|
@@ -426,7 +437,7 @@ _forEachInstanceProperty(_context38 = _Object$keys(_rockerButtonGroup)).call(_co
|
|
426
437
|
});
|
427
438
|
});
|
428
439
|
var _scrollBox = require("./scrollBox");
|
429
|
-
_forEachInstanceProperty(
|
440
|
+
_forEachInstanceProperty(_context40 = _Object$keys(_scrollBox)).call(_context40, function (key) {
|
430
441
|
if (key === "default" || key === "__esModule") return;
|
431
442
|
if (key in exports && exports[key] === _scrollBox[key]) return;
|
432
443
|
_Object$defineProperty(exports, key, {
|
@@ -437,7 +448,7 @@ _forEachInstanceProperty(_context39 = _Object$keys(_scrollBox)).call(_context39,
|
|
437
448
|
});
|
438
449
|
});
|
439
450
|
var _separator = require("./separator");
|
440
|
-
_forEachInstanceProperty(
|
451
|
+
_forEachInstanceProperty(_context41 = _Object$keys(_separator)).call(_context41, function (key) {
|
441
452
|
if (key === "default" || key === "__esModule") return;
|
442
453
|
if (key in exports && exports[key] === _separator[key]) return;
|
443
454
|
_Object$defineProperty(exports, key, {
|
@@ -448,7 +459,7 @@ _forEachInstanceProperty(_context40 = _Object$keys(_separator)).call(_context40,
|
|
448
459
|
});
|
449
460
|
});
|
450
461
|
var _shared = require("./shared");
|
451
|
-
_forEachInstanceProperty(
|
462
|
+
_forEachInstanceProperty(_context42 = _Object$keys(_shared)).call(_context42, function (key) {
|
452
463
|
if (key === "default" || key === "__esModule") return;
|
453
464
|
if (key in exports && exports[key] === _shared[key]) return;
|
454
465
|
_Object$defineProperty(exports, key, {
|
@@ -459,7 +470,7 @@ _forEachInstanceProperty(_context41 = _Object$keys(_shared)).call(_context41, fu
|
|
459
470
|
});
|
460
471
|
});
|
461
472
|
var _tab = require("./tab");
|
462
|
-
_forEachInstanceProperty(
|
473
|
+
_forEachInstanceProperty(_context43 = _Object$keys(_tab)).call(_context43, function (key) {
|
463
474
|
if (key === "default" || key === "__esModule") return;
|
464
475
|
if (key in exports && exports[key] === _tab[key]) return;
|
465
476
|
_Object$defineProperty(exports, key, {
|
@@ -470,7 +481,7 @@ _forEachInstanceProperty(_context42 = _Object$keys(_tab)).call(_context42, funct
|
|
470
481
|
});
|
471
482
|
});
|
472
483
|
var _table = require("./table");
|
473
|
-
_forEachInstanceProperty(
|
484
|
+
_forEachInstanceProperty(_context44 = _Object$keys(_table)).call(_context44, function (key) {
|
474
485
|
if (key === "default" || key === "__esModule") return;
|
475
486
|
if (key in exports && exports[key] === _table[key]) return;
|
476
487
|
_Object$defineProperty(exports, key, {
|
@@ -481,7 +492,7 @@ _forEachInstanceProperty(_context43 = _Object$keys(_table)).call(_context43, fun
|
|
481
492
|
});
|
482
493
|
});
|
483
494
|
var _tabs = require("./tabs");
|
484
|
-
_forEachInstanceProperty(
|
495
|
+
_forEachInstanceProperty(_context45 = _Object$keys(_tabs)).call(_context45, function (key) {
|
485
496
|
if (key === "default" || key === "__esModule") return;
|
486
497
|
if (key in exports && exports[key] === _tabs[key]) return;
|
487
498
|
_Object$defineProperty(exports, key, {
|
@@ -492,7 +503,7 @@ _forEachInstanceProperty(_context44 = _Object$keys(_tabs)).call(_context44, func
|
|
492
503
|
});
|
493
504
|
});
|
494
505
|
var _text = require("./text");
|
495
|
-
_forEachInstanceProperty(
|
506
|
+
_forEachInstanceProperty(_context46 = _Object$keys(_text)).call(_context46, function (key) {
|
496
507
|
if (key === "default" || key === "__esModule") return;
|
497
508
|
if (key in exports && exports[key] === _text[key]) return;
|
498
509
|
_Object$defineProperty(exports, key, {
|
@@ -503,7 +514,7 @@ _forEachInstanceProperty(_context45 = _Object$keys(_text)).call(_context45, func
|
|
503
514
|
});
|
504
515
|
});
|
505
516
|
var _tooltipTrigger = require("./tooltipTrigger");
|
506
|
-
_forEachInstanceProperty(
|
517
|
+
_forEachInstanceProperty(_context47 = _Object$keys(_tooltipTrigger)).call(_context47, function (key) {
|
507
518
|
if (key === "default" || key === "__esModule") return;
|
508
519
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
509
520
|
_Object$defineProperty(exports, key, {
|
@@ -9,9 +9,6 @@ import MenuUp from '@pingux/mdi-react/MenuUpIcon';
|
|
9
9
|
import { useAccordionItem } from '@react-aria/accordion';
|
10
10
|
import { useFocusRing } from '@react-aria/focus';
|
11
11
|
import { useHover } from '@react-aria/interactions';
|
12
|
-
|
13
|
-
// eslint-disable-next-line import/no-unresolved
|
14
|
-
|
15
12
|
import { Button as ThemeUIButton } from 'theme-ui';
|
16
13
|
import { AccordionContext } from '../../context/AccordionContext';
|
17
14
|
import { useStatusClasses } from '../../hooks';
|
@@ -53,6 +53,10 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
53
|
prevButtonProps = _ref.prevButtonProps,
|
54
54
|
nextButtonProps = _ref.nextButtonProps,
|
55
55
|
title = _ref.title;
|
56
|
+
|
57
|
+
// to remove warning for unknown event handler property `onFocusChange`.
|
58
|
+
delete prevButtonProps.onFocusChange;
|
59
|
+
delete nextButtonProps.onFocusChange;
|
56
60
|
var _useState = useState(null),
|
57
61
|
_useState2 = _slicedToArray(_useState, 2),
|
58
62
|
yearChangeDirection = _useState2[0],
|
@@ -25,7 +25,7 @@ These keys provide additional functionality to the component.
|
|
25
25
|
| Tab | Components in the calendar are focusable and follow the page tab sequence. |
|
26
26
|
| Shift + Tab | Moves focus to the previous focusable component. |
|
27
27
|
| Pressing Home:(Fn + Right Arrow Key) Or Control or Command + Home | Shifts the focus to the first calendar date. |
|
28
|
-
| Pressing
|
28
|
+
| Pressing End:(Fn + left Arrow Key) Or Control or Command + End | Shifts the focus to the last calendar date. |
|
29
29
|
| Arrow key | Navigates up, down, right, and left across the calendar. |
|
30
30
|
| Page up | Changes the grid of dates to the previous month. |
|
31
31
|
| Page down | Changes the grid of dates to the next month. |
|
@@ -209,15 +209,12 @@ test('allows users to select and navigate through calendar items', function () {
|
|
209
209
|
});
|
210
210
|
test('readonly calendar', function () {
|
211
211
|
getComponent({
|
212
|
-
isReadOnly: true
|
213
|
-
defaultValue: '2022-08-10'
|
212
|
+
isReadOnly: true
|
214
213
|
});
|
215
214
|
expect(screen.queryByRole('grid')).toHaveAttribute('aria-readonly', 'true');
|
216
215
|
var dateButtons = screen.queryAllByRole('button');
|
217
216
|
userEvent.click(dateButtons[4]);
|
218
217
|
expect(dateButtons[4]).not.toHaveClass('is-selected');
|
219
|
-
expect(dateButtons[4]).toHaveFocus();
|
220
|
-
expect(dateButtons[4]).toHaveAttribute('tabindex', '0');
|
221
218
|
});
|
222
219
|
test('disabled calendar date', function () {
|
223
220
|
getComponent({
|
@@ -49,7 +49,7 @@ var CalendarCell = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
49
49
|
setFocused(false);
|
50
50
|
focusNextPage();
|
51
51
|
}
|
52
|
-
}, [
|
52
|
+
}, [focusNextPage, focusPreviousPage, formattedDate, state, setFocused, cellRef]);
|
53
53
|
var _useHover = useHover({}),
|
54
54
|
hoverProps = _useHover.hoverProps,
|
55
55
|
isHovered = _useHover.isHovered;
|
@@ -619,12 +619,6 @@ test('dateField should handle autofocus when deleting segments from middle', fun
|
|
619
619
|
key: 'Backspace'
|
620
620
|
});
|
621
621
|
}
|
622
|
-
fireEvent.keyDown(year, {
|
623
|
-
key: 'Backspace'
|
624
|
-
});
|
625
|
-
fireEvent.keyUp(year, {
|
626
|
-
key: 'Backspace'
|
627
|
-
});
|
628
622
|
expect(day).toHaveFocus();
|
629
623
|
expect(hiddenInput).toHaveValue('');
|
630
624
|
});
|
@@ -664,6 +658,68 @@ test('segment focus should move to the year if month is already empty', function
|
|
664
658
|
}
|
665
659
|
expect(year).toHaveFocus();
|
666
660
|
});
|
661
|
+
test('segment focus stay on year if all are empty for year segment', function () {
|
662
|
+
getComponent({
|
663
|
+
defaultValue: ''
|
664
|
+
});
|
665
|
+
var hiddenInput = screen.queryByTestId('date-field');
|
666
|
+
var inputButtons = screen.queryAllByRole('spinbutton');
|
667
|
+
var year = inputButtons[0];
|
668
|
+
expect(hiddenInput).toHaveValue('');
|
669
|
+
act(function () {
|
670
|
+
year.focus();
|
671
|
+
});
|
672
|
+
expect(year).toHaveFocus();
|
673
|
+
fireEvent.keyDown(year, {
|
674
|
+
key: 'Backspace'
|
675
|
+
});
|
676
|
+
fireEvent.keyUp(year, {
|
677
|
+
key: 'Backspace'
|
678
|
+
});
|
679
|
+
expect(year).toHaveFocus();
|
680
|
+
});
|
681
|
+
test('segment focus should move to previous if all are empty for month segment', function () {
|
682
|
+
getComponent({
|
683
|
+
defaultValue: ''
|
684
|
+
});
|
685
|
+
var hiddenInput = screen.queryByTestId('date-field');
|
686
|
+
var inputButtons = screen.queryAllByRole('spinbutton');
|
687
|
+
var month = inputButtons[1];
|
688
|
+
var year = inputButtons[0];
|
689
|
+
expect(hiddenInput).toHaveValue('');
|
690
|
+
act(function () {
|
691
|
+
month.focus();
|
692
|
+
});
|
693
|
+
expect(month).toHaveFocus();
|
694
|
+
fireEvent.keyDown(month, {
|
695
|
+
key: 'Backspace'
|
696
|
+
});
|
697
|
+
fireEvent.keyUp(month, {
|
698
|
+
key: 'Backspace'
|
699
|
+
});
|
700
|
+
expect(year).toHaveFocus();
|
701
|
+
});
|
702
|
+
test('segment focus should move to previous if all are empty for day segment', function () {
|
703
|
+
getComponent({
|
704
|
+
defaultValue: ''
|
705
|
+
});
|
706
|
+
var hiddenInput = screen.queryByTestId('date-field');
|
707
|
+
var inputButtons = screen.queryAllByRole('spinbutton');
|
708
|
+
var day = inputButtons[2];
|
709
|
+
var month = inputButtons[1];
|
710
|
+
expect(hiddenInput).toHaveValue('');
|
711
|
+
act(function () {
|
712
|
+
day.focus();
|
713
|
+
});
|
714
|
+
expect(day).toHaveFocus();
|
715
|
+
fireEvent.keyDown(day, {
|
716
|
+
key: 'Backspace'
|
717
|
+
});
|
718
|
+
fireEvent.keyUp(day, {
|
719
|
+
key: 'Backspace'
|
720
|
+
});
|
721
|
+
expect(month).toHaveFocus();
|
722
|
+
});
|
667
723
|
test('should add the correct number of padded 0 to year, month and day', function () {
|
668
724
|
getComponent({
|
669
725
|
defaultValue: '0009-08-02'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import React from 'react';
|
3
|
+
import { Grid as ThemeUIGrid } from 'theme-ui';
|
4
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
|
+
export var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
6
|
+
return ___EmotionJSX(ThemeUIGrid, _extends({
|
7
|
+
ref: ref
|
8
|
+
}, props));
|
9
|
+
});
|
10
|
+
Grid.defaultProps = {
|
11
|
+
repeat: 'fit'
|
12
|
+
};
|
13
|
+
Grid.displayName = 'Grid';
|
14
|
+
export default Grid;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
<Meta title="Components/Grid/Grid" />
|
4
|
+
|
5
|
+
# Grid
|
6
|
+
|
7
|
+
A responsive layout utility component which utilizes [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout) to position child elements in a variety of ways. Great for providing mobile-first UI layouts.
|
8
|
+
|
9
|
+
Uses the [responsive values](https://theme-ui.com/sx-prop#responsive-values) array syntax and the [Grid from Theme-UI](https://theme-ui.com/components/grid/).
|
10
|
+
|
11
|
+
### Required Components
|
12
|
+
|
13
|
+
`Grid` should be used to position other components, but there are none that are specifically required. `Box` is used for demonstration below.
|