@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
|
@@ -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
|
};
|
|
@@ -4,17 +4,41 @@ import type { Sprinkles } from '../../../styles/sprinkles.css';
|
|
|
4
4
|
import type { CommonBoxProps } from '../Box';
|
|
5
5
|
export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<ComponentStylesProps, 'className'> & Sprinkles;
|
|
6
6
|
export type BoxStylesReturn<P extends object> = [string, P];
|
|
7
|
+
/** Extract the ref type for a polymorphic component based on the provided element type */
|
|
7
8
|
export type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
|
|
9
|
+
/** `as` prop for polymorphic components, allowing specification of the rendered element type */
|
|
8
10
|
export type AsPolyProp<C extends ElementType> = {
|
|
9
11
|
as?: C | ReactElement;
|
|
10
12
|
};
|
|
13
|
+
/** `ref` prop for polymorphic components, using the extracted `PolymorphicRef` type */
|
|
11
14
|
export type RefPolyProp<C extends ElementType> = {
|
|
12
15
|
ref?: PolymorphicRef<C>;
|
|
13
16
|
};
|
|
17
|
+
/** Helps to omit base component's props when creating polymorphic props */
|
|
14
18
|
export type PropsToOmit<C extends ElementType, P> = keyof (AsPolyProp<C> & P);
|
|
19
|
+
/**
|
|
20
|
+
* Constructs the props type for a polymorphic component.
|
|
21
|
+
* It combines base props (`Props`), the `as` prop, and the `ref` prop,
|
|
22
|
+
* while omitting conflicting keys from the base element's intrinsic props.
|
|
23
|
+
*/
|
|
15
24
|
export type PolymorphicComponentProps<C extends ElementType, Props = object> = PropsWithChildren<Props & AsPolyProp<C> & RefPolyProp<C>> & Omit<ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
25
|
+
/** Polymorphic box props that merge sprinkles style props and the HTML element props */
|
|
16
26
|
export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, CommonBoxProps & Sprinkles>;
|
|
27
|
+
/**
|
|
28
|
+
* Define custom props similar to Box with polymorphic, common and style props.
|
|
29
|
+
* Component props will take take precedent over style props and can overwrite them
|
|
30
|
+
*/
|
|
17
31
|
export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<Sprinkles, keyof P> & CommonBoxProps & P>;
|
|
32
|
+
/**
|
|
33
|
+
* The Overdrive component primitive to expose a flexible HTML element as a fully typesafe React component
|
|
34
|
+
* that provides intrinsic props as well as style props from vanilla-extract sprinkles.
|
|
35
|
+
*
|
|
36
|
+
* The return value must be checked for `reactElement` being defined.
|
|
37
|
+
*
|
|
38
|
+
* @returns `{ Component, reactElement, componentProps, SemanticChild }` where `reactElement` is only defined
|
|
39
|
+
* if JSX was passed in the `as` prop and `cloneElement` will need to be used. `SemanticChild` is only defined
|
|
40
|
+
* depending on the HTML tag.
|
|
41
|
+
*/
|
|
18
42
|
export declare const useBox: <E extends ElementType = "div">({ as: _as, className: _className, odComponent, testId, ...props }: UseBoxProps<E>) => {
|
|
19
43
|
Component: ElementType;
|
|
20
44
|
componentProps: ComponentPropsWithRef<E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAQ7C,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,GACvC,SAAS,CAAC;AAEX,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAQ7C,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,GACvC,SAAS,CAAC;AAEX,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE5D,0FAA0F;AAC1F,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAC/C,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAEjC,gGAAgG;AAChG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI;IAC/C,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC;CAGtB,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI;IAChD,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,CACpC,CAAC,SAAS,WAAW,EACrB,KAAK,GAAG,MAAM,IACX,iBAAiB,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC5D,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAE1D,wFAAwF;AACxF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IACpD,yBAAyB,CAAC,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,YAAY,CACvB,CAAC,SAAS,WAAW,EACrB,CAAC,GAAG,MAAM,IACP,yBAAyB,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC;AAEhF;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,mEAMnD,WAAW,CAAC,CAAC,CAAC;;;;;CAmChB,CAAC"}
|
|
@@ -10,10 +10,43 @@ import { useDeepCompareMemo } from "../../../hooks/index.js";
|
|
|
10
10
|
import { componentStyles } from "../../../styles/componentStyles.js";
|
|
11
11
|
import { dataAttrs } from "../../../utils/dataAttrs.js";
|
|
12
12
|
import { filterPropsWithStyles } from "../../../utils/sprinkles.js";
|
|
13
|
+
// defaults
|
|
13
14
|
const DEFAULT_TAG = 'div';
|
|
14
15
|
const LIST_ITEM_TAG = 'li';
|
|
15
16
|
const LIST_TAGS = ['ul', 'ol'];
|
|
16
17
|
const OD_COMPONENT_ATTR = 'od-component';
|
|
18
|
+
|
|
19
|
+
/** Extract the ref type for a polymorphic component based on the provided element type */
|
|
20
|
+
|
|
21
|
+
/** `as` prop for polymorphic components, allowing specification of the rendered element type */
|
|
22
|
+
|
|
23
|
+
/** `ref` prop for polymorphic components, using the extracted `PolymorphicRef` type */
|
|
24
|
+
|
|
25
|
+
/** Helps to omit base component's props when creating polymorphic props */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Constructs the props type for a polymorphic component.
|
|
29
|
+
* It combines base props (`Props`), the `as` prop, and the `ref` prop,
|
|
30
|
+
* while omitting conflicting keys from the base element's intrinsic props.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** Polymorphic box props that merge sprinkles style props and the HTML element props */
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Define custom props similar to Box with polymorphic, common and style props.
|
|
37
|
+
* Component props will take take precedent over style props and can overwrite them
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The Overdrive component primitive to expose a flexible HTML element as a fully typesafe React component
|
|
42
|
+
* that provides intrinsic props as well as style props from vanilla-extract sprinkles.
|
|
43
|
+
*
|
|
44
|
+
* The return value must be checked for `reactElement` being defined.
|
|
45
|
+
*
|
|
46
|
+
* @returns `{ Component, reactElement, componentProps, SemanticChild }` where `reactElement` is only defined
|
|
47
|
+
* if JSX was passed in the `as` prop and `cloneElement` will need to be used. `SemanticChild` is only defined
|
|
48
|
+
* depending on the HTML tag.
|
|
49
|
+
*/
|
|
17
50
|
export const useBox = _ref => {
|
|
18
51
|
let {
|
|
19
52
|
as: _as,
|
|
@@ -22,11 +55,15 @@ export const useBox = _ref => {
|
|
|
22
55
|
testId
|
|
23
56
|
} = _ref,
|
|
24
57
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
const isReactElement = typeof _as !== 'string' && isValidElement(_as);
|
|
58
|
+
const isReactElement = typeof _as !== 'string' && /*#__PURE__*/isValidElement(_as);
|
|
26
59
|
const as = isReactElement ? undefined : _as !== null && _as !== void 0 ? _as : DEFAULT_TAG;
|
|
27
60
|
const Component = as !== null && as !== void 0 ? as : DEFAULT_TAG;
|
|
61
|
+
|
|
62
|
+
// logic to promote semantic HTML and ensure a child tag is correct for the `as` prop
|
|
28
63
|
const isList = LIST_TAGS.includes(Component);
|
|
29
64
|
const SemanticChild = isList ? LIST_ITEM_TAG : undefined;
|
|
65
|
+
|
|
66
|
+
// deep compare is mainly to attempt to stop rerenders arrising from responsive style props
|
|
30
67
|
const {
|
|
31
68
|
className,
|
|
32
69
|
baseProps
|
|
@@ -33,10 +33,10 @@ export const Bullet = _ref => {
|
|
|
33
33
|
children,
|
|
34
34
|
className
|
|
35
35
|
} = _ref;
|
|
36
|
-
return _jsx(Box, {
|
|
36
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
37
37
|
as: "li",
|
|
38
38
|
className: [styles.root.default, (_getBulletCls = getBulletCls(styles, bulletMap[useContext(BulletListContext)])) !== null && _getBulletCls !== void 0 ? _getBulletCls : '', {
|
|
39
|
-
[styles.noDot]: isValidElement(children) && children.type === BulletList
|
|
39
|
+
[styles.noDot]: /*#__PURE__*/isValidElement(children) && children.type === BulletList
|
|
40
40
|
}, className],
|
|
41
41
|
children: children
|
|
42
42
|
});
|
|
@@ -13,13 +13,13 @@ export const BulletList = _ref => {
|
|
|
13
13
|
className
|
|
14
14
|
} = _ref;
|
|
15
15
|
const stack = useContext(BulletListContext);
|
|
16
|
-
return _jsx(Box, {
|
|
16
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
17
17
|
as: "ul",
|
|
18
18
|
className: clsx(className, styles.root, {
|
|
19
19
|
[styles.firstOccurrence]: stack === -1
|
|
20
20
|
}),
|
|
21
21
|
odComponent: "bullet-list",
|
|
22
|
-
children: _jsx(BulletListContext.Provider, {
|
|
22
|
+
children: /*#__PURE__*/_jsx(BulletListContext.Provider, {
|
|
23
23
|
value: stack + 1 >= bulletMap.length ? 0 : stack + 1,
|
|
24
24
|
children: children
|
|
25
25
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMhD,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAChD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,GAAI,4CAKxB,eAAe,sBA2CjB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import React, { isValidElement } from 'react';
|
|
4
5
|
import { Box } from "../Box/Box.js";
|
|
5
6
|
import { Inline } from "../Inline/Inline.js";
|
|
@@ -13,39 +14,39 @@ export const BulletText = _ref => {
|
|
|
13
14
|
children,
|
|
14
15
|
bullet: Bullet = '•'
|
|
15
16
|
} = _ref;
|
|
16
|
-
return _jsxs(Inline, {
|
|
17
|
+
return /*#__PURE__*/_jsxs(Inline, {
|
|
17
18
|
as: as,
|
|
18
19
|
noWrap: true,
|
|
19
20
|
space: "3",
|
|
20
21
|
alignX: "start",
|
|
21
22
|
alignY: "center",
|
|
22
|
-
children: [isValidElement(Bullet) ? _jsx(Box, {
|
|
23
|
+
children: [/*#__PURE__*/isValidElement(Bullet) ? /*#__PURE__*/_jsx(Box, {
|
|
23
24
|
position: "relative",
|
|
24
25
|
flexShrink: 0,
|
|
25
26
|
children: Bullet
|
|
26
|
-
}) : _jsx(Box, {
|
|
27
|
+
}) : /*#__PURE__*/_jsx(Box, {
|
|
27
28
|
position: "relative",
|
|
28
|
-
flexShrink:
|
|
29
|
+
flexShrink: 0,
|
|
29
30
|
display: "flex",
|
|
30
31
|
alignItems: "center",
|
|
31
32
|
justifyContent: "center",
|
|
32
|
-
className:
|
|
33
|
+
className: clsx(styles.bullet, {
|
|
33
34
|
[styles.primary]: variant === 'primary',
|
|
34
35
|
[styles.secondary]: variant !== 'primary'
|
|
35
|
-
}
|
|
36
|
+
}),
|
|
36
37
|
borderRadius: "pill",
|
|
37
|
-
children: _jsx(Text, {
|
|
38
|
-
className: {
|
|
38
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
39
|
+
className: clsx({
|
|
39
40
|
[styles.primaryText]: variant === 'primary',
|
|
40
41
|
[styles.secondaryText]: variant !== 'primary'
|
|
41
|
-
},
|
|
42
|
+
}),
|
|
42
43
|
as: "span",
|
|
43
44
|
size: "2",
|
|
44
45
|
children: Bullet
|
|
45
46
|
})
|
|
46
|
-
}), _jsx(Box, {
|
|
47
|
-
flexGrow:
|
|
48
|
-
children: _jsx(Text, {
|
|
47
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
49
50
|
as: "span",
|
|
50
51
|
size: "4",
|
|
51
52
|
display: "block",
|
|
@@ -90,8 +90,17 @@ export type ButtonShape = ButtonRecipeProps['shape'];
|
|
|
90
90
|
export type ButtonIntent = ButtonRecipeProps['intent'];
|
|
91
91
|
export type ButtonMinimal = ButtonRecipeProps['minimal'];
|
|
92
92
|
export interface StyledButtonProps {
|
|
93
|
+
/**
|
|
94
|
+
* Button sizing
|
|
95
|
+
*/
|
|
93
96
|
size?: ButtonSize;
|
|
97
|
+
/**
|
|
98
|
+
* Button intentional colour scheme
|
|
99
|
+
*/
|
|
94
100
|
variant?: ButtonIntent;
|
|
101
|
+
/**
|
|
102
|
+
* Present a borderless minimal appearance
|
|
103
|
+
*/
|
|
95
104
|
minimal?: ButtonMinimal;
|
|
96
105
|
}
|
|
97
106
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAWlE,eAAO,MAAM,IAAI,QAIf,CAAC;AAEH,eAAO,MAAM,aAAa,QAExB,CAAC;AAEH,eAAO,MAAM,OAAO,QAElB,CAAC;AAGH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+OjB,CAAC;AAEH,KAAK,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"Button.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAWlE,eAAO,MAAM,IAAI,QAIf,CAAC;AAEH,eAAO,MAAM,aAAa,QAExB,CAAC;AAEH,eAAO,MAAM,OAAO,QAElB,CAAC;AAGH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+OjB,CAAC;AAEH,KAAK,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB"}
|
|
@@ -20,6 +20,8 @@ export const hiddenContent = style({
|
|
|
20
20
|
export const spinner = style({
|
|
21
21
|
margin: '0 auto'
|
|
22
22
|
}, "spinner");
|
|
23
|
+
|
|
24
|
+
// Button recipe with all variants
|
|
23
25
|
export const button = recipe({
|
|
24
26
|
base: [{
|
|
25
27
|
transitionTimingFunction: vars.animation.easing.standard,
|
|
@@ -41,6 +43,7 @@ export const button = recipe({
|
|
|
41
43
|
}
|
|
42
44
|
}, focusOutlineStyle],
|
|
43
45
|
variants: {
|
|
46
|
+
// Size variants
|
|
44
47
|
size: {
|
|
45
48
|
small: {
|
|
46
49
|
height: smallHeight
|
|
@@ -52,11 +55,13 @@ export const button = recipe({
|
|
|
52
55
|
padding: `2px ${vars.space['2']}`
|
|
53
56
|
}
|
|
54
57
|
},
|
|
58
|
+
// Shape variants
|
|
55
59
|
shape: {
|
|
56
60
|
default: {},
|
|
57
61
|
rounded: {},
|
|
58
62
|
iconOnly: {}
|
|
59
63
|
},
|
|
64
|
+
// Intent (color scheme) variants
|
|
60
65
|
intent: {
|
|
61
66
|
primary: {
|
|
62
67
|
color: intentColors.primary.foreground,
|
|
@@ -113,6 +118,7 @@ export const button = recipe({
|
|
|
113
118
|
}
|
|
114
119
|
}
|
|
115
120
|
},
|
|
121
|
+
// Miminal appearance variant
|
|
116
122
|
minimal: {
|
|
117
123
|
true: {
|
|
118
124
|
color: vars.typography.colour.neutral,
|
|
@@ -122,7 +128,9 @@ export const button = recipe({
|
|
|
122
128
|
false: []
|
|
123
129
|
}
|
|
124
130
|
},
|
|
125
|
-
compoundVariants: [
|
|
131
|
+
compoundVariants: [
|
|
132
|
+
// Size and shape compound variants
|
|
133
|
+
{
|
|
126
134
|
variants: {
|
|
127
135
|
size: 'small',
|
|
128
136
|
shape: 'default'
|
|
@@ -172,7 +180,9 @@ export const button = recipe({
|
|
|
172
180
|
style: {
|
|
173
181
|
width: vars.space['8']
|
|
174
182
|
}
|
|
175
|
-
},
|
|
183
|
+
},
|
|
184
|
+
// Minimal compound variants per intent
|
|
185
|
+
{
|
|
176
186
|
variants: {
|
|
177
187
|
intent: 'primary',
|
|
178
188
|
minimal: true
|
|
@@ -9,14 +9,23 @@ declare const defaultEnglish: {
|
|
|
9
9
|
readonly loading: "loading";
|
|
10
10
|
};
|
|
11
11
|
type TextContent = keyof typeof defaultEnglish;
|
|
12
|
-
export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onClick' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'>, StyledButtonProps, TestId {
|
|
12
|
+
export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onBlur' | 'onClick' | 'onFocus' | 'onMouseEnter' | 'onMouseLeave' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'>, StyledButtonProps, TestId {
|
|
13
13
|
children: AllowedChildren | AllowedChildren[];
|
|
14
|
+
/**
|
|
15
|
+
* Disabling the button will prevent it from receiving keyboard focus or click events
|
|
16
|
+
*/
|
|
14
17
|
disabled?: boolean;
|
|
15
|
-
|
|
18
|
+
is?: ElementType | ReactElement;
|
|
16
19
|
isLoading?: boolean;
|
|
17
20
|
isFullWidth?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Pill shaped button appearance
|
|
23
|
+
*/
|
|
18
24
|
rounded?: boolean;
|
|
19
25
|
withDoubleClicks?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Language content override
|
|
28
|
+
*/
|
|
20
29
|
lang?: Partial<Record<TextContent, string>>;
|
|
21
30
|
}
|
|
22
31
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EASN,KAAK,cAAc,EAEnB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAElE,KAAK,eAAe,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACvD,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,CAAC;AAIzC,QAAA,MAAM,cAAc;;CAEV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAE/C,MAAM,WAAW,WAChB,SAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EASN,KAAK,cAAc,EAEnB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAElE,KAAK,eAAe,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACvD,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,CAAC;AAIzC,QAAA,MAAM,cAAc;;CAEV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAE/C,MAAM,WAAW,WAChB,SAAQ,IAAI,CACV,eAAe,EACb,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,SAAS,GACT,cAAc,GACd,cAAc,GACd,MAAM,GACN,WAAW,CACb,EACD,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,EAClC,iBAAiB,EACjB,MAAM;IACP,QAAQ,EAAE,eAAe,GAAG,eAAe,EAAE,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AA2BD,eAAO,MAAM,MAAM,uFAoLlB,CAAC;AAIF,eAAe,MAAM,CAAC"}
|
|
@@ -34,19 +34,23 @@ const fontWeight = {
|
|
|
34
34
|
small: 'semiBold',
|
|
35
35
|
medium: 'semiBold'
|
|
36
36
|
};
|
|
37
|
-
export const Button = forwardRef((_ref, ref) => {
|
|
37
|
+
export const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
38
38
|
let {
|
|
39
39
|
children,
|
|
40
40
|
className = '',
|
|
41
41
|
disabled = false,
|
|
42
42
|
id,
|
|
43
|
-
|
|
43
|
+
is: Component = 'button',
|
|
44
44
|
withDoubleClicks = false,
|
|
45
45
|
isLoading = false,
|
|
46
46
|
isFullWidth = false,
|
|
47
47
|
lang,
|
|
48
48
|
minimal = false,
|
|
49
|
+
onBlur,
|
|
49
50
|
onClick: incomingOnClick,
|
|
51
|
+
onFocus,
|
|
52
|
+
onMouseEnter,
|
|
53
|
+
onMouseLeave,
|
|
50
54
|
rounded = false,
|
|
51
55
|
size = 'medium',
|
|
52
56
|
type = 'button',
|
|
@@ -59,7 +63,9 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
59
63
|
isSingleIconChild,
|
|
60
64
|
props: maybeIconProps
|
|
61
65
|
} = useMemo(() => {
|
|
62
|
-
const maybeIcon =
|
|
66
|
+
const maybeIcon =
|
|
67
|
+
// @ts-expect-error This comparison appears to be unintentional
|
|
68
|
+
/*#__PURE__*/isValidElement(children) && children.type === Icon;
|
|
63
69
|
const maybeProps = children;
|
|
64
70
|
return maybeIcon ? {
|
|
65
71
|
isSingleIconChild: true,
|
|
@@ -73,6 +79,8 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
73
79
|
if (!withDoubleClicks) setFunctionallyDisabled(true);
|
|
74
80
|
if (typeof incomingOnClick === 'function') incomingOnClick(event);
|
|
75
81
|
}, [withDoubleClicks, incomingOnClick]);
|
|
82
|
+
|
|
83
|
+
// Determine shape based on rounded and iconOnly status
|
|
76
84
|
const shape = useMemo(() => {
|
|
77
85
|
if (isSingleIconChild) return 'iconOnly';
|
|
78
86
|
if (rounded) return 'rounded';
|
|
@@ -81,7 +89,11 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
81
89
|
const props = _objectSpread(_objectSpread({
|
|
82
90
|
type: Component === 'button' ? type : undefined,
|
|
83
91
|
id,
|
|
92
|
+
onBlur,
|
|
84
93
|
onClick,
|
|
94
|
+
onFocus,
|
|
95
|
+
onMouseEnter,
|
|
96
|
+
onMouseLeave,
|
|
85
97
|
disabled: disabled || isLoading,
|
|
86
98
|
'aria-label': isLoading ? language.loading : ariaLabel,
|
|
87
99
|
className: clsx(componentStyles({
|
|
@@ -113,8 +125,8 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
113
125
|
});
|
|
114
126
|
const buttonContents = useMemo(() => {
|
|
115
127
|
var _maybeIconProps$size;
|
|
116
|
-
return _jsx(_Fragment, {
|
|
117
|
-
children: isSingleIconChild && maybeIconProps ? _jsx(Icon, _objectSpread({
|
|
128
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
129
|
+
children: isSingleIconChild && maybeIconProps ? /*#__PURE__*/_jsx(Icon, _objectSpread({
|
|
118
130
|
size: ((_maybeIconProps$size = maybeIconProps.size) !== null && _maybeIconProps$size !== void 0 ? _maybeIconProps$size : size === 'small') ? 'small' : 'medium'
|
|
119
131
|
}, maybeIconProps)) : children
|
|
120
132
|
});
|
|
@@ -124,39 +136,39 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
124
136
|
if (functionallyDisabled) timeout = setTimeout(() => setFunctionallyDisabled(false), DOUBLE_CLICK_DETECTION_PERIOD);
|
|
125
137
|
return () => timeout ? clearTimeout(timeout) : void 0;
|
|
126
138
|
}, [functionallyDisabled]);
|
|
127
|
-
const child = isLoading ? _jsxs(Box, {
|
|
139
|
+
const child = isLoading ? /*#__PURE__*/_jsxs(Box, {
|
|
128
140
|
display: "flex",
|
|
129
141
|
justifyContent: "center",
|
|
130
142
|
position: "relative",
|
|
131
143
|
alignItems: "center",
|
|
132
144
|
width: "full",
|
|
133
145
|
height: "full",
|
|
134
|
-
children: [_jsx(Box, {
|
|
146
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
135
147
|
position: "absolute",
|
|
136
148
|
alignItems: "center",
|
|
137
149
|
justifyContent: "center",
|
|
138
150
|
display: "flex",
|
|
139
151
|
width: "full",
|
|
140
152
|
height: "full",
|
|
141
|
-
children: _jsx(ProgressSpinner, {
|
|
153
|
+
children: /*#__PURE__*/_jsx(ProgressSpinner, {
|
|
142
154
|
className: styles.spinner,
|
|
143
155
|
colour: getSpinnerColour(variant, minimal)
|
|
144
156
|
})
|
|
145
|
-
}), _jsx(Box, {
|
|
157
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
146
158
|
height: "full",
|
|
147
159
|
alignItems: "center",
|
|
148
160
|
justifyContent: "center",
|
|
149
161
|
className: [styles.body, styles.hiddenContent],
|
|
150
162
|
children: buttonContents
|
|
151
163
|
})]
|
|
152
|
-
}) : _jsx(Box, {
|
|
164
|
+
}) : /*#__PURE__*/_jsx(Box, {
|
|
153
165
|
height: "full",
|
|
154
166
|
alignItems: "center",
|
|
155
167
|
justifyContent: "center",
|
|
156
168
|
className: styles.body,
|
|
157
169
|
children: buttonContents
|
|
158
170
|
});
|
|
159
|
-
return isValidElement(Component) ? cloneElement(Component, _objectSpread({}, props), child) : createElement(Component, _objectSpread({}, props), child);
|
|
171
|
+
return /*#__PURE__*/isValidElement(Component) ? /*#__PURE__*/cloneElement(Component, _objectSpread({}, props), child) : /*#__PURE__*/createElement(Component, _objectSpread({}, props), child);
|
|
160
172
|
});
|
|
161
173
|
Button.displayName = 'Button';
|
|
162
174
|
export default Button;
|
|
@@ -3,6 +3,10 @@ export interface CheckboxProps {
|
|
|
3
3
|
className?: string;
|
|
4
4
|
checked?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Used to set an individual checkbox to an inbetween state and sets `indeterminate` accordingly on the native
|
|
8
|
+
* input control. Toggling logic is left up to the parent component
|
|
9
|
+
*/
|
|
6
10
|
isIndeterminate?: boolean;
|
|
7
11
|
name?: string;
|
|
8
12
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBox.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAqB,MAAM,OAAO,CAAC;AAWxE,MAAM,WAAW,aAAa;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckBox.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAqB,MAAM,OAAO,CAAC;AAWxE,MAAM,WAAW,aAAa;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,QAAQ,wFA0DpB,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { CheckableBase } from "../private/CheckableBase/CheckableBase.js";
|
|
|
14
14
|
import { checkableIndicator } from "../private/CheckableBase/CheckableBase.css.js";
|
|
15
15
|
import * as styles from "./CheckBox.css.js";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
export const CheckBox = forwardRef((_ref, ref) => {
|
|
17
|
+
export const CheckBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
18
18
|
let {
|
|
19
19
|
value,
|
|
20
20
|
className = '',
|
|
@@ -32,7 +32,7 @@ export const CheckBox = forwardRef((_ref, ref) => {
|
|
|
32
32
|
internalRef.current.indeterminate = isIndeterminate;
|
|
33
33
|
}
|
|
34
34
|
}, [isIndeterminate]);
|
|
35
|
-
return _jsx(CheckableBase, {
|
|
35
|
+
return /*#__PURE__*/_jsx(CheckableBase, {
|
|
36
36
|
ref: mergeRefs([ref, internalRef]),
|
|
37
37
|
inputType: "checkbox",
|
|
38
38
|
className: className,
|
|
@@ -43,14 +43,14 @@ export const CheckBox = forwardRef((_ref, ref) => {
|
|
|
43
43
|
checked: checked,
|
|
44
44
|
handleClick: onClick,
|
|
45
45
|
handleChange: onChange,
|
|
46
|
-
children: _jsx(Box, _objectSpread(_objectSpread({
|
|
46
|
+
children: /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
47
47
|
className: clsx(styles.checkbox.default, checkableIndicator, {
|
|
48
48
|
[styles.checkbox.selected]: checked || isIndeterminate
|
|
49
49
|
})
|
|
50
50
|
}, dataAttrs({
|
|
51
51
|
indeterminate: isIndeterminate
|
|
52
52
|
})), {}, {
|
|
53
|
-
children: _jsx(Icon, {
|
|
53
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
54
54
|
icon: isIndeterminate ? MinusIcon : CheckIcon,
|
|
55
55
|
size: "medium",
|
|
56
56
|
className: styles.icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColourInput.d.ts","sourceRoot":"","sources":["../../../lib/components/ColourInput/ColourInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColourInput.d.ts","sourceRoot":"","sources":["../../../lib/components/ColourInput/ColourInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,eAAO,MAAM,WAAW,8TAyEvB,CAAC"}
|