@ornikar/kitt-universal 9.3.2 → 9.6.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 (68) hide show
  1. package/dist/definitions/Actions/Actions.d.ts +13 -0
  2. package/dist/definitions/Actions/Actions.d.ts.map +1 -0
  3. package/dist/definitions/Actions/ActionsButton.d.ts +9 -0
  4. package/dist/definitions/Actions/ActionsButton.d.ts.map +1 -0
  5. package/dist/definitions/Actions/ActionsItem.d.ts +12 -0
  6. package/dist/definitions/Actions/ActionsItem.d.ts.map +1 -0
  7. package/dist/definitions/Choices/ChoiceItem.d.ts +38 -0
  8. package/dist/definitions/Choices/ChoiceItem.d.ts.map +1 -0
  9. package/dist/definitions/Choices/ChoiceItemContainer.d.ts +10 -0
  10. package/dist/definitions/Choices/ChoiceItemContainer.d.ts.map +1 -0
  11. package/dist/definitions/Choices/Choices.d.ts +33 -0
  12. package/dist/definitions/Choices/Choices.d.ts.map +1 -0
  13. package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts +14 -0
  14. package/dist/definitions/Choices/hooks/useNativeAnimation.d.ts.map +1 -0
  15. package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts +7 -0
  16. package/dist/definitions/Choices/hooks/useNativeAnimation.web.d.ts.map +1 -0
  17. package/dist/definitions/IconButton/IconButton.d.ts +1 -1
  18. package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
  19. package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts +1 -1
  20. package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts.map +1 -1
  21. package/dist/definitions/forms/InputField/InputField.d.ts.map +1 -1
  22. package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
  23. package/dist/definitions/index.d.ts +7 -0
  24. package/dist/definitions/index.d.ts.map +1 -1
  25. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +15 -15
  26. package/dist/definitions/story-components/StoryBlock.d.ts +1 -1
  27. package/dist/definitions/test-utils/TestWrapper.d.ts +7 -0
  28. package/dist/definitions/test-utils/TestWrapper.d.ts.map +1 -0
  29. package/dist/definitions/themes/default.d.ts +8 -1
  30. package/dist/definitions/themes/default.d.ts.map +1 -1
  31. package/dist/definitions/themes/late-ocean/choices.d.ts +35 -0
  32. package/dist/definitions/themes/late-ocean/choices.d.ts.map +1 -0
  33. package/dist/definitions/themes/late-ocean/forms.d.ts +7 -1
  34. package/dist/definitions/themes/late-ocean/forms.d.ts.map +1 -1
  35. package/dist/definitions/themes/late-ocean/inputField.d.ts +7 -1
  36. package/dist/definitions/themes/late-ocean/inputField.d.ts.map +1 -1
  37. package/dist/definitions/typography/Typography.d.ts +1 -0
  38. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  39. package/dist/definitions/typography/TypographyLink.d.ts +1 -1
  40. package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
  41. package/dist/index-browser-all.es.android.js +917 -432
  42. package/dist/index-browser-all.es.android.js.map +1 -1
  43. package/dist/index-browser-all.es.ios.js +917 -432
  44. package/dist/index-browser-all.es.ios.js.map +1 -1
  45. package/dist/index-browser-all.es.js +917 -432
  46. package/dist/index-browser-all.es.js.map +1 -1
  47. package/dist/index-browser-all.es.web.js +995 -591
  48. package/dist/index-browser-all.es.web.js.map +1 -1
  49. package/dist/index-node-14.17.cjs.js +933 -477
  50. package/dist/index-node-14.17.cjs.js.map +1 -1
  51. package/dist/index-node-14.17.cjs.web.css +1 -1
  52. package/dist/index-node-14.17.cjs.web.js +824 -449
  53. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  54. package/dist/linaria-themes-browser-all.es.android.js +41 -1
  55. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  56. package/dist/linaria-themes-browser-all.es.ios.js +41 -1
  57. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  58. package/dist/linaria-themes-browser-all.es.js +41 -1
  59. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  60. package/dist/linaria-themes-browser-all.es.web.js +41 -1
  61. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  62. package/dist/linaria-themes-node-14.17.cjs.js +41 -1
  63. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  64. package/dist/linaria-themes-node-14.17.cjs.web.js +41 -1
  65. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  66. package/dist/styles.css +1 -1
  67. package/dist/tsbuildinfo +1 -1
  68. package/package.json +27 -2
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const nativeBase = require('native-base');
6
+ const react = require('react');
7
+ const react$1 = require('@linaria/react');
5
8
  const BabelPluginStyledComponentsReactNative = require('react-native');
6
- const kittIcons = require('@ornikar/kitt-icons');
7
9
  const styled = require('styled-components/native');
8
- const react = require('react');
9
10
  const jsxRuntime = require('react/jsx-runtime');
10
- const nativeBase = require('native-base');
11
- const react$1 = require('@linaria/react');
11
+ const kittIcons = require('@ornikar/kitt-icons');
12
12
  const twemojiParser = require('twemoji-parser');
13
13
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
14
14
  const reactPortal = require('react-portal');
@@ -19,36 +19,224 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
 
20
20
  const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
21
21
 
22
- const defaultIconSize = 20;
23
- const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
24
- displayName: "Icon__IconContainer",
25
- componentId: "kitt-universal__sc-usm0ol-0"
26
- })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
27
- $color
28
- }) => $color, ({
29
- $size
30
- }) => $size, ({
31
- $size
32
- }) => $size, ({
33
- $align = 'auto'
34
- }) => $align);
35
- function Icon({
36
- icon,
37
- size = defaultIconSize,
38
- align,
39
- color
40
- }) {
41
- const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
42
- color
43
- });
44
- return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
45
- $align: align,
46
- $size: size,
47
- $color: color,
48
- children: clonedIcon
22
+ const Stack = nativeBase.Stack;
23
+ const VStack = nativeBase.VStack;
24
+ const HStack = nativeBase.HStack;
25
+
26
+ function warn(message) {
27
+ if (process.env.NODE_ENV !== 'production') {
28
+ console.warn(message);
29
+ }
30
+ }
31
+ function deprecatedMessage(symbol, deprecation, replaceBy) {
32
+ const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
33
+ warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
34
+ }
35
+ function deprecatedInComponent(component, deprecation, replaceBy) {
36
+ deprecatedMessage(`<${component} />`, deprecation, replaceBy);
37
+ }
38
+
39
+ // type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
40
+ // type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
41
+ // export function withTheme<Props extends { theme: DefaultTheme }, C>(
42
+ // WrappedComponent: ComponentType<Props> & C,
43
+ // ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
44
+ // return function ThemedComponent(props) {
45
+ // const theme = useTheme();
46
+ // return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
47
+ // };
48
+ // }
49
+ function withTheme(WrappedComponent) {
50
+ // eslint-disable-next-line prefer-arrow-callback
51
+ return /*#__PURE__*/react.forwardRef(function (props, ref) {
52
+ const theme = /*#__PURE__*/styled.useTheme();
53
+ return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
54
+ ref: ref,
55
+ theme: theme,
56
+ ...props
57
+ });
49
58
  });
50
59
  }
51
60
 
61
+ const hasVariant = (button, variant) => {
62
+ return variant in button;
63
+ };
64
+
65
+ function getVariantValuesIfExist(theme, type, variant) {
66
+ const button = theme.kitt.button[type];
67
+
68
+ if (hasVariant(button, variant)) {
69
+ return button[variant];
70
+ }
71
+
72
+ return theme.kitt.button[type].default;
73
+ }
74
+
75
+ function isSubtle(type) {
76
+ return type.startsWith('subtle');
77
+ }
78
+
79
+ const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
80
+ name: "AnimatedButtonPressableContainer",
81
+ class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
82
+ vars: {
83
+ "a1vkj3mh-0": [({
84
+ $isStretch
85
+ }) => $isStretch ? 'inherit' : 'inline-flex'],
86
+ "a1vkj3mh-1": [({
87
+ $isStretch
88
+ }) => $isStretch ? 'stretch' : 'baseline'],
89
+ "a1vkj3mh-3": [({
90
+ theme
91
+ }) => theme.kitt.button.scale.medium.hover],
92
+ "a1vkj3mh-4": [({
93
+ theme,
94
+ $isDisabled
95
+ }) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
96
+ "a1vkj3mh-5": [({
97
+ theme,
98
+ $type,
99
+ $variant,
100
+ $isDisabled
101
+ }) => {
102
+ if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
103
+ return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
104
+ }],
105
+ "a1vkj3mh-6": [({
106
+ theme
107
+ }) => {
108
+ const {
109
+ duration,
110
+ timingFunction
111
+ } = theme.kitt.button.transition;
112
+ return `color, background, border-color, ${duration} ${timingFunction}`;
113
+ }],
114
+ "a1vkj3mh-7": [({
115
+ theme
116
+ }) => theme.kitt.button.borderRadius, "px"],
117
+ "a1vkj3mh-8": [({
118
+ theme
119
+ }) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
120
+ "a1vkj3mh-9": [({
121
+ $isDisabled
122
+ }) => $isDisabled ? 1 : 0],
123
+ "a1vkj3mh-10": [({
124
+ theme
125
+ }) => `-${theme.kitt.button.borderWidth.disabled}px`],
126
+ "a1vkj3mh-12": [({
127
+ theme
128
+ }) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
129
+ "a1vkj3mh-14": [({
130
+ theme
131
+ }) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
132
+ "a1vkj3mh-15": [({
133
+ theme,
134
+ $type,
135
+ $variant
136
+ }) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
137
+ "a1vkj3mh-16": [({
138
+ theme
139
+ }) => `-${theme.kitt.button.borderWidth.focus}px`],
140
+ "a1vkj3mh-18": [({
141
+ theme,
142
+ $type,
143
+ $isDisabled
144
+ }) => {
145
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
146
+
147
+ if (isSubtle($type)) {
148
+ return theme.kitt.button[$type].default.color;
149
+ }
150
+
151
+ return 'inherit';
152
+ }],
153
+ "a1vkj3mh-19": [({
154
+ theme,
155
+ $type,
156
+ $isDisabled
157
+ }) => {
158
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
159
+
160
+ if (isSubtle($type)) {
161
+ return theme.kitt.button[$type].default.hoverColor;
162
+ }
163
+
164
+ return 'inherit';
165
+ }],
166
+ "a1vkj3mh-20": [({
167
+ theme,
168
+ $type,
169
+ $isDisabled
170
+ }) => {
171
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
172
+
173
+ if (isSubtle($type)) {
174
+ return theme.kitt.button[$type].default.activeColor;
175
+ }
176
+
177
+ return 'inherit';
178
+ }]
179
+ }
180
+ }));
181
+ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
182
+ $type,
183
+ $variant,
184
+ $isStretch,
185
+ disabled,
186
+ ...props
187
+ }, ref) => {
188
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
189
+ ref: ref,
190
+ $type: $type,
191
+ $variant: $variant,
192
+ $isDisabled: !!disabled,
193
+ $isStretch: $isStretch,
194
+ children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
195
+ disabled: disabled,
196
+ ...props
197
+ })
198
+ });
199
+ });
200
+
201
+ const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
202
+ displayName: "BaseStyledButtonPressable",
203
+ componentId: "kitt-universal__sc-4k8lse-0"
204
+ })(["position:relative;min-width:", "px;max-width:", ";width:", ";min-height:", "px;border-radius:", "px;flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], ({
205
+ theme
206
+ }) => theme.kitt.button.minWidth, ({
207
+ theme,
208
+ $isStretch
209
+ }) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
210
+ $isStretch
211
+ }) => $isStretch ? '100%' : 'auto', ({
212
+ theme
213
+ }) => theme.kitt.button.minHeight, ({
214
+ theme
215
+ }) => theme.kitt.button.borderRadius, ({
216
+ theme,
217
+ $isDisabled,
218
+ $type,
219
+ $variant
220
+ }) => {
221
+ if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
222
+ return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
223
+ }, ({
224
+ theme,
225
+ $size,
226
+ $isDisabled
227
+ }) => {
228
+ const {
229
+ large,
230
+ default: defaultPadding,
231
+ disabled: disabledPadding,
232
+ xLarge
233
+ } = theme.kitt.button.contentPadding;
234
+ if ($size === 'large') return large;
235
+ if ($size === 'xlarge') return xLarge;
236
+ if ($isDisabled) return disabledPadding;
237
+ return defaultPadding;
238
+ });
239
+
52
240
  const KittBreakpoints = {
53
241
  /**
54
242
  * min-width: 0
@@ -111,8 +299,14 @@ const TypographyColorContext = /*#__PURE__*/react.createContext('black');
111
299
  function useTypographyColor() {
112
300
  return react.useContext(TypographyColorContext);
113
301
  }
302
+ const TypographyDefaultColorContext = /*#__PURE__*/react.createContext(undefined);
303
+
304
+ function useTypographyDefaultColor() {
305
+ return react.useContext(TypographyDefaultColorContext);
306
+ }
114
307
  /** @deprecated use native-base instead for SSR compatibility */
115
308
 
309
+
116
310
  const getTypographyTypeConfigKey = theme => {
117
311
  const isMediumOrAbove = theme.responsive.matchWindowSize({
118
312
  minWidth: KittBreakpoints.MEDIUM
@@ -144,6 +338,11 @@ function createNativeBaseFontSize(type) {
144
338
  });
145
339
  return fontSizeForNativeBase;
146
340
  }
341
+
342
+ function getNBThemeColorFromColorProps(colorName) {
343
+ return colorName ? `kitt.typography.${colorName}` : undefined;
344
+ }
345
+
147
346
  function Typography({
148
347
  accessibilityRole,
149
348
  base: legacyBase,
@@ -163,6 +362,7 @@ function Typography({
163
362
  ...otherProps
164
363
  }) {
165
364
  const isHeaderTypographyInContext = react.useContext(IsHeaderTypographyContext);
365
+ const defaultColor = useTypographyDefaultColor();
166
366
  const hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
167
367
  const baseOrDefaultToBody = hasTypographyAncestor ? type.base : type.base ?? 'body';
168
368
  const isHeader = isTypographyHeader(baseOrDefaultToBody, isHeaderTypographyInContext);
@@ -179,14 +379,16 @@ function Typography({
179
379
  });
180
380
  }
181
381
 
382
+ const currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
383
+
182
384
  const text = /*#__PURE__*/jsxRuntime.jsx(nativeBase.Text, {
183
385
  accessibilityRole: accessibilityRole || undefined,
184
386
  fontSize: fontSizeForNativeBase,
185
387
  lineHeight: hasTypographyAncestor ? undefined : fontSizeForNativeBase,
186
388
  fontWeight: isHeader ? `headers.${nonNullableVariant}` : `bodies.${nonNullableVariant}`,
187
389
  fontFamily: isHeader ? `headers.${nonNullableVariant}` : `bodies.${nonNullableVariant}`,
188
- color: color ? `kitt.typography.${color}` : undefined,
189
- textDecorationColor: color ? `kitt.typography.${color}` : undefined,
390
+ color: getNBThemeColorFromColorProps(currentColor),
391
+ textDecorationColor: getNBThemeColorFromColorProps(currentColor),
190
392
  ...otherProps
191
393
  });
192
394
 
@@ -230,6 +432,7 @@ const createHeading = (level, defaultBase) => {
230
432
  return TypographyHeading;
231
433
  };
232
434
 
435
+ Typography.SetDefaultColor = TypographyDefaultColorContext.Provider;
233
436
  Typography.Text = TypographyText;
234
437
  Typography.Paragraph = TypographyParagraph;
235
438
  Typography.Header1 = createHeading(1);
@@ -250,304 +453,39 @@ Typography.h3 = createHeading(3, 'header3');
250
453
  /** @deprecated use Typography.Header4 */
251
454
 
252
455
  Typography.h4 = createHeading(4, 'header4');
253
- /** @deprecated use Typography.Header6 */
254
-
255
- Typography.h5 = createHeading(5, 'header5');
256
-
257
- const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
258
-
259
- const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
260
- displayName: "Avatar__StyledAvatarView",
261
- componentId: "kitt-universal__sc-9miubv-0"
262
- })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
263
- theme,
264
- $isRound,
265
- $size,
266
- $sizeVariant
267
- }) => {
268
- if ($isRound) return `${$size / 2}px`;
269
- return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
270
- }, ({
271
- theme,
272
- $isLight
273
- }) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
274
- $size
275
- }) => $size, ({
276
- $size
277
- }) => $size);
278
-
279
- function AvatarContent({
280
- size,
281
- src,
282
- firstname,
283
- lastname,
284
- alt,
285
- isLight,
286
- sizeVariant
287
- }) {
288
- if (src) {
289
- return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
290
- source: {
291
- uri: src
292
- },
293
- style: {
294
- width: size,
295
- height: size
296
- },
297
- accessibilityLabel: alt
298
- });
299
- }
300
-
301
- if (firstname && lastname) {
302
- return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
303
- base: sizeVariant === 'large' ? 'body-large' : 'body-small',
304
- variant: sizeVariant === 'large' ? 'bold' : 'regular',
305
- color: isLight ? 'black' : 'white',
306
- children: getInitials(firstname, lastname)
307
- });
308
- }
309
-
310
- return /*#__PURE__*/jsxRuntime.jsx(Icon, {
311
- icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
312
- color: isLight ? 'black' : 'white',
313
- size: size / 2
314
- });
315
- }
316
-
317
- function Avatar({
318
- size = 40,
319
- round,
320
- light,
321
- sizeVariant,
322
- ...props
323
- }) {
324
- return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
325
- $size: size,
326
- $isRound: round,
327
- $isLight: light,
328
- $sizeVariant: sizeVariant,
329
- children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
330
- size: size,
331
- isLight: light,
332
- sizeVariant: sizeVariant,
333
- ...props
334
- })
335
- });
336
- }
337
-
338
- function warn(message) {
339
- if (process.env.NODE_ENV !== 'production') {
340
- console.warn(message);
341
- }
342
- }
343
- function deprecatedMessage(symbol, deprecation, replaceBy) {
344
- const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
345
- warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
346
- }
347
- function deprecatedInComponent(component, deprecation, replaceBy) {
348
- deprecatedMessage(`<${component} />`, deprecation, replaceBy);
349
- }
350
-
351
- // type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
352
- // type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
353
- // export function withTheme<Props extends { theme: DefaultTheme }, C>(
354
- // WrappedComponent: ComponentType<Props> & C,
355
- // ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
356
- // return function ThemedComponent(props) {
357
- // const theme = useTheme();
358
- // return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
359
- // };
360
- // }
361
- function withTheme(WrappedComponent) {
362
- // eslint-disable-next-line prefer-arrow-callback
363
- return /*#__PURE__*/react.forwardRef(function (props, ref) {
364
- const theme = /*#__PURE__*/styled.useTheme();
365
- return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
366
- ref: ref,
367
- theme: theme,
368
- ...props
369
- });
370
- });
371
- }
372
-
373
- const hasVariant = (button, variant) => {
374
- return variant in button;
375
- };
376
-
377
- function getVariantValuesIfExist(theme, type, variant) {
378
- const button = theme.kitt.button[type];
379
-
380
- if (hasVariant(button, variant)) {
381
- return button[variant];
382
- }
383
-
384
- return theme.kitt.button[type].default;
385
- }
386
-
387
- function isSubtle(type) {
388
- return type.startsWith('subtle');
389
- }
390
-
391
- const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
392
- name: "AnimatedButtonPressableContainer",
393
- class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
394
- vars: {
395
- "a1vkj3mh-0": [({
396
- $isStretch
397
- }) => $isStretch ? 'inherit' : 'inline-flex'],
398
- "a1vkj3mh-1": [({
399
- $isStretch
400
- }) => $isStretch ? 'stretch' : 'baseline'],
401
- "a1vkj3mh-3": [({
402
- theme
403
- }) => theme.kitt.button.scale.medium.hover],
404
- "a1vkj3mh-4": [({
405
- theme,
406
- $isDisabled
407
- }) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
408
- "a1vkj3mh-5": [({
409
- theme,
410
- $type,
411
- $variant,
412
- $isDisabled
413
- }) => {
414
- if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
415
- return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
416
- }],
417
- "a1vkj3mh-6": [({
418
- theme
419
- }) => {
420
- const {
421
- duration,
422
- timingFunction
423
- } = theme.kitt.button.transition;
424
- return `color, background, border-color, ${duration} ${timingFunction}`;
425
- }],
426
- "a1vkj3mh-7": [({
427
- theme
428
- }) => theme.kitt.button.borderRadius, "px"],
429
- "a1vkj3mh-8": [({
430
- theme
431
- }) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
432
- "a1vkj3mh-9": [({
433
- $isDisabled
434
- }) => $isDisabled ? 1 : 0],
435
- "a1vkj3mh-10": [({
436
- theme
437
- }) => `-${theme.kitt.button.borderWidth.disabled}px`],
438
- "a1vkj3mh-12": [({
439
- theme
440
- }) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
441
- "a1vkj3mh-14": [({
442
- theme
443
- }) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
444
- "a1vkj3mh-15": [({
445
- theme,
446
- $type,
447
- $variant
448
- }) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
449
- "a1vkj3mh-16": [({
450
- theme
451
- }) => `-${theme.kitt.button.borderWidth.focus}px`],
452
- "a1vkj3mh-18": [({
453
- theme,
454
- $type,
455
- $isDisabled
456
- }) => {
457
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
458
-
459
- if (isSubtle($type)) {
460
- return theme.kitt.button[$type].default.color;
461
- }
462
-
463
- return 'inherit';
464
- }],
465
- "a1vkj3mh-19": [({
466
- theme,
467
- $type,
468
- $isDisabled
469
- }) => {
470
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
471
-
472
- if (isSubtle($type)) {
473
- return theme.kitt.button[$type].default.hoverColor;
474
- }
475
-
476
- return 'inherit';
477
- }],
478
- "a1vkj3mh-20": [({
479
- theme,
480
- $type,
481
- $isDisabled
482
- }) => {
483
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
456
+ /** @deprecated use Typography.Header6 */
484
457
 
485
- if (isSubtle($type)) {
486
- return theme.kitt.button[$type].default.activeColor;
487
- }
458
+ Typography.h5 = createHeading(5, 'header5');
488
459
 
489
- return 'inherit';
490
- }]
491
- }
492
- }));
493
- const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
494
- $type,
495
- $variant,
496
- $isStretch,
497
- disabled,
498
- ...props
499
- }, ref) => {
500
- return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
501
- ref: ref,
502
- $type: $type,
503
- $variant: $variant,
504
- $isDisabled: !!disabled,
505
- $isStretch: $isStretch,
506
- children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
507
- disabled: disabled,
508
- ...props
509
- })
460
+ const defaultIconSize = 20;
461
+ const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
462
+ displayName: "Icon__IconContainer",
463
+ componentId: "kitt-universal__sc-usm0ol-0"
464
+ })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
465
+ $color
466
+ }) => $color, ({
467
+ $size
468
+ }) => $size, ({
469
+ $size
470
+ }) => $size, ({
471
+ $align = 'auto'
472
+ }) => $align);
473
+ function Icon({
474
+ icon,
475
+ size = defaultIconSize,
476
+ align,
477
+ color
478
+ }) {
479
+ const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
480
+ color
510
481
  });
511
- });
512
-
513
- const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
514
- displayName: "BaseStyledButtonPressable",
515
- componentId: "kitt-universal__sc-4k8lse-0"
516
- })(["position:relative;min-width:", "px;max-width:", ";width:", ";min-height:", "px;border-radius:", "px;flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], ({
517
- theme
518
- }) => theme.kitt.button.minWidth, ({
519
- theme,
520
- $isStretch
521
- }) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
522
- $isStretch
523
- }) => $isStretch ? '100%' : 'auto', ({
524
- theme
525
- }) => theme.kitt.button.minHeight, ({
526
- theme
527
- }) => theme.kitt.button.borderRadius, ({
528
- theme,
529
- $isDisabled,
530
- $type,
531
- $variant
532
- }) => {
533
- if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
534
- return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
535
- }, ({
536
- theme,
537
- $size,
538
- $isDisabled
539
- }) => {
540
- const {
541
- large,
542
- default: defaultPadding,
543
- disabled: disabledPadding,
544
- xLarge
545
- } = theme.kitt.button.contentPadding;
546
- if ($size === 'large') return large;
547
- if ($size === 'xlarge') return xLarge;
548
- if ($isDisabled) return disabledPadding;
549
- return defaultPadding;
550
- });
482
+ return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
483
+ $align: align,
484
+ $size: size,
485
+ $color: color,
486
+ children: clonedIcon
487
+ });
488
+ }
551
489
 
552
490
  function TypographyIconSpecifiedColor({
553
491
  color,
@@ -689,7 +627,7 @@ function ButtonContentChildren({
689
627
  };
690
628
  return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
691
629
  children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
692
- testID: "button-left-icon",
630
+ testID: "button.ButtonContent.leftButtonIcon",
693
631
  icon: icon
694
632
  }) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
695
633
  base: "body",
@@ -779,45 +717,257 @@ const Button = /*#__PURE__*/react.forwardRef(({
779
717
  throw new Error('variant=ghost is only allowed with type=primary or default');
780
718
  }
781
719
 
782
- if (large || xLarge) {
783
- const deprecatedProp = large ? 'large' : 'xLarge';
784
- deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
720
+ if (large || xLarge) {
721
+ const deprecatedProp = large ? 'large' : 'xLarge';
722
+ deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
723
+ }
724
+
725
+ const size = getButtonSize({
726
+ large,
727
+ xLarge,
728
+ size: sizeProp
729
+ });
730
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
731
+ ref: ref,
732
+ accessibilityRole: accessibilityRole,
733
+ testID: testID,
734
+ href: href,
735
+ hrefAttrs: hrefAttrs,
736
+ disabled: disabled,
737
+ $isStretch: stretch,
738
+ $type: type,
739
+ $variant: variant,
740
+ onPress: onPress,
741
+ children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
742
+ $type: type,
743
+ $variant: variant,
744
+ $isStretch: stretch,
745
+ $size: size,
746
+ $isDisabled: disabled,
747
+ children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
748
+ type: type,
749
+ variant: variant,
750
+ $isStretch: stretch,
751
+ isDisabled: disabled,
752
+ icon: icon,
753
+ iconPosition: iconPosition,
754
+ children: children
755
+ }), null]
756
+ })
757
+ });
758
+ });
759
+
760
+ const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
761
+ name: "StyledSpinningIconContainer",
762
+ class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
763
+ }));
764
+ function SpinningIcon({
765
+ icon,
766
+ color
767
+ }) {
768
+ const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
769
+ color
770
+ });
771
+ return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
772
+ children: clonedIcon
773
+ });
774
+ }
775
+
776
+ function LoaderIcon({
777
+ color
778
+ }) {
779
+ return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
780
+ color: color,
781
+ icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
782
+ });
783
+ }
784
+
785
+ const View = nativeBase.View;
786
+ const ScrollView = nativeBase.ScrollView;
787
+ const Pressable = nativeBase.Pressable;
788
+
789
+ function matchWindowSize({
790
+ width,
791
+ height
792
+ }, {
793
+ minWidth,
794
+ maxWidth,
795
+ minHeight,
796
+ maxHeight
797
+ }) {
798
+ const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
799
+ const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
800
+ return hasWidthMatched && hasHeightMatched;
801
+ }
802
+ function useMatchWindowSize(options) {
803
+ const {
804
+ width,
805
+ height
806
+ } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
807
+ return matchWindowSize({
808
+ width,
809
+ height
810
+ }, options);
811
+ }
812
+
813
+ function ActionsItem({
814
+ as,
815
+ onPress,
816
+ disabled,
817
+ icon,
818
+ ...props
819
+ }) {
820
+ const isMedium = useMatchWindowSize({
821
+ minWidth: KittBreakpoints.MEDIUM
822
+ });
823
+ const [isLoading, setIsLoading] = react.useState(false);
824
+ const mountedRef = react.useRef(false); // effect just for tracking mounted state, as onPress can unmount the ActionButton
825
+
826
+ react.useEffect(() => {
827
+ mountedRef.current = true;
828
+ return () => {
829
+ mountedRef.current = false;
830
+ };
831
+ }, []);
832
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
833
+ children: /*#__PURE__*/jsxRuntime.jsx(as, { ...props,
834
+ stretch: !isMedium ? true : undefined,
835
+ disabled: isLoading ? true : disabled,
836
+ icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
837
+ onPress: e => {
838
+ (async () => {
839
+ if (!onPress) return;
840
+ setIsLoading(true);
841
+
842
+ try {
843
+ await onPress(e);
844
+
845
+ if (mountedRef.current) {
846
+ setIsLoading(false);
847
+ }
848
+ } catch (err) {
849
+ if (mountedRef.current) {
850
+ setIsLoading(false);
851
+ }
852
+
853
+ throw err;
854
+ }
855
+ })();
856
+ }
857
+ })
858
+ });
859
+ }
860
+
861
+ function ActionsButton({ ...props
862
+ }) {
863
+ return /*#__PURE__*/jsxRuntime.jsx(ActionsItem, {
864
+ as: Button,
865
+ ...props
866
+ });
867
+ }
868
+
869
+ function Actions({
870
+ children,
871
+ ...props
872
+ }) {
873
+ return /*#__PURE__*/jsxRuntime.jsx(Stack, {
874
+ alignItems: {
875
+ base: 'stretch',
876
+ medium: 'center'
877
+ },
878
+ direction: {
879
+ base: 'column',
880
+ medium: 'row'
881
+ },
882
+ flex: 1,
883
+ ...props,
884
+ space: "kitt.3",
885
+ children: children
886
+ });
887
+ }
888
+ Actions.Button = ActionsButton;
889
+ Actions.Item = ActionsItem;
890
+
891
+ const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
892
+
893
+ const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
894
+ displayName: "Avatar__StyledAvatarView",
895
+ componentId: "kitt-universal__sc-9miubv-0"
896
+ })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
897
+ theme,
898
+ $isRound,
899
+ $size,
900
+ $sizeVariant
901
+ }) => {
902
+ if ($isRound) return `${$size / 2}px`;
903
+ return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
904
+ }, ({
905
+ theme,
906
+ $isLight
907
+ }) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
908
+ $size
909
+ }) => $size, ({
910
+ $size
911
+ }) => $size);
912
+
913
+ function AvatarContent({
914
+ size,
915
+ src,
916
+ firstname,
917
+ lastname,
918
+ alt,
919
+ isLight,
920
+ sizeVariant
921
+ }) {
922
+ if (src) {
923
+ return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
924
+ source: {
925
+ uri: src
926
+ },
927
+ style: {
928
+ width: size,
929
+ height: size
930
+ },
931
+ accessibilityLabel: alt
932
+ });
933
+ }
934
+
935
+ if (firstname && lastname) {
936
+ return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
937
+ base: sizeVariant === 'large' ? 'body-large' : 'body-small',
938
+ variant: sizeVariant === 'large' ? 'bold' : 'regular',
939
+ color: isLight ? 'black' : 'white',
940
+ children: getInitials(firstname, lastname)
941
+ });
785
942
  }
786
943
 
787
- const size = getButtonSize({
788
- large,
789
- xLarge,
790
- size: sizeProp
944
+ return /*#__PURE__*/jsxRuntime.jsx(Icon, {
945
+ icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
946
+ color: isLight ? 'black' : 'white',
947
+ size: size / 2
791
948
  });
792
- return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
793
- ref: ref,
794
- accessibilityRole: accessibilityRole,
795
- testID: testID,
796
- href: href,
797
- hrefAttrs: hrefAttrs,
798
- disabled: disabled,
799
- $isStretch: stretch,
800
- $type: type,
801
- $variant: variant,
802
- onPress: onPress,
803
- children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
804
- $type: type,
805
- $variant: variant,
806
- $isStretch: stretch,
807
- $size: size,
808
- $isDisabled: disabled,
809
- children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
810
- type: type,
811
- variant: variant,
812
- $isStretch: stretch,
813
- isDisabled: disabled,
814
- icon: icon,
815
- iconPosition: iconPosition,
816
- children: children
817
- }), null]
949
+ }
950
+
951
+ function Avatar({
952
+ size = 40,
953
+ round,
954
+ light,
955
+ sizeVariant,
956
+ ...props
957
+ }) {
958
+ return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
959
+ $size: size,
960
+ $isRound: round,
961
+ $isLight: light,
962
+ $sizeVariant: sizeVariant,
963
+ children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
964
+ size: size,
965
+ isLight: light,
966
+ sizeVariant: sizeVariant,
967
+ ...props
818
968
  })
819
969
  });
820
- });
970
+ }
821
971
 
822
972
  const Container$3 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
823
973
  displayName: "Card__Container",
@@ -845,6 +995,261 @@ function Card({
845
995
  });
846
996
  }
847
997
 
998
+ const useNativeAnimation = () => {
999
+ return {
1000
+ onPressIn: () => {},
1001
+ onPressOut: () => {},
1002
+ backgroundStyles: undefined
1003
+ };
1004
+ };
1005
+
1006
+ function getCurrentTextColor({
1007
+ isDisabled,
1008
+ isSelected,
1009
+ isPressed,
1010
+ isHovered
1011
+ }) {
1012
+ if (isDisabled) return 'black-light';
1013
+ if (isSelected && isHovered) return 'white';
1014
+ if (isSelected || isPressed) return 'white';
1015
+ return 'black';
1016
+ }
1017
+
1018
+ function getBorderRadius(defaultRadius, variant) {
1019
+ // The clean way to have the rounded effect would have been to know the children height since radius >= height * 0.5
1020
+ // We don't control over the height of the rendered children we just go with a arbitrary really high value
1021
+ if (variant === 'rounded') return 800;
1022
+ return defaultRadius;
1023
+ }
1024
+
1025
+ const DisabledBorder = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
1026
+ displayName: "ChoiceItem__DisabledBorder",
1027
+ componentId: "kitt-universal__sc-wuv3y6-0"
1028
+ })(["border-radius:", "px;", ";"], ({
1029
+ theme,
1030
+ $variant
1031
+ }) => getBorderRadius(theme.kitt.choices.item.borderRadius, $variant), ({
1032
+ theme
1033
+ }) => {
1034
+ const {
1035
+ width,
1036
+ color
1037
+ } = theme.kitt.choices.item.disabled.border;
1038
+ return styled.css(["border:", "px solid ", ";"], width, color);
1039
+ });
1040
+ const ChoiceItemView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
1041
+ displayName: "ChoiceItem__ChoiceItemView",
1042
+ componentId: "kitt-universal__sc-wuv3y6-1"
1043
+ })(["position:relative;border-radius:", "px;background-color:", ";", ";", ""], ({
1044
+ theme,
1045
+ $variant
1046
+ }) => getBorderRadius(theme.kitt.choices.item.borderRadius, $variant), ({
1047
+ theme,
1048
+ $isHovered,
1049
+ $isPressed,
1050
+ $isDisabled,
1051
+ $isSelected
1052
+ }) => {
1053
+ const {
1054
+ hoverWhenSelected,
1055
+ hover,
1056
+ disabled,
1057
+ selected,
1058
+ pressed,
1059
+ default: defaultBackground
1060
+ } = theme.kitt.choices.item.backgroundColor;
1061
+ if ($isDisabled) return disabled;
1062
+ if ($isSelected && $isHovered) return hoverWhenSelected;
1063
+ if ($isPressed) return pressed;
1064
+ if ($isHovered) return hover;
1065
+ if ($isSelected) return selected;
1066
+ return defaultBackground;
1067
+ }, ({
1068
+ theme
1069
+ }) => {
1070
+ const {
1071
+ base,
1072
+ small
1073
+ } = theme.kitt.choices.item.padding;
1074
+ return theme.responsive.ifWindowSizeMatches({
1075
+ minWidth: KittBreakpoints.SMALL
1076
+ }, styled.css(["padding:", "px;"], small), styled.css(["padding:", "px;"], base));
1077
+ }, ({
1078
+ theme
1079
+ }) => {
1080
+ const {
1081
+ property,
1082
+ duration,
1083
+ timingFunction
1084
+ } = theme.kitt.choices.item.transition;
1085
+ return styled.css(["transition:", " ", "ms ", ";"], property, duration, timingFunction);
1086
+ });
1087
+ function ChoiceItem({
1088
+ type = 'button',
1089
+ value,
1090
+ selected,
1091
+ disabled,
1092
+ variant,
1093
+ children,
1094
+ isPressedInternal,
1095
+ isHoveredInternal,
1096
+ onPress,
1097
+ onChange,
1098
+ onBlur,
1099
+ onFocus
1100
+ }) {
1101
+ const {
1102
+ onPressIn,
1103
+ onPressOut,
1104
+ backgroundStyles
1105
+ } = useNativeAnimation();
1106
+
1107
+ const handleChange = () => {
1108
+ if (!onChange) return; // Checkbox can be toggled
1109
+
1110
+ if (type === 'checkbox') {
1111
+ onChange(selected ? undefined : value);
1112
+ return;
1113
+ }
1114
+
1115
+ onChange(value);
1116
+ };
1117
+
1118
+ return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
1119
+ disabled: disabled,
1120
+ accessibilityRole: type,
1121
+ accessibilityState: {
1122
+ checked: selected
1123
+ },
1124
+ onBlur: onBlur,
1125
+ onFocus: onFocus,
1126
+ onPress: e => {
1127
+ if (onFocus) onFocus(e);
1128
+ if (onPress) onPress();
1129
+ handleChange();
1130
+ if (onBlur) onBlur(e);
1131
+ },
1132
+ onPressIn: onPressIn,
1133
+ onPressOut: onPressOut,
1134
+ children: ({
1135
+ isHovered,
1136
+ isPressed
1137
+ }) => /*#__PURE__*/jsxRuntime.jsxs(ChoiceItemView, {
1138
+ style: undefined,
1139
+ $isHovered: isHovered || isHoveredInternal,
1140
+ $isDisabled: disabled,
1141
+ $isSelected: selected,
1142
+ $isPressed: isPressed || isPressedInternal,
1143
+ $variant: variant,
1144
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography.SetDefaultColor, {
1145
+ value: getCurrentTextColor({
1146
+ isDisabled: disabled,
1147
+ isSelected: selected || isPressedInternal,
1148
+ isPressed,
1149
+ isHovered: isHovered || isHoveredInternal
1150
+ }),
1151
+ children: children
1152
+ }), disabled ? /*#__PURE__*/jsxRuntime.jsx(DisabledBorder, {
1153
+ $variant: variant,
1154
+ style: BabelPluginStyledComponentsReactNative.StyleSheet.absoluteFillObject
1155
+ }) : null]
1156
+ })
1157
+ });
1158
+ }
1159
+
1160
+ const ChoiceItemContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
1161
+ displayName: "ChoiceItemContainer",
1162
+ componentId: "kitt-universal__sc-17uuimx-0"
1163
+ })(["", ""], ({
1164
+ theme,
1165
+ $isLast,
1166
+ $direction
1167
+ }) => {
1168
+ const {
1169
+ row,
1170
+ column
1171
+ } = theme.kitt.choices.spacing;
1172
+
1173
+ if ($direction === 'row') {
1174
+ return styled.css(["margin-right:", "px;"], $isLast ? 0 : row);
1175
+ }
1176
+
1177
+ return styled.css(["margin-bottom:", "px;"], $isLast ? 0 : column);
1178
+ });
1179
+
1180
+ function ChoicesContainer({
1181
+ direction,
1182
+ ...props
1183
+ }) {
1184
+ if (direction === 'row') {
1185
+ return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.ScrollView, {
1186
+ horizontal: true,
1187
+ ...props
1188
+ });
1189
+ }
1190
+
1191
+ return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.View, { ...props
1192
+ });
1193
+ }
1194
+
1195
+ function Choices({
1196
+ id,
1197
+ testID,
1198
+ type,
1199
+ direction = 'column',
1200
+ disabled,
1201
+ children,
1202
+ value,
1203
+ variant,
1204
+ onPress,
1205
+ onChange,
1206
+ onFocus,
1207
+ onBlur
1208
+ }) {
1209
+ const [currentValue, setCurrentValue] = react.useState(value);
1210
+ const isForm = type && ['radio', 'checkbox'].includes(type);
1211
+ const childrenArray = react.Children.toArray(children);
1212
+ const sharedProps = {
1213
+ type,
1214
+ disabled,
1215
+ variant,
1216
+ onPress: !isForm ? onPress : undefined,
1217
+ onChange: isForm ? newValue => {
1218
+ setCurrentValue(newValue);
1219
+ if (onChange) onChange(newValue);
1220
+ } : undefined,
1221
+ onFocus,
1222
+ onBlur
1223
+ };
1224
+ return /*#__PURE__*/jsxRuntime.jsx(ChoicesContainer, {
1225
+ direction: direction,
1226
+ testID: testID,
1227
+ nativeID: id,
1228
+ children: childrenArray.map((child, index) => {
1229
+ const element = /*#__PURE__*/react.cloneElement(child, {
1230
+ selected: isForm ? child.props.value === currentValue : undefined,
1231
+ ...sharedProps
1232
+ });
1233
+ return /*#__PURE__*/jsxRuntime.jsx(ChoiceItemContainer, {
1234
+ $direction: direction,
1235
+ $isLast: index === childrenArray.length - 1,
1236
+ children: element
1237
+ }, child.key);
1238
+ })
1239
+ });
1240
+ }
1241
+
1242
+ Choices.Item = ChoiceItem;
1243
+ function createChoicesComponent() {
1244
+ return Choices;
1245
+ }
1246
+ const ButtonChoices = createChoicesComponent();
1247
+ Choices.ButtonChoices = ButtonChoices;
1248
+ const ChoicesElements = {
1249
+ Item: ChoiceItem,
1250
+ ButtonChoices
1251
+ };
1252
+
848
1253
  function Emoji({
849
1254
  emoji,
850
1255
  size,
@@ -1148,6 +1553,39 @@ const card = {
1148
1553
  }
1149
1554
  };
1150
1555
 
1556
+ const choices = {
1557
+ spacing: {
1558
+ row: 12,
1559
+ column: 12
1560
+ },
1561
+ item: {
1562
+ borderRadius: 10,
1563
+ padding: {
1564
+ base: 16,
1565
+ small: 24
1566
+ },
1567
+ backgroundColor: {
1568
+ default: lateOceanColorPalette.black50,
1569
+ disabled: colors.disabled,
1570
+ selected: colors.primary,
1571
+ pressed: lateOceanColorPalette.lateOceanLight1,
1572
+ hover: lateOceanColorPalette.black100,
1573
+ hoverWhenSelected: lateOceanColorPalette.lateOceanLight1
1574
+ },
1575
+ disabled: {
1576
+ border: {
1577
+ width: 2,
1578
+ color: lateOceanColorPalette.black100
1579
+ }
1580
+ },
1581
+ transition: {
1582
+ property: 'all',
1583
+ duration: 300,
1584
+ timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
1585
+ }
1586
+ }
1587
+ };
1588
+
1151
1589
  const feedbackMessage = {
1152
1590
  danger: {
1153
1591
  backgroundColor: colors.danger
@@ -1319,8 +1757,14 @@ const input = {
1319
1757
  };
1320
1758
 
1321
1759
  const inputField = {
1760
+ containerPaddingTop: 5,
1761
+ containerPaddingBottom: 10,
1762
+ feedbackPaddingTop: {
1763
+ base: 5,
1764
+ small: 10
1765
+ },
1322
1766
  labelContainerPaddingBottom: 5,
1323
- iconMarginLeft: 6
1767
+ labelFeedbackMarginLeft: 6
1324
1768
  };
1325
1769
 
1326
1770
  const inputTag = {
@@ -1561,6 +2005,7 @@ const theme = {
1561
2005
  breakpoints,
1562
2006
  button,
1563
2007
  card,
2008
+ choices,
1564
2009
  feedbackMessage,
1565
2010
  forms,
1566
2011
  fullScreenModal,
@@ -1576,30 +2021,6 @@ const theme = {
1576
2021
  navigationModal
1577
2022
  };
1578
2023
 
1579
- function matchWindowSize({
1580
- width,
1581
- height
1582
- }, {
1583
- minWidth,
1584
- maxWidth,
1585
- minHeight,
1586
- maxHeight
1587
- }) {
1588
- const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
1589
- const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
1590
- return hasWidthMatched && hasHeightMatched;
1591
- }
1592
- function useMatchWindowSize(options) {
1593
- const {
1594
- width,
1595
- height
1596
- } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
1597
- return matchWindowSize({
1598
- width,
1599
- height
1600
- }, options);
1601
- }
1602
-
1603
2024
  // eslint-disable-next-line no-restricted-imports
1604
2025
  function createWindowSizeHelper(dimensions) {
1605
2026
  return {
@@ -2016,42 +2437,26 @@ function InputFeedback({
2016
2437
  });
2017
2438
  }
2018
2439
 
2019
- const FieldContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
2020
- displayName: "InputField__FieldContainer",
2021
- componentId: "kitt-universal__sc-13fkixs-0"
2022
- })(["padding:5px 0 10px;"]);
2023
- const FeedbackContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
2024
- displayName: "InputField__FeedbackContainer",
2025
- componentId: "kitt-universal__sc-13fkixs-1"
2026
- })(["", ";"], ({
2027
- theme
2028
- }) => theme.responsive.ifWindowSizeMatches({
2029
- minWidth: KittBreakpoints.SMALL
2030
- }, 'padding-top: 10px', 'padding-top: 5px'));
2031
- const FieldLabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
2032
- displayName: "InputField__FieldLabelContainer",
2033
- componentId: "kitt-universal__sc-13fkixs-2"
2034
- })(["flex-direction:row;align-items:center;padding-bottom:", "px;"], ({
2035
- theme
2036
- }) => theme.kitt.forms.inputField.labelContainerPaddingBottom);
2037
- const LabelContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
2038
- displayName: "InputField__LabelContainer",
2039
- componentId: "kitt-universal__sc-13fkixs-3"
2040
- })(["margin-right:", "px;"], ({
2041
- theme
2042
- }) => theme.kitt.forms.inputField.iconMarginLeft);
2043
2440
  function InputField({
2044
2441
  label,
2045
2442
  labelFeedback,
2046
2443
  input,
2047
2444
  feedback
2048
2445
  }) {
2049
- return /*#__PURE__*/jsxRuntime.jsxs(FieldContainer, {
2050
- children: [label ? /*#__PURE__*/jsxRuntime.jsxs(FieldLabelContainer, {
2051
- children: [/*#__PURE__*/jsxRuntime.jsx(LabelContainer, {
2446
+ const theme = /*#__PURE__*/styled.useTheme();
2447
+ return /*#__PURE__*/jsxRuntime.jsxs(View, {
2448
+ paddingTop: theme.kitt.forms.inputField.containerPaddingTop,
2449
+ paddingBottom: theme.kitt.forms.inputField.containerPaddingBottom,
2450
+ children: [label ? /*#__PURE__*/jsxRuntime.jsxs(View, {
2451
+ flexDirection: "row",
2452
+ alignItems: "center",
2453
+ paddingBottom: theme.kitt.forms.inputField.labelContainerPaddingBottom,
2454
+ children: [/*#__PURE__*/jsxRuntime.jsx(View, {
2455
+ marginRight: theme.kitt.forms.inputField.labelFeedbackMarginLeft,
2052
2456
  children: label
2053
2457
  }), labelFeedback]
2054
- }) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(FeedbackContainer, {
2458
+ }) : null, input, feedback ? /*#__PURE__*/jsxRuntime.jsx(View, {
2459
+ paddingTop: theme.kitt.forms.inputField.feedbackPaddingTop,
2055
2460
  children: feedback
2056
2461
  }) : null]
2057
2462
  });
@@ -2430,22 +2835,6 @@ function FullScreenModal({
2430
2835
  FullScreenModal.Header = FullScreenModalHeader;
2431
2836
  FullScreenModal.Body = FullScreenModalBody;
2432
2837
 
2433
- const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
2434
- name: "StyledSpinningIconContainer",
2435
- class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
2436
- }));
2437
- function SpinningIcon({
2438
- icon,
2439
- color
2440
- }) {
2441
- const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
2442
- color
2443
- });
2444
- return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
2445
- children: clonedIcon
2446
- });
2447
- }
2448
-
2449
2838
  function StyleWebWrapper({
2450
2839
  as,
2451
2840
  children,
@@ -2724,15 +3113,6 @@ ListItem.Content = ListItemContent;
2724
3113
  ListItem.SideContent = ListItemSideContent;
2725
3114
  ListItem.SideContainer = ListItemSideContainer;
2726
3115
 
2727
- function LoaderIcon({
2728
- color
2729
- }) {
2730
- return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
2731
- color: color,
2732
- icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
2733
- });
2734
- }
2735
-
2736
3116
  function IconContent({
2737
3117
  type,
2738
3118
  color
@@ -3260,14 +3640,6 @@ function KittNativeBaseProvider({
3260
3640
  });
3261
3641
  }
3262
3642
 
3263
- const Stack = nativeBase.Stack;
3264
- const VStack = nativeBase.VStack;
3265
- const HStack = nativeBase.HStack;
3266
-
3267
- const View = nativeBase.View;
3268
- const ScrollView = nativeBase.ScrollView;
3269
- const Pressable = nativeBase.Pressable;
3270
-
3271
3643
  const ViewWithPadding = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
3272
3644
  displayName: "ContentPadding__ViewWithPadding",
3273
3645
  componentId: "kitt-universal__sc-1rprqcv-0"
@@ -4461,10 +4833,12 @@ function MatchWindowSize({
4461
4833
  }
4462
4834
 
4463
4835
  exports.useWindowSize = BabelPluginStyledComponentsReactNative.useWindowDimensions;
4836
+ exports.Actions = Actions;
4464
4837
  exports.Avatar = Avatar;
4465
4838
  exports.Button = Button;
4466
4839
  exports.Card = Card;
4467
4840
  exports.Checkbox = Checkbox;
4841
+ exports.ChoicesElements = ChoicesElements;
4468
4842
  exports.DatePicker = DatePicker;
4469
4843
  exports.Emoji = Emoji;
4470
4844
  exports.ExternalAppLink = ExternalAppLink;
@@ -4525,6 +4899,7 @@ exports.TypographyIcon = TypographyIcon;
4525
4899
  exports.TypographyLink = TypographyLink;
4526
4900
  exports.VStack = VStack;
4527
4901
  exports.View = View;
4902
+ exports.createChoicesComponent = createChoicesComponent;
4528
4903
  exports.createWindowSizeHelper = createWindowSizeHelper;
4529
4904
  exports.hex2rgba = hex2rgba;
4530
4905
  exports.matchWindowSize = matchWindowSize;