@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
|
@@ -3,103 +3,82 @@
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
6
|
+
import { invariant } from '@autoguru/utilities';
|
|
7
|
+
import React, { Children, cloneElement, isValidElement } from 'react';
|
|
8
|
+
import { useTooltip } from "../../hooks/useTooltip/useTooltip.js";
|
|
8
9
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
9
|
-
import { Box } from "../Box/Box.js";
|
|
10
|
-
import { Positioner } from "../Positioner/Positioner.js";
|
|
11
10
|
import { EAlignment } from "../Positioner/alignment.js";
|
|
12
|
-
import { Text } from "../Text/Text.js";
|
|
13
11
|
import * as styles from "./Tooltip.css.js";
|
|
14
12
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Renders a tooltip that appears when the user hovers over or focuses on the trigger element.
|
|
15
|
+
*
|
|
16
|
+
* If the provided children are not keyboard-focusable, you can supply set `wrapper` to true to
|
|
17
|
+
* ensure keyboard accessibility. You can also give a tag name to the `wrapper` prop.
|
|
18
|
+
*
|
|
19
|
+
* This component can operate in either controlled or uncontrolled mode:
|
|
20
|
+
* - In uncontrolled mode, it opens on hover/focus and can auto-close after a specified delay.
|
|
21
|
+
* - In controlled mode, its visibility is managed externally via the `isOpen` prop.
|
|
22
|
+
*/
|
|
19
23
|
export const Tooltip = _ref => {
|
|
20
24
|
let {
|
|
21
25
|
alignment = EAlignment.RIGHT,
|
|
22
|
-
isOpen
|
|
26
|
+
isOpen,
|
|
23
27
|
label,
|
|
24
28
|
children,
|
|
25
29
|
size = 'medium',
|
|
26
30
|
closeAfter = null,
|
|
27
|
-
testId
|
|
31
|
+
testId,
|
|
32
|
+
wrapper
|
|
28
33
|
} = _ref;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const leaveHandler = useCallback(() => {
|
|
41
|
-
leaveTimer.current = setTimeout(() => {
|
|
42
|
-
setIsOpen(false);
|
|
43
|
-
}, 1e3 / 2);
|
|
44
|
-
}, [setIsOpen]);
|
|
45
|
-
const focusHandler = useCallback(() => {
|
|
46
|
-
setIsOpen(true);
|
|
47
|
-
}, [setIsOpen]);
|
|
48
|
-
const blurHandler = useCallback(() => {
|
|
49
|
-
setIsOpen(false);
|
|
50
|
-
}, [setIsOpen]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
let timeout;
|
|
53
|
-
if (isOpen && typeof closeAfter === 'number') {
|
|
54
|
-
timeout = setTimeout(() => setIsOpen(false), closeAfter);
|
|
55
|
-
}
|
|
56
|
-
return () => {
|
|
57
|
-
if (timeout) clearTimeout(timeout);
|
|
58
|
-
};
|
|
59
|
-
}, [closeAfter, isOpen]);
|
|
60
|
-
if (!label) return _jsx(_Fragment, {
|
|
34
|
+
const {
|
|
35
|
+
PositionedTooltip,
|
|
36
|
+
triggerRef,
|
|
37
|
+
triggerProps
|
|
38
|
+
} = useTooltip({
|
|
39
|
+
isOpen,
|
|
40
|
+
closeAfter
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// return early if no label provided
|
|
44
|
+
if (!label) return /*#__PURE__*/_jsx(_Fragment, {
|
|
61
45
|
children: children
|
|
62
46
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children: children
|
|
79
|
-
})), _jsx(Positioner, {
|
|
80
|
-
triggerRef: triggerRef,
|
|
81
|
-
alignment: alignment,
|
|
82
|
-
isOpen: typeof incomingIsOpen === 'boolean' ? incomingIsOpen : isOpen,
|
|
83
|
-
children: _jsx(Box, {
|
|
84
|
-
id: tooltipId,
|
|
85
|
-
ref: tooltipRef,
|
|
47
|
+
|
|
48
|
+
// return wrapped output
|
|
49
|
+
if (wrapper) {
|
|
50
|
+
const TagName = typeof wrapper === 'string' ? wrapper : 'span';
|
|
51
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
52
|
+
children: [/*#__PURE__*/_jsx(TagName, _objectSpread(_objectSpread(_objectSpread({
|
|
53
|
+
ref: triggerRef
|
|
54
|
+
}, triggerProps), {}, {
|
|
55
|
+
tabIndex: 0
|
|
56
|
+
}, dataAttrs({
|
|
57
|
+
testid: testId
|
|
58
|
+
})), {}, {
|
|
59
|
+
children: children
|
|
60
|
+
})), /*#__PURE__*/_jsx(PositionedTooltip, {
|
|
61
|
+
alignment: alignment,
|
|
86
62
|
className: styles.root,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
63
|
+
label: label,
|
|
64
|
+
size: size
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
! /*#__PURE__*/isValidElement(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Tooltips without a wrapper should have a single child component') : invariant(false) : void 0;
|
|
69
|
+
if (! /*#__PURE__*/isValidElement(children)) return /*#__PURE__*/_jsx(_Fragment, {
|
|
70
|
+
children: children
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// nested React component which receices spread props
|
|
74
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
75
|
+
children: [/*#__PURE__*/cloneElement(Children.only(children), _objectSpread(_objectSpread({}, triggerProps), {}, {
|
|
76
|
+
ref: triggerRef
|
|
77
|
+
})), /*#__PURE__*/_jsx(PositionedTooltip, {
|
|
78
|
+
alignment: alignment,
|
|
79
|
+
className: styles.root,
|
|
80
|
+
label: label,
|
|
81
|
+
size: size
|
|
103
82
|
})]
|
|
104
83
|
});
|
|
105
84
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Tooltip } from './Tooltip';
|
|
1
|
+
export { Tooltip, type TooltipProps } from './Tooltip';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BoxProps } from '../Box/Box';
|
|
3
3
|
type VisuallyHiddenProps = Pick<BoxProps, 'as' | 'children'>;
|
|
4
|
+
/**
|
|
5
|
+
* Wrap any content or components with `<VisuallyHidden>` to apply styling that ensure the child content is not
|
|
6
|
+
* visually displayed on the screen but is still present in the DOM/accessibility tree for assitive technology.
|
|
7
|
+
* Use the `as` prop to change the rendered html tag.
|
|
8
|
+
*/
|
|
4
9
|
export declare const VisuallyHidden: ({ children, ...props }: VisuallyHiddenProps) => React.JSX.Element;
|
|
5
10
|
export {};
|
|
6
11
|
//# sourceMappingURL=VisuallyHidden.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../../../lib/components/VisuallyHidden/VisuallyHidden.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAIhD,KAAK,mBAAmB,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../../../lib/components/VisuallyHidden/VisuallyHidden.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAIhD,KAAK,mBAAmB,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,wBAAwB,mBAAmB,sBAIzE,CAAC"}
|
|
@@ -9,12 +9,17 @@ import * as React from 'react';
|
|
|
9
9
|
import { Box } from "../Box/Box.js";
|
|
10
10
|
import { visuallyHidden } from "./VisuallyHidden.css.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Wrap any content or components with `<VisuallyHidden>` to apply styling that ensure the child content is not
|
|
14
|
+
* visually displayed on the screen but is still present in the DOM/accessibility tree for assitive technology.
|
|
15
|
+
* Use the `as` prop to change the rendered html tag.
|
|
16
|
+
*/
|
|
12
17
|
export const VisuallyHidden = _ref => {
|
|
13
18
|
let {
|
|
14
19
|
children
|
|
15
20
|
} = _ref,
|
|
16
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
-
return _jsx(Box, _objectSpread(_objectSpread({}, props), {}, {
|
|
22
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({}, props), {}, {
|
|
18
23
|
className: visuallyHidden,
|
|
19
24
|
odComponent: "visually-hidden",
|
|
20
25
|
children: children
|
|
@@ -7,7 +7,7 @@ import { Text } from "../../Text/Text.js";
|
|
|
7
7
|
import { textStyles } from "../../Text/textStyles.js";
|
|
8
8
|
import * as styles from "./CheckableBase.css.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
export const CheckableBase = forwardRef((_ref, ref) => {
|
|
10
|
+
export const CheckableBase = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
11
|
let {
|
|
12
12
|
className = '',
|
|
13
13
|
label = '',
|
|
@@ -27,7 +27,7 @@ export const CheckableBase = forwardRef((_ref, ref) => {
|
|
|
27
27
|
};
|
|
28
28
|
const nakedLabel = ['string', 'number'].includes(typeof label);
|
|
29
29
|
const id = useId();
|
|
30
|
-
return _jsxs(Box, {
|
|
30
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
31
31
|
display: "flex",
|
|
32
32
|
alignItems: "center",
|
|
33
33
|
flexDirection: "row",
|
|
@@ -39,7 +39,7 @@ export const CheckableBase = forwardRef((_ref, ref) => {
|
|
|
39
39
|
className: [styles.root, resetStyles('button'), className, {
|
|
40
40
|
[styles.disabled]: disabled
|
|
41
41
|
}],
|
|
42
|
-
children: [_jsx(Box, {
|
|
42
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
43
43
|
ref: ref,
|
|
44
44
|
id: id,
|
|
45
45
|
as: "input",
|
|
@@ -57,14 +57,14 @@ export const CheckableBase = forwardRef((_ref, ref) => {
|
|
|
57
57
|
className: [resetStyles('button'), styles.nativeInput],
|
|
58
58
|
onClick: handleClick,
|
|
59
59
|
onChange: onChange
|
|
60
|
-
}), _jsx(Box, {
|
|
60
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
61
61
|
display: "flex",
|
|
62
62
|
alignItems: "center",
|
|
63
63
|
justifyContent: "center",
|
|
64
64
|
position: "relative",
|
|
65
65
|
className: [styles.checkable, resetStyles('button')],
|
|
66
66
|
children: children
|
|
67
|
-
}), _jsx(Box, {
|
|
67
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
68
68
|
as: "label",
|
|
69
69
|
htmlFor: id,
|
|
70
70
|
width: "full",
|
|
@@ -74,7 +74,7 @@ export const CheckableBase = forwardRef((_ref, ref) => {
|
|
|
74
74
|
}), {
|
|
75
75
|
[styles.label.disabled]: disabled
|
|
76
76
|
}],
|
|
77
|
-
children: nakedLabel ? _jsx(Text, {
|
|
77
|
+
children: nakedLabel ? /*#__PURE__*/_jsx(Text, {
|
|
78
78
|
as: "span",
|
|
79
79
|
children: label
|
|
80
80
|
}) : label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckableStyles.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/CheckableBase/useCheckableStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCheckableStyles.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/CheckableBase/useCheckableStyles.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM;IACtC,aAAa,EAAE,MAAM,CAAC;CAGrB,CAAC"}
|
|
@@ -16,7 +16,7 @@ export const HintText = _ref => {
|
|
|
16
16
|
} = _ref;
|
|
17
17
|
if (!hintText && !reserveHintSpace) return null;
|
|
18
18
|
const showHintText = !disabled && hintText;
|
|
19
|
-
return _jsx(Text, {
|
|
19
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
20
20
|
as: "p",
|
|
21
21
|
size: size === 'large' ? '4' : '2',
|
|
22
22
|
colour: "unset",
|
|
@@ -25,7 +25,7 @@ export const NotchedBase = _ref => {
|
|
|
25
25
|
} = _ref;
|
|
26
26
|
const labelRef = useRef(null);
|
|
27
27
|
const shouldMerge = !isFocused && !isHovered;
|
|
28
|
-
return _jsxs(Box, {
|
|
28
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
29
29
|
position: "relative",
|
|
30
30
|
width: "full",
|
|
31
31
|
padding: "none",
|
|
@@ -43,7 +43,7 @@ export const NotchedBase = _ref => {
|
|
|
43
43
|
[styles.bordersAttach.complete.BOTTOM]: !notch && attach === 'BOTTOM',
|
|
44
44
|
[styles.bordersAttach.complete.ALL]: !notch && attach === 'ALL'
|
|
45
45
|
}),
|
|
46
|
-
children: [children, notch && _jsxs(Box, {
|
|
46
|
+
children: [children, notch && /*#__PURE__*/_jsxs(Box, {
|
|
47
47
|
className: clsx(styles.borders.root.default, {
|
|
48
48
|
[styles.borders.root.disabled]: disabled
|
|
49
49
|
}),
|
|
@@ -53,7 +53,7 @@ export const NotchedBase = _ref => {
|
|
|
53
53
|
width: "full",
|
|
54
54
|
height: "full",
|
|
55
55
|
textAlign: "left",
|
|
56
|
-
children: [_jsx("div", {
|
|
56
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
57
57
|
className: clsx(styles.borders.leading, borderColourClassName, {
|
|
58
58
|
[styles.bordersMerged.complete.LEFT]: shouldMerge && borderMerged === 'LEFT',
|
|
59
59
|
[styles.bordersMerged.complete.TOP]: shouldMerge && borderMerged === 'TOP',
|
|
@@ -63,14 +63,14 @@ export const NotchedBase = _ref => {
|
|
|
63
63
|
[styles.bordersAttach.flatCorners.BOTTOM_LEFT]: attach === 'LEFT' || attach === 'BOTTOM' || attach === 'ALL',
|
|
64
64
|
[styles.largeBorder]: size === 'large'
|
|
65
65
|
})
|
|
66
|
-
}), _jsxs("div", {
|
|
66
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
67
67
|
className: clsx(styles.borders.middle, borderColourClassName, size === 'large' && styles.largeBorderY),
|
|
68
|
-
children: [_jsx(Box, {
|
|
68
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
69
69
|
display: isEmpty || placeholder.length === 0 ? 'none' : 'block',
|
|
70
70
|
paddingX: "2",
|
|
71
71
|
className: [styles.labelStyle.base, styles.labelStyle[size], styles.notchGapPlaceholder.base, styles.notchGapPlaceholder[size]],
|
|
72
72
|
children: placeholder
|
|
73
|
-
}), _jsx(Box, {
|
|
73
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
74
74
|
ref: labelRef,
|
|
75
75
|
as: "label",
|
|
76
76
|
pointerEvents: "none",
|
|
@@ -91,7 +91,7 @@ export const NotchedBase = _ref => {
|
|
|
91
91
|
}),
|
|
92
92
|
children: placeholder
|
|
93
93
|
})]
|
|
94
|
-
}), _jsx("div", {
|
|
94
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
95
95
|
className: clsx(styles.borders.trailing, borderColourClassName, {
|
|
96
96
|
[styles.bordersMerged.complete.RIGHT]: shouldMerge && borderMerged === 'RIGHT',
|
|
97
97
|
[styles.bordersMerged.complete.TOP]: shouldMerge && borderMerged === 'TOP',
|
|
@@ -4,7 +4,7 @@ import { Box } from '../../Box/Box';
|
|
|
4
4
|
import { NotchedBase } from './NotchedBase';
|
|
5
5
|
import type { InputSize } from './withEnhancedInput.css';
|
|
6
6
|
type ElementTypes = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
7
|
-
type NativeAttributes<E extends ElementTypes> = Omit<InputHTMLAttributes<E>, '
|
|
7
|
+
type NativeAttributes<E extends ElementTypes> = Omit<InputHTMLAttributes<E>, 'color' | 'height' | 'is' | 'placeholder' | 'size' | 'width'>;
|
|
8
8
|
export interface EventHandlers<E extends ElementTypes> {
|
|
9
9
|
onChange?: ChangeEventHandler<E>;
|
|
10
10
|
onBlur?: FocusEventHandler<E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withEnhancedInput.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/withEnhancedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,EAAE,EACb,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,SAAS,EAGd,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,KAAK,YAAY,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAC/E,KAAK,gBAAgB,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CACnD,mBAAmB,CAAC,CAAC,CAAC,EACtB,
|
|
1
|
+
{"version":3,"file":"withEnhancedInput.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/withEnhancedInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -16,7 +16,10 @@ import { ProgressSpinner } from "../../ProgressSpinner/ProgressSpinner.js";
|
|
|
16
16
|
import { HintText } from "./HintText.js";
|
|
17
17
|
import * as inputStateStyles from "./InputState.css.js";
|
|
18
18
|
import { NotchedBase } from "./NotchedBase.js";
|
|
19
|
-
import * as styles from "./withEnhancedInput.css.js";
|
|
19
|
+
import * as styles from "./withEnhancedInput.css.js"; // The event handlers we'll allow the wrapped component to bind too
|
|
20
|
+
// The props we'll give the end consumer to send
|
|
21
|
+
// An amalgamation of the HoC props, event handlers and the consumer props.
|
|
22
|
+
// The final props we send into thw wrapping component
|
|
20
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
24
|
export const withEnhancedInput = function (WrappingComponent) {
|
|
22
25
|
let {
|
|
@@ -24,12 +27,17 @@ export const withEnhancedInput = function (WrappingComponent) {
|
|
|
24
27
|
withPrefixIcon = true,
|
|
25
28
|
withSuffixIcon = true,
|
|
26
29
|
defaultValue
|
|
30
|
+
// eslint-disable-next-line unicorn/no-object-as-default-parameter
|
|
27
31
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
28
32
|
primitiveType: 'text',
|
|
29
33
|
defaultValue: void 0
|
|
30
34
|
};
|
|
31
|
-
return (
|
|
35
|
+
return (
|
|
36
|
+
/*#__PURE__*/
|
|
37
|
+
// eslint-disable-next-line react/display-name
|
|
38
|
+
forwardRef((_ref, ref) => {
|
|
32
39
|
let {
|
|
40
|
+
// EnhanceInputPrimitiveProps
|
|
33
41
|
placeholder,
|
|
34
42
|
name,
|
|
35
43
|
id = name,
|
|
@@ -86,6 +94,17 @@ export const withEnhancedInput = function (WrappingComponent) {
|
|
|
86
94
|
[styles.inputItselfSize[size].suffixed.any]: Boolean(suffixIcon || isLoading),
|
|
87
95
|
[styles.inputItselfSize[size].suffixed[primitiveType]]: Boolean(suffixIcon || isLoading)
|
|
88
96
|
});
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
Need to disable the type assertion here, as ts has no idea that P and an omitted P without its properties is just P
|
|
100
|
+
@see https://stackoverflow.com/a/53951825/2609301
|
|
101
|
+
type P = {firstName: string}
|
|
102
|
+
type A = P
|
|
103
|
+
type B = Omit<P, 'firstName'>
|
|
104
|
+
A & B != A _or_ P & Omit<P, 'firstName'> != P
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
// @ts-expect-error props not assignable to type
|
|
89
108
|
const wrappingComponent = _objectSpread({
|
|
90
109
|
validation: {
|
|
91
110
|
isTouched,
|
|
@@ -100,6 +119,8 @@ export const withEnhancedInput = function (WrappingComponent) {
|
|
|
100
119
|
}
|
|
101
120
|
return true;
|
|
102
121
|
}, onChange),
|
|
122
|
+
// Until https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within is more stable, the below
|
|
123
|
+
// will wrap now
|
|
103
124
|
onFocus: wrapEvent(() => setActive(true), onFocus),
|
|
104
125
|
onBlur: wrapEvent(() => setActive(false), onBlur),
|
|
105
126
|
onMouseEnter,
|
|
@@ -132,12 +153,12 @@ export const withEnhancedInput = function (WrappingComponent) {
|
|
|
132
153
|
pointerEvents: 'none',
|
|
133
154
|
position: 'absolute'
|
|
134
155
|
});
|
|
135
|
-
return _jsxs(Box, {
|
|
156
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
136
157
|
width: "full",
|
|
137
158
|
className: className,
|
|
138
159
|
onMouseEnter: onMouseOver,
|
|
139
160
|
onMouseLeave: onMouseOut,
|
|
140
|
-
children: [_jsx(NotchedBase, {
|
|
161
|
+
children: [/*#__PURE__*/_jsx(NotchedBase, {
|
|
141
162
|
id: id,
|
|
142
163
|
prefixed: Boolean(prefixIcon),
|
|
143
164
|
isEmpty: isEmpty,
|
|
@@ -153,26 +174,26 @@ export const withEnhancedInput = function (WrappingComponent) {
|
|
|
153
174
|
[derivedColours.colour]: !isEmpty
|
|
154
175
|
}),
|
|
155
176
|
borderColourClassName: derivedColours.borderColour,
|
|
156
|
-
children: _jsxs(Box, {
|
|
177
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
157
178
|
ref: wrapperRef,
|
|
158
179
|
className: styles.inputWrapperSize[size].root[primitiveType],
|
|
159
180
|
width: "full",
|
|
160
181
|
height: "full",
|
|
161
|
-
children: [prefixIcon ? _jsx(Icon, {
|
|
182
|
+
children: [prefixIcon ? /*#__PURE__*/_jsx(Icon, {
|
|
162
183
|
icon: prefixIcon,
|
|
163
184
|
size: iconSize,
|
|
164
185
|
className: clsx(iconStyles, styles.iconRoot, styles.prefixIcon, styles.iconSize[size], derivedColours.colour)
|
|
165
|
-
}) : null, isLoading ? _jsx(ProgressSpinner, {
|
|
186
|
+
}) : null, isLoading ? /*#__PURE__*/_jsx(ProgressSpinner, {
|
|
166
187
|
colour: "default",
|
|
167
188
|
size: size === 'large' ? size : undefined,
|
|
168
189
|
className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size])
|
|
169
|
-
}) : null, suffixIcon && !isLoading ? _jsx(Icon, {
|
|
190
|
+
}) : null, suffixIcon && !isLoading ? /*#__PURE__*/_jsx(Icon, {
|
|
170
191
|
icon: suffixIcon,
|
|
171
192
|
size: iconSize,
|
|
172
193
|
className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size], derivedColours.colour)
|
|
173
|
-
}) : null, _jsx(WrappingComponent, _objectSpread({}, wrappingComponent))]
|
|
194
|
+
}) : null, /*#__PURE__*/_jsx(WrappingComponent, _objectSpread({}, wrappingComponent))]
|
|
174
195
|
})
|
|
175
|
-
}), hintText || reserveHintSpace ? _jsx(HintText, {
|
|
196
|
+
}), hintText || reserveHintSpace ? /*#__PURE__*/_jsx(HintText, {
|
|
176
197
|
className: derivedColours.colour,
|
|
177
198
|
hintText: hintText,
|
|
178
199
|
disabled: disabled,
|
|
@@ -198,6 +219,7 @@ const derivedColourIntent = (_ref2, styles) => {
|
|
|
198
219
|
} = _ref2;
|
|
199
220
|
if (disabled) return styles.disabled;
|
|
200
221
|
if (isTouched === true) {
|
|
222
|
+
// Validation route
|
|
201
223
|
const node = stateNodeGetter(isValid ? styles.success : styles.error);
|
|
202
224
|
return node(isHovered, isActive);
|
|
203
225
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './useDeepCompareMemo';
|
|
|
4
4
|
export * from './useDocumentBodyStyles';
|
|
5
5
|
export * from './useNegativeMargin';
|
|
6
6
|
export * from './useResponsiveValue';
|
|
7
|
+
export * from './useTooltip';
|
|
7
8
|
export * from './useWindowHeightFill';
|
|
8
9
|
export * from './useWindowScrollLock';
|
|
9
10
|
export * from './useMedia';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./useDeepCompareMemo/index.js";
|
|
|
6
6
|
export * from "./useDocumentBodyStyles/index.js";
|
|
7
7
|
export * from "./useNegativeMargin/index.js";
|
|
8
8
|
export * from "./useResponsiveValue/index.js";
|
|
9
|
+
export * from "./useTooltip/index.js";
|
|
9
10
|
export * from "./useWindowHeightFill/index.js";
|
|
10
11
|
export * from "./useWindowScrollLock/index.js";
|
|
11
12
|
export * from "./useMedia/index.js";
|
|
@@ -44,10 +44,11 @@ export const useAttachedBoxes = _ref => {
|
|
|
44
44
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
45
45
|
isLastItem = index === count - 1;
|
|
46
46
|
if (isLastItem && decimals) {
|
|
47
|
+
//is last item and is not a perfect division
|
|
47
48
|
colStart = Math.round(decimals / (1 / columnCount));
|
|
48
49
|
extend = Math.round((1 - decimals) / (1 / columnCount));
|
|
49
50
|
}
|
|
50
|
-
return _jsx(Box, _objectSpread(_objectSpread({
|
|
51
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
51
52
|
backgroundColour: backgroundColour,
|
|
52
53
|
className: clsx(className, {
|
|
53
54
|
[styles.grid.topLeft]: index === 0,
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A custom hook that works like useMemo but uses deep comparison instead of reference equality.
|
|
3
|
+
* This is particularily useful for components with many props that are not individually destructured
|
|
4
|
+
*/
|
|
1
5
|
export declare function useDeepCompareMemo<T>(factory: () => T, dependencies: React.DependencyList): T;
|
|
2
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useDeepCompareMemo/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useDeepCompareMemo/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EACnC,OAAO,EAAE,MAAM,CAAC,EAChB,YAAY,EAAE,KAAK,CAAC,cAAc,GAChC,CAAC,CAeH"}
|
|
@@ -2,12 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
import { isEqual } from 'es-toolkit';
|
|
4
4
|
import { useRef } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A custom hook that works like useMemo but uses deep comparison instead of reference equality.
|
|
8
|
+
* This is particularily useful for components with many props that are not individually destructured
|
|
9
|
+
*/
|
|
5
10
|
export function useDeepCompareMemo(factory, dependencies) {
|
|
11
|
+
// Store the current value
|
|
6
12
|
const ref = useRef(factory());
|
|
13
|
+
// Store the previous dependencies
|
|
7
14
|
const prevDeps = useRef(dependencies);
|
|
15
|
+
|
|
16
|
+
// Only update if deps have changed based on deep comparison
|
|
8
17
|
if (!isEqual(prevDeps.current, dependencies)) {
|
|
9
18
|
ref.current = factory();
|
|
19
|
+
// Update the previous dependencies
|
|
10
20
|
prevDeps.current = dependencies;
|
|
11
21
|
}
|
|
22
|
+
|
|
23
|
+
// Return the memoized value
|
|
12
24
|
return ref.current;
|
|
13
25
|
}
|
|
@@ -20,6 +20,7 @@ export const useMedia = function (queries) {
|
|
|
20
20
|
const removeHandlersFn = matchers.map((matcher, idx) => {
|
|
21
21
|
const handler = e => {
|
|
22
22
|
if (!isMounted) return;
|
|
23
|
+
// eslint-disable-next-line sonarjs/no-nested-functions
|
|
23
24
|
setMatches(prevState => {
|
|
24
25
|
const newState = _toConsumableArray(prevState);
|
|
25
26
|
newState[idx] = e.matches;
|
|
@@ -5,7 +5,9 @@ import { useMedia } from "../../hooks/useMedia/useMedia.js";
|
|
|
5
5
|
import { isBrowser } from "../../utils/index.js";
|
|
6
6
|
import { getEarliestKnownToken } from "../../utils/resolveResponsiveProps.js";
|
|
7
7
|
export function useResponsiveValue(responsiveValue, serverFallbackCase) {
|
|
8
|
-
if (!isBrowser)
|
|
8
|
+
if (!isBrowser)
|
|
9
|
+
// This is ok as it will only run on server
|
|
10
|
+
return serverFallbackCase || null;
|
|
9
11
|
if (!Array.isArray(responsiveValue)) return responsiveValue;
|
|
10
12
|
const activeBP = useMedia(['mobile', 'tablet', 'desktop', 'largeDesktop']).reduce((activeBreakPoint, current, index) => {
|
|
11
13
|
if (current) activeBreakPoint = index + 1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,WAAW,GAChB,MAAM,cAAc,CAAC"}
|