@ornikar/kitt-universal 9.4.0 → 9.5.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 (34) 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.map +1 -1
  8. package/dist/definitions/IconButton/IconButton.d.ts +1 -1
  9. package/dist/definitions/IconButton/IconButton.d.ts.map +1 -1
  10. package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts +1 -1
  11. package/dist/definitions/IconButton/PressableAnimatedContainer.d.ts.map +1 -1
  12. package/dist/definitions/forms/InputText/InputTextContainer.web.d.ts +1 -1
  13. package/dist/definitions/index.d.ts +4 -0
  14. package/dist/definitions/index.d.ts.map +1 -1
  15. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +15 -15
  16. package/dist/definitions/story-components/StoryBlock.d.ts +1 -1
  17. package/dist/definitions/typography/TypographyLink.d.ts +1 -1
  18. package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
  19. package/dist/index-browser-all.es.android.js +598 -480
  20. package/dist/index-browser-all.es.android.js.map +1 -1
  21. package/dist/index-browser-all.es.ios.js +598 -480
  22. package/dist/index-browser-all.es.ios.js.map +1 -1
  23. package/dist/index-browser-all.es.js +598 -480
  24. package/dist/index-browser-all.es.js.map +1 -1
  25. package/dist/index-browser-all.es.web.js +627 -509
  26. package/dist/index-browser-all.es.web.js.map +1 -1
  27. package/dist/index-node-14.17.cjs.js +535 -456
  28. package/dist/index-node-14.17.cjs.js.map +1 -1
  29. package/dist/index-node-14.17.cjs.web.css +1 -1
  30. package/dist/index-node-14.17.cjs.web.js +464 -385
  31. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  32. package/dist/styles.css +1 -1
  33. package/dist/tsbuildinfo +1 -1
  34. package/package.json +2 -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 Animated = require('react-native-reanimated');
13
13
  const twemojiParser = require('twemoji-parser');
14
14
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
@@ -21,36 +21,224 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
21
  const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
22
22
  const Animated__default = /*#__PURE__*/_interopDefaultLegacy(Animated);
23
23
 
24
- const defaultIconSize = 20;
25
- const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
26
- displayName: "Icon__IconContainer",
27
- componentId: "kitt-universal__sc-usm0ol-0"
28
- })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
29
- $color
30
- }) => $color, ({
31
- $size
32
- }) => $size, ({
33
- $size
34
- }) => $size, ({
35
- $align = 'auto'
36
- }) => $align);
37
- function Icon({
38
- icon,
39
- size = defaultIconSize,
40
- align,
41
- color
42
- }) {
43
- const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
44
- color
45
- });
46
- return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
47
- $align: align,
48
- $size: size,
49
- $color: color,
50
- children: clonedIcon
24
+ const Stack = nativeBase.Stack;
25
+ const VStack = nativeBase.VStack;
26
+ const HStack = nativeBase.HStack;
27
+
28
+ function warn(message) {
29
+ if (process.env.NODE_ENV !== 'production') {
30
+ console.warn(message);
31
+ }
32
+ }
33
+ function deprecatedMessage(symbol, deprecation, replaceBy) {
34
+ const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
35
+ warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
36
+ }
37
+ function deprecatedInComponent(component, deprecation, replaceBy) {
38
+ deprecatedMessage(`<${component} />`, deprecation, replaceBy);
39
+ }
40
+
41
+ // type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
42
+ // type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
43
+ // export function withTheme<Props extends { theme: DefaultTheme }, C>(
44
+ // WrappedComponent: ComponentType<Props> & C,
45
+ // ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
46
+ // return function ThemedComponent(props) {
47
+ // const theme = useTheme();
48
+ // return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
49
+ // };
50
+ // }
51
+ function withTheme(WrappedComponent) {
52
+ // eslint-disable-next-line prefer-arrow-callback
53
+ return /*#__PURE__*/react.forwardRef(function (props, ref) {
54
+ const theme = /*#__PURE__*/styled.useTheme();
55
+ return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
56
+ ref: ref,
57
+ theme: theme,
58
+ ...props
59
+ });
51
60
  });
52
61
  }
53
62
 
63
+ const hasVariant = (button, variant) => {
64
+ return variant in button;
65
+ };
66
+
67
+ function getVariantValuesIfExist(theme, type, variant) {
68
+ const button = theme.kitt.button[type];
69
+
70
+ if (hasVariant(button, variant)) {
71
+ return button[variant];
72
+ }
73
+
74
+ return theme.kitt.button[type].default;
75
+ }
76
+
77
+ function isSubtle(type) {
78
+ return type.startsWith('subtle');
79
+ }
80
+
81
+ const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
82
+ name: "AnimatedButtonPressableContainer",
83
+ class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
84
+ vars: {
85
+ "a1vkj3mh-0": [({
86
+ $isStretch
87
+ }) => $isStretch ? 'inherit' : 'inline-flex'],
88
+ "a1vkj3mh-1": [({
89
+ $isStretch
90
+ }) => $isStretch ? 'stretch' : 'baseline'],
91
+ "a1vkj3mh-3": [({
92
+ theme
93
+ }) => theme.kitt.button.scale.medium.hover],
94
+ "a1vkj3mh-4": [({
95
+ theme,
96
+ $isDisabled
97
+ }) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
98
+ "a1vkj3mh-5": [({
99
+ theme,
100
+ $type,
101
+ $variant,
102
+ $isDisabled
103
+ }) => {
104
+ if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
105
+ return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
106
+ }],
107
+ "a1vkj3mh-6": [({
108
+ theme
109
+ }) => {
110
+ const {
111
+ duration,
112
+ timingFunction
113
+ } = theme.kitt.button.transition;
114
+ return `color, background, border-color, ${duration} ${timingFunction}`;
115
+ }],
116
+ "a1vkj3mh-7": [({
117
+ theme
118
+ }) => theme.kitt.button.borderRadius, "px"],
119
+ "a1vkj3mh-8": [({
120
+ theme
121
+ }) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
122
+ "a1vkj3mh-9": [({
123
+ $isDisabled
124
+ }) => $isDisabled ? 1 : 0],
125
+ "a1vkj3mh-10": [({
126
+ theme
127
+ }) => `-${theme.kitt.button.borderWidth.disabled}px`],
128
+ "a1vkj3mh-12": [({
129
+ theme
130
+ }) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
131
+ "a1vkj3mh-14": [({
132
+ theme
133
+ }) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
134
+ "a1vkj3mh-15": [({
135
+ theme,
136
+ $type,
137
+ $variant
138
+ }) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
139
+ "a1vkj3mh-16": [({
140
+ theme
141
+ }) => `-${theme.kitt.button.borderWidth.focus}px`],
142
+ "a1vkj3mh-18": [({
143
+ theme,
144
+ $type,
145
+ $isDisabled
146
+ }) => {
147
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
148
+
149
+ if (isSubtle($type)) {
150
+ return theme.kitt.button[$type].default.color;
151
+ }
152
+
153
+ return 'inherit';
154
+ }],
155
+ "a1vkj3mh-19": [({
156
+ theme,
157
+ $type,
158
+ $isDisabled
159
+ }) => {
160
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
161
+
162
+ if (isSubtle($type)) {
163
+ return theme.kitt.button[$type].default.hoverColor;
164
+ }
165
+
166
+ return 'inherit';
167
+ }],
168
+ "a1vkj3mh-20": [({
169
+ theme,
170
+ $type,
171
+ $isDisabled
172
+ }) => {
173
+ if ($isDisabled) return theme.kitt.typography.colors['black-light'];
174
+
175
+ if (isSubtle($type)) {
176
+ return theme.kitt.button[$type].default.activeColor;
177
+ }
178
+
179
+ return 'inherit';
180
+ }]
181
+ }
182
+ }));
183
+ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
184
+ $type,
185
+ $variant,
186
+ $isStretch,
187
+ disabled,
188
+ ...props
189
+ }, ref) => {
190
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
191
+ ref: ref,
192
+ $type: $type,
193
+ $variant: $variant,
194
+ $isDisabled: !!disabled,
195
+ $isStretch: $isStretch,
196
+ children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
197
+ disabled: disabled,
198
+ ...props
199
+ })
200
+ });
201
+ });
202
+
203
+ const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
204
+ displayName: "BaseStyledButtonPressable",
205
+ componentId: "kitt-universal__sc-4k8lse-0"
206
+ })(["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:", ";"], ({
207
+ theme
208
+ }) => theme.kitt.button.minWidth, ({
209
+ theme,
210
+ $isStretch
211
+ }) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
212
+ $isStretch
213
+ }) => $isStretch ? '100%' : 'auto', ({
214
+ theme
215
+ }) => theme.kitt.button.minHeight, ({
216
+ theme
217
+ }) => theme.kitt.button.borderRadius, ({
218
+ theme,
219
+ $isDisabled,
220
+ $type,
221
+ $variant
222
+ }) => {
223
+ if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
224
+ return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
225
+ }, ({
226
+ theme,
227
+ $size,
228
+ $isDisabled
229
+ }) => {
230
+ const {
231
+ large,
232
+ default: defaultPadding,
233
+ disabled: disabledPadding,
234
+ xLarge
235
+ } = theme.kitt.button.contentPadding;
236
+ if ($size === 'large') return large;
237
+ if ($size === 'xlarge') return xLarge;
238
+ if ($isDisabled) return disabledPadding;
239
+ return defaultPadding;
240
+ });
241
+
54
242
  const KittBreakpoints = {
55
243
  /**
56
244
  * min-width: 0
@@ -271,301 +459,36 @@ Typography.h4 = createHeading(4, 'header4');
271
459
 
272
460
  Typography.h5 = createHeading(5, 'header5');
273
461
 
274
- const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
275
-
276
- const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
277
- displayName: "Avatar__StyledAvatarView",
278
- componentId: "kitt-universal__sc-9miubv-0"
279
- })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
280
- theme,
281
- $isRound,
282
- $size,
283
- $sizeVariant
284
- }) => {
285
- if ($isRound) return `${$size / 2}px`;
286
- return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
287
- }, ({
288
- theme,
289
- $isLight
290
- }) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
291
- $size
292
- }) => $size, ({
293
- $size
294
- }) => $size);
295
-
296
- function AvatarContent({
297
- size,
298
- src,
299
- firstname,
300
- lastname,
301
- alt,
302
- isLight,
303
- sizeVariant
304
- }) {
305
- if (src) {
306
- return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
307
- source: {
308
- uri: src
309
- },
310
- style: {
311
- width: size,
312
- height: size
313
- },
314
- accessibilityLabel: alt
315
- });
316
- }
317
-
318
- if (firstname && lastname) {
319
- return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
320
- base: sizeVariant === 'large' ? 'body-large' : 'body-small',
321
- variant: sizeVariant === 'large' ? 'bold' : 'regular',
322
- color: isLight ? 'black' : 'white',
323
- children: getInitials(firstname, lastname)
324
- });
325
- }
326
-
327
- return /*#__PURE__*/jsxRuntime.jsx(Icon, {
328
- icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
329
- color: isLight ? 'black' : 'white',
330
- size: size / 2
331
- });
332
- }
333
-
334
- function Avatar({
335
- size = 40,
336
- round,
337
- light,
338
- sizeVariant,
339
- ...props
340
- }) {
341
- return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
342
- $size: size,
343
- $isRound: round,
344
- $isLight: light,
345
- $sizeVariant: sizeVariant,
346
- children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
347
- size: size,
348
- isLight: light,
349
- sizeVariant: sizeVariant,
350
- ...props
351
- })
352
- });
353
- }
354
-
355
- function warn(message) {
356
- if (process.env.NODE_ENV !== 'production') {
357
- console.warn(message);
358
- }
359
- }
360
- function deprecatedMessage(symbol, deprecation, replaceBy) {
361
- const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
362
- warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
363
- }
364
- function deprecatedInComponent(component, deprecation, replaceBy) {
365
- deprecatedMessage(`<${component} />`, deprecation, replaceBy);
366
- }
367
-
368
- // type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
369
- // type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
370
- // export function withTheme<Props extends { theme: DefaultTheme }, C>(
371
- // WrappedComponent: ComponentType<Props> & C,
372
- // ): ComponentType<SetOptional<Props, 'theme'>> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent> {
373
- // return function ThemedComponent(props) {
374
- // const theme = useTheme();
375
- // return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
376
- // };
377
- // }
378
- function withTheme(WrappedComponent) {
379
- // eslint-disable-next-line prefer-arrow-callback
380
- return /*#__PURE__*/react.forwardRef(function (props, ref) {
381
- const theme = /*#__PURE__*/styled.useTheme();
382
- return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
383
- ref: ref,
384
- theme: theme,
385
- ...props
386
- });
387
- });
388
- }
389
-
390
- const hasVariant = (button, variant) => {
391
- return variant in button;
392
- };
393
-
394
- function getVariantValuesIfExist(theme, type, variant) {
395
- const button = theme.kitt.button[type];
396
-
397
- if (hasVariant(button, variant)) {
398
- return button[variant];
399
- }
400
-
401
- return theme.kitt.button[type].default;
402
- }
403
-
404
- function isSubtle(type) {
405
- return type.startsWith('subtle');
406
- }
407
-
408
- const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
409
- name: "AnimatedButtonPressableContainer",
410
- class: "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
411
- vars: {
412
- "a1vkj3mh-0": [({
413
- $isStretch
414
- }) => $isStretch ? 'inherit' : 'inline-flex'],
415
- "a1vkj3mh-1": [({
416
- $isStretch
417
- }) => $isStretch ? 'stretch' : 'baseline'],
418
- "a1vkj3mh-3": [({
419
- theme
420
- }) => theme.kitt.button.scale.medium.hover],
421
- "a1vkj3mh-4": [({
422
- theme,
423
- $isDisabled
424
- }) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
425
- "a1vkj3mh-5": [({
426
- theme,
427
- $type,
428
- $variant,
429
- $isDisabled
430
- }) => {
431
- if ($isDisabled) return theme.kitt.button.disabled.default.hoverBackgroundColor;
432
- return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
433
- }],
434
- "a1vkj3mh-6": [({
435
- theme
436
- }) => {
437
- const {
438
- duration,
439
- timingFunction
440
- } = theme.kitt.button.transition;
441
- return `color, background, border-color, ${duration} ${timingFunction}`;
442
- }],
443
- "a1vkj3mh-7": [({
444
- theme
445
- }) => theme.kitt.button.borderRadius, "px"],
446
- "a1vkj3mh-8": [({
447
- theme
448
- }) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
449
- "a1vkj3mh-9": [({
450
- $isDisabled
451
- }) => $isDisabled ? 1 : 0],
452
- "a1vkj3mh-10": [({
453
- theme
454
- }) => `-${theme.kitt.button.borderWidth.disabled}px`],
455
- "a1vkj3mh-12": [({
456
- theme
457
- }) => `calc(100% - ${theme.kitt.button.borderWidth.disabled * 0.5}px)`],
458
- "a1vkj3mh-14": [({
459
- theme
460
- }) => `${theme.kitt.button.borderWidth.disabled}px solid ${theme.kitt.button.disabled.default.borderColor}`],
461
- "a1vkj3mh-15": [({
462
- theme,
463
- $type,
464
- $variant
465
- }) => `${theme.kitt.button.borderWidth.focus}px solid ${getVariantValuesIfExist(theme, $type, $variant).focusBorderColor}`],
466
- "a1vkj3mh-16": [({
467
- theme
468
- }) => `-${theme.kitt.button.borderWidth.focus}px`],
469
- "a1vkj3mh-18": [({
470
- theme,
471
- $type,
472
- $isDisabled
473
- }) => {
474
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
475
-
476
- if (isSubtle($type)) {
477
- return theme.kitt.button[$type].default.color;
478
- }
479
-
480
- return 'inherit';
481
- }],
482
- "a1vkj3mh-19": [({
483
- theme,
484
- $type,
485
- $isDisabled
486
- }) => {
487
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
488
-
489
- if (isSubtle($type)) {
490
- return theme.kitt.button[$type].default.hoverColor;
491
- }
492
-
493
- return 'inherit';
494
- }],
495
- "a1vkj3mh-20": [({
496
- theme,
497
- $type,
498
- $isDisabled
499
- }) => {
500
- if ($isDisabled) return theme.kitt.typography.colors['black-light'];
501
-
502
- if (isSubtle($type)) {
503
- return theme.kitt.button[$type].default.activeColor;
504
- }
505
-
506
- return 'inherit';
507
- }]
508
- }
509
- }));
510
- const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
511
- $type,
512
- $variant,
513
- $isStretch,
514
- disabled,
515
- ...props
516
- }, ref) => {
517
- return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
518
- ref: ref,
519
- $type: $type,
520
- $variant: $variant,
521
- $isDisabled: !!disabled,
522
- $isStretch: $isStretch,
523
- children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
524
- disabled: disabled,
525
- ...props
526
- })
527
- });
528
- });
529
-
530
- const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
531
- displayName: "BaseStyledButtonPressable",
532
- componentId: "kitt-universal__sc-4k8lse-0"
533
- })(["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:", ";"], ({
534
- theme
535
- }) => theme.kitt.button.minWidth, ({
536
- theme,
537
- $isStretch
538
- }) => $isStretch ? '100%' : `${theme.kitt.button.maxWidth}px`, ({
539
- $isStretch
540
- }) => $isStretch ? '100%' : 'auto', ({
541
- theme
542
- }) => theme.kitt.button.minHeight, ({
543
- theme
544
- }) => theme.kitt.button.borderRadius, ({
545
- theme,
546
- $isDisabled,
547
- $type,
548
- $variant
549
- }) => {
550
- if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
551
- return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
552
- }, ({
553
- theme,
554
- $size,
555
- $isDisabled
556
- }) => {
557
- const {
558
- large,
559
- default: defaultPadding,
560
- disabled: disabledPadding,
561
- xLarge
562
- } = theme.kitt.button.contentPadding;
563
- if ($size === 'large') return large;
564
- if ($size === 'xlarge') return xLarge;
565
- if ($isDisabled) return disabledPadding;
566
- return defaultPadding;
567
- });
568
-
462
+ const defaultIconSize = 20;
463
+ const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
464
+ displayName: "Icon__IconContainer",
465
+ componentId: "kitt-universal__sc-usm0ol-0"
466
+ })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
467
+ $color
468
+ }) => $color, ({
469
+ $size
470
+ }) => $size, ({
471
+ $size
472
+ }) => $size, ({
473
+ $align = 'auto'
474
+ }) => $align);
475
+ function Icon({
476
+ icon,
477
+ size = defaultIconSize,
478
+ align,
479
+ color
480
+ }) {
481
+ const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
482
+ color
483
+ });
484
+ return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
485
+ $align: align,
486
+ $size: size,
487
+ $color: color,
488
+ children: clonedIcon
489
+ });
490
+ }
491
+
569
492
  function TypographyIconSpecifiedColor({
570
493
  color,
571
494
  ...props
@@ -706,7 +629,7 @@ function ButtonContentChildren({
706
629
  };
707
630
  return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
708
631
  children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
709
- testID: "button-left-icon",
632
+ testID: "button.ButtonContent.leftButtonIcon",
710
633
  icon: icon
711
634
  }) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
712
635
  base: "body",
@@ -836,6 +759,218 @@ const Button = /*#__PURE__*/react.forwardRef(({
836
759
  });
837
760
  });
838
761
 
762
+ const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
763
+ name: "StyledSpinningIconContainer",
764
+ class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
765
+ }));
766
+ function SpinningIcon({
767
+ icon,
768
+ color
769
+ }) {
770
+ const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
771
+ color
772
+ });
773
+ return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
774
+ children: clonedIcon
775
+ });
776
+ }
777
+
778
+ function LoaderIcon({
779
+ color
780
+ }) {
781
+ return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
782
+ color: color,
783
+ icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
784
+ });
785
+ }
786
+
787
+ const View = nativeBase.View;
788
+ const ScrollView = nativeBase.ScrollView;
789
+ const Pressable = nativeBase.Pressable;
790
+
791
+ function matchWindowSize({
792
+ width,
793
+ height
794
+ }, {
795
+ minWidth,
796
+ maxWidth,
797
+ minHeight,
798
+ maxHeight
799
+ }) {
800
+ const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
801
+ const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
802
+ return hasWidthMatched && hasHeightMatched;
803
+ }
804
+ function useMatchWindowSize(options) {
805
+ const {
806
+ width,
807
+ height
808
+ } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
809
+ return matchWindowSize({
810
+ width,
811
+ height
812
+ }, options);
813
+ }
814
+
815
+ function ActionsItem({
816
+ as,
817
+ onPress,
818
+ disabled,
819
+ icon,
820
+ ...props
821
+ }) {
822
+ const isMedium = useMatchWindowSize({
823
+ minWidth: KittBreakpoints.MEDIUM
824
+ });
825
+ const [isLoading, setIsLoading] = react.useState(false);
826
+ const mountedRef = react.useRef(false); // effect just for tracking mounted state, as onPress can unmount the ActionButton
827
+
828
+ react.useEffect(() => {
829
+ mountedRef.current = true;
830
+ return () => {
831
+ mountedRef.current = false;
832
+ };
833
+ }, []);
834
+ return /*#__PURE__*/jsxRuntime.jsx(View, {
835
+ children: /*#__PURE__*/jsxRuntime.jsx(as, { ...props,
836
+ stretch: !isMedium ? true : undefined,
837
+ disabled: isLoading ? true : disabled,
838
+ icon: isLoading ? /*#__PURE__*/jsxRuntime.jsx(LoaderIcon, {}) : icon,
839
+ onPress: e => {
840
+ (async () => {
841
+ if (!onPress) return;
842
+ setIsLoading(true);
843
+
844
+ try {
845
+ await onPress(e);
846
+
847
+ if (mountedRef.current) {
848
+ setIsLoading(false);
849
+ }
850
+ } catch (err) {
851
+ if (mountedRef.current) {
852
+ setIsLoading(false);
853
+ }
854
+
855
+ throw err;
856
+ }
857
+ })();
858
+ }
859
+ })
860
+ });
861
+ }
862
+
863
+ function ActionsButton({ ...props
864
+ }) {
865
+ return /*#__PURE__*/jsxRuntime.jsx(ActionsItem, {
866
+ as: Button,
867
+ ...props
868
+ });
869
+ }
870
+
871
+ function Actions({
872
+ children,
873
+ ...props
874
+ }) {
875
+ return /*#__PURE__*/jsxRuntime.jsx(Stack, {
876
+ alignItems: {
877
+ base: 'stretch',
878
+ medium: 'center'
879
+ },
880
+ direction: {
881
+ base: 'column',
882
+ medium: 'row'
883
+ },
884
+ flex: 1,
885
+ ...props,
886
+ space: "kitt.3",
887
+ children: children
888
+ });
889
+ }
890
+ Actions.Button = ActionsButton;
891
+ Actions.Item = ActionsItem;
892
+
893
+ const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
894
+
895
+ const StyledAvatarView = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
896
+ displayName: "Avatar__StyledAvatarView",
897
+ componentId: "kitt-universal__sc-9miubv-0"
898
+ })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
899
+ theme,
900
+ $isRound,
901
+ $size,
902
+ $sizeVariant
903
+ }) => {
904
+ if ($isRound) return `${$size / 2}px`;
905
+ return `${$sizeVariant === 'large' ? theme.kitt.avatar.large.borderRadius : theme.kitt.avatar.borderRadius}px`;
906
+ }, ({
907
+ theme,
908
+ $isLight
909
+ }) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
910
+ $size
911
+ }) => $size, ({
912
+ $size
913
+ }) => $size);
914
+
915
+ function AvatarContent({
916
+ size,
917
+ src,
918
+ firstname,
919
+ lastname,
920
+ alt,
921
+ isLight,
922
+ sizeVariant
923
+ }) {
924
+ if (src) {
925
+ return /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Image, {
926
+ source: {
927
+ uri: src
928
+ },
929
+ style: {
930
+ width: size,
931
+ height: size
932
+ },
933
+ accessibilityLabel: alt
934
+ });
935
+ }
936
+
937
+ if (firstname && lastname) {
938
+ return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
939
+ base: sizeVariant === 'large' ? 'body-large' : 'body-small',
940
+ variant: sizeVariant === 'large' ? 'bold' : 'regular',
941
+ color: isLight ? 'black' : 'white',
942
+ children: getInitials(firstname, lastname)
943
+ });
944
+ }
945
+
946
+ return /*#__PURE__*/jsxRuntime.jsx(Icon, {
947
+ icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
948
+ color: isLight ? 'black' : 'white',
949
+ size: size / 2
950
+ });
951
+ }
952
+
953
+ function Avatar({
954
+ size = 40,
955
+ round,
956
+ light,
957
+ sizeVariant,
958
+ ...props
959
+ }) {
960
+ return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
961
+ $size: size,
962
+ $isRound: round,
963
+ $isLight: light,
964
+ $sizeVariant: sizeVariant,
965
+ children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
966
+ size: size,
967
+ isLight: light,
968
+ sizeVariant: sizeVariant,
969
+ ...props
970
+ })
971
+ });
972
+ }
973
+
839
974
  const Container$3 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
840
975
  displayName: "Card__Container",
841
976
  componentId: "kitt-universal__sc-1n9psug-0"
@@ -1037,7 +1172,7 @@ function ChoiceItem({
1037
1172
  onChange(value);
1038
1173
  };
1039
1174
 
1040
- return /*#__PURE__*/jsxRuntime.jsx(nativeBase.Pressable, {
1175
+ return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
1041
1176
  disabled: disabled,
1042
1177
  accessibilityRole: type,
1043
1178
  accessibilityState: {
@@ -1941,30 +2076,6 @@ const theme = {
1941
2076
  navigationModal
1942
2077
  };
1943
2078
 
1944
- function matchWindowSize({
1945
- width,
1946
- height
1947
- }, {
1948
- minWidth,
1949
- maxWidth,
1950
- minHeight,
1951
- maxHeight
1952
- }) {
1953
- const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
1954
- const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
1955
- return hasWidthMatched && hasHeightMatched;
1956
- }
1957
- function useMatchWindowSize(options) {
1958
- const {
1959
- width,
1960
- height
1961
- } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
1962
- return matchWindowSize({
1963
- width,
1964
- height
1965
- }, options);
1966
- }
1967
-
1968
2079
  // eslint-disable-next-line no-restricted-imports
1969
2080
  function createWindowSizeHelper(dimensions) {
1970
2081
  return {
@@ -2795,22 +2906,6 @@ function FullScreenModal({
2795
2906
  FullScreenModal.Header = FullScreenModalHeader;
2796
2907
  FullScreenModal.Body = FullScreenModalBody;
2797
2908
 
2798
- const StyledSpinningIconContainer = withTheme( /*#__PURE__*/react$1.styled("div")({
2799
- name: "StyledSpinningIconContainer",
2800
- class: "kitt-u_StyledSpinningIconContainer_ssn8o83"
2801
- }));
2802
- function SpinningIcon({
2803
- icon,
2804
- color
2805
- }) {
2806
- const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
2807
- color
2808
- });
2809
- return /*#__PURE__*/jsxRuntime.jsx(StyledSpinningIconContainer, {
2810
- children: clonedIcon
2811
- });
2812
- }
2813
-
2814
2909
  function StyleWebWrapper({
2815
2910
  as,
2816
2911
  children,
@@ -3089,15 +3184,6 @@ ListItem.Content = ListItemContent;
3089
3184
  ListItem.SideContent = ListItemSideContent;
3090
3185
  ListItem.SideContainer = ListItemSideContainer;
3091
3186
 
3092
- function LoaderIcon({
3093
- color
3094
- }) {
3095
- return /*#__PURE__*/jsxRuntime.jsx(SpinningIcon, {
3096
- color: color,
3097
- icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.ArcIcon, {})
3098
- });
3099
- }
3100
-
3101
3187
  function IconContent({
3102
3188
  type,
3103
3189
  color
@@ -3625,14 +3711,6 @@ function KittNativeBaseProvider({
3625
3711
  });
3626
3712
  }
3627
3713
 
3628
- const Stack = nativeBase.Stack;
3629
- const VStack = nativeBase.VStack;
3630
- const HStack = nativeBase.HStack;
3631
-
3632
- const View = nativeBase.View;
3633
- const ScrollView = nativeBase.ScrollView;
3634
- const Pressable = nativeBase.Pressable;
3635
-
3636
3714
  const ViewWithPadding = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
3637
3715
  displayName: "ContentPadding__ViewWithPadding",
3638
3716
  componentId: "kitt-universal__sc-1rprqcv-0"
@@ -4826,6 +4904,7 @@ function MatchWindowSize({
4826
4904
  }
4827
4905
 
4828
4906
  exports.useWindowSize = BabelPluginStyledComponentsReactNative.useWindowDimensions;
4907
+ exports.Actions = Actions;
4829
4908
  exports.Avatar = Avatar;
4830
4909
  exports.Button = Button;
4831
4910
  exports.Card = Card;