@godxjp/ui 23.2.1 → 23.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/timezones.js +2 -1
- package/dist/components/charts/chart-cartesian.js +2 -4
- package/dist/components/charts/chart-frame.js +2 -1
- package/dist/components/data-display/card.d.ts +87 -1
- package/dist/components/data-display/card.js +88 -15
- package/dist/components/data-display/index.d.ts +5 -1
- package/dist/components/data-display/index.js +5 -0
- package/dist/components/data-display/thought-chain.d.ts +42 -0
- package/dist/components/data-display/thought-chain.js +177 -0
- package/dist/components/data-display/welcome.d.ts +26 -0
- package/dist/components/data-display/welcome.js +37 -0
- package/dist/components/data-entry/attachments.d.ts +19 -0
- package/dist/components/data-entry/attachments.js +322 -0
- package/dist/components/data-entry/date-picker.js +12 -14
- package/dist/components/data-entry/index.d.ts +2 -0
- package/dist/components/data-entry/index.js +2 -0
- package/dist/components/data-entry/number-input.js +2 -1
- package/dist/components/feedback/dialog.d.ts +10 -7
- package/dist/components/feedback/dialog.js +40 -17
- package/dist/components/feedback/index.d.ts +3 -3
- package/dist/components/feedback/index.js +2 -0
- package/dist/components/feedback/skeleton.d.ts +11 -2
- package/dist/components/feedback/skeleton.js +8 -0
- package/dist/components/general/actions.d.ts +59 -0
- package/dist/components/general/actions.js +253 -0
- package/dist/components/general/activity.js +1 -0
- package/dist/components/general/button.js +2 -1
- package/dist/components/general/float-button.d.ts +41 -0
- package/dist/components/general/float-button.js +336 -0
- package/dist/components/general/index.d.ts +6 -2
- package/dist/components/general/index.js +12 -1
- package/dist/components/general/typography.d.ts +79 -4
- package/dist/components/general/typography.js +598 -54
- package/dist/components/layout/draggable-panel.d.ts +18 -0
- package/dist/components/layout/draggable-panel.js +189 -0
- package/dist/components/layout/error-surface.js +3 -2
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +2 -0
- package/dist/components/navigation/conversations.d.ts +39 -0
- package/dist/components/navigation/conversations.js +371 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +2 -0
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/toggle.js +2 -1
- package/dist/i18n/messages/en.json +53 -0
- package/dist/i18n/messages/ja.json +53 -0
- package/dist/i18n/messages/vi.json +53 -0
- package/dist/i18n/translate.js +3 -2
- package/dist/lib/datetime/picker-format.js +2 -1
- package/dist/lib/format.js +3 -2
- package/dist/lib/intl-cache.d.ts +32 -0
- package/dist/lib/intl-cache.js +29 -0
- package/dist/props/components/data-display.prop.d.ts +143 -1
- package/dist/props/components/data-entry.prop.d.ts +87 -0
- package/dist/props/components/feedback.prop.d.ts +53 -1
- package/dist/props/components/general.prop.d.ts +440 -3
- package/dist/props/components/index.d.ts +2 -2
- package/dist/props/components/layout.prop.d.ts +63 -1
- package/dist/props/components/navigation.prop.d.ts +150 -0
- package/dist/props/registry.d.ts +431 -0
- package/dist/props/registry.js +551 -0
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +113 -0
- package/dist/styles/alert-layout.css +22 -0
- package/dist/styles/card-layout.css +34 -0
- package/dist/styles/core.css +1 -0
- package/dist/styles/data-display-layout.css +236 -0
- package/dist/styles/float-button-layout.css +168 -0
- package/dist/styles/form-layout.css +11 -1
- package/dist/styles/index.css +1 -0
- package/dist/styles/layout.css +196 -0
- package/dist/styles/navigation-layout.css +139 -0
- package/dist/styles/text-layout.css +156 -0
- package/dist/tokens/axes.css +5 -0
- package/dist/tokens/base.css +7 -0
- package/dist/tokens/components/actions.css +14 -0
- package/dist/tokens/components/attachments.css +15 -0
- package/dist/tokens/components/conversations.css +28 -0
- package/dist/tokens/components/draggable-panel.css +25 -0
- package/dist/tokens/components/float-button.css +39 -0
- package/dist/tokens/components/text.css +13 -0
- package/dist/tokens/components/thought-chain.css +31 -0
- package/dist/tokens/components/welcome.css +19 -0
- package/dist/tokens/foundation.css +6 -4
- package/docs/DESIGN-AUTHORITY.md +133 -20
- package/docs/FRAME-COVERAGE-REPORT.md +5 -2
- package/docs/data-display/card/examples/tab-list.tsx +97 -0
- package/docs/data-display/thought-chain.tsx +176 -0
- package/docs/data-display/welcome.tsx +115 -0
- package/docs/data-entry/attachments.tsx +160 -0
- package/docs/feedback/dialog.tsx +50 -0
- package/docs/general/actions.tsx +175 -0
- package/docs/general/float-button.tsx +133 -0
- package/docs/general/typography.tsx +63 -1
- package/docs/layout/draggable-panel.tsx +127 -0
- package/docs/navigation/conversations.tsx +176 -0
- package/docs/roadmap/parity-audit-layout-navigation-general.md +17 -16
- package/package.json +20 -4
- package/scripts/_agent-setup.mjs +36 -5
- package/scripts/guinea-pig-skill.md +14 -0
- package/scripts/ui-audit.mjs +69 -9
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ChevronUp, FileText, X } from "lucide-react";
|
|
5
|
+
import { useTranslation } from "../../i18n/use-translation.js";
|
|
6
|
+
import { useMediaQuery } from "../../lib/hooks.js";
|
|
7
|
+
import { numberFormat } from "../../lib/intl-cache.js";
|
|
8
|
+
import { cn } from "../../lib/utils.js";
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../feedback/tooltip.js";
|
|
10
|
+
import { Button } from "./button.js";
|
|
11
|
+
const GroupContext = React.createContext(null);
|
|
12
|
+
const DEFAULT_ICON = /* @__PURE__ */ jsx(FileText, { "aria-hidden": "true" });
|
|
13
|
+
const BUTTON_VARIANT = {
|
|
14
|
+
default: "outline",
|
|
15
|
+
primary: "default"
|
|
16
|
+
};
|
|
17
|
+
function isRenderable(node) {
|
|
18
|
+
return node != null && node !== false && node !== true && node !== "";
|
|
19
|
+
}
|
|
20
|
+
function toTooltipProps(tooltip) {
|
|
21
|
+
if (tooltip == null) return null;
|
|
22
|
+
if (typeof tooltip === "object" && !React.isValidElement(tooltip) && "title" in tooltip) {
|
|
23
|
+
return tooltip;
|
|
24
|
+
}
|
|
25
|
+
return { title: tooltip };
|
|
26
|
+
}
|
|
27
|
+
function FloatButtonBadge({
|
|
28
|
+
badge,
|
|
29
|
+
locale
|
|
30
|
+
}) {
|
|
31
|
+
const { count, dot, overflowCount = 99, showZero = false, color } = badge;
|
|
32
|
+
if (!dot) {
|
|
33
|
+
if (count == null) return null;
|
|
34
|
+
if (count === 0 && !showZero) return null;
|
|
35
|
+
}
|
|
36
|
+
const label = dot ? null : count != null && count > overflowCount ? `${numberFormat(locale).format(overflowCount)}+` : numberFormat(locale).format(count ?? 0);
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "float-button-badge",
|
|
41
|
+
"data-dot": dot ? "" : void 0,
|
|
42
|
+
className: "ui-float-button-badge",
|
|
43
|
+
style: color ? { "--float-button-badge-background": color } : void 0,
|
|
44
|
+
children: label
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const FloatButtonRoot = React.forwardRef(function FloatButton({
|
|
49
|
+
icon,
|
|
50
|
+
description,
|
|
51
|
+
content,
|
|
52
|
+
type = "default",
|
|
53
|
+
shape = "circle",
|
|
54
|
+
tooltip,
|
|
55
|
+
href,
|
|
56
|
+
target,
|
|
57
|
+
badge,
|
|
58
|
+
disabled,
|
|
59
|
+
htmlType = "button",
|
|
60
|
+
className,
|
|
61
|
+
children,
|
|
62
|
+
...rest
|
|
63
|
+
}, ref) {
|
|
64
|
+
const { locale } = useTranslation();
|
|
65
|
+
const group = React.useContext(GroupContext);
|
|
66
|
+
const mergedShape = group?.shape ?? shape;
|
|
67
|
+
const mergedContent = isRenderable(content) ? content : description;
|
|
68
|
+
const hasContent = isRenderable(mergedContent);
|
|
69
|
+
const mergedIcon = !hasContent && icon == null ? DEFAULT_ICON : icon;
|
|
70
|
+
if (process.env.NODE_ENV !== "production" && mergedShape === "circle" && hasContent) {
|
|
71
|
+
console.warn(
|
|
72
|
+
"[@godxjp/ui] FloatButton: `content` is supported only when `shape` is `square` \u2014 a circle has no room for a line of text."
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const tooltipProps = toTooltipProps(tooltip);
|
|
76
|
+
const ariaLabel = rest["aria-label"] ?? (!hasContent && typeof tooltipProps?.title === "string" ? tooltipProps.title : void 0);
|
|
77
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
isRenderable(mergedIcon) ? /* @__PURE__ */ jsx("span", { "data-slot": "float-button-icon", className: "ui-float-button-icon", children: mergedIcon }) : null,
|
|
79
|
+
hasContent ? /* @__PURE__ */ jsx("span", { "data-slot": "float-button-content", className: "ui-float-button-content", children: mergedContent }) : null,
|
|
80
|
+
children,
|
|
81
|
+
badge ? /* @__PURE__ */ jsx(FloatButtonBadge, { badge, locale }) : null
|
|
82
|
+
] });
|
|
83
|
+
const shared = {
|
|
84
|
+
"data-slot": "float-button",
|
|
85
|
+
"data-type": type,
|
|
86
|
+
"data-shape": mergedShape,
|
|
87
|
+
"data-individual": group?.individual ?? true ? "" : void 0,
|
|
88
|
+
"data-icon-only": hasContent ? void 0 : "",
|
|
89
|
+
className: cn("ui-float-button", className),
|
|
90
|
+
variant: BUTTON_VARIANT[type],
|
|
91
|
+
shape: mergedShape === "circle" ? "pill" : "default",
|
|
92
|
+
size: "icon-lg"
|
|
93
|
+
};
|
|
94
|
+
const node = href ? /* @__PURE__ */ jsx(Button, { ...shared, asChild: true, children: /* @__PURE__ */ jsx(
|
|
95
|
+
"a",
|
|
96
|
+
{
|
|
97
|
+
...rest,
|
|
98
|
+
ref,
|
|
99
|
+
href: disabled ? void 0 : href,
|
|
100
|
+
target,
|
|
101
|
+
"aria-label": ariaLabel,
|
|
102
|
+
"aria-disabled": disabled || void 0,
|
|
103
|
+
"data-disabled": disabled ? "" : void 0,
|
|
104
|
+
children: inner
|
|
105
|
+
}
|
|
106
|
+
) }) : /* @__PURE__ */ jsx(
|
|
107
|
+
Button,
|
|
108
|
+
{
|
|
109
|
+
...shared,
|
|
110
|
+
...rest,
|
|
111
|
+
ref,
|
|
112
|
+
type: htmlType,
|
|
113
|
+
disabled,
|
|
114
|
+
"aria-label": ariaLabel,
|
|
115
|
+
children: inner
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
if (!tooltipProps || !isRenderable(tooltipProps.title)) return node;
|
|
119
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
120
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: node }),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
TooltipContent,
|
|
123
|
+
{
|
|
124
|
+
side: tooltipProps.side,
|
|
125
|
+
align: tooltipProps.align,
|
|
126
|
+
sideOffset: tooltipProps.sideOffset,
|
|
127
|
+
children: tooltipProps.title
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] });
|
|
131
|
+
});
|
|
132
|
+
const PLACEMENTS = ["top", "left", "right", "bottom"];
|
|
133
|
+
function FloatButtonGroup({
|
|
134
|
+
children,
|
|
135
|
+
trigger,
|
|
136
|
+
open,
|
|
137
|
+
onOpenChange,
|
|
138
|
+
closeIcon,
|
|
139
|
+
placement,
|
|
140
|
+
shape = "circle",
|
|
141
|
+
type = "default",
|
|
142
|
+
icon,
|
|
143
|
+
disabled,
|
|
144
|
+
className,
|
|
145
|
+
onClick,
|
|
146
|
+
...rest
|
|
147
|
+
}) {
|
|
148
|
+
const { t } = useTranslation();
|
|
149
|
+
const rootRef = React.useRef(null);
|
|
150
|
+
const isMenuMode = trigger === "click" || trigger === "hover";
|
|
151
|
+
const mergedPlacement = PLACEMENTS.includes(placement) ? placement : "top";
|
|
152
|
+
const individual = shape === "circle";
|
|
153
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
154
|
+
const isControlled = open != null;
|
|
155
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
156
|
+
if (process.env.NODE_ENV !== "production" && isControlled && !trigger) {
|
|
157
|
+
console.warn(
|
|
158
|
+
"[@godxjp/ui] FloatButton.Group: `open` needs to be used together with `trigger`."
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
const setOpen = React.useCallback(
|
|
162
|
+
(next) => {
|
|
163
|
+
if (disabled || next === isOpen) return;
|
|
164
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
165
|
+
onOpenChange?.(next);
|
|
166
|
+
},
|
|
167
|
+
[disabled, isOpen, isControlled, onOpenChange]
|
|
168
|
+
);
|
|
169
|
+
React.useEffect(() => {
|
|
170
|
+
if (trigger !== "click") return;
|
|
171
|
+
const root = rootRef.current;
|
|
172
|
+
if (!root) return;
|
|
173
|
+
const doc = root.ownerDocument;
|
|
174
|
+
const onDocClick = (event) => {
|
|
175
|
+
if (event.composedPath().includes(root)) return;
|
|
176
|
+
setOpen(false);
|
|
177
|
+
};
|
|
178
|
+
doc.addEventListener("click", onDocClick, { capture: true });
|
|
179
|
+
return () => doc.removeEventListener("click", onDocClick, { capture: true });
|
|
180
|
+
}, [trigger, setOpen]);
|
|
181
|
+
const listContext = React.useMemo(() => ({ shape, individual }), [shape, individual]);
|
|
182
|
+
const triggerContext = React.useMemo(() => ({ shape, individual: true }), [shape]);
|
|
183
|
+
const list = /* @__PURE__ */ jsx(GroupContext.Provider, { value: listContext, children: /* @__PURE__ */ jsx("div", { "data-slot": "float-button-list", className: "ui-float-button-list", children }) });
|
|
184
|
+
return /* @__PURE__ */ jsxs(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
ref: rootRef,
|
|
188
|
+
"data-slot": "float-button-group",
|
|
189
|
+
"data-placement": isMenuMode ? mergedPlacement : void 0,
|
|
190
|
+
"data-menu-mode": isMenuMode ? "" : void 0,
|
|
191
|
+
"data-individual": individual ? "" : void 0,
|
|
192
|
+
"data-state": isMenuMode ? isOpen ? "open" : "closed" : void 0,
|
|
193
|
+
className: cn("ui-float-button-group", className),
|
|
194
|
+
onMouseEnter: trigger === "hover" ? () => setOpen(true) : void 0,
|
|
195
|
+
onMouseLeave: trigger === "hover" ? () => setOpen(false) : void 0,
|
|
196
|
+
children: [
|
|
197
|
+
isMenuMode ? isOpen ? list : null : list,
|
|
198
|
+
isMenuMode ? /* @__PURE__ */ jsx(GroupContext.Provider, { value: triggerContext, children: /* @__PURE__ */ jsx(
|
|
199
|
+
FloatButtonRoot,
|
|
200
|
+
{
|
|
201
|
+
...rest,
|
|
202
|
+
type,
|
|
203
|
+
disabled,
|
|
204
|
+
icon: isOpen ? closeIcon ?? /* @__PURE__ */ jsx(X, { "aria-hidden": "true" }) : icon,
|
|
205
|
+
"aria-label": rest["aria-label"] ?? t("ui.floatButton.actions"),
|
|
206
|
+
"aria-expanded": isOpen,
|
|
207
|
+
className: "ui-float-button-trigger",
|
|
208
|
+
onClick: (event) => {
|
|
209
|
+
if (trigger === "click") setOpen(!isOpen);
|
|
210
|
+
onClick?.(event);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
) }) : null
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
function easeInOutCubic(t, b, c, d) {
|
|
219
|
+
const cc = c - b;
|
|
220
|
+
let tt = t / (d / 2);
|
|
221
|
+
if (tt < 1) return cc / 2 * tt * tt * tt + b;
|
|
222
|
+
tt -= 2;
|
|
223
|
+
return cc / 2 * (tt * tt * tt + 2) + b;
|
|
224
|
+
}
|
|
225
|
+
function readScrollTop(target) {
|
|
226
|
+
if (!target) return 0;
|
|
227
|
+
if (target === window) return window.pageYOffset || window.document.documentElement.scrollTop;
|
|
228
|
+
if ("documentElement" in target && target.documentElement) {
|
|
229
|
+
return target.documentElement.scrollTop;
|
|
230
|
+
}
|
|
231
|
+
return target.scrollTop;
|
|
232
|
+
}
|
|
233
|
+
function writeScrollTop(target, value) {
|
|
234
|
+
if (!target) return;
|
|
235
|
+
if (target === window) {
|
|
236
|
+
window.scrollTo(window.pageXOffset, value);
|
|
237
|
+
} else if ("documentElement" in target && target.documentElement) {
|
|
238
|
+
target.documentElement.scrollTop = value;
|
|
239
|
+
} else {
|
|
240
|
+
target.scrollTop = value;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function readScrollProgress(target) {
|
|
244
|
+
if (!target) return 0;
|
|
245
|
+
const element = target === window ? window.document.documentElement : "documentElement" in target && target.documentElement ? target.documentElement : target;
|
|
246
|
+
if (!element) return 0;
|
|
247
|
+
const max = Math.max(element.scrollHeight - element.clientHeight, 0);
|
|
248
|
+
if (max <= 0) return 0;
|
|
249
|
+
return Math.min(Math.max(readScrollTop(target) / max, 0), 1);
|
|
250
|
+
}
|
|
251
|
+
function FloatButtonBackTop({
|
|
252
|
+
visibilityHeight = 400,
|
|
253
|
+
target,
|
|
254
|
+
duration = 450,
|
|
255
|
+
showProgress = false,
|
|
256
|
+
onClick,
|
|
257
|
+
icon,
|
|
258
|
+
tooltip,
|
|
259
|
+
className,
|
|
260
|
+
...rest
|
|
261
|
+
}) {
|
|
262
|
+
const { t } = useTranslation();
|
|
263
|
+
const reduceMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
264
|
+
const nodeRef = React.useRef(null);
|
|
265
|
+
const [visible, setVisible] = React.useState(visibilityHeight === 0);
|
|
266
|
+
const [progress, setProgress] = React.useState(0);
|
|
267
|
+
const getTarget = React.useCallback(
|
|
268
|
+
() => target ? target() : nodeRef.current?.ownerDocument ?? window,
|
|
269
|
+
[target]
|
|
270
|
+
);
|
|
271
|
+
React.useEffect(() => {
|
|
272
|
+
const container = getTarget();
|
|
273
|
+
let frame = 0;
|
|
274
|
+
const sync = () => {
|
|
275
|
+
frame = 0;
|
|
276
|
+
setVisible(readScrollTop(container) >= visibilityHeight);
|
|
277
|
+
if (showProgress) setProgress(readScrollProgress(container));
|
|
278
|
+
};
|
|
279
|
+
const onScroll = () => {
|
|
280
|
+
if (frame) return;
|
|
281
|
+
frame = requestAnimationFrame(sync);
|
|
282
|
+
};
|
|
283
|
+
sync();
|
|
284
|
+
container?.addEventListener("scroll", onScroll);
|
|
285
|
+
return () => {
|
|
286
|
+
if (frame) cancelAnimationFrame(frame);
|
|
287
|
+
container?.removeEventListener("scroll", onScroll);
|
|
288
|
+
};
|
|
289
|
+
}, [getTarget, showProgress, visibilityHeight]);
|
|
290
|
+
const scrollToTop = (event) => {
|
|
291
|
+
const container = getTarget();
|
|
292
|
+
const from = readScrollTop(container);
|
|
293
|
+
if (reduceMotion || duration <= 0) {
|
|
294
|
+
writeScrollTop(container, 0);
|
|
295
|
+
} else {
|
|
296
|
+
const startedAt = Date.now();
|
|
297
|
+
const step = () => {
|
|
298
|
+
const elapsed = Date.now() - startedAt;
|
|
299
|
+
if (elapsed >= duration) {
|
|
300
|
+
writeScrollTop(container, 0);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
writeScrollTop(container, easeInOutCubic(elapsed, from, 0, duration));
|
|
304
|
+
requestAnimationFrame(step);
|
|
305
|
+
};
|
|
306
|
+
requestAnimationFrame(step);
|
|
307
|
+
}
|
|
308
|
+
onClick?.(event);
|
|
309
|
+
};
|
|
310
|
+
if (!visible) return null;
|
|
311
|
+
return /* @__PURE__ */ jsx(
|
|
312
|
+
FloatButtonRoot,
|
|
313
|
+
{
|
|
314
|
+
...rest,
|
|
315
|
+
ref: nodeRef,
|
|
316
|
+
className: cn("ui-float-button-back-top", className),
|
|
317
|
+
"data-progress": showProgress ? "" : void 0,
|
|
318
|
+
icon: icon ?? /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true" }),
|
|
319
|
+
tooltip: tooltip ?? t("ui.floatButton.backTop"),
|
|
320
|
+
onClick: scrollToTop,
|
|
321
|
+
style: showProgress ? {
|
|
322
|
+
...rest.style,
|
|
323
|
+
"--float-button-progress-offset": `${progress}turn`
|
|
324
|
+
} : rest.style
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
FloatButtonGroup.displayName = "FloatButton.Group";
|
|
329
|
+
FloatButtonBackTop.displayName = "FloatButton.BackTop";
|
|
330
|
+
const FloatButton2 = Object.assign(FloatButtonRoot, {
|
|
331
|
+
Group: FloatButtonGroup,
|
|
332
|
+
BackTop: FloatButtonBackTop
|
|
333
|
+
});
|
|
334
|
+
export {
|
|
335
|
+
FloatButton2 as FloatButton
|
|
336
|
+
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export { Button, buttonVariants } from "./button.js";
|
|
2
2
|
export type { ButtonProps } from "./button.js";
|
|
3
|
-
export { Text, Heading } from "./typography.js";
|
|
4
|
-
export type { TextProps, HeadingProps, TextProp, HeadingProp } from "./typography.js";
|
|
3
|
+
export { Text, Heading, Typography, Title, Paragraph, Link } from "./typography.js";
|
|
4
|
+
export type { TextProps, HeadingProps, TextProp, HeadingProp, TypographyProp, TypographyProps, TypographyBlockProp, TypographyTitleProp, TitleProps, ParagraphProp, ParagraphProps, LinkProp, LinkProps, } from "./typography.js";
|
|
5
5
|
export { Logo } from "./logo.js";
|
|
6
6
|
export type { LogoMark, LogoProps, LogoSize, LogoTone } from "./logo.js";
|
|
7
7
|
export { Reveal } from "./reveal.js";
|
|
8
8
|
export type { RevealProp, RevealProps } from "./reveal.js";
|
|
9
|
+
export { FloatButton } from "./float-button.js";
|
|
10
|
+
export type { FloatButtonBackTopProp, FloatButtonBackTopProps, FloatButtonBadgeProp, FloatButtonGroupProp, FloatButtonGroupProps, FloatButtonPlacementProp, FloatButtonProp, FloatButtonProps, FloatButtonShapeProp, FloatButtonTooltipProp, FloatButtonTriggerProp, FloatButtonTypeProp, } from "./float-button.js";
|
|
9
11
|
export { Activity } from "./activity.js";
|
|
10
12
|
export type { ActivityProp, ActivityProps } from "./activity.js";
|
|
11
13
|
export { VisuallyHidden } from "./visually-hidden.js";
|
|
14
|
+
export { Actions, ActionsItem, ActionsCopy, ActionsFeedback } from "./actions.js";
|
|
15
|
+
export type { ActionsProp, ActionsProps, ActionsItemsProp, ActionsItemProp, ActionsItemProps, ActionsCopyProp, ActionsCopyProps, ActionsFeedbackProp, ActionsFeedbackProps, ActionsVariantProp, ActionsStatusProp, ActionsFeedbackValueProp, } from "./actions.js";
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { Button, buttonVariants } from "./button.js";
|
|
2
|
-
import { Text, Heading } from "./typography.js";
|
|
2
|
+
import { Text, Heading, Typography, Title, Paragraph, Link } from "./typography.js";
|
|
3
3
|
import { Logo } from "./logo.js";
|
|
4
4
|
import { Reveal } from "./reveal.js";
|
|
5
|
+
import { FloatButton } from "./float-button.js";
|
|
5
6
|
import { Activity } from "./activity.js";
|
|
6
7
|
import { VisuallyHidden } from "./visually-hidden.js";
|
|
8
|
+
import { Actions, ActionsItem, ActionsCopy, ActionsFeedback } from "./actions.js";
|
|
7
9
|
export {
|
|
10
|
+
Actions,
|
|
11
|
+
ActionsCopy,
|
|
12
|
+
ActionsFeedback,
|
|
13
|
+
ActionsItem,
|
|
8
14
|
Activity,
|
|
9
15
|
Button,
|
|
16
|
+
FloatButton,
|
|
10
17
|
Heading,
|
|
18
|
+
Link,
|
|
11
19
|
Logo,
|
|
20
|
+
Paragraph,
|
|
12
21
|
Reveal,
|
|
13
22
|
Text,
|
|
23
|
+
Title,
|
|
24
|
+
Typography,
|
|
14
25
|
VisuallyHidden,
|
|
15
26
|
buttonVariants
|
|
16
27
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import type { TextProp, TypographyBlockProp } from "../../props/components/general.prop.js";
|
|
3
|
+
import type { TypographyEllipsisConfigProp } from "../../props/vocabulary/index.js";
|
|
4
|
+
export type { TextProp, TextProp as TextProps, HeadingProp, HeadingProp as HeadingProps, TypographyProp, TypographyProp as TypographyProps, TypographyBlockProp, TypographyTitleProp, TypographyTitleProp as TitleProps, ParagraphProp, ParagraphProp as ParagraphProps, LinkProp, LinkProp as LinkProps, } from "../../props/components/general.prop.js";
|
|
3
5
|
/**
|
|
4
|
-
* Text — the typographic primitive
|
|
5
|
-
*
|
|
6
|
+
* Text — the typographic primitive, and antd's `Typography.Text`.
|
|
7
|
+
*
|
|
8
|
+
* Use it INSTEAD of a hand-rolled `<span className="text-[13px] font-medium text-muted-foreground">`.
|
|
9
|
+
* Size is a step of the type scale (never a px); tone and weight are tokens.
|
|
6
10
|
*/
|
|
7
|
-
export declare const Text: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement>, "color"> & {
|
|
11
|
+
export declare const Text: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement>, "color"> & Omit<TypographyBlockProp, "ellipsis"> & {
|
|
8
12
|
as?: "span" | "p" | "div" | "a" | "label" | "strong" | "em" | "small" | "code" | "kbd" | "dt" | "dd" | "caption" | "abbr";
|
|
9
13
|
asChild?: import("../../props/index.js").AsChildProp;
|
|
10
14
|
link?: boolean;
|
|
@@ -14,6 +18,7 @@ export declare const Text: React.ForwardRefExoticComponent<Omit<React.HTMLAttrib
|
|
|
14
18
|
align?: import("../../props/index.js").TextAlignProp;
|
|
15
19
|
truncate?: boolean;
|
|
16
20
|
clamp?: number;
|
|
21
|
+
ellipsis?: boolean | Omit<TypographyEllipsisConfigProp, "rows" | "expandable" | "onExpand">;
|
|
17
22
|
whitespace?: import("../../props/index.js").TextWhitespaceProp;
|
|
18
23
|
tabular?: boolean;
|
|
19
24
|
decoration?: "none" | "underline" | "line-through";
|
|
@@ -25,9 +30,39 @@ export declare const Text: React.ForwardRefExoticComponent<Omit<React.HTMLAttrib
|
|
|
25
30
|
rel?: string;
|
|
26
31
|
download?: React.AnchorHTMLAttributes<HTMLAnchorElement>["download"];
|
|
27
32
|
} & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
/**
|
|
34
|
+
* Paragraph — antd `Typography.Paragraph`.
|
|
35
|
+
*
|
|
36
|
+
* Renders a `<div>`, matching antd, because the editing textarea and the action cluster are block
|
|
37
|
+
* content that a `<p>` may not legally contain — a `<p>` would be split by the parser and the
|
|
38
|
+
* actions would end up OUTSIDE the paragraph. Pass `as="p"` when the content is phrasing-only.
|
|
39
|
+
*
|
|
40
|
+
* The one difference from `Text` is antd's: `ellipsis` here keeps `rows`, `expandable` and
|
|
41
|
+
* `onExpand`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const Paragraph: React.ForwardRefExoticComponent<Omit<TextProp, "as" | "ellipsis"> & {
|
|
44
|
+
as?: "div" | "p" | "span";
|
|
45
|
+
ellipsis?: boolean | TypographyEllipsisConfigProp;
|
|
46
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
/**
|
|
48
|
+
* Link — antd `Typography.Link`.
|
|
49
|
+
*
|
|
50
|
+
* `Text link` is the same affordance and is unchanged; `Link` is antd's anchor-by-default flavour
|
|
51
|
+
* of it. It adds antd's `rel` guard: a `target="_blank"` with no explicit `rel` gets
|
|
52
|
+
* `noopener noreferrer`, because the opened document otherwise keeps a live handle on
|
|
53
|
+
* `window.opener`. antd restricts `ellipsis` to a boolean on `Link`, and that restriction is ported
|
|
54
|
+
* by the type — `allowRows` stays off.
|
|
55
|
+
*/
|
|
56
|
+
export declare const Link: React.ForwardRefExoticComponent<Omit<TextProp, "as" | "ellipsis"> & {
|
|
57
|
+
as?: "a" | "span";
|
|
58
|
+
ellipsis?: boolean;
|
|
59
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
28
60
|
/**
|
|
29
61
|
* Heading — h1..h4 sized from the `--heading-h*` tokens. `level` sets both the size token and the
|
|
30
62
|
* semantic element; override the rendered element with `as` (e.g. a visual h2 that is a real <h1>).
|
|
63
|
+
*
|
|
64
|
+
* UNCHANGED by the antd port. antd's heading is `Title`, which is the sibling below; `Heading` is
|
|
65
|
+
* this library's own and keeps its four levels, its props and its markup exactly as they shipped.
|
|
31
66
|
*/
|
|
32
67
|
export declare const Heading: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLHeadingElement>, "color"> & {
|
|
33
68
|
level?: import("../../props/index.js").HeadingLevelProp;
|
|
@@ -37,3 +72,43 @@ export declare const Heading: React.ForwardRefExoticComponent<Omit<React.HTMLAtt
|
|
|
37
72
|
truncate?: boolean;
|
|
38
73
|
weight?: import("../../props/index.js").FontWeightProp;
|
|
39
74
|
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
75
|
+
/**
|
|
76
|
+
* Title — antd `Typography.Title`.
|
|
77
|
+
*
|
|
78
|
+
* A SIBLING of `Heading`, not a replacement: five levels instead of four, plus the antd block
|
|
79
|
+
* behaviours (`copyable`, `editable`, `ellipsis`, the decorations). antd omits `strong` here
|
|
80
|
+
* because a heading already renders at the strong weight, and that omission is ported.
|
|
81
|
+
*/
|
|
82
|
+
export declare const Title: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLHeadingElement>, "color"> & Omit<TypographyBlockProp, "strong"> & {
|
|
83
|
+
level?: import("../../props/index.js").TitleLevelProp;
|
|
84
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "div";
|
|
85
|
+
tone?: import("../../props/index.js").TextToneProp;
|
|
86
|
+
align?: import("../../props/index.js").TextAlignProp;
|
|
87
|
+
truncate?: boolean;
|
|
88
|
+
weight?: import("../../props/index.js").FontWeightProp;
|
|
89
|
+
ellipsis?: boolean | TypographyEllipsisConfigProp;
|
|
90
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
91
|
+
/**
|
|
92
|
+
* Typography — antd's plain wrapper for a run of prose.
|
|
93
|
+
*
|
|
94
|
+
* It renders an `<article>` and carries no emphasis of its own. It exists so `Title`, `Paragraph`,
|
|
95
|
+
* `Text` and `Link` have a container with the reading measure and the block rhythm on it, and so
|
|
96
|
+
* the compound spelling every antd codebase is written in — `<Typography.Text>` — works here
|
|
97
|
+
* unchanged.
|
|
98
|
+
*/
|
|
99
|
+
declare const TypographyRoot: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement>, "color"> & {
|
|
100
|
+
as?: string;
|
|
101
|
+
component?: string;
|
|
102
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
103
|
+
type TypographyCompound = typeof TypographyRoot & {
|
|
104
|
+
Text: typeof Text;
|
|
105
|
+
Title: typeof Title;
|
|
106
|
+
Paragraph: typeof Paragraph;
|
|
107
|
+
Link: typeof Link;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* The compound export. `Typography.Text` and the bare `Text` are the SAME component — there is no
|
|
111
|
+
* second, poorer Text — so a paste from an antd codebase and a call written in this library's own
|
|
112
|
+
* style compile to the same thing.
|
|
113
|
+
*/
|
|
114
|
+
export declare const Typography: TypographyCompound;
|