@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.
Files changed (62) hide show
  1. package/dist/components/Calendar/Calendar.css.d.ts +8 -0
  2. package/dist/components/Calendar/Calendar.css.d.ts.map +1 -0
  3. package/dist/components/Calendar/Calendar.css.js +113 -0
  4. package/dist/components/Calendar/Calendar.d.ts +69 -0
  5. package/dist/components/Calendar/Calendar.d.ts.map +1 -0
  6. package/dist/components/Calendar/Calendar.js +129 -0
  7. package/dist/components/Calendar/CalendarButton.d.ts +7 -0
  8. package/dist/components/Calendar/CalendarButton.d.ts.map +1 -0
  9. package/dist/components/{DateTimePicker → Calendar}/CalendarButton.js +3 -2
  10. package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.d.ts +4 -1
  11. package/dist/components/Calendar/CalendarGrid.d.ts.map +1 -0
  12. package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.js +7 -6
  13. package/dist/components/Calendar/index.d.ts +3 -0
  14. package/dist/components/Calendar/index.d.ts.map +1 -0
  15. package/dist/components/Calendar/index.js +3 -0
  16. package/dist/components/DatePicker/DatePicker.css.d.ts +2 -1
  17. package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
  18. package/dist/components/DatePicker/DatePicker.css.js +60 -30
  19. package/dist/components/DatePicker/DatePicker.d.ts +106 -5
  20. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  21. package/dist/components/DatePicker/DatePicker.js +188 -44
  22. package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +0 -7
  23. package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -1
  24. package/dist/components/DateTimePicker/DateTimePicker.css.js +0 -110
  25. package/dist/components/DateTimePicker/DateTimePicker.d.ts +5 -2
  26. package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
  27. package/dist/components/DateTimePicker/DateTimePicker.js +24 -80
  28. package/dist/components/OptionList/OptionList.d.ts +5 -5
  29. package/dist/components/Popover/Popover.css.d.ts +4 -0
  30. package/dist/components/Popover/Popover.css.d.ts.map +1 -0
  31. package/dist/components/Popover/Popover.css.js +46 -0
  32. package/dist/components/Popover/Popover.d.ts +34 -0
  33. package/dist/components/Popover/Popover.d.ts.map +1 -0
  34. package/dist/components/Popover/Popover.js +127 -0
  35. package/dist/components/Popover/PopoverTrigger.d.ts +51 -0
  36. package/dist/components/Popover/PopoverTrigger.d.ts.map +1 -0
  37. package/dist/components/Popover/PopoverTrigger.js +94 -0
  38. package/dist/components/Popover/index.d.ts +5 -0
  39. package/dist/components/Popover/index.d.ts.map +1 -0
  40. package/dist/components/Popover/index.js +4 -0
  41. package/dist/components/Slider/Slider.css.d.ts +9 -0
  42. package/dist/components/Slider/Slider.css.d.ts.map +1 -0
  43. package/dist/components/Slider/Slider.css.js +92 -0
  44. package/dist/components/Slider/Slider.d.ts +47 -0
  45. package/dist/components/Slider/Slider.d.ts.map +1 -0
  46. package/dist/components/Slider/Slider.js +141 -0
  47. package/dist/components/Slider/index.d.ts +2 -0
  48. package/dist/components/Slider/index.d.ts.map +1 -0
  49. package/dist/components/Slider/index.js +3 -0
  50. package/dist/components/index.d.ts +1 -0
  51. package/dist/components/index.d.ts.map +1 -1
  52. package/dist/components/index.js +1 -0
  53. package/dist/styles/selectors.d.ts +2 -1
  54. package/dist/styles/selectors.d.ts.map +1 -1
  55. package/dist/styles/selectors.js +2 -1
  56. package/dist/utils/dateFormat.d.ts +24 -0
  57. package/dist/utils/dateFormat.d.ts.map +1 -0
  58. package/dist/utils/dateFormat.js +57 -0
  59. package/package.json +18 -18
  60. package/dist/components/DateTimePicker/CalendarButton.d.ts +0 -4
  61. package/dist/components/DateTimePicker/CalendarButton.d.ts.map +0 -1
  62. package/dist/components/DateTimePicker/CalendarGrid.d.ts.map +0 -1
@@ -3,23 +3,15 @@
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
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
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,
8
- // currently only supporting western-style Gregorian calendar
9
- GregorianCalendar, today } from '@internationalized/date';
10
- import React, { useEffect, useRef } from 'react';
11
- import { useCalendar,
12
- // useDateFormatter,
13
- useLocale, useId } from 'react-aria';
14
- import { useCalendarState } from 'react-stately';
6
+ import { getLocalTimeZone, today } from '@internationalized/date';
7
+ import React, { useRef } from 'react';
8
+ import { useId } from 'react-aria';
15
9
  import { sprinkles } from "../../styles/sprinkles.css.js";
16
10
  import { dataAttrs } from "../../utils/dataAttrs.js";
11
+ import { Calendar } from "../Calendar/index.js";
17
12
  import { Heading } from "../Heading/index.js";
18
- import { Icon } from "../Icon/index.js";
19
13
  import { OptionGrid } from "../OptionGrid/OptionGrid.js";
20
- import { CalendarButton } from "./CalendarButton.js";
21
- import { CalendarGrid } from "./CalendarGrid.js";
22
- import { calendarStyle, layoutStyle, queryContainerStyle, titleStyle } from "./DateTimePicker.css.js";
14
+ import { layoutStyle, queryContainerStyle } from "./DateTimePicker.css.js";
23
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
16
  const defaultEnglish = {
25
17
  dateLabel: 'Date',
@@ -27,13 +19,6 @@ const defaultEnglish = {
27
19
  nextLabel: 'Next month',
28
20
  prevLabel: 'Previous month'
29
21
  };
30
- function createCalendar(identifier) {
31
- if (identifier === 'gregory') {
32
- return new GregorianCalendar();
33
- }
34
- throw new Error(`Unsupported calendar configured ${identifier}`);
35
- }
36
-
37
22
  // const dateTextPunctuationEN = (text: string) =>
38
23
  // text
39
24
  // .split(' ')
@@ -54,15 +39,15 @@ function createCalendar(identifier) {
54
39
  */
55
40
  export const DateTimePicker = ({
56
41
  allowPastDate = false,
57
- calendar,
42
+ calendarOptions,
58
43
  lang,
59
44
  onChange,
60
45
  timeOptions,
61
46
  title,
62
47
  testId
63
48
  }) => {
64
- var _lang$dateLabel, _lang$prevLabel, _lang$nextLabel, _lang$timeLabel;
65
- const selectedDate = useRef(null);
49
+ var _lang$dateLabel, _lang$timeLabel;
50
+ const selectedDate = useRef(today(getLocalTimeZone()));
66
51
  const selectedTimeOption = useRef(null);
67
52
  const handleChange = () => {
68
53
  var _selectedTimeOption$c;
@@ -73,6 +58,10 @@ export const DateTimePicker = ({
73
58
  });
74
59
  }
75
60
  };
61
+ const handleDateChange = value => {
62
+ selectedDate.current = value;
63
+ handleChange();
64
+ };
76
65
  const handleTimeChange = keys => {
77
66
  if (keys === 'all') return;
78
67
  // we expect only a single value for time picker
@@ -80,15 +69,6 @@ export const DateTimePicker = ({
80
69
  selectedTimeOption.current = time;
81
70
  handleChange();
82
71
  };
83
- const calendarComponentProps = _objectSpread({
84
- defaultValue: today(getLocalTimeZone()),
85
- firstDayOfWeek: 'sun',
86
- minValue: allowPastDate ? undefined : today(getLocalTimeZone()),
87
- onChange: value => {
88
- selectedDate.current = value;
89
- handleChange();
90
- }
91
- }, calendar);
92
72
  const optionGridComponentProps = _objectSpread({
93
73
  columns: '3',
94
74
  onSelectionChange: handleTimeChange,
@@ -96,34 +76,13 @@ export const DateTimePicker = ({
96
76
  selectionMode: 'single',
97
77
  disallowEmptySelection: true
98
78
  }, timeOptions);
99
- const {
100
- locale
101
- } = useLocale();
102
- const state = useCalendarState(_objectSpread(_objectSpread({}, calendarComponentProps), {}, {
103
- locale,
104
- createCalendar
105
- }));
106
- const {
107
- calendarProps,
108
- prevButtonProps,
109
- nextButtonProps,
110
- title: calendarTitle
111
- } = useCalendar(calendarComponentProps, state);
112
79
  const titleId = useId();
113
- useEffect(() => {
114
- if (state.value) {
115
- selectedDate.current = state.value;
116
- }
117
- // eslint-disable-next-line react-hooks/exhaustive-deps -- run only once
118
- }, []);
119
-
120
- // const formatter = useDateFormatter({ dateStyle: 'full' });
121
- // const dateText = state.value
122
- // ? dateTextPunctuationEN(
123
- // formatter.format(state?.value?.toDate(getLocalTimeZone())),
124
- // )
125
- // : '';
126
80
 
81
+ // Create calendar lang props from our lang props
82
+ const calendarLang = lang ? {
83
+ nextLabel: lang.nextLabel,
84
+ prevLabel: lang.prevLabel
85
+ } : undefined;
127
86
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
128
87
  role: "group",
129
88
  "aria-labelledby": titleId,
@@ -148,27 +107,11 @@ export const DateTimePicker = ({
148
107
  mb: "4",
149
108
  size: "6",
150
109
  children: (_lang$dateLabel = lang === null || lang === void 0 ? void 0 : lang.dateLabel) !== null && _lang$dateLabel !== void 0 ? _lang$dateLabel : defaultEnglish.dateLabel
151
- }), /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, calendarProps), {}, {
152
- className: calendarStyle,
153
- children: [/*#__PURE__*/_jsx(CalendarButton, _objectSpread(_objectSpread({}, prevButtonProps), {}, {
154
- "aria-label": (_lang$prevLabel = lang === null || lang === void 0 ? void 0 : lang.prevLabel) !== null && _lang$prevLabel !== void 0 ? _lang$prevLabel : defaultEnglish.prevLabel,
155
- children: /*#__PURE__*/_jsx(Icon, {
156
- icon: ChevronLeftIcon,
157
- size: "medium"
158
- })
159
- })), /*#__PURE__*/_jsx("h4", {
160
- className: titleStyle,
161
- children: calendarTitle
162
- }), /*#__PURE__*/_jsx(CalendarButton, _objectSpread(_objectSpread({}, nextButtonProps), {}, {
163
- "aria-label": (_lang$nextLabel = lang === null || lang === void 0 ? void 0 : lang.nextLabel) !== null && _lang$nextLabel !== void 0 ? _lang$nextLabel : defaultEnglish.nextLabel,
164
- children: /*#__PURE__*/_jsx(Icon, {
165
- icon: ChevronRightIcon,
166
- size: "medium"
167
- })
168
- }))]
169
- })), /*#__PURE__*/_jsx(CalendarGrid, {
170
- state: state,
171
- firstDayOfWeek: calendarComponentProps.firstDayOfWeek
110
+ }), /*#__PURE__*/_jsx(Calendar, {
111
+ allowPastDate: allowPastDate,
112
+ calendarOptions: calendarOptions,
113
+ lang: calendarLang,
114
+ onChange: handleDateChange
172
115
  })]
173
116
  }), /*#__PURE__*/_jsxs("div", {
174
117
  className: sprinkles({
@@ -183,4 +126,5 @@ export const DateTimePicker = ({
183
126
  })]
184
127
  })]
185
128
  }));
186
- };
129
+ };
130
+ DateTimePicker.displayName = 'DateTimePicker';
@@ -60,18 +60,18 @@ export declare const OptionList: {
60
60
  onKeyDown?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
61
61
  onKeyUp?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
62
62
  onClick?: ((e: React.MouseEvent<import("@react-types/shared").FocusableElement>) => void) | undefined;
63
+ excludeFromTabOrder?: boolean | undefined;
63
64
  isDisabled?: boolean | undefined;
64
- isReadOnly?: boolean | undefined;
65
+ isRequired?: boolean | undefined;
66
+ isInvalid?: boolean | undefined;
67
+ validationState?: import("react-stately").ValidationState | undefined;
65
68
  onFocusChange?: ((isFocused: boolean) => void) | undefined;
66
- excludeFromTabOrder?: boolean | undefined;
69
+ isReadOnly?: boolean | undefined;
67
70
  onPress?: ((e: import("react-aria").PressEvent) => void) | undefined;
68
71
  onPressStart?: ((e: import("react-aria").PressEvent) => void) | undefined;
69
72
  onPressEnd?: ((e: import("react-aria").PressEvent) => void) | undefined;
70
73
  onPressChange?: ((isPressed: boolean) => void) | undefined;
71
74
  onPressUp?: ((e: import("react-aria").PressEvent) => void) | undefined;
72
- isRequired?: boolean | undefined;
73
- isInvalid?: boolean | undefined;
74
- validationState?: import("react-stately").ValidationState | undefined;
75
75
  validationBehavior?: "aria" | "native" | undefined;
76
76
  validate?: ((value: boolean) => import("@react-types/shared").ValidationError | true | null | undefined) | undefined;
77
77
  }): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const overlayStyle: string;
2
+ export declare const triggerStyle: string;
3
+ export declare const fullScreenStyle: string;
4
+ //# sourceMappingURL=Popover.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/Popover.css.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,QAiBvB,CAAC;AAEH,eAAO,MAAM,YAAY,QASvB,CAAC;AAEH,eAAO,MAAM,eAAe,QAW1B,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+ __vanilla_filescope__.setFileScope("lib/components/Popover/Popover.css.ts", "@autoguru/overdrive");
5
+ import { style } from '@vanilla-extract/css';
6
+ import { cssLayerComponent } from "../../styles/layers.css.js";
7
+ import { sprinkles } from "../../styles/sprinkles.css.js";
8
+ import { overdriveTokens as tokens } from "../../themes/theme.css.js";
9
+ export const overlayStyle = style([sprinkles({
10
+ borderRadius: 'md',
11
+ borderWidth: '1',
12
+ borderStyle: 'solid',
13
+ borderColour: 'light',
14
+ padding: '4'
15
+ }), {
16
+ '@layer': {
17
+ [cssLayerComponent]: {
18
+ backgroundColor: tokens.colours.background.body,
19
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
20
+ minWidth: '280px'
21
+ }
22
+ }
23
+ }], "overlayStyle");
24
+ export const triggerStyle = style({
25
+ '@layer': {
26
+ [cssLayerComponent]: {
27
+ background: 'transparent',
28
+ border: 'none',
29
+ cursor: 'pointer',
30
+ padding: 0
31
+ }
32
+ }
33
+ }, "triggerStyle");
34
+ export const fullScreenStyle = style({
35
+ '@layer': {
36
+ [cssLayerComponent]: {
37
+ backgroundColor: tokens.colours.background.body,
38
+ bottom: 0,
39
+ left: 0,
40
+ position: 'fixed',
41
+ right: 0,
42
+ top: 0
43
+ }
44
+ }
45
+ }, "fullScreenStyle");
46
+ __vanilla_filescope__.endFileScope();
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { type AriaPopoverProps } from 'react-aria';
3
+ import { type OverlayTriggerState } from 'react-stately';
4
+ declare const defaultEnglish: {
5
+ readonly close: "close";
6
+ };
7
+ export type Language = Partial<Record<keyof typeof defaultEnglish, string>>;
8
+ /**
9
+ * Internal props for the Popover component.
10
+ */
11
+ export interface PopoverProps extends Omit<AriaPopoverProps, 'popoverRef'> {
12
+ /**
13
+ * Content to display inside the popover
14
+ */
15
+ children: React.ReactNode;
16
+ /**
17
+ * State object that controls the popover's open/close state
18
+ */
19
+ state: OverlayTriggerState;
20
+ /**
21
+ * Reference to the trigger element for positioning
22
+ */
23
+ triggerRef: React.RefObject<HTMLElement | null>;
24
+ /**
25
+ * Language content override
26
+ */
27
+ lang?: Language;
28
+ }
29
+ export declare const Popover: {
30
+ ({ children, offset, state, triggerRef, lang, ...props }: PopoverProps): React.JSX.Element;
31
+ displayName: string;
32
+ };
33
+ export {};
34
+ //# sourceMappingURL=Popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/Popover.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAKN,KAAK,gBAAgB,EAErB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AASzD,QAAA,MAAM,cAAc;;CAEV,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACzE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;IAC3B;;OAEG;IACH,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAoBD,eAAO,MAAM,OAAO;8DAOjB,YAAY;;CA6Ed,CAAC"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["children"],
6
+ _excluded2 = ["children", "offset", "state", "triggerRef", "lang"];
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 { CloseIcon } from '@autoguru/icons';
10
+ import React, { useRef, useEffect } from 'react';
11
+ import { usePopover, useDialog, DismissButton, Overlay } from 'react-aria';
12
+ import { useMedia } from "../../hooks/useMedia/useMedia.js";
13
+ import { sprinkles } from "../../styles/sprinkles.css.js";
14
+ import { Button } from "../Button/Button.js";
15
+ import { Icon } from "../Icon/Icon.js";
16
+ import { fullScreenStyle, overlayStyle } from "./Popover.css.js";
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ const defaultEnglish = {
19
+ close: 'close'
20
+ };
21
+
22
+ /**
23
+ * Internal props for the Popover component.
24
+ */
25
+
26
+ /**
27
+ * Internal props for the Dialog wrapper component.
28
+ */
29
+
30
+ const Dialog = _ref => {
31
+ let {
32
+ children
33
+ } = _ref,
34
+ props = _objectWithoutProperties(_ref, _excluded);
35
+ const ref = useRef(null);
36
+ const {
37
+ dialogProps
38
+ } = useDialog(props, ref);
39
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, dialogProps), {}, {
40
+ ref: ref,
41
+ children: children
42
+ }));
43
+ };
44
+ export const Popover = _ref2 => {
45
+ let {
46
+ children,
47
+ offset = 4,
48
+ state,
49
+ triggerRef,
50
+ lang
51
+ } = _ref2,
52
+ props = _objectWithoutProperties(_ref2, _excluded2);
53
+ const popoverRef = useRef(null);
54
+ const [isTablet] = useMedia(['tablet']);
55
+ const isFullScreen = !isTablet;
56
+
57
+ // Handle Esc manually since we have two different modes (popover vs fullscreen dialog)
58
+ // and react-aria would need a slightly different ModalTrigger pattern
59
+ useEffect(() => {
60
+ if (!isFullScreen) return;
61
+ const handleKeyDown = event => {
62
+ if (event.key === 'Escape') {
63
+ event.preventDefault();
64
+ state.close();
65
+ }
66
+ };
67
+ document.addEventListener('keydown', handleKeyDown);
68
+ return () => document.removeEventListener('keydown', handleKeyDown);
69
+ }, [isFullScreen, state]);
70
+ const {
71
+ popoverProps,
72
+ underlayProps
73
+ } = usePopover(_objectSpread(_objectSpread({}, props), {}, {
74
+ offset,
75
+ triggerRef,
76
+ popoverRef
77
+ }), state);
78
+
79
+ // Fullscreen mode: render Dialog directly without popover positioning
80
+ if (isFullScreen) {
81
+ var _lang$close;
82
+ return /*#__PURE__*/_jsx(Overlay, {
83
+ children: /*#__PURE__*/_jsx(Dialog, {
84
+ children: /*#__PURE__*/_jsx("div", {
85
+ className: fullScreenStyle,
86
+ children: /*#__PURE__*/_jsxs("div", {
87
+ className: sprinkles({
88
+ display: 'flex',
89
+ flexDirection: 'column',
90
+ gap: '5',
91
+ p: '3'
92
+ }),
93
+ children: [/*#__PURE__*/_jsx("div", {
94
+ className: sprinkles({
95
+ alignSelf: 'end'
96
+ }),
97
+ children: /*#__PURE__*/_jsx(Button, {
98
+ variant: "secondary",
99
+ minimal: true,
100
+ rounded: true,
101
+ onClick: state.close,
102
+ "aria-label": (_lang$close = lang === null || lang === void 0 ? void 0 : lang.close) !== null && _lang$close !== void 0 ? _lang$close : defaultEnglish.close,
103
+ children: /*#__PURE__*/_jsx(Icon, {
104
+ icon: CloseIcon
105
+ })
106
+ })
107
+ }), children]
108
+ })
109
+ })
110
+ })
111
+ });
112
+ }
113
+
114
+ // Standard popover mode: use popover positioning
115
+ return /*#__PURE__*/_jsxs(Overlay, {
116
+ children: [/*#__PURE__*/_jsx("div", _objectSpread({}, underlayProps)), /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, popoverProps), {}, {
117
+ ref: popoverRef,
118
+ className: overlayStyle,
119
+ children: [/*#__PURE__*/_jsx(Dialog, {
120
+ children: children
121
+ }), /*#__PURE__*/_jsx(DismissButton, {
122
+ onDismiss: state.close
123
+ })]
124
+ }))]
125
+ });
126
+ };
127
+ Popover.displayName = 'Popover';
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { type AriaPopoverProps } from 'react-aria';
3
+ import type { TestIdProp } from '../../types';
4
+ import { type Language } from './Popover';
5
+ /**
6
+ * Props for the PopoverTrigger component.
7
+ */
8
+ export interface PopoverTriggerProps extends Pick<AriaPopoverProps, 'offset' | 'placement' | 'shouldCloseOnInteractOutside' | 'shouldFlip'>, TestIdProp {
9
+ /**
10
+ * The content to display in the popover
11
+ */
12
+ content: React.ReactNode;
13
+ /**
14
+ * The element that triggers the popover when interacted with. For accessibility,
15
+ * this must contain the aria visible content (e.g. "open calender")
16
+ */
17
+ children: React.ReactNode;
18
+ /**
19
+ * Whether the trigger is disabled and non-interactive
20
+ */
21
+ isDisabled?: boolean;
22
+ /**
23
+ * Language content override
24
+ */
25
+ lang?: Language;
26
+ /**
27
+ * Callback that receives the overlay trigger state for external control
28
+ */
29
+ onStateReady?: (state: {
30
+ close: () => void;
31
+ }) => void;
32
+ }
33
+ /**
34
+ * A popover component that displays content in an overlay positioned relative to a trigger element.
35
+ * The popover automatically handles positioning, accessibility, and focus management.
36
+ *
37
+ * Note: Button components are not supported as children due to React Aria compatibility issues,
38
+ * use button tag, plain text, or other elements instead.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * <PopoverTrigger content={<Calendar />}>
43
+ * Choose Date
44
+ * </PopoverTrigger>
45
+ * ```
46
+ */
47
+ export declare const PopoverTrigger: {
48
+ ({ content, children, isDisabled, offset, placement, shouldCloseOnInteractOutside, shouldFlip, testId, lang, onStateReady, }: PopoverTriggerProps): React.JSX.Element;
49
+ displayName: string;
50
+ };
51
+ //# sourceMappingURL=PopoverTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAAE,KAAK,QAAQ,EAAW,MAAM,WAAW,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,mBAChB,SAAQ,IAAI,CACV,gBAAgB,EACd,QAAQ,GACR,WAAW,GACX,8BAA8B,GAC9B,YAAY,CACd,EACD,UAAU;IACX;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc;kIAWxB,mBAAmB;;CAwErB,CAAC"}
@@ -0,0 +1,94 @@
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 { invariant } from '@autoguru/utilities';
7
+ import React, { useRef } from 'react';
8
+ import { useOverlayTrigger, useButton } from 'react-aria';
9
+ import { useOverlayTriggerState } from 'react-stately';
10
+ import { dataAttrs } from "../../utils/dataAttrs.js";
11
+ import { Button } from "../Button/Button.js";
12
+ import { Popover } from "./Popover.js";
13
+ import { triggerStyle } from "./Popover.css.js";
14
+ /**
15
+ * Props for the PopoverTrigger component.
16
+ */
17
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
18
+ /**
19
+ * A popover component that displays content in an overlay positioned relative to a trigger element.
20
+ * The popover automatically handles positioning, accessibility, and focus management.
21
+ *
22
+ * Note: Button components are not supported as children due to React Aria compatibility issues,
23
+ * use button tag, plain text, or other elements instead.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * <PopoverTrigger content={<Calendar />}>
28
+ * Choose Date
29
+ * </PopoverTrigger>
30
+ * ```
31
+ */
32
+ export const PopoverTrigger = ({
33
+ content,
34
+ children,
35
+ isDisabled,
36
+ offset,
37
+ placement,
38
+ shouldCloseOnInteractOutside,
39
+ shouldFlip,
40
+ testId,
41
+ lang,
42
+ onStateReady
43
+ }) => {
44
+ const state = useOverlayTriggerState({});
45
+ const triggerRef = useRef(null);
46
+
47
+ // Provide state access to parent component
48
+ React.useEffect(() => {
49
+ if (onStateReady) {
50
+ onStateReady({
51
+ close: state.close
52
+ });
53
+ }
54
+ }, [onStateReady, state.close]);
55
+ const {
56
+ triggerProps,
57
+ overlayProps
58
+ } = useOverlayTrigger({
59
+ type: 'dialog'
60
+ }, state, triggerRef);
61
+ const {
62
+ buttonProps
63
+ } = useButton(_objectSpread(_objectSpread({}, triggerProps), {}, {
64
+ isDisabled
65
+ }), triggerRef);
66
+
67
+ // Validate that Button components are not used as children
68
+ if (/*#__PURE__*/React.isValidElement(children) && children.type === Button) {
69
+ !false ? process.env.NODE_ENV !== "production" ? invariant(false, 'PopoverTrigger: The Button component is presently incompatible with ReactAria. Please use a native button or other element for the trigger.') : invariant(false) : void 0;
70
+ }
71
+ const isNativeButton = /*#__PURE__*/React.isValidElement(children) && children.type === 'button';
72
+ const combinedProps = _objectSpread(_objectSpread(_objectSpread({}, buttonProps), dataAttrs({
73
+ testid: testId
74
+ })), {}, {
75
+ ref: triggerRef
76
+ });
77
+ const triggerElement = isNativeButton ? (/*#__PURE__*/React.cloneElement(children, combinedProps)) : /*#__PURE__*/_jsx("button", _objectSpread(_objectSpread({}, combinedProps), {}, {
78
+ className: triggerStyle,
79
+ children: children
80
+ }));
81
+ return /*#__PURE__*/_jsxs(_Fragment, {
82
+ children: [triggerElement, state.isOpen && /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({}, overlayProps), {}, {
83
+ state: state,
84
+ triggerRef: triggerRef,
85
+ placement: placement,
86
+ offset: offset,
87
+ shouldCloseOnInteractOutside: shouldCloseOnInteractOutside,
88
+ shouldFlip: shouldFlip,
89
+ lang: lang,
90
+ children: content
91
+ }))]
92
+ });
93
+ };
94
+ PopoverTrigger.displayName = 'PopoverTrigger';
@@ -0,0 +1,5 @@
1
+ export { Popover } from './Popover';
2
+ export { PopoverTrigger } from './PopoverTrigger';
3
+ export type { PopoverProps } from './Popover';
4
+ export type { PopoverTriggerProps } from './PopoverTrigger';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { Popover } from "./Popover.js";
4
+ export { PopoverTrigger } from "./PopoverTrigger.js";
@@ -0,0 +1,9 @@
1
+ export declare const container: string;
2
+ export declare const label: string;
3
+ export declare const valueDisplay: string;
4
+ export declare const valueText: string;
5
+ export declare const sliderContainer: string;
6
+ export declare const trackContainer: string;
7
+ export declare const track: string;
8
+ export declare const thumb: string;
9
+ //# sourceMappingURL=Slider.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slider.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Slider/Slider.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS,QAKpB,CAAC;AAEH,eAAO,MAAM,KAAK,QAIhB,CAAC;AAEH,eAAO,MAAM,YAAY,QAIvB,CAAC;AAEH,eAAO,MAAM,SAAS,QAIpB,CAAC;AAEH,eAAO,MAAM,eAAe,QAK1B,CAAC;AAEH,eAAO,MAAM,cAAc,QAIzB,CAAC;AAEH,eAAO,MAAM,KAAK,QAoBhB,CAAC;AAEH,eAAO,MAAM,KAAK,QAkChB,CAAC"}