@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
|
@@ -349,6 +349,20 @@ function Avatar(_ref6) {
|
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
var hasVariant = function (button, variant) {
|
|
353
|
+
return variant in button;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
function getVariantValuesIfExist(theme, type, variant) {
|
|
357
|
+
var button = theme.kitt.button[type];
|
|
358
|
+
|
|
359
|
+
if (hasVariant(button, variant)) {
|
|
360
|
+
return button[variant];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return theme.kitt.button[type]["default"];
|
|
364
|
+
}
|
|
365
|
+
|
|
352
366
|
var StyledPressable = /*#__PURE__*/styled.Pressable.withConfig({
|
|
353
367
|
displayName: "AnimatedButtonPressable__StyledPressable"
|
|
354
368
|
})(["", ""], function (_ref) {
|
|
@@ -367,6 +381,7 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
367
381
|
disabled = _ref3.disabled,
|
|
368
382
|
accessibilityRole = _ref3.accessibilityRole,
|
|
369
383
|
$type = _ref3.$type,
|
|
384
|
+
$variant = _ref3.$variant,
|
|
370
385
|
$isStretch = _ref3.$isStretch,
|
|
371
386
|
href = _ref3.href,
|
|
372
387
|
hrefAttrs = _ref3.hrefAttrs,
|
|
@@ -375,9 +390,11 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
375
390
|
var theme = /*#__PURE__*/useTheme();
|
|
376
391
|
var pressed = useSharedValue(0);
|
|
377
392
|
var color = useSharedValue(0);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
393
|
+
|
|
394
|
+
var _getVariantValuesIfEx = getVariantValuesIfExist(theme, $type, $variant),
|
|
395
|
+
backgroundColor = _getVariantValuesIfEx.backgroundColor,
|
|
396
|
+
pressedBackgroundColor = _getVariantValuesIfEx.pressedBackgroundColor;
|
|
397
|
+
|
|
381
398
|
var scale = theme.kitt.button.scale;
|
|
382
399
|
var scaleStyles = useAnimatedStyle(function () {
|
|
383
400
|
var _f = function () {
|
|
@@ -405,7 +422,7 @@ var AnimatedButtonPressable = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
405
422
|
};
|
|
406
423
|
_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)}]};}}";
|
|
407
424
|
_f.__workletHash = 5368461229978;
|
|
408
|
-
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (
|
|
425
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (56:41)";
|
|
409
426
|
_f.__optimalization = 2;
|
|
410
427
|
|
|
411
428
|
global.__reanimatedWorkletInit(_f);
|
|
@@ -466,10 +483,11 @@ var BaseStyledButtonPressable = /*#__PURE__*/styled.View.withConfig({
|
|
|
466
483
|
}, function (_ref6) {
|
|
467
484
|
var theme = _ref6.theme,
|
|
468
485
|
$isDisabled = _ref6.$isDisabled,
|
|
469
|
-
$type = _ref6.$type
|
|
470
|
-
|
|
486
|
+
$type = _ref6.$type,
|
|
487
|
+
$variant = _ref6.$variant;
|
|
488
|
+
if ($isDisabled) return theme.kitt.button.disabled["default"].backgroundColor;
|
|
471
489
|
if (Platform.OS !== 'web') return 'transparent';
|
|
472
|
-
return theme
|
|
490
|
+
return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
|
|
473
491
|
}, function (_ref7) {
|
|
474
492
|
var theme = _ref7.theme,
|
|
475
493
|
$isLarge = _ref7.$isLarge,
|
|
@@ -520,12 +538,12 @@ function isSubtle(type) {
|
|
|
520
538
|
return type.startsWith('subtle');
|
|
521
539
|
}
|
|
522
540
|
|
|
523
|
-
var _excluded$f = ["type", "isDisabled", "$isStretch", "icon", "children"];
|
|
541
|
+
var _excluded$f = ["type", "variant", "isDisabled", "$isStretch", "icon", "children"];
|
|
524
542
|
|
|
525
|
-
var getTextColorByType = function (type) {
|
|
543
|
+
var getTextColorByType = function (type, variant) {
|
|
526
544
|
switch (type) {
|
|
527
545
|
case 'primary':
|
|
528
|
-
return 'white';
|
|
546
|
+
return variant === 'ghost' ? 'primary' : 'white';
|
|
529
547
|
|
|
530
548
|
case 'white':
|
|
531
549
|
return 'white';
|
|
@@ -654,13 +672,14 @@ var ButtonContentContainer = /*#__PURE__*/styled.View.withConfig({
|
|
|
654
672
|
});
|
|
655
673
|
function ButtonContent(_ref7) {
|
|
656
674
|
var type = _ref7.type,
|
|
675
|
+
variant = _ref7.variant,
|
|
657
676
|
isDisabled = _ref7.isDisabled,
|
|
658
677
|
$isStretch = _ref7.$isStretch,
|
|
659
678
|
icon = _ref7.icon,
|
|
660
679
|
children = _ref7.children,
|
|
661
680
|
props = _objectWithoutProperties(_ref7, _excluded$f);
|
|
662
681
|
|
|
663
|
-
var color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
682
|
+
var color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
664
683
|
return /*#__PURE__*/jsx(ButtonContentContainer, {
|
|
665
684
|
$isSubtle: isSubtle(type),
|
|
666
685
|
$isStretch: $isStretch,
|
|
@@ -683,7 +702,7 @@ var StyledDisabled = /*#__PURE__*/styled.View.withConfig({
|
|
|
683
702
|
var _theme$kitt$button = theme.kitt.button,
|
|
684
703
|
borderWidth = _theme$kitt$button.borderWidth,
|
|
685
704
|
disabled = _theme$kitt$button.disabled;
|
|
686
|
-
return "".concat(borderWidth.disabled, "px solid ").concat(disabled.borderColor);
|
|
705
|
+
return "".concat(borderWidth.disabled, "px solid ").concat(disabled["default"].borderColor);
|
|
687
706
|
}, function (_ref2) {
|
|
688
707
|
var theme = _ref2.theme;
|
|
689
708
|
return theme.kitt.button.borderRadius;
|
|
@@ -693,6 +712,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
693
712
|
var children = _ref.children,
|
|
694
713
|
_ref$type = _ref.type,
|
|
695
714
|
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
715
|
+
_ref$variant = _ref.variant,
|
|
716
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
696
717
|
disabled = _ref.disabled,
|
|
697
718
|
stretch = _ref.stretch,
|
|
698
719
|
large = _ref.large,
|
|
@@ -705,6 +726,11 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
705
726
|
_ref$accessibilityRol = _ref.accessibilityRole,
|
|
706
727
|
accessibilityRole = _ref$accessibilityRol === void 0 ? 'button' : _ref$accessibilityRol,
|
|
707
728
|
onPress = _ref.onPress;
|
|
729
|
+
|
|
730
|
+
if ((process.env.NODE_ENV !== "production") && variant === 'ghost' && type !== 'primary') {
|
|
731
|
+
throw new Error('variant=ghost is only allowed with type=primary');
|
|
732
|
+
}
|
|
733
|
+
|
|
708
734
|
return /*#__PURE__*/jsx(AnimatedButtonPressable, {
|
|
709
735
|
ref: ref,
|
|
710
736
|
accessibilityRole: accessibilityRole,
|
|
@@ -714,14 +740,17 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
714
740
|
disabled: disabled,
|
|
715
741
|
$isStretch: stretch,
|
|
716
742
|
$type: type,
|
|
743
|
+
$variant: variant,
|
|
717
744
|
onPress: onPress,
|
|
718
745
|
children: /*#__PURE__*/jsxs(BaseStyledButtonPressable, {
|
|
719
746
|
$type: type,
|
|
747
|
+
$variant: variant,
|
|
720
748
|
$isStretch: stretch,
|
|
721
749
|
$isLarge: large,
|
|
722
750
|
$isDisabled: disabled,
|
|
723
751
|
children: [/*#__PURE__*/jsx(ButtonContent, {
|
|
724
752
|
type: type,
|
|
753
|
+
variant: variant,
|
|
725
754
|
$isStretch: stretch,
|
|
726
755
|
isDisabled: disabled,
|
|
727
756
|
icon: icon,
|
|
@@ -810,8 +839,12 @@ function ExternalLink(_ref) {
|
|
|
810
839
|
rest = _objectWithoutProperties(_ref, _excluded$e);
|
|
811
840
|
|
|
812
841
|
return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, rest), {}, {
|
|
813
|
-
onPress: function handleOnPress() {
|
|
814
|
-
if (onPress)
|
|
842
|
+
onPress: function handleOnPress(e) {
|
|
843
|
+
if (onPress) {
|
|
844
|
+
onPress(e);
|
|
845
|
+
if (e !== null && e !== void 0 && e.defaultPrevented) return;
|
|
846
|
+
}
|
|
847
|
+
|
|
815
848
|
if (!href) return;
|
|
816
849
|
|
|
817
850
|
switch (openLinkBehavior["native"]) {
|
|
@@ -925,47 +958,68 @@ var button = {
|
|
|
925
958
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
926
959
|
},
|
|
927
960
|
"default": {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
961
|
+
"default": {
|
|
962
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
963
|
+
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
964
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
965
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
966
|
+
}
|
|
932
967
|
},
|
|
933
968
|
primary: {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
969
|
+
"default": {
|
|
970
|
+
backgroundColor: colors.primary,
|
|
971
|
+
pressedBackgroundColor: colors.primaryLight,
|
|
972
|
+
hoverBackgroundColor: colors.primaryLight,
|
|
973
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
974
|
+
},
|
|
975
|
+
ghost: {
|
|
976
|
+
backgroundColor: colors.uiBackgroundLight,
|
|
977
|
+
pressedBackgroundColor: colors.uiBackground,
|
|
978
|
+
hoverBackgroundColor: colors.hover,
|
|
979
|
+
focusBorderColor: 'rgba(255,255,255, 0.4)',
|
|
980
|
+
color: colors.primary,
|
|
981
|
+
hoverColor: colors.hover,
|
|
982
|
+
activeColor: colors.hover
|
|
983
|
+
}
|
|
938
984
|
},
|
|
939
985
|
white: {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
986
|
+
"default": {
|
|
987
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
988
|
+
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
989
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
990
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
991
|
+
}
|
|
944
992
|
},
|
|
945
993
|
subtle: {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
994
|
+
"default": {
|
|
995
|
+
backgroundColor: colors.transparent,
|
|
996
|
+
pressedBackgroundColor: colors.transparent,
|
|
997
|
+
hoverBackgroundColor: colors.transparent,
|
|
998
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
999
|
+
color: colors.primary,
|
|
1000
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
1001
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
1002
|
+
}
|
|
953
1003
|
},
|
|
954
1004
|
'subtle-dark': {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1005
|
+
"default": {
|
|
1006
|
+
backgroundColor: colors.transparent,
|
|
1007
|
+
pressedBackgroundColor: colors.transparent,
|
|
1008
|
+
hoverBackgroundColor: colors.transparent,
|
|
1009
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
1010
|
+
color: colors.black,
|
|
1011
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
1012
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
1013
|
+
}
|
|
962
1014
|
},
|
|
963
1015
|
disabled: {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1016
|
+
"default": {
|
|
1017
|
+
backgroundColor: colors.disabled,
|
|
1018
|
+
pressedBackgroundColor: colors.disabled,
|
|
1019
|
+
hoverBackgroundColor: colors.disabled,
|
|
1020
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
1021
|
+
borderColor: lateOceanColorPalette.black100
|
|
1022
|
+
}
|
|
969
1023
|
}
|
|
970
1024
|
};
|
|
971
1025
|
|
|
@@ -1245,14 +1299,14 @@ var iconButton = {
|
|
|
1245
1299
|
},
|
|
1246
1300
|
disabled: {
|
|
1247
1301
|
scale: 1,
|
|
1248
|
-
backgroundColor: button.disabled.backgroundColor,
|
|
1249
|
-
borderColor: button.disabled.borderColor
|
|
1302
|
+
backgroundColor: button.disabled["default"].backgroundColor,
|
|
1303
|
+
borderColor: button.disabled["default"].borderColor
|
|
1250
1304
|
},
|
|
1251
1305
|
"default": {
|
|
1252
|
-
pressedBackgroundColor: button["default"].pressedBackgroundColor
|
|
1306
|
+
pressedBackgroundColor: button["default"]["default"].pressedBackgroundColor
|
|
1253
1307
|
},
|
|
1254
1308
|
white: {
|
|
1255
|
-
pressedBackgroundColor: button.white.hoverBackgroundColor
|
|
1309
|
+
pressedBackgroundColor: button.white["default"].hoverBackgroundColor
|
|
1256
1310
|
}
|
|
1257
1311
|
};
|
|
1258
1312
|
|