@abydahana/aksara-ui 1.1.3 → 1.1.4

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.
@@ -9,3 +9,4 @@ export * from "./input-group";
9
9
  export * from "./form-control";
10
10
  export * from "./floating-label";
11
11
  export * from "./layout";
12
+ export * from "./dropdown-select";
@@ -4,3 +4,4 @@ export * from "./pagination";
4
4
  export * from "./tabs";
5
5
  export * from "./scrollspy";
6
6
  export * from "./sidebar";
7
+ export * from "./user-pill";
@@ -4,3 +4,4 @@ export * from "./pagination";
4
4
  export * from "./tabs";
5
5
  export * from "./scrollspy";
6
6
  export * from "./sidebar";
7
+ export * from "./user-pill";
@@ -0,0 +1,13 @@
1
+ export interface UserPillProps {
2
+ avatar?: string;
3
+ initials?: string;
4
+ name: string;
5
+ handle?: string;
6
+ subtitle?: string;
7
+ menuHtml?: string;
8
+ className?: string;
9
+ triggerClassName?: string;
10
+ attributes?: Record<string, unknown>;
11
+ }
12
+ export declare function UserPill(props: UserPillProps): string;
13
+ export declare const userPill: typeof UserPill;
@@ -0,0 +1,32 @@
1
+ import { classNames, escapeHtml, toAttributes } from "../utils";
2
+ import { Avatar } from "../data/avatar";
3
+ export function UserPill(props) {
4
+ const { avatar, initials, name, handle, subtitle, menuHtml = "", className = "", triggerClassName = "", attributes } = props;
5
+ const containerClasses = classNames("sidebar-user-pill-wrap position-relative mt-auto", className);
6
+ const triggerClasses = classNames("sidebar-user-pill w-100 text-start", triggerClassName);
7
+ const avatarHtml = Avatar({
8
+ src: avatar,
9
+ alt: name,
10
+ initials,
11
+ size: "md",
12
+ shape: "circle",
13
+ className: "sidebar-user-avatar"
14
+ });
15
+ const subText = subtitle || (handle ? `@${handle.replace(/^@/, "")}` : "");
16
+ const menuContainer = menuHtml ? `<div class="sidebar-user-menu d-none" data-user-menu>${menuHtml}</div>` : "";
17
+ const baseAttrs = toAttributes(attributes);
18
+ return `
19
+ <div class="${containerClasses}"${baseAttrs}>
20
+ ${menuContainer}
21
+ <button type="button" class="${triggerClasses}" data-user-menu-trigger aria-haspopup="true" aria-expanded="false">
22
+ ${avatarHtml}
23
+ <div class="sidebar-user-meta flex-1 min-w-0">
24
+ <div class="sidebar-user-name fw-bold text-truncate">${escapeHtml(name)}</div>
25
+ ${subText ? `<div class="sidebar-user-handle text-muted text-truncate">${escapeHtml(subText)}</div>` : ""}
26
+ </div>
27
+ <i class="mdi mdi-dots-horizontal sidebar-user-dots" aria-hidden="true"></i>
28
+ </button>
29
+ </div>
30
+ `.trim();
31
+ }
32
+ export const userPill = UserPill;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abydahana/aksara-ui",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },