@coinbase/cds-web 8.61.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 +6 -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/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/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 +6 -4
- 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
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { fireEvent, screen } from '@testing-library/react';
|
|
8
|
+
import { measurePerformance } from 'reassure';
|
|
9
|
+
import { Button } from '../../buttons/Button';
|
|
10
|
+
import { IconButton } from '../../buttons/IconButton';
|
|
11
|
+
import { ListCell } from '../../cells/ListCell';
|
|
12
|
+
import { Chip } from '../../chips/Chip';
|
|
13
|
+
import { SearchInput } from '../../controls/SearchInput';
|
|
14
|
+
import { TextInput } from '../../controls/TextInput';
|
|
15
|
+
import { DotCount } from '../../dots/DotCount';
|
|
16
|
+
import { Icon } from '../../icons/Icon';
|
|
17
|
+
import { HStack } from '../../layout/HStack';
|
|
18
|
+
import { VStack } from '../../layout/VStack';
|
|
19
|
+
import { Avatar } from '../../media/Avatar';
|
|
20
|
+
import { ComponentConfigProvider } from '../../system/ComponentConfigProvider';
|
|
21
|
+
import { ThemeProvider } from '../../system/ThemeProvider';
|
|
22
|
+
import { Tag } from '../../tag/Tag';
|
|
23
|
+
import { defaultTheme } from '../../themes/defaultTheme';
|
|
24
|
+
import { Text } from '../../typography/Text';
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
const updateIterations = 50;
|
|
27
|
+
const customPerfTheme = _objectSpread(_objectSpread({}, defaultTheme), {}, {
|
|
28
|
+
id: 'component-config-perf-baseline-theme',
|
|
29
|
+
lightColor: _objectSpread(_objectSpread({}, defaultTheme.lightColor), {}, {
|
|
30
|
+
bgAlternate: defaultTheme.lightColor.bgSecondary
|
|
31
|
+
}),
|
|
32
|
+
darkColor: _objectSpread(_objectSpread({}, defaultTheme.darkColor), {}, {
|
|
33
|
+
bgAlternate: defaultTheme.darkColor.bgSecondary
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
const customComponentConfig = {
|
|
37
|
+
Button: props => ({
|
|
38
|
+
borderRadius: 200,
|
|
39
|
+
height: props.compact ? 24 : 32,
|
|
40
|
+
font: props.compact ? 'label1' : 'headline'
|
|
41
|
+
}),
|
|
42
|
+
IconButton: props => ({
|
|
43
|
+
borderRadius: 200,
|
|
44
|
+
height: props.compact ? 24 : 32,
|
|
45
|
+
width: props.compact ? 24 : 32
|
|
46
|
+
}),
|
|
47
|
+
TextInput: props => ({
|
|
48
|
+
bordered: false,
|
|
49
|
+
inputBackground: 'bgAlternate',
|
|
50
|
+
font: props.compact ? 'label2' : 'body',
|
|
51
|
+
variant: 'foregroundMuted',
|
|
52
|
+
focusedBorderWidth: 100
|
|
53
|
+
}),
|
|
54
|
+
SearchInput: props => ({
|
|
55
|
+
borderRadius: 200,
|
|
56
|
+
height: props.compact ? 24 : 32
|
|
57
|
+
}),
|
|
58
|
+
Chip: {
|
|
59
|
+
borderRadius: 200
|
|
60
|
+
},
|
|
61
|
+
ListCell: props => {
|
|
62
|
+
var _props$spacingVariant;
|
|
63
|
+
const spacingVariant = (_props$spacingVariant = props.spacingVariant) !== null && _props$spacingVariant !== void 0 ? _props$spacingVariant : props.compact ? 'compact' : 'normal';
|
|
64
|
+
return spacingVariant === 'normal' ? {
|
|
65
|
+
minHeight: '36px'
|
|
66
|
+
} : {};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const ComplexStickerSheetLike = _ref => {
|
|
70
|
+
let {
|
|
71
|
+
tick = 0
|
|
72
|
+
} = _ref;
|
|
73
|
+
return /*#__PURE__*/_jsx(VStack, {
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
background: "bgAlternate",
|
|
76
|
+
gap: 2,
|
|
77
|
+
padding: 2,
|
|
78
|
+
children: /*#__PURE__*/_jsxs(HStack, {
|
|
79
|
+
gap: 2,
|
|
80
|
+
children: [/*#__PURE__*/_jsxs(VStack, {
|
|
81
|
+
gap: 2,
|
|
82
|
+
width: 420,
|
|
83
|
+
children: [/*#__PURE__*/_jsx(HStack, {
|
|
84
|
+
gap: 1,
|
|
85
|
+
children: Array.from({
|
|
86
|
+
length: 12
|
|
87
|
+
}, (_, i) => /*#__PURE__*/_jsx(Button, {
|
|
88
|
+
variant: "primary",
|
|
89
|
+
children: "Primary"
|
|
90
|
+
}, "primary-".concat(i)))
|
|
91
|
+
}), /*#__PURE__*/_jsx(HStack, {
|
|
92
|
+
gap: 1,
|
|
93
|
+
children: Array.from({
|
|
94
|
+
length: 12
|
|
95
|
+
}, (_, i) => /*#__PURE__*/_jsx(Button, {
|
|
96
|
+
compact: true,
|
|
97
|
+
variant: "secondary",
|
|
98
|
+
children: "Secondary"
|
|
99
|
+
}, "secondary-".concat(i)))
|
|
100
|
+
}), /*#__PURE__*/_jsx(VStack, {
|
|
101
|
+
gap: 1,
|
|
102
|
+
children: Array.from({
|
|
103
|
+
length: 8
|
|
104
|
+
}, (_, i) => /*#__PURE__*/_jsx(TextInput, {
|
|
105
|
+
label: "Label ".concat(i),
|
|
106
|
+
placeholder: "Input value"
|
|
107
|
+
}, "input-".concat(i)))
|
|
108
|
+
}), /*#__PURE__*/_jsx(VStack, {
|
|
109
|
+
gap: 1,
|
|
110
|
+
children: Array.from({
|
|
111
|
+
length: 8
|
|
112
|
+
}, (_, i) => /*#__PURE__*/_jsx(SearchInput, {
|
|
113
|
+
label: "Search ".concat(i),
|
|
114
|
+
onChangeText: () => {},
|
|
115
|
+
placeholder: "Search value"
|
|
116
|
+
}, "search-".concat(i)))
|
|
117
|
+
}), /*#__PURE__*/_jsx(VStack, {
|
|
118
|
+
gap: 1,
|
|
119
|
+
children: Array.from({
|
|
120
|
+
length: 8
|
|
121
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
122
|
+
accessibilityLabel: "List row ".concat(i),
|
|
123
|
+
description: "$100",
|
|
124
|
+
media: /*#__PURE__*/_jsx(Avatar, {
|
|
125
|
+
name: "A",
|
|
126
|
+
size: "m"
|
|
127
|
+
}),
|
|
128
|
+
onClick: () => {},
|
|
129
|
+
subtitle: "Subtitle",
|
|
130
|
+
title: "Row ".concat(i)
|
|
131
|
+
}, "cell-".concat(i)))
|
|
132
|
+
})]
|
|
133
|
+
}), /*#__PURE__*/_jsxs(VStack, {
|
|
134
|
+
gap: 2,
|
|
135
|
+
width: 600,
|
|
136
|
+
children: [/*#__PURE__*/_jsx(HStack, {
|
|
137
|
+
gap: 1,
|
|
138
|
+
children: Array.from({
|
|
139
|
+
length: 16
|
|
140
|
+
}, (_, i) => /*#__PURE__*/_jsx(IconButton, {
|
|
141
|
+
accessibilityLabel: "Icon button ".concat(i),
|
|
142
|
+
name: "add",
|
|
143
|
+
variant: "tertiary"
|
|
144
|
+
}, "icon-".concat(i)))
|
|
145
|
+
}), /*#__PURE__*/_jsx(HStack, {
|
|
146
|
+
flexWrap: "wrap",
|
|
147
|
+
gap: 1,
|
|
148
|
+
children: Array.from({
|
|
149
|
+
length: 24
|
|
150
|
+
}, (_, i) => /*#__PURE__*/_jsxs(Chip, {
|
|
151
|
+
accessibilityLabel: "Chip ".concat(i),
|
|
152
|
+
onClick: () => {},
|
|
153
|
+
children: ["Chip ", i]
|
|
154
|
+
}, "chip-".concat(i)))
|
|
155
|
+
}), /*#__PURE__*/_jsx(HStack, {
|
|
156
|
+
gap: 1,
|
|
157
|
+
children: Array.from({
|
|
158
|
+
length: 20
|
|
159
|
+
}, (_, i) => /*#__PURE__*/_jsxs(Tag, {
|
|
160
|
+
intent: i % 2 === 0 ? 'informational' : 'promotional',
|
|
161
|
+
children: ["Tag ", i]
|
|
162
|
+
}, "tag-".concat(i)))
|
|
163
|
+
}), /*#__PURE__*/_jsx(HStack, {
|
|
164
|
+
gap: 1,
|
|
165
|
+
children: Array.from({
|
|
166
|
+
length: 10
|
|
167
|
+
}, (_, i) => /*#__PURE__*/_jsx(DotCount, {
|
|
168
|
+
count: i + 1,
|
|
169
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
170
|
+
name: "bell",
|
|
171
|
+
size: "l"
|
|
172
|
+
})
|
|
173
|
+
}, "dot-".concat(i)))
|
|
174
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
175
|
+
font: "title3",
|
|
176
|
+
children: "Complex story-like surface"
|
|
177
|
+
})]
|
|
178
|
+
})]
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
const BaselineHarness = () => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
183
|
+
activeColorScheme: "light",
|
|
184
|
+
theme: defaultTheme,
|
|
185
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {})
|
|
186
|
+
});
|
|
187
|
+
const CustomThemeNoProviderHarness = () => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
188
|
+
activeColorScheme: "dark",
|
|
189
|
+
theme: customPerfTheme,
|
|
190
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {})
|
|
191
|
+
});
|
|
192
|
+
const CustomThemeNoProviderStateUpdateHarness = () => {
|
|
193
|
+
const [tick, setTick] = React.useState(0);
|
|
194
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
195
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
196
|
+
"data-testid": "update-page-state-no-provider",
|
|
197
|
+
onClick: () => setTick(v => v + 1),
|
|
198
|
+
children: "Update page state"
|
|
199
|
+
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
200
|
+
activeColorScheme: "dark",
|
|
201
|
+
theme: customPerfTheme,
|
|
202
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {
|
|
203
|
+
tick: tick
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
const CustomHarness = () => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
209
|
+
activeColorScheme: "dark",
|
|
210
|
+
theme: defaultTheme,
|
|
211
|
+
children: /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
212
|
+
value: customComponentConfig,
|
|
213
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {})
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
const UnrelatedConfigUpdateHarness = () => {
|
|
217
|
+
const [tick, setTick] = React.useState(0);
|
|
218
|
+
const value = React.useMemo(() => _objectSpread(_objectSpread({}, customComponentConfig), {}, {
|
|
219
|
+
// Toggling a key that is not rendered by StickerSheet isolates cross-key churn.
|
|
220
|
+
Tour: tick % 2 === 0 ? {} : {}
|
|
221
|
+
}), [tick]);
|
|
222
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
223
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
224
|
+
"data-testid": "update-unrelated-config",
|
|
225
|
+
onClick: () => setTick(v => v + 1),
|
|
226
|
+
children: "Update unrelated config"
|
|
227
|
+
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
228
|
+
activeColorScheme: "dark",
|
|
229
|
+
theme: defaultTheme,
|
|
230
|
+
children: /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
231
|
+
value: value,
|
|
232
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {})
|
|
233
|
+
})
|
|
234
|
+
})]
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
const TargetedConfigUpdateHarness = () => {
|
|
238
|
+
const [tick, setTick] = React.useState(0);
|
|
239
|
+
const value = React.useMemo(() => _objectSpread(_objectSpread({}, customComponentConfig), {}, {
|
|
240
|
+
// Intentionally churn a hot key used broadly in StickerSheet.
|
|
241
|
+
Button: props => ({
|
|
242
|
+
borderRadius: tick % 2 === 0 ? 200 : 300,
|
|
243
|
+
height: props.compact ? 24 : 32,
|
|
244
|
+
font: props.compact ? 'label1' : 'headline'
|
|
245
|
+
})
|
|
246
|
+
}), [tick]);
|
|
247
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
248
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
249
|
+
"data-testid": "update-targeted-config",
|
|
250
|
+
onClick: () => setTick(v => v + 1),
|
|
251
|
+
children: "Update targeted config"
|
|
252
|
+
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
253
|
+
activeColorScheme: "dark",
|
|
254
|
+
theme: defaultTheme,
|
|
255
|
+
children: /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
256
|
+
value: value,
|
|
257
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {})
|
|
258
|
+
})
|
|
259
|
+
})]
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
const RandomStateUpdateHarness = () => {
|
|
263
|
+
const [tick, setTick] = React.useState(0);
|
|
264
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
265
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
266
|
+
"data-testid": "update-random-state",
|
|
267
|
+
onClick: () => setTick(v => v + 1),
|
|
268
|
+
children: "Update random state"
|
|
269
|
+
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
270
|
+
activeColorScheme: "dark",
|
|
271
|
+
theme: defaultTheme,
|
|
272
|
+
children: /*#__PURE__*/_jsx(ComponentConfigProvider, {
|
|
273
|
+
value: customComponentConfig,
|
|
274
|
+
children: /*#__PURE__*/_jsx(ComplexStickerSheetLike, {
|
|
275
|
+
tick: tick
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
})]
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
describe('ComponentConfig StickerSheet performance tests', () => {
|
|
282
|
+
jest.setTimeout(60000);
|
|
283
|
+
it('renders StickerSheet baseline (no provider)', async () => {
|
|
284
|
+
await measurePerformance(/*#__PURE__*/_jsx(BaselineHarness, {}));
|
|
285
|
+
});
|
|
286
|
+
it('renders StickerSheet custom story (theme + component config)', async () => {
|
|
287
|
+
await measurePerformance(/*#__PURE__*/_jsx(CustomHarness, {}));
|
|
288
|
+
});
|
|
289
|
+
it('renders custom theme with no provider', async () => {
|
|
290
|
+
await measurePerformance(/*#__PURE__*/_jsx(CustomThemeNoProviderHarness, {}));
|
|
291
|
+
});
|
|
292
|
+
it('updates page state 50 times with custom theme and no provider', async () => {
|
|
293
|
+
const scenario = async () => {
|
|
294
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
295
|
+
fireEvent.click(screen.getByTestId('update-page-state-no-provider'));
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
await measurePerformance(/*#__PURE__*/_jsx(CustomThemeNoProviderStateUpdateHarness, {}), {
|
|
299
|
+
scenario
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
it('updates unrelated config key 50 times', async () => {
|
|
303
|
+
const scenario = async () => {
|
|
304
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
305
|
+
fireEvent.click(screen.getByTestId('update-unrelated-config'));
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
await measurePerformance(/*#__PURE__*/_jsx(UnrelatedConfigUpdateHarness, {}), {
|
|
309
|
+
scenario
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
it('updates targeted config key 50 times', async () => {
|
|
313
|
+
const scenario = async () => {
|
|
314
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
315
|
+
fireEvent.click(screen.getByTestId('update-targeted-config'));
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
await measurePerformance(/*#__PURE__*/_jsx(TargetedConfigUpdateHarness, {}), {
|
|
319
|
+
scenario
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
it('updates random local state 50 times (provider enabled)', async () => {
|
|
323
|
+
const scenario = async () => {
|
|
324
|
+
for (let i = 0; i < updateIterations; i += 1) {
|
|
325
|
+
fireEvent.click(screen.getByTestId('update-random-state'));
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
await measurePerformance(/*#__PURE__*/_jsx(RandomStateUpdateHarness, {}), {
|
|
329
|
+
scenario
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
});
|
|
@@ -7,13 +7,15 @@ 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, { forwardRef, memo } from 'react';
|
|
10
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
10
11
|
import { Icon } from '../icons';
|
|
11
12
|
import { HStack } from '../layout/HStack';
|
|
12
13
|
import { VStack } from '../layout/VStack';
|
|
13
14
|
import { Text } from '../typography/Text';
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
export const SectionHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function SectionHeader(
|
|
16
|
-
|
|
16
|
+
export const SectionHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function SectionHeader(_props, ref) {
|
|
17
|
+
const mergedProps = useComponentConfig('SectionHeader', _props);
|
|
18
|
+
const {
|
|
17
19
|
title,
|
|
18
20
|
start,
|
|
19
21
|
icon,
|
|
@@ -26,8 +28,8 @@ export const SectionHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
26
28
|
minWidth = 256,
|
|
27
29
|
paddingX = 4,
|
|
28
30
|
paddingY = 2
|
|
29
|
-
} =
|
|
30
|
-
props = _objectWithoutProperties(
|
|
31
|
+
} = mergedProps,
|
|
32
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
31
33
|
return /*#__PURE__*/_jsxs(HStack, _objectSpread(_objectSpread({
|
|
32
34
|
ref: ref,
|
|
33
35
|
gap: gap,
|