@almanaclabs/blaze-ui 0.10.0 → 0.11.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/components/app-shell/app-shell.d.ts +81 -0
- package/dist/components/app-shell/app-shell.d.ts.map +1 -0
- package/dist/components/app-shell/app-shell.js +144 -0
- package/dist/components/app-shell/index.d.ts +2 -0
- package/dist/components/app-shell/index.d.ts.map +1 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/chat-bar/chat-bar.d.ts +26 -0
- package/dist/components/chat-bar/chat-bar.d.ts.map +1 -0
- package/dist/components/chat-bar/chat-bar.js +58 -0
- package/dist/components/chat-bar/index.d.ts +2 -0
- package/dist/components/chat-bar/index.d.ts.map +1 -0
- package/dist/components/dense-table/dense-table.d.ts +36 -0
- package/dist/components/dense-table/dense-table.d.ts.map +1 -0
- package/dist/components/dense-table/dense-table.js +41 -0
- package/dist/components/dense-table/index.d.ts +2 -0
- package/dist/components/dense-table/index.d.ts.map +1 -0
- package/dist/components/editable-text/editable-text.d.ts +26 -0
- package/dist/components/editable-text/editable-text.d.ts.map +1 -0
- package/dist/components/editable-text/editable-text.js +82 -0
- package/dist/components/editable-text/index.d.ts +2 -0
- package/dist/components/editable-text/index.d.ts.map +1 -0
- package/dist/components/face-stack-button/face-stack-button.d.ts +31 -0
- package/dist/components/face-stack-button/face-stack-button.d.ts.map +1 -0
- package/dist/components/face-stack-button/face-stack-button.js +47 -0
- package/dist/components/face-stack-button/index.d.ts +2 -0
- package/dist/components/face-stack-button/index.d.ts.map +1 -0
- package/dist/components/goal-card/goal-card.d.ts +51 -0
- package/dist/components/goal-card/goal-card.d.ts.map +1 -0
- package/dist/components/goal-card/goal-card.js +109 -0
- package/dist/components/goal-card/index.d.ts +2 -0
- package/dist/components/goal-card/index.d.ts.map +1 -0
- package/dist/components/input-group/input-group.d.ts +1 -1
- package/dist/components/media-thumbnail/index.d.ts +2 -0
- package/dist/components/media-thumbnail/index.d.ts.map +1 -0
- package/dist/components/media-thumbnail/media-thumbnail.d.ts +21 -0
- package/dist/components/media-thumbnail/media-thumbnail.d.ts.map +1 -0
- package/dist/components/media-thumbnail/media-thumbnail.js +50 -0
- package/dist/components/metric-tile/index.d.ts +2 -0
- package/dist/components/metric-tile/index.d.ts.map +1 -0
- package/dist/components/metric-tile/metric-tile.d.ts +34 -0
- package/dist/components/metric-tile/metric-tile.d.ts.map +1 -0
- package/dist/components/metric-tile/metric-tile.js +75 -0
- package/dist/components/page-header/index.d.ts +2 -0
- package/dist/components/page-header/index.d.ts.map +1 -0
- package/dist/components/page-header/page-header.d.ts +16 -0
- package/dist/components/page-header/page-header.d.ts.map +1 -0
- package/dist/components/page-header/page-header.js +38 -0
- package/dist/components/platform-avatar/index.d.ts +2 -0
- package/dist/components/platform-avatar/index.d.ts.map +1 -0
- package/dist/components/platform-avatar/platform-avatar.d.ts +23 -0
- package/dist/components/platform-avatar/platform-avatar.d.ts.map +1 -0
- package/dist/components/platform-avatar/platform-avatar.js +54 -0
- package/dist/components/platform-icon/index.d.ts +2 -0
- package/dist/components/platform-icon/index.d.ts.map +1 -0
- package/dist/components/platform-icon/platform-icon.d.ts +33 -0
- package/dist/components/platform-icon/platform-icon.d.ts.map +1 -0
- package/dist/components/platform-icon/platform-icon.js +169 -0
- package/dist/components/sidebar/sidebar.js +19 -19
- package/dist/components/signal-strip/index.d.ts +2 -0
- package/dist/components/signal-strip/index.d.ts.map +1 -0
- package/dist/components/signal-strip/signal-strip.d.ts +34 -0
- package/dist/components/signal-strip/signal-strip.d.ts.map +1 -0
- package/dist/components/signal-strip/signal-strip.js +84 -0
- package/dist/components/source-avatar/index.d.ts +2 -0
- package/dist/components/source-avatar/index.d.ts.map +1 -0
- package/dist/components/source-avatar/source-avatar.d.ts +16 -0
- package/dist/components/source-avatar/source-avatar.d.ts.map +1 -0
- package/dist/components/source-avatar/source-avatar.js +15 -0
- package/dist/components/stacked-bar-chart/index.d.ts +2 -0
- package/dist/components/stacked-bar-chart/index.d.ts.map +1 -0
- package/dist/components/stacked-bar-chart/stacked-bar-chart.d.ts +80 -0
- package/dist/components/stacked-bar-chart/stacked-bar-chart.d.ts.map +1 -0
- package/dist/components/stacked-bar-chart/stacked-bar-chart.js +240 -0
- package/dist/components/state-banner/index.d.ts +2 -0
- package/dist/components/state-banner/index.d.ts.map +1 -0
- package/dist/components/state-banner/state-banner.d.ts +32 -0
- package/dist/components/state-banner/state-banner.d.ts.map +1 -0
- package/dist/components/state-banner/state-banner.js +70 -0
- package/dist/components/suggest-chips/index.d.ts +2 -0
- package/dist/components/suggest-chips/index.d.ts.map +1 -0
- package/dist/components/suggest-chips/suggest-chips.d.ts +13 -0
- package/dist/components/suggest-chips/suggest-chips.d.ts.map +1 -0
- package/dist/components/suggest-chips/suggest-chips.js +24 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -49
- package/package.json +1 -1
- package/src/styles/globals.css +40 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type AppShellProps = React.ComponentProps<'div'> & {
|
|
3
|
+
/** The left column, usually an `AppSidebar`. It spans both rows. */
|
|
4
|
+
sidebar?: React.ReactNode;
|
|
5
|
+
/** The top row right of the sidebar, usually an `AppTopBar`. */
|
|
6
|
+
topBar?: React.ReactNode;
|
|
7
|
+
/** Classes for the white main panel. */
|
|
8
|
+
mainClassName?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The application frame: a 188px sidebar column, a 56px top bar row, and the page in a white panel on the canvas.
|
|
12
|
+
* The panel is positioned, so a `ChatBar` or other floating element can sit inside it.
|
|
13
|
+
*/
|
|
14
|
+
declare function AppShell({ sidebar, topBar, mainClassName, className, children, ...props }: AppShellProps): React.JSX.Element;
|
|
15
|
+
type AppTopBarProps = React.ComponentProps<'header'> & {
|
|
16
|
+
/** Content at the end of the bar, such as the account avatar. */
|
|
17
|
+
end?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/** The header row right of the sidebar. `children` fill the start; `end` sits at the right. */
|
|
20
|
+
declare function AppTopBar({ end, className, children, ...props }: AppTopBarProps): React.JSX.Element;
|
|
21
|
+
type AppSidebarIcon = React.ComponentType<{
|
|
22
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
23
|
+
className?: string;
|
|
24
|
+
}>;
|
|
25
|
+
type AppSidebarItem = {
|
|
26
|
+
/** Unique within the sidebar; compared with `activeId`. */
|
|
27
|
+
id: string;
|
|
28
|
+
label: React.ReactNode;
|
|
29
|
+
icon?: AppSidebarIcon;
|
|
30
|
+
/** Something waiting for the owner. Shown as a count pill when above zero. */
|
|
31
|
+
count?: number;
|
|
32
|
+
/** Render the row as a link. */
|
|
33
|
+
href?: string;
|
|
34
|
+
onSelect?: () => void;
|
|
35
|
+
};
|
|
36
|
+
type AppSidebarSection = {
|
|
37
|
+
id: string;
|
|
38
|
+
/** The group label. Leave it out for an unlabelled group. */
|
|
39
|
+
label?: React.ReactNode;
|
|
40
|
+
items: readonly AppSidebarItem[];
|
|
41
|
+
};
|
|
42
|
+
type AppSidebarProps = Omit<React.ComponentProps<'aside'>, 'onSelect'> & {
|
|
43
|
+
/** The workspace switcher at the top, usually an `AppSidebarWorkspace`. */
|
|
44
|
+
workspace?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* The plain "New" row. It leads the first section when that section has no label, and otherwise sits in its own
|
|
47
|
+
* group. Its icon defaults to a plus.
|
|
48
|
+
*/
|
|
49
|
+
newItem?: Omit<AppSidebarItem, 'icon' | 'count'> & {
|
|
50
|
+
icon?: AppSidebarIcon;
|
|
51
|
+
};
|
|
52
|
+
sections: readonly AppSidebarSection[];
|
|
53
|
+
/** The group pinned to the bottom, such as settings. */
|
|
54
|
+
bottomItems?: readonly AppSidebarItem[];
|
|
55
|
+
/** The id of the current page. */
|
|
56
|
+
activeId?: string;
|
|
57
|
+
/** Called with the item whenever a row is picked, after the item's own `onSelect`. */
|
|
58
|
+
onNavigate?: (item: AppSidebarItem) => void;
|
|
59
|
+
/** The navigation landmark's name. */
|
|
60
|
+
navLabel?: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The application's left navigation: a workspace switcher, a plain "New" row, labelled sections of destinations with
|
|
64
|
+
* optional counts, and a group pinned to the bottom. The current destination is the raised white row.
|
|
65
|
+
*/
|
|
66
|
+
declare function AppSidebar({ workspace, newItem, sections, bottomItems, activeId, onNavigate, navLabel, className, ...props }: AppSidebarProps): React.JSX.Element;
|
|
67
|
+
type AppSidebarWorkspaceProps = {
|
|
68
|
+
/** The workspace or business name. */
|
|
69
|
+
name: string;
|
|
70
|
+
/** The workspace's logo, usually an `<img alt="">`. Shown at 32px. */
|
|
71
|
+
logo?: React.ReactNode;
|
|
72
|
+
/** The menu's items, such as `DropdownMenuItem`s for each workspace and "New workspace". */
|
|
73
|
+
children?: React.ReactNode;
|
|
74
|
+
/** The trigger's accessible name. Defaults to "Open workspace menu for <name>". */
|
|
75
|
+
triggerLabel?: string;
|
|
76
|
+
className?: string;
|
|
77
|
+
};
|
|
78
|
+
/** The workspace switcher at the top of `AppSidebar`: the logo and name, opening a menu. */
|
|
79
|
+
declare function AppSidebarWorkspace({ name, logo, children, triggerLabel, className, }: AppSidebarWorkspaceProps): React.JSX.Element;
|
|
80
|
+
export { AppShell, AppSidebar, AppSidebarWorkspace, AppTopBar, type AppShellProps, type AppSidebarIcon, type AppSidebarItem, type AppSidebarProps, type AppSidebarSection, type AppSidebarWorkspaceProps, type AppTopBarProps, };
|
|
81
|
+
//# sourceMappingURL=app-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuB9B,KAAK,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,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,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,GACpB,CAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../button/button.js";
|
|
3
|
+
import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuTrigger as i } from "../dropdown-menu/dropdown-menu.js";
|
|
4
|
+
import { SidebarGroup as a, SidebarGroupContent as o, SidebarGroupLabel as s, SidebarMenu as c, SidebarMenuBadge as l, SidebarMenuButton as u, SidebarMenuItem as d, SidebarProvider as f } from "../sidebar/sidebar.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
import { IconChevronDown as h, IconPlus as g } from "@tabler/icons-react";
|
|
8
|
+
//#region src/components/app-shell/app-shell.tsx
|
|
9
|
+
function _({ sidebar: t, topBar: n, mainClassName: r, className: i, children: a, ...o }) {
|
|
10
|
+
return /* @__PURE__ */ m("div", {
|
|
11
|
+
"data-slot": "app-shell",
|
|
12
|
+
className: e("grid min-h-screen grid-cols-[188px_minmax(0,1fr)] grid-rows-[56px_1fr] gap-x-2.5 bg-background px-4 pb-2.5 text-foreground", i),
|
|
13
|
+
...o,
|
|
14
|
+
children: [
|
|
15
|
+
t,
|
|
16
|
+
n ?? /* @__PURE__ */ p("div", { "data-slot": "app-shell-top-bar-placeholder" }),
|
|
17
|
+
/* @__PURE__ */ p("main", {
|
|
18
|
+
"data-slot": "app-shell-main",
|
|
19
|
+
className: e("relative min-w-0 rounded-2xl bg-card shadow-[0_1px_2px_rgb(0_0_0/0.04),0_6px_20px_rgb(0_0_0/0.07)]", r),
|
|
20
|
+
children: a
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function v({ end: t, className: n, children: r, ...i }) {
|
|
26
|
+
return /* @__PURE__ */ m("header", {
|
|
27
|
+
"data-slot": "app-top-bar",
|
|
28
|
+
className: e("flex min-w-0 items-center gap-3", n),
|
|
29
|
+
...i,
|
|
30
|
+
children: [/* @__PURE__ */ p("div", {
|
|
31
|
+
"data-slot": "app-top-bar-start",
|
|
32
|
+
className: "flex min-w-0 flex-1",
|
|
33
|
+
children: r
|
|
34
|
+
}), t ? /* @__PURE__ */ p("div", {
|
|
35
|
+
"data-slot": "app-top-bar-end",
|
|
36
|
+
className: "flex flex-none items-center gap-2",
|
|
37
|
+
children: t
|
|
38
|
+
}) : null]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function y({ item: e, active: t, onNavigate: n }) {
|
|
42
|
+
let r = e.icon;
|
|
43
|
+
return /* @__PURE__ */ m(d, {
|
|
44
|
+
"data-slot": "app-sidebar-item",
|
|
45
|
+
children: [/* @__PURE__ */ m(u, {
|
|
46
|
+
variant: "raised",
|
|
47
|
+
isActive: t,
|
|
48
|
+
"aria-current": t ? "page" : void 0,
|
|
49
|
+
render: e.href ? /* @__PURE__ */ p("a", { href: e.href }) : void 0,
|
|
50
|
+
onClick: () => {
|
|
51
|
+
e.onSelect?.(), n?.(e);
|
|
52
|
+
},
|
|
53
|
+
children: [r ? /* @__PURE__ */ p(r, { "aria-hidden": "true" }) : null, /* @__PURE__ */ p("span", { children: e.label })]
|
|
54
|
+
}), e.count ? /* @__PURE__ */ p(l, {
|
|
55
|
+
className: "top-1.5 rounded-full bg-primary/10 font-semibold text-primary",
|
|
56
|
+
children: e.count
|
|
57
|
+
}) : null]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function b({ label: e, children: t }) {
|
|
61
|
+
return /* @__PURE__ */ m(a, {
|
|
62
|
+
className: "p-0",
|
|
63
|
+
children: [e ? /* @__PURE__ */ p(s, {
|
|
64
|
+
className: "px-2.5",
|
|
65
|
+
children: e
|
|
66
|
+
}) : null, /* @__PURE__ */ p(o, { children: /* @__PURE__ */ p(c, {
|
|
67
|
+
className: "gap-px",
|
|
68
|
+
children: t
|
|
69
|
+
}) })]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function x({ workspace: t, newItem: n, sections: r, bottomItems: i, activeId: a, onNavigate: o, navLabel: s = "Workspace", className: c, ...l }) {
|
|
73
|
+
let u = (e) => /* @__PURE__ */ p(y, {
|
|
74
|
+
item: e,
|
|
75
|
+
active: e.id === a,
|
|
76
|
+
onNavigate: o
|
|
77
|
+
}, e.id), d = n ? u({
|
|
78
|
+
...n,
|
|
79
|
+
icon: n.icon ?? g
|
|
80
|
+
}) : null, [h, ..._] = r, v = !!(d && h && !h.label);
|
|
81
|
+
return /* @__PURE__ */ p("aside", {
|
|
82
|
+
"data-slot": "app-sidebar",
|
|
83
|
+
className: e("sticky top-0 row-span-2 flex h-screen flex-col self-start overflow-y-auto pt-2.5 pb-3", c),
|
|
84
|
+
...l,
|
|
85
|
+
children: /* @__PURE__ */ m(f, {
|
|
86
|
+
className: "contents",
|
|
87
|
+
children: [
|
|
88
|
+
t,
|
|
89
|
+
/* @__PURE__ */ m("nav", {
|
|
90
|
+
"aria-label": s,
|
|
91
|
+
className: "flex flex-col gap-4",
|
|
92
|
+
children: [
|
|
93
|
+
d && !v ? /* @__PURE__ */ p(b, { children: d }) : null,
|
|
94
|
+
h ? /* @__PURE__ */ m(b, {
|
|
95
|
+
label: h.label,
|
|
96
|
+
children: [v ? d : null, h.items.map(u)]
|
|
97
|
+
}, h.id) : null,
|
|
98
|
+
_.map((e) => /* @__PURE__ */ p(b, {
|
|
99
|
+
label: e.label,
|
|
100
|
+
children: e.items.map(u)
|
|
101
|
+
}, e.id))
|
|
102
|
+
]
|
|
103
|
+
}),
|
|
104
|
+
i?.length ? /* @__PURE__ */ p("div", {
|
|
105
|
+
"data-slot": "app-sidebar-bottom",
|
|
106
|
+
className: "mt-auto pt-4",
|
|
107
|
+
children: /* @__PURE__ */ p(b, { children: i.map(u) })
|
|
108
|
+
}) : null
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function S({ name: a, logo: o, children: s, triggerLabel: c, className: l }) {
|
|
114
|
+
return /* @__PURE__ */ m(n, { children: [/* @__PURE__ */ m(i, {
|
|
115
|
+
render: /* @__PURE__ */ p(t, {
|
|
116
|
+
type: "button",
|
|
117
|
+
variant: "tertiary",
|
|
118
|
+
size: "lg",
|
|
119
|
+
"data-slot": "app-sidebar-workspace",
|
|
120
|
+
"aria-label": c ?? `Open workspace menu for ${a}`,
|
|
121
|
+
className: e("mb-4 w-full justify-start gap-2.5 px-1.5", l)
|
|
122
|
+
}),
|
|
123
|
+
children: [
|
|
124
|
+
o ? /* @__PURE__ */ p("span", {
|
|
125
|
+
className: "flex size-8 flex-none items-center justify-center overflow-hidden rounded-md [&>img]:size-full [&>img]:object-cover",
|
|
126
|
+
children: o
|
|
127
|
+
}) : null,
|
|
128
|
+
/* @__PURE__ */ p("span", {
|
|
129
|
+
className: "type-label flex-1 truncate text-left font-medium",
|
|
130
|
+
children: a
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ p(h, {
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
className: "icon-optical-16 text-muted-foreground"
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}), s ? /* @__PURE__ */ p(r, {
|
|
138
|
+
align: "start",
|
|
139
|
+
className: "min-w-56",
|
|
140
|
+
children: s
|
|
141
|
+
}) : null] });
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { _ as AppShell, x as AppSidebar, S as AppSidebarWorkspace, v as AppTopBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "secondary" | "destructive" | "link" | "default" | "
|
|
4
|
+
variant?: "secondary" | "destructive" | "link" | "default" | "outline" | "success" | "warning" | "info" | "ghost" | "area-website" | "area-social" | "area-search" | "area-ads" | "area-calls" | "area-reviews" | null | undefined;
|
|
5
5
|
size?: "md" | "default" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
declare function Badge({ className, variant, size, render, ...props }: useRender.ComponentProps<'span'> & VariantProps<typeof badgeVariants>): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const chatBarFormVariants: (props?: ({
|
|
4
|
+
size?: "default" | "compact" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
type ChatBarProps = Omit<React.ComponentProps<'div'>, 'onSubmit' | 'defaultValue'> & VariantProps<typeof chatBarFormVariants> & {
|
|
7
|
+
/** Called with the trimmed message when the owner sends it. Empty messages are not sent. */
|
|
8
|
+
onSend?: (text: string) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** The input's accessible name. */
|
|
11
|
+
inputLabel?: string;
|
|
12
|
+
/** The send button's accessible name. */
|
|
13
|
+
sendLabel?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Float the bar at the foot of the scrolling panel, over a fade to the card surface. Turn it off to place the bar
|
|
17
|
+
* yourself.
|
|
18
|
+
*/
|
|
19
|
+
floating?: boolean;
|
|
20
|
+
/** Content under the bar, such as suggestion chips. */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
/** The chat bar: a floating rounded input with a round send button. Enter sends. */
|
|
24
|
+
declare function ChatBar({ onSend, placeholder, inputLabel, sendLabel, defaultValue, floating, size, className, children, ...props }: ChatBarProps): React.JSX.Element;
|
|
25
|
+
export { ChatBar, chatBarFormVariants, type ChatBarProps };
|
|
26
|
+
//# sourceMappingURL=chat-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-bar.d.ts","sourceRoot":"","sources":["../../../src/components/chat-bar/chat-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,mBAAmB;;8EAYxB,CAAA;AAcD,KAAK,YAAY,GAAG,IAAI,CACtB,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B,UAAU,GAAG,cAAc,CAC5B,GACC,YAAY,CAAC,OAAO,mBAAmB,CAAC,GAAG;IACzC,4FAA4F;IAC5F,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAEH,oFAAoF;AACpF,iBAAS,OAAO,CAAC,EACf,MAAM,EACN,WAAsD,EACtD,UAAsB,EACtB,SAAkB,EAClB,YAAiB,EACjB,QAAe,EACf,IAAgB,EAChB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,qBAqDd;AAED,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../button/button.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { cva as r } from "class-variance-authority";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { IconArrowUp as o } from "@tabler/icons-react";
|
|
7
|
+
//#region src/components/chat-bar/chat-bar.tsx
|
|
8
|
+
var s = r("pointer-events-auto mx-auto flex w-full items-center rounded-full border border-border bg-card", {
|
|
9
|
+
variants: { size: {
|
|
10
|
+
default: "min-h-[60px] max-w-[680px] gap-2.5 py-2 pr-2.5 pl-6 shadow-[0_10px_34px_-12px_rgb(0_0_0/.22),0_1px_3px_rgb(0_0_0/.06)]",
|
|
11
|
+
compact: "max-w-[560px] gap-2 py-1.5 pr-1.5 pl-5 shadow-sm"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { size: "default" }
|
|
14
|
+
}), c = r("flex-none rounded-full", {
|
|
15
|
+
variants: { size: {
|
|
16
|
+
default: "size-10 [--icon-stroke-width:var(--icon-stroke-20)] [&_svg:not([class*=size-])]:size-5",
|
|
17
|
+
compact: "size-8 [--icon-stroke-width:var(--icon-stroke-16)] [&_svg:not([class*=size-])]:size-4"
|
|
18
|
+
} },
|
|
19
|
+
defaultVariants: { size: "default" }
|
|
20
|
+
});
|
|
21
|
+
function l({ onSend: r, placeholder: l = "Ask me anything, or tell me what to do", inputLabel: u = "Message", sendLabel: d = "Send", defaultValue: f = "", floating: p = !0, size: m = "default", className: h, children: g, ..._ }) {
|
|
22
|
+
let [v, y] = n.useState(f), b = m === "compact" ? "max-w-[560px]" : "max-w-[680px]";
|
|
23
|
+
return /* @__PURE__ */ a("div", {
|
|
24
|
+
"data-slot": "chat-bar",
|
|
25
|
+
"data-size": m,
|
|
26
|
+
className: e(p && "pointer-events-none sticky bottom-0 z-10 rounded-b-2xl bg-linear-to-t from-card from-75% to-transparent px-6 pt-6 pb-6", h),
|
|
27
|
+
..._,
|
|
28
|
+
children: [/* @__PURE__ */ a("form", {
|
|
29
|
+
"data-slot": "chat-bar-form",
|
|
30
|
+
className: s({ size: m }),
|
|
31
|
+
onSubmit: (e) => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
let t = v.trim();
|
|
34
|
+
t && (r?.(t), y(""));
|
|
35
|
+
},
|
|
36
|
+
children: [/* @__PURE__ */ i("input", {
|
|
37
|
+
"data-slot": "chat-bar-input",
|
|
38
|
+
"aria-label": u,
|
|
39
|
+
value: v,
|
|
40
|
+
onChange: (e) => y(e.target.value),
|
|
41
|
+
placeholder: l,
|
|
42
|
+
className: "type-body min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-foreground-tertiary"
|
|
43
|
+
}), /* @__PURE__ */ i(t, {
|
|
44
|
+
type: "submit",
|
|
45
|
+
"aria-label": d,
|
|
46
|
+
size: m === "compact" ? "icon-md" : "icon-lg",
|
|
47
|
+
className: c({ size: m }),
|
|
48
|
+
children: /* @__PURE__ */ i(o, { "aria-hidden": "true" })
|
|
49
|
+
})]
|
|
50
|
+
}), g ? /* @__PURE__ */ i("div", {
|
|
51
|
+
"data-slot": "chat-bar-footer",
|
|
52
|
+
className: e("pointer-events-auto mx-auto mt-3", b),
|
|
53
|
+
children: g
|
|
54
|
+
}) : null]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { l as ChatBar, s as chatBarFormVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-bar/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TableRow } from '../table';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface DenseTableColumn {
|
|
4
|
+
/** The header text. An empty header still needs `srLabel` for screen readers. */
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
/** Right-aligns the header to sit over numbers. */
|
|
7
|
+
numeric?: boolean;
|
|
8
|
+
/** Names a column whose header is visually empty. */
|
|
9
|
+
srLabel?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DenseTableProps extends Omit<React.ComponentProps<'div'>, 'children'> {
|
|
13
|
+
columns: readonly DenseTableColumn[];
|
|
14
|
+
/** The rows: `DenseTableRow`s of `DenseTableCell`s. */
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/** Names the table for assistive technology. */
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A data-heavy table on a white card: compact rows, small muted headers and
|
|
21
|
+
* right-aligned numbers, for scanning many figures at once.
|
|
22
|
+
*/
|
|
23
|
+
declare function DenseTable({ columns, children, className, 'aria-label': ariaLabel, ...props }: DenseTableProps): React.JSX.Element;
|
|
24
|
+
declare const DenseTableRow: typeof TableRow;
|
|
25
|
+
export interface DenseTableCellProps extends React.ComponentProps<'td'> {
|
|
26
|
+
/** Right-aligned tabular figures in medium weight. */
|
|
27
|
+
numeric?: boolean;
|
|
28
|
+
/** A muted line under a number, such as "vs 120 the week before". */
|
|
29
|
+
sub?: React.ReactNode;
|
|
30
|
+
/** Text that wraps instead of staying on one line. Defaults to true for text cells. */
|
|
31
|
+
wrap?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A dense cell: wrapping text, or a right-aligned number with an optional muted line. */
|
|
34
|
+
declare function DenseTableCell({ numeric, sub, wrap, className, children, ...props }: DenseTableCellProps): React.JSX.Element;
|
|
35
|
+
export { DenseTable, DenseTableCell, DenseTableRow };
|
|
36
|
+
//# sourceMappingURL=dense-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dense-table.d.ts","sourceRoot":"","sources":["../../../src/components/dense-table/dense-table.tsx"],"names":[],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|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Table as t, TableBody as n, TableCell as r, TableHead as i, TableHeader as a, TableRow as o } from "../table/table.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/dense-table/dense-table.tsx
|
|
6
|
+
function l({ columns: r, children: l, className: u, "aria-label": d, ...f }) {
|
|
7
|
+
return /* @__PURE__ */ s("div", {
|
|
8
|
+
"data-slot": "dense-table",
|
|
9
|
+
className: e("overflow-x-auto rounded-xl border border-border bg-card px-2", u),
|
|
10
|
+
...f,
|
|
11
|
+
children: /* @__PURE__ */ c(t, {
|
|
12
|
+
density: "compact",
|
|
13
|
+
"aria-label": d,
|
|
14
|
+
children: [/* @__PURE__ */ s(a, { children: /* @__PURE__ */ s(o, { children: r.map((t, n) => /* @__PURE__ */ c(i, {
|
|
15
|
+
"data-numeric": t.numeric ? "" : void 0,
|
|
16
|
+
className: e("type-meta font-medium text-muted-foreground", t.numeric && "text-right", t.className),
|
|
17
|
+
children: [t.label, t.srLabel ? /* @__PURE__ */ s("span", {
|
|
18
|
+
className: "sr-only",
|
|
19
|
+
children: t.srLabel
|
|
20
|
+
}) : null]
|
|
21
|
+
}, n)) }) }), /* @__PURE__ */ s(n, { children: l })]
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var u = o;
|
|
26
|
+
function d({ numeric: t = !1, sub: n, wrap: i = !t, className: a, children: o, ...l }) {
|
|
27
|
+
return /* @__PURE__ */ c(r, {
|
|
28
|
+
"data-numeric": t ? "" : void 0,
|
|
29
|
+
className: e("type-body align-top", t && "text-right tabular-nums", i && "whitespace-normal", a),
|
|
30
|
+
...l,
|
|
31
|
+
children: [t ? /* @__PURE__ */ s("span", {
|
|
32
|
+
className: "font-medium",
|
|
33
|
+
children: o
|
|
34
|
+
}) : o, n ? /* @__PURE__ */ s("span", {
|
|
35
|
+
className: "type-meta block text-muted-foreground",
|
|
36
|
+
children: n
|
|
37
|
+
}) : null]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { l as DenseTable, d as DenseTableCell, u as DenseTableRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dense-table/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type EditableTextProps = Omit<React.ComponentProps<'div'>, 'onChange'> & {
|
|
3
|
+
/** The saved text. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Called with the new text when the owner saves a change. */
|
|
6
|
+
onSave?: (text: string) => void;
|
|
7
|
+
/** A short confirmation shown under the text after a save. Pass an empty string to show nothing. */
|
|
8
|
+
note?: React.ReactNode;
|
|
9
|
+
/** Start in the text box, e.g. when a "Change" button mounts it. */
|
|
10
|
+
defaultEditing?: boolean;
|
|
11
|
+
/** Always show the pencil and underline the text, for a page's edit mode. */
|
|
12
|
+
pencil?: boolean;
|
|
13
|
+
/** The type role for the text and the text box. */
|
|
14
|
+
textClassName?: string;
|
|
15
|
+
/** The text box's accessible name. */
|
|
16
|
+
inputLabel?: string;
|
|
17
|
+
saveLabel?: React.ReactNode;
|
|
18
|
+
cancelLabel?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Text the owner can change in place. A click turns it into a text box with Save and Cancel; Enter saves (Shift+Enter
|
|
22
|
+
* adds a line) and Escape cancels.
|
|
23
|
+
*/
|
|
24
|
+
declare function EditableText({ value, onSave, note, defaultEditing, pencil, textClassName, inputLabel, saveLabel, cancelLabel, className, ...props }: EditableTextProps): React.JSX.Element;
|
|
25
|
+
export { EditableText, type EditableTextProps };
|
|
26
|
+
//# sourceMappingURL=editable-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable-text.d.ts","sourceRoot":"","sources":["../../../src/components/editable-text/editable-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,oGAAoG;IACpG,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,oEAAoE;IACpE,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC9B,CAAA;AAED;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,KAAK,EACL,MAAM,EACN,IAAe,EACf,cAAsB,EACtB,MAAc,EACd,aAA2B,EAC3B,UAAwB,EACxB,SAAkB,EAClB,WAAsB,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,qBAkJnB;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../button/button.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { IconPencil as o } from "@tabler/icons-react";
|
|
6
|
+
//#region src/components/editable-text/editable-text.tsx
|
|
7
|
+
function s({ value: s, onSave: c, note: l = "Saved.", defaultEditing: u = !1, pencil: d = !1, textClassName: f = "type-body", inputLabel: p = "Edit text", saveLabel: m = "Save", cancelLabel: h = "Cancel", className: g, ..._ }) {
|
|
8
|
+
let [v, y] = n.useState(s), [b, x] = n.useState(s), [S, C] = n.useState(u), [w, T] = n.useState(!1), [E, D] = n.useState(s), O = n.useRef(null), k = n.useRef(null), A = n.useRef(!1);
|
|
9
|
+
s !== E && (D(s), y(s), S || x(s)), n.useEffect(() => {
|
|
10
|
+
let e = O.current;
|
|
11
|
+
!S || !e || (e.focus(), e.setSelectionRange(e.value.length, e.value.length));
|
|
12
|
+
}, [S]), n.useEffect(() => {
|
|
13
|
+
let e = O.current;
|
|
14
|
+
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
15
|
+
}, [b, S]), n.useEffect(() => {
|
|
16
|
+
!S && A.current && (A.current = !1, k.current?.focus());
|
|
17
|
+
}, [S]);
|
|
18
|
+
let j = () => {
|
|
19
|
+
A.current = !0, C(!1);
|
|
20
|
+
}, M = () => {
|
|
21
|
+
let e = b.trim();
|
|
22
|
+
e && e !== v && (y(e), T(!0), c?.(e)), j();
|
|
23
|
+
}, N = () => {
|
|
24
|
+
x(v), j();
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ i("div", {
|
|
27
|
+
"data-slot": "editable-text",
|
|
28
|
+
"data-state": S ? "editing" : "idle",
|
|
29
|
+
className: g,
|
|
30
|
+
..._,
|
|
31
|
+
children: S ? /* @__PURE__ */ a("div", {
|
|
32
|
+
className: "flex flex-col gap-2",
|
|
33
|
+
children: [/* @__PURE__ */ i("textarea", {
|
|
34
|
+
ref: O,
|
|
35
|
+
"data-slot": "editable-text-input",
|
|
36
|
+
"aria-label": p,
|
|
37
|
+
value: b,
|
|
38
|
+
rows: 1,
|
|
39
|
+
onChange: (e) => x(e.target.value),
|
|
40
|
+
onKeyDown: (e) => {
|
|
41
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), M()), e.key === "Escape" && (e.preventDefault(), N());
|
|
42
|
+
},
|
|
43
|
+
className: e(f, "w-full resize-none overflow-hidden rounded-sm border border-border bg-card px-2.5 py-1.5 text-foreground outline-none focus:border-ring")
|
|
44
|
+
}), /* @__PURE__ */ a("div", {
|
|
45
|
+
className: "flex gap-2",
|
|
46
|
+
children: [/* @__PURE__ */ i(t, {
|
|
47
|
+
size: "sm",
|
|
48
|
+
variant: "primary",
|
|
49
|
+
onClick: M,
|
|
50
|
+
children: m
|
|
51
|
+
}), /* @__PURE__ */ i(t, {
|
|
52
|
+
size: "sm",
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
onClick: N,
|
|
55
|
+
children: h
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
}) : /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("button", {
|
|
59
|
+
ref: k,
|
|
60
|
+
type: "button",
|
|
61
|
+
"data-slot": "editable-text-trigger",
|
|
62
|
+
onClick: () => {
|
|
63
|
+
x(v), C(!0), T(!1);
|
|
64
|
+
},
|
|
65
|
+
className: e(f, "group/editable -mx-1.5 flex w-[calc(100%+12px)] items-start gap-2 rounded-sm px-1.5 text-left text-foreground outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-border-subtle"),
|
|
66
|
+
children: [/* @__PURE__ */ i("span", {
|
|
67
|
+
className: e("flex-1 whitespace-pre-line", d && "underline decoration-foreground-tertiary/50 decoration-dotted underline-offset-4"),
|
|
68
|
+
children: v
|
|
69
|
+
}), /* @__PURE__ */ i(o, {
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
className: e("icon-optical-14 mt-1 shrink-0 text-muted-foreground", d ? "opacity-100" : "opacity-0 group-hover/editable:opacity-100 group-focus-visible/editable:opacity-100")
|
|
72
|
+
})]
|
|
73
|
+
}), w && l ? /* @__PURE__ */ i("p", {
|
|
74
|
+
"data-slot": "editable-text-note",
|
|
75
|
+
role: "status",
|
|
76
|
+
className: "type-meta mt-0.5 text-success",
|
|
77
|
+
children: l
|
|
78
|
+
}) : null] })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { s as EditableText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/editable-text/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ButtonProps } from '../button';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type FaceStackFace = {
|
|
4
|
+
/** Profile photo; without one the first letter of `name` shows. */
|
|
5
|
+
src?: string | null;
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
type FaceStackButtonProps = Omit<ButtonProps, 'children' | 'size' | 'className'> & {
|
|
9
|
+
className?: string;
|
|
10
|
+
/** The people or accounts behind the destination. Only the first `max` are drawn. */
|
|
11
|
+
faces: readonly FaceStackFace[];
|
|
12
|
+
/** How many faces overlap at the start of the button. */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** `md` for a row or section header (20px faces), `lg` beside a page title (26px faces). */
|
|
15
|
+
size?: 'md' | 'lg';
|
|
16
|
+
/** The destination's name, in the button's own weight. */
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
/** A count, in the quiet tone after the label. */
|
|
19
|
+
count?: React.ReactNode;
|
|
20
|
+
/** Words after the count, in the same quiet tone ("from accounts you watch"). */
|
|
21
|
+
detail?: React.ReactNode;
|
|
22
|
+
/** The trailing chevron that says the button opens somewhere. */
|
|
23
|
+
showChevron?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A secondary button led by a stack of overlapping faces, then a label and a count.
|
|
27
|
+
* It opens the place those people live (a watch list, followers, a team) on click.
|
|
28
|
+
*/
|
|
29
|
+
declare function FaceStackButton({ faces, max, size, label, count, detail, showChevron, variant, className, ...props }: FaceStackButtonProps): React.JSX.Element;
|
|
30
|
+
export { FaceStackButton, type FaceStackButtonProps, type FaceStackFace };
|
|
31
|
+
//# sourceMappingURL=face-stack-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face-stack-button.d.ts","sourceRoot":"","sources":["../../../src/components/face-stack-button/face-stack-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAA;AAGpD,KAAK,aAAa,GAAG;IACnB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAC9B,WAAW,EACX,UAAU,GAAG,MAAM,GAAG,WAAW,CAClC,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qFAAqF;IACrF,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;IAC/B,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4FAA4F;IAC5F,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,iFAAiF;IACjF,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED;;;GAGG;AACH,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,GAAO,EACP,IAAW,EACX,KAAK,EACL,KAAK,EACL,MAAM,EACN,WAAkB,EAClB,OAAqB,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAoDtB;AAED,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,KAAK,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../button/button.js";
|
|
3
|
+
import { AvatarGroup as n } from "../avatar/avatar.js";
|
|
4
|
+
import { PlatformAvatar as r } from "../platform-avatar/platform-avatar.js";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { IconChevronRight as s } from "@tabler/icons-react";
|
|
8
|
+
//#region src/components/face-stack-button/face-stack-button.tsx
|
|
9
|
+
function c({ faces: c, max: l = 4, size: u = "md", label: d, count: f, detail: p, showChevron: m = !0, variant: h = "secondary", className: g, ..._ }) {
|
|
10
|
+
let v = u === "lg" ? 26 : 20, y = [f, p].filter((e) => e != null && e !== "");
|
|
11
|
+
return /* @__PURE__ */ o(t, {
|
|
12
|
+
"data-face-stack": "",
|
|
13
|
+
size: u,
|
|
14
|
+
variant: h,
|
|
15
|
+
className: e("gap-2.5 pl-1.5", g),
|
|
16
|
+
..._,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ a(n, {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
className: "-space-x-2 *:data-[slot=avatar]:ring-card",
|
|
21
|
+
children: c.slice(0, l).map((e, t) => /* @__PURE__ */ a(r, {
|
|
22
|
+
src: e.src,
|
|
23
|
+
name: e.name,
|
|
24
|
+
size: v
|
|
25
|
+
}, `${e.name}-${t}`))
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ o("span", {
|
|
28
|
+
"data-slot": "face-stack-button-text",
|
|
29
|
+
children: [
|
|
30
|
+
d,
|
|
31
|
+
d !== void 0 && y.length > 0 ? " " : null,
|
|
32
|
+
y.length > 0 ? /* @__PURE__ */ a("span", {
|
|
33
|
+
"data-slot": "face-stack-button-count",
|
|
34
|
+
className: "font-normal text-muted-foreground",
|
|
35
|
+
children: y.map((e, t) => /* @__PURE__ */ o(i.Fragment, { children: [t > 0 ? " " : null, e] }, t))
|
|
36
|
+
}) : null
|
|
37
|
+
]
|
|
38
|
+
}),
|
|
39
|
+
m ? /* @__PURE__ */ a(s, {
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
className: "size-4 text-muted-foreground"
|
|
42
|
+
}) : null
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { c as FaceStackButton };
|