@aircall/blocks 0.2.1 → 0.2.2
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/globals.css +1 -1
- package/dist/index.d.ts +78 -38
- package/dist/index.js +321 -2
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Badge, Button, CounterBadge, SidebarProvider, TabsList, useSidebar } from "@aircall/ds";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime27 from "react/jsx-runtime";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
5
|
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
7
|
+
import * as _base_ui_react0 from "@base-ui/react";
|
|
5
8
|
|
|
6
9
|
//#region src/components/copy-button.d.ts
|
|
7
10
|
type CopyButtonProps = Omit<React.ComponentProps<typeof Button>, 'onClick' | 'variant'> & {
|
|
@@ -17,13 +20,13 @@ declare function CopyButton({
|
|
|
17
20
|
variant,
|
|
18
21
|
children,
|
|
19
22
|
...buttonProps
|
|
20
|
-
}: CopyButtonProps):
|
|
23
|
+
}: CopyButtonProps): react_jsx_runtime27.JSX.Element;
|
|
21
24
|
interface CopyButtonIconProps {
|
|
22
25
|
className?: string;
|
|
23
26
|
}
|
|
24
27
|
declare function CopyButtonIcon({
|
|
25
28
|
className
|
|
26
|
-
}: CopyButtonIconProps):
|
|
29
|
+
}: CopyButtonIconProps): react_jsx_runtime27.JSX.Element;
|
|
27
30
|
interface CopyButtonLabelProps {
|
|
28
31
|
label?: string;
|
|
29
32
|
copiedLabel?: string;
|
|
@@ -33,56 +36,56 @@ declare function CopyButtonLabel({
|
|
|
33
36
|
label,
|
|
34
37
|
copiedLabel,
|
|
35
38
|
className
|
|
36
|
-
}: CopyButtonLabelProps):
|
|
39
|
+
}: CopyButtonLabelProps): react_jsx_runtime27.JSX.Element;
|
|
37
40
|
//#endregion
|
|
38
41
|
//#region src/components/dashboard-page.d.ts
|
|
39
42
|
declare function DashboardPage({
|
|
40
43
|
className,
|
|
41
44
|
...props
|
|
42
|
-
}: React.ComponentProps<'div'>):
|
|
45
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
43
46
|
declare function DashboardPageBanner({
|
|
44
47
|
className,
|
|
45
48
|
...props
|
|
46
|
-
}: React.ComponentProps<'div'>):
|
|
49
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
47
50
|
declare function DashboardPageContent({
|
|
48
51
|
className,
|
|
49
52
|
...props
|
|
50
|
-
}: React.ComponentProps<'div'>):
|
|
53
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
51
54
|
declare function DashboardPageMain({
|
|
52
55
|
className,
|
|
53
56
|
...props
|
|
54
|
-
}: React.ComponentProps<'main'>):
|
|
57
|
+
}: React.ComponentProps<'main'>): react_jsx_runtime27.JSX.Element;
|
|
55
58
|
declare function DashboardPageTabs({
|
|
56
59
|
className,
|
|
57
60
|
...props
|
|
58
|
-
}: React.ComponentProps<typeof TabsList>):
|
|
61
|
+
}: React.ComponentProps<typeof TabsList>): react_jsx_runtime27.JSX.Element;
|
|
59
62
|
//#endregion
|
|
60
63
|
//#region src/components/dashboard-page-header.d.ts
|
|
61
64
|
declare function DashboardPageHeader({
|
|
62
65
|
className,
|
|
63
66
|
children,
|
|
64
67
|
...props
|
|
65
|
-
}: React.ComponentProps<'div'>):
|
|
68
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
66
69
|
declare function DashboardPageHeaderNav({
|
|
67
70
|
className,
|
|
68
71
|
children,
|
|
69
72
|
...props
|
|
70
|
-
}: React.ComponentProps<'div'>):
|
|
73
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
71
74
|
type DashboardPageHeaderNavBackProps = Omit<React.ComponentProps<typeof Button>, 'variant' | 'size'>;
|
|
72
75
|
declare function DashboardPageHeaderNavBack({
|
|
73
76
|
children,
|
|
74
77
|
...props
|
|
75
|
-
}: DashboardPageHeaderNavBackProps):
|
|
78
|
+
}: DashboardPageHeaderNavBackProps): react_jsx_runtime27.JSX.Element;
|
|
76
79
|
declare function DashboardPageHeaderPrefix({
|
|
77
80
|
className,
|
|
78
81
|
children,
|
|
79
82
|
...props
|
|
80
|
-
}: React.ComponentProps<'div'>):
|
|
83
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
81
84
|
declare function DashboardPageHeaderTitleGroup({
|
|
82
85
|
className,
|
|
83
86
|
children,
|
|
84
87
|
...props
|
|
85
|
-
}: React.ComponentProps<'div'>):
|
|
88
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
86
89
|
type DashboardPageHeaderTitleProps = React.ComponentProps<'h1'> & {
|
|
87
90
|
size?: 'lg' | 'sm';
|
|
88
91
|
};
|
|
@@ -91,22 +94,22 @@ declare function DashboardPageHeaderTitle({
|
|
|
91
94
|
className,
|
|
92
95
|
children,
|
|
93
96
|
...props
|
|
94
|
-
}: DashboardPageHeaderTitleProps):
|
|
97
|
+
}: DashboardPageHeaderTitleProps): react_jsx_runtime27.JSX.Element;
|
|
95
98
|
declare function DashboardPageHeaderSubtitle({
|
|
96
99
|
className,
|
|
97
100
|
children,
|
|
98
101
|
...props
|
|
99
|
-
}: React.ComponentProps<'div'>):
|
|
102
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
100
103
|
declare function DashboardPageHeaderDescription({
|
|
101
104
|
className,
|
|
102
105
|
children,
|
|
103
106
|
...props
|
|
104
|
-
}: React.ComponentProps<'div'>):
|
|
107
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
105
108
|
declare function DashboardPageHeaderActions({
|
|
106
109
|
className,
|
|
107
110
|
children,
|
|
108
111
|
...props
|
|
109
|
-
}: React.ComponentProps<'div'>):
|
|
112
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
110
113
|
type DashboardPageHeaderActionProps = Omit<React.ComponentProps<typeof Button>, 'size'> & {
|
|
111
114
|
size?: 'lg' | 'icon-lg';
|
|
112
115
|
};
|
|
@@ -119,7 +122,7 @@ declare const BetaBadge: {
|
|
|
119
122
|
({
|
|
120
123
|
className,
|
|
121
124
|
...props
|
|
122
|
-
}: BadgeBaseProps):
|
|
125
|
+
}: BadgeBaseProps): react_jsx_runtime27.JSX.Element;
|
|
123
126
|
displayName: string;
|
|
124
127
|
};
|
|
125
128
|
/** Green pill — recently launched feature */
|
|
@@ -127,7 +130,7 @@ declare const NewBadge: {
|
|
|
127
130
|
({
|
|
128
131
|
className,
|
|
129
132
|
...props
|
|
130
|
-
}: BadgeBaseProps):
|
|
133
|
+
}: BadgeBaseProps): react_jsx_runtime27.JSX.Element;
|
|
131
134
|
displayName: string;
|
|
132
135
|
};
|
|
133
136
|
/** Amber pill — feature being phased out */
|
|
@@ -135,7 +138,7 @@ declare const DeprecatedBadge: {
|
|
|
135
138
|
({
|
|
136
139
|
className,
|
|
137
140
|
...props
|
|
138
|
-
}: BadgeBaseProps):
|
|
141
|
+
}: BadgeBaseProps): react_jsx_runtime27.JSX.Element;
|
|
139
142
|
displayName: string;
|
|
140
143
|
};
|
|
141
144
|
/** Blue pill — user is in a trial period (same blue family as Beta) */
|
|
@@ -143,14 +146,14 @@ declare const TrialBadge: {
|
|
|
143
146
|
({
|
|
144
147
|
className,
|
|
145
148
|
...props
|
|
146
|
-
}: BadgeBaseProps):
|
|
149
|
+
}: BadgeBaseProps): react_jsx_runtime27.JSX.Element;
|
|
147
150
|
displayName: string;
|
|
148
151
|
};
|
|
149
152
|
/** Green pill — Professional tier (no gradient; uses default Badge variant) */
|
|
150
153
|
declare function ProfessionalBadge({
|
|
151
154
|
className,
|
|
152
155
|
...props
|
|
153
|
-
}: BadgeBaseProps):
|
|
156
|
+
}: BadgeBaseProps): react_jsx_runtime27.JSX.Element;
|
|
154
157
|
type RoleBadgeRole = 'agent' | 'supervisor' | 'admin' | 'owner';
|
|
155
158
|
type RoleBadgeProps = BadgeBaseProps & {
|
|
156
159
|
/** The user's role within Aircall. */role: RoleBadgeRole;
|
|
@@ -159,7 +162,44 @@ declare function RoleBadge({
|
|
|
159
162
|
role,
|
|
160
163
|
className,
|
|
161
164
|
...props
|
|
162
|
-
}: RoleBadgeProps):
|
|
165
|
+
}: RoleBadgeProps): react_jsx_runtime27.JSX.Element;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/components/colorful-badge.d.ts
|
|
168
|
+
declare const colorfulBadgeVariants: (props?: ({
|
|
169
|
+
color?: "charcoal" | "red" | "green" | "blue" | "purple" | "yellow" | "pink" | null | undefined;
|
|
170
|
+
tone?: "dark" | "medium-dark" | "medium-light" | "light" | null | undefined;
|
|
171
|
+
glow?: boolean | null | undefined;
|
|
172
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
173
|
+
type ColorfulBadgeVariants = VariantProps<typeof colorfulBadgeVariants>;
|
|
174
|
+
type ColorfulBadgeColor = NonNullable<ColorfulBadgeVariants['color']>;
|
|
175
|
+
type ColorfulBadgeTone = NonNullable<ColorfulBadgeVariants['tone']>;
|
|
176
|
+
type ColorfulBadgeProps = Omit<React.ComponentProps<typeof Badge>, 'variant' | 'size' | 'color'> & ColorfulBadgeVariants & {
|
|
177
|
+
/**
|
|
178
|
+
* A legacy hard-coded tag hex (e.g. `#0761B5`) from the old palette. When
|
|
179
|
+
* provided it is resolved to the matching `color` + `tone` and overrides
|
|
180
|
+
* them — render existing tags without migrating their stored colors.
|
|
181
|
+
* Unknown values fall back to `charcoal` / `dark`.
|
|
182
|
+
*/
|
|
183
|
+
legacyColor?: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* A color-customizable badge. Pick a `color` and `tone`; optionally enable the
|
|
187
|
+
* AI `glow`. To render an existing tag, pass its stored hex via `legacyColor`.
|
|
188
|
+
* Icons (e.g. a leading `<Sparkles />` or a trailing close `<X />`) are composed
|
|
189
|
+
* as children, exactly like `Badge`.
|
|
190
|
+
*/
|
|
191
|
+
declare const ColorfulBadge: React.ForwardRefExoticComponent<Omit<ColorfulBadgeProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
192
|
+
/**
|
|
193
|
+
* Trailing remove affordance for a removable `ColorfulBadge`. Inspired by the
|
|
194
|
+
* ds `ComboboxChip` remove button: a ghost icon button that inherits the
|
|
195
|
+
* badge's text color and brightens on hover. Pass an `aria-label` and an
|
|
196
|
+
* `onClick`. Compose it as the last child of a `ColorfulBadge`.
|
|
197
|
+
*/
|
|
198
|
+
declare const ColorfulBadgeRemove: React.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ButtonProps & VariantProps<(props?: ({
|
|
199
|
+
variant?: "link" | "default" | "secondary" | "outline" | "destructive" | "ghost" | null | undefined;
|
|
200
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
201
|
+
block?: boolean | null | undefined;
|
|
202
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
163
203
|
//#endregion
|
|
164
204
|
//#region src/hooks/use-copy-to-clipboard.d.ts
|
|
165
205
|
interface UseCopyToClipboardOptions {
|
|
@@ -256,7 +296,7 @@ type DashboardSidebarNavProps = {
|
|
|
256
296
|
declare function DashboardSidebarNav({
|
|
257
297
|
groups,
|
|
258
298
|
renderLink
|
|
259
|
-
}: DashboardSidebarNavProps):
|
|
299
|
+
}: DashboardSidebarNavProps): react_jsx_runtime27.JSX.Element;
|
|
260
300
|
//#endregion
|
|
261
301
|
//#region src/components/dashboard-sidebar.d.ts
|
|
262
302
|
type DashboardSidebarProviderProps = React.ComponentProps<typeof SidebarProvider>;
|
|
@@ -264,34 +304,34 @@ declare function DashboardSidebarProvider({
|
|
|
264
304
|
className,
|
|
265
305
|
style,
|
|
266
306
|
...props
|
|
267
|
-
}: DashboardSidebarProviderProps):
|
|
307
|
+
}: DashboardSidebarProviderProps): react_jsx_runtime27.JSX.Element;
|
|
268
308
|
declare function DashboardSidebar({
|
|
269
309
|
className,
|
|
270
310
|
children,
|
|
271
311
|
...props
|
|
272
|
-
}: React.ComponentProps<'div'>):
|
|
312
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
273
313
|
declare function DashboardSidebarHeader({
|
|
274
314
|
className,
|
|
275
315
|
children,
|
|
276
316
|
...props
|
|
277
|
-
}: React.ComponentProps<'div'>):
|
|
317
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
278
318
|
declare function DashboardSidebarTrigger({
|
|
279
319
|
className,
|
|
280
320
|
onClick,
|
|
281
321
|
...props
|
|
282
|
-
}: React.ComponentProps<typeof Button>):
|
|
322
|
+
}: React.ComponentProps<typeof Button>): react_jsx_runtime27.JSX.Element;
|
|
283
323
|
declare function DashboardSidebarContent({
|
|
284
324
|
className,
|
|
285
325
|
...props
|
|
286
|
-
}: React.ComponentProps<'div'>):
|
|
326
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
287
327
|
declare function DashboardSidebarFooter({
|
|
288
328
|
className,
|
|
289
329
|
...props
|
|
290
|
-
}: React.ComponentProps<'div'>):
|
|
330
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
291
331
|
declare function DashboardSidebarGroup({
|
|
292
332
|
className,
|
|
293
333
|
...props
|
|
294
|
-
}: React.ComponentProps<'div'>):
|
|
334
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
295
335
|
declare function DashboardSidebarGroupLabel({
|
|
296
336
|
className,
|
|
297
337
|
render,
|
|
@@ -300,11 +340,11 @@ declare function DashboardSidebarGroupLabel({
|
|
|
300
340
|
declare function DashboardSidebarMenu({
|
|
301
341
|
className,
|
|
302
342
|
...props
|
|
303
|
-
}: React.ComponentProps<'ul'>):
|
|
343
|
+
}: React.ComponentProps<'ul'>): react_jsx_runtime27.JSX.Element;
|
|
304
344
|
declare function DashboardSidebarMenuItem({
|
|
305
345
|
className,
|
|
306
346
|
...props
|
|
307
|
-
}: React.ComponentProps<'li'>):
|
|
347
|
+
}: React.ComponentProps<'li'>): react_jsx_runtime27.JSX.Element;
|
|
308
348
|
type DashboardSidebarMenuButtonProps = useRender.ComponentProps<'button'> & React.ComponentProps<'button'> & {
|
|
309
349
|
isActive?: boolean;
|
|
310
350
|
/** Visual-only disabled state. The button remains clickable (e.g. to show an
|
|
@@ -327,11 +367,11 @@ declare const DashboardSidebarMenuButton: React.ForwardRefExoticComponent<Omit<D
|
|
|
327
367
|
declare function DashboardSidebarMenuBadge({
|
|
328
368
|
className,
|
|
329
369
|
...props
|
|
330
|
-
}: React.ComponentProps<typeof CounterBadge>):
|
|
370
|
+
}: React.ComponentProps<typeof CounterBadge>): react_jsx_runtime27.JSX.Element;
|
|
331
371
|
declare function DashboardSidebarSubmenu({
|
|
332
372
|
className,
|
|
333
373
|
...props
|
|
334
|
-
}: React.ComponentProps<'div'>):
|
|
374
|
+
}: React.ComponentProps<'div'>): react_jsx_runtime27.JSX.Element;
|
|
335
375
|
type DashboardSidebarSubmenuItemProps = useRender.ComponentProps<'div'> & React.ComponentProps<'div'> & {
|
|
336
376
|
isActive?: boolean;
|
|
337
377
|
};
|
|
@@ -345,6 +385,6 @@ declare function DashboardSidebarSubmenuSeparator({
|
|
|
345
385
|
className
|
|
346
386
|
}: {
|
|
347
387
|
className?: string;
|
|
348
|
-
}):
|
|
388
|
+
}): react_jsx_runtime27.JSX.Element;
|
|
349
389
|
//#endregion
|
|
350
|
-
export { BetaBadge, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, type DashboardSidebarNavGroup, type DashboardSidebarNavItem, type DashboardSidebarNavItemAction, type DashboardSidebarNavItemLink, type DashboardSidebarNavItemSubmenu, type DashboardSidebarNavProps, type DashboardSidebarNavSubmenuItem, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DeprecatedBadge, NewBadge, ProfessionalBadge, RoleBadge, type RoleBadgeRole, TrialBadge, useCopyToClipboard, useSidebar as useDashboardSidebar };
|
|
390
|
+
export { BetaBadge, ColorfulBadge, type ColorfulBadgeColor, ColorfulBadgeRemove, type ColorfulBadgeTone, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, type DashboardSidebarNavGroup, type DashboardSidebarNavItem, type DashboardSidebarNavItemAction, type DashboardSidebarNavItemLink, type DashboardSidebarNavItemSubmenu, type DashboardSidebarNavProps, type DashboardSidebarNavSubmenuItem, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DeprecatedBadge, NewBadge, ProfessionalBadge, RoleBadge, type RoleBadgeRole, TrialBadge, colorfulBadgeVariants, useCopyToClipboard, useSidebar as useDashboardSidebar };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Badge, Button, CounterBadge, DropdownMenu, DropdownMenuAddon, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, SidebarProvider, TabsList, Tooltip, TooltipContent, TooltipTrigger, cn, useSidebar } from "@aircall/ds";
|
|
4
|
-
import { Check, ChevronLeft, ChevronRight, Copy, PanelLeftClose, PanelLeftOpen } from "@aircall/react-icons";
|
|
4
|
+
import { Check, ChevronLeft, ChevronRight, Copy, PanelLeftClose, PanelLeftOpen, X } from "@aircall/react-icons";
|
|
5
5
|
import { useCallbackRef, useIsMounted, useUnmount } from "@aircall/hooks";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
7
8
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
8
9
|
import { useRender } from "@base-ui/react/use-render";
|
|
9
10
|
|
|
@@ -266,6 +267,324 @@ function RoleBadge({ role, className, ...props }) {
|
|
|
266
267
|
});
|
|
267
268
|
}
|
|
268
269
|
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/components/colorful-badge.tsx
|
|
272
|
+
const colorfulBadgeVariants = cva("h-[26px] gap-1 rounded-full border-transparent bg-[linear-gradient(0deg,var(--colorful-badge-overlay)_0%,var(--colorful-badge-overlay)_100%)]", {
|
|
273
|
+
variants: {
|
|
274
|
+
color: {
|
|
275
|
+
charcoal: "",
|
|
276
|
+
red: "",
|
|
277
|
+
green: "",
|
|
278
|
+
blue: "",
|
|
279
|
+
purple: "",
|
|
280
|
+
yellow: "",
|
|
281
|
+
pink: ""
|
|
282
|
+
},
|
|
283
|
+
tone: {
|
|
284
|
+
dark: "",
|
|
285
|
+
"medium-dark": "",
|
|
286
|
+
"medium-light": "",
|
|
287
|
+
light: ""
|
|
288
|
+
},
|
|
289
|
+
glow: {
|
|
290
|
+
true: "",
|
|
291
|
+
false: ""
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
compoundVariants: [
|
|
295
|
+
{
|
|
296
|
+
color: "charcoal",
|
|
297
|
+
tone: "dark",
|
|
298
|
+
class: "bg-charcoal-900 text-charcoal-50"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
color: "charcoal",
|
|
302
|
+
tone: "medium-dark",
|
|
303
|
+
class: "bg-charcoal-600 text-white"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
color: "charcoal",
|
|
307
|
+
tone: "medium-light",
|
|
308
|
+
class: "bg-charcoal-300 text-charcoal-950"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
color: "charcoal",
|
|
312
|
+
tone: "light",
|
|
313
|
+
class: "bg-charcoal-200 text-charcoal-950"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
color: "red",
|
|
317
|
+
tone: "dark",
|
|
318
|
+
class: "bg-red-700 text-red-50"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
color: "red",
|
|
322
|
+
tone: "medium-dark",
|
|
323
|
+
class: "bg-red-400 text-red-950"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
color: "red",
|
|
327
|
+
tone: "medium-light",
|
|
328
|
+
class: "bg-red-300 text-red-950"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
color: "red",
|
|
332
|
+
tone: "light",
|
|
333
|
+
class: "bg-red-200 text-red-800"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
color: "green",
|
|
337
|
+
tone: "dark",
|
|
338
|
+
class: "bg-green-800 text-green-50"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
color: "green",
|
|
342
|
+
tone: "medium-dark",
|
|
343
|
+
class: "bg-green-600 text-white"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
color: "green",
|
|
347
|
+
tone: "medium-light",
|
|
348
|
+
class: "bg-green-300 text-green-950"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
color: "green",
|
|
352
|
+
tone: "light",
|
|
353
|
+
class: "bg-green-200 text-green-950"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
color: "blue",
|
|
357
|
+
tone: "dark",
|
|
358
|
+
class: "bg-blue-800 text-blue-50"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
color: "blue",
|
|
362
|
+
tone: "medium-dark",
|
|
363
|
+
class: "bg-blue-600 text-white"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
color: "blue",
|
|
367
|
+
tone: "medium-light",
|
|
368
|
+
class: "bg-blue-300 text-blue-950"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
color: "blue",
|
|
372
|
+
tone: "light",
|
|
373
|
+
class: "bg-blue-200 text-blue-900"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
color: "purple",
|
|
377
|
+
tone: "dark",
|
|
378
|
+
class: "bg-purple-800 text-purple-50"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
color: "purple",
|
|
382
|
+
tone: "medium-dark",
|
|
383
|
+
class: "bg-purple-600 text-white"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
color: "purple",
|
|
387
|
+
tone: "medium-light",
|
|
388
|
+
class: "bg-purple-300 text-purple-950"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
color: "purple",
|
|
392
|
+
tone: "light",
|
|
393
|
+
class: "bg-purple-200 text-purple-900"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
color: "yellow",
|
|
397
|
+
tone: "dark",
|
|
398
|
+
class: "bg-yellow-500 text-yellow-950"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
color: "yellow",
|
|
402
|
+
tone: "medium-dark",
|
|
403
|
+
class: "bg-yellow-400 text-yellow-950"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
color: "yellow",
|
|
407
|
+
tone: "medium-light",
|
|
408
|
+
class: "bg-yellow-300 text-black"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
color: "yellow",
|
|
412
|
+
tone: "light",
|
|
413
|
+
class: "bg-yellow-200 text-yellow-900"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
color: "pink",
|
|
417
|
+
tone: "dark",
|
|
418
|
+
class: "bg-pink-700 text-pink-50"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
color: "pink",
|
|
422
|
+
tone: "medium-dark",
|
|
423
|
+
class: "bg-pink-500 text-pink-950"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
color: "pink",
|
|
427
|
+
tone: "medium-light",
|
|
428
|
+
class: "bg-pink-300 text-pink-950"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
color: "pink",
|
|
432
|
+
tone: "light",
|
|
433
|
+
class: "bg-pink-200 text-pink-900"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
glow: true,
|
|
437
|
+
class: "drop-shadow-[0px_0px_3px_var(--cb-glow)] animate-colorful-badge-glow motion-reduce:animate-none"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
color: "charcoal",
|
|
441
|
+
glow: true,
|
|
442
|
+
class: "border-charcoal-600 [--cb-glow:var(--color-charcoal-600)]"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
color: "red",
|
|
446
|
+
glow: true,
|
|
447
|
+
class: "border-red-500 [--cb-glow:var(--color-red-500)]"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
color: "green",
|
|
451
|
+
glow: true,
|
|
452
|
+
class: "border-green-600 [--cb-glow:var(--color-green-600)]"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
color: "blue",
|
|
456
|
+
glow: true,
|
|
457
|
+
class: "border-blue-600 [--cb-glow:var(--color-blue-600)]"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
color: "purple",
|
|
461
|
+
glow: true,
|
|
462
|
+
class: "border-purple-600 [--cb-glow:var(--color-purple-600)]"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
color: "yellow",
|
|
466
|
+
glow: true,
|
|
467
|
+
class: "border-yellow-400 [--cb-glow:var(--color-yellow-400)]"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
color: "pink",
|
|
471
|
+
glow: true,
|
|
472
|
+
class: "border-pink-600 [--cb-glow:var(--color-pink-600)]"
|
|
473
|
+
}
|
|
474
|
+
],
|
|
475
|
+
defaultVariants: {
|
|
476
|
+
color: "charcoal",
|
|
477
|
+
tone: "dark",
|
|
478
|
+
glow: false
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
/**
|
|
482
|
+
* A color-customizable badge. Pick a `color` and `tone`; optionally enable the
|
|
483
|
+
* AI `glow`. To render an existing tag, pass its stored hex via `legacyColor`.
|
|
484
|
+
* Icons (e.g. a leading `<Sparkles />` or a trailing close `<X />`) are composed
|
|
485
|
+
* as children, exactly like `Badge`.
|
|
486
|
+
*/
|
|
487
|
+
const ColorfulBadge = React.forwardRef(({ color, tone, glow, legacyColor, className, ...props }, ref) => {
|
|
488
|
+
const resolved = legacyColor ? resolveTagColor(legacyColor) : {
|
|
489
|
+
color,
|
|
490
|
+
tone
|
|
491
|
+
};
|
|
492
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
493
|
+
ref,
|
|
494
|
+
"data-slot": "colorful-badge",
|
|
495
|
+
size: "lg",
|
|
496
|
+
className: cn(colorfulBadgeVariants({
|
|
497
|
+
color: resolved.color,
|
|
498
|
+
tone: resolved.tone,
|
|
499
|
+
glow
|
|
500
|
+
}), className),
|
|
501
|
+
...props
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
ColorfulBadge.displayName = "ColorfulBadge";
|
|
505
|
+
/**
|
|
506
|
+
* Trailing remove affordance for a removable `ColorfulBadge`. Inspired by the
|
|
507
|
+
* ds `ComboboxChip` remove button: a ghost icon button that inherits the
|
|
508
|
+
* badge's text color and brightens on hover. Pass an `aria-label` and an
|
|
509
|
+
* `onClick`. Compose it as the last child of a `ColorfulBadge`.
|
|
510
|
+
*/
|
|
511
|
+
const ColorfulBadgeRemove = React.forwardRef(({ className, ...props }, ref) => {
|
|
512
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
513
|
+
ref,
|
|
514
|
+
type: "button",
|
|
515
|
+
variant: "ghost",
|
|
516
|
+
size: "icon-sm",
|
|
517
|
+
"data-slot": "colorful-badge-remove",
|
|
518
|
+
className: cn("-mr-1.5 size-5 rounded-full text-inherit opacity-70 hover:bg-transparent! hover:text-inherit! hover:opacity-100!", className),
|
|
519
|
+
...props,
|
|
520
|
+
children: /* @__PURE__ */ jsx(X, { className: "pointer-events-none size-3.5" })
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
ColorfulBadgeRemove.displayName = "ColorfulBadgeRemove";
|
|
524
|
+
const LEGACY_TAG_COLOR_MAP = {
|
|
525
|
+
"#003d4b": {
|
|
526
|
+
color: "charcoal",
|
|
527
|
+
tone: "dark"
|
|
528
|
+
},
|
|
529
|
+
"#bb2001": {
|
|
530
|
+
color: "red",
|
|
531
|
+
tone: "dark"
|
|
532
|
+
},
|
|
533
|
+
"#f92c00": {
|
|
534
|
+
color: "red",
|
|
535
|
+
tone: "medium-dark"
|
|
536
|
+
},
|
|
537
|
+
"#0761b5": {
|
|
538
|
+
color: "blue",
|
|
539
|
+
tone: "dark"
|
|
540
|
+
},
|
|
541
|
+
"#008f6c": {
|
|
542
|
+
color: "green",
|
|
543
|
+
tone: "medium-dark"
|
|
544
|
+
},
|
|
545
|
+
"#b285d1": {
|
|
546
|
+
color: "purple",
|
|
547
|
+
tone: "medium-light"
|
|
548
|
+
},
|
|
549
|
+
"#fcbb26": {
|
|
550
|
+
color: "yellow",
|
|
551
|
+
tone: "medium-light"
|
|
552
|
+
},
|
|
553
|
+
"#fe9d88": {
|
|
554
|
+
color: "red",
|
|
555
|
+
tone: "light"
|
|
556
|
+
},
|
|
557
|
+
"#ff844c": {
|
|
558
|
+
color: "red",
|
|
559
|
+
tone: "medium-light"
|
|
560
|
+
},
|
|
561
|
+
"#abccf2": {
|
|
562
|
+
color: "blue",
|
|
563
|
+
tone: "light"
|
|
564
|
+
},
|
|
565
|
+
"#49a0ff": {
|
|
566
|
+
color: "blue",
|
|
567
|
+
tone: "medium-light"
|
|
568
|
+
},
|
|
569
|
+
"#66d188": {
|
|
570
|
+
color: "green",
|
|
571
|
+
tone: "medium-light"
|
|
572
|
+
},
|
|
573
|
+
"#2ac8ff": {
|
|
574
|
+
color: "blue",
|
|
575
|
+
tone: "medium-dark"
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
/** Charcoal/dark — used when a stored hex is outside the known legacy palette. */
|
|
579
|
+
const FALLBACK_TAG_COLOR = {
|
|
580
|
+
color: "charcoal",
|
|
581
|
+
tone: "dark"
|
|
582
|
+
};
|
|
583
|
+
/** Resolve a legacy hard-coded tag hex to `color` + `tone`; unknown → charcoal/dark. */
|
|
584
|
+
function resolveTagColor(hex) {
|
|
585
|
+
return LEGACY_TAG_COLOR_MAP[hex.trim().toLowerCase()] ?? FALLBACK_TAG_COLOR;
|
|
586
|
+
}
|
|
587
|
+
|
|
269
588
|
//#endregion
|
|
270
589
|
//#region src/components/dashboard-sidebar.tsx
|
|
271
590
|
function DashboardSidebarProvider({ className, style, ...props }) {
|
|
@@ -522,4 +841,4 @@ function DashboardSidebarNav({ groups, renderLink }) {
|
|
|
522
841
|
}
|
|
523
842
|
|
|
524
843
|
//#endregion
|
|
525
|
-
export { BetaBadge, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DeprecatedBadge, NewBadge, ProfessionalBadge, RoleBadge, TrialBadge, useCopyToClipboard, useSidebar as useDashboardSidebar };
|
|
844
|
+
export { BetaBadge, ColorfulBadge, ColorfulBadgeRemove, CopyButton, CopyButtonIcon, CopyButtonLabel, DashboardPage, DashboardPageBanner, DashboardPageContent, DashboardPageHeader, DashboardPageHeaderAction, DashboardPageHeaderActions, DashboardPageHeaderDescription, DashboardPageHeaderNav, DashboardPageHeaderNavBack, DashboardPageHeaderPrefix, DashboardPageHeaderSubtitle, DashboardPageHeaderTitle, DashboardPageHeaderTitleGroup, DashboardPageMain, DashboardPageTabs, DashboardSidebar, DashboardSidebarContent, DashboardSidebarFooter, DashboardSidebarGroup, DashboardSidebarGroupLabel, DashboardSidebarHeader, DashboardSidebarMenu, DashboardSidebarMenuBadge, DashboardSidebarMenuButton, DashboardSidebarMenuItem, DashboardSidebarNav, DashboardSidebarProvider, DashboardSidebarSubmenu, DashboardSidebarSubmenuItem, DashboardSidebarSubmenuSeparator, DashboardSidebarTrigger, DeprecatedBadge, NewBadge, ProfessionalBadge, RoleBadge, TrialBadge, colorfulBadgeVariants, useCopyToClipboard, useSidebar as useDashboardSidebar };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aircall/blocks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@aircall/hooks": "*",
|
|
30
30
|
"@aircall/react-icons": "*",
|
|
31
31
|
"@base-ui/react": "*",
|
|
32
|
+
"class-variance-authority": "*",
|
|
32
33
|
"react": "^18.0.0 || ^19.0.0",
|
|
33
34
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
34
35
|
},
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@aircall/react-icons": "*",
|
|
38
39
|
"@base-ui/react": "1.3.0",
|
|
40
|
+
"class-variance-authority": "0.7.1",
|
|
39
41
|
"@aircall/tsconfig": "1.4.3",
|
|
40
42
|
"@chromatic-com/storybook": "5.0.2",
|
|
41
43
|
"@faker-js/faker": "10.2.0",
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"typescript": "5.9.3",
|
|
66
68
|
"vite": "7.3.1",
|
|
67
69
|
"vitest": "4.0.17",
|
|
68
|
-
"@aircall/ds": "0.9.
|
|
70
|
+
"@aircall/ds": "0.9.1",
|
|
69
71
|
"@aircall/hooks": "0.5.1"
|
|
70
72
|
},
|
|
71
73
|
"scripts": {
|