@autoguru/overdrive 4.43.6 → 4.43.7

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.
@@ -86,11 +86,11 @@ export const StandardModal = _ref => {
86
86
  }, className]),
87
87
  children: [_jsxs(Box, {
88
88
  as: "header",
89
- flexShrink: 0,
89
+ flexShrink: "0",
90
90
  position: "relative",
91
91
  display: "flex",
92
92
  alignItems: "center",
93
- justifyContent: "center",
93
+ justifyContent: "space-between",
94
94
  width: "full",
95
95
  paddingY: "3",
96
96
  paddingLeft: "5",
@@ -98,7 +98,7 @@ export const StandardModal = _ref => {
98
98
  borderWidthBottom: "1",
99
99
  borderColour: "light",
100
100
  children: [_jsx(Box, {
101
- flexGrow: 0,
101
+ flexGrow: "0",
102
102
  id: titleId,
103
103
  children: _jsx(Heading, {
104
104
  as: "h4",
@@ -123,7 +123,7 @@ export const StandardModal = _ref => {
123
123
  as: "main",
124
124
  display: "flex",
125
125
  flexDirection: "column",
126
- flexGrow: 1,
126
+ flexGrow: "1",
127
127
  height: "full",
128
128
  className: styles.content,
129
129
  children: children
@@ -1,12 +1,13 @@
1
- import { FunctionComponent, ReactElement } from 'react';
1
+ import { type FunctionComponent, type ReactNode } from 'react';
2
+ import type { TestId } from '../../types';
2
3
  import { EAlignment } from '../Positioner/alignment';
3
4
  type ToolTipSize = 'medium' | 'large';
4
- export interface TooltipProps {
5
+ export interface TooltipProps extends TestId {
5
6
  size?: ToolTipSize;
6
7
  isOpen?: boolean;
7
8
  label: string;
8
9
  alignment?: EAlignment;
9
- children: ReactElement;
10
+ children: ReactNode;
10
11
  closeAfter?: number;
11
12
  }
12
13
  export declare const Tooltip: FunctionComponent<TooltipProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAIN,iBAAiB,EACjB,YAAY,EAKZ,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,KAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtC,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CA2EnD,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEb,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAMd,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,KAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtC,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC3C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAkGnD,CAAC"}
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
 
3
- import * as React from 'react';
4
- import { Children, cloneElement, useCallback, useEffect, useRef, useState } from 'react';
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, { useCallback, useEffect, useRef, useState, useId } from 'react';
7
+ import { sprinkles } from "../../styles/sprinkles.css.js";
8
+ import { dataAttrs } from "../../utils/dataAttrs.js";
5
9
  import { Box } from "../Box/Box.js";
6
10
  import { Positioner } from "../Positioner/Positioner.js";
7
11
  import { EAlignment } from "../Positioner/alignment.js";
8
12
  import { Text } from "../Text/Text.js";
9
13
  import * as styles from "./Tooltip.css.js";
10
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
15
  const sizeMap = {
12
16
  medium: '2',
13
17
  large: '3'
@@ -19,11 +23,13 @@ export const Tooltip = _ref => {
19
23
  label,
20
24
  children,
21
25
  size = 'medium',
22
- closeAfter = null
26
+ closeAfter = null,
27
+ testId
23
28
  } = _ref;
29
+ const tooltipId = useId();
24
30
  const [isOpen, setIsOpen] = useState(incomingIsOpen);
25
- const childRef = useRef(null);
26
31
  const triggerRef = useRef(null);
32
+ const tooltipRef = useRef(null);
27
33
  const leaveTimer = useRef(null);
28
34
  const enterHandler = useCallback(() => {
29
35
  if (leaveTimer.current) {
@@ -36,22 +42,47 @@ export const Tooltip = _ref => {
36
42
  setIsOpen(false);
37
43
  }, 1e3 / 2);
38
44
  }, [setIsOpen]);
45
+ const focusHandler = useCallback(() => {
46
+ setIsOpen(true);
47
+ }, [setIsOpen]);
48
+ const blurHandler = useCallback(() => {
49
+ setIsOpen(false);
50
+ }, [setIsOpen]);
39
51
  useEffect(() => {
40
52
  let timeout;
41
- if (isOpen && typeof closeAfter === 'number') timeout = setTimeout(() => setIsOpen(false), closeAfter);
42
- return () => timeout ? clearTimeout(timeout) : void 0;
43
- }, [closeAfter, isOpen, label]);
44
- return (label === null || label === void 0 ? void 0 : label.length) > 0 ? _jsxs(_Fragment, {
45
- children: [cloneElement(Children.only(children), {
53
+ if (isOpen && typeof closeAfter === 'number') {
54
+ timeout = setTimeout(() => setIsOpen(false), closeAfter);
55
+ }
56
+ return () => {
57
+ if (timeout) clearTimeout(timeout);
58
+ };
59
+ }, [closeAfter, isOpen]);
60
+ if (!label) return _jsx(_Fragment, {
61
+ children: children
62
+ });
63
+ return _jsxs(_Fragment, {
64
+ children: [_jsx("span", _objectSpread(_objectSpread({
46
65
  ref: triggerRef,
47
66
  onMouseEnter: enterHandler,
48
- onMouseLeave: leaveHandler
49
- }), _jsx(Positioner, {
67
+ onMouseLeave: leaveHandler,
68
+ onFocus: focusHandler,
69
+ onBlur: blurHandler,
70
+ tabIndex: 0,
71
+ className: sprinkles({
72
+ display: 'inline-block'
73
+ }),
74
+ "aria-describedby": isOpen ? tooltipId : undefined
75
+ }, dataAttrs({
76
+ testid: testId
77
+ })), {}, {
78
+ children: children
79
+ })), _jsx(Positioner, {
50
80
  triggerRef: triggerRef,
51
81
  alignment: alignment,
52
82
  isOpen: typeof incomingIsOpen === 'boolean' ? incomingIsOpen : isOpen,
53
83
  children: _jsx(Box, {
54
- ref: childRef,
84
+ id: tooltipId,
85
+ ref: tooltipRef,
55
86
  className: styles.root,
56
87
  width: "full",
57
88
  pointerEvents: "none",
@@ -62,6 +93,7 @@ export const Tooltip = _ref => {
62
93
  backgroundColour: "gray900",
63
94
  paddingY: "2",
64
95
  paddingX: "3",
96
+ role: "tooltip",
65
97
  children: _jsx(Text, {
66
98
  size: sizeMap[size],
67
99
  colour: "white",
@@ -69,7 +101,6 @@ export const Tooltip = _ref => {
69
101
  })
70
102
  })
71
103
  })]
72
- }) : _jsx(_Fragment, {
73
- children: children
74
104
  });
75
- };
105
+ };
106
+ Tooltip.displayName = 'Tooltip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.43.6",
3
+ "version": "4.43.7",
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",
@@ -93,22 +93,22 @@
93
93
  "@octokit/rest": "^22.0.0",
94
94
  "@popperjs/core": "^2.11.8",
95
95
  "@react-stately/toggle": "^3.8.5",
96
- "@storybook/addon-a11y": "9.0.6",
97
- "@storybook/addon-docs": "9.0.6",
98
- "@storybook/addon-links": "9.0.6",
99
- "@storybook/addon-onboarding": "9.0.6",
100
- "@storybook/addon-vitest": "9.0.6",
101
- "@storybook/react-vite": "9.0.6",
96
+ "@storybook/addon-a11y": "9.0.10",
97
+ "@storybook/addon-docs": "9.0.10",
98
+ "@storybook/addon-links": "9.0.10",
99
+ "@storybook/addon-onboarding": "9.0.10",
100
+ "@storybook/addon-vitest": "9.0.10",
101
+ "@storybook/react-vite": "9.0.10",
102
102
  "@testing-library/dom": "^10.4.0",
103
103
  "@testing-library/jest-dom": "^6.6.3",
104
104
  "@testing-library/react": "^16.3.0",
105
105
  "@testing-library/react-hooks": "^8.0.1",
106
106
  "@testing-library/user-event": "^14.6.1",
107
- "@types/node": "24.0.0",
108
- "@types/react": "19.1.7",
107
+ "@types/node": "24.0.3",
108
+ "@types/react": "19.1.8",
109
109
  "@types/react-dom": "19.1.6",
110
110
  "@types/webpack-env": "^1.18.8",
111
- "@typescript-eslint/utils": "^8.34.0",
111
+ "@typescript-eslint/utils": "^8.34.1",
112
112
  "@vanilla-extract/babel-plugin": "^1.2.0",
113
113
  "@vanilla-extract/css": "^1.17.3",
114
114
  "@vanilla-extract/dynamic": "^2.1.4",
@@ -118,12 +118,12 @@
118
118
  "@vanilla-extract/webpack-plugin": "^2.3.20",
119
119
  "@vitest/browser": "3.2.3",
120
120
  "@vitest/coverage-v8": "3.2.3",
121
- "@vitest/eslint-plugin": "1.2.1",
121
+ "@vitest/eslint-plugin": "1.2.7",
122
122
  "babel-plugin-add-import-extension": "^1.6.0",
123
123
  "babel-plugin-dev-expression": "^0.2.3",
124
124
  "babel-plugin-macros": "^3.1.0",
125
125
  "browserslist-config-autoguru": "^2.4.4",
126
- "chromatic": "12.2.0",
126
+ "chromatic": "13.0.0",
127
127
  "clsx": "^2.1.1",
128
128
  "colord": "^2.9.3",
129
129
  "concurrently": "^9.1.2",
@@ -132,17 +132,17 @@
132
132
  "deepmerge": "^4.3.1",
133
133
  "es-toolkit": "1.39.3",
134
134
  "eslint": "9.28.0",
135
- "eslint-plugin-storybook": "9.0.6",
135
+ "eslint-plugin-storybook": "9.0.10",
136
136
  "husky": "^9.1.7",
137
137
  "intersection-observer": "^0.12.2",
138
138
  "jsdom": "26.1.0",
139
- "lint-staged": "16.1.0",
139
+ "lint-staged": "16.1.2",
140
140
  "magic-string": "^0.30.17",
141
141
  "mini-css-extract-plugin": "^2.9.2",
142
142
  "mockdate": "^3.0.5",
143
- "playwright": "^1.52.0",
143
+ "playwright": "^1.53.0",
144
144
  "plop": "^4.0.1",
145
- "postcss": "^8.5.4",
145
+ "postcss": "^8.5.6",
146
146
  "prettier": "^3.5.3",
147
147
  "prop-types": "^15.8.1",
148
148
  "rand-seed": "^2.1.7",
@@ -156,7 +156,7 @@
156
156
  "react-stately": "^3.39.0",
157
157
  "react-swipeable": "^7.0.2",
158
158
  "rollup-plugin-visualizer": "^6.0.3",
159
- "storybook": "9.0.6",
159
+ "storybook": "9.0.10",
160
160
  "storybook-addon-tag-badges": "^2.0.1",
161
161
  "typescript": "5.8.3",
162
162
  "url-loader": "^4.1.1",