@camstack/ui-library 1.2.277 → 1.2.278
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.
- package/dist/composites/config-form-builder.d.ts +11 -0
- package/dist/index.cjs +35 -12
- package/dist/index.js +35 -12
- package/package.json +1 -1
|
@@ -20,5 +20,16 @@ interface FormBuilderProps {
|
|
|
20
20
|
*/
|
|
21
21
|
bare?: boolean;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Container-query driven responsive grid. Each section is its own
|
|
25
|
+
* `@container` so the column count adapts to the SECTION's width
|
|
26
|
+
* (not the viewport) — important inside narrow hosts like the
|
|
27
|
+
* device-detail right column / ItemFormDialog. Behavior:
|
|
28
|
+
* columns=1 → always 1 col
|
|
29
|
+
* columns=2 (default) → 1 col below 480px container, 2 cols above
|
|
30
|
+
* columns=3 → 1 → 2 → 3 col at 480px / 880px
|
|
31
|
+
* columns=4 → 1 → 2 → 4 col at 480px / 1140px
|
|
32
|
+
*/
|
|
33
|
+
export declare function sectionGridClass(columns: 1 | 2 | 3 | 4 | undefined): string;
|
|
23
34
|
export declare function ConfigFormBuilder({ schema, values, onChange, disabled, translationFn, onTestField, probeResults, onClearProbe, bare }: FormBuilderProps): JSX.Element;
|
|
24
35
|
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -30125,11 +30125,27 @@ function resolveLabel(value, t) {
|
|
|
30125
30125
|
if (t && isI18nKey(value)) return t(value);
|
|
30126
30126
|
return value;
|
|
30127
30127
|
}
|
|
30128
|
+
/**
|
|
30129
|
+
* Container-query driven responsive grid. Each section is its own
|
|
30130
|
+
* `@container` so the column count adapts to the SECTION's width
|
|
30131
|
+
* (not the viewport) — important inside narrow hosts like the
|
|
30132
|
+
* device-detail right column / ItemFormDialog. Behavior:
|
|
30133
|
+
* columns=1 → always 1 col
|
|
30134
|
+
* columns=2 (default) → 1 col below 480px container, 2 cols above
|
|
30135
|
+
* columns=3 → 1 → 2 → 3 col at 480px / 880px
|
|
30136
|
+
* columns=4 → 1 → 2 → 4 col at 480px / 1140px
|
|
30137
|
+
*/
|
|
30138
|
+
function sectionGridClass(columns) {
|
|
30139
|
+
const cols = columns ?? 2;
|
|
30140
|
+
if (cols === 1) return "grid-cols-1";
|
|
30141
|
+
if (cols === 3) return "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3";
|
|
30142
|
+
if (cols === 4) return "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4";
|
|
30143
|
+
return "grid-cols-1 @[480px]:grid-cols-2";
|
|
30144
|
+
}
|
|
30128
30145
|
function SectionCard$1({ section, values, onChange, disabled, translationFn, onTestField, probeResults }) {
|
|
30129
30146
|
const [collapsed, setCollapsed] = (0, react$1.useState)(section.defaultCollapsed ?? false);
|
|
30130
30147
|
const isAccordion = section.style === "accordion";
|
|
30131
|
-
const
|
|
30132
|
-
const gridClass = columns === 1 ? "grid-cols-1" : columns === 3 ? "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3" : columns === 4 ? "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4" : "grid-cols-1 @[480px]:grid-cols-2";
|
|
30148
|
+
const gridClass = sectionGridClass(section.columns);
|
|
30133
30149
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
30134
30150
|
className: "@container rounded-lg border border-border bg-surface p-3",
|
|
30135
30151
|
style: { containerType: "inline-size" },
|
|
@@ -30169,16 +30185,23 @@ function ConfigFormBuilder({ schema, values, onChange, disabled, translationFn,
|
|
|
30169
30185
|
onClearProbe?.(key);
|
|
30170
30186
|
};
|
|
30171
30187
|
if (bare) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30172
|
-
className: "
|
|
30173
|
-
children: schema.sections.
|
|
30174
|
-
|
|
30175
|
-
|
|
30176
|
-
|
|
30177
|
-
|
|
30178
|
-
|
|
30179
|
-
|
|
30180
|
-
|
|
30181
|
-
|
|
30188
|
+
className: "space-y-4",
|
|
30189
|
+
children: schema.sections.map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30190
|
+
className: "@container",
|
|
30191
|
+
style: { containerType: "inline-size" },
|
|
30192
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30193
|
+
className: `grid ${sectionGridClass(section.columns)} gap-x-3 gap-y-2.5`,
|
|
30194
|
+
children: section.fields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormField, {
|
|
30195
|
+
field,
|
|
30196
|
+
values,
|
|
30197
|
+
onChange: handleFieldChange,
|
|
30198
|
+
disabled,
|
|
30199
|
+
translationFn,
|
|
30200
|
+
onTestField,
|
|
30201
|
+
externalProbe: probeResults?.[field.key]
|
|
30202
|
+
}, field.key))
|
|
30203
|
+
})
|
|
30204
|
+
}, section.id))
|
|
30182
30205
|
});
|
|
30183
30206
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30184
30207
|
className: "space-y-4",
|
package/dist/index.js
CHANGED
|
@@ -30101,11 +30101,27 @@ function resolveLabel(value, t) {
|
|
|
30101
30101
|
if (t && isI18nKey(value)) return t(value);
|
|
30102
30102
|
return value;
|
|
30103
30103
|
}
|
|
30104
|
+
/**
|
|
30105
|
+
* Container-query driven responsive grid. Each section is its own
|
|
30106
|
+
* `@container` so the column count adapts to the SECTION's width
|
|
30107
|
+
* (not the viewport) — important inside narrow hosts like the
|
|
30108
|
+
* device-detail right column / ItemFormDialog. Behavior:
|
|
30109
|
+
* columns=1 → always 1 col
|
|
30110
|
+
* columns=2 (default) → 1 col below 480px container, 2 cols above
|
|
30111
|
+
* columns=3 → 1 → 2 → 3 col at 480px / 880px
|
|
30112
|
+
* columns=4 → 1 → 2 → 4 col at 480px / 1140px
|
|
30113
|
+
*/
|
|
30114
|
+
function sectionGridClass(columns) {
|
|
30115
|
+
const cols = columns ?? 2;
|
|
30116
|
+
if (cols === 1) return "grid-cols-1";
|
|
30117
|
+
if (cols === 3) return "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3";
|
|
30118
|
+
if (cols === 4) return "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4";
|
|
30119
|
+
return "grid-cols-1 @[480px]:grid-cols-2";
|
|
30120
|
+
}
|
|
30104
30121
|
function SectionCard$1({ section, values, onChange, disabled, translationFn, onTestField, probeResults }) {
|
|
30105
30122
|
const [collapsed, setCollapsed] = useState(section.defaultCollapsed ?? false);
|
|
30106
30123
|
const isAccordion = section.style === "accordion";
|
|
30107
|
-
const
|
|
30108
|
-
const gridClass = columns === 1 ? "grid-cols-1" : columns === 3 ? "grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3" : columns === 4 ? "grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4" : "grid-cols-1 @[480px]:grid-cols-2";
|
|
30124
|
+
const gridClass = sectionGridClass(section.columns);
|
|
30109
30125
|
return /* @__PURE__ */ jsxs("div", {
|
|
30110
30126
|
className: "@container rounded-lg border border-border bg-surface p-3",
|
|
30111
30127
|
style: { containerType: "inline-size" },
|
|
@@ -30145,16 +30161,23 @@ function ConfigFormBuilder({ schema, values, onChange, disabled, translationFn,
|
|
|
30145
30161
|
onClearProbe?.(key);
|
|
30146
30162
|
};
|
|
30147
30163
|
if (bare) return /* @__PURE__ */ jsx("div", {
|
|
30148
|
-
className: "
|
|
30149
|
-
children: schema.sections.
|
|
30150
|
-
|
|
30151
|
-
|
|
30152
|
-
|
|
30153
|
-
|
|
30154
|
-
|
|
30155
|
-
|
|
30156
|
-
|
|
30157
|
-
|
|
30164
|
+
className: "space-y-4",
|
|
30165
|
+
children: schema.sections.map((section) => /* @__PURE__ */ jsx("div", {
|
|
30166
|
+
className: "@container",
|
|
30167
|
+
style: { containerType: "inline-size" },
|
|
30168
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
30169
|
+
className: `grid ${sectionGridClass(section.columns)} gap-x-3 gap-y-2.5`,
|
|
30170
|
+
children: section.fields.map((field) => /* @__PURE__ */ jsx(FormField, {
|
|
30171
|
+
field,
|
|
30172
|
+
values,
|
|
30173
|
+
onChange: handleFieldChange,
|
|
30174
|
+
disabled,
|
|
30175
|
+
translationFn,
|
|
30176
|
+
onTestField,
|
|
30177
|
+
externalProbe: probeResults?.[field.key]
|
|
30178
|
+
}, field.key))
|
|
30179
|
+
})
|
|
30180
|
+
}, section.id))
|
|
30158
30181
|
});
|
|
30159
30182
|
return /* @__PURE__ */ jsx("div", {
|
|
30160
30183
|
className: "space-y-4",
|