@ornikar/kitt-universal 27.5.1-canary.eac3fc19869888632e3a59913cf9f700a72b0dad.0 → 27.6.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +6 -4
  2. package/dist/definitions/TabBar/TabBar.d.ts +6 -4
  3. package/dist/definitions/TabBar/TabBar.d.ts.map +1 -1
  4. package/dist/definitions/TabBar/TabBarItem.d.ts +11 -1
  5. package/dist/definitions/TabBar/TabBarItem.d.ts.map +1 -1
  6. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +180 -12
  7. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  8. package/dist/definitions/themes/default.d.ts +1 -12
  9. package/dist/definitions/themes/default.d.ts.map +1 -1
  10. package/dist/definitions/themes/late-ocean/icon.d.ts +0 -20
  11. package/dist/definitions/themes/late-ocean/icon.d.ts.map +1 -1
  12. package/dist/definitions/themes/late-ocean/tabBar.d.ts +34 -0
  13. package/dist/definitions/themes/late-ocean/tabBar.d.ts.map +1 -0
  14. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  15. package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
  16. package/dist/definitions/typography/utils/getTypographyFamily.d.ts +2 -1
  17. package/dist/definitions/typography/utils/getTypographyFamily.d.ts.map +1 -1
  18. package/dist/index-metro.es.android.js +565 -250
  19. package/dist/index-metro.es.android.js.map +1 -1
  20. package/dist/index-metro.es.ios.js +565 -250
  21. package/dist/index-metro.es.ios.js.map +1 -1
  22. package/dist/index-node-22.17.cjs.js +456 -140
  23. package/dist/index-node-22.17.cjs.js.map +1 -1
  24. package/dist/index-node-22.17.cjs.web.js +457 -141
  25. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  26. package/dist/index-node-22.17.es.mjs +456 -140
  27. package/dist/index-node-22.17.es.mjs.map +1 -1
  28. package/dist/index-node-22.17.es.web.mjs +457 -141
  29. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  30. package/dist/index.es.js +567 -242
  31. package/dist/index.es.js.map +1 -1
  32. package/dist/index.es.web.js +566 -241
  33. package/dist/index.es.web.js.map +1 -1
  34. package/dist/linaria-themes-metro.es.android.js +179 -36
  35. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  36. package/dist/linaria-themes-metro.es.ios.js +179 -36
  37. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  38. package/dist/linaria-themes-node-22.17.cjs.js +179 -36
  39. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  40. package/dist/linaria-themes-node-22.17.cjs.web.js +179 -36
  41. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  42. package/dist/linaria-themes-node-22.17.es.mjs +179 -36
  43. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  44. package/dist/linaria-themes-node-22.17.es.web.mjs +179 -36
  45. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  46. package/dist/linaria-themes.es.js +179 -36
  47. package/dist/linaria-themes.es.js.map +1 -1
  48. package/dist/linaria-themes.es.web.js +179 -36
  49. package/dist/linaria-themes.es.web.js.map +1 -1
  50. package/dist/tsbuildinfo +1 -1
  51. package/package.json +2 -2
  52. package/scripts/codemods/card-modal.js +155 -0
  53. package/scripts/codemods/fullscreen-modal.js +155 -0
  54. package/scripts/codemods/navigation-modal.js +155 -0
  55. package/scripts/{run-transformers.js → run-codemods.js} +30 -32
  56. package/scripts/transformers/card-modal.js +0 -101
  57. package/scripts/transformers/fullscreen-modal.js +0 -101
  58. package/scripts/transformers/navigation-modal.js +0 -101
  59. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.input.js +0 -0
  60. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.output.js +0 -0
  61. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.input.js +0 -0
  62. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.output.js +0 -0
  63. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.input.js +0 -0
  64. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.output.js +0 -0
  65. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.input.js +0 -0
  66. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.output.js +0 -0
  67. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.input.js +0 -0
  68. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.output.js +0 -0
  69. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.input.js +0 -0
  70. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.output.js +0 -0
  71. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.input.js +0 -0
  72. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.output.js +0 -0
  73. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.input.js +0 -0
  74. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.output.js +0 -0
  75. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.input.js +0 -0
  76. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.output.js +0 -0
  77. /package/scripts/{transformers → codemods}/__tests__/card-modal.test.js +0 -0
  78. /package/scripts/{transformers → codemods}/__tests__/fullscreen-modal.test.js +0 -0
  79. /package/scripts/{transformers → codemods}/__tests__/navigation-modal.test.js +0 -0
@@ -1890,43 +1890,8 @@ const highlight = {
1890
1890
  }
1891
1891
  };
1892
1892
 
1893
- const getIconSizeFromFontSize = fontSize => {
1894
- if (fontSize <= 14) return 16;
1895
- if (fontSize <= 16) return 20;
1896
- return 24;
1897
- };
1898
- const createTypographyIconSizeConfig = (baseAndSmallFontSize, mediumAndWideFontSize) => {
1899
- const baseAndSmallIconSize = getIconSizeFromFontSize(baseAndSmallFontSize);
1900
- const mediumAndWideIconSize = getIconSizeFromFontSize(mediumAndWideFontSize);
1901
- return {
1902
- baseAndSmall: {
1903
- iconSize: baseAndSmallIconSize
1904
- },
1905
- mediumAndWide: {
1906
- iconSize: mediumAndWideIconSize
1907
- }
1908
- };
1909
- };
1910
1893
  const icon = {
1911
- defaultSize: 20,
1912
- // Note: this is based on typography updated sizes, not current https://github.com/ornikar/kitt/pull/2130
1913
- typographySize: {
1914
- // also known as xxlarge
1915
- header1: createTypographyIconSizeConfig(40, 56),
1916
- // also known as xlarge
1917
- header2: createTypographyIconSizeConfig(32, 48),
1918
- // also known as medium
1919
- header3: createTypographyIconSizeConfig(24, 40),
1920
- // also known as xsmall
1921
- header4: createTypographyIconSizeConfig(18, 24),
1922
- // also known as xxsmall
1923
- header5: createTypographyIconSizeConfig(18, 18),
1924
- 'body-large': createTypographyIconSizeConfig(18, 24),
1925
- 'body-medium': createTypographyIconSizeConfig(18, 18),
1926
- body: createTypographyIconSizeConfig(16, 16),
1927
- 'body-small': createTypographyIconSizeConfig(14, 14),
1928
- 'body-xsmall': createTypographyIconSizeConfig(12, 12)
1929
- }
1894
+ defaultSize: 20
1930
1895
  };
1931
1896
 
1932
1897
  const iconButton = {
@@ -2353,6 +2318,183 @@ const skeleton = {
2353
2318
  }
2354
2319
  };
2355
2320
 
2321
+ const tabBar = {
2322
+ underline: {
2323
+ default: {
2324
+ active: {
2325
+ color: {
2326
+ default: deepPurpleColorPalette['deepPurple.8'],
2327
+ focused: deepPurpleColorPalette['deepPurple.8'],
2328
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2329
+ pressed: deepPurpleColorPalette['deepPurple.8']
2330
+ },
2331
+ indicator: {
2332
+ backgroundColor: deepPurpleColorPalette['deepPurple.8']
2333
+ }
2334
+ },
2335
+ inactive: {
2336
+ color: {
2337
+ default: deepPurpleColorPalette['grey.5'],
2338
+ focused: deepPurpleColorPalette['grey.5'],
2339
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2340
+ pressed: deepPurpleColorPalette['deepPurple.8']
2341
+ },
2342
+ indicator: {
2343
+ backgroundColor: undefined
2344
+ }
2345
+ },
2346
+ disabled: {
2347
+ color: {
2348
+ default: deepPurpleColorPalette['grey.3'],
2349
+ focused: deepPurpleColorPalette['grey.3'],
2350
+ hovered: deepPurpleColorPalette['grey.3'],
2351
+ pressed: deepPurpleColorPalette['grey.3']
2352
+ },
2353
+ indicator: {
2354
+ backgroundColor: undefined
2355
+ }
2356
+ },
2357
+ borderBottomColor: deepPurpleColorPalette['beige.3']
2358
+ },
2359
+ revert: {
2360
+ active: {
2361
+ color: {
2362
+ default: deepPurpleColorPalette['grey.0'],
2363
+ focused: deepPurpleColorPalette['grey.0'],
2364
+ hovered: deepPurpleColorPalette['grey.0'],
2365
+ pressed: deepPurpleColorPalette['grey.0']
2366
+ },
2367
+ indicator: {
2368
+ backgroundColor: deepPurpleColorPalette['grey.0']
2369
+ }
2370
+ },
2371
+ inactive: {
2372
+ color: {
2373
+ default: deepPurpleColorPalette['white-alpha.80'],
2374
+ focused: deepPurpleColorPalette['white-alpha.80'],
2375
+ hovered: deepPurpleColorPalette['grey.0'],
2376
+ pressed: deepPurpleColorPalette['grey.0']
2377
+ },
2378
+ indicator: {
2379
+ backgroundColor: undefined
2380
+ }
2381
+ },
2382
+ disabled: {
2383
+ color: {
2384
+ default: deepPurpleColorPalette['white-alpha.20'],
2385
+ focused: deepPurpleColorPalette['white-alpha.20'],
2386
+ hovered: deepPurpleColorPalette['white-alpha.20'],
2387
+ pressed: deepPurpleColorPalette['white-alpha.20']
2388
+ },
2389
+ indicator: {
2390
+ backgroundColor: undefined
2391
+ }
2392
+ },
2393
+ borderBottomColor: deepPurpleColorPalette['white-alpha.20']
2394
+ }
2395
+ },
2396
+ solid: {
2397
+ default: {
2398
+ active: {
2399
+ color: {
2400
+ default: deepPurpleColorPalette['grey.0'],
2401
+ focused: deepPurpleColorPalette['grey.0'],
2402
+ hovered: deepPurpleColorPalette['grey.0'],
2403
+ pressed: deepPurpleColorPalette['grey.0']
2404
+ },
2405
+ backgroundColor: {
2406
+ default: deepPurpleColorPalette['deepPurple.8'],
2407
+ focused: deepPurpleColorPalette['deepPurple.8'],
2408
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2409
+ pressed: deepPurpleColorPalette['deepPurple.8']
2410
+ },
2411
+ borderRadius: 4,
2412
+ indicator: {
2413
+ backgroundColor: undefined
2414
+ }
2415
+ },
2416
+ inactive: {
2417
+ color: {
2418
+ default: deepPurpleColorPalette['grey.5'],
2419
+ focused: deepPurpleColorPalette['grey.5'],
2420
+ hovered: deepPurpleColorPalette['grey.5'],
2421
+ pressed: deepPurpleColorPalette['grey.5']
2422
+ },
2423
+ backgroundColor: {
2424
+ default: undefined,
2425
+ focused: undefined,
2426
+ hovered: deepPurpleColorPalette['beige.1'],
2427
+ pressed: deepPurpleColorPalette['beige.1']
2428
+ },
2429
+ borderRadius: 4,
2430
+ indicator: {
2431
+ backgroundColor: undefined
2432
+ }
2433
+ },
2434
+ disabled: {
2435
+ color: {
2436
+ default: deepPurpleColorPalette['grey.3'],
2437
+ focused: deepPurpleColorPalette['grey.3'],
2438
+ hovered: deepPurpleColorPalette['grey.3'],
2439
+ pressed: deepPurpleColorPalette['grey.3']
2440
+ },
2441
+ indicator: {
2442
+ backgroundColor: undefined
2443
+ }
2444
+ }
2445
+ },
2446
+ revert: {
2447
+ active: {
2448
+ color: {
2449
+ default: deepPurpleColorPalette['deepPurple.8'],
2450
+ focused: deepPurpleColorPalette['deepPurple.8'],
2451
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2452
+ pressed: deepPurpleColorPalette['deepPurple.8']
2453
+ },
2454
+ backgroundColor: {
2455
+ default: deepPurpleColorPalette['grey.0'],
2456
+ focused: deepPurpleColorPalette['grey.0'],
2457
+ hovered: deepPurpleColorPalette['grey.0'],
2458
+ pressed: deepPurpleColorPalette['grey.0']
2459
+ },
2460
+ borderRadius: 4,
2461
+ indicator: {
2462
+ backgroundColor: undefined
2463
+ }
2464
+ },
2465
+ inactive: {
2466
+ color: {
2467
+ default: deepPurpleColorPalette['white-alpha.80'],
2468
+ focused: deepPurpleColorPalette['white-alpha.80'],
2469
+ hovered: deepPurpleColorPalette['white-alpha.80'],
2470
+ pressed: deepPurpleColorPalette['white-alpha.80']
2471
+ },
2472
+ backgroundColor: {
2473
+ default: undefined,
2474
+ focused: undefined,
2475
+ hovered: deepPurpleColorPalette['white-alpha.10'],
2476
+ pressed: deepPurpleColorPalette['white-alpha.10']
2477
+ },
2478
+ borderRadius: 4,
2479
+ indicator: {
2480
+ backgroundColor: undefined
2481
+ }
2482
+ },
2483
+ disabled: {
2484
+ color: {
2485
+ default: deepPurpleColorPalette['white-alpha.20'],
2486
+ focused: deepPurpleColorPalette['white-alpha.20'],
2487
+ hovered: deepPurpleColorPalette['white-alpha.20'],
2488
+ pressed: deepPurpleColorPalette['white-alpha.20']
2489
+ },
2490
+ indicator: {
2491
+ backgroundColor: undefined
2492
+ }
2493
+ }
2494
+ }
2495
+ }
2496
+ };
2497
+
2356
2498
  const tag = {
2357
2499
  borderRadius: 16,
2358
2500
  icon: {
@@ -2492,6 +2634,7 @@ const theme = {
2492
2634
  picker,
2493
2635
  shadows,
2494
2636
  skeleton,
2637
+ tabBar,
2495
2638
  tag,
2496
2639
  tooltip,
2497
2640
  typography,
@@ -2904,6 +3047,13 @@ const getTypographyFamilyWithAncestorValue = (type, typographyFamilyInContext) =
2904
3047
  if (typographyFamilyInContext != null) return typographyFamilyInContext;
2905
3048
  throw new Error('You must set a "base" prop or wrap this Typography in one that does.');
2906
3049
  };
3050
+ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3051
+ // check if all values are not undefined
3052
+ const isAllValuesUndefined = Object.values(type).every(value => value === undefined);
3053
+
3054
+ // if every values are undefined and we hgave a typographyTypeInContext, we use the parent typography type (typographyTypeInContext)
3055
+ return !!isAllValuesUndefined && !!typographyTypeInContext ? typographyTypeInContext : type;
3056
+ };
2907
3057
 
2908
3058
  const TypographyFamilyContext = /*#__PURE__*/createContext(null);
2909
3059
  const TypographyTypeContext = /*#__PURE__*/createContext(null);
@@ -2911,9 +3061,6 @@ const TypographyColorContext = /*#__PURE__*/createContext('black');
2911
3061
  function useTypographyColor() {
2912
3062
  return useContext(TypographyColorContext);
2913
3063
  }
2914
- function useTypographyAncestorType() {
2915
- return useContext(TypographyTypeContext);
2916
- }
2917
3064
  const TypographyDefaultColorContext = /*#__PURE__*/createContext(undefined);
2918
3065
  function useTypographyDefaultColor() {
2919
3066
  return useContext(TypographyDefaultColorContext);
@@ -3036,9 +3183,11 @@ function Typography({
3036
3183
  }) {
3037
3184
  const sx = useSx();
3038
3185
  const typographyFamilyInContext = useContext(TypographyFamilyContext);
3186
+ const typographyTypeInContext = useContext(TypographyTypeContext);
3039
3187
  const defaultColor = useTypographyDefaultColor();
3040
3188
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3041
- const baseOrDefaultToBody = hasTypographyAncestor ? type.base : type.base ?? 'body-m';
3189
+ const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3190
+ const baseOrDefaultToBody = typographyType.base ?? 'body-m';
3042
3191
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3043
3192
  const fontSizeForNativeBase = createNativeBaseFontSize({
3044
3193
  ...type,
@@ -3077,7 +3226,7 @@ function Typography({
3077
3226
  const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3078
3227
  value: typographyFamily,
3079
3228
  children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3080
- value: type,
3229
+ value: typographyType,
3081
3230
  children: text
3082
3231
  })
3083
3232
  }) : text;
@@ -3178,30 +3327,11 @@ function Icon({
3178
3327
  });
3179
3328
  }
3180
3329
 
3181
- function getIconSizeConfigKeyFromTypeName(breakpointName) {
3182
- return breakpointName === KittBreakpointNameEnum.BASE || breakpointName === KittBreakpointNameEnum.SMALL ? 'baseAndSmall' : 'mediumAndWide';
3183
- }
3184
- function createNativeBaseIconSize(type) {
3185
- const typeWithMediumForced = {
3186
- ...type,
3187
- medium: type.medium || type.small || type.base
3188
- };
3189
- const iconSizeForNativeBase = {};
3190
- [KittBreakpointNameEnum.BASE, KittBreakpointNameEnum.SMALL, KittBreakpointNameEnum.MEDIUM, KittBreakpointNameEnum.LARGE, KittBreakpointNameEnum.WIDE].forEach(typeName => {
3191
- const value = typeWithMediumForced[typeName];
3192
- if (value) {
3193
- iconSizeForNativeBase[typeName] = `kitt.icon.typographySize.${value}.${getIconSizeConfigKeyFromTypeName(typeName)}.iconSize`;
3194
- }
3195
- });
3196
- return iconSizeForNativeBase;
3197
- }
3198
3330
  function TypographyIconSpecifiedColor({
3199
3331
  color,
3200
3332
  size,
3201
3333
  ...props
3202
3334
  }) {
3203
- const ancestorType = useTypographyAncestorType();
3204
- const iconSize = size || (ancestorType ? createNativeBaseIconSize(ancestorType) : undefined);
3205
3335
  const colorValue = getTypographyColorValue(color);
3206
3336
  const sx = useSx();
3207
3337
  const {
@@ -3211,7 +3341,7 @@ function TypographyIconSpecifiedColor({
3211
3341
  });
3212
3342
  return /*#__PURE__*/jsx(Icon, {
3213
3343
  ...props,
3214
- size: iconSize,
3344
+ size: size,
3215
3345
  color: colorStyleValue
3216
3346
  });
3217
3347
  }
@@ -9614,6 +9744,148 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9614
9744
  backgroundColor: theme.picker.web.optionsContainer.backgroundColor
9615
9745
  }
9616
9746
  }
9747
+ },
9748
+ tabBar: {
9749
+ underline: {
9750
+ default: {
9751
+ active: {
9752
+ color: {
9753
+ default: theme.tabBar.underline.default.active.color.default,
9754
+ focused: theme.tabBar.underline.default.active.color.focused,
9755
+ hovered: theme.tabBar.underline.default.active.color.hovered,
9756
+ pressed: theme.tabBar.underline.default.active.color.pressed
9757
+ },
9758
+ indicator: {
9759
+ backgroundColor: theme.tabBar.underline.default.active.indicator.backgroundColor
9760
+ }
9761
+ },
9762
+ inactive: {
9763
+ color: {
9764
+ default: theme.tabBar.underline.default.inactive.color.default,
9765
+ focused: theme.tabBar.underline.default.inactive.color.focused,
9766
+ hovered: theme.tabBar.underline.default.inactive.color.hovered,
9767
+ pressed: theme.tabBar.underline.default.inactive.color.pressed
9768
+ }
9769
+ },
9770
+ disabled: {
9771
+ color: {
9772
+ default: theme.tabBar.underline.default.disabled.color.default,
9773
+ focused: theme.tabBar.underline.default.disabled.color.focused,
9774
+ hovered: theme.tabBar.underline.default.disabled.color.hovered,
9775
+ pressed: theme.tabBar.underline.default.disabled.color.pressed
9776
+ }
9777
+ },
9778
+ borderBottomColor: theme.tabBar.underline.default.borderBottomColor
9779
+ },
9780
+ revert: {
9781
+ active: {
9782
+ color: {
9783
+ default: theme.tabBar.underline.revert.active.color.default,
9784
+ focused: theme.tabBar.underline.revert.active.color.focused,
9785
+ hovered: theme.tabBar.underline.revert.active.color.hovered,
9786
+ pressed: theme.tabBar.underline.revert.active.color.pressed
9787
+ },
9788
+ indicator: {
9789
+ backgroundColor: theme.tabBar.underline.revert.active.indicator.backgroundColor
9790
+ }
9791
+ },
9792
+ inactive: {
9793
+ color: {
9794
+ default: theme.tabBar.underline.revert.inactive.color.default,
9795
+ focused: theme.tabBar.underline.revert.inactive.color.focused,
9796
+ hovered: theme.tabBar.underline.revert.inactive.color.hovered,
9797
+ pressed: theme.tabBar.underline.revert.inactive.color.pressed
9798
+ }
9799
+ },
9800
+ disabled: {
9801
+ color: {
9802
+ default: theme.tabBar.underline.revert.disabled.color.default,
9803
+ focused: theme.tabBar.underline.revert.disabled.color.focused,
9804
+ hovered: theme.tabBar.underline.revert.disabled.color.hovered,
9805
+ pressed: theme.tabBar.underline.revert.disabled.color.pressed
9806
+ }
9807
+ },
9808
+ borderBottomColor: theme.tabBar.underline.revert.borderBottomColor
9809
+ }
9810
+ },
9811
+ solid: {
9812
+ default: {
9813
+ active: {
9814
+ color: {
9815
+ default: theme.tabBar.solid.default.active.color.default,
9816
+ focused: theme.tabBar.solid.default.active.color.focused,
9817
+ hovered: theme.tabBar.solid.default.active.color.hovered,
9818
+ pressed: theme.tabBar.solid.default.active.color.pressed
9819
+ },
9820
+ backgroundColor: {
9821
+ default: theme.tabBar.solid.default.active.backgroundColor?.default,
9822
+ focused: theme.tabBar.solid.default.active.backgroundColor?.focused,
9823
+ hovered: theme.tabBar.solid.default.active.backgroundColor?.hovered,
9824
+ pressed: theme.tabBar.solid.default.active.backgroundColor?.pressed
9825
+ }
9826
+ },
9827
+ inactive: {
9828
+ color: {
9829
+ default: theme.tabBar.solid.default.inactive.color.default,
9830
+ focused: theme.tabBar.solid.default.inactive.color.focused,
9831
+ hovered: theme.tabBar.solid.default.inactive.color.hovered,
9832
+ pressed: theme.tabBar.solid.default.inactive.color.pressed
9833
+ },
9834
+ backgroundColor: {
9835
+ default: theme.tabBar.solid.default.inactive.backgroundColor?.default,
9836
+ focused: theme.tabBar.solid.default.inactive.backgroundColor?.focused,
9837
+ hovered: theme.tabBar.solid.default.inactive.backgroundColor?.hovered,
9838
+ pressed: theme.tabBar.solid.default.inactive.backgroundColor?.pressed
9839
+ }
9840
+ },
9841
+ disabled: {
9842
+ color: {
9843
+ default: theme.tabBar.solid.default.disabled.color.default,
9844
+ focused: theme.tabBar.solid.default.disabled.color.focused,
9845
+ hovered: theme.tabBar.solid.default.disabled.color.hovered,
9846
+ pressed: theme.tabBar.solid.default.disabled.color.pressed
9847
+ }
9848
+ }
9849
+ },
9850
+ revert: {
9851
+ active: {
9852
+ color: {
9853
+ default: theme.tabBar.solid.revert.active.color.default,
9854
+ focused: theme.tabBar.solid.revert.active.color.focused,
9855
+ hovered: theme.tabBar.solid.revert.active.color.hovered,
9856
+ pressed: theme.tabBar.solid.revert.active.color.pressed
9857
+ },
9858
+ backgroundColor: {
9859
+ default: theme.tabBar.solid.revert.active.backgroundColor?.default,
9860
+ focused: theme.tabBar.solid.revert.active.backgroundColor?.focused,
9861
+ hovered: theme.tabBar.solid.revert.active.backgroundColor?.hovered,
9862
+ pressed: theme.tabBar.solid.revert.active.backgroundColor?.pressed
9863
+ }
9864
+ },
9865
+ inactive: {
9866
+ color: {
9867
+ default: theme.tabBar.solid.revert.inactive.color.default,
9868
+ focused: theme.tabBar.solid.revert.inactive.color.focused,
9869
+ hovered: theme.tabBar.solid.revert.inactive.color.hovered,
9870
+ pressed: theme.tabBar.solid.revert.inactive.color.pressed
9871
+ },
9872
+ backgroundColor: {
9873
+ default: theme.tabBar.solid.revert.inactive.backgroundColor?.default,
9874
+ focused: theme.tabBar.solid.revert.inactive.backgroundColor?.focused,
9875
+ hovered: theme.tabBar.solid.revert.inactive.backgroundColor?.hovered,
9876
+ pressed: theme.tabBar.solid.revert.inactive.backgroundColor?.pressed
9877
+ }
9878
+ },
9879
+ disabled: {
9880
+ color: {
9881
+ default: theme.tabBar.solid.revert.disabled.color.default,
9882
+ focused: theme.tabBar.solid.revert.disabled.color.focused,
9883
+ hovered: theme.tabBar.solid.revert.disabled.color.hovered,
9884
+ pressed: theme.tabBar.solid.revert.disabled.color.pressed
9885
+ }
9886
+ }
9887
+ }
9888
+ }
9617
9889
  }
9618
9890
  },
9619
9891
  app: appTheme?.colors
@@ -9690,6 +9962,44 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9690
9962
  highlight: {
9691
9963
  borderRadius: theme.highlight.borderRadius
9692
9964
  },
9965
+ tabBar: {
9966
+ underline: {
9967
+ default: {
9968
+ active: {
9969
+ borderRadius: theme.tabBar.underline.default.active.borderRadius
9970
+ },
9971
+ inactive: {
9972
+ borderRadius: theme.tabBar.underline.default.inactive.borderRadius
9973
+ }
9974
+ },
9975
+ revert: {
9976
+ active: {
9977
+ borderRadius: theme.tabBar.underline.revert.active.borderRadius
9978
+ },
9979
+ inactive: {
9980
+ borderRadius: theme.tabBar.underline.revert.inactive.borderRadius
9981
+ }
9982
+ }
9983
+ },
9984
+ solid: {
9985
+ default: {
9986
+ active: {
9987
+ borderRadius: theme.tabBar.solid.default.active.borderRadius
9988
+ },
9989
+ inactive: {
9990
+ borderRadius: theme.tabBar.solid.default.inactive.borderRadius
9991
+ }
9992
+ },
9993
+ revert: {
9994
+ active: {
9995
+ borderRadius: theme.tabBar.solid.revert.active.borderRadius
9996
+ },
9997
+ inactive: {
9998
+ borderRadius: theme.tabBar.solid.revert.inactive.borderRadius
9999
+ }
10000
+ }
10001
+ }
10002
+ },
9693
10003
  tag: {
9694
10004
  borderRadius: theme.tag.borderRadius
9695
10005
  },
@@ -12525,123 +12835,129 @@ const StoryGrid = {
12525
12835
  Col: StoryGridCol
12526
12836
  };
12527
12837
 
12528
- function useTabBarItemColor(color, isActive) {
12529
- const {
12530
- kitt: kittTheme
12531
- } = useKittTheme();
12532
- switch (color) {
12533
- case 'black':
12534
- {
12535
- return isActive ? kittTheme.colors.primary : kittTheme.colors.blackLight;
12536
- }
12537
- case 'white':
12538
- {
12539
- return isActive ? kittTheme.palettes.deepPurple.white : kittTheme.palettes.deepPurple['white-alpha.80'];
12540
- }
12541
- default:
12542
- {
12543
- return isActive ? kittTheme.colors.primary : kittTheme.colors.blackLight;
12544
- }
12545
- }
12546
- }
12547
- function useTabBarIndicatorColor(color, isActive) {
12548
- const {
12549
- kitt: kittTheme
12550
- } = useKittTheme();
12551
- switch (color) {
12552
- case 'black':
12553
- {
12554
- return isActive ? kittTheme.colors.primary : kittTheme.palettes.deepPurple.transparent;
12555
- }
12556
- case 'white':
12557
- {
12558
- return isActive ? kittTheme.palettes.deepPurple.white : kittTheme.palettes.deepPurple.transparent;
12559
- }
12560
- default:
12561
- {
12562
- return isActive ? kittTheme.colors.primary : kittTheme.palettes.deepPurple.transparent;
12563
- }
12564
- }
12565
- }
12838
+ const getVariantFromColor = color => {
12839
+ if (color === 'white') return 'revert';
12840
+ return 'default';
12841
+ };
12842
+ const getTabBarItemActiveState = (isActive, disabled) => {
12843
+ if (disabled) return 'disabled';
12844
+ if (isActive) return 'active';
12845
+ return 'inactive';
12846
+ };
12847
+ const getTabBarItemState = (isHovered, isPressed, isFocused) => {
12848
+ if (isHovered) return 'hovered';
12849
+ if (isPressed) return 'pressed';
12850
+ if (isFocused) return 'focused';
12851
+ return 'default';
12852
+ };
12566
12853
  function TabBarItem({
12567
12854
  name,
12568
12855
  icon,
12569
- color = 'black',
12856
+ variant = 'default',
12857
+ type = 'underline',
12858
+ color,
12570
12859
  testID,
12860
+ disabled,
12571
12861
  isActive = false,
12862
+ isFocusedInternal = false,
12863
+ isHoveredInternal = false,
12864
+ isPressedInternal = false,
12572
12865
  onPress
12573
12866
  }) {
12574
- const typographyColor = useTabBarItemColor(color, isActive);
12575
- const indicatorColor = useTabBarIndicatorColor(color, isActive);
12867
+ // Keep backward compatibility with color property
12868
+ const definedVariant = color ? getVariantFromColor(color) : variant;
12869
+ const activeState = getTabBarItemActiveState(isActive, disabled);
12870
+ const baseTheme = `kitt.tabBar.${type}.${definedVariant}.${activeState}`;
12576
12871
  return /*#__PURE__*/jsx(Pressable, {
12872
+ disabled: disabled,
12577
12873
  testID: testID,
12578
12874
  onPress: onPress,
12579
- children: /*#__PURE__*/jsxs(HStack, {
12580
- height: 56,
12581
- alignItems: "center",
12582
- position: "relative",
12583
- children: [icon ? /*#__PURE__*/jsx(View, {
12584
- marginRight: "kitt.1",
12585
- children: /*#__PURE__*/jsx(TypographyIcon, {
12586
- color: typographyColor,
12587
- icon: icon
12588
- })
12589
- }) : null, /*#__PURE__*/jsx(Typography.Text, {
12590
- numberOfLines: 1,
12591
- color: typographyColor,
12592
- variant: isActive ? 'bold' : undefined,
12593
- children: name
12594
- }), /*#__PURE__*/jsx(View, {
12595
- borderRadius: 100,
12596
- backgroundColor: indicatorColor,
12597
- position: "absolute",
12598
- bottom: -1 // in order to be over tab bar's border bottom
12599
- ,
12600
- width: "100%",
12601
- height: 4
12602
- })]
12603
- })
12875
+ children: ({
12876
+ isHovered,
12877
+ isPressed,
12878
+ isFocused
12879
+ }) => {
12880
+ const state = getTabBarItemState(isHovered || isHoveredInternal, isPressed || isPressedInternal, isFocused || isFocusedInternal);
12881
+ return /*#__PURE__*/jsxs(HStack, {
12882
+ alignItems: "center",
12883
+ position: "relative",
12884
+ paddingY: "kitt.2",
12885
+ paddingRight: "kitt.2",
12886
+ paddingLeft: icon ? undefined : 'kitt.2',
12887
+ backgroundColor: `${baseTheme}.backgroundColor.${state}`,
12888
+ borderRadius: `${baseTheme}.borderRadius`,
12889
+ children: [icon ? /*#__PURE__*/jsx(View, {
12890
+ marginRight: "kitt.2",
12891
+ children: /*#__PURE__*/jsx(TypographyIcon, {
12892
+ color: `${baseTheme}.color.${state}`,
12893
+ icon: icon
12894
+ })
12895
+ }) : null, /*#__PURE__*/jsx(Typography.Text, {
12896
+ base: "label-large",
12897
+ numberOfLines: 1,
12898
+ color: `${baseTheme}.color.${state}`,
12899
+ children: name
12900
+ }), type !== 'solid' ? /*#__PURE__*/jsx(View, {
12901
+ backgroundColor: `${baseTheme}.indicator.backgroundColor`,
12902
+ position: "absolute",
12903
+ bottom: -1 // in order to be over tab bar's border bottom
12904
+ ,
12905
+ left: 0,
12906
+ right: 0,
12907
+ height: 2
12908
+ }) : null]
12909
+ });
12910
+ }
12604
12911
  });
12605
12912
  }
12606
12913
 
12607
12914
  function TabBar({
12608
12915
  tabs,
12609
- color = 'black',
12916
+ variant = 'default',
12917
+ type = 'underline',
12610
12918
  align = 'left',
12919
+ color,
12611
12920
  activeTabIndex = 0,
12612
12921
  renderTabItem,
12613
- onChangeTab,
12614
- ...props
12922
+ onChangeTab
12615
12923
  }) {
12616
12924
  const sx = useSx();
12617
- const {
12618
- kitt: kittTheme
12619
- } = useKittTheme();
12620
12925
  const tabItems = tabs.map((tab, index) => renderTabItem({
12621
12926
  tab,
12622
12927
  index,
12623
12928
  isActive: activeTabIndex === index
12624
12929
  }));
12625
- const scrollViewStyles = sx({
12930
+ let styles = {
12626
12931
  justifyContent: align,
12627
12932
  paddingRight: align === 'center' ? 'kitt.2' : 'kitt.12',
12628
- minWidth: '100%',
12629
- borderBottomWidth: 1,
12630
- borderBottomColor: kittTheme.palettes.deepPurple['beige.2']
12631
- });
12933
+ minWidth: '100%'
12934
+ };
12935
+
12936
+ // Keep backward compatibility with color property
12937
+ const definedVariant = color ? getVariantFromColor(color) : variant;
12938
+ if (type !== 'solid') {
12939
+ styles = {
12940
+ ...styles,
12941
+ borderBottomWidth: 1,
12942
+ borderBottomColor: `kitt.tabBar.${type}.${definedVariant}.borderBottomColor`
12943
+ };
12944
+ }
12945
+ const scrollViewStyles = sx(styles);
12946
+ const space = type === 'solid' ? 'kitt.2' : 'kitt.4';
12632
12947
  return /*#__PURE__*/jsx(ScrollView, {
12633
12948
  horizontal: true,
12634
12949
  showsHorizontalScrollIndicator: false,
12635
12950
  contentContainerStyle: scrollViewStyles,
12636
12951
  children: /*#__PURE__*/jsx(HStack, {
12637
- space: align === 'center' ? 'kitt.16' : 'kitt.4',
12638
- ...props,
12952
+ space: align === 'center' ? 'kitt.16' : space,
12639
12953
  children: Children.map(tabItems, (child, index) => {
12640
12954
  const tab = tabs[index];
12641
12955
  if (!tab) throw new Error(`TabBar: tab is undefined at index ${index}`);
12642
12956
  return /*#__PURE__*/jsx(View, {
12643
12957
  children: /*#__PURE__*/cloneElement(child, {
12644
12958
  color,
12959
+ variant: definedVariant,
12960
+ type,
12645
12961
  onPress: event => {
12646
12962
  onChangeTab({
12647
12963
  tab,