@autoguru/overdrive 4.10.1 → 4.11.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.
Files changed (260) hide show
  1. package/dist/components/Actions/Actions.js +21 -4
  2. package/dist/components/Actions/index.js +3 -1
  3. package/dist/components/Alert/Alert.css.js +28 -20
  4. package/dist/components/Alert/Alert.js +84 -26
  5. package/dist/components/Alert/index.js +3 -1
  6. package/dist/components/Anchor/Anchor.css.js +11 -3
  7. package/dist/components/Anchor/Anchor.js +53 -28
  8. package/dist/components/Anchor/index.js +3 -1
  9. package/dist/components/AutoSuggest/AutoSuggest.css.js +84 -76
  10. package/dist/components/AutoSuggest/AutoSuggest.js +621 -302
  11. package/dist/components/AutoSuggest/index.js +3 -1
  12. package/dist/components/AutoSuggest/useLayoutSuggestionVisible.js +29 -31
  13. package/dist/components/Badge/Badge.css.js +79 -71
  14. package/dist/components/Badge/Badge.js +44 -27
  15. package/dist/components/Badge/index.js +3 -1
  16. package/dist/components/Box/Box.js +122 -53
  17. package/dist/components/Box/argTypes.js +72 -105
  18. package/dist/components/Box/index.js +4 -2
  19. package/dist/components/Box/useBoxStyles.css.d.ts +4 -4
  20. package/dist/components/Box/useBoxStyles.css.d.ts.map +1 -1
  21. package/dist/components/Box/useBoxStyles.css.js +114 -89
  22. package/dist/components/Box/useBoxStyles.d.ts +7 -7
  23. package/dist/components/Box/useBoxStyles.d.ts.map +1 -1
  24. package/dist/components/Box/useBoxStyles.js +75 -47
  25. package/dist/components/BulletList/Bullet.css.js +49 -41
  26. package/dist/components/BulletList/Bullet.js +38 -24
  27. package/dist/components/BulletList/BulletList.css.js +13 -5
  28. package/dist/components/BulletList/BulletList.js +23 -10
  29. package/dist/components/BulletList/context.js +3 -1
  30. package/dist/components/BulletList/index.js +4 -2
  31. package/dist/components/BulletText/BulletText.css.js +21 -13
  32. package/dist/components/BulletText/BulletText.js +57 -16
  33. package/dist/components/BulletText/index.js +3 -1
  34. package/dist/components/Button/Button.css.js +243 -235
  35. package/dist/components/Button/Button.js +154 -91
  36. package/dist/components/Button/index.js +3 -1
  37. package/dist/components/CheckBox/CheckBox.css.js +28 -20
  38. package/dist/components/CheckBox/CheckBox.js +54 -16
  39. package/dist/components/CheckBox/index.js +3 -1
  40. package/dist/components/ColourInput/ColourInput.css.js +31 -23
  41. package/dist/components/ColourInput/ColourInput.js +70 -20
  42. package/dist/components/ColourInput/index.js +3 -1
  43. package/dist/components/Columns/Column.css.js +36 -26
  44. package/dist/components/Columns/Column.js +51 -16
  45. package/dist/components/Columns/Columns.css.js +39 -31
  46. package/dist/components/Columns/Columns.js +55 -22
  47. package/dist/components/Columns/index.js +4 -2
  48. package/dist/components/DateInput/DateInput.js +34 -7
  49. package/dist/components/DateInput/index.js +3 -1
  50. package/dist/components/DatePicker/DatePicker.css.js +40 -32
  51. package/dist/components/DatePicker/DatePicker.js +64 -23
  52. package/dist/components/DatePicker/index.js +3 -1
  53. package/dist/components/DividerLine/DividerLine.css.js +45 -37
  54. package/dist/components/DividerLine/DividerLine.js +22 -6
  55. package/dist/components/DividerLine/index.js +3 -1
  56. package/dist/components/Flyout/Flyout.js +41 -5
  57. package/dist/components/Flyout/index.js +3 -1
  58. package/dist/components/Heading/Heading.js +41 -21
  59. package/dist/components/Heading/index.js +3 -1
  60. package/dist/components/Icon/Icon.css.js +13 -5
  61. package/dist/components/Icon/Icon.js +26 -9
  62. package/dist/components/Icon/index.js +3 -1
  63. package/dist/components/Image/Image.js +23 -5
  64. package/dist/components/Image/ImageServerProvider.d.ts +1 -1
  65. package/dist/components/Image/ImageServerProvider.d.ts.map +1 -1
  66. package/dist/components/Image/ImageServerProvider.js +55 -35
  67. package/dist/components/Image/ResponsiveImage.js +46 -21
  68. package/dist/components/Image/SimpleImage.js +30 -2
  69. package/dist/components/Image/index.js +4 -2
  70. package/dist/components/Image/types.js +3 -1
  71. package/dist/components/Inline/Inline.js +74 -30
  72. package/dist/components/Inline/index.js +3 -1
  73. package/dist/components/LinearProgressIndicator/LinearProgressIndicator.css.js +56 -48
  74. package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +31 -7
  75. package/dist/components/LinearProgressIndicator/index.js +3 -1
  76. package/dist/components/LoadingBox/LoadingBox.css.js +26 -18
  77. package/dist/components/LoadingBox/LoadingBox.js +40 -7
  78. package/dist/components/LoadingBox/index.js +3 -1
  79. package/dist/components/Meta/Meta.css.js +16 -8
  80. package/dist/components/Meta/Meta.js +30 -8
  81. package/dist/components/Meta/index.js +3 -1
  82. package/dist/components/MinimalModal/MinimalModal.css.js +15 -7
  83. package/dist/components/MinimalModal/MinimalModal.js +67 -29
  84. package/dist/components/MinimalModal/index.js +3 -1
  85. package/dist/components/Modal/Modal.css.js +38 -30
  86. package/dist/components/Modal/Modal.js +129 -73
  87. package/dist/components/Modal/index.js +3 -1
  88. package/dist/components/NumberBubble/NumberBubble.css.js +12 -4
  89. package/dist/components/NumberBubble/NumberBubble.js +51 -23
  90. package/dist/components/NumberBubble/index.js +3 -1
  91. package/dist/components/NumberInput/NumberInput.js +67 -29
  92. package/dist/components/NumberInput/index.js +3 -1
  93. package/dist/components/OrderedList/OrderedList.css.js +16 -8
  94. package/dist/components/OrderedList/OrderedList.js +60 -26
  95. package/dist/components/OrderedList/index.js +3 -1
  96. package/dist/components/OutsideClick/OutsideClick.js +40 -35
  97. package/dist/components/OutsideClick/index.js +3 -1
  98. package/dist/components/OverdriveProvider/OverdriveProvider.js +33 -19
  99. package/dist/components/OverdriveProvider/index.js +3 -1
  100. package/dist/components/Pagination/Bubble.js +41 -19
  101. package/dist/components/Pagination/Pagination.css.js +28 -20
  102. package/dist/components/Pagination/Pagination.js +166 -67
  103. package/dist/components/Pagination/index.js +3 -1
  104. package/dist/components/Portal/Portal.js +40 -24
  105. package/dist/components/Portal/index.js +3 -1
  106. package/dist/components/Positioner/Positioner.css.js +14 -6
  107. package/dist/components/Positioner/Positioner.js +109 -85
  108. package/dist/components/Positioner/alignment.js +13 -10
  109. package/dist/components/Positioner/index.js +4 -2
  110. package/dist/components/ProgressBar/ProgressBar.css.js +14 -6
  111. package/dist/components/ProgressBar/ProgressBar.js +30 -12
  112. package/dist/components/ProgressBar/index.js +3 -1
  113. package/dist/components/ProgressBarGroup/ProgressBarGroup.css.js +12 -4
  114. package/dist/components/ProgressBarGroup/ProgressBarGroup.js +42 -14
  115. package/dist/components/ProgressBarGroup/index.js +3 -1
  116. package/dist/components/ProgressSpinner/ProgressSpinner.css.js +81 -73
  117. package/dist/components/ProgressSpinner/ProgressSpinner.js +32 -14
  118. package/dist/components/ProgressSpinner/index.js +3 -1
  119. package/dist/components/Radio/Radio.css.js +31 -23
  120. package/dist/components/Radio/Radio.js +58 -19
  121. package/dist/components/Radio/RadioGroup.js +32 -7
  122. package/dist/components/Radio/index.js +4 -2
  123. package/dist/components/Section/Section.css.js +13 -5
  124. package/dist/components/Section/Section.js +19 -4
  125. package/dist/components/Section/index.js +3 -1
  126. package/dist/components/SelectInput/SelectInput.css.js +19 -11
  127. package/dist/components/SelectInput/SelectInput.js +60 -11
  128. package/dist/components/SelectInput/index.js +3 -1
  129. package/dist/components/SimplePagination/SimplePagination.js +57 -17
  130. package/dist/components/SimplePagination/index.js +3 -1
  131. package/dist/components/Stack/Divider.css.js +12 -4
  132. package/dist/components/Stack/Divider.js +13 -4
  133. package/dist/components/Stack/Stack.css.js +18 -10
  134. package/dist/components/Stack/Stack.js +47 -23
  135. package/dist/components/Stack/index.js +3 -1
  136. package/dist/components/StandardModal/StandardModal.css.js +69 -57
  137. package/dist/components/StandardModal/StandardModal.js +127 -52
  138. package/dist/components/StandardModal/index.js +3 -1
  139. package/dist/components/StarRating/StarRating.css.js +16 -8
  140. package/dist/components/StarRating/StarRating.js +90 -46
  141. package/dist/components/StarRating/index.js +3 -1
  142. package/dist/components/Stepper/Stepper.css.js +46 -36
  143. package/dist/components/Stepper/Stepper.js +159 -66
  144. package/dist/components/Stepper/index.js +3 -1
  145. package/dist/components/Switch/Switch.css.js +54 -46
  146. package/dist/components/Switch/Switch.js +54 -21
  147. package/dist/components/Switch/index.js +3 -1
  148. package/dist/components/Table/Table.css.js +14 -6
  149. package/dist/components/Table/Table.js +29 -6
  150. package/dist/components/Table/TableCell.css.js +28 -20
  151. package/dist/components/Table/TableCell.js +41 -11
  152. package/dist/components/Table/TableHeadCell.css.js +61 -50
  153. package/dist/components/Table/TableHeadCell.js +86 -40
  154. package/dist/components/Table/TableRow.js +18 -3
  155. package/dist/components/Table/TableRowGroup.js +16 -3
  156. package/dist/components/Table/context.js +21 -10
  157. package/dist/components/Table/index.js +7 -5
  158. package/dist/components/Tabs/Tab.css.js +43 -35
  159. package/dist/components/Tabs/Tab.js +79 -49
  160. package/dist/components/Tabs/TabList.css.js +30 -22
  161. package/dist/components/Tabs/TabList.js +122 -67
  162. package/dist/components/Tabs/TabPane.css.js +11 -3
  163. package/dist/components/Tabs/TabPane.js +32 -15
  164. package/dist/components/Tabs/TabPanes.css.js +16 -8
  165. package/dist/components/Tabs/TabPanes.js +23 -6
  166. package/dist/components/Tabs/Tabs.js +22 -10
  167. package/dist/components/Tabs/index.js +7 -5
  168. package/dist/components/Text/Text.js +37 -15
  169. package/dist/components/Text/index.js +4 -2
  170. package/dist/components/Text/useTextStyles.css.js +42 -20
  171. package/dist/components/Text/useTextStyles.js +20 -5
  172. package/dist/components/TextAreaInput/TextAreaInput.js +35 -7
  173. package/dist/components/TextAreaInput/index.js +3 -1
  174. package/dist/components/TextBubble/TextBubble.css.js +13 -5
  175. package/dist/components/TextBubble/TextBubble.js +66 -29
  176. package/dist/components/TextBubble/index.js +3 -1
  177. package/dist/components/TextContainer/TextContainer.js +44 -9
  178. package/dist/components/TextContainer/index.js +3 -1
  179. package/dist/components/TextInput/TextInput.js +36 -5
  180. package/dist/components/TextInput/index.js +3 -1
  181. package/dist/components/TextLink/TextLink.css.js +23 -15
  182. package/dist/components/TextLink/TextLink.js +63 -24
  183. package/dist/components/TextLink/index.js +3 -1
  184. package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.d.ts +3 -0
  185. package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.d.ts.map +1 -0
  186. package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.js +80 -0
  187. package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts +22 -0
  188. package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts.map +1 -0
  189. package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.js +39 -0
  190. package/dist/components/ThemeOverrideProvider/index.d.ts +3 -0
  191. package/dist/components/ThemeOverrideProvider/index.d.ts.map +1 -0
  192. package/dist/components/ThemeOverrideProvider/index.js +4 -0
  193. package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts +17 -0
  194. package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts.map +1 -0
  195. package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.js +97 -0
  196. package/dist/components/ThemeProvider/ThemeProvider.js +30 -11
  197. package/dist/components/ThemeProvider/index.js +3 -1
  198. package/dist/components/Toaster/Toast.css.js +18 -10
  199. package/dist/components/Toaster/Toast.js +222 -108
  200. package/dist/components/Toaster/index.js +3 -1
  201. package/dist/components/Tooltip/Tooltip.css.js +21 -9
  202. package/dist/components/Tooltip/Tooltip.js +72 -40
  203. package/dist/components/Tooltip/index.js +3 -1
  204. package/dist/components/VisuallyHidden/VisuallyHidden.css.js +13 -5
  205. package/dist/components/VisuallyHidden/VisuallyHidden.js +20 -4
  206. package/dist/components/VisuallyHidden/index.js +3 -1
  207. package/dist/components/index.d.ts +1 -0
  208. package/dist/components/index.d.ts.map +1 -1
  209. package/dist/components/index.js +59 -56
  210. package/dist/components/private/CheckableBase/CheckableBase.css.js +46 -38
  211. package/dist/components/private/CheckableBase/CheckableBase.js +91 -27
  212. package/dist/components/private/CheckableBase/index.js +3 -1
  213. package/dist/components/private/CheckableBase/useCheckableStyles.js +5 -3
  214. package/dist/components/private/InputBase/HintText.css.js +11 -3
  215. package/dist/components/private/InputBase/HintText.js +28 -14
  216. package/dist/components/private/InputBase/InputState.css.js +96 -80
  217. package/dist/components/private/InputBase/NotchedBase.css.js +157 -162
  218. package/dist/components/private/InputBase/NotchedBase.js +116 -76
  219. package/dist/components/private/InputBase/index.js +3 -1
  220. package/dist/components/private/InputBase/withEnhancedInput.css.js +117 -109
  221. package/dist/components/private/InputBase/withEnhancedInput.js +190 -92
  222. package/dist/hooks/useAttachedBoxes/index.js +3 -1
  223. package/dist/hooks/useAttachedBoxes/useAttachedBoxes.css.js +26 -18
  224. package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +71 -46
  225. package/dist/hooks/useMedia/index.js +3 -1
  226. package/dist/hooks/useMedia/useMedia.js +44 -34
  227. package/dist/hooks/useNegativeMargin/useNegativeMargin.js +4 -2
  228. package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.css.js +13 -5
  229. package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.js +6 -4
  230. package/dist/hooks/useNegativeMargin/useNegativeMarginTop.css.js +12 -4
  231. package/dist/hooks/useNegativeMargin/useNegativeMarginTop.js +6 -4
  232. package/dist/hooks/useResponsiveValue/index.js +3 -1
  233. package/dist/hooks/useResponsiveValue/useResponsiveValue.js +14 -14
  234. package/dist/hooks/useWindowScrollLock/index.js +15 -13
  235. package/dist/index.js +7 -5
  236. package/dist/reset/globalFonts.css.js +20 -12
  237. package/dist/reset/globalReset.css.js +21 -13
  238. package/dist/reset/reset.css.js +105 -109
  239. package/dist/themes/base/index.d.ts +1 -0
  240. package/dist/themes/base/index.d.ts.map +1 -1
  241. package/dist/themes/base/index.js +10 -6
  242. package/dist/themes/base/tokens.js +264 -257
  243. package/dist/themes/base/vars.css.js +10 -2
  244. package/dist/themes/flat_red/index.d.ts +1 -0
  245. package/dist/themes/flat_red/index.d.ts.map +1 -1
  246. package/dist/themes/flat_red/index.js +10 -6
  247. package/dist/themes/flat_red/tokens.js +104 -98
  248. package/dist/themes/flat_red/vars.css.js +10 -2
  249. package/dist/themes/helpers.js +60 -51
  250. package/dist/themes/index.js +4 -2
  251. package/dist/themes/makeTheme.js +27 -16
  252. package/dist/themes/theme.css.js +271 -259
  253. package/dist/themes/tokens.js +3 -1
  254. package/dist/utils/index.js +93 -77
  255. package/dist/utils/mapTokenToProperty.js +22 -10
  256. package/dist/utils/number.js +21 -24
  257. package/dist/utils/resolveResponsiveProps.js +29 -31
  258. package/dist/utils/responsiveProps.css.js +29 -17
  259. package/dist/utils/responsiveStyle.js +26 -16
  260. package/package.json +4 -2
@@ -1 +1,3 @@
1
- export { useOutsideClick, OutsideClick } from './OutsideClick';
1
+ "use strict";
2
+
3
+ export { useOutsideClick, OutsideClick } from "./OutsideClick.js";
@@ -1,22 +1,36 @@
1
+ "use strict";
2
+
1
3
  import * as React from 'react';
2
4
  import { useEffect } from 'react';
3
- import { tokens } from '../../themes/base/tokens';
4
- import { isBrowser } from '../../utils';
5
- import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
6
- export const OverdriveProvider = ({ noBodyLevelTheming = false, vars, themeClass, breakpoints, children, }) => {
7
- useEffect(() => {
8
- if (!isBrowser)
9
- return;
10
- if (!noBodyLevelTheming) {
11
- document.body.classList.add(themeClass);
12
- document.body.style.backgroundColor = vars.body.backgroundColour;
13
- document.body.style.color = vars.body.colour;
14
- }
15
- else {
16
- document.body.style.backgroundColor = tokens.body.backgroundColour;
17
- document.body.style.color = tokens.body.colour;
18
- }
19
- }, [vars, themeClass]);
20
- return (React.createElement(ThemeProvider, { vars: vars, themeClass: themeClass, breakpoints: breakpoints }, children));
5
+ import { tokens } from "../../themes/base/tokens.js";
6
+ import { isBrowser } from "../../utils/index.js";
7
+ import { ThemeProvider } from "../ThemeProvider/ThemeProvider.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ export const OverdriveProvider = _ref => {
10
+ let {
11
+ noBodyLevelTheming = false,
12
+ vars,
13
+ themeClass,
14
+ breakpoints,
15
+ children
16
+ } = _ref;
17
+ useEffect(() => {
18
+ if (!isBrowser) return;
19
+
20
+ if (!noBodyLevelTheming) {
21
+ document.body.classList.add(themeClass);
22
+ document.body.style.backgroundColor = vars.body.backgroundColour;
23
+ document.body.style.color = vars.body.colour;
24
+ } else {
25
+ document.body.style.backgroundColor = tokens.body.backgroundColour;
26
+ document.body.style.color = tokens.body.colour;
27
+ }
28
+ }, [vars, themeClass]);
29
+ return _jsx(ThemeProvider, {
30
+ vars: vars,
31
+ themeClass: themeClass,
32
+ breakpoints: breakpoints,
33
+ children: children
34
+ });
21
35
  };
22
- export default OverdriveProvider;
36
+ export default OverdriveProvider;
@@ -1 +1,3 @@
1
- export { OverdriveProvider } from './OverdriveProvider';
1
+ "use strict";
2
+
3
+ export { OverdriveProvider } from "./OverdriveProvider.js";
@@ -1,22 +1,44 @@
1
+ "use strict";
2
+
1
3
  import clsx from 'clsx';
2
4
  import * as React from 'react';
3
- import { Box } from '../Box';
4
- import { useTextStyles } from '../Text';
5
- import * as styles from './Pagination.css';
6
- export const Bubble = ({ className = '', selected = false, gap = false, children, disabled, onClick, }) => {
7
- let backgroundColour = 'transparent';
8
- if (selected)
9
- backgroundColour = 'green900';
10
- else if (disabled)
11
- backgroundColour = 'gray200';
12
- return (React.createElement(Box, { is: "button", backgroundColour: backgroundColour, display: "flex", overflow: "hidden", alignItems: "center", flexDirection: "row", justifyContent: "center", textAlign: "center", borderRadius: "pill", pointerEvents: disabled ? 'none' : void 0, className: clsx(className, useTextStyles({
13
- fontWeight: 'bold',
14
- colour: selected ? 'white' : 'light',
15
- size: '3',
16
- }), {
17
- [styles.selectedItem]: selected,
18
- [styles.disabled]: gap,
19
- [styles.activeItem]: !gap,
20
- }), onClick: onClick }, gap ? '...' : children));
5
+ import { Box } from "../Box/index.js";
6
+ import { useTextStyles } from "../Text/index.js";
7
+ import * as styles from "./Pagination.css.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ export const Bubble = _ref => {
10
+ let {
11
+ className = '',
12
+ selected = false,
13
+ gap = false,
14
+ children,
15
+ disabled,
16
+ onClick
17
+ } = _ref;
18
+ let backgroundColour = 'transparent';
19
+ if (selected) backgroundColour = 'green900';else if (disabled) backgroundColour = 'gray200';
20
+ return _jsx(Box, {
21
+ is: "button",
22
+ backgroundColour: backgroundColour,
23
+ display: "flex",
24
+ overflow: "hidden",
25
+ alignItems: "center",
26
+ flexDirection: "row",
27
+ justifyContent: "center",
28
+ textAlign: "center",
29
+ borderRadius: "pill",
30
+ pointerEvents: disabled ? 'none' : void 0,
31
+ className: clsx(className, useTextStyles({
32
+ fontWeight: 'bold',
33
+ colour: selected ? 'white' : 'light',
34
+ size: '3'
35
+ }), {
36
+ [styles.selectedItem]: selected,
37
+ [styles.disabled]: gap,
38
+ [styles.activeItem]: !gap
39
+ }),
40
+ onClick: onClick,
41
+ children: gap ? '...' : children
42
+ });
21
43
  };
22
- export default Bubble;
44
+ export default Bubble;
@@ -1,26 +1,34 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+
5
+ __vanilla_filescope__.setFileScope("lib/components/Pagination/Pagination.css.ts", "@autoguru/overdrive");
6
+
1
7
  import { style } from '@vanilla-extract/css';
2
- import { themeContractVars as vars } from '../../themes/theme.css';
8
+ import { themeContractVars as vars } from "../../themes/theme.css.js";
3
9
  const paginationBubbleSize = '36px';
4
10
  export const disabled = style({
5
- color: vars.colours.background.neutral,
6
- });
11
+ color: vars.colours.background.neutral
12
+ }, "disabled");
7
13
  export const selectedItem = style({
8
- transition: 'none',
9
- });
14
+ transition: 'none'
15
+ }, "selectedItem");
10
16
  export const activeItem = style({
11
- lineHeight: `calc(${paginationBubbleSize} - 3px)`,
12
- width: paginationBubbleSize,
13
- height: paginationBubbleSize,
14
- cursor: 'pointer',
15
- transition: `background-color 0.2s ${vars.animation.easing.decelerate} 0s, box-shadow 0.2s ${vars.animation.easing.decelerate} 0s`,
16
- selectors: {
17
- [`&:not(${selectedItem}):hover`]: {
18
- backgroundColor: vars.colours.background.body,
19
- boxShadow: `inset 0 0 0 1px ${vars.colours.intent.primary.background.strong}, ${vars.elevation['1']}`,
20
- },
21
- [`&:not(${selectedItem}):active`]: {
22
- backgroundColor: vars.colours.background.body,
23
- boxShadow: `inset 0 0 0 1px ${vars.colours.intent.primary.background.strong}, ${vars.elevation['1']}`,
24
- },
17
+ lineHeight: "calc(".concat(paginationBubbleSize, " - 3px)"),
18
+ width: paginationBubbleSize,
19
+ height: paginationBubbleSize,
20
+ cursor: 'pointer',
21
+ transition: "background-color 0.2s ".concat(vars.animation.easing.decelerate, " 0s, box-shadow 0.2s ").concat(vars.animation.easing.decelerate, " 0s"),
22
+ selectors: {
23
+ ["&:not(".concat(selectedItem, "):hover")]: {
24
+ backgroundColor: vars.colours.background.body,
25
+ boxShadow: "inset 0 0 0 1px ".concat(vars.colours.intent.primary.background.strong, ", ").concat(vars.elevation['1'])
25
26
  },
26
- });
27
+ ["&:not(".concat(selectedItem, "):active")]: {
28
+ backgroundColor: vars.colours.background.body,
29
+ boxShadow: "inset 0 0 0 1px ".concat(vars.colours.intent.primary.background.strong, ", ").concat(vars.elevation['1'])
30
+ }
31
+ }
32
+ }, "activeItem");
33
+
34
+ __vanilla_filescope__.endFileScope();
@@ -1,85 +1,184 @@
1
+ "use strict";
2
+
1
3
  import { ChevronLeftIcon, ChevronRightIcon } from '@autoguru/icons';
2
4
  import clsx from 'clsx';
3
5
  import * as React from 'react';
4
- import { useCallback, useMemo, } from 'react';
5
- import { noop } from '../../utils';
6
- import { Box } from '../Box';
7
- import { Icon } from '../Icon';
8
- import { Inline } from '../Inline';
9
- import { useTextStyles } from '../Text';
10
- import { Bubble } from './Bubble';
11
- import * as styles from './Pagination.css';
12
- const NavButton = ({ icon, disabled, label = '', onClick = noop, }) => (React.createElement(Box, { is: "button", "aria-disabled": disabled, "aria-label": label, display: "flex", overflow: "hidden", alignItems: "center", flexDirection: "row", justifyContent: "center", textAlign: "center", borderRadius: "pill", padding: "2", userSelect: "none", pointerEvents: disabled ? 'none' : void 0, className: clsx(useTextStyles({ colour: 'light' }), {
13
- [styles.disabled]: disabled,
14
- }), onClick: onClick },
15
- React.createElement(Icon, { size: "medium", icon: icon })));
16
- const Loading = ({ placeholderBubblesNum = 3, }) => (React.createElement(Inline, { is: "span", space: "3" },
17
- React.createElement(NavButton, { disabled: true, icon: ChevronLeftIcon }),
18
- Array.from({ length: placeholderBubblesNum })
19
- .fill('')
20
- .map((_, index) => (React.createElement(Bubble, { key: index, children: "", disabled: true, className: styles.disabled }))),
21
- React.createElement(NavButton, { disabled: true, icon: ChevronRightIcon })));
22
- export const Pagination = ({ total, pageSize, activePage, numPagesDisplayed = 5, loading = false, onChange = noop, }) => {
23
- const numPages = useMemo(() => calcPagesNum(total, pageSize), [total, pageSize]);
24
- const handleClick = useCallback((num) => () => {
25
- onChange({ pageNumber: withinBoundaries(num, numPages) });
26
- }, [numPages]);
27
- const allowedActive = useMemo(() => withinBoundaries(activePage, numPages), [activePage, numPages]);
28
- return !loading && total && pageSize && activePage && numPagesDisplayed ? (React.createElement(Inline, { is: "nav", space: "3", "aria-label": "pagination" },
29
- React.createElement(NavButton, { disabled: activePage <= 1, label: "navigate back", icon: ChevronLeftIcon, onClick: handleClick(activePage - 1) }),
30
- buildPagesList(numPages, allowedActive, numPagesDisplayed, numPages - numPagesDisplayed).map((num) => (React.createElement(Bubble, { key: num, gap: num < 0, selected: allowedActive === num, "aria-current": allowedActive === num ? 'page' : 'false', onClick: handleClick(num) }, num))),
31
- React.createElement(NavButton, { disabled: activePage >= numPages, label: "navigate forward", icon: ChevronRightIcon, onClick: handleClick(allowedActive + 1) }))) : (React.createElement(Loading, { placeholderBubblesNum: 3 }));
6
+ import { useCallback, useMemo } from 'react';
7
+ import { noop } from "../../utils/index.js";
8
+ import { Box } from "../Box/index.js";
9
+ import { Icon } from "../Icon/index.js";
10
+ import { Inline } from "../Inline/index.js";
11
+ import { useTextStyles } from "../Text/index.js";
12
+ import { Bubble } from "./Bubble.js";
13
+ import * as styles from "./Pagination.css.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
+
17
+ const NavButton = _ref => {
18
+ let {
19
+ icon,
20
+ disabled,
21
+ label = '',
22
+ onClick = noop
23
+ } = _ref;
24
+ return _jsx(Box, {
25
+ is: "button",
26
+ "aria-disabled": disabled,
27
+ "aria-label": label,
28
+ display: "flex",
29
+ overflow: "hidden",
30
+ alignItems: "center",
31
+ flexDirection: "row",
32
+ justifyContent: "center",
33
+ textAlign: "center",
34
+ borderRadius: "pill",
35
+ padding: "2",
36
+ userSelect: "none",
37
+ pointerEvents: disabled ? 'none' : void 0,
38
+ className: clsx(useTextStyles({
39
+ colour: 'light'
40
+ }), {
41
+ [styles.disabled]: disabled
42
+ }),
43
+ onClick: onClick,
44
+ children: _jsx(Icon, {
45
+ size: "medium",
46
+ icon: icon
47
+ })
48
+ });
32
49
  };
50
+
51
+ const Loading = _ref2 => {
52
+ let {
53
+ placeholderBubblesNum = 3
54
+ } = _ref2;
55
+ return _jsxs(Inline, {
56
+ is: "span",
57
+ space: "3",
58
+ children: [_jsx(NavButton, {
59
+ disabled: true,
60
+ icon: ChevronLeftIcon
61
+ }), Array.from({
62
+ length: placeholderBubblesNum
63
+ }).fill('').map((_, index) => _jsx(Bubble, {
64
+ children: "",
65
+ disabled: true,
66
+ className: styles.disabled
67
+ }, index)), _jsx(NavButton, {
68
+ disabled: true,
69
+ icon: ChevronRightIcon
70
+ })]
71
+ });
72
+ };
73
+
74
+ export const Pagination = _ref3 => {
75
+ let {
76
+ total,
77
+ pageSize,
78
+ activePage,
79
+ numPagesDisplayed = 5,
80
+ loading = false,
81
+ onChange = noop
82
+ } = _ref3;
83
+ const numPages = useMemo(() => calcPagesNum(total, pageSize), [total, pageSize]);
84
+ const handleClick = useCallback(num => () => {
85
+ onChange({
86
+ pageNumber: withinBoundaries(num, numPages)
87
+ });
88
+ }, [numPages]);
89
+ const allowedActive = useMemo(() => withinBoundaries(activePage, numPages), [activePage, numPages]);
90
+ return !loading && total && pageSize && activePage && numPagesDisplayed ? _jsxs(Inline, {
91
+ is: "nav",
92
+ space: "3",
93
+ "aria-label": "pagination",
94
+ children: [_jsx(NavButton, {
95
+ disabled: activePage <= 1,
96
+ label: "navigate back",
97
+ icon: ChevronLeftIcon,
98
+ onClick: handleClick(activePage - 1)
99
+ }), buildPagesList(numPages, allowedActive, numPagesDisplayed, numPages - numPagesDisplayed).map(num => _jsx(Bubble, {
100
+ gap: num < 0,
101
+ selected: allowedActive === num,
102
+ "aria-current": allowedActive === num ? 'page' : 'false',
103
+ onClick: handleClick(num),
104
+ children: num
105
+ }, num)), _jsx(NavButton, {
106
+ disabled: activePage >= numPages,
107
+ label: "navigate forward",
108
+ icon: ChevronRightIcon,
109
+ onClick: handleClick(allowedActive + 1)
110
+ })]
111
+ }) : _jsx(Loading, {
112
+ placeholderBubblesNum: 3
113
+ });
114
+ };
115
+
33
116
  function calcPagesNum(total, pageSize) {
34
- return Math.ceil(total / pageSize);
117
+ return Math.ceil(total / pageSize);
35
118
  }
119
+
36
120
  function withinBoundaries(activePage, numPages) {
37
- return Math.min(Math.max(1, activePage), numPages);
121
+ return Math.min(Math.max(1, activePage), numPages);
38
122
  }
123
+
39
124
  function generateDefaultArray(numPages) {
40
- return Array.from({ length: numPages })
41
- .fill(-1)
42
- .map((_, index) => index + 1);
125
+ return Array.from({
126
+ length: numPages
127
+ }).fill(-1).map((_, index) => index + 1);
43
128
  }
129
+
44
130
  function generateJumpForwardArray(numPages, activePage, numPagesDisplayed) {
45
- return generateDefaultArray(numPagesDisplayed).map((_, index) => {
46
- const num = index + 1;
47
- const gapIndex = numPagesDisplayed - 1;
48
- if (num < gapIndex) {
49
- return activePage + index;
50
- }
51
- if (num === gapIndex) {
52
- return -1;
53
- }
54
- return numPages;
55
- });
131
+ return generateDefaultArray(numPagesDisplayed).map((_, index) => {
132
+ const num = index + 1;
133
+ const gapIndex = numPagesDisplayed - 1;
134
+
135
+ if (num < gapIndex) {
136
+ return activePage + index;
137
+ }
138
+
139
+ if (num === gapIndex) {
140
+ return -1;
141
+ }
142
+
143
+ return numPages;
144
+ });
56
145
  }
146
+
57
147
  function generateNoJumpArray(numPagesDisplayed, rightBoundary) {
58
- return generateDefaultArray(numPagesDisplayed).map((_, index) => rightBoundary + index + 1);
148
+ return generateDefaultArray(numPagesDisplayed).map((_, index) => rightBoundary + index + 1);
59
149
  }
150
+
60
151
  function generateJumpBackwardArray(numPages, numPagesDisplayed) {
61
- return generateDefaultArray(numPagesDisplayed).map((_, index) => {
62
- const num = index + 1;
63
- const gapIndex = 2;
64
- if (num === 1) {
65
- return 1;
66
- }
67
- if (num === gapIndex) {
68
- return -1;
69
- }
70
- return numPages - 4 + index;
71
- });
72
- }
73
- function buildPagesList(numPages, activePage, numPagesDisplayed, rightBoundary) {
74
- if (numPages <= numPagesDisplayed) {
75
- return generateDefaultArray(numPages);
152
+ return generateDefaultArray(numPagesDisplayed).map((_, index) => {
153
+ const num = index + 1;
154
+ const gapIndex = 2;
155
+
156
+ if (num === 1) {
157
+ return 1;
76
158
  }
77
- if (activePage <= rightBoundary) {
78
- return generateJumpForwardArray(numPages, activePage, numPagesDisplayed);
159
+
160
+ if (num === gapIndex) {
161
+ return -1;
79
162
  }
80
- if (activePage > rightBoundary && activePage <= rightBoundary + 2) {
81
- return generateNoJumpArray(numPagesDisplayed, rightBoundary);
82
- }
83
- return generateJumpBackwardArray(numPages, numPagesDisplayed);
163
+
164
+ return numPages - 4 + index;
165
+ });
166
+ }
167
+
168
+ function buildPagesList(numPages, activePage, numPagesDisplayed, rightBoundary) {
169
+ if (numPages <= numPagesDisplayed) {
170
+ return generateDefaultArray(numPages);
171
+ }
172
+
173
+ if (activePage <= rightBoundary) {
174
+ return generateJumpForwardArray(numPages, activePage, numPagesDisplayed);
175
+ }
176
+
177
+ if (activePage > rightBoundary && activePage <= rightBoundary + 2) {
178
+ return generateNoJumpArray(numPagesDisplayed, rightBoundary);
179
+ }
180
+
181
+ return generateJumpBackwardArray(numPages, numPagesDisplayed);
84
182
  }
85
- export default Pagination;
183
+
184
+ export default Pagination;
@@ -1 +1,3 @@
1
- export { Pagination } from './Pagination';
1
+ "use strict";
2
+
3
+ export { Pagination } from "./Pagination.js";
@@ -1,30 +1,46 @@
1
+ "use strict";
2
+
1
3
  import * as React from 'react';
2
4
  import { forwardRef, useLayoutEffect, useState } from 'react';
3
5
  import { createPortal } from 'react-dom';
4
- import { isBrowser, isHtmlElement, setRef } from '../../utils';
5
- import { useTheme } from '../ThemeProvider';
6
- function Portal({ children, container, noThemedWrapper }, ref) {
7
- const themeClass = useTheme()?.themeClass;
8
- const [mountNode, setMountNode] = useState(null);
9
- if (isBrowser) {
10
- useLayoutEffect(() => {
11
- setMountNode(isHtmlElement(container) ? container : document.body);
12
- }, [container]);
13
- useLayoutEffect(() => {
14
- if (mountNode) {
15
- setRef(ref, mountNode);
16
- }
17
- return () => {
18
- void setRef(ref, null);
19
- };
20
- }, [ref, mountNode]);
21
- }
22
- if (!mountNode)
23
- return null;
24
- return noThemedWrapper
25
- ? createPortal(children, mountNode)
26
- : createPortal(React.createElement("div", { className: themeClass }, children), mountNode);
6
+ import { isBrowser, isHtmlElement, setRef } from "../../utils/index.js";
7
+ import { useTheme } from "../ThemeProvider/index.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+
10
+ function Portal(_ref, ref) {
11
+ var _useTheme;
12
+
13
+ let {
14
+ children,
15
+ container,
16
+ noThemedWrapper
17
+ } = _ref;
18
+ const themeClass = (_useTheme = useTheme()) === null || _useTheme === void 0 ? void 0 : _useTheme.themeClass;
19
+ const [mountNode, setMountNode] = useState(null);
20
+
21
+ if (isBrowser) {
22
+ useLayoutEffect(() => {
23
+ setMountNode(isHtmlElement(container) ? container : document.body);
24
+ }, [container]);
25
+ useLayoutEffect(() => {
26
+ if (mountNode) {
27
+ setRef(ref, mountNode);
28
+ }
29
+
30
+ return () => {
31
+ void setRef(ref, null);
32
+ };
33
+ }, [ref, mountNode]);
34
+ }
35
+
36
+ if (!mountNode) return null;
37
+ return noThemedWrapper ? createPortal(children, mountNode) : createPortal(_jsx("div", {
38
+ className: themeClass,
39
+ children: children
40
+ }), mountNode);
27
41
  }
42
+
28
43
  const _Portal = forwardRef(Portal);
44
+
29
45
  export { _Portal as Portal };
30
- export default Portal;
46
+ export default Portal;
@@ -1 +1,3 @@
1
- export { Portal } from './Portal';
1
+ "use strict";
2
+
3
+ export { Portal } from "./Portal.js";
@@ -1,8 +1,16 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+
5
+ __vanilla_filescope__.setFileScope("lib/components/Positioner/Positioner.css.ts", "@autoguru/overdrive");
6
+
1
7
  import { style } from '@vanilla-extract/css';
2
8
  export const root = style({
3
- zIndex: 1050,
4
- top: 0,
5
- left: 0,
6
- transform: 'translateZ(0)',
7
- willChange: 'transform',
8
- });
9
+ zIndex: 1050,
10
+ top: 0,
11
+ left: 0,
12
+ transform: 'translateZ(0)',
13
+ willChange: 'transform'
14
+ }, "root");
15
+
16
+ __vanilla_filescope__.endFileScope();