@coinbase/cds-mobile 9.9.0 → 9.10.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/alpha/combobox/Combobox.d.ts.map +1 -1
- 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/Select.d.ts +1 -0
- package/dts/alpha/select/Select.d.ts.map +1 -1
- package/dts/alpha/select/types.d.ts +27 -2
- package/dts/alpha/select/types.d.ts.map +1 -1
- package/dts/alpha/select-chip/SelectChip.d.ts +8 -2
- package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -1
- package/dts/alpha/select-chip/SelectChipControl.d.ts +3 -4
- package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts +8 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts.map +1 -1
- package/dts/buttons/AvatarButton.d.ts +7 -3
- package/dts/buttons/AvatarButton.d.ts.map +1 -1
- package/dts/buttons/Button.d.ts +21 -2
- package/dts/buttons/Button.d.ts.map +1 -1
- package/dts/buttons/DefaultSlideButtonBackground.d.ts +2 -2
- package/dts/buttons/DefaultSlideButtonBackground.d.ts.map +1 -1
- package/dts/buttons/DefaultSlideButtonHandle.d.ts +20 -10
- package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
- package/dts/buttons/IconButton.d.ts +18 -5
- package/dts/buttons/IconButton.d.ts.map +1 -1
- package/dts/buttons/SlideButton.d.ts +47 -9
- package/dts/buttons/SlideButton.d.ts.map +1 -1
- package/dts/cards/CardBody.d.ts.map +1 -1
- package/dts/cards/FeedCard.d.ts.map +1 -1
- package/dts/cards/NudgeCard.d.ts +1 -1
- package/dts/cards/UpsellCard.d.ts +1 -1
- package/dts/carousel/DefaultCarouselNavigation.d.ts +8 -0
- package/dts/carousel/DefaultCarouselNavigation.d.ts.map +1 -1
- package/dts/chips/Chip.d.ts +3 -2
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/ChipProps.d.ts +11 -1
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/MediaChip.d.ts +1 -0
- package/dts/chips/MediaChip.d.ts.map +1 -1
- package/dts/controls/InputIcon.d.ts +6 -0
- package/dts/controls/InputIcon.d.ts.map +1 -1
- package/dts/controls/InputIconButton.d.ts +3 -1
- package/dts/controls/InputIconButton.d.ts.map +1 -1
- package/dts/controls/InputStack.d.ts.map +1 -1
- package/dts/controls/NativeInput.d.ts +7 -2
- package/dts/controls/NativeInput.d.ts.map +1 -1
- package/dts/controls/SearchInput.d.ts +4 -1
- package/dts/controls/SearchInput.d.ts.map +1 -1
- package/dts/controls/TextInput.d.ts +24 -2
- package/dts/controls/TextInput.d.ts.map +1 -1
- package/dts/dates/DateInput.d.ts +18 -3
- package/dts/dates/DateInput.d.ts.map +1 -1
- package/dts/dates/DatePicker.d.ts +13 -0
- package/dts/dates/DatePicker.d.ts.map +1 -1
- package/dts/navigation/BrowserBarSearchInput.d.ts +1 -1
- package/dts/navigation/BrowserBarSearchInput.d.ts.map +1 -1
- package/esm/__stories__/SizeComposition.stories.js +237 -0
- package/esm/alpha/combobox/Combobox.js +1 -1
- package/esm/alpha/combobox/__stories__/Combobox.stories.js +34 -0
- package/esm/alpha/select/DefaultSelectControl.js +71 -22
- package/esm/alpha/select/DefaultSelectDropdown.js +5 -2
- package/esm/alpha/select/Select.js +9 -3
- package/esm/alpha/select/__stories__/AlphaSelect.stories.js +31 -0
- package/esm/alpha/select/types.js +8 -0
- package/esm/alpha/select-chip/SelectChip.js +14 -7
- package/esm/alpha/select-chip/SelectChipControl.js +2 -0
- package/esm/alpha/select-chip/__stories__/AlphaSelectChip.stories.js +31 -1
- package/esm/alpha/tabbed-chips/TabbedChips.js +8 -5
- package/esm/alpha/tabbed-chips/__stories__/AlphaTabbedChips.stories.js +23 -12
- package/esm/buttons/Button.js +52 -7
- package/esm/buttons/DefaultSlideButtonBackground.js +3 -2
- package/esm/buttons/DefaultSlideButtonHandle.js +13 -12
- package/esm/buttons/IconButton.js +38 -4
- package/esm/buttons/SlideButton.js +34 -6
- package/esm/buttons/__stories__/Button.stories.js +46 -16
- package/esm/buttons/__stories__/IconButton.stories.js +58 -11
- package/esm/buttons/__stories__/SlideButton.stories.js +18 -9
- package/esm/cards/CardBody.js +7 -2
- package/esm/cards/FeedCard.js +23 -8
- package/esm/cards/MessagingCard/MessagingCardLayout.js +2 -2
- package/esm/cards/NudgeCard.js +1 -1
- package/esm/cards/UpsellCard.js +2 -2
- package/esm/carousel/DefaultCarouselNavigation.js +11 -3
- package/esm/chips/Chip.js +24 -6
- package/esm/chips/MediaChip.js +7 -3
- package/esm/chips/__stories__/Chip.stories.js +9 -3
- package/esm/chips/__stories__/InputChip.stories.js +19 -1
- package/esm/controls/InputStack.js +6 -2
- package/esm/controls/NativeInput.js +7 -2
- package/esm/controls/SearchInput.js +2 -0
- package/esm/controls/TextInput.js +42 -16
- package/esm/controls/__stories__/SearchInput.stories.js +28 -1
- package/esm/controls/__stories__/TextInput.stories.js +82 -0
- package/esm/dates/DateInput.js +2 -1
- package/esm/dates/DatePicker.js +4 -2
- package/esm/dates/__stories__/DateInput.stories.js +28 -0
- package/esm/dates/__stories__/DatePicker.stories.js +23 -0
- package/esm/navigation/BrowserBarSearchInput.js +8 -4
- package/esm/overlays/Toast.js +1 -1
- package/esm/visualizations/ProgressContainerWithButtons.js +2 -2
- package/package.json +2 -2
|
@@ -34,9 +34,7 @@ const buttonStories = [{
|
|
|
34
34
|
}, {
|
|
35
35
|
block: true
|
|
36
36
|
}, {
|
|
37
|
-
|
|
38
|
-
}, {
|
|
39
|
-
compact: true,
|
|
37
|
+
size: 's',
|
|
40
38
|
block: true
|
|
41
39
|
}, {
|
|
42
40
|
transparent: true
|
|
@@ -46,35 +44,35 @@ const buttonStories = [{
|
|
|
46
44
|
loading: true
|
|
47
45
|
}, {
|
|
48
46
|
loading: true,
|
|
49
|
-
|
|
47
|
+
size: 's'
|
|
50
48
|
}, {
|
|
51
49
|
loading: true,
|
|
52
50
|
transparent: true
|
|
53
51
|
}, {
|
|
54
52
|
loading: true,
|
|
55
53
|
transparent: true,
|
|
56
|
-
|
|
54
|
+
size: 's'
|
|
57
55
|
}, {
|
|
58
56
|
loading: true,
|
|
59
57
|
variant: 'secondary'
|
|
60
58
|
}, {
|
|
61
59
|
loading: true,
|
|
62
60
|
variant: 'secondary',
|
|
63
|
-
|
|
61
|
+
size: 's'
|
|
64
62
|
}, {
|
|
65
63
|
loading: true,
|
|
66
64
|
variant: 'positive'
|
|
67
65
|
}, {
|
|
68
66
|
loading: true,
|
|
69
67
|
variant: 'positive',
|
|
70
|
-
|
|
68
|
+
size: 's'
|
|
71
69
|
}, {
|
|
72
70
|
loading: true,
|
|
73
71
|
variant: 'negative'
|
|
74
72
|
}, {
|
|
75
73
|
loading: true,
|
|
76
74
|
variant: 'negative',
|
|
77
|
-
|
|
75
|
+
size: 's'
|
|
78
76
|
}, {
|
|
79
77
|
startIcon: 'backArrow'
|
|
80
78
|
}, {
|
|
@@ -89,12 +87,12 @@ const buttonStories = [{
|
|
|
89
87
|
}, {
|
|
90
88
|
transparent: true,
|
|
91
89
|
flush: 'start',
|
|
92
|
-
|
|
90
|
+
size: 's',
|
|
93
91
|
endIcon: 'forwardArrow'
|
|
94
92
|
}, {
|
|
95
93
|
transparent: true,
|
|
96
94
|
flush: 'end',
|
|
97
|
-
|
|
95
|
+
size: 's',
|
|
98
96
|
endIcon: 'forwardArrow'
|
|
99
97
|
}, {
|
|
100
98
|
flush: 'start',
|
|
@@ -105,13 +103,13 @@ const buttonStories = [{
|
|
|
105
103
|
}, {
|
|
106
104
|
startIcon: 'backArrow',
|
|
107
105
|
endIcon: 'forwardArrow',
|
|
108
|
-
|
|
106
|
+
size: 's'
|
|
109
107
|
}, {
|
|
110
108
|
startIcon: 'backArrow',
|
|
111
|
-
|
|
109
|
+
size: 's'
|
|
112
110
|
}, {
|
|
113
111
|
endIcon: 'forwardArrow',
|
|
114
|
-
|
|
112
|
+
size: 's'
|
|
115
113
|
}];
|
|
116
114
|
const ButtonScreen = () => {
|
|
117
115
|
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
@@ -119,8 +117,8 @@ const ButtonScreen = () => {
|
|
|
119
117
|
inline: true,
|
|
120
118
|
title: "Complex example",
|
|
121
119
|
children: /*#__PURE__*/_jsx(Button, {
|
|
122
|
-
compact: true,
|
|
123
120
|
endIcon: "caretDown",
|
|
121
|
+
size: "s",
|
|
124
122
|
variant: "secondary",
|
|
125
123
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
126
124
|
alignItems: "center",
|
|
@@ -243,20 +241,52 @@ const ButtonScreen = () => {
|
|
|
243
241
|
}), /*#__PURE__*/_jsxs(HStack, {
|
|
244
242
|
gap: 2,
|
|
245
243
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
246
|
-
compact: true,
|
|
247
244
|
height: 24,
|
|
248
245
|
paddingY: 0,
|
|
249
246
|
progressCircleSize: 16,
|
|
247
|
+
size: "s",
|
|
250
248
|
children: "I am a button"
|
|
251
249
|
}), /*#__PURE__*/_jsx(Button, {
|
|
252
|
-
compact: true,
|
|
253
250
|
loading: true,
|
|
254
251
|
height: 24,
|
|
255
252
|
paddingY: 0,
|
|
256
253
|
progressCircleSize: 16,
|
|
254
|
+
size: "s",
|
|
257
255
|
children: "I am a button"
|
|
258
256
|
})]
|
|
259
257
|
})]
|
|
258
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
259
|
+
title: "Sizes",
|
|
260
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
261
|
+
alignItems: "flex-start",
|
|
262
|
+
gap: 2,
|
|
263
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
264
|
+
size: "xs",
|
|
265
|
+
children: "Extra small (xs)"
|
|
266
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
267
|
+
size: "s",
|
|
268
|
+
children: "Small (s)"
|
|
269
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
270
|
+
size: "m",
|
|
271
|
+
children: "Medium (m)"
|
|
272
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
273
|
+
size: "l",
|
|
274
|
+
children: "Large (l)"
|
|
275
|
+
})]
|
|
276
|
+
})
|
|
277
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
278
|
+
title: "Deprecated compact (use size='s')",
|
|
279
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
280
|
+
alignItems: "flex-start",
|
|
281
|
+
gap: 2,
|
|
282
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
283
|
+
compact: true,
|
|
284
|
+
children: "Compact (deprecated)"
|
|
285
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
286
|
+
size: "s",
|
|
287
|
+
children: "Equivalent size=\"s\""
|
|
288
|
+
})]
|
|
289
|
+
})
|
|
260
290
|
})]
|
|
261
291
|
});
|
|
262
292
|
};
|
|
@@ -147,6 +147,53 @@ const IconButtonScreen = () => {
|
|
|
147
147
|
}), variant.title]
|
|
148
148
|
}, index);
|
|
149
149
|
})
|
|
150
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
151
|
+
inline: true,
|
|
152
|
+
title: "T-shirt sizes",
|
|
153
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
flexDirection: "row",
|
|
156
|
+
justifyContent: "space-between",
|
|
157
|
+
width: 350,
|
|
158
|
+
children: /*#__PURE__*/_jsxs(HStack, {
|
|
159
|
+
alignItems: "center",
|
|
160
|
+
gap: 2,
|
|
161
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
162
|
+
accessibilityLabel: "Extra small",
|
|
163
|
+
name: iconName,
|
|
164
|
+
size: "xs"
|
|
165
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
166
|
+
accessibilityLabel: "Small",
|
|
167
|
+
name: iconName,
|
|
168
|
+
size: "s"
|
|
169
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
170
|
+
accessibilityLabel: "Medium",
|
|
171
|
+
name: iconName,
|
|
172
|
+
size: "m"
|
|
173
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
174
|
+
accessibilityLabel: "Large",
|
|
175
|
+
name: iconName,
|
|
176
|
+
size: "l"
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
181
|
+
inline: true,
|
|
182
|
+
title: "Deprecated compact (renders as size \"s\")",
|
|
183
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
flexDirection: "row",
|
|
186
|
+
justifyContent: "space-between",
|
|
187
|
+
width: 350,
|
|
188
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
189
|
+
compact: true,
|
|
190
|
+
accessibilityLabel: accessibilityLabel,
|
|
191
|
+
name: iconName
|
|
192
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
193
|
+
font: "body",
|
|
194
|
+
children: "compact"
|
|
195
|
+
})]
|
|
196
|
+
})
|
|
150
197
|
}), /*#__PURE__*/_jsx(Example, {
|
|
151
198
|
inline: true,
|
|
152
199
|
title: "Icon sizes",
|
|
@@ -171,9 +218,9 @@ const IconButtonScreen = () => {
|
|
|
171
218
|
name: iconName
|
|
172
219
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
173
220
|
accessibilityLabel: "Large icon",
|
|
174
|
-
compact: false,
|
|
175
221
|
iconSize: "l",
|
|
176
|
-
name: iconName
|
|
222
|
+
name: iconName,
|
|
223
|
+
size: "l"
|
|
177
224
|
})]
|
|
178
225
|
})
|
|
179
226
|
})
|
|
@@ -314,9 +361,9 @@ const IconButtonScreen = () => {
|
|
|
314
361
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
315
362
|
loading: true,
|
|
316
363
|
accessibilityLabel: "Loading",
|
|
317
|
-
compact: false,
|
|
318
364
|
iconSize: "l",
|
|
319
|
-
name: iconName
|
|
365
|
+
name: iconName,
|
|
366
|
+
size: "l"
|
|
320
367
|
})]
|
|
321
368
|
})]
|
|
322
369
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
@@ -325,20 +372,20 @@ const IconButtonScreen = () => {
|
|
|
325
372
|
style: {
|
|
326
373
|
marginBottom: 8
|
|
327
374
|
},
|
|
328
|
-
children: "Loading
|
|
375
|
+
children: "Loading size s vs size l"
|
|
329
376
|
}), /*#__PURE__*/_jsxs(HStack, {
|
|
330
377
|
alignItems: "center",
|
|
331
378
|
gap: 2,
|
|
332
379
|
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
333
|
-
compact: true,
|
|
334
380
|
loading: true,
|
|
335
381
|
accessibilityLabel: "Loading",
|
|
336
|
-
name: iconName
|
|
382
|
+
name: iconName,
|
|
383
|
+
size: "s"
|
|
337
384
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
338
385
|
loading: true,
|
|
339
386
|
accessibilityLabel: "Loading",
|
|
340
|
-
|
|
341
|
-
|
|
387
|
+
name: iconName,
|
|
388
|
+
size: "l"
|
|
342
389
|
})]
|
|
343
390
|
})]
|
|
344
391
|
})]
|
|
@@ -395,19 +442,19 @@ const IconButtonScreen = () => {
|
|
|
395
442
|
onPress: onPress,
|
|
396
443
|
width: 32
|
|
397
444
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
398
|
-
compact: true,
|
|
399
445
|
accessibilityLabel: accessibilityLabel,
|
|
400
446
|
height: 24,
|
|
401
447
|
name: iconName,
|
|
402
448
|
onPress: onPress,
|
|
449
|
+
size: "s",
|
|
403
450
|
width: 24
|
|
404
451
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
405
|
-
compact: true,
|
|
406
452
|
loading: true,
|
|
407
453
|
accessibilityLabel: accessibilityLabel,
|
|
408
454
|
height: 24,
|
|
409
455
|
name: iconName,
|
|
410
456
|
onPress: onPress,
|
|
457
|
+
size: "s",
|
|
411
458
|
width: 24
|
|
412
459
|
})]
|
|
413
460
|
})]
|
|
@@ -32,9 +32,9 @@ const SlideButtonExample = _ref => {
|
|
|
32
32
|
font: "label1",
|
|
33
33
|
children: "Reset"
|
|
34
34
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
35
|
-
compact: true,
|
|
36
35
|
name: "refresh",
|
|
37
|
-
onPress: toggleOff
|
|
36
|
+
onPress: toggleOff,
|
|
37
|
+
size: "s"
|
|
38
38
|
})]
|
|
39
39
|
}), /*#__PURE__*/_jsx(SlideButton, _extends({
|
|
40
40
|
checked: checked,
|
|
@@ -104,9 +104,9 @@ export const SlideButtonStories = () => {
|
|
|
104
104
|
uncheckedLabel: "Super long label that will get truncated when it exceeds the available space"
|
|
105
105
|
})
|
|
106
106
|
}), /*#__PURE__*/_jsx(Example, {
|
|
107
|
-
title: "
|
|
107
|
+
title: 'size="s" & long label',
|
|
108
108
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
109
|
-
|
|
109
|
+
size: "s",
|
|
110
110
|
uncheckedLabel: "Super long label that will get truncated when it exceeds the available space"
|
|
111
111
|
})
|
|
112
112
|
}), /*#__PURE__*/_jsx(Example, {
|
|
@@ -167,16 +167,25 @@ export const SlideButtonStories = () => {
|
|
|
167
167
|
checked: true,
|
|
168
168
|
disabled: true
|
|
169
169
|
})
|
|
170
|
+
}), /*#__PURE__*/_jsxs(Example, {
|
|
171
|
+
title: "Sizes",
|
|
172
|
+
children: [/*#__PURE__*/_jsx(SlideButtonExample, {
|
|
173
|
+
size: "s"
|
|
174
|
+
}), /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
175
|
+
size: "m"
|
|
176
|
+
}), /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
177
|
+
size: "l"
|
|
178
|
+
})]
|
|
170
179
|
}), /*#__PURE__*/_jsx(Example, {
|
|
171
|
-
title: "
|
|
180
|
+
title: 'size="s" and disabled',
|
|
172
181
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
173
|
-
|
|
182
|
+
disabled: true,
|
|
183
|
+
size: "s"
|
|
174
184
|
})
|
|
175
185
|
}), /*#__PURE__*/_jsx(Example, {
|
|
176
|
-
title: "
|
|
186
|
+
title: "Deprecated compact (renders as size s)",
|
|
177
187
|
children: /*#__PURE__*/_jsx(SlideButtonExample, {
|
|
178
|
-
compact: true
|
|
179
|
-
disabled: true
|
|
188
|
+
compact: true
|
|
180
189
|
})
|
|
181
190
|
}), /*#__PURE__*/_jsx(Example, {
|
|
182
191
|
title: "Custom components",
|
package/esm/cards/CardBody.js
CHANGED
|
@@ -9,6 +9,9 @@ import { HStack } from '../layout/HStack';
|
|
|
9
9
|
import { VStack } from '../layout/VStack';
|
|
10
10
|
import { Text } from '../typography/Text';
|
|
11
11
|
import { CardMedia } from './CardMedia';
|
|
12
|
+
|
|
13
|
+
// Cards are not sizable, so `size` stays off this wrapper's API and density remains a card feature
|
|
14
|
+
// under `compact`, translated onto Button's size scale below.
|
|
12
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
16
|
const CardBodyAction = /*#__PURE__*/memo(function CardBodyAction(_ref) {
|
|
14
17
|
let {
|
|
@@ -22,9 +25,11 @@ const CardBodyAction = /*#__PURE__*/memo(function CardBodyAction(_ref) {
|
|
|
22
25
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
26
|
return /*#__PURE__*/_jsx(Button, _extends({
|
|
24
27
|
noScaleOnPress: true,
|
|
25
|
-
compact: compact,
|
|
26
28
|
flush: flush,
|
|
27
|
-
numberOfLines: numberOfLines
|
|
29
|
+
numberOfLines: numberOfLines
|
|
30
|
+
// `undefined` rather than a hardcoded `l` so Button keeps owning its own default size.
|
|
31
|
+
,
|
|
32
|
+
size: compact ? 's' : undefined,
|
|
28
33
|
transparent: transparent,
|
|
29
34
|
variant: variant
|
|
30
35
|
}, props, {
|
package/esm/cards/FeedCard.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const _excluded = ["testID", "avatar", "author", "metadata", "pictogram", "spotSquare", "image", "mediaPlacement", "title", "description", "headerAction", "like", "comment", "share", "cta", "borderRadius", "elevation"]
|
|
1
|
+
const _excluded = ["testID", "avatar", "author", "metadata", "pictogram", "spotSquare", "image", "mediaPlacement", "title", "description", "headerAction", "like", "comment", "share", "cta", "borderRadius", "elevation"],
|
|
2
|
+
_excluded2 = ["compact", "size"];
|
|
2
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); }
|
|
3
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; }
|
|
4
5
|
import React, { memo, useMemo } from 'react';
|
|
@@ -36,6 +37,25 @@ export const FeedCard = /*#__PURE__*/memo(function FeedCard(_ref) {
|
|
|
36
37
|
elevation = 0
|
|
37
38
|
} = _ref,
|
|
38
39
|
cardProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
40
|
+
const ctaNode = useMemo(() => {
|
|
41
|
+
if (!cta) return null;
|
|
42
|
+
|
|
43
|
+
// `compact` and `size` are lifted out of the spread so a consumer-supplied `cta` cannot clobber
|
|
44
|
+
// the footer's dense default. Precedence matches the pre-`size` behaviour: an explicit `size`
|
|
45
|
+
// wins, otherwise `compact` decides and defaults to dense. Collapses to `size={size ?? 's'}`
|
|
46
|
+
// in v10 once `compact` is dropped from Button.
|
|
47
|
+
const {
|
|
48
|
+
compact,
|
|
49
|
+
size
|
|
50
|
+
} = cta,
|
|
51
|
+
ctaProps = _objectWithoutPropertiesLoose(cta, _excluded2);
|
|
52
|
+
return /*#__PURE__*/_jsx(Button, _extends({
|
|
53
|
+
transparent: true,
|
|
54
|
+
flush: "end",
|
|
55
|
+
size: size != null ? size : (compact != null ? compact : true) ? 's' : undefined,
|
|
56
|
+
variant: "secondary"
|
|
57
|
+
}, ctaProps));
|
|
58
|
+
}, [cta]);
|
|
39
59
|
const footer = useMemo(() => {
|
|
40
60
|
var _ref2, _ref3;
|
|
41
61
|
const hasFooterActions = Boolean((_ref2 = (_ref3 = like != null ? like : comment) != null ? _ref3 : share) != null ? _ref2 : cta);
|
|
@@ -59,16 +79,11 @@ export const FeedCard = /*#__PURE__*/memo(function FeedCard(_ref) {
|
|
|
59
79
|
name: "share",
|
|
60
80
|
testID: testID + "-share"
|
|
61
81
|
}, share))]
|
|
62
|
-
}),
|
|
63
|
-
compact: true,
|
|
64
|
-
transparent: true,
|
|
65
|
-
flush: "end",
|
|
66
|
-
variant: "secondary"
|
|
67
|
-
}, cta))]
|
|
82
|
+
}), ctaNode]
|
|
68
83
|
});
|
|
69
84
|
}
|
|
70
85
|
return null;
|
|
71
|
-
}, [comment, cta, like, share, testID]);
|
|
86
|
+
}, [comment, cta, ctaNode, like, share, testID]);
|
|
72
87
|
return /*#__PURE__*/_jsxs(Card, _extends({
|
|
73
88
|
borderRadius: borderRadius,
|
|
74
89
|
elevation: elevation,
|
|
@@ -61,9 +61,9 @@ export const MessagingCardLayout = /*#__PURE__*/memo(_ref => {
|
|
|
61
61
|
if (typeof action === 'string') {
|
|
62
62
|
if (type === 'upsell') {
|
|
63
63
|
return /*#__PURE__*/_jsx(Button, {
|
|
64
|
-
compact: true,
|
|
65
64
|
accessibilityLabel: actionButtonAccessibilityLabel != null ? actionButtonAccessibilityLabel : action,
|
|
66
65
|
onPress: onActionButtonPress,
|
|
66
|
+
size: "s",
|
|
67
67
|
variant: "secondary",
|
|
68
68
|
children: action
|
|
69
69
|
});
|
|
@@ -101,10 +101,10 @@ export const MessagingCardLayout = /*#__PURE__*/memo(_ref => {
|
|
|
101
101
|
style: styles == null ? void 0 : styles.dismissButtonContainer,
|
|
102
102
|
top: 0,
|
|
103
103
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
104
|
-
compact: true,
|
|
105
104
|
accessibilityLabel: computedDismissButtonAccessibilityLabel,
|
|
106
105
|
name: "close",
|
|
107
106
|
onPress: onDismissButtonPress,
|
|
107
|
+
size: "s",
|
|
108
108
|
variant: "secondary"
|
|
109
109
|
})
|
|
110
110
|
});
|
package/esm/cards/NudgeCard.js
CHANGED
|
@@ -31,7 +31,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
31
31
|
* title="Title"
|
|
32
32
|
* description="Description"
|
|
33
33
|
* media={<Pictogram dimension="48x48" name="addToWatchlist" />}
|
|
34
|
-
* actions={<Button
|
|
34
|
+
* actions={<Button size="s" variant="secondary">Learn more</Button>}
|
|
35
35
|
* onDismiss={handleDismiss}
|
|
36
36
|
* mediaPlacement="end"
|
|
37
37
|
* />
|
package/esm/cards/UpsellCard.js
CHANGED
|
@@ -29,7 +29,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
29
29
|
* title="Title"
|
|
30
30
|
* description="Description"
|
|
31
31
|
* media={<RemoteImage ... />}
|
|
32
|
-
* actions={<Button
|
|
32
|
+
* actions={<Button size="s" variant="secondary">Get Started</Button>}
|
|
33
33
|
* onDismiss={handleDismiss}
|
|
34
34
|
* mediaPlacement="end"
|
|
35
35
|
* />
|
|
@@ -88,10 +88,10 @@ export const UpsellCard = /*#__PURE__*/memo(_ref => {
|
|
|
88
88
|
}), !!action && /*#__PURE__*/_jsx(HStack, {
|
|
89
89
|
paddingStart: 2,
|
|
90
90
|
children: /*#__PURE__*/isValidElement(action) ? action : /*#__PURE__*/_jsx(Button, {
|
|
91
|
-
compact: true,
|
|
92
91
|
flush: "start",
|
|
93
92
|
numberOfLines: 1,
|
|
94
93
|
onPress: onActionPress,
|
|
94
|
+
size: "s",
|
|
95
95
|
variant: "secondary",
|
|
96
96
|
children: action
|
|
97
97
|
})
|
|
@@ -3,6 +3,8 @@ import { IconButton } from '../buttons/IconButton';
|
|
|
3
3
|
import { useTheme } from '../hooks/useTheme';
|
|
4
4
|
import { HStack } from '../layout/HStack';
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
/** Size the navigation buttons render at when neither `iconButtonSize` nor `compact` is set. */
|
|
7
|
+
const defaultIconButtonSize = 's';
|
|
6
8
|
export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarouselNavigation(_ref) {
|
|
7
9
|
var _testIDMap$autoplayBu, _testIDMap$previousBu, _testIDMap$nextButton;
|
|
8
10
|
let {
|
|
@@ -18,6 +20,7 @@ export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarou
|
|
|
18
20
|
startAutoplayAccessibilityLabel = 'Play Carousel',
|
|
19
21
|
stopAutoplayAccessibilityLabel = 'Pause Carousel',
|
|
20
22
|
variant = 'secondary',
|
|
23
|
+
iconButtonSize,
|
|
21
24
|
compact,
|
|
22
25
|
previousIcon = 'caretLeft',
|
|
23
26
|
nextIcon = 'caretRight',
|
|
@@ -33,32 +36,37 @@ export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarou
|
|
|
33
36
|
const rootStyles = useMemo(() => [{
|
|
34
37
|
paddingVertical: theme.space[0.5]
|
|
35
38
|
}, style, styles == null ? void 0 : styles.root], [style, styles == null ? void 0 : styles.root, theme.space]);
|
|
39
|
+
|
|
40
|
+
// `compact` was forwarded straight to `IconButton`, which defaults its own `compact` to `true` —
|
|
41
|
+
// so these buttons have always rendered dense unless a caller explicitly passed `compact={false}`,
|
|
42
|
+
// which then fell back to IconButton's `l`. `iconButtonSize` wins when set.
|
|
43
|
+
const resolvedIconButtonSize = iconButtonSize != null ? iconButtonSize : (compact != null ? compact : true) ? defaultIconButtonSize : 'l';
|
|
36
44
|
return /*#__PURE__*/_jsxs(HStack, {
|
|
37
45
|
gap: 1,
|
|
38
46
|
style: rootStyles,
|
|
39
47
|
children: [autoplay && /*#__PURE__*/_jsx(IconButton, {
|
|
40
48
|
accessibilityLabel: isAutoplayStopped ? startAutoplayAccessibilityLabel : stopAutoplayAccessibilityLabel,
|
|
41
|
-
compact: compact,
|
|
42
49
|
name: isAutoplayStopped ? startIcon : stopIcon,
|
|
43
50
|
onPress: onToggleAutoplay,
|
|
51
|
+
size: resolvedIconButtonSize,
|
|
44
52
|
style: styles == null ? void 0 : styles.autoplayButton,
|
|
45
53
|
testID: (_testIDMap$autoplayBu = testIDMap == null ? void 0 : testIDMap.autoplayButton) != null ? _testIDMap$autoplayBu : 'carousel-autoplay-button',
|
|
46
54
|
variant: variant
|
|
47
55
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
48
56
|
accessibilityLabel: previousPageAccessibilityLabel,
|
|
49
|
-
compact: compact,
|
|
50
57
|
disabled: disableGoPrevious,
|
|
51
58
|
name: previousIcon,
|
|
52
59
|
onPress: onGoPrevious,
|
|
60
|
+
size: resolvedIconButtonSize,
|
|
53
61
|
style: styles == null ? void 0 : styles.previousButton,
|
|
54
62
|
testID: (_testIDMap$previousBu = testIDMap == null ? void 0 : testIDMap.previousButton) != null ? _testIDMap$previousBu : 'carousel-previous-button',
|
|
55
63
|
variant: variant
|
|
56
64
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
57
65
|
accessibilityLabel: nextPageAccessibilityLabel,
|
|
58
|
-
compact: compact,
|
|
59
66
|
disabled: disableGoNext,
|
|
60
67
|
name: nextIcon,
|
|
61
68
|
onPress: onGoNext,
|
|
69
|
+
size: resolvedIconButtonSize,
|
|
62
70
|
style: styles == null ? void 0 : styles.nextButton,
|
|
63
71
|
testID: (_testIDMap$nextButton = testIDMap == null ? void 0 : testIDMap.nextButton) != null ? _testIDMap$nextButton : 'carousel-next-button',
|
|
64
72
|
variant: variant
|
package/esm/chips/Chip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _excluded = ["ref"],
|
|
2
|
-
_excluded2 = ["alignSelf", "children", "start", "end", "invertColorScheme", "inverted", "maxWidth", "compact", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "color", "font"];
|
|
2
|
+
_excluded2 = ["alignSelf", "children", "start", "end", "invertColorScheme", "inverted", "maxWidth", "compact", "size", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "color", "font"];
|
|
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; }
|
|
5
5
|
import React, { Fragment, memo } from 'react';
|
|
@@ -11,15 +11,34 @@ import { Pressable } from '../system/Pressable';
|
|
|
11
11
|
import { InvertedThemeProvider } from '../system/ThemeProvider';
|
|
12
12
|
import { Text } from '../typography/Text';
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const chipSizes = {
|
|
15
|
+
xs: {
|
|
16
|
+
paddingX: 1.5,
|
|
17
|
+
paddingY: 0.75,
|
|
18
|
+
font: 'label1',
|
|
19
|
+
borderRadius: 700
|
|
20
|
+
},
|
|
21
|
+
s: {
|
|
22
|
+
paddingX: 2,
|
|
23
|
+
paddingY: 1,
|
|
24
|
+
font: 'headline',
|
|
25
|
+
borderRadius: 700
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const defaultChipSize = 's';
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
31
|
* This is a basic Chip component used to create all Chip components.
|
|
16
32
|
*/
|
|
17
33
|
export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
34
|
+
var _mergedProps$size;
|
|
18
35
|
let {
|
|
19
36
|
ref
|
|
20
37
|
} = _ref,
|
|
21
38
|
_props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
39
|
const mergedProps = useComponentConfig('Chip', _props);
|
|
40
|
+
// Geometry is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
|
|
41
|
+
const sizeConfig = chipSizes[(_mergedProps$size = mergedProps.size) != null ? _mergedProps$size : mergedProps.compact ? 'xs' : defaultChipSize];
|
|
23
42
|
const {
|
|
24
43
|
alignSelf = 'flex-start',
|
|
25
44
|
children,
|
|
@@ -28,10 +47,9 @@ export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
|
28
47
|
invertColorScheme,
|
|
29
48
|
inverted,
|
|
30
49
|
maxWidth = chipMaxWidth,
|
|
31
|
-
compact,
|
|
32
50
|
gap = 1,
|
|
33
|
-
paddingX =
|
|
34
|
-
paddingY =
|
|
51
|
+
paddingX = sizeConfig.paddingX,
|
|
52
|
+
paddingY = sizeConfig.paddingY,
|
|
35
53
|
alignItems = 'center',
|
|
36
54
|
justifyContent,
|
|
37
55
|
padding,
|
|
@@ -42,13 +60,13 @@ export const Chip = /*#__PURE__*/memo(function Chip(_ref) {
|
|
|
42
60
|
numberOfLines = 1,
|
|
43
61
|
testID,
|
|
44
62
|
contentStyle,
|
|
45
|
-
borderRadius =
|
|
63
|
+
borderRadius = sizeConfig.borderRadius,
|
|
46
64
|
background = 'bgSecondary',
|
|
47
65
|
style,
|
|
48
66
|
styles,
|
|
49
67
|
onPress,
|
|
50
68
|
color = 'fg',
|
|
51
|
-
font =
|
|
69
|
+
font = sizeConfig.font
|
|
52
70
|
} = mergedProps,
|
|
53
71
|
props = _objectWithoutPropertiesLoose(mergedProps, _excluded2);
|
|
54
72
|
const WrapperComponent = (invertColorScheme != null ? invertColorScheme : inverted) ? InvertedThemeProvider : Fragment;
|
package/esm/chips/MediaChip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _excluded = ["ref"],
|
|
2
|
-
_excluded2 = ["start", "children", "end", "compact", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd"];
|
|
2
|
+
_excluded2 = ["start", "children", "end", "compact", "size", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd"];
|
|
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; }
|
|
5
5
|
import { memo, useMemo } from 'react';
|
|
@@ -18,6 +18,7 @@ export const MediaChip = /*#__PURE__*/memo(function MediaChip(_ref) {
|
|
|
18
18
|
children,
|
|
19
19
|
end,
|
|
20
20
|
compact,
|
|
21
|
+
size,
|
|
21
22
|
padding,
|
|
22
23
|
paddingX,
|
|
23
24
|
paddingY,
|
|
@@ -27,9 +28,11 @@ export const MediaChip = /*#__PURE__*/memo(function MediaChip(_ref) {
|
|
|
27
28
|
paddingEnd
|
|
28
29
|
} = mergedProps,
|
|
29
30
|
props = _objectWithoutPropertiesLoose(mergedProps, _excluded2);
|
|
31
|
+
// Spacing is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
|
|
32
|
+
const resolvedSize = size != null ? size : compact ? 'xs' : 's';
|
|
30
33
|
const spacingProps = useMemo(() => {
|
|
31
34
|
const defaults = getMediaChipSpacingProps({
|
|
32
|
-
|
|
35
|
+
size: resolvedSize,
|
|
33
36
|
start: !!start,
|
|
34
37
|
end: !!end,
|
|
35
38
|
children: !!children
|
|
@@ -43,11 +46,12 @@ export const MediaChip = /*#__PURE__*/memo(function MediaChip(_ref) {
|
|
|
43
46
|
paddingStart: paddingStart != null ? paddingStart : defaults.paddingStart,
|
|
44
47
|
paddingEnd: paddingEnd != null ? paddingEnd : defaults.paddingEnd
|
|
45
48
|
};
|
|
46
|
-
}, [
|
|
49
|
+
}, [resolvedSize, start, end, children, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingStart, paddingEnd]);
|
|
47
50
|
return /*#__PURE__*/_jsx(Chip, _extends({
|
|
48
51
|
ref: ref,
|
|
49
52
|
compact: compact,
|
|
50
53
|
end: end,
|
|
54
|
+
size: size,
|
|
51
55
|
start: start
|
|
52
56
|
}, spacingProps, props, {
|
|
53
57
|
children: children
|
|
@@ -18,8 +18,9 @@ const ChipExamples = _ref => {
|
|
|
18
18
|
} = _ref,
|
|
19
19
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
20
20
|
const ref = useRef(null);
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const isCompactSize = props.compact || props.size === 'xs';
|
|
22
|
+
const mediaSize = isCompactSize ? 16 : 24;
|
|
23
|
+
const textFont = isCompactSize ? 'label1' : 'headline';
|
|
23
24
|
const assetIconProps = {
|
|
24
25
|
height: mediaSize,
|
|
25
26
|
shape: 'circle',
|
|
@@ -111,7 +112,12 @@ const ChipScreen = () => /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
|
111
112
|
inverted: true
|
|
112
113
|
})
|
|
113
114
|
}), /*#__PURE__*/_jsx(Example, {
|
|
114
|
-
title: "
|
|
115
|
+
title: "Size xs",
|
|
116
|
+
children: /*#__PURE__*/_jsx(ChipExamples, {
|
|
117
|
+
size: "xs"
|
|
118
|
+
})
|
|
119
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
120
|
+
title: "Compact (deprecated)",
|
|
115
121
|
children: /*#__PURE__*/_jsx(ChipExamples, {
|
|
116
122
|
compact: true
|
|
117
123
|
})
|