@stachelock/ui 0.8.4 → 0.8.7

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/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@stachelock/ui",
3
- "version": "0.8.4",
3
+ "version": "0.8.7",
4
4
  "description": "A comprehensive Vue 3 UI component library built with Tailwind CSS",
5
5
  "type": "module",
6
+ "publishConfig": {
7
+ "access": "restricted"
8
+ },
6
9
  "main": "./dist/index.js",
7
10
  "module": "./dist/index.js",
8
11
  "types": "./dist/index.d.ts",
@@ -1,125 +0,0 @@
1
- import { defineComponent as B, ref as m, computed as o, onMounted as I, onBeforeUnmount as U, createElementBlock as n, openBlock as a, createElementVNode as r, createVNode as j, createCommentVNode as u, normalizeStyle as v, normalizeClass as k, renderSlot as f, createBlock as R, toDisplayString as c, Transition as S, withCtx as M } from "vue";
2
- import P from "./components/CloudinaryImage.js";
3
- const T = { class: "sl-relative sl-flex sl-items-center sl-gap-3" }, V = ["aria-expanded"], O = {
4
- key: 1,
5
- class: "sl-w-full sl-h-full sl-inline-flex sl-items-center sl-justify-center sl-bg-stachelock-200 dark:sl-bg-stachelock-700"
6
- }, A = { class: "sl-p-4 sl-border-b sl-border-gray-200 dark:sl-border-slate-700" }, D = { class: "sl-text-sm sl-font-medium sl-text-gray-900 dark:sl-text-white" }, H = { class: "sl-text-xs sl-text-gray-500 dark:sl-text-slate-400" }, K = {
7
- key: 0,
8
- class: "sl-py-1"
9
- }, J = /* @__PURE__ */ B({
10
- __name: "ProfileHeaderAvatar",
11
- props: {
12
- userName: {},
13
- userEmail: { default: "" },
14
- imagePublicId: {},
15
- imageUrl: {},
16
- showLogout: { type: Boolean, default: !0 },
17
- logoutLabel: { default: "Log Out" },
18
- size: { default: 40 },
19
- ringColorClass: { default: "sl-ring-stachelock-400" },
20
- menuTop: { default: "3rem" },
21
- menuRight: { default: "0" }
22
- },
23
- emits: ["logout", "menu-toggle"],
24
- setup(e, { expose: y, emit: b }) {
25
- const s = e, d = b, l = m(!1), x = m(null), p = m(null), w = o(() => !!s.imagePublicId || !!s.imageUrl), C = o(() => s.userName ? s.userName.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2) : "U"), z = o(() => `hover:sl-ring-2 hover:${s.ringColorClass}`), E = o(() => `sl-ring-2 ${s.ringColorClass}`), L = o(() => s.size < 32 ? "sl-text-xs" : s.size < 48 ? "sl-text-sm" : "sl-text-base"), N = o(() => ({
26
- top: s.menuTop,
27
- right: s.menuRight
28
- })), g = () => {
29
- l.value = !l.value, d("menu-toggle", l.value);
30
- }, i = () => {
31
- l.value && (l.value = !1, d("menu-toggle", !1));
32
- }, $ = () => {
33
- i(), d("logout");
34
- }, h = (t) => {
35
- t.key === "Escape" && i();
36
- };
37
- return I(() => {
38
- document.addEventListener("keydown", h);
39
- }), U(() => {
40
- document.removeEventListener("keydown", h);
41
- }), y({
42
- toggleMenu: g,
43
- closeMenu: i,
44
- isMenuOpen: l
45
- }), (t, q) => (a(), n("div", T, [
46
- r("button", {
47
- ref_key: "avatarButton",
48
- ref: x,
49
- type: "button",
50
- onClick: g,
51
- class: k(["sl-relative sl-inline-flex sl-items-center sl-justify-center sl-rounded-full sl-overflow-hidden sl-transition-all sl-flex-shrink-0 focus:sl-outline-none", [
52
- z.value,
53
- { [E.value]: l.value }
54
- ]]),
55
- style: v({ width: `${e.size}px`, height: `${e.size}px` }),
56
- "aria-expanded": l.value,
57
- "aria-haspopup": "true"
58
- }, [
59
- f(t.$slots, "avatar", {}, () => [
60
- w.value ? (a(), R(P, {
61
- key: 0,
62
- src: e.imageUrl,
63
- "public-id": e.imagePublicId,
64
- alt: e.userName,
65
- width: e.size,
66
- height: e.size,
67
- "custom-classes": { image: { "sl-w-full sl-h-full sl-object-cover sl-object-center": !0 } },
68
- skeleton: "user"
69
- }, null, 8, ["src", "public-id", "alt", "width", "height"])) : (a(), n("div", O, [
70
- r("span", {
71
- class: k(["sl-font-semibold sl-text-stachelock-700 dark:sl-text-stachelock-200", L.value])
72
- }, c(C.value), 3)
73
- ]))
74
- ])
75
- ], 14, V),
76
- j(S, {
77
- "enter-active-class": "sl-transition sl-ease-out sl-duration-100",
78
- "enter-from-class": "sl-transform sl-opacity-0 sl-scale-95",
79
- "enter-to-class": "sl-transform sl-opacity-100 sl-scale-100",
80
- "leave-active-class": "sl-transition sl-ease-in sl-duration-75",
81
- "leave-from-class": "sl-transform sl-opacity-100 sl-scale-100",
82
- "leave-to-class": "sl-transform sl-opacity-0 sl-scale-95"
83
- }, {
84
- default: M(() => [
85
- l.value ? (a(), n("div", {
86
- key: 0,
87
- ref_key: "menuRef",
88
- ref: p,
89
- class: "sl-absolute sl-bg-white dark:sl-bg-slate-800 sl-rounded-lg sl-shadow-lg sl-border sl-border-gray-200 dark:sl-border-slate-700 sl-z-50 sl-min-w-max sl-overflow-hidden",
90
- style: v(N.value),
91
- role: "menu",
92
- "aria-orientation": "vertical"
93
- }, [
94
- r("div", A, [
95
- f(t.$slots, "menu-header", {}, () => [
96
- r("p", D, c(e.userName), 1),
97
- r("p", H, c(e.userEmail), 1)
98
- ])
99
- ]),
100
- t.$slots["menu-items"] ? (a(), n("div", K, [
101
- f(t.$slots, "menu-items")
102
- ])) : u("", !0),
103
- e.showLogout ? (a(), n("button", {
104
- key: 1,
105
- type: "button",
106
- onClick: $,
107
- class: "sl-w-full sl-text-left sl-px-4 sl-py-2 sl-text-sm sl-text-red-600 dark:sl-text-red-400 hover:sl-bg-red-50 dark:hover:sl-bg-red-900/20 sl-transition-colors",
108
- role: "menuitem"
109
- }, c(e.logoutLabel), 1)) : u("", !0)
110
- ], 4)) : u("", !0)
111
- ]),
112
- _: 3
113
- }),
114
- l.value ? (a(), n("div", {
115
- key: 0,
116
- class: "sl-fixed sl-inset-0 sl-z-40",
117
- onClick: i,
118
- "aria-hidden": "true"
119
- })) : u("", !0)
120
- ]));
121
- }
122
- });
123
- export {
124
- J as _
125
- };