@enderfall/ui 0.2.21 → 0.2.23
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/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Dropdown.d.ts +2 -0
- package/dist/components/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown.js +3 -2
- package/package.json +1 -1
- package/src/components/Button.css +14 -5
- package/src/components/Button.tsx +1 -1
- package/src/components/Dropdown.tsx +49 -49
- package/src/components/UserMenu.css +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,OAAO,CAAC,EACJ,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,KAAK,CAAC;IACV,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAElD,KAAK,WAAW,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC3D,OAAO,CAAC,EACJ,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,KAAK,CAAC;IACV,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,8CAAyE,WAAW,4CAa1G,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const Button = ({ variant = "primary", subvariant = "
|
|
2
|
+
export const Button = ({ variant = "primary", subvariant = "hover-glow", className, ...props }) => (_jsx("button", { ...props, className: [
|
|
3
3
|
"ef-button",
|
|
4
4
|
variant,
|
|
5
5
|
subvariant === "glow" ? "ef-button--glow" : "",
|
|
@@ -12,6 +12,8 @@ export type DropdownUserItem = {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
title?: string;
|
|
14
14
|
variant?: "default" | "theme-preview";
|
|
15
|
+
buttonVariant?: "primary" | "ghost" | "locked" | "danger" | "delete" | "warning" | "info" | "success" | "tab";
|
|
16
|
+
buttonSubvariant?: "default" | "glow" | "hover-glow";
|
|
15
17
|
};
|
|
16
18
|
export type DropdownUserListItem = {
|
|
17
19
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../src/components/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7E,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../src/components/Dropdown.tsx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,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,uBAAuB,EAAE,CAAC;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACnE,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,SAAS,CAAC;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,aAAa,GACd,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,oBAAoB,CAAC;AAgFzB,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,4CA8Y5C,CAAC"}
|
|
@@ -81,12 +81,13 @@ export const Dropdown = (props) => {
|
|
|
81
81
|
return props.items.map((item, index) => {
|
|
82
82
|
const key = item.id ?? `${item.label}-${index}`;
|
|
83
83
|
if (item.variant === "theme-preview") {
|
|
84
|
-
return (_jsx(Button, { type: "button", variant: "primary", className: ["theme-preview", item.className].filter(Boolean).join(" "), onClick: () => {
|
|
84
|
+
return (_jsx(Button, { type: "button", variant: "primary", subvariant: item.buttonSubvariant ?? "default", className: ["theme-preview", item.className].filter(Boolean).join(" "), onClick: () => {
|
|
85
85
|
item.onClick();
|
|
86
86
|
setOpen(false);
|
|
87
87
|
}, disabled: item.disabled, title: item.title, children: item.label }, key));
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
const isLogoutAction = /\b(log\s*out|sign\s*out)\b/i.test(item.label);
|
|
90
|
+
return (_jsx(Button, { variant: item.buttonVariant ?? (isLogoutAction ? "danger" : "primary"), subvariant: item.buttonSubvariant ?? "hover-glow", className: ["dropdown-item", item.className].filter(Boolean).join(" "), type: "button", onClick: () => {
|
|
90
91
|
item.onClick();
|
|
91
92
|
setOpen(false);
|
|
92
93
|
}, disabled: item.disabled, title: item.title, children: item.label }, key));
|
package/package.json
CHANGED
|
@@ -67,11 +67,20 @@
|
|
|
67
67
|
--ef-button-current-glow-shadow: var(--ef-button-glow-shadow, 0 0 24px rgba(124, 77, 255, 0.45));
|
|
68
68
|
--ef-button-current-hover-shadow: var(--ef-button-hover-shadow, 0 0 18px rgba(124, 77, 255, 0.35));
|
|
69
69
|
--ef-button-current-focus-shadow: var(--ef-button-focus-shadow, 0 0 18px rgba(124, 77, 255, 0.35));
|
|
70
|
-
background:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
background: var(--ef-tab-button-surface, var(--ef-nav-surface));
|
|
71
|
+
box-shadow: var(--ef-tab-button-shadow, var(--ef-nav-shadow));
|
|
72
|
+
color: var(--ef-tab-button-text, var(--ef-nav-text));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ef-button.ghost:not(:disabled):hover {
|
|
76
|
+
background: var(--ef-tab-button-surface-hover, var(--ef-tab-button-surface, var(--ef-nav-surface)));
|
|
77
|
+
box-shadow: var(--ef-tab-button-shadow-hover, var(--ef-nav-shadow-hover));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ef-button.ghost:focus-visible {
|
|
81
|
+
background: var(--ef-tab-button-surface-hover, var(--ef-tab-button-surface, var(--ef-nav-surface)));
|
|
82
|
+
box-shadow: var(--ef-tab-button-shadow-focus, var(--ef-nav-shadow-focus));
|
|
83
|
+
}
|
|
75
84
|
|
|
76
85
|
.ef-button.locked {
|
|
77
86
|
background: var(--ef-button-locked-bg);
|
|
@@ -14,7 +14,7 @@ type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
14
14
|
subvariant?: "default" | "glow" | "hover-glow";
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const Button = ({ variant = "primary", subvariant = "
|
|
17
|
+
export const Button = ({ variant = "primary", subvariant = "hover-glow", className, ...props }: ButtonProps) => (
|
|
18
18
|
<button
|
|
19
19
|
{...props}
|
|
20
20
|
className={[
|
|
@@ -7,26 +7,26 @@ export type HeaderMenuItem = {
|
|
|
7
7
|
content: ReactNode;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type DropdownUserItem = {
|
|
11
|
-
id?: string;
|
|
12
|
-
label: string;
|
|
13
|
-
onClick: () => void;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
className?: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
variant?: "default" | "theme-preview";
|
|
18
|
-
buttonVariant?:
|
|
19
|
-
| "primary"
|
|
20
|
-
| "ghost"
|
|
21
|
-
| "locked"
|
|
22
|
-
| "danger"
|
|
23
|
-
| "delete"
|
|
24
|
-
| "warning"
|
|
25
|
-
| "info"
|
|
26
|
-
| "success"
|
|
27
|
-
| "tab";
|
|
28
|
-
buttonSubvariant?: "default" | "glow" | "hover-glow";
|
|
29
|
-
};
|
|
10
|
+
export type DropdownUserItem = {
|
|
11
|
+
id?: string;
|
|
12
|
+
label: string;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
variant?: "default" | "theme-preview";
|
|
18
|
+
buttonVariant?:
|
|
19
|
+
| "primary"
|
|
20
|
+
| "ghost"
|
|
21
|
+
| "locked"
|
|
22
|
+
| "danger"
|
|
23
|
+
| "delete"
|
|
24
|
+
| "warning"
|
|
25
|
+
| "info"
|
|
26
|
+
| "success"
|
|
27
|
+
| "tab";
|
|
28
|
+
buttonSubvariant?: "default" | "glow" | "hover-glow";
|
|
29
|
+
};
|
|
30
30
|
|
|
31
31
|
export type DropdownUserListItem = {
|
|
32
32
|
id?: string;
|
|
@@ -300,48 +300,48 @@ export const Dropdown = (props: DropdownProps) => {
|
|
|
300
300
|
: null;
|
|
301
301
|
|
|
302
302
|
const renderUserListItems = () => {
|
|
303
|
-
if (props.variant !== "user-list") {
|
|
304
|
-
return props.items.map((item, index) => {
|
|
305
|
-
const key = item.id ?? `${item.label}-${index}`;
|
|
306
|
-
if (item.variant === "theme-preview") {
|
|
307
|
-
return (
|
|
303
|
+
if (props.variant !== "user-list") {
|
|
304
|
+
return props.items.map((item, index) => {
|
|
305
|
+
const key = item.id ?? `${item.label}-${index}`;
|
|
306
|
+
if (item.variant === "theme-preview") {
|
|
307
|
+
return (
|
|
308
308
|
<Button
|
|
309
309
|
key={key}
|
|
310
310
|
type="button"
|
|
311
|
-
variant="primary"
|
|
312
|
-
subvariant={item.buttonSubvariant ?? "default"}
|
|
313
|
-
className={["theme-preview", item.className].filter(Boolean).join(" ")}
|
|
314
|
-
onClick={() => {
|
|
315
|
-
item.onClick();
|
|
316
|
-
setOpen(false);
|
|
317
|
-
}}
|
|
311
|
+
variant="primary"
|
|
312
|
+
subvariant={item.buttonSubvariant ?? "default"}
|
|
313
|
+
className={["theme-preview", item.className].filter(Boolean).join(" ")}
|
|
314
|
+
onClick={() => {
|
|
315
|
+
item.onClick();
|
|
316
|
+
setOpen(false);
|
|
317
|
+
}}
|
|
318
318
|
disabled={item.disabled}
|
|
319
319
|
title={item.title}
|
|
320
|
-
>
|
|
321
|
-
{item.label}
|
|
322
|
-
</Button>
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
const isLogoutAction = /\b(log\s*out|sign\s*out)\b/i.test(item.label);
|
|
326
|
-
return (
|
|
320
|
+
>
|
|
321
|
+
{item.label}
|
|
322
|
+
</Button>
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
const isLogoutAction = /\b(log\s*out|sign\s*out)\b/i.test(item.label);
|
|
326
|
+
return (
|
|
327
327
|
<Button
|
|
328
328
|
key={key}
|
|
329
329
|
variant={item.buttonVariant ?? (isLogoutAction ? "danger" : "primary")}
|
|
330
|
-
subvariant={item.buttonSubvariant ?? "
|
|
330
|
+
subvariant={item.buttonSubvariant ?? "hover-glow"}
|
|
331
331
|
className={["dropdown-item", item.className].filter(Boolean).join(" ")}
|
|
332
332
|
type="button"
|
|
333
333
|
onClick={() => {
|
|
334
334
|
item.onClick();
|
|
335
335
|
setOpen(false);
|
|
336
|
-
}}
|
|
337
|
-
disabled={item.disabled}
|
|
338
|
-
title={item.title}
|
|
339
|
-
>
|
|
340
|
-
{item.label}
|
|
341
|
-
</Button>
|
|
342
|
-
);
|
|
343
|
-
});
|
|
344
|
-
}
|
|
336
|
+
}}
|
|
337
|
+
disabled={item.disabled}
|
|
338
|
+
title={item.title}
|
|
339
|
+
>
|
|
340
|
+
{item.label}
|
|
341
|
+
</Button>
|
|
342
|
+
);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
345
|
|
|
346
346
|
if (!props.items.length) {
|
|
347
347
|
return (
|
|
@@ -116,26 +116,9 @@
|
|
|
116
116
|
cursor: pointer;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.dropdown-item:not(.ef-button) {
|
|
120
|
-
border: 2px solid transparent;
|
|
121
|
-
padding: 10px 16px;
|
|
122
|
-
border-radius: var(--ef-control-radius, 12px);
|
|
123
|
-
background:
|
|
124
|
-
linear-gradient(var(--ef-surface), var(--ef-surface)) padding-box,
|
|
125
|
-
var(--ef-border-gradient) border-box;
|
|
126
|
-
color: var(--text-strong);
|
|
127
|
-
font-weight: 600;
|
|
128
|
-
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
|
129
|
-
box-shadow: var(--ef-button-glow-shadow, 0 0 24px rgba(124, 77, 255, 0.45));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
119
|
.dropdown-item:hover {
|
|
133
120
|
transform: translateY(-1px);
|
|
134
121
|
}
|
|
135
|
-
|
|
136
|
-
.dropdown-item:not(.ef-button):hover {
|
|
137
|
-
box-shadow: var(--ef-button-hover-glow-shadow, 0 0 18px rgba(124, 77, 255, 0.35));
|
|
138
|
-
}
|
|
139
122
|
|
|
140
123
|
.dropdown-item.theme-preview {
|
|
141
124
|
border: 2px solid transparent;
|