react-native-molecules 0.5.0-beta.28 → 0.5.0-beta.29

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.
@@ -210,7 +210,7 @@ const buttonStylesDefault = StyleSheet.create(theme => {
210
210
  shape: 'square',
211
211
  size: 'xs',
212
212
  styles: {
213
- borderRadius: theme.shapes.corner.medium,
213
+ borderRadius: theme.shapes.corner.small,
214
214
  },
215
215
  },
216
216
  {
@@ -1,125 +1,161 @@
1
1
  import { useControlledValue } from '@react-native-molecules/utils/hooks';
2
- import { forwardRef, memo, useCallback, useMemo } from 'react';
2
+ import { forwardRef, memo, useCallback, useContext, useId, useMemo } from 'react';
3
3
  import { View } from 'react-native';
4
4
 
5
5
  import { resolveStateVariant } from '../../utils';
6
6
  import { Text } from '../Text';
7
7
  import CheckboxBase from './CheckboxBase';
8
- import type { CheckBoxBaseProps, States } from './types';
9
- import { styles } from './utils';
10
-
11
- export type Props = CheckBoxBaseProps;
8
+ import { CheckboxItemContext } from './context';
9
+ import type { CheckboxLabelProps, CheckboxProps, CheckboxRowProps } from './types';
10
+ import { checkboxRowStyles } from './utils';
12
11
 
12
+ /**
13
+ * The checkbox control (the box). Use inside a CheckboxRow, or standalone with `value`/`onValueChange`.
14
+ */
13
15
  const Checkbox = (
14
16
  {
15
17
  value: valueProp,
16
- onChange: onChangeProp,
17
18
  defaultValue,
18
- disabled,
19
+ onValueChange,
19
20
  indeterminate,
20
- label,
21
- labelStyle,
22
- containerStyle,
23
- labelProps,
24
- position = 'leading',
25
- accessibilityLabel: accessibilityLabelProp,
21
+ disabled: disabledProp,
22
+ size: sizeProp,
26
23
  testID,
27
- size = 'md',
28
- style: styleProp,
29
24
  ...rest
30
- }: Props,
25
+ }: CheckboxProps,
31
26
  ref: any,
32
27
  ) => {
33
- const [value, onChange] = useControlledValue({
28
+ const item = useContext(CheckboxItemContext);
29
+
30
+ const [value, setValue] = useControlledValue({
34
31
  value: valueProp,
35
- onChange: onChangeProp,
36
32
  defaultValue,
37
- disabled: disabled,
33
+ onChange: onValueChange,
34
+ disabled: disabledProp,
38
35
  });
39
36
 
40
- // Prepare label-related state and styles (always compute, even if not used)
41
- const isLeading = position === 'leading';
42
- const checked = Boolean(value) && !indeterminate;
43
- const state = resolveStateVariant({ disabled: Boolean(disabled), checked });
44
- const accessibilityLabel = accessibilityLabelProp ?? label;
45
-
46
- // Use variants only when label is provided
47
- if (label) {
48
- styles.useVariants({
49
- variant: 'item',
50
- // @ts-ignore // TODO - fix this
51
- state: state as States,
52
- isLeading,
53
- // @ts-ignore // TODO - fix this
54
- size,
55
- });
56
- }
37
+ // Inside a CheckboxRow the item context drives state; standalone (bare) mode owns its own.
38
+ const checked = item ? item.checked : Boolean(value);
39
+ const disabled = disabledProp ?? item?.disabled;
40
+ const isIndeterminate = item ? item.indeterminate : indeterminate;
41
+ const size = sizeProp ?? item?.size ?? 'md';
42
+ const labelId = item?.labelId;
57
43
 
58
- const { containerStyles, labelStyles, style } = useMemo(() => {
59
- return {
60
- containerStyles: [styles.itemContainer, containerStyle],
61
- labelStyles: [
62
- // @ts-ignore
63
- styles.label,
64
- labelStyle,
65
- ],
66
- style: [styles.root, styleProp],
67
- };
68
- }, [containerStyle, labelStyle, styleProp]);
69
-
70
- const onLabelPress = useCallback(() => {
71
- if (!disabled) {
72
- onChange(!value);
73
- }
74
- }, [onChange, value, disabled]);
75
-
76
- const accessibilityState = useMemo(
77
- () => ({
78
- checked: Boolean(value),
79
- disabled,
80
- }),
81
- [disabled, value],
44
+ const onChange = useCallback(
45
+ (next: boolean) => {
46
+ if (item) {
47
+ item.onToggle();
48
+ } else {
49
+ setValue(next);
50
+ }
51
+ },
52
+ [item, setValue],
82
53
  );
83
54
 
84
- const checkboxStyle = label ? style : styleProp;
85
- const checkboxAccessibilityLabel = label ? undefined : accessibilityLabelProp;
86
-
87
- const checkbox = (
55
+ return (
88
56
  <CheckboxBase
89
- ref={label ? undefined : ref}
90
- value={value}
57
+ {...rest}
58
+ ref={ref}
59
+ value={checked}
91
60
  onChange={onChange}
61
+ indeterminate={isIndeterminate}
92
62
  disabled={disabled}
93
- indeterminate={indeterminate}
94
63
  size={size}
95
- style={checkboxStyle}
96
64
  testID={testID}
97
- accessibilityLabel={checkboxAccessibilityLabel}
98
- {...rest}
65
+ accessibilityLabelledBy={labelId}
99
66
  />
100
67
  );
68
+ };
69
+
70
+ /**
71
+ * The label for a CheckboxRow. Pressing it toggles the checkbox, and it is wired to the control via
72
+ * `nativeID` / `accessibilityLabelledBy` (web `id` / `aria-labelledby`).
73
+ */
74
+ export const CheckboxLabel = memo(({ children, style, ...rest }: CheckboxLabelProps) => {
75
+ const item = useContext(CheckboxItemContext);
76
+
77
+ const state = resolveStateVariant({
78
+ disabled: !!item?.disabled,
79
+ checked: !!item?.checked,
80
+ });
81
+
82
+ checkboxRowStyles.useVariants({ state: state as any });
101
83
 
102
- if (!label) {
103
- return checkbox;
84
+ if (!item) {
85
+ return (
86
+ <Text style={style} {...rest}>
87
+ {children}
88
+ </Text>
89
+ );
104
90
  }
105
91
 
106
92
  return (
107
- <View style={containerStyles} ref={ref}>
108
- {isLeading && checkbox}
109
- <Text
110
- onPress={onLabelPress}
111
- disabled={disabled}
112
- selectable={false}
113
- accessibilityLabel={accessibilityLabel}
114
- accessibilityRole="checkbox"
115
- accessibilityState={accessibilityState}
116
- {...labelProps}
117
- style={labelStyles}>
118
- {label}
119
- </Text>
120
- {!isLeading && checkbox}
121
- </View>
93
+ <Text
94
+ nativeID={item.labelId}
95
+ onPress={item.disabled ? undefined : item.onToggle}
96
+ disabled={item.disabled}
97
+ selectable={false}
98
+ style={[checkboxRowStyles.label, style]}
99
+ {...rest}>
100
+ {children}
101
+ </Text>
122
102
  );
123
- };
103
+ });
104
+
105
+ CheckboxLabel.displayName = 'Checkbox_Label';
106
+
107
+ /**
108
+ * A row that binds checked state to a Checkbox control and its Checkbox.Label. The row itself is not
109
+ * pressable — only the Checkbox and Checkbox.Label inside it are. Children may be in any order.
110
+ */
111
+ export const CheckboxRow = memo(
112
+ forwardRef(
113
+ (
114
+ {
115
+ value: valueProp,
116
+ defaultValue,
117
+ onValueChange,
118
+ indeterminate,
119
+ disabled,
120
+ size,
121
+ style,
122
+ children,
123
+ ...rest
124
+ }: CheckboxRowProps,
125
+ ref: any,
126
+ ) => {
127
+ const labelId = useId();
128
+
129
+ const [value, setValue] = useControlledValue({
130
+ value: valueProp,
131
+ defaultValue,
132
+ onChange: onValueChange,
133
+ disabled,
134
+ });
135
+
136
+ const checked = Boolean(value);
137
+
138
+ const onToggle = useCallback(() => {
139
+ if (disabled) return;
140
+ setValue(!checked);
141
+ }, [disabled, setValue, checked]);
142
+
143
+ const contextValue = useMemo(
144
+ () => ({ checked, onToggle, disabled, indeterminate, size, labelId }),
145
+ [checked, onToggle, disabled, indeterminate, size, labelId],
146
+ );
147
+
148
+ return (
149
+ <CheckboxItemContext.Provider value={contextValue}>
150
+ <View ref={ref} style={[checkboxRowStyles.row, style]} {...rest}>
151
+ {children}
152
+ </View>
153
+ </CheckboxItemContext.Provider>
154
+ );
155
+ },
156
+ ),
157
+ );
158
+
159
+ CheckboxRow.displayName = 'Checkbox_Row';
124
160
 
125
161
  export default memo(forwardRef(Checkbox));
@@ -4,12 +4,10 @@ import { View } from 'react-native';
4
4
  import { resolveStateVariant } from '../../utils';
5
5
  import { Icon } from '../Icon';
6
6
  import { TouchableRipple } from '../TouchableRipple';
7
- import type { CheckBoxBaseProps, States } from './types';
7
+ import type { CheckboxBaseProps, States } from './types';
8
8
  import { iconSizeMap, styles } from './utils';
9
9
 
10
- export type Props = Omit<CheckBoxBaseProps, 'uncheckedColor' | 'value' | 'defaultValue'> & {
11
- value: boolean;
12
- };
10
+ export type Props = Omit<CheckboxBaseProps, 'uncheckedColor'>;
13
11
 
14
12
  const CheckboxIOS = (
15
13
  {
@@ -1,5 +1,4 @@
1
- import { forwardRef, memo, type PropsWithoutRef, useCallback, useMemo } from 'react';
2
- import { type ViewProps } from 'react-native';
1
+ import { forwardRef, memo, useCallback, useMemo } from 'react';
3
2
 
4
3
  import { useActionState } from '../../hooks';
5
4
  import { resolveStateVariant } from '../../utils';
@@ -7,16 +6,10 @@ import { tokenStylesParser } from '../../utils/tokenStylesParser';
7
6
  import { Icon } from '../Icon';
8
7
  import { StateLayer } from '../StateLayer';
9
8
  import { TouchableRipple } from '../TouchableRipple';
10
- import type { CheckBoxBaseProps, States } from './types';
9
+ import type { CheckboxBaseProps, States } from './types';
11
10
  import { iconSizeMap, styles } from './utils';
12
11
 
13
- export type Props = Omit<CheckBoxBaseProps, 'value' | 'defaultValue'> & {
14
- value: boolean;
15
- /**
16
- * props for the stateLayer
17
- */
18
- stateLayerProps?: PropsWithoutRef<ViewProps>;
19
- };
12
+ export type Props = CheckboxBaseProps;
20
13
 
21
14
  const CheckboxAndroid = (
22
15
  {
@@ -0,0 +1,14 @@
1
+ import { createContext } from 'react';
2
+
3
+ import type { Size } from './types';
4
+
5
+ export type CheckboxItemContextType = {
6
+ checked: boolean;
7
+ onToggle: () => void;
8
+ disabled?: boolean;
9
+ indeterminate?: boolean;
10
+ size?: Size;
11
+ labelId: string;
12
+ };
13
+
14
+ export const CheckboxItemContext = createContext<CheckboxItemContextType | null>(null);
@@ -1,7 +1,14 @@
1
1
  import { getRegisteredComponentWithFallback } from '../../core';
2
- import CheckboxComponent from './Checkbox';
2
+ // @component ./Checkbox.tsx
3
+ import CheckboxBox, { CheckboxLabel, CheckboxRow as CheckboxRowComponent } from './Checkbox';
3
4
 
4
- export const Checkbox = getRegisteredComponentWithFallback('Checkbox', CheckboxComponent);
5
+ const CheckboxDefault = Object.assign(CheckboxBox, {
6
+ Label: CheckboxLabel,
7
+ Row: CheckboxRowComponent,
8
+ });
5
9
 
6
- export type { Props as CheckboxProps } from './Checkbox';
7
- export { styles as checkboxStyles } from './utils';
10
+ export const Checkbox = getRegisteredComponentWithFallback('Checkbox', CheckboxDefault);
11
+ export const CheckboxRow = CheckboxRowComponent;
12
+
13
+ export type { CheckboxLabelProps, CheckboxProps, CheckboxRowProps } from './types';
14
+ export { checkboxRowStyles, styles as checkboxStyles } from './utils';
@@ -1,46 +1,45 @@
1
- import type { StyleProp, TextProps, TextStyle, ViewStyle } from 'react-native';
1
+ import type { PropsWithoutRef, ReactNode } from 'react';
2
+ import type { TextProps, ViewProps } from 'react-native';
2
3
 
3
4
  import type { TouchableRippleProps } from '../TouchableRipple';
4
5
 
5
6
  export type Size = 'sm' | 'md' | 'lg';
6
7
  export type States = 'disabled' | 'checked' | 'hovered' | 'checkedAndHovered';
7
8
 
8
- export type CheckBoxBaseProps = Omit<TouchableRippleProps, 'children'> & {
9
+ /**
10
+ * Internal props for the platform control (CheckboxBase).
11
+ */
12
+ export type CheckboxBaseProps = Omit<TouchableRippleProps, 'children'> & {
9
13
  /**
10
- * value of checkbox.
14
+ * Whether the checkbox is checked.
11
15
  */
12
- value?: boolean;
13
- /**
14
- * defaultValue of checkbox.
15
- */
16
- defaultValue?: boolean;
16
+ value: boolean;
17
17
  /**
18
- * function execute when the value change i.e checkbox is press
18
+ * Called when the checkbox is pressed.
19
19
  */
20
20
  onChange?: (newValue: boolean) => void;
21
21
  /**
22
- * Whether or not if it's in the indeterminate state, if true, it will override the value
22
+ * Whether the checkbox is in the indeterminate state (overrides `value`).
23
23
  */
24
24
  indeterminate?: boolean;
25
25
  /**
26
- * Whether checkbox is disabled.
26
+ * Whether the checkbox is disabled.
27
27
  */
28
28
  disabled?: boolean;
29
29
  /**
30
- * Size of the icon.
31
- * Should be a number or a Design Token
30
+ * Size of the checkbox.
32
31
  */
33
32
  size?: Size;
34
33
  /**
35
- * Custom color for unchecked checkbox.
34
+ * Custom color for the checked checkbox.
36
35
  */
37
- uncheckedColor?: string;
36
+ color?: string;
38
37
  /**
39
- * Custom color for checkbox.
38
+ * Custom color for the unchecked checkbox.
40
39
  */
41
- color?: string;
40
+ uncheckedColor?: string;
42
41
  /**
43
- * Accessibility label for the touchable. This is read by the screen reader when the user taps the touchable.
42
+ * Accessibility label for the touchable.
44
43
  */
45
44
  accessibilityLabel?: string;
46
45
  /**
@@ -48,25 +47,60 @@ export type CheckBoxBaseProps = Omit<TouchableRippleProps, 'children'> & {
48
47
  */
49
48
  testID?: string;
50
49
  /**
51
- * Label to be displayed next to the checkbox.
50
+ * Props for the state layer.
51
+ */
52
+ stateLayerProps?: PropsWithoutRef<ViewProps>;
53
+ };
54
+
55
+ /**
56
+ * The checkbox control (the box). Use inside a CheckboxRow, or standalone with `value`/`onValueChange`.
57
+ */
58
+ export type CheckboxProps = Omit<CheckboxBaseProps, 'value' | 'onChange'> & {
59
+ /**
60
+ * Whether the checkbox is checked (controlled).
61
+ */
62
+ value?: boolean;
63
+ /**
64
+ * Default checked state (uncontrolled).
65
+ */
66
+ defaultValue?: boolean;
67
+ /**
68
+ * Called when the checked state changes.
69
+ */
70
+ onValueChange?: (newValue: boolean) => void;
71
+ };
72
+
73
+ export type CheckboxRowProps = ViewProps & {
74
+ /**
75
+ * Whether the checkbox is checked (controlled).
76
+ */
77
+ value?: boolean;
78
+ /**
79
+ * Default checked state (uncontrolled).
80
+ */
81
+ defaultValue?: boolean;
82
+ /**
83
+ * Called when the checked state changes.
52
84
  */
53
- label?: string;
85
+ onValueChange?: (newValue: boolean) => void;
54
86
  /**
55
- * Style that is passed to Label element.
87
+ * Whether the checkbox is in the indeterminate state.
56
88
  */
57
- labelStyle?: StyleProp<TextStyle>;
89
+ indeterminate?: boolean;
58
90
  /**
59
- * Style that is passed to Container element (when label is provided).
91
+ * Disables the row (control + label).
60
92
  */
61
- containerStyle?: ViewStyle;
93
+ disabled?: boolean;
62
94
  /**
63
- * Props for the label text element.
95
+ * Size applied to the checkbox.
64
96
  */
65
- labelProps?: Omit<TextProps, 'children' | 'style'>;
97
+ size?: Size;
66
98
  /**
67
- * Checkbox control position relative to label.
99
+ * Checkbox control and Checkbox.Label, in any order.
68
100
  */
69
- position?: 'leading' | 'trailing';
101
+ children: ReactNode;
102
+ };
70
103
 
71
- style?: StyleProp<TextStyle>;
104
+ export type CheckboxLabelProps = TextProps & {
105
+ children: ReactNode;
72
106
  };
@@ -21,17 +21,14 @@ const checkboxStylesDefault = StyleSheet.create(theme => ({
21
21
  sm: {
22
22
  padding: PADDING,
23
23
  borderRadius: 16,
24
- // iconSize: iconSizeMap.sm,
25
24
  },
26
25
  md: {
27
26
  padding: PADDING,
28
27
  borderRadius: 18,
29
- // iconSize: iconSizeMap.md,
30
28
  },
31
29
  lg: {
32
30
  padding: PADDING,
33
31
  borderRadius: 20,
34
- // iconSize: iconSizeMap.lg,
35
32
  },
36
33
  },
37
34
  },
@@ -81,57 +78,6 @@ const checkboxStylesDefault = StyleSheet.create(theme => ({
81
78
  },
82
79
  },
83
80
  },
84
- itemContainer: {
85
- flexDirection: 'row',
86
- alignItems: 'center',
87
- justifyContent: 'space-between',
88
- },
89
- label: {
90
- flexShrink: 1,
91
- flexGrow: 1,
92
- variants: {
93
- variant: {
94
- item: {
95
- color: theme.colors.onSurface,
96
- },
97
- },
98
- isLeading: {
99
- true: {
100
- textAlign: 'right',
101
- paddingLeft: 0,
102
- paddingRight: theme.spacings['2'],
103
- },
104
- false: {
105
- textAlign: 'left',
106
- paddingLeft: theme.spacings['2'],
107
- paddingRight: 0,
108
- },
109
- },
110
- },
111
- compoundVariants: [
112
- {
113
- variant: 'item',
114
- size: 'sm',
115
- styles: {
116
- ...theme.typescale.bodyMedium,
117
- },
118
- },
119
- {
120
- variant: 'item',
121
- size: 'md',
122
- styles: {
123
- ...theme.typescale.bodyMedium,
124
- },
125
- },
126
- {
127
- variant: 'item',
128
- size: 'lg',
129
- styles: {
130
- ...theme.typescale.bodyLarge,
131
- },
132
- },
133
- ],
134
- },
135
81
  icon: {
136
82
  color: theme.colors.onSurfaceVariant,
137
83
 
@@ -150,36 +96,32 @@ const checkboxStylesDefault = StyleSheet.create(theme => ({
150
96
  },
151
97
  },
152
98
  },
153
- // compoundVariantStyles: (variant: 'android' | 'ios' | 'item', size: Size, state: States) => {
154
- // if (variant === 'android') {
155
- // return {
156
- // root: {
157
- // ...(size === 'sm' && { width: 32, height: 32 }),
158
- // ...(size === 'md' && { width: 36, height: 36 }),
159
- // ...(size === 'lg' && { width: 40, height: 40 }),
160
- // },
161
- // stateLayer: {
162
- // ...(state === 'hovered' && {
163
- // backgroundColor: theme.colors.stateLayer.hover.onSurface,
164
- // }),
165
- // ...(state === 'checkedAndHovered' && {
166
- // backgroundColor: theme.colors.stateLayer.hover.primary,
167
- // }),
168
- // },
169
- // } as any;
170
- // }
99
+ }));
171
100
 
172
- // if (variant === 'item') {
173
- // return {
174
- // root: {
175
- // labelColor: 'colors.onSurface',
176
- // ...(size === 'sm' && { labelTypeScale: theme.typescale.bodyMedium }),
177
- // ...(size === 'md' && { labelTypeScale: theme.typescale.bodyLarge }),
178
- // ...(size === 'lg' && { labelTypeScale: theme.typescale.bodyLarge }),
179
- // },
180
- // };
181
- // }
182
- // },
101
+ const checkboxRowStylesDefault = StyleSheet.create(theme => ({
102
+ row: {
103
+ flexDirection: 'row',
104
+ alignItems: 'center',
105
+ },
106
+ label: {
107
+ flexShrink: 1,
108
+ flexGrow: 1,
109
+ color: theme.colors.onSurface,
110
+ ...theme.typescale.bodyLarge,
111
+
112
+ variants: {
113
+ state: {
114
+ checked: {},
115
+ checkedAndHovered: {},
116
+ hovered: {},
117
+ disabled: { color: theme.colors.onSurfaceDisabled },
118
+ },
119
+ },
120
+ },
183
121
  }));
184
122
 
185
123
  export const styles = getRegisteredComponentStylesWithFallback('Checkbox', checkboxStylesDefault);
124
+ export const checkboxRowStyles = getRegisteredComponentStylesWithFallback(
125
+ 'Checkbox_Row',
126
+ checkboxRowStylesDefault,
127
+ );
@@ -13,13 +13,12 @@ import CrossFadeIcon from '../Icon/CrossFadeIcon';
13
13
  import { StateLayer } from '../StateLayer';
14
14
  import { TouchableRipple, type TouchableRippleProps } from '../TouchableRipple';
15
15
  import type { IconButtonShape, IconButtonVariant, IconButtonWidth } from './types';
16
- import { defaultStyles, iconButtonSizeToIconSizeMap } from './utils';
17
-
18
- const ICON_BUTTON_MIN_CONTAINER_SIZE = 32;
19
- const ICON_BUTTON_CONTAINER_PADDING = 16;
20
- const M3_ICON_BUTTON_NARROW_WIDTH_ADJUSTMENT = -8;
21
- const M3_ICON_BUTTON_WIDE_WIDTH_ADJUSTMENT = 12;
22
- const M3_ICON_BUTTON_SQUARE_CORNER_RADIUS = 12;
16
+ import {
17
+ defaultStyles,
18
+ iconButtonConstants,
19
+ iconButtonDefaultProps,
20
+ iconButtonSizeToIconSizeMap,
21
+ } from './utils';
23
22
 
24
23
  export type Props = Omit<TouchableRippleProps, 'children' | 'style'> & {
25
24
  /**
@@ -88,17 +87,17 @@ const emptyObject = {};
88
87
  const IconButton = (
89
88
  {
90
89
  name,
91
- size = 24,
90
+ size = iconButtonDefaultProps.size,
92
91
  color: _iconColor,
93
92
  type,
94
93
  accessibilityLabel,
95
94
  disabled = false,
96
95
  onPress,
97
96
  selected = false,
98
- animated = false,
99
- variant = 'default',
100
- shape = 'round',
101
- width = 'default',
97
+ animated = iconButtonDefaultProps.animated,
98
+ variant = iconButtonDefaultProps.variant,
99
+ shape = iconButtonDefaultProps.shape,
100
+ width = iconButtonDefaultProps.width,
102
101
  style,
103
102
  testID,
104
103
  stateLayerProps = emptyObject,
@@ -142,18 +141,18 @@ const IconButton = (
142
141
  iconButtonSizeToIconSizeMap[size as keyof typeof iconButtonSizeToIconSizeMap] ??
143
142
  (typeof size === 'number' && size ? (size as number) : 24);
144
143
  const containerHeight = Math.max(
145
- ICON_BUTTON_MIN_CONTAINER_SIZE,
146
- iconSizeInNum + ICON_BUTTON_CONTAINER_PADDING,
144
+ iconButtonConstants.minContainerSize,
145
+ iconSizeInNum + iconButtonConstants.containerPadding,
147
146
  );
148
147
  const widthAdjustment =
149
148
  width === 'narrow'
150
- ? M3_ICON_BUTTON_NARROW_WIDTH_ADJUSTMENT
149
+ ? iconButtonConstants.narrowWidthAdjustment
151
150
  : width === 'wide'
152
- ? M3_ICON_BUTTON_WIDE_WIDTH_ADJUSTMENT
151
+ ? iconButtonConstants.wideWidthAdjustment
153
152
  : 0;
154
153
  const containerWidth = Math.max(iconSizeInNum, containerHeight + widthAdjustment);
155
154
  const borderRadius =
156
- shape === 'round' ? containerHeight / 2 : M3_ICON_BUTTON_SQUARE_CORNER_RADIUS;
155
+ shape === 'round' ? containerHeight / 2 : iconButtonConstants.squareCornerRadius;
157
156
 
158
157
  return {
159
158
  iconColor: _iconColor,