@coinbase/cds-mobile 8.28.1 → 8.29.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 +12 -0
- package/dts/alpha/combobox/Combobox.d.ts +73 -0
- package/dts/alpha/combobox/Combobox.d.ts.map +1 -0
- package/dts/alpha/combobox/DefaultComboboxControl.d.ts +20 -0
- package/dts/alpha/combobox/DefaultComboboxControl.d.ts.map +1 -0
- package/dts/alpha/select/DefaultSelectControl.d.ts +1 -0
- package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
- package/dts/alpha/select/types.d.ts +4 -1
- package/dts/alpha/select/types.d.ts.map +1 -1
- package/dts/overlays/drawer/Drawer.d.ts.map +1 -1
- package/dts/overlays/tray/Tray.d.ts +8 -0
- package/dts/overlays/tray/Tray.d.ts.map +1 -1
- package/dts/typography/index.d.ts +1 -1
- package/dts/typography/index.d.ts.map +1 -1
- package/esm/alpha/combobox/Combobox.js +194 -0
- package/esm/alpha/combobox/DefaultComboboxControl.js +80 -0
- package/esm/alpha/combobox/__stories__/Combobox.stories.js +1019 -0
- package/esm/alpha/select/DefaultSelectControl.js +25 -23
- package/esm/alpha/select/DefaultSelectDropdown.js +80 -75
- package/esm/alpha/select/__stories__/AlphaSelect.stories.js +24 -4
- package/esm/buttons/__stories__/SlideButton.stories.js +11 -6
- package/esm/carousel/__stories__/Carousel.stories.js +5 -4
- package/esm/overlays/drawer/Drawer.js +14 -3
- package/esm/overlays/tray/Tray.js +17 -5
- package/esm/typography/index.js +2 -2
- package/esm/visualizations/__stories__/ProgressCircle.stories.js +3 -3
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["type", "options", "value", "onChange", "open", "placeholder", "disabled", "setOpen", "variant", "helperText", "label", "labelVariant", "startNode", "endNode", "compact", "maxSelectedOptionsToShow", "accessibilityLabel", "accessibilityHint", "hiddenSelectedOptionsLabel", "removeSelectedOptionAccessibilityLabel", "style", "styles"];
|
|
1
|
+
const _excluded = ["type", "options", "value", "onChange", "open", "placeholder", "disabled", "setOpen", "variant", "helperText", "label", "labelVariant", "contentNode", "startNode", "endNode", "compact", "maxSelectedOptionsToShow", "accessibilityLabel", "accessibilityHint", "hiddenSelectedOptionsLabel", "removeSelectedOptionAccessibilityLabel", "style", "styles"];
|
|
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 { forwardRef, memo, useMemo } from 'react';
|
|
@@ -43,6 +43,7 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
43
43
|
helperText,
|
|
44
44
|
label,
|
|
45
45
|
labelVariant,
|
|
46
|
+
contentNode,
|
|
46
47
|
startNode,
|
|
47
48
|
endNode: customEndNode,
|
|
48
49
|
compact,
|
|
@@ -111,15 +112,13 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
111
112
|
onPress: () => setOpen(s => !s),
|
|
112
113
|
style: styles == null ? void 0 : styles.controlLabelNode,
|
|
113
114
|
children: /*#__PURE__*/_jsx(InputLabel, {
|
|
114
|
-
alignSelf: labelVariant === 'inside' ? 'flex-start' : undefined,
|
|
115
115
|
color: "fg",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
paddingY: shouldShowCompactLabel || labelVariant === 'inside' ? 0 : 0.5,
|
|
116
|
+
paddingEnd: 0,
|
|
117
|
+
paddingStart: labelVariant === 'inside' ? 2 : 0,
|
|
118
|
+
paddingY: labelVariant === 'inside' || compact ? 0 : 0.5,
|
|
120
119
|
children: label
|
|
121
120
|
})
|
|
122
|
-
}) : label, [disabled, label, labelVariant, setOpen,
|
|
121
|
+
}) : label, [compact, disabled, label, labelVariant, setOpen, styles == null ? void 0 : styles.controlLabelNode]);
|
|
123
122
|
const valueNode = useMemo(() => {
|
|
124
123
|
var _ref5, _ref6, _option$label2;
|
|
125
124
|
if (hasValue && isMultiSelect) {
|
|
@@ -135,7 +134,7 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
135
134
|
compact: true,
|
|
136
135
|
accessibilityLabel: removeSelectedOptionAccessibilityLabel + " " + accessibilityLabel,
|
|
137
136
|
borderWidth: 0,
|
|
138
|
-
disabled: option.disabled,
|
|
137
|
+
disabled: disabled || option.disabled,
|
|
139
138
|
invertColorScheme: false,
|
|
140
139
|
maxWidth: 200,
|
|
141
140
|
onPress: event => {
|
|
@@ -160,10 +159,10 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
160
159
|
color: hasValue ? 'fg' : 'fgMuted',
|
|
161
160
|
ellipsize: "tail",
|
|
162
161
|
font: "body",
|
|
163
|
-
textAlign:
|
|
162
|
+
textAlign: "left",
|
|
164
163
|
children: content
|
|
165
164
|
}) : content;
|
|
166
|
-
}, [hasValue, isMultiSelect, optionsMap, placeholder,
|
|
165
|
+
}, [hasValue, isMultiSelect, optionsMap, placeholder, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel, removeSelectedOptionAccessibilityLabel, disabled, onChange]);
|
|
167
166
|
const inputNode = useMemo(() => /*#__PURE__*/_jsx(TouchableOpacity, _extends({
|
|
168
167
|
ref: ref,
|
|
169
168
|
accessibilityHint: accessibilityHint,
|
|
@@ -180,7 +179,7 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
180
179
|
justifyContent: "space-between",
|
|
181
180
|
minHeight: labelVariant === 'inside' ? LABEL_VARIANT_INSIDE_HEIGHT : compact ? COMPACT_HEIGHT : DEFAULT_HEIGHT,
|
|
182
181
|
paddingStart: startNode ? 0 : 2,
|
|
183
|
-
paddingY: labelVariant === 'inside' ? 0 : compact ?
|
|
182
|
+
paddingY: labelVariant === 'inside' ? 0 : compact ? 1 : 1.5,
|
|
184
183
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
185
184
|
alignItems: "center",
|
|
186
185
|
flexGrow: 1,
|
|
@@ -191,30 +190,33 @@ export const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forw
|
|
|
191
190
|
children: startNode
|
|
192
191
|
}), shouldShowCompactLabel ? /*#__PURE__*/_jsx(HStack, {
|
|
193
192
|
alignItems: "center",
|
|
193
|
+
maxWidth: "40%",
|
|
194
194
|
paddingEnd: 1,
|
|
195
|
-
width: "40%",
|
|
196
195
|
children: labelNode
|
|
197
|
-
}) : null, /*#__PURE__*/
|
|
196
|
+
}) : null, /*#__PURE__*/_jsxs(VStack, {
|
|
198
197
|
justifyContent: "center",
|
|
199
|
-
maxWidth:
|
|
198
|
+
maxWidth: startNode ? '70%' : '85%',
|
|
200
199
|
style: styles == null ? void 0 : styles.controlValueNode,
|
|
201
|
-
children: valueNode
|
|
200
|
+
children: [valueNode, contentNode]
|
|
202
201
|
})]
|
|
203
202
|
})
|
|
204
203
|
})
|
|
205
|
-
})), [ref, accessibilityHint, accessibilityLabel, disabled, styles == null ? void 0 : styles.controlInputNode, styles == null ? void 0 : styles.controlStartNode, styles == null ? void 0 : styles.controlValueNode, props,
|
|
206
|
-
const endNode = useMemo(() => /*#__PURE__*/_jsx(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
204
|
+
})), [ref, accessibilityHint, accessibilityLabel, disabled, styles == null ? void 0 : styles.controlInputNode, styles == null ? void 0 : styles.controlStartNode, styles == null ? void 0 : styles.controlValueNode, props, labelVariant, compact, startNode, shouldShowCompactLabel, labelNode, valueNode, contentNode, setOpen]);
|
|
205
|
+
const endNode = useMemo(() => /*#__PURE__*/_jsx(Pressable, {
|
|
206
|
+
disabled: disabled,
|
|
207
|
+
onPress: () => setOpen(s => !s),
|
|
208
|
+
children: /*#__PURE__*/_jsx(HStack, {
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
flexGrow: 1,
|
|
211
|
+
paddingX: 2,
|
|
212
|
+
paddingY: compact ? 1 : 1.5,
|
|
213
|
+
style: styles == null ? void 0 : styles.controlEndNode,
|
|
212
214
|
children: customEndNode ? customEndNode : /*#__PURE__*/_jsx(AnimatedCaret, {
|
|
213
215
|
color: !open ? 'fg' : variant ? variantColor[variant] : 'fgPrimary',
|
|
214
216
|
rotate: open ? 0 : 180
|
|
215
217
|
})
|
|
216
218
|
})
|
|
217
|
-
}), [
|
|
219
|
+
}), [compact, styles == null ? void 0 : styles.controlEndNode, disabled, customEndNode, open, variant, setOpen]);
|
|
218
220
|
return /*#__PURE__*/_jsx(InputStack, _extends({
|
|
219
221
|
borderFocusedStyle: borderFocusedStyle,
|
|
220
222
|
borderStyle: borderUnfocusedStyle,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["type", "options", "value", "onChange", "open", "setOpen", "controlRef", "disabled", "style", "styles", "compact", "label", "end", "selectAllLabel", "emptyOptionsLabel", "clearAllLabel", "hideSelectAll", "accessory", "media", "SelectOptionComponent", "SelectAllOptionComponent", "SelectEmptyDropdownContentsComponent", "SelectOptionGroupComponent", "accessibilityRoles"],
|
|
1
|
+
const _excluded = ["type", "options", "value", "onChange", "onVisibilityChange", "open", "setOpen", "controlRef", "disabled", "style", "styles", "compact", "header", "footer", "label", "end", "selectAllLabel", "emptyOptionsLabel", "clearAllLabel", "hideSelectAll", "accessory", "media", "SelectOptionComponent", "SelectAllOptionComponent", "SelectEmptyDropdownContentsComponent", "SelectOptionGroupComponent", "accessibilityRoles"],
|
|
2
2
|
_excluded2 = ["Component", "media", "accessory", "end", "disabled"];
|
|
3
3
|
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); }
|
|
4
4
|
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; }
|
|
@@ -21,12 +21,15 @@ const DefaultSelectDropdownComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef
|
|
|
21
21
|
options,
|
|
22
22
|
value,
|
|
23
23
|
onChange,
|
|
24
|
+
onVisibilityChange,
|
|
24
25
|
open,
|
|
25
26
|
setOpen,
|
|
26
27
|
disabled,
|
|
27
28
|
style,
|
|
28
29
|
styles,
|
|
29
30
|
compact,
|
|
31
|
+
header,
|
|
32
|
+
footer,
|
|
30
33
|
label,
|
|
31
34
|
end,
|
|
32
35
|
selectAllLabel = 'Select all',
|
|
@@ -132,6 +135,7 @@ const DefaultSelectDropdownComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef
|
|
|
132
135
|
indeterminate: indeterminate,
|
|
133
136
|
label: selectAllLabel + " (" + flatOptionsForSelectAll.filter(o => o.value !== null).length + ")",
|
|
134
137
|
media: media != null ? media : /*#__PURE__*/_jsx(Checkbox, {
|
|
138
|
+
accessible: false,
|
|
135
139
|
checked: isAllOptionsSelected,
|
|
136
140
|
indeterminate: indeterminate,
|
|
137
141
|
onPress: toggleSelectAll,
|
|
@@ -148,87 +152,88 @@ const DefaultSelectDropdownComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef
|
|
|
148
152
|
return /*#__PURE__*/_jsx(Tray, {
|
|
149
153
|
ref: ref,
|
|
150
154
|
disableCapturePanGestureToDismiss: true,
|
|
155
|
+
footer: footer,
|
|
156
|
+
header: header,
|
|
151
157
|
onCloseComplete: () => setOpen(false),
|
|
152
158
|
onDismiss: () => setOpen(false),
|
|
159
|
+
onVisibilityChange: onVisibilityChange,
|
|
153
160
|
style: dropdownStyles,
|
|
154
161
|
title: label,
|
|
155
162
|
verticalDrawerPercentageOfView: 0.9,
|
|
156
|
-
children: /*#__PURE__*/_jsx(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
children:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
SelectOptionComponent: SelectOptionComponent,
|
|
168
|
-
accessibilityRole: accessibilityRoles == null ? void 0 : accessibilityRoles.option,
|
|
169
|
-
accessory: accessory,
|
|
170
|
-
compact: compact,
|
|
171
|
-
disabled: (_group$disabled = group.disabled) != null ? _group$disabled : disabled,
|
|
172
|
-
end: end,
|
|
173
|
-
label: group.label,
|
|
174
|
-
media: media,
|
|
175
|
-
onChange: onChange,
|
|
176
|
-
options: group.options,
|
|
177
|
-
setOpen: setOpen,
|
|
178
|
-
styles: optionGroupStyles,
|
|
179
|
-
type: type,
|
|
180
|
-
value: value
|
|
181
|
-
}, "group-" + group.label);
|
|
182
|
-
}
|
|
183
|
-
const option = optionOrGroup;
|
|
184
|
-
const {
|
|
185
|
-
Component: optionComponent,
|
|
186
|
-
media: optionMedia,
|
|
187
|
-
accessory: optionAccessory,
|
|
188
|
-
end: optionEnd,
|
|
189
|
-
disabled: optionDisabled
|
|
190
|
-
} = option,
|
|
191
|
-
optionProps = _objectWithoutPropertiesLoose(option, _excluded2);
|
|
192
|
-
const RenderedComponent = optionComponent != null ? optionComponent : SelectOptionComponent;
|
|
193
|
-
const selected = optionProps.value !== null && isMultiSelect ? value.includes(optionProps.value) : value === optionProps.value;
|
|
194
|
-
/** onPress handlers are passed so that when the media is pressed,
|
|
195
|
-
* the onChange handler is called. Since the <RenderedSelectOption>
|
|
196
|
-
* has an accessibilityRole, the inner media won't be detected by a screen reader
|
|
197
|
-
* so this behavior matches web
|
|
198
|
-
* */
|
|
199
|
-
const defaultMedia = isMultiSelect ? /*#__PURE__*/_jsx(Checkbox, {
|
|
200
|
-
"aria-hidden": true,
|
|
201
|
-
checked: selected,
|
|
202
|
-
onChange: () => handleOptionPress(optionProps.value),
|
|
203
|
-
tabIndex: -1,
|
|
204
|
-
value: (_optionProps$value = optionProps.value) == null ? void 0 : _optionProps$value.toString()
|
|
205
|
-
}) : /*#__PURE__*/_jsx(Radio, {
|
|
206
|
-
"aria-hidden": true,
|
|
207
|
-
checked: selected,
|
|
208
|
-
onChange: () => handleOptionPress(optionProps.value),
|
|
209
|
-
tabIndex: -1,
|
|
210
|
-
value: (_optionProps$value2 = optionProps.value) == null ? void 0 : _optionProps$value2.toString()
|
|
211
|
-
});
|
|
212
|
-
return /*#__PURE__*/_jsx(RenderedComponent, _extends({
|
|
163
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
164
|
+
showsVerticalScrollIndicator: true,
|
|
165
|
+
children: /*#__PURE__*/_jsxs(VStack, _extends({}, props, {
|
|
166
|
+
children: [!hideSelectAll && isMultiSelect && options.length > 0 && SelectAllOption, options.length > 0 ? options.map(optionOrGroup => {
|
|
167
|
+
var _optionProps$value, _optionProps$value2, _ref3;
|
|
168
|
+
// Check if it's a group (has 'options' property and 'label')
|
|
169
|
+
if (isSelectOptionGroup(optionOrGroup)) {
|
|
170
|
+
var _group$disabled;
|
|
171
|
+
const group = optionOrGroup;
|
|
172
|
+
return /*#__PURE__*/_jsx(SelectOptionGroupComponent, {
|
|
173
|
+
SelectOptionComponent: SelectOptionComponent,
|
|
213
174
|
accessibilityRole: accessibilityRoles == null ? void 0 : accessibilityRoles.option,
|
|
214
|
-
accessory:
|
|
215
|
-
blendStyles: styles == null ? void 0 : styles.optionBlendStyles,
|
|
175
|
+
accessory: accessory,
|
|
216
176
|
compact: compact,
|
|
217
|
-
disabled:
|
|
218
|
-
end:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
label
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
177
|
+
disabled: (_group$disabled = group.disabled) != null ? _group$disabled : disabled,
|
|
178
|
+
end: end,
|
|
179
|
+
label: group.label,
|
|
180
|
+
media: media,
|
|
181
|
+
onChange: onChange,
|
|
182
|
+
options: group.options,
|
|
183
|
+
setOpen: setOpen,
|
|
184
|
+
styles: optionGroupStyles,
|
|
185
|
+
type: type,
|
|
186
|
+
value: value
|
|
187
|
+
}, "group-" + group.label);
|
|
188
|
+
}
|
|
189
|
+
const option = optionOrGroup;
|
|
190
|
+
const {
|
|
191
|
+
Component: optionComponent,
|
|
192
|
+
media: optionMedia,
|
|
193
|
+
accessory: optionAccessory,
|
|
194
|
+
end: optionEnd,
|
|
195
|
+
disabled: optionDisabled
|
|
196
|
+
} = option,
|
|
197
|
+
optionProps = _objectWithoutPropertiesLoose(option, _excluded2);
|
|
198
|
+
const RenderedComponent = optionComponent != null ? optionComponent : SelectOptionComponent;
|
|
199
|
+
const selected = optionProps.value !== null && isMultiSelect ? value.includes(optionProps.value) : value === optionProps.value;
|
|
200
|
+
/** onPress handlers are passed so that when the media is pressed,
|
|
201
|
+
* the onChange handler is called. Since the <RenderedSelectOption>
|
|
202
|
+
* has an accessibilityRole, the inner media won't be detected by a screen reader
|
|
203
|
+
* so this behavior matches web
|
|
204
|
+
* */
|
|
205
|
+
const defaultMedia = isMultiSelect ? /*#__PURE__*/_jsx(Checkbox, {
|
|
206
|
+
"aria-hidden": true,
|
|
207
|
+
checked: selected,
|
|
208
|
+
onChange: () => handleOptionPress(optionProps.value),
|
|
209
|
+
tabIndex: -1,
|
|
210
|
+
value: (_optionProps$value = optionProps.value) == null ? void 0 : _optionProps$value.toString()
|
|
211
|
+
}) : /*#__PURE__*/_jsx(Radio, {
|
|
212
|
+
"aria-hidden": true,
|
|
213
|
+
checked: selected,
|
|
214
|
+
onChange: () => handleOptionPress(optionProps.value),
|
|
215
|
+
tabIndex: -1,
|
|
216
|
+
value: (_optionProps$value2 = optionProps.value) == null ? void 0 : _optionProps$value2.toString()
|
|
217
|
+
});
|
|
218
|
+
return /*#__PURE__*/_jsx(RenderedComponent, _extends({
|
|
219
|
+
accessibilityRole: accessibilityRoles == null ? void 0 : accessibilityRoles.option,
|
|
220
|
+
accessory: optionAccessory != null ? optionAccessory : accessory,
|
|
221
|
+
blendStyles: styles == null ? void 0 : styles.optionBlendStyles,
|
|
222
|
+
compact: compact,
|
|
223
|
+
disabled: optionDisabled || disabled,
|
|
224
|
+
end: optionEnd != null ? optionEnd : end,
|
|
225
|
+
media: (_ref3 = optionMedia != null ? optionMedia : media) != null ? _ref3 : defaultMedia,
|
|
226
|
+
onPress: handleOptionPress,
|
|
227
|
+
selected: selected,
|
|
228
|
+
style: styles == null ? void 0 : styles.option,
|
|
229
|
+
styles: optionStyles,
|
|
230
|
+
type: type
|
|
231
|
+
}, optionProps), optionProps.value);
|
|
232
|
+
}) : /*#__PURE__*/_jsx(SelectEmptyDropdownContentsComponent, {
|
|
233
|
+
label: emptyOptionsLabel,
|
|
234
|
+
styles: emptyDropdownContentsStyles
|
|
235
|
+
})]
|
|
236
|
+
}))
|
|
232
237
|
})
|
|
233
238
|
});
|
|
234
239
|
}));
|
|
@@ -324,10 +324,10 @@ const CompactExample = () => {
|
|
|
324
324
|
value: value
|
|
325
325
|
});
|
|
326
326
|
};
|
|
327
|
-
const
|
|
327
|
+
const InsideLabelVariantExample = () => {
|
|
328
328
|
const [value, setValue] = useState('1');
|
|
329
329
|
return /*#__PURE__*/_jsx(Select, {
|
|
330
|
-
label: "
|
|
330
|
+
label: "Inside label variant",
|
|
331
331
|
labelVariant: "inside",
|
|
332
332
|
onChange: setValue,
|
|
333
333
|
options: exampleOptions,
|
|
@@ -720,6 +720,23 @@ const MultiSelectCompactExample = () => {
|
|
|
720
720
|
value: value
|
|
721
721
|
});
|
|
722
722
|
};
|
|
723
|
+
const MultiSelectInsideLabelVariantExample = () => {
|
|
724
|
+
const {
|
|
725
|
+
value,
|
|
726
|
+
onChange
|
|
727
|
+
} = useMultiSelect({
|
|
728
|
+
initialValue: ['1']
|
|
729
|
+
});
|
|
730
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
731
|
+
label: "Multi select - inside label variant",
|
|
732
|
+
labelVariant: "inside",
|
|
733
|
+
onChange: onChange,
|
|
734
|
+
options: exampleOptions,
|
|
735
|
+
placeholder: "Empty value",
|
|
736
|
+
type: "multi",
|
|
737
|
+
value: value
|
|
738
|
+
});
|
|
739
|
+
};
|
|
723
740
|
const MultiSelectHideSelectAllExample = () => {
|
|
724
741
|
const {
|
|
725
742
|
value,
|
|
@@ -1186,8 +1203,8 @@ const SelectV3Screen = () => {
|
|
|
1186
1203
|
title: "Compact",
|
|
1187
1204
|
children: /*#__PURE__*/_jsx(CompactExample, {})
|
|
1188
1205
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1189
|
-
title: "
|
|
1190
|
-
children: /*#__PURE__*/_jsx(
|
|
1206
|
+
title: "Compact with inside label variant",
|
|
1207
|
+
children: /*#__PURE__*/_jsx(InsideLabelVariantExample, {})
|
|
1191
1208
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1192
1209
|
title: "With Helper Text",
|
|
1193
1210
|
children: /*#__PURE__*/_jsx(WithHelperTextExample, {})
|
|
@@ -1269,6 +1286,9 @@ const SelectV3Screen = () => {
|
|
|
1269
1286
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1270
1287
|
title: "Multi Select Compact",
|
|
1271
1288
|
children: /*#__PURE__*/_jsx(MultiSelectCompactExample, {})
|
|
1289
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
1290
|
+
title: "Multi Select Inside Label Variant",
|
|
1291
|
+
children: /*#__PURE__*/_jsx(MultiSelectInsideLabelVariantExample, {})
|
|
1272
1292
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1273
1293
|
title: "Multi Select Hide Select All",
|
|
1274
1294
|
children: /*#__PURE__*/_jsx(MultiSelectHideSelectAllExample, {})
|
|
@@ -9,7 +9,7 @@ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
|
9
9
|
import { Icon } from '../../icons';
|
|
10
10
|
import { HStack, VStack } from '../../layout';
|
|
11
11
|
import { Pressable } from '../../system';
|
|
12
|
-
import {
|
|
12
|
+
import { Text } from '../../typography';
|
|
13
13
|
import { SlideButton } from '../SlideButton';
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const SlideButtonExample = _ref => {
|
|
@@ -28,7 +28,8 @@ const SlideButtonExample = _ref => {
|
|
|
28
28
|
gap: 1,
|
|
29
29
|
justifyContent: "flex-end",
|
|
30
30
|
paddingBottom: 2,
|
|
31
|
-
children: [/*#__PURE__*/_jsx(
|
|
31
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
32
|
+
font: "label1",
|
|
32
33
|
children: "Reset"
|
|
33
34
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
34
35
|
compact: true,
|
|
@@ -64,7 +65,8 @@ const CustomHandle = _ref2 => {
|
|
|
64
65
|
height: "100%",
|
|
65
66
|
padding: 2,
|
|
66
67
|
pin: "right",
|
|
67
|
-
children: /*#__PURE__*/_jsx(
|
|
68
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
69
|
+
font: "label1",
|
|
68
70
|
children: "\u27A1\uFE0F"
|
|
69
71
|
})
|
|
70
72
|
})
|
|
@@ -85,7 +87,8 @@ const CustomBackground = _ref3 => {
|
|
|
85
87
|
height: "100%",
|
|
86
88
|
justifyContent: "center",
|
|
87
89
|
width: "100%",
|
|
88
|
-
children: /*#__PURE__*/_jsx(
|
|
90
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
91
|
+
font: "headline",
|
|
89
92
|
children: "Slide me"
|
|
90
93
|
})
|
|
91
94
|
}));
|
|
@@ -132,11 +135,13 @@ export const SlideButtonStories = () => {
|
|
|
132
135
|
}), /*#__PURE__*/_jsx(Example, {
|
|
133
136
|
title: "Labels as nodes",
|
|
134
137
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
135
|
-
checkedLabel: /*#__PURE__*/_jsx(
|
|
138
|
+
checkedLabel: /*#__PURE__*/_jsx(Text, {
|
|
136
139
|
color: "fgInverse",
|
|
140
|
+
font: "label2",
|
|
137
141
|
children: "Node checked label"
|
|
138
142
|
}),
|
|
139
|
-
uncheckedLabel: /*#__PURE__*/_jsx(
|
|
143
|
+
uncheckedLabel: /*#__PURE__*/_jsx(Text, {
|
|
144
|
+
font: "label2",
|
|
140
145
|
children: "Node label"
|
|
141
146
|
})
|
|
142
147
|
})
|
|
@@ -14,8 +14,7 @@ import { useTheme } from '../../hooks/useTheme';
|
|
|
14
14
|
import { Box, HStack, VStack } from '../../layout';
|
|
15
15
|
import { RemoteImage } from '../../media';
|
|
16
16
|
import { Pressable } from '../../system/Pressable';
|
|
17
|
-
import { Link,
|
|
18
|
-
import { Text } from '../../typography/Text';
|
|
17
|
+
import { Link, Text } from '../../typography';
|
|
19
18
|
import { Carousel } from '../Carousel';
|
|
20
19
|
import { CarouselItem } from '../CarouselItem';
|
|
21
20
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -92,7 +91,8 @@ const sampleItems = [/*#__PURE__*/_jsx(SampleCard, {
|
|
|
92
91
|
}, "9"), /*#__PURE__*/_jsx(SampleCard, {
|
|
93
92
|
text: "Slide 10"
|
|
94
93
|
}, "10")];
|
|
95
|
-
const SeeAllComponent = () => /*#__PURE__*/_jsx(
|
|
94
|
+
const SeeAllComponent = () => /*#__PURE__*/_jsx(Text, {
|
|
95
|
+
font: "headline",
|
|
96
96
|
children: /*#__PURE__*/_jsx(Link, {
|
|
97
97
|
to: "https://coinbase.com/",
|
|
98
98
|
children: "See all"
|
|
@@ -459,8 +459,9 @@ const AnimatedExample = () => {
|
|
|
459
459
|
return /*#__PURE__*/_jsx(Animated.View, {
|
|
460
460
|
style: animatedStyle,
|
|
461
461
|
children: /*#__PURE__*/_jsx(ContainedAssetCard, {
|
|
462
|
-
description: /*#__PURE__*/_jsx(
|
|
462
|
+
description: /*#__PURE__*/_jsx(Text, {
|
|
463
463
|
color: "fgPositive",
|
|
464
|
+
font: "label2",
|
|
464
465
|
numberOfLines: 2,
|
|
465
466
|
children: "\u21976.37%"
|
|
466
467
|
}),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const _excluded = ["children", "pin", "onCloseComplete", "preventDismissGestures", "preventHardwareBackBehaviorAndroid", "hideHandleBar", "disableCapturePanGestureToDismiss", "onBlur", "verticalDrawerPercentageOfView", "handleBarAccessibilityLabel"];
|
|
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, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
5
|
-
import { Animated, Modal, Platform, StyleSheet, useWindowDimensions } from 'react-native';
|
|
4
|
+
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Animated, Keyboard, Modal, Platform, StyleSheet, useWindowDimensions } from 'react-native';
|
|
6
6
|
import { drawerAnimationDefaultDuration, MAX_OVER_DRAG } from '@coinbase/cds-common/animation/drawer';
|
|
7
7
|
import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext';
|
|
8
8
|
import { horizontalDrawerPercentageOfView, verticalDrawerPercentageOfView as defaultVerticalDrawerPercentageOfView } from '@coinbase/cds-common/tokens/drawer';
|
|
@@ -103,8 +103,19 @@ export const Drawer = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Drawer(
|
|
|
103
103
|
|
|
104
104
|
// leave 15% of the screenwidth as open area for menu drawer
|
|
105
105
|
const horizontalDrawerWidth = useMemo(() => width * horizontalDrawerPercentageOfView + MAX_OVER_DRAG, [width]);
|
|
106
|
+
const [keyboardInset, setKeyboardInset] = useState(0);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (Platform.OS !== 'android') return;
|
|
109
|
+
const show = Keyboard.addListener('keyboardDidShow', e => setKeyboardInset(e.endCoordinates.height));
|
|
110
|
+
const hide = Keyboard.addListener('keyboardDidHide', () => setKeyboardInset(0));
|
|
111
|
+
return () => {
|
|
112
|
+
show.remove();
|
|
113
|
+
hide.remove();
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
106
117
|
// drawer will automatically size itself based on content, but will cap at 75% of viewport height (can override)
|
|
107
|
-
const verticalDrawerMaxHeight = useMemo(() => height * verticalDrawerPercentageOfView + MAX_OVER_DRAG, [height, verticalDrawerPercentageOfView]);
|
|
118
|
+
const verticalDrawerMaxHeight = useMemo(() => height * verticalDrawerPercentageOfView + MAX_OVER_DRAG - keyboardInset, [height, verticalDrawerPercentageOfView, keyboardInset]);
|
|
108
119
|
const getPanGestureHandlers = !preventDismissGestures ? panGestureHandlers.panHandlers : undefined;
|
|
109
120
|
const handleOverlayPress = useCallback(() => {
|
|
110
121
|
if (!preventDismissGestures) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["children", "title", "onVisibilityChange", "verticalDrawerPercentageOfView"];
|
|
1
|
+
const _excluded = ["children", "header", "footer", "title", "onVisibilityChange", "verticalDrawerPercentageOfView"];
|
|
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, { createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
@@ -16,6 +16,8 @@ export const TrayContext = /*#__PURE__*/createContext({
|
|
|
16
16
|
export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref, ref) {
|
|
17
17
|
let {
|
|
18
18
|
children,
|
|
19
|
+
header,
|
|
20
|
+
footer,
|
|
19
21
|
title,
|
|
20
22
|
onVisibilityChange,
|
|
21
23
|
verticalDrawerPercentageOfView = defaultVerticalDrawerPercentageOfView
|
|
@@ -30,7 +32,13 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
30
32
|
let {
|
|
31
33
|
handleClose
|
|
32
34
|
} = _ref2;
|
|
35
|
+
const content = typeof children === 'function' ? children({
|
|
36
|
+
handleClose
|
|
37
|
+
}) : children;
|
|
33
38
|
return /*#__PURE__*/_jsxs(VStack, {
|
|
39
|
+
flexGrow: 1,
|
|
40
|
+
flexShrink: 1,
|
|
41
|
+
minHeight: 0,
|
|
34
42
|
paddingTop: title ? 0 : 2,
|
|
35
43
|
children: [title && (typeof title === 'string' ? /*#__PURE__*/_jsx(HStack, {
|
|
36
44
|
alignItems: "center",
|
|
@@ -45,11 +53,15 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
|
|
|
45
53
|
}) : /*#__PURE__*/_jsx(Box, {
|
|
46
54
|
onLayout: onTitleLayout,
|
|
47
55
|
children: title
|
|
48
|
-
})),
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
})), header, /*#__PURE__*/_jsx(Box, {
|
|
57
|
+
flexGrow: 1,
|
|
58
|
+
flexShrink: 1,
|
|
59
|
+
minHeight: 0,
|
|
60
|
+
width: "100%",
|
|
61
|
+
children: content
|
|
62
|
+
}), footer]
|
|
51
63
|
});
|
|
52
|
-
}, [children, onTitleLayout, title]);
|
|
64
|
+
}, [children, footer, header, onTitleLayout, title]);
|
|
53
65
|
useEffect(() => {
|
|
54
66
|
onVisibilityChange == null || onVisibilityChange('visible');
|
|
55
67
|
return () => {
|
package/esm/typography/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Link';
|
|
2
|
+
export * from './Text';
|
|
2
3
|
export * from './TextBody';
|
|
3
4
|
export * from './TextCaption';
|
|
4
5
|
export * from './TextDisplay1';
|
|
@@ -11,5 +12,4 @@ export * from './TextLegal';
|
|
|
11
12
|
export * from './TextTitle1';
|
|
12
13
|
export * from './TextTitle2';
|
|
13
14
|
export * from './TextTitle3';
|
|
14
|
-
export * from './TextTitle4';
|
|
15
|
-
export {};
|
|
15
|
+
export * from './TextTitle4';
|
|
@@ -8,8 +8,7 @@ import { Icon } from '../../icons';
|
|
|
8
8
|
import { Box, HStack, VStack } from '../../layout';
|
|
9
9
|
import { RemoteImage } from '../../media';
|
|
10
10
|
import { defaultTheme } from '../../themes/defaultTheme';
|
|
11
|
-
import {
|
|
12
|
-
import { Text } from '../../typography/Text';
|
|
11
|
+
import { Text } from '../../typography';
|
|
13
12
|
import { theme } from '../../utils/testHelpers';
|
|
14
13
|
import { DefaultProgressCircleContent } from '../DefaultProgressCircleContent';
|
|
15
14
|
import { ProgressCircle } from '../ProgressCircle';
|
|
@@ -22,8 +21,9 @@ const CustomStyles = () => {
|
|
|
22
21
|
children: [/*#__PURE__*/_jsxs(HStack, {
|
|
23
22
|
gap: 2,
|
|
24
23
|
children: [/*#__PURE__*/_jsx(ProgressCircle, {
|
|
25
|
-
contentNode: /*#__PURE__*/_jsx(
|
|
24
|
+
contentNode: /*#__PURE__*/_jsx(Text, {
|
|
26
25
|
color: disabled ? 'fgMuted' : 'fgPrimary',
|
|
26
|
+
font: "title1",
|
|
27
27
|
children: "40%"
|
|
28
28
|
}),
|
|
29
29
|
disabled: disabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.29.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.29.0",
|
|
158
158
|
"@coinbase/cds-icons": "^5.8.0",
|
|
159
159
|
"@coinbase/cds-illustrations": "^4.29.0",
|
|
160
160
|
"@coinbase/cds-lottie-files": "^3.3.3",
|