@coinbase/cds-web 8.62.1 → 8.66.1
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 +56 -0
- package/dts/alpha/combobox/DefaultComboboxControl.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
- package/dts/alpha/select/Select.d.ts.map +1 -1
- package/dts/core/componentConfig.d.ts +2 -2
- package/dts/core/componentConfig.d.ts.map +1 -1
- package/dts/dropdown/Dropdown.d.ts +4 -0
- package/dts/dropdown/Dropdown.d.ts.map +1 -1
- package/dts/dropdown/DropdownContent.d.ts +12 -5
- package/dts/dropdown/DropdownContent.d.ts.map +1 -1
- package/dts/dropdown/DropdownProps.d.ts +20 -0
- package/dts/dropdown/DropdownProps.d.ts.map +1 -1
- package/dts/dropdown/useResponsiveHeight.d.ts +4 -0
- package/dts/dropdown/useResponsiveHeight.d.ts.map +1 -1
- package/dts/overlays/Toast.d.ts.map +1 -1
- package/dts/overlays/index.d.ts +1 -0
- package/dts/overlays/index.d.ts.map +1 -1
- package/dts/overlays/modal/ModalHeader.d.ts +3 -3
- package/dts/overlays/modal/ModalHeader.d.ts.map +1 -1
- package/dts/overlays/modal/ModalWrapper.d.ts.map +1 -1
- package/dts/overlays/popover/Popover.d.ts +48 -31
- package/dts/overlays/popover/Popover.d.ts.map +1 -1
- package/dts/overlays/popover/PopoverPanel.d.ts +164 -0
- package/dts/overlays/popover/PopoverPanel.d.ts.map +1 -0
- package/dts/overlays/popover/PopoverPanelContent.d.ts +43 -0
- package/dts/overlays/popover/PopoverPanelContent.d.ts.map +1 -0
- package/dts/overlays/popover/PopoverProps.d.ts +13 -4
- package/dts/overlays/popover/PopoverProps.d.ts.map +1 -1
- package/dts/overlays/tooltip/TooltipContent.d.ts.map +1 -1
- package/dts/stepper/Stepper.d.ts.map +1 -1
- package/dts/tabs/DefaultTab.d.ts +42 -0
- package/dts/tabs/DefaultTab.d.ts.map +1 -0
- package/dts/tabs/DefaultTabsActiveIndicator.d.ts +16 -0
- package/dts/tabs/DefaultTabsActiveIndicator.d.ts.map +1 -0
- package/dts/tabs/TabIndicator.d.ts +2 -0
- package/dts/tabs/TabIndicator.d.ts.map +1 -1
- package/dts/tabs/TabLabel.d.ts +2 -0
- package/dts/tabs/TabLabel.d.ts.map +1 -1
- package/dts/tabs/TabNavigation.d.ts +16 -0
- package/dts/tabs/TabNavigation.d.ts.map +1 -1
- package/dts/tabs/Tabs.d.ts +25 -11
- package/dts/tabs/Tabs.d.ts.map +1 -1
- package/dts/tabs/index.d.ts +2 -0
- package/dts/tabs/index.d.ts.map +1 -1
- package/dts/tour/DefaultTourMask.d.ts +1 -2
- package/dts/tour/DefaultTourMask.d.ts.map +1 -1
- package/dts/tour/DefaultTourStepArrow.d.ts +1 -1
- package/dts/tour/DefaultTourStepArrow.d.ts.map +1 -1
- package/dts/tour/Tour.d.ts +35 -7
- package/dts/tour/Tour.d.ts.map +1 -1
- package/dts/tour/TourStep.d.ts +4 -1
- package/dts/tour/TourStep.d.ts.map +1 -1
- package/esm/alpha/combobox/DefaultComboboxControl.js +1 -2
- package/esm/alpha/select/DefaultSelectControl.js +4 -2
- package/esm/alpha/select/DefaultSelectDropdown.js +1 -0
- package/esm/alpha/select/Select.js +30 -1
- package/esm/dropdown/Dropdown.js +5 -0
- package/esm/dropdown/DropdownContent.js +12 -1
- package/esm/dropdown/useResponsiveHeight.js +5 -0
- package/esm/icons/__figma__/Icon.figma.js +1771 -869
- package/esm/overlays/Toast.js +20 -12
- package/esm/overlays/index.js +1 -0
- package/esm/overlays/modal/ModalHeader.js +6 -4
- package/esm/overlays/modal/ModalWrapper.js +7 -1
- package/esm/overlays/popover/Popover.js +71 -28
- package/esm/overlays/popover/PopoverPanel.css +2 -0
- package/esm/overlays/popover/PopoverPanel.js +220 -0
- package/esm/overlays/popover/PopoverPanelContent.js +57 -0
- package/esm/overlays/tooltip/TooltipContent.js +3 -5
- package/esm/stepper/Stepper.js +4 -3
- package/esm/tabs/DefaultTab.css +3 -0
- package/esm/tabs/DefaultTab.js +77 -0
- package/esm/tabs/DefaultTabsActiveIndicator.js +58 -0
- package/esm/tabs/TabIndicator.js +2 -0
- package/esm/tabs/TabLabel.js +3 -0
- package/esm/tabs/TabNavigation.js +21 -0
- package/esm/tabs/Tabs.js +32 -34
- package/esm/tabs/index.js +2 -0
- package/esm/tour/DefaultTourMask.js +1 -1
- package/esm/tour/DefaultTourStepArrow.js +3 -1
- package/esm/tour/Tour.js +38 -7
- package/esm/tour/TourStep.js +16 -6
- package/package.json +4 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const _excluded = ["id", "label", "disabled", "onClick", "count", "max", "accessibilityLabel", "className"];
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
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); }
|
|
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
|
+
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
|
+
import React, { forwardRef, memo, useCallback } from 'react';
|
|
10
|
+
import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
|
|
11
|
+
import { cx } from '../cx';
|
|
12
|
+
import { DotCount } from '../dots/DotCount';
|
|
13
|
+
import { HStack } from '../layout';
|
|
14
|
+
import { Pressable } from '../system/Pressable';
|
|
15
|
+
import { Text } from '../typography/Text';
|
|
16
|
+
|
|
17
|
+
/** Optional dot count and a11y overrides for the default tab row. */
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
const pressableCss = "pressableCss-p1gyavxu";
|
|
20
|
+
const insetFocusRingCss = "insetFocusRingCss-i14sq9yf";
|
|
21
|
+
const labelPaddingCss = "labelPaddingCss-lu2xm1d";
|
|
22
|
+
const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
23
|
+
let {
|
|
24
|
+
id,
|
|
25
|
+
label,
|
|
26
|
+
disabled: disabledProp,
|
|
27
|
+
onClick,
|
|
28
|
+
count,
|
|
29
|
+
max,
|
|
30
|
+
accessibilityLabel,
|
|
31
|
+
className
|
|
32
|
+
} = _ref,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
const {
|
|
35
|
+
activeTab,
|
|
36
|
+
updateActiveTab,
|
|
37
|
+
disabled: allTabsDisabled
|
|
38
|
+
} = useTabsContext();
|
|
39
|
+
const isActive = (activeTab === null || activeTab === void 0 ? void 0 : activeTab.id) === id;
|
|
40
|
+
const isDisabled = disabledProp || allTabsDisabled;
|
|
41
|
+
const handlePress = useCallback(() => {
|
|
42
|
+
updateActiveTab(id);
|
|
43
|
+
onClick === null || onClick === void 0 || onClick(id);
|
|
44
|
+
}, [id, onClick, updateActiveTab]);
|
|
45
|
+
return /*#__PURE__*/_jsx(Pressable, _objectSpread(_objectSpread({
|
|
46
|
+
ref: ref,
|
|
47
|
+
"data-rendered-tab": true,
|
|
48
|
+
accessibilityLabel: accessibilityLabel,
|
|
49
|
+
"aria-controls": "tabpanel--".concat(id),
|
|
50
|
+
"aria-selected": isActive,
|
|
51
|
+
background: "transparent",
|
|
52
|
+
className: cx(pressableCss, insetFocusRingCss, className),
|
|
53
|
+
disabled: isDisabled,
|
|
54
|
+
id: "tab--".concat(id),
|
|
55
|
+
onClick: handlePress
|
|
56
|
+
}, props), {}, {
|
|
57
|
+
children: /*#__PURE__*/_jsxs(HStack, {
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
gap: 0.5,
|
|
60
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
61
|
+
as: "h2",
|
|
62
|
+
className: labelPaddingCss,
|
|
63
|
+
color: isActive ? 'fgPrimary' : 'fg',
|
|
64
|
+
display: "block",
|
|
65
|
+
font: "headline",
|
|
66
|
+
children: label
|
|
67
|
+
}), !!count && /*#__PURE__*/_jsx(DotCount, {
|
|
68
|
+
accessibilityLabel: "".concat(accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : typeof label === 'string' ? label : '', " count: ").concat(count),
|
|
69
|
+
count: count,
|
|
70
|
+
max: max
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
}));
|
|
74
|
+
}));
|
|
75
|
+
DefaultTabComponent.displayName = 'DefaultTab';
|
|
76
|
+
export const DefaultTab = DefaultTabComponent;
|
|
77
|
+
import "./DefaultTab.css";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const _excluded = ["activeTabRect", "background", "className", "style", "testID"];
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
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); }
|
|
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
|
+
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
|
+
import { memo } from 'react';
|
|
10
|
+
import { m as motion } from 'framer-motion';
|
|
11
|
+
import { Box } from '../layout/Box';
|
|
12
|
+
import { tabsTransitionConfig } from './Tabs';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const MotionBox = motion(Box);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default underline-style indicator for `Tabs`. Pass as
|
|
18
|
+
* `TabsActiveIndicatorComponent={DefaultTabIndicator}` with `TabComponent={DefaultTab}`.
|
|
19
|
+
*/
|
|
20
|
+
export const DefaultTabsActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
21
|
+
let {
|
|
22
|
+
activeTabRect,
|
|
23
|
+
background = 'bgPrimary',
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
testID
|
|
27
|
+
} = _ref,
|
|
28
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
const {
|
|
30
|
+
width,
|
|
31
|
+
x
|
|
32
|
+
} = activeTabRect;
|
|
33
|
+
if (!width) return null;
|
|
34
|
+
return /*#__PURE__*/_jsx(MotionBox, {
|
|
35
|
+
animate: {
|
|
36
|
+
width,
|
|
37
|
+
x
|
|
38
|
+
},
|
|
39
|
+
background: background,
|
|
40
|
+
bottom: 0,
|
|
41
|
+
className: className,
|
|
42
|
+
height: 2,
|
|
43
|
+
initial: {
|
|
44
|
+
width: 0,
|
|
45
|
+
x
|
|
46
|
+
},
|
|
47
|
+
left: 0,
|
|
48
|
+
overflow: "hidden",
|
|
49
|
+
position: "absolute",
|
|
50
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
51
|
+
pointerEvents: 'none'
|
|
52
|
+
}),
|
|
53
|
+
testID: testID,
|
|
54
|
+
transition: tabsTransitionConfig,
|
|
55
|
+
zIndex: 0
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
DefaultTabsActiveIndicator.displayName = 'DefaultTabsActiveIndicator';
|
package/esm/tabs/TabIndicator.js
CHANGED
|
@@ -12,6 +12,8 @@ import { Box } from '../layout/Box';
|
|
|
12
12
|
import { useAnimateTabIndicator } from './hooks/useAnimateTabIndicator';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const MotionBox = motion(Box);
|
|
15
|
+
/** @deprecated Use DefaultTabsActiveIndicator instead. This will be removed in a future major release. */
|
|
16
|
+
/** @deprecationExpectedRemoval v10 */
|
|
15
17
|
export const TabIndicator = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
18
|
let {
|
|
17
19
|
width,
|
package/esm/tabs/TabLabel.js
CHANGED
|
@@ -28,6 +28,9 @@ const colorVariantStyle = {
|
|
|
28
28
|
inactive: 'fgMuted'
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
/** @deprecated Use DefaultTab instead. This will be removed in a future major release. */
|
|
32
|
+
/** @deprecationExpectedRemoval v10 */
|
|
33
|
+
|
|
31
34
|
export const TabLabel = /*#__PURE__*/memo(_ref => {
|
|
32
35
|
var _props$accessibilityL, _ref2;
|
|
33
36
|
let {
|
|
@@ -30,6 +30,27 @@ const scrollContainerCss = "scrollContainerCss-sgry0cc";
|
|
|
30
30
|
const pressableCss = "pressableCss-p1umbmq2";
|
|
31
31
|
const pressableCustomTabCss = "pressableCustomTabCss-p1gi4b8i";
|
|
32
32
|
const insetFocusRingCss = "insetFocusRingCss-i8jdxgz";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use Tabs instead. This will be removed in a future major release.
|
|
36
|
+
* @deprecationExpectedRemoval v10
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use Tabs instead. This will be removed in a future major release.
|
|
41
|
+
* @deprecationExpectedRemoval v10
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use Tabs instead. This will be removed in a future major release.
|
|
46
|
+
* @deprecationExpectedRemoval v10
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use Tabs instead. This will be removed in a future major release.
|
|
51
|
+
* @deprecationExpectedRemoval v10
|
|
52
|
+
*/
|
|
53
|
+
|
|
33
54
|
const fallbackLayout = {
|
|
34
55
|
width: 0,
|
|
35
56
|
x: 0
|
package/esm/tabs/Tabs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const _excluded = ["id", "registerRef"],
|
|
2
|
-
_excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "activeTab", "onActiveTabElementChange", "disabled", "onChange", "className", "classNames", "styles", "role", "position", "width", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "style"],
|
|
3
|
-
_excluded3 = ["
|
|
4
|
-
_excluded4 = ["activeTabRect", "position"];
|
|
2
|
+
_excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "activeTab", "onActiveTabElementChange", "disabled", "onChange", "className", "classNames", "styles", "role", "position", "width", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "style", "testID"],
|
|
3
|
+
_excluded3 = ["activeTabRect", "position", "testID"];
|
|
5
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
6
|
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; }
|
|
@@ -22,6 +21,8 @@ import { cx } from '../cx';
|
|
|
22
21
|
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
23
22
|
import { Box } from '../layout/Box';
|
|
24
23
|
import { HStack } from '../layout/HStack';
|
|
24
|
+
import { DefaultTab } from './DefaultTab';
|
|
25
|
+
import { DefaultTabsActiveIndicator } from './DefaultTabsActiveIndicator';
|
|
25
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
27
|
const MotionBox = motion(Box);
|
|
27
28
|
const TabContainer = _ref => {
|
|
@@ -46,8 +47,8 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
46
47
|
const mergedProps = useComponentConfig('Tabs', _props);
|
|
47
48
|
const {
|
|
48
49
|
tabs,
|
|
49
|
-
TabComponent,
|
|
50
|
-
TabsActiveIndicatorComponent,
|
|
50
|
+
TabComponent = DefaultTab,
|
|
51
|
+
TabsActiveIndicatorComponent = DefaultTabsActiveIndicator,
|
|
51
52
|
activeBackground,
|
|
52
53
|
activeTab,
|
|
53
54
|
onActiveTabElementChange,
|
|
@@ -64,7 +65,8 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
64
65
|
borderTopRightRadius,
|
|
65
66
|
borderBottomLeftRadius,
|
|
66
67
|
borderBottomRightRadius,
|
|
67
|
-
style
|
|
68
|
+
style,
|
|
69
|
+
testID
|
|
68
70
|
} = mergedProps,
|
|
69
71
|
props = _objectWithoutProperties(mergedProps, _excluded2);
|
|
70
72
|
const api = useTabs({
|
|
@@ -125,9 +127,7 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
125
127
|
focusableElement === null || focusableElement === void 0 || focusableElement.focus();
|
|
126
128
|
}
|
|
127
129
|
}, [tabs, refMap]);
|
|
128
|
-
const containerStyle = useMemo(() => _objectSpread(_objectSpread({
|
|
129
|
-
opacity: disabled ? accessibleOpacityDisabled : 1
|
|
130
|
-
}, style), styles === null || styles === void 0 ? void 0 : styles.root), [disabled, style, styles === null || styles === void 0 ? void 0 : styles.root]);
|
|
130
|
+
const containerStyle = useMemo(() => _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root), [style, styles === null || styles === void 0 ? void 0 : styles.root]);
|
|
131
131
|
const registerRef = useCallback((tabId, ref) => {
|
|
132
132
|
refMap.registerRef(tabId, ref);
|
|
133
133
|
if ((activeTab === null || activeTab === void 0 ? void 0 : activeTab.id) === tabId) {
|
|
@@ -143,9 +143,11 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
143
143
|
borderTopRightRadius: borderTopRightRadius,
|
|
144
144
|
className: cx(className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
145
145
|
onKeyDown: handleTabsContainerKeyDown,
|
|
146
|
+
opacity: disabled ? accessibleOpacityDisabled : 1,
|
|
146
147
|
position: position,
|
|
147
148
|
role: role,
|
|
148
149
|
style: containerStyle,
|
|
150
|
+
testID: testID,
|
|
149
151
|
width: width
|
|
150
152
|
}, props), {}, {
|
|
151
153
|
children: /*#__PURE__*/_jsxs(TabsContext.Provider, {
|
|
@@ -159,40 +161,36 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
159
161
|
borderTopLeftRadius: borderTopLeftRadius,
|
|
160
162
|
borderTopRightRadius: borderTopRightRadius,
|
|
161
163
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.activeIndicator,
|
|
162
|
-
style: styles === null || styles === void 0 ? void 0 : styles.activeIndicator
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
style: styles === null || styles === void 0 ? void 0 : styles.activeIndicator,
|
|
165
|
+
testID: testID ? "".concat(testID, "-active-indicator") : undefined
|
|
166
|
+
}), tabs.map(props => {
|
|
167
|
+
var _props$Component;
|
|
168
|
+
const RenderedTab = (_props$Component = props.Component) !== null && _props$Component !== void 0 ? _props$Component : TabComponent;
|
|
169
|
+
const renderedTabProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
170
|
+
'data-rendered-tab': true,
|
|
171
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.tab,
|
|
172
|
+
role: 'tab',
|
|
173
|
+
style: styles === null || styles === void 0 ? void 0 : styles.tab,
|
|
174
|
+
tabIndex: (activeTab === null || activeTab === void 0 ? void 0 : activeTab.id) === props.id || !activeTab ? 0 : -1
|
|
175
|
+
});
|
|
171
176
|
return /*#__PURE__*/_jsx(TabContainer, {
|
|
172
|
-
id: id,
|
|
177
|
+
id: props.id,
|
|
173
178
|
registerRef: registerRef,
|
|
174
|
-
children: /*#__PURE__*/_jsx(RenderedTab, _objectSpread({
|
|
175
|
-
|
|
176
|
-
className: classNames === null || classNames === void 0 ? void 0 : classNames.tab,
|
|
177
|
-
disabled: tabDisabled,
|
|
178
|
-
id: id,
|
|
179
|
-
role: "tab",
|
|
180
|
-
style: styles === null || styles === void 0 ? void 0 : styles.tab,
|
|
181
|
-
tabIndex: (activeTab === null || activeTab === void 0 ? void 0 : activeTab.id) === id || !activeTab ? 0 : -1
|
|
182
|
-
}, props))
|
|
183
|
-
}, id);
|
|
179
|
+
children: /*#__PURE__*/_jsx(RenderedTab, _objectSpread({}, renderedTabProps))
|
|
180
|
+
}, props.id);
|
|
184
181
|
})]
|
|
185
182
|
})
|
|
186
183
|
}));
|
|
187
184
|
}));
|
|
188
185
|
TabsComponent.displayName = 'Tabs';
|
|
189
186
|
export const Tabs = TabsComponent;
|
|
190
|
-
export const TabsActiveIndicator =
|
|
187
|
+
export const TabsActiveIndicator = _ref2 => {
|
|
191
188
|
let {
|
|
192
189
|
activeTabRect,
|
|
193
|
-
position = 'absolute'
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
position = 'absolute',
|
|
191
|
+
testID = 'tabs-active-indicator'
|
|
192
|
+
} = _ref2,
|
|
193
|
+
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
196
194
|
const {
|
|
197
195
|
width,
|
|
198
196
|
height,
|
|
@@ -205,12 +203,12 @@ export const TabsActiveIndicator = _ref3 => {
|
|
|
205
203
|
if (!width) return null;
|
|
206
204
|
return /*#__PURE__*/_jsx(MotionBox, _objectSpread({
|
|
207
205
|
animate: activeAnimation,
|
|
208
|
-
"data-testid": "tabs-active-indicator",
|
|
209
206
|
height: height,
|
|
210
207
|
initial: false,
|
|
211
208
|
left: 0,
|
|
212
209
|
position: position,
|
|
213
210
|
role: "none",
|
|
211
|
+
testID: testID,
|
|
214
212
|
transition: tabsTransitionConfig
|
|
215
213
|
}, props));
|
|
216
214
|
};
|
package/esm/tabs/index.js
CHANGED
|
@@ -11,7 +11,8 @@ export const DefaultTourStepArrow = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_
|
|
|
11
11
|
let {
|
|
12
12
|
placement,
|
|
13
13
|
arrow,
|
|
14
|
-
style
|
|
14
|
+
style,
|
|
15
|
+
className
|
|
15
16
|
} = _ref;
|
|
16
17
|
const width = 24;
|
|
17
18
|
const height = 24;
|
|
@@ -33,6 +34,7 @@ export const DefaultTourStepArrow = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_
|
|
|
33
34
|
return /*#__PURE__*/_jsx(Box, {
|
|
34
35
|
ref: ref,
|
|
35
36
|
background: "bgInverse",
|
|
37
|
+
className: className,
|
|
36
38
|
height: height,
|
|
37
39
|
style: arrowStyles,
|
|
38
40
|
testID: "tour-step-arrow",
|
package/esm/tour/Tour.js
CHANGED
|
@@ -3,12 +3,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
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
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
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, { useCallback, useEffect, useRef } from 'react';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext';
|
|
8
8
|
import { TourContext } from '@coinbase/cds-common/tour/TourContext';
|
|
9
9
|
import { useTour } from '@coinbase/cds-common/tour/useTour';
|
|
10
10
|
import { arrow as arrowMiddleware, autoPlacement, autoUpdate, offset, shift, useFloating } from '@floating-ui/react-dom';
|
|
11
11
|
import { animated, config as springConfig, useSpring } from '@react-spring/web';
|
|
12
|
+
import { cx } from '../cx';
|
|
12
13
|
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
13
14
|
import { useScrollBlocker } from '../hooks/useScrollBlocker';
|
|
14
15
|
import { FocusTrap } from '../overlays/FocusTrap';
|
|
@@ -16,11 +17,31 @@ import { Portal } from '../overlays/Portal';
|
|
|
16
17
|
import { modalContainerId } from '../overlays/PortalProvider';
|
|
17
18
|
import { DefaultTourMask } from './DefaultTourMask';
|
|
18
19
|
import { DefaultTourStepArrow } from './DefaultTourStepArrow';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Static class names for Calendar component parts.
|
|
23
|
+
* Use these selectors to target specific elements with CSS.
|
|
24
|
+
*/
|
|
19
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
export const tourClassNames = {
|
|
27
|
+
/** Root element */
|
|
28
|
+
root: 'cds-Tour',
|
|
29
|
+
/** The opaque overlay/mask that emphasizes current step */
|
|
30
|
+
mask: 'cds-Tour-mask',
|
|
31
|
+
/** A step's arrow element */
|
|
32
|
+
stepArrow: 'cds-Tour-stepArrow',
|
|
33
|
+
/** A step element's positioned container */
|
|
34
|
+
stepContainer: 'cds-Tour-stepContainer'
|
|
35
|
+
};
|
|
20
36
|
const overlayContentContextValue = {
|
|
21
37
|
isTour: true
|
|
22
38
|
};
|
|
23
39
|
const containerCss = "containerCss-c1gsy0il";
|
|
40
|
+
|
|
41
|
+
// ------------ SUBCOMPONENT PROP TYPES ------------
|
|
42
|
+
|
|
43
|
+
// ------------ SUBCOMPONENT TYPES ------------
|
|
44
|
+
|
|
24
45
|
const defaultScrollOptions = {
|
|
25
46
|
behavior: 'smooth',
|
|
26
47
|
marginX: 100,
|
|
@@ -72,7 +93,7 @@ const scrollIntoView = async (element, scrollOptions) => {
|
|
|
72
93
|
const defaultTourStepOffset = 24;
|
|
73
94
|
const defaultTourStepShiftPadding = 32;
|
|
74
95
|
const TourComponent = _props => {
|
|
75
|
-
var
|
|
96
|
+
var _ref, _activeTourStep$hideO, _activeTourStep$tourM, _activeTourStep$tourM2;
|
|
76
97
|
const mergedProps = useComponentConfig('Tour', _props);
|
|
77
98
|
const {
|
|
78
99
|
steps,
|
|
@@ -90,14 +111,18 @@ const TourComponent = _props => {
|
|
|
90
111
|
scrollOptions = defaultScrollOptions,
|
|
91
112
|
disablePortal,
|
|
92
113
|
disableAutoScroll,
|
|
114
|
+
classNames,
|
|
115
|
+
styles,
|
|
93
116
|
accessibilityLabel,
|
|
94
117
|
accessibilityLabelledBy,
|
|
95
118
|
id,
|
|
96
119
|
testID
|
|
97
120
|
} = mergedProps;
|
|
98
121
|
const tourStepArrowRef = useRef(null);
|
|
122
|
+
// let individual step data override global custom components
|
|
99
123
|
const RenderedTourStep = activeTourStep === null || activeTourStep === void 0 ? void 0 : activeTourStep.Component;
|
|
100
|
-
|
|
124
|
+
// activeTourStep.ArrowComponent references old, deprecated type in cds-common
|
|
125
|
+
const RenderedTourStepArrow = (_ref = activeTourStep === null || activeTourStep === void 0 ? void 0 : activeTourStep.ArrowComponent) !== null && _ref !== void 0 ? _ref : TourStepArrowComponent;
|
|
101
126
|
|
|
102
127
|
// This state is used to store the active tour step target element.
|
|
103
128
|
// const [activeTourStepTarget, setActiveTourStepTarget] = useState<HTMLElement | null>(null);
|
|
@@ -109,6 +134,7 @@ const TourComponent = _props => {
|
|
|
109
134
|
},
|
|
110
135
|
config: springConfig.slow
|
|
111
136
|
}), []);
|
|
137
|
+
const tourMaskStyles = useMemo(() => _objectSpread(_objectSpread({}, animation), styles === null || styles === void 0 ? void 0 : styles.mask), [animation, styles === null || styles === void 0 ? void 0 : styles.mask]);
|
|
112
138
|
const {
|
|
113
139
|
refs,
|
|
114
140
|
floatingStyles,
|
|
@@ -124,6 +150,7 @@ const TourComponent = _props => {
|
|
|
124
150
|
})],
|
|
125
151
|
whileElementsMounted: autoUpdate
|
|
126
152
|
});
|
|
153
|
+
const stepContainerStyle = useMemo(() => _objectSpread(_objectSpread({}, animation), styles === null || styles === void 0 ? void 0 : styles.stepContainer), [animation, styles === null || styles === void 0 ? void 0 : styles.stepContainer]);
|
|
127
154
|
const handleChange = useCallback(tourStep => {
|
|
128
155
|
void animationApi.start({
|
|
129
156
|
to: {
|
|
@@ -200,12 +227,14 @@ const TourComponent = _props => {
|
|
|
200
227
|
"aria-label": accessibilityLabel,
|
|
201
228
|
"aria-labelledby": accessibilityLabelledBy,
|
|
202
229
|
"aria-modal": "true",
|
|
203
|
-
className: containerCss,
|
|
230
|
+
className: cx(tourClassNames.root, containerCss, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
204
231
|
"data-testid": testID,
|
|
205
232
|
id: id,
|
|
206
233
|
role: "dialog",
|
|
234
|
+
style: styles === null || styles === void 0 ? void 0 : styles.root,
|
|
207
235
|
children: [!((_activeTourStep$hideO = activeTourStep.hideOverlay) !== null && _activeTourStep$hideO !== void 0 ? _activeTourStep$hideO : hideOverlay) && activeTourStepTarget && /*#__PURE__*/_jsx(animated.div, {
|
|
208
|
-
|
|
236
|
+
className: cx(tourClassNames.mask, classNames === null || classNames === void 0 ? void 0 : classNames.mask),
|
|
237
|
+
style: tourMaskStyles,
|
|
209
238
|
children: /*#__PURE__*/_jsx(TourMaskComponent, {
|
|
210
239
|
activeTourStepTargetRect: activeTourStepTarget.getBoundingClientRect(),
|
|
211
240
|
borderRadius: (_activeTourStep$tourM = activeTourStep.tourMaskBorderRadius) !== null && _activeTourStep$tourM !== void 0 ? _activeTourStep$tourM : tourMaskBorderRadius,
|
|
@@ -216,12 +245,14 @@ const TourComponent = _props => {
|
|
|
216
245
|
style: floatingStyles,
|
|
217
246
|
children: /*#__PURE__*/_jsx(FocusTrap, {
|
|
218
247
|
children: /*#__PURE__*/_jsxs(animated.div, {
|
|
219
|
-
|
|
248
|
+
className: cx(tourClassNames.stepContainer, classNames === null || classNames === void 0 ? void 0 : classNames.stepContainer),
|
|
249
|
+
style: stepContainerStyle,
|
|
220
250
|
children: [/*#__PURE__*/_jsx(RenderedTourStepArrow, {
|
|
221
251
|
ref: tourStepArrowRef,
|
|
222
252
|
arrow: arrow,
|
|
253
|
+
className: cx(tourClassNames.stepArrow, classNames === null || classNames === void 0 ? void 0 : classNames.stepArrow),
|
|
223
254
|
placement: placement,
|
|
224
|
-
style:
|
|
255
|
+
style: styles === null || styles === void 0 ? void 0 : styles.stepArrow
|
|
225
256
|
}), /*#__PURE__*/_jsx(RenderedTourStep, _objectSpread({}, activeTourStep))]
|
|
226
257
|
})
|
|
227
258
|
})
|
package/esm/tour/TourStep.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
const _excluded = ["id", "children"];
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
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); }
|
|
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
|
+
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; }
|
|
1
9
|
import React, { useCallback } from 'react';
|
|
2
10
|
import { useTourContext } from '@coinbase/cds-common/tour/TourContext';
|
|
3
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -8,16 +16,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
16
|
*/
|
|
9
17
|
export const TourStep = _ref => {
|
|
10
18
|
let {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
id,
|
|
20
|
+
children
|
|
21
|
+
} = _ref,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
23
|
const {
|
|
15
24
|
activeTourStep,
|
|
16
25
|
setActiveTourStepTarget
|
|
17
26
|
} = useTourContext();
|
|
18
27
|
const refCallback = useCallback(ref => (activeTourStep === null || activeTourStep === void 0 ? void 0 : activeTourStep.id) === id && ref && setActiveTourStepTarget(ref), [activeTourStep, id, setActiveTourStepTarget]);
|
|
19
|
-
return /*#__PURE__*/_jsx("div", {
|
|
20
|
-
ref: refCallback
|
|
28
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
29
|
+
ref: refCallback
|
|
30
|
+
}, props), {}, {
|
|
21
31
|
children: children
|
|
22
|
-
});
|
|
32
|
+
}));
|
|
23
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.66.1",
|
|
4
4
|
"description": "Coinbase Design System - Web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -207,9 +207,9 @@
|
|
|
207
207
|
"react-dom": "^18.3.1"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@coinbase/cds-common": "^8.
|
|
211
|
-
"@coinbase/cds-icons": "^5.
|
|
212
|
-
"@coinbase/cds-illustrations": "^4.
|
|
210
|
+
"@coinbase/cds-common": "^8.66.1",
|
|
211
|
+
"@coinbase/cds-icons": "^5.16.0",
|
|
212
|
+
"@coinbase/cds-illustrations": "^4.38.0",
|
|
213
213
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
214
214
|
"@coinbase/cds-utils": "^2.3.5",
|
|
215
215
|
"@floating-ui/react-dom": "^2.1.1",
|