@coinbase/cds-mobile 9.9.0 → 9.10.1

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dts/alpha/combobox/Combobox.d.ts.map +1 -1
  3. package/dts/alpha/select/DefaultSelectControl.d.ts +1 -0
  4. package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
  5. package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
  6. package/dts/alpha/select/Select.d.ts +1 -0
  7. package/dts/alpha/select/Select.d.ts.map +1 -1
  8. package/dts/alpha/select/types.d.ts +27 -2
  9. package/dts/alpha/select/types.d.ts.map +1 -1
  10. package/dts/alpha/select-chip/SelectChip.d.ts +8 -2
  11. package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -1
  12. package/dts/alpha/select-chip/SelectChipControl.d.ts +3 -4
  13. package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -1
  14. package/dts/alpha/tabbed-chips/TabbedChips.d.ts +8 -1
  15. package/dts/alpha/tabbed-chips/TabbedChips.d.ts.map +1 -1
  16. package/dts/buttons/AvatarButton.d.ts +7 -3
  17. package/dts/buttons/AvatarButton.d.ts.map +1 -1
  18. package/dts/buttons/Button.d.ts +21 -2
  19. package/dts/buttons/Button.d.ts.map +1 -1
  20. package/dts/buttons/DefaultSlideButtonBackground.d.ts +2 -2
  21. package/dts/buttons/DefaultSlideButtonBackground.d.ts.map +1 -1
  22. package/dts/buttons/DefaultSlideButtonHandle.d.ts +20 -10
  23. package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
  24. package/dts/buttons/IconButton.d.ts +18 -5
  25. package/dts/buttons/IconButton.d.ts.map +1 -1
  26. package/dts/buttons/SlideButton.d.ts +47 -9
  27. package/dts/buttons/SlideButton.d.ts.map +1 -1
  28. package/dts/cards/CardBody.d.ts.map +1 -1
  29. package/dts/cards/FeedCard.d.ts.map +1 -1
  30. package/dts/cards/NudgeCard.d.ts +1 -1
  31. package/dts/cards/UpsellCard.d.ts +1 -1
  32. package/dts/carousel/DefaultCarouselNavigation.d.ts +8 -0
  33. package/dts/carousel/DefaultCarouselNavigation.d.ts.map +1 -1
  34. package/dts/chips/Chip.d.ts +3 -2
  35. package/dts/chips/Chip.d.ts.map +1 -1
  36. package/dts/chips/ChipProps.d.ts +11 -1
  37. package/dts/chips/ChipProps.d.ts.map +1 -1
  38. package/dts/chips/MediaChip.d.ts +1 -0
  39. package/dts/chips/MediaChip.d.ts.map +1 -1
  40. package/dts/controls/InputIcon.d.ts +6 -0
  41. package/dts/controls/InputIcon.d.ts.map +1 -1
  42. package/dts/controls/InputIconButton.d.ts +3 -1
  43. package/dts/controls/InputIconButton.d.ts.map +1 -1
  44. package/dts/controls/InputStack.d.ts.map +1 -1
  45. package/dts/controls/NativeInput.d.ts +7 -2
  46. package/dts/controls/NativeInput.d.ts.map +1 -1
  47. package/dts/controls/SearchInput.d.ts +4 -1
  48. package/dts/controls/SearchInput.d.ts.map +1 -1
  49. package/dts/controls/TextInput.d.ts +24 -2
  50. package/dts/controls/TextInput.d.ts.map +1 -1
  51. package/dts/dates/DateInput.d.ts +18 -3
  52. package/dts/dates/DateInput.d.ts.map +1 -1
  53. package/dts/dates/DatePicker.d.ts +13 -0
  54. package/dts/dates/DatePicker.d.ts.map +1 -1
  55. package/dts/gradients/LinearGradient.d.ts.map +1 -1
  56. package/dts/navigation/BrowserBarSearchInput.d.ts +1 -1
  57. package/dts/navigation/BrowserBarSearchInput.d.ts.map +1 -1
  58. package/esm/__stories__/SizeComposition.stories.js +237 -0
  59. package/esm/alpha/combobox/Combobox.js +1 -1
  60. package/esm/alpha/combobox/__stories__/Combobox.stories.js +34 -0
  61. package/esm/alpha/select/DefaultSelectControl.js +71 -22
  62. package/esm/alpha/select/DefaultSelectDropdown.js +5 -2
  63. package/esm/alpha/select/Select.js +9 -3
  64. package/esm/alpha/select/__stories__/AlphaSelect.stories.js +31 -0
  65. package/esm/alpha/select/types.js +8 -0
  66. package/esm/alpha/select-chip/SelectChip.js +14 -7
  67. package/esm/alpha/select-chip/SelectChipControl.js +2 -0
  68. package/esm/alpha/select-chip/__stories__/AlphaSelectChip.stories.js +31 -1
  69. package/esm/alpha/tabbed-chips/TabbedChips.js +8 -5
  70. package/esm/alpha/tabbed-chips/__stories__/AlphaTabbedChips.stories.js +23 -12
  71. package/esm/buttons/Button.js +52 -7
  72. package/esm/buttons/DefaultSlideButtonBackground.js +3 -2
  73. package/esm/buttons/DefaultSlideButtonHandle.js +13 -12
  74. package/esm/buttons/IconButton.js +38 -4
  75. package/esm/buttons/SlideButton.js +34 -6
  76. package/esm/buttons/__stories__/Button.stories.js +46 -16
  77. package/esm/buttons/__stories__/IconButton.stories.js +58 -11
  78. package/esm/buttons/__stories__/SlideButton.stories.js +18 -9
  79. package/esm/cards/CardBody.js +7 -2
  80. package/esm/cards/FeedCard.js +23 -8
  81. package/esm/cards/MessagingCard/MessagingCardLayout.js +2 -2
  82. package/esm/cards/NudgeCard.js +1 -1
  83. package/esm/cards/UpsellCard.js +2 -2
  84. package/esm/carousel/DefaultCarouselNavigation.js +11 -3
  85. package/esm/chips/Chip.js +24 -6
  86. package/esm/chips/MediaChip.js +7 -3
  87. package/esm/chips/__stories__/Chip.stories.js +9 -3
  88. package/esm/chips/__stories__/InputChip.stories.js +19 -1
  89. package/esm/controls/InputStack.js +6 -2
  90. package/esm/controls/NativeInput.js +7 -2
  91. package/esm/controls/SearchInput.js +2 -0
  92. package/esm/controls/TextInput.js +42 -16
  93. package/esm/controls/__stories__/SearchInput.stories.js +28 -1
  94. package/esm/controls/__stories__/TextInput.stories.js +82 -0
  95. package/esm/dates/DateInput.js +2 -1
  96. package/esm/dates/DatePicker.js +4 -2
  97. package/esm/dates/__stories__/DateInput.stories.js +28 -0
  98. package/esm/dates/__stories__/DatePicker.stories.js +23 -0
  99. package/esm/gradients/LinearGradient.js +32 -7
  100. package/esm/navigation/BrowserBarSearchInput.js +8 -4
  101. package/esm/overlays/Toast.js +1 -1
  102. package/esm/visualizations/ProgressContainerWithButtons.js +2 -2
  103. package/package.json +2 -2
@@ -21,6 +21,7 @@ const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
21
21
  hiddenSelectedOptionsLabel = 'more',
22
22
  label,
23
23
  compact,
24
+ size,
24
25
  invertColorScheme,
25
26
  numberOfLines,
26
27
  maxWidth,
@@ -109,6 +110,7 @@ const SelectChipControlComponent = /*#__PURE__*/memo(_ref => {
109
110
  maxWidth: maxWidth,
110
111
  numberOfLines: numberOfLines,
111
112
  onPress: () => setOpen(s => !s),
113
+ size: size,
112
114
  start: startNode,
113
115
  children: labelContent
114
116
  });
@@ -68,6 +68,33 @@ export const DefaultMulti = () => {
68
68
  value: value
69
69
  });
70
70
  };
71
+ export const SizeXs = () => {
72
+ const exampleOptions = [{
73
+ value: '1',
74
+ label: 'Option 1'
75
+ }, {
76
+ value: '2',
77
+ label: 'Option 2'
78
+ }, {
79
+ value: '3',
80
+ label: 'Option 3'
81
+ }, {
82
+ value: '4',
83
+ label: 'Option 4'
84
+ }];
85
+ const [value, setValue] = useState('1');
86
+ return /*#__PURE__*/_jsx(SelectChip, {
87
+ onChange: setValue,
88
+ options: exampleOptions,
89
+ placeholder: "Choose an option",
90
+ size: "xs",
91
+ value: value
92
+ });
93
+ };
94
+
95
+ /**
96
+ * The `compact` prop is deprecated; it renders as `size="xs"`. Prefer `size="xs"`.
97
+ */
71
98
  export const Compact = () => {
72
99
  const exampleOptions = [{
73
100
  value: '1',
@@ -548,7 +575,10 @@ const SelectChipScreen = () => {
548
575
  title: "Default Multi",
549
576
  children: /*#__PURE__*/_jsx(DefaultMulti, {})
550
577
  }), /*#__PURE__*/_jsx(Example, {
551
- title: "Compact",
578
+ title: 'size="xs"',
579
+ children: /*#__PURE__*/_jsx(SizeXs, {})
580
+ }), /*#__PURE__*/_jsx(Example, {
581
+ title: "Deprecated compact (renders as size xs)",
552
582
  children: /*#__PURE__*/_jsx(Compact, {})
553
583
  }), /*#__PURE__*/_jsx(Example, {
554
584
  title: "With Start End Nodes",
@@ -1,6 +1,6 @@
1
1
  const _excluded = ["label", "id", "activeBackground", "activeColor", "color"],
2
2
  _excluded2 = ["ref"],
3
- _excluded3 = ["tabs", "activeTab", "testID", "TabComponent", "onChange", "width", "gap", "compact", "styles", "autoScrollOffset"];
3
+ _excluded3 = ["tabs", "activeTab", "testID", "TabComponent", "onChange", "width", "gap", "compact", "size", "styles", "autoScrollOffset"];
4
4
  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); }
5
5
  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; }
6
6
  import React, { memo, useCallback, useMemo, useState } from 'react';
@@ -58,10 +58,13 @@ const TabbedChipsComponent = /*#__PURE__*/memo(function TabbedChips(_ref2) {
58
58
  width,
59
59
  gap = 1,
60
60
  compact,
61
+ size,
61
62
  styles,
62
63
  autoScrollOffset = 30
63
64
  } = mergedProps,
64
65
  accessibilityProps = _objectWithoutPropertiesLoose(mergedProps, _excluded3);
66
+ // Size is driven by `size`; deprecated `compact` falls back to its legacy `xs` size.
67
+ const resolvedSize = size != null ? size : compact ? 'xs' : 's';
65
68
  const [scrollTarget, setScrollTarget] = useState(null);
66
69
  const {
67
70
  scrollRef,
@@ -75,11 +78,11 @@ const TabbedChipsComponent = /*#__PURE__*/memo(function TabbedChips(_ref2) {
75
78
  activeTarget: scrollTarget,
76
79
  autoScrollOffset
77
80
  });
78
- const TabComponentWithCompact = useCallback(props => {
81
+ const TabComponentWithSize = useCallback(props => {
79
82
  return /*#__PURE__*/_jsx(TabComponent, _extends({
80
- compact: compact
83
+ size: resolvedSize
81
84
  }, props));
82
- }, [TabComponent, compact]);
85
+ }, [TabComponent, resolvedSize]);
83
86
  return /*#__PURE__*/_jsxs(Box, {
84
87
  ref: ref,
85
88
  overflow: isScrollContentOverflowing ? undefined : 'visible',
@@ -95,7 +98,7 @@ const TabbedChipsComponent = /*#__PURE__*/memo(function TabbedChips(_ref2) {
95
98
  scrollEventThrottle: 1,
96
99
  showsHorizontalScrollIndicator: false,
97
100
  children: /*#__PURE__*/_jsx(Tabs, _extends({
98
- TabComponent: TabComponentWithCompact,
101
+ TabComponent: TabComponentWithSize,
99
102
  TabsActiveIndicatorComponent: TabsActiveIndicatorComponent,
100
103
  activeTab: activeTab || null,
101
104
  gap: gap,
@@ -20,7 +20,8 @@ const enumTabs = [{
20
20
  const Demo = _ref => {
21
21
  let {
22
22
  tabs = defaultTabs,
23
- compact = false,
23
+ compact,
24
+ size,
24
25
  width,
25
26
  autoScrollOffset
26
27
  } = _ref;
@@ -30,6 +31,7 @@ const Demo = _ref => {
30
31
  autoScrollOffset: autoScrollOffset,
31
32
  compact: compact,
32
33
  onChange: setValue,
34
+ size: size,
33
35
  tabs: tabs,
34
36
  width: width
35
37
  });
@@ -48,7 +50,7 @@ const assetIconProps = {
48
50
  source: assets.eth.imageUrl,
49
51
  width: 24
50
52
  };
51
- const compactAssetIconProps = {
53
+ const smallAssetIconProps = {
52
54
  height: 16,
53
55
  shape: 'circle',
54
56
  source: assets.eth.imageUrl,
@@ -57,8 +59,8 @@ const compactAssetIconProps = {
57
59
  const tabsWithStart = defaultTabs.map(tab => _extends({}, tab, {
58
60
  start: /*#__PURE__*/_jsx(RemoteImage, _extends({}, assetIconProps))
59
61
  }));
60
- const compactTabsWithStart = defaultTabs.map(tab => _extends({}, tab, {
61
- start: /*#__PURE__*/_jsx(RemoteImage, _extends({}, compactAssetIconProps))
62
+ const smallTabsWithStart = defaultTabs.map(tab => _extends({}, tab, {
63
+ start: /*#__PURE__*/_jsx(RemoteImage, _extends({}, smallAssetIconProps))
62
64
  }));
63
65
  const activeBackgroundTabs = defaultTabs.map(tab => _extends({}, tab, {
64
66
  activeBackground: 'bgPositive'
@@ -91,17 +93,26 @@ const TabbedChipsScreen = () => {
91
93
  }), /*#__PURE__*/_jsx(Example, {
92
94
  title: "With enum values",
93
95
  children: /*#__PURE__*/_jsx(EnumDemo, {})
96
+ }), /*#__PURE__*/_jsxs(Example, {
97
+ title: "Sizes",
98
+ children: [/*#__PURE__*/_jsx(Demo, {
99
+ size: "s"
100
+ }), /*#__PURE__*/_jsx(Demo, {
101
+ size: "xs"
102
+ })]
94
103
  }), /*#__PURE__*/_jsx(Example, {
95
- title: "With start",
104
+ title: "Deprecated compact (renders as size xs)",
96
105
  children: /*#__PURE__*/_jsx(Demo, {
97
- tabs: tabsWithStart
98
- })
99
- }), /*#__PURE__*/_jsx(Example, {
100
- title: "Compact with start",
101
- children: /*#__PURE__*/_jsx(Demo, {
102
- compact: true,
103
- tabs: compactTabsWithStart
106
+ compact: true
104
107
  })
108
+ }), /*#__PURE__*/_jsxs(Example, {
109
+ title: "Sizes with start",
110
+ children: [/*#__PURE__*/_jsx(Demo, {
111
+ tabs: tabsWithStart
112
+ }), /*#__PURE__*/_jsx(Demo, {
113
+ size: "xs",
114
+ tabs: smallTabsWithStart
115
+ })]
105
116
  }), /*#__PURE__*/_jsx(Example, {
106
117
  title: "With auto scroll offset",
107
118
  children: /*#__PURE__*/_jsx(Demo, {
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["ref"],
2
- _excluded2 = ["variant", "loading", "progressCircleSize", "transparent", "block", "compact", "children", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "flush", "noScaleOnPress", "numberOfLines", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "background", "color", "style", "wrapperStyles", "feedback", "borderColor", "borderWidth", "borderRadius", "accessibilityLabel", "accessibilityHint", "padding", "paddingStart", "paddingEnd", "paddingTop", "paddingBottom", "paddingX", "paddingY"];
2
+ _excluded2 = ["variant", "loading", "progressCircleSize", "transparent", "block", "compact", "size", "children", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "flush", "noScaleOnPress", "numberOfLines", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "background", "color", "style", "wrapperStyles", "feedback", "borderColor", "borderWidth", "borderRadius", "accessibilityLabel", "accessibilityHint", "padding", "paddingStart", "paddingEnd", "paddingTop", "paddingBottom", "paddingX", "paddingY"];
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, { isValidElement, memo, useCallback, useMemo } from 'react';
@@ -14,6 +14,41 @@ import { Text } from '../typography/Text';
14
14
  import { ProgressCircle } from '../visualizations/ProgressCircle';
15
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  const defaultProgressCircleSize = 24;
17
+ const buttonSizes = {
18
+ xs: {
19
+ paddingX: 2,
20
+ paddingY: 0.75,
21
+ borderRadius: 700,
22
+ iconSize: 's',
23
+ font: 'label1',
24
+ feedback: 'light'
25
+ },
26
+ s: {
27
+ paddingX: 2,
28
+ paddingY: 1,
29
+ borderRadius: 700,
30
+ iconSize: 's',
31
+ font: 'headline',
32
+ feedback: 'light'
33
+ },
34
+ m: {
35
+ paddingX: 3,
36
+ paddingY: 1.5,
37
+ borderRadius: 900,
38
+ iconSize: 'm',
39
+ font: 'headline',
40
+ feedback: 'normal'
41
+ },
42
+ l: {
43
+ paddingX: 4,
44
+ paddingY: 2,
45
+ borderRadius: 900,
46
+ iconSize: 'm',
47
+ font: 'headline',
48
+ feedback: 'normal'
49
+ }
50
+ };
51
+ const defaultButtonSize = 'l';
17
52
  export const styles = StyleSheet.create({
18
53
  inline: {
19
54
  width: 'auto'
@@ -42,6 +77,7 @@ export const Button = /*#__PURE__*/memo(function Button(_ref) {
42
77
  transparent,
43
78
  block,
44
79
  compact,
80
+ size,
45
81
  children,
46
82
  start,
47
83
  startIcon,
@@ -52,7 +88,7 @@ export const Button = /*#__PURE__*/memo(function Button(_ref) {
52
88
  flush,
53
89
  noScaleOnPress,
54
90
  numberOfLines = 1,
55
- font = 'headline',
91
+ font: fontProp,
56
92
  fontFamily,
57
93
  fontSize,
58
94
  fontWeight,
@@ -61,11 +97,11 @@ export const Button = /*#__PURE__*/memo(function Button(_ref) {
61
97
  color,
62
98
  style,
63
99
  wrapperStyles,
64
- feedback = compact ? 'light' : 'normal',
100
+ feedback: feedbackProp,
65
101
  borderColor,
66
102
  borderWidth = 0,
67
103
  // remove Pressable's default transparent border
68
- borderRadius = compact ? 700 : 900,
104
+ borderRadius: borderRadiusProp,
69
105
  accessibilityLabel,
70
106
  accessibilityHint,
71
107
  padding,
@@ -73,12 +109,21 @@ export const Button = /*#__PURE__*/memo(function Button(_ref) {
73
109
  paddingEnd,
74
110
  paddingTop,
75
111
  paddingBottom,
76
- paddingX = compact ? 2 : 4,
77
- paddingY = compact ? 1 : 2
112
+ paddingX: paddingXProp,
113
+ paddingY: paddingYProp
78
114
  } = mergedProps,
79
115
  props = _objectWithoutPropertiesLoose(mergedProps, _excluded2);
80
116
  const theme = useTheme();
81
- const iconSize = compact ? 's' : 'm';
117
+
118
+ // `size` wins when both `size` and `compact` are set; compact-only maps to `s`.
119
+ const resolvedSize = size != null ? size : compact ? 's' : defaultButtonSize;
120
+ const sizeConfig = buttonSizes[resolvedSize];
121
+ const font = fontProp != null ? fontProp : sizeConfig.font;
122
+ const feedback = feedbackProp != null ? feedbackProp : sizeConfig.feedback;
123
+ const borderRadius = borderRadiusProp != null ? borderRadiusProp : sizeConfig.borderRadius;
124
+ const paddingX = paddingXProp != null ? paddingXProp : sizeConfig.paddingX;
125
+ const paddingY = paddingYProp != null ? paddingYProp : sizeConfig.paddingY;
126
+ const iconSize = sizeConfig.iconSize;
82
127
  const hasIcon = Boolean(startIcon || endIcon);
83
128
  const variantMap = transparent ? transparentVariants : variants;
84
129
  const variantStyle = variantMap[variant];
@@ -2,6 +2,7 @@ import React, { memo } from 'react';
2
2
  import Animated, { useAnimatedStyle } from 'react-native-reanimated';
3
3
  import { Box } from '../layout/Box';
4
4
  import { Text } from '../typography/Text';
5
+ import { defaultSlideButtonSize, slideButtonSizes } from './SlideButton';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
7
  export const DefaultSlideButtonBackground = /*#__PURE__*/memo(_ref => {
7
8
  let {
@@ -9,7 +10,7 @@ export const DefaultSlideButtonBackground = /*#__PURE__*/memo(_ref => {
9
10
  progress,
10
11
  uncheckedLabel,
11
12
  disabled,
12
- compact,
13
+ size = defaultSlideButtonSize,
13
14
  style,
14
15
  borderRadius,
15
16
  borderTopLeftRadius,
@@ -17,7 +18,7 @@ export const DefaultSlideButtonBackground = /*#__PURE__*/memo(_ref => {
17
18
  borderBottomLeftRadius,
18
19
  borderBottomRightRadius
19
20
  } = _ref;
20
- const horizontalPadding = compact ? 7 : 9;
21
+ const horizontalPadding = slideButtonSizes[size].backgroundPadding;
21
22
  const animatedStyle = useAnimatedStyle(() => ({
22
23
  opacity: disabled ? 0.5 : 1 - progress.value
23
24
  }), [progress, disabled]);
@@ -1,4 +1,4 @@
1
- const _excluded = ["ref", "checked", "compact", "disabled", "style", "variant", "startUncheckedNode", "endCheckedNode", "checkedLabel", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius"];
1
+ const _excluded = ["ref", "checked", "size", "disabled", "style", "variant", "startUncheckedNode", "endCheckedNode", "checkedLabel", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius"];
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, { memo, useEffect, useMemo } from 'react';
@@ -11,6 +11,7 @@ import { Box } from '../layout/Box';
11
11
  import { Pressable } from '../system/Pressable';
12
12
  import { Text } from '../typography/Text';
13
13
  import { ProgressCircle } from '../visualizations/ProgressCircle';
14
+ import { defaultSlideButtonSize, slideButtonSizes } from './SlideButton';
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  export const slideButtonSpringConfig = {
16
17
  stiffness: 300,
@@ -48,11 +49,11 @@ export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
48
49
  let {
49
50
  label,
50
51
  end,
51
- compact
52
+ size = defaultSlideButtonSize
52
53
  } = _ref;
53
54
  const theme = useTheme();
54
- const iconSize = compact ? 's' : 'm';
55
- const iconSizeValue = theme.iconSize[iconSize];
55
+ const sizeConfig = slideButtonSizes[size];
56
+ const iconSizeValue = theme.iconSize[sizeConfig.iconSize];
56
57
  return /*#__PURE__*/_jsxs(Box, {
57
58
  alignItems: "center",
58
59
  height: "100%",
@@ -66,7 +67,7 @@ export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
66
67
  alignItems: "center",
67
68
  height: "100%",
68
69
  justifyContent: "center",
69
- padding: compact ? 1.5 : 2,
70
+ padding: sizeConfig.handlePadding,
70
71
  pin: "right",
71
72
  children: end != null ? end : /*#__PURE__*/_jsx(ProgressCircle, {
72
73
  indeterminate: true,
@@ -80,19 +81,19 @@ export const SlideButtonHandleChecked = /*#__PURE__*/memo(_ref => {
80
81
  export const SlideButtonHandleUnchecked = /*#__PURE__*/memo(_ref2 => {
81
82
  let {
82
83
  start,
83
- compact
84
+ size = defaultSlideButtonSize
84
85
  } = _ref2;
85
- const iconSize = compact ? 's' : 'm';
86
+ const sizeConfig = slideButtonSizes[size];
86
87
  return /*#__PURE__*/_jsx(Box, {
87
88
  alignItems: "center",
88
89
  height: "100%",
89
90
  justifyContent: "center",
90
- padding: compact ? 1.5 : 2,
91
+ padding: sizeConfig.handlePadding,
91
92
  pin: "right",
92
93
  children: start != null ? start : /*#__PURE__*/_jsx(Icon, {
93
94
  color: "fgInverse",
94
95
  name: "forwardArrow",
95
- size: iconSize
96
+ size: sizeConfig.iconSize
96
97
  })
97
98
  });
98
99
  });
@@ -100,7 +101,7 @@ export const DefaultSlideButtonHandle = /*#__PURE__*/memo(_ref3 => {
100
101
  let {
101
102
  ref,
102
103
  checked,
103
- compact,
104
+ size = defaultSlideButtonSize,
104
105
  disabled,
105
106
  style,
106
107
  variant = 'primary',
@@ -149,17 +150,17 @@ export const DefaultSlideButtonHandle = /*#__PURE__*/memo(_ref3 => {
149
150
  children: [/*#__PURE__*/_jsx(Animated.View, {
150
151
  style: [styles.absoluteContainer, animatedCheckedStyle],
151
152
  children: /*#__PURE__*/_jsx(SlideButtonHandleChecked, {
152
- compact: compact,
153
153
  disabled: disabled,
154
154
  end: endCheckedNode,
155
155
  label: checkedLabel,
156
+ size: size,
156
157
  variant: variant
157
158
  })
158
159
  }), /*#__PURE__*/_jsx(Animated.View, {
159
160
  style: [styles.absoluteContainer, animatedUncheckedStyle],
160
161
  children: /*#__PURE__*/_jsx(SlideButtonHandleUnchecked, {
161
- compact: compact,
162
162
  disabled: disabled,
163
+ size: size,
163
164
  start: startUncheckedNode,
164
165
  variant: variant
165
166
  })
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["ref"],
2
- _excluded2 = ["name", "active", "variant", "alignSelf", "transparent", "compact", "background", "color", "borderColor", "iconSize", "borderWidth", "borderRadius", "feedback", "flush", "padding", "loading", "progressCircleSize", "style", "styles", "accessibilityHint", "accessibilityLabel"];
2
+ _excluded2 = ["name", "active", "variant", "alignSelf", "transparent", "compact", "size", "background", "color", "borderColor", "iconSize", "borderWidth", "borderRadius", "feedback", "flush", "padding", "loading", "progressCircleSize", "style", "styles", "accessibilityHint", "accessibilityLabel"];
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 } from 'react';
@@ -10,6 +10,29 @@ import { Icon } from '../icons/Icon';
10
10
  import { Pressable } from '../system/Pressable';
11
11
  import { ProgressCircle } from '../visualizations/ProgressCircle';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ const iconButtonSizes = {
14
+ xs: {
15
+ padding: 1,
16
+ iconSize: 's',
17
+ feedback: 'light'
18
+ },
19
+ s: {
20
+ padding: 1.5,
21
+ iconSize: 's',
22
+ feedback: 'light'
23
+ },
24
+ m: {
25
+ padding: 1.5,
26
+ iconSize: 'm',
27
+ feedback: 'normal'
28
+ },
29
+ l: {
30
+ padding: 2,
31
+ iconSize: 'm',
32
+ feedback: 'normal'
33
+ }
34
+ };
35
+ const defaultIconButtonSize = 'l';
13
36
  export const IconButton = /*#__PURE__*/memo(_ref => {
14
37
  let {
15
38
  ref
@@ -24,16 +47,18 @@ export const IconButton = /*#__PURE__*/memo(_ref => {
24
47
  // prevents stretching when placed in a flex container
25
48
  transparent,
26
49
  compact = true,
50
+ size,
27
51
  background,
28
52
  color,
29
53
  borderColor,
30
- iconSize = compact ? 's' : 'm',
54
+ iconSize: iconSizeProp,
31
55
  borderWidth = 0,
32
56
  // remove Pressable's default transparent border
33
57
  borderRadius = 1000,
34
- feedback = compact ? 'light' : 'normal',
58
+ // fully rounded at every size
59
+ feedback: feedbackProp,
35
60
  flush,
36
- padding = compact ? 1.5 : 2,
61
+ padding: paddingProp,
37
62
  loading,
38
63
  progressCircleSize,
39
64
  styles,
@@ -41,6 +66,15 @@ export const IconButton = /*#__PURE__*/memo(_ref => {
41
66
  accessibilityLabel
42
67
  } = mergedProps,
43
68
  props = _objectWithoutPropertiesLoose(mergedProps, _excluded2);
69
+
70
+ // `size` wins when both `size` and `compact` are set. IconButton defaults `compact`
71
+ // to `true`, so with no explicit `size` the button resolves to `s`. The resolved size
72
+ // also drives haptic `feedback` (xs/s -> light, m/l -> normal).
73
+ const resolvedSize = size != null ? size : compact ? 's' : defaultIconButtonSize;
74
+ const sizeConfig = iconButtonSizes[resolvedSize];
75
+ const padding = paddingProp != null ? paddingProp : sizeConfig.padding;
76
+ const iconSize = iconSizeProp != null ? iconSizeProp : sizeConfig.iconSize;
77
+ const feedback = feedbackProp != null ? feedbackProp : sizeConfig.feedback;
44
78
  const theme = useTheme();
45
79
  const iconSizeValue = theme.iconSize[iconSize];
46
80
  const variantMap = transparent ? transparentVariants : variants;
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["ref"],
2
- _excluded2 = ["checked", "compact", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "uncheckedLabel", "checkedLabel", "onSlideStart", "onSlideCancel", "onSlideEnd", "onSlideComplete", "onChange", "disabled", "height", "checkThreshold", "SlideButtonHandleComponent", "SlideButtonBackgroundComponent", "styles", "testID", "autoCompleteSlideOnThresholdMet", "variant", "startUncheckedNode", "endCheckedNode"];
2
+ _excluded2 = ["checked", "compact", "size", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "uncheckedLabel", "checkedLabel", "onSlideStart", "onSlideCancel", "onSlideEnd", "onSlideComplete", "onChange", "disabled", "height", "checkThreshold", "SlideButtonHandleComponent", "SlideButtonBackgroundComponent", "styles", "testID", "autoCompleteSlideOnThresholdMet", "variant", "startUncheckedNode", "endCheckedNode"];
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, { memo, useCallback, useEffect, useId, useMemo } from 'react';
@@ -13,17 +13,45 @@ import { DefaultSlideButtonHandle, slideButtonSpringConfig } from './DefaultSlid
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  export const slideButtonTestID = 'slide-button';
15
15
  export const DEFAULT_COMPACT_HEIGHT = 40;
16
+ export const DEFAULT_MEDIUM_HEIGHT = 48;
16
17
  export const DEFAULT_REGULAR_HEIGHT = 56;
18
+ export const slideButtonSizes = {
19
+ s: {
20
+ height: DEFAULT_COMPACT_HEIGHT,
21
+ borderRadius: 700,
22
+ iconSize: 's',
23
+ handlePadding: 1.5,
24
+ backgroundPadding: 7
25
+ },
26
+ m: {
27
+ height: DEFAULT_MEDIUM_HEIGHT,
28
+ borderRadius: 900,
29
+ iconSize: 'm',
30
+ handlePadding: 2,
31
+ backgroundPadding: 9
32
+ },
33
+ l: {
34
+ height: DEFAULT_REGULAR_HEIGHT,
35
+ borderRadius: 900,
36
+ iconSize: 'm',
37
+ handlePadding: 2,
38
+ backgroundPadding: 9
39
+ }
40
+ };
41
+ export const defaultSlideButtonSize = 'l';
17
42
  export const SlideButton = /*#__PURE__*/memo(_ref => {
43
+ var _mergedProps$size;
18
44
  let {
19
45
  ref
20
46
  } = _ref,
21
47
  _props = _objectWithoutPropertiesLoose(_ref, _excluded);
22
48
  const mergedProps = useComponentConfig('SlideButton', _props);
49
+ // `size` wins when both are set; compact-only maps to `s`.
50
+ const resolvedSize = (_mergedProps$size = mergedProps.size) != null ? _mergedProps$size : mergedProps.compact ? 's' : defaultSlideButtonSize;
51
+ const sizeConfig = slideButtonSizes[resolvedSize];
23
52
  const {
24
53
  checked,
25
- compact,
26
- borderRadius = compact ? 700 : 900,
54
+ borderRadius = sizeConfig.borderRadius,
27
55
  borderTopLeftRadius,
28
56
  borderTopRightRadius,
29
57
  borderBottomLeftRadius,
@@ -36,7 +64,7 @@ export const SlideButton = /*#__PURE__*/memo(_ref => {
36
64
  onSlideComplete,
37
65
  onChange,
38
66
  disabled,
39
- height = compact ? DEFAULT_COMPACT_HEIGHT : DEFAULT_REGULAR_HEIGHT,
67
+ height = sizeConfig.height,
40
68
  checkThreshold = 0.7,
41
69
  SlideButtonHandleComponent = DefaultSlideButtonHandle,
42
70
  SlideButtonBackgroundComponent = DefaultSlideButtonBackground,
@@ -126,9 +154,9 @@ export const SlideButton = /*#__PURE__*/memo(_ref => {
126
154
  borderTopLeftRadius: borderTopLeftRadius,
127
155
  borderTopRightRadius: borderTopRightRadius,
128
156
  checked: checked,
129
- compact: compact,
130
157
  disabled: disabled,
131
158
  progress: progress,
159
+ size: resolvedSize,
132
160
  style: styles == null ? void 0 : styles.background,
133
161
  uncheckedLabel: uncheckedLabel,
134
162
  variant: variant
@@ -151,11 +179,11 @@ export const SlideButton = /*#__PURE__*/memo(_ref => {
151
179
  borderTopRightRadius: borderTopRightRadius,
152
180
  checked: checked,
153
181
  checkedLabel: checkedLabel,
154
- compact: compact,
155
182
  disabled: disabled,
156
183
  endCheckedNode: endCheckedNode,
157
184
  onAccessibilityAction: handleAccessibilityAction,
158
185
  progress: progress,
186
+ size: resolvedSize,
159
187
  startUncheckedNode: startUncheckedNode,
160
188
  style: styles == null ? void 0 : styles.handle,
161
189
  testID: testID + "-handle",