@apple-pie/slice-native 0.1.4 → 0.1.7

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 (178) hide show
  1. package/README.md +164 -97
  2. package/SliceNative.podspec +24 -0
  3. package/dist/cjs/components.js +19 -0
  4. package/dist/cjs/hooks.js +9 -0
  5. package/dist/cjs/index.js +27 -812
  6. package/dist/cjs/providers.js +9 -0
  7. package/dist/cjs/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +11 -0
  8. package/dist/cjs/src/components/SliceButton/SliceButton.js +146 -0
  9. package/dist/cjs/src/components/SliceIcon/SliceIcon.js +20 -0
  10. package/dist/cjs/src/components/SliceIcon/iconRegistry.js +668 -0
  11. package/dist/cjs/src/components/SliceIcon/icons.js +144 -0
  12. package/dist/cjs/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +12 -0
  13. package/dist/cjs/src/components/SliceText/SliceText.js +21 -0
  14. package/dist/cjs/src/components/SliceTextInput/SliceTextInput.js +117 -0
  15. package/dist/cjs/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +13 -0
  16. package/dist/cjs/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +19 -0
  17. package/dist/cjs/src/providers/SliceThemeProvider.js +37 -0
  18. package/dist/cjs/src/theme/colors/colors.js +253 -0
  19. package/dist/cjs/src/theme/corners/corners.js +14 -0
  20. package/dist/cjs/src/theme/elevations/elevations.js +17 -0
  21. package/dist/cjs/src/theme/motion/motion.js +15 -0
  22. package/dist/cjs/src/theme/motion.js +47 -0
  23. package/dist/cjs/src/theme/spacing/spacing.js +14 -0
  24. package/dist/cjs/src/theme/type/type.js +190 -0
  25. package/dist/cjs/src/utils/sizes/sizes.js +40 -0
  26. package/dist/cjs/src/utils/typography/typography.js +17 -0
  27. package/dist/cjs/theme.js +23 -538
  28. package/dist/cjs/utils.js +10 -0
  29. package/dist/esm/components.mjs +7 -0
  30. package/dist/esm/hooks.mjs +2 -0
  31. package/dist/esm/index.mjs +12 -813
  32. package/dist/esm/providers.mjs +1 -0
  33. package/dist/esm/src/components/SliceBackgroundBlur/SliceBackgroundBlur.mjs +9 -0
  34. package/dist/esm/src/components/SliceButton/SliceButton.mjs +144 -0
  35. package/dist/esm/src/components/SliceIcon/SliceIcon.mjs +18 -0
  36. package/dist/esm/src/components/SliceIcon/iconRegistry.mjs +666 -0
  37. package/dist/esm/src/components/SliceIcon/icons.mjs +142 -0
  38. package/dist/esm/src/components/SliceLiquidGlassView/SliceLiquidGlassView.mjs +10 -0
  39. package/dist/esm/src/components/SliceText/SliceText.mjs +19 -0
  40. package/dist/esm/src/components/SliceTextInput/SliceTextInput.mjs +115 -0
  41. package/dist/esm/src/hooks/useCreateThemedStyles/useCreateThemedStyles.mjs +11 -0
  42. package/dist/esm/src/hooks/useDeviceCapabilities/useDeviceCapabilities.mjs +17 -0
  43. package/dist/esm/src/providers/SliceThemeProvider.mjs +33 -0
  44. package/dist/esm/src/theme/colors/colors.mjs +249 -0
  45. package/dist/esm/src/theme/corners/corners.mjs +12 -0
  46. package/dist/esm/src/theme/elevations/elevations.mjs +15 -0
  47. package/dist/esm/src/theme/motion/motion.mjs +13 -0
  48. package/dist/esm/src/theme/motion.mjs +45 -0
  49. package/dist/esm/src/theme/spacing/spacing.mjs +12 -0
  50. package/dist/esm/src/theme/type/type.mjs +184 -0
  51. package/dist/esm/src/utils/sizes/sizes.mjs +37 -0
  52. package/dist/esm/src/utils/typography/typography.mjs +15 -0
  53. package/dist/esm/theme.mjs +7 -522
  54. package/dist/esm/utils.mjs +2 -0
  55. package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.js +6 -0
  56. package/dist/react-native/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.js +6 -0
  57. package/dist/react-native/native/src/components/SliceBackgroundBlur/_types.js +1 -0
  58. package/dist/react-native/native/src/components/SliceBackgroundBlur/index.js +1 -0
  59. package/dist/react-native/native/src/components/SliceButton/SliceButton.js +141 -0
  60. package/dist/react-native/native/src/components/SliceButton/_types.js +1 -0
  61. package/dist/react-native/native/src/components/SliceButton/index.js +1 -0
  62. package/dist/react-native/native/src/components/SliceIcon/SliceIcon.js +15 -0
  63. package/dist/react-native/native/src/components/SliceIcon/_types.js +1 -0
  64. package/dist/react-native/native/src/components/SliceIcon/iconRegistry.js +663 -0
  65. package/dist/react-native/native/src/components/SliceIcon/icons.js +140 -0
  66. package/dist/react-native/native/src/components/SliceIcon/index.js +2 -0
  67. package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.js +6 -0
  68. package/dist/react-native/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.js +7 -0
  69. package/dist/react-native/native/src/components/SliceLiquidGlassView/_types.js +1 -0
  70. package/dist/react-native/native/src/components/SliceLiquidGlassView/index.js +1 -0
  71. package/dist/react-native/native/src/components/SliceText/SliceText.js +16 -0
  72. package/dist/react-native/native/src/components/SliceText/_types.js +1 -0
  73. package/dist/react-native/native/src/components/SliceText/index.js +1 -0
  74. package/dist/react-native/native/src/components/SliceTextInput/SliceTextInput.js +111 -0
  75. package/dist/react-native/native/src/components/SliceTextInput/_types.js +1 -0
  76. package/dist/react-native/native/src/components/SliceTextInput/index.js +1 -0
  77. package/dist/react-native/native/src/components/index.js +6 -0
  78. package/dist/react-native/native/src/hooks/index.js +2 -0
  79. package/dist/react-native/native/src/hooks/useCreateThemedStyles/index.js +1 -0
  80. package/dist/react-native/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +8 -0
  81. package/dist/react-native/native/src/hooks/useDeviceCapabilities/_types.js +1 -0
  82. package/dist/react-native/native/src/hooks/useDeviceCapabilities/index.js +1 -0
  83. package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.js +14 -0
  84. package/dist/react-native/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.js +23 -0
  85. package/dist/react-native/native/src/index.js +6 -0
  86. package/dist/react-native/native/src/providers/SliceThemeProvider.js +30 -0
  87. package/dist/react-native/native/src/providers/index.js +1 -0
  88. package/dist/react-native/native/src/specs/BackgroundBlurNativeComponent.ts +16 -0
  89. package/dist/react-native/native/src/specs/LiquidGlassNativeComponent.ts +18 -0
  90. package/dist/react-native/native/src/specs/NativeDeviceCapabilities.ts +13 -0
  91. package/dist/react-native/native/src/theme/index.js +69 -0
  92. package/dist/react-native/native/src/theme/motion.js +43 -0
  93. package/dist/react-native/native/src/types/index.js +1 -0
  94. package/dist/react-native/native/src/types/sharedTypes.js +1 -0
  95. package/dist/react-native/native/src/utils/index.js +2 -0
  96. package/dist/react-native/native/src/utils/sizes/index.js +1 -0
  97. package/dist/react-native/native/src/utils/sizes/sizes.js +35 -0
  98. package/dist/react-native/native/src/utils/typography/index.js +1 -0
  99. package/dist/react-native/native/src/utils/typography/typography.js +13 -0
  100. package/dist/react-native/src/theme/colors/colors.js +385 -0
  101. package/dist/react-native/src/theme/colors/types.js +1 -0
  102. package/dist/react-native/src/theme/corners/corners.js +10 -0
  103. package/dist/react-native/src/theme/corners/types.js +1 -0
  104. package/dist/react-native/src/theme/elevations/_types.js +1 -0
  105. package/dist/react-native/src/theme/elevations/elevations.js +13 -0
  106. package/dist/react-native/src/theme/motion/_types.js +1 -0
  107. package/dist/react-native/src/theme/motion/motion.js +11 -0
  108. package/dist/react-native/src/theme/spacing/_types.js +1 -0
  109. package/dist/react-native/src/theme/spacing/spacing.js +10 -0
  110. package/dist/react-native/src/theme/type/type.js +371 -0
  111. package/dist/react-native/src/theme/type/types.js +1 -0
  112. package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.d.ts +3 -0
  113. package/dist/types/native/src/components/SliceBackgroundBlur/SliceBackgroundBlur.native.d.ts +2 -0
  114. package/dist/types/native/src/components/SliceBackgroundBlur/_types.d.ts +24 -0
  115. package/dist/types/native/src/components/SliceBackgroundBlur/index.d.ts +2 -0
  116. package/dist/types/native/src/components/SliceButton/SliceButton.d.ts +5 -0
  117. package/dist/types/native/src/components/SliceButton/_types.d.ts +78 -0
  118. package/dist/types/native/src/components/SliceButton/index.d.ts +2 -0
  119. package/dist/types/native/src/components/SliceIcon/SliceIcon.d.ts +2 -0
  120. package/dist/types/native/{components/Icon → src/components/SliceIcon}/icons.d.ts +1 -0
  121. package/dist/types/native/src/components/SliceIcon/index.d.ts +3 -0
  122. package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.d.ts +3 -0
  123. package/dist/types/native/src/components/SliceLiquidGlassView/SliceLiquidGlassView.ios.d.ts +2 -0
  124. package/dist/types/native/src/components/SliceLiquidGlassView/_types.d.ts +17 -0
  125. package/dist/types/native/src/components/SliceLiquidGlassView/index.d.ts +2 -0
  126. package/dist/types/native/src/components/SliceText/SliceText.d.ts +5 -0
  127. package/dist/types/native/src/components/SliceText/_types.d.ts +17 -0
  128. package/dist/types/native/src/components/SliceText/index.d.ts +2 -0
  129. package/dist/types/native/src/components/SliceTextInput/SliceTextInput.d.ts +2 -0
  130. package/dist/types/native/src/components/SliceTextInput/_types.d.ts +58 -0
  131. package/dist/types/native/src/components/SliceTextInput/index.d.ts +2 -0
  132. package/dist/types/native/src/components/index.d.ts +12 -0
  133. package/dist/types/native/src/hooks/index.d.ts +3 -0
  134. package/dist/types/native/src/hooks/useCreateThemedStyles/index.d.ts +1 -0
  135. package/dist/types/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.d.ts +7 -0
  136. package/dist/types/native/src/hooks/useDeviceCapabilities/_types.d.ts +17 -0
  137. package/dist/types/native/src/hooks/useDeviceCapabilities/index.d.ts +2 -0
  138. package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.d.ts +3 -0
  139. package/dist/types/native/src/hooks/useDeviceCapabilities/useDeviceCapabilities.native.d.ts +7 -0
  140. package/dist/types/native/src/index.d.ts +12 -0
  141. package/dist/types/native/src/providers/SliceThemeProvider.d.ts +16 -0
  142. package/dist/types/native/src/providers/index.d.ts +2 -0
  143. package/dist/types/native/src/specs/BackgroundBlurNativeComponent.d.ts +9 -0
  144. package/dist/types/native/src/specs/LiquidGlassNativeComponent.d.ts +9 -0
  145. package/dist/types/native/src/specs/NativeDeviceCapabilities.d.ts +11 -0
  146. package/dist/types/native/{theme → src/theme}/index.d.ts +5 -5
  147. package/dist/types/native/src/types/index.d.ts +1 -0
  148. package/dist/types/native/src/types/sharedTypes.d.ts +14 -0
  149. package/dist/types/native/src/utils/index.d.ts +2 -0
  150. package/dist/types/native/src/utils/sizes/index.d.ts +1 -0
  151. package/dist/types/native/src/utils/sizes/sizes.d.ts +7 -0
  152. package/dist/types/native/src/utils/typography/index.d.ts +1 -0
  153. package/dist/types/native/src/utils/typography/typography.d.ts +7 -0
  154. package/package.json +57 -11
  155. package/platform/android/build.gradle +22 -0
  156. package/platform/android/src/main/AndroidManifest.xml +1 -0
  157. package/platform/android/src/main/java/com/slice/SliceBackgroundBlurManager.java +28 -0
  158. package/platform/android/src/main/java/com/slice/SliceBackgroundBlurView.java +98 -0
  159. package/platform/android/src/main/java/com/slice/SliceDeviceCapabilitiesModule.java +25 -0
  160. package/platform/android/src/main/java/com/slice/SlicePackage.java +25 -0
  161. package/platform/ios/BackgroundBlurSurface.swift +89 -0
  162. package/platform/ios/LiquidGlassSurface.swift +82 -0
  163. package/platform/ios/RCTBackgroundBlurView.h +3 -0
  164. package/platform/ios/RCTBackgroundBlurView.mm +42 -0
  165. package/platform/ios/RCTLiquidGlassView.h +8 -0
  166. package/platform/ios/RCTLiquidGlassView.mm +73 -0
  167. package/platform/ios/SliceDeviceCapabilities.h +4 -0
  168. package/platform/ios/SliceDeviceCapabilities.mm +35 -0
  169. package/react-native.config.js +1 -0
  170. package/src/specs/BackgroundBlurNativeComponent.ts +16 -0
  171. package/src/specs/LiquidGlassNativeComponent.ts +18 -0
  172. package/src/specs/NativeDeviceCapabilities.ts +13 -0
  173. package/dist/types/native/components/Icon/NativeIcon.d.ts +0 -2
  174. package/dist/types/native/components/Icon/index.d.ts +0 -3
  175. package/dist/types/native/index.d.ts +0 -4
  176. /package/dist/types/native/{components/Icon → src/components/SliceIcon}/_types.d.ts +0 -0
  177. /package/dist/types/native/{components/Icon → src/components/SliceIcon}/iconRegistry.d.ts +0 -0
  178. /package/dist/types/native/{theme → src/theme}/motion.d.ts +0 -0
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ // Generated by native/scripts/generate-icons.mjs from src/components/Icon. Do not edit directly.
4
+ const SliceIcons = {
5
+ arrows: {
6
+ arrowLeft: 'arrow left',
7
+ arrowRight: 'arrow right',
8
+ arrowUp: 'arrow up',
9
+ arrowDown: 'arrow down',
10
+ chevronDown: 'chevron down',
11
+ chevronUp: 'chevron up',
12
+ navigateRight: 'navigate right',
13
+ navigateLeft: 'navigate left',
14
+ share: 'share',
15
+ },
16
+ selection: {
17
+ check: 'check',
18
+ checkCircle: 'check circle',
19
+ checkbox: 'checkbox',
20
+ checkboxChecked: 'checkbox checked',
21
+ checkboxPartial: 'checkbox partial',
22
+ circle: 'circle',
23
+ circleFill: 'circle fill',
24
+ plus: 'plus',
25
+ plusCircle: 'plus circle',
26
+ },
27
+ Messaging: {
28
+ chat: 'chat',
29
+ mail: 'mail',
30
+ notification: 'notification',
31
+ inbox: 'inbox',
32
+ like: 'like',
33
+ unlike: 'unlike',
34
+ at: '@',
35
+ },
36
+ media: {
37
+ camera: 'camera',
38
+ focus: 'focus',
39
+ mic: 'mic',
40
+ micMuted: 'mic muted',
41
+ video: 'video',
42
+ videoOff: 'video off',
43
+ download: 'download',
44
+ upload: 'upload',
45
+ speaker: 'speaker',
46
+ speakerMuted: 'speaker muted',
47
+ speakerHigh: 'speaker high',
48
+ speakerLow: 'speaker low',
49
+ play: 'play',
50
+ playCircle: 'play circle',
51
+ pause: 'pause',
52
+ pauseCircle: 'pause circle',
53
+ },
54
+ files: {
55
+ document: 'document',
56
+ documentEditor: 'document editor',
57
+ textDocument: 'text document',
58
+ },
59
+ people: {
60
+ people: 'people',
61
+ person: 'person',
62
+ talk: 'talk',
63
+ },
64
+ business: {
65
+ briefcase: 'briefcase',
66
+ dollar: 'dollar',
67
+ invoice: 'invoice',
68
+ payment: 'payment',
69
+ wallet: 'wallet',
70
+ laptop: 'laptop',
71
+ },
72
+ charts: {
73
+ barChart: 'bar chart',
74
+ chart: 'chart',
75
+ chartArrow: 'chart arrow',
76
+ },
77
+ status: {
78
+ alert: 'alert',
79
+ exclamation: 'exclamation',
80
+ help: 'help',
81
+ info: 'info',
82
+ issue: 'issue',
83
+ lightBulb: 'light bulb',
84
+ target: 'target',
85
+ openCircle: 'open circle',
86
+ },
87
+ brands: {
88
+ apple: 'apple',
89
+ google: 'google',
90
+ googleMono: 'google mono',
91
+ linkedin: 'linkedin',
92
+ github: 'github',
93
+ npm: 'npm',
94
+ openAI: 'openAI',
95
+ android: 'android',
96
+ },
97
+ edit: {
98
+ edit: 'edit',
99
+ trashBin: 'trash bin',
100
+ copy: 'copy',
101
+ filter: 'filter',
102
+ highlight: 'highlight',
103
+ undo: 'undo',
104
+ concise: 'concise',
105
+ expanded: 'expanded',
106
+ moderate: 'moderate',
107
+ recent: 'recent',
108
+ },
109
+ typography: {
110
+ fontLarger: 'font larger',
111
+ fontSmaller: 'font smaller',
112
+ characterBeam: 'character beam',
113
+ },
114
+ weather: {
115
+ sun: 'sun',
116
+ moonFull: 'moon full',
117
+ },
118
+ ai: {
119
+ sparkle: 'sparkle',
120
+ wand: 'wand',
121
+ },
122
+ ui: {
123
+ attach: 'attach',
124
+ blank: 'blank',
125
+ book: 'book',
126
+ globeLocation: 'globe location',
127
+ heart: 'heart',
128
+ stop: 'stop',
129
+ search: 'search',
130
+ settings: 'settings',
131
+ view: 'view',
132
+ refresh: 'refresh',
133
+ home: 'home',
134
+ menu: 'menu',
135
+ more: 'more',
136
+ sidebar: 'sidebar',
137
+ sidebarSplit: 'sidebar split',
138
+ keyboard: 'keyboard',
139
+ x: 'x',
140
+ fullscreen: 'fullscreen',
141
+ },
142
+ };
143
+
144
+ exports.SliceIcons = SliceIcons;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var reactNative = require('react-native');
6
+
7
+ /** Android/web fallback. Metro selects SliceLiquidGlassView.ios on iOS. */
8
+ const SliceLiquidGlassView = react.forwardRef(function SliceLiquidGlassView({ glassStyle: _glassStyle, glassTintColor: _glassTintColor, interactive: _interactive, cornerRadius = 24, fallbackColor = 'rgba(128, 128, 128, 0.18)', style, ...props }, ref) {
9
+ return (jsxRuntime.jsx(reactNative.View, { ...props, ref: ref, style: [{ backgroundColor: fallbackColor }, style, { borderRadius: cornerRadius, overflow: 'hidden' }] }));
10
+ });
11
+
12
+ exports.SliceLiquidGlassView = SliceLiquidGlassView;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var reactNative = require('react-native');
5
+ var SliceThemeProvider = require('../../providers/SliceThemeProvider.js');
6
+
7
+ /**
8
+ * Utility wrapper around text component for easier styling of text using slice theme
9
+ */
10
+ function StyledText(props) {
11
+ const { textStyle, textColor, style, singleLine, children, ...rest } = props;
12
+ const { type, colors } = SliceThemeProvider.useSliceTheme();
13
+ const textStyles = textStyle ? type[textStyle] : undefined;
14
+ const color = { color: textColor ? colors[textColor] : colors['core-text-primary'] };
15
+ const fontSize = textStyles?.fontSize ?? 16;
16
+ const height = typeof singleLine === 'number' ? singleLine : 1.2;
17
+ const lineHeight = { lineHeight: singleLine ? height * fontSize : textStyles?.lineHeight };
18
+ return (jsxRuntime.jsx(reactNative.Text, { ...rest, numberOfLines: singleLine ? 1 : rest.numberOfLines, style: [textStyles, color, lineHeight, style], children: children }));
19
+ }
20
+
21
+ exports.StyledText = StyledText;
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var reactNative = require('react-native');
6
+ var Reanimated = require('react-native-reanimated');
7
+ var useCreateThemedStyles = require('../../hooks/useCreateThemedStyles/useCreateThemedStyles.js');
8
+ var SliceThemeProvider = require('../../providers/SliceThemeProvider.js');
9
+ var typography = require('../../utils/typography/typography.js');
10
+ var sizes = require('../../utils/sizes/sizes.js');
11
+ var SliceIcon = require('../SliceIcon/SliceIcon.js');
12
+
13
+ function SliceTextInput(props) {
14
+ const themedStyles = useCreateThemedStyles.useCreateThemedStyles(styles);
15
+ const { colors } = SliceThemeProvider.useSliceTheme();
16
+ const { didFocus, layout, icon, focused, blurClears = false, iconColor, iconSize = 24, placeholderTextColor = themedStyles.placeHolder.color, hideIconOnFocus = true, style, onFocus, onBlur, onChangeText, accessibilityState, borderRadius = 'pill', borderWidth = 1, borderColor = colors['core-outline-secondary'], backgroundColor, size = 'm', ...rest } = props;
17
+ const inputRef = react.useRef(null);
18
+ const [isFocused, setIsFocused] = react.useState(false);
19
+ // Only drive native focus when the caller explicitly supplies a preference.
20
+ react.useEffect(() => {
21
+ if (focused === undefined || !inputRef.current)
22
+ return;
23
+ if (focused && !inputRef.current.isFocused())
24
+ inputRef.current.focus();
25
+ else if (!focused && inputRef.current.isFocused())
26
+ inputRef.current.blur();
27
+ }, [focused]);
28
+ const iconColorComputed = react.useMemo(() => {
29
+ if (iconColor)
30
+ return iconColor;
31
+ return isFocused ? themedStyles.icon.color : placeholderTextColor;
32
+ }, [themedStyles, isFocused, iconColor, placeholderTextColor]);
33
+ const showIcon = react.useMemo(() => {
34
+ if (!icon)
35
+ return false;
36
+ return !(isFocused && hideIconOnFocus);
37
+ }, [isFocused, hideIconOnFocus, icon]);
38
+ const padding = react.useMemo(() => {
39
+ return reactNative.StyleSheet.create({
40
+ padding: { paddingRight: 18, paddingLeft: showIcon ? 0 : 18 },
41
+ });
42
+ }, [showIcon]);
43
+ const inputSize = react.useMemo(() => {
44
+ return reactNative.StyleSheet.create({
45
+ size: {
46
+ minHeight: sizes.sizeToNumber(size),
47
+ },
48
+ });
49
+ }, [size]);
50
+ const borderStyles = react.useMemo(() => {
51
+ return reactNative.StyleSheet.create({
52
+ border: {
53
+ borderWidth: Number.isFinite(borderWidth) ? Math.max(0, borderWidth) : 0,
54
+ borderColor,
55
+ },
56
+ });
57
+ }, [borderColor, borderWidth]);
58
+ const cornerRadius = react.useMemo(() => {
59
+ return reactNative.StyleSheet.create({
60
+ borderRadius: {
61
+ borderRadius: sizes.borderRadiusToNumber(borderRadius),
62
+ },
63
+ });
64
+ }, [borderRadius]);
65
+ const bgColor = react.useMemo(() => {
66
+ return reactNative.StyleSheet.create({
67
+ backgroundColor: { backgroundColor: backgroundColor ?? colors['core-surface-primary'] },
68
+ });
69
+ }, [backgroundColor, colors]);
70
+ return (jsxRuntime.jsxs(Reanimated.View, { style: [
71
+ themedStyles.inputWrapper,
72
+ inputSize.size,
73
+ cornerRadius.borderRadius,
74
+ borderStyles.border,
75
+ bgColor.backgroundColor,
76
+ ], layout: layout, children: [showIcon && (jsxRuntime.jsx(reactNative.View, { style: [themedStyles.icon, { height: iconSize, width: iconSize }], children: jsxRuntime.jsx(SliceIcon.SliceIcon, { name: icon, strokeColor: iconColorComputed, size: iconSize, accessible: false, pointerEvents: "none" }) })), jsxRuntime.jsx(reactNative.TextInput, { ...rest, ref: inputRef, style: [themedStyles.inputFieldView, padding.padding, style], accessibilityState: {
77
+ ...accessibilityState,
78
+ disabled: rest.editable === false || accessibilityState?.disabled,
79
+ }, onChangeText: onChangeText, placeholderTextColor: placeholderTextColor, onFocus: (event) => {
80
+ setIsFocused(true);
81
+ didFocus?.(true);
82
+ onFocus?.(event);
83
+ }, onBlur: (event) => {
84
+ setIsFocused(false);
85
+ if (blurClears) {
86
+ inputRef.current?.clear();
87
+ onChangeText?.('');
88
+ }
89
+ didFocus?.(false);
90
+ onBlur?.(event);
91
+ } })] }));
92
+ }
93
+ const styles = (theme) => reactNative.StyleSheet.create({
94
+ icon: {
95
+ marginLeft: 16,
96
+ color: theme.name === 'lightMode' ? theme.colors['core-icon-primary'] : theme.colors['core-link-primary'],
97
+ },
98
+ inputWrapper: {
99
+ flex: 1,
100
+ flexDirection: 'row',
101
+ alignItems: 'center',
102
+ justifyContent: 'flex-start',
103
+ gap: 8,
104
+ zIndex: 2,
105
+ },
106
+ inputFieldView: {
107
+ ...typography.lineHeightTextStyle(theme.type['body-xl-bold']),
108
+ color: theme.colors['core-text-primary'],
109
+ flex: 1,
110
+ zIndex: 2,
111
+ },
112
+ placeHolder: {
113
+ color: theme.colors['core-text-tertiary'],
114
+ },
115
+ });
116
+
117
+ exports.SliceTextInput = SliceTextInput;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var SliceThemeProvider = require('../../providers/SliceThemeProvider.js');
5
+
6
+ /** Resolve native styles using the current provider theme. Keep the factory stable
7
+ * (outside the component, or with useCallback) to reuse styles across renders. */
8
+ function useCreateThemedStyles(styles) {
9
+ const sliceTheme = SliceThemeProvider.useSliceTheme();
10
+ return react.useMemo(() => styles(sliceTheme), [sliceTheme, styles]);
11
+ }
12
+
13
+ exports.useCreateThemedStyles = useCreateThemedStyles;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var reactNative = require('react-native');
5
+
6
+ /** Unsupported-platform fallback. Metro selects the native hook on iOS/Android. */
7
+ function useDeviceCapabilities() {
8
+ return react.useMemo(() => ({
9
+ platform: reactNative.Platform.OS,
10
+ iosVersion: null,
11
+ androidSdkVersion: null,
12
+ deviceName: null,
13
+ deviceModel: null,
14
+ supportsLiquidGlass: false,
15
+ supportsNativeBlur: false,
16
+ }), []);
17
+ }
18
+
19
+ exports.useDeviceCapabilities = useDeviceCapabilities;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var reactNative = require('react-native');
6
+ var theme = require('../../theme.js');
7
+
8
+ const ThemeContext = react.createContext(undefined);
9
+ function SliceThemeProvider({ preference = 'system', onPreferenceChange = undefined, children, }) {
10
+ const deviceMode = reactNative.useColorScheme();
11
+ const mode = preference === 'system' ? (deviceMode === 'dark' ? 'dark' : 'light') : preference;
12
+ const value = react.useMemo(() => ({
13
+ theme: mode === 'dark' ? theme.darkTheme : theme.lightTheme,
14
+ mode,
15
+ preference,
16
+ setPreference: onPreferenceChange,
17
+ }), [mode, preference, onPreferenceChange]);
18
+ return jsxRuntime.jsx(ThemeContext.Provider, { value: value, children: children });
19
+ }
20
+ function useSliceContext() {
21
+ const context = react.useContext(ThemeContext);
22
+ if (!context) {
23
+ throw new Error('useSliceContext must be used within SliceThemeProvider');
24
+ }
25
+ return context;
26
+ }
27
+ function useSliceTheme() {
28
+ const context = react.useContext(ThemeContext);
29
+ if (!context) {
30
+ throw new Error('useSliceTheme must be used within SliceThemeProvider');
31
+ }
32
+ return context.theme;
33
+ }
34
+
35
+ exports.SliceThemeProvider = SliceThemeProvider;
36
+ exports.useSliceContext = useSliceContext;
37
+ exports.useSliceTheme = useSliceTheme;
@@ -0,0 +1,253 @@
1
+ 'use strict';
2
+
3
+ const coreColors = {
4
+ 'brand-grey-50': '#f4f7fa',
5
+ 'brand-grey-100': '#e5ecf3',
6
+ 'brand-grey-200': '#d5e0ea',
7
+ 'brand-grey-300': '#98acbf',
8
+ 'brand-grey-400': '#7f96a9',
9
+ 'brand-grey-500': '#657d91',
10
+ 'brand-grey-600': '#4c6273',
11
+ 'brand-grey-700': '#405261',
12
+ 'brand-grey-800': '#37434e',
13
+ 'brand-grey-900': '#2d353d',
14
+ 'brand-grey-950': '#1f262d',
15
+ 'brand-sea-50': '#e8f1ff',
16
+ 'brand-sea-100': '#c7defe',
17
+ 'brand-sea-200': '#a5c9ff',
18
+ 'brand-sea-300': '#7ab3ff',
19
+ 'brand-sea-400': '#4084ff',
20
+ 'brand-sea-500': '#2f45ff',
21
+ 'brand-sea-600': '#2d2fff',
22
+ 'brand-sea-700': '#0000ff',
23
+ 'brand-sea-800': '#0609cd',
24
+ 'brand-sea-900': '#001699',
25
+ 'brand-sea-950': '#0a0b5c',
26
+ 'brand-sky-50': '#eafffe',
27
+ 'brand-sky-100': '#cdfffb',
28
+ 'brand-sky-200': '#a3f8ff',
29
+ 'brand-sky-300': '#6af5ff',
30
+ 'brand-sky-400': '#00edff',
31
+ 'brand-sky-500': '#00c8e0',
32
+ 'brand-sky-600': '#00a6c0',
33
+ 'brand-sky-700': '#03839b',
34
+ 'brand-sky-800': '#0d697d',
35
+ 'brand-sky-900': '#105669',
36
+ 'brand-sky-950': '#033949',
37
+ 'brand-land-50': '#f4ffe5',
38
+ 'brand-land-100': '#e0ffb7',
39
+ 'brand-land-200': '#caff95',
40
+ 'brand-land-300': '#b7fe59',
41
+ 'brand-land-400': '#9cf820',
42
+ 'brand-land-500': '#71e618',
43
+ 'brand-land-600': '#56c900',
44
+ 'brand-land-700': '#2d8c00',
45
+ 'brand-land-800': '#31690b',
46
+ 'brand-land-900': '#2a580f',
47
+ 'brand-land-950': '#123201',
48
+ 'brand-orange-50': '#fff8ec',
49
+ 'brand-orange-100': '#ffebd7',
50
+ 'brand-orange-200': '#ffe3c6',
51
+ 'brand-orange-300': '#ffc182',
52
+ 'brand-orange-400': '#ff972e',
53
+ 'brand-orange-500': '#ff800a',
54
+ 'brand-orange-600': '#ff6700',
55
+ 'brand-orange-700': '#ff3700',
56
+ 'brand-orange-800': '#a02b0b',
57
+ 'brand-orange-900': '#80250b',
58
+ 'brand-orange-950': '#461604',
59
+ 'brand-yellow-50': '#ffffea',
60
+ 'brand-yellow-100': '#fffdca',
61
+ 'brand-yellow-200': '#fff2a0',
62
+ 'brand-yellow-300': '#ffeb72',
63
+ 'brand-yellow-400': '#ffd333',
64
+ 'brand-yellow-500': '#ffc200',
65
+ 'brand-yellow-600': '#ffad00',
66
+ 'brand-yellow-700': '#c68601',
67
+ 'brand-yellow-800': '#8f6307',
68
+ 'brand-yellow-900': '#5f430a',
69
+ 'brand-yellow-950': '#442e00',
70
+ 'brand-purple-50': '#faf0ff',
71
+ 'brand-purple-100': '#f4ddff',
72
+ 'brand-purple-200': '#e5cdff',
73
+ 'brand-purple-300': '#ccafff',
74
+ 'brand-purple-400': '#b891ff',
75
+ 'brand-purple-500': '#7d48ff',
76
+ 'brand-purple-600': '#6a14ff',
77
+ 'brand-purple-700': '#5600f1',
78
+ 'brand-purple-800': '#4d01d6',
79
+ 'brand-purple-900': '#4003af',
80
+ 'brand-purple-950': '#1e007c',
81
+ 'brand-magenta-50': '#fef1fc',
82
+ 'brand-magenta-100': '#ffdcef',
83
+ 'brand-magenta-200': '#ffcae6',
84
+ 'brand-magenta-300': '#ff90cb',
85
+ 'brand-magenta-400': '#ff61ca',
86
+ 'brand-magenta-500': '#ff3ac2',
87
+ 'brand-magenta-600': '#f012aa',
88
+ 'brand-magenta-700': '#df059b',
89
+ 'brand-magenta-800': '#9b0069',
90
+ 'brand-magenta-900': '#790a55',
91
+ 'brand-magenta-950': '#58003a',
92
+ 'brand-white-0': '#ffffff',
93
+ 'product-red-400': '#ff474a',
94
+ 'product-red-500': '#df0529',
95
+ 'core-drop-shadow-light': '#0339491a',
96
+ 'core-drop-shadow-dark': '#0000007a',
97
+ 'core-surface-coverup-translucent-light': '#1f262d52',
98
+ 'core-surface-coverup-translucent-dark': '#0000007a',
99
+ 'core-surface-overlay-translucent-light': '#ffffffcc',
100
+ 'core-surface-overlay-translucent-dark': '#1f262dcc',
101
+ 'surface-primary-tint-light': '#fcfcfc',
102
+ 'surface-primary-tint-dark': '#191e24',
103
+ 'scroll-bar-light': '#e3e8ef',
104
+ 'scroll-bar-dark': 'rgba(255, 255, 255, 0.1)',
105
+ 'scroll-bar-hover-light': '#cdd5df',
106
+ 'scroll-bar-hover-dark': 'rgba(255, 255, 255, 0.15)',
107
+ 'surface-shadow-soft-light': '0px 4px 24px #0339491a',
108
+ 'surface-shadow-soft-dark': '0px 4px 24px #0000007a',
109
+ 'surface-shadow-strong-light': '0px 4px 64px #0339491a',
110
+ 'surface-shadow-strong-dark': '0px 4px 64px #0000007a',
111
+ };
112
+ const light = {
113
+ 'array-land': coreColors['brand-land-100'],
114
+ 'array-land-label': coreColors['brand-land-600'],
115
+ 'array-magenta': coreColors['brand-magenta-100'],
116
+ 'array-magenta-label': coreColors['brand-magenta-600'],
117
+ 'array-orange': coreColors['brand-orange-100'],
118
+ 'array-orange-label': coreColors['brand-orange-600'],
119
+ 'array-purple': coreColors['brand-purple-100'],
120
+ 'array-purple-label': coreColors['brand-purple-600'],
121
+ 'array-sea': coreColors['brand-sea-100'],
122
+ 'array-sea-label': coreColors['brand-sea-600'],
123
+ 'array-sky': coreColors['brand-sky-100'],
124
+ 'array-sky-label': coreColors['brand-sky-600'],
125
+ 'array-yellow': coreColors['brand-yellow-100'],
126
+ 'array-yellow-label': coreColors['brand-yellow-600'],
127
+ 'core-badge-primary': coreColors['brand-sea-500'],
128
+ 'core-badge-secondary': coreColors['brand-grey-100'],
129
+ 'core-button-disabled': coreColors['brand-grey-50'],
130
+ 'core-button-primary': coreColors['brand-sea-500'],
131
+ 'core-drop-shadow': coreColors['core-drop-shadow-light'],
132
+ 'core-gp-logo-primary': coreColors['brand-sea-700'],
133
+ 'core-gp-logo-secondary': coreColors['brand-grey-950'],
134
+ 'core-icon-dark': coreColors['brand-grey-950'],
135
+ 'core-icon-disabled': coreColors['brand-grey-300'],
136
+ 'core-icon-error': coreColors['product-red-500'],
137
+ 'core-icon-light': coreColors['brand-white-0'],
138
+ 'core-icon-primary': coreColors['brand-grey-950'],
139
+ 'core-icon-secondary': coreColors['brand-grey-700'],
140
+ 'core-icon-tertiary': coreColors['brand-sea-500'],
141
+ 'core-outline-secondary': coreColors['brand-grey-100'],
142
+ 'core-outline-primary': coreColors['brand-grey-100'],
143
+ 'core-outline-special': coreColors['brand-sea-100'],
144
+ 'core-outline-tertiary': coreColors['brand-sea-500'],
145
+ 'core-surface-coverup-translucent': coreColors['core-surface-coverup-translucent-light'],
146
+ 'core-surface-overlay-translucent': coreColors['core-surface-overlay-translucent-light'],
147
+ 'core-surface-primary': coreColors['brand-white-0'],
148
+ 'core-surface-primary-tint': coreColors['surface-primary-tint-light'],
149
+ 'core-surface-secondary': coreColors['brand-grey-50'],
150
+ 'core-surface-special': coreColors['brand-sea-50'],
151
+ 'core-text-dark': coreColors['brand-grey-950'],
152
+ 'core-text-disabled': coreColors['brand-grey-300'],
153
+ 'core-text-error': coreColors['product-red-500'],
154
+ 'core-text-light': coreColors['brand-white-0'],
155
+ 'core-text-primary': coreColors['brand-grey-950'],
156
+ 'core-text-secondary': coreColors['brand-grey-700'],
157
+ 'core-text-tertiary': coreColors['brand-grey-600'],
158
+ 'core-text-special': coreColors['brand-sea-500'],
159
+ 'core-text-accent': coreColors['brand-sky-500'],
160
+ 'core-link-primary': coreColors['brand-sea-500'],
161
+ 'eor-tag-employee': coreColors['brand-sky-700'],
162
+ 'eor-tag-overdue': coreColors['product-red-500'],
163
+ 'eor-tag-paid': coreColors['brand-land-700'],
164
+ 'eor-tag-pending': coreColors['brand-orange-500'],
165
+ 'eor-tag-professional': coreColors['brand-sea-500'],
166
+ 'feedback-attention': coreColors['brand-yellow-500'],
167
+ 'feedback-informative': coreColors['brand-sky-700'],
168
+ 'feedback-positive': coreColors['brand-land-700'],
169
+ 'feedback-urgency': coreColors['brand-orange-500'],
170
+ 'feedback-warning': coreColors['product-red-500'],
171
+ 'gia-tag-risk-high': coreColors['product-red-500'],
172
+ 'gia-tag-risk-low': coreColors['brand-sky-700'],
173
+ 'gia-tag-risk-moderate': coreColors['brand-orange-500'],
174
+ 'gia-text-excerpt-highlight': coreColors['brand-orange-100'],
175
+ 'gia-text-selection': coreColors['brand-sea-100'],
176
+ 'scroll-bar': coreColors['scroll-bar-light'],
177
+ 'scroll-bar-hover': coreColors['scroll-bar-hover-light'],
178
+ 'surface-shadow-soft': coreColors['surface-shadow-soft-light'],
179
+ 'surface-shadow-strong': coreColors['surface-shadow-strong-light'],
180
+ };
181
+ const dark = {
182
+ 'array-land': coreColors['brand-land-100'],
183
+ 'array-land-label': coreColors['brand-land-600'],
184
+ 'array-magenta': coreColors['brand-magenta-100'],
185
+ 'array-magenta-label': coreColors['brand-magenta-600'],
186
+ 'array-orange': coreColors['brand-orange-100'],
187
+ 'array-orange-label': coreColors['brand-orange-600'],
188
+ 'array-purple': coreColors['brand-purple-100'],
189
+ 'array-purple-label': coreColors['brand-purple-600'],
190
+ 'array-sea': coreColors['brand-sea-100'],
191
+ 'array-sea-label': coreColors['brand-sea-600'],
192
+ 'array-sky': coreColors['brand-sky-100'],
193
+ 'array-sky-label': coreColors['brand-sky-600'],
194
+ 'array-yellow': coreColors['brand-yellow-100'],
195
+ 'array-yellow-label': coreColors['brand-yellow-600'],
196
+ 'core-badge-primary': coreColors['brand-sea-500'],
197
+ 'core-badge-secondary': coreColors['brand-grey-700'],
198
+ 'core-button-disabled': coreColors['brand-grey-900'],
199
+ 'core-button-primary': coreColors['brand-sea-500'],
200
+ 'core-drop-shadow': coreColors['core-drop-shadow-dark'],
201
+ 'core-gp-logo-primary': coreColors['brand-sea-500'],
202
+ 'core-gp-logo-secondary': coreColors['brand-white-0'],
203
+ 'core-icon-dark': coreColors['brand-grey-950'],
204
+ 'core-icon-disabled': coreColors['brand-grey-500'],
205
+ 'core-icon-error': coreColors['product-red-400'],
206
+ 'core-icon-light': coreColors['brand-white-0'],
207
+ 'core-icon-primary': coreColors['brand-white-0'],
208
+ 'core-icon-secondary': coreColors['brand-grey-200'],
209
+ 'core-icon-tertiary': coreColors['brand-sky-300'],
210
+ 'core-outline-secondary': coreColors['brand-grey-900'],
211
+ 'core-outline-primary': coreColors['brand-grey-700'],
212
+ 'core-outline-special': coreColors['brand-sky-900'],
213
+ 'core-outline-tertiary': coreColors['brand-sky-300'],
214
+ 'core-surface-coverup-translucent': coreColors['core-surface-coverup-translucent-dark'],
215
+ 'core-surface-overlay-translucent': coreColors['core-surface-overlay-translucent-dark'],
216
+ 'core-surface-primary': coreColors['brand-grey-950'],
217
+ 'core-surface-primary-tint': coreColors['surface-primary-tint-dark'],
218
+ 'core-surface-secondary': coreColors['brand-grey-900'],
219
+ 'core-surface-special': coreColors['brand-sky-950'],
220
+ 'core-text-dark': coreColors['brand-grey-950'],
221
+ 'core-text-disabled': coreColors['brand-grey-500'],
222
+ 'core-text-error': coreColors['product-red-400'],
223
+ 'core-text-light': coreColors['brand-white-0'],
224
+ 'core-text-primary': coreColors['brand-white-0'],
225
+ 'core-text-secondary': coreColors['brand-grey-200'],
226
+ 'core-text-tertiary': coreColors['brand-grey-400'],
227
+ 'core-text-special': coreColors['brand-sky-300'],
228
+ 'core-text-accent': coreColors['brand-sky-300'],
229
+ 'core-link-primary': coreColors['brand-sky-300'],
230
+ 'eor-tag-employee': coreColors['brand-sky-700'],
231
+ 'eor-tag-overdue': coreColors['product-red-400'],
232
+ 'eor-tag-paid': coreColors['brand-land-700'],
233
+ 'eor-tag-pending': coreColors['brand-orange-500'],
234
+ 'eor-tag-professional': coreColors['brand-sea-500'],
235
+ 'feedback-attention': coreColors['brand-yellow-400'],
236
+ 'feedback-informative': coreColors['brand-sky-600'],
237
+ 'feedback-positive': coreColors['brand-land-700'],
238
+ 'feedback-urgency': coreColors['brand-orange-500'],
239
+ 'feedback-warning': coreColors['product-red-400'],
240
+ 'gia-tag-risk-high': coreColors['product-red-400'],
241
+ 'gia-tag-risk-low': coreColors['brand-sky-600'],
242
+ 'gia-tag-risk-moderate': coreColors['brand-orange-500'],
243
+ 'gia-text-excerpt-highlight': coreColors['brand-orange-100'],
244
+ 'gia-text-selection': coreColors['brand-sea-900'],
245
+ 'scroll-bar': coreColors['scroll-bar-dark'],
246
+ 'scroll-bar-hover': coreColors['scroll-bar-hover-dark'],
247
+ 'surface-shadow-soft': coreColors['surface-shadow-soft-dark'],
248
+ 'surface-shadow-strong': coreColors['surface-shadow-strong-dark'],
249
+ };
250
+
251
+ exports.coreColors = coreColors;
252
+ exports.dark = dark;
253
+ exports.light = light;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ const corners = {
4
+ 'corner-none': 0,
5
+ 'corner-xs': 4,
6
+ 'corner-s': 6,
7
+ 'corner-m': 8,
8
+ 'corner-l': 12,
9
+ 'corner-xl': 16,
10
+ 'corner-xxl': 32,
11
+ 'corner-round': 1000,
12
+ };
13
+
14
+ exports.corners = corners;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Elevation levels for UI component types
5
+ */
6
+ const elevations = {
7
+ 'elevation-below-surface': -100, // items hidden from view
8
+ 'elevation-surface': 0, // default
9
+ 'elevation-float': 100, // toolbars, fab buttons, etc.
10
+ 'elevation-describe': 200, // tooltips, info, etc.
11
+ 'elevation-status': 300, // status bars, toasts, etc.
12
+ 'elevation-notify': 400, // alerts, and other critical status, etc.
13
+ 'elevation-overlay': 500, // overlay covers, etc.
14
+ 'elevation-confirm': 600, // conformation dialogs, etc. requiring action to dismiss
15
+ };
16
+
17
+ exports.elevations = elevations;