uibee 2.4.10 → 2.4.11

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.
@@ -4,12 +4,10 @@ import { ChevronDown } from 'lucide-react';
4
4
  import React, { useRef, useState } from 'react';
5
5
  export default function NavDropdown({ children, title, className }) {
6
6
  const [isMobileDropdownOpen, setIsMobileDropdownOpen] = useState(false);
7
+ const [isDesktopOpen, setIsDesktopOpen] = useState(false);
7
8
  const navItemRef = useRef(null);
8
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: 'relative group hidden 800px:block', children: _jsxs("div", { className: 'outline-none', tabIndex: 0, ref: navItemRef, children: [_jsxs("div", { className: `list-none no-underline text-base leading-4 p-3 font-bold cursor-pointer flex flex-row items-center
9
- transition-colors`, children: [title, _jsx(ChevronDown, { className: 'w-6 h-6 stroke-login ml-1 text-2xl transition-transform duration-300 ease-in-out' })] }), _jsx("div", { className: `absolute pt-2 -ml-4 -translate-y-4 opacity-0 pointer-events-none
10
- transition-all duration-200 ease-in-out z-10
11
- group-hover:opacity-100 group-hover:pointer-events-auto group-hover:translate-y-0
12
- group-focus-within:opacity-100 group-focus-within:pointer-events-auto group-focus-within:translate-y-0`, children: _jsx("ul", { className: `p-3 px-6 pb-4 rounded-[0.4rem] shadow-[0_0.1rem_0.5rem_rgba(3,3,3,0.5)] bg-login-700/98 ${className || ''}`, onClick: () => navItemRef.current?.blur(), children: React.Children.map(children, (child, index) => (_jsx("div", { onClick: () => navItemRef.current?.blur(), className: 'group dropdown', children: child }, index))) }) })] }) }), _jsxs("div", { className: 'block 800px:hidden!', children: [_jsx("button", { className: 'bg-none border-none cursor-pointer w-full text-left', onClick: (e) => {
9
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: 'relative hidden 800px:block', children: _jsxs("div", { className: 'outline-none', tabIndex: 0, ref: navItemRef, onMouseEnter: () => setIsDesktopOpen(true), onMouseLeave: () => setIsDesktopOpen(false), onFocus: () => setIsDesktopOpen(true), onBlur: () => setIsDesktopOpen(false), children: [_jsxs("div", { className: `list-none no-underline text-base leading-4 p-3 font-bold cursor-pointer flex flex-row items-center
10
+ transition-colors`, children: [title, _jsx(ChevronDown, { className: 'w-6 h-6 stroke-login ml-1 text-2xl transition-transform duration-300 ease-in-out' })] }), _jsx("div", { className: `absolute pt-2 -ml-4 transition-all duration-200 ease-in-out z-10 ${isDesktopOpen ? 'opacity-100 pointer-events-auto translate-y-0' : 'opacity-0 pointer-events-none -translate-y-4'}`, children: _jsx("ul", { className: `p-3 px-6 pb-4 rounded-[0.4rem] shadow-[0_0.1rem_0.5rem_rgba(3,3,3,0.5)] bg-login-700/98 ${className || ''}`, onClick: () => setIsDesktopOpen(false), children: React.Children.map(children, (child, index) => (_jsx("div", { onClick: () => setIsDesktopOpen(false), className: 'group dropdown', children: child }, index))) }) })] }) }), _jsxs("div", { className: 'block 800px:hidden!', children: [_jsx("button", { className: 'bg-none border-none cursor-pointer w-full text-left', onClick: (e) => {
13
11
  e.stopPropagation();
14
12
  setIsMobileDropdownOpen(!isMobileDropdownOpen);
15
13
  }, children: _jsxs("li", { className: `list-none no-underline text-2xl leading-6 overflow-hidden
@@ -212,6 +212,9 @@
212
212
  }
213
213
  }
214
214
  @layer utilities {
215
+ .pointer-events-auto {
216
+ pointer-events: auto;
217
+ }
215
218
  .pointer-events-none {
216
219
  pointer-events: none;
217
220
  }
@@ -1075,44 +1078,6 @@
1075
1078
  --tw-outline-style: none;
1076
1079
  outline-style: none;
1077
1080
  }
1078
- .group-focus-within\:pointer-events-auto {
1079
- &:is(:where(.group):focus-within *) {
1080
- pointer-events: auto;
1081
- }
1082
- }
1083
- .group-focus-within\:translate-y-0 {
1084
- &:is(:where(.group):focus-within *) {
1085
- --tw-translate-y: calc(var(--spacing) * 0);
1086
- translate: var(--tw-translate-x) var(--tw-translate-y);
1087
- }
1088
- }
1089
- .group-focus-within\:opacity-100 {
1090
- &:is(:where(.group):focus-within *) {
1091
- opacity: 100%;
1092
- }
1093
- }
1094
- .group-hover\:pointer-events-auto {
1095
- &:is(:where(.group):hover *) {
1096
- @media (hover: hover) {
1097
- pointer-events: auto;
1098
- }
1099
- }
1100
- }
1101
- .group-hover\:translate-y-0 {
1102
- &:is(:where(.group):hover *) {
1103
- @media (hover: hover) {
1104
- --tw-translate-y: calc(var(--spacing) * 0);
1105
- translate: var(--tw-translate-x) var(--tw-translate-y);
1106
- }
1107
- }
1108
- }
1109
- .group-hover\:opacity-100 {
1110
- &:is(:where(.group):hover *) {
1111
- @media (hover: hover) {
1112
- opacity: 100%;
1113
- }
1114
- }
1115
- }
1116
1081
  .group-\[\.dropdown\]\:h-auto {
1117
1082
  &:is(:where(.group):is(.dropdown) *) {
1118
1083
  height: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -11,33 +11,38 @@ export type NavDropdownProps = {
11
11
 
12
12
  export default function NavDropdown({ children, title, className }: NavDropdownProps) {
13
13
  const [isMobileDropdownOpen, setIsMobileDropdownOpen] = useState(false)
14
+ const [isDesktopOpen, setIsDesktopOpen] = useState(false)
14
15
  const navItemRef = useRef<HTMLDivElement>(null)
15
16
 
16
17
  return (
17
18
  <>
18
19
  {/* Desktop Dropdown */}
19
- <div className={'relative group hidden 800px:block'}>
20
- <div className='outline-none' tabIndex={0} ref={navItemRef}>
20
+ <div className={'relative hidden 800px:block'}>
21
+ <div className='outline-none' tabIndex={0} ref={navItemRef}
22
+ onMouseEnter={() => setIsDesktopOpen(true)}
23
+ onMouseLeave={() => setIsDesktopOpen(false)}
24
+ onFocus={() => setIsDesktopOpen(true)}
25
+ onBlur={() => setIsDesktopOpen(false)}
26
+ >
21
27
  <div className={`list-none no-underline text-base leading-4 p-3 font-bold cursor-pointer flex flex-row items-center
22
28
  transition-colors`
23
29
  }>
24
30
  {title}
25
31
  <ChevronDown className={'w-6 h-6 stroke-login ml-1 text-2xl transition-transform duration-300 ease-in-out'} />
26
32
  </div>
27
- <div className={`absolute pt-2 -ml-4 -translate-y-4 opacity-0 pointer-events-none
28
- transition-all duration-200 ease-in-out z-10
29
- group-hover:opacity-100 group-hover:pointer-events-auto group-hover:translate-y-0
30
- group-focus-within:opacity-100 group-focus-within:pointer-events-auto group-focus-within:translate-y-0`}
33
+ <div className={`absolute pt-2 -ml-4 transition-all duration-200 ease-in-out z-10 ${
34
+ isDesktopOpen ? 'opacity-100 pointer-events-auto translate-y-0' : 'opacity-0 pointer-events-none -translate-y-4'
35
+ }`}
31
36
  >
32
37
  <ul
33
38
  className={`p-3 px-6 pb-4 rounded-[0.4rem] shadow-[0_0.1rem_0.5rem_rgba(3,3,3,0.5)] bg-login-700/98 ${
34
39
  className || ''}`}
35
- onClick={() => navItemRef.current?.blur()}
40
+ onClick={() => setIsDesktopOpen(false)}
36
41
  >
37
42
  {React.Children.map(children, (child, index) => (
38
43
  <div
39
44
  key={index}
40
- onClick={() => navItemRef.current?.blur()}
45
+ onClick={() => setIsDesktopOpen(false)}
41
46
  className='group dropdown'
42
47
  >
43
48
  {child}