@hero-design/rn 8.25.2 → 8.26.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 (35) hide show
  1. package/.turbo/turbo-build.log +8 -9
  2. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  3. package/es/index.js +282 -186
  4. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  5. package/lib/index.js +282 -186
  6. package/package.json +5 -5
  7. package/src/components/FAB/ActionGroup/ActionItem.tsx +6 -1
  8. package/src/components/FAB/ActionGroup/StyledActionItem.tsx +1 -4
  9. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +374 -202
  10. package/src/components/FAB/ActionGroup/index.tsx +15 -9
  11. package/src/components/FAB/AnimatedFABIcon.tsx +5 -3
  12. package/src/components/FAB/FAB.tsx +16 -3
  13. package/src/components/FAB/StyledFAB.tsx +10 -3
  14. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +4 -4
  15. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +1 -2
  16. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +74 -43
  17. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  18. package/src/components/Icon/IconList.ts +1 -0
  19. package/src/components/Switch/SelectorSwitch/Option.tsx +31 -5
  20. package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +18 -4
  21. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +25 -18
  22. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +49 -18
  23. package/src/components/Switch/SelectorSwitch/index.tsx +81 -17
  24. package/src/components/Switch/index.tsx +1 -0
  25. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +7 -9
  26. package/src/theme/components/fab.ts +7 -9
  27. package/types/components/FAB/ActionGroup/ActionItem.d.ts +1 -0
  28. package/types/components/FAB/StyledFAB.d.ts +5 -1
  29. package/types/components/Icon/IconList.d.ts +1 -1
  30. package/types/components/Icon/index.d.ts +1 -1
  31. package/types/components/Icon/utils.d.ts +1 -1
  32. package/types/components/Switch/SelectorSwitch/Option.d.ts +4 -1
  33. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +15 -9
  34. package/types/components/Switch/SelectorSwitch/index.d.ts +1 -1
  35. package/types/theme/components/fab.d.ts +4 -6
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { Animated, View } from 'react-native';
2
+ import { Animated, Easing, Platform, View } from 'react-native';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import ActionItem from './ActionItem';
5
5
  import {
@@ -19,13 +19,18 @@ type ActionItemsContainerProps = {
19
19
  const ActionItemsListComponent = ({
20
20
  style,
21
21
  items,
22
- }: ActionItemsContainerProps) => (
23
- <View style={style}>
24
- {items?.map((itemProp) => (
25
- <ActionItem key={itemProp.icon} {...itemProp} />
26
- ))}
27
- </View>
28
- );
22
+ }: ActionItemsContainerProps) => {
23
+ return (
24
+ <View style={style}>
25
+ {items?.map((itemProp) => (
26
+ <ActionItem
27
+ key={itemProp.key || `${itemProp.icon}_${itemProp.title}`}
28
+ {...itemProp}
29
+ />
30
+ ))}
31
+ </View>
32
+ );
33
+ };
29
34
 
30
35
  export interface ActionGroupProps {
31
36
  /**
@@ -85,7 +90,8 @@ const ActionGroup = ({
85
90
  useEffect(() => {
86
91
  const animation = Animated.timing(tranlateXAnimation.current, {
87
92
  toValue: active ? 1 : 0,
88
- useNativeDriver: true,
93
+ useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
94
+ easing: Easing.inOut(Easing.cubic),
89
95
  });
90
96
 
91
97
  animation.start();
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { Animated, StyleSheet } from 'react-native';
2
+ import { Animated, Easing, Platform, StyleSheet } from 'react-native';
3
3
  import { StyledFABIcon } from './StyledFAB';
4
4
  import type { IconProps } from '../Icon';
5
5
 
@@ -16,7 +16,9 @@ const AnimatedFABIcon = ({ active, ...iconProps }: Props) => {
16
16
  useEffect(() => {
17
17
  const animation = Animated.timing(rotateAnimation.current, {
18
18
  toValue: active ? 1 : 0,
19
- useNativeDriver: true,
19
+ useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
20
+ easing: Easing.inOut(Easing.ease),
21
+ duration: 300,
20
22
  });
21
23
 
22
24
  animation.start();
@@ -39,7 +41,7 @@ const AnimatedFABIcon = ({ active, ...iconProps }: Props) => {
39
41
  },
40
42
  ])}
41
43
  >
42
- <AnimatedIcons {...iconProps} />
44
+ <AnimatedIcons size="xsmall" {...iconProps} />
43
45
  </Animated.View>
44
46
  );
45
47
  };
@@ -3,7 +3,12 @@ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import { useTheme } from '../../theme';
4
4
  import type { IconName } from '../Icon';
5
5
  import { AnimatedFABIcon } from './AnimatedFABIcon';
6
- import { StyledFAB, StyledFABIcon, StyledFABText } from './StyledFAB';
6
+ import {
7
+ StyledFAB,
8
+ StyledFABIcon,
9
+ StyledFABText,
10
+ StyledIconContainer,
11
+ } from './StyledFAB';
7
12
 
8
13
  export interface FABProps {
9
14
  /**
@@ -54,7 +59,13 @@ const IconOnlyContent = ({
54
59
  }) => {
55
60
  if (animated) {
56
61
  return (
57
- <AnimatedFABIcon active={active} icon={icon} testID="animated-fab-icon" />
62
+ <StyledIconContainer>
63
+ <AnimatedFABIcon
64
+ active={active}
65
+ icon={icon}
66
+ testID="animated-fab-icon"
67
+ />
68
+ </StyledIconContainer>
58
69
  );
59
70
  }
60
71
  return <StyledFABIcon icon={icon} testID="styled-fab-icon" />;
@@ -68,7 +79,9 @@ const IconWithTextContent = ({
68
79
  title?: string;
69
80
  }) => (
70
81
  <>
71
- <StyledFABIcon size="xsmall" icon={icon} testID="styled-fab-icon" />
82
+ <StyledIconContainer>
83
+ <StyledFABIcon size="xsmall" icon={icon} testID="styled-fab-icon" />
84
+ </StyledIconContainer>
72
85
  <StyledFABText>{title}</StyledFABText>
73
86
  </>
74
87
  );
@@ -4,6 +4,7 @@ import { TouchableHighlight } from 'react-native';
4
4
  import type { IconProps } from '../Icon';
5
5
  import Icon from '../Icon';
6
6
  import Typography from '../Typography';
7
+ import Box from '../Box';
7
8
 
8
9
  const StyledFAB = styled(TouchableHighlight)<TouchableHighlightProps>(
9
10
  ({ theme }) => ({
@@ -12,8 +13,7 @@ const StyledFAB = styled(TouchableHighlight)<TouchableHighlightProps>(
12
13
  alignItems: 'center',
13
14
  justifyContent: 'center',
14
15
  alignSelf: 'flex-start',
15
- paddingHorizontal: theme.__hd__.fab.space.containerPaddingHorizontal,
16
- paddingVertical: theme.__hd__.fab.space.containerPaddingVertical,
16
+ padding: theme.__hd__.fab.space.containerPadding,
17
17
  flexDirection: 'row',
18
18
  elevation: theme.__hd__.fab.shadows.elevation,
19
19
  shadowColor: theme.__hd__.fab.colors.shadow,
@@ -40,4 +40,11 @@ const StyledFABText = styled(Typography.Text)<TextProps>(({ theme }) => ({
40
40
  marginHorizontal: theme.__hd__.fab.space.titleMarginHorizontal,
41
41
  }));
42
42
 
43
- export { StyledFAB, StyledFABIcon, StyledFABText };
43
+ const StyledIconContainer = styled(Box)(({ theme }) => ({
44
+ width: theme.__hd__.fab.sizes.iconContainerWidth,
45
+ height: theme.__hd__.fab.sizes.iconContainerHeight,
46
+ justifyContent: 'center',
47
+ alignItems: 'center',
48
+ }));
49
+
50
+ export { StyledFAB, StyledFABIcon, StyledFABText, StyledIconContainer };
@@ -19,7 +19,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is false 1`] = `
19
19
  Array [
20
20
  Object {
21
21
  "color": "#001f23",
22
- "fontSize": 24,
22
+ "fontSize": 16,
23
23
  },
24
24
  Array [
25
25
  Object {
@@ -33,7 +33,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is false 1`] = `
33
33
  ]
34
34
  }
35
35
  themeIntent="text"
36
- themeSize="medium"
36
+ themeSize="xsmall"
37
37
  />
38
38
  </View>
39
39
  `;
@@ -57,7 +57,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is true 1`] = `
57
57
  Array [
58
58
  Object {
59
59
  "color": "#001f23",
60
- "fontSize": 24,
60
+ "fontSize": 16,
61
61
  },
62
62
  Array [
63
63
  Object {
@@ -71,7 +71,7 @@ exports[`AnimatedFABIcon renders correctly when isActive is true 1`] = `
71
71
  ]
72
72
  }
73
73
  themeIntent="text"
74
- themeSize="medium"
74
+ themeSize="xsmall"
75
75
  />
76
76
  </View>
77
77
  `;
@@ -21,8 +21,7 @@ exports[`StyledFAB renders correctly 1`] = `
21
21
  "elevation": 2,
22
22
  "flexDirection": "row",
23
23
  "justifyContent": "center",
24
- "paddingHorizontal": 16,
25
- "paddingVertical": 16,
24
+ "padding": 20,
26
25
  "shadowColor": "#001f23",
27
26
  "shadowOffset": Object {
28
27
  "height": 2,
@@ -21,8 +21,7 @@ exports[`FAB when animated is false renders StyledFABIcon 1`] = `
21
21
  "elevation": 2,
22
22
  "flexDirection": "row",
23
23
  "justifyContent": "center",
24
- "paddingHorizontal": 16,
25
- "paddingVertical": 16,
24
+ "padding": 20,
26
25
  "shadowColor": "#001f23",
27
26
  "shadowOffset": Object {
28
27
  "height": 2,
@@ -84,8 +83,7 @@ exports[`FAB when animated is true renders animatedFABIcon 1`] = `
84
83
  "elevation": 2,
85
84
  "flexDirection": "row",
86
85
  "justifyContent": "center",
87
- "paddingHorizontal": 16,
88
- "paddingVertical": 16,
86
+ "padding": 20,
89
87
  "shadowColor": "#001f23",
90
88
  "shadowOffset": Object {
91
89
  "height": 2,
@@ -101,40 +99,57 @@ exports[`FAB when animated is true renders animatedFABIcon 1`] = `
101
99
  }
102
100
  >
103
101
  <View
104
- collapsable={false}
105
102
  style={
106
- Object {
107
- "transform": Array [
103
+ Array [
104
+ Object {},
105
+ Array [
108
106
  Object {
109
- "rotate": "0deg",
107
+ "alignItems": "center",
108
+ "height": 24,
109
+ "justifyContent": "center",
110
+ "width": 24,
110
111
  },
112
+ undefined,
111
113
  ],
112
- }
114
+ ]
113
115
  }
114
116
  >
115
- <HeroIcon
116
- name="add"
117
+ <View
118
+ collapsable={false}
117
119
  style={
118
- Array [
119
- Object {
120
- "color": "#001f23",
121
- "fontSize": 24,
122
- },
123
- Array [
120
+ Object {
121
+ "transform": Array [
124
122
  Object {
125
- "color": "#ffffff",
126
- "lineHeight": 24,
127
- "textAlign": "center",
128
- "textAlignVertical": "center",
123
+ "rotate": "0deg",
129
124
  },
130
- Object {},
131
125
  ],
132
- ]
126
+ }
133
127
  }
134
- testID="animated-fab-icon"
135
- themeIntent="text"
136
- themeSize="medium"
137
- />
128
+ >
129
+ <HeroIcon
130
+ name="add"
131
+ style={
132
+ Array [
133
+ Object {
134
+ "color": "#001f23",
135
+ "fontSize": 16,
136
+ },
137
+ Array [
138
+ Object {
139
+ "color": "#ffffff",
140
+ "lineHeight": 24,
141
+ "textAlign": "center",
142
+ "textAlignVertical": "center",
143
+ },
144
+ Object {},
145
+ ],
146
+ ]
147
+ }
148
+ testID="animated-fab-icon"
149
+ themeIntent="text"
150
+ themeSize="xsmall"
151
+ />
152
+ </View>
138
153
  </View>
139
154
  </View>
140
155
  `;
@@ -160,8 +175,7 @@ exports[`FAB when title has value renders correctly 1`] = `
160
175
  "elevation": 2,
161
176
  "flexDirection": "row",
162
177
  "justifyContent": "center",
163
- "paddingHorizontal": 16,
164
- "paddingVertical": 16,
178
+ "padding": 20,
165
179
  "shadowColor": "#001f23",
166
180
  "shadowOffset": Object {
167
181
  "height": 2,
@@ -176,29 +190,46 @@ exports[`FAB when title has value renders correctly 1`] = `
176
190
  ]
177
191
  }
178
192
  >
179
- <HeroIcon
180
- name="pencil"
193
+ <View
181
194
  style={
182
195
  Array [
183
- Object {
184
- "color": "#001f23",
185
- "fontSize": 16,
186
- },
196
+ Object {},
187
197
  Array [
188
198
  Object {
189
- "color": "#ffffff",
190
- "lineHeight": 24,
191
- "textAlign": "center",
192
- "textAlignVertical": "center",
199
+ "alignItems": "center",
200
+ "height": 24,
201
+ "justifyContent": "center",
202
+ "width": 24,
193
203
  },
194
204
  undefined,
195
205
  ],
196
206
  ]
197
207
  }
198
- testID="styled-fab-icon"
199
- themeIntent="text"
200
- themeSize="xsmall"
201
- />
208
+ >
209
+ <HeroIcon
210
+ name="pencil"
211
+ style={
212
+ Array [
213
+ Object {
214
+ "color": "#001f23",
215
+ "fontSize": 16,
216
+ },
217
+ Array [
218
+ Object {
219
+ "color": "#ffffff",
220
+ "lineHeight": 24,
221
+ "textAlign": "center",
222
+ "textAlignVertical": "center",
223
+ },
224
+ undefined,
225
+ ],
226
+ ]
227
+ }
228
+ testID="styled-fab-icon"
229
+ themeIntent="text"
230
+ themeSize="xsmall"
231
+ />
232
+ </View>
202
233
  <Text
203
234
  allowFontScaling={false}
204
235
  style={
@@ -1 +1 @@
1
- {"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark":59013,"box-check":59014,"box":59015,"bpay":59016,"buildings":59017,"cake":59018,"calendar-clock":59019,"calendar":59020,"candy-box-menu":59021,"caret-down-small":59022,"caret-down":59023,"caret-left-small":59024,"caret-left":59025,"caret-right-small":59026,"caret-right":59027,"caret-up-small":59028,"caret-up":59029,"check-radio":59030,"circle-add":59031,"circle-cancel":59032,"circle-check":59033,"circle-down":59034,"circle-info":59035,"circle-left":59036,"circle-ok":59037,"circle-pencil":59038,"circle-question":59039,"circle-remove":59040,"circle-right":59041,"circle-up":59042,"circle-warning":59043,"clock-3":59044,"clock":59045,"cloud-download":59046,"cloud-upload":59047,"cog":59048,"coin":59049,"contacts":59050,"credit-card":59051,"diamond":59052,"direction-arrows":59053,"directory":59054,"document":59055,"dollar-coin-shine":59056,"double-buildings":59057,"edit-template":59058,"envelope":59059,"exclude":59060,"expense":59061,"eye-circle":59062,"eye-invisible":59063,"eye":59064,"face-meh":59065,"face-sad":59066,"face-smiley":59067,"feed":59068,"feedbacks":59069,"file-certified":59070,"file-clone":59071,"file-copy":59072,"file-csv":59073,"file-dispose":59074,"file-doc":59075,"file-excel":59076,"file-export":59077,"file-lock":59078,"file-pdf":59079,"file-powerpoint":59080,"file-search":59081,"file-secured":59082,"file-sheets":59083,"file-slide":59084,"file-verified":59085,"file-word":59086,"file":59087,"filter":59088,"folder-user":59089,"folder":59090,"format-bold":59091,"format-heading1":59092,"format-heading2":59093,"format-italic":59094,"format-list-bulleted":59095,"format-list-numbered":59096,"format-underlined":59097,"funnel-filter":59098,"global-dollar":59099,"globe":59100,"graduation-cap":59101,"graph":59102,"happy-sun":59103,"health-bag":59104,"heart":59105,"home":59106,"image":59107,"import":59108,"incident-siren":59109,"instapay":59110,"list":59111,"loading-2":59112,"loading":59113,"location":59114,"lock":59115,"looks-one":59116,"looks-two":59117,"media-content":59118,"menu":59119,"money-notes":59120,"moneybag":59121,"moon":59122,"multiple-stars":59123,"multiple-users":59124,"node":59125,"open-folder":59126,"paperclip":59127,"payment-summary":59128,"pencil":59129,"phone":59130,"piggy-bank":59131,"plane-up":59132,"plane":59133,"play-circle":59134,"print":59135,"raising-hands":59136,"reply-arrow":59137,"reply":59138,"reschedule":59139,"rostering":59140,"save":59141,"schedule-send":59142,"schedule":59143,"search-person":59144,"send":59145,"speaker-active":59146,"speaker":59147,"star-award":59148,"star-badge":59149,"star-circle":59150,"star-medal":59151,"star":59152,"steps-circle":59153,"stopwatch":59154,"suitcase":59155,"surfing":59156,"survey":59157,"swag-pillar-benefit":59158,"swag-pillar-career":59159,"swag-pillar-money":59160,"swag-pillar-work":59161,"swag":59162,"switch":59163,"tag":59164,"target":59165,"teams":59166,"timesheet":59167,"touch-id":59168,"trash-bin":59169,"unlock":59170,"user":59171,"video-1":59172,"video-2":59173,"wallet":59174,"warning":59175,"activate-outlined":59176,"add-credit-card-outlined":59177,"add-person-outlined":59178,"add-section-outlined":59179,"add-time-outlined":59180,"add":59181,"adjustment-outlined":59182,"alignment-2-outlined":59183,"alignment-outlined":59184,"all-caps":59185,"arrow-down":59186,"arrow-downwards":59187,"arrow-left":59188,"arrow-leftwards":59189,"arrow-right":59190,"arrow-rightwards":59191,"arrow-up":59192,"arrow-upwards":59193,"article-outlined":59194,"at-sign":59195,"auto-graph-outlined":59196,"beer-outlined":59197,"bell-active-outlined":59198,"bell-outlined":59199,"bell-slash-outlined":59200,"billing-outlined":59201,"body-outlined":59202,"bold":59203,"book-outlined":59204,"bookmark-added-outlined":59205,"bookmark-outlined":59206,"box-check-outlined":59207,"box-outlined":59208,"bullet-points":59209,"cake-outlined":59210,"calendar-dates-outlined":59211,"calendar-star-outlined":59212,"call-split-outlined":59213,"camera-outlined":59214,"cancel":59215,"car-forward-outlined":59216,"charging-station-outlined":59217,"chat-bubble-outlined":59218,"chat-unread-outlined":59219,"checkmark":59220,"circle-add-outlined":59221,"circle-cancel-outlined":59222,"circle-down-outlined":59223,"circle-info-outlined":59224,"circle-left-outlined":59225,"circle-ok-outlined":59226,"circle-question-outlined":59227,"circle-remove-outlined":59228,"circle-right-outlined":59229,"circle-up-outlined":59230,"circle-warning-outlined":59231,"clock-2-outlined":59232,"clock-outlined":59233,"cog-outlined":59234,"coin-outlined":59235,"coin-super-outlined":59236,"comment-outlined":59237,"contacts-outlined":59238,"contacts-user-outlined":59239,"credit-card-outlined":59240,"cup-outlined":59241,"dentistry-outlined":59242,"direction-arrows-outlined":59243,"directory-outlined":59244,"document-outlined":59245,"dollar-box-outlined":59246,"dollar-card-outlined":59247,"dollar-coin-shine-outlined":59248,"dollar-credit-card-outlined":59249,"dollar-sign":59250,"double-buildings-outlined":59251,"double-left-arrows":59252,"double-right-arrows":59253,"download-outlined":59254,"edit-template-outlined":59255,"email-outlined":59256,"enter-arrow":59257,"envelope-outlined":59258,"expense-outlined":59259,"explore-outlined":59260,"external-link":59261,"eye-invisible-outlined":59262,"eye-outlined":59263,"face-id":59264,"face-meh-outlined":59265,"face-open-smiley-outlined":59266,"face-sad-outlined":59267,"face-smiley-outlined":59268,"fastfood-outlined":59269,"feed-outlined":59270,"file-certified-outlined":59271,"file-clone-outlined":59272,"file-copy-outlined":59273,"file-dispose-outlined":59274,"file-dollar-certified-outlined":59275,"file-dollar-outlined":59276,"file-download-outlined":59277,"file-export-outlined":59278,"file-lock-outlined":59279,"file-outlined":59280,"file-search-outlined":59281,"file-secured-outlined":59282,"file-statutory-outlined":59283,"file-verified-outlined":59284,"filter-outlined":59285,"folder-outlined":59286,"folder-user-outlined":59287,"form-outlined":59288,"funnel-filter-outline":59289,"graph-outlined":59290,"hand-holding-user-outlined":59291,"happy-sun-outlined":59292,"health-bag-outlined":59293,"heart-outlined":59294,"home-active-outlined":59295,"home-outlined":59296,"id-card-outlined":59297,"image-outlined":59298,"import-outlined":59299,"instapay-outlined":59300,"italic":59301,"link-1":59302,"link-2":59303,"list-outlined":59304,"live-help-outlined":59305,"location-on-outlined":59306,"location-outlined":59307,"lock-outlined":59308,"locked-file-outlined":59309,"log-out":59310,"media-content-outlined":59311,"menu-close":59312,"menu-expand":59313,"menu-fold-outlined":59314,"menu-unfold-outlined":59315,"moneybag-outlined":59316,"moon-outlined":59317,"more-horizontal":59318,"more-vertical":59319,"multiple-folders-outlined":59320,"multiple-users-outlined":59321,"near-me-outlined":59322,"node-outlined":59323,"number-points":59324,"number":59325,"overview-outlined":59326,"payment-summary-outlined":59327,"payslip-outlined":59328,"pencil-outlined":59329,"percentage":59330,"phone-outlined":59331,"piggy-bank-outlined":59332,"plane-outlined":59333,"play-circle-outlined":59334,"print-outlined":59335,"qr-code-outlined":59336,"qualification-outlined":59337,"re-assign":59338,"redeem":59339,"refresh":59340,"remove":59341,"reply-outlined":59342,"restart":59343,"return-arrow":59344,"rostering-outlined":59345,"save-outlined":59346,"schedule-outlined":59347,"search-outlined":59348,"search-secured-outlined":59349,"send-outlined":59350,"share-1":59351,"share-2":59352,"share-outlined":59353,"show-chart-outlined":59354,"single-down-arrow":59355,"single-left-arrow":59356,"single-right-arrow":59357,"single-up-arrow":59358,"speaker-active-outlined":59359,"speaker-outlined":59360,"star-circle-outlined":59361,"star-outlined":59362,"stopwatch-outlined":59363,"strikethrough":59364,"styler-outlined":59365,"suitcase-clock-outlined":59366,"suitcase-outlined":59367,"survey-outlined":59368,"switch-outlined":59369,"sync":59370,"tag-outlined":59371,"target-outlined":59372,"tennis-outlined":59373,"ticket-outlined":59374,"timesheet-outlined":59375,"today-outlined":59376,"transfer":59377,"trash-bin-outlined":59378,"umbrela-outlined":59379,"unavailable":59380,"underline":59381,"union-outlined":59382,"unlock-outlined":59383,"upload-outlined":59384,"user-circle-outlined":59385,"user-gear-outlined":59386,"user-outlined":59387,"user-rectangle-outlined":59388,"video-1-outlined":59389,"video-2-outlined":59390,"volunteer-outlined":59391,"wallet-outlined":59392}
1
+ {"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark":59013,"box-check":59014,"box":59015,"bpay":59016,"buildings":59017,"cake":59018,"calendar-clock":59019,"calendar":59020,"candy-box-menu":59021,"caret-down-small":59022,"caret-down":59023,"caret-left-small":59024,"caret-left":59025,"caret-right-small":59026,"caret-right":59027,"caret-up-small":59028,"caret-up":59029,"check-radio":59030,"circle-add":59031,"circle-cancel":59032,"circle-check":59033,"circle-down":59034,"circle-info":59035,"circle-left":59036,"circle-ok":59037,"circle-pencil":59038,"circle-question":59039,"circle-remove":59040,"circle-right":59041,"circle-up":59042,"circle-warning":59043,"clock-3":59044,"clock":59045,"cloud-download":59046,"cloud-upload":59047,"cog":59048,"coin":59049,"contacts":59050,"credit-card":59051,"diamond":59052,"direction-arrows":59053,"directory":59054,"document":59055,"dollar-coin-shine":59056,"double-buildings":59057,"edit-template":59058,"envelope":59059,"exclude":59060,"expense":59061,"eye-circle":59062,"eye-invisible":59063,"eye":59064,"face-meh":59065,"face-sad":59066,"face-smiley":59067,"feed":59068,"feedbacks":59069,"file-certified":59070,"file-clone":59071,"file-copy":59072,"file-csv":59073,"file-dispose":59074,"file-doc":59075,"file-excel":59076,"file-export":59077,"file-lock":59078,"file-pdf":59079,"file-powerpoint":59080,"file-search":59081,"file-secured":59082,"file-sheets":59083,"file-slide":59084,"file-verified":59085,"file-word":59086,"file":59087,"filter":59088,"folder-user":59089,"folder":59090,"format-bold":59091,"format-heading1":59092,"format-heading2":59093,"format-italic":59094,"format-list-bulleted":59095,"format-list-numbered":59096,"format-underlined":59097,"funnel-filter":59098,"global-dollar":59099,"globe":59100,"graduation-cap":59101,"graph":59102,"happy-sun":59103,"health-bag":59104,"heart":59105,"home":59106,"image":59107,"import":59108,"incident-siren":59109,"instapay":59110,"list":59111,"loading-2":59112,"loading":59113,"location":59114,"lock":59115,"looks-one":59116,"looks-two":59117,"media-content":59118,"menu":59119,"money-notes":59120,"moneybag":59121,"moon":59122,"multiple-stars":59123,"multiple-users":59124,"node":59125,"open-folder":59126,"paperclip":59127,"payment-summary":59128,"pencil":59129,"phone":59130,"piggy-bank":59131,"plane-up":59132,"plane":59133,"play-circle":59134,"print":59135,"raising-hands":59136,"reply-arrow":59137,"reply":59138,"reschedule":59139,"rostering":59140,"save":59141,"schedule-send":59142,"schedule":59143,"search-person":59144,"send":59145,"speaker-active":59146,"speaker":59147,"star-award":59148,"star-badge":59149,"star-circle":59150,"star-medal":59151,"star":59152,"steps-circle":59153,"stopwatch":59154,"suitcase":59155,"surfing":59156,"survey":59157,"swag-pillar-benefit":59158,"swag-pillar-career":59159,"swag-pillar-money":59160,"swag-pillar-work":59161,"swag":59162,"switch":59163,"tag":59164,"target":59165,"teams":59166,"timesheet":59167,"touch-id":59168,"trash-bin":59169,"unlock":59170,"user":59171,"video-1":59172,"video-2":59173,"wallet":59174,"warning":59175,"activate-outlined":59176,"add-credit-card-outlined":59177,"add-person-outlined":59178,"add-section-outlined":59179,"add-time-outlined":59180,"add":59181,"adjustment-outlined":59182,"alignment-2-outlined":59183,"alignment-outlined":59184,"all-caps":59185,"arrow-down":59186,"arrow-downwards":59187,"arrow-left":59188,"arrow-leftwards":59189,"arrow-right":59190,"arrow-rightwards":59191,"arrow-up":59192,"arrow-upwards":59193,"article-outlined":59194,"at-sign":59195,"auto-graph-outlined":59196,"beer-outlined":59197,"bell-active-outlined":59198,"bell-outlined":59199,"bell-slash-outlined":59200,"billing-outlined":59201,"body-outlined":59202,"bold":59203,"book-outlined":59204,"bookmark-added-outlined":59205,"bookmark-outlined":59206,"box-check-outlined":59207,"box-outlined":59208,"bullet-points":59209,"cake-outlined":59210,"calendar-dates-outlined":59211,"calendar-star-outlined":59212,"call-split-outlined":59213,"camera-outlined":59214,"cancel":59215,"car-forward-outlined":59216,"charging-station-outlined":59217,"chat-bubble-outlined":59218,"chat-unread-outlined":59219,"checkmark":59220,"circle-add-outlined":59221,"circle-cancel-outlined":59222,"circle-down-outlined":59223,"circle-info-outlined":59224,"circle-left-outlined":59225,"circle-ok-outlined":59226,"circle-question-outlined":59227,"circle-remove-outlined":59228,"circle-right-outlined":59229,"circle-up-outlined":59230,"circle-warning-outlined":59231,"clock-2-outlined":59232,"clock-outlined":59233,"cog-outlined":59234,"coin-outlined":59235,"coin-super-outlined":59236,"comment-outlined":59237,"contacts-outlined":59238,"contacts-user-outlined":59239,"credit-card-outlined":59240,"cup-outlined":59241,"dentistry-outlined":59242,"direction-arrows-outlined":59243,"directory-outlined":59244,"document-outlined":59245,"dollar-box-outlined":59246,"dollar-card-outlined":59247,"dollar-coin-shine-outlined":59248,"dollar-credit-card-outlined":59249,"dollar-sign":59250,"double-buildings-outlined":59251,"double-left-arrows":59252,"double-right-arrows":59253,"download-box-outlined":59254,"download-outlined":59255,"edit-template-outlined":59256,"email-outlined":59257,"enter-arrow":59258,"envelope-outlined":59259,"expense-outlined":59260,"explore-outlined":59261,"external-link":59262,"eye-invisible-outlined":59263,"eye-outlined":59264,"face-id":59265,"face-meh-outlined":59266,"face-open-smiley-outlined":59267,"face-sad-outlined":59268,"face-smiley-outlined":59269,"fastfood-outlined":59270,"feed-outlined":59271,"file-certified-outlined":59272,"file-clone-outlined":59273,"file-copy-outlined":59274,"file-dispose-outlined":59275,"file-dollar-certified-outlined":59276,"file-dollar-outlined":59277,"file-download-outlined":59278,"file-export-outlined":59279,"file-lock-outlined":59280,"file-outlined":59281,"file-search-outlined":59282,"file-secured-outlined":59283,"file-statutory-outlined":59284,"file-verified-outlined":59285,"filter-outlined":59286,"folder-outlined":59287,"folder-user-outlined":59288,"form-outlined":59289,"funnel-filter-outline":59290,"graph-outlined":59291,"hand-holding-user-outlined":59292,"happy-sun-outlined":59293,"health-bag-outlined":59294,"heart-outlined":59295,"home-active-outlined":59296,"home-outlined":59297,"id-card-outlined":59298,"image-outlined":59299,"import-outlined":59300,"instapay-outlined":59301,"italic":59302,"link-1":59303,"link-2":59304,"list-outlined":59305,"live-help-outlined":59306,"location-on-outlined":59307,"location-outlined":59308,"lock-outlined":59309,"locked-file-outlined":59310,"log-out":59311,"media-content-outlined":59312,"menu-close":59313,"menu-expand":59314,"menu-fold-outlined":59315,"menu-unfold-outlined":59316,"moneybag-outlined":59317,"moon-outlined":59318,"more-horizontal":59319,"more-vertical":59320,"multiple-folders-outlined":59321,"multiple-users-outlined":59322,"near-me-outlined":59323,"node-outlined":59324,"number-points":59325,"number":59326,"overview-outlined":59327,"payment-summary-outlined":59328,"payslip-outlined":59329,"pencil-outlined":59330,"percentage":59331,"phone-outlined":59332,"piggy-bank-outlined":59333,"plane-outlined":59334,"play-circle-outlined":59335,"print-outlined":59336,"qr-code-outlined":59337,"qualification-outlined":59338,"re-assign":59339,"redeem":59340,"refresh":59341,"remove":59342,"reply-outlined":59343,"restart":59344,"return-arrow":59345,"rostering-outlined":59346,"save-outlined":59347,"schedule-outlined":59348,"search-outlined":59349,"search-secured-outlined":59350,"send-outlined":59351,"share-1":59352,"share-2":59353,"share-outlined":59354,"show-chart-outlined":59355,"single-down-arrow":59356,"single-left-arrow":59357,"single-right-arrow":59358,"single-up-arrow":59359,"speaker-active-outlined":59360,"speaker-outlined":59361,"star-circle-outlined":59362,"star-outlined":59363,"stopwatch-outlined":59364,"strikethrough":59365,"styler-outlined":59366,"suitcase-clock-outlined":59367,"suitcase-outlined":59368,"survey-outlined":59369,"switch-outlined":59370,"sync":59371,"tag-outlined":59372,"target-outlined":59373,"tennis-outlined":59374,"ticket-outlined":59375,"timesheet-outlined":59376,"today-outlined":59377,"transfer":59378,"trash-bin-outlined":59379,"umbrela-outlined":59380,"unavailable":59381,"underline":59382,"union-outlined":59383,"unlock-outlined":59384,"upload-outlined":59385,"user-circle-outlined":59386,"user-gear-outlined":59387,"user-outlined":59388,"user-rectangle-outlined":59389,"video-1-outlined":59390,"video-2-outlined":59391,"volunteer-outlined":59392,"wallet-outlined":59393}
@@ -254,6 +254,7 @@ const IconList = [
254
254
  'double-buildings-outlined',
255
255
  'double-left-arrows',
256
256
  'double-right-arrows',
257
+ 'download-box-outlined',
257
258
  'download-outlined',
258
259
  'edit-template-outlined',
259
260
  'email-outlined',
@@ -1,11 +1,12 @@
1
- import React from 'react';
2
1
  import type { ReactElement } from 'react';
2
+ import React, { useEffect, useRef } from 'react';
3
+ import { Animated, Easing, LayoutChangeEvent, Platform } from 'react-native';
3
4
  import type { BadgeConfigType, OptionType } from '.';
4
5
  import { useTheme } from '../../../theme';
5
- import { StyledIconWrapper, StyledTextWrapper } from './StyledSelectorSwitch';
6
- import Typography from '../../Typography';
7
6
  import Badge from '../../Badge';
8
7
  import Icon from '../../Icon';
8
+ import Typography from '../../Typography';
9
+ import { StyledIconWrapper, StyledTextWrapper } from './StyledSelectorSwitch';
9
10
 
10
11
  export const OptionContent = ({
11
12
  content,
@@ -39,12 +40,34 @@ const Option = <T,>({
39
40
  icon,
40
41
  badge,
41
42
  selected,
43
+ onLayout,
44
+ index = 0,
42
45
  }: Pick<OptionType<T>, 'text' | 'icon' | 'badge'> & {
43
46
  selected: boolean;
47
+ onLayout?: (e: LayoutChangeEvent) => void;
48
+ index?: number;
44
49
  }): ReactElement => {
50
+ const animatedValue = useRef(new Animated.Value(1)).current;
51
+ const translateX = animatedValue.interpolate({
52
+ inputRange: [0, 1],
53
+ outputRange: index === 1 ? [-5, 0] : [5, 0],
54
+ });
55
+
56
+ useEffect(() => {
57
+ Animated.timing(animatedValue, {
58
+ toValue: selected ? 1 : 0,
59
+ duration: 200,
60
+ easing: Easing.linear,
61
+ useNativeDriver: Platform.OS === 'ios' || Platform.OS === 'android',
62
+ }).start();
63
+ }, [selected]);
64
+
45
65
  if (selected) {
46
66
  return (
47
- <StyledTextWrapper>
67
+ <StyledTextWrapper
68
+ style={{ transform: [{ translateX }] }}
69
+ onLayout={onLayout}
70
+ >
48
71
  <OptionContent
49
72
  content={<Typography.Text fontSize="large">{text}</Typography.Text>}
50
73
  badge={badge}
@@ -54,7 +77,10 @@ const Option = <T,>({
54
77
  }
55
78
 
56
79
  return (
57
- <StyledIconWrapper>
80
+ <StyledIconWrapper
81
+ style={{ transform: [{ translateX }] }}
82
+ onLayout={onLayout}
83
+ >
58
84
  <OptionContent content={<Icon icon={icon} />} badge={badge} />
59
85
  </StyledIconWrapper>
60
86
  );
@@ -1,5 +1,7 @@
1
1
  import styled from '@emotion/native';
2
- import { View } from 'react-native';
2
+ import { View, Animated } from 'react-native';
3
+
4
+ const AnimatedView = Animated.createAnimatedComponent(View);
3
5
 
4
6
  export const StyledWrapper = styled(View)(({ theme }) => ({
5
7
  flexDirection: 'row',
@@ -8,18 +10,30 @@ export const StyledWrapper = styled(View)(({ theme }) => ({
8
10
  borderRadius: theme.__hd__.switch.radii.selector.default,
9
11
  backgroundColor: theme.__hd__.switch.colors.selector.background,
10
12
  padding: theme.__hd__.switch.spaces.selector.wrapperPadding,
13
+ position: 'relative',
11
14
  }));
12
15
 
13
- export const StyledTextWrapper = styled(View)(({ theme }) => ({
16
+ export const StyledTextWrapper = styled(AnimatedView)(({ theme }) => ({
14
17
  flex: 1,
15
18
  borderRadius: theme.__hd__.switch.radii.selector.default,
16
- backgroundColor: theme.__hd__.switch.colors.selector.textBackground,
17
19
  justifyContent: 'center',
18
20
  alignItems: 'center',
21
+ zIndex: 1,
19
22
  }));
20
23
 
21
- export const StyledIconWrapper = styled(View)(({ theme }) => ({
24
+ export const StyledIconWrapper = styled(AnimatedView)(({ theme }) => ({
22
25
  paddingHorizontal: theme.__hd__.switch.spaces.selector.iconPadding,
23
26
  justifyContent: 'center',
24
27
  alignItems: 'center',
28
+ zIndex: 1,
29
+ }));
30
+
31
+ export const StyledKnot = styled(AnimatedView)(({ theme }) => ({
32
+ borderRadius: theme.__hd__.switch.radii.selector.default,
33
+ backgroundColor: theme.__hd__.switch.colors.selector.textBackground,
34
+ position: 'absolute',
35
+ top: theme.__hd__.switch.spaces.selector.wrapperPadding,
36
+ bottom: theme.__hd__.switch.spaces.selector.wrapperPadding,
37
+ left: theme.__hd__.switch.spaces.selector.wrapperPadding,
38
+ right: theme.__hd__.switch.spaces.selector.wrapperPadding,
25
39
  }));
@@ -2,15 +2,19 @@
2
2
 
3
3
  exports[`Option renders correctly when not selected 1`] = `
4
4
  <View
5
+ collapsable={false}
5
6
  style={
6
- Array [
7
- Object {
8
- "alignItems": "center",
9
- "justifyContent": "center",
10
- "paddingHorizontal": 16,
11
- },
12
- undefined,
13
- ]
7
+ Object {
8
+ "alignItems": "center",
9
+ "justifyContent": "center",
10
+ "paddingHorizontal": 16,
11
+ "transform": Array [
12
+ Object {
13
+ "translateX": 0,
14
+ },
15
+ ],
16
+ "zIndex": 1,
17
+ }
14
18
  }
15
19
  >
16
20
  <View
@@ -62,17 +66,20 @@ exports[`Option renders correctly when not selected 1`] = `
62
66
 
63
67
  exports[`Option renders correctly when selected 1`] = `
64
68
  <View
69
+ collapsable={false}
65
70
  style={
66
- Array [
67
- Object {
68
- "alignItems": "center",
69
- "backgroundColor": "#ffffff",
70
- "borderRadius": 999,
71
- "flex": 1,
72
- "justifyContent": "center",
73
- },
74
- undefined,
75
- ]
71
+ Object {
72
+ "alignItems": "center",
73
+ "borderRadius": 999,
74
+ "flex": 1,
75
+ "justifyContent": "center",
76
+ "transform": Array [
77
+ Object {
78
+ "translateX": 0,
79
+ },
80
+ ],
81
+ "zIndex": 1,
82
+ }
76
83
  }
77
84
  >
78
85
  <View