@autoguru/overdrive 4.43.9-next.0 → 4.43.10-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Actions/Actions.d.ts +3 -3
- package/dist/components/Actions/Actions.d.ts.map +1 -1
- package/dist/components/Actions/Actions.js +4 -3
- package/dist/components/Alert/Alert.d.ts +3 -3
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +11 -11
- package/dist/components/Anchor/Anchor.d.ts +4 -3
- package/dist/components/Anchor/Anchor.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.js +21 -19
- package/dist/components/AutoSuggest/AutoSuggest.js +52 -34
- package/dist/components/AutoSuggest/useLayoutSuggestionVisible.js +1 -0
- package/dist/components/Badge/Badge.d.ts +13 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +7 -1
- package/dist/components/Box/Box.d.ts +7 -0
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +11 -2
- package/dist/components/Box/newBox/NewBox.d.ts +23 -0
- package/dist/components/Box/newBox/NewBox.d.ts.map +1 -1
- package/dist/components/Box/newBox/NewBox.js +25 -2
- package/dist/components/Box/newBox/useBox.d.ts +24 -0
- package/dist/components/Box/newBox/useBox.d.ts.map +1 -1
- package/dist/components/Box/newBox/useBox.js +38 -1
- package/dist/components/BulletList/Bullet.js +2 -2
- package/dist/components/BulletList/BulletList.js +2 -2
- package/dist/components/BulletList/context.js +1 -1
- package/dist/components/BulletText/BulletText.d.ts.map +1 -1
- package/dist/components/BulletText/BulletText.js +13 -12
- package/dist/components/Button/Button.css.d.ts +9 -0
- package/dist/components/Button/Button.css.d.ts.map +1 -1
- package/dist/components/Button/Button.css.js +12 -2
- package/dist/components/Button/Button.d.ts +11 -2
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +23 -11
- package/dist/components/CheckBox/CheckBox.d.ts +4 -0
- package/dist/components/CheckBox/CheckBox.d.ts.map +1 -1
- package/dist/components/CheckBox/CheckBox.js +4 -4
- package/dist/components/ColourInput/ColourInput.d.ts.map +1 -1
- package/dist/components/ColourInput/ColourInput.js +10 -9
- package/dist/components/Columns/Column.css.js +1 -0
- package/dist/components/Columns/Column.js +3 -3
- package/dist/components/Columns/ColumnGrid.css.js +1 -1
- package/dist/components/Columns/Columns.d.ts +3 -3
- package/dist/components/Columns/Columns.d.ts.map +1 -1
- package/dist/components/Columns/Columns.js +4 -4
- package/dist/components/DateInput/DateInput.js +1 -1
- package/dist/components/DatePicker/DatePicker.js +6 -6
- package/dist/components/DateTimePicker/CalendarButton.js +1 -1
- package/dist/components/DateTimePicker/CalendarGrid.js +10 -10
- package/dist/components/DateTimePicker/DateTimePicker.css.js +9 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +39 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +50 -17
- package/dist/components/DividerLine/DividerLine.js +1 -1
- package/dist/components/DropDown/DropDown.js +5 -5
- package/dist/components/DropDown/DropDownOption.js +4 -4
- package/dist/components/DropDown/DropDownOptionsList.js +4 -4
- package/dist/components/EditableText/EditableText.d.ts +2 -2
- package/dist/components/EditableText/EditableText.d.ts.map +1 -1
- package/dist/components/EditableText/EditableText.js +10 -10
- package/dist/components/FillHeightBox/FillHeightBox.js +2 -1
- package/dist/components/Flyout/Flyout.d.ts +2 -2
- package/dist/components/Flyout/Flyout.d.ts.map +1 -1
- package/dist/components/Flyout/Flyout.js +3 -3
- package/dist/components/Heading/Heading.d.ts +6 -1
- package/dist/components/Heading/Heading.d.ts.map +1 -1
- package/dist/components/Heading/Heading.js +10 -3
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts +2 -2
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts.map +1 -1
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.js +19 -18
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/Image/Image.d.ts +3 -0
- package/dist/components/Image/Image.d.ts.map +1 -1
- package/dist/components/Image/Image.js +2 -2
- package/dist/components/Image/ImageServerProvider.js +7 -2
- package/dist/components/Image/ResponsiveImage.d.ts +22 -0
- package/dist/components/Image/ResponsiveImage.d.ts.map +1 -1
- package/dist/components/Image/ResponsiveImage.js +2 -1
- package/dist/components/Image/SimpleImage.d.ts +18 -0
- package/dist/components/Image/SimpleImage.d.ts.map +1 -1
- package/dist/components/Image/SimpleImage.js +6 -2
- package/dist/components/Inline/Inline.d.ts +9 -6
- package/dist/components/Inline/Inline.d.ts.map +1 -1
- package/dist/components/Inline/Inline.js +53 -46
- package/dist/components/IntentStripe/IntentStripe.js +1 -1
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +4 -4
- package/dist/components/LoadingBox/LoadingBox.js +1 -1
- package/dist/components/Meta/Meta.js +3 -3
- package/dist/components/MinimalModal/MinimalModal.js +4 -4
- package/dist/components/Modal/Modal.js +7 -6
- package/dist/components/NumberBubble/NumberBubble.js +2 -2
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/NumberInput/useNumberInputBehaviours.js +9 -3
- package/dist/components/OptionGrid/OptionGrid.css.js +7 -1
- package/dist/components/OptionGrid/OptionGrid.d.ts +32 -0
- package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.js +26 -12
- package/dist/components/OptionList/OptionList.css.js +5 -1
- package/dist/components/OptionList/OptionList.d.ts +25 -0
- package/dist/components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/components/OptionList/OptionList.js +19 -6
- package/dist/components/OptionList/OptionListItem.d.ts +10 -0
- package/dist/components/OptionList/OptionListItem.d.ts.map +1 -1
- package/dist/components/OptionList/OptionListItem.js +16 -9
- package/dist/components/OrderedList/OrderedList.css.d.ts +0 -1
- package/dist/components/OrderedList/OrderedList.css.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.css.js +1 -8
- package/dist/components/OrderedList/OrderedList.d.ts +4 -4
- package/dist/components/OrderedList/OrderedList.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.js +11 -9
- package/dist/components/OutsideClick/OutsideClick.js +4 -1
- package/dist/components/OverdriveProvider/FallbackProvider.d.ts +3 -0
- package/dist/components/OverdriveProvider/FallbackProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/FallbackProvider.js +5 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts +5 -0
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +10 -6
- package/dist/components/OverdriveProvider/ThemeOverrideDebugger.js +7 -7
- package/dist/components/OverdriveProvider/index.d.ts +2 -1
- package/dist/components/OverdriveProvider/index.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/index.js +3 -1
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts +1 -0
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/useColorOverrides.js +9 -0
- package/dist/components/Pagination/Bubble.js +1 -1
- package/dist/components/Pagination/Pagination.js +11 -11
- package/dist/components/Portal/Portal.js +5 -2
- package/dist/components/Positioner/Positioner.js +18 -2
- package/dist/components/Positioner/alignment.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +3 -3
- package/dist/components/ProgressBarGroup/ProgressBarGroup.js +5 -5
- package/dist/components/ProgressSpinner/ProgressSpinner.js +3 -3
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/Radio/RadioGroup.js +4 -4
- package/dist/components/ScrollPane/ScrollPane.js +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +17 -0
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.js +21 -9
- package/dist/components/Section/Section.d.ts +3 -3
- package/dist/components/Section/Section.d.ts.map +1 -1
- package/dist/components/Section/Section.js +4 -3
- package/dist/components/SelectInput/SelectInput.js +6 -6
- package/dist/components/SimplePagination/SimplePagination.js +6 -6
- package/dist/components/SliderProgress/ProgressStep.js +4 -4
- package/dist/components/SliderProgress/SliderProgress.js +3 -3
- package/dist/components/Stack/Divider.d.ts +3 -0
- package/dist/components/Stack/Divider.d.ts.map +1 -0
- package/dist/components/Stack/Divider.js +13 -0
- package/dist/components/Stack/Stack.d.ts +6 -10
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js +28 -28
- package/dist/components/StandardModal/StandardModal.d.ts +2 -2
- package/dist/components/StandardModal/StandardModal.d.ts.map +1 -1
- package/dist/components/StandardModal/StandardModal.js +13 -11
- package/dist/components/StarRating/StarRating.js +11 -9
- package/dist/components/Stepper/Stepper.js +10 -10
- package/dist/components/StickyBox/StickyBox.js +4 -3
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +10 -5
- package/dist/components/Table/Table.css.js +4 -0
- package/dist/components/Table/Table.js +9 -3
- package/dist/components/Table/TableCell.css.js +5 -0
- package/dist/components/Table/TableCell.js +7 -4
- package/dist/components/Table/TableHeadCell.js +7 -7
- package/dist/components/Table/TableRow.js +2 -2
- package/dist/components/Table/TableRowGroup.js +2 -2
- package/dist/components/Table/context.js +2 -2
- package/dist/components/Tabs/Tab.d.ts +3 -3
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +6 -6
- package/dist/components/Tabs/TabList.js +10 -10
- package/dist/components/Tabs/TabPane.js +1 -1
- package/dist/components/Tabs/TabPanes.d.ts +1 -0
- package/dist/components/Tabs/TabPanes.d.ts.map +1 -1
- package/dist/components/Tabs/TabPanes.js +3 -3
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Text/Text.d.ts +3 -5
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +5 -2
- package/dist/components/Text/textStyles.d.ts +3 -0
- package/dist/components/Text/textStyles.d.ts.map +1 -1
- package/dist/components/Text/textStyles.js +5 -0
- package/dist/components/TextAreaInput/TextAreaInput.js +1 -1
- package/dist/components/TextBubble/TextBubble.d.ts +5 -5
- package/dist/components/TextBubble/TextBubble.d.ts.map +1 -1
- package/dist/components/TextBubble/TextBubble.js +4 -3
- package/dist/components/TextContainer/TextContainer.js +4 -4
- package/dist/components/TextInput/TextInput.js +1 -1
- package/dist/components/TextLink/TextLink.css.d.ts +0 -1
- package/dist/components/TextLink/TextLink.css.d.ts.map +1 -1
- package/dist/components/TextLink/TextLink.css.js +0 -5
- package/dist/components/TextLink/TextLink.d.ts +7 -8
- package/dist/components/TextLink/TextLink.d.ts.map +1 -1
- package/dist/components/TextLink/TextLink.js +19 -19
- package/dist/components/Toaster/Toast.js +20 -10
- package/dist/components/Tooltip/Tooltip.d.ts +25 -5
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +61 -82
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +5 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.js +6 -1
- package/dist/components/private/CheckableBase/CheckableBase.css.js +2 -0
- package/dist/components/private/CheckableBase/CheckableBase.js +6 -6
- package/dist/components/private/CheckableBase/useCheckableStyles.d.ts +3 -0
- package/dist/components/private/CheckableBase/useCheckableStyles.d.ts.map +1 -1
- package/dist/components/private/CheckableBase/useCheckableStyles.js +3 -0
- package/dist/components/private/InputBase/HintText.js +1 -1
- package/dist/components/private/InputBase/NotchedBase.js +7 -7
- package/dist/components/private/InputBase/withEnhancedInput.css.js +1 -0
- package/dist/components/private/InputBase/withEnhancedInput.d.ts +1 -1
- package/dist/components/private/InputBase/withEnhancedInput.d.ts.map +1 -1
- package/dist/components/private/InputBase/withEnhancedInput.js +32 -10
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +2 -1
- package/dist/hooks/useDeepCompareMemo/index.d.ts +4 -0
- package/dist/hooks/useDeepCompareMemo/index.d.ts.map +1 -1
- package/dist/hooks/useDeepCompareMemo/index.js +12 -0
- package/dist/hooks/useMedia/useMedia.js +1 -0
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +3 -1
- package/dist/hooks/useTooltip/index.d.ts +2 -0
- package/dist/hooks/useTooltip/index.d.ts.map +1 -0
- package/dist/hooks/useTooltip/index.js +3 -0
- package/dist/hooks/useTooltip/useTooltip.d.ts +38 -0
- package/dist/hooks/useTooltip/useTooltip.d.ts.map +1 -0
- package/dist/hooks/useTooltip/useTooltip.js +125 -0
- package/dist/hooks/useWindowHeightFill/useWindowHeightFill.js +1 -0
- package/dist/hooks/useWindowScrollLock/index.js +2 -0
- package/dist/styles/componentStyles.d.ts +14 -1
- package/dist/styles/componentStyles.d.ts.map +1 -1
- package/dist/styles/componentStyles.js +17 -3
- package/dist/styles/componentStyles.spec.d.ts +2 -0
- package/dist/styles/componentStyles.spec.d.ts.map +1 -0
- package/dist/styles/componentStyles.spec.js +251 -0
- package/dist/styles/elementReset.css.d.ts +1 -0
- package/dist/styles/elementReset.css.d.ts.map +1 -1
- package/dist/styles/elementReset.css.js +4 -0
- package/dist/styles/global/reset.css.js +2 -0
- package/dist/styles/layers.css.d.ts +3 -2
- package/dist/styles/layers.css.d.ts.map +1 -1
- package/dist/styles/layers.css.js +6 -2
- package/dist/styles/sprinkles.css.d.ts +11 -11
- package/dist/styles/sprinkles.css.d.ts.map +1 -1
- package/dist/styles/sprinkles.css.js +39 -14
- package/dist/styles/typography.css.d.ts +14 -0
- package/dist/styles/typography.css.d.ts.map +1 -1
- package/dist/styles/typography.css.js +5 -0
- package/dist/styles/vars.css.js +2 -0
- package/dist/themes/base/theme.css.js +3 -1
- package/dist/themes/base/tokens.d.ts +3 -0
- package/dist/themes/base/tokens.d.ts.map +1 -1
- package/dist/themes/base/tokens.js +3 -0
- package/dist/themes/helpers.d.ts +22 -0
- package/dist/themes/helpers.d.ts.map +1 -1
- package/dist/themes/helpers.js +24 -0
- package/dist/themes/makeTheme.d.ts +3 -0
- package/dist/themes/makeTheme.d.ts.map +1 -1
- package/dist/themes/makeTheme.js +7 -1
- package/dist/themes/theme.css.d.ts +4 -0
- package/dist/themes/theme.css.d.ts.map +1 -1
- package/dist/themes/theme.css.js +16 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/css.d.ts +15 -0
- package/dist/utils/css.d.ts.map +1 -1
- package/dist/utils/css.js +18 -0
- package/dist/utils/dataAttrs.d.ts +3 -0
- package/dist/utils/dataAttrs.d.ts.map +1 -1
- package/dist/utils/dataAttrs.js +3 -0
- package/dist/utils/estimateTextWidth.js +3 -2
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +39 -0
- package/dist/utils/number.js +7 -2
- package/dist/utils/propGuards.d.ts +14 -0
- package/dist/utils/propGuards.d.ts.map +1 -1
- package/dist/utils/propGuards.js +14 -0
- package/dist/utils/responsiveProps.css.js +1 -1
- package/dist/utils/sprinkles.d.ts +18 -0
- package/dist/utils/sprinkles.d.ts.map +1 -1
- package/dist/utils/sprinkles.js +21 -1
- package/package.json +19 -19
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Children, isValidElement } from 'react';
|
|
4
5
|
import flattenChildren from 'react-keyed-flatten-children';
|
|
6
|
+
import { useNegativeMarginLeft, useNegativeMarginTop } from "../../hooks/useNegativeMargin/useNegativeMargin.js";
|
|
5
7
|
import { Box } from "../Box/Box.js";
|
|
6
|
-
import { LIST_MAP } from "../Stack/Stack.js";
|
|
7
8
|
import { Text } from "../Text/Text.js";
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
children
|
|
12
|
-
} = _ref;
|
|
13
|
-
if (!children) return null;
|
|
14
|
-
if (typeof children === 'boolean') return _jsx(Text, {
|
|
15
|
-
"aria-hidden": true,
|
|
16
|
-
children: "\u2022"
|
|
17
|
-
});
|
|
18
|
-
if (isValidElement(children)) return _jsx("div", {
|
|
19
|
-
"aria-hidden": true,
|
|
20
|
-
children: children
|
|
21
|
-
});
|
|
22
|
-
return _jsx(Text, {
|
|
23
|
-
"aria-hidden": true,
|
|
24
|
-
children: children
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
export const Inline = _ref2 => {
|
|
9
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const supportedListTypes = ['ul', 'ol'];
|
|
11
|
+
export const Inline = _ref => {
|
|
28
12
|
let {
|
|
29
13
|
as = 'div',
|
|
30
|
-
alignX,
|
|
31
|
-
alignY = 'center',
|
|
32
14
|
children,
|
|
33
|
-
dividers,
|
|
34
|
-
noWrap,
|
|
35
15
|
space = '2',
|
|
16
|
+
alignY = 'center',
|
|
17
|
+
alignX,
|
|
18
|
+
noWrap,
|
|
19
|
+
dividers,
|
|
36
20
|
width
|
|
37
|
-
} =
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
} = _ref;
|
|
22
|
+
const negativeMarginLeft = useNegativeMarginLeft(space);
|
|
23
|
+
const negativeMarginTop = useNegativeMarginTop(space);
|
|
24
|
+
const items = flattenChildren(children);
|
|
25
|
+
if (items.length < 2) {
|
|
26
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
27
|
+
children: items
|
|
28
|
+
});
|
|
41
29
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
const divider = renderDivider(dividers);
|
|
31
|
+
let listItem = 'div';
|
|
32
|
+
if (typeof as === 'string') listItem = supportedListTypes.includes(as) ? 'li' : 'div';
|
|
33
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
45
34
|
as: as,
|
|
35
|
+
width: width,
|
|
36
|
+
position: "relative",
|
|
46
37
|
display: "flex",
|
|
38
|
+
alignItems: alignY,
|
|
39
|
+
justifyContent: alignX,
|
|
47
40
|
flexDirection: "row",
|
|
48
41
|
flexWrap: noWrap ? 'nowrap' : 'wrap',
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
width: width,
|
|
53
|
-
children: Children.map(items, (child, idx) => child && _jsxs(Box, {
|
|
54
|
-
alignItems: alignY,
|
|
55
|
-
as: childEl,
|
|
42
|
+
className: [negativeMarginTop, !dividers && negativeMarginLeft],
|
|
43
|
+
children: Children.map(items, (child, idx) => child !== null && child !== undefined ? /*#__PURE__*/_jsxs(Box, {
|
|
44
|
+
as: listItem,
|
|
56
45
|
display: "flex",
|
|
46
|
+
flexDirection: "row",
|
|
57
47
|
flexWrap: "nowrap",
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
alignItems: alignY,
|
|
49
|
+
paddingTop: space,
|
|
50
|
+
paddingLeft: dividers ? undefined : space,
|
|
51
|
+
children: [child, dividers && idx !== items.length - 1 ? /*#__PURE__*/_jsx(Box, {
|
|
52
|
+
paddingX: space,
|
|
53
|
+
children: divider
|
|
54
|
+
}) : null]
|
|
55
|
+
}) : null)
|
|
63
56
|
});
|
|
64
|
-
};
|
|
57
|
+
};
|
|
58
|
+
const renderDivider = dividers => {
|
|
59
|
+
if (typeof dividers === 'boolean') {
|
|
60
|
+
return dividers ? /*#__PURE__*/_jsx(Text, {
|
|
61
|
+
children: "\u2022"
|
|
62
|
+
}) : null;
|
|
63
|
+
}
|
|
64
|
+
if (/*#__PURE__*/isValidElement(dividers)) {
|
|
65
|
+
return dividers;
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
68
|
+
children: dividers
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export default Inline;
|
|
@@ -5,23 +5,23 @@ import { memo } from 'react';
|
|
|
5
5
|
import { Box } from "../Box/index.js";
|
|
6
6
|
import * as styles from "./LinearProgressIndicator.css.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
export const LinearProgressIndicator = memo(_ref => {
|
|
8
|
+
export const LinearProgressIndicator = /*#__PURE__*/memo(_ref => {
|
|
9
9
|
let {
|
|
10
10
|
className = ''
|
|
11
11
|
} = _ref;
|
|
12
|
-
return _jsx(Box, {
|
|
12
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
13
13
|
position: "relative",
|
|
14
14
|
overflow: "hidden",
|
|
15
15
|
width: "full",
|
|
16
16
|
backgroundColour: "gray200",
|
|
17
17
|
className: [styles.root, className],
|
|
18
18
|
odComponent: "linear-progress-indicator",
|
|
19
|
-
children: _jsx(Box, {
|
|
19
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
20
20
|
position: "absolute",
|
|
21
21
|
width: "full",
|
|
22
22
|
height: "full",
|
|
23
23
|
className: styles.linearProgressBar,
|
|
24
|
-
children: _jsx(Box, {
|
|
24
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
25
25
|
as: "span",
|
|
26
26
|
backgroundColour: "green300",
|
|
27
27
|
position: "absolute",
|
|
@@ -19,7 +19,7 @@ export const LoadingBox = _ref => {
|
|
|
19
19
|
as = 'span'
|
|
20
20
|
} = _ref,
|
|
21
21
|
boxStyles = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
return _jsx(Box, _objectSpread(_objectSpread({
|
|
22
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
23
23
|
as: as,
|
|
24
24
|
display: display,
|
|
25
25
|
width: randomWidth ? undefined : 'full',
|
|
@@ -13,15 +13,15 @@ export const Meta = _ref => {
|
|
|
13
13
|
variant = 'primary',
|
|
14
14
|
breakWord
|
|
15
15
|
} = _ref;
|
|
16
|
-
return _jsxs(Inline, {
|
|
16
|
+
return /*#__PURE__*/_jsxs(Inline, {
|
|
17
17
|
noWrap: true,
|
|
18
18
|
as: "span",
|
|
19
19
|
space: "2",
|
|
20
20
|
alignY: "center",
|
|
21
|
-
children: [icon && _jsx(Icon, {
|
|
21
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
22
22
|
icon: icon,
|
|
23
23
|
className: styles.variant[variant]
|
|
24
|
-
}), _jsx(Text, {
|
|
24
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
25
25
|
breakWord: breakWord,
|
|
26
26
|
children: label
|
|
27
27
|
})]
|
|
@@ -38,11 +38,11 @@ export const MinimalModal = _ref => {
|
|
|
38
38
|
};
|
|
39
39
|
}, [isOpen]);
|
|
40
40
|
}
|
|
41
|
-
return _jsx(Modal, _objectSpread(_objectSpread({
|
|
41
|
+
return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
|
|
42
42
|
isOpen: isOpen,
|
|
43
43
|
onRequestClose: onRequestClose
|
|
44
44
|
}, modalProps), {}, {
|
|
45
|
-
children: _jsx(Box, {
|
|
45
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
46
46
|
className: [styles.container, className],
|
|
47
47
|
height: "full",
|
|
48
48
|
display: "flex",
|
|
@@ -52,14 +52,14 @@ export const MinimalModal = _ref => {
|
|
|
52
52
|
role: "none presentation",
|
|
53
53
|
onMouseDown: unlockModal,
|
|
54
54
|
onClick: backdropHandler,
|
|
55
|
-
children: _jsx(Box, {
|
|
55
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
56
56
|
as: "article",
|
|
57
57
|
role: "dialog",
|
|
58
58
|
"aria-modal": "true",
|
|
59
59
|
"aria-labelledby": titleId,
|
|
60
60
|
display: "flex",
|
|
61
61
|
flexDirection: "column",
|
|
62
|
-
children: _jsx(Box, {
|
|
62
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
63
63
|
as: "main",
|
|
64
64
|
display: "flex",
|
|
65
65
|
flexDirection: "column",
|
|
@@ -96,17 +96,17 @@ export const Modal = _ref => {
|
|
|
96
96
|
}
|
|
97
97
|
return () => {};
|
|
98
98
|
}, [state]);
|
|
99
|
-
return _jsx(Portal, {
|
|
99
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
100
100
|
ref: ref,
|
|
101
101
|
noThemedWrapper: noThemedWrapper,
|
|
102
102
|
container: container,
|
|
103
|
-
children: state === 'OPENING' || state === 'OPEN' || state === 'CLOSING' ? _jsxs(FocusLock, {
|
|
103
|
+
children: state === 'OPENING' || state === 'OPEN' || state === 'CLOSING' ? /*#__PURE__*/_jsxs(FocusLock, {
|
|
104
104
|
returnFocus: true,
|
|
105
105
|
autoFocus: false,
|
|
106
106
|
onActivation: () => {
|
|
107
107
|
dispatch('ANIMATION_COMPLETE');
|
|
108
108
|
},
|
|
109
|
-
children: [_jsx(Box, {
|
|
109
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
110
110
|
"aria-hidden": "true",
|
|
111
111
|
position: "fixed",
|
|
112
112
|
pointerEvents: disableBackdropClick || state === 'CLOSING' ? 'none' : undefined,
|
|
@@ -114,7 +114,7 @@ export const Modal = _ref => {
|
|
|
114
114
|
backgroundColour: hideBackdrop ? 'transparent' : 'neutral',
|
|
115
115
|
className: [styles.backdrop.root, styles.transition, hideBackdrop && styles.backdrop.invisible],
|
|
116
116
|
onClick: handleBackdropClick
|
|
117
|
-
}), _jsx(Box, {
|
|
117
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
118
118
|
role: "presentation",
|
|
119
119
|
position: "fixed",
|
|
120
120
|
overflow: "hidden",
|
|
@@ -131,11 +131,12 @@ export const withModal = WrappedComponent => _ref2 => {
|
|
|
131
131
|
isOpen
|
|
132
132
|
} = _ref2,
|
|
133
133
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
134
|
+
// TODO: Deprecate me
|
|
134
135
|
process.env.NODE_ENV !== "production" ? warning(false, 'Using withModal is now an anti-pattern. Use <Modal /> instead') : void 0;
|
|
135
|
-
return _jsx(Modal, {
|
|
136
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
136
137
|
isOpen: isOpen,
|
|
137
138
|
onRequestClose: onRequestClose,
|
|
138
|
-
children: _jsx(WrappedComponent, _objectSpread({
|
|
139
|
+
children: /*#__PURE__*/_jsx(WrappedComponent, _objectSpread({
|
|
139
140
|
isOpen: isOpen,
|
|
140
141
|
onRequestClose: onRequestClose
|
|
141
142
|
}, rest))
|
|
@@ -33,7 +33,7 @@ export const NumberBubble = _ref => {
|
|
|
33
33
|
if (value >= 9999) return 'LARGE';
|
|
34
34
|
return 'SMALL';
|
|
35
35
|
}, [value]);
|
|
36
|
-
return _jsx(Box, _objectSpread(_objectSpread({
|
|
36
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
37
37
|
borderRadius: "full",
|
|
38
38
|
backgroundColour: "gray900",
|
|
39
39
|
display: "inline-block",
|
|
@@ -41,7 +41,7 @@ export const NumberBubble = _ref => {
|
|
|
41
41
|
padding: valuePaddingMap[size],
|
|
42
42
|
odComponent: "number-bubble"
|
|
43
43
|
}, boxProps), {}, {
|
|
44
|
-
children: _jsx(Text, {
|
|
44
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
45
45
|
size: "2",
|
|
46
46
|
strong: true,
|
|
47
47
|
className: clsx(styles.bubbleText, sprinkles({
|
|
@@ -47,7 +47,7 @@ export const NumberInput = withEnhancedInput(_ref => {
|
|
|
47
47
|
onChange: eventHandlers.onChange,
|
|
48
48
|
value: incomingFieldProps.value
|
|
49
49
|
});
|
|
50
|
-
return _jsx(Box, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
50
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
51
51
|
as: "input",
|
|
52
52
|
ref: inputRef
|
|
53
53
|
}, eventHandlers), {}, {
|
|
@@ -49,9 +49,15 @@ export const useNumberInputBehaviours = _ref => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
return () => {
|
|
52
|
-
if (mouseWheelListener && inputRef.current)
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
if (mouseWheelListener && inputRef.current)
|
|
53
|
+
// Standard
|
|
54
|
+
inputRef.current.removeEventListener('mousewheel', mouseWheelListener);
|
|
55
|
+
if (onWheelListener && inputRef.current)
|
|
56
|
+
// Chrome
|
|
57
|
+
inputRef.current.removeEventListener('onwheel', onWheelListener);
|
|
58
|
+
if (wheelListener && inputRef.current)
|
|
59
|
+
// Safari
|
|
60
|
+
inputRef.current.removeEventListener('wheel', wheelListener);
|
|
55
61
|
};
|
|
56
62
|
}, [preventMouseWheel, inputRef.current]);
|
|
57
63
|
return {
|
|
@@ -8,12 +8,14 @@ import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
|
8
8
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
9
9
|
import { breakpoints } from "../../themes/makeTheme.js";
|
|
10
10
|
import { overdriveTokens as tokens } from "../../themes/theme.css.js";
|
|
11
|
-
import { interactionStyle, notDisabled, notSelected } from "../../utils/css.js";
|
|
11
|
+
import { interactionStyle, notDisabled, notSelected } from "../../utils/css.js"; // === Container styles
|
|
12
12
|
export const gridContainer = createContainer("gridContainer");
|
|
13
13
|
export const gridContainerStyle = style({
|
|
14
14
|
containerName: gridContainer,
|
|
15
15
|
containerType: 'inline-size'
|
|
16
16
|
}, "gridContainerStyle");
|
|
17
|
+
|
|
18
|
+
// == Grid styles
|
|
17
19
|
const minWidth1200 = '(min-width: 1200px)';
|
|
18
20
|
const repeat2Col = 'repeat(2, 1fr)';
|
|
19
21
|
const repeat3Col = 'repeat(3, 1fr)';
|
|
@@ -77,6 +79,7 @@ export const styledGrid = recipe({
|
|
|
77
79
|
columns: '2'
|
|
78
80
|
}
|
|
79
81
|
}, "styledGrid");
|
|
82
|
+
// === Option item styles
|
|
80
83
|
const optionTransition = style({
|
|
81
84
|
transition: 'background 100ms ease-in, border-color 100ms ease-in'
|
|
82
85
|
}, "optionTransition");
|
|
@@ -124,6 +127,7 @@ export const styledGridItem = recipe({
|
|
|
124
127
|
}
|
|
125
128
|
}, optionTransition, focusOutlineStyle]
|
|
126
129
|
}, "styledGridItem");
|
|
130
|
+
// === Indicator styles
|
|
127
131
|
export const styleIndicator = style({
|
|
128
132
|
height: '26px',
|
|
129
133
|
width: '26px'
|
|
@@ -199,6 +203,8 @@ export const styledRadioButton = recipe({
|
|
|
199
203
|
}
|
|
200
204
|
}, pseudoRadio, optionTransition]
|
|
201
205
|
}, "styledRadioButton");
|
|
206
|
+
// === Label styles
|
|
207
|
+
|
|
202
208
|
export const labelStyle = style({
|
|
203
209
|
fontSize: tokens.typography.size[4].fontSize
|
|
204
210
|
}, "labelStyle");
|
|
@@ -8,15 +8,47 @@ export interface OptionItem {
|
|
|
8
8
|
name: string;
|
|
9
9
|
label: string;
|
|
10
10
|
value?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional custom icon from `@autoguru/icons` to display in unselected state
|
|
13
|
+
*/
|
|
11
14
|
icon?: IconEl;
|
|
12
15
|
description?: string;
|
|
13
16
|
}
|
|
14
17
|
export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'>, TestId {
|
|
18
|
+
/**
|
|
19
|
+
* Mandatory descriptive label that indicates the purpose of the group of options, used for assistive technologies
|
|
20
|
+
*/
|
|
15
21
|
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* Pass in the content for the OptionGrid using the items array
|
|
24
|
+
*/
|
|
16
25
|
items: OptionItem[];
|
|
26
|
+
/**
|
|
27
|
+
* Toggle the indicator appearance between checkbox and radio button, visual effect only
|
|
28
|
+
*/
|
|
17
29
|
indicator?: 'none' | 'checkbox' | 'radio';
|
|
30
|
+
/**
|
|
31
|
+
* Toggle between single and multi selection mode
|
|
32
|
+
*/
|
|
18
33
|
selectionMode?: SelectionMode;
|
|
34
|
+
/**
|
|
35
|
+
* Number of columns to display the options in
|
|
36
|
+
*/
|
|
19
37
|
columns?: StyledGridProps['columns'];
|
|
20
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The OptionGrid is primarily used in the booking flow to provide large selectable tiles to the user. It is not a form
|
|
41
|
+
* control as it is built on the react-aria ListBox ([docs](https://react-spectrum.adobe.com/react-aria/ListBox.html)),
|
|
42
|
+
* and implements a listbox behaviour without wrapping an input element. It supports controlled and uncontrolled usage.
|
|
43
|
+
* Following ARIA guidelines, the arrow keys can be used to navigate withing the group of options.
|
|
44
|
+
*
|
|
45
|
+
* See more details on react-aria [ListBox props](https://react-spectrum.adobe.com/react-aria/ListBox.html#listbox-1).
|
|
46
|
+
*
|
|
47
|
+
* Not yet implemented: disabled appearance, empty state, loading state, error state.
|
|
48
|
+
*
|
|
49
|
+
* Accessibility note: The ARIA spec prohibits listbox items from including interactive content such as buttons,
|
|
50
|
+
* tooltips, etc. For these cases a completely different implementation is required (e.g. react-aria [GridList](
|
|
51
|
+
* https://react-spectrum.adobe.com/react-aria/GridList.html))
|
|
52
|
+
*/
|
|
21
53
|
export declare const OptionGrid: ({ className, columns, indicator, label, layout, selectionMode, testId, ...props }: OptionGridProps<OptionItem>) => React.JSX.Element;
|
|
22
54
|
//# sourceMappingURL=OptionGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EASN,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EASN,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,eAAe,CAAC,CAAC,CACjC,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EACrC,MAAM;IACP;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC1C;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,mFAUxB,eAAe,CAAC,UAAU,CAAC,sBA+E7B,CAAC"}
|
|
@@ -13,6 +13,20 @@ import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
|
13
13
|
import { Icon } from "../Icon/index.js";
|
|
14
14
|
import { descriptionStyle, gridContainerStyle, labelStyle, styledCheckbox, styledGrid, styledGridItem, styledRadioButton, styleIndicator } from "./OptionGrid.css.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* The OptionGrid is primarily used in the booking flow to provide large selectable tiles to the user. It is not a form
|
|
18
|
+
* control as it is built on the react-aria ListBox ([docs](https://react-spectrum.adobe.com/react-aria/ListBox.html)),
|
|
19
|
+
* and implements a listbox behaviour without wrapping an input element. It supports controlled and uncontrolled usage.
|
|
20
|
+
* Following ARIA guidelines, the arrow keys can be used to navigate withing the group of options.
|
|
21
|
+
*
|
|
22
|
+
* See more details on react-aria [ListBox props](https://react-spectrum.adobe.com/react-aria/ListBox.html#listbox-1).
|
|
23
|
+
*
|
|
24
|
+
* Not yet implemented: disabled appearance, empty state, loading state, error state.
|
|
25
|
+
*
|
|
26
|
+
* Accessibility note: The ARIA spec prohibits listbox items from including interactive content such as buttons,
|
|
27
|
+
* tooltips, etc. For these cases a completely different implementation is required (e.g. react-aria [GridList](
|
|
28
|
+
* https://react-spectrum.adobe.com/react-aria/GridList.html))
|
|
29
|
+
*/
|
|
16
30
|
export const OptionGrid = _ref => {
|
|
17
31
|
let {
|
|
18
32
|
className,
|
|
@@ -24,9 +38,9 @@ export const OptionGrid = _ref => {
|
|
|
24
38
|
testId
|
|
25
39
|
} = _ref,
|
|
26
40
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
return _jsx("div", {
|
|
41
|
+
return /*#__PURE__*/_jsx("div", {
|
|
28
42
|
className: gridContainerStyle,
|
|
29
|
-
children: _jsx(ListBox, _objectSpread(_objectSpread(_objectSpread({
|
|
43
|
+
children: /*#__PURE__*/_jsx(ListBox, _objectSpread(_objectSpread(_objectSpread({
|
|
30
44
|
"aria-label": label,
|
|
31
45
|
layout: layout,
|
|
32
46
|
selectionMode: selectionMode,
|
|
@@ -43,7 +57,7 @@ export const OptionGrid = _ref => {
|
|
|
43
57
|
label,
|
|
44
58
|
name
|
|
45
59
|
} = _ref2;
|
|
46
|
-
return _jsx(ListBoxItem, {
|
|
60
|
+
return /*#__PURE__*/_jsx(ListBoxItem, {
|
|
47
61
|
className: styledGridItem(),
|
|
48
62
|
id: name,
|
|
49
63
|
textValue: label,
|
|
@@ -56,34 +70,34 @@ export const OptionGrid = _ref => {
|
|
|
56
70
|
const hasIndicator = indicator !== 'none';
|
|
57
71
|
const hasNoInteraction = !isFocusVisible && !isHovered && !isSelected;
|
|
58
72
|
const IndicatorIcon = () => {
|
|
59
|
-
if (icon && hasNoInteraction) return _jsx(Icon, {
|
|
73
|
+
if (icon && hasNoInteraction) return /*#__PURE__*/_jsx(Icon, {
|
|
60
74
|
icon: icon,
|
|
61
75
|
size: "100%"
|
|
62
76
|
});
|
|
63
77
|
const styledIndicator = indicator === 'radio' ? styledRadioButton : styledCheckbox;
|
|
64
|
-
return _jsx("div", _objectSpread(_objectSpread({
|
|
78
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
65
79
|
className: styledIndicator()
|
|
66
80
|
}, dataAttrs({
|
|
67
81
|
'focus-visible': isFocusVisible,
|
|
68
82
|
hover: isHovered,
|
|
69
83
|
selected: isSelected
|
|
70
84
|
})), {}, {
|
|
71
|
-
children: indicator === 'checkbox' && _jsx(Icon, {
|
|
85
|
+
children: indicator === 'checkbox' && /*#__PURE__*/_jsx(Icon, {
|
|
72
86
|
icon: CheckIcon
|
|
73
87
|
})
|
|
74
88
|
}));
|
|
75
89
|
};
|
|
76
|
-
return _jsxs(_Fragment, {
|
|
77
|
-
children: [hasIndicator && _jsx("div", {
|
|
90
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
+
children: [hasIndicator && /*#__PURE__*/_jsx("div", {
|
|
78
92
|
className: styleIndicator,
|
|
79
|
-
children: _jsx(IndicatorIcon, {})
|
|
80
|
-
}), _jsxs("div", {
|
|
81
|
-
children: [_jsx(Text, {
|
|
93
|
+
children: /*#__PURE__*/_jsx(IndicatorIcon, {})
|
|
94
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
95
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
82
96
|
slot: "label",
|
|
83
97
|
elementType: "div",
|
|
84
98
|
className: labelStyle,
|
|
85
99
|
children: label
|
|
86
|
-
}), description && _jsx(Text, {
|
|
100
|
+
}), description && /*#__PURE__*/_jsx(Text, {
|
|
87
101
|
slot: "description",
|
|
88
102
|
elementType: "div",
|
|
89
103
|
className: descriptionStyle,
|
|
@@ -7,7 +7,7 @@ import { recipe } from '@vanilla-extract/recipes';
|
|
|
7
7
|
import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
8
8
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
9
9
|
import { overdriveTokens as tokens } from "../../themes/theme.css.js";
|
|
10
|
-
import { interactionStyle } from "../../utils/css.js";
|
|
10
|
+
import { interactionStyle } from "../../utils/css.js"; // === Group styles
|
|
11
11
|
export const groupStyle = style({
|
|
12
12
|
marginTop: tokens.space['6']
|
|
13
13
|
}, "groupStyle");
|
|
@@ -22,6 +22,8 @@ export const descriptionStyle = style({
|
|
|
22
22
|
fontSize: tokens.typography.size[4].fontSize,
|
|
23
23
|
lineHeight: tokens.typography.size[4].lineHeight
|
|
24
24
|
}, "descriptionStyle");
|
|
25
|
+
|
|
26
|
+
// === Option item styles
|
|
25
27
|
const buttonBorderRadius = tokens.border.radius['md'];
|
|
26
28
|
export const styledOptionItem = recipe({
|
|
27
29
|
base: [{
|
|
@@ -68,6 +70,8 @@ export const itemLabelStyle = style({
|
|
|
68
70
|
lineHeight: tokens.typography.size['3'].lineHeight,
|
|
69
71
|
width: '100%'
|
|
70
72
|
}, "itemLabelStyle");
|
|
73
|
+
|
|
74
|
+
// === Checkbox styles
|
|
71
75
|
const checkboxTransition = style({
|
|
72
76
|
transitionProperty: 'background',
|
|
73
77
|
transitionTimingFunction: 'ease-in',
|
|
@@ -4,15 +4,40 @@ import { type CheckboxGroupState } from 'react-stately';
|
|
|
4
4
|
import type { TestId } from '../../types';
|
|
5
5
|
type ElementAttributes = Pick<React.ComponentPropsWithRef<'div'>, 'className' | 'ref' | 'style'>;
|
|
6
6
|
export interface OptionListProps extends AriaCheckboxGroupProps, ElementAttributes, TestId {
|
|
7
|
+
/**
|
|
8
|
+
* Label for the CheckboxButtons group needs to be provided at the component level for accessibility
|
|
9
|
+
*/
|
|
7
10
|
label: AriaCheckboxGroupProps['label'];
|
|
8
11
|
description?: AriaCheckboxGroupProps['description'];
|
|
12
|
+
/**
|
|
13
|
+
* Populate with one or more CheckboxItem components
|
|
14
|
+
*/
|
|
9
15
|
children?: React.ReactNode;
|
|
10
16
|
name?: AriaCheckboxGroupProps['name'];
|
|
11
17
|
defaultValue?: AriaCheckboxGroupProps['defaultValue'];
|
|
18
|
+
/**
|
|
19
|
+
* Current selected value (controlled state)
|
|
20
|
+
*/
|
|
12
21
|
value?: AriaCheckboxGroupProps['value'];
|
|
22
|
+
/**
|
|
23
|
+
* Event handler when any checkbox button changes. Returned string array is the values of the inputs that are currently
|
|
24
|
+
* checked.
|
|
25
|
+
*/
|
|
13
26
|
onChange?: AriaCheckboxGroupProps['onChange'];
|
|
14
27
|
}
|
|
15
28
|
export declare const OptionListContext: React.Context<CheckboxGroupState | null>;
|
|
29
|
+
/**
|
|
30
|
+
* The OptionList is a form control that groups selectable items that apear as an outlined list of options and
|
|
31
|
+
* implements React Aria `useCheckboxGroup`
|
|
32
|
+
* ([docs](https://react-spectrum.adobe.com/react-aria/useCheckboxGroup.html))
|
|
33
|
+
*
|
|
34
|
+
* Populate the OptionList group with the OptionListList, each item must have a `value` (unique) and be labelled.
|
|
35
|
+
* The `value` of all active items are passed as a string array to set `defaultValue` (uncontrolled), `value`
|
|
36
|
+
* (controlled) and is the format returned from the onChange handler as well.
|
|
37
|
+
*
|
|
38
|
+
* Used in the booking flow on the payment step for addons.
|
|
39
|
+
* Future enhancements might include: validation states/error handling
|
|
40
|
+
*/
|
|
16
41
|
export declare const OptionList: {
|
|
17
42
|
(props: OptionListProps): React.JSX.Element;
|
|
18
43
|
Item: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAU1C,KAAK,iBAAiB,GAAG,IAAI,CAC5B,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAClC,WAAW,GAAG,KAAK,GAAG,OAAO,CAC7B,CAAC;AAEF,MAAM,WAAW,eAChB,SAAQ,sBAAsB,EAC7B,iBAAiB,EACjB,MAAM;
|
|
1
|
+
{"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAU1C,KAAK,iBAAiB,GAAG,IAAI,CAC5B,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAClC,WAAW,GAAG,KAAK,GAAG,OAAO,CAC7B,CAAC;AAEF,MAAM,WAAW,eAChB,SAAQ,sBAAsB,EAC7B,iBAAiB,EACjB,MAAM;IACP;;OAEG;IACH,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,iBAAiB,0CAAiD,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhD,CAAC"}
|
|
@@ -10,7 +10,20 @@ import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
|
10
10
|
import { descriptionStyle, groupStyle, groupLabelStyle } from "./OptionList.css.js";
|
|
11
11
|
import { OptionListItem, ItemSplitLabel } from "./OptionListItem.js";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export const OptionListContext = createContext(null);
|
|
13
|
+
export const OptionListContext = /*#__PURE__*/createContext(null);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The OptionList is a form control that groups selectable items that apear as an outlined list of options and
|
|
17
|
+
* implements React Aria `useCheckboxGroup`
|
|
18
|
+
* ([docs](https://react-spectrum.adobe.com/react-aria/useCheckboxGroup.html))
|
|
19
|
+
*
|
|
20
|
+
* Populate the OptionList group with the OptionListList, each item must have a `value` (unique) and be labelled.
|
|
21
|
+
* The `value` of all active items are passed as a string array to set `defaultValue` (uncontrolled), `value`
|
|
22
|
+
* (controlled) and is the format returned from the onChange handler as well.
|
|
23
|
+
*
|
|
24
|
+
* Used in the booking flow on the payment step for addons.
|
|
25
|
+
* Future enhancements might include: validation states/error handling
|
|
26
|
+
*/
|
|
14
27
|
export const OptionList = props => {
|
|
15
28
|
const {
|
|
16
29
|
children,
|
|
@@ -31,18 +44,18 @@ export const OptionList = props => {
|
|
|
31
44
|
labelProps,
|
|
32
45
|
descriptionProps
|
|
33
46
|
} = useCheckboxGroup(props, state);
|
|
34
|
-
return _jsxs("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, groupProps), elementAttrs), dataAttrs({
|
|
47
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, groupProps), elementAttrs), dataAttrs({
|
|
35
48
|
testid: props.testId
|
|
36
49
|
})), {}, {
|
|
37
|
-
children: [_jsx("div", _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
50
|
+
children: [/*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, labelProps), {}, {
|
|
38
51
|
className: groupLabelStyle,
|
|
39
52
|
children: label
|
|
40
|
-
})), description && _jsx("div", _objectSpread(_objectSpread({}, descriptionProps), {}, {
|
|
53
|
+
})), description && /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, descriptionProps), {}, {
|
|
41
54
|
className: descriptionStyle,
|
|
42
55
|
children: description
|
|
43
|
-
})), _jsx(OptionListContext.Provider, {
|
|
56
|
+
})), /*#__PURE__*/_jsx(OptionListContext.Provider, {
|
|
44
57
|
value: state,
|
|
45
|
-
children: _jsx("div", {
|
|
58
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
46
59
|
className: groupStyle,
|
|
47
60
|
children: children
|
|
48
61
|
})
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type AriaCheckboxGroupItemProps } from 'react-aria';
|
|
3
3
|
type FilteredCheckboxProps = Omit<AriaCheckboxGroupItemProps, 'isIndeterminate'>;
|
|
4
|
+
/**
|
|
5
|
+
* The OptionListItem is used to populate OptionList. They are outlined with a large interactive area and flexible
|
|
6
|
+
* label content layout.
|
|
7
|
+
*/
|
|
4
8
|
export declare const OptionListItem: {
|
|
5
9
|
(props: FilteredCheckboxProps): React.JSX.Element;
|
|
6
10
|
displayName: string;
|
|
7
11
|
};
|
|
8
12
|
export interface SplitLabelProps {
|
|
9
13
|
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* convenience prop for passing through a string array instead of children
|
|
16
|
+
*/
|
|
10
17
|
content?: string[];
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Helper component part to display a checkbox button label with a second column justified to the end
|
|
21
|
+
*/
|
|
12
22
|
export declare const ItemSplitLabel: {
|
|
13
23
|
({ children, content }: SplitLabelProps): React.JSX.Element | null;
|
|
14
24
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionListItem.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionListItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAIN,KAAK,0BAA0B,EAC/B,MAAM,YAAY,CAAC;AAUpB,KAAK,qBAAqB,GAAG,IAAI,CAChC,0BAA0B,EAC1B,iBAAiB,CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionListItem.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionListItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAIN,KAAK,0BAA0B,EAC/B,MAAM,YAAY,CAAC;AAUpB,KAAK,qBAAqB,GAAG,IAAI,CAChC,0BAA0B,EAC1B,iBAAiB,CACjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc;YAAW,qBAAqB;;CA+B1D,CAAC;AAIF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;4BAA2B,eAAe;;CAcpE,CAAC"}
|