@coinbase/cds-mobile 8.23.0 → 8.24.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 +6 -0
- package/dts/controls/TextInput.d.ts +10 -0
- package/dts/controls/TextInput.d.ts.map +1 -1
- package/esm/controls/TextInput.js +5 -4
- package/esm/controls/__stories__/TextInput.stories.js +24 -0
- package/esm/dates/__stories__/DateInput.stories.js +19 -0
- package/esm/dates/__stories__/DatePicker.stories.js +23 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 8.24.0 (12/1/2025 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Support labelNode in TextInput. [[#198](https://github.com/coinbase/cds/pull/198)]
|
|
16
|
+
|
|
11
17
|
## 8.23.0 ((12/1/2025, 06:33 AM PST))
|
|
12
18
|
|
|
13
19
|
This is an artificial version bump with no new change.
|
|
@@ -51,6 +51,11 @@ export type TextInputBaseProps = SharedProps &
|
|
|
51
51
|
* @default 'error'
|
|
52
52
|
*/
|
|
53
53
|
helperTextErrorIconAccessibilityLabel?: string;
|
|
54
|
+
/**
|
|
55
|
+
* React node to render label. Takes precedence over `label`.
|
|
56
|
+
* @note if both labelNode and label are provided, label will still be used as accessibility label for the input if no accessibilityLabel is provided.
|
|
57
|
+
*/
|
|
58
|
+
labelNode?: React.ReactNode;
|
|
54
59
|
};
|
|
55
60
|
export type TextInputProps = TextInputBaseProps &
|
|
56
61
|
Omit<RNTextInputProps, 'value' | 'onChange' | 'onChangeText' | 'textAlign'> & {
|
|
@@ -118,6 +123,11 @@ export declare const TextInput: React.MemoExoticComponent<
|
|
|
118
123
|
* @default 'error'
|
|
119
124
|
*/
|
|
120
125
|
helperTextErrorIconAccessibilityLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* React node to render label. Takes precedence over `label`.
|
|
128
|
+
* @note if both labelNode and label are provided, label will still be used as accessibility label for the input if no accessibilityLabel is provided.
|
|
129
|
+
*/
|
|
130
|
+
labelNode?: React.ReactNode;
|
|
121
131
|
} & Omit<RNTextInputProps, 'value' | 'textAlign' | 'onChange' | 'onChangeText'> & {
|
|
122
132
|
value?: RNTextInputProps['value'];
|
|
123
133
|
onChange?: RNTextInputProps['onChange'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/controls/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAEV,SAAS,IAAI,WAAW,EAExB,cAAc,IAAI,gBAAgB,EAEnC,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EACV,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAcjF,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAC1C,IAAI,CACF,wBAAwB,EACxB,oBAAoB,GAAG,yBAAyB,GAAG,mBAAmB,CACvE,GACD,gBAAgB,GAChB,IAAI,CACF,mBAAmB,EACjB,QAAQ,GACR,SAAS,GACT,OAAO,GACP,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,cAAc,CACjB,GAAG;IACF;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uHAAuH;IACvH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,mHAAmH;IACnH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF;;;OAGG;IACH,qCAAqC,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/controls/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAEV,SAAS,IAAI,WAAW,EAExB,cAAc,IAAI,gBAAgB,EAEnC,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EACV,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAcjF,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAC1C,IAAI,CACF,wBAAwB,EACxB,oBAAoB,GAAG,yBAAyB,GAAG,mBAAmB,CACvE,GACD,gBAAgB,GAChB,IAAI,CACF,mBAAmB,EACjB,QAAQ,GACR,SAAS,GACT,OAAO,GACP,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,cAAc,CACjB,GAAG;IACF;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uHAAuH;IACvH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,mHAAmH;IACnH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,C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AC/C;;;OAGG;gBACS,cAAc;IAC1B;;;OAGG;gBACS,gBAAgB,CAAC,WAAW,CAAC,GAAG,OAAO;IACnD;;;OAGG;eACQ,OAAO;sCA8OrB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["label", "helperText", "variant", "testID", "testIDMap", "start", "end", "width", "disabled", "align", "compact", "suffix", "accessibilityLabel", "borderRadius", "enableColorSurge", "helperTextErrorIconAccessibilityLabel", "bordered", "labelVariant"];
|
|
1
|
+
const _excluded = ["label", "helperText", "variant", "testID", "testIDMap", "start", "end", "width", "disabled", "align", "compact", "suffix", "accessibilityLabel", "borderRadius", "enableColorSurge", "helperTextErrorIconAccessibilityLabel", "bordered", "labelVariant", "labelNode"];
|
|
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, { cloneElement, forwardRef, isValidElement, memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
@@ -45,7 +45,8 @@ export const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
45
45
|
enableColorSurge = false,
|
|
46
46
|
helperTextErrorIconAccessibilityLabel = 'error',
|
|
47
47
|
bordered = true,
|
|
48
|
-
labelVariant = 'outside'
|
|
48
|
+
labelVariant = 'outside',
|
|
49
|
+
labelNode
|
|
49
50
|
} = _ref,
|
|
50
51
|
editableInputProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
51
52
|
const theme = useTheme();
|
|
@@ -155,7 +156,7 @@ export const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
155
156
|
disabled: disabled,
|
|
156
157
|
testID: testID
|
|
157
158
|
}, editableInputAddonProps)),
|
|
158
|
-
labelNode: !compact && !!label && /*#__PURE__*/_jsx(Pressable, {
|
|
159
|
+
labelNode: !compact && (labelNode ? labelNode : !!label && /*#__PURE__*/_jsx(Pressable, {
|
|
159
160
|
accessibilityRole: "button",
|
|
160
161
|
disabled: disabled,
|
|
161
162
|
onPress: handleNodePress,
|
|
@@ -169,7 +170,7 @@ export const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
169
170
|
testID: (_testIDMap$label = testIDMap == null ? void 0 : testIDMap.label) != null ? _testIDMap$label : '',
|
|
170
171
|
children: label
|
|
171
172
|
}))
|
|
172
|
-
}),
|
|
173
|
+
})),
|
|
173
174
|
labelVariant: labelVariant,
|
|
174
175
|
startNode: (compact && !!label || !!start) && /*#__PURE__*/_jsx(Box, {
|
|
175
176
|
alignItems: "center",
|
|
@@ -8,9 +8,11 @@ import { Icon } from '../../icons';
|
|
|
8
8
|
import { Box } from '../../layout/Box';
|
|
9
9
|
import { HStack } from '../../layout/HStack';
|
|
10
10
|
import { VStack } from '../../layout/VStack';
|
|
11
|
+
import { Tooltip } from '../../overlays/tooltip/Tooltip';
|
|
11
12
|
import { Text } from '../../typography/Text';
|
|
12
13
|
import { InputIcon } from '../InputIcon';
|
|
13
14
|
import { InputIconButton } from '../InputIconButton';
|
|
15
|
+
import { InputLabel } from '../InputLabel';
|
|
14
16
|
import { TextInput } from '../TextInput';
|
|
15
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
const MockTextInput = _ref => {
|
|
@@ -537,6 +539,28 @@ const InputScreen = () => {
|
|
|
537
539
|
placeholder: "Enter your favorite color",
|
|
538
540
|
variant: "negative"
|
|
539
541
|
})
|
|
542
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
543
|
+
inline: true,
|
|
544
|
+
title: "TextInput with labelNode",
|
|
545
|
+
children: /*#__PURE__*/_jsx(MockTextInput, {
|
|
546
|
+
label: "Display name",
|
|
547
|
+
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
548
|
+
alignItems: "center",
|
|
549
|
+
gap: 1,
|
|
550
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
551
|
+
children: "Display name"
|
|
552
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
553
|
+
content: "This will be visible to other users.",
|
|
554
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
555
|
+
active: true,
|
|
556
|
+
color: "fg",
|
|
557
|
+
name: "info",
|
|
558
|
+
size: "xs"
|
|
559
|
+
})
|
|
560
|
+
})]
|
|
561
|
+
}),
|
|
562
|
+
placeholder: "Satoshi Nakamoto"
|
|
563
|
+
})
|
|
540
564
|
})]
|
|
541
565
|
});
|
|
542
566
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { LocaleProvider } from '@coinbase/cds-common/system/LocaleProvider';
|
|
4
|
+
import { InputLabel } from '../../controls/InputLabel';
|
|
4
5
|
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
5
6
|
import { Icon } from '../../icons';
|
|
7
|
+
import { HStack } from '../../layout';
|
|
6
8
|
import { Group } from '../../layout/Group';
|
|
9
|
+
import { Tooltip } from '../../overlays';
|
|
7
10
|
import { ThemeProvider } from '../../system/ThemeProvider';
|
|
8
11
|
import { defaultTheme } from '../../themes/defaultTheme';
|
|
9
12
|
import { DateInput } from '../DateInput';
|
|
@@ -43,6 +46,22 @@ export const Examples = () => {
|
|
|
43
46
|
minDate: oneDayAgo
|
|
44
47
|
})), /*#__PURE__*/_jsx(DateInput, _extends({}, sharedProps, props, {
|
|
45
48
|
separator: "-"
|
|
49
|
+
})), /*#__PURE__*/_jsx(DateInput, _extends({}, sharedProps, props, {
|
|
50
|
+
label: "Date of birth",
|
|
51
|
+
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
gap: 1,
|
|
54
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
55
|
+
children: "Date of birth"
|
|
56
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
57
|
+
content: "This will be visible to other users.",
|
|
58
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
59
|
+
color: "fgMuted",
|
|
60
|
+
name: "info",
|
|
61
|
+
size: "xs"
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
64
|
+
})
|
|
46
65
|
})), /*#__PURE__*/_jsx(DateInput, _extends({}, sharedProps, props, {
|
|
47
66
|
end: /*#__PURE__*/_jsx(Icon, {
|
|
48
67
|
active: true,
|
|
@@ -1,8 +1,11 @@
|
|
|
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
2
|
import { useState } from 'react';
|
|
3
|
+
import { InputLabel } from '../../controls/InputLabel';
|
|
3
4
|
import { TextInput } from '../../controls/TextInput';
|
|
4
5
|
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
6
|
+
import { Icon } from '../../icons';
|
|
5
7
|
import { HStack } from '../../layout';
|
|
8
|
+
import { Tooltip } from '../../overlays/tooltip/Tooltip';
|
|
6
9
|
import { DatePicker } from '../DatePicker';
|
|
7
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
11
|
const today = new Date(new Date(2024, 7, 18).setHours(0, 0, 0, 0));
|
|
@@ -76,6 +79,26 @@ export const FullExample = () => {
|
|
|
76
79
|
width: "auto"
|
|
77
80
|
})]
|
|
78
81
|
})
|
|
82
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
83
|
+
title: "DatePicker with labelNode",
|
|
84
|
+
children: /*#__PURE__*/_jsx(ExampleDatePicker, {
|
|
85
|
+
calendarIconButtonAccessibilityLabel: "Birthdate calendar",
|
|
86
|
+
label: "Birthdate",
|
|
87
|
+
labelNode: /*#__PURE__*/_jsxs(HStack, {
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: 1,
|
|
90
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
91
|
+
children: "Birthdate"
|
|
92
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
93
|
+
content: "This will be visible to other users.",
|
|
94
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
95
|
+
color: "fgMuted",
|
|
96
|
+
name: "info",
|
|
97
|
+
size: "xs"
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
79
102
|
}), /*#__PURE__*/_jsx(Example, {
|
|
80
103
|
title: "DatePicker fit-content width",
|
|
81
104
|
children: /*#__PURE__*/_jsxs(HStack, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.24.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"react-native-svg": "^14.1.0"
|
|
155
155
|
},
|
|
156
156
|
"dependencies": {
|
|
157
|
-
"@coinbase/cds-common": "^8.
|
|
157
|
+
"@coinbase/cds-common": "^8.24.0",
|
|
158
158
|
"@coinbase/cds-icons": "^5.7.0",
|
|
159
159
|
"@coinbase/cds-illustrations": "^4.28.0",
|
|
160
160
|
"@coinbase/cds-lottie-files": "^3.3.3",
|