@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
@@ -337,6 +337,19 @@ function Avatar({
337
337
  });
338
338
  }
339
339
 
340
+ function warn(message) {
341
+ if (process.env.NODE_ENV !== 'production') {
342
+ console.warn(message);
343
+ }
344
+ }
345
+ function deprecatedMessage(symbol, deprecation, replaceBy) {
346
+ const replaceMessage = replaceBy === undefined ? '' : `, please use ${replaceBy} instead`;
347
+ warn(`[Deprecation] in ${symbol}: ${deprecation} is deprecated${replaceMessage}.`);
348
+ }
349
+ function deprecatedInComponent(component, deprecation, replaceBy) {
350
+ deprecatedMessage(`<${component} />`, deprecation, replaceBy);
351
+ }
352
+
340
353
  const hasVariant = (button, variant) => {
341
354
  return variant in button;
342
355
  };
@@ -476,8 +489,7 @@ const BaseStyledButtonPressable = /*#__PURE__*/styled__default.View.withConfig({
476
489
  return getVariantValuesIfExist(theme, $type, $variant).backgroundColor;
477
490
  }, ({
478
491
  theme,
479
- $isLarge,
480
- $isXLarge,
492
+ $size,
481
493
  $isDisabled
482
494
  }) => {
483
495
  const {
@@ -486,8 +498,8 @@ const BaseStyledButtonPressable = /*#__PURE__*/styled__default.View.withConfig({
486
498
  disabled: disabledPadding,
487
499
  xLarge
488
500
  } = theme.kitt.button.contentPadding;
489
- if ($isXLarge) return xLarge;
490
- if ($isLarge) return large;
501
+ if ($size === 'large') return large;
502
+ if ($size === 'xlarge') return xLarge;
491
503
  if ($isDisabled) return disabledPadding;
492
504
  return defaultPadding;
493
505
  });
@@ -715,6 +727,17 @@ const StyledDisabled = /*#__PURE__*/styled__default.View.withConfig({
715
727
  }) => theme.kitt.button.borderRadius);
716
728
 
717
729
  const allowedGhostTypes = ['primary', 'default'];
730
+
731
+ const getButtonSize = ({
732
+ large,
733
+ xLarge,
734
+ size
735
+ }) => {
736
+ if (large) return 'large';
737
+ if (xLarge) return 'xlarge';
738
+ return size;
739
+ };
740
+
718
741
  const Button = /*#__PURE__*/React.forwardRef(({
719
742
  children,
720
743
  type = 'default',
@@ -724,6 +747,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
724
747
  large,
725
748
  xLarge,
726
749
  icon,
750
+ size: sizeProp,
727
751
  iconPosition = 'left',
728
752
  testID,
729
753
  href,
@@ -735,6 +759,16 @@ const Button = /*#__PURE__*/React.forwardRef(({
735
759
  throw new Error('variant=ghost is only allowed with type=primary or default');
736
760
  }
737
761
 
762
+ if (large || xLarge) {
763
+ const deprecatedProp = large ? 'large' : 'xLarge';
764
+ deprecatedInComponent('Button', `${deprecatedProp} prop`, 'size');
765
+ }
766
+
767
+ const size = getButtonSize({
768
+ large,
769
+ xLarge,
770
+ size: sizeProp
771
+ });
738
772
  return /*#__PURE__*/jsxRuntime.jsx(AnimatedButtonPressable, {
739
773
  ref: ref,
740
774
  accessibilityRole: accessibilityRole,
@@ -750,8 +784,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
750
784
  $type: type,
751
785
  $variant: variant,
752
786
  $isStretch: stretch,
753
- $isLarge: large,
754
- $isXLarge: xLarge,
787
+ $size: size,
755
788
  $isDisabled: disabled,
756
789
  children: [/*#__PURE__*/jsxRuntime.jsx(ButtonContent, {
757
790
  type: type,
@@ -1210,7 +1243,7 @@ const typography = {
1210
1243
  },
1211
1244
  fontWeight: {
1212
1245
  regular: 400,
1213
- bold: 700
1246
+ bold: reactNative.Platform.OS === 'web' ? 700 : 400
1214
1247
  },
1215
1248
  fontStyle: {
1216
1249
  regular: 'normal',
@@ -3326,6 +3359,144 @@ function Message({
3326
3359
  });
3327
3360
  }
3328
3361
 
3362
+ const createKittSpaces = spacing => {
3363
+ const sizes = {};
3364
+
3365
+ for (let size = 1; size <= 64; size++) {
3366
+ sizes[`kitt.${size}`] = size * spacing;
3367
+ }
3368
+
3369
+ return sizes;
3370
+ }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
3371
+
3372
+
3373
+ const createKittNativeBaseCustomTheme = theme => {
3374
+ const spaces = createKittSpaces(theme.spacing);
3375
+ return nativeBase.extendTheme({
3376
+ colors: {
3377
+ kitt: { ...theme.colors,
3378
+ typography: theme.typography.colors
3379
+ }
3380
+ },
3381
+ radii: {
3382
+ 'kitt.borderRadius': theme.card.borderRadius
3383
+ },
3384
+ sizes: { ...spaces,
3385
+ // reset native-base to be able to set size as number
3386
+ // https://docs.nativebase.io/next/default-theme#h2-size
3387
+ ...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]))
3388
+ },
3389
+ space: spaces,
3390
+ breakpoints: {
3391
+ // kitt breakpoints
3392
+ base: KittBreakpoints.BASE,
3393
+ small: KittBreakpoints.SMALL,
3394
+ medium: KittBreakpoints.MEDIUM,
3395
+ large: KittBreakpoints.LARGE,
3396
+ wide: KittBreakpoints.WIDE,
3397
+ // native base default naming
3398
+ sm: Number.MAX_SAFE_INTEGER,
3399
+ md: Number.MAX_SAFE_INTEGER,
3400
+ lg: Number.MAX_SAFE_INTEGER,
3401
+ xl: Number.MAX_SAFE_INTEGER,
3402
+ '2xl': Number.MAX_SAFE_INTEGER
3403
+ },
3404
+ fontSizes: {
3405
+ baseAndSmall: {
3406
+ header1: `${theme.typography.types.headers.configs.header1.baseAndSmall.fontSize}px`,
3407
+ header2: `${theme.typography.types.headers.configs.header2.baseAndSmall.fontSize}px`,
3408
+ header3: `${theme.typography.types.headers.configs.header3.baseAndSmall.fontSize}px`,
3409
+ header4: `${theme.typography.types.headers.configs.header4.baseAndSmall.fontSize}px`,
3410
+ header5: `${theme.typography.types.headers.configs.header5.baseAndSmall.fontSize}px`,
3411
+ 'body-large': `${theme.typography.types.bodies.configs['body-large'].baseAndSmall.fontSize}px`,
3412
+ 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].baseAndSmall.fontSize}px`,
3413
+ body: `${theme.typography.types.bodies.configs.body.baseAndSmall.fontSize}px`,
3414
+ 'body-small': `${theme.typography.types.bodies.configs['body-small'].baseAndSmall.fontSize}px`,
3415
+ 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.fontSize}px`
3416
+ },
3417
+ mediumAndWide: {
3418
+ header1: `${theme.typography.types.headers.configs.header1.mediumAndWide.fontSize}px`,
3419
+ header2: `${theme.typography.types.headers.configs.header2.mediumAndWide.fontSize}px`,
3420
+ header3: `${theme.typography.types.headers.configs.header3.mediumAndWide.fontSize}px`,
3421
+ header4: `${theme.typography.types.headers.configs.header4.mediumAndWide.fontSize}px`,
3422
+ header5: `${theme.typography.types.headers.configs.header5.mediumAndWide.fontSize}px`,
3423
+ 'body-large': `${theme.typography.types.bodies.configs['body-large'].mediumAndWide.fontSize}px`,
3424
+ 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].mediumAndWide.fontSize}px`,
3425
+ body: `${theme.typography.types.bodies.configs.body.mediumAndWide.fontSize}px`,
3426
+ 'body-small': `${theme.typography.types.bodies.configs['body-small'].mediumAndWide.fontSize}px`,
3427
+ 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.fontSize}px`
3428
+ }
3429
+ },
3430
+ lineHeights: {
3431
+ baseAndSmall: {
3432
+ header1: theme.typography.types.headers.configs.header1.baseAndSmall.lineHeight,
3433
+ header2: theme.typography.types.headers.configs.header2.baseAndSmall.lineHeight,
3434
+ header3: theme.typography.types.headers.configs.header3.baseAndSmall.lineHeight,
3435
+ header4: theme.typography.types.headers.configs.header4.baseAndSmall.lineHeight,
3436
+ header5: theme.typography.types.headers.configs.header5.baseAndSmall.lineHeight,
3437
+ 'body-large': theme.typography.types.bodies.configs['body-large'].baseAndSmall.lineHeight,
3438
+ 'body-medium': theme.typography.types.bodies.configs['body-medium'].baseAndSmall.lineHeight,
3439
+ body: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight,
3440
+ 'body-small': theme.typography.types.bodies.configs['body-small'].baseAndSmall.lineHeight,
3441
+ 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.lineHeight
3442
+ },
3443
+ mediumAndWide: {
3444
+ header1: theme.typography.types.headers.configs.header1.mediumAndWide.lineHeight,
3445
+ header2: theme.typography.types.headers.configs.header2.mediumAndWide.lineHeight,
3446
+ header3: theme.typography.types.headers.configs.header3.mediumAndWide.lineHeight,
3447
+ header4: theme.typography.types.headers.configs.header4.mediumAndWide.lineHeight,
3448
+ header5: theme.typography.types.headers.configs.header5.mediumAndWide.lineHeight,
3449
+ 'body-large': theme.typography.types.bodies.configs['body-large'].mediumAndWide.lineHeight,
3450
+ 'body-medium': theme.typography.types.bodies.configs['body-medium'].mediumAndWide.lineHeight,
3451
+ body: theme.typography.types.bodies.configs.body.mediumAndWide.lineHeight,
3452
+ 'body-small': theme.typography.types.bodies.configs['body-small'].mediumAndWide.lineHeight,
3453
+ 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.lineHeight
3454
+ }
3455
+ },
3456
+ fontWeights: {
3457
+ headers: {
3458
+ regular: theme.typography.types.headers.fontWeight,
3459
+ bold: theme.typography.types.headers.fontWeight
3460
+ },
3461
+ bodies: theme.typography.types.bodies.fontWeight
3462
+ },
3463
+ fonts: {
3464
+ headers: theme.typography.types.headers.fontFamily,
3465
+ bodies: theme.typography.types.bodies.fontFamily
3466
+ },
3467
+ components: {
3468
+ Text: {
3469
+ baseStyle: {
3470
+ _light: {
3471
+ color: 'kitt.typography.black'
3472
+ },
3473
+ _dark: {
3474
+ color: 'kitt.typography.white'
3475
+ },
3476
+ fontFamily: theme.typography.types.bodies.fontFamily.regular,
3477
+ fontStyle: theme.typography.types.bodies.fontStyle.regular,
3478
+ fontWeight: theme.typography.types.bodies.fontWeight.regular,
3479
+ fontSize: undefined,
3480
+ lineHeight: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight
3481
+ }
3482
+ }
3483
+ }
3484
+ });
3485
+ };
3486
+ function KittNativeBaseProvider({
3487
+ theme,
3488
+ isSSR,
3489
+ children
3490
+ }) {
3491
+ const kittTheme = theme.kitt;
3492
+ const nativeBaseCustomTheme = React.useMemo(() => createKittNativeBaseCustomTheme(kittTheme), [kittTheme]);
3493
+ return /*#__PURE__*/jsxRuntime.jsx(nativeBase.NativeBaseProvider, {
3494
+ theme: nativeBaseCustomTheme,
3495
+ isSSR: isSSR,
3496
+ children: children
3497
+ });
3498
+ }
3499
+
3329
3500
  function Notification({
3330
3501
  type,
3331
3502
  children,
@@ -4579,144 +4750,6 @@ const hex2rgba = (hex, alpha = 1) => {
4579
4750
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
4580
4751
  };
4581
4752
 
4582
- const createKittSpaces = spacing => {
4583
- const sizes = {};
4584
-
4585
- for (let size = 1; size <= 64; size++) {
4586
- sizes[`kitt.${size}`] = size * spacing;
4587
- }
4588
-
4589
- return sizes;
4590
- }; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type -- let typescript infer types
4591
-
4592
-
4593
- const createKittNativeBaseCustomTheme = theme => {
4594
- const spaces = createKittSpaces(theme.spacing);
4595
- return nativeBase.extendTheme({
4596
- colors: {
4597
- kitt: { ...theme.colors,
4598
- typography: theme.typography.colors
4599
- }
4600
- },
4601
- radii: {
4602
- 'kitt.borderRadius': theme.card.borderRadius
4603
- },
4604
- sizes: { ...spaces,
4605
- // reset native-base to be able to set size as number
4606
- // https://docs.nativebase.io/next/default-theme#h2-size
4607
- ...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]))
4608
- },
4609
- space: spaces,
4610
- breakpoints: {
4611
- // kitt breakpoints
4612
- base: KittBreakpoints.BASE,
4613
- small: KittBreakpoints.SMALL,
4614
- medium: KittBreakpoints.MEDIUM,
4615
- large: KittBreakpoints.LARGE,
4616
- wide: KittBreakpoints.WIDE,
4617
- // native base default naming
4618
- sm: Number.MAX_SAFE_INTEGER,
4619
- md: Number.MAX_SAFE_INTEGER,
4620
- lg: Number.MAX_SAFE_INTEGER,
4621
- xl: Number.MAX_SAFE_INTEGER,
4622
- '2xl': Number.MAX_SAFE_INTEGER
4623
- },
4624
- fontSizes: {
4625
- baseAndSmall: {
4626
- header1: `${theme.typography.types.headers.configs.header1.baseAndSmall.fontSize}px`,
4627
- header2: `${theme.typography.types.headers.configs.header2.baseAndSmall.fontSize}px`,
4628
- header3: `${theme.typography.types.headers.configs.header3.baseAndSmall.fontSize}px`,
4629
- header4: `${theme.typography.types.headers.configs.header4.baseAndSmall.fontSize}px`,
4630
- header5: `${theme.typography.types.headers.configs.header5.baseAndSmall.fontSize}px`,
4631
- 'body-large': `${theme.typography.types.bodies.configs['body-large'].baseAndSmall.fontSize}px`,
4632
- 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].baseAndSmall.fontSize}px`,
4633
- body: `${theme.typography.types.bodies.configs.body.baseAndSmall.fontSize}px`,
4634
- 'body-small': `${theme.typography.types.bodies.configs['body-small'].baseAndSmall.fontSize}px`,
4635
- 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.fontSize}px`
4636
- },
4637
- mediumAndWide: {
4638
- header1: `${theme.typography.types.headers.configs.header1.mediumAndWide.fontSize}px`,
4639
- header2: `${theme.typography.types.headers.configs.header2.mediumAndWide.fontSize}px`,
4640
- header3: `${theme.typography.types.headers.configs.header3.mediumAndWide.fontSize}px`,
4641
- header4: `${theme.typography.types.headers.configs.header4.mediumAndWide.fontSize}px`,
4642
- header5: `${theme.typography.types.headers.configs.header5.mediumAndWide.fontSize}px`,
4643
- 'body-large': `${theme.typography.types.bodies.configs['body-large'].mediumAndWide.fontSize}px`,
4644
- 'body-medium': `${theme.typography.types.bodies.configs['body-medium'].mediumAndWide.fontSize}px`,
4645
- body: `${theme.typography.types.bodies.configs.body.mediumAndWide.fontSize}px`,
4646
- 'body-small': `${theme.typography.types.bodies.configs['body-small'].mediumAndWide.fontSize}px`,
4647
- 'body-xsmall': `${theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.fontSize}px`
4648
- }
4649
- },
4650
- lineHeights: {
4651
- baseAndSmall: {
4652
- header1: theme.typography.types.headers.configs.header1.baseAndSmall.lineHeight,
4653
- header2: theme.typography.types.headers.configs.header2.baseAndSmall.lineHeight,
4654
- header3: theme.typography.types.headers.configs.header3.baseAndSmall.lineHeight,
4655
- header4: theme.typography.types.headers.configs.header4.baseAndSmall.lineHeight,
4656
- header5: theme.typography.types.headers.configs.header5.baseAndSmall.lineHeight,
4657
- 'body-large': theme.typography.types.bodies.configs['body-large'].baseAndSmall.lineHeight,
4658
- 'body-medium': theme.typography.types.bodies.configs['body-medium'].baseAndSmall.lineHeight,
4659
- body: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight,
4660
- 'body-small': theme.typography.types.bodies.configs['body-small'].baseAndSmall.lineHeight,
4661
- 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].baseAndSmall.lineHeight
4662
- },
4663
- mediumAndWide: {
4664
- header1: theme.typography.types.headers.configs.header1.mediumAndWide.lineHeight,
4665
- header2: theme.typography.types.headers.configs.header2.mediumAndWide.lineHeight,
4666
- header3: theme.typography.types.headers.configs.header3.mediumAndWide.lineHeight,
4667
- header4: theme.typography.types.headers.configs.header4.mediumAndWide.lineHeight,
4668
- header5: theme.typography.types.headers.configs.header5.mediumAndWide.lineHeight,
4669
- 'body-large': theme.typography.types.bodies.configs['body-large'].mediumAndWide.lineHeight,
4670
- 'body-medium': theme.typography.types.bodies.configs['body-medium'].mediumAndWide.lineHeight,
4671
- body: theme.typography.types.bodies.configs.body.mediumAndWide.lineHeight,
4672
- 'body-small': theme.typography.types.bodies.configs['body-small'].mediumAndWide.lineHeight,
4673
- 'body-xsmall': theme.typography.types.bodies.configs['body-xsmall'].mediumAndWide.lineHeight
4674
- }
4675
- },
4676
- fontWeights: {
4677
- headers: {
4678
- regular: theme.typography.types.headers.fontWeight,
4679
- bold: theme.typography.types.headers.fontWeight
4680
- },
4681
- bodies: theme.typography.types.bodies.fontWeight
4682
- },
4683
- fonts: {
4684
- headers: theme.typography.types.headers.fontFamily,
4685
- bodies: theme.typography.types.bodies.fontFamily
4686
- },
4687
- components: {
4688
- Text: {
4689
- baseStyle: {
4690
- _light: {
4691
- color: 'kitt.typography.black'
4692
- },
4693
- _dark: {
4694
- color: 'kitt.typography.white'
4695
- },
4696
- fontFamily: theme.typography.types.bodies.fontFamily.regular,
4697
- fontStyle: theme.typography.types.bodies.fontStyle.regular,
4698
- fontWeight: theme.typography.types.bodies.fontWeight.regular,
4699
- fontSize: undefined,
4700
- lineHeight: theme.typography.types.bodies.configs.body.baseAndSmall.lineHeight
4701
- }
4702
- }
4703
- }
4704
- });
4705
- };
4706
- function KittNativeBaseProvider({
4707
- theme,
4708
- isSSR,
4709
- children
4710
- }) {
4711
- const kittTheme = theme.kitt;
4712
- const nativeBaseCustomTheme = React.useMemo(() => createKittNativeBaseCustomTheme(kittTheme), [kittTheme]);
4713
- return /*#__PURE__*/jsxRuntime.jsx(nativeBase.NativeBaseProvider, {
4714
- theme: nativeBaseCustomTheme,
4715
- isSSR: isSSR,
4716
- children: children
4717
- });
4718
- }
4719
-
4720
4753
  function KittThemeProvider({
4721
4754
  isSSR,
4722
4755
  children
@@ -4778,6 +4811,7 @@ exports.InputTag = InputTag;
4778
4811
  exports.InputText = InputText;
4779
4812
  exports.KittBreakpoints = KittBreakpoints;
4780
4813
  exports.KittBreakpointsMax = KittBreakpointsMax;
4814
+ exports.KittNativeBaseProvider = KittNativeBaseProvider;
4781
4815
  exports.KittThemeDecorator = KittThemeDecorator;
4782
4816
  exports.KittThemeProvider = KittThemeProvider;
4783
4817
  exports.Label = Label;