@coinbase/cds-web 9.8.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 +10 -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 +11 -1
- package/dts/buttons/Button.d.ts.map +1 -1
- package/dts/buttons/IconButton.d.ts +18 -2
- package/dts/buttons/IconButton.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 +2 -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.map +1 -1
- package/dts/controls/NativeInput.d.ts +2 -0
- package/dts/controls/NativeInput.d.ts.map +1 -1
- package/dts/controls/NativeTextArea.d.ts +8 -3
- package/dts/controls/NativeTextArea.d.ts.map +1 -1
- package/dts/controls/SearchInput.d.ts +5 -2
- package/dts/controls/SearchInput.d.ts.map +1 -1
- package/dts/controls/TextInput.d.ts +27 -4
- 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/pagination/DefaultPaginationNavigationTextButton.d.ts +1 -10
- package/dts/pagination/DefaultPaginationNavigationTextButton.d.ts.map +1 -1
- package/dts/tabs/Paddle.d.ts +7 -0
- package/dts/tabs/Paddle.d.ts.map +1 -1
- package/esm/alpha/select/DefaultSelectControl.js +70 -32
- package/esm/alpha/select/DefaultSelectDropdown.js +5 -2
- package/esm/alpha/select/Select.js +8 -1
- package/esm/alpha/select/types.js +8 -0
- package/esm/alpha/select-chip/SelectChip.js +14 -6
- package/esm/alpha/select-chip/SelectChipControl.js +2 -0
- package/esm/alpha/tabbed-chips/TabbedChips.js +10 -5
- package/esm/buttons/Button.js +47 -6
- package/esm/buttons/IconButton.js +31 -3
- package/esm/cards/CardBody.js +1 -1
- 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 +10 -3
- package/esm/chips/Chip.js +24 -5
- package/esm/chips/MediaChip.js +7 -3
- package/esm/controls/NativeInput.js +3 -0
- package/esm/controls/SearchInput.js +15 -7
- package/esm/controls/TextInput.css +2 -2
- package/esm/controls/TextInput.js +37 -18
- package/esm/dates/DateInput.js +2 -1
- package/esm/dates/DatePicker.js +4 -2
- package/esm/overlays/Toast.js +1 -1
- package/esm/pagination/DefaultPaginationNavigationButton.js +1 -1
- package/esm/pagination/DefaultPaginationNavigationTextButton.js +3 -3
- package/esm/pagination/DefaultPaginationPageButton.js +1 -1
- package/esm/tabs/Paddle.js +3 -1
- package/esm/visualizations/ProgressContainerWithButtons.js +2 -2
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _excluded = ["label", "id", "activeBackground", "activeColor", "color"],
|
|
2
|
-
_excluded2 = ["tabs", "activeTab", "onChange", "TabComponent", "testID", "background", "gap", "previousArrowAccessibilityLabel", "nextArrowAccessibilityLabel", "width", "TabsActiveIndicatorComponent", "disabled", "compact", "styles", "classNames", "autoScrollOffset"];
|
|
2
|
+
_excluded2 = ["tabs", "activeTab", "onChange", "TabComponent", "testID", "background", "gap", "previousArrowAccessibilityLabel", "nextArrowAccessibilityLabel", "width", "TabsActiveIndicatorComponent", "disabled", "compact", "size", "styles", "classNames", "autoScrollOffset"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -77,11 +77,14 @@ const TabbedChipsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
77
77
|
TabsActiveIndicatorComponent = DefaultTabsActiveIndicatorComponent,
|
|
78
78
|
disabled,
|
|
79
79
|
compact,
|
|
80
|
+
size,
|
|
80
81
|
styles,
|
|
81
82
|
classNames,
|
|
82
83
|
autoScrollOffset = 50
|
|
83
84
|
} = mergedProps,
|
|
84
85
|
accessibilityProps = _objectWithoutProperties(mergedProps, _excluded2);
|
|
86
|
+
// Size is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
|
|
87
|
+
const resolvedSize = size !== null && size !== void 0 ? size : compact ? 'xs' : 's';
|
|
85
88
|
const [scrollTarget, setScrollTarget] = useState(null);
|
|
86
89
|
const {
|
|
87
90
|
scrollRef,
|
|
@@ -107,11 +110,11 @@ const TabbedChipsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
107
110
|
behavior: 'smooth'
|
|
108
111
|
});
|
|
109
112
|
}, [scrollRef]);
|
|
110
|
-
const
|
|
113
|
+
const TabComponentWithSize = useCallback(props => {
|
|
111
114
|
return /*#__PURE__*/_jsx(TabComponent, _objectSpread({
|
|
112
|
-
|
|
115
|
+
size: resolvedSize
|
|
113
116
|
}, props));
|
|
114
|
-
}, [TabComponent,
|
|
117
|
+
}, [TabComponent, resolvedSize]);
|
|
115
118
|
return /*#__PURE__*/_jsxs(HStack, {
|
|
116
119
|
alignItems: "center",
|
|
117
120
|
className: cx(containerCss, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
@@ -126,6 +129,7 @@ const TabbedChipsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
126
129
|
onClick: handleScrollLeft,
|
|
127
130
|
paddleStyle: styles === null || styles === void 0 ? void 0 : styles.paddle,
|
|
128
131
|
show: isScrollContentOffscreenLeft,
|
|
132
|
+
size: resolvedSize,
|
|
129
133
|
variant: "secondary"
|
|
130
134
|
}), /*#__PURE__*/_jsx(HStack, {
|
|
131
135
|
ref: scrollRef,
|
|
@@ -136,7 +140,7 @@ const TabbedChipsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
136
140
|
style: styles === null || styles === void 0 ? void 0 : styles.scrollContainer,
|
|
137
141
|
children: /*#__PURE__*/_jsx(Tabs, _objectSpread({
|
|
138
142
|
ref: ref,
|
|
139
|
-
TabComponent:
|
|
143
|
+
TabComponent: TabComponentWithSize,
|
|
140
144
|
TabsActiveIndicatorComponent: DefaultTabsActiveIndicatorComponent,
|
|
141
145
|
activeTab: activeTab || null,
|
|
142
146
|
background: background,
|
|
@@ -155,6 +159,7 @@ const TabbedChipsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function
|
|
|
155
159
|
onClick: handleScrollRight,
|
|
156
160
|
paddleStyle: styles === null || styles === void 0 ? void 0 : styles.paddle,
|
|
157
161
|
show: isScrollContentOffscreenRight,
|
|
162
|
+
size: resolvedSize,
|
|
158
163
|
variant: "secondary"
|
|
159
164
|
})]
|
|
160
165
|
});
|
package/esm/buttons/Button.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["as", "variant", "loading", "progressCircleSize", "transparent", "block", "compact", "children", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "flush", "noScaleOnPress", "numberOfLines", "font", "fontFamily", "fontSize", "fontWeight", "height", "lineHeight", "background", "color", "className", "borderColor", "borderWidth", "borderRadius", "accessibilityLabel", "padding", "paddingX", "paddingY", "margin", "minWidth", "style", "textAlign"];
|
|
1
|
+
const _excluded = ["as", "variant", "loading", "progressCircleSize", "transparent", "block", "compact", "size", "children", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "flush", "noScaleOnPress", "numberOfLines", "font", "fontFamily", "fontSize", "fontWeight", "height", "lineHeight", "background", "color", "className", "borderColor", "borderWidth", "borderRadius", "accessibilityLabel", "padding", "paddingX", "paddingY", "margin", "minWidth", "style", "textAlign"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -24,6 +24,37 @@ const COMPONENT_STATIC_CLASSNAME = 'cds-Button';
|
|
|
24
24
|
*/
|
|
25
25
|
export const spinnerHeight = 2.5;
|
|
26
26
|
const defaultProgressCircleSize = 24;
|
|
27
|
+
const buttonSizes = {
|
|
28
|
+
xs: {
|
|
29
|
+
paddingX: 2,
|
|
30
|
+
paddingY: 0.75,
|
|
31
|
+
borderRadius: 700,
|
|
32
|
+
iconSize: 's',
|
|
33
|
+
font: 'label1'
|
|
34
|
+
},
|
|
35
|
+
s: {
|
|
36
|
+
paddingX: 2,
|
|
37
|
+
paddingY: 1,
|
|
38
|
+
borderRadius: 700,
|
|
39
|
+
iconSize: 's',
|
|
40
|
+
font: 'headline'
|
|
41
|
+
},
|
|
42
|
+
m: {
|
|
43
|
+
paddingX: 3,
|
|
44
|
+
paddingY: 1.5,
|
|
45
|
+
borderRadius: 900,
|
|
46
|
+
iconSize: 'm',
|
|
47
|
+
font: 'headline'
|
|
48
|
+
},
|
|
49
|
+
l: {
|
|
50
|
+
paddingX: 4,
|
|
51
|
+
paddingY: 2,
|
|
52
|
+
borderRadius: 900,
|
|
53
|
+
iconSize: 'm',
|
|
54
|
+
font: 'headline'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const defaultButtonSize = 'l';
|
|
27
58
|
const baseCss = "baseCss-b99zquh";
|
|
28
59
|
const blockCss = "blockCss-b9yox33";
|
|
29
60
|
const spinnerContainerCss = "spinnerContainerCss-s1bhvbb9";
|
|
@@ -36,6 +67,7 @@ const middleNodeCss = "middleNodeCss-m1avpq52";
|
|
|
36
67
|
const flushCss = "flushCss-f69rtgb";
|
|
37
68
|
export const buttonDefaultElement = 'button';
|
|
38
69
|
export const Button = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
70
|
+
var _ref, _ref2;
|
|
39
71
|
const mergedProps = useComponentConfig('Button', _props);
|
|
40
72
|
const {
|
|
41
73
|
as,
|
|
@@ -45,6 +77,7 @@ export const Button = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
45
77
|
transparent,
|
|
46
78
|
block,
|
|
47
79
|
compact,
|
|
80
|
+
size,
|
|
48
81
|
children,
|
|
49
82
|
start,
|
|
50
83
|
startIcon,
|
|
@@ -55,7 +88,7 @@ export const Button = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
55
88
|
flush,
|
|
56
89
|
noScaleOnPress,
|
|
57
90
|
numberOfLines,
|
|
58
|
-
font
|
|
91
|
+
font: fontProp,
|
|
59
92
|
fontFamily,
|
|
60
93
|
fontSize,
|
|
61
94
|
fontWeight,
|
|
@@ -67,11 +100,11 @@ export const Button = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
67
100
|
borderColor,
|
|
68
101
|
borderWidth = 0,
|
|
69
102
|
// remove Pressable's default transparent border
|
|
70
|
-
borderRadius
|
|
103
|
+
borderRadius: borderRadiusProp,
|
|
71
104
|
accessibilityLabel,
|
|
72
105
|
padding,
|
|
73
|
-
paddingX
|
|
74
|
-
paddingY
|
|
106
|
+
paddingX: paddingXProp,
|
|
107
|
+
paddingY: paddingYProp,
|
|
75
108
|
margin = 0,
|
|
76
109
|
minWidth = 'auto',
|
|
77
110
|
style,
|
|
@@ -80,7 +113,15 @@ export const Button = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
|
|
|
80
113
|
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
81
114
|
const theme = useTheme();
|
|
82
115
|
const Component = as !== null && as !== void 0 ? as : buttonDefaultElement;
|
|
83
|
-
|
|
116
|
+
|
|
117
|
+
// `size` wins when both `size` and `compact` are set; compact-only maps to `s`.
|
|
118
|
+
const resolvedSize = size !== null && size !== void 0 ? size : compact ? 's' : defaultButtonSize;
|
|
119
|
+
const sizeConfig = buttonSizes[resolvedSize];
|
|
120
|
+
const font = fontProp !== null && fontProp !== void 0 ? fontProp : sizeConfig.font;
|
|
121
|
+
const borderRadius = borderRadiusProp !== null && borderRadiusProp !== void 0 ? borderRadiusProp : sizeConfig.borderRadius;
|
|
122
|
+
const paddingX = (_ref = paddingXProp !== null && paddingXProp !== void 0 ? paddingXProp : padding) !== null && _ref !== void 0 ? _ref : sizeConfig.paddingX;
|
|
123
|
+
const paddingY = (_ref2 = paddingYProp !== null && paddingYProp !== void 0 ? paddingYProp : padding) !== null && _ref2 !== void 0 ? _ref2 : sizeConfig.paddingY;
|
|
124
|
+
const iconSize = sizeConfig.iconSize;
|
|
84
125
|
const hasIcon = Boolean(startIcon !== null && startIcon !== void 0 ? startIcon : endIcon);
|
|
85
126
|
const variantMap = transparent ? transparentVariants : variants;
|
|
86
127
|
const variantStyle = variantMap[variant];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["as", "variant", "transparent", "compact", "background", "color", "borderColor", "borderRadius", "borderWidth", "alignItems", "justifyContent", "className", "style", "padding", "name", "iconSize", "active", "flush", "loading", "progressCircleSize", "accessibilityLabel", "accessibilityHint", "styles", "classNames"];
|
|
1
|
+
const _excluded = ["as", "variant", "transparent", "compact", "size", "background", "color", "borderColor", "borderRadius", "borderWidth", "alignItems", "justifyContent", "className", "style", "padding", "name", "iconSize", "active", "flush", "loading", "progressCircleSize", "accessibilityLabel", "accessibilityHint", "styles", "classNames"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -29,6 +29,25 @@ export const iconButtonClassNames = {
|
|
|
29
29
|
progressCircle: 'cds-IconButton-progressCircle'
|
|
30
30
|
};
|
|
31
31
|
export const iconButtonDefaultElement = 'button';
|
|
32
|
+
const iconButtonSizes = {
|
|
33
|
+
xs: {
|
|
34
|
+
padding: 1,
|
|
35
|
+
iconSize: 's'
|
|
36
|
+
},
|
|
37
|
+
s: {
|
|
38
|
+
padding: 1.5,
|
|
39
|
+
iconSize: 's'
|
|
40
|
+
},
|
|
41
|
+
m: {
|
|
42
|
+
padding: 1.5,
|
|
43
|
+
iconSize: 'm'
|
|
44
|
+
},
|
|
45
|
+
l: {
|
|
46
|
+
padding: 2,
|
|
47
|
+
iconSize: 'm'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const defaultIconButtonSize = 'l';
|
|
32
51
|
const baseCss = "baseCss-b1po8mo6";
|
|
33
52
|
export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
34
53
|
const mergedProps = useComponentConfig('IconButton', _props);
|
|
@@ -37,19 +56,21 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref
|
|
|
37
56
|
variant = 'secondary',
|
|
38
57
|
transparent,
|
|
39
58
|
compact = true,
|
|
59
|
+
size,
|
|
40
60
|
background,
|
|
41
61
|
color,
|
|
42
62
|
borderColor,
|
|
43
63
|
borderRadius = 1000,
|
|
64
|
+
// fully rounded at every size
|
|
44
65
|
borderWidth = 0,
|
|
45
66
|
// remove Pressable's default transparent border
|
|
46
67
|
alignItems = 'center',
|
|
47
68
|
justifyContent = 'center',
|
|
48
69
|
className,
|
|
49
70
|
style,
|
|
50
|
-
padding
|
|
71
|
+
padding: paddingProp,
|
|
51
72
|
name,
|
|
52
|
-
iconSize
|
|
73
|
+
iconSize: iconSizeProp,
|
|
53
74
|
active,
|
|
54
75
|
flush,
|
|
55
76
|
loading,
|
|
@@ -62,6 +83,13 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref
|
|
|
62
83
|
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
63
84
|
const Component = as !== null && as !== void 0 ? as : iconButtonDefaultElement;
|
|
64
85
|
const theme = useTheme();
|
|
86
|
+
|
|
87
|
+
// `size` wins when both `size` and `compact` are set. IconButton defaults `compact`
|
|
88
|
+
// to `true`, so with no explicit `size` the button resolves to `s`.
|
|
89
|
+
const resolvedSize = size !== null && size !== void 0 ? size : compact ? 's' : defaultIconButtonSize;
|
|
90
|
+
const sizeConfig = iconButtonSizes[resolvedSize];
|
|
91
|
+
const padding = paddingProp !== null && paddingProp !== void 0 ? paddingProp : sizeConfig.padding;
|
|
92
|
+
const iconSize = iconSizeProp !== null && iconSizeProp !== void 0 ? iconSizeProp : sizeConfig.iconSize;
|
|
65
93
|
const iconSizeValue = theme.iconSize[iconSize];
|
|
66
94
|
const spinnerSize = iconSizeValue / 10;
|
|
67
95
|
const resolvedPadding = useResolveResponsiveProp(padding);
|
package/esm/cards/CardBody.js
CHANGED
|
@@ -79,7 +79,6 @@ export const CardBody = /*#__PURE__*/memo(function CardBody(_ref) {
|
|
|
79
79
|
const action = useMemo(() => {
|
|
80
80
|
if (actionLabel && onActionPress) {
|
|
81
81
|
return /*#__PURE__*/_jsx(Button, {
|
|
82
|
-
compact: true,
|
|
83
82
|
noScaleOnPress: true,
|
|
84
83
|
transparent: true,
|
|
85
84
|
accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : actionLabel,
|
|
@@ -87,6 +86,7 @@ export const CardBody = /*#__PURE__*/memo(function CardBody(_ref) {
|
|
|
87
86
|
flush: "start",
|
|
88
87
|
numberOfLines: 3,
|
|
89
88
|
onClick: onActionPress,
|
|
89
|
+
size: "s",
|
|
90
90
|
testID: "".concat(testID, "-action"),
|
|
91
91
|
variant: "primary",
|
|
92
92
|
children: actionLabel
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -41,6 +42,25 @@ export const FeedCard = /*#__PURE__*/memo(function FeedCard(_ref) {
|
|
|
41
42
|
elevation = 0
|
|
42
43
|
} = _ref,
|
|
43
44
|
cardProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
const ctaNode = useMemo(() => {
|
|
46
|
+
if (!cta) return null;
|
|
47
|
+
|
|
48
|
+
// `compact` and `size` are lifted out of the spread so a consumer-supplied `cta` cannot clobber
|
|
49
|
+
// the footer's dense default. Precedence matches the pre-`size` behaviour: an explicit `size`
|
|
50
|
+
// wins, otherwise `compact` decides and defaults to dense. Collapses to `size={size ?? 's'}`
|
|
51
|
+
// in v10 once `compact` is dropped from Button.
|
|
52
|
+
const {
|
|
53
|
+
compact,
|
|
54
|
+
size
|
|
55
|
+
} = cta,
|
|
56
|
+
ctaProps = _objectWithoutProperties(cta, _excluded2);
|
|
57
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread({
|
|
58
|
+
transparent: true,
|
|
59
|
+
flush: "end",
|
|
60
|
+
size: size !== null && size !== void 0 ? size : (compact !== null && compact !== void 0 ? compact : true) ? 's' : undefined,
|
|
61
|
+
variant: "secondary"
|
|
62
|
+
}, ctaProps));
|
|
63
|
+
}, [cta]);
|
|
44
64
|
const footer = useMemo(() => {
|
|
45
65
|
var _ref2, _ref3;
|
|
46
66
|
const hasFooterActions = Boolean((_ref2 = (_ref3 = like !== null && like !== void 0 ? like : comment) !== null && _ref3 !== void 0 ? _ref3 : share) !== null && _ref2 !== void 0 ? _ref2 : cta);
|
|
@@ -64,16 +84,11 @@ export const FeedCard = /*#__PURE__*/memo(function FeedCard(_ref) {
|
|
|
64
84
|
name: "share",
|
|
65
85
|
testID: "".concat(testID, "-share")
|
|
66
86
|
}, share))]
|
|
67
|
-
}),
|
|
68
|
-
compact: true,
|
|
69
|
-
transparent: true,
|
|
70
|
-
flush: "end",
|
|
71
|
-
variant: "secondary"
|
|
72
|
-
}, cta))]
|
|
87
|
+
}), ctaNode]
|
|
73
88
|
});
|
|
74
89
|
}
|
|
75
90
|
return null;
|
|
76
|
-
}, [comment, cta, like, share, testID]);
|
|
91
|
+
}, [comment, cta, ctaNode, like, share, testID]);
|
|
77
92
|
return /*#__PURE__*/_jsxs(Card, _objectSpread(_objectSpread({
|
|
78
93
|
borderRadius: borderRadius,
|
|
79
94
|
elevation: elevation,
|
|
@@ -74,9 +74,9 @@ export const MessagingCardLayout = /*#__PURE__*/memo(_ref => {
|
|
|
74
74
|
};
|
|
75
75
|
if (type === 'upsell') {
|
|
76
76
|
return /*#__PURE__*/_jsx(Button, {
|
|
77
|
-
compact: true,
|
|
78
77
|
accessibilityLabel: actionButtonAccessibilityLabel !== null && actionButtonAccessibilityLabel !== void 0 ? actionButtonAccessibilityLabel : action,
|
|
79
78
|
onClick: handleActionClick,
|
|
79
|
+
size: "s",
|
|
80
80
|
variant: "secondary",
|
|
81
81
|
children: action
|
|
82
82
|
});
|
|
@@ -121,10 +121,10 @@ export const MessagingCardLayout = /*#__PURE__*/memo(_ref => {
|
|
|
121
121
|
style: styles === null || styles === void 0 ? void 0 : styles.dismissButtonContainer,
|
|
122
122
|
top: 0,
|
|
123
123
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
124
|
-
compact: true,
|
|
125
124
|
accessibilityLabel: computedDismissButtonAccessibilityLabel,
|
|
126
125
|
name: "close",
|
|
127
126
|
onClick: handleDismiss,
|
|
127
|
+
size: "s",
|
|
128
128
|
variant: "secondary"
|
|
129
129
|
})
|
|
130
130
|
});
|
package/esm/cards/NudgeCard.js
CHANGED
|
@@ -66,7 +66,7 @@ const getCardBodyPaddingProps = _ref => {
|
|
|
66
66
|
* title="Title"
|
|
67
67
|
* description="Description"
|
|
68
68
|
* media={<Pictogram dimension="48x48" name="addToWatchlist" />}
|
|
69
|
-
* actions={<Button
|
|
69
|
+
* actions={<Button size="s" variant="secondary">Learn more</Button>}
|
|
70
70
|
* onDismiss={handleDismiss}
|
|
71
71
|
* mediaPlacement="end"
|
|
72
72
|
* />
|
package/esm/cards/UpsellCard.js
CHANGED
|
@@ -34,7 +34,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
34
34
|
* title="Title"
|
|
35
35
|
* description="Description"
|
|
36
36
|
* media={<RemoteImage ... />}
|
|
37
|
-
* actions={<Button
|
|
37
|
+
* actions={<Button size="s" variant="secondary">Get Started</Button>}
|
|
38
38
|
* onDismiss={handleDismiss}
|
|
39
39
|
* mediaPlacement="end"
|
|
40
40
|
* />
|
|
@@ -102,10 +102,10 @@ export const UpsellCard = /*#__PURE__*/memo(_ref => {
|
|
|
102
102
|
}), !!action && /*#__PURE__*/_jsx(HStack, {
|
|
103
103
|
paddingStart: 2,
|
|
104
104
|
children: /*#__PURE__*/isValidElement(action) ? action : /*#__PURE__*/_jsx(Button, {
|
|
105
|
-
compact: true,
|
|
106
105
|
flush: "start",
|
|
107
106
|
numberOfLines: 1,
|
|
108
107
|
onClick: onActionPress,
|
|
108
|
+
size: "s",
|
|
109
109
|
variant: "secondary",
|
|
110
110
|
children: action
|
|
111
111
|
})
|
|
@@ -8,6 +8,8 @@ import { IconButton } from '../buttons/IconButton';
|
|
|
8
8
|
import { cx } from '../cx';
|
|
9
9
|
import { HStack } from '../layout/HStack';
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
/** Size the navigation buttons render at when neither `iconButtonSize` nor `compact` is set. */
|
|
12
|
+
const defaultIconButtonSize = 's';
|
|
11
13
|
const navigationCss = "navigationCss-n15h1fxo";
|
|
12
14
|
export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarouselNavigation(_ref) {
|
|
13
15
|
var _testIDMap$autoplayBu, _testIDMap$previousBu, _testIDMap$nextButton;
|
|
@@ -28,6 +30,7 @@ export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarou
|
|
|
28
30
|
startIcon = 'play',
|
|
29
31
|
stopIcon = 'pause',
|
|
30
32
|
variant = 'secondary',
|
|
33
|
+
iconButtonSize,
|
|
31
34
|
compact,
|
|
32
35
|
className,
|
|
33
36
|
classNames,
|
|
@@ -36,6 +39,10 @@ export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarou
|
|
|
36
39
|
testIDMap,
|
|
37
40
|
hideUnlessFocused
|
|
38
41
|
} = _ref;
|
|
42
|
+
// `compact` was forwarded straight to `IconButton`, which defaults its own `compact` to `true` —
|
|
43
|
+
// so these buttons have always rendered dense unless a caller explicitly passed `compact={false}`,
|
|
44
|
+
// which then fell back to IconButton's `l`. `iconButtonSize` wins when set.
|
|
45
|
+
const resolvedIconButtonSize = iconButtonSize !== null && iconButtonSize !== void 0 ? iconButtonSize : (compact !== null && compact !== void 0 ? compact : true) ? defaultIconButtonSize : 'l';
|
|
39
46
|
return /*#__PURE__*/_jsxs(HStack, {
|
|
40
47
|
className: cx(navigationCss, className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
41
48
|
"data-hiddenunlessfocused": hideUnlessFocused,
|
|
@@ -44,29 +51,29 @@ export const DefaultCarouselNavigation = /*#__PURE__*/memo(function DefaultCarou
|
|
|
44
51
|
children: [autoplay && /*#__PURE__*/_jsx(IconButton, {
|
|
45
52
|
accessibilityLabel: isAutoplayStopped ? startAutoplayAccessibilityLabel : stopAutoplayAccessibilityLabel,
|
|
46
53
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.autoplayButton,
|
|
47
|
-
compact: compact,
|
|
48
54
|
name: isAutoplayStopped ? startIcon : stopIcon,
|
|
49
55
|
onClick: onToggleAutoplay,
|
|
56
|
+
size: resolvedIconButtonSize,
|
|
50
57
|
style: styles === null || styles === void 0 ? void 0 : styles.autoplayButton,
|
|
51
58
|
testID: (_testIDMap$autoplayBu = testIDMap === null || testIDMap === void 0 ? void 0 : testIDMap.autoplayButton) !== null && _testIDMap$autoplayBu !== void 0 ? _testIDMap$autoplayBu : 'carousel-autoplay-button',
|
|
52
59
|
variant: variant
|
|
53
60
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
54
61
|
accessibilityLabel: previousPageAccessibilityLabel,
|
|
55
62
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.previousButton,
|
|
56
|
-
compact: compact,
|
|
57
63
|
disabled: disableGoPrevious,
|
|
58
64
|
name: previousIcon,
|
|
59
65
|
onClick: onGoPrevious,
|
|
66
|
+
size: resolvedIconButtonSize,
|
|
60
67
|
style: styles === null || styles === void 0 ? void 0 : styles.previousButton,
|
|
61
68
|
testID: (_testIDMap$previousBu = testIDMap === null || testIDMap === void 0 ? void 0 : testIDMap.previousButton) !== null && _testIDMap$previousBu !== void 0 ? _testIDMap$previousBu : 'carousel-previous-button',
|
|
62
69
|
variant: variant
|
|
63
70
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
64
71
|
accessibilityLabel: nextPageAccessibilityLabel,
|
|
65
72
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.nextButton,
|
|
66
|
-
compact: compact,
|
|
67
73
|
disabled: disableGoNext,
|
|
68
74
|
name: nextIcon,
|
|
69
75
|
onClick: onGoNext,
|
|
76
|
+
size: resolvedIconButtonSize,
|
|
70
77
|
style: styles === null || styles === void 0 ? void 0 : styles.nextButton,
|
|
71
78
|
testID: (_testIDMap$nextButton = testIDMap === null || testIDMap === void 0 ? void 0 : testIDMap.nextButton) !== null && _testIDMap$nextButton !== void 0 ? _testIDMap$nextButton : 'carousel-next-button',
|
|
72
79
|
variant: variant
|
package/esm/chips/Chip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["as", "alignItems", "width", "height", "compact", "gap", "start", "end", "paddingX", "paddingY", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "justifyContent", "children", "maxWidth", "invertColorScheme", "inverted", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "className", "styles", "classNames", "font", "color", "onClick"];
|
|
1
|
+
const _excluded = ["as", "alignItems", "width", "height", "compact", "size", "gap", "start", "end", "paddingX", "paddingY", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "justifyContent", "children", "maxWidth", "invertColorScheme", "inverted", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "className", "styles", "classNames", "font", "color", "onClick"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -17,6 +17,21 @@ import { Pressable } from '../system/Pressable';
|
|
|
17
17
|
import { InvertedThemeProvider } from '../system/ThemeProvider';
|
|
18
18
|
import { Text } from '../typography/Text';
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const chipSizes = {
|
|
21
|
+
xs: {
|
|
22
|
+
paddingX: 1.5,
|
|
23
|
+
paddingY: 0.75,
|
|
24
|
+
font: 'label1',
|
|
25
|
+
borderRadius: 700
|
|
26
|
+
},
|
|
27
|
+
s: {
|
|
28
|
+
paddingX: 2,
|
|
29
|
+
paddingY: 1,
|
|
30
|
+
font: 'headline',
|
|
31
|
+
borderRadius: 700
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const defaultChipSize = 's';
|
|
20
35
|
const transitionCss = "transitionCss-thdcix9";
|
|
21
36
|
|
|
22
37
|
/**
|
|
@@ -25,18 +40,22 @@ const transitionCss = "transitionCss-thdcix9";
|
|
|
25
40
|
* When onClick is not provided, the ref will be typed as HTMLDivElement.
|
|
26
41
|
*/
|
|
27
42
|
export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_props, ref) {
|
|
43
|
+
var _mergedProps$size;
|
|
28
44
|
const mergedProps = useComponentConfig('Chip', _props);
|
|
45
|
+
// Geometry is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
|
|
46
|
+
const sizeConfig = chipSizes[(_mergedProps$size = mergedProps.size) !== null && _mergedProps$size !== void 0 ? _mergedProps$size : mergedProps.compact ? 'xs' : defaultChipSize];
|
|
29
47
|
const {
|
|
30
48
|
as,
|
|
31
49
|
alignItems = 'center',
|
|
32
50
|
width = 'fit-content',
|
|
33
51
|
height = 'fit-content',
|
|
34
52
|
compact,
|
|
53
|
+
size: _size,
|
|
35
54
|
gap = 1,
|
|
36
55
|
start,
|
|
37
56
|
end,
|
|
38
|
-
paddingX =
|
|
39
|
-
paddingY =
|
|
57
|
+
paddingX = sizeConfig.paddingX,
|
|
58
|
+
paddingY = sizeConfig.paddingY,
|
|
40
59
|
padding,
|
|
41
60
|
paddingTop,
|
|
42
61
|
paddingBottom,
|
|
@@ -50,13 +69,13 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_pro
|
|
|
50
69
|
numberOfLines = 1,
|
|
51
70
|
testID,
|
|
52
71
|
contentStyle,
|
|
53
|
-
borderRadius =
|
|
72
|
+
borderRadius = sizeConfig.borderRadius,
|
|
54
73
|
background = 'bgSecondary',
|
|
55
74
|
style,
|
|
56
75
|
className,
|
|
57
76
|
styles,
|
|
58
77
|
classNames,
|
|
59
|
-
font =
|
|
78
|
+
font = sizeConfig.font,
|
|
60
79
|
color = 'fg',
|
|
61
80
|
onClick
|
|
62
81
|
} = mergedProps,
|
package/esm/chips/MediaChip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["start", "children", "end", "compact", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd"];
|
|
1
|
+
const _excluded = ["start", "children", "end", "compact", "size", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -18,6 +18,7 @@ export const MediaChip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Medi
|
|
|
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(/*#__PURE__*/forwardRef(function Medi
|
|
|
27
28
|
paddingEnd
|
|
28
29
|
} = mergedProps,
|
|
29
30
|
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
31
|
+
// Spacing is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
|
|
32
|
+
const resolvedSize = size !== null && size !== void 0 ? 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(/*#__PURE__*/forwardRef(function Medi
|
|
|
43
46
|
paddingStart: paddingStart !== null && paddingStart !== void 0 ? paddingStart : defaults.paddingStart,
|
|
44
47
|
paddingEnd: paddingEnd !== null && paddingEnd !== void 0 ? paddingEnd : defaults.paddingEnd
|
|
45
48
|
};
|
|
46
|
-
}, [
|
|
49
|
+
}, [resolvedSize, start, end, children, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingStart, paddingEnd]);
|
|
47
50
|
return /*#__PURE__*/_jsx(Chip, _objectSpread(_objectSpread(_objectSpread({
|
|
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
|
|
@@ -37,6 +37,9 @@ export const NativeInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Na
|
|
|
37
37
|
const {
|
|
38
38
|
activeColorScheme
|
|
39
39
|
} = useTheme();
|
|
40
|
+
// NativeInput has no `size` prop, so the deprecated `compact` still drives its own
|
|
41
|
+
// padding here. When rendered inside TextInput, `containerSpacing` (size-derived) is
|
|
42
|
+
// passed and overrides this fallback.
|
|
40
43
|
const defaultContainerPadding = compact ? compactContainerPaddingCss : originalContainerPaddingCss;
|
|
41
44
|
const dynamicStyles = useMemo(() => _objectSpread({
|
|
42
45
|
textAlign: align,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["onChange", "onClear", "onChangeText", "onSearch", "testID", "value", "compact", "hideStartIcon", "hideEndIcon", "startIcon", "end", "startIconAccessibilityLabel", "clearIconAccessibilityLabel", "borderRadius"
|
|
1
|
+
const _excluded = ["onChange", "onClear", "onChangeText", "onSearch", "testID", "value", "compact", "size", "hideStartIcon", "hideEndIcon", "startIcon", "end", "startIconAccessibilityLabel", "clearIconAccessibilityLabel", "borderRadius"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -15,7 +15,7 @@ import { InputIconButton } from './InputIconButton';
|
|
|
15
15
|
import { TextInput } from './TextInput';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated Use local constants or the `
|
|
18
|
+
* @deprecated Use local constants or the `size` prop instead. This will be removed in a future major release.
|
|
19
19
|
* @deprecationExpectedRemoval v10
|
|
20
20
|
*/
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -23,6 +23,9 @@ export const scales = {
|
|
|
23
23
|
regular: 56,
|
|
24
24
|
compact: 40
|
|
25
25
|
};
|
|
26
|
+
|
|
27
|
+
/** T-shirt size for SearchInput. Aliases the TextInput size union. */
|
|
28
|
+
|
|
26
29
|
export const SearchInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
|
|
27
30
|
const mergedProps = useComponentConfig('SearchInput', _props);
|
|
28
31
|
const {
|
|
@@ -33,18 +36,22 @@ export const SearchInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, re
|
|
|
33
36
|
testID,
|
|
34
37
|
value,
|
|
35
38
|
compact,
|
|
39
|
+
size,
|
|
36
40
|
hideStartIcon = false,
|
|
37
41
|
hideEndIcon,
|
|
38
42
|
startIcon,
|
|
39
43
|
end,
|
|
40
44
|
startIconAccessibilityLabel = 'Back',
|
|
41
45
|
clearIconAccessibilityLabel = 'Clear search query',
|
|
42
|
-
borderRadius = 1000
|
|
43
|
-
height = compact ? scales.compact : scales.regular
|
|
46
|
+
borderRadius = 1000
|
|
44
47
|
} = mergedProps,
|
|
45
48
|
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
46
49
|
const internalRef = useRef(null);
|
|
47
50
|
const refs = useMergeRefs(ref, internalRef);
|
|
51
|
+
|
|
52
|
+
// Field geometry is handled by TextInput; this only drives SearchInput's own clear-button
|
|
53
|
+
// spacing. `size` wins over the deprecated `compact`, which maps to its legacy `s` size.
|
|
54
|
+
const resolvedSize = size !== null && size !== void 0 ? size : compact ? 's' : 'l';
|
|
48
55
|
const handleOnChange = useCallback(e => {
|
|
49
56
|
onChange === null || onChange === void 0 || onChange(e);
|
|
50
57
|
onChangeText === null || onChangeText === void 0 || onChangeText(e.target.value);
|
|
@@ -66,9 +73,10 @@ export const SearchInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, re
|
|
|
66
73
|
return /*#__PURE__*/_jsx(TextInput, _objectSpread({
|
|
67
74
|
ref: refs,
|
|
68
75
|
borderRadius: borderRadius,
|
|
76
|
+
compact: compact,
|
|
69
77
|
end: end !== null && end !== void 0 ? end : !!value && !hideEndIcon && /*#__PURE__*/_jsx(Box, {
|
|
70
|
-
marginEnd:
|
|
71
|
-
paddingEnd:
|
|
78
|
+
marginEnd: resolvedSize === 's' ? -0.5 : 0,
|
|
79
|
+
paddingEnd: resolvedSize === 's' ? 0 : 0.5,
|
|
72
80
|
children: /*#__PURE__*/_jsx(InputIconButton, {
|
|
73
81
|
accessibilityLabel: clearIconAccessibilityLabel,
|
|
74
82
|
name: "close",
|
|
@@ -76,10 +84,10 @@ export const SearchInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, re
|
|
|
76
84
|
testID: testID && "".concat(testID, "-close-iconbtn")
|
|
77
85
|
})
|
|
78
86
|
}),
|
|
79
|
-
height: height,
|
|
80
87
|
onChange: handleOnChange,
|
|
81
88
|
onKeyUp: handleOnKeyUp,
|
|
82
89
|
role: "searchbox",
|
|
90
|
+
size: size,
|
|
83
91
|
start: !hideStartIcon && /*#__PURE__*/_jsx(InputIcon, {
|
|
84
92
|
accessibilityLabel: determineStartIconAccessibilityLabel,
|
|
85
93
|
name: startIcon !== null && startIcon !== void 0 ? startIcon : 'search',
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
@layer cds{.nativeInputContainerCss-nvfk24{padding-top:var(--space-2);padding-bottom:var(--space-2);padding-inline-start:var(--space-2);padding-inline-end:var(--space-2);}.nativeInputContainerCss-nvfk24[data-
|
|
2
|
-
.insideLabelCss-i1dqgbcz{padding-top:var(--space-
|
|
1
|
+
@layer cds{.nativeInputContainerCss-nvfk24{padding-top:var(--space-2);padding-bottom:var(--space-2);padding-inline-start:var(--space-2);padding-inline-end:var(--space-2);}.nativeInputContainerCss-nvfk24[data-size='m']{padding-top:var(--space-1_5);padding-bottom:var(--space-1_5);}.nativeInputContainerCss-nvfk24[data-size='s']{padding-top:var(--space-1);padding-bottom:var(--space-1);}.nativeInputContainerCss-nvfk24[data-labelvariant='inside']{padding-top:0;padding-bottom:var(--space-0_75);}.nativeInputContainerCss-nvfk24[data-inlinelabel='true']{padding-inline-start:var(--space-1);}.nativeInputContainerCss-nvfk24[data-start='true']{padding-inline-start:var(--space-0_5);}
|
|
2
|
+
.insideLabelCss-i1dqgbcz{padding-top:var(--space-0_75);padding-bottom:0;padding-inline-start:var(--space-2);padding-inline-end:var(--space-2);}
|
|
3
3
|
.insideLabelCssStartCss-i1scwjk{padding-inline-start:var(--space-0_5);}}
|