@hero-design/rn 8.104.1-alpha.3 → 8.105.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 (34) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +6 -18
  3. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  4. package/es/index.js +521 -284
  5. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  6. package/lib/index.js +521 -283
  7. package/package.json +1 -1
  8. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  9. package/src/components/Icon/IconList.ts +2 -0
  10. package/src/components/SegmentedControl/SegmentedItem.tsx +192 -0
  11. package/src/components/SegmentedControl/StyledSegmentedControl.tsx +62 -0
  12. package/src/components/SegmentedControl/__tests__/SegmentedItem.spec.tsx +162 -0
  13. package/src/components/SegmentedControl/__tests__/__snapshots__/SegmentedItem.spec.tsx.snap +131 -0
  14. package/src/components/SegmentedControl/__tests__/__snapshots__/index.spec.tsx.snap +359 -0
  15. package/src/components/SegmentedControl/__tests__/index.spec.tsx +247 -0
  16. package/src/components/SegmentedControl/index.tsx +61 -0
  17. package/src/components/SegmentedControl/types.ts +46 -0
  18. package/src/index.ts +2 -0
  19. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +53 -0
  20. package/src/theme/components/segmentedControl.ts +60 -0
  21. package/src/theme/getTheme.ts +3 -0
  22. package/src/types.ts +2 -0
  23. package/stats/8.105.0/rn-stats.html +4844 -0
  24. package/types/components/Icon/IconList.d.ts +1 -1
  25. package/types/components/Icon/index.d.ts +1 -1
  26. package/types/components/SegmentedControl/SegmentedItem.d.ts +18 -0
  27. package/types/components/SegmentedControl/StyledSegmentedControl.d.ts +26 -0
  28. package/types/components/SegmentedControl/index.d.ts +31 -0
  29. package/types/components/SegmentedControl/types.d.ts +43 -0
  30. package/types/components/TextInput/index.d.ts +1 -1
  31. package/types/index.d.ts +2 -1
  32. package/types/theme/components/segmentedControl.d.ts +46 -0
  33. package/types/theme/getTheme.d.ts +2 -0
  34. package/types/types.d.ts +2 -1
package/src/index.ts CHANGED
@@ -77,6 +77,7 @@ import {
77
77
  FlatListWithFAB,
78
78
  } from './components/AnimatedScroller';
79
79
  import Search from './components/Search';
80
+ import SegmentedControl from './components/SegmentedControl';
80
81
  import FloatingIsland from './components/FloatingIsland';
81
82
  import LocaleProvider from './components/LocaleProvider';
82
83
  import FilterTrigger from './components/FilterTrigger';
@@ -141,6 +142,7 @@ export {
141
142
  Swipeable,
142
143
  Radio,
143
144
  Search,
145
+ SegmentedControl,
144
146
  ScrollViewWithFAB,
145
147
  SectionHeading,
146
148
  SectionListWithFAB,
@@ -1151,6 +1151,59 @@ exports[`theme returns correct theme object 1`] = `
1151
1151
  "iconMarginRight": 12,
1152
1152
  },
1153
1153
  },
1154
+ "segmentedControl": {
1155
+ "colors": {
1156
+ "itemBackground": {
1157
+ "active": "#ffffff",
1158
+ "inactive": "transparent",
1159
+ },
1160
+ "wrapperBackground": "#f6f6f7",
1161
+ },
1162
+ "lineHeights": {
1163
+ "itemText": undefined,
1164
+ },
1165
+ "radii": {
1166
+ "item": {
1167
+ "large": 16,
1168
+ "medium": 12,
1169
+ },
1170
+ "wrapper": {
1171
+ "large": 20,
1172
+ "medium": 16,
1173
+ },
1174
+ },
1175
+ "shadows": {
1176
+ "item": {
1177
+ "active": {
1178
+ "elevation": 6,
1179
+ "shadowColor": "#001f23",
1180
+ "shadowOffset": {
1181
+ "height": 2,
1182
+ "width": 0,
1183
+ },
1184
+ "shadowOpacity": 0.12,
1185
+ "shadowRadius": 2,
1186
+ },
1187
+ "inactive": undefined,
1188
+ },
1189
+ },
1190
+ "sizes": {
1191
+ "itemHeight": {
1192
+ "large": 36,
1193
+ "medium": 28,
1194
+ },
1195
+ "wrapperHeight": {
1196
+ "large": 44,
1197
+ "medium": 36,
1198
+ },
1199
+ },
1200
+ "space": {
1201
+ "itemAffixGap": 8,
1202
+ "itemLabelGap": 4,
1203
+ "itemLabelMarginEnd": 12,
1204
+ "wrapperHorizontalPadding": 4,
1205
+ },
1206
+ },
1154
1207
  "select": {
1155
1208
  "radii": {
1156
1209
  "option": 4,
@@ -0,0 +1,60 @@
1
+ import { Platform } from 'react-native';
2
+ import { scale } from '../../utils/scale';
3
+ import type { GlobalTheme } from '../global';
4
+
5
+ const getSegmentedControlTheme = (theme: GlobalTheme) => {
6
+ const sizes = {
7
+ itemHeight: {
8
+ medium: scale(28),
9
+ large: scale(36),
10
+ },
11
+ wrapperHeight: {
12
+ medium: scale(36),
13
+ large: scale(44),
14
+ },
15
+ };
16
+
17
+ const colors = {
18
+ itemBackground: {
19
+ inactive: 'transparent',
20
+ active: theme.colors.defaultGlobalSurface,
21
+ },
22
+ wrapperBackground: theme.colors.neutralGlobalSurface,
23
+ };
24
+
25
+ const shadows = {
26
+ item: {
27
+ inactive: undefined,
28
+ active: theme.shadows.default,
29
+ },
30
+ };
31
+
32
+ const radii = {
33
+ item: {
34
+ medium: theme.radii.large,
35
+ large: theme.radii.xlarge,
36
+ },
37
+ wrapper: {
38
+ medium: theme.radii.xlarge,
39
+ large: theme.radii.xxlarge,
40
+ },
41
+ };
42
+
43
+ const space = {
44
+ wrapperHorizontalPadding: theme.space.xsmall,
45
+ itemLabelGap: theme.space.xsmall,
46
+ itemLabelMarginEnd: theme.space.smallMedium,
47
+ itemAffixGap: theme.space.small,
48
+ };
49
+
50
+ const lineHeights = {
51
+ itemText: Platform.select({
52
+ android: 20,
53
+ ios: undefined,
54
+ }),
55
+ };
56
+
57
+ return { sizes, colors, shadows, radii, space, lineHeights };
58
+ };
59
+
60
+ export default getSegmentedControlTheme;
@@ -56,6 +56,7 @@ import getFloatingIslandTheme from './components/floatingIsland';
56
56
  import getAppCueTheme from './components/appCue';
57
57
  import { ThemeMode } from './global/colors/types';
58
58
  import getFilterTriggerTheme from './components/filterTrigger';
59
+ import getSegmentedControlTheme from './components/segmentedControl';
59
60
 
60
61
  type Theme = GlobalTheme & {
61
62
  themeMode?: ThemeMode;
@@ -114,6 +115,7 @@ type Theme = GlobalTheme & {
114
115
  toolbar: ReturnType<typeof getToolbarTheme>;
115
116
  typography: ReturnType<typeof getTypographyTheme>;
116
117
  floatingIsland: ReturnType<typeof getFloatingIslandTheme>;
118
+ segmentedControl: ReturnType<typeof getSegmentedControlTheme>;
117
119
  };
118
120
  };
119
121
 
@@ -179,6 +181,7 @@ const getTheme = (
179
181
  toolbar: getToolbarTheme(globalTheme),
180
182
  typography: getTypographyTheme(globalTheme),
181
183
  floatingIsland: getFloatingIslandTheme(globalTheme),
184
+ segmentedControl: getSegmentedControlTheme(globalTheme),
182
185
  },
183
186
  };
184
187
  };
package/src/types.ts CHANGED
@@ -51,6 +51,7 @@ import { PinInputHandler } from './components/PinInput';
51
51
  import { ThemeScale } from './components/Box/types';
52
52
  import { TimePickerProps } from './components/TimePicker/types';
53
53
  import { DatePickerProps } from './components/DatePicker/types';
54
+ import type { SegmentedControlItemConfig } from './components/SegmentedControl/types';
54
55
 
55
56
  export type {
56
57
  Space,
@@ -105,4 +106,5 @@ export type {
105
106
  BadgeProps,
106
107
  TimePickerProps,
107
108
  DatePickerProps,
109
+ SegmentedControlItemConfig,
108
110
  };