@coinbase/cds-mobile 8.36.2 → 8.36.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const _excluded = ["steps", "defaultActiveStepId", "title", "initialComplete", "skipParentSteps", "renderWithApi"];
|
|
2
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
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; }
|
|
4
|
-
import React, { useState } from 'react';
|
|
4
|
+
import React, { memo, useState } from 'react';
|
|
5
5
|
import { useStepper } from '@coinbase/cds-common/stepper/useStepper';
|
|
6
6
|
import { Button } from '../../buttons';
|
|
7
7
|
import { ListCell } from '../../cells';
|
|
@@ -11,6 +11,9 @@ import { Icon } from '../../icons/Icon';
|
|
|
11
11
|
import { HStack, VStack } from '../../layout';
|
|
12
12
|
import { Pressable } from '../../system';
|
|
13
13
|
import { Text } from '../../typography/Text';
|
|
14
|
+
import { DefaultStepperIconVertical } from '../DefaultStepperIconVertical';
|
|
15
|
+
import { DefaultStepperLabelVertical } from '../DefaultStepperLabelVertical';
|
|
16
|
+
import { DefaultStepperProgressVertical } from '../DefaultStepperProgressVertical';
|
|
14
17
|
import { Stepper } from '../Stepper';
|
|
15
18
|
|
|
16
19
|
// A reusable example wrapper that encapsulates useStepper, renders the Stepper and controls,
|
|
@@ -573,6 +576,84 @@ const NullComponents = () => {
|
|
|
573
576
|
steps: steps
|
|
574
577
|
});
|
|
575
578
|
};
|
|
579
|
+
const ErrorStepperIcon = /*#__PURE__*/memo(function ErrorStepperIcon(props) {
|
|
580
|
+
var _step$metadata;
|
|
581
|
+
const {
|
|
582
|
+
step,
|
|
583
|
+
visited,
|
|
584
|
+
complete
|
|
585
|
+
} = props;
|
|
586
|
+
const showError = ((_step$metadata = step.metadata) == null ? void 0 : _step$metadata.isError) && (visited || complete);
|
|
587
|
+
if (!showError) {
|
|
588
|
+
return /*#__PURE__*/_jsx(DefaultStepperIconVertical, _extends({}, props));
|
|
589
|
+
}
|
|
590
|
+
return /*#__PURE__*/_jsx(DefaultStepperIconVertical, _extends({}, props, {
|
|
591
|
+
activeColor: "bgNegative",
|
|
592
|
+
completeColor: "bgNegative",
|
|
593
|
+
completeName: "circleCross",
|
|
594
|
+
visitedColor: "bgNegative",
|
|
595
|
+
visitedName: "circleCross"
|
|
596
|
+
}));
|
|
597
|
+
});
|
|
598
|
+
const ErrorStepperLabel = /*#__PURE__*/memo(function ErrorStepperLabel(props) {
|
|
599
|
+
var _step$metadata2;
|
|
600
|
+
const {
|
|
601
|
+
step,
|
|
602
|
+
visited,
|
|
603
|
+
complete
|
|
604
|
+
} = props;
|
|
605
|
+
const showError = ((_step$metadata2 = step.metadata) == null ? void 0 : _step$metadata2.isError) && (visited || complete);
|
|
606
|
+
if (!showError) {
|
|
607
|
+
return /*#__PURE__*/_jsx(DefaultStepperLabelVertical, _extends({}, props));
|
|
608
|
+
}
|
|
609
|
+
return /*#__PURE__*/_jsx(DefaultStepperLabelVertical, _extends({}, props, {
|
|
610
|
+
activeColor: "fgNegative",
|
|
611
|
+
completeColor: "fgNegative",
|
|
612
|
+
visitedColor: "fgNegative"
|
|
613
|
+
}));
|
|
614
|
+
});
|
|
615
|
+
const ErrorStepperProgress = /*#__PURE__*/memo(function ErrorStepperProgress(props) {
|
|
616
|
+
var _step$metadata3;
|
|
617
|
+
const {
|
|
618
|
+
step,
|
|
619
|
+
visited,
|
|
620
|
+
complete
|
|
621
|
+
} = props;
|
|
622
|
+
const showError = ((_step$metadata3 = step.metadata) == null ? void 0 : _step$metadata3.isError) && (visited || complete);
|
|
623
|
+
if (!showError) {
|
|
624
|
+
return /*#__PURE__*/_jsx(DefaultStepperProgressVertical, _extends({}, props));
|
|
625
|
+
}
|
|
626
|
+
return /*#__PURE__*/_jsx(DefaultStepperProgressVertical, _extends({}, props, {
|
|
627
|
+
completeFill: "bgNegative",
|
|
628
|
+
visitedFill: "bgNegative"
|
|
629
|
+
}));
|
|
630
|
+
});
|
|
631
|
+
const CustomErrorStep = () => {
|
|
632
|
+
const steps = [{
|
|
633
|
+
id: '1',
|
|
634
|
+
label: 'Account Details'
|
|
635
|
+
}, {
|
|
636
|
+
id: '2',
|
|
637
|
+
label: 'Personal Information'
|
|
638
|
+
}, {
|
|
639
|
+
id: '3',
|
|
640
|
+
label: 'Payment Method',
|
|
641
|
+
metadata: {
|
|
642
|
+
isError: true
|
|
643
|
+
}
|
|
644
|
+
}, {
|
|
645
|
+
id: '4',
|
|
646
|
+
label: 'Review & Submit'
|
|
647
|
+
}];
|
|
648
|
+
return /*#__PURE__*/_jsx(StepperVerticalExample, {
|
|
649
|
+
StepperIconComponent: ErrorStepperIcon,
|
|
650
|
+
StepperLabelComponent: ErrorStepperLabel,
|
|
651
|
+
StepperProgressComponent: ErrorStepperProgress,
|
|
652
|
+
defaultActiveStepId: '1',
|
|
653
|
+
steps: steps,
|
|
654
|
+
title: "Custom Error Step (shows error state after step is visited)"
|
|
655
|
+
});
|
|
656
|
+
};
|
|
576
657
|
const StepperVerticalScreen = () => {
|
|
577
658
|
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
578
659
|
children: [/*#__PURE__*/_jsx(Example, {
|
|
@@ -596,6 +677,9 @@ const StepperVerticalScreen = () => {
|
|
|
596
677
|
}), /*#__PURE__*/_jsx(Example, {
|
|
597
678
|
title: "Null Components",
|
|
598
679
|
children: /*#__PURE__*/_jsx(NullComponents, {})
|
|
680
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
681
|
+
title: "Custom Error Step",
|
|
682
|
+
children: /*#__PURE__*/_jsx(CustomErrorStep, {})
|
|
599
683
|
})]
|
|
600
684
|
});
|
|
601
685
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.36.
|
|
3
|
+
"version": "8.36.3",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"react-native-svg": "^14.1.0"
|
|
199
199
|
},
|
|
200
200
|
"dependencies": {
|
|
201
|
-
"@coinbase/cds-common": "^8.36.
|
|
201
|
+
"@coinbase/cds-common": "^8.36.3",
|
|
202
202
|
"@coinbase/cds-icons": "^5.9.0",
|
|
203
203
|
"@coinbase/cds-illustrations": "^4.29.0",
|
|
204
204
|
"@coinbase/cds-lottie-files": "^3.3.4",
|