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