@devalok/shilp-sutra 0.48.0 → 0.49.1
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/BREAKING.json +32 -0
- package/MIGRATION.md +891 -881
- package/dist/_chunks/badge-group.js +52 -65
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/block-shell.js +1 -1
- package/dist/_chunks/chart-container.js +1 -1
- package/dist/_chunks/chat.js +4 -4
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/colors.js +2 -2
- package/dist/_chunks/document-preview.js +4 -4
- package/dist/_chunks/emoji-suggestion.js +5 -5
- package/dist/_chunks/emoji-suggestion.js.map +1 -1
- package/dist/_chunks/emoji.js +1 -1
- package/dist/_chunks/field-state.js +8 -0
- package/dist/_chunks/field-state.js.map +1 -0
- package/dist/_chunks/grid-lines.js +1 -1
- package/dist/_chunks/image-preview.js +7 -7
- package/dist/_chunks/keybinding.js +1 -1
- package/dist/_chunks/link-context.js +1 -1
- package/dist/_chunks/mention-suggestion.js +2 -2
- package/dist/_chunks/mention.js +1 -1
- package/dist/_chunks/motion-provider.js +1 -1
- package/dist/_chunks/normalize-icon.js +1 -1
- package/dist/_chunks/oauth-button.js +2 -2
- package/dist/_chunks/popover.js +55 -52
- package/dist/_chunks/popover.js.map +1 -1
- package/dist/_chunks/primitives.js +155 -155
- package/dist/_chunks/primitives.js.map +1 -1
- package/dist/_chunks/shared.js +5 -5
- package/dist/_chunks/success.js +4 -4
- package/dist/_chunks/tiptap.js +8 -8
- package/dist/_chunks/tooltip.js +1 -1
- package/dist/_chunks/tree-view.js +2 -2
- package/dist/_chunks/use-calendar.js +2 -2
- package/dist/_chunks/use-calendar.js.map +1 -1
- package/dist/_chunks/use-controllable-open.js +15 -0
- package/dist/_chunks/use-controllable-open.js.map +1 -0
- package/dist/_chunks/vendor-client.js +1 -1
- package/dist/_chunks/vendor-utils.js +1 -1
- package/dist/ai/block-renderer.js +7 -7
- package/dist/ai/blocks/error.js +1 -1
- package/dist/ai/blocks/index.js +2 -2
- package/dist/ai/blocks/text.js +1 -1
- package/dist/ai/command-bar.js +6 -6
- package/dist/ai/conversation.js +2 -2
- package/dist/ai/index.js +3 -3
- package/dist/composed/avatar-group.js +1 -1
- package/dist/composed/bulk-action-bar.js +1 -1
- package/dist/composed/command-palette.js +9 -9
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/confirm-dialog.js +3 -3
- package/dist/composed/confirm-dialog.js.map +1 -1
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/date-picker/index.js +13 -13
- package/dist/composed/date-picker/index.js.map +1 -1
- package/dist/composed/emoji-picker.js +4 -4
- package/dist/composed/empty-state.js +1 -1
- package/dist/composed/error-boundary.js +1 -1
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/extensions/emoji-node.js +1 -1
- package/dist/composed/extensions/emoji-suggestion.js +1 -1
- package/dist/composed/file-preview.js +14 -14
- package/dist/composed/filter-bar.js +1 -1
- package/dist/composed/index.d.ts +3 -1
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +4 -3
- package/dist/composed/loading-skeleton.js +15 -15
- package/dist/composed/loading-skeleton.js.map +1 -1
- package/dist/composed/multi-select-popover.js +3 -3
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-header.js +32 -45
- package/dist/composed/page-header.js.map +1 -1
- package/dist/composed/page-skeletons.js +19 -19
- package/dist/composed/page-skeletons.js.map +1 -1
- package/dist/composed/priority-indicator.js +1 -1
- package/dist/composed/responsive-modal.d.ts +39 -0
- package/dist/composed/responsive-modal.d.ts.map +1 -0
- package/dist/composed/responsive-modal.js +212 -0
- package/dist/composed/responsive-modal.js.map +1 -0
- package/dist/composed/rich-chat-input.js +445 -445
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.js +29 -29
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/schedule-view.d.ts +1 -1
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/composed/schedule-view.js +48 -54
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/composed/status-badge.d.ts +13 -11
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +54 -130
- package/dist/composed/status-badge.js.map +1 -1
- package/dist/motion/index.js +2 -2
- package/dist/shell/bottom-navbar.js +3 -3
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/index.js +2 -2
- package/dist/shell/link-context.js +2 -2
- package/dist/shell/notification-center.js +3 -3
- package/dist/shell/sidebar.js +2 -2
- package/dist/shell/top-bar.js +2 -2
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/semantic.css +8 -1
- package/dist/ui/accordion.js +11 -11
- package/dist/ui/alert-dialog.js +34 -34
- package/dist/ui/alert.js +1 -1
- package/dist/ui/aspect-ratio.js +1 -1
- package/dist/ui/autocomplete.js +7 -7
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +84 -79
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge-group.js +1 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/banner.js +1 -1
- package/dist/ui/breadcrumb.d.ts +0 -1
- package/dist/ui/breadcrumb.d.ts.map +1 -1
- package/dist/ui/breadcrumb.js +58 -35
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.js +3 -3
- package/dist/ui/card.js +1 -1
- package/dist/ui/charts/area-chart.js +6 -6
- package/dist/ui/charts/bar-chart.js +6 -6
- package/dist/ui/charts/chart-container.js +1 -1
- package/dist/ui/charts/gauge-chart.js +2 -2
- package/dist/ui/charts/index.js +2 -2
- package/dist/ui/charts/line-chart.js +6 -6
- package/dist/ui/charts/pie-chart.js +5 -5
- package/dist/ui/charts/radar-chart.js +5 -5
- package/dist/ui/charts/sparkline.js +2 -2
- package/dist/ui/chat/index.js +2 -2
- package/dist/ui/checkbox.d.ts +4 -2
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +33 -28
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/collapsible.js +5 -5
- package/dist/ui/color-input.js +4 -4
- package/dist/ui/combobox.d.ts +3 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +137 -132
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.js +32 -32
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +49 -46
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dot.d.ts +38 -0
- package/dist/ui/dot.d.ts.map +1 -0
- package/dist/ui/dot.js +92 -0
- package/dist/ui/dot.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +81 -76
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/hover-card.js +6 -6
- package/dist/ui/icon-button.js +1 -1
- package/dist/ui/index.d.ts +3 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +67 -67
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.d.ts +4 -2
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +39 -38
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/lib/field-state.d.ts +21 -0
- package/dist/ui/lib/field-state.d.ts.map +1 -0
- package/dist/ui/lib/use-controllable-open.d.ts +32 -0
- package/dist/ui/lib/use-controllable-open.d.ts.map +1 -0
- package/dist/ui/lib/utils.js +4 -4
- package/dist/ui/link.js +1 -1
- package/dist/ui/menubar.js +53 -53
- package/dist/ui/navigation-menu.js +27 -27
- package/dist/ui/number-input.d.ts +4 -2
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +52 -51
- package/dist/ui/number-input.js.map +1 -1
- package/dist/ui/oauth-button/index.js +2 -2
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +2 -2
- package/dist/ui/progress.d.ts +66 -42
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +144 -40
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio.d.ts +6 -2
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +44 -33
- package/dist/ui/radio.js.map +1 -1
- package/dist/ui/segmented-control.js +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +56 -55
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/separator.js +2 -2
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +56 -53
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/sidebar.js +6 -6
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/slider.js +8 -8
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/split-button.js +3 -3
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +123 -126
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stat-flash.js +1 -1
- package/dist/ui/stepper.js +1 -1
- package/dist/ui/surface.js +2 -2
- package/dist/ui/switch.d.ts +3 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +32 -27
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table-row-link.js +1 -1
- package/dist/ui/tabs.js +13 -13
- package/dist/ui/text.js +1 -1
- package/dist/ui/textarea.d.ts +3 -3
- package/dist/ui/textarea.d.ts.map +1 -1
- package/dist/ui/textarea.js +19 -18
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toast.js +2 -2
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +2 -2
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +37 -34
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/ui/tree-view/index.js +2 -2
- package/docs/components/ai/ai-command-provider.md +46 -0
- package/docs/components/ai/block-renderer.md +59 -0
- package/docs/components/ai/command-bar.md +78 -0
- package/docs/components/ai/conversation.md +59 -0
- package/docs/components/ai/devadoot-icon.md +41 -0
- package/docs/components/composed/page-header.md +1 -1
- package/docs/components/composed/responsive-modal.md +66 -0
- package/docs/components/composed/schedule-view.md +6 -2
- package/docs/components/ui/breadcrumb.md +1 -1
- package/docs/components/ui/checkbox.md +4 -1
- package/docs/components/ui/combobox.md +4 -0
- package/docs/components/ui/dot.md +61 -0
- package/docs/components/ui/progress.md +54 -16
- package/docs/components/ui/radio.md +6 -2
- package/docs/components/ui/select.md +9 -5
- package/docs/components/ui/switch.md +4 -1
- package/docs/components/ui/table.md +2 -1
- package/llms.txt +11 -3
- package/make-kit/components/form.md +2 -2
- package/make-kit/components/icon.md +2 -2
- package/make-kit/components/overview.md +2 -2
- package/make-kit/components/select.md +1 -1
- package/make-kit/components/table.md +1 -1
- package/mcp-manifest.json +2656 -1068
- package/mcp-manifest.schema.json +18 -0
- package/package.json +11 -6
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +11 -3
- package/dist/ui/status-dot.d.ts +0 -27
- package/dist/ui/status-dot.d.ts.map +0 -1
- package/dist/ui/status-dot.js +0 -68
- package/dist/ui/status-dot.js.map +0 -1
- package/docs/components/ui/status-dot.md +0 -35
package/dist/ui/avatar.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Fallback as e, Image as t, Root$6 as n } from "../_chunks/primitives.js";
|
|
3
3
|
import { springs as r } from "./lib/motion.js";
|
|
4
|
-
import {
|
|
4
|
+
import { cva as i } from "../_chunks/vendor-utils.js";
|
|
5
5
|
import { cn as a } from "./lib/utils.js";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { Dot as o } from "./dot.js";
|
|
7
|
+
import { Skeleton as s } from "./skeleton.js";
|
|
8
|
+
import * as c from "react";
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
import { motion as d, useReducedMotion as f } from "framer-motion";
|
|
10
11
|
//#region src/ui/avatar.tsx
|
|
11
|
-
var
|
|
12
|
+
var p = c.createContext("circle"), m = c.createContext("md"), h = i("relative flex shrink-0 overflow-hidden", {
|
|
12
13
|
variants: {
|
|
13
14
|
size: {
|
|
14
15
|
xs: "h-ds-xs w-ds-xs",
|
|
@@ -27,37 +28,37 @@ var f = s.createContext("circle"), p = s.createContext("md"), m = i("relative fl
|
|
|
27
28
|
size: "md",
|
|
28
29
|
shape: "circle"
|
|
29
30
|
}
|
|
30
|
-
}),
|
|
31
|
-
online: "
|
|
32
|
-
offline: "
|
|
33
|
-
busy: "
|
|
34
|
-
away: "
|
|
35
|
-
},
|
|
31
|
+
}), g = {
|
|
32
|
+
online: "success",
|
|
33
|
+
offline: "neutral",
|
|
34
|
+
busy: "error",
|
|
35
|
+
away: "warning"
|
|
36
|
+
}, _ = {
|
|
36
37
|
online: "Online",
|
|
37
38
|
offline: "Offline",
|
|
38
39
|
busy: "Busy",
|
|
39
40
|
away: "Away"
|
|
40
|
-
}, _ = {
|
|
41
|
-
xs: "h-ds-02b w-ds-02b",
|
|
42
|
-
sm: "h-[8px] w-[8px]",
|
|
43
|
-
md: "h-ds-03 w-ds-03",
|
|
44
|
-
lg: "h-[12px] w-[12px]",
|
|
45
|
-
xl: "h-ds-04 w-ds-04"
|
|
46
41
|
}, v = {
|
|
42
|
+
xs: "xs",
|
|
43
|
+
sm: "sm",
|
|
44
|
+
md: "md",
|
|
45
|
+
lg: "lg",
|
|
46
|
+
xl: "lg"
|
|
47
|
+
}, y = {
|
|
47
48
|
lead: "ring-accent-7",
|
|
48
49
|
admin: "ring-warning-7",
|
|
49
50
|
client: "ring-info-7"
|
|
50
|
-
},
|
|
51
|
+
}, b = {
|
|
51
52
|
circle: "rounded-pill",
|
|
52
53
|
square: "rounded-none",
|
|
53
54
|
rounded: "rounded-control"
|
|
54
|
-
},
|
|
55
|
+
}, x = {
|
|
55
56
|
xs: "text-ds-2xs",
|
|
56
57
|
sm: "text-ds-xs",
|
|
57
58
|
md: "text-ds-sm",
|
|
58
59
|
lg: "text-ds-md",
|
|
59
60
|
xl: "text-ds-lg"
|
|
60
|
-
},
|
|
61
|
+
}, S = [
|
|
61
62
|
{
|
|
62
63
|
bg: "bg-accent-3",
|
|
63
64
|
text: "text-accent-11"
|
|
@@ -91,85 +92,89 @@ var f = s.createContext("circle"), p = s.createContext("md"), m = i("relative fl
|
|
|
91
92
|
text: "text-category-cyan-11"
|
|
92
93
|
}
|
|
93
94
|
];
|
|
94
|
-
function
|
|
95
|
+
function C(e) {
|
|
95
96
|
let t = 5381;
|
|
96
97
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) | 0;
|
|
97
|
-
return
|
|
98
|
+
return S[Math.abs(t) % S.length];
|
|
98
99
|
}
|
|
99
|
-
var
|
|
100
|
-
let
|
|
101
|
-
if (
|
|
102
|
-
ref:
|
|
103
|
-
className: a("relative inline-flex shrink-0",
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
className: a(
|
|
100
|
+
var w = c.forwardRef(({ className: e, size: t, shape: i, status: c, ring: x, badge: S, loading: C, children: w, ...T }, E) => {
|
|
101
|
+
let D = i ?? "circle", O = f(), k = x && x !== "none" ? a("ring-2 ring-offset-2 ring-offset-surface-raised", y[x], b[D]) : void 0;
|
|
102
|
+
if (C) return /* @__PURE__ */ l("span", {
|
|
103
|
+
ref: E,
|
|
104
|
+
className: a("relative inline-flex shrink-0", k),
|
|
105
|
+
children: /* @__PURE__ */ l(s, {
|
|
106
|
+
className: a(h({
|
|
106
107
|
size: t,
|
|
107
108
|
shape: i
|
|
108
109
|
})),
|
|
109
110
|
"data-slot": "avatar-skeleton"
|
|
110
111
|
})
|
|
111
112
|
});
|
|
112
|
-
let
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
value:
|
|
115
|
-
children: /* @__PURE__ */
|
|
113
|
+
let A = S !== void 0 && S !== 0;
|
|
114
|
+
return /* @__PURE__ */ l(p.Provider, {
|
|
115
|
+
value: D,
|
|
116
|
+
children: /* @__PURE__ */ l(m.Provider, {
|
|
116
117
|
value: t ?? "md",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
className: a("relative inline-flex shrink-0",
|
|
118
|
+
children: /* @__PURE__ */ u("span", {
|
|
119
|
+
className: a("relative inline-flex shrink-0", k),
|
|
119
120
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
ref:
|
|
122
|
-
className: a(
|
|
121
|
+
/* @__PURE__ */ l(n, {
|
|
122
|
+
ref: E,
|
|
123
|
+
className: a(h({
|
|
123
124
|
size: t,
|
|
124
125
|
shape: i
|
|
125
126
|
}), e),
|
|
126
|
-
...
|
|
127
|
-
children:
|
|
127
|
+
...T,
|
|
128
|
+
children: w
|
|
128
129
|
}),
|
|
129
|
-
|
|
130
|
-
className:
|
|
131
|
-
animate: { opacity: [
|
|
132
|
-
1,
|
|
133
|
-
.75,
|
|
134
|
-
1
|
|
135
|
-
] },
|
|
136
|
-
transition: {
|
|
137
|
-
duration: 2.5,
|
|
138
|
-
repeat: Infinity,
|
|
139
|
-
ease: "easeInOut"
|
|
140
|
-
},
|
|
141
|
-
role: "img",
|
|
142
|
-
"aria-label": g[s]
|
|
143
|
-
}) : /* @__PURE__ */ c("span", {
|
|
144
|
-
className: a("absolute bottom-0 right-0 rounded-pill ring-2 ring-surface-raised", h[s], _[t ?? "md"]),
|
|
130
|
+
c && /* @__PURE__ */ l(d.span, {
|
|
131
|
+
className: "absolute bottom-0 right-0",
|
|
145
132
|
role: "img",
|
|
146
|
-
"aria-label":
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
"aria-label": _[c],
|
|
134
|
+
...c === "online" && !O ? {
|
|
135
|
+
animate: { opacity: [
|
|
136
|
+
1,
|
|
137
|
+
.75,
|
|
138
|
+
1
|
|
139
|
+
] },
|
|
140
|
+
transition: {
|
|
141
|
+
duration: 2.5,
|
|
142
|
+
repeat: Infinity,
|
|
143
|
+
ease: "easeInOut"
|
|
144
|
+
}
|
|
145
|
+
} : {},
|
|
146
|
+
children: /* @__PURE__ */ l(o, {
|
|
147
|
+
color: g[c],
|
|
148
|
+
size: v[t ?? "md"],
|
|
149
|
+
withBorder: !0,
|
|
150
|
+
"aria-hidden": !0
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
A && (S === "dot" ? /* @__PURE__ */ l("span", {
|
|
154
|
+
className: "absolute -right-0.5 -top-0.5 h-ds-03 w-ds-03 rounded-pill bg-error-9 ring-2 ring-surface-raised",
|
|
150
155
|
"data-slot": "avatar-badge-dot",
|
|
151
156
|
"aria-hidden": "true"
|
|
152
|
-
}) : typeof
|
|
157
|
+
}) : typeof S == "number" ? /* @__PURE__ */ l(d.span, {
|
|
153
158
|
initial: { scale: 0 },
|
|
154
159
|
animate: { scale: 1 },
|
|
155
160
|
transition: r.smooth,
|
|
156
|
-
className: "absolute -right-1 -top-1 flex min-w-
|
|
161
|
+
className: "absolute -right-1 -top-1 flex min-w-ds-05 items-center justify-center rounded-pill bg-error-9 px-1 text-[10px] font-bold leading-[16px] text-error-fg ring-2 ring-surface-raised",
|
|
157
162
|
"data-slot": "avatar-badge",
|
|
158
163
|
role: "status",
|
|
159
|
-
"aria-label": `${
|
|
160
|
-
children:
|
|
161
|
-
}) : /* @__PURE__ */
|
|
164
|
+
"aria-label": `${S > 99 ? "99+" : S} notifications`,
|
|
165
|
+
children: S > 99 ? "99+" : S
|
|
166
|
+
}) : /* @__PURE__ */ l("span", {
|
|
162
167
|
className: "absolute -right-1 -top-1",
|
|
163
168
|
"data-slot": "avatar-badge-custom",
|
|
164
|
-
children:
|
|
169
|
+
children: S
|
|
165
170
|
}))
|
|
166
171
|
]
|
|
167
172
|
})
|
|
168
173
|
})
|
|
169
174
|
});
|
|
170
175
|
});
|
|
171
|
-
|
|
172
|
-
var
|
|
176
|
+
w.displayName = n.displayName;
|
|
177
|
+
var T = c.forwardRef(({ className: e, ...n }, i) => /* @__PURE__ */ l(d.span, {
|
|
173
178
|
initial: {
|
|
174
179
|
opacity: 0,
|
|
175
180
|
scale: .96
|
|
@@ -180,23 +185,23 @@ var w = s.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ c(u.span, {
|
|
|
180
185
|
},
|
|
181
186
|
transition: r.smooth,
|
|
182
187
|
className: "absolute inset-0 h-full w-full",
|
|
183
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ l(t, {
|
|
184
189
|
ref: i,
|
|
185
|
-
className: a("aspect-square h-full w-full",
|
|
190
|
+
className: a("aspect-square h-full w-full", e),
|
|
186
191
|
...n
|
|
187
192
|
})
|
|
188
193
|
}));
|
|
189
|
-
|
|
190
|
-
var
|
|
191
|
-
let
|
|
192
|
-
return /* @__PURE__ */
|
|
194
|
+
T.displayName = t.displayName;
|
|
195
|
+
var E = c.forwardRef(({ className: t, colorSeed: n, children: r, ...i }, o) => {
|
|
196
|
+
let s = typeof r == "string" ? r : "", u = C(n ?? s), d = c.useContext(p), f = c.useContext(m), h = d === "square" ? "rounded-none" : d === "rounded" ? "rounded-control" : "rounded-pill", g = s.length === 1 ? "tracking-wide" : "tracking-normal";
|
|
197
|
+
return /* @__PURE__ */ l(e, {
|
|
193
198
|
ref: o,
|
|
194
199
|
"data-slot": "avatar-fallback",
|
|
195
|
-
className: a("flex h-full w-full items-center justify-center font-semibold", h,
|
|
200
|
+
className: a("flex h-full w-full items-center justify-center font-semibold", h, x[f], u.bg, u.text, g, t),
|
|
196
201
|
...i,
|
|
197
202
|
children: r
|
|
198
203
|
});
|
|
199
204
|
});
|
|
200
|
-
|
|
205
|
+
E.displayName = e.displayName;
|
|
201
206
|
//#endregion
|
|
202
|
-
export {
|
|
207
|
+
export { w as Avatar, E as AvatarFallback, T as AvatarImage, h as avatarVariants };
|
package/dist/ui/avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../src/ui/avatar.tsx"],"sourcesContent":["'use client'\n\nimport * as AvatarPrimitive from \"@primitives/react-avatar\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { motion, useReducedMotion } from \"framer-motion\"\nimport * as React from \"react\"\n\nimport { springs } from \"./lib/motion\"\nimport { cn } from \"./lib/utils\"\nimport { Skeleton } from \"./skeleton\"\n\n// ── Contexts so AvatarFallback can inherit shape & size from Avatar ──\ntype AvatarShape = 'circle' | 'square' | 'rounded'\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nconst AvatarShapeContext = React.createContext<AvatarShape>('circle')\nconst AvatarSizeContext = React.createContext<AvatarSize>('md')\n\nexport const avatarVariants = cva(\n 'relative flex shrink-0 overflow-hidden',\n {\n variants: {\n size: {\n xs: 'h-ds-xs w-ds-xs',\n sm: 'h-ds-sm w-ds-sm',\n md: 'h-ds-md w-ds-md',\n lg: 'h-ds-lg w-ds-lg',\n xl: 'h-ds-xl w-ds-xl',\n },\n shape: {\n circle: 'rounded-pill',\n square: 'rounded-none',\n rounded: 'rounded-control',\n },\n },\n defaultVariants: { size: 'md', shape: 'circle' },\n }\n)\n\nexport type AvatarStatus = 'online' | 'offline' | 'busy' | 'away'\n\nexport type AvatarRing = 'none' | 'lead' | 'admin' | 'client'\n\nconst statusColorMap: Record<AvatarStatus, string> = {\n online: 'bg-success-9',\n offline: 'bg-surface-raised-hover',\n busy: 'bg-error-9',\n away: 'bg-warning-9',\n}\n\nconst statusLabelMap: Record<AvatarStatus, string> = {\n online: 'Online',\n offline: 'Offline',\n busy: 'Busy',\n away: 'Away',\n}\n\n/**\n * Dot size classes that scale with the avatar size.\n * xs/sm get a smaller dot, md gets medium, lg/xl get a larger dot.\n */\nconst statusDotSizeMap: Record<string, string> = {\n xs: 'h-ds-02b w-ds-02b',\n sm: 'h-[8px] w-[8px]',\n md: 'h-ds-03 w-ds-03',\n lg: 'h-[12px] w-[12px]',\n xl: 'h-ds-04 w-ds-04',\n}\n\n// ── Role ring ───────────────────────────────────────────────────────────────\n\nconst ringColorMap: Record<Exclude<AvatarRing, 'none'>, string> = {\n lead: 'ring-accent-7',\n admin: 'ring-warning-7',\n client: 'ring-info-7',\n}\n\nconst ringShapeMap: Record<string, string> = {\n circle: 'rounded-pill',\n square: 'rounded-none',\n rounded: 'rounded-control',\n}\n\n// ── Fallback font sizes that scale with avatar size ─────────────────────────\nconst fallbackTextSizeMap: Record<AvatarSize, string> = {\n xs: 'text-ds-2xs',\n sm: 'text-ds-xs',\n md: 'text-ds-sm',\n lg: 'text-ds-md',\n xl: 'text-ds-lg',\n}\n\n// ── Deterministic fallback colors ───────────────────────────────────────────\n\nconst FALLBACK_COLORS = [\n { bg: 'bg-accent-3', text: 'text-accent-11' },\n { bg: 'bg-success-3', text: 'text-success-11' },\n { bg: 'bg-warning-3', text: 'text-warning-11' },\n { bg: 'bg-error-3', text: 'text-error-11' },\n { bg: 'bg-info-3', text: 'text-info-11' },\n { bg: 'bg-category-teal-3', text: 'text-category-teal-11' },\n { bg: 'bg-category-indigo-3', text: 'text-category-indigo-11' },\n { bg: 'bg-category-cyan-3', text: 'text-category-cyan-11' },\n] as const\n\n/**\n * Simple string hash that produces a deterministic index into FALLBACK_COLORS.\n * Uses djb2 for a reasonable distribution with short strings.\n */\nfunction getFallbackColor(seed: string): (typeof FALLBACK_COLORS)[number] {\n let hash = 5381\n for (let i = 0; i < seed.length; i++) {\n hash = ((hash << 5) + hash + seed.charCodeAt(i)) | 0\n }\n const index = Math.abs(hash) % FALLBACK_COLORS.length\n return FALLBACK_COLORS[index]\n}\n\n/**\n * Props for Avatar — a user/entity image container with size, shape, and presence-status variants.\n *\n * **Sizes:** `xs` | `sm` | `md` (default) | `lg` | `xl` — the status dot scales with the avatar size.\n *\n * **Shapes:** `circle` (default, round) | `square` (sharp corners) | `rounded` (rounded corners, for bots/apps)\n *\n * **Status dot:** `status=\"online\"` (green) | `\"offline\"` (muted) | `\"busy\"` (red) | `\"away\"` (amber).\n * The dot renders with `role=\"img\"` and an accessible `aria-label` — it is not purely decorative.\n *\n * **Role ring:** `ring=\"lead\"` (accent) | `\"admin\"` (warning) | `\"client\"` (info) — a colored ring\n * around the avatar indicating the user's role.\n *\n * **Badge:** `badge={5}` (number) | `badge=\"dot\"` (notification dot) | `badge={<Icon />}` (custom).\n * Numbers > 99 display as \"99+\". Badge is hidden when `0` or `undefined`.\n *\n * **Loading:** `loading={true}` shows a pulse skeleton placeholder.\n *\n * **Children:** Use `<AvatarImage>` for the photo and `<AvatarFallback>` for initials when the image fails.\n *\n * @example\n * // User avatar with photo and fallback initials:\n * <Avatar size=\"md\">\n * <AvatarImage src={user.avatarUrl} alt={user.name} />\n * <AvatarFallback>JD</AvatarFallback>\n * </Avatar>\n *\n * @example\n * // Online presence indicator in a team roster:\n * <Avatar size=\"lg\" status=\"online\">\n * <AvatarImage src={user.photoUrl} alt={user.name} />\n * <AvatarFallback>{user.initials}</AvatarFallback>\n * </Avatar>\n *\n * @example\n * // Square shape for a bot/integration logo:\n * <Avatar shape=\"square\" size=\"xl\">\n * <AvatarImage src=\"/logos/github.png\" alt=\"GitHub\" />\n * </Avatar>\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface AvatarProps\n extends Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, 'children'>,\n VariantProps<typeof avatarVariants> {\n /** Optional status indicator displayed as a dot at the bottom-right corner */\n status?: AvatarStatus\n /** Role ring color indicator */\n ring?: AvatarRing\n /** Badge overlay: number, 'dot', or custom ReactNode */\n badge?: number | 'dot' | React.ReactNode\n /** Show loading skeleton instead of content */\n loading?: boolean\n children?: React.ReactNode\n}\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n AvatarProps\n>(({ className, size, shape, status, ring, badge, loading, children, ...props }, ref) => {\n const resolvedShape = shape ?? 'circle'\n // MotionConfig can't stop this opacity loop (non-transform), so guard it locally.\n const prefersReduced = useReducedMotion()\n\n // Build ring classes for the outer wrapper\n const ringClasses = ring && ring !== 'none'\n ? cn('ring-2 ring-offset-2 ring-offset-surface-raised', ringColorMap[ring], ringShapeMap[resolvedShape])\n : undefined\n\n // Loading skeleton — early return\n if (loading) {\n return (\n <span ref={ref} className={cn('relative inline-flex shrink-0', ringClasses)}>\n <Skeleton\n className={cn(avatarVariants({ size, shape }))}\n data-slot=\"avatar-skeleton\"\n />\n </span>\n )\n }\n\n // Determine whether to render badge\n const showBadge = badge !== undefined && badge !== 0\n\n return (\n <AvatarShapeContext.Provider value={resolvedShape}>\n <AvatarSizeContext.Provider value={size ?? 'md'}>\n <span className={cn('relative inline-flex shrink-0', ringClasses)}>\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, shape }), className)}\n {...props}\n >\n {children}\n </AvatarPrimitive.Root>\n {status && (\n status === 'online' && !prefersReduced ? (\n <motion.span\n className={cn('absolute bottom-0 right-0 rounded-pill ring-2 ring-surface-raised', statusColorMap[status], statusDotSizeMap[size ?? 'md'])}\n animate={{ opacity: [1, 0.75, 1] }}\n transition={{ duration: 2.5, repeat: Infinity, ease: 'easeInOut' }}\n role=\"img\"\n aria-label={statusLabelMap[status]}\n />\n ) : (\n <span className={cn('absolute bottom-0 right-0 rounded-pill ring-2 ring-surface-raised', statusColorMap[status], statusDotSizeMap[size ?? 'md'])} role=\"img\" aria-label={statusLabelMap[status]} />\n )\n )}\n {showBadge && (\n badge === 'dot' ? (\n <span\n className=\"absolute -right-0.5 -top-0.5 h-[8px] w-[8px] rounded-pill bg-error-9 ring-2 ring-surface-raised\"\n data-slot=\"avatar-badge-dot\"\n aria-hidden=\"true\"\n />\n ) : typeof badge === 'number' ? (\n <motion.span\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={springs.smooth}\n className=\"absolute -right-1 -top-1 flex min-w-[16px] items-center justify-center rounded-pill bg-error-9 px-1 text-[10px] font-bold leading-[16px] text-error-fg ring-2 ring-surface-raised\"\n data-slot=\"avatar-badge\"\n role=\"status\"\n aria-label={`${badge > 99 ? '99+' : badge} notifications`}\n >\n {badge > 99 ? '99+' : badge}\n </motion.span>\n ) : (\n <span className=\"absolute -right-1 -top-1\" data-slot=\"avatar-badge-custom\">\n {badge}\n </span>\n )\n )}\n </span>\n </AvatarSizeContext.Provider>\n </AvatarShapeContext.Provider>\n )\n})\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <motion.span\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.smooth}\n className=\"absolute inset-0 h-full w-full\"\n >\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n </motion.span>\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nexport interface AvatarFallbackProps\n extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> {\n /**\n * Seed string for deterministic color selection.\n * Falls back to the text content of `children` if not provided.\n */\n colorSeed?: string\n}\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n AvatarFallbackProps\n>(({ className, colorSeed, children, ...props }, ref) => {\n // Derive seed: explicit colorSeed > children text content > empty string\n const childrenText = typeof children === 'string' ? children : ''\n const seed = colorSeed ?? childrenText\n const color = getFallbackColor(seed)\n\n // Inherit shape and size from parent Avatar via context\n const shape = React.useContext(AvatarShapeContext)\n const size = React.useContext(AvatarSizeContext)\n const shapeClass = shape === 'square' ? 'rounded-none' : shape === 'rounded' ? 'rounded-control' : 'rounded-pill'\n\n // Letter-spacing based on character count\n const tracking = childrenText.length === 1 ? 'tracking-wide' : 'tracking-normal'\n\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n data-slot=\"avatar-fallback\"\n className={cn(\n 'flex h-full w-full items-center justify-center font-semibold',\n shapeClass,\n fallbackTextSizeMap[size],\n color.bg,\n color.text,\n tracking,\n className,\n )}\n {...props}\n >\n {children}\n </AvatarPrimitive.Fallback>\n )\n})\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarFallback,AvatarImage }\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAqB,EAAM,cAA2B,SAAS,EAC/D,IAAoB,EAAM,cAA0B,KAAK,EAElD,IAAiB,EAC5B,0CACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL;EACD,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,SAAS;GACV;EACF;CACD,iBAAiB;EAAE,MAAM;EAAM,OAAO;EAAU;CACjD,CACF,EAMK,IAA+C;CACnD,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACP,EAEK,IAA+C;CACnD,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACP,EAMK,IAA2C;CAC/C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAIK,IAA4D;CAChE,MAAM;CACN,OAAO;CACP,QAAQ;CACT,EAEK,IAAuC;CAC3C,QAAQ;CACR,QAAQ;CACR,SAAS;CACV,EAGK,IAAkD;CACtD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAIK,IAAkB;CACtB;EAAE,IAAI;EAAe,MAAM;EAAkB;CAC7C;EAAE,IAAI;EAAgB,MAAM;EAAmB;CAC/C;EAAE,IAAI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,WAAW,EAAmB,EAC5C,IAAO,EAAM,WAAW,EAAkB,EAC1C,IAAa,MAAU,WAAW,iBAAiB,MAAU,YAAY,oBAAoB,gBAG7F,IAAW,EAAa,WAAW,IAAI,kBAAkB;AAE/D,QACE,kBAAC,GAAD;EACO;EACL,aAAU;EACV,WAAW,EACT,gEACA,GACA,EAAoB,IACpB,EAAM,IACN,EAAM,MACN,GACA,EACD;EACD,GAAI;EAEH;EACwB,CAAA;EAE7B;AACF,EAAe,cAAA,EAAuC"}
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../src/ui/avatar.tsx"],"sourcesContent":["'use client'\n\nimport * as AvatarPrimitive from \"@primitives/react-avatar\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { motion, useReducedMotion } from \"framer-motion\"\nimport * as React from \"react\"\n\nimport { Dot, type DotColor, type DotSize } from \"./dot\"\nimport { springs } from \"./lib/motion\"\nimport { cn } from \"./lib/utils\"\nimport { Skeleton } from \"./skeleton\"\n\n// ── Contexts so AvatarFallback can inherit shape & size from Avatar ──\ntype AvatarShape = 'circle' | 'square' | 'rounded'\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nconst AvatarShapeContext = React.createContext<AvatarShape>('circle')\nconst AvatarSizeContext = React.createContext<AvatarSize>('md')\n\nexport const avatarVariants = cva(\n 'relative flex shrink-0 overflow-hidden',\n {\n variants: {\n size: {\n xs: 'h-ds-xs w-ds-xs',\n sm: 'h-ds-sm w-ds-sm',\n md: 'h-ds-md w-ds-md',\n lg: 'h-ds-lg w-ds-lg',\n xl: 'h-ds-xl w-ds-xl',\n },\n shape: {\n circle: 'rounded-pill',\n square: 'rounded-none',\n rounded: 'rounded-control',\n },\n },\n defaultVariants: { size: 'md', shape: 'circle' },\n }\n)\n\nexport type AvatarStatus = 'online' | 'offline' | 'busy' | 'away'\n\nexport type AvatarRing = 'none' | 'lead' | 'admin' | 'client'\n\n// Presence status → shared Dot intent colour.\nconst statusDotColor: Record<AvatarStatus, DotColor> = {\n online: 'success',\n offline: 'neutral',\n busy: 'error',\n away: 'warning',\n}\n\nconst statusLabelMap: Record<AvatarStatus, string> = {\n online: 'Online',\n offline: 'Offline',\n busy: 'Busy',\n away: 'Away',\n}\n\n/** Avatar size → Dot size (the status dot scales with the avatar). */\nconst statusDotSize: Record<AvatarSize, DotSize> = {\n xs: 'xs',\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n xl: 'lg',\n}\n\n// ── Role ring ───────────────────────────────────────────────────────────────\n\nconst ringColorMap: Record<Exclude<AvatarRing, 'none'>, string> = {\n lead: 'ring-accent-7',\n admin: 'ring-warning-7',\n client: 'ring-info-7',\n}\n\nconst ringShapeMap: Record<string, string> = {\n circle: 'rounded-pill',\n square: 'rounded-none',\n rounded: 'rounded-control',\n}\n\n// ── Fallback font sizes that scale with avatar size ─────────────────────────\nconst fallbackTextSizeMap: Record<AvatarSize, string> = {\n xs: 'text-ds-2xs',\n sm: 'text-ds-xs',\n md: 'text-ds-sm',\n lg: 'text-ds-md',\n xl: 'text-ds-lg',\n}\n\n// ── Deterministic fallback colors ───────────────────────────────────────────\n\nconst FALLBACK_COLORS = [\n { bg: 'bg-accent-3', text: 'text-accent-11' },\n { bg: 'bg-success-3', text: 'text-success-11' },\n { bg: 'bg-warning-3', text: 'text-warning-11' },\n { bg: 'bg-error-3', text: 'text-error-11' },\n { bg: 'bg-info-3', text: 'text-info-11' },\n { bg: 'bg-category-teal-3', text: 'text-category-teal-11' },\n { bg: 'bg-category-indigo-3', text: 'text-category-indigo-11' },\n { bg: 'bg-category-cyan-3', text: 'text-category-cyan-11' },\n] as const\n\n/**\n * Simple string hash that produces a deterministic index into FALLBACK_COLORS.\n * Uses djb2 for a reasonable distribution with short strings.\n */\nfunction getFallbackColor(seed: string): (typeof FALLBACK_COLORS)[number] {\n let hash = 5381\n for (let i = 0; i < seed.length; i++) {\n hash = ((hash << 5) + hash + seed.charCodeAt(i)) | 0\n }\n const index = Math.abs(hash) % FALLBACK_COLORS.length\n return FALLBACK_COLORS[index]\n}\n\n/**\n * Props for Avatar — a user/entity image container with size, shape, and presence-status variants.\n *\n * **Sizes:** `xs` | `sm` | `md` (default) | `lg` | `xl` — the status dot scales with the avatar size.\n *\n * **Shapes:** `circle` (default, round) | `square` (sharp corners) | `rounded` (rounded corners, for bots/apps)\n *\n * **Status dot:** `status=\"online\"` (green) | `\"offline\"` (muted) | `\"busy\"` (red) | `\"away\"` (amber).\n * The dot renders with `role=\"img\"` and an accessible `aria-label` — it is not purely decorative.\n *\n * **Role ring:** `ring=\"lead\"` (accent) | `\"admin\"` (warning) | `\"client\"` (info) — a colored ring\n * around the avatar indicating the user's role.\n *\n * **Badge:** `badge={5}` (number) | `badge=\"dot\"` (notification dot) | `badge={<Icon />}` (custom).\n * Numbers > 99 display as \"99+\". Badge is hidden when `0` or `undefined`.\n *\n * **Loading:** `loading={true}` shows a pulse skeleton placeholder.\n *\n * **Children:** Use `<AvatarImage>` for the photo and `<AvatarFallback>` for initials when the image fails.\n *\n * @example\n * // User avatar with photo and fallback initials:\n * <Avatar size=\"md\">\n * <AvatarImage src={user.avatarUrl} alt={user.name} />\n * <AvatarFallback>JD</AvatarFallback>\n * </Avatar>\n *\n * @example\n * // Online presence indicator in a team roster:\n * <Avatar size=\"lg\" status=\"online\">\n * <AvatarImage src={user.photoUrl} alt={user.name} />\n * <AvatarFallback>{user.initials}</AvatarFallback>\n * </Avatar>\n *\n * @example\n * // Square shape for a bot/integration logo:\n * <Avatar shape=\"square\" size=\"xl\">\n * <AvatarImage src=\"/logos/github.png\" alt=\"GitHub\" />\n * </Avatar>\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface AvatarProps\n extends Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, 'children'>,\n VariantProps<typeof avatarVariants> {\n /** Optional status indicator displayed as a dot at the bottom-right corner */\n status?: AvatarStatus\n /** Role ring color indicator */\n ring?: AvatarRing\n /** Badge overlay: number, 'dot', or custom ReactNode */\n badge?: number | 'dot' | React.ReactNode\n /** Show loading skeleton instead of content */\n loading?: boolean\n children?: React.ReactNode\n}\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n AvatarProps\n>(({ className, size, shape, status, ring, badge, loading, children, ...props }, ref) => {\n const resolvedShape = shape ?? 'circle'\n // MotionConfig can't stop this opacity loop (non-transform), so guard it locally.\n const prefersReduced = useReducedMotion()\n\n // Build ring classes for the outer wrapper\n const ringClasses = ring && ring !== 'none'\n ? cn('ring-2 ring-offset-2 ring-offset-surface-raised', ringColorMap[ring], ringShapeMap[resolvedShape])\n : undefined\n\n // Loading skeleton — early return\n if (loading) {\n return (\n <span ref={ref} className={cn('relative inline-flex shrink-0', ringClasses)}>\n <Skeleton\n className={cn(avatarVariants({ size, shape }))}\n data-slot=\"avatar-skeleton\"\n />\n </span>\n )\n }\n\n // Determine whether to render badge\n const showBadge = badge !== undefined && badge !== 0\n\n return (\n <AvatarShapeContext.Provider value={resolvedShape}>\n <AvatarSizeContext.Provider value={size ?? 'md'}>\n <span className={cn('relative inline-flex shrink-0', ringClasses)}>\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(avatarVariants({ size, shape }), className)}\n {...props}\n >\n {children}\n </AvatarPrimitive.Root>\n {status && (\n <motion.span\n className=\"absolute bottom-0 right-0\"\n role=\"img\"\n aria-label={statusLabelMap[status]}\n {...(status === 'online' && !prefersReduced\n ? { animate: { opacity: [1, 0.75, 1] }, transition: { duration: 2.5, repeat: Infinity, ease: 'easeInOut' } }\n : {})}\n >\n {/* Shared Dot primitive: colour + contrast ring; wrapper owns position + presence breathe + a11y. */}\n <Dot color={statusDotColor[status]} size={statusDotSize[size ?? 'md']} withBorder aria-hidden />\n </motion.span>\n )}\n {showBadge && (\n badge === 'dot' ? (\n <span\n className=\"absolute -right-0.5 -top-0.5 h-ds-03 w-ds-03 rounded-pill bg-error-9 ring-2 ring-surface-raised\"\n data-slot=\"avatar-badge-dot\"\n aria-hidden=\"true\"\n />\n ) : typeof badge === 'number' ? (\n <motion.span\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={springs.smooth}\n className=\"absolute -right-1 -top-1 flex min-w-ds-05 items-center justify-center rounded-pill bg-error-9 px-1 text-[10px] font-bold leading-[16px] text-error-fg ring-2 ring-surface-raised\"\n data-slot=\"avatar-badge\"\n role=\"status\"\n aria-label={`${badge > 99 ? '99+' : badge} notifications`}\n >\n {badge > 99 ? '99+' : badge}\n </motion.span>\n ) : (\n <span className=\"absolute -right-1 -top-1\" data-slot=\"avatar-badge-custom\">\n {badge}\n </span>\n )\n )}\n </span>\n </AvatarSizeContext.Provider>\n </AvatarShapeContext.Provider>\n )\n})\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <motion.span\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.smooth}\n className=\"absolute inset-0 h-full w-full\"\n >\n <AvatarPrimitive.Image\n ref={ref}\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n </motion.span>\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nexport interface AvatarFallbackProps\n extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> {\n /**\n * Seed string for deterministic color selection.\n * Falls back to the text content of `children` if not provided.\n */\n colorSeed?: string\n}\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n AvatarFallbackProps\n>(({ className, colorSeed, children, ...props }, ref) => {\n // Derive seed: explicit colorSeed > children text content > empty string\n const childrenText = typeof children === 'string' ? children : ''\n const seed = colorSeed ?? childrenText\n const color = getFallbackColor(seed)\n\n // Inherit shape and size from parent Avatar via context\n const shape = React.useContext(AvatarShapeContext)\n const size = React.useContext(AvatarSizeContext)\n const shapeClass = shape === 'square' ? 'rounded-none' : shape === 'rounded' ? 'rounded-control' : 'rounded-pill'\n\n // Letter-spacing based on character count\n const tracking = childrenText.length === 1 ? 'tracking-wide' : 'tracking-normal'\n\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n data-slot=\"avatar-fallback\"\n className={cn(\n 'flex h-full w-full items-center justify-center font-semibold',\n shapeClass,\n fallbackTextSizeMap[size],\n color.bg,\n color.text,\n tracking,\n className,\n )}\n {...props}\n >\n {children}\n </AvatarPrimitive.Fallback>\n )\n})\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarFallback,AvatarImage }\n"],"mappings":";;;;;;;;;;;AAeA,IAAM,IAAqB,EAAM,cAA2B,SAAS,EAC/D,IAAoB,EAAM,cAA0B,KAAK,EAElD,IAAiB,EAC5B,0CACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL;EACD,OAAO;GACL,QAAQ;GACR,QAAQ;GACR,SAAS;GACV;EACF;CACD,iBAAiB;EAAE,MAAM;EAAM,OAAO;EAAU;CACjD,CACF,EAOK,IAAiD;CACrD,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACP,EAEK,IAA+C;CACnD,QAAQ;CACR,SAAS;CACT,MAAM;CACN,MAAM;CACP,EAGK,IAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAIK,IAA4D;CAChE,MAAM;CACN,OAAO;CACP,QAAQ;CACT,EAEK,IAAuC;CAC3C,QAAQ;CACR,QAAQ;CACR,SAAS;CACV,EAGK,IAAkD;CACtD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAIK,IAAkB;CACtB;EAAE,IAAI;EAAe,MAAM;EAAkB;CAC7C;EAAE,IAAI;EAAgB,MAAM;EAAmB;CAC/C;EAA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,WAAW,EAAkB,EAC1C,IAAa,MAAU,WAAW,iBAAiB,MAAU,YAAY,oBAAoB,gBAG7F,IAAW,EAAa,WAAW,IAAI,kBAAkB;AAE/D,QACE,kBAAC,GAAD;EACO;EACL,aAAU;EACV,WAAW,EACT,gEACA,GACA,EAAoB,IACpB,EAAM,IACN,EAAM,MACN,GACA,EACD;EACD,GAAI;EAEH;EACwB,CAAA;EAE7B;AACF,EAAe,cAAA,EAAuC"}
|
package/dist/ui/badge-group.js
CHANGED
package/dist/ui/badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/ui/badge.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/ui/badge.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAMjD,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAeJ,CAAA;AAEV,KAAK,UAAU,GAAG,MAAM,OAAO,QAAQ,GAAG,QAAQ,CAAA;AAclD,QAAA,MAAM,aAAa;;;8EAsBlB,CAAA;AA0BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,UAAU,UACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,EACtD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,2FAA2F;IAC3F,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAyLD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,QAAA,MAAM,aAAa;;;CAGjB,CAAA;AAEF,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,KAAK,UAAU,EAAC,KAAK,UAAU,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/ui/badge.js
CHANGED
package/dist/ui/banner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { motionProps as e, springs as t } from "./lib/motion.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cva as n } from "../_chunks/vendor-utils.js";
|
|
4
4
|
import { cn as r } from "./lib/utils.js";
|
|
5
5
|
import { Icon as i } from "./icon.js";
|
|
6
6
|
import * as a from "react";
|
package/dist/ui/breadcrumb.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/ui/breadcrumb.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/ui/breadcrumb.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B,QAAA,MAAM,UAAU;gBAEwC,KAAK,CAAC,SAAS;qCACO,CAAA;AAG9E,QAAA,MAAM,cAAc,2KAWnB,CAAA;AAGD,QAAA,MAAM,cAAc,kKAInB,CAAA;AAGD,QAAA,MAAM,cAAc;cAEgC,OAAO;2CAczD,CAAA;AAGF,QAAA,MAAM,cAAc,sKASnB,CAAA;AAGD,QAAA,MAAM,mBAAmB;wCAAuC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;;CASzF,CAAA;AAGD,QAAA,MAAM,kBAAkB;8BAA6B,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;;CAUhF,CAAA;AAGD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAA;AAErE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,CAAA"}
|
package/dist/ui/breadcrumb.js
CHANGED
|
@@ -1,66 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
import { Hn as e } from "../_chunks/primitives.js";
|
|
1
|
+
import { Slot as e } from "../_chunks/primitives.js";
|
|
3
2
|
import { cn as t } from "./lib/utils.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import { IconChevronRight as o, IconDots as s } from "@tabler/icons-react";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
8
5
|
//#region src/ui/breadcrumb.tsx
|
|
9
|
-
var
|
|
6
|
+
var a = (e) => /* @__PURE__ */ r("svg", {
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
stroke: "currentColor",
|
|
10
|
+
strokeWidth: 2,
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
...e,
|
|
15
|
+
children: /* @__PURE__ */ r("path", { d: "M9 6l6 6l-6 6" })
|
|
16
|
+
}), o = (e) => /* @__PURE__ */ i("svg", {
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
...e,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ r("circle", {
|
|
23
|
+
cx: "5",
|
|
24
|
+
cy: "12",
|
|
25
|
+
r: "1.2"
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ r("circle", {
|
|
28
|
+
cx: "12",
|
|
29
|
+
cy: "12",
|
|
30
|
+
r: "1.2"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ r("circle", {
|
|
33
|
+
cx: "19",
|
|
34
|
+
cy: "12",
|
|
35
|
+
r: "1.2"
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
}), s = n.forwardRef(({ ...e }, t) => /* @__PURE__ */ r("nav", {
|
|
10
39
|
ref: t,
|
|
11
40
|
"aria-label": "breadcrumb",
|
|
12
41
|
...e
|
|
13
42
|
}));
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
ref:
|
|
43
|
+
s.displayName = "Breadcrumb";
|
|
44
|
+
var c = n.forwardRef(({ className: e, ...n }, i) => /* @__PURE__ */ r("ol", {
|
|
45
|
+
ref: i,
|
|
17
46
|
className: t("flex flex-wrap items-center gap-ds-02b break-words text-ds-md text-surface-fg-muted sm:gap-ds-03", e),
|
|
18
47
|
...n
|
|
19
48
|
}));
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
ref:
|
|
49
|
+
c.displayName = "BreadcrumbList";
|
|
50
|
+
var l = n.forwardRef(({ className: e, ...n }, i) => /* @__PURE__ */ r("li", {
|
|
51
|
+
ref: i,
|
|
23
52
|
className: t("inline-flex items-center gap-ds-03", e),
|
|
24
53
|
...n
|
|
25
54
|
}));
|
|
26
|
-
|
|
27
|
-
var
|
|
55
|
+
l.displayName = "BreadcrumbItem";
|
|
56
|
+
var u = n.forwardRef(({ className: n, asChild: i = !1, ...a }, o) => /* @__PURE__ */ r(i ? e : "a", {
|
|
28
57
|
ref: o,
|
|
29
58
|
className: t("min-w-0 truncate max-w-[20ch] transition-colors duration-fast-01 ease-productive-standard hover:text-surface-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 rounded-control-inner", n),
|
|
30
59
|
...a
|
|
31
60
|
}));
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
ref:
|
|
61
|
+
u.displayName = "BreadcrumbLink";
|
|
62
|
+
var d = n.forwardRef(({ className: e, ...n }, i) => /* @__PURE__ */ r("span", {
|
|
63
|
+
ref: i,
|
|
35
64
|
"aria-current": "page",
|
|
36
65
|
className: t("min-w-0 truncate max-w-[20ch] font-medium text-surface-fg", e),
|
|
37
66
|
...n
|
|
38
67
|
}));
|
|
39
|
-
|
|
40
|
-
var
|
|
68
|
+
d.displayName = "BreadcrumbPage";
|
|
69
|
+
var f = ({ children: e, className: n, ...i }) => /* @__PURE__ */ r("li", {
|
|
41
70
|
role: "presentation",
|
|
42
71
|
"aria-hidden": "true",
|
|
43
|
-
className: t("[&>svg]:h-ico-sm [&>svg]:w-ico-sm",
|
|
44
|
-
...
|
|
45
|
-
children: e ?? /* @__PURE__ */
|
|
46
|
-
icon: o,
|
|
47
|
-
size: "sm"
|
|
48
|
-
})
|
|
72
|
+
className: t("[&>svg]:h-ico-sm [&>svg]:w-ico-sm", n),
|
|
73
|
+
...i,
|
|
74
|
+
children: e ?? /* @__PURE__ */ r(a, {})
|
|
49
75
|
});
|
|
50
|
-
|
|
51
|
-
var
|
|
76
|
+
f.displayName = "BreadcrumbSeparator";
|
|
77
|
+
var p = ({ className: e, ...n }) => /* @__PURE__ */ i("span", {
|
|
52
78
|
role: "presentation",
|
|
53
79
|
"aria-hidden": "true",
|
|
54
80
|
className: t("flex h-ds-sm-plus w-ds-sm-plus items-center justify-center", e),
|
|
55
|
-
...
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
icon: s,
|
|
58
|
-
size: "sm"
|
|
59
|
-
}), /* @__PURE__ */ i("span", {
|
|
81
|
+
...n,
|
|
82
|
+
children: [/* @__PURE__ */ r(o, { className: "h-ico-sm w-ico-sm" }), /* @__PURE__ */ r("span", {
|
|
60
83
|
className: "sr-only",
|
|
61
84
|
children: "More"
|
|
62
85
|
})]
|
|
63
86
|
});
|
|
64
|
-
|
|
87
|
+
p.displayName = "BreadcrumbEllipsis";
|
|
65
88
|
//#endregion
|
|
66
|
-
export {
|
|
89
|
+
export { s as Breadcrumb, p as BreadcrumbEllipsis, l as BreadcrumbItem, u as BreadcrumbLink, c as BreadcrumbList, d as BreadcrumbPage, f as BreadcrumbSeparator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","names":[],"sources":["../../src/ui/breadcrumb.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":[],"sources":["../../src/ui/breadcrumb.tsx"],"sourcesContent":["// @server-safe\nimport { Slot } from '@primitives/react-slot'\nimport * as React from 'react'\n\nimport { cn } from './lib/utils'\n\n// Inline glyphs (no client `Icon` dependency) keep Breadcrumb server-renderable —\n// so server-safe consumers like PageHeader can compose it.\nconst ChevronGlyph = (props: React.SVGProps<SVGSVGElement>) => (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" {...props}>\n <path d=\"M9 6l6 6l-6 6\" />\n </svg>\n)\n\nconst DotsGlyph = (props: React.SVGProps<SVGSVGElement>) => (\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\" {...props}>\n <circle cx=\"5\" cy=\"12\" r=\"1.2\" />\n <circle cx=\"12\" cy=\"12\" r=\"1.2\" />\n <circle cx=\"19\" cy=\"12\" r=\"1.2\" />\n </svg>\n)\n\nconst Breadcrumb = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<'nav'> & { separator?: React.ReactNode }\n>(({ ...props }, ref) => <nav ref={ref} aria-label=\"breadcrumb\" {...props} />)\nBreadcrumb.displayName = 'Breadcrumb'\n\nconst BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<'ol'>>(\n ({ className, ...props }, ref) => (\n <ol\n ref={ref}\n className={cn(\n 'flex flex-wrap items-center gap-ds-02b break-words text-ds-md text-surface-fg-muted sm:gap-ds-03',\n className,\n )}\n {...props}\n />\n ),\n)\nBreadcrumbList.displayName = 'BreadcrumbList'\n\nconst BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(\n ({ className, ...props }, ref) => (\n <li ref={ref} className={cn('inline-flex items-center gap-ds-03', className)} {...props} />\n ),\n)\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n\nconst BreadcrumbLink = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentPropsWithoutRef<'a'> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a'\n\n return (\n <Comp\n ref={ref}\n className={cn(\n 'min-w-0 truncate max-w-[20ch] transition-colors duration-fast-01 ease-productive-standard hover:text-surface-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 rounded-control-inner',\n className,\n )}\n {...props}\n />\n )\n})\nBreadcrumbLink.displayName = 'BreadcrumbLink'\n\nconst BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(\n ({ className, ...props }, ref) => (\n <span\n ref={ref}\n aria-current=\"page\"\n className={cn('min-w-0 truncate max-w-[20ch] font-medium text-surface-fg', className)}\n {...props}\n />\n ),\n)\nBreadcrumbPage.displayName = 'BreadcrumbPage'\n\nconst BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<'li'>) => (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('[&>svg]:h-ico-sm [&>svg]:w-ico-sm', className)}\n {...props}\n >\n {children ?? <ChevronGlyph />}\n </li>\n)\nBreadcrumbSeparator.displayName = 'BreadcrumbSeparator'\n\nconst BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<'span'>) => (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('flex h-ds-sm-plus w-ds-sm-plus items-center justify-center', className)}\n {...props}\n >\n <DotsGlyph className=\"h-ico-sm w-ico-sm\" />\n <span className=\"sr-only\">More</span>\n </span>\n)\nBreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis'\n\nexport type BreadcrumbProps = React.ComponentPropsWithoutRef<'nav'>\nexport type BreadcrumbLinkProps = React.ComponentPropsWithoutRef<'a'>\n\nexport {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n}\n"],"mappings":";;;;;AAQA,IAAM,KAAgB,MACpB,kBAAC,OAAD;CAAK,SAAQ;CAAY,MAAK;CAAO,QAAO;CAAe,aAAa;CAAG,eAAc;CAAQ,gBAAe;CAAQ,eAAY;CAAO,GAAI;WAC7I,kBAAC,QAAD,EAAM,GAAE,iBAAkB,CAAA;CACtB,CAAA,EAGF,KAAa,MACjB,kBAAC,OAAD;CAAK,SAAQ;CAAY,MAAK;CAAe,eAAY;CAAO,GAAI;WAApE;EACE,kBAAC,UAAD;GAAQ,IAAG;GAAI,IAAG;GAAK,GAAE;GAAQ,CAAA;EACjC,kBAAC,UAAD;GAAQ,IAAG;GAAK,IAAG;GAAK,GAAE;GAAQ,CAAA;EAClC,kBAAC,UAAD;GAAQ,IAAG;GAAK,IAAG;GAAK,GAAE;GAAQ,CAAA;EAC9B;IAGF,IAAa,EAAM,YAGtB,EAAE,GAAG,KAAS,M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ANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Slot as e, Slottable as t } from "../_chunks/primitives.js";
|
|
3
3
|
import { IconProvider as n } from "./icon-context.js";
|
|
4
4
|
import { motionProps as ee } from "./lib/motion.js";
|
|
5
|
-
import {
|
|
5
|
+
import { cva as r } from "../_chunks/vendor-utils.js";
|
|
6
6
|
import { cn as i } from "./lib/utils.js";
|
|
7
7
|
import { Spinner as a } from "./spinner.js";
|
|
8
8
|
import { Icon as te } from "./icon.js";
|
|
9
|
-
import {
|
|
9
|
+
import { normalizeIcon as o } from "../_chunks/normalize-icon.js";
|
|
10
10
|
import { getGroupPositionStyle as ne, useButtonGroup as re, useButtonGroupItem as ie } from "./button-group.js";
|
|
11
11
|
import { ProcessingOverlay as ae } from "./button-processing.js";
|
|
12
12
|
import * as s from "react";
|
package/dist/ui/card.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { motionProps as e, springs as t } from "./lib/motion.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cva as n } from "../_chunks/vendor-utils.js";
|
|
4
4
|
import { cn as r } from "./lib/utils.js";
|
|
5
5
|
import * as i from "react";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { motionProps as e, tweens as t } from "../lib/motion.js";
|
|
3
3
|
import { cn as n } from "../lib/utils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
|
|
5
|
+
import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
|
|
6
|
+
import { Axis as c, GridLines as l } from "../../_chunks/grid-lines.js";
|
|
7
|
+
import { ChartContainer as u } from "../../_chunks/chart-container.js";
|
|
8
8
|
import * as d from "react";
|
|
9
9
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
10
|
import { motion as h } from "framer-motion";
|
|
@@ -12,7 +12,7 @@ import { scaleLinear as g, scalePoint as _ } from "d3-scale";
|
|
|
12
12
|
import { area as v, curveLinear as y, curveMonotoneX as b, line as x, stack as S, stackOffsetNone as C, stackOrderNone as w } from "d3-shape";
|
|
13
13
|
//#region src/ui/charts/area-chart.tsx
|
|
14
14
|
var T = d.forwardRef(({ data: T, xKey: E, series: D, curved: O = !1, stacked: k = !1, fillOpacity: A = .3, gradient: j = !1, strokeWidth: M = 2, height: N = 300, showGrid: P = !0, showTooltip: F = !0, showLegend: I = !1, animate: L = !0, xLabel: R, yLabel: z, ariaLabel: B, className: V, ...H }, U) => {
|
|
15
|
-
let { tooltip: W, show: G, hide: K } =
|
|
15
|
+
let { tooltip: W, show: G, hide: K } = a(), q = s(), J = L && !q, Y = D.map((e, t) => o(e.color, t)), X = d.useId();
|
|
16
16
|
return /* @__PURE__ */ m(h.div, {
|
|
17
17
|
ref: U,
|
|
18
18
|
className: n("relative", V),
|
|
@@ -161,7 +161,7 @@ var T = d.forwardRef(({ data: T, xKey: E, series: D, curved: O = !1, stacked: k
|
|
|
161
161
|
] });
|
|
162
162
|
}
|
|
163
163
|
}),
|
|
164
|
-
F && /* @__PURE__ */ p(
|
|
164
|
+
F && /* @__PURE__ */ p(r, { state: W }),
|
|
165
165
|
I && D.length > 1 && /* @__PURE__ */ p(i, {
|
|
166
166
|
items: D.map((e, t) => ({
|
|
167
167
|
label: e.label,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { motionProps as e, tweens as t } from "../lib/motion.js";
|
|
3
3
|
import { cn as n } from "../lib/utils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
|
|
5
|
+
import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
|
|
6
|
+
import { Axis as c, GridLines as l } from "../../_chunks/grid-lines.js";
|
|
7
|
+
import { ChartContainer as u } from "../../_chunks/chart-container.js";
|
|
8
8
|
import * as d from "react";
|
|
9
9
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
10
|
import { motion as h } from "framer-motion";
|
|
11
11
|
import { scaleBand as g, scaleLinear as _ } from "d3-scale";
|
|
12
12
|
//#region src/ui/charts/bar-chart.tsx
|
|
13
13
|
var v = d.forwardRef(({ data: d, xKey: v, yKey: y, orientation: b = "vertical", stacked: x = !1, grouped: S = !1, color: C, height: w = 300, showGrid: T = !0, showTooltip: E = !0, showLegend: D = !1, animate: O = !0, barRadius: k = 4, xLabel: A, yLabel: j, seriesLabels: M, ariaLabel: N, className: P, ...F }, I) => {
|
|
14
|
-
let { tooltip: L, show: R, hide: z } =
|
|
14
|
+
let { tooltip: L, show: R, hide: z } = a(), B = s(), V = b === "vertical", H = O && !B, U = Array.isArray(y) ? y : [y], W = U.length > 1, G = W ? U.map((e, t) => o(Array.isArray(C) ? C[t] : typeof C == "string" ? C : void 0, t)) : [o(typeof C == "string" ? C : Array.isArray(C) ? C[0] : void 0, 0)];
|
|
15
15
|
return /* @__PURE__ */ m(h.div, {
|
|
16
16
|
ref: I,
|
|
17
17
|
className: n("relative", P),
|
|
@@ -111,7 +111,7 @@ var v = d.forwardRef(({ data: d, xKey: v, yKey: y, orientation: b = "vertical",
|
|
|
111
111
|
] });
|
|
112
112
|
}
|
|
113
113
|
}),
|
|
114
|
-
E && /* @__PURE__ */ p(
|
|
114
|
+
E && /* @__PURE__ */ p(r, { state: L }),
|
|
115
115
|
D && W && /* @__PURE__ */ p(i, {
|
|
116
116
|
items: U.map((e, t) => ({
|
|
117
117
|
label: M?.[t] ?? e,
|