@hero-design/rn 8.104.1-alpha.2 → 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 (77) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +6 -10
  3. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  4. package/es/index.js +683 -402
  5. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  6. package/lib/index.js +683 -401
  7. package/package.json +1 -1
  8. package/src/components/Calendar/CalendarRange.tsx +35 -117
  9. package/src/components/Calendar/__tests__/helper.spec.ts +197 -0
  10. package/src/components/Calendar/constants.ts +9 -0
  11. package/src/components/Calendar/helpers.ts +112 -0
  12. package/src/components/Calendar/index.tsx +34 -159
  13. package/src/components/Calendar/shared/hooks/useCalendarLayout.ts +37 -0
  14. package/src/components/Calendar/types.ts +62 -0
  15. package/src/components/DatePicker/DatePickerCalendar.tsx +2 -1
  16. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  17. package/src/components/Icon/IconList.ts +2 -0
  18. package/src/components/SegmentedControl/SegmentedItem.tsx +192 -0
  19. package/src/components/SegmentedControl/StyledSegmentedControl.tsx +62 -0
  20. package/src/components/SegmentedControl/__tests__/SegmentedItem.spec.tsx +162 -0
  21. package/src/components/SegmentedControl/__tests__/__snapshots__/SegmentedItem.spec.tsx.snap +131 -0
  22. package/src/components/SegmentedControl/__tests__/__snapshots__/index.spec.tsx.snap +359 -0
  23. package/src/components/SegmentedControl/__tests__/index.spec.tsx +247 -0
  24. package/src/components/SegmentedControl/index.tsx +61 -0
  25. package/src/components/SegmentedControl/types.ts +46 -0
  26. package/src/components/Typography/Body/StyledBody.tsx +2 -2
  27. package/src/components/Typography/Body/__tests__/__snapshots__/index.spec.tsx.snap +51 -0
  28. package/src/components/Typography/Body/__tests__/index.spec.tsx +1 -0
  29. package/src/components/Typography/Body/index.tsx +2 -13
  30. package/src/components/Typography/Caption/StyledCaption.tsx +2 -2
  31. package/src/components/Typography/Caption/__tests__/__snapshots__/index.spec.tsx.snap +50 -0
  32. package/src/components/Typography/Caption/__tests__/index.spec.tsx +1 -0
  33. package/src/components/Typography/Caption/index.tsx +2 -13
  34. package/src/components/Typography/Label/StyledLabel.tsx +2 -2
  35. package/src/components/Typography/Label/__tests__/__snapshots__/index.spec.tsx.snap +48 -0
  36. package/src/components/Typography/Label/__tests__/index.spec.tsx +1 -0
  37. package/src/components/Typography/Label/index.tsx +2 -13
  38. package/src/components/Typography/Title/StyledTitle.tsx +2 -2
  39. package/src/components/Typography/Title/__tests__/__snapshots__/index.spec.tsx.snap +51 -0
  40. package/src/components/Typography/Title/__tests__/index.spec.tsx +1 -0
  41. package/src/components/Typography/Title/index.tsx +2 -13
  42. package/src/components/Typography/types.ts +3 -2
  43. package/src/index.ts +2 -0
  44. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +54 -0
  45. package/src/theme/components/segmentedControl.ts +60 -0
  46. package/src/theme/components/typography.ts +1 -0
  47. package/src/theme/getTheme.ts +3 -0
  48. package/src/types.ts +2 -0
  49. package/stats/8.104.0/rn-stats.html +3 -1
  50. package/stats/8.105.0/rn-stats.html +4844 -0
  51. package/types/components/Calendar/CalendarRange.d.ts +4 -16
  52. package/types/components/Calendar/constants.d.ts +4 -0
  53. package/types/components/Calendar/helpers.d.ts +14 -0
  54. package/types/components/Calendar/index.d.ts +5 -56
  55. package/types/components/Calendar/shared/hooks/useCalendarLayout.d.ts +8 -0
  56. package/types/components/Calendar/types.d.ts +58 -0
  57. package/types/components/Icon/IconList.d.ts +1 -1
  58. package/types/components/Icon/index.d.ts +1 -1
  59. package/types/components/SegmentedControl/SegmentedItem.d.ts +18 -0
  60. package/types/components/SegmentedControl/StyledSegmentedControl.d.ts +26 -0
  61. package/types/components/SegmentedControl/index.d.ts +31 -0
  62. package/types/components/SegmentedControl/types.d.ts +43 -0
  63. package/types/components/TextInput/index.d.ts +1 -1
  64. package/types/components/Typography/Body/StyledBody.d.ts +2 -2
  65. package/types/components/Typography/Body/index.d.ts +2 -1
  66. package/types/components/Typography/Caption/StyledCaption.d.ts +2 -2
  67. package/types/components/Typography/Caption/index.d.ts +2 -1
  68. package/types/components/Typography/Label/StyledLabel.d.ts +2 -2
  69. package/types/components/Typography/Label/index.d.ts +2 -1
  70. package/types/components/Typography/Title/StyledTitle.d.ts +2 -2
  71. package/types/components/Typography/Title/index.d.ts +2 -1
  72. package/types/components/Typography/types.d.ts +1 -1
  73. package/types/index.d.ts +2 -1
  74. package/types/theme/components/segmentedControl.d.ts +46 -0
  75. package/types/theme/components/typography.d.ts +1 -0
  76. package/types/theme/getTheme.d.ts +2 -0
  77. package/types/types.d.ts +2 -1
@@ -816,6 +816,57 @@ exports[`Title has h6 level and playful typeface style 1`] = `
816
816
  </View>
817
817
  `;
818
818
 
819
+ exports[`Title has inactive intent style 1`] = `
820
+ <View
821
+ style={
822
+ {
823
+ "flex": 1,
824
+ }
825
+ }
826
+ >
827
+ <Text
828
+ allowFontScaling={false}
829
+ style={
830
+ [
831
+ {
832
+ "color": "#808f91",
833
+ "fontFamily": "BeVietnamPro-Regular",
834
+ "fontSize": 42,
835
+ "letterSpacing": 0,
836
+ "lineHeight": 50,
837
+ },
838
+ undefined,
839
+ ]
840
+ }
841
+ themeIntent="inactive"
842
+ themeLevel="h1"
843
+ themeTypeface="neutral"
844
+ >
845
+ This is a test
846
+ </Text>
847
+ <View
848
+ pointerEvents="box-none"
849
+ position="bottom"
850
+ style={
851
+ [
852
+ {
853
+ "bottom": 0,
854
+ "elevation": 9999,
855
+ "flexDirection": "column-reverse",
856
+ "left": 0,
857
+ "paddingHorizontal": 24,
858
+ "paddingVertical": 16,
859
+ "position": "absolute",
860
+ "right": 0,
861
+ "top": 0,
862
+ },
863
+ undefined,
864
+ ]
865
+ }
866
+ />
867
+ </View>
868
+ `;
869
+
819
870
  exports[`Title has info intent style 1`] = `
820
871
  <View
821
872
  style={
@@ -23,6 +23,7 @@ describe('Title', () => {
23
23
  ${'archived'}
24
24
  ${'disabled'}
25
25
  ${'muted'}
26
+ ${'inactive'}
26
27
  `('has $intent intent style', ({ intent }) => {
27
28
  const { toJSON } = renderWithTheme(
28
29
  <Title intent={intent}>This is a test</Title>
@@ -6,6 +6,7 @@ import type {
6
6
  TextStyle,
7
7
  } from 'react-native';
8
8
  import { StyledTitle } from './StyledTitle';
9
+ import type { TypographyIntent } from '../types';
9
10
 
10
11
  export interface TitleProps extends NativeTextProps {
11
12
  /**
@@ -15,19 +16,7 @@ export interface TitleProps extends NativeTextProps {
15
16
  /**
16
17
  * Visual intent color to apply to the text.
17
18
  */
18
- intent?:
19
- | 'body'
20
- | 'subdued'
21
- | 'primary'
22
- | 'secondary'
23
- | 'success'
24
- | 'info'
25
- | 'warning'
26
- | 'danger'
27
- | 'inverted'
28
- | 'archived'
29
- | 'disabled'
30
- | 'muted';
19
+ intent?: TypographyIntent;
31
20
  /**
32
21
  * Additional style.
33
22
  */
@@ -4,7 +4,7 @@ export const FONTWEIGHT_MAP = {
4
4
  'semi-bold': 'semiBold',
5
5
  } as const;
6
6
 
7
- export type ThemeIntent =
7
+ export type TypographyIntent =
8
8
  | 'body'
9
9
  | 'subdued'
10
10
  | 'primary'
@@ -16,4 +16,5 @@ export type ThemeIntent =
16
16
  | 'inverted'
17
17
  | 'archived'
18
18
  | 'disabled'
19
- | 'muted';
19
+ | 'muted'
20
+ | 'inactive';
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,
@@ -1576,6 +1629,7 @@ exports[`theme returns correct theme object 1`] = `
1576
1629
  "body": "#001f23",
1577
1630
  "danger": "#f46363",
1578
1631
  "disabled": "#bfc1c5",
1632
+ "inactive": "#808f91",
1579
1633
  "info": "#355bfb",
1580
1634
  "inverted": "#ffffff",
1581
1635
  "muted": "#4d6265",
@@ -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;
@@ -14,6 +14,7 @@ const getTypographyTheme = (theme: GlobalTheme) => {
14
14
  archived: theme.colors.onArchivedSurface,
15
15
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
16
16
  muted: theme.colors.mutedOnDefaultGlobalSurface,
17
+ inactive: theme.colors.inactiveOnDefaultGlobalSurface,
17
18
  };
18
19
 
19
20
  const fontSizes = {
@@ -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
  };