@ornikar/kitt-universal 9.1.0 → 9.1.2

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.
Files changed (32) hide show
  1. package/dist/definitions/Button/BaseStyledButtonPressable.d.ts +2 -3
  2. package/dist/definitions/Button/BaseStyledButtonPressable.d.ts.map +1 -1
  3. package/dist/definitions/Button/Button.d.ts +8 -0
  4. package/dist/definitions/Button/Button.d.ts.map +1 -1
  5. package/dist/definitions/index.d.ts +2 -0
  6. package/dist/definitions/index.d.ts.map +1 -1
  7. package/dist/definitions/utils/warnings.d.ts +4 -0
  8. package/dist/definitions/utils/warnings.d.ts.map +1 -0
  9. package/dist/index-browser-all.es.android.js +195 -163
  10. package/dist/index-browser-all.es.android.js.map +1 -1
  11. package/dist/index-browser-all.es.ios.js +195 -163
  12. package/dist/index-browser-all.es.ios.js.map +1 -1
  13. package/dist/index-browser-all.es.js +195 -163
  14. package/dist/index-browser-all.es.js.map +1 -1
  15. package/dist/index-browser-all.es.web.js +194 -162
  16. package/dist/index-browser-all.es.web.js.map +1 -1
  17. package/dist/index-node-14.17.cjs.js +179 -145
  18. package/dist/index-node-14.17.cjs.js.map +1 -1
  19. package/dist/index-node-14.17.cjs.web.js +178 -144
  20. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  21. package/dist/linaria-themes-browser-all.es.android.js +1 -1
  22. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  23. package/dist/linaria-themes-browser-all.es.ios.js +1 -1
  24. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  25. package/dist/linaria-themes-browser-all.es.js +1 -1
  26. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  27. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  28. package/dist/linaria-themes-node-14.17.cjs.js +1 -1
  29. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  30. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  31. package/dist/tsbuildinfo +1 -1
  32. package/package.json +4 -4
@@ -326,6 +326,19 @@ function Avatar({
326
326
  });
327
327
  }
328
328
 
329
+ function warn(message) {
330
+ if (process.env.NODE_ENV !== 'production') {
331
+ console.warn(message);
332
+ }
333
+ }
334
+ function deprecatedMessage(symbol, deprecation, replaceBy) {
335
+ const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
336
+ warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
337
+ }
338
+ function deprecatedInComponent(component, deprecation, replaceBy) {
339
+ deprecatedMessage(`<${component} />`, deprecation, replaceBy);
340
+ }
341
+
329
342
  // type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
330
343
  // type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
331
344
  // export function withTheme<Props extends { theme: DefaultTheme }, C>(
@@ -512,8 +525,7 @@ const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyled
512
525
  return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
513
526
  }, ({
514
527
  theme,
515
- $isLarge,
516
- $isXLarge,
528
+ $size,
517
529
  $isDisabled
518
530
  }) => {
519
531
  const {
@@ -522,8 +534,8 @@ const BaseStyledButtonPressable = /*#__PURE__*/styled__default(BabelPluginStyled
522
534
  disabled: disabledPadding,
523
535
  xLarge
524
536
  } = theme.kitt.button.contentPadding;
525
- if ($isXLarge) return xLarge;
526
- if ($isLarge) return large;
537
+ if ($size === 'large') return large;
538
+ if ($size === 'xlarge') return xLarge;
527
539
  if ($isDisabled) return disabledPadding;
528
540
  return defaultPadding;
529
541
  });
@@ -726,6 +738,17 @@ function ButtonContent({
726
738
  }
727
739
 
728
740
  const allowedGhostTypes = ['primary', 'default'];
741
+
742
+ const getButtonSize = ({
743
+ large,
744
+ xLarge,
745
+ size
746
+ }) => {
747
+ if (large) return 'large';
748
+ if (xLarge) return 'xlarge';
749
+ return size;
750
+ };
751
+
729
752
  const Button = /*#__PURE__*/react.forwardRef(({
730
753
  children,
731
754
  type = 'default',
@@ -735,6 +758,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
735
758
  large,
736
759
  xLarge,
737
760
  icon,
761
+ size: sizeProp,
738
762
  iconPosition = 'left',
739
763
  testID,
740
764
  href,
@@ -746,6 +770,16 @@ const Button = /*#__PURE__*/react.forwardRef(({
746
770
  throw new Error('variant=ghost is only allowed with type=primary or default');
747
771
  }
748
772
 
773
+ if (large || xLarge) {
774
+ const deprecatedProp = large ? 'large' : 'xLarge';
775
+ deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
776
+ }
777
+
778
+ const size = getButtonSize({
779
+ large,
780
+ xLarge,
781
+ size: sizeProp
782
+ });
749
783
  return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
750
784
  ref: ref,
751
785
  accessibilityRole: accessibilityRole,
@@ -761,8 +795,7 @@ const Button = /*#__PURE__*/react.forwardRef(({
761
795
  $type: type,
762
796
  $variant: variant,
763
797
  $isStretch: stretch,
764
- $isLarge: large,
765
- $isXLarge: xLarge,
798
+ $size: size,
766
799
  $isDisabled: disabled,
767
800
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
768
801
  type: type,
@@ -2992,6 +3025,144 @@ Modal.Header = ModalHeader;
2992
3025
  Modal.Body = ModalBody;
2993
3026
  Modal.Footer = ModalFooter;
2994
3027
 
3028
+ const createKittSpaces = spacing => {
3029
+ const sizes = {};
3030
+
3031
+ for (let size = 1; size <= 64; size++) {
3032
+ sizes[`kitt.${size}`] = size * spacing;
3033
+ }
3034
+
3035
+ return sizes;
3036
+ }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
3037
+
3038
+
3039
+ const createKittNativeBaseCustomTheme = theme => {
3040
+ const spaces = createKittSpaces(theme.spacing);
3041
+ return nativeBase.extendTheme({
3042
+ colors: {
3043
+ kitt: { ...theme.colors,
3044
+ typography: theme.typography.colors
3045
+ }
3046
+ },
3047
+ radii: {
3048
+ 'kitt.borderRadius': theme.card.borderRadius
3049
+ },
3050
+ sizes: { ...spaces,
3051
+ // reset native-base to be able to set size as number
3052
+ // https://docs.nativebase.io/next/default-theme#h2-size
3053
+ ...Object.fromEntries([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 78, 80, 96, 0.5, 1.5, 2.5, 3.5].map(value => [value, value]))
3054
+ },
3055
+ space: spaces,
3056
+ breakpoints: {
3057
+ // kitt breakpoints
3058
+ base: KittBreakpoints.BASE,
3059
+ small: KittBreakpoints.SMALL,
3060
+ medium: KittBreakpoints.MEDIUM,
3061
+ large: KittBreakpoints.LARGE,
3062
+ wide: KittBreakpoints.WIDE,
3063
+ // native base default naming
3064
+ sm: Number.MAX_SAFE_INTEGER,
3065
+ md: Number.MAX_SAFE_INTEGER,
3066
+ lg: Number.MAX_SAFE_INTEGER,
3067
+ xl: Number.MAX_SAFE_INTEGER,
3068
+ '2xl': Number.MAX_SAFE_INTEGER
3069
+ },
3070
+ fontSizes: {
3071
+ baseAndSmall: {
3072
+ header1: `${theme.typography.types.headers.configs.header1.baseAndSmall.fontSize}px`,
3073
+ header2: `${theme.typography.types.headers.configs.header2.baseAndSmall.fontSize}px`,
3074
+ header3: `${theme.typography.types.headers.configs.header3.baseAndSmall.fontSize}px`,
3075
+ header4: `${theme.typography.types.headers.configs.header4.baseAndSmall.fontSize}px`,
3076
+ header5: `${theme.typography.types.headers.configs.header5.baseAndSmall.fontSize}px`,
3077
+ 'body-large': `${theme.typography.types.bodies.configs['body-large'].baseAndSmall.fontSize}px`,
3078
+ 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].baseAndSmall.fontSize}px`,
3079
+ body: `${theme.typography.types.bodies.configs.body.baseAndSmall.fontSize}px`,
3080
+ 'body-small': `${theme.typography.types.bodies.configs['body-small'].baseAndSmall.fontSize}px`,
3081
+ 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.fontSize}px`
3082
+ },
3083
+ mediumAndWide: {
3084
+ header1: `${theme.typography.types.headers.configs.header1.mediumAndWide.fontSize}px`,
3085
+ header2: `${theme.typography.types.headers.configs.header2.mediumAndWide.fontSize}px`,
3086
+ header3: `${theme.typography.types.headers.configs.header3.mediumAndWide.fontSize}px`,
3087
+ header4: `${theme.typography.types.headers.configs.header4.mediumAndWide.fontSize}px`,
3088
+ header5: `${theme.typography.types.headers.configs.header5.mediumAndWide.fontSize}px`,
3089
+ 'body-large': `${theme.typography.types.bodies.configs['body-large'].mediumAndWide.fontSize}px`,
3090
+ 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].mediumAndWide.fontSize}px`,
3091
+ body: `${theme.typography.types.bodies.configs.body.mediumAndWide.fontSize}px`,
3092
+ 'body-small': `${theme.typography.types.bodies.configs['body-small'].mediumAndWide.fontSize}px`,
3093
+ 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.fontSize}px`
3094
+ }
3095
+ },
3096
+ lineHeights: {
3097
+ baseAndSmall: {
3098
+ header1: theme.typography.types.headers.configs.header1.baseAndSmall.lineHeight,
3099
+ header2: theme.typography.types.headers.configs.header2.baseAndSmall.lineHeight,
3100
+ header3: theme.typography.types.headers.configs.header3.baseAndSmall.lineHeight,
3101
+ header4: theme.typography.types.headers.configs.header4.baseAndSmall.lineHeight,
3102
+ header5: theme.typography.types.headers.configs.header5.baseAndSmall.lineHeight,
3103
+ 'body-large': theme.typography.types.bodies.configs['body-large'].baseAndSmall.lineHeight,
3104
+ 'body-medium': theme.typography.types.bodies.configs['body-medium'].baseAndSmall.lineHeight,
3105
+ body: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight,
3106
+ 'body-small': theme.typography.types.bodies.configs['body-small'].baseAndSmall.lineHeight,
3107
+ 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.lineHeight
3108
+ },
3109
+ mediumAndWide: {
3110
+ header1: theme.typography.types.headers.configs.header1.mediumAndWide.lineHeight,
3111
+ header2: theme.typography.types.headers.configs.header2.mediumAndWide.lineHeight,
3112
+ header3: theme.typography.types.headers.configs.header3.mediumAndWide.lineHeight,
3113
+ header4: theme.typography.types.headers.configs.header4.mediumAndWide.lineHeight,
3114
+ header5: theme.typography.types.headers.configs.header5.mediumAndWide.lineHeight,
3115
+ 'body-large': theme.typography.types.bodies.configs['body-large'].mediumAndWide.lineHeight,
3116
+ 'body-medium': theme.typography.types.bodies.configs['body-medium'].mediumAndWide.lineHeight,
3117
+ body: theme.typography.types.bodies.configs.body.mediumAndWide.lineHeight,
3118
+ 'body-small': theme.typography.types.bodies.configs['body-small'].mediumAndWide.lineHeight,
3119
+ 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.lineHeight
3120
+ }
3121
+ },
3122
+ fontWeights: {
3123
+ headers: {
3124
+ regular: theme.typography.types.headers.fontWeight,
3125
+ bold: theme.typography.types.headers.fontWeight
3126
+ },
3127
+ bodies: theme.typography.types.bodies.fontWeight
3128
+ },
3129
+ fonts: {
3130
+ headers: theme.typography.types.headers.fontFamily,
3131
+ bodies: theme.typography.types.bodies.fontFamily
3132
+ },
3133
+ components: {
3134
+ Text: {
3135
+ baseStyle: {
3136
+ _light: {
3137
+ color: 'kitt.typography.black'
3138
+ },
3139
+ _dark: {
3140
+ color: 'kitt.typography.white'
3141
+ },
3142
+ fontFamily: theme.typography.types.bodies.fontFamily.regular,
3143
+ fontStyle: theme.typography.types.bodies.fontStyle.regular,
3144
+ fontWeight: theme.typography.types.bodies.fontWeight.regular,
3145
+ fontSize: undefined,
3146
+ lineHeight: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight
3147
+ }
3148
+ }
3149
+ }
3150
+ });
3151
+ };
3152
+ function KittNativeBaseProvider({
3153
+ theme,
3154
+ isSSR,
3155
+ children
3156
+ }) {
3157
+ const kittTheme = theme.kitt;
3158
+ const nativeBaseCustomTheme = react.useMemo(() => createKittNativeBaseCustomTheme(kittTheme), [kittTheme]);
3159
+ return /*#__PURE__*/jsxRuntime.jsx(nativeBase.NativeBaseProvider, {
3160
+ theme: nativeBaseCustomTheme,
3161
+ isSSR: isSSR,
3162
+ children: children
3163
+ });
3164
+ }
3165
+
2995
3166
  function Notification({
2996
3167
  type,
2997
3168
  children,
@@ -3929,144 +4100,6 @@ const hex2rgba = (hex, alpha = 1) => {
3929
4100
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
3930
4101
  };
3931
4102
 
3932
- const createKittSpaces = spacing => {
3933
- const sizes = {};
3934
-
3935
- for (let size = 1; size <= 64; size++) {
3936
- sizes[`kitt.${size}`] = size * spacing;
3937
- }
3938
-
3939
- return sizes;
3940
- }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
3941
-
3942
-
3943
- const createKittNativeBaseCustomTheme = theme => {
3944
- const spaces = createKittSpaces(theme.spacing);
3945
- return nativeBase.extendTheme({
3946
- colors: {
3947
- kitt: { ...theme.colors,
3948
- typography: theme.typography.colors
3949
- }
3950
- },
3951
- radii: {
3952
- 'kitt.borderRadius': theme.card.borderRadius
3953
- },
3954
- sizes: { ...spaces,
3955
- // reset native-base to be able to set size as number
3956
- // https://docs.nativebase.io/next/default-theme#h2-size
3957
- ...Object.fromEntries([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 78, 80, 96, 0.5, 1.5, 2.5, 3.5].map(value => [value, value]))
3958
- },
3959
- space: spaces,
3960
- breakpoints: {
3961
- // kitt breakpoints
3962
- base: KittBreakpoints.BASE,
3963
- small: KittBreakpoints.SMALL,
3964
- medium: KittBreakpoints.MEDIUM,
3965
- large: KittBreakpoints.LARGE,
3966
- wide: KittBreakpoints.WIDE,
3967
- // native base default naming
3968
- sm: Number.MAX_SAFE_INTEGER,
3969
- md: Number.MAX_SAFE_INTEGER,
3970
- lg: Number.MAX_SAFE_INTEGER,
3971
- xl: Number.MAX_SAFE_INTEGER,
3972
- '2xl': Number.MAX_SAFE_INTEGER
3973
- },
3974
- fontSizes: {
3975
- baseAndSmall: {
3976
- header1: `${theme.typography.types.headers.configs.header1.baseAndSmall.fontSize}px`,
3977
- header2: `${theme.typography.types.headers.configs.header2.baseAndSmall.fontSize}px`,
3978
- header3: `${theme.typography.types.headers.configs.header3.baseAndSmall.fontSize}px`,
3979
- header4: `${theme.typography.types.headers.configs.header4.baseAndSmall.fontSize}px`,
3980
- header5: `${theme.typography.types.headers.configs.header5.baseAndSmall.fontSize}px`,
3981
- 'body-large': `${theme.typography.types.bodies.configs['body-large'].baseAndSmall.fontSize}px`,
3982
- 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].baseAndSmall.fontSize}px`,
3983
- body: `${theme.typography.types.bodies.configs.body.baseAndSmall.fontSize}px`,
3984
- 'body-small': `${theme.typography.types.bodies.configs['body-small'].baseAndSmall.fontSize}px`,
3985
- 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.fontSize}px`
3986
- },
3987
- mediumAndWide: {
3988
- header1: `${theme.typography.types.headers.configs.header1.mediumAndWide.fontSize}px`,
3989
- header2: `${theme.typography.types.headers.configs.header2.mediumAndWide.fontSize}px`,
3990
- header3: `${theme.typography.types.headers.configs.header3.mediumAndWide.fontSize}px`,
3991
- header4: `${theme.typography.types.headers.configs.header4.mediumAndWide.fontSize}px`,
3992
- header5: `${theme.typography.types.headers.configs.header5.mediumAndWide.fontSize}px`,
3993
- 'body-large': `${theme.typography.types.bodies.configs['body-large'].mediumAndWide.fontSize}px`,
3994
- 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].mediumAndWide.fontSize}px`,
3995
- body: `${theme.typography.types.bodies.configs.body.mediumAndWide.fontSize}px`,
3996
- 'body-small': `${theme.typography.types.bodies.configs['body-small'].mediumAndWide.fontSize}px`,
3997
- 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.fontSize}px`
3998
- }
3999
- },
4000
- lineHeights: {
4001
- baseAndSmall: {
4002
- header1: theme.typography.types.headers.configs.header1.baseAndSmall.lineHeight,
4003
- header2: theme.typography.types.headers.configs.header2.baseAndSmall.lineHeight,
4004
- header3: theme.typography.types.headers.configs.header3.baseAndSmall.lineHeight,
4005
- header4: theme.typography.types.headers.configs.header4.baseAndSmall.lineHeight,
4006
- header5: theme.typography.types.headers.configs.header5.baseAndSmall.lineHeight,
4007
- 'body-large': theme.typography.types.bodies.configs['body-large'].baseAndSmall.lineHeight,
4008
- 'body-medium': theme.typography.types.bodies.configs['body-medium'].baseAndSmall.lineHeight,
4009
- body: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight,
4010
- 'body-small': theme.typography.types.bodies.configs['body-small'].baseAndSmall.lineHeight,
4011
- 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.lineHeight
4012
- },
4013
- mediumAndWide: {
4014
- header1: theme.typography.types.headers.configs.header1.mediumAndWide.lineHeight,
4015
- header2: theme.typography.types.headers.configs.header2.mediumAndWide.lineHeight,
4016
- header3: theme.typography.types.headers.configs.header3.mediumAndWide.lineHeight,
4017
- header4: theme.typography.types.headers.configs.header4.mediumAndWide.lineHeight,
4018
- header5: theme.typography.types.headers.configs.header5.mediumAndWide.lineHeight,
4019
- 'body-large': theme.typography.types.bodies.configs['body-large'].mediumAndWide.lineHeight,
4020
- 'body-medium': theme.typography.types.bodies.configs['body-medium'].mediumAndWide.lineHeight,
4021
- body: theme.typography.types.bodies.configs.body.mediumAndWide.lineHeight,
4022
- 'body-small': theme.typography.types.bodies.configs['body-small'].mediumAndWide.lineHeight,
4023
- 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.lineHeight
4024
- }
4025
- },
4026
- fontWeights: {
4027
- headers: {
4028
- regular: theme.typography.types.headers.fontWeight,
4029
- bold: theme.typography.types.headers.fontWeight
4030
- },
4031
- bodies: theme.typography.types.bodies.fontWeight
4032
- },
4033
- fonts: {
4034
- headers: theme.typography.types.headers.fontFamily,
4035
- bodies: theme.typography.types.bodies.fontFamily
4036
- },
4037
- components: {
4038
- Text: {
4039
- baseStyle: {
4040
- _light: {
4041
- color: 'kitt.typography.black'
4042
- },
4043
- _dark: {
4044
- color: 'kitt.typography.white'
4045
- },
4046
- fontFamily: theme.typography.types.bodies.fontFamily.regular,
4047
- fontStyle: theme.typography.types.bodies.fontStyle.regular,
4048
- fontWeight: theme.typography.types.bodies.fontWeight.regular,
4049
- fontSize: undefined,
4050
- lineHeight: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight
4051
- }
4052
- }
4053
- }
4054
- });
4055
- };
4056
- function KittNativeBaseProvider({
4057
- theme,
4058
- isSSR,
4059
- children
4060
- }) {
4061
- const kittTheme = theme.kitt;
4062
- const nativeBaseCustomTheme = react.useMemo(() => createKittNativeBaseCustomTheme(kittTheme), [kittTheme]);
4063
- return /*#__PURE__*/jsxRuntime.jsx(nativeBase.NativeBaseProvider, {
4064
- theme: nativeBaseCustomTheme,
4065
- isSSR: isSSR,
4066
- children: children
4067
- });
4068
- }
4069
-
4070
4103
  function KittThemeProvider({
4071
4104
  isSSR,
4072
4105
  children
@@ -4128,6 +4161,7 @@ exports.InputTag = InputTag;
4128
4161
  exports.InputText = InputText;
4129
4162
  exports.KittBreakpoints = KittBreakpoints;
4130
4163
  exports.KittBreakpointsMax = KittBreakpointsMax;
4164
+ exports.KittNativeBaseProvider = KittNativeBaseProvider;
4131
4165
  exports.KittThemeDecorator = KittThemeDecorator;
4132
4166
  exports.KittThemeProvider = KittThemeProvider;
4133
4167
  exports.Label = Label;