@coinbase/cds-mobile 8.62.0 → 8.66.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dts/cells/Cell.d.ts.map +1 -1
  3. package/dts/overlays/modal/ModalHeader.d.ts +1 -1
  4. package/dts/overlays/modal/ModalHeader.d.ts.map +1 -1
  5. package/dts/stepper/Stepper.d.ts.map +1 -1
  6. package/dts/tabs/DefaultTab.d.ts +50 -0
  7. package/dts/tabs/DefaultTab.d.ts.map +1 -0
  8. package/dts/tabs/DefaultTabsActiveIndicator.d.ts +11 -0
  9. package/dts/tabs/DefaultTabsActiveIndicator.d.ts.map +1 -0
  10. package/dts/tabs/TabIndicator.d.ts +2 -0
  11. package/dts/tabs/TabIndicator.d.ts.map +1 -1
  12. package/dts/tabs/TabLabel.d.ts +2 -0
  13. package/dts/tabs/TabLabel.d.ts.map +1 -1
  14. package/dts/tabs/TabNavigation.d.ts +16 -0
  15. package/dts/tabs/TabNavigation.d.ts.map +1 -1
  16. package/dts/tabs/Tabs.d.ts +26 -11
  17. package/dts/tabs/Tabs.d.ts.map +1 -1
  18. package/dts/tabs/index.d.ts +2 -0
  19. package/dts/tabs/index.d.ts.map +1 -1
  20. package/dts/tour/DefaultTourStepArrow.d.ts +1 -1
  21. package/dts/tour/DefaultTourStepArrow.d.ts.map +1 -1
  22. package/dts/tour/Tour.d.ts +28 -2
  23. package/dts/tour/Tour.d.ts.map +1 -1
  24. package/dts/tour/TourStep.d.ts +3 -0
  25. package/dts/tour/TourStep.d.ts.map +1 -1
  26. package/esm/cells/Cell.js +2 -1
  27. package/esm/cells/__stories__/ListCell.stories.js +2 -0
  28. package/esm/overlays/__stories__/ModalCustomHeader.stories.js +86 -0
  29. package/esm/overlays/modal/ModalHeader.js +13 -4
  30. package/esm/stepper/Stepper.js +4 -3
  31. package/esm/tabs/DefaultTab.js +75 -0
  32. package/esm/tabs/DefaultTabsActiveIndicator.js +58 -0
  33. package/esm/tabs/TabIndicator.js +2 -0
  34. package/esm/tabs/TabLabel.js +2 -0
  35. package/esm/tabs/TabNavigation.js +20 -0
  36. package/esm/tabs/Tabs.js +17 -13
  37. package/esm/tabs/__stories__/Tabs.stories.js +165 -64
  38. package/esm/tabs/index.js +2 -0
  39. package/esm/tour/DefaultTourStepArrow.js +1 -2
  40. package/esm/tour/Tour.js +23 -7
  41. package/esm/tour/TourStep.js +11 -6
  42. package/package.json +4 -4
package/esm/tour/Tour.js CHANGED
@@ -1,6 +1,6 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useRef } from 'react';
3
- import { Modal, View } from 'react-native';
2
+ import React, { useCallback, useMemo, useRef } from 'react';
3
+ import { Modal, StyleSheet, View } from 'react-native';
4
4
  import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext';
5
5
  import { TourContext } from '@coinbase/cds-common/tour/TourContext';
6
6
  import { useTour } from '@coinbase/cds-common/tour/useTour';
@@ -14,8 +14,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const overlayContentContextValue = {
15
15
  isTour: true
16
16
  };
17
+
18
+ // ------------ SUBCOMPONENT PROP TYPES ------------
19
+
20
+ // ------------ SUBCOMPONENT TYPES ------------
21
+
17
22
  const TourComponent = _props => {
18
- var _activeTourStep$Arrow, _activeTourStep$hideO, _activeTourStep$tourM, _activeTourStep$tourM2;
23
+ var _ref, _activeTourStep$hideO, _activeTourStep$tourM, _activeTourStep$tourM2;
19
24
  const mergedProps = useComponentConfig('Tour', _props);
20
25
  const {
21
26
  steps,
@@ -29,6 +34,7 @@ const TourComponent = _props => {
29
34
  hideOverlay,
30
35
  tourMaskPadding,
31
36
  tourMaskBorderRadius,
37
+ styles,
32
38
  accessibilityLabel,
33
39
  accessibilityLabelledBy,
34
40
  id,
@@ -39,13 +45,20 @@ const TourComponent = _props => {
39
45
  const defaultTourStepShiftPadding = theme.space[4];
40
46
  const tourStepArrowRef = useRef(null);
41
47
  const RenderedTourStep = activeTourStep == null ? void 0 : activeTourStep.Component;
42
- const RenderedTourStepArrow = (_activeTourStep$Arrow = activeTourStep == null ? void 0 : activeTourStep.ArrowComponent) != null ? _activeTourStep$Arrow : TourStepArrowComponent;
48
+ // activeTourStep.ArrowComponent references old, deprecated type in cds-common
49
+ const RenderedTourStepArrow = (_ref = activeTourStep == null ? void 0 : activeTourStep.ArrowComponent) != null ? _ref : TourStepArrowComponent;
43
50
  const [animation, animationApi] = useSpring(() => ({
44
51
  from: {
45
52
  opacity: 0
46
53
  },
47
54
  config: springConfig.slow
48
55
  }), []);
56
+
57
+ // StyleSheet.flatten is needed because styles?.mask/stepContainer are StyleProp<ViewStyle>,
58
+ // which may be arrays. Unlike RN's Animated.View, react-spring's animated.View only accepts
59
+ // plain style objects, so we must flatten before merging with the spring animation values.
60
+ const maskStyles = useMemo(() => _extends({}, animation, StyleSheet.flatten(styles == null ? void 0 : styles.mask)), [animation, styles == null ? void 0 : styles.mask]);
61
+ const stepContainerStyles = useMemo(() => _extends({}, animation, StyleSheet.flatten(styles == null ? void 0 : styles.stepContainer)), [animation, styles == null ? void 0 : styles.stepContainer]);
49
62
  const {
50
63
  refs,
51
64
  floatingStyles,
@@ -124,9 +137,11 @@ const TourComponent = _props => {
124
137
  animationType: "none",
125
138
  id: id,
126
139
  presentationStyle: "overFullScreen",
140
+ style: styles == null ? void 0 : styles.root,
127
141
  testID: testID,
128
142
  children: [!((_activeTourStep$hideO = activeTourStep.hideOverlay) != null ? _activeTourStep$hideO : hideOverlay) && !!activeTourStepTarget && /*#__PURE__*/_jsx(animated.View, {
129
- style: animation,
143
+ style: maskStyles,
144
+ testID: "tour-mask",
130
145
  children: /*#__PURE__*/_jsx(TourMaskComponent, {
131
146
  activeTourStepTarget: activeTourStepTarget,
132
147
  borderRadius: (_activeTourStep$tourM = activeTourStep.tourMaskBorderRadius) != null ? _activeTourStep$tourM : tourMaskBorderRadius,
@@ -137,12 +152,13 @@ const TourComponent = _props => {
137
152
  collapsable: false,
138
153
  style: floatingStyles,
139
154
  children: /*#__PURE__*/_jsxs(animated.View, {
140
- style: animation,
155
+ style: stepContainerStyles,
156
+ testID: "tour-step-container",
141
157
  children: [/*#__PURE__*/_jsx(RenderedTourStepArrow, {
142
158
  ref: tourStepArrowRef,
143
159
  arrow: arrow,
144
160
  placement: placement,
145
- style: activeTourStep == null ? void 0 : activeTourStep.arrowStyle
161
+ style: styles == null ? void 0 : styles.stepArrow
146
162
  }), /*#__PURE__*/_jsx(RenderedTourStep, _extends({}, activeTourStep))]
147
163
  })
148
164
  })]
@@ -1,3 +1,6 @@
1
+ const _excluded = ["id", "children"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ 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
4
  import React, { useCallback } from 'react';
2
5
  import { View } from 'react-native';
3
6
  import { useTourContext } from '@coinbase/cds-common/tour/TourContext';
@@ -9,17 +12,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
12
  */
10
13
  export const TourStep = _ref => {
11
14
  let {
12
- id,
13
- children
14
- } = _ref;
15
+ id,
16
+ children
17
+ } = _ref,
18
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
15
19
  const {
16
20
  activeTourStep,
17
21
  setActiveTourStepTarget
18
22
  } = useTourContext();
19
23
  const refCallback = useCallback(ref => (activeTourStep == null ? void 0 : activeTourStep.id) === id && ref && setActiveTourStepTarget(ref), [activeTourStep, id, setActiveTourStepTarget]);
20
- return /*#__PURE__*/_jsx(View, {
24
+ return /*#__PURE__*/_jsx(View, _extends({
21
25
  ref: refCallback,
22
- collapsable: false,
26
+ collapsable: false
27
+ }, props, {
23
28
  children: children
24
- });
29
+ }));
25
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "8.62.0",
3
+ "version": "8.66.0",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -197,9 +197,9 @@
197
197
  "react-native-svg": "^14.1.0"
198
198
  },
199
199
  "dependencies": {
200
- "@coinbase/cds-common": "^8.62.0",
201
- "@coinbase/cds-icons": "^5.13.0",
202
- "@coinbase/cds-illustrations": "^4.36.0",
200
+ "@coinbase/cds-common": "^8.66.0",
201
+ "@coinbase/cds-icons": "^5.15.0",
202
+ "@coinbase/cds-illustrations": "^4.38.0",
203
203
  "@coinbase/cds-lottie-files": "^3.3.4",
204
204
  "@coinbase/cds-utils": "^2.3.5",
205
205
  "@floating-ui/react-native": "^0.10.5",