@autoguru/overdrive 4.46.0 → 4.47.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/dist/components/Calendar/Calendar.css.d.ts +8 -0
- package/dist/components/Calendar/Calendar.css.d.ts.map +1 -0
- package/dist/components/Calendar/Calendar.css.js +113 -0
- package/dist/components/Calendar/Calendar.d.ts +69 -0
- package/dist/components/Calendar/Calendar.d.ts.map +1 -0
- package/dist/components/Calendar/Calendar.js +129 -0
- package/dist/components/Calendar/CalendarButton.d.ts +7 -0
- package/dist/components/Calendar/CalendarButton.d.ts.map +1 -0
- package/dist/components/{DateTimePicker → Calendar}/CalendarButton.js +3 -2
- package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.d.ts +4 -1
- package/dist/components/Calendar/CalendarGrid.d.ts.map +1 -0
- package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.js +7 -6
- package/dist/components/Calendar/index.d.ts +3 -0
- package/dist/components/Calendar/index.d.ts.map +1 -0
- package/dist/components/Calendar/index.js +3 -0
- package/dist/components/DatePicker/DatePicker.css.d.ts +2 -1
- package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.css.js +60 -30
- package/dist/components/DatePicker/DatePicker.d.ts +106 -5
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +188 -44
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +0 -7
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.css.js +0 -110
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +5 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +24 -80
- package/dist/components/OptionList/OptionList.d.ts +5 -5
- package/dist/components/Popover/Popover.css.d.ts +4 -0
- package/dist/components/Popover/Popover.css.d.ts.map +1 -0
- package/dist/components/Popover/Popover.css.js +46 -0
- package/dist/components/Popover/Popover.d.ts +34 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +127 -0
- package/dist/components/Popover/PopoverTrigger.d.ts +51 -0
- package/dist/components/Popover/PopoverTrigger.d.ts.map +1 -0
- package/dist/components/Popover/PopoverTrigger.js +94 -0
- package/dist/components/Popover/index.d.ts +5 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +4 -0
- package/dist/components/Slider/Slider.css.d.ts +9 -0
- package/dist/components/Slider/Slider.css.d.ts.map +1 -0
- package/dist/components/Slider/Slider.css.js +92 -0
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -0
- package/dist/components/Slider/Slider.js +141 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/Slider/index.js +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/styles/selectors.d.ts +2 -1
- package/dist/styles/selectors.d.ts.map +1 -1
- package/dist/styles/selectors.js +2 -1
- package/dist/utils/dateFormat.d.ts +24 -0
- package/dist/utils/dateFormat.d.ts.map +1 -0
- package/dist/utils/dateFormat.js +57 -0
- package/package.json +18 -18
- package/dist/components/DateTimePicker/CalendarButton.d.ts +0 -4
- package/dist/components/DateTimePicker/CalendarButton.d.ts.map +0 -1
- package/dist/components/DateTimePicker/CalendarGrid.d.ts.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
__vanilla_filescope__.setFileScope("lib/components/Slider/Slider.css.ts", "@autoguru/overdrive");
|
|
5
|
+
import { style } from '@vanilla-extract/css';
|
|
6
|
+
import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
7
|
+
import { cssLayerComponent } from "../../styles/layers.css.js";
|
|
8
|
+
import { selectors } from "../../styles/selectors.js";
|
|
9
|
+
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
10
|
+
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
11
|
+
export const container = sprinkles({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
gap: '3',
|
|
15
|
+
width: 'full'
|
|
16
|
+
});
|
|
17
|
+
export const label = sprinkles({
|
|
18
|
+
fontSize: '6',
|
|
19
|
+
fontWeight: 'semiBold',
|
|
20
|
+
color: 'normal'
|
|
21
|
+
});
|
|
22
|
+
export const valueDisplay = sprinkles({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
marginBottom: '3'
|
|
26
|
+
});
|
|
27
|
+
export const valueText = sprinkles({
|
|
28
|
+
fontSize: '7',
|
|
29
|
+
fontWeight: 'semiBold',
|
|
30
|
+
color: 'normal'
|
|
31
|
+
});
|
|
32
|
+
export const sliderContainer = sprinkles({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: '4',
|
|
36
|
+
width: 'full'
|
|
37
|
+
});
|
|
38
|
+
export const trackContainer = sprinkles({
|
|
39
|
+
position: 'relative',
|
|
40
|
+
width: 'full',
|
|
41
|
+
display: 'flex'
|
|
42
|
+
});
|
|
43
|
+
export const track = style([sprinkles({
|
|
44
|
+
borderRadius: 'pill',
|
|
45
|
+
height: '1',
|
|
46
|
+
position: 'relative',
|
|
47
|
+
width: 'full'
|
|
48
|
+
}), {
|
|
49
|
+
'@layer': {
|
|
50
|
+
[cssLayerComponent]: {
|
|
51
|
+
backgroundColor: vars.colours.gamut.gray300,
|
|
52
|
+
selectors: {
|
|
53
|
+
[selectors.disabled]: {
|
|
54
|
+
backgroundColor: vars.colours.gamut.gray200,
|
|
55
|
+
cursor: 'not-allowed'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}], "track");
|
|
61
|
+
export const thumb = style([sprinkles({
|
|
62
|
+
borderRadius: 'full',
|
|
63
|
+
borderWidth: 'none',
|
|
64
|
+
size: '5'
|
|
65
|
+
}), {
|
|
66
|
+
'@layer': {
|
|
67
|
+
[cssLayerComponent]: {
|
|
68
|
+
backgroundColor: vars.colours.gamut.black900,
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
top: '50%',
|
|
72
|
+
transform: 'translate(-50%, -50%)',
|
|
73
|
+
transition: `box-shadow 0.2s ${vars.animation.easing.standard}`,
|
|
74
|
+
selectors: {
|
|
75
|
+
[selectors.hover]: {
|
|
76
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.1)`
|
|
77
|
+
},
|
|
78
|
+
[selectors.focusVisible]: {
|
|
79
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.2)`
|
|
80
|
+
},
|
|
81
|
+
'&[data-dragging]': {
|
|
82
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.2)`
|
|
83
|
+
},
|
|
84
|
+
[selectors.disabled]: {
|
|
85
|
+
backgroundColor: vars.colours.gamut.gray500,
|
|
86
|
+
cursor: 'not-allowed'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, focusOutlineStyle], "thumb");
|
|
92
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AriaSliderProps, type AriaSliderThumbProps } from 'react-aria';
|
|
3
|
+
import type { TestIdProp } from '../../types';
|
|
4
|
+
export interface SliderProps extends AriaSliderProps, Pick<AriaSliderThumbProps, 'name'>, TestIdProp {
|
|
5
|
+
/**
|
|
6
|
+
* Label for the slider. Can be a string or custom child element.
|
|
7
|
+
*/
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Unit text to display with the value (e.g., 'kms', 'miles', '%')
|
|
11
|
+
*/
|
|
12
|
+
unitText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Step value for slider increments
|
|
15
|
+
* @default 5
|
|
16
|
+
*/
|
|
17
|
+
step?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Formatting options for the value displayed in the slider
|
|
20
|
+
*/
|
|
21
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A slider component that allows users to select a value from a range,
|
|
25
|
+
* supports configurable step values and value unit post-fix. Use the `onChange` handler
|
|
26
|
+
* in most instances for retrieving the current value.
|
|
27
|
+
*
|
|
28
|
+
* Supports flexible label approach:
|
|
29
|
+
* - Pre-styled label `label="Distance"`
|
|
30
|
+
* - Custom label content: `label={<label className={customlabelStyles}>Distance</label>}`
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Slider
|
|
34
|
+
* label="Distance"
|
|
35
|
+
* value={distance}
|
|
36
|
+
* onChange={handleOnChange}
|
|
37
|
+
* minValue={0}
|
|
38
|
+
* maxValue={100}
|
|
39
|
+
* step={5}
|
|
40
|
+
* unitText="kms"
|
|
41
|
+
* />;
|
|
42
|
+
*/
|
|
43
|
+
export declare const Slider: {
|
|
44
|
+
({ formatOptions, label, step, testId, unitText, ...props }: SliderProps): React.JSX.Element;
|
|
45
|
+
displayName: string;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=Slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../lib/components/Slider/Slider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,EAMN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,MAAM,WAAW,WAChB,SAAQ,eAAe,EACtB,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAClC,UAAU;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACzC;AAqCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM;iEAOhB,WAAW;;CAqEb,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
const _excluded = ["formatOptions", "label", "step", "testId", "unitText"];
|
|
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 { MinusIcon, PlusIcon } from '@autoguru/icons';
|
|
9
|
+
import React, { isValidElement } from 'react';
|
|
10
|
+
import { mergeProps, useFocusRing, useNumberFormatter, useSlider, useSliderThumb } from 'react-aria';
|
|
11
|
+
import { useSliderState } from 'react-stately';
|
|
12
|
+
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
13
|
+
import { Box } from "../Box/index.js";
|
|
14
|
+
import { Icon } from "../Icon/index.js";
|
|
15
|
+
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
16
|
+
import * as styles from "./Slider.css.js";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const SliderThumb = ({
|
|
19
|
+
state,
|
|
20
|
+
trackRef,
|
|
21
|
+
index,
|
|
22
|
+
name
|
|
23
|
+
}) => {
|
|
24
|
+
const inputRef = React.useRef(null);
|
|
25
|
+
const {
|
|
26
|
+
thumbProps,
|
|
27
|
+
inputProps,
|
|
28
|
+
isDisabled,
|
|
29
|
+
isDragging
|
|
30
|
+
} = useSliderThumb({
|
|
31
|
+
index,
|
|
32
|
+
trackRef,
|
|
33
|
+
inputRef,
|
|
34
|
+
name
|
|
35
|
+
}, state);
|
|
36
|
+
const {
|
|
37
|
+
isFocusVisible,
|
|
38
|
+
focusProps
|
|
39
|
+
} = useFocusRing();
|
|
40
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread(_objectSpread({}, thumbProps), {}, {
|
|
41
|
+
className: styles.thumb
|
|
42
|
+
}, dataAttrs({
|
|
43
|
+
'focus-visible': isFocusVisible,
|
|
44
|
+
dragging: isDragging,
|
|
45
|
+
disabled: isDisabled
|
|
46
|
+
})), {}, {
|
|
47
|
+
children: /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
48
|
+
children: /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, mergeProps(inputProps, focusProps)), {}, {
|
|
49
|
+
ref: inputRef
|
|
50
|
+
}))
|
|
51
|
+
})
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A slider component that allows users to select a value from a range,
|
|
57
|
+
* supports configurable step values and value unit post-fix. Use the `onChange` handler
|
|
58
|
+
* in most instances for retrieving the current value.
|
|
59
|
+
*
|
|
60
|
+
* Supports flexible label approach:
|
|
61
|
+
* - Pre-styled label `label="Distance"`
|
|
62
|
+
* - Custom label content: `label={<label className={customlabelStyles}>Distance</label>}`
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <Slider
|
|
66
|
+
* label="Distance"
|
|
67
|
+
* value={distance}
|
|
68
|
+
* onChange={handleOnChange}
|
|
69
|
+
* minValue={0}
|
|
70
|
+
* maxValue={100}
|
|
71
|
+
* step={5}
|
|
72
|
+
* unitText="kms"
|
|
73
|
+
* />;
|
|
74
|
+
*/
|
|
75
|
+
export const Slider = _ref => {
|
|
76
|
+
let {
|
|
77
|
+
formatOptions,
|
|
78
|
+
label,
|
|
79
|
+
step = 5,
|
|
80
|
+
testId,
|
|
81
|
+
unitText
|
|
82
|
+
} = _ref,
|
|
83
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
84
|
+
const trackRef = React.useRef(null);
|
|
85
|
+
const numberFormatter = useNumberFormatter(formatOptions);
|
|
86
|
+
const hasTextLabel = !!label && typeof label === 'string' && label !== '';
|
|
87
|
+
const hasCustomLabel = !hasTextLabel && /*#__PURE__*/isValidElement(label);
|
|
88
|
+
const state = useSliderState(_objectSpread(_objectSpread({}, props), {}, {
|
|
89
|
+
step,
|
|
90
|
+
numberFormatter
|
|
91
|
+
}));
|
|
92
|
+
const {
|
|
93
|
+
groupProps,
|
|
94
|
+
trackProps,
|
|
95
|
+
labelProps,
|
|
96
|
+
outputProps
|
|
97
|
+
} = useSlider(_objectSpread(_objectSpread({}, props), {}, {
|
|
98
|
+
label,
|
|
99
|
+
step
|
|
100
|
+
}), state, trackRef);
|
|
101
|
+
return /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread({}, groupProps), {}, {
|
|
102
|
+
className: styles.container,
|
|
103
|
+
odComponent: "slider",
|
|
104
|
+
testId: testId,
|
|
105
|
+
children: [hasTextLabel && /*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
106
|
+
className: styles.label,
|
|
107
|
+
children: label
|
|
108
|
+
})), hasCustomLabel && /*#__PURE__*/React.cloneElement(label, _objectSpread({}, labelProps)), /*#__PURE__*/_jsx("div", {
|
|
109
|
+
className: styles.valueDisplay,
|
|
110
|
+
children: /*#__PURE__*/_jsxs("output", _objectSpread(_objectSpread({}, outputProps), {}, {
|
|
111
|
+
className: styles.valueText,
|
|
112
|
+
children: [state.getThumbValueLabel(0), unitText]
|
|
113
|
+
}))
|
|
114
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
115
|
+
className: styles.sliderContainer,
|
|
116
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
117
|
+
icon: MinusIcon,
|
|
118
|
+
size: "medium"
|
|
119
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
120
|
+
className: styles.trackContainer,
|
|
121
|
+
children: /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread(_objectSpread({}, trackProps), {}, {
|
|
122
|
+
ref: trackRef,
|
|
123
|
+
className: styles.track
|
|
124
|
+
}, dataAttrs({
|
|
125
|
+
disabled: props.isDisabled
|
|
126
|
+
})), {}, {
|
|
127
|
+
children: /*#__PURE__*/_jsx(SliderThumb, {
|
|
128
|
+
index: 0,
|
|
129
|
+
state: state,
|
|
130
|
+
trackRef: trackRef,
|
|
131
|
+
name: props.name
|
|
132
|
+
})
|
|
133
|
+
}))
|
|
134
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
135
|
+
icon: PlusIcon,
|
|
136
|
+
size: "medium"
|
|
137
|
+
})]
|
|
138
|
+
})]
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
Slider.displayName = 'Slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -44,6 +44,7 @@ export * from './ScrollPane';
|
|
|
44
44
|
export * from './Section';
|
|
45
45
|
export * from './SelectInput';
|
|
46
46
|
export * from './SimplePagination';
|
|
47
|
+
export * from './Slider';
|
|
47
48
|
export * from './SliderProgress';
|
|
48
49
|
export * from './Stack';
|
|
49
50
|
export * from './StandardModal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CA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
CHANGED
|
@@ -46,6 +46,7 @@ export * from "./ScrollPane/index.js";
|
|
|
46
46
|
export * from "./Section/index.js";
|
|
47
47
|
export * from "./SelectInput/index.js";
|
|
48
48
|
export * from "./SimplePagination/index.js";
|
|
49
|
+
export * from "./Slider/index.js";
|
|
49
50
|
export * from "./SliderProgress/index.js";
|
|
50
51
|
export * from "./Stack/index.js";
|
|
51
52
|
export * from "./StandardModal/index.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare const selectors: {
|
|
2
2
|
readonly active: "&:active";
|
|
3
3
|
readonly checked: "&:checked, &[data-checked], &[data-selected]";
|
|
4
|
-
readonly disabled: "&:disabled, &[data-disabled]";
|
|
4
|
+
readonly disabled: "&:disabled, &[data-disabled], &[aria-disabled=\"true\"]";
|
|
5
5
|
readonly focus: "&:focus, &[data-focus], &[data-focused]";
|
|
6
6
|
readonly focusVisible: "&:focus-visible, &[data-focus-visible]";
|
|
7
7
|
readonly selected: "&[data-selected], &[aria-selected=\"true\"]";
|
|
8
|
+
readonly unavailable: "&[data-unavailable]";
|
|
8
9
|
readonly hover: string;
|
|
9
10
|
readonly hoverNotDisabled: string;
|
|
10
11
|
readonly hoverNotSelected: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../lib/styles/selectors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../lib/styles/selectors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS;;;;;;;;;;;;CAoBZ,CAAC"}
|
package/dist/styles/selectors.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
export const selectors = {
|
|
8
8
|
active: '&:active',
|
|
9
9
|
checked: '&:checked, &[data-checked], &[data-selected]',
|
|
10
|
-
disabled: '&:disabled, &[data-disabled]',
|
|
10
|
+
disabled: '&:disabled, &[data-disabled], &[aria-disabled="true"]',
|
|
11
11
|
focus: '&:focus, &[data-focus], &[data-focused]',
|
|
12
12
|
focusVisible: '&:focus-visible, &[data-focus-visible]',
|
|
13
13
|
selected: '&[data-selected], &[aria-selected="true"]',
|
|
14
|
+
unavailable: '&[data-unavailable]',
|
|
14
15
|
get hover() {
|
|
15
16
|
return `&:hover:not(${this.disabled}), &[data-hover]:not(${this.disabled})`;
|
|
16
17
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DateValue } from '@internationalized/date';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a given DateValue represents today's date
|
|
4
|
+
* @param dateValue
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
export declare function isToday(date: DateValue | string | null | undefined): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a date value or ISO date string for display, with special handling for "today"
|
|
10
|
+
*
|
|
11
|
+
* @param date - DateValue, ISO date string, or null/undefined
|
|
12
|
+
* @param format - Intl date formatting style (default: 'medium')
|
|
13
|
+
* @param locales - Locales for formatting (default: 'en-AU')
|
|
14
|
+
* @returns Formatted date string or empty string for null/undefined
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* displayFormattedDate('2025-05-01') // "May 01, 2025"
|
|
19
|
+
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
20
|
+
* displayFormattedDate('2025-09-21', 'short') // "21/9/25"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function displayFormattedDate(date: DateValue | string | null | undefined, format?: Intl.DateTimeFormatOptions['dateStyle'], locales?: Intl.LocalesArgument): string;
|
|
24
|
+
//# sourceMappingURL=dateFormat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateFormat.d.ts","sourceRoot":"","sources":["../../lib/utils/dateFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,WAUlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAC3C,MAAM,GAAE,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAY,EAC1D,OAAO,GAAE,IAAI,CAAC,eAAyB,GACrC,MAAM,CAmBR"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getLocalTimeZone, parseDate, today } from '@internationalized/date';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a given DateValue represents today's date
|
|
7
|
+
* @param dateValue
|
|
8
|
+
* @returns boolean
|
|
9
|
+
*/
|
|
10
|
+
export function isToday(date) {
|
|
11
|
+
if (!date) return false;
|
|
12
|
+
if (typeof date === 'string') {
|
|
13
|
+
try {
|
|
14
|
+
date = parseDate(date);
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return date.compare(today(getLocalTimeZone())) === 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Formats a date value or ISO date string for display, with special handling for "today"
|
|
24
|
+
*
|
|
25
|
+
* @param date - DateValue, ISO date string, or null/undefined
|
|
26
|
+
* @param format - Intl date formatting style (default: 'medium')
|
|
27
|
+
* @param locales - Locales for formatting (default: 'en-AU')
|
|
28
|
+
* @returns Formatted date string or empty string for null/undefined
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* displayFormattedDate('2025-05-01') // "May 01, 2025"
|
|
33
|
+
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
34
|
+
* displayFormattedDate('2025-09-21', 'short') // "21/9/25"
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function displayFormattedDate(date, format = 'medium', locales = 'en-AU') {
|
|
38
|
+
if (!date) return '';
|
|
39
|
+
let dateValue;
|
|
40
|
+
|
|
41
|
+
// Handle string input by parsing it
|
|
42
|
+
if (typeof date === 'string') {
|
|
43
|
+
try {
|
|
44
|
+
dateValue = parseDate(date);
|
|
45
|
+
} catch {
|
|
46
|
+
return date; // Return original string if parsing fails
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
dateValue = date;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Format the date using Intl.DateTimeFormat
|
|
53
|
+
const formatter = new Intl.DateTimeFormat(locales, {
|
|
54
|
+
dateStyle: format
|
|
55
|
+
});
|
|
56
|
+
return formatter.format(dateValue.toDate(getLocalTimeZone()));
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.47.1",
|
|
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",
|
|
@@ -64,39 +64,39 @@
|
|
|
64
64
|
"@autoguru/tsconfig": "1.3.1",
|
|
65
65
|
"@autoguru/utilities": "^1.3.3",
|
|
66
66
|
"@babel/cli": "7.28.3",
|
|
67
|
-
"@babel/core": "7.28.
|
|
67
|
+
"@babel/core": "7.28.4",
|
|
68
68
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
69
69
|
"@babel/plugin-proposal-export-default-from": "7.27.1",
|
|
70
70
|
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
|
|
71
71
|
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
|
|
72
72
|
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
73
73
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
74
|
-
"@babel/plugin-transform-classes": "7.28.
|
|
74
|
+
"@babel/plugin-transform-classes": "7.28.4",
|
|
75
75
|
"@babel/plugin-transform-runtime": "7.28.3",
|
|
76
76
|
"@babel/plugin-transform-spread": "7.27.1",
|
|
77
77
|
"@babel/plugin-transform-strict-mode": "7.27.1",
|
|
78
78
|
"@babel/preset-env": "7.28.3",
|
|
79
79
|
"@babel/preset-react": "7.27.1",
|
|
80
80
|
"@babel/preset-typescript": "7.27.1",
|
|
81
|
-
"@babel/runtime-corejs3": "7.28.
|
|
81
|
+
"@babel/runtime-corejs3": "7.28.4",
|
|
82
82
|
"@changesets/cli": "2.29.6",
|
|
83
83
|
"@chromatic-com/storybook": "4.1.1",
|
|
84
84
|
"@internationalized/date": "3.9.0",
|
|
85
85
|
"@octokit/rest": "22.0.0",
|
|
86
86
|
"@popperjs/core": "2.11.8",
|
|
87
87
|
"@react-stately/toggle": "3.9.1",
|
|
88
|
-
"@storybook/addon-a11y": "9.1.
|
|
89
|
-
"@storybook/addon-docs": "9.1.
|
|
90
|
-
"@storybook/addon-links": "9.1.
|
|
91
|
-
"@storybook/addon-onboarding": "9.1.
|
|
92
|
-
"@storybook/addon-vitest": "9.1.
|
|
93
|
-
"@storybook/react-vite": "9.1.
|
|
88
|
+
"@storybook/addon-a11y": "9.1.5",
|
|
89
|
+
"@storybook/addon-docs": "9.1.5",
|
|
90
|
+
"@storybook/addon-links": "9.1.5",
|
|
91
|
+
"@storybook/addon-onboarding": "9.1.5",
|
|
92
|
+
"@storybook/addon-vitest": "9.1.5",
|
|
93
|
+
"@storybook/react-vite": "9.1.5",
|
|
94
94
|
"@testing-library/dom": "^10.4.1",
|
|
95
95
|
"@testing-library/jest-dom": "6.8.0",
|
|
96
96
|
"@testing-library/react": "16.3.0",
|
|
97
97
|
"@testing-library/react-hooks": "8.0.1",
|
|
98
98
|
"@testing-library/user-event": "14.6.1",
|
|
99
|
-
"@types/node": "24.3.
|
|
99
|
+
"@types/node": "24.3.1",
|
|
100
100
|
"@types/react": "19.1.12",
|
|
101
101
|
"@types/react-dom": "19.1.9",
|
|
102
102
|
"@types/webpack-env": "1.18.8",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@vanilla-extract/webpack-plugin": "2.3.22",
|
|
111
111
|
"@vitest/browser": "3.2.4",
|
|
112
112
|
"@vitest/coverage-v8": "3.2.4",
|
|
113
|
-
"@vitest/eslint-plugin": "1.3.
|
|
113
|
+
"@vitest/eslint-plugin": "1.3.9",
|
|
114
114
|
"babel-plugin-add-import-extension": "1.6.0",
|
|
115
115
|
"babel-plugin-dev-expression": "0.2.3",
|
|
116
116
|
"babel-plugin-macros": "3.1.0",
|
|
@@ -124,16 +124,16 @@
|
|
|
124
124
|
"deepmerge": "4.3.1",
|
|
125
125
|
"es-toolkit": "1.39.10",
|
|
126
126
|
"eslint": "9.34.0",
|
|
127
|
-
"eslint-plugin-storybook": "9.1.
|
|
127
|
+
"eslint-plugin-storybook": "9.1.5",
|
|
128
128
|
"husky": "9.1.7",
|
|
129
129
|
"intersection-observer": "0.12.2",
|
|
130
130
|
"jsdom": "26.1.0",
|
|
131
|
-
"lint-staged": "16.1.
|
|
132
|
-
"magic-string": "0.30.
|
|
131
|
+
"lint-staged": "16.1.6",
|
|
132
|
+
"magic-string": "0.30.19",
|
|
133
133
|
"mini-css-extract-plugin": "2.9.4",
|
|
134
134
|
"mockdate": "3.0.5",
|
|
135
135
|
"playwright": "1.55.0",
|
|
136
|
-
"plop": "4.0.
|
|
136
|
+
"plop": "4.0.2",
|
|
137
137
|
"postcss": "8.5.6",
|
|
138
138
|
"prettier": "3.6.2",
|
|
139
139
|
"prop-types": "15.8.1",
|
|
@@ -148,11 +148,11 @@
|
|
|
148
148
|
"react-stately": "3.41.0",
|
|
149
149
|
"react-swipeable": "7.0.2",
|
|
150
150
|
"rollup-plugin-visualizer": "6.0.3",
|
|
151
|
-
"storybook": "9.1.
|
|
151
|
+
"storybook": "9.1.5",
|
|
152
152
|
"storybook-addon-tag-badges": "2.0.2",
|
|
153
153
|
"typescript": "5.9.2",
|
|
154
154
|
"url-loader": "4.1.1",
|
|
155
|
-
"vite": "7.1.
|
|
155
|
+
"vite": "7.1.5",
|
|
156
156
|
"vitest": "3.2.4",
|
|
157
157
|
"webpack": "5.101.3"
|
|
158
158
|
},
|
|
@@ -1 +0,0 @@
|
|
|
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;AAI7D,eAAO,MAAM,cAAc,GAAI,OAAO,eAAe,sBAQpD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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;AA8CnD,UAAU,iBAAkB,SAAQ,qBAAqB;IACxD,KAAK,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,GAAI,qBAAqB,iBAAiB,sBA2ClE,CAAC"}
|