@measured/puck 0.17.3 → 0.17.4-canary.18f0d46
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/README.md +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -20
- package/dist/index.mjs +49 -20
- package/package.json +1 -1
package/README.md
CHANGED
@@ -101,11 +101,11 @@ Available recipes include:
|
|
101
101
|
- [Discord server](https://discord.gg/D9e4E3MQVZ) for discussions
|
102
102
|
- [awesome-puck](https://github.com/measuredco/awesome-puck) community repo for plugins, custom fields & more
|
103
103
|
|
104
|
-
##
|
104
|
+
## Get support
|
105
105
|
|
106
|
-
|
106
|
+
If you have any questions about Puck, please open a [GitHub issue](https://github.com/measuredco/puck/issues) or join us on [Discord](https://discord.gg/D9e4E3MQVZ).
|
107
107
|
|
108
|
-
|
108
|
+
Or [book a discovery call](https://app.cal.com/chrisvxd/puck-enquiry/) for hands-on support and consultancy.
|
109
109
|
|
110
110
|
## License
|
111
111
|
|
package/dist/index.d.mts
CHANGED
@@ -39,7 +39,7 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
39
39
|
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
40
40
|
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<ValueType, FieldType>): react_jsx_runtime.JSX.Element;
|
41
41
|
|
42
|
-
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
42
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
43
43
|
children: ReactNode;
|
44
44
|
href?: string;
|
45
45
|
onClick?: (e: any) => void | Promise<void>;
|
package/dist/index.d.ts
CHANGED
@@ -39,7 +39,7 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
39
39
|
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
40
40
|
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<ValueType, FieldType>): react_jsx_runtime.JSX.Element;
|
41
41
|
|
42
|
-
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
42
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
43
43
|
children: ReactNode;
|
44
44
|
href?: string;
|
45
45
|
onClick?: (e: any) => void | Promise<void>;
|
package/dist/index.js
CHANGED
@@ -1868,29 +1868,57 @@ var import_react11 = require("react");
|
|
1868
1868
|
init_react_import();
|
1869
1869
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
1870
1870
|
|
1871
|
+
// lib/filter-data-attrs.ts
|
1872
|
+
init_react_import();
|
1873
|
+
var dataAttrRe = /^(data-.*)$/;
|
1874
|
+
var filterDataAttrs = (props) => {
|
1875
|
+
let filteredProps = {};
|
1876
|
+
for (const prop in props) {
|
1877
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) && dataAttrRe.test(prop)) {
|
1878
|
+
filteredProps[prop] = props[prop];
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
return filteredProps;
|
1882
|
+
};
|
1883
|
+
|
1871
1884
|
// components/Button/Button.tsx
|
1872
1885
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
1873
1886
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1874
|
-
var Button = ({
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1887
|
+
var Button = (_a) => {
|
1888
|
+
var _b = _a, {
|
1889
|
+
children,
|
1890
|
+
href,
|
1891
|
+
onClick,
|
1892
|
+
variant = "primary",
|
1893
|
+
type,
|
1894
|
+
disabled,
|
1895
|
+
tabIndex,
|
1896
|
+
newTab,
|
1897
|
+
fullWidth,
|
1898
|
+
icon,
|
1899
|
+
size = "medium",
|
1900
|
+
loading: loadingProp = false
|
1901
|
+
} = _b, props = __objRest(_b, [
|
1902
|
+
"children",
|
1903
|
+
"href",
|
1904
|
+
"onClick",
|
1905
|
+
"variant",
|
1906
|
+
"type",
|
1907
|
+
"disabled",
|
1908
|
+
"tabIndex",
|
1909
|
+
"newTab",
|
1910
|
+
"fullWidth",
|
1911
|
+
"icon",
|
1912
|
+
"size",
|
1913
|
+
"loading"
|
1914
|
+
]);
|
1888
1915
|
const [loading, setLoading] = (0, import_react11.useState)(loadingProp);
|
1889
1916
|
(0, import_react11.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
1890
1917
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1918
|
+
const dataAttrs = filterDataAttrs(props);
|
1891
1919
|
const el = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
1892
1920
|
ElementType,
|
1893
|
-
{
|
1921
|
+
__spreadProps(__spreadValues({
|
1894
1922
|
className: getClassName9({
|
1895
1923
|
primary: variant === "primary",
|
1896
1924
|
secondary: variant === "secondary",
|
@@ -1910,13 +1938,14 @@ var Button = ({
|
|
1910
1938
|
tabIndex,
|
1911
1939
|
target: newTab ? "_blank" : void 0,
|
1912
1940
|
rel: newTab ? "noreferrer" : void 0,
|
1913
|
-
href
|
1941
|
+
href
|
1942
|
+
}, dataAttrs), {
|
1914
1943
|
children: [
|
1915
1944
|
icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
1916
1945
|
children,
|
1917
1946
|
loading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader, { size: 14 }) })
|
1918
1947
|
]
|
1919
|
-
}
|
1948
|
+
})
|
1920
1949
|
);
|
1921
1950
|
return el;
|
1922
1951
|
};
|
@@ -3168,7 +3197,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3168
3197
|
DraggableComponent,
|
3169
3198
|
{
|
3170
3199
|
label,
|
3171
|
-
id: `draggable-${componentId}`,
|
3200
|
+
id: `draggable-${componentId}::${item.type}`,
|
3172
3201
|
index: i,
|
3173
3202
|
isSelected,
|
3174
3203
|
isLocked: userIsDragging,
|
@@ -4025,10 +4054,10 @@ var useResolvedFields = () => {
|
|
4025
4054
|
setResolvedFields(fields || {});
|
4026
4055
|
setFieldsLoading(false);
|
4027
4056
|
});
|
4028
|
-
|
4029
|
-
setResolvedFields(defaultFields);
|
4057
|
+
return;
|
4030
4058
|
}
|
4031
4059
|
}
|
4060
|
+
setResolvedFields(defaultFields);
|
4032
4061
|
}, [
|
4033
4062
|
data,
|
4034
4063
|
defaultFields,
|
package/dist/index.mjs
CHANGED
@@ -1689,29 +1689,57 @@ import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
1689
1689
|
init_react_import();
|
1690
1690
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
1691
1691
|
|
1692
|
+
// lib/filter-data-attrs.ts
|
1693
|
+
init_react_import();
|
1694
|
+
var dataAttrRe = /^(data-.*)$/;
|
1695
|
+
var filterDataAttrs = (props) => {
|
1696
|
+
let filteredProps = {};
|
1697
|
+
for (const prop in props) {
|
1698
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) && dataAttrRe.test(prop)) {
|
1699
|
+
filteredProps[prop] = props[prop];
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
return filteredProps;
|
1703
|
+
};
|
1704
|
+
|
1692
1705
|
// components/Button/Button.tsx
|
1693
1706
|
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
1694
1707
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1695
|
-
var Button = ({
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1708
|
+
var Button = (_a) => {
|
1709
|
+
var _b = _a, {
|
1710
|
+
children,
|
1711
|
+
href,
|
1712
|
+
onClick,
|
1713
|
+
variant = "primary",
|
1714
|
+
type,
|
1715
|
+
disabled,
|
1716
|
+
tabIndex,
|
1717
|
+
newTab,
|
1718
|
+
fullWidth,
|
1719
|
+
icon,
|
1720
|
+
size = "medium",
|
1721
|
+
loading: loadingProp = false
|
1722
|
+
} = _b, props = __objRest(_b, [
|
1723
|
+
"children",
|
1724
|
+
"href",
|
1725
|
+
"onClick",
|
1726
|
+
"variant",
|
1727
|
+
"type",
|
1728
|
+
"disabled",
|
1729
|
+
"tabIndex",
|
1730
|
+
"newTab",
|
1731
|
+
"fullWidth",
|
1732
|
+
"icon",
|
1733
|
+
"size",
|
1734
|
+
"loading"
|
1735
|
+
]);
|
1709
1736
|
const [loading, setLoading] = useState7(loadingProp);
|
1710
1737
|
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
1711
1738
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1739
|
+
const dataAttrs = filterDataAttrs(props);
|
1712
1740
|
const el = /* @__PURE__ */ jsxs6(
|
1713
1741
|
ElementType,
|
1714
|
-
{
|
1742
|
+
__spreadProps(__spreadValues({
|
1715
1743
|
className: getClassName9({
|
1716
1744
|
primary: variant === "primary",
|
1717
1745
|
secondary: variant === "secondary",
|
@@ -1731,13 +1759,14 @@ var Button = ({
|
|
1731
1759
|
tabIndex,
|
1732
1760
|
target: newTab ? "_blank" : void 0,
|
1733
1761
|
rel: newTab ? "noreferrer" : void 0,
|
1734
|
-
href
|
1762
|
+
href
|
1763
|
+
}, dataAttrs), {
|
1735
1764
|
children: [
|
1736
1765
|
icon && /* @__PURE__ */ jsx14("div", { className: getClassName9("icon"), children: icon }),
|
1737
1766
|
children,
|
1738
1767
|
loading && /* @__PURE__ */ jsx14("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx14(Loader, { size: 14 }) })
|
1739
1768
|
]
|
1740
|
-
}
|
1769
|
+
})
|
1741
1770
|
);
|
1742
1771
|
return el;
|
1743
1772
|
};
|
@@ -3001,7 +3030,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3001
3030
|
DraggableComponent,
|
3002
3031
|
{
|
3003
3032
|
label,
|
3004
|
-
id: `draggable-${componentId}`,
|
3033
|
+
id: `draggable-${componentId}::${item.type}`,
|
3005
3034
|
index: i,
|
3006
3035
|
isSelected,
|
3007
3036
|
isLocked: userIsDragging,
|
@@ -3864,10 +3893,10 @@ var useResolvedFields = () => {
|
|
3864
3893
|
setResolvedFields(fields || {});
|
3865
3894
|
setFieldsLoading(false);
|
3866
3895
|
});
|
3867
|
-
|
3868
|
-
setResolvedFields(defaultFields);
|
3896
|
+
return;
|
3869
3897
|
}
|
3870
3898
|
}
|
3899
|
+
setResolvedFields(defaultFields);
|
3871
3900
|
}, [
|
3872
3901
|
data,
|
3873
3902
|
defaultFields,
|
package/package.json
CHANGED