@coinbase/cds-web 8.60.0 → 8.62.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/CHANGELOG.md +20 -0
- package/dts/accordion/Accordion.d.ts +1 -9
- package/dts/accordion/Accordion.d.ts.map +1 -1
- package/dts/alpha/combobox/Combobox.d.ts.map +1 -1
- package/dts/alpha/select/Select.d.ts.map +1 -1
- package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts.map +1 -1
- package/dts/banner/Banner.d.ts.map +1 -1
- package/dts/buttons/AvatarButton.d.ts.map +1 -1
- package/dts/buttons/Button.d.ts +2 -4
- package/dts/buttons/Button.d.ts.map +1 -1
- package/dts/buttons/ButtonGroup.d.ts.map +1 -1
- package/dts/buttons/IconButton.d.ts.map +1 -1
- package/dts/buttons/IconCounterButton.d.ts.map +1 -1
- package/dts/buttons/Tile.d.ts +1 -1
- package/dts/buttons/Tile.d.ts.map +1 -1
- package/dts/buttons/TileButton.d.ts.map +1 -1
- package/dts/cards/Card.d.ts +4 -0
- package/dts/cards/Card.d.ts.map +1 -1
- package/dts/cards/CardBody.d.ts +3 -0
- package/dts/cards/CardBody.d.ts.map +1 -1
- package/dts/cards/CardFooter.d.ts +4 -0
- package/dts/cards/CardFooter.d.ts.map +1 -1
- package/dts/cards/CardGroup.d.ts +12 -0
- package/dts/cards/CardGroup.d.ts.map +1 -1
- package/dts/cards/CardHeader.d.ts +4 -0
- package/dts/cards/CardHeader.d.ts.map +1 -1
- package/dts/cards/CardMedia.d.ts +4 -0
- package/dts/cards/CardMedia.d.ts.map +1 -1
- package/dts/cards/LikeButton.d.ts.map +1 -1
- package/dts/carousel/Carousel.d.ts.map +1 -1
- package/dts/cells/Cell.d.ts.map +1 -1
- package/dts/cells/CellAccessory.d.ts.map +1 -1
- package/dts/cells/ListCell.d.ts.map +1 -1
- package/dts/cells/ListCellFallback.d.ts.map +1 -1
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/ChipProps.d.ts +10 -8
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/InputChip.d.ts.map +1 -1
- package/dts/chips/MediaChip.d.ts +4 -4
- package/dts/chips/MediaChip.d.ts.map +1 -1
- package/dts/chips/TabbedChips.d.ts.map +1 -1
- package/dts/coachmark/Coachmark.d.ts.map +1 -1
- package/dts/collapsible/Collapsible.d.ts.map +1 -1
- package/dts/collapsible/useCollapsibleMotionProps.d.ts +221 -221
- package/dts/controls/Checkbox.d.ts.map +1 -1
- package/dts/controls/CheckboxCell.d.ts.map +1 -1
- package/dts/controls/Control.d.ts.map +1 -1
- package/dts/controls/ControlGroup.d.ts +13 -4
- package/dts/controls/ControlGroup.d.ts.map +1 -1
- package/dts/controls/InputStack.d.ts.map +1 -1
- package/dts/controls/Radio.d.ts.map +1 -1
- package/dts/controls/RadioCell.d.ts.map +1 -1
- package/dts/controls/SearchInput.d.ts.map +1 -1
- package/dts/controls/SelectOption.d.ts +1 -14
- package/dts/controls/SelectOption.d.ts.map +1 -1
- package/dts/controls/Switch.d.ts +2 -1
- package/dts/controls/Switch.d.ts.map +1 -1
- package/dts/controls/TextInput.d.ts.map +1 -1
- package/dts/core/componentConfig.d.ts +192 -0
- package/dts/core/componentConfig.d.ts.map +1 -0
- package/dts/dates/Calendar.d.ts.map +1 -1
- package/dts/dates/DateInput.d.ts.map +1 -1
- package/dts/dates/DatePicker.d.ts.map +1 -1
- package/dts/dots/DotCount.d.ts +1 -15
- package/dts/dots/DotCount.d.ts.map +1 -1
- package/dts/dots/DotStatusColor.d.ts +1 -10
- package/dts/dots/DotStatusColor.d.ts.map +1 -1
- package/dts/dots/DotSymbol.d.ts +1 -22
- package/dts/dots/DotSymbol.d.ts.map +1 -1
- package/dts/dropdown/Dropdown.d.ts +30 -29
- package/dts/dropdown/Dropdown.d.ts.map +1 -1
- package/dts/dropdown/DropdownProps.d.ts +53 -51
- package/dts/dropdown/DropdownProps.d.ts.map +1 -1
- package/dts/hooks/useComponentConfig.d.ts +22 -0
- package/dts/hooks/useComponentConfig.d.ts.map +1 -0
- package/dts/hooks/useIsoEffect.d.ts +2 -2
- package/dts/hooks/useIsoEffect.d.ts.map +1 -1
- package/dts/icons/Icon.d.ts.map +1 -1
- package/dts/index.d.ts +2 -0
- package/dts/index.d.ts.map +1 -1
- package/dts/layout/Divider.d.ts +1 -6
- package/dts/layout/Divider.d.ts.map +1 -1
- package/dts/layout/Fallback.d.ts.map +1 -1
- package/dts/media/Avatar.d.ts +1 -15
- package/dts/media/Avatar.d.ts.map +1 -1
- package/dts/media/RemoteImage.d.ts +1 -15
- package/dts/media/RemoteImage.d.ts.map +1 -1
- package/dts/media/RemoteImageGroup.d.ts +3 -10
- package/dts/media/RemoteImageGroup.d.ts.map +1 -1
- package/dts/motion/useMotionProps.d.ts +457 -457
- package/dts/motion/utils.d.ts +211 -211
- package/dts/navigation/NavigationBar.d.ts +1 -25
- package/dts/navigation/NavigationBar.d.ts.map +1 -1
- package/dts/navigation/NavigationTitle.d.ts +4 -3
- package/dts/navigation/NavigationTitle.d.ts.map +1 -1
- package/dts/navigation/NavigationTitleSelect.d.ts +5 -12
- package/dts/navigation/NavigationTitleSelect.d.ts.map +1 -1
- package/dts/navigation/Sidebar.d.ts.map +1 -1
- package/dts/navigation/SidebarItem.d.ts +40 -34
- package/dts/navigation/SidebarItem.d.ts.map +1 -1
- package/dts/navigation/SidebarMoreMenu.d.ts +13 -12
- package/dts/navigation/SidebarMoreMenu.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/dts/overlays/Alert.d.ts.map +1 -1
- package/dts/overlays/FocusTrap.d.ts +9 -12
- package/dts/overlays/FocusTrap.d.ts.map +1 -1
- package/dts/overlays/FullscreenAlert.d.ts +10 -7
- package/dts/overlays/FullscreenAlert.d.ts.map +1 -1
- package/dts/overlays/Toast.d.ts.map +1 -1
- package/dts/overlays/modal/FullscreenModal.d.ts +47 -45
- package/dts/overlays/modal/FullscreenModal.d.ts.map +1 -1
- package/dts/overlays/modal/FullscreenModalHeader.d.ts.map +1 -1
- package/dts/overlays/modal/FullscreenModalLayout.d.ts +2 -2
- package/dts/overlays/modal/Modal.d.ts.map +1 -1
- package/dts/overlays/modal/ModalBody.d.ts +6 -3
- package/dts/overlays/modal/ModalBody.d.ts.map +1 -1
- package/dts/overlays/modal/ModalFooter.d.ts +3 -10
- package/dts/overlays/modal/ModalFooter.d.ts.map +1 -1
- package/dts/overlays/modal/ModalHeader.d.ts +3 -12
- package/dts/overlays/modal/ModalHeader.d.ts.map +1 -1
- package/dts/overlays/modal/ModalWrapper.d.ts.map +1 -1
- package/dts/overlays/overlay/Overlay.d.ts +2 -1
- package/dts/overlays/overlay/Overlay.d.ts.map +1 -1
- package/dts/overlays/overlay/OverlayContent.d.ts +7 -5
- package/dts/overlays/overlay/OverlayContent.d.ts.map +1 -1
- package/dts/overlays/popover/PopoverProps.d.ts +46 -46
- package/dts/overlays/popover/PopoverProps.d.ts.map +1 -1
- package/dts/overlays/tooltip/Tooltip.d.ts +4 -22
- package/dts/overlays/tooltip/Tooltip.d.ts.map +1 -1
- package/dts/overlays/tooltip/TooltipContent.d.ts +7 -1
- package/dts/overlays/tooltip/TooltipContent.d.ts.map +1 -1
- package/dts/overlays/tray/Tray.d.ts.map +1 -1
- package/dts/page/PageFooter.d.ts.map +1 -1
- package/dts/page/PageHeader.d.ts.map +1 -1
- package/dts/pagination/Pagination.d.ts +3 -19
- package/dts/pagination/Pagination.d.ts.map +1 -1
- package/dts/perf/component-config/Button.component-config.perf-test.d.ts +2 -0
- package/dts/perf/component-config/Button.component-config.perf-test.d.ts.map +1 -0
- package/dts/perf/component-config/ComponentConfigProvider.perf-test.d.ts +2 -0
- package/dts/perf/component-config/ComponentConfigProvider.perf-test.d.ts.map +1 -0
- package/dts/perf/component-config/ComponentConfigStickerSheet.perf-test.d.ts +2 -0
- package/dts/perf/component-config/ComponentConfigStickerSheet.perf-test.d.ts.map +1 -0
- package/dts/section-header/SectionHeader.d.ts.map +1 -1
- package/dts/stepper/Stepper.d.ts.map +1 -1
- package/dts/system/ComponentConfigProvider.d.ts +26 -0
- package/dts/system/ComponentConfigProvider.d.ts.map +1 -0
- package/dts/system/index.d.ts +1 -0
- package/dts/system/index.d.ts.map +1 -1
- package/dts/tables/Table.d.ts +7 -5
- package/dts/tables/Table.d.ts.map +1 -1
- package/dts/tables/TableCaption.d.ts +32 -41
- package/dts/tables/TableCaption.d.ts.map +1 -1
- package/dts/tables/TableCell.d.ts +26 -48
- package/dts/tables/TableCell.d.ts.map +1 -1
- package/dts/tables/TableCellFallback.d.ts +10 -17
- package/dts/tables/TableCellFallback.d.ts.map +1 -1
- package/dts/tables/TableRow.d.ts +44 -53
- package/dts/tables/TableRow.d.ts.map +1 -1
- package/dts/tabs/SegmentedTab.d.ts +6 -3
- package/dts/tabs/SegmentedTab.d.ts.map +1 -1
- package/dts/tabs/SegmentedTabs.d.ts +9 -3
- package/dts/tabs/SegmentedTabs.d.ts.map +1 -1
- package/dts/tabs/Tabs.d.ts +16 -15
- package/dts/tabs/Tabs.d.ts.map +1 -1
- package/dts/tabs/hooks/useAnimateTabIndicator.d.ts +457 -457
- package/dts/tag/Tag.d.ts.map +1 -1
- package/dts/tour/Tour.d.ts +54 -53
- package/dts/tour/Tour.d.ts.map +1 -1
- package/dts/typography/Link.d.ts.map +1 -1
- package/dts/utils/mergeComponentProps.d.ts +34 -0
- package/dts/utils/mergeComponentProps.d.ts.map +1 -0
- package/dts/visualizations/ProgressBar.d.ts.map +1 -1
- package/dts/visualizations/ProgressBarWithFixedLabels.d.ts +5 -3
- package/dts/visualizations/ProgressBarWithFixedLabels.d.ts.map +1 -1
- package/dts/visualizations/ProgressBarWithFloatLabel.d.ts +3 -1
- package/dts/visualizations/ProgressBarWithFloatLabel.d.ts.map +1 -1
- package/dts/visualizations/ProgressCircle.d.ts.map +1 -1
- package/esm/accordion/Accordion.js +5 -3
- package/esm/alpha/combobox/Combobox.js +6 -4
- package/esm/alpha/select/Select.js +5 -3
- package/esm/alpha/select-chip/SelectChip.js +6 -4
- package/esm/alpha/tabbed-chips/TabbedChips.js +6 -4
- package/esm/banner/Banner.js +6 -4
- package/esm/buttons/AvatarButton.js +6 -4
- package/esm/buttons/Button.js +6 -4
- package/esm/buttons/ButtonGroup.js +5 -3
- package/esm/buttons/IconButton.js +6 -4
- package/esm/buttons/IconCounterButton.js +6 -4
- package/esm/buttons/Tile.js +5 -3
- package/esm/buttons/TileButton.js +6 -4
- package/esm/cards/Card.js +4 -0
- package/esm/cards/CardBody.js +3 -0
- package/esm/cards/CardFooter.js +4 -0
- package/esm/cards/CardGroup.js +14 -0
- package/esm/cards/CardHeader.js +5 -0
- package/esm/cards/CardMedia.js +5 -0
- package/esm/cards/LikeButton.js +6 -4
- package/esm/carousel/Carousel.js +8 -6
- package/esm/cells/Cell.js +8 -6
- package/esm/cells/CellAccessory.js +6 -4
- package/esm/cells/ListCell.js +6 -4
- package/esm/cells/ListCellFallback.js +6 -4
- package/esm/chips/Chip.js +6 -4
- package/esm/chips/InputChip.js +6 -4
- package/esm/chips/MediaChip.js +6 -4
- package/esm/chips/TabbedChips.js +6 -4
- package/esm/coachmark/Coachmark.js +6 -4
- package/esm/collapsible/Collapsible.js +5 -3
- package/esm/controls/Checkbox.js +6 -4
- package/esm/controls/CheckboxCell.js +6 -4
- package/esm/controls/Control.js +6 -4
- package/esm/controls/ControlGroup.js +6 -4
- package/esm/controls/InputStack.js +6 -4
- package/esm/controls/Radio.js +6 -4
- package/esm/controls/RadioCell.js +6 -4
- package/esm/controls/SearchInput.js +11 -12
- package/esm/controls/SelectOption.js +6 -4
- package/esm/controls/Switch.js +6 -4
- package/esm/controls/TextInput.js +6 -4
- package/esm/core/componentConfig.js +1 -0
- package/esm/dates/Calendar.js +6 -4
- package/esm/dates/DateInput.js +6 -4
- package/esm/dates/DatePicker.js +6 -4
- package/esm/dots/DotCount.js +6 -4
- package/esm/dots/DotStatusColor.js +6 -4
- package/esm/dots/DotSymbol.js +6 -4
- package/esm/dropdown/Dropdown.js +6 -4
- package/esm/hooks/useComponentConfig.js +27 -0
- package/esm/icons/Icon.js +6 -4
- package/esm/index.js +2 -0
- package/esm/layout/Divider.js +6 -4
- package/esm/layout/Fallback.js +6 -4
- package/esm/media/Avatar.js +8 -6
- package/esm/media/RemoteImage.js +6 -4
- package/esm/media/RemoteImageGroup.js +6 -4
- package/esm/navigation/NavigationBar.js +6 -4
- package/esm/navigation/NavigationTitle.js +6 -4
- package/esm/navigation/NavigationTitleSelect.js +6 -4
- package/esm/navigation/Sidebar.js +6 -4
- package/esm/navigation/SidebarItem.js +6 -4
- package/esm/navigation/SidebarMoreMenu.js +6 -4
- package/esm/numbers/RollingNumber/RollingNumber.js +6 -4
- package/esm/overlays/Alert.js +6 -4
- package/esm/overlays/FocusTrap.js +5 -3
- package/esm/overlays/FullscreenAlert.js +5 -3
- package/esm/overlays/Toast.js +6 -4
- package/esm/overlays/modal/FullscreenModal.js +5 -3
- package/esm/overlays/modal/FullscreenModalHeader.js +6 -4
- package/esm/overlays/modal/Modal.js +6 -4
- package/esm/overlays/modal/ModalBody.js +9 -6
- package/esm/overlays/modal/ModalFooter.js +8 -6
- package/esm/overlays/modal/ModalHeader.js +6 -4
- package/esm/overlays/modal/ModalWrapper.js +6 -4
- package/esm/overlays/overlay/Overlay.js +4 -2
- package/esm/overlays/tooltip/Tooltip.js +9 -7
- package/esm/overlays/tooltip/TooltipContent.js +16 -9
- package/esm/overlays/tray/Tray.js +5 -3
- package/esm/page/PageFooter.js +6 -4
- package/esm/page/PageHeader.js +6 -4
- package/esm/pagination/Pagination.js +6 -4
- package/esm/perf/component-config/Button.component-config.perf-test.js +43 -0
- package/esm/perf/component-config/ComponentConfigProvider.perf-test.js +134 -0
- package/esm/perf/component-config/ComponentConfigStickerSheet.perf-test.js +332 -0
- package/esm/perf/component-config/README.md +8 -0
- package/esm/section-header/SectionHeader.js +6 -4
- package/esm/stepper/Stepper.js +12 -10
- package/esm/system/ComponentConfigProvider.js +41 -0
- package/esm/system/index.js +1 -0
- package/esm/tables/Table.js +6 -4
- package/esm/tables/TableCaption.js +6 -4
- package/esm/tables/TableCell.js +9 -7
- package/esm/tables/TableCellFallback.js +6 -4
- package/esm/tables/TableRow.js +6 -4
- package/esm/tabs/SegmentedTab.js +6 -4
- package/esm/tabs/SegmentedTabs.js +6 -4
- package/esm/tabs/Tabs.js +12 -10
- package/esm/tag/Tag.js +6 -4
- package/esm/tour/Tour.js +5 -3
- package/esm/typography/Link.js +6 -4
- package/esm/utils/mergeComponentProps.js +39 -0
- package/esm/visualizations/ProgressBar.js +5 -3
- package/esm/visualizations/ProgressBarWithFixedLabels.js +5 -3
- package/esm/visualizations/ProgressBarWithFloatLabel.js +5 -3
- package/esm/visualizations/ProgressCircle.js +7 -5
- package/package.json +4 -3
- package/esm/controls/SearchInput.css +0 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { cloneElement, useCallback, useMemo, useRef } from 'react';
|
|
1
|
+
import React, { cloneElement, memo, useCallback, useMemo, useRef } from 'react';
|
|
2
|
+
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
2
3
|
import { Popover } from '../popover/Popover';
|
|
3
4
|
import { TooltipContent } from './TooltipContent';
|
|
4
5
|
import { useTooltipState } from './useTooltipState';
|
|
@@ -7,8 +8,9 @@ const preventMouseDown = event => {
|
|
|
7
8
|
event.preventDefault();
|
|
8
9
|
event.stopPropagation();
|
|
9
10
|
};
|
|
10
|
-
export const Tooltip =
|
|
11
|
-
|
|
11
|
+
export const Tooltip = /*#__PURE__*/memo(_props => {
|
|
12
|
+
const mergedProps = useComponentConfig('Tooltip', _props);
|
|
13
|
+
const {
|
|
12
14
|
children,
|
|
13
15
|
content,
|
|
14
16
|
elevation,
|
|
@@ -29,7 +31,7 @@ export const Tooltip = _ref => {
|
|
|
29
31
|
autoFocusDelay = 20,
|
|
30
32
|
openDelay,
|
|
31
33
|
closeDelay
|
|
32
|
-
} =
|
|
34
|
+
} = mergedProps;
|
|
33
35
|
const {
|
|
34
36
|
isOpen,
|
|
35
37
|
handleOnMouseEnter,
|
|
@@ -39,10 +41,10 @@ export const Tooltip = _ref => {
|
|
|
39
41
|
tooltipId
|
|
40
42
|
} = useTooltipState(tooltipIdDefault, openDelay, closeDelay);
|
|
41
43
|
const tooltipContentRef = useRef(null);
|
|
42
|
-
const handleMouseEnter = useCallback(
|
|
44
|
+
const handleMouseEnter = useCallback(_ref => {
|
|
43
45
|
let {
|
|
44
46
|
target
|
|
45
|
-
} =
|
|
47
|
+
} = _ref;
|
|
46
48
|
const node = tooltipContentRef.current;
|
|
47
49
|
|
|
48
50
|
// to prevent flicker, don't open tooltip if enter event originates from tooltip content
|
|
@@ -98,4 +100,4 @@ export const Tooltip = _ref => {
|
|
|
98
100
|
visible: isVisible,
|
|
99
101
|
children: clonedChild
|
|
100
102
|
});
|
|
101
|
-
};
|
|
103
|
+
});
|
|
@@ -8,21 +8,28 @@ import { animateInOpacityConfig, animateOutOpacityConfig, getTranslateConfigByPl
|
|
|
8
8
|
import { tooltipMaxWidth, tooltipPaddingX, tooltipPaddingY } from '@coinbase/cds-common/tokens/tooltip';
|
|
9
9
|
import { zIndex as zIndexTokens } from '@coinbase/cds-common/tokens/zIndex';
|
|
10
10
|
import { m as motion } from 'framer-motion';
|
|
11
|
+
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
11
12
|
import { Box } from '../../layout/Box';
|
|
12
13
|
import { useMotionProps } from '../../motion/useMotionProps';
|
|
13
14
|
import { Text } from '../../typography/Text';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const textCss = "textCss-t15dzixe";
|
|
16
|
-
export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((
|
|
17
|
-
|
|
17
|
+
export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
18
|
+
const mergedProps = useComponentConfig('TooltipContent', _props);
|
|
19
|
+
const {
|
|
18
20
|
content,
|
|
19
21
|
elevation,
|
|
20
22
|
gap,
|
|
21
23
|
testID,
|
|
22
24
|
zIndex,
|
|
23
25
|
tooltipId,
|
|
24
|
-
placement = 'top'
|
|
25
|
-
|
|
26
|
+
placement = 'top',
|
|
27
|
+
background = 'bg',
|
|
28
|
+
borderRadius = 200,
|
|
29
|
+
maxWidth = tooltipMaxWidth,
|
|
30
|
+
paddingX = tooltipPaddingX,
|
|
31
|
+
paddingY = tooltipPaddingY
|
|
32
|
+
} = mergedProps;
|
|
26
33
|
const outerStyle = useMemo(() => ({
|
|
27
34
|
padding: "var(--space-".concat(gap, ")"),
|
|
28
35
|
zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : zIndexTokens.tooltip
|
|
@@ -42,14 +49,14 @@ export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, r
|
|
|
42
49
|
"data-testid": "".concat(testID, "-motion"),
|
|
43
50
|
children: /*#__PURE__*/_jsx(Box, {
|
|
44
51
|
ref: ref,
|
|
45
|
-
background:
|
|
46
|
-
borderRadius:
|
|
52
|
+
background: background,
|
|
53
|
+
borderRadius: borderRadius,
|
|
47
54
|
"data-testid": testID,
|
|
48
55
|
elevation: elevation,
|
|
49
56
|
id: tooltipId,
|
|
50
|
-
maxWidth:
|
|
51
|
-
paddingX:
|
|
52
|
-
paddingY:
|
|
57
|
+
maxWidth: maxWidth,
|
|
58
|
+
paddingX: paddingX,
|
|
59
|
+
paddingY: paddingY,
|
|
53
60
|
role: "tooltip",
|
|
54
61
|
children: typeof content === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
55
62
|
className: textCss,
|
|
@@ -9,6 +9,7 @@ import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayCont
|
|
|
9
9
|
import { domMax, LazyMotion, m as motion, MotionConfig, useAnimate, useDragControls } from 'framer-motion';
|
|
10
10
|
import { IconButton } from '../../buttons';
|
|
11
11
|
import { cx } from '../../cx';
|
|
12
|
+
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
12
13
|
import { useDimensions } from '../../hooks/useDimensions';
|
|
13
14
|
import { useScrollBlocker } from '../../hooks/useScrollBlocker';
|
|
14
15
|
import { useTheme } from '../../hooks/useTheme';
|
|
@@ -90,8 +91,9 @@ const animationConfig = {
|
|
|
90
91
|
const overlayContentContextValue = {
|
|
91
92
|
isDrawer: true
|
|
92
93
|
};
|
|
93
|
-
export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(
|
|
94
|
-
|
|
94
|
+
export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_props, ref) {
|
|
95
|
+
const mergedProps = useComponentConfig('Tray', _props);
|
|
96
|
+
const {
|
|
95
97
|
children,
|
|
96
98
|
header,
|
|
97
99
|
footer,
|
|
@@ -119,7 +121,7 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
119
121
|
pin = 'bottom',
|
|
120
122
|
showHandleBar,
|
|
121
123
|
hideCloseButton
|
|
122
|
-
} =
|
|
124
|
+
} = mergedProps;
|
|
123
125
|
const theme = useTheme();
|
|
124
126
|
const [isOpen, setIsOpen] = useState(true);
|
|
125
127
|
const [hasScrolledDown, setHasScrolledDown] = useState(false);
|
package/esm/page/PageFooter.js
CHANGED
|
@@ -8,6 +8,7 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
8
8
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
9
9
|
import React, { forwardRef, memo } from 'react';
|
|
10
10
|
import { pageFooterHeight } from '@coinbase/cds-common/tokens/page';
|
|
11
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
11
12
|
import { Box } from '../layout/Box';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
export const pageFooterPaddingX = {
|
|
@@ -20,16 +21,17 @@ export const pageFooterJustifyContent = {
|
|
|
20
21
|
tablet: 'flex-end',
|
|
21
22
|
desktop: 'flex-end'
|
|
22
23
|
};
|
|
23
|
-
export const PageFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
|
|
24
|
-
|
|
24
|
+
export const PageFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
25
|
+
const mergedProps = useComponentConfig('PageFooter', _props);
|
|
26
|
+
const {
|
|
25
27
|
action,
|
|
26
28
|
height = pageFooterHeight,
|
|
27
29
|
justifyContent = pageFooterJustifyContent,
|
|
28
30
|
paddingX = pageFooterPaddingX,
|
|
29
31
|
paddingY = 1.5,
|
|
30
32
|
role = 'contentinfo'
|
|
31
|
-
} =
|
|
32
|
-
props = _objectWithoutProperties(
|
|
33
|
+
} = mergedProps,
|
|
34
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
33
35
|
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
34
36
|
ref: ref,
|
|
35
37
|
height: height,
|
package/esm/page/PageHeader.js
CHANGED
|
@@ -9,6 +9,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
9
9
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
10
10
|
import { pageHeaderHeight } from '@coinbase/cds-common/tokens/page';
|
|
11
11
|
import { cx } from '../cx';
|
|
12
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
12
13
|
import { Box } from '../layout/Box';
|
|
13
14
|
import { Grid } from '../layout/Grid';
|
|
14
15
|
import { media } from '../styles/media';
|
|
@@ -26,8 +27,9 @@ export const pageHeaderEndPaddingX = {
|
|
|
26
27
|
tablet: 4,
|
|
27
28
|
desktop: 4
|
|
28
29
|
};
|
|
29
|
-
export const PageHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
|
|
30
|
-
|
|
30
|
+
export const PageHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
31
|
+
const mergedProps = useComponentConfig('PageHeader', _props);
|
|
32
|
+
const {
|
|
31
33
|
start,
|
|
32
34
|
end,
|
|
33
35
|
title,
|
|
@@ -38,8 +40,8 @@ export const PageHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Pag
|
|
|
38
40
|
style,
|
|
39
41
|
classNames,
|
|
40
42
|
className
|
|
41
|
-
} =
|
|
42
|
-
props = _objectWithoutProperties(
|
|
43
|
+
} = mergedProps,
|
|
44
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
43
45
|
const titleResponsivePaddingLeft = useMemo(() => ({
|
|
44
46
|
phone: start && !end ? 0 : 3,
|
|
45
47
|
tablet: start ? 0 : 4,
|
|
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
7
7
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
9
9
|
import React, { useCallback, useRef } from 'react';
|
|
10
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
10
11
|
import { HStack } from '../layout/HStack';
|
|
11
12
|
import { DefaultPaginationEllipsis } from './DefaultPaginationEllipsis';
|
|
12
13
|
import { DefaultPaginationNavigationButton } from './DefaultPaginationNavigationButton';
|
|
@@ -14,9 +15,10 @@ import { DefaultPaginationNavigationTextButton } from './DefaultPaginationNaviga
|
|
|
14
15
|
import { DefaultPaginationPageButton } from './DefaultPaginationPageButton';
|
|
15
16
|
import { usePagination } from './usePagination';
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
export const Pagination =
|
|
18
|
+
export const Pagination = _props => {
|
|
18
19
|
var _accessibilityLabels$, _accessibilityLabels$2, _accessibilityLabels$3, _accessibilityLabels$4, _accessibilityLabels$5, _accessibilityLabels$6;
|
|
19
|
-
|
|
20
|
+
const mergedProps = useComponentConfig('Pagination', _props);
|
|
21
|
+
const {
|
|
20
22
|
totalPages,
|
|
21
23
|
activePage,
|
|
22
24
|
onChange,
|
|
@@ -33,8 +35,8 @@ export const Pagination = _ref => {
|
|
|
33
35
|
PaginationEllipsisComponent = DefaultPaginationEllipsis,
|
|
34
36
|
firstPageButtonLabel = 'First',
|
|
35
37
|
lastPageButtonLabel = 'Last'
|
|
36
|
-
} =
|
|
37
|
-
props = _objectWithoutProperties(
|
|
38
|
+
} = mergedProps,
|
|
39
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
38
40
|
const {
|
|
39
41
|
items,
|
|
40
42
|
updateActivePage,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { measurePerformance } from 'reassure';
|
|
3
|
+
import { Button } from '../../buttons/Button';
|
|
4
|
+
import { ComponentConfigProvider } from '../../system/ComponentConfigProvider';
|
|
5
|
+
import { DefaultThemeProvider } from '../../utils/test';
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
+
const buttonCount = 1000;
|
|
8
|
+
const ButtonList = () => {
|
|
9
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
10
|
+
children: Array.from({
|
|
11
|
+
length: buttonCount
|
|
12
|
+
}, (_, index) => /*#__PURE__*/_jsx(Button, {
|
|
13
|
+
children: "Child"
|
|
14
|
+
}, index))
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const Wrapper = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_jsx(DefaultThemeProvider, {
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
describe('Button component-config performance (web)', () => {
|
|
26
|
+
it('no provider', async () => {
|
|
27
|
+
await measurePerformance(/*#__PURE__*/_jsx(Wrapper, {
|
|
28
|
+
children: /*#__PURE__*/_jsx(ButtonList, {})
|
|
29
|
+
}));
|
|
30
|
+
});
|
|
31
|
+
it('provider customization', async () => {
|
|
32
|
+
await measurePerformance(/*#__PURE__*/_jsx(Wrapper, {
|
|
33
|
+
children: /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
34
|
+
value: {
|
|
35
|
+
Button: {
|
|
36
|
+
compact: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
children: /*#__PURE__*/_jsx(ButtonList, {})
|
|
40
|
+
})
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fireEvent, screen } from '@testing-library/react';
|
|
3
|
+
import { measurePerformance } from 'reassure';
|
|
4
|
+
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
5
|
+
import { ComponentConfigProvider } from '../../system/ComponentConfigProvider';
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const consumerCount = 1000;
|
|
8
|
+
const updateIterations = 50;
|
|
9
|
+
const stableButtonConfig = () => ({
|
|
10
|
+
compact: true
|
|
11
|
+
});
|
|
12
|
+
const stableAvatarConfig = () => ({});
|
|
13
|
+
const ButtonConfigConsumer = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
index
|
|
16
|
+
} = _ref;
|
|
17
|
+
const mergedProps = useComponentConfig('Button', {
|
|
18
|
+
compact: false,
|
|
19
|
+
variant: 'primary'
|
|
20
|
+
});
|
|
21
|
+
return /*#__PURE__*/_jsx("div", {
|
|
22
|
+
"data-compact": String(mergedProps.compact),
|
|
23
|
+
"data-index": index
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const ButtonConfigConsumerList = _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
count
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
31
|
+
children: Array.from({
|
|
32
|
+
length: count
|
|
33
|
+
}, (_, index) => /*#__PURE__*/_jsx(ButtonConfigConsumer, {
|
|
34
|
+
index: index
|
|
35
|
+
}, index))
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const UnrelatedKeyUpdateHarness = _ref3 => {
|
|
39
|
+
let {
|
|
40
|
+
count
|
|
41
|
+
} = _ref3;
|
|
42
|
+
const [unrelatedUpdates, setUnrelatedUpdates] = React.useState(0);
|
|
43
|
+
const value = React.useMemo(() => ({
|
|
44
|
+
Avatar: () => unrelatedUpdates % 2 === 0 ? {} : {},
|
|
45
|
+
Button: stableButtonConfig
|
|
46
|
+
}), [unrelatedUpdates]);
|
|
47
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
49
|
+
"data-testid": "update-unrelated-key",
|
|
50
|
+
onClick: () => setUnrelatedUpdates(v => v + 1),
|
|
51
|
+
children: "Update unrelated key"
|
|
52
|
+
}), /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
53
|
+
value: value,
|
|
54
|
+
children: /*#__PURE__*/_jsx(ButtonConfigConsumerList, {
|
|
55
|
+
count: count
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const TargetKeyUpdateHarness = _ref4 => {
|
|
61
|
+
let {
|
|
62
|
+
count
|
|
63
|
+
} = _ref4;
|
|
64
|
+
const [targetUpdates, setTargetUpdates] = React.useState(0);
|
|
65
|
+
const value = React.useMemo(() => ({
|
|
66
|
+
Avatar: stableAvatarConfig,
|
|
67
|
+
Button: () => ({
|
|
68
|
+
compact: targetUpdates % 2 === 0
|
|
69
|
+
})
|
|
70
|
+
}), [targetUpdates]);
|
|
71
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
72
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
73
|
+
"data-testid": "update-target-key",
|
|
74
|
+
onClick: () => setTargetUpdates(v => v + 1),
|
|
75
|
+
children: "Update target key"
|
|
76
|
+
}), /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
77
|
+
value: value,
|
|
78
|
+
children: /*#__PURE__*/_jsx(ButtonConfigConsumerList, {
|
|
79
|
+
count: count
|
|
80
|
+
})
|
|
81
|
+
})]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
describe('ComponentConfigProvider performance tests', () => {
|
|
85
|
+
it('Scenario A: renders 1000 consumers under one provider', async () => {
|
|
86
|
+
await measurePerformance(/*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
87
|
+
value: {
|
|
88
|
+
Button: stableButtonConfig
|
|
89
|
+
},
|
|
90
|
+
children: /*#__PURE__*/_jsx(ButtonConfigConsumerList, {
|
|
91
|
+
count: consumerCount
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
it('Scenario B: updates unrelated component key 50 times', async () => {
|
|
96
|
+
const scenario = async () => {
|
|
97
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
98
|
+
fireEvent.click(screen.getByTestId('update-unrelated-key'));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
await measurePerformance(/*#__PURE__*/_jsx(UnrelatedKeyUpdateHarness, {
|
|
102
|
+
count: consumerCount
|
|
103
|
+
}), {
|
|
104
|
+
scenario
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
it('Scenario C: updates target component key 50 times', async () => {
|
|
108
|
+
const scenario = async () => {
|
|
109
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
110
|
+
fireEvent.click(screen.getByTestId('update-target-key'));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
await measurePerformance(/*#__PURE__*/_jsx(TargetKeyUpdateHarness, {
|
|
114
|
+
count: consumerCount
|
|
115
|
+
}), {
|
|
116
|
+
scenario
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
it('Scenario D (baseline): no provider with 1000 consumers', async () => {
|
|
120
|
+
await measurePerformance(/*#__PURE__*/_jsx(ButtonConfigConsumerList, {
|
|
121
|
+
count: consumerCount
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
124
|
+
it('Scenario D (provider): provider enabled with 1000 consumers', async () => {
|
|
125
|
+
await measurePerformance(/*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
126
|
+
value: {
|
|
127
|
+
Button: stableButtonConfig
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/_jsx(ButtonConfigConsumerList, {
|
|
130
|
+
count: consumerCount
|
|
131
|
+
})
|
|
132
|
+
}));
|
|
133
|
+
});
|
|
134
|
+
});
|