@arcfusionz/arc-primitive-ui 0.0.0 → 0.2.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/AILoader/AILoader.d.ts +32 -0
- package/dist/components/AILoader/AILoader.js +157 -0
- package/dist/components/AILoader/index.d.ts +2 -0
- package/dist/components/AILoader/index.js +2 -0
- package/dist/components/Accordion/Accordion.d.ts +96 -0
- package/dist/components/Accordion/Accordion.js +149 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +152 -0
- package/dist/components/Avatar/Avatar.js +216 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +87 -0
- package/dist/components/Badge/Badge.js +118 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +109 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +182 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/Button/Button.d.ts +57 -0
- package/dist/components/Button/Button.js +177 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Calendar/Calendar.d.ts +140 -0
- package/dist/components/Calendar/Calendar.js +468 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +60 -0
- package/dist/components/Checkbox/Checkbox.js +129 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +251 -0
- package/dist/components/Combobox/Combobox.js +354 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
- package/dist/components/ContextMenu/ContextMenu.js +93 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +109 -0
- package/dist/components/DatePicker/DatePicker.js +145 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/DateRangePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +112 -0
- package/dist/components/Dialog/Dialog.js +141 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Drawer/Drawer.d.ts +188 -0
- package/dist/components/Drawer/Drawer.js +268 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/Field/Field.d.ts +123 -0
- package/dist/components/Field/Field.js +241 -0
- package/dist/components/Field/FieldContext.d.ts +43 -0
- package/dist/components/Field/FieldContext.js +28 -0
- package/dist/components/Field/index.d.ts +3 -0
- package/dist/components/Field/index.js +3 -0
- package/dist/components/Fieldset/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset/Fieldset.js +48 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +2 -0
- package/dist/components/Form/Form.d.ts +54 -0
- package/dist/components/Form/Form.js +57 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Input/Input.d.ts +64 -0
- package/dist/components/Input/Input.js +111 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +212 -0
- package/dist/components/Menu/Menu.js +255 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +122 -0
- package/dist/components/Popover/Popover.js +116 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/Progress.d.ts +87 -0
- package/dist/components/Progress/Progress.js +73 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +65 -0
- package/dist/components/Radio/Radio.js +93 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Select/Select.d.ts +136 -0
- package/dist/components/Select/Select.js +219 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +39 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Stepper/Stepper.d.ts +161 -0
- package/dist/components/Stepper/Stepper.js +344 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +56 -0
- package/dist/components/Switch/Switch.js +87 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +143 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +116 -0
- package/dist/components/Tabs/Tabs.js +158 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Timeline/Timeline.d.ts +137 -0
- package/dist/components/Timeline/Timeline.js +243 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +135 -0
- package/dist/components/Toast/Toast.js +314 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +104 -0
- package/dist/components/Tooltip/Tooltip.js +95 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +38 -0
- package/dist/components/Typography/Typography.js +53 -0
- package/dist/components/Typography/index.d.ts +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/index.d.ts +66 -3398
- package/dist/index.js +34 -5343
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +9 -0
- package/package.json +6 -2
- package/src/styles/theme.css +341 -341
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
//#region src/components/AILoader/AILoader.d.ts
|
|
4
|
+
type AILoaderState = "default" | "processing";
|
|
5
|
+
type AILoaderSize = "sm" | "md" | "lg";
|
|
6
|
+
type AILoaderTone = "brand" | "current";
|
|
7
|
+
interface AILoaderRenderState extends Record<string, unknown> {
|
|
8
|
+
/** Current visual and semantic state. */
|
|
9
|
+
state: AILoaderState;
|
|
10
|
+
/** Whether the indicator represents active work. */
|
|
11
|
+
processing: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface AILoaderBaseProps extends Omit<ComponentPropsWithoutRef<"span">, "children" | "className"> {
|
|
14
|
+
/** Ambient AI motion or a rotating indeterminate processing indicator. */
|
|
15
|
+
state?: AILoaderState;
|
|
16
|
+
/** Visual scale: `sm` uses a 16px mark/12px plain text, `md` 24px/14px, and `lg` 32px/16px. This is non-interactive, so no target-size floor applies. */
|
|
17
|
+
size?: AILoaderSize;
|
|
18
|
+
/** `brand` uses info → primary → hero at rest and primary blue while processing; `current` inherits the surrounding text color. Processing uses `currentColor`, so text-color utilities or `style.color` can override either tone. */
|
|
19
|
+
tone?: AILoaderTone;
|
|
20
|
+
/** Optional visible status content beside the mark. Accepts plain text or an inline node such as `<Typography as="span">`; processing adds a reduced-motion-safe shimmer. */
|
|
21
|
+
text?: ReactNode;
|
|
22
|
+
/** Accessible label. Defaults to a string `text` value when present, otherwise “AI” at rest and “Processing” while active. When `text` is JSX, set this to override its readable content. */
|
|
23
|
+
label?: string;
|
|
24
|
+
/** Replace the rendered `span` or inspect `{ state, processing }` in a render callback. */
|
|
25
|
+
render?: useRender.RenderProp<AILoaderRenderState>;
|
|
26
|
+
/** Additional classes merged after the component's layout and spacing classes. */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
type AILoaderProps = AILoaderBaseProps;
|
|
30
|
+
declare const AILoader: import("react").ForwardRefExoticComponent<AILoaderBaseProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { AILoader, AILoaderProps, AILoaderRenderState, AILoaderSize, AILoaderState, AILoaderTone };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
//#region src/components/AILoader/AILoader.tsx
|
|
6
|
+
const rootClasses = "relative inline-flex shrink-0 items-center justify-center align-middle select-none";
|
|
7
|
+
const toneClasses = {
|
|
8
|
+
brand: "text-primary",
|
|
9
|
+
current: ""
|
|
10
|
+
};
|
|
11
|
+
const SPARKLE_PATH = "M12 1.2C12.58 1.2 12.82 1.58 12.98 2.28C13.72 5.55 14.72 7.38 16.23 8.68C17.57 9.82 19.24 10.33 21.72 11.02C22.42 11.21 22.8 11.42 22.8 12C22.8 12.58 22.42 12.79 21.72 12.98C19.24 13.67 17.57 14.18 16.23 15.32C14.72 16.62 13.72 18.45 12.98 21.72C12.82 22.42 12.58 22.8 12 22.8C11.42 22.8 11.18 22.42 11.02 21.72C10.28 18.45 9.28 16.62 7.77 15.32C6.43 14.18 4.76 13.67 2.28 12.98C1.58 12.79 1.2 12.58 1.2 12C1.2 11.42 1.58 11.21 2.28 11.02C4.76 10.33 6.43 9.82 7.77 8.68C9.28 7.38 10.28 5.55 11.02 2.28C11.18 1.58 11.42 1.2 12 1.2Z";
|
|
12
|
+
const LARGE_SATELLITE_PATH = "M0-2.25C.16-.82.82-.16 2.25 0 .82.16.16.82 0 2.25-.16.82-.82.16-2.25 0-.82-.16-.16-.82 0-2.25Z";
|
|
13
|
+
const SMALL_SATELLITE_PATH = "M0-1.65C.12-.6.6-.12 1.65 0 .6.12.12.6 0 1.65-.12.6-.6.12-1.65 0-.6-.12-.12-.6 0-1.65Z";
|
|
14
|
+
const sizeClasses = {
|
|
15
|
+
sm: "size-4",
|
|
16
|
+
md: "size-6",
|
|
17
|
+
lg: "size-8"
|
|
18
|
+
};
|
|
19
|
+
const gapClasses = {
|
|
20
|
+
sm: "gap-1.5",
|
|
21
|
+
md: "gap-2",
|
|
22
|
+
lg: "gap-2.5"
|
|
23
|
+
};
|
|
24
|
+
const textSizeClasses = {
|
|
25
|
+
sm: "text-xs",
|
|
26
|
+
md: "text-sm",
|
|
27
|
+
lg: "text-base"
|
|
28
|
+
};
|
|
29
|
+
const textClasses = "inline-block whitespace-nowrap font-sans leading-none text-muted-foreground";
|
|
30
|
+
const textShimmerClasses = "bg-[linear-gradient(90deg,transparent_38%,var(--color-secondary)_50%,transparent_62%),linear-gradient(var(--color-muted-foreground),var(--color-muted-foreground))] bg-[length:250%_100%,100%_100%] bg-clip-text [background-repeat:no-repeat,no-repeat] motion-safe:animate-ai-loader-text-shimmer motion-safe:text-transparent motion-safe:[&_*]:!text-inherit motion-safe:will-change-[background-position]";
|
|
31
|
+
const rotationMotionClasses = "motion-safe:animate-ai-loader-rotate motion-safe:will-change-transform";
|
|
32
|
+
const processingPulseMotionClasses = "motion-safe:animate-ai-loader-processing-pulse motion-safe:will-change-transform";
|
|
33
|
+
const coreMotionClasses = "motion-safe:animate-ai-loader-core motion-safe:will-change-transform";
|
|
34
|
+
const facetMotionClasses = "motion-safe:animate-ai-loader-facet motion-safe:will-change-transform";
|
|
35
|
+
const firstSparkMotionClasses = "motion-safe:animate-ai-loader-spark motion-safe:will-change-transform";
|
|
36
|
+
const quarterSparkMotionClasses = "motion-safe:animate-ai-loader-spark motion-safe:[animation-delay:0.6s] motion-safe:will-change-transform";
|
|
37
|
+
const secondSparkMotionClasses = "motion-safe:animate-ai-loader-spark motion-safe:[animation-delay:1.2s] motion-safe:will-change-transform";
|
|
38
|
+
const threeQuarterSparkMotionClasses = "motion-safe:animate-ai-loader-spark motion-safe:[animation-delay:1.8s] motion-safe:will-change-transform";
|
|
39
|
+
const processingSatelliteMotionClasses = "motion-safe:animate-ai-loader-processing-satellite motion-safe:will-change-opacity";
|
|
40
|
+
const AILoader = forwardRef(({ state = "default", size = "md", tone = "brand", text, label, render, className, ...rest }, ref) => {
|
|
41
|
+
const gradientId = `ai-loader-${useId().replaceAll(":", "")}`;
|
|
42
|
+
const processing = state === "processing";
|
|
43
|
+
const hasText = text != null;
|
|
44
|
+
const accessibleLabel = label ?? (typeof text === "string" ? text : processing ? "Processing" : "AI");
|
|
45
|
+
const monochrome = processing || tone === "current";
|
|
46
|
+
const startColor = monochrome ? "currentColor" : "var(--color-info)";
|
|
47
|
+
const middleColor = monochrome ? "currentColor" : "var(--color-primary)";
|
|
48
|
+
const endColor = monochrome ? "currentColor" : "var(--color-hero)";
|
|
49
|
+
return useRender({
|
|
50
|
+
defaultTagName: "span",
|
|
51
|
+
render,
|
|
52
|
+
ref,
|
|
53
|
+
state: {
|
|
54
|
+
state,
|
|
55
|
+
processing
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
role: processing ? "status" : "img",
|
|
59
|
+
"aria-label": processing ? hasText ? label : void 0 : accessibleLabel,
|
|
60
|
+
className: cn(rootClasses, toneClasses[tone], hasText && gapClasses[size], className),
|
|
61
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
63
|
+
viewBox: "0 0 24 24",
|
|
64
|
+
fill: "none",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
className: cn("shrink-0 overflow-visible", sizeClasses[size]),
|
|
67
|
+
children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
68
|
+
id: gradientId,
|
|
69
|
+
x1: "3",
|
|
70
|
+
y1: "2",
|
|
71
|
+
x2: "21",
|
|
72
|
+
y2: "22",
|
|
73
|
+
gradientUnits: "userSpaceOnUse",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("stop", {
|
|
76
|
+
offset: "0",
|
|
77
|
+
stopColor: startColor
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("stop", {
|
|
80
|
+
offset: "0.5",
|
|
81
|
+
stopColor: middleColor
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("stop", {
|
|
84
|
+
offset: "1",
|
|
85
|
+
stopColor: endColor
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}) }), /* @__PURE__ */ jsxs("g", {
|
|
89
|
+
className: cn("origin-center [transform-box:view-box]", processing && rotationMotionClasses),
|
|
90
|
+
children: [
|
|
91
|
+
!processing && /* @__PURE__ */ jsx("g", {
|
|
92
|
+
className: cn("origin-center rotate-45 scale-75 opacity-15 [transform-box:fill-box]", facetMotionClasses),
|
|
93
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
94
|
+
fill: `url(#${gradientId})`,
|
|
95
|
+
d: SPARKLE_PATH
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx("path", {
|
|
99
|
+
fill: `url(#${gradientId})`,
|
|
100
|
+
d: SPARKLE_PATH,
|
|
101
|
+
className: cn("origin-center opacity-95 [transform-box:fill-box]", processing ? processingPulseMotionClasses : coreMotionClasses)
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx("g", {
|
|
104
|
+
transform: "translate(19 4.75)",
|
|
105
|
+
className: processing ? processingSatelliteMotionClasses : void 0,
|
|
106
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
107
|
+
fill: `url(#${gradientId})`,
|
|
108
|
+
className: cn("origin-center opacity-45 [transform-box:fill-box]", firstSparkMotionClasses),
|
|
109
|
+
d: LARGE_SATELLITE_PATH
|
|
110
|
+
})
|
|
111
|
+
}),
|
|
112
|
+
processing && /* @__PURE__ */ jsx("g", {
|
|
113
|
+
transform: "translate(19 19.25)",
|
|
114
|
+
className: processingSatelliteMotionClasses,
|
|
115
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
116
|
+
fill: `url(#${gradientId})`,
|
|
117
|
+
className: cn("origin-center opacity-45 [transform-box:fill-box]", quarterSparkMotionClasses),
|
|
118
|
+
d: SMALL_SATELLITE_PATH
|
|
119
|
+
})
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("g", {
|
|
122
|
+
transform: processing ? "translate(5 19.25)" : "translate(5 18.25)",
|
|
123
|
+
className: processing ? processingSatelliteMotionClasses : void 0,
|
|
124
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
125
|
+
fill: `url(#${gradientId})`,
|
|
126
|
+
className: cn("origin-center opacity-45 [transform-box:fill-box]", secondSparkMotionClasses),
|
|
127
|
+
d: processing ? LARGE_SATELLITE_PATH : SMALL_SATELLITE_PATH
|
|
128
|
+
})
|
|
129
|
+
}),
|
|
130
|
+
processing && /* @__PURE__ */ jsx("g", {
|
|
131
|
+
transform: "translate(5 4.75)",
|
|
132
|
+
className: processingSatelliteMotionClasses,
|
|
133
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
134
|
+
fill: `url(#${gradientId})`,
|
|
135
|
+
className: cn("origin-center opacity-45 [transform-box:fill-box]", threeQuarterSparkMotionClasses),
|
|
136
|
+
d: SMALL_SATELLITE_PATH
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
})]
|
|
141
|
+
}),
|
|
142
|
+
hasText && /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: cn(textClasses, textSizeClasses[size], processing && textShimmerClasses),
|
|
144
|
+
children: text
|
|
145
|
+
}),
|
|
146
|
+
processing && !hasText && /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: "sr-only",
|
|
148
|
+
children: accessibleLabel
|
|
149
|
+
})
|
|
150
|
+
] }),
|
|
151
|
+
...rest
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
AILoader.displayName = "AILoader";
|
|
156
|
+
//#endregion
|
|
157
|
+
export { AILoader };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
3
|
+
//#region src/components/Accordion/Accordion.d.ts
|
|
4
|
+
type AccordionVariant = "divided" | "contained" | "separated";
|
|
5
|
+
type AccordionSize = "sm" | "md" | "lg";
|
|
6
|
+
type AccordionChevronPosition = "start" | "end";
|
|
7
|
+
type BaseRootProps = ComponentPropsWithoutRef<typeof Accordion.Root>;
|
|
8
|
+
type AccordionChangeEventDetails = Parameters<NonNullable<BaseRootProps["onValueChange"]>>[1];
|
|
9
|
+
interface AccordionProps extends Omit<BaseRootProps, "className" | "value" | "defaultValue" | "onValueChange"> {
|
|
10
|
+
/**
|
|
11
|
+
* Controlled set of open item values — always an array; single mode holds
|
|
12
|
+
* zero or one entries. Item values are strings in this design system
|
|
13
|
+
* (Base UI itself allows any value type).
|
|
14
|
+
*/
|
|
15
|
+
value?: string[];
|
|
16
|
+
/** Item values open on first render (uncontrolled). */
|
|
17
|
+
defaultValue?: string[];
|
|
18
|
+
/** Called with the next open set when an item expands or collapses. */
|
|
19
|
+
onValueChange?: (value: string[], eventDetails: AccordionChangeEventDetails) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Container treatment: `divided` separates full-bleed rows with hairlines,
|
|
22
|
+
* `contained` wraps all items in one bordered box, `separated` renders each
|
|
23
|
+
* item as its own bordered card with a gap.
|
|
24
|
+
*/
|
|
25
|
+
variant?: AccordionVariant;
|
|
26
|
+
/** Row density. Trigger rows are 36px (`sm`) / 44px (`md`) / 56px (`lg`) tall before wrapping — all clear the WCAG 2.5.8 24px target-size floor. */
|
|
27
|
+
size?: AccordionSize;
|
|
28
|
+
/**
|
|
29
|
+
* Side of the header the expansion icon sits on. `end` is the familiar
|
|
30
|
+
* default; `start` keeps the icon next to the label, which NN/g found
|
|
31
|
+
* faster to scan for magnified and low-vision use.
|
|
32
|
+
*/
|
|
33
|
+
chevronPosition?: AccordionChevronPosition;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Vertically stacked disclosure sections built on Base UI's Accordion.
|
|
38
|
+
* One panel opens at a time by default (`multiple` lifts that); the open
|
|
39
|
+
* panel can always be collapsed again.
|
|
40
|
+
*/
|
|
41
|
+
declare const Accordion$1: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
42
|
+
interface AccordionItemProps extends Omit<ComponentPropsWithoutRef<typeof Accordion.Item>, "className" | "value"> {
|
|
43
|
+
/**
|
|
44
|
+
* Identifies the item in the root's `value`/`defaultValue` arrays.
|
|
45
|
+
* Auto-generated when omitted (fine for purely uncontrolled use).
|
|
46
|
+
*/
|
|
47
|
+
value?: string;
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* One disclosure section: a header/trigger pair plus its panel. Give it a
|
|
52
|
+
* `value` to control or pre-open it; omit the value and Base UI generates one.
|
|
53
|
+
*/
|
|
54
|
+
declare const AccordionItem: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
+
interface AccordionHeaderProps extends Omit<ComponentPropsWithoutRef<typeof Accordion.Header>, "className"> {
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The heading that labels a panel — an `<h3>` by default. Pick the level
|
|
60
|
+
* from the surrounding document outline via `render`, e.g.
|
|
61
|
+
* `<AccordionHeader render={<h4 />}>`; the visual style lives on the trigger
|
|
62
|
+
* either way.
|
|
63
|
+
*/
|
|
64
|
+
declare const AccordionHeader: import("react").ForwardRefExoticComponent<AccordionHeaderProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
65
|
+
interface AccordionTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Accordion.Trigger>, "className"> {
|
|
66
|
+
/**
|
|
67
|
+
* Replace the default chevron; pass `null` to render no indicator. The
|
|
68
|
+
* default chevron rotates 180° while open — a custom icon styles its own
|
|
69
|
+
* open state off the trigger's `group`, e.g.
|
|
70
|
+
* `className="motion-safe:transition-transform group-data-panel-open:rotate-45"`.
|
|
71
|
+
*/
|
|
72
|
+
icon?: ReactNode;
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The full-width button that toggles its panel. Label and icon are one
|
|
77
|
+
* target (never split them); long labels wrap.
|
|
78
|
+
*/
|
|
79
|
+
declare const AccordionTrigger: import("react").ForwardRefExoticComponent<AccordionTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
80
|
+
interface AccordionPanelProps extends Omit<ComponentPropsWithoutRef<typeof Accordion.Panel>, "className"> {
|
|
81
|
+
/**
|
|
82
|
+
* Applied to the content block inside the animated panel — the panel
|
|
83
|
+
* element itself must keep zero padding and `overflow-hidden` for the
|
|
84
|
+
* height transition to measure cleanly (customize it via `render`).
|
|
85
|
+
*/
|
|
86
|
+
className?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The collapsible content region. Height animates via Base UI's
|
|
90
|
+
* `--accordion-panel-height` behind `motion-safe:`; with reduced motion it
|
|
91
|
+
* snaps open. Set `hiddenUntilFound` (here or on the root) so browser
|
|
92
|
+
* find-in-page can reveal closed panels.
|
|
93
|
+
*/
|
|
94
|
+
declare const AccordionPanel: import("react").ForwardRefExoticComponent<AccordionPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Accordion$1 as Accordion, AccordionChevronPosition, AccordionHeader, AccordionHeaderProps, AccordionItem, AccordionItemProps, AccordionPanel, AccordionPanelProps, AccordionProps, AccordionSize, AccordionTrigger, AccordionTriggerProps, AccordionVariant };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Accordion/Accordion.tsx
|
|
6
|
+
const AccordionStyleContext = createContext({
|
|
7
|
+
variant: "divided",
|
|
8
|
+
size: "md",
|
|
9
|
+
chevronPosition: "end"
|
|
10
|
+
});
|
|
11
|
+
const rootVariantClasses = {
|
|
12
|
+
divided: "",
|
|
13
|
+
contained: "overflow-hidden rounded-md border border-border",
|
|
14
|
+
separated: "gap-2"
|
|
15
|
+
};
|
|
16
|
+
const itemVariantClasses = {
|
|
17
|
+
divided: "border-b border-border",
|
|
18
|
+
contained: "border-b border-border last:border-b-0",
|
|
19
|
+
separated: "overflow-hidden rounded-md border border-border"
|
|
20
|
+
};
|
|
21
|
+
const triggerBaseClasses = "group flex w-full cursor-pointer items-center gap-3 text-start font-sans font-medium text-foreground transition-colors duration-150 select-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50";
|
|
22
|
+
const triggerVariantClasses = {
|
|
23
|
+
divided: "px-0 hover:underline underline-offset-4",
|
|
24
|
+
contained: "hover:bg-muted active:bg-slate-200",
|
|
25
|
+
separated: "hover:bg-muted active:bg-slate-200"
|
|
26
|
+
};
|
|
27
|
+
const triggerSizeClasses = {
|
|
28
|
+
sm: "px-3 py-2 text-sm",
|
|
29
|
+
md: "px-4 py-3 text-sm",
|
|
30
|
+
lg: "px-5 py-4 text-base [&_svg:not([class*='size-'])]:size-5"
|
|
31
|
+
};
|
|
32
|
+
const panelBaseClasses = "h-[var(--accordion-panel-height)] overflow-hidden motion-safe:transition-[height] motion-safe:duration-200 motion-safe:ease-out data-starting-style:h-0 data-ending-style:h-0";
|
|
33
|
+
const panelContentBaseClasses = "font-sans text-muted-foreground";
|
|
34
|
+
const panelContentSizeClasses = {
|
|
35
|
+
sm: "px-3 pb-2 text-sm",
|
|
36
|
+
md: "px-4 pb-3 text-sm",
|
|
37
|
+
lg: "px-5 pb-4 text-base"
|
|
38
|
+
};
|
|
39
|
+
function ChevronDownIcon(props) {
|
|
40
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
41
|
+
viewBox: "0 0 24 24",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth: 2,
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round",
|
|
47
|
+
...props,
|
|
48
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Vertically stacked disclosure sections built on Base UI's Accordion.
|
|
53
|
+
* One panel opens at a time by default (`multiple` lifts that); the open
|
|
54
|
+
* panel can always be collapsed again.
|
|
55
|
+
*/
|
|
56
|
+
const Accordion$1 = forwardRef(({ variant = "divided", size = "md", chevronPosition = "end", onValueChange, className, ...rest }, ref) => {
|
|
57
|
+
const styleContext = useMemo(() => ({
|
|
58
|
+
variant,
|
|
59
|
+
size,
|
|
60
|
+
chevronPosition
|
|
61
|
+
}), [
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
chevronPosition
|
|
65
|
+
]);
|
|
66
|
+
return /* @__PURE__ */ jsx(AccordionStyleContext.Provider, {
|
|
67
|
+
value: styleContext,
|
|
68
|
+
children: /* @__PURE__ */ jsx(Accordion.Root, {
|
|
69
|
+
ref,
|
|
70
|
+
onValueChange,
|
|
71
|
+
className: cn("flex w-full flex-col", rootVariantClasses[variant], className),
|
|
72
|
+
...rest
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
Accordion$1.displayName = "Accordion";
|
|
77
|
+
/**
|
|
78
|
+
* One disclosure section: a header/trigger pair plus its panel. Give it a
|
|
79
|
+
* `value` to control or pre-open it; omit the value and Base UI generates one.
|
|
80
|
+
*/
|
|
81
|
+
const AccordionItem = forwardRef(({ className, ...rest }, ref) => {
|
|
82
|
+
const { variant } = useContext(AccordionStyleContext);
|
|
83
|
+
return /* @__PURE__ */ jsx(Accordion.Item, {
|
|
84
|
+
ref,
|
|
85
|
+
className: cn(itemVariantClasses[variant], className),
|
|
86
|
+
...rest
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
AccordionItem.displayName = "AccordionItem";
|
|
90
|
+
/**
|
|
91
|
+
* The heading that labels a panel — an `<h3>` by default. Pick the level
|
|
92
|
+
* from the surrounding document outline via `render`, e.g.
|
|
93
|
+
* `<AccordionHeader render={<h4 />}>`; the visual style lives on the trigger
|
|
94
|
+
* either way.
|
|
95
|
+
*/
|
|
96
|
+
const AccordionHeader = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Accordion.Header, {
|
|
97
|
+
ref,
|
|
98
|
+
className: cn("m-0", className),
|
|
99
|
+
...rest
|
|
100
|
+
}));
|
|
101
|
+
AccordionHeader.displayName = "AccordionHeader";
|
|
102
|
+
/**
|
|
103
|
+
* The full-width button that toggles its panel. Label and icon are one
|
|
104
|
+
* target (never split them); long labels wrap.
|
|
105
|
+
*/
|
|
106
|
+
const AccordionTrigger = forwardRef(({ icon, className, children, ...rest }, ref) => {
|
|
107
|
+
const { variant, size, chevronPosition } = useContext(AccordionStyleContext);
|
|
108
|
+
const indicator = icon === void 0 ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out group-data-panel-open:rotate-180" }) : icon;
|
|
109
|
+
const indicatorSlot = indicator != null && /* @__PURE__ */ jsx("span", {
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
className: "inline-flex items-center",
|
|
112
|
+
children: indicator
|
|
113
|
+
});
|
|
114
|
+
return /* @__PURE__ */ jsxs(Accordion.Trigger, {
|
|
115
|
+
ref,
|
|
116
|
+
className: cn(triggerBaseClasses, triggerSizeClasses[size], triggerVariantClasses[variant], className),
|
|
117
|
+
...rest,
|
|
118
|
+
children: [
|
|
119
|
+
chevronPosition === "start" && indicatorSlot,
|
|
120
|
+
/* @__PURE__ */ jsx("span", {
|
|
121
|
+
className: "flex-1",
|
|
122
|
+
children
|
|
123
|
+
}),
|
|
124
|
+
chevronPosition === "end" && indicatorSlot
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
129
|
+
/**
|
|
130
|
+
* The collapsible content region. Height animates via Base UI's
|
|
131
|
+
* `--accordion-panel-height` behind `motion-safe:`; with reduced motion it
|
|
132
|
+
* snaps open. Set `hiddenUntilFound` (here or on the root) so browser
|
|
133
|
+
* find-in-page can reveal closed panels.
|
|
134
|
+
*/
|
|
135
|
+
const AccordionPanel = forwardRef(({ className, children, ...rest }, ref) => {
|
|
136
|
+
const { variant, size } = useContext(AccordionStyleContext);
|
|
137
|
+
return /* @__PURE__ */ jsx(Accordion.Panel, {
|
|
138
|
+
ref,
|
|
139
|
+
className: panelBaseClasses,
|
|
140
|
+
...rest,
|
|
141
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
142
|
+
className: cn(panelContentBaseClasses, panelContentSizeClasses[size], variant === "divided" && "px-0", className),
|
|
143
|
+
children
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
AccordionPanel.displayName = "AccordionPanel";
|
|
148
|
+
//#endregion
|
|
149
|
+
export { Accordion$1 as Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Accordion, AccordionChevronPosition, AccordionHeader, AccordionHeaderProps, AccordionItem, AccordionItemProps, AccordionPanel, AccordionPanelProps, AccordionProps, AccordionSize, AccordionTrigger, AccordionTriggerProps, AccordionVariant } from "./Accordion.js";
|
|
2
|
+
export { Accordion, type AccordionChevronPosition, AccordionHeader, type AccordionHeaderProps, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, type AccordionSize, AccordionTrigger, type AccordionTriggerProps, type AccordionVariant };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { Avatar } from "@base-ui/react/avatar";
|
|
4
|
+
//#region src/components/Avatar/Avatar.d.ts
|
|
5
|
+
type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
type AvatarShape = "circle" | "square";
|
|
7
|
+
interface AvatarVariantsOptions {
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
shape?: AvatarShape;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Class list for an element styled as an Avatar box.
|
|
14
|
+
*
|
|
15
|
+
* Use it when the box must stay a foreign element — e.g. a plain anchor
|
|
16
|
+
* around a raw `<img>`, or a static placeholder — so it still matches
|
|
17
|
+
* real avatars in size, shape and fill:
|
|
18
|
+
*
|
|
19
|
+
* <a href="/profile" className={avatarVariants({ size: "sm" })}>
|
|
20
|
+
* <img src={photo} alt="Open profile" className="size-full rounded-[inherit] object-cover" />
|
|
21
|
+
* </a>
|
|
22
|
+
*/
|
|
23
|
+
declare function avatarVariants({ size, shape, className }?: AvatarVariantsOptions): string;
|
|
24
|
+
interface AvatarProps extends Omit<ComponentPropsWithoutRef<typeof Avatar.Root>, "className"> {
|
|
25
|
+
/**
|
|
26
|
+
* Box size: `xs` 24px · `sm` 32px · `md` 40px · `lg` 48px · `xl` 64px.
|
|
27
|
+
* Defaults to the enclosing `AvatarGroup`'s size, then `md`. Avatars are
|
|
28
|
+
* non-interactive by default; one made clickable via `render` should use
|
|
29
|
+
* `sm`+ to clear the WCAG 2.5.8 24px target-size floor with room to spare.
|
|
30
|
+
*/
|
|
31
|
+
size?: AvatarSize;
|
|
32
|
+
/** `circle` for people (default), `square` (6px radius) for entities like teams, orgs, or apps. Defaults to the enclosing `AvatarGroup`'s shape. */
|
|
33
|
+
shape?: AvatarShape;
|
|
34
|
+
/** Image URL. While it loads — and if it fails — the fallback shows instead. */
|
|
35
|
+
src?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Alt text for the image. Defaults to `""` (decorative) because avatars
|
|
38
|
+
* usually sit next to the visible name. For a standalone avatar put the
|
|
39
|
+
* name on the root via `aria-label` instead — it also covers the fallback,
|
|
40
|
+
* which `alt` cannot.
|
|
41
|
+
*/
|
|
42
|
+
alt?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Person or entity name used to derive the fallback initials (first letter
|
|
45
|
+
* of the first and last words). Used for initials only — pass `aria-label`
|
|
46
|
+
* when the avatar must be announced.
|
|
47
|
+
*/
|
|
48
|
+
name?: string;
|
|
49
|
+
/** Custom fallback content (e.g. an org icon), replacing the derived initials / person icon. */
|
|
50
|
+
fallback?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Milliseconds to wait before showing the fallback, avoiding a flash of
|
|
53
|
+
* initials when images load fast. Only applied while `src` is set — the
|
|
54
|
+
* muted box shows in the meantime. Without `src` the fallback is immediate.
|
|
55
|
+
*/
|
|
56
|
+
fallbackDelay?: number;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Profile picture with automatic fallback, built on Base UI's Avatar.
|
|
61
|
+
*
|
|
62
|
+
* Shorthand props (`src`, `alt`, `name`, `fallback`, `fallbackDelay`) render
|
|
63
|
+
* the image and fallback parts internally; `children` render after them, so
|
|
64
|
+
* an `AvatarBadge` composes on top of the shorthand. When only `children`
|
|
65
|
+
* are passed the root renders them alone — full manual composition with
|
|
66
|
+
* `AvatarImage` / `AvatarFallback` (don't mix that with the shorthand props,
|
|
67
|
+
* or two fallbacks render).
|
|
68
|
+
*
|
|
69
|
+
* Decorative by default. When it stands alone, pass `aria-label` — the root
|
|
70
|
+
* then gets `role="img"` and its internals are hidden from assistive
|
|
71
|
+
* technology, whether the image or the fallback is showing.
|
|
72
|
+
*/
|
|
73
|
+
declare const Avatar$1: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
74
|
+
interface AvatarImageProps extends Omit<ComponentPropsWithoutRef<typeof Avatar.Image>, "className"> {
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The avatar photo, cropped to fill the box. Base UI keeps it unmounted
|
|
79
|
+
* until the file has actually loaded (the fallback shows meanwhile), then it
|
|
80
|
+
* fades in motion-safe. Defaults to `alt=""` — see `Avatar`'s `alt` docs.
|
|
81
|
+
* `onLoadingStatusChange` reports `idle → loading → loaded | error`.
|
|
82
|
+
*/
|
|
83
|
+
declare const AvatarImage: import("react").ForwardRefExoticComponent<AvatarImageProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
84
|
+
interface AvatarFallbackProps extends Omit<ComponentPropsWithoutRef<typeof Avatar.Fallback>, "className"> {
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Shown while there is no loaded image: initials, an icon, or any content.
|
|
89
|
+
* Fills the box and inherits the root's muted fill and text styling — set
|
|
90
|
+
* colors via `className` on the root (or here) as a pair, e.g.
|
|
91
|
+
* `bg-primary-100 text-primary-800`. Base UI's `delay` prop postpones it to
|
|
92
|
+
* avoid a flash on fast image loads; only set a delay when an `AvatarImage`
|
|
93
|
+
* sibling exists, otherwise the box just sits empty for that long.
|
|
94
|
+
*/
|
|
95
|
+
declare const AvatarFallback: import("react").ForwardRefExoticComponent<AvatarFallbackProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
96
|
+
interface AvatarBadgeProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
97
|
+
/**
|
|
98
|
+
* Screen-reader text for the state the badge conveys (e.g. "Online").
|
|
99
|
+
* Color alone must not carry meaning (WCAG 1.4.1) — always pass this when
|
|
100
|
+
* the badge is more than decoration.
|
|
101
|
+
*/
|
|
102
|
+
label?: string;
|
|
103
|
+
/** Replace the rendered `span`, e.g. `render={<a href="…" />}`. */
|
|
104
|
+
render?: useRender.RenderProp;
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Corner indicator anchored to the avatar's bottom-right rim, scaled to the
|
|
109
|
+
* avatar's size, with a background-colored ring separating it from the
|
|
110
|
+
* photo. Defaults to the success fill (presence "online"); recolor via
|
|
111
|
+
* `className` — `bg-warning` away, `bg-destructive` busy, `bg-slate-400`
|
|
112
|
+
* offline — and match the ring to the page surface with `ring-*` when the
|
|
113
|
+
* avatar sits on a non-background fill. Compose inside `<Avatar>`, after the
|
|
114
|
+
* shorthand props or parts.
|
|
115
|
+
*/
|
|
116
|
+
declare const AvatarBadge: import("react").ForwardRefExoticComponent<AvatarBadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
117
|
+
interface AvatarGroupProps extends Omit<ComponentPropsWithoutRef<"div">, "className"> {
|
|
118
|
+
/** Size applied to every member avatar (and the overlap distance). Members can still override it. */
|
|
119
|
+
size?: AvatarSize;
|
|
120
|
+
/** Shape applied to every member avatar. Members can still override it. */
|
|
121
|
+
shape?: AvatarShape;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum boxes to render, counting the overflow chip: with 6 children and
|
|
124
|
+
* `max={4}`, 3 avatars and a "+3" chip show. Values below 2 are treated
|
|
125
|
+
* as 2. Omit to render every child.
|
|
126
|
+
*/
|
|
127
|
+
max?: number;
|
|
128
|
+
/**
|
|
129
|
+
* Total member count when the children are only a page of the real list —
|
|
130
|
+
* e.g. 4 fetched collaborators of 12 → `total={12}` renders "+9" after
|
|
131
|
+
* `max` is applied. Defaults to the number of children.
|
|
132
|
+
*/
|
|
133
|
+
total?: number;
|
|
134
|
+
/** Replace the rendered `div`, e.g. `render={<ul />}` with `<li>`-wrapped avatars. */
|
|
135
|
+
render?: useRender.RenderProp;
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Overlapping stack of avatars ("facepile") with an optional "+N" overflow
|
|
140
|
+
* chip. Members inherit the group's `size`/`shape` and get a
|
|
141
|
+
* background-colored separator ring; later members overlap earlier ones
|
|
142
|
+
* (DOM order). For a custom overflow control — different text, or a chip
|
|
143
|
+
* that opens the full member list — omit `max` and append your own child,
|
|
144
|
+
* e.g. `<Avatar render={<button aria-label="Show all 12 members" />}>+9</Avatar>`.
|
|
145
|
+
* The ring assumes the group sits on `background` — on another surface,
|
|
146
|
+
* override per member (`className="ring-surface"`). Purely visual grouping:
|
|
147
|
+
* give the group an `aria-label` (e.g. "Contributors") when the stack is
|
|
148
|
+
* meaningful, and name each member if avatars are individually meaningful.
|
|
149
|
+
*/
|
|
150
|
+
declare const AvatarGroup: import("react").ForwardRefExoticComponent<AvatarGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
151
|
+
//#endregion
|
|
152
|
+
export { Avatar$1 as Avatar, AvatarBadge, AvatarBadgeProps, AvatarFallback, AvatarFallbackProps, AvatarGroup, AvatarGroupProps, AvatarImage, AvatarImageProps, AvatarProps, AvatarShape, AvatarSize, AvatarVariantsOptions, avatarVariants };
|