@redneckz/wildless-cms-uni-blocks 0.14.431 → 0.14.432

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.
@@ -4380,9 +4380,31 @@
4380
4380
  const DropdownMenu = JSX(({ className = '', items, activeItem, ariaLabel }) => {
4381
4381
  const [isVisible, { setFalse, toggle }] = useBool(false);
4382
4382
  const ref = useOutsideClick(setFalse);
4383
- return (jsxs("div", { className: style(isVisible ? 'bg-white rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, children: Array(3)
4383
+ const dropdownRef = useRef(null);
4384
+ const changeDropdownPosition = useCallback((isOpened, buttonRef, menuRef) => {
4385
+ if (isOpened) {
4386
+ const dropdownRect = menuRef?.current?.getBoundingClientRect();
4387
+ const dropdownButtonRect = buttonRef?.current?.getBoundingClientRect();
4388
+ if (menuRef.current && dropdownRect && dropdownButtonRect) {
4389
+ if (dropdownRect?.right >= globalThis.innerWidth) {
4390
+ menuRef.current.style.left = `${globalThis.innerWidth - dropdownRect.width}px`;
4391
+ }
4392
+ else if (dropdownButtonRect?.left > dropdownRect.left) {
4393
+ menuRef.current.style.left = `${globalThis.innerWidth - dropdownRect.width}px`;
4394
+ }
4395
+ else {
4396
+ menuRef.current.style.left = '';
4397
+ }
4398
+ }
4399
+ }
4400
+ }, [isVisible]);
4401
+ useEventListener(globalThis, 'resize', () => changeDropdownPosition(isVisible, ref, dropdownRef));
4402
+ useEffect(() => {
4403
+ changeDropdownPosition(isVisible, ref, dropdownRef);
4404
+ }, [isVisible]);
4405
+ return (jsxs("div", { className: style(isVisible ? 'rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, children: Array(3)
4384
4406
  .fill(null)
4385
- .map((_, i) => (jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), jsx("div", { className: style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40 translate-x-[-100%]', isVisible ? '' : 'hidden'), "aria-hidden": !isVisible, children: items?.map((item, i) => (jsx(DropdownMenuItem, { isActive: item === activeItem, ...item }, item?.text ?? String(i)))) })] }));
4407
+ .map((_, i) => (jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), jsx("div", { ref: dropdownRef, className: style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', isVisible ? '' : 'hidden'), "aria-hidden": !isVisible, children: items?.map((item, i) => (jsx(DropdownMenuItem, { isActive: item === activeItem, ...item }, item?.text ?? String(i)))) })] }));
4386
4408
  });
4387
4409
  const DropdownMenuItem = JSX(({ isActive, ...rest }) => {
4388
4410
  const link = useLink();
@@ -6490,7 +6512,7 @@
6490
6512
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6491
6513
  });
6492
6514
 
6493
- const packageVersion = "0.14.430";
6515
+ const packageVersion = "0.14.431";
6494
6516
 
6495
6517
  exports.Blocks = Blocks;
6496
6518
  exports.ContentPage = ContentPage;