@redneckz/wildless-cms-uni-blocks 0.14.37 → 0.14.39
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +24 -3
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/bundle/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/dist/ui-kit/Button/Button.js +4 -2
- package/dist/ui-kit/Button/Button.js.map +1 -1
- package/dist/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/dist/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/dist/ui-kit/Button/useFormSubmit.js +24 -0
- package/dist/ui-kit/Button/useFormSubmit.js.map +1 -0
- package/lib/ui-kit/Button/Button.js +4 -2
- package/lib/ui-kit/Button/Button.js.map +1 -1
- package/lib/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/lib/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/lib/ui-kit/Button/useFormSubmit.js +21 -0
- package/lib/ui-kit/Button/useFormSubmit.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +24 -3
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/mobile/bundle/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/mobile/dist/ui-kit/Button/Button.js +4 -2
- package/mobile/dist/ui-kit/Button/Button.js.map +1 -1
- package/mobile/dist/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/mobile/dist/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/mobile/dist/ui-kit/Button/useFormSubmit.js +24 -0
- package/mobile/dist/ui-kit/Button/useFormSubmit.js.map +1 -0
- package/mobile/lib/ui-kit/Button/Button.js +4 -2
- package/mobile/lib/ui-kit/Button/Button.js.map +1 -1
- package/mobile/lib/ui-kit/Button/ButtonContent.d.ts +1 -0
- package/mobile/lib/ui-kit/Button/useFormSubmit.d.ts +3 -0
- package/mobile/lib/ui-kit/Button/useFormSubmit.js +21 -0
- package/mobile/lib/ui-kit/Button/useFormSubmit.js.map +1 -0
- package/mobile/src/ui-kit/Button/Button.tsx +5 -2
- package/mobile/src/ui-kit/Button/ButtonContent.ts +1 -0
- package/mobile/src/ui-kit/Button/useFormSubmit.ts +30 -0
- package/package.json +1 -1
- package/src/ui-kit/Button/Button.tsx +5 -2
- package/src/ui-kit/Button/ButtonContent.ts +1 -0
- package/src/ui-kit/Button/useFormSubmit.ts +30 -0
package/bundle/bundle.umd.js
CHANGED
|
@@ -672,9 +672,30 @@
|
|
|
672
672
|
className,
|
|
673
673
|
].join(' ');
|
|
674
674
|
|
|
675
|
-
const
|
|
675
|
+
const useFormSubmit = ({ method, href }) => useCallback((ev) => {
|
|
676
|
+
if (method !== 'POST' || !href) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
ev.preventDefault();
|
|
680
|
+
const { origin, pathname, searchParams } = new URL(href || '');
|
|
681
|
+
const form = document.createElement('form');
|
|
682
|
+
form.setAttribute('method', 'POST');
|
|
683
|
+
form.setAttribute('action', [origin, pathname].join(''));
|
|
684
|
+
for (const [key, value] of searchParams.entries()) {
|
|
685
|
+
const input = document.createElement('input');
|
|
686
|
+
input.setAttribute('type', 'hidden');
|
|
687
|
+
input.setAttribute('name', key);
|
|
688
|
+
input.setAttribute('value', value);
|
|
689
|
+
form.appendChild(input);
|
|
690
|
+
}
|
|
691
|
+
document.body.appendChild(form);
|
|
692
|
+
form.submit();
|
|
693
|
+
}, []);
|
|
694
|
+
|
|
695
|
+
const Button = JSX(({ disabled, children, method = 'LINK', href, ...rest }) => {
|
|
696
|
+
const handleFormSubmit = useFormSubmit({ method, href });
|
|
676
697
|
const link = useLink();
|
|
677
|
-
const adjustedProps = link(rest);
|
|
698
|
+
const adjustedProps = link({ onClick: handleFormSubmit, href, ...rest });
|
|
678
699
|
const buttonInner = children ?? jsx(ButtonInner, { ...adjustedProps });
|
|
679
700
|
return disabled ? (jsx(DisabledButton, { ...adjustedProps, children: buttonInner })) : (jsx(RegularButton, { ...adjustedProps, children: buttonInner }));
|
|
680
701
|
});
|
|
@@ -5797,7 +5818,7 @@
|
|
|
5797
5818
|
return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
|
|
5798
5819
|
}
|
|
5799
5820
|
|
|
5800
|
-
const packageVersion = "0.14.
|
|
5821
|
+
const packageVersion = "0.14.38";
|
|
5801
5822
|
|
|
5802
5823
|
exports.Blocks = Blocks;
|
|
5803
5824
|
exports.ContentPage = ContentPage;
|