@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
|
@@ -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,
|
package/esm/stepper/Stepper.js
CHANGED
|
@@ -13,6 +13,7 @@ import { usePreviousValue } from '@coinbase/cds-common/hooks/usePreviousValue';
|
|
|
13
13
|
import { containsStep, flattenSteps, isStepVisited } from '@coinbase/cds-common/stepper/utils';
|
|
14
14
|
import { useSprings } from '@react-spring/web';
|
|
15
15
|
import { cx } from '../cx';
|
|
16
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
16
17
|
import { useHasMounted } from '../hooks/useHasMounted';
|
|
17
18
|
import { Box } from '../layout/Box';
|
|
18
19
|
import { VStack } from '../layout/VStack';
|
|
@@ -48,9 +49,10 @@ export const defaultProgressSpringConfig = {
|
|
|
48
49
|
tension: 100,
|
|
49
50
|
clamp: true
|
|
50
51
|
};
|
|
51
|
-
const StepperBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((
|
|
52
|
+
const StepperBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
52
53
|
var _usePreviousValue, _usePreviousValue2;
|
|
53
|
-
|
|
54
|
+
const mergedProps = useComponentConfig('Stepper', _props);
|
|
55
|
+
const {
|
|
54
56
|
direction,
|
|
55
57
|
activeStepId,
|
|
56
58
|
steps,
|
|
@@ -71,8 +73,8 @@ const StepperBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
71
73
|
progressSpringConfig = defaultProgressSpringConfig,
|
|
72
74
|
animate = true,
|
|
73
75
|
disableAnimateOnMount
|
|
74
|
-
} =
|
|
75
|
-
props = _objectWithoutProperties(
|
|
76
|
+
} = mergedProps,
|
|
77
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
76
78
|
const hasMounted = useHasMounted();
|
|
77
79
|
const flatStepIds = useMemo(() => flattenSteps(steps).map(step => step.id), [steps]);
|
|
78
80
|
|
|
@@ -86,11 +88,11 @@ const StepperBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
86
88
|
rootClassName,
|
|
87
89
|
stepClassNames
|
|
88
90
|
} = useMemo(() => {
|
|
89
|
-
const
|
|
91
|
+
const _ref = classNames !== null && classNames !== void 0 ? classNames : {},
|
|
90
92
|
{
|
|
91
93
|
root
|
|
92
|
-
} =
|
|
93
|
-
stepClassNames = _objectWithoutProperties(
|
|
94
|
+
} = _ref,
|
|
95
|
+
stepClassNames = _objectWithoutProperties(_ref, _excluded2);
|
|
94
96
|
const rootClassName = cx(className, root);
|
|
95
97
|
return {
|
|
96
98
|
rootClassName,
|
|
@@ -101,11 +103,11 @@ const StepperBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
101
103
|
rootStyle,
|
|
102
104
|
stepStyles
|
|
103
105
|
} = useMemo(() => {
|
|
104
|
-
const
|
|
106
|
+
const _ref2 = styles !== null && styles !== void 0 ? styles : {},
|
|
105
107
|
{
|
|
106
108
|
root
|
|
107
|
-
} =
|
|
108
|
-
stepStyles = _objectWithoutProperties(
|
|
109
|
+
} = _ref2,
|
|
110
|
+
stepStyles = _objectWithoutProperties(_ref2, _excluded3);
|
|
109
111
|
const rootStyle = _objectSpread(_objectSpread({}, style), root);
|
|
110
112
|
return {
|
|
111
113
|
rootStyle,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { createContext, useContext, useRef } from 'react';
|
|
2
|
+
import { createStore } from 'zustand';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export const ComponentConfigContext = /*#__PURE__*/createContext(undefined);
|
|
5
|
+
|
|
6
|
+
/** Builds the full store state from a ComponentConfig. */
|
|
7
|
+
const createComponentConfigStoreState = config => {
|
|
8
|
+
return {
|
|
9
|
+
components: config
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Provides component-level default props via a zustand store.
|
|
14
|
+
* Each component subscribes to only its own config slice, preventing cross-component re-renders.
|
|
15
|
+
* Supports nesting with isolated scopes: a child provider only applies its own config map.
|
|
16
|
+
*/
|
|
17
|
+
export const ComponentConfigProvider = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
value,
|
|
20
|
+
children
|
|
21
|
+
} = _ref;
|
|
22
|
+
const storeRef = useRef(null);
|
|
23
|
+
if (!storeRef.current) {
|
|
24
|
+
storeRef.current = createStore(() => createComponentConfigStoreState(value));
|
|
25
|
+
}
|
|
26
|
+
const newState = createComponentConfigStoreState(value);
|
|
27
|
+
storeRef.current.setState(newState, true);
|
|
28
|
+
return /*#__PURE__*/_jsx(ComponentConfigContext.Provider, {
|
|
29
|
+
value: storeRef.current,
|
|
30
|
+
children: children
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Singleton empty store used when no ComponentConfigProvider exists in the tree. */
|
|
35
|
+
const emptyComponentConfigStore = createStore(() => ({}));
|
|
36
|
+
|
|
37
|
+
/** Returns the nearest ComponentConfigProvider's zustand store, or an empty fallback. */
|
|
38
|
+
export const useComponentConfigStore = () => {
|
|
39
|
+
const context = useContext(ComponentConfigContext);
|
|
40
|
+
return context !== null && context !== void 0 ? context : emptyComponentConfigStore;
|
|
41
|
+
};
|
package/esm/system/index.js
CHANGED
package/esm/tables/Table.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, useMemo } from 'react';
|
|
10
10
|
import { cx } from '../cx';
|
|
11
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
11
12
|
import { TableContext } from './context/TableContext';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -28,8 +29,9 @@ const tableVariantStyles = {
|
|
|
28
29
|
graph: tableVariantGraphCss,
|
|
29
30
|
ruled: tableVariantRuledCss
|
|
30
31
|
};
|
|
31
|
-
const TableWithRef = /*#__PURE__*/forwardRef(function TableWithRef(
|
|
32
|
-
|
|
32
|
+
const TableWithRef = /*#__PURE__*/forwardRef(function TableWithRef(_props, ref) {
|
|
33
|
+
const mergedProps = useComponentConfig('Table', _props);
|
|
34
|
+
const {
|
|
33
35
|
children,
|
|
34
36
|
variant = 'default',
|
|
35
37
|
bordered,
|
|
@@ -42,8 +44,8 @@ const TableWithRef = /*#__PURE__*/forwardRef(function TableWithRef(_ref, ref) {
|
|
|
42
44
|
accessibilityLabelledBy,
|
|
43
45
|
accessibilityLabel,
|
|
44
46
|
className
|
|
45
|
-
} =
|
|
46
|
-
props = _objectWithoutProperties(
|
|
47
|
+
} = mergedProps,
|
|
48
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
47
49
|
const api = useMemo(() => ({
|
|
48
50
|
variant,
|
|
49
51
|
cellSpacing,
|
|
@@ -8,12 +8,14 @@ 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, { memo, useMemo } from 'react';
|
|
10
10
|
import { useCellSpacing } from '../hooks/useCellSpacing';
|
|
11
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
11
12
|
import { Box } from '../layout/Box';
|
|
12
13
|
import { Text } from '../typography/Text';
|
|
13
14
|
import { useTableCellSpacing } from './hooks/useTable';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
export const TableCaption = /*#__PURE__*/memo(
|
|
16
|
-
|
|
16
|
+
export const TableCaption = /*#__PURE__*/memo(_props => {
|
|
17
|
+
const mergedProps = useComponentConfig('TableCaption', _props);
|
|
18
|
+
const {
|
|
17
19
|
children,
|
|
18
20
|
as = 'span',
|
|
19
21
|
align = 'start',
|
|
@@ -23,8 +25,8 @@ export const TableCaption = /*#__PURE__*/memo(_ref => {
|
|
|
23
25
|
innerSpacing,
|
|
24
26
|
testID,
|
|
25
27
|
style
|
|
26
|
-
} =
|
|
27
|
-
props = _objectWithoutProperties(
|
|
28
|
+
} = mergedProps,
|
|
29
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
28
30
|
const {
|
|
29
31
|
outer,
|
|
30
32
|
inner
|
package/esm/tables/TableCell.js
CHANGED
|
@@ -10,6 +10,7 @@ import React, { memo, useMemo } from 'react';
|
|
|
10
10
|
import { isDevelopment } from '@coinbase/cds-utils';
|
|
11
11
|
import { Cell } from '../cells/Cell';
|
|
12
12
|
import { cx } from '../cx';
|
|
13
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
13
14
|
import { Box } from '../layout/Box';
|
|
14
15
|
import { Text } from '../typography/Text';
|
|
15
16
|
import { useTableCellSpacing, useTableCellTag, useTableContext, useTableSectionTag } from './hooks/useTable';
|
|
@@ -23,9 +24,10 @@ const tableFooterCellCss = "tableFooterCellCss-t1gwndzp";
|
|
|
23
24
|
// the table behavior will override this. We use `width`
|
|
24
25
|
// to explicitly define a table columns width
|
|
25
26
|
const tableOverflowWidthCss = "tableOverflowWidthCss-t1l3yoo8";
|
|
26
|
-
export const TableCell = /*#__PURE__*/memo(
|
|
27
|
-
var
|
|
28
|
-
|
|
27
|
+
export const TableCell = /*#__PURE__*/memo(_props => {
|
|
28
|
+
var _ref;
|
|
29
|
+
const mergedProps = useComponentConfig('TableCell', _props);
|
|
30
|
+
const {
|
|
29
31
|
alignItems,
|
|
30
32
|
children,
|
|
31
33
|
colSpan = 1,
|
|
@@ -38,7 +40,7 @@ export const TableCell = /*#__PURE__*/memo(_ref => {
|
|
|
38
40
|
start,
|
|
39
41
|
testID,
|
|
40
42
|
overflow,
|
|
41
|
-
// Only available when
|
|
43
|
+
// Only available when children is null
|
|
42
44
|
title,
|
|
43
45
|
titleColor,
|
|
44
46
|
subtitle,
|
|
@@ -48,8 +50,8 @@ export const TableCell = /*#__PURE__*/memo(_ref => {
|
|
|
48
50
|
outerSpacing,
|
|
49
51
|
as,
|
|
50
52
|
className
|
|
51
|
-
} =
|
|
52
|
-
props = _objectWithoutProperties(
|
|
53
|
+
} = mergedProps,
|
|
54
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
53
55
|
if (isDevelopment() && children && (title || subtitle)) {
|
|
54
56
|
console.error('TableCell: Cannot use `title` or `subtitle` with `children`.');
|
|
55
57
|
}
|
|
@@ -83,7 +85,7 @@ export const TableCell = /*#__PURE__*/memo(_ref => {
|
|
|
83
85
|
const tableSectionType = useTableSectionTag();
|
|
84
86
|
const isInBody = tableSectionType === 'tbody';
|
|
85
87
|
const defaultTitleColor = isInBody ? 'fg' : 'fgMuted';
|
|
86
|
-
const smartTitleColor = (
|
|
88
|
+
const smartTitleColor = (_ref = titleColor !== null && titleColor !== void 0 ? titleColor : color) !== null && _ref !== void 0 ? _ref : defaultTitleColor;
|
|
87
89
|
|
|
88
90
|
// Spacing defined on the TableCell will override cellSpacing defined on the Table
|
|
89
91
|
const {
|
|
@@ -10,13 +10,15 @@ import { memo } from 'react';
|
|
|
10
10
|
import { getRectWidthVariant } from '@coinbase/cds-common/utils/getRectWidthVariant';
|
|
11
11
|
import { Cell } from '../cells/Cell';
|
|
12
12
|
import { MediaFallback } from '../cells/MediaFallback';
|
|
13
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
13
14
|
import { Fallback } from '../layout';
|
|
14
15
|
import { useTableCellSpacing, useTableCellTag, useTableContext } from './hooks/useTable';
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const visuallyHiddenCss = "visuallyHiddenCss-v1l01hi5";
|
|
17
18
|
const tableCellCss = "tableCellCss-t189mbuy";
|
|
18
|
-
export const TableCellFallback = /*#__PURE__*/memo(
|
|
19
|
-
|
|
19
|
+
export const TableCellFallback = /*#__PURE__*/memo(_props => {
|
|
20
|
+
const mergedProps = useComponentConfig('TableCellFallback', _props);
|
|
21
|
+
const {
|
|
20
22
|
title,
|
|
21
23
|
start,
|
|
22
24
|
end,
|
|
@@ -28,8 +30,8 @@ export const TableCellFallback = /*#__PURE__*/memo(_ref => {
|
|
|
28
30
|
disableRandomRectWidth,
|
|
29
31
|
rectWidthVariant,
|
|
30
32
|
accessibilityLabel = 'Loading Cell'
|
|
31
|
-
} =
|
|
32
|
-
props = _objectWithoutProperties(
|
|
33
|
+
} = mergedProps,
|
|
34
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
33
35
|
const TableCellComponent = useTableCellTag(as);
|
|
34
36
|
// Depending on compact value
|
|
35
37
|
const {
|
package/esm/tables/TableRow.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, { memo, useMemo, useRef } from 'react';
|
|
10
10
|
import { cx } from '../cx';
|
|
11
|
+
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
11
12
|
import { useIsBrowser } from '../hooks/useIsBrowser';
|
|
12
13
|
import { useTableSectionTag } from './hooks/useTable';
|
|
13
14
|
import { useTableRowListener } from './hooks/useTableRowListener';
|
|
@@ -15,8 +16,9 @@ import { TableCell } from './TableCell';
|
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
const tableRowCss = "tableRowCss-t1cncu43";
|
|
17
18
|
const tableRowHoverCss = "tableRowHoverCss-tg1utdg";
|
|
18
|
-
export const TableRow = /*#__PURE__*/memo(
|
|
19
|
-
|
|
19
|
+
export const TableRow = /*#__PURE__*/memo(_props => {
|
|
20
|
+
const mergedProps = useComponentConfig('TableRow', _props);
|
|
21
|
+
const {
|
|
20
22
|
fullWidth,
|
|
21
23
|
disableHoverIndicator,
|
|
22
24
|
children,
|
|
@@ -26,8 +28,8 @@ export const TableRow = /*#__PURE__*/memo(_ref => {
|
|
|
26
28
|
onClick,
|
|
27
29
|
outerSpacing,
|
|
28
30
|
innerSpacing
|
|
29
|
-
} =
|
|
30
|
-
props = _objectWithoutProperties(
|
|
31
|
+
} = mergedProps,
|
|
32
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
31
33
|
const isBrowser = useIsBrowser();
|
|
32
34
|
const tableSectionType = useTableSectionTag();
|
|
33
35
|
const isCellInBody = tableSectionType === 'tbody';
|