@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
|
@@ -361,6 +361,20 @@ function Avatar({
|
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
const hasVariant = (button, variant) => {
|
|
365
|
+
return variant in button;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
function getVariantValuesIfExist(theme, type, variant) {
|
|
369
|
+
const button = theme.kitt.button[type];
|
|
370
|
+
|
|
371
|
+
if (hasVariant(button, variant)) {
|
|
372
|
+
return button[variant];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
return theme.kitt.button[type].default;
|
|
376
|
+
}
|
|
377
|
+
|
|
364
378
|
const StyledPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
|
|
365
379
|
displayName: "AnimatedButtonPressable__StyledPressable",
|
|
366
380
|
componentId: "kitt-universal__sc-175vyve-0"
|
|
@@ -381,6 +395,7 @@ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
|
381
395
|
disabled,
|
|
382
396
|
accessibilityRole,
|
|
383
397
|
$type,
|
|
398
|
+
$variant,
|
|
384
399
|
$isStretch,
|
|
385
400
|
href,
|
|
386
401
|
hrefAttrs,
|
|
@@ -393,7 +408,7 @@ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
|
393
408
|
const {
|
|
394
409
|
backgroundColor,
|
|
395
410
|
pressedBackgroundColor
|
|
396
|
-
} = theme
|
|
411
|
+
} = getVariantValuesIfExist(theme, $type, $variant);
|
|
397
412
|
const {
|
|
398
413
|
scale
|
|
399
414
|
} = theme.kitt.button;
|
|
@@ -423,7 +438,7 @@ const AnimatedButtonPressable = /*#__PURE__*/react.forwardRef(({
|
|
|
423
438
|
};
|
|
424
439
|
_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)}]};}}";
|
|
425
440
|
_f.__workletHash = 5368461229978;
|
|
426
|
-
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (
|
|
441
|
+
_f.__location = "/home/circleci/repo/@ornikar/kitt-universal/src/Button/AnimatedButtonPressable.tsx (56:41)";
|
|
427
442
|
_f.__optimalization = 2;
|
|
428
443
|
|
|
429
444
|
global.__reanimatedWorkletInit(_f);
|
|
@@ -480,11 +495,12 @@ const BaseStyledButtonPressable = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
480
495
|
}) => theme.kitt.button.borderRadius, ({
|
|
481
496
|
theme,
|
|
482
497
|
$isDisabled,
|
|
483
|
-
$type
|
|
498
|
+
$type,
|
|
499
|
+
$variant
|
|
484
500
|
}) => {
|
|
485
|
-
if ($isDisabled) return theme.kitt.button.disabled.backgroundColor;
|
|
501
|
+
if ($isDisabled) return theme.kitt.button.disabled.default.backgroundColor;
|
|
486
502
|
if (reactNative.Platform.OS !== 'web') return 'transparent';
|
|
487
|
-
return theme
|
|
503
|
+
return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
|
|
488
504
|
}, ({
|
|
489
505
|
theme,
|
|
490
506
|
$isLarge,
|
|
@@ -537,10 +553,10 @@ function isSubtle(type) {
|
|
|
537
553
|
return type.startsWith('subtle');
|
|
538
554
|
}
|
|
539
555
|
|
|
540
|
-
const getTextColorByType = type => {
|
|
556
|
+
const getTextColorByType = (type, variant) => {
|
|
541
557
|
switch (type) {
|
|
542
558
|
case 'primary':
|
|
543
|
-
return 'white';
|
|
559
|
+
return variant === 'ghost' ? 'primary' : 'white';
|
|
544
560
|
|
|
545
561
|
case 'white':
|
|
546
562
|
return 'white';
|
|
@@ -681,13 +697,14 @@ const ButtonContentContainer = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
681
697
|
});
|
|
682
698
|
function ButtonContent({
|
|
683
699
|
type,
|
|
700
|
+
variant,
|
|
684
701
|
isDisabled,
|
|
685
702
|
$isStretch,
|
|
686
703
|
icon,
|
|
687
704
|
children,
|
|
688
705
|
...props
|
|
689
706
|
}) {
|
|
690
|
-
const color = isDisabled ? 'black-light' : getTextColorByType(type);
|
|
707
|
+
const color = isDisabled ? 'black-light' : getTextColorByType(type, variant);
|
|
691
708
|
return /*#__PURE__*/jsxRuntime.jsx(ButtonContentContainer, {
|
|
692
709
|
$isSubtle: isSubtle(type),
|
|
693
710
|
$isStretch: $isStretch,
|
|
@@ -713,7 +730,7 @@ const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
713
730
|
borderWidth,
|
|
714
731
|
disabled
|
|
715
732
|
} = theme.kitt.button;
|
|
716
|
-
return `${borderWidth.disabled}px solid ${disabled.borderColor}`;
|
|
733
|
+
return `${borderWidth.disabled}px solid ${disabled.default.borderColor}`;
|
|
717
734
|
}, ({
|
|
718
735
|
theme
|
|
719
736
|
}) => theme.kitt.button.borderRadius);
|
|
@@ -721,6 +738,7 @@ const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
|
|
|
721
738
|
const Button = /*#__PURE__*/react.forwardRef(({
|
|
722
739
|
children,
|
|
723
740
|
type = 'default',
|
|
741
|
+
variant = 'default',
|
|
724
742
|
disabled,
|
|
725
743
|
stretch,
|
|
726
744
|
large,
|
|
@@ -732,6 +750,10 @@ const Button = /*#__PURE__*/react.forwardRef(({
|
|
|
732
750
|
accessibilityRole = 'button',
|
|
733
751
|
onPress
|
|
734
752
|
}, ref) => {
|
|
753
|
+
if ((process.env.NODE_ENV !== "production") && variant === 'ghost' && type !== 'primary') {
|
|
754
|
+
throw new Error('variant=ghost is only allowed with type=primary');
|
|
755
|
+
}
|
|
756
|
+
|
|
735
757
|
return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
|
|
736
758
|
ref: ref,
|
|
737
759
|
accessibilityRole: accessibilityRole,
|
|
@@ -741,14 +763,17 @@ const Button = /*#__PURE__*/react.forwardRef(({
|
|
|
741
763
|
disabled: disabled,
|
|
742
764
|
$isStretch: stretch,
|
|
743
765
|
$type: type,
|
|
766
|
+
$variant: variant,
|
|
744
767
|
onPress: onPress,
|
|
745
768
|
children: /*#__PURE__*/jsxRuntime.jsxs(BaseStyledButtonPressable, {
|
|
746
769
|
$type: type,
|
|
770
|
+
$variant: variant,
|
|
747
771
|
$isStretch: stretch,
|
|
748
772
|
$isLarge: large,
|
|
749
773
|
$isDisabled: disabled,
|
|
750
774
|
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
|
|
751
775
|
type: type,
|
|
776
|
+
variant: variant,
|
|
752
777
|
$isStretch: stretch,
|
|
753
778
|
isDisabled: disabled,
|
|
754
779
|
icon: icon,
|
|
@@ -826,8 +851,12 @@ function ExternalLink({
|
|
|
826
851
|
...rest
|
|
827
852
|
}) {
|
|
828
853
|
return /*#__PURE__*/jsxRuntime.jsx(Component, { ...rest,
|
|
829
|
-
onPress:
|
|
830
|
-
if (onPress)
|
|
854
|
+
onPress: e => {
|
|
855
|
+
if (onPress) {
|
|
856
|
+
onPress(e);
|
|
857
|
+
if (e?.defaultPrevented) return;
|
|
858
|
+
}
|
|
859
|
+
|
|
831
860
|
if (!href) return;
|
|
832
861
|
|
|
833
862
|
switch (openLinkBehavior.native) {
|
|
@@ -941,47 +970,68 @@ const button = {
|
|
|
941
970
|
timingFunction: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
|
|
942
971
|
},
|
|
943
972
|
default: {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
973
|
+
default: {
|
|
974
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
975
|
+
pressedBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
976
|
+
hoverBackgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
977
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)'
|
|
978
|
+
}
|
|
948
979
|
},
|
|
949
980
|
primary: {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
981
|
+
default: {
|
|
982
|
+
backgroundColor: colors.primary,
|
|
983
|
+
pressedBackgroundColor: colors.primaryLight,
|
|
984
|
+
hoverBackgroundColor: colors.primaryLight,
|
|
985
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)'
|
|
986
|
+
},
|
|
987
|
+
ghost: {
|
|
988
|
+
backgroundColor: colors.uiBackgroundLight,
|
|
989
|
+
pressedBackgroundColor: colors.uiBackground,
|
|
990
|
+
hoverBackgroundColor: colors.hover,
|
|
991
|
+
focusBorderColor: 'rgba(255,255,255, 0.4)',
|
|
992
|
+
color: colors.primary,
|
|
993
|
+
hoverColor: colors.hover,
|
|
994
|
+
activeColor: colors.hover
|
|
995
|
+
}
|
|
954
996
|
},
|
|
955
997
|
white: {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
998
|
+
default: {
|
|
999
|
+
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
1000
|
+
pressedBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
1001
|
+
hoverBackgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
1002
|
+
focusBorderColor: 'rgba(255, 255, 255, 0.1)'
|
|
1003
|
+
}
|
|
960
1004
|
},
|
|
961
1005
|
subtle: {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1006
|
+
default: {
|
|
1007
|
+
backgroundColor: colors.transparent,
|
|
1008
|
+
pressedBackgroundColor: colors.transparent,
|
|
1009
|
+
hoverBackgroundColor: colors.transparent,
|
|
1010
|
+
focusBorderColor: 'rgba(76, 52, 224, 0.2)',
|
|
1011
|
+
color: colors.primary,
|
|
1012
|
+
hoverColor: 'rgba(76, 52, 224, 0.8)',
|
|
1013
|
+
activeColor: 'rgba(76, 52, 224, 0.8)'
|
|
1014
|
+
}
|
|
969
1015
|
},
|
|
970
1016
|
'subtle-dark': {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1017
|
+
default: {
|
|
1018
|
+
backgroundColor: colors.transparent,
|
|
1019
|
+
pressedBackgroundColor: colors.transparent,
|
|
1020
|
+
hoverBackgroundColor: colors.transparent,
|
|
1021
|
+
focusBorderColor: 'rgba(0, 0, 0, 0.1)',
|
|
1022
|
+
color: colors.black,
|
|
1023
|
+
hoverColor: 'rgba(0, 0, 0, 0.8)',
|
|
1024
|
+
activeColor: 'rgba(0, 0, 0, 0.8)'
|
|
1025
|
+
}
|
|
978
1026
|
},
|
|
979
1027
|
disabled: {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1028
|
+
default: {
|
|
1029
|
+
backgroundColor: colors.disabled,
|
|
1030
|
+
pressedBackgroundColor: colors.disabled,
|
|
1031
|
+
hoverBackgroundColor: colors.disabled,
|
|
1032
|
+
focusBorderColor: lateOceanColorPalette.black100,
|
|
1033
|
+
borderColor: lateOceanColorPalette.black100
|
|
1034
|
+
}
|
|
985
1035
|
}
|
|
986
1036
|
};
|
|
987
1037
|
|
|
@@ -1257,14 +1307,14 @@ const iconButton = {
|
|
|
1257
1307
|
},
|
|
1258
1308
|
disabled: {
|
|
1259
1309
|
scale: 1,
|
|
1260
|
-
backgroundColor: button.disabled.backgroundColor,
|
|
1261
|
-
borderColor: button.disabled.borderColor
|
|
1310
|
+
backgroundColor: button.disabled.default.backgroundColor,
|
|
1311
|
+
borderColor: button.disabled.default.borderColor
|
|
1262
1312
|
},
|
|
1263
1313
|
default: {
|
|
1264
|
-
pressedBackgroundColor: button.default.pressedBackgroundColor
|
|
1314
|
+
pressedBackgroundColor: button.default.default.pressedBackgroundColor
|
|
1265
1315
|
},
|
|
1266
1316
|
white: {
|
|
1267
|
-
pressedBackgroundColor: button.white.hoverBackgroundColor
|
|
1317
|
+
pressedBackgroundColor: button.white.default.hoverBackgroundColor
|
|
1268
1318
|
}
|
|
1269
1319
|
};
|
|
1270
1320
|
|