@coinbase/cds-mobile 8.53.0 → 8.54.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 +16 -0
- package/README.md +5 -2
- package/dts/buttons/IconButton.d.ts +23 -1
- package/dts/buttons/IconButton.d.ts.map +1 -1
- package/dts/controls/InputIconButton.d.ts +22 -1
- package/dts/controls/InputIconButton.d.ts.map +1 -1
- package/dts/dates/Calendar.d.ts +170 -0
- package/dts/dates/Calendar.d.ts.map +1 -0
- package/dts/dates/DateInput.d.ts +2 -2
- package/dts/dates/DateInput.d.ts.map +1 -1
- package/dts/dates/DatePicker.d.ts +136 -67
- package/dts/dates/DatePicker.d.ts.map +1 -1
- package/dts/overlays/drawer/Drawer.d.ts +4 -0
- package/dts/overlays/drawer/Drawer.d.ts.map +1 -1
- package/dts/overlays/tooltip/Tooltip.d.ts +9 -1
- package/dts/overlays/tooltip/Tooltip.d.ts.map +1 -1
- package/esm/buttons/IconButton.js +4 -3
- package/esm/controls/InputIconButton.js +4 -3
- package/esm/dates/Calendar.js +346 -0
- package/esm/dates/DateInput.js +3 -1
- package/esm/dates/DatePicker.js +116 -39
- package/esm/dates/__stories__/Calendar.stories.js +360 -0
- package/esm/dates/__stories__/DatePicker.stories.js +51 -25
- package/esm/media/RemoteImageGroup.js +1 -1
- package/esm/overlays/drawer/Drawer.js +4 -2
- package/esm/overlays/tooltip/Tooltip.js +7 -2
- package/package.json +3 -5
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
const _excluded = ["date"];
|
|
1
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; }
|
|
2
4
|
import { useState } from 'react';
|
|
3
5
|
import { InputLabel } from '../../controls/InputLabel';
|
|
4
6
|
import { TextInput } from '../../controls/TextInput';
|
|
@@ -10,23 +12,25 @@ import { Tooltip } from '../../overlays/tooltip/Tooltip';
|
|
|
10
12
|
import { Text } from '../../typography/Text';
|
|
11
13
|
import { DatePicker } from '../DatePicker';
|
|
12
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const today = new Date(new Date(
|
|
15
|
+
const today = new Date(new Date().setHours(0, 0, 0, 0));
|
|
14
16
|
const nextMonth15th = new Date(today.getFullYear(), today.getMonth() + 1, 15);
|
|
15
|
-
const
|
|
17
|
+
const tomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
|
16
18
|
const exampleProps = {
|
|
17
|
-
maxDate: nextMonth15th,
|
|
18
|
-
minDate: lastMonth15th,
|
|
19
19
|
invalidDateError: 'Please enter a valid date',
|
|
20
20
|
disabledDateError: 'Date unavailable',
|
|
21
21
|
requiredError: 'This field is required'
|
|
22
22
|
};
|
|
23
|
-
const ExampleDatePicker =
|
|
24
|
-
|
|
23
|
+
const ExampleDatePicker = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
date
|
|
26
|
+
} = _ref,
|
|
27
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
|
+
const [dateValue, setDateValue] = useState(date != null ? date : null);
|
|
25
29
|
const [error, setError] = useState(null);
|
|
26
30
|
return /*#__PURE__*/_jsx(DatePicker, _extends({}, exampleProps, props, {
|
|
27
|
-
date:
|
|
31
|
+
date: dateValue,
|
|
28
32
|
error: error,
|
|
29
|
-
onChangeDate:
|
|
33
|
+
onChangeDate: setDateValue,
|
|
30
34
|
onErrorDate: setError
|
|
31
35
|
}));
|
|
32
36
|
};
|
|
@@ -36,20 +40,20 @@ export const FullExample = () => {
|
|
|
36
40
|
title: "Default",
|
|
37
41
|
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
38
42
|
required: true,
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
label: "Birthdate",
|
|
44
|
+
openCalendarAccessibilityLabel: "Birthdate calendar"
|
|
41
45
|
})
|
|
42
46
|
}), /*#__PURE__*/_jsx(Example, {
|
|
43
47
|
title: "Multiple pickers",
|
|
44
48
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
45
49
|
gap: 2,
|
|
46
50
|
children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
47
|
-
calendarIconButtonAccessibilityLabel: "Example 1 calendar",
|
|
48
51
|
label: "Example 1",
|
|
52
|
+
openCalendarAccessibilityLabel: "Example 1 calendar",
|
|
49
53
|
width: "auto"
|
|
50
54
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
51
|
-
calendarIconButtonAccessibilityLabel: "Example 2 calendar",
|
|
52
55
|
label: "Example 2",
|
|
56
|
+
openCalendarAccessibilityLabel: "Example 2 calendar",
|
|
53
57
|
width: "auto"
|
|
54
58
|
})]
|
|
55
59
|
})
|
|
@@ -62,8 +66,8 @@ export const FullExample = () => {
|
|
|
62
66
|
placeholder: "1",
|
|
63
67
|
width: "auto"
|
|
64
68
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
65
|
-
calendarIconButtonAccessibilityLabel: "Example calendar",
|
|
66
69
|
label: "Example Date",
|
|
70
|
+
openCalendarAccessibilityLabel: "Example calendar",
|
|
67
71
|
width: "auto"
|
|
68
72
|
})]
|
|
69
73
|
})
|
|
@@ -76,8 +80,8 @@ export const FullExample = () => {
|
|
|
76
80
|
placeholder: "1",
|
|
77
81
|
width: "50%"
|
|
78
82
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
79
|
-
calendarIconButtonAccessibilityLabel: "Example calendar",
|
|
80
83
|
label: "Example Date",
|
|
84
|
+
openCalendarAccessibilityLabel: "Example calendar",
|
|
81
85
|
width: "auto"
|
|
82
86
|
})]
|
|
83
87
|
})
|
|
@@ -85,7 +89,6 @@ export const FullExample = () => {
|
|
|
85
89
|
title: "DatePicker with labelNode",
|
|
86
90
|
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
87
91
|
accessibilityLabel: "Birthdate",
|
|
88
|
-
calendarIconButtonAccessibilityLabel: "Birthdate calendar",
|
|
89
92
|
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
90
93
|
alignItems: "center",
|
|
91
94
|
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
@@ -100,7 +103,8 @@ export const FullExample = () => {
|
|
|
100
103
|
size: "xs"
|
|
101
104
|
})
|
|
102
105
|
})]
|
|
103
|
-
})
|
|
106
|
+
}),
|
|
107
|
+
openCalendarAccessibilityLabel: "Birthdate calendar"
|
|
104
108
|
})
|
|
105
109
|
}), /*#__PURE__*/_jsx(Example, {
|
|
106
110
|
title: "DatePicker fit-content width",
|
|
@@ -108,19 +112,41 @@ export const FullExample = () => {
|
|
|
108
112
|
flexWrap: "wrap",
|
|
109
113
|
gap: 2,
|
|
110
114
|
children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
111
|
-
calendarIconButtonAccessibilityLabel: "Example calendar",
|
|
112
115
|
label: "Example Date",
|
|
116
|
+
openCalendarAccessibilityLabel: "Example calendar",
|
|
113
117
|
width: "fit-content"
|
|
114
118
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
115
|
-
calendarIconButtonAccessibilityLabel: "Example calendar 2",
|
|
116
119
|
label: "Example Date 2",
|
|
120
|
+
openCalendarAccessibilityLabel: "Example calendar 2",
|
|
117
121
|
width: "fit-content"
|
|
118
122
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
119
|
-
calendarIconButtonAccessibilityLabel: "Example calendar 3",
|
|
120
123
|
label: "Example Date 3",
|
|
124
|
+
openCalendarAccessibilityLabel: "Example calendar 3",
|
|
121
125
|
width: "fit-content"
|
|
122
126
|
})]
|
|
123
127
|
})
|
|
128
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
129
|
+
title: "DatePicker with seed date (next month)",
|
|
130
|
+
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
131
|
+
label: "Event date",
|
|
132
|
+
openCalendarAccessibilityLabel: "Seed date calendar",
|
|
133
|
+
seedDate: nextMonth15th
|
|
134
|
+
})
|
|
135
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
136
|
+
title: "DatePicker with pre-selected date (next month)",
|
|
137
|
+
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
138
|
+
date: nextMonth15th,
|
|
139
|
+
label: "Event date",
|
|
140
|
+
openCalendarAccessibilityLabel: "Seed date calendar"
|
|
141
|
+
})
|
|
142
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
143
|
+
title: "DatePicker with minimum date of tomorrow",
|
|
144
|
+
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
145
|
+
disabledDateError: "Future dates only",
|
|
146
|
+
invalidDateError: "Future dates only",
|
|
147
|
+
label: "Future date",
|
|
148
|
+
minDate: tomorrow
|
|
149
|
+
})
|
|
124
150
|
})]
|
|
125
151
|
});
|
|
126
152
|
};
|
|
@@ -132,7 +158,6 @@ export const CustomLabel = () => {
|
|
|
132
158
|
gap: 2,
|
|
133
159
|
children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
134
160
|
accessibilityLabel: "Date of birth",
|
|
135
|
-
calendarIconButtonAccessibilityLabel: "Date of birth calendar",
|
|
136
161
|
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
137
162
|
alignItems: "center",
|
|
138
163
|
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
@@ -147,11 +172,11 @@ export const CustomLabel = () => {
|
|
|
147
172
|
size: "xs"
|
|
148
173
|
})
|
|
149
174
|
})]
|
|
150
|
-
})
|
|
175
|
+
}),
|
|
176
|
+
openCalendarAccessibilityLabel: "Date of birth calendar"
|
|
151
177
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
152
178
|
compact: true,
|
|
153
179
|
accessibilityLabel: "Start date",
|
|
154
|
-
calendarIconButtonAccessibilityLabel: "Start date calendar",
|
|
155
180
|
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
156
181
|
alignItems: "center",
|
|
157
182
|
gap: 0.5,
|
|
@@ -162,10 +187,10 @@ export const CustomLabel = () => {
|
|
|
162
187
|
font: "label1",
|
|
163
188
|
children: "*"
|
|
164
189
|
})]
|
|
165
|
-
})
|
|
190
|
+
}),
|
|
191
|
+
openCalendarAccessibilityLabel: "Start date calendar"
|
|
166
192
|
}), /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
167
193
|
accessibilityLabel: "End date",
|
|
168
|
-
calendarIconButtonAccessibilityLabel: "End date calendar",
|
|
169
194
|
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
170
195
|
alignItems: "center",
|
|
171
196
|
gap: 1,
|
|
@@ -178,7 +203,8 @@ export const CustomLabel = () => {
|
|
|
178
203
|
children: "(optional)"
|
|
179
204
|
})]
|
|
180
205
|
}),
|
|
181
|
-
labelVariant: "inside"
|
|
206
|
+
labelVariant: "inside",
|
|
207
|
+
openCalendarAccessibilityLabel: "End date calendar"
|
|
182
208
|
})]
|
|
183
209
|
})
|
|
184
210
|
})
|
|
@@ -77,7 +77,7 @@ export const RemoteImageGroup = _ref => {
|
|
|
77
77
|
children: clonedChild
|
|
78
78
|
}, index);
|
|
79
79
|
}), excess > 0 && /*#__PURE__*/_jsx(Box, {
|
|
80
|
-
background: "
|
|
80
|
+
background: "bgSecondary",
|
|
81
81
|
borderColor: borderColor,
|
|
82
82
|
borderWidth: borderWidth,
|
|
83
83
|
marginStart: overlapSpacing,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["children", "pin", "onCloseComplete", "preventDismissGestures", "preventHardwareBackBehaviorAndroid", "handleBarVariant", "hideHandleBar", "disableCapturePanGestureToDismiss", "onBlur", "verticalDrawerPercentageOfView", "handleBarAccessibilityLabel", "accessibilityLabel", "accessibilityLabelledBy", "reduceMotion", "style", "styles", "accessibilityRole", "animationType"];
|
|
1
|
+
const _excluded = ["children", "pin", "onCloseComplete", "preventDismissGestures", "preventHardwareBackBehaviorAndroid", "handleBarVariant", "hideHandleBar", "disableCapturePanGestureToDismiss", "onBlur", "verticalDrawerPercentageOfView", "handleBarAccessibilityLabel", "accessibilityLabel", "accessibilityLabelledBy", "reduceMotion", "onOpenComplete", "style", "styles", "accessibilityRole", "animationType"];
|
|
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
4
|
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
@@ -39,6 +39,7 @@ export const Drawer = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Drawer(
|
|
|
39
39
|
accessibilityLabel,
|
|
40
40
|
accessibilityLabelledBy,
|
|
41
41
|
reduceMotion,
|
|
42
|
+
onOpenComplete,
|
|
42
43
|
style,
|
|
43
44
|
styles,
|
|
44
45
|
accessibilityRole = 'alert',
|
|
@@ -95,10 +96,11 @@ export const Drawer = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Drawer(
|
|
|
95
96
|
} = _ref4;
|
|
96
97
|
if (finished) {
|
|
97
98
|
isMounted.current = true;
|
|
99
|
+
onOpenComplete == null || onOpenComplete();
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
|
-
}, [drawerAnimation, animateDrawerIn, animateOverlayIn]);
|
|
103
|
+
}, [drawerAnimation, animateDrawerIn, animateOverlayIn, onOpenComplete]);
|
|
102
104
|
const panGestureHandlers = useDrawerPanResponder({
|
|
103
105
|
pin,
|
|
104
106
|
drawerAnimation,
|
|
@@ -19,6 +19,7 @@ export const Tooltip = /*#__PURE__*/memo(_ref => {
|
|
|
19
19
|
accessibilityHint,
|
|
20
20
|
accessibilityLabelForContent,
|
|
21
21
|
accessibilityHintForContent,
|
|
22
|
+
accessibilityState,
|
|
22
23
|
visible,
|
|
23
24
|
invertColorScheme = true,
|
|
24
25
|
elevation,
|
|
@@ -92,8 +93,12 @@ export const Tooltip = /*#__PURE__*/memo(_ref => {
|
|
|
92
93
|
// equals the component where when you click on it, it will show the tooltip
|
|
93
94
|
const accessibilityPropsForTrigger = useMemo(() => ({
|
|
94
95
|
accessibilityLabel: typeof children === 'string' && accessibilityLabel === undefined ? children : accessibilityLabel,
|
|
95
|
-
accessibilityHint: typeof children === 'string' && accessibilityHint === undefined ? children : accessibilityHint
|
|
96
|
-
|
|
96
|
+
accessibilityHint: typeof children === 'string' && accessibilityHint === undefined ? children : accessibilityHint,
|
|
97
|
+
// accessibilityState is applied to the trigger regardless of screen reader usage.
|
|
98
|
+
// Only set it when you need screen reader behavior.
|
|
99
|
+
// e.g. disabled = true: state is announced and the trigger cannot activate
|
|
100
|
+
accessibilityState
|
|
101
|
+
}), [children, accessibilityLabel, accessibilityHint, accessibilityState]);
|
|
97
102
|
const accessibilityPropsForContent = useMemo(() => ({
|
|
98
103
|
accessibilityLabel: typeof content === 'string' && accessibilityLabelForContent === undefined ? content : accessibilityLabelForContent,
|
|
99
104
|
accessibilityHint: typeof content === 'string' && accessibilityHintForContent === undefined ? content : accessibilityHintForContent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.54.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -187,7 +187,6 @@
|
|
|
187
187
|
"lottie-react-native": "^6.7.0",
|
|
188
188
|
"react": "^18.3.1",
|
|
189
189
|
"react-native": "^0.74.5",
|
|
190
|
-
"react-native-date-picker": "^4.4.2",
|
|
191
190
|
"react-native-gesture-handler": "^2.16.2",
|
|
192
191
|
"react-native-inappbrowser-reborn": "^3.7.0",
|
|
193
192
|
"react-native-linear-gradient": "^2.8.3",
|
|
@@ -198,9 +197,9 @@
|
|
|
198
197
|
"react-native-svg": "^14.1.0"
|
|
199
198
|
},
|
|
200
199
|
"dependencies": {
|
|
201
|
-
"@coinbase/cds-common": "^8.
|
|
200
|
+
"@coinbase/cds-common": "^8.54.0",
|
|
202
201
|
"@coinbase/cds-icons": "^5.13.0",
|
|
203
|
-
"@coinbase/cds-illustrations": "^4.
|
|
202
|
+
"@coinbase/cds-illustrations": "^4.34.0",
|
|
204
203
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
205
204
|
"@coinbase/cds-utils": "^2.3.5",
|
|
206
205
|
"@floating-ui/react-native": "^0.10.5",
|
|
@@ -223,7 +222,6 @@
|
|
|
223
222
|
"eslint-plugin-reanimated": "^2.0.1",
|
|
224
223
|
"lottie-react-native": "6.7.0",
|
|
225
224
|
"react-native-accessibility-engine": "^3.2.0",
|
|
226
|
-
"react-native-date-picker": "4.4.2",
|
|
227
225
|
"react-native-gesture-handler": "2.16.2",
|
|
228
226
|
"react-native-inappbrowser-reborn": "3.7.0",
|
|
229
227
|
"react-native-linear-gradient": "2.8.3",
|