@ornikar/kitt-universal 6.0.0 → 6.1.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 +2 -1
- package/dist/definitions/Button/AnimatedButtonPressable.d.ts.map +1 -1
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +2 -1
- package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -1
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts +2 -1
- package/dist/definitions/Button/BaseStyledButtonPressable.d.ts.map +1 -1
- package/dist/definitions/Button/Button.d.ts +2 -0
- package/dist/definitions/Button/Button.d.ts.map +1 -1
- package/dist/definitions/Button/ButtonContent.d.ts +3 -2
- package/dist/definitions/Button/ButtonContent.d.ts.map +1 -1
- package/dist/definitions/Button/getVariantValuesIfExist.d.ts +5 -0
- package/dist/definitions/Button/getVariantValuesIfExist.d.ts.map +1 -0
- package/dist/definitions/ExternalLink/ExternalLink.d.ts +3 -3
- package/dist/definitions/ExternalLink/ExternalLink.d.ts.map +1 -1
- package/dist/definitions/themes/late-ocean/button.d.ts +26 -9
- package/dist/definitions/themes/late-ocean/button.d.ts.map +1 -1
- package/dist/definitions/utils/tests/renderWithProvidersUtils.d.ts +4 -2
- package/dist/definitions/utils/tests/renderWithProvidersUtils.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +103 -49
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +103 -49
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +103 -49
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +117 -54
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +96 -46
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +113 -52
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.android.js +56 -35
- package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.ios.js +56 -35
- package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.js +56 -35
- package/dist/linaria-themes-browser-all.es.js.map +1 -1
- package/dist/linaria-themes-browser-all.es.web.js +56 -35
- package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.js +56 -35
- package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
- package/dist/linaria-themes-node-14.17.cjs.web.js +56 -35
- package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -370,11 +370,25 @@ function withTheme(WrappedComponent) {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
var hasVariant = function (button, variant) {
|
|
374
|
+
return variant in button;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
function getVariantValuesIfExist(theme, type, variant) {
|
|
378
|
+
var button = theme.kitt.button[type];
|
|
379
|
+
|
|
380
|
+
if (hasVariant(button, variant)) {
|
|
381
|
+
return button[variant];
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return theme.kitt.button[type]["default"];
|
|
385
|
+
}
|
|
386
|
+
|
|
373
387
|
function isSubtle(type) {
|
|
374
388
|
return type.startsWith('subtle');
|
|
375
389
|
}
|
|
376
390
|
|
|
377
|
-
var _excluded$f = ["$type", "$isStretch", "disabled"];
|
|
391
|
+
var _excluded$f = ["$type", "$variant", "$isStretch", "disabled"];
|
|
378
392
|
var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
|
|
379
393
|
name: "AnimatedButtonPressableContainer",
|
|
380
394
|
"class": "kitt-u_AnimatedButtonPressableContainer_a1vkj3mh",
|
|
@@ -399,9 +413,10 @@ var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
|
|
|
399
413
|
"a1vkj3mh-5": [function (_ref5) {
|
|
400
414
|
var theme = _ref5.theme,
|
|
401
415
|
$type = _ref5.$type,
|
|
416
|
+
$variant = _ref5.$variant,
|
|
402
417
|
$isDisabled = _ref5.$isDisabled;
|
|
403
|
-
if ($isDisabled) return theme.kitt.button.disabled.hoverBackgroundColor;
|
|
404
|
-
return theme
|
|
418
|
+
if ($isDisabled) return theme.kitt.button.disabled["default"].hoverBackgroundColor;
|
|
419
|
+
return getVariantValuesIfExist(theme, $type, $variant).hoverBackgroundColor;
|
|
405
420
|
}],
|
|
406
421
|
"a1vkj3mh-6": [function (_ref6) {
|
|
407
422
|
var theme = _ref6.theme;
|
|
@@ -432,12 +447,13 @@ var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
|
|
|
432
447
|
}],
|
|
433
448
|
"a1vkj3mh-14": [function (_ref12) {
|
|
434
449
|
var theme = _ref12.theme;
|
|
435
|
-
return "".concat(theme.kitt.button.borderWidth.disabled, "px solid ").concat(theme.kitt.button.disabled.borderColor);
|
|
450
|
+
return "".concat(theme.kitt.button.borderWidth.disabled, "px solid ").concat(theme.kitt.button.disabled["default"].borderColor);
|
|
436
451
|
}],
|
|
437
452
|
"a1vkj3mh-15": [function (_ref13) {
|
|
438
453
|
var theme = _ref13.theme,
|
|
439
|
-
$type = _ref13.$type
|
|
440
|
-
|
|
454
|
+
$type = _ref13.$type,
|
|
455
|
+
$variant = _ref13.$variant;
|
|
456
|
+
return "".concat(theme.kitt.button.borderWidth.focus, "px solid ").concat(getVariantValuesIfExist(theme, $type, $variant).focusBorderColor);
|
|
441
457
|
}],
|
|
442
458
|
"a1vkj3mh-16": [function (_ref14) {
|
|
443
459
|
var theme = _ref14.theme;
|
|
@@ -448,29 +464,42 @@ var AnimatedButtonPressableContainer = withTheme( /*#__PURE__*/styled$1("div")({
|
|
|
448
464
|
$type = _ref15.$type,
|
|
449
465
|
$isDisabled = _ref15.$isDisabled;
|
|
450
466
|
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
451
|
-
|
|
452
|
-
|
|
467
|
+
|
|
468
|
+
if (isSubtle($type)) {
|
|
469
|
+
return theme.kitt.button[$type]["default"].color;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return 'inherit';
|
|
453
473
|
}],
|
|
454
474
|
"a1vkj3mh-19": [function (_ref16) {
|
|
455
475
|
var theme = _ref16.theme,
|
|
456
476
|
$type = _ref16.$type,
|
|
457
477
|
$isDisabled = _ref16.$isDisabled;
|
|
458
478
|
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
459
|
-
|
|
460
|
-
|
|
479
|
+
|
|
480
|
+
if (isSubtle($type)) {
|
|
481
|
+
return theme.kitt.button[$type]["default"].hoverColor;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return 'inherit';
|
|
461
485
|
}],
|
|
462
486
|
"a1vkj3mh-20": [function (_ref17) {
|
|
463
487
|
var theme = _ref17.theme,
|
|
464
488
|
$type = _ref17.$type,
|
|
465
489
|
$isDisabled = _ref17.$isDisabled;
|
|
466
490
|
if ($isDisabled) return theme.kitt.typography.colors['black-light'];
|
|
467
|
-
|
|
468
|
-
|
|
491
|
+
|
|
492
|
+
if (isSubtle($type)) {
|
|
493
|
+
return theme.kitt.button[$type]["default"].activeColor;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
return 'inherit';
|
|
469
497
|
}]
|
|
470
498
|
}
|
|
471
499
|
}));
|
|
472
500
|
var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref18, ref) {
|
|
473
501
|
var $type = _ref18.$type,
|
|
502
|
+
$variant = _ref18.$variant,
|
|
474
503
|
$isStretch = _ref18.$isStretch,
|
|
475
504
|
disabled = _ref18.disabled,
|
|
476
505
|
props = _objectWithoutProperties(_ref18, _excluded$f);
|
|
@@ -478,6 +507,7 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref18, ref) {
|
|
|
478
507
|
return /*#__PURE__*/jsx(AnimatedButtonPressableContainer, {
|
|
479
508
|
ref: ref,
|
|
480
509
|
$type: $type,
|
|
510
|
+
$variant: $variant,
|
|
481
511
|
$isDisabled: !!disabled,
|
|
482
512
|
$isStretch: $isStretch,
|
|
483
513
|
children: /*#__PURE__*/jsx(Pressable, _objectSpread({
|
|
@@ -508,9 +538,10 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled(View).withConfig({
|
|
|
508
538
|
}, function (_ref6) {
|
|
509
539
|
var theme = _ref6.theme,
|
|
510
540
|
$isDisabled = _ref6.$isDisabled,
|
|
511
|
-
$type = _ref6.$type
|
|
512
|
-
|
|
513
|
-
return theme.kitt.button[
|
|
541
|
+
$type = _ref6.$type,
|
|
542
|
+
$variant = _ref6.$variant;
|
|
543
|
+
if ($isDisabled) return theme.kitt.button.disabled["default"].backgroundColor;
|
|
544
|
+
return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
|
|
514
545
|
}, function (_ref7) {
|
|
515
546
|
var theme = _ref7.theme,
|
|
516
547
|
$isLarge = _ref7.$isLarge,
|
|
@@ -557,12 +588,12 @@ function TypographyIcon(_ref2) {
|
|
|
557
588
|
return /*#__PURE__*/jsx(TypographyIconInheritColor, _objectSpread({}, props));
|
|
558
589
|
}
|
|
559
590
|
|
|
560
|
-
var _excluded$d = ["type", "isDisabled", "$isStretch", "icon", "children"];
|
|
591
|
+
var _excluded$d = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
|
|
561
592
|
|
|
562
|
-
var getTextColorByType = function (type) {
|
|
593
|
+
var getTextColorByType = function (type, variant) {
|
|
563
594
|
switch (type) {
|
|
564
595
|
case 'primary':
|
|
565
|
-
return 'white';
|
|
596
|
+
return variant === 'ghost' ? 'primary' : 'white';
|
|
566
597
|
|
|
567
598
|
case 'white':
|
|
568
599
|
return 'white';
|
|
@@ -691,13 +722,14 @@ var ButtonContentContainer = /*#__PURE__*/styled(View).withConfig({
|
|
|
691
722
|
});
|
|
692
723
|
function ButtonContent(_ref7) {
|
|
693
724
|
var type = _ref7.type,
|
|
725
|
+
variant = _ref7.variant,
|
|
694
726
|
isDisabled = _ref7.isDisabled,
|
|
695
727
|
$isStretch = _ref7.$isStretch,
|
|
696
728
|
icon = _ref7.icon,
|
|
697
729
|
children = _ref7.children,
|
|
698
730
|
props = _objectWithoutProperties(_ref7, _excluded$d);
|
|
699
731
|
|
|
700
|
-
var color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
732
|
+
var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
701
733
|
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
702
734
|
$isSubtle: isSubtle(type),
|
|
703
735
|
$isStretch: $isStretch,
|
|
@@ -717,6 +749,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
717
749
|
var children = _ref.children,
|
|
718
750
|
_ref$type = _ref.type,
|
|
719
751
|
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
752
|
+
_ref$variant = _ref.variant,
|
|
753
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
720
754
|
disabled = _ref.disabled,
|
|
721
755
|
stretch = _ref.stretch,
|
|
722
756
|
large = _ref.large,
|
|
@@ -729,6 +763,11 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
729
763
|
_ref$accessibilityRol = _ref.accessibilityRole,
|
|
730
764
|
accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
|
|
731
765
|
onPress = _ref.onPress;
|
|
766
|
+
|
|
767
|
+
if ((process.env.NODE_ENV !== "production") && variant === 'ghost' && type !== 'primary') {
|
|
768
|
+
throw new Error('variant=ghost is only allowed with type=primary');
|
|
769
|
+
}
|
|
770
|
+
|
|
732
771
|
return /*#__PURE__*/jsx(AnimatedButtonPressable, {
|
|
733
772
|
ref: ref,
|
|
734
773
|
accessibilityRole: accessibilityRole,
|
|
@@ -738,14 +777,17 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
738
777
|
disabled: disabled,
|
|
739
778
|
$isStretch: stretch,
|
|
740
779
|
$type: type,
|
|
780
|
+
$variant: variant,
|
|
741
781
|
onPress: onPress,
|
|
742
782
|
children: /*#__PURE__*/jsxs(BaseStyledButtonPressable, {
|
|
743
783
|
$type: type,
|
|
784
|
+
$variant: variant,
|
|
744
785
|
$isStretch: stretch,
|
|
745
786
|
$isLarge: large,
|
|
746
787
|
$isDisabled: disabled,
|
|
747
788
|
children: [/*#__PURE__*/jsx(ButtonContent, {
|
|
748
789
|
type: type,
|
|
790
|
+
variant: variant,
|
|
749
791
|
$isStretch: stretch,
|
|
750
792
|
isDisabled: disabled,
|
|
751
793
|
icon: icon,
|
|
@@ -932,47 +974,68 @@ var button = {
|
|
|
932
974
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
933
975
|
},
|
|
934
976
|
"default": {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
977
|
+
"default": {
|
|
978
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
979
|
+
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
980
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
981
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
982
|
+
}
|
|
939
983
|
},
|
|
940
984
|
primary: {
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
985
|
+
"default": {
|
|
986
|
+
backgroundColor: colors.primary,
|
|
987
|
+
pressedBackgroundColor: colors.primaryLight,
|
|
988
|
+
hoverBackgroundColor: colors.primaryLight,
|
|
989
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
990
|
+
},
|
|
991
|
+
ghost: {
|
|
992
|
+
backgroundColor: colors.uiBackgroundLight,
|
|
993
|
+
pressedBackgroundColor: colors.uiBackground,
|
|
994
|
+
hoverBackgroundColor: colors.hover,
|
|
995
|
+
focusBorderColor: 'rgba(255,255,255, 0.4)',
|
|
996
|
+
color: colors.primary,
|
|
997
|
+
hoverColor: colors.hover,
|
|
998
|
+
activeColor: colors.hover
|
|
999
|
+
}
|
|
945
1000
|
},
|
|
946
1001
|
white: {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1002
|
+
"default": {
|
|
1003
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
1004
|
+
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
1005
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
1006
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
1007
|
+
}
|
|
951
1008
|
},
|
|
952
1009
|
subtle: {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1010
|
+
"default": {
|
|
1011
|
+
backgroundColor: colors.transparent,
|
|
1012
|
+
pressedBackgroundColor: colors.transparent,
|
|
1013
|
+
hoverBackgroundColor: colors.transparent,
|
|
1014
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
1015
|
+
color: colors.primary,
|
|
1016
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
1017
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
1018
|
+
}
|
|
960
1019
|
},
|
|
961
1020
|
'subtle-dark': {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1021
|
+
"default": {
|
|
1022
|
+
backgroundColor: colors.transparent,
|
|
1023
|
+
pressedBackgroundColor: colors.transparent,
|
|
1024
|
+
hoverBackgroundColor: colors.transparent,
|
|
1025
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
1026
|
+
color: colors.black,
|
|
1027
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
1028
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
1029
|
+
}
|
|
969
1030
|
},
|
|
970
1031
|
disabled: {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1032
|
+
"default": {
|
|
1033
|
+
backgroundColor: colors.disabled,
|
|
1034
|
+
pressedBackgroundColor: colors.disabled,
|
|
1035
|
+
hoverBackgroundColor: colors.disabled,
|
|
1036
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
1037
|
+
borderColor: lateOceanColorPalette.black100
|
|
1038
|
+
}
|
|
976
1039
|
}
|
|
977
1040
|
};
|
|
978
1041
|
|
|
@@ -1252,14 +1315,14 @@ var iconButton = {
|
|
|
1252
1315
|
},
|
|
1253
1316
|
disabled: {
|
|
1254
1317
|
scale: 1,
|
|
1255
|
-
backgroundColor: button.disabled.backgroundColor,
|
|
1256
|
-
borderColor: button.disabled.borderColor
|
|
1318
|
+
backgroundColor: button.disabled["default"].backgroundColor,
|
|
1319
|
+
borderColor: button.disabled["default"].borderColor
|
|
1257
1320
|
},
|
|
1258
1321
|
"default": {
|
|
1259
|
-
pressedBackgroundColor: button["default"].pressedBackgroundColor
|
|
1322
|
+
pressedBackgroundColor: button["default"]["default"].pressedBackgroundColor
|
|
1260
1323
|
},
|
|
1261
1324
|
white: {
|
|
1262
|
-
pressedBackgroundColor: button.white.hoverBackgroundColor
|
|
1325
|
+
pressedBackgroundColor: button.white["default"].hoverBackgroundColor
|
|
1263
1326
|
}
|
|
1264
1327
|
};
|
|
1265
1328
|
|