@vezham/react 26.0.0-alpha.7 → 26.0.0-alpha.9
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/lib/components/panel/footer/index.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/index.js +15 -9
- package/dist/lib/components/panel/footer/user-menu.d.ts +8 -1
- package/dist/lib/components/panel/footer/user-menu.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/user-menu.js +127 -45
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/panel/footer/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAoFjD,QAAA,MAAM,MAAM,GAAI,2KAab,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/panel/footer/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAoFjD,QAAA,MAAM,MAAM,GAAI,2KAab,kBAAkB,gCAsFpB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -29,7 +29,7 @@ var FooterAction = ({ children, label, onPress }) => {
|
|
|
29
29
|
})]
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
var CompactActions = ({ showAI, showControlCenter, onControlCenter, showNotifications, notificationCount, onAI, onNotificationsClick }) => {
|
|
32
|
+
var CompactActions = ({ showAI, showControlCenter, onControlCenter, showNotifications, notificationCount = 0, onAI, onNotificationsClick }) => {
|
|
33
33
|
if (!showAI && !showNotifications && !showControlCenter) return null;
|
|
34
34
|
return /* @__PURE__ */ jsxs(Dropdown, { children: [/* @__PURE__ */ jsx(Dropdown.Trigger, {
|
|
35
35
|
"aria-label": "Open footer actions",
|
|
@@ -59,7 +59,7 @@ var CompactActions = ({ showAI, showControlCenter, onControlCenter, showNotifica
|
|
|
59
59
|
className: "flex-1",
|
|
60
60
|
children: "Notifications"
|
|
61
61
|
}),
|
|
62
|
-
notificationCount
|
|
62
|
+
notificationCount > 0 ? /* @__PURE__ */ jsx(Badge, {
|
|
63
63
|
content: String(notificationCount),
|
|
64
64
|
color: "danger",
|
|
65
65
|
size: "sm"
|
|
@@ -117,7 +117,19 @@ var Footer = ({ user, showAI = false, showControlCenter = false, controlCenter,
|
|
|
117
117
|
value: controlCenterContext,
|
|
118
118
|
children: controlCenter ?? /* @__PURE__ */ jsx(DefaultControlCenter, { placement: "right bottom" })
|
|
119
119
|
}),
|
|
120
|
-
/* @__PURE__ */ jsx(
|
|
120
|
+
showUserInfo ? /* @__PURE__ */ jsx(UserMenu, {
|
|
121
|
+
user,
|
|
122
|
+
showAI,
|
|
123
|
+
showControlCenter,
|
|
124
|
+
showNotifications,
|
|
125
|
+
notificationCount,
|
|
126
|
+
onAI,
|
|
127
|
+
onControlCenter: () => setControlCenterOpen(true),
|
|
128
|
+
onNotifications: onNotificationsClick,
|
|
129
|
+
onProfile: () => onUserClick?.(user, "profiles"),
|
|
130
|
+
onPreferences: () => onUserClick?.(user, "account"),
|
|
131
|
+
onLogout: clearUser
|
|
132
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
121
133
|
className: "md:hidden",
|
|
122
134
|
children: /* @__PURE__ */ jsx(CompactActions, {
|
|
123
135
|
showControlCenter,
|
|
@@ -129,12 +141,6 @@ var Footer = ({ user, showAI = false, showControlCenter = false, controlCenter,
|
|
|
129
141
|
onNotificationsClick
|
|
130
142
|
})
|
|
131
143
|
}),
|
|
132
|
-
showUserInfo ? /* @__PURE__ */ jsx(UserMenu, {
|
|
133
|
-
user,
|
|
134
|
-
onProfile: () => onUserClick?.(user, "profiles"),
|
|
135
|
-
onPreferences: () => onUserClick?.(user, "account"),
|
|
136
|
-
onLogout: clearUser
|
|
137
|
-
}) : null,
|
|
138
144
|
toolbarAction && /* @__PURE__ */ jsx(Surface, {
|
|
139
145
|
variant: "transparent",
|
|
140
146
|
className: "md:hidden",
|
|
@@ -4,7 +4,14 @@ type Props = {
|
|
|
4
4
|
onLogout: () => void;
|
|
5
5
|
onProfile?: () => void;
|
|
6
6
|
onPreferences?: () => void;
|
|
7
|
+
showAI?: boolean;
|
|
8
|
+
showControlCenter?: boolean;
|
|
9
|
+
showNotifications?: boolean;
|
|
10
|
+
notificationCount?: number;
|
|
11
|
+
onAI?: () => void;
|
|
12
|
+
onControlCenter?: () => void;
|
|
13
|
+
onNotifications?: () => void;
|
|
7
14
|
};
|
|
8
|
-
declare const UserMenu: ({ user, onLogout, onProfile, onPreferences }: Props) => import("react").JSX.Element;
|
|
15
|
+
declare const UserMenu: ({ user, onLogout, onProfile, onPreferences, showAI, showControlCenter, showNotifications, notificationCount, onAI, onControlCenter, onNotifications }: Props) => import("react").JSX.Element;
|
|
9
16
|
export { UserMenu };
|
|
10
17
|
//# sourceMappingURL=user-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-menu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/panel/footer/user-menu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-menu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/panel/footer/user-menu.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAGV,QAAQ,EAGT,MAAM,SAAS,CAAA;AAEhB,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;CAC7B,CAAA;AAsGD,QAAA,MAAM,QAAQ,GAAI,uJAYf,KAAK,gCA0SP,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { DEFAULT_STATUS_OPTION, STATUS_OPTIONS, STATUS_TIMING_OPTIONS, SUGGESTED
|
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { Avatar, Badge, Button, Dropdown, Separator, Tooltip, useMediaQuery } from "@vezham/react-v3";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { AltArrowLeft, AltArrowRight, CheckRead, Logout2, Settings } from "@vezham/icons-react";
|
|
7
|
+
import { AltArrowLeft, AltArrowRight, Bell, CheckRead, Logout2, Settings, VezhamTamizhi } from "@vezham/icons-react";
|
|
8
8
|
//#region src/lib/components/panel/footer/user-menu.tsx
|
|
9
9
|
var StatusVisual = ({ status }) => {
|
|
10
10
|
if (isColorStatus(status.id)) return /* @__PURE__ */ jsx("span", { className: `h-2 w-2 rounded-full ${status.color ?? ""}` });
|
|
@@ -79,7 +79,7 @@ var useAccountSections = (user) => {
|
|
|
79
79
|
]
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
-
var UserMenu = ({ user, onLogout, onProfile, onPreferences }) => {
|
|
82
|
+
var UserMenu = ({ user, onLogout, onProfile, onPreferences, showAI = false, showControlCenter = false, showNotifications = false, notificationCount = 0, onAI, onControlCenter, onNotifications }) => {
|
|
83
83
|
const small = useMediaQuery(APPLICATION_MENU_SHEET_MEDIA_QUERY, { initializeWithValue: false });
|
|
84
84
|
const bubble = useMediaQuery(ACCOUNT_BUBBLE_MEDIA_QUERY, { initializeWithValue: false });
|
|
85
85
|
const [open, setOpen] = useState(false);
|
|
@@ -90,6 +90,129 @@ var UserMenu = ({ user, onLogout, onProfile, onPreferences }) => {
|
|
|
90
90
|
setOpen(value);
|
|
91
91
|
if (!value) setSection(null);
|
|
92
92
|
};
|
|
93
|
+
const closeAndRun = (action) => {
|
|
94
|
+
setOpen(false);
|
|
95
|
+
action?.();
|
|
96
|
+
};
|
|
97
|
+
const compactActions = [
|
|
98
|
+
showControlCenter ? {
|
|
99
|
+
label: "Control center",
|
|
100
|
+
icon: /* @__PURE__ */ jsx(Settings, {
|
|
101
|
+
size: 24,
|
|
102
|
+
"aria-hidden": "true"
|
|
103
|
+
}),
|
|
104
|
+
onPress: onControlCenter
|
|
105
|
+
} : null,
|
|
106
|
+
showNotifications ? {
|
|
107
|
+
label: "Notifications",
|
|
108
|
+
icon: /* @__PURE__ */ jsxs(Badge.Anchor, { children: [/* @__PURE__ */ jsx(Bell, {
|
|
109
|
+
size: 24,
|
|
110
|
+
"aria-hidden": "true"
|
|
111
|
+
}), notificationCount > 0 ? /* @__PURE__ */ jsx(Badge, {
|
|
112
|
+
content: String(notificationCount),
|
|
113
|
+
color: "danger",
|
|
114
|
+
size: "sm"
|
|
115
|
+
}) : null] }),
|
|
116
|
+
onPress: onNotifications
|
|
117
|
+
} : null,
|
|
118
|
+
showAI ? {
|
|
119
|
+
label: "Tamizhi AI",
|
|
120
|
+
icon: /* @__PURE__ */ jsx(VezhamTamizhi, {
|
|
121
|
+
size: 24,
|
|
122
|
+
"aria-hidden": "true"
|
|
123
|
+
}),
|
|
124
|
+
onPress: onAI
|
|
125
|
+
} : null
|
|
126
|
+
].filter((action) => action !== null);
|
|
127
|
+
const compactContent = /* @__PURE__ */ jsxs("div", {
|
|
128
|
+
className: "flex flex-col items-center gap-5 py-2",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: "flex flex-col items-center gap-2 text-center",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsxs(Badge.Anchor, { children: [/* @__PURE__ */ jsxs(Avatar, {
|
|
134
|
+
className: "size-20",
|
|
135
|
+
children: [user.avatar ? /* @__PURE__ */ jsx(Avatar.Image, {
|
|
136
|
+
src: user.avatar,
|
|
137
|
+
alt: user.name
|
|
138
|
+
}) : null, /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
139
|
+
className: "text-xl",
|
|
140
|
+
children: user.name?.[0]
|
|
141
|
+
})]
|
|
142
|
+
}), /* @__PURE__ */ jsx(Badge, {
|
|
143
|
+
placement: "bottom-right",
|
|
144
|
+
size: "sm",
|
|
145
|
+
className: "border-surface flex items-center justify-center border-2",
|
|
146
|
+
children: /* @__PURE__ */ jsx(StatusVisual, { status: currentStatus })
|
|
147
|
+
})] }),
|
|
148
|
+
/* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: "text-base font-semibold",
|
|
150
|
+
children: user.name
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsxs("span", {
|
|
153
|
+
className: "text-muted flex items-center gap-1 text-sm",
|
|
154
|
+
children: [/* @__PURE__ */ jsx(StatusVisual, { status: currentStatus }), currentStatus.label]
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}),
|
|
158
|
+
compactActions.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "flex items-center justify-center gap-2",
|
|
160
|
+
role: "group",
|
|
161
|
+
"aria-label": "Account actions",
|
|
162
|
+
children: compactActions.map((action) => /* @__PURE__ */ jsxs(Tooltip, {
|
|
163
|
+
delay: 0,
|
|
164
|
+
children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { children: /* @__PURE__ */ jsx(Button, {
|
|
165
|
+
"aria-label": action.label,
|
|
166
|
+
isIconOnly: true,
|
|
167
|
+
size: "lg",
|
|
168
|
+
variant: "ghost",
|
|
169
|
+
onPress: action.onPress,
|
|
170
|
+
children: action.icon
|
|
171
|
+
}) }), /* @__PURE__ */ jsx(Tooltip.Content, {
|
|
172
|
+
placement: "top",
|
|
173
|
+
children: action.label
|
|
174
|
+
})]
|
|
175
|
+
}, action.label))
|
|
176
|
+
}) : null,
|
|
177
|
+
/* @__PURE__ */ jsx(Separator, { className: "self-stretch" }),
|
|
178
|
+
/* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "flex w-full flex-col gap-1 p-2",
|
|
180
|
+
children: [
|
|
181
|
+
accountSections.map((item) => /* @__PURE__ */ jsxs(Button, {
|
|
182
|
+
variant: "ghost",
|
|
183
|
+
className: "h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
184
|
+
onPress: () => setSection(item.id),
|
|
185
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "min-w-0 flex-1 truncate text-start",
|
|
187
|
+
children: item.label
|
|
188
|
+
}), /* @__PURE__ */ jsx(AltArrowRight, {
|
|
189
|
+
size: 16,
|
|
190
|
+
"aria-hidden": "true"
|
|
191
|
+
})]
|
|
192
|
+
}, item.id)),
|
|
193
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
194
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
195
|
+
variant: "ghost",
|
|
196
|
+
className: "h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
197
|
+
onPress: () => closeAndRun(onPreferences),
|
|
198
|
+
children: [/* @__PURE__ */ jsx(Settings, {
|
|
199
|
+
size: 18,
|
|
200
|
+
"aria-hidden": "true"
|
|
201
|
+
}), "Preferences"]
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
204
|
+
variant: "ghost",
|
|
205
|
+
className: "text-danger h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
206
|
+
onPress: () => closeAndRun(onLogout),
|
|
207
|
+
children: [/* @__PURE__ */ jsx(Logout2, {
|
|
208
|
+
size: 18,
|
|
209
|
+
"aria-hidden": "true"
|
|
210
|
+
}), "Logout"]
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
});
|
|
93
216
|
const Trigger = small ? Button : Dropdown.Trigger;
|
|
94
217
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
218
|
/* @__PURE__ */ jsxs("button", {
|
|
@@ -114,48 +237,7 @@ var UserMenu = ({ user, onLogout, onProfile, onPreferences }) => {
|
|
|
114
237
|
})] })]
|
|
115
238
|
}),
|
|
116
239
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
117
|
-
small ? /* @__PURE__ */ jsxs(
|
|
118
|
-
className: "flex flex-col gap-1 p-2",
|
|
119
|
-
children: [
|
|
120
|
-
accountSections.map((item) => /* @__PURE__ */ jsxs(Button, {
|
|
121
|
-
variant: "ghost",
|
|
122
|
-
className: "h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
123
|
-
onPress: () => setSection(item.id),
|
|
124
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
125
|
-
className: "min-w-0 flex-1 truncate text-start",
|
|
126
|
-
children: item.label
|
|
127
|
-
}), /* @__PURE__ */ jsx(AltArrowRight, {
|
|
128
|
-
size: 16,
|
|
129
|
-
"aria-hidden": "true"
|
|
130
|
-
})]
|
|
131
|
-
}, item.id)),
|
|
132
|
-
/* @__PURE__ */ jsx(Separator, {}),
|
|
133
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
134
|
-
variant: "ghost",
|
|
135
|
-
className: "h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
136
|
-
onPress: () => {
|
|
137
|
-
setOpen(false);
|
|
138
|
-
onPreferences?.();
|
|
139
|
-
},
|
|
140
|
-
children: [/* @__PURE__ */ jsx(Settings, {
|
|
141
|
-
size: 18,
|
|
142
|
-
"aria-hidden": "true"
|
|
143
|
-
}), "Preferences"]
|
|
144
|
-
}),
|
|
145
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
146
|
-
variant: "ghost",
|
|
147
|
-
className: "text-danger h-auto min-h-11 w-full justify-start gap-3 px-3 py-2 text-start",
|
|
148
|
-
onPress: () => {
|
|
149
|
-
setOpen(false);
|
|
150
|
-
onLogout();
|
|
151
|
-
},
|
|
152
|
-
children: [/* @__PURE__ */ jsx(Logout2, {
|
|
153
|
-
size: 18,
|
|
154
|
-
"aria-hidden": "true"
|
|
155
|
-
}), "Logout"]
|
|
156
|
-
})
|
|
157
|
-
]
|
|
158
|
-
}) : /* @__PURE__ */ jsxs(Dropdown.Menu, {
|
|
240
|
+
small ? null : /* @__PURE__ */ jsxs(Dropdown.Menu, {
|
|
159
241
|
"aria-label": "Account actions",
|
|
160
242
|
children: [
|
|
161
243
|
accountSections.map((item) => /* @__PURE__ */ jsxs(Dropdown.SubmenuTrigger, { children: [/* @__PURE__ */ jsxs(Dropdown.Item, {
|
|
@@ -274,7 +356,7 @@ var UserMenu = ({ user, onLogout, onProfile, onPreferences }) => {
|
|
|
274
356
|
})
|
|
275
357
|
]
|
|
276
358
|
}, option.id))]
|
|
277
|
-
}) :
|
|
359
|
+
}) : compactContent
|
|
278
360
|
})] }) : /* @__PURE__ */ jsxs(Dropdown, {
|
|
279
361
|
isOpen: open,
|
|
280
362
|
onOpenChange: changeOpen,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vezham/react",
|
|
3
|
-
"version": "26.0.0-alpha.
|
|
3
|
+
"version": "26.0.0-alpha.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/vezham/vx-fe-pkgs.git",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
],
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@tanstack/react-hotkeys": "^0.10.0",
|
|
112
|
-
"@vezham/hooks": "26.0.0-alpha.
|
|
112
|
+
"@vezham/hooks": "26.0.0-alpha.9",
|
|
113
113
|
"react-aria-components": "1.21.1"
|
|
114
114
|
}
|
|
115
115
|
}
|