@ornikar/kitt-universal 3.0.1 → 3.4.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 (56) hide show
  1. package/dist/definitions/Button/AnimatedButtonPressable.d.ts +14 -0
  2. package/dist/definitions/Button/AnimatedButtonPressable.d.ts.map +1 -0
  3. package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +17 -0
  4. package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -0
  5. package/dist/definitions/Button/BaseStyledButtonPressable.d.ts +11 -0
  6. package/dist/definitions/Button/BaseStyledButtonPressable.d.ts.map +1 -0
  7. package/dist/definitions/Button/Button.d.ts +9 -4
  8. package/dist/definitions/Button/Button.d.ts.map +1 -1
  9. package/dist/definitions/Button/ButtonContent.d.ts +11 -3
  10. package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
  11. package/dist/definitions/Button/StyledDisabled.d.ts +3 -0
  12. package/dist/definitions/Button/StyledDisabled.d.ts.map +1 -0
  13. package/dist/definitions/Button/isSubtle.d.ts +3 -0
  14. package/dist/definitions/Button/isSubtle.d.ts.map +1 -0
  15. package/dist/definitions/Icon/SpinningIcon.web.d.ts.map +1 -1
  16. package/dist/definitions/IconButton/PressableIconButton.d.ts.map +1 -1
  17. package/dist/definitions/Loader/LargeLoader.web.d.ts.map +1 -1
  18. package/dist/definitions/Loader/Loader.d.ts +1 -1
  19. package/dist/definitions/Loader/Loader.d.ts.map +1 -1
  20. package/dist/definitions/themes/default.d.ts +3 -43
  21. package/dist/definitions/themes/default.d.ts.map +1 -1
  22. package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts +42 -35
  23. package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts.map +1 -1
  24. package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts +2 -0
  25. package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts.map +1 -1
  26. package/dist/definitions/typography/Typography.d.ts +13 -11
  27. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  28. package/dist/definitions/typography/TypographyIcon.d.ts +2 -2
  29. package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
  30. package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
  31. package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts +7 -2
  32. package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts.map +1 -1
  33. package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts +5 -2
  34. package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts.map +1 -1
  35. package/dist/definitions/utils/withTheme.d.ts +2 -2
  36. package/dist/definitions/utils/withTheme.d.ts.map +1 -1
  37. package/dist/index-browser-all.es.android.js +461 -255
  38. package/dist/index-browser-all.es.android.js.map +1 -1
  39. package/dist/index-browser-all.es.css +2 -2
  40. package/dist/index-browser-all.es.ios.js +461 -255
  41. package/dist/index-browser-all.es.ios.js.map +1 -1
  42. package/dist/index-browser-all.es.js +504 -291
  43. package/dist/index-browser-all.es.js.map +1 -1
  44. package/dist/index-browser-all.es.web.js +500 -281
  45. package/dist/index-browser-all.es.web.js.map +1 -1
  46. package/dist/index-node-14.17.cjs.css +2 -2
  47. package/dist/index-node-14.17.cjs.js +462 -213
  48. package/dist/index-node-14.17.cjs.js.map +1 -1
  49. package/dist/index-node-14.17.cjs.web.css +3 -2
  50. package/dist/index-node-14.17.cjs.web.js +448 -215
  51. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  52. package/dist/styles.css +3 -2
  53. package/dist/tsbuildinfo +1 -1
  54. package/package.json +3 -3
  55. package/dist/definitions/Button/ButtonPressable.d.ts +0 -13
  56. package/dist/definitions/Button/ButtonPressable.d.ts.map +0 -1
@@ -7,10 +7,11 @@ const reactNative = require('react-native');
7
7
  const styled = require('styled-components/native');
8
8
  const react = require('react');
9
9
  const jsxRuntime = require('react/jsx-runtime');
10
+ const Animated = require('react-native-reanimated');
10
11
  const twemojiParser = require('twemoji-parser');
11
12
  const WebBrowser = require('expo-web-browser');
12
13
  const reactNativeSafeAreaContext = require('react-native-safe-area-context');
13
- const Animated = require('react-native-reanimated');
14
+ const react$1 = require('@linaria/react');
14
15
  const DateTimePicker = require('@react-native-community/datetimepicker');
15
16
  const reactIntl = require('react-intl');
16
17
  const reactNative$1 = require('@floating-ui/react-native');
@@ -55,7 +56,7 @@ function SpinningIcon({
55
56
  });
56
57
  }
57
58
 
58
- const IconContainer$2 = /*#__PURE__*/styled__default.View.withConfig({
59
+ const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
59
60
  displayName: "Icon__IconContainer",
60
61
  componentId: "kitt-universal__sc-usm0ol-0"
61
62
  })(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
@@ -77,7 +78,7 @@ function Icon({
77
78
  const clonedIcon = /*#__PURE__*/react.cloneElement(icon, {
78
79
  color
79
80
  });
80
- return /*#__PURE__*/jsxRuntime.jsx(IconContainer$2, {
81
+ return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
81
82
  align: align,
82
83
  size: size,
83
84
  color: color,
@@ -203,6 +204,20 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
203
204
  if (small && width >= KittBreakpoints.SMALL) return small;
204
205
  return base;
205
206
  }
207
+ function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
208
+ base,
209
+ color
210
+ }) {
211
+ // return the props set or undefined. In case of undefined, the value will be inherited from its parents.
212
+ if (hasTypographyAncestor) return {
213
+ base,
214
+ color
215
+ };
216
+ return {
217
+ base: base ?? 'body',
218
+ color: color ?? 'black'
219
+ };
220
+ }
206
221
  function Typography({
207
222
  accessibilityRole,
208
223
  base,
@@ -214,16 +229,21 @@ function Typography({
214
229
  ...otherProps
215
230
  }) {
216
231
  const isHeaderTypographyInContext = react.useContext(IsHeaderTypographyContext);
217
- const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(base, small, medium, large);
232
+ const hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
233
+ const {
234
+ base: baseOrDefaultToBody,
235
+ color: colorOrDefaultToBlack
236
+ } = getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
237
+ base,
238
+ color
239
+ });
240
+ const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
218
241
  const isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
219
- const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular'); // if isHeaderTypographyInContext exists, it means we are inside another typography so we don't want to
220
- // redefine the color, just inherit from it
221
-
222
- const colorWithDefaultToBlack = color ?? (isHeaderTypographyInContext !== undefined ? undefined : 'black');
223
- const content = base ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
242
+ const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular');
243
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
224
244
  value: isHeader,
225
245
  children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
226
- $color: colorWithDefaultToBlack,
246
+ $color: colorOrDefaultToBlack,
227
247
  $isHeader: isHeader,
228
248
  $typeForCurrentWindowSize: typeForCurrentWindowSize,
229
249
  $variant: nonNullableVariant,
@@ -231,7 +251,7 @@ function Typography({
231
251
  ...otherProps
232
252
  })
233
253
  }) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
234
- $color: colorWithDefaultToBlack,
254
+ $color: colorOrDefaultToBlack,
235
255
  $isHeader: isHeader,
236
256
  $variant: nonNullableVariant,
237
257
  accessibilityRole: accessibilityRole || undefined,
@@ -362,79 +382,232 @@ function Avatar({
362
382
  });
363
383
  }
364
384
 
365
- function TypographyIconInheritColor(props) {
366
- const color = useTypographyColor();
385
+ const StyledPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
386
+ displayName: "AnimatedButtonPressable__StyledPressable",
387
+ componentId: "kitt-universal__sc-175vyve-0"
388
+ })(["", ""], ({
389
+ $isStretch
390
+ }) => {
391
+ if ($isStretch) return undefined;
392
+ return 'align-self: flex-start;';
393
+ });
394
+ const StyledAnimatedView = /*#__PURE__*/styled__default(Animated__default.View).withConfig({
395
+ displayName: "AnimatedButtonPressable__StyledAnimatedView",
396
+ componentId: "kitt-universal__sc-175vyve-1"
397
+ })(["border-radius:", ";"], ({
398
+ theme
399
+ }) => theme.kitt.button.borderRadius);
400
+ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
401
+ children,
402
+ disabled,
403
+ accessibilityRole,
404
+ $type,
405
+ $isStretch,
406
+ href,
407
+ hrefAttrs,
408
+ testID,
409
+ onPress
410
+ }, ref) => {
367
411
  const theme = /*#__PURE__*/styled.useTheme();
368
- return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
369
- color: theme.kitt.typography.colors[color]
412
+ const pressed = Animated.useSharedValue(0);
413
+ const color = Animated.useSharedValue(0);
414
+ const {
415
+ backgroundColor,
416
+ pressedBackgroundColor
417
+ } = theme.kitt.button[$type];
418
+ const {
419
+ scale
420
+ } = theme.kitt.button;
421
+ const scaleStyles = Animated.useAnimatedStyle(function () {
422
+ const _f = function () {
423
+ return {
424
+ backgroundColor: Animated.interpolateColor(color.value, [0, 1], [backgroundColor, pressedBackgroundColor]),
425
+ transform: [{
426
+ scale: Animated.withSpring(pressed.value ? scale.base.active : scale.base.default)
427
+ }]
428
+ };
429
+ };
430
+
431
+ _f._closure = {
432
+ interpolateColor: Animated.interpolateColor,
433
+ color,
434
+ backgroundColor,
435
+ pressedBackgroundColor,
436
+ withSpring: Animated.withSpring,
437
+ pressed,
438
+ scale: {
439
+ base: {
440
+ active: scale.base.active,
441
+ default: scale.base.default
442
+ }
443
+ }
444
+ };
445
+ _f.asString = "function _f(){const{interpolateColor,color,backgroundColor,pressedBackgroundColor,withSpring,pressed,scale}=jsThis._closure;{return{backgroundColor:interpolateColor(color.value,[0,1],[backgroundColor,pressedBackgroundColor]),transform:[{scale:withSpring(pressed.value?scale.base.active:scale.base.default)}]};}}";
446
+ _f.__workletHash = 5368461229978;
447
+ _f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (53:41)";
448
+ _f.__optimalization = 2;
449
+
450
+ global.__reanimatedWorkletInit(_f);
451
+
452
+ return _f;
453
+ }());
454
+
455
+ const handlePressInOut = pressIn => {
456
+ color.value = Animated.withSpring(pressIn ? 1 : 0);
457
+ pressed.value = pressIn ? 1 : 0;
458
+ };
459
+
460
+ return /*#__PURE__*/jsxRuntime.jsx(StyledPressable, {
461
+ ref: ref,
462
+ disabled: disabled,
463
+ accessibilityRole: accessibilityRole,
464
+ testID: testID,
465
+ href: href,
466
+ hrefAttrs: hrefAttrs,
467
+ $isStretch: $isStretch,
468
+ $type: $type,
469
+ onPress: onPress,
470
+ onPressIn: () => {
471
+ handlePressInOut(true);
472
+ },
473
+ onPressOut: () => {
474
+ handlePressInOut(false);
475
+ },
476
+ children: /*#__PURE__*/jsxRuntime.jsx(StyledAnimatedView, {
477
+ style: disabled ? [{
478
+ transform: [{
479
+ scale: 1
480
+ }]
481
+ }] : [scaleStyles],
482
+ children: children
483
+ })
370
484
  });
371
- }
485
+ });
486
+
487
+ const BaseStyledButtonPressable = /*#__PURE__*/styled__default.View.withConfig({
488
+ displayName: "BaseStyledButtonPressable",
489
+ componentId: "kitt-universal__sc-4k8lse-0"
490
+ })(["position:relative;min-width:", ";max-width:", ";width:", ";min-height:", ";border-radius:", ";flex-direction:row;align-items:center;justify-content:center;align-self:flex-start;background-color:", ";padding:", ";"], ({
491
+ theme
492
+ }) => theme.kitt.button.minWidth, ({
493
+ theme,
494
+ $isStretch
495
+ }) => $isStretch ? '100%' : theme.kitt.button.maxWidth, ({
496
+ $isStretch
497
+ }) => $isStretch ? '100%' : 'auto', ({
498
+ theme
499
+ }) => theme.kitt.button.minHeight, ({
500
+ theme
501
+ }) => theme.kitt.button.borderRadius, ({
502
+ theme,
503
+ $isDisabled,
504
+ $type
505
+ }) => {
506
+ if ($isDisabled) return theme.kitt.button.disabled.backgroundColor;
507
+ if (reactNative.Platform.OS !== 'web') return 'transparent';
508
+ return theme.kitt.button[$type].backgroundColor;
509
+ }, ({
510
+ theme,
511
+ $isLarge,
512
+ $isDisabled
513
+ }) => {
514
+ const {
515
+ large,
516
+ default: defaultPadding,
517
+ disabled: disabledPadding
518
+ } = theme.kitt.button.contentPadding;
519
+ if ($isLarge) return large;
520
+ if ($isDisabled) return disabledPadding;
521
+ return defaultPadding;
522
+ });
372
523
 
373
524
  function TypographyIconSpecifiedColor({
374
525
  color,
375
- ...otherProps
526
+ ...props
376
527
  }) {
377
528
  const theme = /*#__PURE__*/styled.useTheme();
378
- return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...otherProps,
379
- color: theme.kitt.typography.colors[color]
529
+ return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
530
+ color: color === 'inherit' ? 'inherit' : theme.kitt.typography.colors[color]
531
+ });
532
+ }
533
+
534
+ function TypographyIconInheritColor(props) {
535
+ const color = useTypographyColor();
536
+ return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
537
+ color: color,
538
+ ...props
380
539
  });
381
540
  }
382
541
 
383
542
  function TypographyIcon({
384
543
  color,
385
- ...otherProps
544
+ ...props
386
545
  }) {
387
546
  if (color) {
388
547
  return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
389
548
  color: color,
390
- ...otherProps
549
+ ...props
391
550
  });
392
551
  }
393
552
 
394
- return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...otherProps
553
+ return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...props
395
554
  });
396
555
  }
397
556
 
398
- const getTextColorByType = (type, isPressed, disabled) => {
399
- if (disabled) return 'black-light';
557
+ function isSubtle(type) {
558
+ return type.startsWith('subtle');
559
+ }
400
560
 
561
+ const getTextColorByType = type => {
401
562
  switch (type) {
402
563
  case 'primary':
403
564
  return 'white';
404
565
 
566
+ case 'white':
567
+ return 'white';
568
+
405
569
  case 'subtle':
406
- return isPressed ? 'primary-light' : 'primary';
570
+ return 'primary';
407
571
 
408
572
  case 'subtle-dark':
409
- return isPressed ? 'black-light' : 'black';
573
+ return 'black';
410
574
 
411
- case 'secondary':
412
575
  default:
413
576
  return 'black';
414
577
  }
415
578
  };
416
579
 
417
- const ButtonText = /*#__PURE__*/styled__default(Typography.Text).withConfig({
418
- displayName: "ButtonContent__ButtonText",
580
+ const StyledButtonText = /*#__PURE__*/styled__default(Typography.Text).withConfig({
581
+ displayName: "ButtonContent__StyledButtonText",
419
582
  componentId: "kitt-universal__sc-dnyw3n-0"
420
- })(["text-align:center;"]);
421
- const Content$1 = /*#__PURE__*/styled__default.View.withConfig({
422
- displayName: "ButtonContent__Content",
583
+ })(["text-align:center;", " ", ""], () => {
584
+ // Make the multilines case work properly on native
585
+ // Breaks the web implem
586
+ if (reactNative.Platform.OS === 'web') return undefined;
587
+ return `
588
+ flex-shrink: 1;
589
+ `;
590
+ }, ({
591
+ $type,
592
+ $isDisabled
593
+ }) => {
594
+ /* For subltes button, color changes when hovered.
595
+ * We don't want to use a mouse event handler with a react state to handle it
596
+ * For this precise case, we've decided to work outside the typography logic
597
+ */
598
+ if (reactNative.Platform.OS !== 'web' || $isDisabled || !isSubtle($type)) return undefined;
599
+ return 'color: inherit';
600
+ });
601
+ const StyledIconContainer = /*#__PURE__*/styled__default.View.withConfig({
602
+ displayName: "ButtonContent__StyledIconContainer",
423
603
  componentId: "kitt-universal__sc-dnyw3n-1"
424
- })(["flex-direction:row;align-items:center;justify-content:center;flex:", ";"], ({
425
- stretch,
426
- iconOnly
427
- }) => `${stretch || iconOnly ? 1 : 0} 1 auto`);
428
- const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
429
- displayName: "ButtonContent__IconContainer",
430
- componentId: "kitt-universal__sc-dnyw3n-2"
431
604
  })(["", ""], ({
432
605
  theme,
433
- iconPosition
606
+ $iconPosition
434
607
  }) => {
435
- const value = theme.kitt.spacing * 3;
608
+ const value = theme.kitt.spacing * 2;
436
609
 
437
- if (iconPosition === 'left') {
610
+ if ($iconPosition === 'left') {
438
611
  return `margin: 0 ${value}px 0 0;`;
439
612
  }
440
613
 
@@ -443,150 +616,176 @@ const IconContainer$1 = /*#__PURE__*/styled__default.View.withConfig({
443
616
 
444
617
  function ButtonIcon({
445
618
  icon,
446
- spin,
447
619
  color,
448
- size,
620
+ spin,
449
621
  iconPosition,
450
622
  testID
451
623
  }) {
452
- return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
453
- iconPosition: iconPosition,
624
+ return /*#__PURE__*/jsxRuntime.jsx(StyledIconContainer, {
625
+ $iconPosition: iconPosition,
454
626
  children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
455
627
  icon: icon,
456
628
  spin: spin,
457
- color: color,
458
- size: size,
459
- testID: testID
629
+ testID: testID,
630
+ color: color
460
631
  })
461
632
  });
462
633
  }
463
634
 
464
- function ButtonContent({
635
+ const StyledChildrenWithIcon = /*#__PURE__*/styled__default.View.withConfig({
636
+ displayName: "ButtonContent__StyledChildrenWithIcon",
637
+ componentId: "kitt-universal__sc-dnyw3n-2"
638
+ })(["align-items:center;justify-content:center;flex-direction:row;"]);
639
+ function ButtonContentChildren({
465
640
  type,
466
- isPressed,
467
- stretch,
468
641
  icon,
469
642
  iconPosition,
470
643
  iconSpin,
471
- disabled,
644
+ isDisabled,
645
+ color,
472
646
  children
473
647
  }) {
474
- const color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
475
- const theme = /*#__PURE__*/styled.useTheme();
476
- const sharedIconProps = {
477
- spin: iconSpin,
478
- color,
479
- size: theme.kitt.button.iconSize
480
- };
481
-
482
648
  if ((process.env.NODE_ENV !== "production")) {
483
649
  if (!(children || icon)) {
484
650
  throw new Error('kitt(Button): You should provide at least a children or a icon');
485
651
  }
486
652
  }
487
653
 
654
+ const isWebSubtle = isSubtle(type) && reactNative.Platform.OS === 'web' && !isDisabled;
655
+
488
656
  if (!children) {
489
- return /*#__PURE__*/jsxRuntime.jsx(Content$1, {
490
- iconOnly: true,
491
- stretch: stretch,
492
- children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, { ...sharedIconProps,
493
- icon: icon
494
- })
657
+ return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
658
+ spin: iconSpin // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
659
+ ,
660
+ icon: icon,
661
+ color: isWebSubtle ? 'inherit' : color
495
662
  });
496
663
  }
497
664
 
498
- return /*#__PURE__*/jsxRuntime.jsxs(Content$1, {
499
- stretch: stretch,
500
- children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...sharedIconProps,
501
- icon: icon,
502
- iconPosition: iconPosition,
503
- testID: "button-left-icon"
504
- }) : null, /*#__PURE__*/jsxRuntime.jsx(ButtonText, {
665
+ const buttonIconSharedProps = {
666
+ type,
667
+ spin: iconSpin,
668
+ iconPosition,
669
+ color: isWebSubtle ? 'inherit' : color
670
+ };
671
+ return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
672
+ children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
673
+ testID: "button-left-icon",
674
+ icon: icon
675
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
505
676
  base: "body",
506
- color: color,
507
677
  variant: "bold",
678
+ $type: type,
679
+ $isDisabled: isDisabled // set to color: inherit via styled components
680
+ ,
681
+ color: isWebSubtle ? undefined : color,
508
682
  children: children
509
- }), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...sharedIconProps,
510
- icon: icon,
511
- iconPosition: iconPosition
683
+ }), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
684
+ icon: icon
512
685
  }) : null]
513
686
  });
514
687
  }
688
+ const ButtonContentContainer = /*#__PURE__*/styled__default.View.withConfig({
689
+ displayName: "ButtonContent__ButtonContentContainer",
690
+ componentId: "kitt-universal__sc-dnyw3n-3"
691
+ })(["line-height:16px;", " ", ";"], ({
692
+ $isStretch,
693
+ $isIconOnly
694
+ }) => {
695
+ // Make the multilines case work properly on web
696
+ // Breaks the native implem
697
+ if (reactNative.Platform.OS !== 'web') return undefined;
698
+ return `
699
+ flex: ${$isStretch || $isIconOnly ? 1 : 0} 1 auto;
700
+ `;
701
+ }, ({
702
+ $isSubtle
703
+ }) => {
704
+ if (reactNative.Platform.OS !== 'web' || !$isSubtle) return undefined; // Needed for subtle type
515
705
 
516
- const ButtonPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
517
- displayName: "ButtonPressable",
518
- componentId: "kitt-universal__sc-7ckel6-0"
519
- })(["min-width:", ";max-width:", ";width:", ";min-height:", ";background-color:", ";padding:", ";flex-direction:row;align-self:flex-start;border-radius:", ";border-color:", ";border-width:", ";"], ({
520
- theme
521
- }) => theme.kitt.button.minWidth, ({
522
- theme,
523
- stretch
524
- }) => stretch ? 'auto' : theme.kitt.button.maxWidth, ({
525
- stretch
526
- }) => stretch ? '100%' : 'auto', ({
706
+ return 'color: inherit';
707
+ });
708
+ function ButtonContent({
709
+ type,
710
+ isDisabled,
711
+ $isStretch,
712
+ icon,
713
+ children,
714
+ ...props
715
+ }) {
716
+ const color = isDisabled ? 'black-light' : getTextColorByType(type);
717
+ return /*#__PURE__*/jsxRuntime.jsx(ButtonContentContainer, {
718
+ $isSubtle: isSubtle(type),
719
+ $isStretch: $isStretch,
720
+ $isIconOnly: Boolean(!children && icon),
721
+ children: /*#__PURE__*/jsxRuntime.jsx(ButtonContentChildren, {
722
+ icon: icon,
723
+ type: type,
724
+ isDisabled: isDisabled,
725
+ color: color,
726
+ ...props,
727
+ children: children
728
+ })
729
+ });
730
+ }
731
+
732
+ const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
733
+ displayName: "StyledDisabled",
734
+ componentId: "kitt-universal__sc-16irf7q-0"
735
+ })(["position:absolute;top:0;left:0;right:0;bottom:0;border:", ";border-radius:", ";"], ({
527
736
  theme
528
- }) => theme.kitt.button.minHeight, ({
529
- theme,
530
- isPressed,
531
- disabled,
532
- type
533
737
  }) => {
534
- if (disabled) {
535
- return theme.kitt.button[type].disabledBackgroundColor;
536
- }
537
-
538
- return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
738
+ const {
739
+ borderWidth,
740
+ disabled
741
+ } = theme.kitt.button;
742
+ return `${borderWidth.disabled} solid ${disabled.borderColor}`;
539
743
  }, ({
540
744
  theme
541
- }) => theme.kitt.button.contentPadding.default, ({
542
- theme
543
- }) => theme.kitt.button.borderRadius, ({
544
- theme,
545
- disabled,
546
- type
547
- }) => disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent', ({
548
- theme
549
- }) => theme.kitt.button.borderWidth);
745
+ }) => theme.kitt.button.borderRadius);
550
746
 
551
- function Button({
747
+ const Button = /*#__PURE__*/react.forwardRef(({
552
748
  children,
553
- type = 'secondary',
749
+ type = 'default',
750
+ disabled,
751
+ stretch,
752
+ large,
554
753
  icon,
555
754
  iconPosition = 'left',
556
755
  iconSpin,
557
- stretch,
558
- disabled,
559
756
  testID,
560
757
  href,
561
758
  hrefAttrs,
759
+ accessibilityRole = 'button',
562
760
  onPress
563
- }) {
564
- const [isPressed, setIsPressed] = react.useState(false);
565
- const sharedProps = {
566
- type,
567
- stretch,
568
- disabled
569
- };
570
- return /*#__PURE__*/jsxRuntime.jsx(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
571
- // TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
572
- // underlayColor={globalTheme.button[type].pressedBackgroundColor}
573
- , { ...sharedProps,
574
- isPressed: isPressed,
575
- accessibilityRole: "button",
761
+ }, ref) => {
762
+ return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
763
+ ref: ref,
764
+ accessibilityRole: accessibilityRole,
576
765
  testID: testID,
577
766
  href: href,
578
767
  hrefAttrs: hrefAttrs,
768
+ disabled: disabled,
769
+ $isStretch: stretch,
770
+ $type: type,
579
771
  onPress: onPress,
580
- onPressIn: () => setIsPressed(true),
581
- onPressOut: () => setIsPressed(false),
582
- children: /*#__PURE__*/jsxRuntime.jsx(ButtonContent, { ...sharedProps,
583
- icon: icon,
584
- iconPosition: iconPosition,
585
- iconSpin: iconSpin,
586
- children: children
772
+ children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
773
+ $type: type,
774
+ $isStretch: stretch,
775
+ $isLarge: large,
776
+ $isDisabled: disabled,
777
+ children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
778
+ type: type,
779
+ $isStretch: stretch,
780
+ isDisabled: disabled,
781
+ icon: icon,
782
+ iconPosition: iconPosition,
783
+ iconSpin: iconSpin,
784
+ children: children
785
+ }), reactNative.Platform.OS !== 'web' && disabled ? /*#__PURE__*/jsxRuntime.jsx(StyledDisabled, {}) : null]
587
786
  })
588
787
  });
589
- }
788
+ });
590
789
 
591
790
  const Container$6 = /*#__PURE__*/styled__default.View.withConfig({
592
791
  displayName: "Card__Container",
@@ -1183,8 +1382,7 @@ function StyleWebWrapper({
1183
1382
  // return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
1184
1383
  // };
1185
1384
  // }
1186
- function withTheme( // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1187
- WrappedComponent) {
1385
+ function withTheme(WrappedComponent) {
1188
1386
  return function (props) {
1189
1387
  const theme = /*#__PURE__*/styled.useTheme();
1190
1388
  return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
@@ -1194,7 +1392,7 @@ WrappedComponent) {
1194
1392
  };
1195
1393
  }
1196
1394
 
1197
- const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/styledLinaria("div")({
1395
+ const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react$1.styled("div")({
1198
1396
  name: "PressableIconButtonWebWrapper",
1199
1397
  class: "p1nlccvg",
1200
1398
  vars: {
@@ -1211,11 +1409,16 @@ const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/styledLinaria("div
1211
1409
  theme
1212
1410
  }) => theme.kitt.iconButton.scale.base.active],
1213
1411
  "p1nlccvg-4": [({
1214
- theme
1215
- }) => theme.kitt.iconButton.default.pressedBackgroundColor],
1216
- "p1nlccvg-5": [({
1217
- theme
1218
- }) => theme.kitt.iconButton.white.pressedBackgroundColor]
1412
+ theme,
1413
+ $isWhite
1414
+ }) => {
1415
+ const {
1416
+ white,
1417
+ default: defaultIconButton
1418
+ } = theme.kitt.iconButton;
1419
+ if ($isWhite) return white.pressedBackgroundColor;
1420
+ return defaultIconButton.pressedBackgroundColor;
1421
+ }]
1219
1422
  }
1220
1423
  }));
1221
1424
  const StyledPressableIconButton = /*#__PURE__*/styled__default.Pressable.withConfig({
@@ -1259,7 +1462,7 @@ function PressableIconButton({
1259
1462
  }) {
1260
1463
  return /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
1261
1464
  as: PressableIconButtonWebWrapper,
1262
- "data-color-white": color === 'white' ? true : undefined,
1465
+ $isWhite: color === 'white',
1263
1466
  children: /*#__PURE__*/jsxRuntime.jsx(StyledPressableIconButton, { ...props
1264
1467
  })
1265
1468
  });
@@ -2295,47 +2498,98 @@ const avatarLateOceanTheme = {
2295
2498
  }
2296
2499
  };
2297
2500
 
2501
+ const colorsLateOceanTheme = {
2502
+ primary: lateOceanColorPalette.lateOcean,
2503
+ primaryLight: lateOceanColorPalette.lateOceanLight1,
2504
+ accent: lateOceanColorPalette.warmEmbrace,
2505
+ accentLight: lateOceanColorPalette.warmEmbraceLight1,
2506
+ success: lateOceanColorPalette.viride,
2507
+ correct: lateOceanColorPalette.viride,
2508
+ danger: lateOceanColorPalette.englishVermillon,
2509
+ separator: lateOceanColorPalette.black100,
2510
+ hover: lateOceanColorPalette.black100,
2511
+ black: lateOceanColorPalette.black1000,
2512
+ uiBackground: lateOceanColorPalette.black25,
2513
+ uiBackgroundLight: lateOceanColorPalette.white,
2514
+ transparent: lateOceanColorPalette.transparent,
2515
+ disabled: lateOceanColorPalette.black50,
2516
+ overlay: {
2517
+ dark: 'rgba(41, 48, 51, 0.25)',
2518
+ light: 'rgba(255, 255, 255, 0.90)',
2519
+ fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
2520
+ }
2521
+ };
2522
+
2298
2523
  const buttonLateOceanTheme = {
2299
2524
  borderRadius: '30px',
2300
- borderWidth: '2px',
2301
- minHeight: '42px',
2525
+ borderWidth: {
2526
+ disabled: '2px',
2527
+ focus: '3px'
2528
+ },
2529
+ minHeight: '40px',
2302
2530
  minWidth: '40px',
2303
2531
  maxWidth: '335px',
2304
- iconSize: 18,
2532
+ scale: {
2533
+ base: {
2534
+ default: 1,
2535
+ hover: 0.95,
2536
+ active: 0.95
2537
+ },
2538
+ medium: {
2539
+ hover: 1.05
2540
+ }
2541
+ },
2305
2542
  contentPadding: {
2306
- default: '8px 16px'
2543
+ default: '8px 16px 7px',
2544
+ large: '12px 24px 11px',
2545
+ disabled: '6px 14px 5px'
2307
2546
  },
2308
- primary: {
2309
- backgroundColor: lateOceanColorPalette.lateOcean,
2310
- disabledBackgroundColor: lateOceanColorPalette.black50,
2311
- pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
2312
- disabledBorderColor: lateOceanColorPalette.black100
2547
+ transition: {
2548
+ duration: '200ms',
2549
+ timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
2313
2550
  },
2314
- secondary: {
2551
+ default: {
2315
2552
  backgroundColor: 'rgba(0, 0, 0, 0.05)',
2316
- disabledBackgroundColor: lateOceanColorPalette.black50,
2317
2553
  pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
2318
- disabledBorderColor: lateOceanColorPalette.black100
2319
- },
2320
- subtle: {
2321
- backgroundColor: lateOceanColorPalette.transparent,
2322
- disabledBackgroundColor: lateOceanColorPalette.transparent,
2323
- pressedBackgroundColor: lateOceanColorPalette.transparent,
2324
- disabledBorderColor: lateOceanColorPalette.transparent
2554
+ hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
2555
+ focusBorderColor: 'rgba(0, 0, 0, 0.1)'
2325
2556
  },
2326
- 'subtle-dark': {
2327
- backgroundColor: lateOceanColorPalette.transparent,
2328
- disabledBackgroundColor: lateOceanColorPalette.transparent,
2329
- pressedBackgroundColor: lateOceanColorPalette.transparent,
2330
- disabledBorderColor: lateOceanColorPalette.transparent
2557
+ primary: {
2558
+ backgroundColor: colorsLateOceanTheme.primary,
2559
+ pressedBackgroundColor: colorsLateOceanTheme.primaryLight,
2560
+ hoverBackgroundColor: colorsLateOceanTheme.primaryLight,
2561
+ focusBorderColor: 'rgba(76, 52, 224, 0.2)'
2331
2562
  },
2332
2563
  white: {
2333
2564
  backgroundColor: 'rgba(255, 255, 255, 0.05)',
2334
- disabledBackgroundColor: lateOceanColorPalette.transparent,
2335
- hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
2336
2565
  pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
2337
- focusBorderColor: 'rgba(255, 255, 255, 0.1)',
2338
- disabledBorderColor: lateOceanColorPalette.transparent
2566
+ hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
2567
+ focusBorderColor: 'rgba(255, 255, 255, 0.1)'
2568
+ },
2569
+ subtle: {
2570
+ backgroundColor: colorsLateOceanTheme.transparent,
2571
+ pressedBackgroundColor: colorsLateOceanTheme.transparent,
2572
+ hoverBackgroundColor: colorsLateOceanTheme.transparent,
2573
+ focusBorderColor: 'rgba(76, 52, 224, 0.2)',
2574
+ color: colorsLateOceanTheme.primary,
2575
+ hoverColor: 'rgba(76, 52, 224, 0.8)',
2576
+ activeColor: 'rgba(76, 52, 224, 0.8)'
2577
+ },
2578
+ 'subtle-dark': {
2579
+ backgroundColor: colorsLateOceanTheme.transparent,
2580
+ pressedBackgroundColor: colorsLateOceanTheme.transparent,
2581
+ hoverBackgroundColor: colorsLateOceanTheme.transparent,
2582
+ focusBorderColor: 'rgba(0, 0, 0, 0.1)',
2583
+ color: colorsLateOceanTheme.black,
2584
+ hoverColor: 'rgba(0, 0, 0, 0.8)',
2585
+ activeColor: 'rgba(0, 0, 0, 0.8)'
2586
+ },
2587
+ disabled: {
2588
+ backgroundColor: colorsLateOceanTheme.disabled,
2589
+ pressedBackgroundColor: colorsLateOceanTheme.disabled,
2590
+ hoverBackgroundColor: colorsLateOceanTheme.disabled,
2591
+ focusBorderColor: lateOceanColorPalette.black100,
2592
+ borderColor: lateOceanColorPalette.black100
2339
2593
  }
2340
2594
  };
2341
2595
 
@@ -2357,26 +2611,6 @@ const cardLateOceanTheme = {
2357
2611
  }
2358
2612
  };
2359
2613
 
2360
- const colorsLateOceanTheme = {
2361
- primary: lateOceanColorPalette.lateOcean,
2362
- primaryLight: lateOceanColorPalette.lateOceanLight1,
2363
- accent: lateOceanColorPalette.warmEmbrace,
2364
- accentLight: lateOceanColorPalette.warmEmbraceLight1,
2365
- success: lateOceanColorPalette.viride,
2366
- correct: lateOceanColorPalette.viride,
2367
- danger: lateOceanColorPalette.englishVermillon,
2368
- separator: lateOceanColorPalette.black100,
2369
- hover: lateOceanColorPalette.black100,
2370
- black: lateOceanColorPalette.black1000,
2371
- uiBackground: lateOceanColorPalette.black25,
2372
- uiBackgroundLight: lateOceanColorPalette.white,
2373
- overlay: {
2374
- dark: 'rgba(41, 48, 51, 0.25)',
2375
- light: 'rgba(255, 255, 255, 0.90)',
2376
- fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
2377
- }
2378
- };
2379
-
2380
2614
  const feedbackMessageLateOceanTheme = {
2381
2615
  backgroundColors: {
2382
2616
  success: lateOceanColorPalette.viride,
@@ -2490,11 +2724,11 @@ const iconButton = {
2490
2724
  },
2491
2725
  disabled: {
2492
2726
  scale: 1,
2493
- backgroundColor: buttonLateOceanTheme.secondary.disabledBackgroundColor,
2494
- borderColor: buttonLateOceanTheme.secondary.disabledBorderColor
2727
+ backgroundColor: buttonLateOceanTheme.disabled.backgroundColor,
2728
+ borderColor: buttonLateOceanTheme.disabled.borderColor
2495
2729
  },
2496
2730
  default: {
2497
- pressedBackgroundColor: buttonLateOceanTheme.secondary.pressedBackgroundColor
2731
+ pressedBackgroundColor: buttonLateOceanTheme.default.pressedBackgroundColor
2498
2732
  },
2499
2733
  white: {
2500
2734
  pressedBackgroundColor: buttonLateOceanTheme.white.hoverBackgroundColor
@@ -2656,7 +2890,7 @@ const breakpoints = {
2656
2890
  wideBreakpoint: 'max-width: 1279px'
2657
2891
  }
2658
2892
  }; // eslint-disable-next-line unicorn/expiring-todo-comments
2659
- // TODO : seperate brand color usage definition from proper theme definition and add typings - https://ornikar.atlassian.net/browse/CME-156
2893
+ // TODO : seperate brand co lor usage definition from proper theme definition and add t ypings - https://ornikar.atlassian.net/browse/CME-156
2660
2894
 
2661
2895
  const theme = {
2662
2896
  spacing: 4,
@@ -3037,16 +3271,21 @@ function TypographyEmoji({
3037
3271
  });
3038
3272
  }
3039
3273
 
3040
- const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/styledLinaria("span")({
3274
+ const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react$1.styled("span")({
3041
3275
  name: "TypographyLinkWebWrapper",
3042
- class: "tcwz3nt"
3276
+ class: "tcwz3nt",
3277
+ vars: {
3278
+ "tcwz3nt-0": [({
3279
+ $hasNoUnderline
3280
+ }) => $hasNoUnderline ? 'underline' : 'none']
3281
+ }
3043
3282
  }));
3044
3283
  const StyledLink = /*#__PURE__*/styled__default.Text.withConfig({
3045
3284
  displayName: "TypographyLink__StyledLink",
3046
3285
  componentId: "kitt-universal__sc-1o1zy30-0"
3047
3286
  })(["text-decoration:", ";", ";", ";"], ({
3048
- $noUnderline
3049
- }) => $noUnderline ? 'none' : 'underline', ({
3287
+ $hasNoUnderline
3288
+ }) => $hasNoUnderline ? 'none' : 'underline', ({
3050
3289
  $disabled
3051
3290
  }) => {
3052
3291
  if (reactNative.Platform.OS !== 'web') return undefined;
@@ -3075,10 +3314,10 @@ function TypographyLink({
3075
3314
  accessibilityRole: "none",
3076
3315
  children: /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
3077
3316
  as: TypographyLinkWebWrapper,
3078
- "data-nounderline": noUnderline ? true : undefined,
3317
+ $hasNoUnderline: noUnderline,
3079
3318
  children: /*#__PURE__*/jsxRuntime.jsx(StyledLink, {
3080
3319
  $disabled: disabled,
3081
- $noUnderline: noUnderline,
3320
+ $hasNoUnderline: noUnderline,
3082
3321
  href: href,
3083
3322
  hrefAttrs: hrefAttrs,
3084
3323
  accessibilityRole: "link",
@@ -3093,23 +3332,35 @@ function TypographyLink({
3093
3332
  });
3094
3333
  }
3095
3334
 
3096
- function matchWindowSize(currentWidth, {
3335
+ function matchWindowSize({
3336
+ width,
3337
+ height
3338
+ }, {
3097
3339
  minWidth,
3098
- maxWidth
3340
+ maxWidth,
3341
+ minHeight,
3342
+ maxHeight
3099
3343
  }) {
3100
- return currentWidth >= minWidth && (!maxWidth || currentWidth <= maxWidth);
3344
+ const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
3345
+ const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
3346
+ return hasWidthMatched && hasHeightMatched;
3101
3347
  }
3102
3348
  function useMatchWindowSize(options) {
3103
3349
  const {
3104
- width
3350
+ width,
3351
+ height
3105
3352
  } = reactNative.useWindowDimensions();
3106
- return matchWindowSize(width, options);
3353
+ return matchWindowSize({
3354
+ width,
3355
+ height
3356
+ }, options);
3107
3357
  }
3108
3358
 
3109
- function createWindowSizeHelper(currentWidth) {
3359
+ // eslint-disable-next-line no-restricted-imports
3360
+ function createWindowSizeHelper(dimensions) {
3110
3361
  return {
3111
- matchWindowSize: options => matchWindowSize(currentWidth, options),
3112
- ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(currentWidth, options) ? valueIfTrue : valueIfFalse,
3362
+ matchWindowSize: options => matchWindowSize(dimensions, options),
3363
+ ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(dimensions, options) ? valueIfTrue : valueIfFalse,
3113
3364
  mapWindowWidth: (...widthList) => {
3114
3365
  if ((process.env.NODE_ENV !== "production")) {
3115
3366
  widthList.slice(1).forEach(([minWidth], index) => {
@@ -3121,7 +3372,7 @@ function createWindowSizeHelper(currentWidth) {
3121
3372
  });
3122
3373
  }
3123
3374
 
3124
- const found = widthList.find(([minWidth, value]) => matchWindowSize(currentWidth, {
3375
+ const found = widthList.find(([minWidth, value]) => matchWindowSize(dimensions, {
3125
3376
  minWidth: Number(minWidth)
3126
3377
  }));
3127
3378
  if (!found) return null;
@@ -3131,16 +3382,14 @@ function createWindowSizeHelper(currentWidth) {
3131
3382
  }
3132
3383
 
3133
3384
  function useKittTheme() {
3134
- const {
3135
- width
3136
- } = reactNative.useWindowDimensions();
3385
+ const dimensions = reactNative.useWindowDimensions();
3137
3386
  return react.useMemo(() => {
3138
3387
  return {
3139
3388
  kitt: theme,
3140
- responsive: createWindowSizeHelper(width),
3389
+ responsive: createWindowSizeHelper(dimensions),
3141
3390
  breakpoints
3142
3391
  };
3143
- }, [width]);
3392
+ }, [dimensions]);
3144
3393
  }
3145
3394
 
3146
3395
  function KittThemeProvider({