@autoguru/overdrive 4.37.0 → 4.38.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.
- package/dist/components/Box/argTypes.d.ts +1 -1
- package/dist/components/Box/argTypes.d.ts.map +1 -1
- package/dist/components/BulletText/BulletText.d.ts +1 -1
- package/dist/components/BulletText/BulletText.d.ts.map +1 -1
- package/dist/components/BulletText/BulletText.js +2 -1
- package/dist/components/DateTimePicker/CalendarButton.d.ts +4 -0
- package/dist/components/DateTimePicker/CalendarButton.d.ts.map +1 -0
- package/dist/components/DateTimePicker/CalendarButton.js +47 -0
- package/dist/components/DateTimePicker/CalendarGrid.d.ts +9 -0
- package/dist/components/DateTimePicker/CalendarGrid.d.ts.map +1 -0
- package/dist/components/DateTimePicker/CalendarGrid.js +87 -0
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +10 -0
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.css.js +60 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +26 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +165 -0
- package/dist/components/OptionGrid/OptionGrid.css.d.ts +29 -5
- package/dist/components/OptionGrid/OptionGrid.css.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.css.js +55 -40
- package/dist/components/OptionGrid/OptionGrid.d.ts +2 -2
- package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.js +76 -73
- package/dist/components/OrderedList/OrderedList.js +2 -2
- package/dist/components/Radio/RadioGroup.d.ts +1 -2
- package/dist/components/Radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/Radio/RadioGroup.js +1 -2
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js +4 -3
- package/dist/components/StickyBox/StickyBox.js +1 -1
- package/dist/components/Text/useTextStyles.d.ts +1 -1
- package/dist/components/Text/useTextStyles.d.ts.map +1 -1
- package/dist/hooks/useMedia/useMedia.js +2 -2
- package/dist/styles/sprinkles.css.d.ts +5 -5
- package/dist/styles/sprinkles.css.d.ts.map +1 -1
- package/dist/styles/sprinkles.css.js +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -3
- package/package.json +11 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArgTypes } from '@storybook/react';
|
|
2
|
-
import { ComponentProps } from 'react';
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
3
|
import { Tokens } from '../../themes/tokens';
|
|
4
4
|
import { Box } from './Box';
|
|
5
5
|
export declare const scaleOptions: Array<keyof Tokens['space']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argTypes.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/argTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"argTypes.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/argTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAWrD,CAAC;AAoCF,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,CA0ErE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { BoxStyleProps } from '../Box';
|
|
3
|
-
export interface Props extends Partial<Pick<BoxStyleProps, 'is'>> {
|
|
3
|
+
export interface Props extends Partial<Pick<BoxStyleProps, 'as' | 'is'>> {
|
|
4
4
|
bullet?: ReactNode;
|
|
5
5
|
variant?: 'primary' | 'secondary';
|
|
6
6
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAO,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,MAAM,WAAW,KAAM,SAAQ,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAO,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,MAAM,WAAW,KAAM,SAAQ,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;IACvE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,KAAK,CA2C/C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarButton.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/CalendarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAK7D,eAAO,MAAM,cAAc,UAAW,eAAe,sBA8BpD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import React, { useRef } from 'react';
|
|
7
|
+
import { useButton } from 'react-aria';
|
|
8
|
+
import { focusOutline } from "../../styles/focusOutline.css.js";
|
|
9
|
+
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export const CalendarButton = props => {
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
const {
|
|
14
|
+
buttonProps
|
|
15
|
+
} = useButton(props, ref);
|
|
16
|
+
return _jsx("button", _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
17
|
+
className: odStyle(_objectSpread({
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
background: {
|
|
20
|
+
initial: 'white',
|
|
21
|
+
hover: 'gray200',
|
|
22
|
+
disabled: 'white'
|
|
23
|
+
},
|
|
24
|
+
borderColor: {
|
|
25
|
+
initial: 'gray',
|
|
26
|
+
disabled: 'light'
|
|
27
|
+
},
|
|
28
|
+
borderRadius: '2',
|
|
29
|
+
borderStyle: 'solid',
|
|
30
|
+
borderWidth: '1',
|
|
31
|
+
color: {
|
|
32
|
+
initial: 'gray600',
|
|
33
|
+
disabled: 'gray300'
|
|
34
|
+
},
|
|
35
|
+
cursor: {
|
|
36
|
+
hover: 'pointer',
|
|
37
|
+
disabled: 'default'
|
|
38
|
+
},
|
|
39
|
+
display: 'flex',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
padding: 'none',
|
|
42
|
+
size: '7'
|
|
43
|
+
}, focusOutline)),
|
|
44
|
+
ref: ref,
|
|
45
|
+
children: props.children
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AriaCalendarGridProps } from 'react-aria';
|
|
3
|
+
import type { CalendarState } from 'react-stately';
|
|
4
|
+
interface CalendarGridProps extends AriaCalendarGridProps {
|
|
5
|
+
state: CalendarState;
|
|
6
|
+
}
|
|
7
|
+
export declare const CalendarGrid: ({ state, ...props }: CalendarGridProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=CalendarGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/CalendarGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAKN,KAAK,qBAAqB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAgDnD,UAAU,iBAAkB,SAAQ,qBAAqB;IACxD,KAAK,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,wBAAyB,iBAAiB,sBAgDlE,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
const _excluded = ["state"];
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
import { getWeeksInMonth } from '@internationalized/date';
|
|
10
|
+
import React, { useRef } from 'react';
|
|
11
|
+
import { useCalendarCell, useCalendarGrid, useLocale } from 'react-aria';
|
|
12
|
+
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
13
|
+
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
14
|
+
import { calendarGridStyle, styledCell } from "./DateTimePicker.css.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const CalendarCell = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
state,
|
|
19
|
+
date
|
|
20
|
+
} = _ref;
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
const {
|
|
23
|
+
cellProps,
|
|
24
|
+
buttonProps,
|
|
25
|
+
isSelected,
|
|
26
|
+
isOutsideVisibleRange,
|
|
27
|
+
isDisabled,
|
|
28
|
+
isUnavailable,
|
|
29
|
+
formattedDate
|
|
30
|
+
} = useCalendarCell({
|
|
31
|
+
date
|
|
32
|
+
}, state, ref);
|
|
33
|
+
return _jsx("td", _objectSpread(_objectSpread({}, cellProps), {}, {
|
|
34
|
+
className: odStyle({
|
|
35
|
+
padding: '1',
|
|
36
|
+
textAlign: 'center'
|
|
37
|
+
}),
|
|
38
|
+
children: _jsx("div", _objectSpread(_objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
39
|
+
ref: ref,
|
|
40
|
+
hidden: isOutsideVisibleRange,
|
|
41
|
+
className: styledCell()
|
|
42
|
+
}, dataAttrs({
|
|
43
|
+
selected: isSelected,
|
|
44
|
+
disabled: isDisabled,
|
|
45
|
+
unvailable: isUnavailable
|
|
46
|
+
})), {}, {
|
|
47
|
+
children: formattedDate
|
|
48
|
+
}))
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
export const CalendarGrid = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
state
|
|
54
|
+
} = _ref2,
|
|
55
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
56
|
+
const {
|
|
57
|
+
locale
|
|
58
|
+
} = useLocale();
|
|
59
|
+
const {
|
|
60
|
+
gridProps,
|
|
61
|
+
headerProps,
|
|
62
|
+
weekDays
|
|
63
|
+
} = useCalendarGrid(props, state);
|
|
64
|
+
const weeksInMonth = getWeeksInMonth(state.visibleRange.start, locale, props.firstDayOfWeek);
|
|
65
|
+
return _jsxs("table", _objectSpread(_objectSpread({}, gridProps), {}, {
|
|
66
|
+
className: calendarGridStyle,
|
|
67
|
+
children: [_jsx("thead", _objectSpread(_objectSpread({}, headerProps), {}, {
|
|
68
|
+
children: _jsx("tr", {
|
|
69
|
+
children: weekDays.map((day, index) => _jsx("th", {
|
|
70
|
+
className: odStyle({
|
|
71
|
+
color: 'gray600'
|
|
72
|
+
}),
|
|
73
|
+
children: day
|
|
74
|
+
}, index))
|
|
75
|
+
})
|
|
76
|
+
})), _jsx("tbody", {
|
|
77
|
+
children: _toConsumableArray(Array.from({
|
|
78
|
+
length: weeksInMonth
|
|
79
|
+
}).keys()).map(weekIndex => _jsx("tr", {
|
|
80
|
+
children: state.getDatesInWeek(weekIndex).map((date, i) => date ? _jsx(CalendarCell, {
|
|
81
|
+
state: state,
|
|
82
|
+
date: date
|
|
83
|
+
}, i) : _jsx("td", {}, i))
|
|
84
|
+
}, weekIndex))
|
|
85
|
+
})]
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const queryContainer: string;
|
|
2
|
+
export declare const queryContainerStyle: string;
|
|
3
|
+
export declare const layoutStyle: string;
|
|
4
|
+
export declare const calendarGridStyle: string;
|
|
5
|
+
export declare const styledCell: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
6
|
+
[x: string]: {
|
|
7
|
+
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=DateTimePicker.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/DateTimePicker.css.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,mBAAmB,QAG9B,CAAC;AAEH,eAAO,MAAM,WAAW,QAOtB,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAO5B,CAAC;AAGH,eAAO,MAAM,UAAU;;;;EA2BrB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/DateTimePicker/DateTimePicker.css.ts", "@autoguru/overdrive");
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import { createContainer, style } from '@vanilla-extract/css';
|
|
9
|
+
import { recipe } from '@vanilla-extract/recipes';
|
|
10
|
+
import { focusOutline } from "../../styles/focusOutline.css.js";
|
|
11
|
+
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
12
|
+
import { tokens } from "../../themes/base/tokens.js";
|
|
13
|
+
import { breakpoints } from "../../themes/makeTheme.js";
|
|
14
|
+
export const queryContainer = createContainer("queryContainer");
|
|
15
|
+
export const queryContainerStyle = style({
|
|
16
|
+
containerName: queryContainer,
|
|
17
|
+
containerType: 'inline-size'
|
|
18
|
+
}, "queryContainerStyle");
|
|
19
|
+
export const layoutStyle = style({
|
|
20
|
+
'@container': {
|
|
21
|
+
[`${queryContainer} (min-width: ${breakpoints.tablet})`]: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
gap: tokens.space[7]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, "layoutStyle");
|
|
27
|
+
export const calendarGridStyle = style({
|
|
28
|
+
width: '100%',
|
|
29
|
+
'@container': {
|
|
30
|
+
[`${queryContainer} (min-width: ${breakpoints.tablet})`]: {
|
|
31
|
+
width: 'auto'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, "calendarGridStyle");
|
|
35
|
+
export const styledCell = recipe({
|
|
36
|
+
base: [odStyle(_objectSpread({
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
background: {
|
|
39
|
+
initial: 'white',
|
|
40
|
+
hover: 'gray200',
|
|
41
|
+
selected: 'gray900',
|
|
42
|
+
disabled: 'white'
|
|
43
|
+
},
|
|
44
|
+
borderRadius: '2',
|
|
45
|
+
color: {
|
|
46
|
+
initial: 'gray900',
|
|
47
|
+
selected: 'white',
|
|
48
|
+
disabled: 'gray400'
|
|
49
|
+
},
|
|
50
|
+
cursor: {
|
|
51
|
+
initial: 'pointer',
|
|
52
|
+
disabled: 'default'
|
|
53
|
+
},
|
|
54
|
+
display: 'inline-flex',
|
|
55
|
+
fontSize: 'md',
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
size: '7'
|
|
58
|
+
}, focusOutline))]
|
|
59
|
+
}, "styledCell");
|
|
60
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AriaCalendarProps, type DateValue } from 'react-aria';
|
|
3
|
+
import type { WithTestId } from '../../types';
|
|
4
|
+
import { type OptionGridProps, type OptionItem } from '../OptionGrid/OptionGrid';
|
|
5
|
+
declare const defaultEnglish: {
|
|
6
|
+
readonly dateLabel: "Date";
|
|
7
|
+
readonly timeLabel: "Time";
|
|
8
|
+
readonly nextLabel: "Next month";
|
|
9
|
+
readonly prevLabel: "Previous month";
|
|
10
|
+
};
|
|
11
|
+
type LangContent = keyof typeof defaultEnglish;
|
|
12
|
+
export type DateAndOption = {
|
|
13
|
+
date: DateValue;
|
|
14
|
+
timeOption: string;
|
|
15
|
+
};
|
|
16
|
+
export interface DateTimePickerProps<D extends DateValue> {
|
|
17
|
+
title?: string;
|
|
18
|
+
calendar?: Exclude<AriaCalendarProps<D>, 'onChange'>;
|
|
19
|
+
timeOptions: OptionGridProps<OptionItem>;
|
|
20
|
+
allowPastDate?: boolean;
|
|
21
|
+
onChange?: (value: DateAndOption) => void;
|
|
22
|
+
lang?: Partial<Record<LangContent, string>>;
|
|
23
|
+
}
|
|
24
|
+
export declare const DateTimePicker: <D extends DateValue>({ allowPastDate, calendar, lang, onChange, timeOptions, title, testId, }: WithTestId<DateTimePickerProps<D>>) => React.JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=DateTimePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/DateTimePicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAKN,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,MAAM,0BAA0B,CAAC;AAMlC,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,SAAS;IAIvD,KAAK,CAAC,EAAE,MAAM,CAAC;IASf,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAKrD,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IAIzC,aAAa,CAAC,EAAE,OAAO,CAAC;IAOxB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAI1C,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AA4BD,eAAO,MAAM,cAAc,0JA4J1B,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@autoguru/icons';
|
|
7
|
+
import { getLocalTimeZone, GregorianCalendar, today } from '@internationalized/date';
|
|
8
|
+
import React, { useEffect, useRef } from 'react';
|
|
9
|
+
import { useCalendar, useLocale, useId } from 'react-aria';
|
|
10
|
+
import { useCalendarState } from 'react-stately';
|
|
11
|
+
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
12
|
+
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
13
|
+
import { Icon } from "../Icon/index.js";
|
|
14
|
+
import { OptionGrid } from "../OptionGrid/OptionGrid.js";
|
|
15
|
+
import { CalendarButton } from "./CalendarButton.js";
|
|
16
|
+
import { CalendarGrid } from "./CalendarGrid.js";
|
|
17
|
+
import { layoutStyle, queryContainerStyle } from "./DateTimePicker.css.js";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const defaultEnglish = {
|
|
20
|
+
dateLabel: 'Date',
|
|
21
|
+
timeLabel: 'Time',
|
|
22
|
+
nextLabel: 'Next month',
|
|
23
|
+
prevLabel: 'Previous month'
|
|
24
|
+
};
|
|
25
|
+
function createCalendar(identifier) {
|
|
26
|
+
if (identifier === 'gregory') {
|
|
27
|
+
return new GregorianCalendar();
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Unsupported calendar configured ${identifier}`);
|
|
30
|
+
}
|
|
31
|
+
export const DateTimePicker = _ref => {
|
|
32
|
+
var _lang$dateLabel, _lang$prevLabel, _lang$nextLabel, _lang$timeLabel;
|
|
33
|
+
let {
|
|
34
|
+
allowPastDate = false,
|
|
35
|
+
calendar,
|
|
36
|
+
lang,
|
|
37
|
+
onChange,
|
|
38
|
+
timeOptions,
|
|
39
|
+
title,
|
|
40
|
+
testId
|
|
41
|
+
} = _ref;
|
|
42
|
+
const selectedDate = useRef(null);
|
|
43
|
+
const selectedTimeOption = useRef(null);
|
|
44
|
+
const handleChange = () => {
|
|
45
|
+
var _selectedTimeOption$c;
|
|
46
|
+
if (selectedDate.current && (_selectedTimeOption$c = selectedTimeOption.current) !== null && _selectedTimeOption$c !== void 0 && _selectedTimeOption$c.length) {
|
|
47
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
48
|
+
date: selectedDate.current,
|
|
49
|
+
timeOption: selectedTimeOption.current
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const handleTimeChange = keys => {
|
|
54
|
+
if (keys === 'all') return;
|
|
55
|
+
const time = keys.values().next().value;
|
|
56
|
+
selectedTimeOption.current = time;
|
|
57
|
+
handleChange();
|
|
58
|
+
};
|
|
59
|
+
const calendarComponentProps = _objectSpread({
|
|
60
|
+
defaultValue: today(getLocalTimeZone()),
|
|
61
|
+
firstDayOfWeek: 'sun',
|
|
62
|
+
minValue: allowPastDate ? undefined : today(getLocalTimeZone()),
|
|
63
|
+
onChange: value => {
|
|
64
|
+
selectedDate.current = value;
|
|
65
|
+
handleChange();
|
|
66
|
+
}
|
|
67
|
+
}, calendar);
|
|
68
|
+
const optionGridComponentProps = _objectSpread({
|
|
69
|
+
columns: '3',
|
|
70
|
+
onSelectionChange: handleTimeChange,
|
|
71
|
+
indicator: 'none',
|
|
72
|
+
selectionMode: 'single',
|
|
73
|
+
disallowEmptySelection: true
|
|
74
|
+
}, timeOptions);
|
|
75
|
+
const {
|
|
76
|
+
locale
|
|
77
|
+
} = useLocale();
|
|
78
|
+
const state = useCalendarState(_objectSpread(_objectSpread({}, calendarComponentProps), {}, {
|
|
79
|
+
locale,
|
|
80
|
+
createCalendar
|
|
81
|
+
}));
|
|
82
|
+
const {
|
|
83
|
+
calendarProps,
|
|
84
|
+
prevButtonProps,
|
|
85
|
+
nextButtonProps,
|
|
86
|
+
title: calendarTitle
|
|
87
|
+
} = useCalendar(calendarComponentProps, state);
|
|
88
|
+
const titleId = useId();
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (state.value) {
|
|
91
|
+
selectedDate.current = state.value;
|
|
92
|
+
}
|
|
93
|
+
}, []);
|
|
94
|
+
return _jsxs("div", _objectSpread(_objectSpread({
|
|
95
|
+
role: "group",
|
|
96
|
+
"aria-labelledby": titleId,
|
|
97
|
+
className: queryContainerStyle
|
|
98
|
+
}, dataAttrs({
|
|
99
|
+
'test-id': testId
|
|
100
|
+
})), {}, {
|
|
101
|
+
children: [title && _jsx("h2", {
|
|
102
|
+
id: titleId,
|
|
103
|
+
className: odStyle({
|
|
104
|
+
font: '2xl',
|
|
105
|
+
fontWeight: 'bold'
|
|
106
|
+
}),
|
|
107
|
+
children: title
|
|
108
|
+
}), _jsxs("div", {
|
|
109
|
+
className: layoutStyle,
|
|
110
|
+
children: [_jsxs("div", {
|
|
111
|
+
className: odStyle({
|
|
112
|
+
flexShrink: 0
|
|
113
|
+
}),
|
|
114
|
+
children: [_jsx("h3", {
|
|
115
|
+
className: odStyle({
|
|
116
|
+
font: 'xl',
|
|
117
|
+
fontWeight: 'bold'
|
|
118
|
+
}),
|
|
119
|
+
children: (_lang$dateLabel = lang === null || lang === void 0 ? void 0 : lang.dateLabel) !== null && _lang$dateLabel !== void 0 ? _lang$dateLabel : defaultEnglish.dateLabel
|
|
120
|
+
}), _jsxs("div", _objectSpread(_objectSpread({}, calendarProps), {}, {
|
|
121
|
+
className: odStyle({
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
display: 'flex',
|
|
124
|
+
justifyContent: 'space-between',
|
|
125
|
+
marginBottom: '2',
|
|
126
|
+
paddingX: '1'
|
|
127
|
+
}),
|
|
128
|
+
children: [_jsx(CalendarButton, _objectSpread(_objectSpread({}, prevButtonProps), {}, {
|
|
129
|
+
"aria-label": (_lang$prevLabel = lang === null || lang === void 0 ? void 0 : lang.prevLabel) !== null && _lang$prevLabel !== void 0 ? _lang$prevLabel : defaultEnglish.prevLabel,
|
|
130
|
+
children: _jsx(Icon, {
|
|
131
|
+
icon: ChevronLeftIcon,
|
|
132
|
+
size: "medium"
|
|
133
|
+
})
|
|
134
|
+
})), _jsx("h4", {
|
|
135
|
+
className: odStyle({
|
|
136
|
+
fontWeight: 'bold',
|
|
137
|
+
margin: 'none'
|
|
138
|
+
}),
|
|
139
|
+
children: calendarTitle
|
|
140
|
+
}), _jsx(CalendarButton, _objectSpread(_objectSpread({}, nextButtonProps), {}, {
|
|
141
|
+
"aria-label": (_lang$nextLabel = lang === null || lang === void 0 ? void 0 : lang.nextLabel) !== null && _lang$nextLabel !== void 0 ? _lang$nextLabel : defaultEnglish.nextLabel,
|
|
142
|
+
children: _jsx(Icon, {
|
|
143
|
+
icon: ChevronRightIcon,
|
|
144
|
+
size: "medium"
|
|
145
|
+
})
|
|
146
|
+
}))]
|
|
147
|
+
})), _jsx(CalendarGrid, {
|
|
148
|
+
state: state,
|
|
149
|
+
firstDayOfWeek: calendarComponentProps.firstDayOfWeek
|
|
150
|
+
})]
|
|
151
|
+
}), _jsxs("div", {
|
|
152
|
+
className: odStyle({
|
|
153
|
+
flexGrow: 1
|
|
154
|
+
}),
|
|
155
|
+
children: [_jsx("h3", {
|
|
156
|
+
className: odStyle({
|
|
157
|
+
font: 'xl',
|
|
158
|
+
fontWeight: 'bold'
|
|
159
|
+
}),
|
|
160
|
+
children: (_lang$timeLabel = lang === null || lang === void 0 ? void 0 : lang.timeLabel) !== null && _lang$timeLabel !== void 0 ? _lang$timeLabel : defaultEnglish.timeLabel
|
|
161
|
+
}), _jsx(OptionGrid, _objectSpread({}, optionGridComponentProps))]
|
|
162
|
+
})]
|
|
163
|
+
})]
|
|
164
|
+
}));
|
|
165
|
+
};
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
import { type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const gridContainer: string;
|
|
3
|
+
export declare const gridContainerStyle: string;
|
|
4
|
+
export declare const styledGrid: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
3
5
|
columns: {
|
|
4
6
|
'1': {};
|
|
5
|
-
'2':
|
|
6
|
-
|
|
7
|
+
'2': {
|
|
8
|
+
'@container': {
|
|
9
|
+
[x: string]: {
|
|
10
|
+
gridTemplateColumns: "repeat(2, 1fr)";
|
|
11
|
+
} | {
|
|
12
|
+
gridTemplateColumns: "repeat(3, 1fr)";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
'3': {
|
|
17
|
+
'@container': {
|
|
18
|
+
[x: string]: {
|
|
19
|
+
gridTemplateColumns: "repeat(2, 1fr)";
|
|
20
|
+
} | {
|
|
21
|
+
gridTemplateColumns: "repeat(3, 1fr)";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
7
25
|
'4': string;
|
|
8
|
-
'5': string
|
|
26
|
+
'5': (string | {
|
|
27
|
+
'@container': {
|
|
28
|
+
[x: string]: {
|
|
29
|
+
gridTemplateColumns: "repeat(5, 1fr)";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
})[];
|
|
9
33
|
};
|
|
10
34
|
}>;
|
|
11
|
-
export type
|
|
35
|
+
export type StyledGridProps = NonNullable<RecipeVariants<typeof styledGrid>>;
|
|
12
36
|
export declare const styledGridItem: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
13
37
|
[x: string]: {
|
|
14
38
|
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionGrid.css.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionGrid.css.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQvE,eAAO,MAAM,aAAa,QAAoB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,QAG7B,CAAC;AAuBH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CrB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAyB7E,eAAO,MAAM,cAAc;;;;EAkCzB,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAC5C,cAAc,CAAC,OAAO,cAAc,CAAC,CACrC,CAAC;AAGF,eAAO,MAAM,cAAc,QAGzB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;EA2BzB,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAC5C,cAAc,CAAC,OAAO,cAAc,CAAC,CACrC,CAAC;AAwBF,eAAO,MAAM,iBAAiB;;;;EAoB5B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAC/C,cAAc,CAAC,OAAO,iBAAiB,CAAC,CACxC,CAAC"}
|
|
@@ -5,65 +5,80 @@ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
|
5
5
|
__vanilla_filescope__.setFileScope("lib/components/OptionGrid/OptionGrid.css.ts", "@autoguru/overdrive");
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import { style } from '@vanilla-extract/css';
|
|
8
|
+
import { createContainer, style } from '@vanilla-extract/css';
|
|
9
9
|
import { recipe } from '@vanilla-extract/recipes';
|
|
10
10
|
import { focusOutline } from "../../styles/focusOutline.css.js";
|
|
11
11
|
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
12
12
|
import { tokens } from "../../themes/base/tokens.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import { breakpoints } from "../../themes/makeTheme.js";
|
|
14
|
+
export const gridContainer = createContainer("gridContainer");
|
|
15
|
+
export const gridContainerStyle = style({
|
|
16
|
+
containerName: gridContainer,
|
|
17
|
+
containerType: 'inline-size'
|
|
18
|
+
}, "gridContainerStyle");
|
|
19
|
+
const minWidth1200 = '(min-width: 1200px)';
|
|
20
|
+
const repeat2Col = 'repeat(2, 1fr)';
|
|
21
|
+
const repeat3Col = 'repeat(3, 1fr)';
|
|
22
|
+
const repeat4Col = 'repeat(4, 1fr)';
|
|
23
|
+
const repeat5Col = 'repeat(5, 1fr)';
|
|
24
|
+
const grid4ColStyle = style({
|
|
25
|
+
'@container': {
|
|
26
|
+
[`${gridContainer} (min-width: ${breakpoints.mobile})`]: {
|
|
27
|
+
gridTemplateColumns: repeat2Col
|
|
28
|
+
},
|
|
29
|
+
[`${gridContainer} (min-width: ${breakpoints.tablet})`]: {
|
|
30
|
+
gridTemplateColumns: repeat3Col
|
|
17
31
|
},
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
[`${gridContainer} (min-width: ${breakpoints.desktop})`]: {
|
|
33
|
+
gridTemplateColumns: repeat4Col
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, "grid4ColStyle");
|
|
37
|
+
export const styledGrid = recipe({
|
|
38
|
+
base: odStyle({
|
|
39
|
+
display: 'grid',
|
|
40
|
+
gridColumns: {
|
|
41
|
+
mobile: '1'
|
|
20
42
|
},
|
|
21
43
|
gap: '3'
|
|
22
44
|
}),
|
|
23
45
|
variants: {
|
|
24
46
|
columns: {
|
|
25
47
|
'1': {},
|
|
26
|
-
'2':
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'3': odStyle({
|
|
35
|
-
display: {
|
|
36
|
-
tablet: 'grid'
|
|
37
|
-
},
|
|
38
|
-
gridColumns: {
|
|
39
|
-
tablet: '2',
|
|
40
|
-
desktop: '3'
|
|
48
|
+
'2': {
|
|
49
|
+
'@container': {
|
|
50
|
+
[`${gridContainer} (min-width: 640px)`]: {
|
|
51
|
+
gridTemplateColumns: repeat2Col
|
|
52
|
+
},
|
|
53
|
+
[`${gridContainer} ${minWidth1200}`]: {
|
|
54
|
+
gridTemplateColumns: repeat3Col
|
|
55
|
+
}
|
|
41
56
|
}
|
|
42
|
-
}
|
|
43
|
-
'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
},
|
|
58
|
+
'3': {
|
|
59
|
+
'@container': {
|
|
60
|
+
[`${gridContainer} (min-width: 550px)`]: {
|
|
61
|
+
gridTemplateColumns: repeat2Col
|
|
62
|
+
},
|
|
63
|
+
[`${gridContainer} (min-width: ${breakpoints.desktop})`]: {
|
|
64
|
+
gridTemplateColumns: repeat3Col
|
|
65
|
+
}
|
|
50
66
|
}
|
|
51
|
-
}
|
|
52
|
-
'
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
desktop: '5'
|
|
67
|
+
},
|
|
68
|
+
'4': grid4ColStyle,
|
|
69
|
+
'5': [grid4ColStyle, {
|
|
70
|
+
'@container': {
|
|
71
|
+
[`${gridContainer} ${minWidth1200}`]: {
|
|
72
|
+
gridTemplateColumns: repeat5Col
|
|
73
|
+
}
|
|
59
74
|
}
|
|
60
|
-
}
|
|
75
|
+
}]
|
|
61
76
|
}
|
|
62
77
|
},
|
|
63
78
|
defaultVariants: {
|
|
64
79
|
columns: '2'
|
|
65
80
|
}
|
|
66
|
-
}, "
|
|
81
|
+
}, "styledGrid");
|
|
67
82
|
const optionTransition = style({
|
|
68
83
|
transition: 'background 80ms ease-in'
|
|
69
84
|
}, "optionTransition");
|
|
@@ -3,7 +3,7 @@ import { type ListBoxProps } from 'react-aria-components';
|
|
|
3
3
|
import { type SelectionMode } from 'react-stately';
|
|
4
4
|
import type { WithTestId } from '../../types';
|
|
5
5
|
import { type IconEl } from '../Icon';
|
|
6
|
-
import { type
|
|
6
|
+
import { type StyledGridProps } from './OptionGrid.css';
|
|
7
7
|
export interface OptionItem {
|
|
8
8
|
name: string;
|
|
9
9
|
label: string;
|
|
@@ -16,7 +16,7 @@ export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'> {
|
|
|
16
16
|
items: OptionItem[];
|
|
17
17
|
indicator?: 'none' | 'checkbox' | 'radio';
|
|
18
18
|
selectionMode?: SelectionMode;
|
|
19
|
-
columns?:
|
|
19
|
+
columns?: StyledGridProps['columns'];
|
|
20
20
|
}
|
|
21
21
|
export declare const OptionGrid: ({ className, columns, indicator, label, layout, selectionMode, testId, ...props }: WithTestId<OptionGridProps<OptionItem>>) => React.JSX.Element;
|
|
22
22
|
//# sourceMappingURL=OptionGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,
|
|
1
|
+
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAON,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,eAAe,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IAIzE,KAAK,EAAE,MAAM,CAAC;IAId,KAAK,EAAE,UAAU,EAAE,CAAC;IAIpB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAI1C,aAAa,CAAC,EAAE,aAAa,CAAC;IAI9B,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC;AAgBD,eAAO,MAAM,UAAU,sFASpB,WAAW,gBAAgB,UAAU,CAAC,CAAC,sBAmFzC,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { ListBox, ListBoxItem, Text } from 'react-aria-components';
|
|
|
12
12
|
import { odStyle } from "../../styles/sprinkles.css.js";
|
|
13
13
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
14
14
|
import { Icon } from "../Icon/index.js";
|
|
15
|
-
import { styledCheckbox,
|
|
15
|
+
import { gridContainerStyle, styledCheckbox, styledGrid, styledGridItem, styledRadioButton, styleIndicator } from "./OptionGrid.css.js";
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
17
|
export const OptionGrid = _ref => {
|
|
18
18
|
let {
|
|
@@ -25,77 +25,80 @@ export const OptionGrid = _ref => {
|
|
|
25
25
|
testId
|
|
26
26
|
} = _ref,
|
|
27
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
return _jsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children: _jsx(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
28
|
+
return _jsx("div", {
|
|
29
|
+
className: gridContainerStyle,
|
|
30
|
+
children: _jsx(ListBox, _objectSpread(_objectSpread(_objectSpread({
|
|
31
|
+
"aria-label": label,
|
|
32
|
+
layout: layout,
|
|
33
|
+
selectionMode: selectionMode,
|
|
34
|
+
className: clsx([styledGrid({
|
|
35
|
+
columns
|
|
36
|
+
}), className])
|
|
37
|
+
}, dataAttrs({
|
|
38
|
+
'test-id': testId
|
|
39
|
+
})), props), {}, {
|
|
40
|
+
children: _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
description,
|
|
43
|
+
icon,
|
|
44
|
+
label,
|
|
45
|
+
name
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return _jsx(ListBoxItem, {
|
|
48
|
+
className: styledGridItem(),
|
|
49
|
+
id: name,
|
|
50
|
+
textValue: label,
|
|
51
|
+
children: _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
isFocusVisible,
|
|
54
|
+
isHovered,
|
|
55
|
+
isSelected
|
|
56
|
+
} = _ref3;
|
|
57
|
+
const hasIndicator = indicator !== 'none';
|
|
58
|
+
const hasNoInteraction = !isFocusVisible && !isHovered && !isSelected;
|
|
59
|
+
const IndicatorIcon = () => {
|
|
60
|
+
if (icon && hasNoInteraction) return _jsx(Icon, {
|
|
61
|
+
icon: icon,
|
|
62
|
+
size: "100%"
|
|
63
|
+
});
|
|
64
|
+
const styledIndicator = indicator === 'radio' ? styledRadioButton : styledCheckbox;
|
|
65
|
+
return _jsx("div", _objectSpread(_objectSpread({
|
|
66
|
+
className: styledIndicator()
|
|
67
|
+
}, dataAttrs({
|
|
68
|
+
'focus-visible': isFocusVisible,
|
|
69
|
+
hover: isHovered,
|
|
70
|
+
selected: isSelected
|
|
71
|
+
})), {}, {
|
|
72
|
+
children: indicator === 'checkbox' && _jsx(Icon, {
|
|
73
|
+
icon: CheckIcon
|
|
74
|
+
})
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
return _jsxs(_Fragment, {
|
|
78
|
+
children: [hasIndicator && _jsx("div", {
|
|
79
|
+
className: styleIndicator,
|
|
80
|
+
children: _jsx(IndicatorIcon, {})
|
|
81
|
+
}), _jsxs("div", {
|
|
82
|
+
children: [_jsx(Text, {
|
|
83
|
+
slot: "label",
|
|
84
|
+
elementType: "div",
|
|
85
|
+
className: odStyle({
|
|
86
|
+
fontSize: 'md'
|
|
87
|
+
}),
|
|
88
|
+
children: label
|
|
89
|
+
}), description && _jsx(Text, {
|
|
90
|
+
slot: "description",
|
|
91
|
+
elementType: "div",
|
|
92
|
+
className: odStyle({
|
|
93
|
+
fontSize: 'xs'
|
|
94
|
+
}),
|
|
95
|
+
children: description
|
|
96
|
+
})]
|
|
94
97
|
})]
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
})
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}))
|
|
103
|
+
});
|
|
101
104
|
};
|
|
@@ -25,7 +25,7 @@ export const OrderedList = _ref => {
|
|
|
25
25
|
myCycle = type === null ? cycle + 1 : cycles.indexOf(type);
|
|
26
26
|
}
|
|
27
27
|
return _jsx(Box, {
|
|
28
|
-
|
|
28
|
+
as: "ol",
|
|
29
29
|
paddingLeft: "6",
|
|
30
30
|
marginTop: myCycle > 0 ? '2' : 'none',
|
|
31
31
|
className: clsx(styles.root.default, useTextStyles({
|
|
@@ -52,7 +52,7 @@ const Item = _ref2 => {
|
|
|
52
52
|
children
|
|
53
53
|
} = _ref2;
|
|
54
54
|
return _jsx(Box, {
|
|
55
|
-
|
|
55
|
+
as: "li",
|
|
56
56
|
className: className,
|
|
57
57
|
children: children
|
|
58
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../lib/components/Radio/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../lib/components/Radio/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKb,KAAK,SAAS,EACd,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,UAAU,iBAAiB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IAEd,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,yCAAgD,CAAC;AAE1E,eAAO,MAAM,eAAe,QAAO,iBACT,CAAC;AAE3B,eAAO,MAAM,UAAU,8EAuBtB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
3
|
+
import React, { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
5
4
|
import { Box } from "../Box/index.js";
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
export const RadioContext = createContext(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import type { BoxStyleProps } from '../Box';
|
|
3
3
|
import * as styles from './Stack.css';
|
|
4
|
-
export interface Props extends Pick<BoxStyleProps, 'is' | 'width' | 'alignItems'> {
|
|
4
|
+
export interface Props extends Pick<BoxStyleProps, 'as' | 'is' | 'width' | 'alignItems'> {
|
|
5
5
|
space?: keyof typeof styles.child.spaces;
|
|
6
6
|
className?: string;
|
|
7
7
|
dividers?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../lib/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAI5C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,OAAO,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../lib/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAI5C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,YAAY,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CAClC;AAOD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CA2C1C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -13,6 +13,7 @@ export const Stack = _ref => {
|
|
|
13
13
|
space = '2',
|
|
14
14
|
children,
|
|
15
15
|
is = 'div',
|
|
16
|
+
as = is,
|
|
16
17
|
alignItems,
|
|
17
18
|
width,
|
|
18
19
|
dividers = false,
|
|
@@ -25,13 +26,13 @@ export const Stack = _ref => {
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
let listItem = 'div';
|
|
28
|
-
if (typeof
|
|
29
|
+
if (typeof as === 'string') listItem = supportedListTypes.includes(as) ? 'li' : 'div';
|
|
29
30
|
return _jsx(Box, {
|
|
30
|
-
|
|
31
|
+
as: as,
|
|
31
32
|
className: className,
|
|
32
33
|
width: width,
|
|
33
34
|
children: Children.map(items, (child, idx) => _jsxs(Box, {
|
|
34
|
-
|
|
35
|
+
as: listItem,
|
|
35
36
|
display: alignItems ? 'flex' : void 0,
|
|
36
37
|
flexDirection: "column",
|
|
37
38
|
alignItems: alignItems,
|
|
@@ -28,7 +28,7 @@ export const StickyBox = _ref => {
|
|
|
28
28
|
const [withShadow, setWithShadow] = useState(false);
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
var _containerRef$current;
|
|
31
|
-
if (!((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.parentElement) || !
|
|
31
|
+
if (!((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.parentElement) || !window) return void 0;
|
|
32
32
|
const parentElement = containerRef.current.parentElement;
|
|
33
33
|
const onScroll = () => {
|
|
34
34
|
setWithShadow(parentElement.scrollTop > 3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextStyles.d.ts","sourceRoot":"","sources":["../../../lib/components/Text/useTextStyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useTextStyles.d.ts","sourceRoot":"","sources":["../../../lib/components/Text/useTextStyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,MAAM,WAAW,cAAc;IAE9B,KAAK,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,UAAU,CAAC;IAC5C,EAAE,CAAC,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,SAAS,CAAC;CAC1C;AAED,eAAO,MAAM,aAAa,2EASvB,cAAc,WAWhB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -11,12 +11,12 @@ export const useMedia = function (queries) {
|
|
|
11
11
|
} = useRuntimeTokens();
|
|
12
12
|
if (!isBrowser) return queries.map(() => fallbackCase);
|
|
13
13
|
const getQueries = useCallback(() => queries.map(media => `(min-width: ${breakpoints[media]})`), [breakpoints]);
|
|
14
|
-
const matchesInit = useMemo(() => getQueries().map(query =>
|
|
14
|
+
const matchesInit = useMemo(() => getQueries().map(query => window.matchMedia(query).matches), [getQueries]);
|
|
15
15
|
const [matches, setMatches] = useState(matchesInit);
|
|
16
16
|
if (isBrowser) {
|
|
17
17
|
useLayoutEffect(() => {
|
|
18
18
|
let isMounted = true;
|
|
19
|
-
const matchers = getQueries().map(query =>
|
|
19
|
+
const matchers = getQueries().map(query => window.matchMedia(query));
|
|
20
20
|
const removeHandlersFn = matchers.map((matcher, idx) => {
|
|
21
21
|
const handler = e => {
|
|
22
22
|
if (!isMounted) return;
|
|
@@ -152,11 +152,11 @@ export declare const odStyle: ((props: {
|
|
|
152
152
|
selected?: "1" | "2" | "3" | "4" | "5" | "none" | undefined;
|
|
153
153
|
} | undefined;
|
|
154
154
|
} & {
|
|
155
|
-
display?: "none" | "flex" | "grid" | "block" | {
|
|
156
|
-
mobile?: "none" | "flex" | "grid" | "block" | undefined;
|
|
157
|
-
tablet?: "none" | "flex" | "grid" | "block" | undefined;
|
|
158
|
-
desktop?: "none" | "flex" | "grid" | "block" | undefined;
|
|
159
|
-
largeDesktop?: "none" | "flex" | "grid" | "block" | undefined;
|
|
155
|
+
display?: "none" | "flex" | "grid" | "block" | "inline-block" | "inline-flex" | {
|
|
156
|
+
mobile?: "none" | "flex" | "grid" | "block" | "inline-block" | "inline-flex" | undefined;
|
|
157
|
+
tablet?: "none" | "flex" | "grid" | "block" | "inline-block" | "inline-flex" | undefined;
|
|
158
|
+
desktop?: "none" | "flex" | "grid" | "block" | "inline-block" | "inline-flex" | undefined;
|
|
159
|
+
largeDesktop?: "none" | "flex" | "grid" | "block" | "inline-block" | "inline-flex" | undefined;
|
|
160
160
|
} | undefined;
|
|
161
161
|
flexDirection?: "column" | "row" | {
|
|
162
162
|
mobile?: "column" | "row" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprinkles.css.d.ts","sourceRoot":"","sources":["../../lib/styles/sprinkles.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sprinkles.css.d.ts","sourceRoot":"","sources":["../../lib/styles/sprinkles.css.ts"],"names":[],"mappings":"AA8MA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -153,13 +153,13 @@ const displayProperties = defineProperties({
|
|
|
153
153
|
conditions: _objectSpread({}, responsiveConditions),
|
|
154
154
|
defaultCondition: 'mobile',
|
|
155
155
|
properties: {
|
|
156
|
-
display: ['none', 'block', 'flex', 'grid'],
|
|
156
|
+
display: ['none', 'block', 'flex', 'grid', 'inline-block', 'inline-flex'],
|
|
157
157
|
flexDirection: ['row', 'column'],
|
|
158
158
|
flexGrow: [0, 1],
|
|
159
159
|
flexShrink: [0, 1],
|
|
160
160
|
flexWrap: ['nowrap', 'wrap', 'wrap-reverse'],
|
|
161
161
|
gridTemplateColumns: {
|
|
162
|
-
'1': '
|
|
162
|
+
'1': '1fr',
|
|
163
163
|
'2': 'repeat(2, 1fr)',
|
|
164
164
|
'3': 'repeat(3, 1fr)',
|
|
165
165
|
'4': 'repeat(4, 1fr)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAGN,eAAe,EAGf,MAAM,OAAO,CAAC;AAEf,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAGN,eAAe,EAGf,MAAM,OAAO,CAAC;AAEf,eAAO,MAAM,SAAS,SAAgC,CAAC;AAEvD,eAAO,MAAM,sBAAsB,wBAA0C,CAAC;AAE9E,eAAO,MAAM,oBAAoB,0DAEP,IAAI,oCACT,IAAI,CAOxB,CAAC;AAGF,eAAO,MAAM,uBAAuB,sEAenC,CAAC;AAaF,eAAO,MAAM,KAAK,iBAAkB,MAAM,KAAG,MAAM,GAAG,IAmBrD,CAAC;AAEF,eAAO,MAAM,MAAM,oCAMlB,CAAC;AAOF,wBAAgB,SAAS,CAAC,CAAC,EAC1B,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GACpC,WAAW,CAAC,CAAC,CAAC,CAUhB;AAED,eAAO,MAAM,aAAa,YAAa,GAAG,uBACoB,CAAC;AAE/D,eAAO,MAAM,QAAQ,oCAKsB,CAAC;AAE5C,eAAO,MAAM,aAAa,UAAW,IAAI,KAAG,QACZ,CAAC;AAEjC,eAAO,MAAM,WAAW,UAAW,IAAI,KAAG,MACC,CAAC;AAS5C,eAAO,MAAM,gBAAgB,8DAO5B,CAAC;AAMF,eAAO,MAAM,OAAO,6DAGf,MAAM,wBAER,CAAC,MAAM,IAAI,CAAC,GAAG,IA8BjB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AACpD,eAAO,MAAM,wBAAwB,UAAW,SAAS,uCAKT,CAAC;AAYjD,eAAO,MAAM,eAAe,0EAK3B,CAAC;AAGF,eAAO,MAAM,IAAI,YAAW,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
export const isBrowser = typeof
|
|
4
|
+
export const isBrowser = typeof window !== 'undefined';
|
|
5
5
|
export const isomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
6
6
|
export const useUncontrolledState = (value, onChange) => {
|
|
7
7
|
if (typeof onChange === 'function') {
|
|
@@ -62,8 +62,7 @@ export const hex2rgba = function (c) {
|
|
|
62
62
|
export const ownerDocument = node => (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;
|
|
63
63
|
export const ownerWindow = node => {
|
|
64
64
|
var _ownerDocument;
|
|
65
|
-
return ((
|
|
66
|
-
);
|
|
65
|
+
return ((_ownerDocument = ownerDocument(node)) === null || _ownerDocument === void 0 ? void 0 : _ownerDocument.defaultView) || window;
|
|
67
66
|
};
|
|
68
67
|
export const useEventCallback = fn => {
|
|
69
68
|
const ref = useRef(fn);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.0",
|
|
4
4
|
"description": "Overdrive is a product component library, and design system for AutoGuru.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"@babel/runtime-corejs3": "^7.26.7",
|
|
85
85
|
"@changesets/cli": "^2.27.12",
|
|
86
86
|
"@chromatic-com/storybook": "^3.2.4",
|
|
87
|
+
"@internationalized/date": "^3.7.0",
|
|
87
88
|
"@octokit/rest": "^21.1.0",
|
|
88
89
|
"@popperjs/core": "^2.11.8",
|
|
89
90
|
"@react-stately/toggle": "^3.8.1",
|
|
@@ -107,17 +108,17 @@
|
|
|
107
108
|
"@types/react-dom": "^19.0.3",
|
|
108
109
|
"@types/webpack-env": "^1.18.8",
|
|
109
110
|
"@vanilla-extract/babel-plugin": "^1.2.0",
|
|
110
|
-
"@vanilla-extract/css": "^1.17.
|
|
111
|
+
"@vanilla-extract/css": "^1.17.1",
|
|
111
112
|
"@vanilla-extract/dynamic": "^2.1.2",
|
|
112
113
|
"@vanilla-extract/recipes": "^0.5.5",
|
|
113
114
|
"@vanilla-extract/sprinkles": "^1.6.3",
|
|
114
|
-
"@vanilla-extract/vite-plugin": "^
|
|
115
|
-
"@vanilla-extract/webpack-plugin": "^2.3.
|
|
115
|
+
"@vanilla-extract/vite-plugin": "^5.0.0",
|
|
116
|
+
"@vanilla-extract/webpack-plugin": "^2.3.17",
|
|
116
117
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
117
118
|
"babel-plugin-dev-expression": "^0.2.3",
|
|
118
119
|
"babel-plugin-macros": "^3.1.0",
|
|
119
120
|
"browserslist-config-autoguru": "^2.4.0",
|
|
120
|
-
"chromatic": "^11.25.
|
|
121
|
+
"chromatic": "^11.25.2",
|
|
121
122
|
"clsx": "^2.1.1",
|
|
122
123
|
"colord": "^2.9.3",
|
|
123
124
|
"concurrently": "^9.1.2",
|
|
@@ -125,7 +126,7 @@
|
|
|
125
126
|
"csstype": "^3.1.3",
|
|
126
127
|
"deepmerge": "^4.3.1",
|
|
127
128
|
"eslint": "^8.57.1",
|
|
128
|
-
"eslint-plugin-jest": "28.
|
|
129
|
+
"eslint-plugin-jest": "28.11.0",
|
|
129
130
|
"eslint-plugin-storybook": "^0.11.2",
|
|
130
131
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
131
132
|
"intersection-observer": "^0.12.2",
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
"react-aria": "^3.37.0",
|
|
142
143
|
"react-aria-components": "^1.6.0",
|
|
143
144
|
"react-dom": "^19.0.0",
|
|
144
|
-
"react-focus-lock": "2.13.
|
|
145
|
+
"react-focus-lock": "2.13.6",
|
|
145
146
|
"react-intersection-observer": "^9.15.1",
|
|
146
147
|
"react-keyed-flatten-children": "^2.2.1",
|
|
147
148
|
"react-stately": "^3.35.0",
|
|
@@ -157,6 +158,7 @@
|
|
|
157
158
|
"peerDependencies": {
|
|
158
159
|
"@autoguru/icons": "^1.7.28",
|
|
159
160
|
"@autoguru/utilities": "^1.0.98",
|
|
161
|
+
"@internationalized/date": "^3.7.0",
|
|
160
162
|
"@popperjs/core": "^2.10.2",
|
|
161
163
|
"@vanilla-extract/dynamic": "^2.1.2",
|
|
162
164
|
"clsx": "^1.1.1",
|
|
@@ -164,6 +166,7 @@
|
|
|
164
166
|
"csstype": "^3.1.3",
|
|
165
167
|
"react": ">=18 || >=19.0.0-rc.0",
|
|
166
168
|
"react-aria": "^3.36.0",
|
|
169
|
+
"react-aria-components": "^1.6.0",
|
|
167
170
|
"react-dom": ">=18 || >=19.0.0-rc.0",
|
|
168
171
|
"react-focus-lock": "^2.5.0",
|
|
169
172
|
"react-intersection-observer": ">=9.4.3",
|
|
@@ -178,7 +181,7 @@
|
|
|
178
181
|
"@joshwooding/vite-plugin-react-docgen-typescript": "0.5.0"
|
|
179
182
|
},
|
|
180
183
|
"volta": {
|
|
181
|
-
"node": "20.18.
|
|
184
|
+
"node": "20.18.2",
|
|
182
185
|
"yarn": "4.6.0"
|
|
183
186
|
},
|
|
184
187
|
"packageManager": "yarn@4.6.0"
|