@ornikar/kitt-universal 27.5.1-canary.4d3ec9b2bbb3371c254ae88141f81bb445a59f73.0 → 27.5.1-canary.74b3661a3818b6b6b6cd66a9bf11ce3340651bb8.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 (90) hide show
  1. package/AGENTS.md +30 -0
  2. package/CHANGELOG.md +9 -5
  3. package/dist/definitions/TabBar/TabBar.d.ts +6 -4
  4. package/dist/definitions/TabBar/TabBar.d.ts.map +1 -1
  5. package/dist/definitions/TabBar/TabBarItem.d.ts +11 -1
  6. package/dist/definitions/TabBar/TabBarItem.d.ts.map +1 -1
  7. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +180 -12
  8. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  9. package/dist/definitions/themes/default.d.ts +1 -12
  10. package/dist/definitions/themes/default.d.ts.map +1 -1
  11. package/dist/definitions/themes/late-ocean/icon.d.ts +0 -20
  12. package/dist/definitions/themes/late-ocean/icon.d.ts.map +1 -1
  13. package/dist/definitions/themes/late-ocean/tabBar.d.ts +34 -0
  14. package/dist/definitions/themes/late-ocean/tabBar.d.ts.map +1 -0
  15. package/dist/definitions/typography/Typography.d.ts.map +1 -1
  16. package/dist/definitions/typography/TypographyIcon.d.ts.map +1 -1
  17. package/dist/definitions/typography/utils/getTypographyFamily.d.ts +2 -1
  18. package/dist/definitions/typography/utils/getTypographyFamily.d.ts.map +1 -1
  19. package/dist/index-metro.es.android.js +565 -250
  20. package/dist/index-metro.es.android.js.map +1 -1
  21. package/dist/index-metro.es.ios.js +565 -250
  22. package/dist/index-metro.es.ios.js.map +1 -1
  23. package/dist/index-node-22.17.cjs.js +456 -140
  24. package/dist/index-node-22.17.cjs.js.map +1 -1
  25. package/dist/index-node-22.17.cjs.web.js +457 -141
  26. package/dist/index-node-22.17.cjs.web.js.map +1 -1
  27. package/dist/index-node-22.17.es.mjs +456 -140
  28. package/dist/index-node-22.17.es.mjs.map +1 -1
  29. package/dist/index-node-22.17.es.web.mjs +457 -141
  30. package/dist/index-node-22.17.es.web.mjs.map +1 -1
  31. package/dist/index.es.js +567 -242
  32. package/dist/index.es.js.map +1 -1
  33. package/dist/index.es.web.js +566 -241
  34. package/dist/index.es.web.js.map +1 -1
  35. package/dist/linaria-themes-metro.es.android.js +179 -36
  36. package/dist/linaria-themes-metro.es.android.js.map +1 -1
  37. package/dist/linaria-themes-metro.es.ios.js +179 -36
  38. package/dist/linaria-themes-metro.es.ios.js.map +1 -1
  39. package/dist/linaria-themes-node-22.17.cjs.js +179 -36
  40. package/dist/linaria-themes-node-22.17.cjs.js.map +1 -1
  41. package/dist/linaria-themes-node-22.17.cjs.web.js +179 -36
  42. package/dist/linaria-themes-node-22.17.cjs.web.js.map +1 -1
  43. package/dist/linaria-themes-node-22.17.es.mjs +179 -36
  44. package/dist/linaria-themes-node-22.17.es.mjs.map +1 -1
  45. package/dist/linaria-themes-node-22.17.es.web.mjs +179 -36
  46. package/dist/linaria-themes-node-22.17.es.web.mjs.map +1 -1
  47. package/dist/linaria-themes.es.js +179 -36
  48. package/dist/linaria-themes.es.js.map +1 -1
  49. package/dist/linaria-themes.es.web.js +179 -36
  50. package/dist/linaria-themes.es.web.js.map +1 -1
  51. package/dist/tsbuildinfo +1 -1
  52. package/package.json +2 -2
  53. package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.input.tsx +11 -0
  54. package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.output.tsx +17 -0
  55. package/scripts/codemods/__testfixtures__/csf1-csf2/default.input.tsx +88 -0
  56. package/scripts/codemods/__testfixtures__/csf1-csf2/default.output.tsx +94 -0
  57. package/scripts/codemods/__testfixtures__/csf1-csf2/new.input.tsx +77 -0
  58. package/scripts/codemods/__testfixtures__/csf1-csf2/new.output.tsx +92 -0
  59. package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.input.tsx +21 -0
  60. package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.output.tsx +28 -0
  61. package/scripts/codemods/__tests__/csf1-csf2.test.ts +10 -0
  62. package/scripts/codemods/card-modal.js +155 -0
  63. package/scripts/codemods/csf1-csf2.js +323 -0
  64. package/scripts/codemods/fullscreen-modal.js +155 -0
  65. package/scripts/codemods/navigation-modal.js +155 -0
  66. package/scripts/{run-transformers.js → run-codemods.js} +12 -12
  67. package/scripts/transformers/card-modal.js +0 -136
  68. package/scripts/transformers/fullscreen-modal.js +0 -138
  69. package/scripts/transformers/navigation-modal.js +0 -138
  70. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.input.js +0 -0
  71. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/basic.output.js +0 -0
  72. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.input.js +0 -0
  73. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/withExpressions.output.js +0 -0
  74. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.input.js +0 -0
  75. /package/scripts/{transformers → codemods}/__testfixtures__/card-modal/wrongOrder.output.js +0 -0
  76. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.input.js +0 -0
  77. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/basic.output.js +0 -0
  78. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.input.js +0 -0
  79. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/withExpressions.output.js +0 -0
  80. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.input.js +0 -0
  81. /package/scripts/{transformers → codemods}/__testfixtures__/fullscreen-modal/wrongOrder.output.js +0 -0
  82. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.input.js +0 -0
  83. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/basic.output.js +0 -0
  84. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.input.js +0 -0
  85. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/withExpressions.output.js +0 -0
  86. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.input.js +0 -0
  87. /package/scripts/{transformers → codemods}/__testfixtures__/navigation-modal/wrongOrder.output.js +0 -0
  88. /package/scripts/{transformers → codemods}/__tests__/card-modal.test.js +0 -0
  89. /package/scripts/{transformers → codemods}/__tests__/fullscreen-modal.test.js +0 -0
  90. /package/scripts/{transformers → codemods}/__tests__/navigation-modal.test.js +0 -0
@@ -1913,43 +1913,8 @@ const highlight = {
1913
1913
  }
1914
1914
  };
1915
1915
 
1916
- const getIconSizeFromFontSize = fontSize => {
1917
- if (fontSize <= 14) return 16;
1918
- if (fontSize <= 16) return 20;
1919
- return 24;
1920
- };
1921
- const createTypographyIconSizeConfig = (baseAndSmallFontSize, mediumAndWideFontSize) => {
1922
- const baseAndSmallIconSize = getIconSizeFromFontSize(baseAndSmallFontSize);
1923
- const mediumAndWideIconSize = getIconSizeFromFontSize(mediumAndWideFontSize);
1924
- return {
1925
- baseAndSmall: {
1926
- iconSize: baseAndSmallIconSize
1927
- },
1928
- mediumAndWide: {
1929
- iconSize: mediumAndWideIconSize
1930
- }
1931
- };
1932
- };
1933
1916
  const icon = {
1934
- defaultSize: 20,
1935
- // Note: this is based on typography updated sizes, not current https://github.com/ornikar/kitt/pull/2130
1936
- typographySize: {
1937
- // also known as xxlarge
1938
- header1: createTypographyIconSizeConfig(40, 56),
1939
- // also known as xlarge
1940
- header2: createTypographyIconSizeConfig(32, 48),
1941
- // also known as medium
1942
- header3: createTypographyIconSizeConfig(24, 40),
1943
- // also known as xsmall
1944
- header4: createTypographyIconSizeConfig(18, 24),
1945
- // also known as xxsmall
1946
- header5: createTypographyIconSizeConfig(18, 18),
1947
- 'body-large': createTypographyIconSizeConfig(18, 24),
1948
- 'body-medium': createTypographyIconSizeConfig(18, 18),
1949
- body: createTypographyIconSizeConfig(16, 16),
1950
- 'body-small': createTypographyIconSizeConfig(14, 14),
1951
- 'body-xsmall': createTypographyIconSizeConfig(12, 12)
1952
- }
1917
+ defaultSize: 20
1953
1918
  };
1954
1919
 
1955
1920
  const iconButton = {
@@ -2376,6 +2341,183 @@ const skeleton = {
2376
2341
  }
2377
2342
  };
2378
2343
 
2344
+ const tabBar = {
2345
+ underline: {
2346
+ default: {
2347
+ active: {
2348
+ color: {
2349
+ default: deepPurpleColorPalette['deepPurple.8'],
2350
+ focused: deepPurpleColorPalette['deepPurple.8'],
2351
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2352
+ pressed: deepPurpleColorPalette['deepPurple.8']
2353
+ },
2354
+ indicator: {
2355
+ backgroundColor: deepPurpleColorPalette['deepPurple.8']
2356
+ }
2357
+ },
2358
+ inactive: {
2359
+ color: {
2360
+ default: deepPurpleColorPalette['grey.5'],
2361
+ focused: deepPurpleColorPalette['grey.5'],
2362
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2363
+ pressed: deepPurpleColorPalette['deepPurple.8']
2364
+ },
2365
+ indicator: {
2366
+ backgroundColor: undefined
2367
+ }
2368
+ },
2369
+ disabled: {
2370
+ color: {
2371
+ default: deepPurpleColorPalette['grey.3'],
2372
+ focused: deepPurpleColorPalette['grey.3'],
2373
+ hovered: deepPurpleColorPalette['grey.3'],
2374
+ pressed: deepPurpleColorPalette['grey.3']
2375
+ },
2376
+ indicator: {
2377
+ backgroundColor: undefined
2378
+ }
2379
+ },
2380
+ borderBottomColor: deepPurpleColorPalette['beige.3']
2381
+ },
2382
+ revert: {
2383
+ active: {
2384
+ color: {
2385
+ default: deepPurpleColorPalette['grey.0'],
2386
+ focused: deepPurpleColorPalette['grey.0'],
2387
+ hovered: deepPurpleColorPalette['grey.0'],
2388
+ pressed: deepPurpleColorPalette['grey.0']
2389
+ },
2390
+ indicator: {
2391
+ backgroundColor: deepPurpleColorPalette['grey.0']
2392
+ }
2393
+ },
2394
+ inactive: {
2395
+ color: {
2396
+ default: deepPurpleColorPalette['white-alpha.80'],
2397
+ focused: deepPurpleColorPalette['white-alpha.80'],
2398
+ hovered: deepPurpleColorPalette['grey.0'],
2399
+ pressed: deepPurpleColorPalette['grey.0']
2400
+ },
2401
+ indicator: {
2402
+ backgroundColor: undefined
2403
+ }
2404
+ },
2405
+ disabled: {
2406
+ color: {
2407
+ default: deepPurpleColorPalette['white-alpha.20'],
2408
+ focused: deepPurpleColorPalette['white-alpha.20'],
2409
+ hovered: deepPurpleColorPalette['white-alpha.20'],
2410
+ pressed: deepPurpleColorPalette['white-alpha.20']
2411
+ },
2412
+ indicator: {
2413
+ backgroundColor: undefined
2414
+ }
2415
+ },
2416
+ borderBottomColor: deepPurpleColorPalette['white-alpha.20']
2417
+ }
2418
+ },
2419
+ solid: {
2420
+ default: {
2421
+ active: {
2422
+ color: {
2423
+ default: deepPurpleColorPalette['grey.0'],
2424
+ focused: deepPurpleColorPalette['grey.0'],
2425
+ hovered: deepPurpleColorPalette['grey.0'],
2426
+ pressed: deepPurpleColorPalette['grey.0']
2427
+ },
2428
+ backgroundColor: {
2429
+ default: deepPurpleColorPalette['deepPurple.8'],
2430
+ focused: deepPurpleColorPalette['deepPurple.8'],
2431
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2432
+ pressed: deepPurpleColorPalette['deepPurple.8']
2433
+ },
2434
+ borderRadius: 4,
2435
+ indicator: {
2436
+ backgroundColor: undefined
2437
+ }
2438
+ },
2439
+ inactive: {
2440
+ color: {
2441
+ default: deepPurpleColorPalette['grey.5'],
2442
+ focused: deepPurpleColorPalette['grey.5'],
2443
+ hovered: deepPurpleColorPalette['grey.5'],
2444
+ pressed: deepPurpleColorPalette['grey.5']
2445
+ },
2446
+ backgroundColor: {
2447
+ default: undefined,
2448
+ focused: undefined,
2449
+ hovered: deepPurpleColorPalette['beige.1'],
2450
+ pressed: deepPurpleColorPalette['beige.1']
2451
+ },
2452
+ borderRadius: 4,
2453
+ indicator: {
2454
+ backgroundColor: undefined
2455
+ }
2456
+ },
2457
+ disabled: {
2458
+ color: {
2459
+ default: deepPurpleColorPalette['grey.3'],
2460
+ focused: deepPurpleColorPalette['grey.3'],
2461
+ hovered: deepPurpleColorPalette['grey.3'],
2462
+ pressed: deepPurpleColorPalette['grey.3']
2463
+ },
2464
+ indicator: {
2465
+ backgroundColor: undefined
2466
+ }
2467
+ }
2468
+ },
2469
+ revert: {
2470
+ active: {
2471
+ color: {
2472
+ default: deepPurpleColorPalette['deepPurple.8'],
2473
+ focused: deepPurpleColorPalette['deepPurple.8'],
2474
+ hovered: deepPurpleColorPalette['deepPurple.8'],
2475
+ pressed: deepPurpleColorPalette['deepPurple.8']
2476
+ },
2477
+ backgroundColor: {
2478
+ default: deepPurpleColorPalette['grey.0'],
2479
+ focused: deepPurpleColorPalette['grey.0'],
2480
+ hovered: deepPurpleColorPalette['grey.0'],
2481
+ pressed: deepPurpleColorPalette['grey.0']
2482
+ },
2483
+ borderRadius: 4,
2484
+ indicator: {
2485
+ backgroundColor: undefined
2486
+ }
2487
+ },
2488
+ inactive: {
2489
+ color: {
2490
+ default: deepPurpleColorPalette['white-alpha.80'],
2491
+ focused: deepPurpleColorPalette['white-alpha.80'],
2492
+ hovered: deepPurpleColorPalette['white-alpha.80'],
2493
+ pressed: deepPurpleColorPalette['white-alpha.80']
2494
+ },
2495
+ backgroundColor: {
2496
+ default: undefined,
2497
+ focused: undefined,
2498
+ hovered: deepPurpleColorPalette['white-alpha.10'],
2499
+ pressed: deepPurpleColorPalette['white-alpha.10']
2500
+ },
2501
+ borderRadius: 4,
2502
+ indicator: {
2503
+ backgroundColor: undefined
2504
+ }
2505
+ },
2506
+ disabled: {
2507
+ color: {
2508
+ default: deepPurpleColorPalette['white-alpha.20'],
2509
+ focused: deepPurpleColorPalette['white-alpha.20'],
2510
+ hovered: deepPurpleColorPalette['white-alpha.20'],
2511
+ pressed: deepPurpleColorPalette['white-alpha.20']
2512
+ },
2513
+ indicator: {
2514
+ backgroundColor: undefined
2515
+ }
2516
+ }
2517
+ }
2518
+ }
2519
+ };
2520
+
2379
2521
  const tag = {
2380
2522
  borderRadius: 16,
2381
2523
  icon: {
@@ -2515,6 +2657,7 @@ const theme = {
2515
2657
  picker,
2516
2658
  shadows,
2517
2659
  skeleton,
2660
+ tabBar,
2518
2661
  tag,
2519
2662
  tooltip,
2520
2663
  typography,
@@ -2927,6 +3070,13 @@ const getTypographyFamilyWithAncestorValue = (type, typographyFamilyInContext) =
2927
3070
  if (typographyFamilyInContext != null) return typographyFamilyInContext;
2928
3071
  throw new Error('You must set a "base" prop or wrap this Typography in one that does.');
2929
3072
  };
3073
+ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3074
+ // check if all values are not undefined
3075
+ const isAllValuesUndefined = Object.values(type).every(value => value === undefined);
3076
+
3077
+ // if every values are undefined and we hgave a typographyTypeInContext, we use the parent typography type (typographyTypeInContext)
3078
+ return !!isAllValuesUndefined && !!typographyTypeInContext ? typographyTypeInContext : type;
3079
+ };
2930
3080
 
2931
3081
  const TypographyFamilyContext = /*#__PURE__*/React.createContext(null);
2932
3082
  const TypographyTypeContext = /*#__PURE__*/React.createContext(null);
@@ -2934,9 +3084,6 @@ const TypographyColorContext = /*#__PURE__*/React.createContext('black');
2934
3084
  function useTypographyColor() {
2935
3085
  return React.useContext(TypographyColorContext);
2936
3086
  }
2937
- function useTypographyAncestorType() {
2938
- return React.useContext(TypographyTypeContext);
2939
- }
2940
3087
  const TypographyDefaultColorContext = /*#__PURE__*/React.createContext(undefined);
2941
3088
  function useTypographyDefaultColor() {
2942
3089
  return React.useContext(TypographyDefaultColorContext);
@@ -3059,9 +3206,11 @@ function Typography({
3059
3206
  }) {
3060
3207
  const sx = nativeBase.useSx();
3061
3208
  const typographyFamilyInContext = React.useContext(TypographyFamilyContext);
3209
+ const typographyTypeInContext = React.useContext(TypographyTypeContext);
3062
3210
  const defaultColor = useTypographyDefaultColor();
3063
3211
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3064
- const baseOrDefaultToBody = hasTypographyAncestor ? type.base : type.base ?? 'body-m';
3212
+ const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3213
+ const baseOrDefaultToBody = typographyType.base ?? 'body-m';
3065
3214
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3066
3215
  const fontSizeForNativeBase = createNativeBaseFontSize({
3067
3216
  ...type,
@@ -3100,7 +3249,7 @@ function Typography({
3100
3249
  const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(TypographyFamilyContext.Provider, {
3101
3250
  value: typographyFamily,
3102
3251
  children: /*#__PURE__*/jsxRuntime.jsx(TypographyTypeContext.Provider, {
3103
- value: type,
3252
+ value: typographyType,
3104
3253
  children: text
3105
3254
  })
3106
3255
  }) : text;
@@ -3201,30 +3350,11 @@ function Icon({
3201
3350
  });
3202
3351
  }
3203
3352
 
3204
- function getIconSizeConfigKeyFromTypeName(breakpointName) {
3205
- return breakpointName === KittBreakpointNameEnum.BASE || breakpointName === KittBreakpointNameEnum.SMALL ? 'baseAndSmall' : 'mediumAndWide';
3206
- }
3207
- function createNativeBaseIconSize(type) {
3208
- const typeWithMediumForced = {
3209
- ...type,
3210
- medium: type.medium || type.small || type.base
3211
- };
3212
- const iconSizeForNativeBase = {};
3213
- [KittBreakpointNameEnum.BASE, KittBreakpointNameEnum.SMALL, KittBreakpointNameEnum.MEDIUM, KittBreakpointNameEnum.LARGE, KittBreakpointNameEnum.WIDE].forEach(typeName => {
3214
- const value = typeWithMediumForced[typeName];
3215
- if (value) {
3216
- iconSizeForNativeBase[typeName] = `kitt.icon.typographySize.${value}.${getIconSizeConfigKeyFromTypeName(typeName)}.iconSize`;
3217
- }
3218
- });
3219
- return iconSizeForNativeBase;
3220
- }
3221
3353
  function TypographyIconSpecifiedColor({
3222
3354
  color,
3223
3355
  size,
3224
3356
  ...props
3225
3357
  }) {
3226
- const ancestorType = useTypographyAncestorType();
3227
- const iconSize = size || (ancestorType ? createNativeBaseIconSize(ancestorType) : undefined);
3228
3358
  const colorValue = getTypographyColorValue(color);
3229
3359
  const sx = nativeBase.useSx();
3230
3360
  const {
@@ -3234,7 +3364,7 @@ function TypographyIconSpecifiedColor({
3234
3364
  });
3235
3365
  return /*#__PURE__*/jsxRuntime.jsx(Icon, {
3236
3366
  ...props,
3237
- size: iconSize,
3367
+ size: size,
3238
3368
  color: colorStyleValue
3239
3369
  });
3240
3370
  }
@@ -9637,6 +9767,148 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9637
9767
  backgroundColor: theme.picker.web.optionsContainer.backgroundColor
9638
9768
  }
9639
9769
  }
9770
+ },
9771
+ tabBar: {
9772
+ underline: {
9773
+ default: {
9774
+ active: {
9775
+ color: {
9776
+ default: theme.tabBar.underline.default.active.color.default,
9777
+ focused: theme.tabBar.underline.default.active.color.focused,
9778
+ hovered: theme.tabBar.underline.default.active.color.hovered,
9779
+ pressed: theme.tabBar.underline.default.active.color.pressed
9780
+ },
9781
+ indicator: {
9782
+ backgroundColor: theme.tabBar.underline.default.active.indicator.backgroundColor
9783
+ }
9784
+ },
9785
+ inactive: {
9786
+ color: {
9787
+ default: theme.tabBar.underline.default.inactive.color.default,
9788
+ focused: theme.tabBar.underline.default.inactive.color.focused,
9789
+ hovered: theme.tabBar.underline.default.inactive.color.hovered,
9790
+ pressed: theme.tabBar.underline.default.inactive.color.pressed
9791
+ }
9792
+ },
9793
+ disabled: {
9794
+ color: {
9795
+ default: theme.tabBar.underline.default.disabled.color.default,
9796
+ focused: theme.tabBar.underline.default.disabled.color.focused,
9797
+ hovered: theme.tabBar.underline.default.disabled.color.hovered,
9798
+ pressed: theme.tabBar.underline.default.disabled.color.pressed
9799
+ }
9800
+ },
9801
+ borderBottomColor: theme.tabBar.underline.default.borderBottomColor
9802
+ },
9803
+ revert: {
9804
+ active: {
9805
+ color: {
9806
+ default: theme.tabBar.underline.revert.active.color.default,
9807
+ focused: theme.tabBar.underline.revert.active.color.focused,
9808
+ hovered: theme.tabBar.underline.revert.active.color.hovered,
9809
+ pressed: theme.tabBar.underline.revert.active.color.pressed
9810
+ },
9811
+ indicator: {
9812
+ backgroundColor: theme.tabBar.underline.revert.active.indicator.backgroundColor
9813
+ }
9814
+ },
9815
+ inactive: {
9816
+ color: {
9817
+ default: theme.tabBar.underline.revert.inactive.color.default,
9818
+ focused: theme.tabBar.underline.revert.inactive.color.focused,
9819
+ hovered: theme.tabBar.underline.revert.inactive.color.hovered,
9820
+ pressed: theme.tabBar.underline.revert.inactive.color.pressed
9821
+ }
9822
+ },
9823
+ disabled: {
9824
+ color: {
9825
+ default: theme.tabBar.underline.revert.disabled.color.default,
9826
+ focused: theme.tabBar.underline.revert.disabled.color.focused,
9827
+ hovered: theme.tabBar.underline.revert.disabled.color.hovered,
9828
+ pressed: theme.tabBar.underline.revert.disabled.color.pressed
9829
+ }
9830
+ },
9831
+ borderBottomColor: theme.tabBar.underline.revert.borderBottomColor
9832
+ }
9833
+ },
9834
+ solid: {
9835
+ default: {
9836
+ active: {
9837
+ color: {
9838
+ default: theme.tabBar.solid.default.active.color.default,
9839
+ focused: theme.tabBar.solid.default.active.color.focused,
9840
+ hovered: theme.tabBar.solid.default.active.color.hovered,
9841
+ pressed: theme.tabBar.solid.default.active.color.pressed
9842
+ },
9843
+ backgroundColor: {
9844
+ default: theme.tabBar.solid.default.active.backgroundColor?.default,
9845
+ focused: theme.tabBar.solid.default.active.backgroundColor?.focused,
9846
+ hovered: theme.tabBar.solid.default.active.backgroundColor?.hovered,
9847
+ pressed: theme.tabBar.solid.default.active.backgroundColor?.pressed
9848
+ }
9849
+ },
9850
+ inactive: {
9851
+ color: {
9852
+ default: theme.tabBar.solid.default.inactive.color.default,
9853
+ focused: theme.tabBar.solid.default.inactive.color.focused,
9854
+ hovered: theme.tabBar.solid.default.inactive.color.hovered,
9855
+ pressed: theme.tabBar.solid.default.inactive.color.pressed
9856
+ },
9857
+ backgroundColor: {
9858
+ default: theme.tabBar.solid.default.inactive.backgroundColor?.default,
9859
+ focused: theme.tabBar.solid.default.inactive.backgroundColor?.focused,
9860
+ hovered: theme.tabBar.solid.default.inactive.backgroundColor?.hovered,
9861
+ pressed: theme.tabBar.solid.default.inactive.backgroundColor?.pressed
9862
+ }
9863
+ },
9864
+ disabled: {
9865
+ color: {
9866
+ default: theme.tabBar.solid.default.disabled.color.default,
9867
+ focused: theme.tabBar.solid.default.disabled.color.focused,
9868
+ hovered: theme.tabBar.solid.default.disabled.color.hovered,
9869
+ pressed: theme.tabBar.solid.default.disabled.color.pressed
9870
+ }
9871
+ }
9872
+ },
9873
+ revert: {
9874
+ active: {
9875
+ color: {
9876
+ default: theme.tabBar.solid.revert.active.color.default,
9877
+ focused: theme.tabBar.solid.revert.active.color.focused,
9878
+ hovered: theme.tabBar.solid.revert.active.color.hovered,
9879
+ pressed: theme.tabBar.solid.revert.active.color.pressed
9880
+ },
9881
+ backgroundColor: {
9882
+ default: theme.tabBar.solid.revert.active.backgroundColor?.default,
9883
+ focused: theme.tabBar.solid.revert.active.backgroundColor?.focused,
9884
+ hovered: theme.tabBar.solid.revert.active.backgroundColor?.hovered,
9885
+ pressed: theme.tabBar.solid.revert.active.backgroundColor?.pressed
9886
+ }
9887
+ },
9888
+ inactive: {
9889
+ color: {
9890
+ default: theme.tabBar.solid.revert.inactive.color.default,
9891
+ focused: theme.tabBar.solid.revert.inactive.color.focused,
9892
+ hovered: theme.tabBar.solid.revert.inactive.color.hovered,
9893
+ pressed: theme.tabBar.solid.revert.inactive.color.pressed
9894
+ },
9895
+ backgroundColor: {
9896
+ default: theme.tabBar.solid.revert.inactive.backgroundColor?.default,
9897
+ focused: theme.tabBar.solid.revert.inactive.backgroundColor?.focused,
9898
+ hovered: theme.tabBar.solid.revert.inactive.backgroundColor?.hovered,
9899
+ pressed: theme.tabBar.solid.revert.inactive.backgroundColor?.pressed
9900
+ }
9901
+ },
9902
+ disabled: {
9903
+ color: {
9904
+ default: theme.tabBar.solid.revert.disabled.color.default,
9905
+ focused: theme.tabBar.solid.revert.disabled.color.focused,
9906
+ hovered: theme.tabBar.solid.revert.disabled.color.hovered,
9907
+ pressed: theme.tabBar.solid.revert.disabled.color.pressed
9908
+ }
9909
+ }
9910
+ }
9911
+ }
9640
9912
  }
9641
9913
  },
9642
9914
  app: appTheme?.colors
@@ -9713,6 +9985,44 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
9713
9985
  highlight: {
9714
9986
  borderRadius: theme.highlight.borderRadius
9715
9987
  },
9988
+ tabBar: {
9989
+ underline: {
9990
+ default: {
9991
+ active: {
9992
+ borderRadius: theme.tabBar.underline.default.active.borderRadius
9993
+ },
9994
+ inactive: {
9995
+ borderRadius: theme.tabBar.underline.default.inactive.borderRadius
9996
+ }
9997
+ },
9998
+ revert: {
9999
+ active: {
10000
+ borderRadius: theme.tabBar.underline.revert.active.borderRadius
10001
+ },
10002
+ inactive: {
10003
+ borderRadius: theme.tabBar.underline.revert.inactive.borderRadius
10004
+ }
10005
+ }
10006
+ },
10007
+ solid: {
10008
+ default: {
10009
+ active: {
10010
+ borderRadius: theme.tabBar.solid.default.active.borderRadius
10011
+ },
10012
+ inactive: {
10013
+ borderRadius: theme.tabBar.solid.default.inactive.borderRadius
10014
+ }
10015
+ },
10016
+ revert: {
10017
+ active: {
10018
+ borderRadius: theme.tabBar.solid.revert.active.borderRadius
10019
+ },
10020
+ inactive: {
10021
+ borderRadius: theme.tabBar.solid.revert.inactive.borderRadius
10022
+ }
10023
+ }
10024
+ }
10025
+ },
9716
10026
  tag: {
9717
10027
  borderRadius: theme.tag.borderRadius
9718
10028
  },
@@ -12548,123 +12858,129 @@ const StoryGrid = {
12548
12858
  Col: StoryGridCol
12549
12859
  };
12550
12860
 
12551
- function useTabBarItemColor(color, isActive) {
12552
- const {
12553
- kitt: kittTheme
12554
- } = useKittTheme();
12555
- switch (color) {
12556
- case 'black':
12557
- {
12558
- return isActive ? kittTheme.colors.primary : kittTheme.colors.blackLight;
12559
- }
12560
- case 'white':
12561
- {
12562
- return isActive ? kittTheme.palettes.deepPurple.white : kittTheme.palettes.deepPurple['white-alpha.80'];
12563
- }
12564
- default:
12565
- {
12566
- return isActive ? kittTheme.colors.primary : kittTheme.colors.blackLight;
12567
- }
12568
- }
12569
- }
12570
- function useTabBarIndicatorColor(color, isActive) {
12571
- const {
12572
- kitt: kittTheme
12573
- } = useKittTheme();
12574
- switch (color) {
12575
- case 'black':
12576
- {
12577
- return isActive ? kittTheme.colors.primary : kittTheme.palettes.deepPurple.transparent;
12578
- }
12579
- case 'white':
12580
- {
12581
- return isActive ? kittTheme.palettes.deepPurple.white : kittTheme.palettes.deepPurple.transparent;
12582
- }
12583
- default:
12584
- {
12585
- return isActive ? kittTheme.colors.primary : kittTheme.palettes.deepPurple.transparent;
12586
- }
12587
- }
12588
- }
12861
+ const getVariantFromColor = color => {
12862
+ if (color === 'white') return 'revert';
12863
+ return 'default';
12864
+ };
12865
+ const getTabBarItemActiveState = (isActive, disabled) => {
12866
+ if (disabled) return 'disabled';
12867
+ if (isActive) return 'active';
12868
+ return 'inactive';
12869
+ };
12870
+ const getTabBarItemState = (isHovered, isPressed, isFocused) => {
12871
+ if (isHovered) return 'hovered';
12872
+ if (isPressed) return 'pressed';
12873
+ if (isFocused) return 'focused';
12874
+ return 'default';
12875
+ };
12589
12876
  function TabBarItem({
12590
12877
  name,
12591
12878
  icon,
12592
- color = 'black',
12879
+ variant = 'default',
12880
+ type = 'underline',
12881
+ color,
12593
12882
  testID,
12883
+ disabled,
12594
12884
  isActive = false,
12885
+ isFocusedInternal = false,
12886
+ isHoveredInternal = false,
12887
+ isPressedInternal = false,
12595
12888
  onPress
12596
12889
  }) {
12597
- const typographyColor = useTabBarItemColor(color, isActive);
12598
- const indicatorColor = useTabBarIndicatorColor(color, isActive);
12890
+ // Keep backward compatibility with color property
12891
+ const definedVariant = color ? getVariantFromColor(color) : variant;
12892
+ const activeState = getTabBarItemActiveState(isActive, disabled);
12893
+ const baseTheme = `kitt.tabBar.${type}.${definedVariant}.${activeState}`;
12599
12894
  return /*#__PURE__*/jsxRuntime.jsx(Pressable, {
12895
+ disabled: disabled,
12600
12896
  testID: testID,
12601
12897
  onPress: onPress,
12602
- children: /*#__PURE__*/jsxRuntime.jsxs(HStack, {
12603
- height: 56,
12604
- alignItems: "center",
12605
- position: "relative",
12606
- children: [icon ? /*#__PURE__*/jsxRuntime.jsx(View, {
12607
- marginRight: "kitt.1",
12608
- children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
12609
- color: typographyColor,
12610
- icon: icon
12611
- })
12612
- }) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
12613
- numberOfLines: 1,
12614
- color: typographyColor,
12615
- variant: isActive ? 'bold' : undefined,
12616
- children: name
12617
- }), /*#__PURE__*/jsxRuntime.jsx(View, {
12618
- borderRadius: 100,
12619
- backgroundColor: indicatorColor,
12620
- position: "absolute",
12621
- bottom: -1 // in order to be over tab bar's border bottom
12622
- ,
12623
- width: "100%",
12624
- height: 4
12625
- })]
12626
- })
12898
+ children: ({
12899
+ isHovered,
12900
+ isPressed,
12901
+ isFocused
12902
+ }) => {
12903
+ const state = getTabBarItemState(isHovered || isHoveredInternal, isPressed || isPressedInternal, isFocused || isFocusedInternal);
12904
+ return /*#__PURE__*/jsxRuntime.jsxs(HStack, {
12905
+ alignItems: "center",
12906
+ position: "relative",
12907
+ paddingY: "kitt.2",
12908
+ paddingRight: "kitt.2",
12909
+ paddingLeft: icon ? undefined : 'kitt.2',
12910
+ backgroundColor: `${baseTheme}.backgroundColor.${state}`,
12911
+ borderRadius: `${baseTheme}.borderRadius`,
12912
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx(View, {
12913
+ marginRight: "kitt.2",
12914
+ children: /*#__PURE__*/jsxRuntime.jsx(TypographyIcon, {
12915
+ color: `${baseTheme}.color.${state}`,
12916
+ icon: icon
12917
+ })
12918
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
12919
+ base: "label-large",
12920
+ numberOfLines: 1,
12921
+ color: `${baseTheme}.color.${state}`,
12922
+ children: name
12923
+ }), type !== 'solid' ? /*#__PURE__*/jsxRuntime.jsx(View, {
12924
+ backgroundColor: `${baseTheme}.indicator.backgroundColor`,
12925
+ position: "absolute",
12926
+ bottom: -1 // in order to be over tab bar's border bottom
12927
+ ,
12928
+ left: 0,
12929
+ right: 0,
12930
+ height: 2
12931
+ }) : null]
12932
+ });
12933
+ }
12627
12934
  });
12628
12935
  }
12629
12936
 
12630
12937
  function TabBar({
12631
12938
  tabs,
12632
- color = 'black',
12939
+ variant = 'default',
12940
+ type = 'underline',
12633
12941
  align = 'left',
12942
+ color,
12634
12943
  activeTabIndex = 0,
12635
12944
  renderTabItem,
12636
- onChangeTab,
12637
- ...props
12945
+ onChangeTab
12638
12946
  }) {
12639
12947
  const sx = nativeBase.useSx();
12640
- const {
12641
- kitt: kittTheme
12642
- } = useKittTheme();
12643
12948
  const tabItems = tabs.map((tab, index) => renderTabItem({
12644
12949
  tab,
12645
12950
  index,
12646
12951
  isActive: activeTabIndex === index
12647
12952
  }));
12648
- const scrollViewStyles = sx({
12953
+ let styles = {
12649
12954
  justifyContent: align,
12650
12955
  paddingRight: align === 'center' ? 'kitt.2' : 'kitt.12',
12651
- minWidth: '100%',
12652
- borderBottomWidth: 1,
12653
- borderBottomColor: kittTheme.palettes.deepPurple['beige.2']
12654
- });
12956
+ minWidth: '100%'
12957
+ };
12958
+
12959
+ // Keep backward compatibility with color property
12960
+ const definedVariant = color ? getVariantFromColor(color) : variant;
12961
+ if (type !== 'solid') {
12962
+ styles = {
12963
+ ...styles,
12964
+ borderBottomWidth: 1,
12965
+ borderBottomColor: `kitt.tabBar.${type}.${definedVariant}.borderBottomColor`
12966
+ };
12967
+ }
12968
+ const scrollViewStyles = sx(styles);
12969
+ const space = type === 'solid' ? 'kitt.2' : 'kitt.4';
12655
12970
  return /*#__PURE__*/jsxRuntime.jsx(ScrollView, {
12656
12971
  horizontal: true,
12657
12972
  showsHorizontalScrollIndicator: false,
12658
12973
  contentContainerStyle: scrollViewStyles,
12659
12974
  children: /*#__PURE__*/jsxRuntime.jsx(HStack, {
12660
- space: align === 'center' ? 'kitt.16' : 'kitt.4',
12661
- ...props,
12975
+ space: align === 'center' ? 'kitt.16' : space,
12662
12976
  children: React.Children.map(tabItems, (child, index) => {
12663
12977
  const tab = tabs[index];
12664
12978
  if (!tab) throw new Error(`TabBar: tab is undefined at index ${index}`);
12665
12979
  return /*#__PURE__*/jsxRuntime.jsx(View, {
12666
12980
  children: /*#__PURE__*/React.cloneElement(child, {
12667
12981
  color,
12982
+ variant: definedVariant,
12983
+ type,
12668
12984
  onPress: event => {
12669
12985
  onChangeTab({
12670
12986
  tab,