@aircall/blocks 0.2.2 → 0.4.0
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 +73 -79
- package/dist/index.js +112 -364
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { Check, ChevronLeft, ChevronRight, Copy, PanelLeftClose, PanelLeftOpen } from "@aircall/react-icons";
|
|
5
5
|
import { useCallbackRef, useIsMounted, useUnmount } from "@aircall/hooks";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
@@ -78,6 +78,70 @@ function CopyButtonLabel({ label = "Copy", copiedLabel = "Copied", className })
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/dashboard-standalone-page.tsx
|
|
83
|
+
const DashboardStandalonePage = React.forwardRef((componentProps, forwardRef) => {
|
|
84
|
+
const { className, ...props } = componentProps;
|
|
85
|
+
return /* @__PURE__ */ jsx("div", {
|
|
86
|
+
ref: forwardRef,
|
|
87
|
+
"data-slot": "dashboard-standalone-page",
|
|
88
|
+
className: cn("flex h-screen flex-col bg-neutral-200 dark:bg-neutral-950", className),
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
DashboardStandalonePage.displayName = "DashboardStandalonePage";
|
|
93
|
+
const DashboardStandalonePageHeader = React.forwardRef((componentProps, forwardRef) => {
|
|
94
|
+
const { className, ...props } = componentProps;
|
|
95
|
+
return /* @__PURE__ */ jsx("header", {
|
|
96
|
+
ref: forwardRef,
|
|
97
|
+
"data-slot": "dashboard-standalone-page-header",
|
|
98
|
+
className: cn("grid h-16 shrink-0 grid-cols-[1fr_auto_1fr] items-center gap-4 border-b border-border bg-background px-4 md:px-6", className),
|
|
99
|
+
...props
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
DashboardStandalonePageHeader.displayName = "DashboardStandalonePageHeader";
|
|
103
|
+
const DashboardStandalonePageTitle = React.forwardRef((componentProps, forwardRef) => {
|
|
104
|
+
const { className, ...props } = componentProps;
|
|
105
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
106
|
+
ref: forwardRef,
|
|
107
|
+
"data-slot": "dashboard-standalone-page-title",
|
|
108
|
+
className: cn("col-start-2 row-start-1 truncate text-center text-base font-bold text-foreground", className),
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
DashboardStandalonePageTitle.displayName = "DashboardStandalonePageTitle";
|
|
113
|
+
const DashboardStandalonePageActions = React.forwardRef((componentProps, forwardRef) => {
|
|
114
|
+
const { side = "end", className, ...props } = componentProps;
|
|
115
|
+
return /* @__PURE__ */ jsx("div", {
|
|
116
|
+
ref: forwardRef,
|
|
117
|
+
"data-slot": "dashboard-standalone-page-actions",
|
|
118
|
+
"data-side": side,
|
|
119
|
+
className: cn("row-start-1 flex min-w-0 items-center gap-2", side === "start" ? "col-start-1 justify-start" : "col-start-3 justify-end", className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
DashboardStandalonePageActions.displayName = "DashboardStandalonePageActions";
|
|
124
|
+
const DashboardStandalonePageAction = React.forwardRef((componentProps, forwardRef) => {
|
|
125
|
+
const { variant = "ghost", ...props } = componentProps;
|
|
126
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
127
|
+
ref: forwardRef,
|
|
128
|
+
size: "lg",
|
|
129
|
+
variant,
|
|
130
|
+
...props
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
DashboardStandalonePageAction.displayName = "DashboardStandalonePageAction";
|
|
134
|
+
const DashboardStandalonePageContent = React.forwardRef((componentProps, forwardRef) => {
|
|
135
|
+
const { className, ...props } = componentProps;
|
|
136
|
+
return /* @__PURE__ */ jsx("main", {
|
|
137
|
+
ref: forwardRef,
|
|
138
|
+
"data-slot": "dashboard-standalone-page-content",
|
|
139
|
+
className: cn("min-h-0 flex-1 overflow-auto p-4 md:p-6", className),
|
|
140
|
+
...props
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
DashboardStandalonePageContent.displayName = "DashboardStandalonePageContent";
|
|
144
|
+
|
|
81
145
|
//#endregion
|
|
82
146
|
//#region src/components/dashboard-page.tsx
|
|
83
147
|
function DashboardPage({ className, ...props }) {
|
|
@@ -104,7 +168,7 @@ function DashboardPageContent({ className, ...props }) {
|
|
|
104
168
|
function DashboardPageMain({ className, ...props }) {
|
|
105
169
|
return /* @__PURE__ */ jsx("main", {
|
|
106
170
|
"data-slot": "dashboard-page-main",
|
|
107
|
-
className: cn("flex-1 min-h-0 overflow-auto", className),
|
|
171
|
+
className: cn("flex-1 min-h-0 overflow-auto py-4 px-6", className),
|
|
108
172
|
...props
|
|
109
173
|
});
|
|
110
174
|
}
|
|
@@ -112,7 +176,7 @@ function DashboardPageTabs({ className, ...props }) {
|
|
|
112
176
|
return /* @__PURE__ */ jsx(TabsList, {
|
|
113
177
|
...props,
|
|
114
178
|
"data-slot": "dph-tabs",
|
|
115
|
-
className: cn("flex w-full justify-start gap-0 px-
|
|
179
|
+
className: cn("flex w-full justify-start gap-0 px-6 border-b border-border rounded-none bg-transparent", "[&>[data-slot=tabs-trigger]]:flex-none", "[&>[data-slot=tabs-trigger]]:rounded-none", "[&>[data-slot=tabs-trigger]]:after:hidden", "[&>[data-slot=tabs-trigger]]:border-b-2", "[&>[data-slot=tabs-trigger]]:border-b-transparent", "[&>[data-slot=tabs-trigger]]:-mb-px", "[&>[data-slot=tabs-trigger][data-active]]:border-b-foreground", className)
|
|
116
180
|
});
|
|
117
181
|
}
|
|
118
182
|
|
|
@@ -150,7 +214,7 @@ function DashboardPageHeaderNavBack({ children, ...props }) {
|
|
|
150
214
|
function DashboardPageHeaderPrefix({ className, children, ...props }) {
|
|
151
215
|
return /* @__PURE__ */ jsx("div", {
|
|
152
216
|
"data-slot": "dph-prefix",
|
|
153
|
-
className: cn("[grid-area:prefix] flex shrink-0
|
|
217
|
+
className: cn("[grid-area:prefix] flex shrink-0 px-2 pt-2 items-center justify-center self-start", className),
|
|
154
218
|
...props,
|
|
155
219
|
children
|
|
156
220
|
});
|
|
@@ -158,7 +222,7 @@ function DashboardPageHeaderPrefix({ className, children, ...props }) {
|
|
|
158
222
|
function DashboardPageHeaderTitleGroup({ className, children, ...props }) {
|
|
159
223
|
return /* @__PURE__ */ jsx("div", {
|
|
160
224
|
"data-slot": "dph-title-group",
|
|
161
|
-
className: cn("[grid-area:info] flex min-w-0 flex-col self-center
|
|
225
|
+
className: cn("[grid-area:info] flex min-w-0 flex-col self-center pl-2", "group-has-[[data-slot=dph-prefix]]/dph:pl-0", className),
|
|
162
226
|
...props,
|
|
163
227
|
children
|
|
164
228
|
});
|
|
@@ -166,7 +230,7 @@ function DashboardPageHeaderTitleGroup({ className, children, ...props }) {
|
|
|
166
230
|
function DashboardPageHeaderTitle({ size = "lg", className, children, ...props }) {
|
|
167
231
|
return /* @__PURE__ */ jsx("h1", {
|
|
168
232
|
"data-slot": "dph-title",
|
|
169
|
-
className: cn("[grid-area:info] self-center
|
|
233
|
+
className: cn("[grid-area:info] self-center pl-2 group-has-[[data-slot=dph-prefix]]/dph:pl-0", "[[data-slot=dph-title-group]_&]:p-0", "[[data-slot=dph-title-group]_&]:self-auto", "truncate text-foreground", size === "lg" ? "text-3xl font-bold" : "text-xl font-bold", "leading-10", className),
|
|
170
234
|
...props,
|
|
171
235
|
children
|
|
172
236
|
});
|
|
@@ -204,387 +268,71 @@ DashboardPageHeaderAction.displayName = "DashboardPageHeaderAction";
|
|
|
204
268
|
|
|
205
269
|
//#endregion
|
|
206
270
|
//#region src/components/product-badges.tsx
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
271
|
+
const GRADIENT_BASE = cn("border-transparent text-foreground", "bg-[image:linear-gradient(90deg,var(--badge-overlay),var(--badge-overlay)),linear-gradient(90deg,var(--badge-accent),var(--badge-accent))]");
|
|
272
|
+
const productBadgeVariants = cva(GRADIENT_BASE, { variants: { type: {
|
|
273
|
+
beta: "[--badge-accent:var(--color-blue-300)]",
|
|
274
|
+
new: "[--badge-accent:var(--color-green-300)]",
|
|
275
|
+
deprecated: "[--badge-accent:var(--color-yellow-300)]",
|
|
276
|
+
trial: "[--badge-accent:var(--color-blue-300)]"
|
|
277
|
+
} } });
|
|
278
|
+
const PRODUCT_BADGE_LABEL = {
|
|
279
|
+
beta: "Beta",
|
|
280
|
+
new: "New",
|
|
281
|
+
deprecated: "Deprecated",
|
|
282
|
+
trial: "Trial"
|
|
283
|
+
};
|
|
284
|
+
function createProductBadge(type) {
|
|
285
|
+
const label = PRODUCT_BADGE_LABEL[type];
|
|
286
|
+
function ProductBadge({ className, ...props }) {
|
|
212
287
|
return /* @__PURE__ */ jsx(Badge, {
|
|
213
|
-
"data-slot":
|
|
214
|
-
className: cn(
|
|
215
|
-
style: badgeBg(color),
|
|
288
|
+
"data-slot": `badge-${type}`,
|
|
289
|
+
className: cn(productBadgeVariants({ type }), className),
|
|
216
290
|
...props,
|
|
217
291
|
children: label
|
|
218
292
|
});
|
|
219
293
|
}
|
|
220
|
-
|
|
221
|
-
return
|
|
294
|
+
ProductBadge.displayName = label.replace(/\s+/g, "") + "Badge";
|
|
295
|
+
return ProductBadge;
|
|
222
296
|
}
|
|
223
297
|
/** Blue pill — feature in beta, not yet GA */
|
|
224
|
-
const BetaBadge =
|
|
298
|
+
const BetaBadge = createProductBadge("beta");
|
|
225
299
|
/** Green pill — recently launched feature */
|
|
226
|
-
const NewBadge =
|
|
300
|
+
const NewBadge = createProductBadge("new");
|
|
227
301
|
/** Amber pill — feature being phased out */
|
|
228
|
-
const DeprecatedBadge =
|
|
302
|
+
const DeprecatedBadge = createProductBadge("deprecated");
|
|
229
303
|
/** Blue pill — user is in a trial period (same blue family as Beta) */
|
|
230
|
-
const TrialBadge =
|
|
231
|
-
/**
|
|
304
|
+
const TrialBadge = createProductBadge("trial");
|
|
305
|
+
/** Charcoal pill — Professional tier (no gradient; solid secondary Badge) */
|
|
232
306
|
function ProfessionalBadge({ className, ...props }) {
|
|
233
307
|
return /* @__PURE__ */ jsx(Badge, {
|
|
234
308
|
"data-slot": "badge-professional",
|
|
235
|
-
|
|
236
|
-
|
|
309
|
+
tone: "dark",
|
|
310
|
+
color: "charcoal",
|
|
237
311
|
...props,
|
|
238
312
|
children: "Professional"
|
|
239
313
|
});
|
|
240
314
|
}
|
|
241
|
-
const
|
|
242
|
-
agent:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
admin:
|
|
251
|
-
|
|
252
|
-
label: "Admin"
|
|
253
|
-
},
|
|
254
|
-
owner: {
|
|
255
|
-
color: "var(--color-green-400)",
|
|
256
|
-
label: "Owner"
|
|
257
|
-
}
|
|
315
|
+
const roleBadgeVariants = cva(GRADIENT_BASE, { variants: { role: {
|
|
316
|
+
agent: "[--badge-accent:var(--color-yellow-400)]",
|
|
317
|
+
supervisor: "[--badge-accent:var(--color-blue-500)]",
|
|
318
|
+
admin: "[--badge-accent:var(--color-purple-500)]",
|
|
319
|
+
owner: "[--badge-accent:var(--color-green-400)]"
|
|
320
|
+
} } });
|
|
321
|
+
const ROLE_BADGE_LABEL = {
|
|
322
|
+
agent: "Agent",
|
|
323
|
+
supervisor: "Supervisor",
|
|
324
|
+
admin: "Admin",
|
|
325
|
+
owner: "Owner"
|
|
258
326
|
};
|
|
259
327
|
function RoleBadge({ role, className, ...props }) {
|
|
260
|
-
const { color, label } = ROLE_CONFIG[role];
|
|
261
328
|
return /* @__PURE__ */ jsx(Badge, {
|
|
262
329
|
"data-slot": `badge-${role}`,
|
|
263
|
-
className: cn(
|
|
264
|
-
style: badgeBg(color),
|
|
330
|
+
className: cn(roleBadgeVariants({ role }), className),
|
|
265
331
|
...props,
|
|
266
|
-
children:
|
|
332
|
+
children: ROLE_BADGE_LABEL[role]
|
|
267
333
|
});
|
|
268
334
|
}
|
|
269
335
|
|
|
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
|
-
|
|
588
336
|
//#endregion
|
|
589
337
|
//#region src/components/dashboard-sidebar.tsx
|
|
590
338
|
function DashboardSidebarProvider({ className, style, ...props }) {
|
|
@@ -679,7 +427,7 @@ function DashboardSidebarMenuItem({ className, ...props }) {
|
|
|
679
427
|
const DashboardSidebarMenuButton = React.forwardRef(function DashboardSidebarMenuButton({ className, render, isActive = false, disabled = false, icon, action, children, ...props }, ref) {
|
|
680
428
|
const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
681
429
|
icon && /* @__PURE__ */ jsx("span", {
|
|
682
|
-
className: cn("size-6 rounded-full bg-
|
|
430
|
+
className: cn("size-6 rounded-full bg-background text-foreground flex items-center justify-center shrink-0 overflow-hidden", "[&>svg]:size-4 [&>svg]:shrink-0"),
|
|
683
431
|
children: icon
|
|
684
432
|
}),
|
|
685
433
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -841,4 +589,4 @@ function DashboardSidebarNav({ groups, renderLink }) {
|
|
|
841
589
|
}
|
|
842
590
|
|
|
843
591
|
//#endregion
|
|
844
|
-
export { BetaBadge,
|
|
592
|
+
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, DashboardStandalonePage, DashboardStandalonePageAction, DashboardStandalonePageActions, DashboardStandalonePageContent, DashboardStandalonePageHeader, DashboardStandalonePageTitle, DeprecatedBadge, NewBadge, ProfessionalBadge, RoleBadge, TrialBadge, useCopyToClipboard, useSidebar as useDashboardSidebar };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aircall/blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "5.9.3",
|
|
68
68
|
"vite": "7.3.1",
|
|
69
69
|
"vitest": "4.0.17",
|
|
70
|
-
"@aircall/ds": "0.
|
|
70
|
+
"@aircall/ds": "0.11.0",
|
|
71
71
|
"@aircall/hooks": "0.5.1"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|