@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 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: id, label, icon, url, command, popupMenu, className, style, active, disabled } = item;
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
- return (_jsxs("div", { className: clsx("PaMenuItem", { active }, className), style: style, children: [expanded !== undefined && onToggle ? (_jsx("button", { className: "PaMenuItem-left toggle", onClick: () => onToggle(!expanded), type: "button", children: expanded ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 }) })) : icon ? (_jsx("div", { className: "PaMenuItem-left icon", children: icon })) : undefined, url ? (_jsx("a", { className: clsx("PaMenuItem-label", { disabled }), href: url, onClick: url && command
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 ? (_jsx("button", { className: "PaMenuItem-label", onClick: command, type: "button", disabled: disabled, children: label })) : (_jsx("span", { className: clsx("PaMenuItem-label", { disabled }), children: label })), popupMenu && _jsx(PopupMenu, { className: "PaMenuItem-popup", items: popupMenu })] }, id));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/react-ui",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "React UI toolkit for ParoiCMS.",
5
5
  "keywords": [
6
6
  "paroicms",
package/styles/Dialog.css CHANGED
@@ -2,7 +2,7 @@
2
2
  Dialog Component
3
3
  ======================================== */
4
4
  .PaDialog {
5
- max-width: 90vw;
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: 90vh;
18
+ max-height: 90dvh;
19
19
  margin: auto;
20
20
  }
21
21
 
@@ -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
- & .PaMenuItem {
75
- padding: 0 var(--space-2);
72
+ .PaMenuItem-left {
73
+ width: 45px;
74
+ padding-left: var(--space-5);
76
75
  }
77
76
 
78
- /* Dark Sidebar */
79
- &.dark .PaMenuItem {
80
- color: var(--color-text-sidebar-muted);
77
+ .PaMenuItem-label {
78
+ padding: var(--space-3) var(--space-2);
81
79
 
82
- & .PaMenuItem-label {
83
- padding: var(--space-3) var(--space-2);
80
+ &:first-child {
81
+ padding-left: var(--space-5);
84
82
  }
85
83
 
86
- &:not(.disabled) .PaMenuItem-label:is(a, button):hover {
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
- &.light .PaMenuItem {
127
+ &._light .PaMenuItem {
115
128
  color: var(--color-text-muted);
116
129
 
117
- & .PaMenuItem-label {
118
- padding: var(--space-3) var(--space-2);
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
  }
@@ -11,6 +11,7 @@
11
11
  position: relative;
12
12
  display: flex;
13
13
  align-self: flex-start;
14
+ width: 100%;
14
15
 
15
16
  &.error .PaPasswordInput-input {
16
17
  border-color: var(--color-danger);
@@ -4,7 +4,7 @@
4
4
  .PaPopupMenu {
5
5
  z-index: var(--z-popover);
6
6
  min-width: 160px;
7
- padding: var(--space-2);
7
+ overflow: hidden;
8
8
  background: var(--color-bg-elevated);
9
9
  border: 1px solid var(--color-border);
10
10
  border-radius: var(--radius-md);
@@ -222,7 +222,7 @@
222
222
  /* ========================================
223
223
  Dark Mode (for sidebar)
224
224
  ======================================== */
225
- .dark {
225
+ ._dark {
226
226
  --color-text: #e2e8f0;
227
227
  --color-text-light: #94a3b8;
228
228
  --color-text-muted: #cbd5e1;