@ornikar/kitt-universal 3.3.0 → 3.4.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.
@@ -1,2 +1,2 @@
1
- @media (hover:none) and (pointer:coarse){.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-0));-ms-transform:scale(var(--p1nlccvg-0));transform:scale(var(--p1nlccvg-0));}}@media (var(--p1nlccvg-1)){.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-2));-ms-transform:scale(var(--p1nlccvg-2));transform:scale(var(--p1nlccvg-2));}}.p1nlccvg > *:active,.kitt-active .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-3));-ms-transform:scale(var(--p1nlccvg-3));transform:scale(var(--p1nlccvg-3));}.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *,.p1nlccvg > *:focus,.kitt-focus .p1nlccvg > *,.p1nlccvg > *:active,.kitt-active .p1nlccvg > *{background-color:var(--p1nlccvg-4);}.p1nlccvg[data-color-white=true] > *:hover,.kitt-hover .p1nlccvg[data-color-white] > *,.p1nlccvg[data-color-white=true] > *:focus,.kitt-focus .p1nlccvg[data-color-white=true] > *,.p1nlccvg[data-color-white=true] > *:active,.kitt-active .p1nlccvg[data-color-white=true] > *{background-color:var(--p1nlccvg-5);}
2
- .tcwz3nt > *:hover,.tcwz3nt > *:active,.kitt-hover .tcwz3nt > *{-webkit-text-decoration:none;text-decoration:none;}.tcwz3nt[data-nounderline] > *:hover,.tcwz3nt[data-nounderline] > *:active,.kitt-hover .tcwz3nt[data-nounderline] > *{-webkit-text-decoration:underline;text-decoration:underline;}
1
+ @media (hover:none) and (pointer:coarse){.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-0));-ms-transform:scale(var(--p1nlccvg-0));transform:scale(var(--p1nlccvg-0));}}@media (var(--p1nlccvg-1)){.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-2));-ms-transform:scale(var(--p1nlccvg-2));transform:scale(var(--p1nlccvg-2));}}.p1nlccvg > *:active,.kitt-active .p1nlccvg > *{-webkit-transform:scale(var(--p1nlccvg-3));-ms-transform:scale(var(--p1nlccvg-3));transform:scale(var(--p1nlccvg-3));}.p1nlccvg,.p1nlccvg > [data-focusvisible-polyfill]{outline:none;}.p1nlccvg > *:hover,.kitt-hover .p1nlccvg > *,.p1nlccvg > *:focus,.kitt-focus .p1nlccvg > *,.p1nlccvg > [data-focusvisible-polyfill],.p1nlccvg > *:active,.kitt-active .p1nlccvg > *{background-color:var(--p1nlccvg-4);}
2
+ .tcwz3nt > *:hover,.tcwz3nt > *:active,.kitt-hover .tcwz3nt > *{-webkit-text-decoration:none;text-decoration:none;}.tcwz3nt > *:hover,.tcwz3nt > *:active,.kitt-hover .tcwz3nt > *{-webkit-text-decoration:var(--tcwz3nt-0);text-decoration:var(--tcwz3nt-0);}
@@ -204,6 +204,20 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
204
204
  if (small && width >= KittBreakpoints.SMALL) return small;
205
205
  return base;
206
206
  }
207
+ function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
208
+ base,
209
+ color
210
+ }) {
211
+ // return the props set or undefined. In case of undefined, the value will be inherited from its parents.
212
+ if (hasTypographyAncestor) return {
213
+ base,
214
+ color
215
+ };
216
+ return {
217
+ base: base ?? 'body',
218
+ color: color ?? 'black'
219
+ };
220
+ }
207
221
  function Typography({
208
222
  accessibilityRole,
209
223
  base,
@@ -215,16 +229,21 @@ function Typography({
215
229
  ...otherProps
216
230
  }) {
217
231
  const isHeaderTypographyInContext = react.useContext(IsHeaderTypographyContext);
218
- const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(base, small, medium, large);
232
+ const hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
233
+ const {
234
+ base: baseOrDefaultToBody,
235
+ color: colorOrDefaultToBlack
236
+ } = getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
237
+ base,
238
+ color
239
+ });
240
+ const typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
219
241
  const isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
220
- const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular'); // if isHeaderTypographyInContext exists, it means we are inside another typography so we don't want to
221
- // redefine the color, just inherit from it
222
-
223
- const colorWithDefaultToBlack = color ?? (isHeaderTypographyInContext !== undefined ? undefined : 'black');
224
- const content = base ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
242
+ const nonNullableVariant = variant ?? (isHeader ? 'bold' : 'regular');
243
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(IsHeaderTypographyContext.Provider, {
225
244
  value: isHeader,
226
245
  children: /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
227
- $color: colorWithDefaultToBlack,
246
+ $color: colorOrDefaultToBlack,
228
247
  $isHeader: isHeader,
229
248
  $typeForCurrentWindowSize: typeForCurrentWindowSize,
230
249
  $variant: nonNullableVariant,
@@ -232,7 +251,7 @@ function Typography({
232
251
  ...otherProps
233
252
  })
234
253
  }) : /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
235
- $color: colorWithDefaultToBlack,
254
+ $color: colorOrDefaultToBlack,
236
255
  $isHeader: isHeader,
237
256
  $variant: nonNullableVariant,
238
257
  accessibilityRole: accessibilityRole || undefined,
@@ -1390,11 +1409,16 @@ const PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/react$1.styled("di
1390
1409
  theme
1391
1410
  }) => theme.kitt.iconButton.scale.base.active],
1392
1411
  "p1nlccvg-4": [({
1393
- theme
1394
- }) => theme.kitt.iconButton.default.pressedBackgroundColor],
1395
- "p1nlccvg-5": [({
1396
- theme
1397
- }) => theme.kitt.iconButton.white.pressedBackgroundColor]
1412
+ theme,
1413
+ $isWhite
1414
+ }) => {
1415
+ const {
1416
+ white,
1417
+ default: defaultIconButton
1418
+ } = theme.kitt.iconButton;
1419
+ if ($isWhite) return white.pressedBackgroundColor;
1420
+ return defaultIconButton.pressedBackgroundColor;
1421
+ }]
1398
1422
  }
1399
1423
  }));
1400
1424
  const StyledPressableIconButton = /*#__PURE__*/styled__default.Pressable.withConfig({
@@ -1438,7 +1462,7 @@ function PressableIconButton({
1438
1462
  }) {
1439
1463
  return /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
1440
1464
  as: PressableIconButtonWebWrapper,
1441
- "data-color-white": color === 'white' ? true : undefined,
1465
+ $isWhite: color === 'white',
1442
1466
  children: /*#__PURE__*/jsxRuntime.jsx(StyledPressableIconButton, { ...props
1443
1467
  })
1444
1468
  });
@@ -3249,14 +3273,19 @@ function TypographyEmoji({
3249
3273
 
3250
3274
  const TypographyLinkWebWrapper = withTheme( /*#__PURE__*/react$1.styled("span")({
3251
3275
  name: "TypographyLinkWebWrapper",
3252
- class: "tcwz3nt"
3276
+ class: "tcwz3nt",
3277
+ vars: {
3278
+ "tcwz3nt-0": [({
3279
+ $hasNoUnderline
3280
+ }) => $hasNoUnderline ? 'underline' : 'none']
3281
+ }
3253
3282
  }));
3254
3283
  const StyledLink = /*#__PURE__*/styled__default.Text.withConfig({
3255
3284
  displayName: "TypographyLink__StyledLink",
3256
3285
  componentId: "kitt-universal__sc-1o1zy30-0"
3257
3286
  })(["text-decoration:", ";", ";", ";"], ({
3258
- $noUnderline
3259
- }) => $noUnderline ? 'none' : 'underline', ({
3287
+ $hasNoUnderline
3288
+ }) => $hasNoUnderline ? 'none' : 'underline', ({
3260
3289
  $disabled
3261
3290
  }) => {
3262
3291
  if (reactNative.Platform.OS !== 'web') return undefined;
@@ -3285,10 +3314,10 @@ function TypographyLink({
3285
3314
  accessibilityRole: "none",
3286
3315
  children: /*#__PURE__*/jsxRuntime.jsx(StyleWebWrapper, {
3287
3316
  as: TypographyLinkWebWrapper,
3288
- "data-nounderline": noUnderline ? true : undefined,
3317
+ $hasNoUnderline: noUnderline,
3289
3318
  children: /*#__PURE__*/jsxRuntime.jsx(StyledLink, {
3290
3319
  $disabled: disabled,
3291
- $noUnderline: noUnderline,
3320
+ $hasNoUnderline: noUnderline,
3292
3321
  href: href,
3293
3322
  hrefAttrs: hrefAttrs,
3294
3323
  accessibilityRole: "link",