react-native-system-ui 1.0.0 → 1.0.2

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 (210) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/components/action-sheet/ActionSheet.js +51 -53
  3. package/dist/cjs/components/area/Area.js +22 -22
  4. package/dist/cjs/components/avatar/Avatar.js +23 -23
  5. package/dist/cjs/components/badge/Badge.js +56 -61
  6. package/dist/cjs/components/button/Button.js +87 -92
  7. package/dist/cjs/components/button/ButtonGroup.js +4 -4
  8. package/dist/cjs/components/calendar/Calendar.js +28 -28
  9. package/dist/cjs/components/cascader/Cascader.js +206 -212
  10. package/dist/cjs/components/cell/Cell.js +54 -51
  11. package/dist/cjs/components/cell/CellGroup.js +26 -25
  12. package/dist/cjs/components/checkbox/Checkbox.js +1 -0
  13. package/dist/cjs/components/checkbox/CheckboxGroup.js +20 -19
  14. package/dist/cjs/components/circle/Circle.js +66 -54
  15. package/dist/cjs/components/collapse/Collapse.js +18 -18
  16. package/dist/cjs/components/config-provider/ConfigProvider.js +5 -5
  17. package/dist/cjs/components/count-down/CountDown.js +17 -17
  18. package/dist/cjs/components/datetime-picker/DatetimePicker.js +34 -35
  19. package/dist/cjs/components/dialog/Dialog.js +16 -10
  20. package/dist/cjs/components/dialog/imperative.js +8 -14
  21. package/dist/cjs/components/dialog/tokens.js +1 -0
  22. package/dist/cjs/components/divider/Divider.js +48 -51
  23. package/dist/cjs/components/empty/Empty.js +30 -25
  24. package/dist/cjs/components/error-boundary/ErrorBoundary.js +3 -2
  25. package/dist/cjs/components/flex/Flex.js +27 -27
  26. package/dist/cjs/components/flex/FlexItem.js +1 -0
  27. package/dist/cjs/components/form/Form.js +94 -93
  28. package/dist/cjs/components/form/FormItem.js +60 -54
  29. package/dist/cjs/components/form/FormList.js +35 -35
  30. package/dist/cjs/components/grid/Grid.js +48 -48
  31. package/dist/cjs/components/grid/GridItem.js +9 -2
  32. package/dist/cjs/components/image/Image.js +25 -24
  33. package/dist/cjs/components/image/tokens.js +3 -1
  34. package/dist/cjs/components/image-preview/ImagePreview.js +38 -28
  35. package/dist/cjs/components/image-preview/tokens.js +3 -1
  36. package/dist/cjs/components/input/Input.js +16 -19
  37. package/dist/cjs/components/loading/Loading.js +27 -27
  38. package/dist/cjs/components/nav-bar/NavBar.js +21 -18
  39. package/dist/cjs/components/nav-bar/tokens.js +3 -1
  40. package/dist/cjs/components/notice-bar/NoticeBar.js +7 -3
  41. package/dist/cjs/components/notice-bar/tokens.js +3 -1
  42. package/dist/cjs/components/notify/Notify.js +2 -1
  43. package/dist/cjs/components/notify/imperative.js +17 -17
  44. package/dist/cjs/components/notify/tokens.js +1 -0
  45. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +217 -201
  46. package/dist/cjs/components/number-keyboard/tokens.js +7 -1
  47. package/dist/cjs/components/overlay/Overlay.js +15 -15
  48. package/dist/cjs/components/password-input/PasswordInput.js +49 -49
  49. package/dist/cjs/components/picker/Picker.js +50 -58
  50. package/dist/cjs/components/popup/Popup.js +10 -10
  51. package/dist/cjs/components/popup/tokens.js +1 -0
  52. package/dist/cjs/components/portal/Portal.js +3 -4
  53. package/dist/cjs/components/progress/Progress.js +94 -95
  54. package/dist/cjs/components/progress/tokens.js +1 -0
  55. package/dist/cjs/components/radio/Radio.js +67 -63
  56. package/dist/cjs/components/radio/RadioGroup.js +6 -6
  57. package/dist/cjs/components/safe-area-view/SafeAreaView.js +7 -7
  58. package/dist/cjs/components/search/Search.js +28 -28
  59. package/dist/cjs/components/selector/Selector.js +19 -26
  60. package/dist/cjs/components/share-sheet/ShareSheet.js +8 -2
  61. package/dist/cjs/components/share-sheet/tokens.js +3 -1
  62. package/dist/cjs/components/sidebar/Sidebar.js +22 -16
  63. package/dist/cjs/components/sidebar/SidebarItem.js +9 -8
  64. package/dist/cjs/components/sidebar/tokens.js +3 -1
  65. package/dist/cjs/components/skeleton/Skeleton.js +43 -42
  66. package/dist/cjs/components/slider/Slider.js +1 -1
  67. package/dist/cjs/components/space/Space.js +45 -41
  68. package/dist/cjs/components/space/tokens.js +7 -1
  69. package/dist/cjs/components/stepper/Stepper.js +17 -15
  70. package/dist/cjs/components/stepper/tokens.js +1 -0
  71. package/dist/cjs/components/swiper/Swiper.js +10 -7
  72. package/dist/cjs/components/swiper/SwiperPagIndicator.js +3 -2
  73. package/dist/cjs/components/switch/Switch.js +23 -23
  74. package/dist/cjs/components/tabbar/Tabbar.js +26 -26
  75. package/dist/cjs/components/tabbar/TabbarItem.js +6 -0
  76. package/dist/cjs/components/tabs/Tabs.js +143 -153
  77. package/dist/cjs/components/tabs/tokens.js +3 -1
  78. package/dist/cjs/components/tag/Tag.js +38 -38
  79. package/dist/cjs/components/toast/Toast.js +7 -3
  80. package/dist/cjs/components/toast/tokens.js +1 -0
  81. package/dist/cjs/components/typography/Typography.js +23 -21
  82. package/dist/cjs/components/water-mark/WaterMark.js +65 -65
  83. package/dist/cjs/design-system/Text.js +38 -0
  84. package/dist/cjs/design-system/createComponentTokensHook.js +2 -2
  85. package/dist/cjs/design-system/index.js +7 -0
  86. package/dist/cjs/design-system/mergeTokensOverride.js +1 -4
  87. package/dist/cjs/hooks/useControllableValue.js +11 -11
  88. package/dist/cjs/hooks/useCountDown.js +18 -18
  89. package/dist/cjs/platform/measure.js +4 -2
  90. package/dist/cjs/utils/color.js +2 -7
  91. package/dist/cjs/utils/compare.js +3 -3
  92. package/dist/cjs/utils/date.js +2 -2
  93. package/dist/cjs/utils/deepMerge.js +5 -5
  94. package/dist/cjs/utils/hairline.js +1 -0
  95. package/dist/cjs/utils/render.js +2 -8
  96. package/dist/cjs/utils/validate.js +2 -4
  97. package/dist/es/components/action-sheet/ActionSheet.js +51 -53
  98. package/dist/es/components/area/Area.js +22 -22
  99. package/dist/es/components/avatar/Avatar.js +23 -23
  100. package/dist/es/components/badge/Badge.js +56 -61
  101. package/dist/es/components/button/Button.js +87 -92
  102. package/dist/es/components/button/ButtonGroup.js +4 -4
  103. package/dist/es/components/calendar/Calendar.js +28 -28
  104. package/dist/es/components/cascader/Cascader.js +206 -212
  105. package/dist/es/components/cell/Cell.js +55 -52
  106. package/dist/es/components/cell/CellGroup.js +26 -25
  107. package/dist/es/components/checkbox/Checkbox.js +1 -0
  108. package/dist/es/components/checkbox/CheckboxGroup.js +20 -19
  109. package/dist/es/components/circle/Circle.js +66 -54
  110. package/dist/es/components/collapse/Collapse.js +18 -18
  111. package/dist/es/components/config-provider/ConfigProvider.js +5 -5
  112. package/dist/es/components/count-down/CountDown.js +17 -17
  113. package/dist/es/components/datetime-picker/DatetimePicker.js +34 -35
  114. package/dist/es/components/dialog/Dialog.js +16 -10
  115. package/dist/es/components/dialog/imperative.js +8 -14
  116. package/dist/es/components/dialog/tokens.js +1 -0
  117. package/dist/es/components/divider/Divider.js +48 -51
  118. package/dist/es/components/empty/Empty.js +30 -25
  119. package/dist/es/components/error-boundary/ErrorBoundary.js +3 -2
  120. package/dist/es/components/flex/Flex.js +27 -27
  121. package/dist/es/components/flex/FlexItem.js +1 -0
  122. package/dist/es/components/form/Form.js +95 -94
  123. package/dist/es/components/form/FormItem.js +60 -54
  124. package/dist/es/components/form/FormList.js +35 -35
  125. package/dist/es/components/grid/Grid.js +48 -48
  126. package/dist/es/components/grid/GridItem.js +10 -3
  127. package/dist/es/components/image/Image.js +25 -24
  128. package/dist/es/components/image/tokens.js +3 -1
  129. package/dist/es/components/image-preview/ImagePreview.js +39 -29
  130. package/dist/es/components/image-preview/tokens.js +3 -1
  131. package/dist/es/components/input/Input.js +16 -19
  132. package/dist/es/components/loading/Loading.js +27 -27
  133. package/dist/es/components/nav-bar/NavBar.js +21 -18
  134. package/dist/es/components/nav-bar/tokens.js +3 -1
  135. package/dist/es/components/notice-bar/NoticeBar.js +7 -3
  136. package/dist/es/components/notice-bar/tokens.js +3 -1
  137. package/dist/es/components/notify/Notify.js +2 -1
  138. package/dist/es/components/notify/imperative.js +17 -17
  139. package/dist/es/components/notify/tokens.js +1 -0
  140. package/dist/es/components/number-keyboard/NumberKeyboard.js +217 -201
  141. package/dist/es/components/number-keyboard/tokens.js +7 -1
  142. package/dist/es/components/overlay/Overlay.js +15 -15
  143. package/dist/es/components/password-input/PasswordInput.js +49 -49
  144. package/dist/es/components/picker/Picker.js +50 -58
  145. package/dist/es/components/popup/Popup.js +10 -10
  146. package/dist/es/components/popup/tokens.js +1 -0
  147. package/dist/es/components/portal/Portal.js +3 -4
  148. package/dist/es/components/progress/Progress.js +94 -95
  149. package/dist/es/components/progress/tokens.js +1 -0
  150. package/dist/es/components/radio/Radio.js +67 -63
  151. package/dist/es/components/radio/RadioGroup.js +6 -6
  152. package/dist/es/components/safe-area-view/SafeAreaView.js +7 -7
  153. package/dist/es/components/search/Search.js +28 -28
  154. package/dist/es/components/selector/Selector.js +19 -26
  155. package/dist/es/components/share-sheet/ShareSheet.js +8 -2
  156. package/dist/es/components/share-sheet/tokens.js +3 -1
  157. package/dist/es/components/sidebar/Sidebar.js +22 -16
  158. package/dist/es/components/sidebar/SidebarItem.js +9 -8
  159. package/dist/es/components/sidebar/tokens.js +3 -1
  160. package/dist/es/components/skeleton/Skeleton.js +43 -42
  161. package/dist/es/components/slider/Slider.js +3 -3
  162. package/dist/es/components/space/Space.js +45 -41
  163. package/dist/es/components/space/tokens.js +7 -1
  164. package/dist/es/components/stepper/Stepper.js +17 -15
  165. package/dist/es/components/stepper/tokens.js +1 -0
  166. package/dist/es/components/swiper/Swiper.js +11 -8
  167. package/dist/es/components/swiper/SwiperPagIndicator.js +3 -2
  168. package/dist/es/components/switch/Switch.js +23 -23
  169. package/dist/es/components/tabbar/Tabbar.js +26 -26
  170. package/dist/es/components/tabbar/TabbarItem.js +6 -0
  171. package/dist/es/components/tabs/Tabs.js +144 -154
  172. package/dist/es/components/tabs/tokens.js +3 -1
  173. package/dist/es/components/tag/Tag.js +38 -38
  174. package/dist/es/components/toast/Toast.js +7 -3
  175. package/dist/es/components/toast/tokens.js +1 -0
  176. package/dist/es/components/typography/Typography.js +23 -21
  177. package/dist/es/components/water-mark/WaterMark.js +65 -65
  178. package/dist/es/design-system/Text.js +19 -0
  179. package/dist/es/design-system/createComponentTokensHook.js +2 -2
  180. package/dist/es/design-system/index.js +1 -0
  181. package/dist/es/design-system/mergeTokensOverride.js +1 -4
  182. package/dist/es/hooks/useControllableValue.js +11 -11
  183. package/dist/es/hooks/useCountDown.js +18 -18
  184. package/dist/es/platform/measure.js +4 -2
  185. package/dist/es/utils/color.js +1 -4
  186. package/dist/es/utils/compare.js +3 -3
  187. package/dist/es/utils/date.js +2 -2
  188. package/dist/es/utils/deepMerge.js +5 -5
  189. package/dist/es/utils/hairline.js +1 -0
  190. package/dist/es/utils/render.js +1 -1
  191. package/dist/es/utils/validate.js +1 -2
  192. package/dist/types/components/dialog/tokens.d.ts +1 -0
  193. package/dist/types/components/image-preview/tokens.d.ts +1 -0
  194. package/dist/types/components/nav-bar/tokens.d.ts +1 -1
  195. package/dist/types/components/notice-bar/tokens.d.ts +1 -0
  196. package/dist/types/components/number-keyboard/tokens.d.ts +5 -0
  197. package/dist/types/components/picker/Picker.d.ts +1 -1
  198. package/dist/types/components/popup/tokens.d.ts +1 -0
  199. package/dist/types/components/share-sheet/tokens.d.ts +1 -0
  200. package/dist/types/components/stepper/tokens.d.ts +1 -0
  201. package/dist/types/components/tabs/tokens.d.ts +1 -0
  202. package/dist/types/components/toast/tokens.d.ts +1 -0
  203. package/dist/types/design-system/Text.d.ts +3 -0
  204. package/dist/types/design-system/index.d.ts +1 -0
  205. package/dist/types/hooks/useCountDown.d.ts +1 -1
  206. package/dist/types/utils/color.d.ts +0 -2
  207. package/dist/types/utils/date.d.ts +1 -1
  208. package/dist/types/utils/render.d.ts +1 -1
  209. package/dist/types/utils/validate.d.ts +0 -1
  210. package/package.json +17 -3
@@ -15,7 +15,7 @@ const SearchComponent = (props, ref) => {
15
15
  action,
16
16
  actionText,
17
17
  showAction = false,
18
- shape: shapeProp,
18
+ shape: shapeP,
19
19
  background,
20
20
  style: containerStyle,
21
21
  fieldStyle,
@@ -36,12 +36,12 @@ const SearchComponent = (props, ref) => {
36
36
  ...restFieldProps
37
37
  } = props;
38
38
  const tokens = useSearchTokens(tokensOverride);
39
- const shape = shapeProp ?? tokens.defaults.shape;
39
+ const shape = shapeP ?? tokens.defaults.shape;
40
40
  const [value, triggerChange] = useControllableValue(props, {
41
41
  defaultValue: ''
42
42
  });
43
43
  const inputValue = value ?? '';
44
- const resolvedInputAlign = align ?? inputAlign;
44
+ const rInputAlign = align ?? inputAlign;
45
45
  const onChangeTextRef = useRef(onChangeText),
46
46
  onCancelRef = useRef(onCancel),
47
47
  onSearchRef = useRef(onSearch),
@@ -64,17 +64,17 @@ const SearchComponent = (props, ref) => {
64
64
  onSearchRef.current?.(inputValueRef.current);
65
65
  onSubmitEditingRef.current?.(event);
66
66
  }, []);
67
- const resolvedBackground = background ?? tokens.colors.background;
68
- const resolvedLeftIcon = leftIcon ?? /*#__PURE__*/React.createElement(SearchIcon, {
67
+ const rBg = background ?? tokens.colors.background;
68
+ const rLeftIcon = leftIcon ?? /*#__PURE__*/React.createElement(SearchIcon, {
69
69
  size: tokens.icon.size,
70
70
  fill: tokens.colors.icon,
71
71
  color: tokens.colors.icon
72
72
  });
73
- const resolvedClearTrigger = clearTrigger ?? tokens.defaults.clearTrigger;
74
- const resolvedReturnKeyType = returnKeyType ?? 'search';
75
- const shouldShowAction = !!action || showAction;
76
- const isCustomActionText = /*#__PURE__*/React.isValidElement(actionText);
77
- const shouldRenderCancelAction = shouldShowAction && !action && !isCustomActionText;
73
+ const rClearTrigger = clearTrigger ?? tokens.defaults.clearTrigger;
74
+ const rReturnKey = returnKeyType ?? 'search';
75
+ const showAct = !!action || showAction;
76
+ const customActTxt = /*#__PURE__*/React.isValidElement(actionText);
77
+ const renderCancelAct = showAct && !action && !customActTxt;
78
78
  const radius = shape === 'round' ? tokens.radius.round : tokens.radius.square;
79
79
  const inputRef = useRef(null);
80
80
  useImperativeHandle(ref, () => ({
@@ -82,26 +82,26 @@ const SearchComponent = (props, ref) => {
82
82
  blur: () => inputRef.current?.blur(),
83
83
  clear: () => handleChange('')
84
84
  }), [handleChange]);
85
- const cancelActionPress = useAriaPress({
86
- disabled: !shouldRenderCancelAction,
85
+ const cancelActPress = useAriaPress({
86
+ disabled: !renderCancelAct,
87
87
  onPress: handleCancel,
88
88
  extraProps: {
89
89
  accessibilityRole: 'button',
90
90
  testID: 'rnsu-search-action'
91
91
  }
92
92
  });
93
- const containerStyles = [S.ctr, {
93
+ const ctrStyles = [S.ctr, {
94
94
  paddingHorizontal: tokens.spacing.paddingHorizontal,
95
95
  paddingVertical: tokens.spacing.paddingVertical,
96
- backgroundColor: resolvedBackground
96
+ backgroundColor: rBg
97
97
  }, containerStyle];
98
- const contentStyles = [S.cnt, {
98
+ const cntStyles = [S.cnt, {
99
99
  borderRadius: radius,
100
100
  paddingHorizontal: tokens.spacing.contentPaddingHorizontal,
101
101
  paddingVertical: tokens.spacing.contentPaddingVertical,
102
102
  backgroundColor: tokens.colors.contentBackground
103
103
  }];
104
- const labelElement = !label ? null : isText(label) ? /*#__PURE__*/React.createElement(Text, {
104
+ const labelEl = !label ? null : isText(label) ? /*#__PURE__*/React.createElement(Text, {
105
105
  style: {
106
106
  marginRight: tokens.spacing.labelGap,
107
107
  color: tokens.colors.label,
@@ -113,20 +113,20 @@ const SearchComponent = (props, ref) => {
113
113
  marginRight: tokens.spacing.labelGap
114
114
  }
115
115
  }, label);
116
- const actionElement = action ? /*#__PURE__*/React.createElement(View, {
116
+ const actEl = action ? /*#__PURE__*/React.createElement(View, {
117
117
  style: [S.act, {
118
118
  marginLeft: tokens.spacing.actionGap
119
119
  }]
120
- }, action) : !shouldShowAction ? null : isCustomActionText ? /*#__PURE__*/React.createElement(View, {
120
+ }, action) : !showAct ? null : customActTxt ? /*#__PURE__*/React.createElement(View, {
121
121
  style: [S.act, {
122
122
  marginLeft: tokens.spacing.actionGap
123
123
  }]
124
124
  }, actionText) : /*#__PURE__*/React.createElement(Pressable, _extends({
125
125
  style: [S.act, {
126
126
  marginLeft: tokens.spacing.actionGap,
127
- opacity: cancelActionPress.states.pressed ? tokens.opacity.actionPressed : 1
127
+ opacity: cancelActPress.states.pressed ? tokens.opacity.actionPressed : 1
128
128
  }]
129
- }, cancelActionPress.interactionProps), /*#__PURE__*/React.createElement(Text, {
129
+ }, cancelActPress.interactionProps), /*#__PURE__*/React.createElement(Text, {
130
130
  style: {
131
131
  color: tokens.colors.action,
132
132
  fontSize: tokens.typography.action,
@@ -134,10 +134,10 @@ const SearchComponent = (props, ref) => {
134
134
  }
135
135
  }, actionText ?? locale.cancel));
136
136
  return /*#__PURE__*/React.createElement(View, {
137
- style: containerStyles
137
+ style: ctrStyles
138
138
  }, /*#__PURE__*/React.createElement(View, {
139
- style: contentStyles
140
- }, labelElement, /*#__PURE__*/React.createElement(View, {
139
+ style: cntStyles
140
+ }, labelEl, /*#__PURE__*/React.createElement(View, {
141
141
  style: S.field
142
142
  }, /*#__PURE__*/React.createElement(Field, _extends({
143
143
  ref: inputRef,
@@ -145,12 +145,12 @@ const SearchComponent = (props, ref) => {
145
145
  value: inputValue,
146
146
  onChangeText: handleChange,
147
147
  clearable: clearable,
148
- clearTrigger: resolvedClearTrigger,
149
- leftIcon: resolvedLeftIcon,
148
+ clearTrigger: rClearTrigger,
149
+ leftIcon: rLeftIcon,
150
150
  rightIcon: rightIcon,
151
151
  center: !errorMessage,
152
152
  errorMessage: errorMessage,
153
- inputAlign: resolvedInputAlign,
153
+ inputAlign: rInputAlign,
154
154
  border: false,
155
155
  style: [{
156
156
  paddingHorizontal: tokens.spacing.none,
@@ -163,8 +163,8 @@ const SearchComponent = (props, ref) => {
163
163
  paddingVertical: tokens.spacing.none
164
164
  }, inputStyle],
165
165
  onSubmitEditing: handleSubmit,
166
- returnKeyType: resolvedReturnKeyType
167
- }, restFieldProps)))), actionElement);
166
+ returnKeyType: rReturnKey
167
+ }, restFieldProps)))), actEl);
168
168
  };
169
169
  const SearchForwardRef = /*#__PURE__*/React.forwardRef(SearchComponent);
170
170
  SearchForwardRef.displayName = 'Search';
@@ -103,10 +103,10 @@ const SelectorImpl = props => {
103
103
  const {
104
104
  tokensOverride,
105
105
  options,
106
- columns: columnsProp,
107
- multiple: multipleProp,
108
- showCheckMark: showCheckMarkProp,
109
- disabled: disabledProp,
106
+ columns: colP,
107
+ multiple: multP,
108
+ showCheckMark: showChkP,
109
+ disabled: disP,
110
110
  onChange,
111
111
  itemStyle,
112
112
  labelStyle,
@@ -115,37 +115,30 @@ const SelectorImpl = props => {
115
115
  ...rest
116
116
  } = props;
117
117
  const tokens = useSelectorTokens(tokensOverride);
118
- const columns = columnsProp ?? tokens.defaults.columns ?? 1;
119
- const multiple = multipleProp ?? tokens.defaults.multiple;
120
- const showCheckMark = showCheckMarkProp ?? tokens.defaults.showCheckMark;
121
- const disabled = Boolean(disabledProp ?? tokens.defaults.disabled);
118
+ const columns = colP ?? tokens.defaults.columns ?? 1;
119
+ const multiple = multP ?? tokens.defaults.multiple;
120
+ const showCheckMark = showChkP ?? tokens.defaults.showCheckMark;
121
+ const disabled = Boolean(disP ?? tokens.defaults.disabled);
122
122
  const [value = [], triggerChange] = useControllableValue(props, {
123
123
  defaultValue: []
124
124
  });
125
- const optionsByValue = useMemo(() => {
126
- const map = new Map();
127
- for (const option of options) map.set(option.value, option);
128
- return map;
125
+ const optionsByVal = useMemo(() => {
126
+ const m = new Map();
127
+ for (const o of options) m.set(o.value, o);
128
+ return m;
129
129
  }, [options]);
130
- const resolvedColumns = Math.max(1, Math.floor(columns));
131
- const basis = `${100 / resolvedColumns}%`;
130
+ const rCols = Math.max(1, Math.floor(columns));
131
+ const basis = `${100 / rCols}%`;
132
132
  const itemMargin = tokens.spacing.gap / 2;
133
133
  const selectedSet = useMemo(() => new Set(value), [value]);
134
134
  const toggleOption = useCallback(option => {
135
135
  if (disabled || option.disabled) return;
136
- const isActive = selectedSet.has(option.value);
137
- let nextValue;
138
- if (multiple) {
139
- nextValue = isActive ? value.filter(item => item !== option.value) : [...value, option.value];
140
- } else {
141
- nextValue = isActive ? [] : [option.value];
142
- }
143
- ;
144
- const items = nextValue.map(val => optionsByValue.get(val)).filter(Boolean);
145
- triggerChange(nextValue, {
146
- items
136
+ const active = selectedSet.has(option.value);
137
+ const nextVal = multiple ? active ? value.filter(item => item !== option.value) : [...value, option.value] : active ? [] : [option.value];
138
+ triggerChange(nextVal, {
139
+ items: nextVal.map(v => optionsByVal.get(v)).filter(Boolean)
147
140
  });
148
- }, [disabled, multiple, optionsByValue, selectedSet, triggerChange, value]);
141
+ }, [disabled, multiple, optionsByVal, selectedSet, triggerChange, value]);
149
142
  return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
150
143
  style: [tokens.layout.container, {
151
144
  marginHorizontal: -itemMargin,
@@ -35,18 +35,21 @@ const ShareSheetOptionItem = /*#__PURE__*/React.memo(({
35
35
  testID: `rv-share-sheet-item-${i}`
36
36
  }
37
37
  });
38
+ const iconNode = isText(o.icon) ? renderTextOrNode(o.icon, []) : o.icon;
38
39
  return /*#__PURE__*/React.createElement(Pressable, _extends({
39
40
  style: [S.o, ows]
40
41
  }, p.interactionProps), /*#__PURE__*/React.createElement(View, {
41
42
  style: [S.ic, is, {
42
43
  marginHorizontal: t.spacing.iconMarginHorizontal
43
44
  }]
44
- }, o.icon), isValidNode(o.name) && renderTextOrNode(o.name, [S.ot, {
45
+ }, iconNode), isValidNode(o.name) && renderTextOrNode(o.name, [S.ot, {
45
46
  color: t.colors.option,
47
+ fontFamily: t.typography.fontFamily,
46
48
  fontSize: t.typography.option,
47
49
  paddingHorizontal: t.spacing.optionTextPaddingHorizontal
48
50
  }]), isValidNode(o.description) && (isText(o.description) ? renderTextOrNode(o.description, [S.od, {
49
51
  color: t.colors.optionDesc,
52
+ fontFamily: t.typography.fontFamily,
50
53
  marginTop: t.spacing.gap,
51
54
  fontSize: t.typography.optionDesc,
52
55
  paddingHorizontal: t.spacing.optionDescPaddingHorizontal
@@ -81,6 +84,7 @@ const ShareSheetCancel = /*#__PURE__*/React.memo(({
81
84
  }]
82
85
  }, cp.interactionProps), renderTextOrNode(ct, [S.ct, {
83
86
  color: t.colors.option,
87
+ fontFamily: t.typography.fontFamily,
84
88
  fontSize: t.typography.cancel
85
89
  }])));
86
90
  });
@@ -173,6 +177,7 @@ const ShareSheetImpl = p => {
173
177
  }]
174
178
  }, ht && (isText(title) ? renderTextOrNode(title, [S.t, {
175
179
  color: t.colors.title,
180
+ fontFamily: t.typography.fontFamily,
176
181
  fontSize: t.typography.title,
177
182
  marginTop: t.spacing.titleMarginTop
178
183
  }]) : /*#__PURE__*/React.createElement(View, {
@@ -181,6 +186,7 @@ const ShareSheetImpl = p => {
181
186
  }]
182
187
  }, title)), hd && (isText(description) ? renderTextOrNode(description, [S.d, {
183
188
  color: t.colors.description,
189
+ fontFamily: t.typography.fontFamily,
184
190
  fontSize: t.typography.description,
185
191
  marginTop: t.spacing.descriptionMarginTop
186
192
  }]) : /*#__PURE__*/React.createElement(View, {
@@ -188,7 +194,7 @@ const ShareSheetImpl = p => {
188
194
  marginTop: t.spacing.nodeMarginTop
189
195
  }]
190
196
  }, description)));
191
- }, [description, hd, ht, title, t.colors.description, t.colors.title, t.spacing.descriptionMarginTop, t.spacing.headerPaddingBottom, t.spacing.headerPaddingHorizontal, t.spacing.headerPaddingTop, t.spacing.nodeMarginTop, t.spacing.titleMarginTop, t.typography.description, t.typography.title]);
197
+ }, [description, hd, ht, title, t.colors.description, t.colors.title, t.spacing.descriptionMarginTop, t.spacing.headerPaddingBottom, t.spacing.headerPaddingHorizontal, t.spacing.headerPaddingTop, t.spacing.nodeMarginTop, t.spacing.titleMarginTop, t.typography.description, t.typography.fontFamily, t.typography.title]);
192
198
  const psm = [{
193
199
  padding: t.spacing.popupPadding
194
200
  }, ps];
@@ -3,7 +3,8 @@ const createTokens = foundations => {
3
3
  const {
4
4
  palette,
5
5
  spacing,
6
- fontSize
6
+ fontSize,
7
+ typography
7
8
  } = foundations;
8
9
  return {
9
10
  colors: {
@@ -36,6 +37,7 @@ const createTokens = foundations => {
36
37
  icon: 48
37
38
  },
38
39
  typography: {
40
+ fontFamily: typography.fontFamily,
39
41
  title: fontSize.md,
40
42
  description: fontSize.xs,
41
43
  option: fontSize.xs,
@@ -20,38 +20,44 @@ const SidebarBaseImpl = props => {
20
20
  const dir = useDirection();
21
21
  const sidebarItems = useMemo(() => {
22
22
  const items = [];
23
- React.Children.toArray(children).forEach((child, index) => {
23
+ React.Children.toArray(children).forEach((child, i) => {
24
24
  if (/*#__PURE__*/React.isValidElement(child)) items.push({
25
25
  element: child,
26
- index
26
+ index: i
27
27
  });
28
28
  });
29
29
  return items;
30
30
  }, [children]);
31
- const firstIndex = sidebarItems[0]?.index ?? 0;
31
+ const firstIdx = sidebarItems[0]?.index ?? 0;
32
32
  const [activeIndex, setActiveIndex] = useControllableValue(props, {
33
- defaultValue: firstIndex,
33
+ defaultValue: firstIdx,
34
34
  valuePropName: 'value',
35
35
  defaultValuePropName: 'defaultValue',
36
36
  trigger: 'onChange'
37
37
  });
38
- const currentIndex = useMemo(() => {
38
+ const curIdx = useMemo(() => {
39
39
  for (const item of sidebarItems) {
40
40
  if (item.index === activeIndex) return activeIndex;
41
41
  }
42
- return firstIndex;
43
- }, [activeIndex, firstIndex, sidebarItems]);
44
- const contextValue = useMemo(() => ({
45
- activeIndex: currentIndex,
42
+ ;
43
+ return firstIdx;
44
+ }, [activeIndex, firstIdx, sidebarItems]);
45
+ const ctxVal = useMemo(() => ({
46
+ activeIndex: curIdx,
46
47
  onSelect: setActiveIndex
47
- }), [currentIndex, setActiveIndex]);
48
- const clonedItems = useMemo(() => sidebarItems.map(item => /*#__PURE__*/React.cloneElement(item.element, {
48
+ }), [curIdx, setActiveIndex]);
49
+ const cloned = useMemo(() => sidebarItems.map(item => /*#__PURE__*/React.cloneElement(item.element, {
49
50
  key: item.element.key ?? item.index,
50
51
  index: item.index,
51
52
  tokensOverride: mergeTokensOverride(tokensOverride, item.element.props.tokensOverride)
52
53
  })), [sidebarItems, tokensOverride]);
53
- const activeItem = sidebarItems.find(item => item.index === currentIndex)?.element;
54
- const activeContentNode = !isRenderable(activeItem?.props?.children) ? null : renderTextOrNode(activeItem.props.children);
54
+ const activeItem = sidebarItems.find(item => item.index === curIdx)?.element;
55
+ const contentTxtStyle = useMemo(() => ({
56
+ fontFamily: tokens.typography.fontFamily,
57
+ fontSize: tokens.typography.contentFontSize,
58
+ fontWeight: tokens.typography.fontWeight
59
+ }), [tokens.typography.fontFamily, tokens.typography.contentFontSize, tokens.typography.fontWeight]);
60
+ const activeContent = !isRenderable(activeItem?.props?.children) ? null : renderTextOrNode(activeItem.props.children, contentTxtStyle);
55
61
  return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
56
62
  style: [tokens.layout.container, {
57
63
  backgroundColor: tokens.colors.background
@@ -62,8 +68,8 @@ const SidebarBaseImpl = props => {
62
68
  }, sideStyle],
63
69
  accessibilityRole: "tablist"
64
70
  }, /*#__PURE__*/React.createElement(SidebarContext.Provider, {
65
- value: contextValue
66
- }, clonedItems), /*#__PURE__*/React.createElement(View, {
71
+ value: ctxVal
72
+ }, cloned), /*#__PURE__*/React.createElement(View, {
67
73
  style: createHairlineView({
68
74
  position: dir === 'rtl' ? 'left' : 'right',
69
75
  color: tokens.colors.border,
@@ -72,7 +78,7 @@ const SidebarBaseImpl = props => {
72
78
  })
73
79
  })), /*#__PURE__*/React.createElement(View, {
74
80
  style: [tokens.layout.content, activeItem?.props?.contentStyle]
75
- }, activeContentNode));
81
+ }, activeContent));
76
82
  };
77
83
  const SidebarBase = /*#__PURE__*/React.memo(SidebarBaseImpl);
78
84
  export default SidebarBase;
@@ -23,16 +23,16 @@ const SidebarItemImpl = props => {
23
23
  ...rest
24
24
  } = props;
25
25
  const tokens = useSidebarTokens(tokensOverride);
26
- const context = useSidebarContext();
27
- if (!context) return null;
26
+ const ctx = useSidebarContext();
27
+ if (!ctx) return null;
28
28
  const disabled = disabledProp ?? tokens.defaults.disabled;
29
- const isActive = context.activeIndex === index;
30
- const titleColor = disabled ? tokens.colors.disabled : isActive ? tokens.colors.titleActive : tokens.colors.title;
29
+ const isActive = ctx.activeIndex === index;
30
+ const titleClr = disabled ? tokens.colors.disabled : isActive ? tokens.colors.titleActive : tokens.colors.title;
31
31
  const press = useAriaPress({
32
32
  disabled,
33
33
  onPress: () => {
34
34
  onClick?.(index);
35
- context.onSelect(index);
35
+ ctx.onSelect(index);
36
36
  },
37
37
  extraProps: {
38
38
  accessibilityRole: 'tab',
@@ -43,14 +43,15 @@ const SidebarItemImpl = props => {
43
43
  testID: `rv-sidebar-item-${index}`
44
44
  }
45
45
  });
46
- const indicatorStyle = [tokens.layout.indicator, {
46
+ const indStyle = [tokens.layout.indicator, {
47
47
  width: tokens.sizing.indicatorWidth,
48
48
  borderRadius: tokens.sizing.indicatorWidth,
49
49
  backgroundColor: tokens.colors.indicator
50
50
  }];
51
51
  const titleNode = isRenderable(title) ? isText(title) ? /*#__PURE__*/React.createElement(Text, {
52
52
  style: [tokens.layout.title, {
53
- color: titleColor,
53
+ color: titleClr,
54
+ fontFamily: tokens.typography.fontFamily,
54
55
  fontSize: tokens.typography.fontSize,
55
56
  fontWeight: tokens.typography.fontWeight
56
57
  }, textStyle]
@@ -72,7 +73,7 @@ const SidebarItemImpl = props => {
72
73
  }), /*#__PURE__*/React.createElement(View, {
73
74
  style: tokens.layout.indicatorWrapper
74
75
  }, isActive && /*#__PURE__*/React.createElement(View, {
75
- style: indicatorStyle
76
+ style: indStyle
76
77
  })), /*#__PURE__*/React.createElement(View, {
77
78
  style: tokens.layout.itemContent
78
79
  }, /*#__PURE__*/React.createElement(View, {
@@ -62,8 +62,10 @@ export const createSidebarTokens = foundations => {
62
62
  indicator: palette.primary[600]
63
63
  },
64
64
  typography: {
65
+ fontFamily: typography.fontFamily,
65
66
  fontSize: fontSize.sm,
66
- fontWeight: typography.weight.medium
67
+ fontWeight: typography.weight.medium,
68
+ contentFontSize: fontSize.sm
67
69
  },
68
70
  sizing: {
69
71
  width: 120,
@@ -13,36 +13,36 @@ const SkeletonImpl = (props, ref) => {
13
13
  const {
14
14
  tokensOverride,
15
15
  isLoaded,
16
- loading: loadingProp,
17
- animate: animateProp,
16
+ loading: loadP,
17
+ animate: animP,
18
18
  startColor,
19
- speed: speedProp,
20
- avatar: avatarProp,
21
- avatarSize: avatarSizeProp,
22
- avatarShape: avatarShapeProp,
23
- title: titleProp,
24
- titleWidth: titleWidthProp,
25
- row: rowProp,
26
- rowWidth: rowWidthProp,
19
+ speed: speedP,
20
+ avatar: avP,
21
+ avatarSize: avSzP,
22
+ avatarShape: avShapeP,
23
+ title: titleP,
24
+ titleWidth: titleWP,
25
+ row: rowP,
26
+ rowWidth: rowWP,
27
27
  rowHeight,
28
- round: roundProp,
28
+ round: roundP,
29
29
  style,
30
30
  children,
31
31
  ...rest
32
32
  } = props;
33
33
  const tokens = useSkeletonTokens(tokensOverride);
34
34
  const reducedMotion = useReducedMotion();
35
- const loading = loadingProp ?? (isLoaded != null ? !isLoaded : true);
36
- const animate = animateProp ?? true;
37
- const avatar = avatarProp ?? false;
38
- const avatarSize = avatarSizeProp ?? tokens.defaults.avatarSize;
39
- const avatarShape = avatarShapeProp ?? 'round';
40
- const title = titleProp ?? false;
41
- const titleWidth = titleWidthProp ?? tokens.defaults.titleWidth;
42
- const row = rowProp ?? tokens.defaults.rowCount;
43
- const rowWidth = rowWidthProp ?? tokens.defaults.rowWidth;
44
- const round = roundProp ?? false;
45
- const speed = isFiniteNumber(speedProp) ? Math.max(0.01, speedProp) : isString(speedProp) && Number.isFinite(Number(speedProp)) && Number(speedProp) > 0 ? Number(speedProp) : 1;
35
+ const loading = loadP ?? (isLoaded != null ? !isLoaded : true);
36
+ const animate = animP ?? true;
37
+ const avatar = avP ?? false;
38
+ const avatarSize = avSzP ?? tokens.defaults.avatarSize;
39
+ const avatarShape = avShapeP ?? 'round';
40
+ const title = titleP ?? false;
41
+ const titleWidth = titleWP ?? tokens.defaults.titleWidth;
42
+ const row = rowP ?? tokens.defaults.rowCount;
43
+ const rowWidth = rowWP ?? tokens.defaults.rowWidth;
44
+ const round = roundP ?? false;
45
+ const speed = isFiniteNumber(speedP) ? Math.max(0.01, speedP) : isString(speedP) && Number.isFinite(Number(speedP)) && Number(speedP) > 0 ? Number(speedP) : 1;
46
46
  const duration = Math.max(0, tokens.animation.duration / speed);
47
47
  const blockColor = startColor ?? tokens.colors.block;
48
48
  const rows = isFiniteNumber(row) ? Math.max(0, Math.floor(row)) : 0;
@@ -53,14 +53,15 @@ const SkeletonImpl = (props, ref) => {
53
53
  }, [props.rowWidth, rowWidth, rows, tokens.defaults.lastRowWidth, tokens.defaults.rowWidth]);
54
54
  const rowHeights = useMemo(() => resolveSeries(rows, rowHeight, tokens.defaults.rowHeight), [rowHeight, rows, tokens.defaults.rowHeight]);
55
55
  const titleHeight = rowHeights[0] ?? tokens.defaults.rowHeight;
56
- const resolvedAvatarSize = normalize(avatarSize, tokens.defaults.avatarSize);
57
- const resolvedTitleWidth = normalize(titleWidth, tokens.defaults.titleWidth);
56
+ const rAvSz = normalize(avatarSize, tokens.defaults.avatarSize);
57
+ const rTitleW = normalize(titleWidth, tokens.defaults.titleWidth);
58
58
  const animated = useRef(new Animated.Value(0)).current;
59
59
  useEffect(() => {
60
60
  if (!loading || !animate || duration <= 0 || reducedMotion) {
61
61
  animated.setValue(0);
62
62
  return;
63
63
  }
64
+ ;
64
65
  const loop = Animated.loop(Animated.sequence([Animated.timing(animated, {
65
66
  toValue: 1,
66
67
  duration: duration / 2,
@@ -75,51 +76,51 @@ const SkeletonImpl = (props, ref) => {
75
76
  loop.start();
76
77
  return () => loop.stop();
77
78
  }, [animate, animated, duration, loading, reducedMotion]);
78
- const animatedStyle = useMemo(() => !loading || !animate ? undefined : {
79
+ const animStyle = useMemo(() => !loading || !animate ? undefined : {
79
80
  opacity: animated.interpolate({
80
81
  inputRange: [0, 1],
81
82
  outputRange: [tokens.animation.minOpacity, tokens.animation.maxOpacity]
82
83
  })
83
84
  }, [animate, animated, loading, tokens.animation.maxOpacity, tokens.animation.minOpacity]);
84
- const containerStyles = [S.ctr, {
85
+ const ctrStyles = [S.ctr, {
85
86
  gap: tokens.spacing.containerGap
86
87
  }, style];
87
88
  const avatarNode = useMemo(() => !avatar ? null : /*#__PURE__*/React.createElement(Animated.View, {
88
89
  style: [{
89
- width: resolvedAvatarSize,
90
- height: resolvedAvatarSize,
90
+ width: rAvSz,
91
+ height: rAvSz,
91
92
  borderRadius: avatarShape === 'round' ? 999 : tokens.radius,
92
93
  backgroundColor: blockColor
93
- }, animatedStyle]
94
- }), [animatedStyle, avatar, avatarShape, blockColor, resolvedAvatarSize, tokens.radius]);
94
+ }, animStyle]
95
+ }), [animStyle, avatar, avatarShape, blockColor, rAvSz, tokens.radius]);
95
96
  const titleNode = useMemo(() => !title ? null : /*#__PURE__*/React.createElement(Animated.View, {
96
97
  style: [{
97
- width: resolvedTitleWidth,
98
+ width: rTitleW,
98
99
  height: titleHeight,
99
100
  backgroundColor: blockColor,
100
101
  borderRadius: round ? tokens.radius : 0
101
- }, animatedStyle]
102
- }), [animatedStyle, blockColor, resolvedTitleWidth, round, title, titleHeight, tokens.radius]);
102
+ }, animStyle]
103
+ }), [animStyle, blockColor, rTitleW, round, title, titleHeight, tokens.radius]);
103
104
  const rowNodes = useMemo(() => rows <= 0 ? null : /*#__PURE__*/React.createElement(View, {
104
105
  style: S.rows
105
- }, rowWidths.map((width, index) => /*#__PURE__*/React.createElement(Animated.View, {
106
- key: index,
107
- testID: `rv-skeleton-row-${index}`,
106
+ }, rowWidths.map((w, i) => /*#__PURE__*/React.createElement(Animated.View, {
107
+ key: i,
108
+ testID: `rv-skeleton-row-${i}`,
108
109
  style: [{
109
- width: width,
110
- height: rowHeights[index],
111
- marginTop: index === 0 && !title ? 0 : tokens.spacing.rowGap,
110
+ width: w,
111
+ height: rowHeights[i],
112
+ marginTop: i === 0 && !title ? 0 : tokens.spacing.rowGap,
112
113
  backgroundColor: blockColor,
113
114
  borderRadius: round ? tokens.radius : 0
114
- }, animatedStyle]
115
- }))), [animatedStyle, blockColor, rowHeights, rowWidths, rows, round, title, tokens.radius, tokens.spacing.rowGap]);
115
+ }, animStyle]
116
+ }))), [animStyle, blockColor, rowHeights, rowWidths, rows, round, title, tokens.radius, tokens.spacing.rowGap]);
116
117
  if (!loading) return /*#__PURE__*/React.createElement(View, _extends({
117
118
  ref: ref,
118
119
  style: style
119
120
  }, rest), children);
120
121
  return /*#__PURE__*/React.createElement(View, _extends({
121
122
  ref: ref,
122
- style: containerStyles
123
+ style: ctrStyles
123
124
  }, rest), avatarNode, /*#__PURE__*/React.createElement(View, {
124
125
  style: S.cnt
125
126
  }, titleNode, rowNodes));
@@ -7,8 +7,8 @@ import { Platform, Pressable, StyleSheet, View } from 'react-native';
7
7
  import { useSliderTokens } from './tokens';
8
8
  import { parseNumber } from '../../utils/number';
9
9
  import { createHairlineView } from '../../utils/hairline';
10
- import { clamp } from '../../utils';
11
- import { isFunction, isFiniteNumber } from '../../utils/validate';
10
+ import { clamp, renderTextOrNode } from '../../utils';
11
+ import { isFunction, isFiniteNumber, isText } from '../../utils/validate';
12
12
  import { useAriaPress } from '../../hooks';
13
13
  const isSameLayout = (a, b) => a.width === b.width && a.height === b.height && a.x === b.x && a.y === b.y;
14
14
  const normalizeValue = (value, range, min, max) => {
@@ -168,7 +168,7 @@ const ThumbNode = /*#__PURE__*/React.memo(({
168
168
  return /*#__PURE__*/React.createElement(View, _extends({}, handlers, accessibilityProps, {
169
169
  pointerEvents: isDisabled ? 'none' : 'auto',
170
170
  style: [content ? S.thw : S.t, webGestureStyle, thumbStyle]
171
- }), content ?? /*#__PURE__*/React.createElement(View, {
171
+ }), content != null ? isText(content) ? renderTextOrNode(content, []) : content : /*#__PURE__*/React.createElement(View, {
172
172
  style: indicatorStyle
173
173
  }), !content && /*#__PURE__*/React.createElement(View, {
174
174
  style: createHairlineView({