@kbach/react 0.6.28 → 0.6.30
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.
|
@@ -110,6 +110,18 @@ function mergeStyle(computed, userStyle) {
|
|
|
110
110
|
if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
|
|
111
111
|
return { ...computed, ...userStyle };
|
|
112
112
|
}
|
|
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;
|
|
123
|
+
return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
|
|
124
|
+
}
|
|
113
125
|
function makeElement(isStaticChildren, type, props, key) {
|
|
114
126
|
return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
|
|
115
127
|
}
|
|
@@ -152,7 +164,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
152
164
|
}
|
|
153
165
|
const config = getConfig();
|
|
154
166
|
const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : classStr ? resolve(classStr, config.theme, config.darkMode) : {};
|
|
155
|
-
const { style:
|
|
167
|
+
const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
|
|
168
|
+
const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
|
|
156
169
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
157
170
|
if (interactive) {
|
|
158
171
|
return _jsx(InteractiveWrapper, {
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -622,6 +622,18 @@ function mergeStyle(computed, userStyle) {
|
|
|
622
622
|
if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
|
|
623
623
|
return { ...computed, ...userStyle };
|
|
624
624
|
}
|
|
625
|
+
function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
|
|
626
|
+
if (!webTag || !resolvedBase) return userStyle;
|
|
627
|
+
const explicitDisplay = resolvedBase.display;
|
|
628
|
+
const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
|
|
629
|
+
const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
|
|
630
|
+
if (!willBeFlex) return userStyle;
|
|
631
|
+
const compensation = {};
|
|
632
|
+
if (explicitDisplay === void 0) compensation.display = "flex";
|
|
633
|
+
if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
|
|
634
|
+
if (Object.keys(compensation).length === 0) return userStyle;
|
|
635
|
+
return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
|
|
636
|
+
}
|
|
625
637
|
function makeElement(isStaticChildren, type, props, key) {
|
|
626
638
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
627
639
|
}
|
|
@@ -664,7 +676,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
664
676
|
}
|
|
665
677
|
const config = (0, import_core6.getConfig)();
|
|
666
678
|
const resolved = !import_core6.isWeb && __kbachStyles != null ? __kbachStyles : classStr ? (0, import_core6.resolve)(classStr, config.theme, config.darkMode) : {};
|
|
667
|
-
const { style:
|
|
679
|
+
const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
|
|
680
|
+
const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
|
|
668
681
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
669
682
|
if (interactive) {
|
|
670
683
|
return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
|
package/dist/jsx-dev-runtime.mjs
CHANGED
package/dist/jsx-runtime.js
CHANGED
|
@@ -628,6 +628,18 @@ function mergeStyle(computed, userStyle) {
|
|
|
628
628
|
if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
|
|
629
629
|
return { ...computed, ...userStyle };
|
|
630
630
|
}
|
|
631
|
+
function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
|
|
632
|
+
if (!webTag || !resolvedBase) return userStyle;
|
|
633
|
+
const explicitDisplay = resolvedBase.display;
|
|
634
|
+
const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
|
|
635
|
+
const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
|
|
636
|
+
if (!willBeFlex) return userStyle;
|
|
637
|
+
const compensation = {};
|
|
638
|
+
if (explicitDisplay === void 0) compensation.display = "flex";
|
|
639
|
+
if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
|
|
640
|
+
if (Object.keys(compensation).length === 0) return userStyle;
|
|
641
|
+
return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
|
|
642
|
+
}
|
|
631
643
|
function makeElement(isStaticChildren, type, props, key) {
|
|
632
644
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
633
645
|
}
|
|
@@ -670,7 +682,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
670
682
|
}
|
|
671
683
|
const config = (0, import_core6.getConfig)();
|
|
672
684
|
const resolved = !import_core6.isWeb && __kbachStyles != null ? __kbachStyles : classStr ? (0, import_core6.resolve)(classStr, config.theme, config.darkMode) : {};
|
|
673
|
-
const { style:
|
|
685
|
+
const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
|
|
686
|
+
const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
|
|
674
687
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
675
688
|
if (interactive) {
|
|
676
689
|
return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
|
package/dist/jsx-runtime.mjs
CHANGED