@measured/puck 0.17.0-canary.70b3204 → 0.17.0-canary.8680db3
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/index.js +29 -15
- package/dist/index.mjs +29 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1637,6 +1637,7 @@ var DefaultField = ({
|
|
1637
1637
|
className: getClassName6("input"),
|
1638
1638
|
autoComplete: "off",
|
1639
1639
|
type: field.type,
|
1640
|
+
title: label || name,
|
1640
1641
|
name,
|
1641
1642
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1642
1643
|
onChange: (e) => {
|
@@ -2051,6 +2052,19 @@ var ExternalField = ({
|
|
2051
2052
|
|
2052
2053
|
// components/AutoField/fields/RadioField/index.tsx
|
2053
2054
|
init_react_import();
|
2055
|
+
|
2056
|
+
// lib/safe-json-parse.ts
|
2057
|
+
init_react_import();
|
2058
|
+
var safeJsonParse = (str) => {
|
2059
|
+
try {
|
2060
|
+
const jsonValue = JSON.parse(str);
|
2061
|
+
return jsonValue;
|
2062
|
+
} catch (e) {
|
2063
|
+
return str;
|
2064
|
+
}
|
2065
|
+
};
|
2066
|
+
|
2067
|
+
// components/AutoField/fields/RadioField/index.tsx
|
2054
2068
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
2055
2069
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
2056
2070
|
var RadioField = ({
|
@@ -2085,13 +2099,7 @@ var RadioField = ({
|
|
2085
2099
|
className: getClassName11("radioInput"),
|
2086
2100
|
value: option.value,
|
2087
2101
|
name,
|
2088
|
-
onChange: (
|
2089
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
2090
|
-
onChange(JSON.parse(e.currentTarget.value));
|
2091
|
-
return;
|
2092
|
-
}
|
2093
|
-
onChange(e.currentTarget.value);
|
2094
|
-
},
|
2102
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
2095
2103
|
disabled: readOnly,
|
2096
2104
|
checked: value === option.value
|
2097
2105
|
}
|
@@ -2132,15 +2140,10 @@ var SelectField = ({
|
|
2132
2140
|
"select",
|
2133
2141
|
{
|
2134
2142
|
id,
|
2143
|
+
title: label || name,
|
2135
2144
|
className: getClassName12("input"),
|
2136
2145
|
disabled: readOnly,
|
2137
|
-
onChange: (
|
2138
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
2139
|
-
onChange(JSON.parse(e.currentTarget.value));
|
2140
|
-
return;
|
2141
|
-
}
|
2142
|
-
onChange(e.currentTarget.value);
|
2143
|
-
},
|
2146
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
2144
2147
|
value,
|
2145
2148
|
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
2146
2149
|
"option",
|
@@ -2385,7 +2388,18 @@ function AutoFieldInternal(props) {
|
|
2385
2388
|
}
|
2386
2389
|
const children = defaultFields[field.type](mergedProps);
|
2387
2390
|
const Render2 = render[field.type];
|
2388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
2391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
2392
|
+
"div",
|
2393
|
+
{
|
2394
|
+
className: getClassNameWrapper(),
|
2395
|
+
onFocus,
|
2396
|
+
onBlur,
|
2397
|
+
onClick: (e) => {
|
2398
|
+
e.stopPropagation();
|
2399
|
+
},
|
2400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2401
|
+
}
|
2402
|
+
);
|
2389
2403
|
}
|
2390
2404
|
function AutoFieldPrivate(props) {
|
2391
2405
|
const { state } = useAppContext();
|
package/dist/index.mjs
CHANGED
@@ -1449,6 +1449,7 @@ var DefaultField = ({
|
|
1449
1449
|
className: getClassName6("input"),
|
1450
1450
|
autoComplete: "off",
|
1451
1451
|
type: field.type,
|
1452
|
+
title: label || name,
|
1452
1453
|
name,
|
1453
1454
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1454
1455
|
onChange: (e) => {
|
@@ -1869,6 +1870,19 @@ var ExternalField = ({
|
|
1869
1870
|
|
1870
1871
|
// components/AutoField/fields/RadioField/index.tsx
|
1871
1872
|
init_react_import();
|
1873
|
+
|
1874
|
+
// lib/safe-json-parse.ts
|
1875
|
+
init_react_import();
|
1876
|
+
var safeJsonParse = (str) => {
|
1877
|
+
try {
|
1878
|
+
const jsonValue = JSON.parse(str);
|
1879
|
+
return jsonValue;
|
1880
|
+
} catch (e) {
|
1881
|
+
return str;
|
1882
|
+
}
|
1883
|
+
};
|
1884
|
+
|
1885
|
+
// components/AutoField/fields/RadioField/index.tsx
|
1872
1886
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
1873
1887
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
1874
1888
|
var RadioField = ({
|
@@ -1903,13 +1917,7 @@ var RadioField = ({
|
|
1903
1917
|
className: getClassName11("radioInput"),
|
1904
1918
|
value: option.value,
|
1905
1919
|
name,
|
1906
|
-
onChange: (
|
1907
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1908
|
-
onChange(JSON.parse(e.currentTarget.value));
|
1909
|
-
return;
|
1910
|
-
}
|
1911
|
-
onChange(e.currentTarget.value);
|
1912
|
-
},
|
1920
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
1913
1921
|
disabled: readOnly,
|
1914
1922
|
checked: value === option.value
|
1915
1923
|
}
|
@@ -1950,15 +1958,10 @@ var SelectField = ({
|
|
1950
1958
|
"select",
|
1951
1959
|
{
|
1952
1960
|
id,
|
1961
|
+
title: label || name,
|
1953
1962
|
className: getClassName12("input"),
|
1954
1963
|
disabled: readOnly,
|
1955
|
-
onChange: (
|
1956
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
1957
|
-
onChange(JSON.parse(e.currentTarget.value));
|
1958
|
-
return;
|
1959
|
-
}
|
1960
|
-
onChange(e.currentTarget.value);
|
1961
|
-
},
|
1964
|
+
onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
|
1962
1965
|
value,
|
1963
1966
|
children: field.options.map((option) => /* @__PURE__ */ jsx17(
|
1964
1967
|
"option",
|
@@ -2203,7 +2206,18 @@ function AutoFieldInternal(props) {
|
|
2203
2206
|
}
|
2204
2207
|
const children = defaultFields[field.type](mergedProps);
|
2205
2208
|
const Render2 = render[field.type];
|
2206
|
-
return /* @__PURE__ */ jsx20(
|
2209
|
+
return /* @__PURE__ */ jsx20(
|
2210
|
+
"div",
|
2211
|
+
{
|
2212
|
+
className: getClassNameWrapper(),
|
2213
|
+
onFocus,
|
2214
|
+
onBlur,
|
2215
|
+
onClick: (e) => {
|
2216
|
+
e.stopPropagation();
|
2217
|
+
},
|
2218
|
+
children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2219
|
+
}
|
2220
|
+
);
|
2207
2221
|
}
|
2208
2222
|
function AutoFieldPrivate(props) {
|
2209
2223
|
const { state } = useAppContext();
|
package/package.json
CHANGED