@paroicms/react-ui 0.5.11 → 0.5.13
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/dist/MenuItem.js +4 -3
- package/package.json +1 -1
- package/styles/Dialog.css +2 -2
- package/styles/MenuItem.css +43 -28
- package/styles/PasswordInput.css +1 -0
- package/styles/PopupMenu.css +1 -1
- package/styles/theme/tokens.css +1 -1
package/dist/MenuItem.js
CHANGED
|
@@ -4,15 +4,16 @@ import { clsx } from "clsx";
|
|
|
4
4
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
5
5
|
import { PopupMenu } from "./PopupMenu.js";
|
|
6
6
|
export function MenuItem({ item, expanded, onToggle }) {
|
|
7
|
-
let { key
|
|
7
|
+
let { key, label, icon, url, command, popupMenu, className, style, active, disabled } = item;
|
|
8
8
|
if (disabled) {
|
|
9
9
|
url = undefined;
|
|
10
10
|
command = undefined;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
const iconWrapper = icon ? _jsx("span", { className: "PaMenuItem-icon", children: icon }) : undefined;
|
|
13
|
+
return (_jsxs("div", { className: clsx("PaMenuItem", { active }, className), style: style, children: [expanded !== undefined && onToggle && command ? (_jsx("button", { className: "PaMenuItem-left toggle", onClick: () => onToggle(!expanded), type: "button", children: expanded ? _jsx(ChevronDown, { size: 20 }) : _jsx(ChevronRight, { size: 20 }) })) : undefined, url ? (_jsxs("a", { className: clsx("PaMenuItem-label", { disabled }), href: url, onClick: url && command
|
|
13
14
|
? (ev) => {
|
|
14
15
|
ev.preventDefault();
|
|
15
16
|
command?.();
|
|
16
17
|
}
|
|
17
|
-
: undefined, children: label })) : command ? (
|
|
18
|
+
: undefined, children: [iconWrapper, label] })) : command || url ? (_jsxs("button", { className: "PaMenuItem-label", onClick: command, type: "button", disabled: disabled, children: [iconWrapper, label] })) : onToggle && expanded !== undefined ? (_jsxs("button", { className: "PaMenuItem-label", onClick: () => onToggle(!expanded), type: "button", disabled: disabled, children: [_jsx("span", { className: "PaMenuItem-inlineToggle", children: expanded ? _jsx(ChevronDown, { size: 20 }) : _jsx(ChevronRight, { size: 20 }) }), iconWrapper, label] })) : (_jsxs("span", { className: clsx("PaMenuItem-label", { disabled }), children: [iconWrapper, label] })), popupMenu && _jsx(PopupMenu, { className: "PaMenuItem-popup", items: popupMenu })] }, key));
|
|
18
19
|
}
|
package/package.json
CHANGED
package/styles/Dialog.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Dialog Component
|
|
3
3
|
======================================== */
|
|
4
4
|
.PaDialog {
|
|
5
|
-
max-width:
|
|
5
|
+
max-width: 90dvw;
|
|
6
6
|
padding: 0;
|
|
7
7
|
background: var(--color-bg-elevated);
|
|
8
8
|
border: none;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&:modal {
|
|
18
|
-
max-height:
|
|
18
|
+
max-height: 90dvh;
|
|
19
19
|
margin: auto;
|
|
20
20
|
}
|
|
21
21
|
|
package/styles/MenuItem.css
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
.PaMenuItem-left {
|
|
14
14
|
display: flex;
|
|
15
|
+
flex-shrink: 0;
|
|
15
16
|
align-items: center;
|
|
16
17
|
justify-content: center;
|
|
17
18
|
width: 38px;
|
|
@@ -20,21 +21,15 @@
|
|
|
20
21
|
cursor: pointer;
|
|
21
22
|
background: transparent;
|
|
22
23
|
border: none;
|
|
23
|
-
|
|
24
|
-
&.toggle {
|
|
25
|
-
padding: var(--space-2) var(--space-3);
|
|
26
|
-
|
|
27
|
-
/* &:hover {
|
|
28
|
-
background: var(--color-bg-subtle);
|
|
29
|
-
} */
|
|
30
|
-
}
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
.PaMenuItem-label {
|
|
34
27
|
display: flex;
|
|
35
28
|
flex: 1;
|
|
29
|
+
gap: var(--space-2);
|
|
36
30
|
align-items: center;
|
|
37
31
|
padding: var(--space-2);
|
|
32
|
+
overflow: hidden;
|
|
38
33
|
font-family: inherit;
|
|
39
34
|
font-size: inherit;
|
|
40
35
|
color: inherit;
|
|
@@ -51,39 +46,56 @@
|
|
|
51
46
|
cursor: not-allowed;
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
/* Only apply hover to clickable elements (a, button) */
|
|
55
|
-
/* &:is(a, button):hover {
|
|
56
|
-
background: var(--color-bg-subtle);
|
|
57
|
-
} */
|
|
58
|
-
|
|
59
|
-
/* Non-clickable span elements */
|
|
60
49
|
&:is(span) {
|
|
61
50
|
cursor: default;
|
|
62
51
|
}
|
|
63
52
|
}
|
|
64
53
|
|
|
65
54
|
.PaMenuItem-popup {
|
|
55
|
+
flex-shrink: 0;
|
|
66
56
|
align-self: center;
|
|
67
57
|
margin-left: auto;
|
|
68
58
|
}
|
|
69
59
|
|
|
60
|
+
.PaMenuItem-icon {
|
|
61
|
+
display: flex;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.PaMenuItem-inlineToggle {
|
|
65
|
+
display: flex;
|
|
66
|
+
}
|
|
67
|
+
|
|
70
68
|
/* ========================================
|
|
71
69
|
MenuItem in Sidebar Context
|
|
72
70
|
======================================== */
|
|
73
71
|
._paSidebar {
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
.PaMenuItem-left {
|
|
73
|
+
width: 45px;
|
|
74
|
+
padding-left: var(--space-5);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
color: var(--color-text-sidebar-muted);
|
|
77
|
+
.PaMenuItem-label {
|
|
78
|
+
padding: var(--space-3) var(--space-2);
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
padding: var(--space-
|
|
80
|
+
&:first-child {
|
|
81
|
+
padding-left: var(--space-5);
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
&:
|
|
84
|
+
&:last-child {
|
|
85
|
+
padding-right: var(--space-5);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.PaMenuItem-icon {
|
|
90
|
+
margin-right: var(--space-2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Dark Sidebar */
|
|
94
|
+
&._dark .PaMenuItem {
|
|
95
|
+
color: var(--color-text-sidebar-muted);
|
|
96
|
+
|
|
97
|
+
&:not(.disabled) .PaMenuItem-label:is(a, button):hover,
|
|
98
|
+
&:not(.disabled) .PaMenuItem-popup:is(a, button):hover {
|
|
87
99
|
color: #fff;
|
|
88
100
|
background: var(--color-hover-sidebar-dark);
|
|
89
101
|
}
|
|
@@ -99,7 +111,8 @@
|
|
|
99
111
|
background: var(--color-primary);
|
|
100
112
|
}
|
|
101
113
|
|
|
102
|
-
&.active:not(.disabled) .PaMenuItem-label:is(a, button):hover
|
|
114
|
+
&.active:not(.disabled) .PaMenuItem-label:is(a, button):hover,
|
|
115
|
+
&.active:not(.disabled) .PaMenuItem-popup:is(a, button):hover {
|
|
103
116
|
color: var(--color-text-inverse);
|
|
104
117
|
background: var(--color-primary-hover);
|
|
105
118
|
}
|
|
@@ -111,14 +124,15 @@
|
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
/* Light Sidebar */
|
|
114
|
-
&.
|
|
127
|
+
&._light .PaMenuItem {
|
|
115
128
|
color: var(--color-text-muted);
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
&:not(.disabled) .PaMenuItem-popup:is(a, button) {
|
|
131
|
+
color: #eee;
|
|
119
132
|
}
|
|
120
133
|
|
|
121
|
-
&:not(.disabled) .PaMenuItem-label:is(a, button):hover
|
|
134
|
+
&:not(.disabled) .PaMenuItem-label:is(a, button):hover,
|
|
135
|
+
&:not(.disabled) .PaMenuItem-popup:is(a, button):hover {
|
|
122
136
|
color: var(--color-text);
|
|
123
137
|
background: var(--color-hover-sidebar-light);
|
|
124
138
|
}
|
|
@@ -134,7 +148,8 @@
|
|
|
134
148
|
background: var(--color-primary);
|
|
135
149
|
}
|
|
136
150
|
|
|
137
|
-
&.active:not(.disabled) .PaMenuItem-label:is(a, button):hover
|
|
151
|
+
&.active:not(.disabled) .PaMenuItem-label:is(a, button):hover,
|
|
152
|
+
&.active:not(.disabled) .PaMenuItem-popup:is(a, button):hover {
|
|
138
153
|
color: var(--color-text-inverse);
|
|
139
154
|
background: var(--color-primary-hover);
|
|
140
155
|
}
|
package/styles/PasswordInput.css
CHANGED
package/styles/PopupMenu.css
CHANGED
package/styles/theme/tokens.css
CHANGED