@autoguru/overdrive 4.43.9 → 4.43.10-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Actions/Actions.js +2 -2
- package/dist/components/Alert/Alert.js +10 -10
- package/dist/components/Anchor/Anchor.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.js +7 -7
- package/dist/components/AutoSuggest/AutoSuggest.js +52 -34
- package/dist/components/AutoSuggest/useLayoutSuggestionVisible.js +1 -0
- package/dist/components/Badge/Badge.d.ts +11 -0
- 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.js +6 -6
- 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 +10 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +22 -10
- 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.js +5 -5
- 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.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.js +6 -4
- package/dist/components/FillHeightBox/FillHeightBox.js +2 -1
- package/dist/components/Flyout/Flyout.js +2 -2
- package/dist/components/Heading/Heading.d.ts +4 -0
- package/dist/components/Heading/Heading.d.ts.map +1 -1
- package/dist/components/Heading/Heading.js +7 -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.js +7 -7
- 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.js +5 -5
- 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.js +1 -1
- package/dist/components/SelectInput/SelectInput.js +4 -4
- 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.js +2 -2
- package/dist/components/Stack/Stack.js +5 -5
- 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.js +5 -5
- 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.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.js +2 -2
- package/dist/components/TextContainer/TextContainer.js +4 -4
- package/dist/components/TextInput/TextInput.js +1 -1
- package/dist/components/TextLink/TextLink.js +5 -5
- 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 +56 -82
- package/dist/components/Tooltip/index.d.ts +2 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +2 -1
- package/dist/components/Tooltip/useTooltip/useTooltip.d.ts +38 -0
- package/dist/components/Tooltip/useTooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/useTooltip/useTooltip.js +125 -0
- 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.js +32 -10
- 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/useWindowHeightFill/useWindowHeightFill.js +1 -0
- package/dist/hooks/useWindowScrollLock/index.js +2 -0
- package/dist/styles/componentStyles.d.ts +13 -0
- package/dist/styles/componentStyles.d.ts.map +1 -1
- package/dist/styles/componentStyles.js +15 -0
- package/dist/styles/componentStyles.spec.js +4 -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 +4 -0
- package/dist/styles/sprinkles.css.d.ts.map +1 -1
- package/dist/styles/sprinkles.css.js +32 -3
- 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 +4 -4
- package/dist/components/Anchor/Anchor.css.d.ts +0 -2
- package/dist/components/Anchor/Anchor.css.d.ts.map +0 -1
- package/dist/components/Anchor/Anchor.css.js +0 -10
|
@@ -12,11 +12,11 @@ export const Actions = _ref => {
|
|
|
12
12
|
noWrap,
|
|
13
13
|
wrappingDirection
|
|
14
14
|
} = _ref;
|
|
15
|
-
return _jsx(Columns, {
|
|
15
|
+
return /*#__PURE__*/_jsx(Columns, {
|
|
16
16
|
space: "3",
|
|
17
17
|
noWrap: noWrap,
|
|
18
18
|
wrappingDirection: wrappingDirection,
|
|
19
|
-
children: Children.map(flattenChildren(children), child => _jsx(Column, {
|
|
19
|
+
children: Children.map(flattenChildren(children), child => /*#__PURE__*/_jsx(Column, {
|
|
20
20
|
children: child
|
|
21
21
|
}))
|
|
22
22
|
});
|
|
@@ -27,7 +27,7 @@ export const Alert = _ref => {
|
|
|
27
27
|
onRequestClose,
|
|
28
28
|
dismissible = typeof onRequestClose === 'function'
|
|
29
29
|
} = _ref;
|
|
30
|
-
return _jsxs(Box, {
|
|
30
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
31
31
|
className: clsx(className, sprinklesLegacyText({
|
|
32
32
|
color: intent
|
|
33
33
|
}), {
|
|
@@ -43,14 +43,14 @@ export const Alert = _ref => {
|
|
|
43
43
|
boxShadow: inline ? 'none' : '4',
|
|
44
44
|
padding: "2",
|
|
45
45
|
odComponent: "alert",
|
|
46
|
-
children: [_jsx(IntentStripe, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(IntentStripe, {
|
|
47
47
|
intent: intent
|
|
48
|
-
}), _jsxs(Box, {
|
|
48
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
49
49
|
display: "flex",
|
|
50
50
|
gap: "2",
|
|
51
|
-
children: [_jsx(Box, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
52
52
|
alignSelf: "start",
|
|
53
|
-
children: _jsx(Icon, {
|
|
53
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
54
54
|
icon: iconMapForIntent[intent],
|
|
55
55
|
size: "medium",
|
|
56
56
|
className: sprinkles({
|
|
@@ -58,25 +58,25 @@ export const Alert = _ref => {
|
|
|
58
58
|
marginLeft: '2'
|
|
59
59
|
})
|
|
60
60
|
})
|
|
61
|
-
}), _jsx(Box, {
|
|
61
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
62
62
|
alignSelf: "center",
|
|
63
63
|
width: "auto",
|
|
64
64
|
className: sprinkles({
|
|
65
65
|
colour: 'dark'
|
|
66
66
|
}),
|
|
67
|
-
children: typeof children === 'string' ? _jsx(Text, {
|
|
67
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
68
68
|
children: children
|
|
69
69
|
}) : children
|
|
70
|
-
}), _jsx(Box, {
|
|
70
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
71
71
|
ml: "auto",
|
|
72
|
-
children: dismissible && _jsx(Button, {
|
|
72
|
+
children: dismissible && /*#__PURE__*/_jsx(Button, {
|
|
73
73
|
minimal: true,
|
|
74
74
|
rounded: true,
|
|
75
75
|
variant: "secondary",
|
|
76
76
|
size: "small",
|
|
77
77
|
"aria-label": "close",
|
|
78
78
|
onClick: onRequestClose,
|
|
79
|
-
children: _jsx(Icon, {
|
|
79
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
80
80
|
className: sprinkles({
|
|
81
81
|
colour: 'muted'
|
|
82
82
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EACN,oBAAoB,EAGpB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EACN,oBAAoB,EAGpB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,MAAM,WAAW,KAChB,SAAQ,IAAI,CACV,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,IAAI,CAC3B,EACD,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,KAAK,CA6C3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -9,12 +9,12 @@ import clsx from 'clsx';
|
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { cloneElement, createElement, isValidElement } from 'react';
|
|
11
11
|
import { componentStyles } from "../../styles/componentStyles.js";
|
|
12
|
+
import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
12
13
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
13
14
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
14
15
|
import { Icon } from "../Icon/Icon.js";
|
|
15
16
|
import { Inline } from "../Inline/Inline.js";
|
|
16
17
|
import { Text } from "../Text/Text.js";
|
|
17
|
-
import * as styles from "./Anchor.css.js";
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
export const Anchor = _ref => {
|
|
20
20
|
let {
|
|
@@ -30,27 +30,27 @@ export const Anchor = _ref => {
|
|
|
30
30
|
className: clsx(componentStyles({
|
|
31
31
|
as: Component,
|
|
32
32
|
colour: 'link',
|
|
33
|
-
display: 'inline'
|
|
34
|
-
}),
|
|
33
|
+
display: 'inline-flex'
|
|
34
|
+
}), focusOutlineStyle, className),
|
|
35
35
|
disabled
|
|
36
36
|
}, dataAttrs({
|
|
37
37
|
testid: testId
|
|
38
38
|
})), rest);
|
|
39
|
-
const childs = _jsxs(Inline, {
|
|
39
|
+
const childs = /*#__PURE__*/_jsxs(Inline, {
|
|
40
40
|
space: "2",
|
|
41
|
-
children: [icon && _jsx(Icon, {
|
|
41
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
42
42
|
icon: icon,
|
|
43
43
|
size: "small",
|
|
44
44
|
className: sprinkles({
|
|
45
45
|
colour: 'link'
|
|
46
46
|
})
|
|
47
|
-
}), _jsx(Text, {
|
|
47
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
48
48
|
weight: "bold",
|
|
49
49
|
size: "4",
|
|
50
50
|
colour: "link",
|
|
51
51
|
children: children
|
|
52
52
|
})]
|
|
53
53
|
});
|
|
54
|
-
return isValidElement(Component) ? cloneElement(Component, props, childs) : createElement(Component, props, childs);
|
|
54
|
+
return /*#__PURE__*/isValidElement(Component) ? /*#__PURE__*/cloneElement(Component, props, childs) : /*#__PURE__*/createElement(Component, props, childs);
|
|
55
55
|
};
|
|
56
56
|
export default Anchor;
|
|
@@ -10,6 +10,7 @@ const _excluded = ["autoFocus", "autoWidth", "inlineOptions", "fieldIcon", "sugg
|
|
|
10
10
|
_excluded6 = ["onReset"];
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */
|
|
13
14
|
import { ChevronDownIcon, CloseIcon } from '@autoguru/icons';
|
|
14
15
|
import { wrapEvent } from '@autoguru/utilities';
|
|
15
16
|
import clsx from 'clsx';
|
|
@@ -28,7 +29,7 @@ import { withEnhancedInput } from "../private/InputBase/index.js";
|
|
|
28
29
|
import * as styles from "./AutoSuggest.css.js";
|
|
29
30
|
import { useLayoutSuggestionVisible } from "./useLayoutSuggestionVisible.js";
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
|
-
var ActionTypes = function (ActionTypes) {
|
|
32
|
+
var ActionTypes = /*#__PURE__*/function (ActionTypes) {
|
|
32
33
|
ActionTypes[ActionTypes["INPUT_CHANGE"] = 0] = "INPUT_CHANGE";
|
|
33
34
|
ActionTypes[ActionTypes["INPUT_ESCAPE"] = 1] = "INPUT_ESCAPE";
|
|
34
35
|
ActionTypes[ActionTypes["INPUT_ENTER"] = 2] = "INPUT_ENTER";
|
|
@@ -43,6 +44,7 @@ var ActionTypes = function (ActionTypes) {
|
|
|
43
44
|
}(ActionTypes || {});
|
|
44
45
|
const inputReducerFactory = suggestions => (prevState, action) => {
|
|
45
46
|
switch (action.type) {
|
|
47
|
+
// eslint-disable-next-line sonarjs/prefer-default-last
|
|
46
48
|
default:
|
|
47
49
|
case ActionTypes.INPUT_CHANGE:
|
|
48
50
|
{
|
|
@@ -114,7 +116,7 @@ const inputReducerFactory = suggestions => (prevState, action) => {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
};
|
|
117
|
-
export const AutoSuggest = forwardRef(function AutoSuggest(_ref, ref) {
|
|
119
|
+
export const AutoSuggest = /*#__PURE__*/forwardRef(function AutoSuggest(_ref, ref) {
|
|
118
120
|
let {
|
|
119
121
|
autoFocus = false,
|
|
120
122
|
autoWidth = false,
|
|
@@ -173,7 +175,7 @@ export const AutoSuggest = forwardRef(function AutoSuggest(_ref, ref) {
|
|
|
173
175
|
}, incomingOnFocus),
|
|
174
176
|
onBlur: wrapEvent(() => setIsFocused(false), incomingOnBlur)
|
|
175
177
|
}, textInputProps);
|
|
176
|
-
return !inlineOptions && !isDesktop && showModal ? _jsx(AutoSuggestFullscreenInput, _objectSpread(_objectSpread({}, props), {}, {
|
|
178
|
+
return !inlineOptions && !isDesktop && showModal ? /*#__PURE__*/_jsx(AutoSuggestFullscreenInput, _objectSpread(_objectSpread({}, props), {}, {
|
|
177
179
|
attach: "NONE",
|
|
178
180
|
borderMerged: "NONE",
|
|
179
181
|
isFocused: isFocused,
|
|
@@ -181,7 +183,7 @@ export const AutoSuggest = forwardRef(function AutoSuggest(_ref, ref) {
|
|
|
181
183
|
fieldIcon: fieldIcon,
|
|
182
184
|
autoFocus: autoFocus,
|
|
183
185
|
closeModal: closeModal
|
|
184
|
-
})) : _jsx(AutoSuggestInput, _objectSpread(_objectSpread({
|
|
186
|
+
})) : /*#__PURE__*/_jsx(AutoSuggestInput, _objectSpread(_objectSpread({
|
|
185
187
|
ref: inputRef
|
|
186
188
|
}, props), {}, {
|
|
187
189
|
isFocused: isFocused,
|
|
@@ -191,7 +193,7 @@ export const AutoSuggest = forwardRef(function AutoSuggest(_ref, ref) {
|
|
|
191
193
|
autoWidth: autoWidth
|
|
192
194
|
}));
|
|
193
195
|
});
|
|
194
|
-
const AutoSuggestFullscreenInput = forwardRef(function AutoSuggestFullscreenInput(_ref2, ref) {
|
|
196
|
+
const AutoSuggestFullscreenInput = /*#__PURE__*/forwardRef(function AutoSuggestFullscreenInput(_ref2, ref) {
|
|
195
197
|
let {
|
|
196
198
|
closeModal
|
|
197
199
|
} = _ref2,
|
|
@@ -204,29 +206,29 @@ const AutoSuggestFullscreenInput = forwardRef(function AutoSuggestFullscreenInpu
|
|
|
204
206
|
cancelAnimationFrame(cb);
|
|
205
207
|
};
|
|
206
208
|
}, [setShowPortal]);
|
|
207
|
-
return showPortal ? _jsx(Portal, {
|
|
208
|
-
children: _jsxs("div", {
|
|
209
|
+
return showPortal ? /*#__PURE__*/_jsx(Portal, {
|
|
210
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
209
211
|
className: styles.fullScreenRoot,
|
|
210
|
-
children: [_jsx(AutoSuggestInput, _objectSpread(_objectSpread({
|
|
212
|
+
children: [/*#__PURE__*/_jsx(AutoSuggestInput, _objectSpread(_objectSpread({
|
|
211
213
|
ref: ref
|
|
212
214
|
}, props), {}, {
|
|
213
215
|
className: styles.fullScreenInput,
|
|
214
216
|
inlineOptions: true,
|
|
215
217
|
noScroll: true
|
|
216
|
-
})), _jsx(Button, {
|
|
218
|
+
})), /*#__PURE__*/_jsx(Button, {
|
|
217
219
|
minimal: true,
|
|
218
220
|
rounded: true,
|
|
219
221
|
className: styles.fullScreenCloseBtn,
|
|
220
222
|
size: "medium",
|
|
221
223
|
onClick: closeModal,
|
|
222
|
-
children: _jsx(Icon, {
|
|
224
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
223
225
|
icon: CloseIcon
|
|
224
226
|
})
|
|
225
227
|
})]
|
|
226
228
|
})
|
|
227
229
|
}) : null;
|
|
228
230
|
});
|
|
229
|
-
const AutoSuggestInput = forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
231
|
+
const AutoSuggestInput = /*#__PURE__*/forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
230
232
|
var _state$previewText;
|
|
231
233
|
let {
|
|
232
234
|
inlineOptions = false,
|
|
@@ -260,18 +262,18 @@ const AutoSuggestInput = forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
|
260
262
|
});
|
|
261
263
|
const shouldOpenFlyout = suggestions.length > 0 && state.isFlyoutOpen;
|
|
262
264
|
useLayoutSuggestionVisible(state.highlightIndex, highlightRef, suggestionListRef);
|
|
263
|
-
return _jsxs(Box, {
|
|
265
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
264
266
|
role: "combobox",
|
|
265
267
|
"aria-label": textInputProps.placeholder,
|
|
266
268
|
"aria-expanded": shouldOpenFlyout,
|
|
267
269
|
"aria-owns": suggestionListId,
|
|
268
270
|
"aria-haspopup": "listbox",
|
|
269
271
|
width: "full",
|
|
270
|
-
children: [_jsx(Box, {
|
|
272
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
271
273
|
backgroundColour: "white",
|
|
272
274
|
borderRadius: "sm",
|
|
273
275
|
className: styles.input,
|
|
274
|
-
children: _jsx(AutoSuggestInputPrimitive, _objectSpread(_objectSpread({
|
|
276
|
+
children: /*#__PURE__*/_jsx(AutoSuggestInputPrimitive, _objectSpread(_objectSpread({
|
|
275
277
|
className: className,
|
|
276
278
|
size: size,
|
|
277
279
|
isFocused: isFocused,
|
|
@@ -308,7 +310,11 @@ const AutoSuggestInput = forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
|
308
310
|
}), onFocus),
|
|
309
311
|
onBlur: wrapEvent(() => {
|
|
310
312
|
var _suggestions$state$hi;
|
|
311
|
-
if (state.highlightIndex > -1 &&
|
|
313
|
+
if (state.highlightIndex > -1 &&
|
|
314
|
+
/*
|
|
315
|
+
Cheap trick to check if an arrow or click was used or not. We only _commit_ if a click or arrow
|
|
316
|
+
*/
|
|
317
|
+
state.highlightIndex && state.previewText === ((_suggestions$state$hi = suggestions[state.highlightIndex]) === null || _suggestions$state$hi === void 0 ? void 0 : _suggestions$state$hi.text) && typeof onChange === 'function') onChange(suggestions[state.highlightIndex]);
|
|
312
318
|
dispatch({
|
|
313
319
|
type: ActionTypes.INPUT_BLUR
|
|
314
320
|
});
|
|
@@ -344,7 +350,7 @@ const AutoSuggestInput = forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
|
344
350
|
}
|
|
345
351
|
}, onKeyDown)
|
|
346
352
|
}))
|
|
347
|
-
}), inlineOptions ? _jsx(SuggestionsList, {
|
|
353
|
+
}), inlineOptions ? /*#__PURE__*/_jsx(SuggestionsList, {
|
|
348
354
|
suggestionListRef: suggestionListRef,
|
|
349
355
|
suggestionListId: suggestionListId,
|
|
350
356
|
placeholder: textInputProps.placeholder,
|
|
@@ -355,14 +361,14 @@ const AutoSuggestInput = forwardRef(function AutoSuggestInput(_ref3, ref) {
|
|
|
355
361
|
className: noScroll ? styles.suggestionList.inlineOptionsNoScroll : styles.suggestionList.inlineOptions,
|
|
356
362
|
dispatch: dispatch,
|
|
357
363
|
onChange: onChange
|
|
358
|
-
}) : _jsx(SuggestionListFlyout, {
|
|
364
|
+
}) : /*#__PURE__*/_jsx(SuggestionListFlyout, {
|
|
359
365
|
id: suggestionListId,
|
|
360
366
|
autoWidth: autoWidth,
|
|
361
367
|
triggerRef: triggerRef,
|
|
362
368
|
alignment: EAlignment.BOTTOM_LEFT,
|
|
363
369
|
isOpen: shouldOpenFlyout,
|
|
364
370
|
triggerOffset: 1,
|
|
365
|
-
children: _jsx(SuggestionsList, {
|
|
371
|
+
children: /*#__PURE__*/_jsx(SuggestionsList, {
|
|
366
372
|
className: styles.suggestionList.blockOptions,
|
|
367
373
|
suggestionListRef: suggestionListRef,
|
|
368
374
|
suggestionListId: suggestionListId,
|
|
@@ -390,7 +396,7 @@ const SuggestionsList = _ref4 => {
|
|
|
390
396
|
dispatch,
|
|
391
397
|
suggestionListRef
|
|
392
398
|
} = _ref4;
|
|
393
|
-
return _jsxs(Box, {
|
|
399
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
394
400
|
as: "ul",
|
|
395
401
|
ref: suggestionListRef,
|
|
396
402
|
backgroundColour: "white",
|
|
@@ -398,11 +404,11 @@ const SuggestionsList = _ref4 => {
|
|
|
398
404
|
id: suggestionListId,
|
|
399
405
|
"aria-label": placeholder,
|
|
400
406
|
role: "listbox",
|
|
401
|
-
children: [_jsx("div", {
|
|
407
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
402
408
|
className: styles.spacer
|
|
403
409
|
}), suggestions.map((suggestion, idx) => {
|
|
404
410
|
const highlight = highlightIndex === idx;
|
|
405
|
-
return _jsx(Box, {
|
|
411
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
406
412
|
as: "li",
|
|
407
413
|
ref: highlight ? highlightRef : undefined,
|
|
408
414
|
id: getSuggestionId(suggestionListId, idx),
|
|
@@ -412,9 +418,15 @@ const SuggestionsList = _ref4 => {
|
|
|
412
418
|
className: clsx(styles.suggestionListItem.default, {
|
|
413
419
|
[styles.suggestionListItem.skipped]: suggestion.skip
|
|
414
420
|
}),
|
|
415
|
-
onMouseDown: event =>
|
|
421
|
+
onMouseDown: event => /* This is so a blur doesnt fire from the input when you click */
|
|
422
|
+
event.preventDefault(),
|
|
416
423
|
onMouseMove: () => {
|
|
417
424
|
if (suggestion.skip) return;
|
|
425
|
+
|
|
426
|
+
/*
|
|
427
|
+
This has to be mouse move, so if you're hovering an item, and then arrow keys, we =
|
|
428
|
+
dont want yo trigger a mouse enter and highlight it instead
|
|
429
|
+
*/
|
|
418
430
|
dispatch({
|
|
419
431
|
type: ActionTypes.SUGGESTION_MOUSE_ENTER,
|
|
420
432
|
index: idx
|
|
@@ -433,7 +445,7 @@ const SuggestionsList = _ref4 => {
|
|
|
433
445
|
value: suggestion
|
|
434
446
|
})
|
|
435
447
|
}, suggestion.text.concat(String(idx)));
|
|
436
|
-
}), _jsx("div", {
|
|
448
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
437
449
|
className: styles.spacer
|
|
438
450
|
})]
|
|
439
451
|
});
|
|
@@ -465,6 +477,8 @@ const AutoSuggestInputPrimitive = withEnhancedInput(_ref5 => {
|
|
|
465
477
|
onReset
|
|
466
478
|
} = eventHandlers,
|
|
467
479
|
inputEventHandlers = _objectWithoutProperties(eventHandlers, _excluded6);
|
|
480
|
+
|
|
481
|
+
// TODO: Eventually build a forkedRef helper for this
|
|
468
482
|
const handleRef = useCallback(node => {
|
|
469
483
|
if (field.ref) setRef(field.ref, node);
|
|
470
484
|
setRef(ref, node);
|
|
@@ -476,34 +490,38 @@ const AutoSuggestInputPrimitive = withEnhancedInput(_ref5 => {
|
|
|
476
490
|
return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
|
|
477
491
|
}, 100);
|
|
478
492
|
}, [onReset, focusTimeout]);
|
|
479
|
-
const suffix = useMemo(() =>
|
|
493
|
+
const suffix = useMemo(() =>
|
|
494
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
495
|
+
isLoading ? null : field.value && isFocused ? /*#__PURE__*/_jsx(Box, {
|
|
480
496
|
as: "button",
|
|
481
497
|
paddingY: size === 'small' ? '1' : '3',
|
|
482
498
|
paddingRight: size === 'small' ? '2' : '3',
|
|
483
499
|
flexShrink: 0,
|
|
484
500
|
onMouseDown: onRequestReset,
|
|
485
|
-
children: _jsx(Icon, {
|
|
501
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
486
502
|
size: size === 'large' ? size : 'medium',
|
|
487
503
|
icon: CloseIcon
|
|
488
504
|
})
|
|
489
|
-
}) :
|
|
505
|
+
}) :
|
|
506
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
507
|
+
fieldIcon ? /*#__PURE__*/_jsx(Box, {
|
|
490
508
|
flexShrink: 0,
|
|
491
509
|
paddingY: size === 'medium' ? '3' : '2',
|
|
492
510
|
paddingRight: size === 'medium' ? '3' : '2',
|
|
493
511
|
onClick: focusHandler,
|
|
494
|
-
children: _jsx(Icon, {
|
|
512
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
495
513
|
size: size === 'large' ? size : 'medium',
|
|
496
514
|
icon: fieldIcon
|
|
497
515
|
})
|
|
498
516
|
}) : null, [field.value, isLoading, fieldIcon, isFocused, onRequestReset]);
|
|
499
517
|
useEffect(() => () => focusTimeout ? clearTimeout(focusTimeout) : void 0, []);
|
|
500
|
-
return _jsxs(Box, {
|
|
518
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
501
519
|
display: "flex",
|
|
502
520
|
flexWrap: "nowrap",
|
|
503
521
|
alignItems: "center",
|
|
504
522
|
justifyContent: "center",
|
|
505
523
|
className: className,
|
|
506
|
-
children: [_jsx(Box, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
524
|
+
children: [/*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
507
525
|
as: "input",
|
|
508
526
|
flexGrow: 1
|
|
509
527
|
}, inputEventHandlers), field), {}, {
|
|
@@ -532,14 +550,14 @@ const SuggestionListFlyout = _ref6 => {
|
|
|
532
550
|
autoWidth,
|
|
533
551
|
children
|
|
534
552
|
} = _ref6;
|
|
535
|
-
return _jsx(Positioner, {
|
|
553
|
+
return /*#__PURE__*/_jsx(Positioner, {
|
|
536
554
|
id: id,
|
|
537
555
|
triggerRef: triggerRef,
|
|
538
556
|
alignment: alignment,
|
|
539
557
|
isOpen: isOpen,
|
|
540
558
|
triggerOffset: triggerOffset,
|
|
541
559
|
role: "listbox",
|
|
542
|
-
children: _jsx(Box, {
|
|
560
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
543
561
|
borderWidth: "1",
|
|
544
562
|
borderColour: "gray",
|
|
545
563
|
borderRadius: "md",
|
|
@@ -558,7 +576,7 @@ const defaultItemRenderer = _ref7 => {
|
|
|
558
576
|
value,
|
|
559
577
|
highlight
|
|
560
578
|
} = _ref7;
|
|
561
|
-
return _jsx(DefaultSuggestion, {
|
|
579
|
+
return /*#__PURE__*/_jsx(DefaultSuggestion, {
|
|
562
580
|
highlight: highlight,
|
|
563
581
|
text: value.text
|
|
564
582
|
});
|
|
@@ -568,11 +586,11 @@ const DefaultSuggestion = _ref8 => {
|
|
|
568
586
|
text,
|
|
569
587
|
highlight
|
|
570
588
|
} = _ref8;
|
|
571
|
-
return _jsx("div", {
|
|
589
|
+
return /*#__PURE__*/_jsx("div", {
|
|
572
590
|
className: clsx(styles.suggestion, {
|
|
573
591
|
[styles.suggestionHighlight]: highlight
|
|
574
592
|
}),
|
|
575
|
-
children: _jsx(Text, {
|
|
593
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
576
594
|
as: "span",
|
|
577
595
|
children: text
|
|
578
596
|
})
|
|
@@ -4,6 +4,7 @@ import { useLayoutEffect } from 'react';
|
|
|
4
4
|
import { isBrowser } from "../../utils/index.js";
|
|
5
5
|
export const useLayoutSuggestionVisible = (highlightIndex, highlightRef, suggestionListRef) => {
|
|
6
6
|
if (isBrowser) {
|
|
7
|
+
// Its okay to wrap this... As the value wont change once rendered.
|
|
7
8
|
useLayoutEffect(() => {
|
|
8
9
|
if (highlightRef.current && suggestionListRef.current && highlightIndex > -1) {
|
|
9
10
|
const highlightItem = highlightRef.current;
|
|
@@ -3,12 +3,23 @@ import { type BoxProps } from '../Box/Box';
|
|
|
3
3
|
import type { StyledBadgeProps } from './Badge.css';
|
|
4
4
|
type Colours = Exclude<StyledBadgeProps['colour'], undefined>;
|
|
5
5
|
export interface BadgeProps extends Pick<BoxProps, 'testId'> {
|
|
6
|
+
/** The text content */
|
|
6
7
|
label: string;
|
|
8
|
+
/** The color of the badge */
|
|
7
9
|
colour?: Colours;
|
|
10
|
+
/** Override class name with additional styles */
|
|
8
11
|
className?: string;
|
|
12
|
+
/** The visual style of the badge */
|
|
9
13
|
look?: 'standard' | 'inverted';
|
|
14
|
+
/** Select the badge size */
|
|
10
15
|
size?: StyledBadgeProps['size'];
|
|
11
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The Badge component displays a label using intentional colour themes. The colours and sizes are configuable.
|
|
19
|
+
*
|
|
20
|
+
* To apply badge styling to an element directly the `styledBadge` recipe can be used.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
12
23
|
export declare const Badge: ({ label, colour, look, size, className, testId, }: BadgeProps) => React.JSX.Element;
|
|
13
24
|
export {};
|
|
14
25
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC3D,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC/B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,mDAOnB,UAAU,sBAyBZ,CAAC"}
|
|
@@ -6,6 +6,12 @@ import React from 'react';
|
|
|
6
6
|
import { Box } from "../Box/Box.js";
|
|
7
7
|
import * as styles from "./Badge.css.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* The Badge component displays a label using intentional colour themes. The colours and sizes are configuable.
|
|
11
|
+
*
|
|
12
|
+
* To apply badge styling to an element directly the `styledBadge` recipe can be used.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
9
15
|
export const Badge = _ref => {
|
|
10
16
|
let {
|
|
11
17
|
label,
|
|
@@ -17,7 +23,7 @@ export const Badge = _ref => {
|
|
|
17
23
|
} = _ref;
|
|
18
24
|
!['string', 'number'].includes(typeof label) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Badge `label` can only contain strings or numbers') : invariant(false) : void 0;
|
|
19
25
|
const inverted = look === 'inverted';
|
|
20
|
-
return _jsx(Box, {
|
|
26
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
21
27
|
className: clsx([styles.styledBadge({
|
|
22
28
|
colour,
|
|
23
29
|
inverted,
|
|
@@ -2,10 +2,17 @@ import type { AllHTMLAttributes, ElementType, PropsWithChildren } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { type ComponentStylesProps } from '../../styles/componentStyles';
|
|
4
4
|
import { OdComponent, TestId } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* Use CommonBoxProps to help consistently define additional utility props of a component
|
|
7
|
+
*/
|
|
5
8
|
export interface CommonBoxProps extends OdComponent, PropsWithChildren, TestId {
|
|
6
9
|
}
|
|
7
10
|
export interface BoxProps extends Omit<AllHTMLAttributes<HTMLElement>, 'as' | 'className' | 'color' | 'height' | 'is' | 'size' | 'width'>, CommonBoxProps, ComponentStylesProps {
|
|
11
|
+
/** Pass in the HTML element or JSX component that should be rendered for the box */
|
|
8
12
|
as?: ElementType;
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Box is a general purpose container with no specific semantics.
|
|
16
|
+
*/
|
|
10
17
|
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLElement>>;
|
|
11
18
|
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,cAChB,SAAQ,WAAW,EAClB,iBAAiB,EACjB,MAAM;CAAG;AAEX,MAAM,WAAW,QAChB,SAAQ,IAAI,CACV,iBAAiB,CAAC,WAAW,CAAC,EAC9B,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CACjE,EACD,cAAc,EACd,oBAAoB;IACrB,oFAAoF;IACpF,EAAE,CAAC,EAAE,WAAW,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,GAAG,8EA6Pf,CAAC"}
|
|
@@ -8,14 +8,21 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import React, { forwardRef } from 'react';
|
|
9
9
|
import { componentStyles } from "../../styles/componentStyles.js";
|
|
10
10
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
11
|
+
/**
|
|
12
|
+
* Use CommonBoxProps to help consistently define additional utility props of a component
|
|
13
|
+
*/
|
|
11
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Box is a general purpose container with no specific semantics.
|
|
17
|
+
*/
|
|
18
|
+
export const Box = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
19
|
let {
|
|
14
20
|
as = 'div',
|
|
15
21
|
children,
|
|
16
22
|
className,
|
|
17
23
|
odComponent,
|
|
18
24
|
testId,
|
|
25
|
+
// style props
|
|
19
26
|
display,
|
|
20
27
|
height,
|
|
21
28
|
maxWidth,
|
|
@@ -34,7 +41,9 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
34
41
|
backgroundColour,
|
|
35
42
|
boxShadow,
|
|
36
43
|
color,
|
|
44
|
+
// modern semantic colour tokens
|
|
37
45
|
colour,
|
|
46
|
+
// legacy colours
|
|
38
47
|
fg,
|
|
39
48
|
opacity,
|
|
40
49
|
fontSize,
|
|
@@ -225,7 +234,7 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
225
234
|
paddingRight,
|
|
226
235
|
paddingTop
|
|
227
236
|
});
|
|
228
|
-
return _jsx(Component, _objectSpread(_objectSpread(_objectSpread({}, allOtherProps), dataAttrs({
|
|
237
|
+
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread(_objectSpread({}, allOtherProps), dataAttrs({
|
|
229
238
|
'od-component': odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
|
|
230
239
|
testid: testId
|
|
231
240
|
})), {}, {
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import React, { type ElementType } from 'react';
|
|
2
2
|
import { type UseBoxProps } from './useBox';
|
|
3
|
+
/**
|
|
4
|
+
* A polymorphic Box component that provides a flexible container with styling capabilities, defaulting to a `<div>` element.
|
|
5
|
+
* Use the `as` prop to control the rendered HTML tag. The box component exposes design system tokens relative to each style
|
|
6
|
+
* prop.
|
|
7
|
+
*
|
|
8
|
+
* An alternative to the `as` prop is `asComponent` which allows a React element to render with the custom props
|
|
9
|
+
*
|
|
10
|
+
* Props include:
|
|
11
|
+
* - Sprinkles props (spacing, colors, layout, etc.)
|
|
12
|
+
* - Responsive props (arrays for different breakpoints)
|
|
13
|
+
* - Also accepts valid HTML attributes for the chosen HTML tag
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Box as="section" mx="5" py="5" backgroundColor="accent">
|
|
17
|
+
* Section content
|
|
18
|
+
* </Box>
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Box display={['block', 'flex']} p={['3', '6', '8']}>Responsive padding</Box>
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Box asComponent={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
25
|
+
*/
|
|
3
26
|
export declare const NewBox: {
|
|
4
27
|
<E extends ElementType = "div">({ children, ...props }: UseBoxProps<E>): React.JSX.Element;
|
|
5
28
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/NewBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"NewBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/NewBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,MAAM;KAAI,CAAC,SAAS,WAAW,kCAGzC,WAAW,CAAC,CAAC,CAAC;;CAUhB,CAAC"}
|
|
@@ -7,6 +7,29 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import React, { cloneElement } from 'react';
|
|
9
9
|
import { useBox } from "./useBox.js";
|
|
10
|
+
/**
|
|
11
|
+
* A polymorphic Box component that provides a flexible container with styling capabilities, defaulting to a `<div>` element.
|
|
12
|
+
* Use the `as` prop to control the rendered HTML tag. The box component exposes design system tokens relative to each style
|
|
13
|
+
* prop.
|
|
14
|
+
*
|
|
15
|
+
* An alternative to the `as` prop is `asComponent` which allows a React element to render with the custom props
|
|
16
|
+
*
|
|
17
|
+
* Props include:
|
|
18
|
+
* - Sprinkles props (spacing, colors, layout, etc.)
|
|
19
|
+
* - Responsive props (arrays for different breakpoints)
|
|
20
|
+
* - Also accepts valid HTML attributes for the chosen HTML tag
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <Box as="section" mx="5" py="5" backgroundColor="accent">
|
|
24
|
+
* Section content
|
|
25
|
+
* </Box>
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Box display={['block', 'flex']} p={['3', '6', '8']}>Responsive padding</Box>
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Box asComponent={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
32
|
+
*/
|
|
10
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
34
|
export const NewBox = _ref => {
|
|
12
35
|
let {
|
|
@@ -19,9 +42,9 @@ export const NewBox = _ref => {
|
|
|
19
42
|
reactElement
|
|
20
43
|
} = useBox(props);
|
|
21
44
|
if (reactElement) {
|
|
22
|
-
return cloneElement(reactElement, componentProps, children);
|
|
45
|
+
return /*#__PURE__*/cloneElement(reactElement, componentProps, children);
|
|
23
46
|
}
|
|
24
|
-
return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
47
|
+
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
25
48
|
children: children
|
|
26
49
|
}));
|
|
27
50
|
};
|