@kbach/react 0.6.32 → 0.6.33

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.
@@ -9,6 +9,7 @@ import {
9
9
  getDefaultFontFamily,
10
10
  getEffectiveIsWeb,
11
11
  getGlobalScreens,
12
+ getImpliedRNStyle,
12
13
  getInteractiveModifiers,
13
14
  getModeModifiers,
14
15
  getResponsiveModifiers,
@@ -25,7 +26,7 @@ import {
25
26
  transformToWebProps,
26
27
  useConditionalGlobalDarkMode,
27
28
  useConditionalWidth
28
- } from "./chunk-E322MVGC.mjs";
29
+ } from "./chunk-QCBA2JJK.mjs";
29
30
 
30
31
  // src/jsx-runtime.tsx
31
32
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -110,16 +111,9 @@ function mergeStyle(computed, userStyle) {
110
111
  if (!userStyle) return computed;
111
112
  return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
112
113
  }
113
- function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
114
- if (!webTag || !resolvedBase) return userStyle;
115
- const explicitDisplay = resolvedBase.display;
116
- const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
117
- const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
118
- if (!willBeFlex) return userStyle;
119
- const compensation = {};
120
- if (explicitDisplay === void 0) compensation.display = "flex";
121
- if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
122
- if (Object.keys(compensation).length === 0) return userStyle;
114
+ function withImpliedRNStyleIfNeeded(webTag, resolvedBase, userStyle) {
115
+ const compensation = getImpliedRNStyle(webTag, resolvedBase);
116
+ if (!compensation) return userStyle;
123
117
  return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
124
118
  }
125
119
  function makeElement(isStaticChildren, type, props, key) {
@@ -166,7 +160,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
166
160
  }
167
161
  const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : expandedClassStr ? resolve(expandedClassStr, config.theme, config.darkMode) : {};
168
162
  const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
169
- const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
163
+ const userStyle = withImpliedRNStyleIfNeeded(webTag, resolved.base, rawUserStyle);
170
164
  const { interactive, modeOrResponsive } = bucketMods(resolved);
171
165
  if (interactive) {
172
166
  return _jsx(InteractiveWrapper, {
@@ -3522,6 +3522,19 @@ function getWebTag(type, props) {
3522
3522
  _cache.set(obj, tag);
3523
3523
  return tag;
3524
3524
  }
3525
+ function getImpliedRNStyle(webTag, resolvedBase) {
3526
+ if (!webTag || !resolvedBase) return void 0;
3527
+ const compensation = {};
3528
+ if (resolvedBase.position === void 0) compensation.position = "relative";
3529
+ const explicitDisplay = resolvedBase.display;
3530
+ const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
3531
+ const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
3532
+ if (willBeFlex) {
3533
+ if (explicitDisplay === void 0) compensation.display = "flex";
3534
+ if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
3535
+ }
3536
+ return Object.keys(compensation).length > 0 ? compensation : void 0;
3537
+ }
3525
3538
  var _rnOnlyProps = /* @__PURE__ */ new Set([
3526
3539
  // Interaction
3527
3540
  "onLongPress",
@@ -3961,6 +3974,7 @@ export {
3961
3974
  stripWebOnlyProps,
3962
3975
  registerWebElement,
3963
3976
  getWebTag,
3977
+ getImpliedRNStyle,
3964
3978
  transformToWebProps,
3965
3979
  InteractiveWrapper
3966
3980
  };
package/dist/index.js CHANGED
@@ -544,6 +544,19 @@ function getWebTag(type, props) {
544
544
  _cache.set(obj, tag);
545
545
  return tag;
546
546
  }
547
+ function getImpliedRNStyle(webTag, resolvedBase) {
548
+ if (!webTag || !resolvedBase) return void 0;
549
+ const compensation = {};
550
+ if (resolvedBase.position === void 0) compensation.position = "relative";
551
+ const explicitDisplay = resolvedBase.display;
552
+ const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
553
+ const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
554
+ if (willBeFlex) {
555
+ if (explicitDisplay === void 0) compensation.display = "flex";
556
+ if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
557
+ }
558
+ return Object.keys(compensation).length > 0 ? compensation : void 0;
559
+ }
547
560
  var _rnOnlyProps = /* @__PURE__ */ new Set([
548
561
  // Interaction
549
562
  "onLongPress",
@@ -842,8 +855,13 @@ function styled(Component, baseClasses = "") {
842
855
  [resolved, isDark, pressed, hovered, focused, disabled, checked, width]
843
856
  // eslint-disable-line react-hooks/exhaustive-deps
844
857
  );
845
- const finalStyle = isWebPlatform ? (Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp) ?? void 0 : styleProp ? Array.isArray(styleProp) ? [computedStyle, ...styleProp] : [computedStyle, styleProp] : computedStyle;
846
858
  const webTag = isWebPlatform ? getWebTag(Component, rest) : null;
859
+ const finalStyle = isWebPlatform ? (() => {
860
+ const flatStyleProp = (Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp) ?? void 0;
861
+ const compensation = getImpliedRNStyle(webTag, resolved.base);
862
+ if (!compensation) return flatStyleProp;
863
+ return flatStyleProp ? { ...compensation, ...flatStyleProp } : compensation;
864
+ })() : styleProp ? Array.isArray(styleProp) ? [computedStyle, ...styleProp] : [computedStyle, styleProp] : computedStyle;
847
865
  const effectiveComponent = webTag ?? Component;
848
866
  const componentName2 = Component.displayName ?? Component.name ?? "";
849
867
  const effectiveRest = webTag && componentName2 ? transformToWebProps(componentName2, webTag, rest) : rest;
package/dist/index.mjs CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  getActiveBreakpoints,
15
15
  getConfig,
16
16
  getEffectiveIsWeb,
17
+ getImpliedRNStyle,
17
18
  getWebTag,
18
19
  hasInteractiveBuckets,
19
20
  hasResponsiveBuckets,
@@ -43,7 +44,7 @@ import {
43
44
  useGlobalDarkMode,
44
45
  useGlobalWidth,
45
46
  useSyncExternalStore
46
- } from "./chunk-E322MVGC.mjs";
47
+ } from "./chunk-QCBA2JJK.mjs";
47
48
 
48
49
  // src/context.tsx
49
50
  import { createContext, useContext } from "react";
@@ -406,8 +407,13 @@ function styled(Component, baseClasses = "") {
406
407
  [resolved, isDark, pressed, hovered, focused, disabled, checked, width]
407
408
  // eslint-disable-line react-hooks/exhaustive-deps
408
409
  );
409
- const finalStyle = isWebPlatform ? (Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp) ?? void 0 : styleProp ? Array.isArray(styleProp) ? [computedStyle, ...styleProp] : [computedStyle, styleProp] : computedStyle;
410
410
  const webTag = isWebPlatform ? getWebTag(Component, rest) : null;
411
+ const finalStyle = isWebPlatform ? (() => {
412
+ const flatStyleProp = (Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp) ?? void 0;
413
+ const compensation = getImpliedRNStyle(webTag, resolved.base);
414
+ if (!compensation) return flatStyleProp;
415
+ return flatStyleProp ? { ...compensation, ...flatStyleProp } : compensation;
416
+ })() : styleProp ? Array.isArray(styleProp) ? [computedStyle, ...styleProp] : [computedStyle, styleProp] : computedStyle;
411
417
  const effectiveComponent = webTag ?? Component;
412
418
  const componentName2 = Component.displayName ?? Component.name ?? "";
413
419
  const effectiveRest = webTag && componentName2 ? transformToWebProps(componentName2, webTag, rest) : rest;
@@ -338,6 +338,19 @@ function getWebTag(type, props) {
338
338
  _cache.set(obj, tag);
339
339
  return tag;
340
340
  }
341
+ function getImpliedRNStyle(webTag, resolvedBase) {
342
+ if (!webTag || !resolvedBase) return void 0;
343
+ const compensation = {};
344
+ if (resolvedBase.position === void 0) compensation.position = "relative";
345
+ const explicitDisplay = resolvedBase.display;
346
+ const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
347
+ const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
348
+ if (willBeFlex) {
349
+ if (explicitDisplay === void 0) compensation.display = "flex";
350
+ if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
351
+ }
352
+ return Object.keys(compensation).length > 0 ? compensation : void 0;
353
+ }
341
354
  var _rnOnlyProps = /* @__PURE__ */ new Set([
342
355
  // Interaction
343
356
  "onLongPress",
@@ -621,16 +634,9 @@ function mergeStyle(computed, userStyle) {
621
634
  if (!userStyle) return computed;
622
635
  return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
623
636
  }
624
- function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
625
- if (!webTag || !resolvedBase) return userStyle;
626
- const explicitDisplay = resolvedBase.display;
627
- const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
628
- const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
629
- if (!willBeFlex) return userStyle;
630
- const compensation = {};
631
- if (explicitDisplay === void 0) compensation.display = "flex";
632
- if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
633
- if (Object.keys(compensation).length === 0) return userStyle;
637
+ function withImpliedRNStyleIfNeeded(webTag, resolvedBase, userStyle) {
638
+ const compensation = getImpliedRNStyle(webTag, resolvedBase);
639
+ if (!compensation) return userStyle;
634
640
  return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
635
641
  }
636
642
  function makeElement(isStaticChildren, type, props, key) {
@@ -677,7 +683,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
677
683
  }
678
684
  const resolved = !import_core6.isWeb && __kbachStyles != null ? __kbachStyles : expandedClassStr ? (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode) : {};
679
685
  const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
680
- const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
686
+ const userStyle = withImpliedRNStyleIfNeeded(webTag, resolved.base, rawUserStyle);
681
687
  const { interactive, modeOrResponsive } = bucketMods(resolved);
682
688
  if (interactive) {
683
689
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
@@ -3,8 +3,8 @@ import {
3
3
  Fragment,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-JUGDQQQ4.mjs";
7
- import "./chunk-E322MVGC.mjs";
6
+ } from "./chunk-4DFD4WX3.mjs";
7
+ import "./chunk-QCBA2JJK.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, source, self) {
@@ -344,6 +344,19 @@ function getWebTag(type, props) {
344
344
  _cache.set(obj, tag);
345
345
  return tag;
346
346
  }
347
+ function getImpliedRNStyle(webTag, resolvedBase) {
348
+ if (!webTag || !resolvedBase) return void 0;
349
+ const compensation = {};
350
+ if (resolvedBase.position === void 0) compensation.position = "relative";
351
+ const explicitDisplay = resolvedBase.display;
352
+ const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
353
+ const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
354
+ if (willBeFlex) {
355
+ if (explicitDisplay === void 0) compensation.display = "flex";
356
+ if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
357
+ }
358
+ return Object.keys(compensation).length > 0 ? compensation : void 0;
359
+ }
347
360
  var _rnOnlyProps = /* @__PURE__ */ new Set([
348
361
  // Interaction
349
362
  "onLongPress",
@@ -627,16 +640,9 @@ function mergeStyle(computed, userStyle) {
627
640
  if (!userStyle) return computed;
628
641
  return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
629
642
  }
630
- function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
631
- if (!webTag || !resolvedBase) return userStyle;
632
- const explicitDisplay = resolvedBase.display;
633
- const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
634
- const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
635
- if (!willBeFlex) return userStyle;
636
- const compensation = {};
637
- if (explicitDisplay === void 0) compensation.display = "flex";
638
- if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
639
- if (Object.keys(compensation).length === 0) return userStyle;
643
+ function withImpliedRNStyleIfNeeded(webTag, resolvedBase, userStyle) {
644
+ const compensation = getImpliedRNStyle(webTag, resolvedBase);
645
+ if (!compensation) return userStyle;
640
646
  return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
641
647
  }
642
648
  function makeElement(isStaticChildren, type, props, key) {
@@ -683,7 +689,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
683
689
  }
684
690
  const resolved = !import_core6.isWeb && __kbachStyles != null ? __kbachStyles : expandedClassStr ? (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode) : {};
685
691
  const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
686
- const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
692
+ const userStyle = withImpliedRNStyleIfNeeded(webTag, resolved.base, rawUserStyle);
687
693
  const { interactive, modeOrResponsive } = bucketMods(resolved);
688
694
  if (interactive) {
689
695
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
@@ -4,10 +4,10 @@ import {
4
4
  _invalidateDefaultFontCache,
5
5
  jsx,
6
6
  jsxs
7
- } from "./chunk-JUGDQQQ4.mjs";
7
+ } from "./chunk-4DFD4WX3.mjs";
8
8
  import {
9
9
  registerWebElement
10
- } from "./chunk-E322MVGC.mjs";
10
+ } from "./chunk-QCBA2JJK.mjs";
11
11
  export {
12
12
  Fragment,
13
13
  _invalidateDefaultFontCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.32",
3
+ "version": "0.6.33",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "repository": {
6
6
  "type": "git",