@ornikar/kitt-universal 3.0.0 → 3.3.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.
- package/dist/definitions/Button/AnimatedButtonPressable.d.ts +14 -0
- package/dist/definitions/Button/AnimatedButtonPressable.d.ts.map +1 -0
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +17 -0
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -0
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts +11 -0
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts.map +1 -0
- package/dist/definitions/Button/Button.d.ts +9 -4
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonContent.d.ts +11 -3
- package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
- package/dist/definitions/Button/StyledDisabled.d.ts +3 -0
- package/dist/definitions/Button/StyledDisabled.d.ts.map +1 -0
- package/dist/definitions/Button/isSubtle.d.ts +3 -0
- package/dist/definitions/Button/isSubtle.d.ts.map +1 -0
- package/dist/definitions/Icon/SpinningIcon.web.d.ts.map +1 -1
- package/dist/definitions/IconButton/PressableIconButton.d.ts.map +1 -1
- package/dist/definitions/Loader/LargeLoader.web.d.ts.map +1 -1
- package/dist/definitions/Loader/Loader.d.ts +1 -1
- package/dist/definitions/Loader/Loader.d.ts.map +1 -1
- package/dist/definitions/themes/default.d.ts +3 -43
- package/dist/definitions/themes/default.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts +42 -35
- package/dist/definitions/themes/late-ocean/buttonLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts +2 -0
- package/dist/definitions/themes/late-ocean/colorsLateOceanTheme.d.ts.map +1 -1
- package/dist/definitions/typography/Typography.d.ts +11 -11
- package/dist/definitions/typography/TypographyIcon.d.ts +2 -2
- package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
- package/dist/definitions/typography/TypographyLink.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts +7 -2
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts +5 -2
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts.map +1 -1
- package/dist/definitions/utils/withTheme.d.ts +2 -2
- package/dist/definitions/utils/withTheme.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +421 -234
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +421 -234
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +425 -238
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +421 -228
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +448 -206
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.css +1 -0
- package/dist/index-node-14.17.cjs.web.js +400 -196
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/styles.css +1 -0
- package/dist/tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/definitions/Button/ButtonPressable.d.ts +0 -13
- package/dist/definitions/Button/ButtonPressable.d.ts.map +0 -1
|
@@ -27,8 +27,7 @@ const styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
27
27
|
// return (<WrappedComponent theme={theme} {...(props as any)} />) as any;
|
|
28
28
|
// };
|
|
29
29
|
// }
|
|
30
|
-
function withTheme(
|
|
31
|
-
WrappedComponent) {
|
|
30
|
+
function withTheme(WrappedComponent) {
|
|
32
31
|
return function (props) {
|
|
33
32
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
34
33
|
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, {
|
|
@@ -50,7 +49,7 @@ function SpinningIcon({
|
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
const IconContainer$
|
|
52
|
+
const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
54
53
|
displayName: "Icon__IconContainer",
|
|
55
54
|
componentId: "kitt-universal__sc-usm0ol-0"
|
|
56
55
|
})(["color:", ";width:", "px;height:", "px;align-self:", ";"], ({
|
|
@@ -72,7 +71,7 @@ function Icon({
|
|
|
72
71
|
const clonedIcon = /*#__PURE__*/react$1.cloneElement(icon, {
|
|
73
72
|
color
|
|
74
73
|
});
|
|
75
|
-
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$
|
|
74
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconContainer$1, {
|
|
76
75
|
align: align,
|
|
77
76
|
size: size,
|
|
78
77
|
color: color,
|
|
@@ -357,79 +356,235 @@ function Avatar({
|
|
|
357
356
|
});
|
|
358
357
|
}
|
|
359
358
|
|
|
360
|
-
function
|
|
361
|
-
|
|
362
|
-
const theme = /*#__PURE__*/styled.useTheme();
|
|
363
|
-
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
|
|
364
|
-
color: theme.kitt.typography.colors[color]
|
|
365
|
-
});
|
|
359
|
+
function isSubtle(type) {
|
|
360
|
+
return type.startsWith('subtle');
|
|
366
361
|
}
|
|
367
362
|
|
|
363
|
+
const AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/react.styled("div")({
|
|
364
|
+
name: "AnimatedButtonPressableContainer",
|
|
365
|
+
class: "a1vkj3mh",
|
|
366
|
+
vars: {
|
|
367
|
+
"a1vkj3mh-0": [({
|
|
368
|
+
$isStretch
|
|
369
|
+
}) => $isStretch ? 'inherit' : 'inline-flex'],
|
|
370
|
+
"a1vkj3mh-1": [({
|
|
371
|
+
$isStretch
|
|
372
|
+
}) => $isStretch ? 'stretch' : 'baseline'],
|
|
373
|
+
"a1vkj3mh-2": [({
|
|
374
|
+
theme
|
|
375
|
+
}) => theme.breakpoints.min.mediumBreakpoint],
|
|
376
|
+
"a1vkj3mh-3": [({
|
|
377
|
+
theme
|
|
378
|
+
}) => theme.kitt.button.scale.medium.hover],
|
|
379
|
+
"a1vkj3mh-4": [({
|
|
380
|
+
theme,
|
|
381
|
+
$isDisabled
|
|
382
|
+
}) => `scale(${$isDisabled ? 1 : theme.kitt.button.scale.base.active})`],
|
|
383
|
+
"a1vkj3mh-5": [({
|
|
384
|
+
theme,
|
|
385
|
+
$type,
|
|
386
|
+
$isDisabled
|
|
387
|
+
}) => {
|
|
388
|
+
if ($isDisabled) return theme.kitt.button.disabled.hoverBackgroundColor;
|
|
389
|
+
return theme.kitt.button[$type].hoverBackgroundColor;
|
|
390
|
+
}],
|
|
391
|
+
"a1vkj3mh-6": [({
|
|
392
|
+
theme
|
|
393
|
+
}) => {
|
|
394
|
+
const {
|
|
395
|
+
duration,
|
|
396
|
+
timingFunction
|
|
397
|
+
} = theme.kitt.button.transition;
|
|
398
|
+
return `color, background, border-color, ${duration} ${timingFunction}`;
|
|
399
|
+
}],
|
|
400
|
+
"a1vkj3mh-7": [({
|
|
401
|
+
theme
|
|
402
|
+
}) => theme.kitt.button.borderRadius],
|
|
403
|
+
"a1vkj3mh-8": [({
|
|
404
|
+
theme
|
|
405
|
+
}) => `opacity ${theme.kitt.button.transition.duration} ${theme.kitt.button.transition.timingFunction}`],
|
|
406
|
+
"a1vkj3mh-9": [({
|
|
407
|
+
$isDisabled
|
|
408
|
+
}) => $isDisabled ? 1 : 0],
|
|
409
|
+
"a1vkj3mh-10": [({
|
|
410
|
+
theme
|
|
411
|
+
}) => `-${theme.kitt.button.borderWidth.disabled}`],
|
|
412
|
+
"a1vkj3mh-12": [({
|
|
413
|
+
theme
|
|
414
|
+
}) => `calc(100% - ${parseInt(theme.kitt.button.borderWidth.disabled, 10) * 0.5}px)`],
|
|
415
|
+
"a1vkj3mh-14": [({
|
|
416
|
+
theme
|
|
417
|
+
}) => `${theme.kitt.button.disabled.borderColor} solid ${theme.kitt.button.borderWidth.disabled}`],
|
|
418
|
+
"a1vkj3mh-15": [({
|
|
419
|
+
theme,
|
|
420
|
+
$type
|
|
421
|
+
}) => `${theme.kitt.button.borderWidth.focus} solid ${theme.kitt.button[$type].focusBorderColor}`],
|
|
422
|
+
"a1vkj3mh-16": [({
|
|
423
|
+
theme
|
|
424
|
+
}) => `-${theme.kitt.button.borderWidth.focus}`],
|
|
425
|
+
"a1vkj3mh-18": [({
|
|
426
|
+
theme,
|
|
427
|
+
$type,
|
|
428
|
+
$isDisabled
|
|
429
|
+
}) => {
|
|
430
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
431
|
+
if (!isSubtle($type)) return 'inherit';
|
|
432
|
+
return theme.kitt.button[$type].color;
|
|
433
|
+
}],
|
|
434
|
+
"a1vkj3mh-19": [({
|
|
435
|
+
theme,
|
|
436
|
+
$type,
|
|
437
|
+
$isDisabled
|
|
438
|
+
}) => {
|
|
439
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
440
|
+
if (!isSubtle($type)) return 'inherit';
|
|
441
|
+
return theme.kitt.button[$type].hoverColor;
|
|
442
|
+
}],
|
|
443
|
+
"a1vkj3mh-20": [({
|
|
444
|
+
theme,
|
|
445
|
+
$type,
|
|
446
|
+
$isDisabled
|
|
447
|
+
}) => {
|
|
448
|
+
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
449
|
+
if (!isSubtle($type)) return 'inherit';
|
|
450
|
+
return theme.kitt.button[$type].activeColor;
|
|
451
|
+
}]
|
|
452
|
+
}
|
|
453
|
+
}));
|
|
454
|
+
const AnimatedButtonPressable = /*#__PURE__*/react$1.forwardRef(({
|
|
455
|
+
$type,
|
|
456
|
+
$isStretch,
|
|
457
|
+
disabled,
|
|
458
|
+
...props
|
|
459
|
+
}, ref) => {
|
|
460
|
+
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressableContainer, {
|
|
461
|
+
ref: ref,
|
|
462
|
+
$type: $type,
|
|
463
|
+
$isDisabled: !!disabled,
|
|
464
|
+
$isStretch: $isStretch,
|
|
465
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BabelPluginStyledComponentsReactNative.Pressable, {
|
|
466
|
+
disabled: disabled,
|
|
467
|
+
...props
|
|
468
|
+
})
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
473
|
+
displayName: "BaseStyledButtonPressable",
|
|
474
|
+
componentId: "kitt-universal__sc-4k8lse-0"
|
|
475
|
+
})(["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:", ";"], ({
|
|
476
|
+
theme
|
|
477
|
+
}) => theme.kitt.button.minWidth, ({
|
|
478
|
+
theme,
|
|
479
|
+
$isStretch
|
|
480
|
+
}) => $isStretch ? '100%' : theme.kitt.button.maxWidth, ({
|
|
481
|
+
$isStretch
|
|
482
|
+
}) => $isStretch ? '100%' : 'auto', ({
|
|
483
|
+
theme
|
|
484
|
+
}) => theme.kitt.button.minHeight, ({
|
|
485
|
+
theme
|
|
486
|
+
}) => theme.kitt.button.borderRadius, ({
|
|
487
|
+
theme,
|
|
488
|
+
$isDisabled,
|
|
489
|
+
$type
|
|
490
|
+
}) => {
|
|
491
|
+
if ($isDisabled) return theme.kitt.button.disabled.backgroundColor;
|
|
492
|
+
return theme.kitt.button[$type].backgroundColor;
|
|
493
|
+
}, ({
|
|
494
|
+
theme,
|
|
495
|
+
$isLarge,
|
|
496
|
+
$isDisabled
|
|
497
|
+
}) => {
|
|
498
|
+
const {
|
|
499
|
+
large,
|
|
500
|
+
default: defaultPadding,
|
|
501
|
+
disabled: disabledPadding
|
|
502
|
+
} = theme.kitt.button.contentPadding;
|
|
503
|
+
if ($isLarge) return large;
|
|
504
|
+
if ($isDisabled) return disabledPadding;
|
|
505
|
+
return defaultPadding;
|
|
506
|
+
});
|
|
507
|
+
|
|
368
508
|
function TypographyIconSpecifiedColor({
|
|
369
509
|
color,
|
|
370
|
-
...
|
|
510
|
+
...props
|
|
371
511
|
}) {
|
|
372
512
|
const theme = /*#__PURE__*/styled.useTheme();
|
|
373
|
-
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...
|
|
374
|
-
color: theme.kitt.typography.colors[color]
|
|
513
|
+
return /*#__PURE__*/jsxRuntime.jsx(Icon, { ...props,
|
|
514
|
+
color: color === 'inherit' ? 'inherit' : theme.kitt.typography.colors[color]
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function TypographyIconInheritColor(props) {
|
|
519
|
+
const color = useTypographyColor();
|
|
520
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
|
|
521
|
+
color: color,
|
|
522
|
+
...props
|
|
375
523
|
});
|
|
376
524
|
}
|
|
377
525
|
|
|
378
526
|
function TypographyIcon({
|
|
379
527
|
color,
|
|
380
|
-
...
|
|
528
|
+
...props
|
|
381
529
|
}) {
|
|
382
530
|
if (color) {
|
|
383
531
|
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconSpecifiedColor, {
|
|
384
532
|
color: color,
|
|
385
|
-
...
|
|
533
|
+
...props
|
|
386
534
|
});
|
|
387
535
|
}
|
|
388
536
|
|
|
389
|
-
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...
|
|
537
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIconInheritColor, { ...props
|
|
390
538
|
});
|
|
391
539
|
}
|
|
392
540
|
|
|
393
|
-
const getTextColorByType =
|
|
394
|
-
if (disabled) return 'black-light';
|
|
395
|
-
|
|
541
|
+
const getTextColorByType = type => {
|
|
396
542
|
switch (type) {
|
|
397
543
|
case 'primary':
|
|
398
544
|
return 'white';
|
|
399
545
|
|
|
546
|
+
case 'white':
|
|
547
|
+
return 'white';
|
|
548
|
+
|
|
400
549
|
case 'subtle':
|
|
401
|
-
return
|
|
550
|
+
return 'primary';
|
|
402
551
|
|
|
403
552
|
case 'subtle-dark':
|
|
404
|
-
return
|
|
553
|
+
return 'black';
|
|
405
554
|
|
|
406
|
-
case 'secondary':
|
|
407
555
|
default:
|
|
408
556
|
return 'black';
|
|
409
557
|
}
|
|
410
558
|
};
|
|
411
559
|
|
|
412
|
-
const
|
|
413
|
-
displayName: "
|
|
560
|
+
const StyledButtonText = /*#__PURE__*/styled__default(Typography.Text).withConfig({
|
|
561
|
+
displayName: "ButtonContent__StyledButtonText",
|
|
414
562
|
componentId: "kitt-universal__sc-dnyw3n-0"
|
|
415
|
-
})(["text-align:center;"])
|
|
416
|
-
|
|
417
|
-
|
|
563
|
+
})(["text-align:center;", " ", ""], () => {
|
|
564
|
+
// Make the multilines case work properly on native
|
|
565
|
+
// Breaks the web implem
|
|
566
|
+
return undefined;
|
|
567
|
+
}, ({
|
|
568
|
+
$type,
|
|
569
|
+
$isDisabled
|
|
570
|
+
}) => {
|
|
571
|
+
/* For subltes button, color changes when hovered.
|
|
572
|
+
* We don't want to use a mouse event handler with a react state to handle it
|
|
573
|
+
* For this precise case, we've decided to work outside the typography logic
|
|
574
|
+
*/
|
|
575
|
+
if ($isDisabled || !isSubtle($type)) return undefined;
|
|
576
|
+
return 'color: inherit';
|
|
577
|
+
});
|
|
578
|
+
const StyledIconContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
579
|
+
displayName: "ButtonContent__StyledIconContainer",
|
|
418
580
|
componentId: "kitt-universal__sc-dnyw3n-1"
|
|
419
|
-
})(["flex-direction:row;align-items:center;justify-content:center;flex:", ";"], ({
|
|
420
|
-
stretch,
|
|
421
|
-
iconOnly
|
|
422
|
-
}) => `${stretch || iconOnly ? 1 : 0} 1 auto`);
|
|
423
|
-
const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
424
|
-
displayName: "ButtonContent__IconContainer",
|
|
425
|
-
componentId: "kitt-universal__sc-dnyw3n-2"
|
|
426
581
|
})(["", ""], ({
|
|
427
582
|
theme,
|
|
428
|
-
iconPosition
|
|
583
|
+
$iconPosition
|
|
429
584
|
}) => {
|
|
430
|
-
const value = theme.kitt.spacing *
|
|
585
|
+
const value = theme.kitt.spacing * 2;
|
|
431
586
|
|
|
432
|
-
if (iconPosition === 'left') {
|
|
587
|
+
if ($iconPosition === 'left') {
|
|
433
588
|
return `margin: 0 ${value}px 0 0;`;
|
|
434
589
|
}
|
|
435
590
|
|
|
@@ -438,150 +593,158 @@ const IconContainer$1 = /*#__PURE__*/styled__default(BabelPluginStyledComponents
|
|
|
438
593
|
|
|
439
594
|
function ButtonIcon({
|
|
440
595
|
icon,
|
|
441
|
-
spin,
|
|
442
596
|
color,
|
|
443
|
-
|
|
597
|
+
spin,
|
|
444
598
|
iconPosition,
|
|
445
599
|
testID
|
|
446
600
|
}) {
|
|
447
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
448
|
-
iconPosition: iconPosition,
|
|
601
|
+
return /*#__PURE__*/jsxRuntime.jsx(StyledIconContainer, {
|
|
602
|
+
$iconPosition: iconPosition,
|
|
449
603
|
children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
450
604
|
icon: icon,
|
|
451
605
|
spin: spin,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
testID: testID
|
|
606
|
+
testID: testID,
|
|
607
|
+
color: color
|
|
455
608
|
})
|
|
456
609
|
});
|
|
457
610
|
}
|
|
458
611
|
|
|
459
|
-
|
|
612
|
+
const StyledChildrenWithIcon = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
613
|
+
displayName: "ButtonContent__StyledChildrenWithIcon",
|
|
614
|
+
componentId: "kitt-universal__sc-dnyw3n-2"
|
|
615
|
+
})(["align-items:center;justify-content:center;flex-direction:row;"]);
|
|
616
|
+
function ButtonContentChildren({
|
|
460
617
|
type,
|
|
461
|
-
isPressed,
|
|
462
|
-
stretch,
|
|
463
618
|
icon,
|
|
464
619
|
iconPosition,
|
|
465
620
|
iconSpin,
|
|
466
|
-
|
|
621
|
+
isDisabled,
|
|
622
|
+
color,
|
|
467
623
|
children
|
|
468
624
|
}) {
|
|
469
|
-
const color = getTextColorByType(type, Boolean(isPressed), Boolean(disabled));
|
|
470
|
-
const theme = /*#__PURE__*/styled.useTheme();
|
|
471
|
-
const sharedIconProps = {
|
|
472
|
-
spin: iconSpin,
|
|
473
|
-
color,
|
|
474
|
-
size: theme.kitt.button.iconSize
|
|
475
|
-
};
|
|
476
|
-
|
|
477
625
|
if ((process.env.NODE_ENV !== "production")) {
|
|
478
626
|
if (!(children || icon)) {
|
|
479
627
|
throw new Error('kitt(Button): You should provide at least a children or a icon');
|
|
480
628
|
}
|
|
481
629
|
}
|
|
482
630
|
|
|
631
|
+
const isWebSubtle = isSubtle(type) && "web" === 'web' && !isDisabled;
|
|
632
|
+
|
|
483
633
|
if (!children) {
|
|
484
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
})
|
|
634
|
+
return /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
|
|
635
|
+
spin: iconSpin // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
636
|
+
,
|
|
637
|
+
icon: icon,
|
|
638
|
+
color: isWebSubtle ? 'inherit' : color
|
|
490
639
|
});
|
|
491
640
|
}
|
|
492
641
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
642
|
+
const buttonIconSharedProps = {
|
|
643
|
+
type,
|
|
644
|
+
spin: iconSpin,
|
|
645
|
+
iconPosition,
|
|
646
|
+
color: isWebSubtle ? 'inherit' : color
|
|
647
|
+
};
|
|
648
|
+
return /*#__PURE__*/jsxRuntime.jsxs(StyledChildrenWithIcon, {
|
|
649
|
+
children: [icon && iconPosition === 'left' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
|
|
650
|
+
testID: "button-left-icon",
|
|
651
|
+
icon: icon
|
|
652
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(StyledButtonText, {
|
|
500
653
|
base: "body",
|
|
501
|
-
color: color,
|
|
502
654
|
variant: "bold",
|
|
655
|
+
$type: type,
|
|
656
|
+
$isDisabled: isDisabled // set to color: inherit via styled components
|
|
657
|
+
,
|
|
658
|
+
color: isWebSubtle ? undefined : color,
|
|
503
659
|
children: children
|
|
504
|
-
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...
|
|
505
|
-
icon: icon
|
|
506
|
-
iconPosition: iconPosition
|
|
660
|
+
}), icon && iconPosition === 'right' ? /*#__PURE__*/jsxRuntime.jsx(ButtonIcon, { ...buttonIconSharedProps,
|
|
661
|
+
icon: icon
|
|
507
662
|
}) : null]
|
|
508
663
|
});
|
|
509
664
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}) => theme.kitt.button.minWidth, ({
|
|
517
|
-
theme,
|
|
518
|
-
stretch
|
|
519
|
-
}) => stretch ? 'auto' : theme.kitt.button.maxWidth, ({
|
|
520
|
-
stretch
|
|
521
|
-
}) => stretch ? '100%' : 'auto', ({
|
|
522
|
-
theme
|
|
523
|
-
}) => theme.kitt.button.minHeight, ({
|
|
524
|
-
theme,
|
|
525
|
-
isPressed,
|
|
526
|
-
disabled,
|
|
527
|
-
type
|
|
665
|
+
const ButtonContentContainer = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
666
|
+
displayName: "ButtonContent__ButtonContentContainer",
|
|
667
|
+
componentId: "kitt-universal__sc-dnyw3n-3"
|
|
668
|
+
})(["line-height:16px;", " ", ";"], ({
|
|
669
|
+
$isStretch,
|
|
670
|
+
$isIconOnly
|
|
528
671
|
}) => {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return isPressed ? theme.kitt.button[type].pressedBackgroundColor : theme.kitt.button[type].backgroundColor;
|
|
672
|
+
return `
|
|
673
|
+
flex: ${$isStretch || $isIconOnly ? 1 : 0} 1 auto;
|
|
674
|
+
`;
|
|
534
675
|
}, ({
|
|
535
|
-
|
|
536
|
-
}) =>
|
|
537
|
-
|
|
538
|
-
}) => theme.kitt.button.borderRadius, ({
|
|
539
|
-
theme,
|
|
540
|
-
disabled,
|
|
541
|
-
type
|
|
542
|
-
}) => disabled ? theme.kitt.button[type].disabledBorderColor : 'transparent', ({
|
|
543
|
-
theme
|
|
544
|
-
}) => theme.kitt.button.borderWidth);
|
|
676
|
+
$isSubtle
|
|
677
|
+
}) => {
|
|
678
|
+
if (!$isSubtle) return undefined; // Needed for subtle type
|
|
545
679
|
|
|
546
|
-
|
|
680
|
+
return 'color: inherit';
|
|
681
|
+
});
|
|
682
|
+
function ButtonContent({
|
|
683
|
+
type,
|
|
684
|
+
isDisabled,
|
|
685
|
+
$isStretch,
|
|
686
|
+
icon,
|
|
547
687
|
children,
|
|
548
|
-
|
|
688
|
+
...props
|
|
689
|
+
}) {
|
|
690
|
+
const color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
691
|
+
return /*#__PURE__*/jsxRuntime.jsx(ButtonContentContainer, {
|
|
692
|
+
$isSubtle: isSubtle(type),
|
|
693
|
+
$isStretch: $isStretch,
|
|
694
|
+
$isIconOnly: Boolean(!children && icon),
|
|
695
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ButtonContentChildren, {
|
|
696
|
+
icon: icon,
|
|
697
|
+
type: type,
|
|
698
|
+
isDisabled: isDisabled,
|
|
699
|
+
color: color,
|
|
700
|
+
...props,
|
|
701
|
+
children: children
|
|
702
|
+
})
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
const Button = /*#__PURE__*/react$1.forwardRef(({
|
|
707
|
+
children,
|
|
708
|
+
type = 'default',
|
|
709
|
+
disabled,
|
|
710
|
+
stretch,
|
|
711
|
+
large,
|
|
549
712
|
icon,
|
|
550
713
|
iconPosition = 'left',
|
|
551
714
|
iconSpin,
|
|
552
|
-
stretch,
|
|
553
|
-
disabled,
|
|
554
715
|
testID,
|
|
555
716
|
href,
|
|
556
717
|
hrefAttrs,
|
|
718
|
+
accessibilityRole = 'button',
|
|
557
719
|
onPress
|
|
558
|
-
}) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
stretch,
|
|
563
|
-
disabled
|
|
564
|
-
};
|
|
565
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonPressable // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
566
|
-
// TODO: When designs are defined, update with the proper onPress styles to mimic TouchableHighlight
|
|
567
|
-
// underlayColor={globalTheme.button[type].pressedBackgroundColor}
|
|
568
|
-
, { ...sharedProps,
|
|
569
|
-
isPressed: isPressed,
|
|
570
|
-
accessibilityRole: "button",
|
|
720
|
+
}, ref) => {
|
|
721
|
+
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
|
|
722
|
+
ref: ref,
|
|
723
|
+
accessibilityRole: accessibilityRole,
|
|
571
724
|
testID: testID,
|
|
572
725
|
href: href,
|
|
573
726
|
hrefAttrs: hrefAttrs,
|
|
727
|
+
disabled: disabled,
|
|
728
|
+
$isStretch: stretch,
|
|
729
|
+
$type: type,
|
|
574
730
|
onPress: onPress,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
731
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
|
|
732
|
+
$type: type,
|
|
733
|
+
$isStretch: stretch,
|
|
734
|
+
$isLarge: large,
|
|
735
|
+
$isDisabled: disabled,
|
|
736
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
|
|
737
|
+
type: type,
|
|
738
|
+
$isStretch: stretch,
|
|
739
|
+
isDisabled: disabled,
|
|
740
|
+
icon: icon,
|
|
741
|
+
iconPosition: iconPosition,
|
|
742
|
+
iconSpin: iconSpin,
|
|
743
|
+
children: children
|
|
744
|
+
}), null]
|
|
582
745
|
})
|
|
583
746
|
});
|
|
584
|
-
}
|
|
747
|
+
});
|
|
585
748
|
|
|
586
749
|
const Container$5 = /*#__PURE__*/styled__default(BabelPluginStyledComponentsReactNative.View).withConfig({
|
|
587
750
|
displayName: "Card__Container",
|
|
@@ -2164,47 +2327,98 @@ const avatarLateOceanTheme = {
|
|
|
2164
2327
|
}
|
|
2165
2328
|
};
|
|
2166
2329
|
|
|
2330
|
+
const colorsLateOceanTheme = {
|
|
2331
|
+
primary: lateOceanColorPalette.lateOcean,
|
|
2332
|
+
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2333
|
+
accent: lateOceanColorPalette.warmEmbrace,
|
|
2334
|
+
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2335
|
+
success: lateOceanColorPalette.viride,
|
|
2336
|
+
correct: lateOceanColorPalette.viride,
|
|
2337
|
+
danger: lateOceanColorPalette.englishVermillon,
|
|
2338
|
+
separator: lateOceanColorPalette.black100,
|
|
2339
|
+
hover: lateOceanColorPalette.black100,
|
|
2340
|
+
black: lateOceanColorPalette.black1000,
|
|
2341
|
+
uiBackground: lateOceanColorPalette.black25,
|
|
2342
|
+
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2343
|
+
transparent: lateOceanColorPalette.transparent,
|
|
2344
|
+
disabled: lateOceanColorPalette.black50,
|
|
2345
|
+
overlay: {
|
|
2346
|
+
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2347
|
+
light: 'rgba(255, 255, 255, 0.90)',
|
|
2348
|
+
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2349
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
|
|
2167
2352
|
const buttonLateOceanTheme = {
|
|
2168
2353
|
borderRadius: '30px',
|
|
2169
|
-
borderWidth:
|
|
2170
|
-
|
|
2354
|
+
borderWidth: {
|
|
2355
|
+
disabled: '2px',
|
|
2356
|
+
focus: '3px'
|
|
2357
|
+
},
|
|
2358
|
+
minHeight: '40px',
|
|
2171
2359
|
minWidth: '40px',
|
|
2172
2360
|
maxWidth: '335px',
|
|
2173
|
-
|
|
2361
|
+
scale: {
|
|
2362
|
+
base: {
|
|
2363
|
+
default: 1,
|
|
2364
|
+
hover: 0.95,
|
|
2365
|
+
active: 0.95
|
|
2366
|
+
},
|
|
2367
|
+
medium: {
|
|
2368
|
+
hover: 1.05
|
|
2369
|
+
}
|
|
2370
|
+
},
|
|
2174
2371
|
contentPadding: {
|
|
2175
|
-
default: '8px 16px'
|
|
2372
|
+
default: '8px 16px 7px',
|
|
2373
|
+
large: '12px 24px 11px',
|
|
2374
|
+
disabled: '6px 14px 5px'
|
|
2176
2375
|
},
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
pressedBackgroundColor: lateOceanColorPalette.lateOceanLight1,
|
|
2181
|
-
disabledBorderColor: lateOceanColorPalette.black100
|
|
2376
|
+
transition: {
|
|
2377
|
+
duration: '200ms',
|
|
2378
|
+
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
2182
2379
|
},
|
|
2183
|
-
|
|
2380
|
+
default: {
|
|
2184
2381
|
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
2185
|
-
disabledBackgroundColor: lateOceanColorPalette.black50,
|
|
2186
2382
|
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2187
|
-
|
|
2383
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2384
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
2188
2385
|
},
|
|
2189
|
-
|
|
2190
|
-
backgroundColor:
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
},
|
|
2195
|
-
'subtle-dark': {
|
|
2196
|
-
backgroundColor: lateOceanColorPalette.transparent,
|
|
2197
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2198
|
-
pressedBackgroundColor: lateOceanColorPalette.transparent,
|
|
2199
|
-
disabledBorderColor: lateOceanColorPalette.transparent
|
|
2386
|
+
primary: {
|
|
2387
|
+
backgroundColor: colorsLateOceanTheme.primary,
|
|
2388
|
+
pressedBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2389
|
+
hoverBackgroundColor: colorsLateOceanTheme.primaryLight,
|
|
2390
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
2200
2391
|
},
|
|
2201
2392
|
white: {
|
|
2202
2393
|
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
2203
|
-
disabledBackgroundColor: lateOceanColorPalette.transparent,
|
|
2204
|
-
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2205
2394
|
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2206
|
-
|
|
2207
|
-
|
|
2395
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
2396
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
2397
|
+
},
|
|
2398
|
+
subtle: {
|
|
2399
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2400
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2401
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2402
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
2403
|
+
color: colorsLateOceanTheme.primary,
|
|
2404
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
2405
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
2406
|
+
},
|
|
2407
|
+
'subtle-dark': {
|
|
2408
|
+
backgroundColor: colorsLateOceanTheme.transparent,
|
|
2409
|
+
pressedBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2410
|
+
hoverBackgroundColor: colorsLateOceanTheme.transparent,
|
|
2411
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
2412
|
+
color: colorsLateOceanTheme.black,
|
|
2413
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
2414
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
2415
|
+
},
|
|
2416
|
+
disabled: {
|
|
2417
|
+
backgroundColor: colorsLateOceanTheme.disabled,
|
|
2418
|
+
pressedBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2419
|
+
hoverBackgroundColor: colorsLateOceanTheme.disabled,
|
|
2420
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
2421
|
+
borderColor: lateOceanColorPalette.black100
|
|
2208
2422
|
}
|
|
2209
2423
|
};
|
|
2210
2424
|
|
|
@@ -2226,26 +2440,6 @@ const cardLateOceanTheme = {
|
|
|
2226
2440
|
}
|
|
2227
2441
|
};
|
|
2228
2442
|
|
|
2229
|
-
const colorsLateOceanTheme = {
|
|
2230
|
-
primary: lateOceanColorPalette.lateOcean,
|
|
2231
|
-
primaryLight: lateOceanColorPalette.lateOceanLight1,
|
|
2232
|
-
accent: lateOceanColorPalette.warmEmbrace,
|
|
2233
|
-
accentLight: lateOceanColorPalette.warmEmbraceLight1,
|
|
2234
|
-
success: lateOceanColorPalette.viride,
|
|
2235
|
-
correct: lateOceanColorPalette.viride,
|
|
2236
|
-
danger: lateOceanColorPalette.englishVermillon,
|
|
2237
|
-
separator: lateOceanColorPalette.black100,
|
|
2238
|
-
hover: lateOceanColorPalette.black100,
|
|
2239
|
-
black: lateOceanColorPalette.black1000,
|
|
2240
|
-
uiBackground: lateOceanColorPalette.black25,
|
|
2241
|
-
uiBackgroundLight: lateOceanColorPalette.white,
|
|
2242
|
-
overlay: {
|
|
2243
|
-
dark: 'rgba(41, 48, 51, 0.25)',
|
|
2244
|
-
light: 'rgba(255, 255, 255, 0.90)',
|
|
2245
|
-
fullscreenLoader: 'rgba(0, 0, 0, 0.25)'
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
|
|
2249
2443
|
const feedbackMessageLateOceanTheme = {
|
|
2250
2444
|
backgroundColors: {
|
|
2251
2445
|
success: lateOceanColorPalette.viride,
|
|
@@ -2359,11 +2553,11 @@ const iconButton = {
|
|
|
2359
2553
|
},
|
|
2360
2554
|
disabled: {
|
|
2361
2555
|
scale: 1,
|
|
2362
|
-
backgroundColor: buttonLateOceanTheme.
|
|
2363
|
-
borderColor: buttonLateOceanTheme.
|
|
2556
|
+
backgroundColor: buttonLateOceanTheme.disabled.backgroundColor,
|
|
2557
|
+
borderColor: buttonLateOceanTheme.disabled.borderColor
|
|
2364
2558
|
},
|
|
2365
2559
|
default: {
|
|
2366
|
-
pressedBackgroundColor: buttonLateOceanTheme.
|
|
2560
|
+
pressedBackgroundColor: buttonLateOceanTheme.default.pressedBackgroundColor
|
|
2367
2561
|
},
|
|
2368
2562
|
white: {
|
|
2369
2563
|
pressedBackgroundColor: buttonLateOceanTheme.white.hoverBackgroundColor
|
|
@@ -2525,7 +2719,7 @@ const breakpoints = {
|
|
|
2525
2719
|
wideBreakpoint: 'max-width: 1279px'
|
|
2526
2720
|
}
|
|
2527
2721
|
}; // eslint-disable-next-line unicorn/expiring-todo-comments
|
|
2528
|
-
// TODO : seperate brand
|
|
2722
|
+
// TODO : seperate brand co lor usage definition from proper theme definition and add t ypings - https://ornikar.atlassian.net/browse/CME-156
|
|
2529
2723
|
|
|
2530
2724
|
const theme = {
|
|
2531
2725
|
spacing: 4,
|
|
@@ -2841,23 +3035,35 @@ function TypographyLink({
|
|
|
2841
3035
|
});
|
|
2842
3036
|
}
|
|
2843
3037
|
|
|
2844
|
-
function matchWindowSize(
|
|
3038
|
+
function matchWindowSize({
|
|
3039
|
+
width,
|
|
3040
|
+
height
|
|
3041
|
+
}, {
|
|
2845
3042
|
minWidth,
|
|
2846
|
-
maxWidth
|
|
3043
|
+
maxWidth,
|
|
3044
|
+
minHeight,
|
|
3045
|
+
maxHeight
|
|
2847
3046
|
}) {
|
|
2848
|
-
|
|
3047
|
+
const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
|
|
3048
|
+
const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
|
|
3049
|
+
return hasWidthMatched && hasHeightMatched;
|
|
2849
3050
|
}
|
|
2850
3051
|
function useMatchWindowSize(options) {
|
|
2851
3052
|
const {
|
|
2852
|
-
width
|
|
3053
|
+
width,
|
|
3054
|
+
height
|
|
2853
3055
|
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
2854
|
-
return matchWindowSize(
|
|
3056
|
+
return matchWindowSize({
|
|
3057
|
+
width,
|
|
3058
|
+
height
|
|
3059
|
+
}, options);
|
|
2855
3060
|
}
|
|
2856
3061
|
|
|
2857
|
-
|
|
3062
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3063
|
+
function createWindowSizeHelper(dimensions) {
|
|
2858
3064
|
return {
|
|
2859
|
-
matchWindowSize: options => matchWindowSize(
|
|
2860
|
-
ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(
|
|
3065
|
+
matchWindowSize: options => matchWindowSize(dimensions, options),
|
|
3066
|
+
ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(dimensions, options) ? valueIfTrue : valueIfFalse,
|
|
2861
3067
|
mapWindowWidth: (...widthList) => {
|
|
2862
3068
|
if ((process.env.NODE_ENV !== "production")) {
|
|
2863
3069
|
widthList.slice(1).forEach(([minWidth], index) => {
|
|
@@ -2869,7 +3075,7 @@ function createWindowSizeHelper(currentWidth) {
|
|
|
2869
3075
|
});
|
|
2870
3076
|
}
|
|
2871
3077
|
|
|
2872
|
-
const found = widthList.find(([minWidth, value]) => matchWindowSize(
|
|
3078
|
+
const found = widthList.find(([minWidth, value]) => matchWindowSize(dimensions, {
|
|
2873
3079
|
minWidth: Number(minWidth)
|
|
2874
3080
|
}));
|
|
2875
3081
|
if (!found) return null;
|
|
@@ -2879,16 +3085,14 @@ function createWindowSizeHelper(currentWidth) {
|
|
|
2879
3085
|
}
|
|
2880
3086
|
|
|
2881
3087
|
function useKittTheme() {
|
|
2882
|
-
const
|
|
2883
|
-
width
|
|
2884
|
-
} = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
3088
|
+
const dimensions = BabelPluginStyledComponentsReactNative.useWindowDimensions();
|
|
2885
3089
|
return react$1.useMemo(() => {
|
|
2886
3090
|
return {
|
|
2887
3091
|
kitt: theme,
|
|
2888
|
-
responsive: createWindowSizeHelper(
|
|
3092
|
+
responsive: createWindowSizeHelper(dimensions),
|
|
2889
3093
|
breakpoints
|
|
2890
3094
|
};
|
|
2891
|
-
}, [
|
|
3095
|
+
}, [dimensions]);
|
|
2892
3096
|
}
|
|
2893
3097
|
|
|
2894
3098
|
function KittThemeProvider({
|