@kbach/react 0.3.12 → 0.3.14

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.
@@ -8,7 +8,7 @@ import {
8
8
  resolve,
9
9
  useConditionalWidth,
10
10
  useGlobalDarkMode
11
- } from "./chunk-UGBTZ7VN.mjs";
11
+ } from "./chunk-WPJY7X5I.mjs";
12
12
 
13
13
  // src/jsx-runtime.tsx
14
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
@@ -32,12 +32,24 @@ var DarkWrapper = React.forwardRef(
32
32
  const width = useConditionalWidth(needsWidth);
33
33
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
34
34
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
35
+ if (isWeb) stripWebGridProps(computedStyle);
35
36
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
36
37
  const props = { ref, ...rest, style: finalStyle };
37
38
  return Array.isArray(children) ? React.createElement(Component, props, ...children) : React.createElement(Component, props, children);
38
39
  }
39
40
  );
40
41
  DarkWrapper.displayName = "Kbach.DarkWrapper";
42
+ function stripWebGridProps(s) {
43
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
44
+ delete s.gridTemplateColumns;
45
+ delete s.gridTemplateRows;
46
+ delete s.gridColumn;
47
+ delete s.gridRow;
48
+ delete s.gridArea;
49
+ delete s.gridAutoFlow;
50
+ delete s.gridAutoColumns;
51
+ delete s.gridAutoRows;
52
+ }
41
53
 
42
54
  // src/jsx-runtime.tsx
43
55
  var INTERACTIVE_MODS = /* @__PURE__ */ new Set([
@@ -137,6 +149,17 @@ function processElement(type, rawProps, key, isStaticChildren) {
137
149
  }, key);
138
150
  }
139
151
  const computedStyle = flatten(resolved, false);
152
+ if (isWeb) {
153
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
154
+ delete computedStyle.gridTemplateColumns;
155
+ delete computedStyle.gridTemplateRows;
156
+ delete computedStyle.gridColumn;
157
+ delete computedStyle.gridRow;
158
+ delete computedStyle.gridArea;
159
+ delete computedStyle.gridAutoFlow;
160
+ delete computedStyle.gridAutoColumns;
161
+ delete computedStyle.gridAutoRows;
162
+ }
140
163
  const finalStyle = mergeStyle(computedStyle, userStyle);
141
164
  return makeElement(isStaticChildren, type, {
142
165
  ...passProps,
@@ -2024,7 +2024,8 @@ function styleValueToCSS(styles) {
2024
2024
  } else {
2025
2025
  cssVal = String(val);
2026
2026
  }
2027
- return `${cssProp}: ${cssVal}`;
2027
+ const important = prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") ? " !important" : "";
2028
+ return `${cssProp}: ${cssVal}${important}`;
2028
2029
  }).join("; ");
2029
2030
  }
2030
2031
  function camelToKebab(str) {
@@ -2413,7 +2414,21 @@ var InteractiveWrapper = forwardRef(
2413
2414
  const handleFocus = useCallback(chain(onFocus, () => setFocused(true)), [onFocus]);
2414
2415
  const handleBlur = useCallback(chain(onBlur, () => setFocused(false)), [onBlur]);
2415
2416
  const computedStyle = useMemo(
2416
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2417
+ () => {
2418
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2419
+ if (isWeb) {
2420
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2421
+ delete s.gridTemplateColumns;
2422
+ delete s.gridTemplateRows;
2423
+ delete s.gridColumn;
2424
+ delete s.gridRow;
2425
+ delete s.gridArea;
2426
+ delete s.gridAutoFlow;
2427
+ delete s.gridAutoColumns;
2428
+ delete s.gridAutoRows;
2429
+ }
2430
+ return s;
2431
+ },
2417
2432
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2418
2433
  // eslint-disable-line react-hooks/exhaustive-deps
2419
2434
  );
package/dist/index.js CHANGED
@@ -2154,7 +2154,8 @@ function styleValueToCSS(styles) {
2154
2154
  } else {
2155
2155
  cssVal = String(val);
2156
2156
  }
2157
- return `${cssProp}: ${cssVal}`;
2157
+ const important = prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") ? " !important" : "";
2158
+ return `${cssProp}: ${cssVal}${important}`;
2158
2159
  }).join("; ");
2159
2160
  }
2160
2161
  function camelToKebab(str) {
@@ -2917,7 +2918,21 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
2917
2918
  const handleFocus = (0, import_react9.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2918
2919
  const handleBlur = (0, import_react9.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2919
2920
  const computedStyle = (0, import_react9.useMemo)(
2920
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2921
+ () => {
2922
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2923
+ if (isWeb) {
2924
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2925
+ delete s.gridTemplateColumns;
2926
+ delete s.gridTemplateRows;
2927
+ delete s.gridColumn;
2928
+ delete s.gridRow;
2929
+ delete s.gridArea;
2930
+ delete s.gridAutoFlow;
2931
+ delete s.gridAutoColumns;
2932
+ delete s.gridAutoRows;
2933
+ }
2934
+ return s;
2935
+ },
2921
2936
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2922
2937
  // eslint-disable-line react-hooks/exhaustive-deps
2923
2938
  );
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  updateConfig,
22
22
  useGlobalDarkMode,
23
23
  useGlobalWidth
24
- } from "./chunk-UGBTZ7VN.mjs";
24
+ } from "./chunk-WPJY7X5I.mjs";
25
25
 
26
26
  // src/context.tsx
27
27
  import { createContext, useContext } from "react";
@@ -2045,7 +2045,8 @@ function styleValueToCSS(styles) {
2045
2045
  } else {
2046
2046
  cssVal = String(val);
2047
2047
  }
2048
- return `${cssProp}: ${cssVal}`;
2048
+ const important = prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") ? " !important" : "";
2049
+ return `${cssProp}: ${cssVal}${important}`;
2049
2050
  }).join("; ");
2050
2051
  }
2051
2052
  function camelToKebab(str) {
@@ -2396,7 +2397,21 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2396
2397
  const handleFocus = (0, import_react3.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2397
2398
  const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2398
2399
  const computedStyle = (0, import_react3.useMemo)(
2399
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2400
+ () => {
2401
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2402
+ if (isWeb) {
2403
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2404
+ delete s.gridTemplateColumns;
2405
+ delete s.gridTemplateRows;
2406
+ delete s.gridColumn;
2407
+ delete s.gridRow;
2408
+ delete s.gridArea;
2409
+ delete s.gridAutoFlow;
2410
+ delete s.gridAutoColumns;
2411
+ delete s.gridAutoRows;
2412
+ }
2413
+ return s;
2414
+ },
2400
2415
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2401
2416
  // eslint-disable-line react-hooks/exhaustive-deps
2402
2417
  );
@@ -2438,12 +2453,24 @@ var DarkWrapper = import_react4.default.forwardRef(
2438
2453
  const width = useConditionalWidth(needsWidth);
2439
2454
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2440
2455
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2456
+ if (isWeb) stripWebGridProps(computedStyle);
2441
2457
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2442
2458
  const props = { ref, ...rest, style: finalStyle };
2443
2459
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
2444
2460
  }
2445
2461
  );
2446
2462
  DarkWrapper.displayName = "Kbach.DarkWrapper";
2463
+ function stripWebGridProps(s) {
2464
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2465
+ delete s.gridTemplateColumns;
2466
+ delete s.gridTemplateRows;
2467
+ delete s.gridColumn;
2468
+ delete s.gridRow;
2469
+ delete s.gridArea;
2470
+ delete s.gridAutoFlow;
2471
+ delete s.gridAutoColumns;
2472
+ delete s.gridAutoRows;
2473
+ }
2447
2474
 
2448
2475
  // src/jsx-runtime.tsx
2449
2476
  var INTERACTIVE_MODS = /* @__PURE__ */ new Set([
@@ -2543,6 +2570,17 @@ function processElement(type, rawProps, key, isStaticChildren) {
2543
2570
  }, key);
2544
2571
  }
2545
2572
  const computedStyle = flatten(resolved, false);
2573
+ if (isWeb) {
2574
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2575
+ delete computedStyle.gridTemplateColumns;
2576
+ delete computedStyle.gridTemplateRows;
2577
+ delete computedStyle.gridColumn;
2578
+ delete computedStyle.gridRow;
2579
+ delete computedStyle.gridArea;
2580
+ delete computedStyle.gridAutoFlow;
2581
+ delete computedStyle.gridAutoColumns;
2582
+ delete computedStyle.gridAutoRows;
2583
+ }
2546
2584
  const finalStyle = mergeStyle(computedStyle, userStyle);
2547
2585
  return makeElement(isStaticChildren, type, {
2548
2586
  ...passProps,
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-BAI72FG4.mjs";
6
- import "./chunk-UGBTZ7VN.mjs";
5
+ } from "./chunk-R22W555P.mjs";
6
+ import "./chunk-WPJY7X5I.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -2044,7 +2044,8 @@ function styleValueToCSS(styles) {
2044
2044
  } else {
2045
2045
  cssVal = String(val);
2046
2046
  }
2047
- return `${cssProp}: ${cssVal}`;
2047
+ const important = prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") ? " !important" : "";
2048
+ return `${cssProp}: ${cssVal}${important}`;
2048
2049
  }).join("; ");
2049
2050
  }
2050
2051
  function camelToKebab(str) {
@@ -2395,7 +2396,21 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2395
2396
  const handleFocus = (0, import_react3.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2396
2397
  const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2397
2398
  const computedStyle = (0, import_react3.useMemo)(
2398
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2399
+ () => {
2400
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2401
+ if (isWeb) {
2402
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2403
+ delete s.gridTemplateColumns;
2404
+ delete s.gridTemplateRows;
2405
+ delete s.gridColumn;
2406
+ delete s.gridRow;
2407
+ delete s.gridArea;
2408
+ delete s.gridAutoFlow;
2409
+ delete s.gridAutoColumns;
2410
+ delete s.gridAutoRows;
2411
+ }
2412
+ return s;
2413
+ },
2399
2414
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2400
2415
  // eslint-disable-line react-hooks/exhaustive-deps
2401
2416
  );
@@ -2437,12 +2452,24 @@ var DarkWrapper = import_react4.default.forwardRef(
2437
2452
  const width = useConditionalWidth(needsWidth);
2438
2453
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2439
2454
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2455
+ if (isWeb) stripWebGridProps(computedStyle);
2440
2456
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2441
2457
  const props = { ref, ...rest, style: finalStyle };
2442
2458
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
2443
2459
  }
2444
2460
  );
2445
2461
  DarkWrapper.displayName = "Kbach.DarkWrapper";
2462
+ function stripWebGridProps(s) {
2463
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2464
+ delete s.gridTemplateColumns;
2465
+ delete s.gridTemplateRows;
2466
+ delete s.gridColumn;
2467
+ delete s.gridRow;
2468
+ delete s.gridArea;
2469
+ delete s.gridAutoFlow;
2470
+ delete s.gridAutoColumns;
2471
+ delete s.gridAutoRows;
2472
+ }
2446
2473
 
2447
2474
  // src/jsx-runtime.tsx
2448
2475
  var INTERACTIVE_MODS = /* @__PURE__ */ new Set([
@@ -2542,6 +2569,17 @@ function processElement(type, rawProps, key, isStaticChildren) {
2542
2569
  }, key);
2543
2570
  }
2544
2571
  const computedStyle = flatten(resolved, false);
2572
+ if (isWeb) {
2573
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2574
+ delete computedStyle.gridTemplateColumns;
2575
+ delete computedStyle.gridTemplateRows;
2576
+ delete computedStyle.gridColumn;
2577
+ delete computedStyle.gridRow;
2578
+ delete computedStyle.gridArea;
2579
+ delete computedStyle.gridAutoFlow;
2580
+ delete computedStyle.gridAutoColumns;
2581
+ delete computedStyle.gridAutoRows;
2582
+ }
2545
2583
  const finalStyle = mergeStyle(computedStyle, userStyle);
2546
2584
  return makeElement(isStaticChildren, type, {
2547
2585
  ...passProps,
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-BAI72FG4.mjs";
6
- import "./chunk-UGBTZ7VN.mjs";
5
+ } from "./chunk-R22W555P.mjs";
6
+ import "./chunk-WPJY7X5I.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",