@kbach/react 0.3.13 → 0.3.15

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-XL3F5GRY.mjs";
11
+ } from "./chunk-OJE5MVCI.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([
@@ -115,12 +127,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
115
127
  return makeElement(isStaticChildren, type, rawProps, key);
116
128
  }
117
129
  const config = getConfig();
130
+ const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
131
+ const actualType = isGrdOnWeb ? "div" : type;
118
132
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
119
133
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
120
134
  const { interactive, modeOrResponsive } = bucketMods(resolved);
121
135
  if (interactive) {
122
136
  return _jsx(InteractiveWrapper, {
123
- Component: type,
137
+ Component: actualType,
124
138
  resolvedStyle: resolved,
125
139
  ...isWeb && classStr ? { className: classStr } : {},
126
140
  style: userStyle,
@@ -129,7 +143,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
129
143
  }
130
144
  if (modeOrResponsive) {
131
145
  return _jsx(DarkWrapper, {
132
- Component: type,
146
+ Component: actualType,
133
147
  resolvedStyle: resolved,
134
148
  ...isWeb && classStr ? { className: classStr } : {},
135
149
  style: userStyle,
@@ -137,8 +151,19 @@ function processElement(type, rawProps, key, isStaticChildren) {
137
151
  }, key);
138
152
  }
139
153
  const computedStyle = flatten(resolved, false);
154
+ if (isWeb) {
155
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
156
+ delete computedStyle.gridTemplateColumns;
157
+ delete computedStyle.gridTemplateRows;
158
+ delete computedStyle.gridColumn;
159
+ delete computedStyle.gridRow;
160
+ delete computedStyle.gridArea;
161
+ delete computedStyle.gridAutoFlow;
162
+ delete computedStyle.gridAutoColumns;
163
+ delete computedStyle.gridAutoRows;
164
+ }
140
165
  const finalStyle = mergeStyle(computedStyle, userStyle);
141
- return makeElement(isStaticChildren, type, {
166
+ return makeElement(isStaticChildren, actualType, {
142
167
  ...passProps,
143
168
  style: finalStyle,
144
169
  ...isWeb && classStr ? { className: classStr } : {}
@@ -829,6 +829,7 @@ var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
829
829
  "grid",
830
830
  "inline-flex",
831
831
  "inline-grid",
832
+ "grd",
832
833
  "hidden",
833
834
  "contents",
834
835
  "flow-root",
@@ -1142,6 +1143,7 @@ var STANDALONE = {
1142
1143
  "inline-block": isWeb ? { display: "inline-block" } : null,
1143
1144
  inline: isWeb ? { display: "inline" } : null,
1144
1145
  grid: isWeb ? { display: "grid" } : null,
1146
+ grd: isWeb ? { display: "grid" } : null,
1145
1147
  "inline-flex": { display: isWeb ? "inline-flex" : "flex" },
1146
1148
  "inline-grid": isWeb ? { display: "inline-grid" } : null,
1147
1149
  hidden: { display: "none" },
@@ -2414,7 +2416,21 @@ var InteractiveWrapper = forwardRef(
2414
2416
  const handleFocus = useCallback(chain(onFocus, () => setFocused(true)), [onFocus]);
2415
2417
  const handleBlur = useCallback(chain(onBlur, () => setFocused(false)), [onBlur]);
2416
2418
  const computedStyle = useMemo(
2417
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2419
+ () => {
2420
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2421
+ if (isWeb) {
2422
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2423
+ delete s.gridTemplateColumns;
2424
+ delete s.gridTemplateRows;
2425
+ delete s.gridColumn;
2426
+ delete s.gridRow;
2427
+ delete s.gridArea;
2428
+ delete s.gridAutoFlow;
2429
+ delete s.gridAutoColumns;
2430
+ delete s.gridAutoRows;
2431
+ }
2432
+ return s;
2433
+ },
2418
2434
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2419
2435
  // eslint-disable-line react-hooks/exhaustive-deps
2420
2436
  );
package/dist/index.js CHANGED
@@ -995,6 +995,7 @@ var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
995
995
  "grid",
996
996
  "inline-flex",
997
997
  "inline-grid",
998
+ "grd",
998
999
  "hidden",
999
1000
  "contents",
1000
1001
  "flow-root",
@@ -1308,6 +1309,7 @@ var STANDALONE = {
1308
1309
  "inline-block": isWeb ? { display: "inline-block" } : null,
1309
1310
  inline: isWeb ? { display: "inline" } : null,
1310
1311
  grid: isWeb ? { display: "grid" } : null,
1312
+ grd: isWeb ? { display: "grid" } : null,
1311
1313
  "inline-flex": { display: isWeb ? "inline-flex" : "flex" },
1312
1314
  "inline-grid": isWeb ? { display: "inline-grid" } : null,
1313
1315
  hidden: { display: "none" },
@@ -2918,7 +2920,21 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
2918
2920
  const handleFocus = (0, import_react9.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2919
2921
  const handleBlur = (0, import_react9.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2920
2922
  const computedStyle = (0, import_react9.useMemo)(
2921
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2923
+ () => {
2924
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2925
+ if (isWeb) {
2926
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2927
+ delete s.gridTemplateColumns;
2928
+ delete s.gridTemplateRows;
2929
+ delete s.gridColumn;
2930
+ delete s.gridRow;
2931
+ delete s.gridArea;
2932
+ delete s.gridAutoFlow;
2933
+ delete s.gridAutoColumns;
2934
+ delete s.gridAutoRows;
2935
+ }
2936
+ return s;
2937
+ },
2922
2938
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2923
2939
  // eslint-disable-line react-hooks/exhaustive-deps
2924
2940
  );
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  updateConfig,
22
22
  useGlobalDarkMode,
23
23
  useGlobalWidth
24
- } from "./chunk-XL3F5GRY.mjs";
24
+ } from "./chunk-OJE5MVCI.mjs";
25
25
 
26
26
  // src/context.tsx
27
27
  import { createContext, useContext } from "react";
@@ -898,6 +898,7 @@ var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
898
898
  "grid",
899
899
  "inline-flex",
900
900
  "inline-grid",
901
+ "grd",
901
902
  "hidden",
902
903
  "contents",
903
904
  "flow-root",
@@ -1211,6 +1212,7 @@ var STANDALONE = {
1211
1212
  "inline-block": isWeb ? { display: "inline-block" } : null,
1212
1213
  inline: isWeb ? { display: "inline" } : null,
1213
1214
  grid: isWeb ? { display: "grid" } : null,
1215
+ grd: isWeb ? { display: "grid" } : null,
1214
1216
  "inline-flex": { display: isWeb ? "inline-flex" : "flex" },
1215
1217
  "inline-grid": isWeb ? { display: "inline-grid" } : null,
1216
1218
  hidden: { display: "none" },
@@ -2397,7 +2399,21 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2397
2399
  const handleFocus = (0, import_react3.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2398
2400
  const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2399
2401
  const computedStyle = (0, import_react3.useMemo)(
2400
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2402
+ () => {
2403
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2404
+ if (isWeb) {
2405
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2406
+ delete s.gridTemplateColumns;
2407
+ delete s.gridTemplateRows;
2408
+ delete s.gridColumn;
2409
+ delete s.gridRow;
2410
+ delete s.gridArea;
2411
+ delete s.gridAutoFlow;
2412
+ delete s.gridAutoColumns;
2413
+ delete s.gridAutoRows;
2414
+ }
2415
+ return s;
2416
+ },
2401
2417
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2402
2418
  // eslint-disable-line react-hooks/exhaustive-deps
2403
2419
  );
@@ -2439,12 +2455,24 @@ var DarkWrapper = import_react4.default.forwardRef(
2439
2455
  const width = useConditionalWidth(needsWidth);
2440
2456
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2441
2457
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2458
+ if (isWeb) stripWebGridProps(computedStyle);
2442
2459
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2443
2460
  const props = { ref, ...rest, style: finalStyle };
2444
2461
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
2445
2462
  }
2446
2463
  );
2447
2464
  DarkWrapper.displayName = "Kbach.DarkWrapper";
2465
+ function stripWebGridProps(s) {
2466
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2467
+ delete s.gridTemplateColumns;
2468
+ delete s.gridTemplateRows;
2469
+ delete s.gridColumn;
2470
+ delete s.gridRow;
2471
+ delete s.gridArea;
2472
+ delete s.gridAutoFlow;
2473
+ delete s.gridAutoColumns;
2474
+ delete s.gridAutoRows;
2475
+ }
2448
2476
 
2449
2477
  // src/jsx-runtime.tsx
2450
2478
  var INTERACTIVE_MODS = /* @__PURE__ */ new Set([
@@ -2522,12 +2550,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
2522
2550
  return makeElement(isStaticChildren, type, rawProps, key);
2523
2551
  }
2524
2552
  const config = getConfig();
2553
+ const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2554
+ const actualType = isGrdOnWeb ? "div" : type;
2525
2555
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2526
2556
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
2527
2557
  const { interactive, modeOrResponsive } = bucketMods(resolved);
2528
2558
  if (interactive) {
2529
2559
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
2530
- Component: type,
2560
+ Component: actualType,
2531
2561
  resolvedStyle: resolved,
2532
2562
  ...isWeb && classStr ? { className: classStr } : {},
2533
2563
  style: userStyle,
@@ -2536,7 +2566,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2536
2566
  }
2537
2567
  if (modeOrResponsive) {
2538
2568
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
2539
- Component: type,
2569
+ Component: actualType,
2540
2570
  resolvedStyle: resolved,
2541
2571
  ...isWeb && classStr ? { className: classStr } : {},
2542
2572
  style: userStyle,
@@ -2544,8 +2574,19 @@ function processElement(type, rawProps, key, isStaticChildren) {
2544
2574
  }, key);
2545
2575
  }
2546
2576
  const computedStyle = flatten(resolved, false);
2577
+ if (isWeb) {
2578
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2579
+ delete computedStyle.gridTemplateColumns;
2580
+ delete computedStyle.gridTemplateRows;
2581
+ delete computedStyle.gridColumn;
2582
+ delete computedStyle.gridRow;
2583
+ delete computedStyle.gridArea;
2584
+ delete computedStyle.gridAutoFlow;
2585
+ delete computedStyle.gridAutoColumns;
2586
+ delete computedStyle.gridAutoRows;
2587
+ }
2547
2588
  const finalStyle = mergeStyle(computedStyle, userStyle);
2548
- return makeElement(isStaticChildren, type, {
2589
+ return makeElement(isStaticChildren, actualType, {
2549
2590
  ...passProps,
2550
2591
  style: finalStyle,
2551
2592
  ...isWeb && classStr ? { className: classStr } : {}
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-BBWDCPU6.mjs";
6
- import "./chunk-XL3F5GRY.mjs";
5
+ } from "./chunk-6FOS3PUK.mjs";
6
+ import "./chunk-OJE5MVCI.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -897,6 +897,7 @@ var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
897
897
  "grid",
898
898
  "inline-flex",
899
899
  "inline-grid",
900
+ "grd",
900
901
  "hidden",
901
902
  "contents",
902
903
  "flow-root",
@@ -1210,6 +1211,7 @@ var STANDALONE = {
1210
1211
  "inline-block": isWeb ? { display: "inline-block" } : null,
1211
1212
  inline: isWeb ? { display: "inline" } : null,
1212
1213
  grid: isWeb ? { display: "grid" } : null,
1214
+ grd: isWeb ? { display: "grid" } : null,
1213
1215
  "inline-flex": { display: isWeb ? "inline-flex" : "flex" },
1214
1216
  "inline-grid": isWeb ? { display: "inline-grid" } : null,
1215
1217
  hidden: { display: "none" },
@@ -2396,7 +2398,21 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2396
2398
  const handleFocus = (0, import_react3.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
2397
2399
  const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
2398
2400
  const computedStyle = (0, import_react3.useMemo)(
2399
- () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
2401
+ () => {
2402
+ const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2403
+ if (isWeb) {
2404
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2405
+ delete s.gridTemplateColumns;
2406
+ delete s.gridTemplateRows;
2407
+ delete s.gridColumn;
2408
+ delete s.gridRow;
2409
+ delete s.gridArea;
2410
+ delete s.gridAutoFlow;
2411
+ delete s.gridAutoColumns;
2412
+ delete s.gridAutoRows;
2413
+ }
2414
+ return s;
2415
+ },
2400
2416
  [resolvedStyle, isDark, pressed, hovered, focused, width]
2401
2417
  // eslint-disable-line react-hooks/exhaustive-deps
2402
2418
  );
@@ -2438,12 +2454,24 @@ var DarkWrapper = import_react4.default.forwardRef(
2438
2454
  const width = useConditionalWidth(needsWidth);
2439
2455
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2440
2456
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2457
+ if (isWeb) stripWebGridProps(computedStyle);
2441
2458
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2442
2459
  const props = { ref, ...rest, style: finalStyle };
2443
2460
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
2444
2461
  }
2445
2462
  );
2446
2463
  DarkWrapper.displayName = "Kbach.DarkWrapper";
2464
+ function stripWebGridProps(s) {
2465
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2466
+ delete s.gridTemplateColumns;
2467
+ delete s.gridTemplateRows;
2468
+ delete s.gridColumn;
2469
+ delete s.gridRow;
2470
+ delete s.gridArea;
2471
+ delete s.gridAutoFlow;
2472
+ delete s.gridAutoColumns;
2473
+ delete s.gridAutoRows;
2474
+ }
2447
2475
 
2448
2476
  // src/jsx-runtime.tsx
2449
2477
  var INTERACTIVE_MODS = /* @__PURE__ */ new Set([
@@ -2521,12 +2549,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
2521
2549
  return makeElement(isStaticChildren, type, rawProps, key);
2522
2550
  }
2523
2551
  const config = getConfig();
2552
+ const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2553
+ const actualType = isGrdOnWeb ? "div" : type;
2524
2554
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2525
2555
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
2526
2556
  const { interactive, modeOrResponsive } = bucketMods(resolved);
2527
2557
  if (interactive) {
2528
2558
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
2529
- Component: type,
2559
+ Component: actualType,
2530
2560
  resolvedStyle: resolved,
2531
2561
  ...isWeb && classStr ? { className: classStr } : {},
2532
2562
  style: userStyle,
@@ -2535,7 +2565,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2535
2565
  }
2536
2566
  if (modeOrResponsive) {
2537
2567
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
2538
- Component: type,
2568
+ Component: actualType,
2539
2569
  resolvedStyle: resolved,
2540
2570
  ...isWeb && classStr ? { className: classStr } : {},
2541
2571
  style: userStyle,
@@ -2543,8 +2573,19 @@ function processElement(type, rawProps, key, isStaticChildren) {
2543
2573
  }, key);
2544
2574
  }
2545
2575
  const computedStyle = flatten(resolved, false);
2576
+ if (isWeb) {
2577
+ if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2578
+ delete computedStyle.gridTemplateColumns;
2579
+ delete computedStyle.gridTemplateRows;
2580
+ delete computedStyle.gridColumn;
2581
+ delete computedStyle.gridRow;
2582
+ delete computedStyle.gridArea;
2583
+ delete computedStyle.gridAutoFlow;
2584
+ delete computedStyle.gridAutoColumns;
2585
+ delete computedStyle.gridAutoRows;
2586
+ }
2546
2587
  const finalStyle = mergeStyle(computedStyle, userStyle);
2547
- return makeElement(isStaticChildren, type, {
2588
+ return makeElement(isStaticChildren, actualType, {
2548
2589
  ...passProps,
2549
2590
  style: finalStyle,
2550
2591
  ...isWeb && classStr ? { className: classStr } : {}
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-BBWDCPU6.mjs";
6
- import "./chunk-XL3F5GRY.mjs";
5
+ } from "./chunk-6FOS3PUK.mjs";
6
+ import "./chunk-OJE5MVCI.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.13",
3
+ "version": "0.3.15",
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",