@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.
Files changed (40) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +24 -3
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/ui-kit/Button/ButtonContent.d.ts +1 -0
  5. package/bundle/ui-kit/Button/useFormSubmit.d.ts +3 -0
  6. package/dist/ui-kit/Button/Button.js +4 -2
  7. package/dist/ui-kit/Button/Button.js.map +1 -1
  8. package/dist/ui-kit/Button/ButtonContent.d.ts +1 -0
  9. package/dist/ui-kit/Button/useFormSubmit.d.ts +3 -0
  10. package/dist/ui-kit/Button/useFormSubmit.js +24 -0
  11. package/dist/ui-kit/Button/useFormSubmit.js.map +1 -0
  12. package/lib/ui-kit/Button/Button.js +4 -2
  13. package/lib/ui-kit/Button/Button.js.map +1 -1
  14. package/lib/ui-kit/Button/ButtonContent.d.ts +1 -0
  15. package/lib/ui-kit/Button/useFormSubmit.d.ts +3 -0
  16. package/lib/ui-kit/Button/useFormSubmit.js +21 -0
  17. package/lib/ui-kit/Button/useFormSubmit.js.map +1 -0
  18. package/mobile/bundle/bundle.umd.js +24 -3
  19. package/mobile/bundle/bundle.umd.min.js +1 -1
  20. package/mobile/bundle/ui-kit/Button/ButtonContent.d.ts +1 -0
  21. package/mobile/bundle/ui-kit/Button/useFormSubmit.d.ts +3 -0
  22. package/mobile/dist/ui-kit/Button/Button.js +4 -2
  23. package/mobile/dist/ui-kit/Button/Button.js.map +1 -1
  24. package/mobile/dist/ui-kit/Button/ButtonContent.d.ts +1 -0
  25. package/mobile/dist/ui-kit/Button/useFormSubmit.d.ts +3 -0
  26. package/mobile/dist/ui-kit/Button/useFormSubmit.js +24 -0
  27. package/mobile/dist/ui-kit/Button/useFormSubmit.js.map +1 -0
  28. package/mobile/lib/ui-kit/Button/Button.js +4 -2
  29. package/mobile/lib/ui-kit/Button/Button.js.map +1 -1
  30. package/mobile/lib/ui-kit/Button/ButtonContent.d.ts +1 -0
  31. package/mobile/lib/ui-kit/Button/useFormSubmit.d.ts +3 -0
  32. package/mobile/lib/ui-kit/Button/useFormSubmit.js +21 -0
  33. package/mobile/lib/ui-kit/Button/useFormSubmit.js.map +1 -0
  34. package/mobile/src/ui-kit/Button/Button.tsx +5 -2
  35. package/mobile/src/ui-kit/Button/ButtonContent.ts +1 -0
  36. package/mobile/src/ui-kit/Button/useFormSubmit.ts +30 -0
  37. package/package.json +1 -1
  38. package/src/ui-kit/Button/Button.tsx +5 -2
  39. package/src/ui-kit/Button/ButtonContent.ts +1 -0
  40. package/src/ui-kit/Button/useFormSubmit.ts +30 -0
@@ -672,9 +672,30 @@
672
672
  className,
673
673
  ].join(' ');
674
674
 
675
- const Button = JSX(({ disabled, children, ...rest }) => {
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.36";
5821
+ const packageVersion = "0.14.38";
5801
5822
 
5802
5823
  exports.Blocks = Blocks;
5803
5824
  exports.ContentPage = ContentPage;