@ztwoint/z-ui 0.1.44 → 0.1.45

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/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from './components/table';
16
16
  export * from './components/tooltip/tooltip';
17
17
  export * from './components/table-card';
18
18
  export * from './components/badge/badge';
19
+ export * from './components/avatar/avatar';
19
20
  export * from './components/assets/icons/apartment-building';
20
21
  export * from './components/assets/icons/chevron-down';
21
22
  export * from './components/assets/icons/chevron-left';
package/dist/index.js CHANGED
@@ -10,10 +10,10 @@ import { Z2SideNavBarFooter as s } from "./components/collapsible-side-nav-bar/s
10
10
  import { Z2SideNavBarGroup as v } from "./components/collapsible-side-nav-bar/side-nav-bar-group.js";
11
11
  import { Z2SideNavBarItem as M } from "./components/collapsible-side-nav-bar/side-nav-bar-item.js";
12
12
  import { Z2SideNavBarSeparator as N } from "./components/collapsible-side-nav-bar/side-nav-bar-separator.js";
13
- import { useZ2SideNavBar as E } from "./components/collapsible-side-nav-bar/context.js";
13
+ import { useZ2SideNavBar as L } from "./components/collapsible-side-nav-bar/context.js";
14
14
  import { Z2Popover as F } from "./components/collapsible-side-nav-bar/popover/popover.js";
15
15
  import { ChevronUpIcon as _ } from "./components/assets/icons/chevron-up-icon.js";
16
- import { default as V } from "./components/assets/icons/sub-nav-indicator.js";
16
+ import { default as h } from "./components/assets/icons/sub-nav-indicator.js";
17
17
  import { default as G } from "./components/assets/icons/circles-icon.js";
18
18
  import { default as U } from "./components/assets/icons/database-copy.js";
19
19
  import { default as k } from "./components/assets/icons/window-left-copy.js";
@@ -22,9 +22,9 @@ import { SIDEBAR_WIDTH as Y, SIDEBAR_WIDTH_COLLAPSED as j } from "./components/c
22
22
  import { CountryFlags as z } from "./components/country-flags/country-flags.js";
23
23
  import { Z2Dialog as X, Z2DialogClose as $, Z2DialogContent as oo, Z2DialogDescription as eo, Z2DialogFooter as ro, Z2DialogHeader as to, Z2DialogOverlay as ao, Z2DialogPortal as po, Z2DialogTitle as no, Z2DialogTrigger as lo } from "./components/dialog/dialog.js";
24
24
  import { DropdownContext as fo, Z2Dropdown as xo, Z2DropdownContent as io, Z2DropdownInput as Zo, Z2DropdownItem as uo, Z2DropdownSub as So, Z2DropdownSubContent as Do, Z2DropdownSubItem as To, Z2DropdownSubTrigger as bo } from "./components/dropdown/z2-dropdown.js";
25
- import { Z2DropdownMenu as Co, Z2DropdownMenuCheckboxItem as wo, Z2DropdownMenuContent as co, Z2DropdownMenuGroup as so, Z2DropdownMenuItem as Io, Z2DropdownMenuLabel as vo, Z2DropdownMenuPortal as Bo, Z2DropdownMenuRadioGroup as Mo, Z2DropdownMenuRadioItem as Ao, Z2DropdownMenuSeparator as No, Z2DropdownMenuShortcut as Po, Z2DropdownMenuSub as Eo, Z2DropdownMenuSubContent as Lo, Z2DropdownMenuSubTrigger as Fo, Z2DropdownMenuTrigger as Ho } from "./components/dropdown-menu/z2-dropdown-menu.js";
25
+ import { Z2DropdownMenu as Co, Z2DropdownMenuCheckboxItem as wo, Z2DropdownMenuContent as co, Z2DropdownMenuGroup as so, Z2DropdownMenuItem as Io, Z2DropdownMenuLabel as vo, Z2DropdownMenuPortal as Bo, Z2DropdownMenuRadioGroup as Mo, Z2DropdownMenuRadioItem as Ao, Z2DropdownMenuSeparator as No, Z2DropdownMenuShortcut as Po, Z2DropdownMenuSub as Lo, Z2DropdownMenuSubContent as Eo, Z2DropdownMenuSubTrigger as Fo, Z2DropdownMenuTrigger as Ho } from "./components/dropdown-menu/z2-dropdown-menu.js";
26
26
  import { FileUploadArea as yo } from "./components/file-upload-area/file-upload-area.js";
27
- import { DEFAULT_ACCEPT as ho } from "./components/file-upload-area/file-upload-area.const.js";
27
+ import { DEFAULT_ACCEPT as Vo } from "./components/file-upload-area/file-upload-area.const.js";
28
28
  import { Input as Ro } from "./components/input/input.js";
29
29
  import { NavHeader as Wo } from "./components/nav-header/nav-header.js";
30
30
  import { NavItem as Oo } from "./components/nav-header/nav-item/nav-item.js";
@@ -40,11 +40,11 @@ import { TableContext as se, useTableContext as Ie } from "./components/table/ta
40
40
  import { TableCell as Be } from "./components/table/components/table-cell.js";
41
41
  import { TextCell as Ae } from "./components/table/components/cell/text-cell.js";
42
42
  import { NumberCell as Pe } from "./components/table/components/cell/number-cell.js";
43
- import { BooleanCell as Le } from "./components/table/components/cell/boolean-cell.js";
43
+ import { BooleanCell as Ee } from "./components/table/components/cell/boolean-cell.js";
44
44
  import { TableHeader as He } from "./components/table/components/table-header/table-header.js";
45
45
  import "react/jsx-runtime";
46
46
  import { TableRow as ye } from "./components/table/components/table-row.js";
47
- import { TableEmptyState as he } from "./components/table/components/table-empty-state.js";
47
+ import { TableEmptyState as Ve } from "./components/table/components/table-empty-state.js";
48
48
  import { TableLoadingState as Re } from "./components/table/components/table-loading-state.js";
49
49
  import { Pagination as We } from "./components/table/components/pagination/pagination.js";
50
50
  import { TableHeaderWrapper as Oe } from "./components/table/components/table-header-wrapper.js";
@@ -59,28 +59,31 @@ import "react";
59
59
  import { Z2Tooltip as nr } from "./components/tooltip/tooltip.js";
60
60
  import { default as mr } from "./components/table-card/table-card.js";
61
61
  import { Badge as xr, badgeVariants as ir } from "./components/badge/badge.js";
62
- import { InfoIcon as dr } from "./components/assets/icons/info-icon.js";
63
- import { useTheme as Sr } from "./lib/theme.hook.js";
64
- import { cn as Tr } from "./lib/utils.js";
65
- import { Z2PopoverTrigger as gr } from "./components/collapsible-side-nav-bar/popover/popover-trigger.js";
66
- import { Z2PopoverContent as wr } from "./components/collapsible-side-nav-bar/popover/popover-content.js";
62
+ import { Avatar as dr, AvatarWithLabel as ur } from "./components/avatar/avatar.js";
63
+ import { InfoIcon as Dr } from "./components/assets/icons/info-icon.js";
64
+ import { useTheme as br } from "./lib/theme.hook.js";
65
+ import { cn as Cr } from "./lib/utils.js";
66
+ import { Z2PopoverTrigger as cr } from "./components/collapsible-side-nav-bar/popover/popover-trigger.js";
67
+ import { Z2PopoverContent as Ir } from "./components/collapsible-side-nav-bar/popover/popover-content.js";
67
68
  export {
68
69
  p as Alert,
69
70
  f as AlertCirclesIcon,
70
71
  n as AlertDescription,
71
72
  l as AlertTitle,
73
+ dr as Avatar,
74
+ ur as AvatarWithLabel,
72
75
  xr as Badge,
73
- Le as BooleanCell,
76
+ Ee as BooleanCell,
74
77
  i as Button,
75
78
  _ as ChevronUpIcon,
76
79
  G as CirclesIcon,
77
80
  z as CountryFlags,
78
- ho as DEFAULT_ACCEPT,
81
+ Vo as DEFAULT_ACCEPT,
79
82
  Ce as DEFAULT_EMPTY_MESSAGE,
80
83
  U as DatabaseCopy,
81
84
  fo as DropdownContext,
82
85
  yo as FileUploadArea,
83
- dr as InfoIcon,
86
+ Dr as InfoIcon,
84
87
  Ro as Input,
85
88
  Xe as MagnifierIcon,
86
89
  Wo as NavHeader,
@@ -91,14 +94,14 @@ export {
91
94
  Y as SIDEBAR_WIDTH,
92
95
  j as SIDEBAR_WIDTH_COLLAPSED,
93
96
  J as SidebarLeftShowCopy,
94
- V as SubNavIndicator,
97
+ h as SubNavIndicator,
95
98
  we as TABLE_CSS_CLASSES,
96
99
  Ze as Table,
97
100
  Se as TableBody,
98
101
  mr as TableCard,
99
102
  Be as TableCell,
100
103
  se as TableContext,
101
- he as TableEmptyState,
104
+ Ve as TableEmptyState,
102
105
  or as TableFilter,
103
106
  je as TableFooter,
104
107
  ze as TableFooterContent,
@@ -136,8 +139,8 @@ export {
136
139
  Ao as Z2DropdownMenuRadioItem,
137
140
  No as Z2DropdownMenuSeparator,
138
141
  Po as Z2DropdownMenuShortcut,
139
- Eo as Z2DropdownMenuSub,
140
- Lo as Z2DropdownMenuSubContent,
142
+ Lo as Z2DropdownMenuSub,
143
+ Eo as Z2DropdownMenuSubContent,
141
144
  Fo as Z2DropdownMenuSubTrigger,
142
145
  Ho as Z2DropdownMenuTrigger,
143
146
  So as Z2DropdownSub,
@@ -145,8 +148,8 @@ export {
145
148
  To as Z2DropdownSubItem,
146
149
  bo as Z2DropdownSubTrigger,
147
150
  F as Z2Popover,
148
- wr as Z2PopoverContent,
149
- gr as Z2PopoverTrigger,
151
+ Ir as Z2PopoverContent,
152
+ cr as Z2PopoverTrigger,
150
153
  Qo as Z2Select,
151
154
  Yo as Z2SelectContent,
152
155
  jo as Z2SelectGroup,
@@ -175,10 +178,10 @@ export {
175
178
  nr as Z2Tooltip,
176
179
  ir as badgeVariants,
177
180
  Z as buttonVariants,
178
- Tr as cn,
181
+ Cr as cn,
179
182
  Te as extractCellValue,
180
183
  be as getNestedValue,
181
184
  Ie as useTableContext,
182
- Sr as useTheme,
183
- E as useZ2SideNavBar
185
+ br as useTheme,
186
+ L as useZ2SideNavBar
184
187
  };
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Props for the Avatar Root component.
3
+ * @interface RootProps
4
+ */
5
+ interface RootProps {
6
+ /** Size variant of the avatar. Affects width, height, border radius, and text size */
7
+ size: 'xxs' | 'xs' | 'sm' | 'md';
8
+ /** Color theme of the avatar using design system color tokens */
9
+ color: 'orange' | 'purple' | 'green' | 'blue';
10
+ /** Child components, typically Avatar.Label or Avatar.Element */
11
+ children: React.ReactNode;
12
+ /** Additional CSS classes for custom styling */
13
+ className?: string;
14
+ /** Ref object for the root div element */
15
+ ref?: React.RefObject<HTMLDivElement>;
16
+ }
17
+ /**
18
+ * Avatar Root component - the container for avatar content.
19
+ *
20
+ * @param props - The component props
21
+ * @param props.size - Size variant (xxs: 18px, xs: 22px, sm: 26px, md: 30px)
22
+ * @param props.color - Color theme using design system tokens
23
+ * @param props.children - Child components (typically Avatar.Label)
24
+ * @param props.className - Additional CSS classes
25
+ * @param props.ref - Ref for the root div element
26
+ * @returns The rendered avatar container
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <Avatar.Root size="sm" color="orange">
31
+ * <Avatar.Label label="JD" />
32
+ * </Avatar.Root>
33
+ * ```
34
+ */
35
+ declare function Root({ size, color, children, className, ref, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
36
+ /**
37
+ * Props for the Avatar Element component.
38
+ * @interface ElementProps
39
+ */
40
+ interface ElementProps {
41
+ /** Text content to display in the avatar (typically initials) */
42
+ label: string;
43
+ /** Additional CSS classes for custom styling */
44
+ className?: string;
45
+ /** Ref object for the span element */
46
+ ref?: React.RefObject<HTMLSpanElement>;
47
+ /** When true, merges props with the first child instead of rendering a span */
48
+ asChild?: boolean;
49
+ /** Child components (only used when asChild is true) */
50
+ children?: React.ReactNode;
51
+ }
52
+ /**
53
+ * Avatar Element component - flexible text/content renderer with asChild support.
54
+ *
55
+ * @param props - The component props
56
+ * @param props.label - Text to display (typically user initials)
57
+ * @param props.className - Additional CSS classes
58
+ * @param props.ref - Ref for the element
59
+ * @param props.asChild - When true, uses Radix Slot to merge with first child
60
+ * @param props.children - Child components (only when asChild is true)
61
+ * @returns The rendered element with avatar text styling
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * <Avatar.Element label="JD" />
66
+ *
67
+ * // With asChild for custom elements
68
+ * <Avatar.Element label="JD" asChild>
69
+ * <button>Custom Button</button>
70
+ * </Avatar.Element>
71
+ * ```
72
+ */
73
+ declare function Element({ label, className, ref, asChild, children, ...props }: ElementProps): import("react/jsx-runtime").JSX.Element;
74
+ /**
75
+ * Props for the Avatar Label component.
76
+ * @interface LabelProps
77
+ */
78
+ interface LabelProps {
79
+ /** Text content to display in the avatar (typically user initials) */
80
+ label: string;
81
+ /** Additional CSS classes for custom styling */
82
+ className?: string;
83
+ /** Ref object for the span element */
84
+ ref?: React.RefObject<HTMLSpanElement>;
85
+ }
86
+ /**
87
+ * Avatar Label component - simplified wrapper around Avatar.Element.
88
+ *
89
+ * @param props - The component props
90
+ * @param props.label - Text to display (typically user initials)
91
+ * @param props.className - Additional CSS classes
92
+ * @param props.ref - Ref for the span element
93
+ * @returns The rendered label with avatar text styling
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * <Avatar.Label label="JD" />
98
+ * <Avatar.Label label="AB" className="text-yellow-300" />
99
+ * ```
100
+ */
101
+ declare function Label({ label, className, ref, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
102
+ /**
103
+ * Props for the AvatarWithLabel convenience component.
104
+ * @interface AvatarWithLabelProps
105
+ */
106
+ interface AvatarWithLabelProps {
107
+ /** Text content to display in the avatar (typically user initials) */
108
+ label: string;
109
+ /** Size variant of the avatar. Affects width, height, border radius, and text size */
110
+ size: 'xxs' | 'xs' | 'sm' | 'md';
111
+ /** Color theme of the avatar using design system color tokens */
112
+ color: 'orange' | 'purple' | 'green' | 'blue';
113
+ /** Additional CSS classes for custom styling */
114
+ className?: string;
115
+ /** Ref object for the root div element */
116
+ ref?: React.RefObject<HTMLDivElement>;
117
+ }
118
+ /**
119
+ * AvatarWithLabel - A convenience component that combines Avatar.Root and Avatar.Label.
120
+ * Perfect for simple use cases where you just need an avatar with text.
121
+ *
122
+ * @param props - The component props
123
+ * @param props.label - Text to display (typically user initials)
124
+ * @param props.size - Size variant (xxs: 18px, xs: 22px, sm: 26px, md: 30px)
125
+ * @param props.color - Color theme using design system tokens
126
+ * @param props.className - Additional CSS classes
127
+ * @param props.ref - Ref for the root div element
128
+ * @returns The rendered avatar with label
129
+ *
130
+ * @example
131
+ * ```tsx
132
+ * <AvatarWithLabel label="JD" size="sm" color="orange" />
133
+ * <AvatarWithLabel label="AB" size="md" color="blue" className="rounded-full" />
134
+ * ```
135
+ */
136
+ declare function AvatarWithLabel({ label, size, color, className, ref, ...props }: AvatarWithLabelProps): import("react/jsx-runtime").JSX.Element;
137
+ /**
138
+ * Avatar compound component with multiple variants for flexible usage.
139
+ *
140
+ * @namespace Avatar
141
+ * @property {React.ComponentType<RootProps>} Root - Container component for avatar content
142
+ * @property {React.ComponentType<ElementProps>} Element - Flexible text/content renderer with asChild support
143
+ * @property {React.ComponentType<LabelProps>} Label - Simplified text renderer (wrapper around Element)
144
+ *
145
+ * @example
146
+ * ```tsx
147
+ * // Basic usage
148
+ * <Avatar.Root size="sm" color="orange">
149
+ * <Avatar.Label label="JD" />
150
+ * </Avatar.Root>
151
+ *
152
+ * // With custom styling
153
+ * <Avatar.Root size="md" color="blue" className="rounded-full border-2 border-white">
154
+ * <Avatar.Label label="AB" className="text-yellow-300" />
155
+ * </Avatar.Root>
156
+ *
157
+ * // Using Element with asChild for custom components
158
+ * <Avatar.Root size="sm" color="green">
159
+ * <Avatar.Element label="CD" asChild>
160
+ * <button onClick={handleClick}>Clickable Avatar</button>
161
+ * </Avatar.Element>
162
+ * </Avatar.Root>
163
+ * ```
164
+ */
165
+ declare const Avatar: {
166
+ Root: typeof Root;
167
+ Element: typeof Element;
168
+ Label: typeof Label;
169
+ };
170
+ /**
171
+ * @fileoverview Avatar component library providing both compound and convenience components.
172
+ *
173
+ * This module exports:
174
+ * - Avatar: A compound component with Root, Element, and Label sub-components
175
+ * - AvatarWithLabel: A convenience component that combines Root and Label
176
+ *
177
+ * Features:
178
+ * - Multiple sizes (xxs, xs, sm, md) with responsive scaling
179
+ * - Color themes using design system tokens
180
+ * - Customizable styling via className
181
+ * - Radix Slot support for advanced composition
182
+ * - TypeScript support with comprehensive prop types
183
+ * - Optimized typography for readability at all sizes
184
+ */
185
+ export { Avatar, AvatarWithLabel, ElementProps, LabelProps, RootProps, AvatarWithLabelProps };
@@ -17,6 +17,7 @@ export * from './components/table';
17
17
  export * from './components/tooltip/tooltip';
18
18
  export * from './components/table-card';
19
19
  export * from './components/badge/badge';
20
+ export * from './components/avatar/avatar';
20
21
  export * from './components/assets/icons/apartment-building';
21
22
  export * from './components/assets/icons/chevron-down';
22
23
  export * from './components/assets/icons/chevron-left';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztwoint/z-ui",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",