@measured/puck 0.17.1 → 0.17.2-canary.bbe0a8d
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -17
- package/dist/index.mjs +46 -17
- package/package.json +1 -1
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
@@ -1801,29 +1801,57 @@ var import_react10 = require("react");
|
|
1801
1801
|
init_react_import();
|
1802
1802
|
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" };
|
1803
1803
|
|
1804
|
+
// lib/filter-data-attrs.ts
|
1805
|
+
init_react_import();
|
1806
|
+
var dataAttrRe = /^(data-.*)$/;
|
1807
|
+
var filterDataAttrs = (props) => {
|
1808
|
+
let filteredProps = {};
|
1809
|
+
for (const prop in props) {
|
1810
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) && dataAttrRe.test(prop)) {
|
1811
|
+
filteredProps[prop] = props[prop];
|
1812
|
+
}
|
1813
|
+
}
|
1814
|
+
return filteredProps;
|
1815
|
+
};
|
1816
|
+
|
1804
1817
|
// components/Button/Button.tsx
|
1805
1818
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
1806
1819
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1807
|
-
var Button = ({
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1820
|
+
var Button = (_a) => {
|
1821
|
+
var _b = _a, {
|
1822
|
+
children,
|
1823
|
+
href,
|
1824
|
+
onClick,
|
1825
|
+
variant = "primary",
|
1826
|
+
type,
|
1827
|
+
disabled,
|
1828
|
+
tabIndex,
|
1829
|
+
newTab,
|
1830
|
+
fullWidth,
|
1831
|
+
icon,
|
1832
|
+
size = "medium",
|
1833
|
+
loading: loadingProp = false
|
1834
|
+
} = _b, props = __objRest(_b, [
|
1835
|
+
"children",
|
1836
|
+
"href",
|
1837
|
+
"onClick",
|
1838
|
+
"variant",
|
1839
|
+
"type",
|
1840
|
+
"disabled",
|
1841
|
+
"tabIndex",
|
1842
|
+
"newTab",
|
1843
|
+
"fullWidth",
|
1844
|
+
"icon",
|
1845
|
+
"size",
|
1846
|
+
"loading"
|
1847
|
+
]);
|
1821
1848
|
const [loading, setLoading] = (0, import_react10.useState)(loadingProp);
|
1822
1849
|
(0, import_react10.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
1823
1850
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1851
|
+
const dataAttrs = filterDataAttrs(props);
|
1824
1852
|
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
1825
1853
|
ElementType,
|
1826
|
-
{
|
1854
|
+
__spreadProps(__spreadValues({
|
1827
1855
|
className: getClassName9({
|
1828
1856
|
primary: variant === "primary",
|
1829
1857
|
secondary: variant === "secondary",
|
@@ -1843,13 +1871,14 @@ var Button = ({
|
|
1843
1871
|
tabIndex,
|
1844
1872
|
target: newTab ? "_blank" : void 0,
|
1845
1873
|
rel: newTab ? "noreferrer" : void 0,
|
1846
|
-
href
|
1874
|
+
href
|
1875
|
+
}, dataAttrs), {
|
1847
1876
|
children: [
|
1848
1877
|
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
1849
1878
|
children,
|
1850
1879
|
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 14 }) })
|
1851
1880
|
]
|
1852
|
-
}
|
1881
|
+
})
|
1853
1882
|
);
|
1854
1883
|
return el;
|
1855
1884
|
};
|
package/dist/index.mjs
CHANGED
@@ -1619,29 +1619,57 @@ import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
1619
1619
|
init_react_import();
|
1620
1620
|
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" };
|
1621
1621
|
|
1622
|
+
// lib/filter-data-attrs.ts
|
1623
|
+
init_react_import();
|
1624
|
+
var dataAttrRe = /^(data-.*)$/;
|
1625
|
+
var filterDataAttrs = (props) => {
|
1626
|
+
let filteredProps = {};
|
1627
|
+
for (const prop in props) {
|
1628
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) && dataAttrRe.test(prop)) {
|
1629
|
+
filteredProps[prop] = props[prop];
|
1630
|
+
}
|
1631
|
+
}
|
1632
|
+
return filteredProps;
|
1633
|
+
};
|
1634
|
+
|
1622
1635
|
// components/Button/Button.tsx
|
1623
1636
|
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
1624
1637
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1625
|
-
var Button = ({
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1638
|
+
var Button = (_a) => {
|
1639
|
+
var _b = _a, {
|
1640
|
+
children,
|
1641
|
+
href,
|
1642
|
+
onClick,
|
1643
|
+
variant = "primary",
|
1644
|
+
type,
|
1645
|
+
disabled,
|
1646
|
+
tabIndex,
|
1647
|
+
newTab,
|
1648
|
+
fullWidth,
|
1649
|
+
icon,
|
1650
|
+
size = "medium",
|
1651
|
+
loading: loadingProp = false
|
1652
|
+
} = _b, props = __objRest(_b, [
|
1653
|
+
"children",
|
1654
|
+
"href",
|
1655
|
+
"onClick",
|
1656
|
+
"variant",
|
1657
|
+
"type",
|
1658
|
+
"disabled",
|
1659
|
+
"tabIndex",
|
1660
|
+
"newTab",
|
1661
|
+
"fullWidth",
|
1662
|
+
"icon",
|
1663
|
+
"size",
|
1664
|
+
"loading"
|
1665
|
+
]);
|
1639
1666
|
const [loading, setLoading] = useState7(loadingProp);
|
1640
1667
|
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
1641
1668
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1669
|
+
const dataAttrs = filterDataAttrs(props);
|
1642
1670
|
const el = /* @__PURE__ */ jsxs6(
|
1643
1671
|
ElementType,
|
1644
|
-
{
|
1672
|
+
__spreadProps(__spreadValues({
|
1645
1673
|
className: getClassName9({
|
1646
1674
|
primary: variant === "primary",
|
1647
1675
|
secondary: variant === "secondary",
|
@@ -1661,13 +1689,14 @@ var Button = ({
|
|
1661
1689
|
tabIndex,
|
1662
1690
|
target: newTab ? "_blank" : void 0,
|
1663
1691
|
rel: newTab ? "noreferrer" : void 0,
|
1664
|
-
href
|
1692
|
+
href
|
1693
|
+
}, dataAttrs), {
|
1665
1694
|
children: [
|
1666
1695
|
icon && /* @__PURE__ */ jsx13("div", { className: getClassName9("icon"), children: icon }),
|
1667
1696
|
children,
|
1668
1697
|
loading && /* @__PURE__ */ jsx13("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx13(Loader, { size: 14 }) })
|
1669
1698
|
]
|
1670
|
-
}
|
1699
|
+
})
|
1671
1700
|
);
|
1672
1701
|
return el;
|
1673
1702
|
};
|
package/package.json
CHANGED