@hero-design/rn 7.20.1 → 7.22.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.
Files changed (132) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.turbo/turbo-build.log +9 -9
  3. package/babel.config.js +1 -1
  4. package/es/index.js +714 -471
  5. package/lib/index.js +720 -474
  6. package/package.json +9 -15
  7. package/rollup.config.js +1 -0
  8. package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
  9. package/src/components/BottomNavigation/index.tsx +3 -3
  10. package/src/components/BottomSheet/index.tsx +6 -1
  11. package/src/components/Box/helpers.ts +1 -1
  12. package/src/components/Calendar/index.tsx +9 -9
  13. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -4
  14. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +13 -13
  15. package/src/components/Collapse/index.tsx +1 -1
  16. package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
  17. package/src/components/Empty/StyledEmpty.tsx +1 -9
  18. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +58 -5
  19. package/src/components/Empty/__tests__/index.spec.tsx +13 -0
  20. package/src/components/Empty/index.tsx +38 -18
  21. package/src/components/FAB/ActionGroup/index.tsx +1 -1
  22. package/src/components/Icon/HeroIcon/selection.json +7029 -1
  23. package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +81 -0
  24. package/src/components/Image/__tests__/index.spec.tsx +29 -0
  25. package/src/components/Image/index.tsx +46 -0
  26. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +5 -5
  27. package/src/components/PinInput/index.tsx +1 -1
  28. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +60 -60
  29. package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
  30. package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
  31. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
  32. package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
  33. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +2 -2
  34. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
  35. package/src/components/Select/MultiSelect/OptionList.tsx +5 -7
  36. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +21 -0
  37. package/src/components/Select/MultiSelect/index.tsx +35 -5
  38. package/src/components/Select/SingleSelect/OptionList.tsx +4 -5
  39. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +16 -0
  40. package/src/components/Select/SingleSelect/index.tsx +36 -6
  41. package/src/components/Select/StyledOptionList.tsx +3 -9
  42. package/src/components/Select/helpers.tsx +4 -4
  43. package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +43 -0
  44. package/src/components/Slider/__tests__/index.spec.tsx +33 -0
  45. package/src/components/Slider/index.tsx +89 -0
  46. package/src/components/Switch/SelectorSwitch/Option.tsx +67 -0
  47. package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
  48. package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
  49. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
  50. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
  51. package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
  52. package/src/components/Switch/SelectorSwitch/index.tsx +60 -0
  53. package/src/components/Switch/StyledSwitch.tsx +4 -4
  54. package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +10 -10
  55. package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
  56. package/src/components/Switch/index.tsx +9 -5
  57. package/src/components/Tabs/ScrollableTabs.tsx +12 -5
  58. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
  59. package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
  60. package/src/components/Tabs/index.tsx +13 -6
  61. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
  62. package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
  63. package/src/components/TextInput/index.tsx +64 -59
  64. package/src/components/Toast/ToastContainer.tsx +6 -6
  65. package/src/index.ts +4 -0
  66. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +70 -23
  67. package/src/theme/components/alert.ts +1 -2
  68. package/src/theme/components/avatar.ts +8 -8
  69. package/src/theme/components/badge.ts +4 -4
  70. package/src/theme/components/bottomNavigation.ts +1 -1
  71. package/src/theme/components/bottomSheet.ts +2 -3
  72. package/src/theme/components/calendar.ts +9 -7
  73. package/src/theme/components/card.ts +1 -1
  74. package/src/theme/components/checkbox.ts +2 -5
  75. package/src/theme/components/datePicker.ts +3 -3
  76. package/src/theme/components/drawer.ts +2 -3
  77. package/src/theme/components/empty.ts +3 -8
  78. package/src/theme/components/fab.ts +2 -2
  79. package/src/theme/components/image.ts +12 -0
  80. package/src/theme/components/pinInput.ts +3 -3
  81. package/src/theme/components/progress.ts +2 -3
  82. package/src/theme/components/radio.ts +7 -3
  83. package/src/theme/components/richTextEditor.ts +4 -4
  84. package/src/theme/components/slider.ts +13 -0
  85. package/src/theme/components/switch.ts +28 -17
  86. package/src/theme/components/tabs.ts +1 -1
  87. package/src/theme/components/timePicker.ts +3 -3
  88. package/src/theme/components/toast.ts +1 -2
  89. package/src/theme/getTheme.ts +9 -2
  90. package/src/theme/global/colors/swag.ts +2 -0
  91. package/src/theme/global/colors/types.ts +2 -0
  92. package/src/theme/global/index.ts +3 -0
  93. package/src/theme/global/scale.ts +3 -0
  94. package/src/theme/global/sizes.ts +29 -0
  95. package/testUtils/setup.tsx +15 -1
  96. package/tsconfig.json +1 -1
  97. package/types/components/BottomSheet/index.d.ts +5 -1
  98. package/types/components/Empty/StyledEmpty.d.ts +1 -7
  99. package/types/components/Empty/index.d.ts +8 -2
  100. package/types/components/Image/__tests__/index.spec.d.ts +1 -0
  101. package/types/components/Image/index.d.ts +17 -0
  102. package/types/components/Select/MultiSelect/OptionList.d.ts +5 -2
  103. package/types/components/Select/MultiSelect/index.d.ts +7 -1
  104. package/types/components/Select/SingleSelect/OptionList.d.ts +5 -2
  105. package/types/components/Select/SingleSelect/index.d.ts +8 -2
  106. package/types/components/Select/StyledOptionList.d.ts +4 -3
  107. package/types/components/Select/index.d.ts +1 -1
  108. package/types/components/Slider/__tests__/index.spec.d.ts +1 -0
  109. package/types/components/Slider/index.d.ts +52 -0
  110. package/types/components/Switch/SelectorSwitch/Option.d.ts +10 -0
  111. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
  112. package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
  113. package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
  114. package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
  115. package/types/components/Switch/index.d.ts +5 -3
  116. package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
  117. package/types/components/Tabs/index.d.ts +2 -2
  118. package/types/components/TextInput/index.d.ts +6 -5
  119. package/types/index.d.ts +3 -1
  120. package/types/theme/components/datePicker.d.ts +2 -1
  121. package/types/theme/components/empty.d.ts +2 -5
  122. package/types/theme/components/image.d.ts +8 -0
  123. package/types/theme/components/slider.d.ts +9 -0
  124. package/types/theme/components/switch.d.ts +27 -12
  125. package/types/theme/components/timePicker.d.ts +2 -1
  126. package/types/theme/getTheme.d.ts +4 -0
  127. package/types/theme/global/colors/types.d.ts +2 -0
  128. package/types/theme/global/index.d.ts +3 -0
  129. package/types/theme/global/scale.d.ts +1 -0
  130. package/types/theme/global/sizes.d.ts +14 -0
  131. package/.eslintrc.json +0 -61
  132. package/.prettierrc.json +0 -8
@@ -1,11 +1,11 @@
1
- import React, { useRef } from 'react';
2
- import { TextInput as RNTextInput, StyleSheet } from 'react-native';
1
+ import React from "react";
2
+ import { StyleSheet } from "react-native";
3
3
  import type {
4
4
  TextInputProps as NativeTextInputProps,
5
5
  StyleProp,
6
6
  ViewStyle,
7
7
  TextStyle,
8
- } from 'react-native';
8
+ } from "react-native";
9
9
  import {
10
10
  StyledTextInputContainer,
11
11
  StyledLabel,
@@ -24,11 +24,11 @@ import {
24
24
  StyledErrorAndHelpTextContainer,
25
25
  StyledBorderBackDrop,
26
26
  StyledErrorAndMaxLengthContainer,
27
- } from './StyledTextInput';
28
- import Icon from '../Icon';
29
- import { useTheme } from '../../theme';
30
- import type { Variant } from './StyledTextInput';
31
- import type { IconName } from '../Icon';
27
+ } from "./StyledTextInput";
28
+ import Icon from "../Icon";
29
+ import { useTheme } from "../../theme";
30
+ import type { Variant } from "./StyledTextInput";
31
+ import type { IconName } from "../Icon";
32
32
 
33
33
  export interface TextInputProps extends NativeTextInputProps {
34
34
  /**
@@ -92,6 +92,10 @@ export interface TextInputProps extends NativeTextInputProps {
92
92
  * The helper text to display.
93
93
  */
94
94
  helpText?: string;
95
+ /*
96
+ * Customise input value renderer
97
+ */
98
+ renderInputValue?: (inputProps: NativeTextInputProps) => React.ReactNode;
95
99
  }
96
100
 
97
101
  export const getVariant = ({
@@ -110,21 +114,21 @@ export const getVariant = ({
110
114
  isEmptyValue?: boolean;
111
115
  }): Variant => {
112
116
  if (disabled) {
113
- return 'disabled';
117
+ return "disabled";
114
118
  }
115
119
  if (error) {
116
- return 'error';
120
+ return "error";
117
121
  }
118
122
  if (!editable || loading) {
119
- return 'readonly';
123
+ return "readonly";
120
124
  }
121
125
  if (isFocused) {
122
- return 'focused';
126
+ return "focused";
123
127
  }
124
128
  if (!isEmptyValue) {
125
- return 'filled';
129
+ return "filled";
126
130
  }
127
- return 'default';
131
+ return "default";
128
132
  };
129
133
 
130
134
  const TextInput = ({
@@ -144,12 +148,12 @@ const TextInput = ({
144
148
  helpText,
145
149
  value,
146
150
  defaultValue,
151
+ renderInputValue,
147
152
  ...nativeProps
148
153
  }: TextInputProps): JSX.Element => {
149
- const textInputReference = useRef<RNTextInput | null>(null);
150
- const displayText = (value !== undefined ? value : defaultValue) ?? '';
154
+ const displayText = (value !== undefined ? value : defaultValue) ?? "";
151
155
  const isEmptyValue = displayText.length === 0;
152
- const actualSuffix = loading ? 'loading' : suffix;
156
+ const actualSuffix = loading ? "loading" : suffix;
153
157
 
154
158
  const [isFocused, setIsFocused] = React.useState(false);
155
159
 
@@ -165,16 +169,46 @@ const TextInput = ({
165
169
  const shouldShowMaxLength = maxLength !== undefined;
166
170
 
167
171
  const theme = useTheme();
172
+
173
+ const nativeInputProps: NativeTextInputProps = {
174
+ style: StyleSheet.flatten([
175
+ { color: theme.__hd__.textInput.colors.text },
176
+ textStyle,
177
+ ]),
178
+ testID: "text-input",
179
+ accessibilityState: {
180
+ disabled: variant === "disabled" || variant === "readonly",
181
+ },
182
+ // @ts-ignore
183
+ accessibilityLabelledBy,
184
+ ...nativeProps,
185
+ onFocus: (event) => {
186
+ setIsFocused(true);
187
+ nativeProps.onFocus?.(event);
188
+ },
189
+ onBlur: (event) => {
190
+ setIsFocused(false);
191
+ nativeProps.onBlur?.(event);
192
+ },
193
+ editable,
194
+ maxLength,
195
+ value,
196
+ onChangeText: (text) => {
197
+ nativeProps.onChangeText?.(text);
198
+ },
199
+ defaultValue,
200
+ placeholder: variant === "focused" ? nativeProps.placeholder : undefined,
201
+ };
202
+
168
203
  return (
169
204
  <StyledContainer
170
- style={style}
171
205
  pointerEvents={
172
- variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto'
206
+ variant === "disabled" || variant === "readonly" ? "none" : "auto"
173
207
  }
174
208
  testID={testID}
175
209
  >
176
210
  <StyledTextInputContainer>
177
- <StyledBorderBackDrop themeVariant={variant} />
211
+ <StyledBorderBackDrop themeVariant={variant} style={style} />
178
212
  {(isFocused || (label && !isEmptyValue)) && (
179
213
  <StyledLabelContainer pointerEvents="none">
180
214
  {required && (
@@ -194,9 +228,9 @@ const TextInput = ({
194
228
  )}
195
229
  </StyledLabelContainer>
196
230
  )}
197
- {typeof prefix === 'string' ? (
231
+ {typeof prefix === "string" ? (
198
232
  <Icon
199
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
233
+ intent={variant === "disabled" ? "disabled-text" : "text"}
200
234
  testID="input-prefix"
201
235
  icon={prefix}
202
236
  size="xsmall"
@@ -224,47 +258,18 @@ const TextInput = ({
224
258
  )}
225
259
  </StyledLabelContainerInsideTextInput>
226
260
  )}
227
- <StyledTextInput
228
- // when input is not editable on Android, the text color is gray
229
- // hence, adding this to make the text color the same as iOS
230
- style={StyleSheet.flatten([
231
- { color: theme.__hd__.textInput.colors.text },
232
- textStyle,
233
- ])}
234
- testID="text-input"
235
- accessibilityState={{
236
- disabled: variant === 'disabled' || variant === 'readonly',
237
- }}
238
- // @ts-ignore
239
- accessibilityLabelledBy={accessibilityLabelledBy}
240
- {...nativeProps}
241
- onFocus={event => {
242
- setIsFocused(true);
243
- nativeProps.onFocus?.(event);
244
- }}
245
- onBlur={event => {
246
- setIsFocused(false);
247
- nativeProps.onBlur?.(event);
248
- }}
249
- ref={textInputReference}
250
- editable={editable}
251
- maxLength={maxLength}
252
- value={value}
253
- onChangeText={text => {
254
- nativeProps.onChangeText?.(text);
255
- }}
256
- defaultValue={defaultValue}
257
- placeholder={
258
- variant === 'focused' ? nativeProps.placeholder : undefined
259
- }
260
- />
261
+ {renderInputValue ? (
262
+ renderInputValue(nativeInputProps)
263
+ ) : (
264
+ <StyledTextInput {...nativeInputProps} />
265
+ )}
261
266
  </StyledTextInputAndLabelContainer>
262
- {typeof actualSuffix === 'string' ? (
267
+ {typeof actualSuffix === "string" ? (
263
268
  <Icon
264
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
269
+ intent={variant === "disabled" ? "disabled-text" : "text"}
265
270
  testID="input-suffix"
266
271
  icon={actualSuffix}
267
- spin={actualSuffix === 'loading'}
272
+ spin={actualSuffix === "loading"}
268
273
  size="xsmall"
269
274
  />
270
275
  ) : (
@@ -28,7 +28,7 @@ const SingleToastDisplay = ({
28
28
  key={toast.id}
29
29
  style={{ marginBottom: theme.space.small }}
30
30
  onDismiss={() => {
31
- setToastList(state => state.filter(item => item.id !== toast.id));
31
+ setToastList((state) => state.filter((item) => item.id !== toast.id));
32
32
  toast.props.onDismiss?.();
33
33
  }}
34
34
  />
@@ -43,17 +43,17 @@ const ToastContainer = React.forwardRef<
43
43
  const [toastList, setToastList] = useState<ToastItemProps[]>([]);
44
44
 
45
45
  useImperativeHandle(ref, () => ({
46
- show: props => {
46
+ show: (props) => {
47
47
  const item = {
48
48
  id: generateID(),
49
49
  props,
50
50
  };
51
51
 
52
- setToastList(state => [item, ...state]);
52
+ setToastList((state) => [item, ...state]);
53
53
  return item.id;
54
54
  },
55
- hide: id => {
56
- setToastList(state => state.filter(item => item.id !== id));
55
+ hide: (id) => {
56
+ setToastList((state) => state.filter((item) => item.id !== id));
57
57
  },
58
58
  clearAll: () => {
59
59
  setToastList([]);
@@ -75,7 +75,7 @@ const ToastContainer = React.forwardRef<
75
75
  key={id}
76
76
  style={{ marginBottom: theme.space.small }}
77
77
  onDismiss={() => {
78
- setToastList(state => state.filter(item => item.id !== id));
78
+ setToastList((state) => state.filter((item) => item.id !== id));
79
79
  props.onDismiss?.();
80
80
  }}
81
81
  />
package/src/index.ts CHANGED
@@ -26,9 +26,11 @@ import Drawer from './components/Drawer';
26
26
  import Empty from './components/Empty';
27
27
  import FAB from './components/FAB';
28
28
  import Icon from './components/Icon';
29
+ import Image from './components/Image';
29
30
  import List from './components/List';
30
31
  import PinInput from './components/PinInput';
31
32
  import Progress from './components/Progress';
33
+ import Slider from './components/Slider';
32
34
  import Spinner from './components/Spinner';
33
35
  import Radio from './components/Radio';
34
36
  import SectionHeading from './components/SectionHeading';
@@ -70,9 +72,11 @@ export {
70
72
  Empty,
71
73
  FAB,
72
74
  Icon,
75
+ Image,
73
76
  List,
74
77
  PinInput,
75
78
  Progress,
79
+ Slider,
76
80
  Spinner,
77
81
  Radio,
78
82
  SectionHeading,
@@ -262,11 +262,11 @@ Object {
262
262
  "wrapper": 8,
263
263
  },
264
264
  "sizes": Object {
265
- "icon": 20,
265
+ "icon": 24,
266
266
  },
267
267
  "space": Object {
268
268
  "iconDescriptionPadding": 12,
269
- "iconTop": -3,
269
+ "iconTop": 0,
270
270
  "wrapperPadding": 16,
271
271
  },
272
272
  },
@@ -338,14 +338,11 @@ Object {
338
338
  "description": "BeVietnamPro-Light",
339
339
  "title": "BeVietnamPro-SemiBold",
340
340
  },
341
- "radii": Object {
342
- "illustration": 999,
343
- },
344
341
  "sizes": Object {
345
- "illustration": 168,
342
+ "image": 168,
346
343
  },
347
344
  "space": Object {
348
- "illustrationMargin": 24,
345
+ "imageMargin": 24,
349
346
  "titleMargin": 16,
350
347
  "wrapperPadding": 16,
351
348
  },
@@ -419,6 +416,12 @@ Object {
419
416
  "xsmall": 16,
420
417
  },
421
418
  },
419
+ "image": Object {
420
+ "sizes": Object {
421
+ "15xlarge": 144,
422
+ "6xlarge": 72,
423
+ },
424
+ },
422
425
  "list": Object {
423
426
  "colors": Object {
424
427
  "checkedListItemContainerBackground": "#f3e6f6",
@@ -507,7 +510,7 @@ Object {
507
510
  },
508
511
  "sizes": Object {
509
512
  "barHeight": 4,
510
- "circleWidth": 76,
513
+ "circleWidth": 72,
511
514
  },
512
515
  },
513
516
  "radio": Object {
@@ -539,10 +542,10 @@ Object {
539
542
  "editor": 14,
540
543
  },
541
544
  "sizes": Object {
542
- "editorMinHeight": 21,
545
+ "editorMinHeight": 24,
543
546
  "toolbarButtonSize": 48,
544
547
  "toolbarSeparatorHeight": 16,
545
- "toolbarSeparatorWidth": 1,
548
+ "toolbarSeparatorWidth": 2,
546
549
  },
547
550
  "space": Object {
548
551
  "editorPadding": 16,
@@ -578,6 +581,13 @@ Object {
578
581
  "sectionSpacing": 12,
579
582
  },
580
583
  },
584
+ "slider": Object {
585
+ "colors": Object {
586
+ "maximumTrackTint": "#ece8ef",
587
+ "minimumTrackTint": "#401960",
588
+ "thumbTint": "#e6e9e9",
589
+ },
590
+ },
581
591
  "spinner": Object {
582
592
  "colors": Object {
583
593
  "dot1": "#795e90",
@@ -611,28 +621,43 @@ Object {
611
621
  "disabled-unchecked": "#ccced1",
612
622
  "unchecked": "#808f91",
613
623
  },
624
+ "selector": Object {
625
+ "background": "#f6f6f7",
626
+ "textBackground": "#401960",
627
+ },
614
628
  "thumb": "#ffffff",
615
629
  },
616
- "heights": Object {
617
- "medium": 28.799999999999997,
618
- "small": 24,
619
- },
620
630
  "radii": Object {
621
631
  "rounded": 999,
632
+ "selector": Object {
633
+ "default": 999,
634
+ },
635
+ },
636
+ "sizes": Object {
637
+ "heights": Object {
638
+ "medium": 32,
639
+ "small": 24,
640
+ },
641
+ "selector": Object {
642
+ "height": 56,
643
+ },
644
+ "thumbs": Object {
645
+ "medium": 24,
646
+ "small": 16,
647
+ },
648
+ "widths": Object {
649
+ "medium": 64,
650
+ "small": 48,
651
+ },
622
652
  },
623
653
  "spaces": Object {
624
- "inactive": 0,
625
654
  "medium": 4,
655
+ "selector": Object {
656
+ "iconPadding": 16,
657
+ "wrapperPadding": 4,
658
+ },
626
659
  "small": 4,
627
660
  },
628
- "thumbSizes": Object {
629
- "medium": 20.8,
630
- "small": 16,
631
- },
632
- "widths": Object {
633
- "medium": 56,
634
- "small": 48,
635
- },
636
661
  },
637
662
  "tabs": Object {
638
663
  "borderWidths": Object {
@@ -888,6 +913,8 @@ Object {
888
913
  "__alpha__globalNeutral3": "#f6f6f7",
889
914
  "__alpha__globalPrimary": "#001f23",
890
915
  "__alpha__globalSecondary1": "#4d6265",
916
+ "__alpha__globalSecondary4": "#e6e9e9",
917
+ "__alpha__primary1": "#401960",
891
918
  "__alpha__primary2": "#c38cee",
892
919
  "__alpha__secondary1": "#795e90",
893
920
  "__alpha__secondary2": "#a08cb0",
@@ -971,6 +998,26 @@ Object {
971
998
  "rounded": 999,
972
999
  "xlarge": 16,
973
1000
  },
1001
+ "sizes": Object {
1002
+ "14xlarge": 136,
1003
+ "15xlarge": 144,
1004
+ "18xlarge": 168,
1005
+ "19xlarge": 176,
1006
+ "6xlarge": 72,
1007
+ "7xlarge": 80,
1008
+ "9xlarge": 96,
1009
+ "large": 24,
1010
+ "medium": 16,
1011
+ "small": 8,
1012
+ "smallMedium": 12,
1013
+ "xlarge": 32,
1014
+ "xsmall": 4,
1015
+ "xxlarge": 40,
1016
+ "xxsmall": 2,
1017
+ "xxxlarge": 48,
1018
+ "xxxxlarge": 56,
1019
+ "xxxxxlarge": 64,
1020
+ },
974
1021
  "space": Object {
975
1022
  "large": 24,
976
1023
  "medium": 16,
@@ -1,4 +1,3 @@
1
- import { scale } from '../../utils/scale';
2
1
  import type { GlobalTheme } from '../global';
3
2
 
4
3
  const getAlertTheme = (theme: GlobalTheme) => {
@@ -12,7 +11,7 @@ const getAlertTheme = (theme: GlobalTheme) => {
12
11
  };
13
12
 
14
13
  const sizes = {
15
- height: scale(48),
14
+ height: theme.sizes.xxxlarge,
16
15
  };
17
16
 
18
17
  const space = {
@@ -10,14 +10,14 @@ const getAvatarTheme = (theme: GlobalTheme) => {
10
10
  };
11
11
 
12
12
  const sizes = {
13
- small: theme.space.xlarge,
14
- medium: theme.space.xxlarge,
15
- large: theme.space.xxxlarge,
16
- xlarge: theme.space.xxxxlarge,
17
- xxlarge: theme.space.xlarge * 2,
18
- xxxlarge: theme.space.xxlarge * 2,
19
- xxxxlarge: theme.space.xxxlarge * 2,
20
- xxxxxlarge: theme.space.small * 17,
13
+ small: theme.sizes.xlarge,
14
+ medium: theme.sizes.xxlarge,
15
+ large: theme.sizes.xxxlarge,
16
+ xlarge: theme.sizes.xxxxlarge,
17
+ xxlarge: theme.sizes.xxxxxlarge,
18
+ xxxlarge: theme.sizes['7xlarge'],
19
+ xxxxlarge: theme.sizes['9xlarge'],
20
+ xxxxxlarge: theme.sizes['14xlarge'],
21
21
  };
22
22
 
23
23
  const fontSizes = {
@@ -19,10 +19,10 @@ const getBadgeTheme = (theme: GlobalTheme) => {
19
19
  };
20
20
 
21
21
  const sizes = {
22
- height: theme.fontSizes.small + theme.space.small,
23
- minWidth: theme.fontSizes.small + theme.space.small,
24
- statusHeight: theme.space.small,
25
- statusWidth: theme.space.small,
22
+ height: theme.fontSizes.small + theme.sizes.small,
23
+ minWidth: theme.fontSizes.small + theme.sizes.small,
24
+ statusHeight: theme.sizes.small,
25
+ statusWidth: theme.sizes.small,
26
26
  };
27
27
 
28
28
  const space = {
@@ -7,7 +7,7 @@ const getBottomNavigationTheme = (theme: GlobalTheme) => {
7
7
  };
8
8
 
9
9
  const sizes = {
10
- height: 72,
10
+ height: theme.sizes['6xlarge'],
11
11
  };
12
12
 
13
13
  const shadows = {
@@ -1,4 +1,3 @@
1
- import { scale } from '../../utils/scale';
2
1
  import type { GlobalTheme } from '../global';
3
2
 
4
3
  const getBottomSheetTheme = (theme: GlobalTheme) => {
@@ -9,8 +8,8 @@ const getBottomSheetTheme = (theme: GlobalTheme) => {
9
8
  };
10
9
 
11
10
  const sizes = {
12
- sectionHeight: scale(64),
13
- closeIcon: scale(48),
11
+ sectionHeight: theme.sizes.xxxxxlarge,
12
+ closeIcon: theme.sizes.xxxlarge,
14
13
  };
15
14
 
16
15
  const space = {
@@ -1,4 +1,3 @@
1
- import { scale } from '../../utils/scale';
2
1
  import type { GlobalTheme } from '../global';
3
2
 
4
3
  const getCalendarTheme = (theme: GlobalTheme) => {
@@ -9,13 +8,16 @@ const getCalendarTheme = (theme: GlobalTheme) => {
9
8
  inverted: theme.colors.invertedText,
10
9
  };
11
10
 
11
+ const cellSize = theme.sizes.xxxlarge;
12
+ const markSize = theme.sizes.xsmall;
13
+
12
14
  const sizes = {
13
- cellWidth: scale(48),
14
- cellHeight: scale(48),
15
- cellCircleWidth: scale(44),
16
- cellCircleHeight: scale(44),
17
- markWidth: scale(4),
18
- markHeight: scale(4),
15
+ cellWidth: cellSize,
16
+ cellHeight: cellSize,
17
+ cellCircleWidth: cellSize - markSize,
18
+ cellCircleHeight: cellSize - markSize,
19
+ markWidth: markSize,
20
+ markHeight: markSize,
19
21
  };
20
22
 
21
23
  const space = {
@@ -12,7 +12,7 @@ const getCardTheme = (theme: GlobalTheme) => {
12
12
  };
13
13
 
14
14
  const sizes = {
15
- indicatorWidth: theme.space.medium,
15
+ indicatorWidth: theme.sizes.medium,
16
16
  };
17
17
 
18
18
  const radii = {
@@ -1,5 +1,4 @@
1
1
  import type { GlobalTheme } from '../global';
2
- import { scale } from '../../utils/scale';
3
2
 
4
3
  const getCheckboxTheme = (theme: GlobalTheme) => {
5
4
  const colors = {
@@ -8,15 +7,13 @@ const getCheckboxTheme = (theme: GlobalTheme) => {
8
7
  };
9
8
 
10
9
  const space = {
11
- // to remove the empty space above the check icon
12
- // and also to center the check mark
13
- iconTop: -scale(3),
10
+ iconTop: 0,
14
11
  wrapperPadding: theme.space.medium,
15
12
  iconDescriptionPadding: theme.space.smallMedium,
16
13
  };
17
14
 
18
15
  const sizes = {
19
- icon: scale(20),
16
+ icon: theme.sizes.large,
20
17
  };
21
18
 
22
19
  const radii = {
@@ -1,8 +1,8 @@
1
- import { scale } from '../../utils/scale';
1
+ import { GlobalTheme } from '../global';
2
2
 
3
- const getDatePickerTheme = () => {
3
+ const getDatePickerTheme = (theme: GlobalTheme) => {
4
4
  const sizes = {
5
- height: scale(176),
5
+ height: theme.sizes['19xlarge'],
6
6
  };
7
7
 
8
8
  return { sizes };
@@ -1,4 +1,3 @@
1
- import { scale } from '../../utils/scale';
2
1
  import type { GlobalTheme } from '../global';
3
2
 
4
3
  const getDrawerTheme = (theme: GlobalTheme) => {
@@ -19,8 +18,8 @@ const getDrawerTheme = (theme: GlobalTheme) => {
19
18
  };
20
19
 
21
20
  const sizes = {
22
- handlerWidth: scale(56),
23
- handlerHeight: scale(4),
21
+ handlerWidth: theme.sizes.xxxxlarge,
22
+ handlerHeight: theme.sizes.xsmall,
24
23
  };
25
24
 
26
25
  const shadows = {
@@ -1,19 +1,14 @@
1
- import { scale } from '../../utils/scale';
2
1
  import type { GlobalTheme } from '../global';
3
2
 
4
3
  const getEmptyTheme = (theme: GlobalTheme) => {
5
4
  const space = {
6
5
  titleMargin: theme.space.medium,
7
- illustrationMargin: theme.space.large,
6
+ imageMargin: theme.space.large,
8
7
  wrapperPadding: theme.space.medium,
9
8
  };
10
9
 
11
10
  const sizes = {
12
- illustration: scale(168),
13
- };
14
-
15
- const radii = {
16
- illustration: theme.radii.rounded,
11
+ image: theme.sizes['18xlarge'],
17
12
  };
18
13
 
19
14
  const colors = {
@@ -33,7 +28,7 @@ const getEmptyTheme = (theme: GlobalTheme) => {
33
28
  description: theme.fonts.light,
34
29
  };
35
30
 
36
- return { fontSizes, colors, sizes, space, fonts, radii };
31
+ return { fontSizes, colors, sizes, space, fonts };
37
32
  };
38
33
 
39
34
  export default getEmptyTheme;
@@ -12,8 +12,8 @@ const getFABTheme = (theme: GlobalTheme) => {
12
12
  };
13
13
 
14
14
  const sizes = {
15
- width: 64,
16
- height: 64,
15
+ width: theme.sizes.xxxxxlarge,
16
+ height: theme.sizes.xxxxxlarge,
17
17
  };
18
18
 
19
19
  const fonts = {
@@ -0,0 +1,12 @@
1
+ import type { GlobalTheme } from '../global';
2
+
3
+ const getImageTheme = (theme: GlobalTheme) => {
4
+ const sizes = {
5
+ '6xlarge': theme.sizes['6xlarge'],
6
+ '15xlarge': theme.sizes['15xlarge'],
7
+ };
8
+
9
+ return { sizes };
10
+ };
11
+
12
+ export default getImageTheme;
@@ -24,9 +24,9 @@ const getPinInputTheme = (theme: GlobalTheme) => {
24
24
  };
25
25
 
26
26
  const sizes = {
27
- cellWidth: theme.space.xxlarge,
28
- cellHeight: theme.space.xxxlarge,
29
- mask: theme.space.medium,
27
+ cellWidth: theme.sizes.xxlarge,
28
+ cellHeight: theme.sizes.xxxlarge,
29
+ mask: theme.sizes.medium,
30
30
  };
31
31
 
32
32
  const space = {