@godxjp/ui 19.5.0 → 20.0.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/data-display/card.d.ts +2 -2
- package/dist/components/data-display/collapsible.d.ts +23 -4
- package/dist/components/data-display/collapsible.js +119 -4
- package/dist/components/data-display/index.d.ts +3 -1
- package/dist/components/data-display/index.js +2 -0
- package/dist/components/data-display/legend.d.ts +15 -0
- package/dist/components/data-display/legend.js +11 -0
- package/dist/components/data-display/list-row.js +1 -1
- package/dist/components/data-display/popover.d.ts +58 -5
- package/dist/components/data-display/popover.js +206 -27
- package/dist/components/data-display/progress.d.ts +50 -2
- package/dist/components/data-display/progress.js +57 -9
- package/dist/components/data-entry/calendar.d.ts +1 -1
- package/dist/components/data-entry/calendar.js +67 -32
- package/dist/components/data-entry/checkbox.d.ts +19 -6
- package/dist/components/data-entry/checkbox.js +55 -16
- package/dist/components/data-entry/choice-option.d.ts +1 -1
- package/dist/components/data-entry/date-range-picker.d.ts +1 -1
- package/dist/components/data-entry/field.js +0 -1
- package/dist/components/data-entry/form.js +1 -1
- package/dist/components/data-entry/label.d.ts +3 -2
- package/dist/components/data-entry/label.js +23 -10
- package/dist/components/data-entry/month-picker.d.ts +1 -1
- package/dist/components/data-entry/month-range-picker.d.ts +1 -1
- package/dist/components/data-entry/transfer.js +16 -6
- package/dist/components/data-entry/tree-select-strategy.d.ts +1 -1
- package/dist/components/data-entry/tree-select.js +29 -12
- package/dist/components/data-entry/tree-utils.d.ts +1 -1
- package/dist/components/data-entry/upload.js +7 -2
- package/dist/components/feedback/dialog.d.ts +105 -38
- package/dist/components/feedback/dialog.js +272 -194
- package/dist/components/feedback/overlay-close-focus.d.ts +31 -0
- package/dist/components/feedback/overlay-close-focus.js +31 -0
- package/dist/components/feedback/overlay-header-tone.d.ts +1 -1
- package/dist/components/feedback/sheet.d.ts +53 -11
- package/dist/components/feedback/sheet.js +150 -81
- package/dist/components/feedback/tooltip.d.ts +51 -7
- package/dist/components/feedback/tooltip.js +107 -25
- package/dist/components/general/button.js +2 -2
- package/dist/components/general/logo.d.ts +17 -0
- package/dist/components/general/logo.js +22 -16
- package/dist/components/general/typography.d.ts +7 -1
- package/dist/components/general/typography.js +20 -5
- package/dist/components/layout/app-shell.d.ts +1 -1
- package/dist/components/layout/app-shell.js +52 -8
- package/dist/components/layout/aspect-ratio.js +0 -1
- package/dist/components/layout/auth-divider.js +0 -1
- package/dist/components/layout/flex.d.ts +1 -1
- package/dist/components/layout/flex.js +19 -2
- package/dist/components/layout/nav-surface.d.ts +26 -0
- package/dist/components/layout/nav-surface.js +17 -0
- package/dist/components/layout/org-switcher.d.ts +5 -1
- package/dist/components/layout/org-switcher.js +5 -3
- package/dist/components/layout/separator.js +0 -1
- package/dist/components/layout/sidebar.js +4 -1
- package/dist/components/layout/split-pane.d.ts +14 -1
- package/dist/components/layout/split-pane.js +26 -13
- package/dist/components/layout/topbar-item.js +1 -2
- package/dist/components/navigation/app-setting-picker.js +21 -2
- package/dist/components/navigation/app-setting-toggle.d.ts +16 -0
- package/dist/components/navigation/app-setting-toggle.js +96 -0
- package/dist/components/navigation/dropdown-menu.d.ts +199 -18
- package/dist/components/navigation/dropdown-menu.js +344 -117
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +2 -0
- package/dist/components/navigation/pagination-utils.d.ts +2 -1
- package/dist/components/navigation/tabs.d.ts +47 -6
- package/dist/components/navigation/tabs.js +152 -90
- package/dist/components/ui/accordion.d.ts +50 -5
- package/dist/components/ui/accordion.js +239 -33
- package/dist/components/ui/aspect-ratio.d.ts +23 -2
- package/dist/components/ui/aspect-ratio.js +15 -13
- package/dist/components/ui/avatar.d.ts +29 -4
- package/dist/components/ui/avatar.js +111 -25
- package/dist/components/ui/hover-card.d.ts +42 -4
- package/dist/components/ui/hover-card.js +183 -27
- package/dist/components/ui/label.js +0 -1
- package/dist/components/ui/segmented.d.ts +3 -3
- package/dist/components/ui/separator.d.ts +8 -2
- package/dist/components/ui/separator.js +17 -9
- package/dist/components/ui/toggle-group.d.ts +50 -5
- package/dist/components/ui/toggle-group.js +79 -20
- package/dist/components/ui/toggle.d.ts +31 -5
- package/dist/components/ui/toggle.js +42 -3
- package/dist/i18n/messages/en.json +8 -0
- package/dist/i18n/messages/ja.json +8 -0
- package/dist/i18n/messages/vi.json +8 -0
- package/dist/lib/control-styles.d.ts +1 -1
- package/dist/lib/control-styles.js +1 -1
- package/dist/lib/slot.d.ts +32 -0
- package/dist/lib/slot.js +22 -0
- package/dist/lib/variants.d.ts +22 -3
- package/dist/lib/variants.js +56 -1
- package/dist/props/components/app.prop.d.ts +25 -1
- package/dist/props/components/data-display.prop.d.ts +17 -0
- package/dist/props/components/data-entry.prop.d.ts +32 -4
- package/dist/props/components/general.prop.d.ts +31 -1
- package/dist/props/components/index.d.ts +1 -1
- package/dist/props/components/layout.prop.d.ts +118 -5
- package/dist/props/components/navigation.prop.d.ts +1 -1
- package/dist/props/registry.d.ts +22 -2
- package/dist/props/registry.js +33 -2
- package/dist/props/vocabulary/content.prop.d.ts +1 -1
- package/dist/props/vocabulary/index.d.ts +2 -2
- package/dist/props/vocabulary/interaction.prop.d.ts +17 -1
- package/dist/props/vocabulary/layout.prop.d.ts +57 -1
- package/dist/styles/control.css +142 -1
- package/dist/styles/core.css +5 -2
- package/dist/styles/data-display-layout.css +72 -0
- package/dist/styles/focus-ring.css +13 -1
- package/dist/styles/index.css +5 -2
- package/dist/styles/layout.css +106 -0
- package/dist/styles/shell-layout.css +140 -8
- package/dist/styles/text-layout.css +16 -4
- package/dist/tokens/base.css +2 -1
- package/dist/tokens/components/data-display.css +11 -0
- package/dist/tokens/components/shell.css +3 -1
- package/dist/tokens/components/text.css +7 -0
- package/dist/tokens/foundation.css +2 -0
- package/docs/COMPONENTS.md +9 -3
- package/docs/DESIGN-AUTHORITY.md +96 -71
- package/docs/FRAME-COVERAGE-REPORT.md +5 -3
- package/docs/README.md +14 -14
- package/docs/WHAT-BELONGS-HERE.md +179 -0
- package/docs/data-display/legend.tsx +145 -0
- package/docs/data-display/progress.tsx +32 -0
- package/docs/data-entry/segmented.tsx +1 -1
- package/docs/data-entry/select.tsx +2 -2
- package/docs/feedback/sheet.tsx +1 -1
- package/docs/general/typography.tsx +84 -1
- package/docs/layout/app-shell-arrangements.tsx +225 -0
- package/docs/layout/aspect-ratio.tsx +1 -1
- package/docs/navigation/app-setting-picker.tsx +26 -1
- package/docs/navigation/app-setting-toggle.tsx +111 -0
- package/package.json +11 -8
- package/scripts/_agent-setup.mjs +165 -3
- package/scripts/consumer-rule.md +98 -0
- package/scripts/guinea-pig-skill.md +322 -0
- package/scripts/init-guinea-pig.mjs +62 -0
- package/scripts/postinstall.mjs +13 -2
- package/scripts/ui-audit.mjs +115 -14
- /package/dist/tokens/{antd.generated.css → derived.css} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
AArrowDown,
|
|
6
|
+
AArrowUp,
|
|
7
|
+
ALargeSmall,
|
|
8
|
+
Clock,
|
|
9
|
+
Monitor,
|
|
10
|
+
Moon,
|
|
11
|
+
Rows2,
|
|
12
|
+
Rows3,
|
|
13
|
+
Rows4,
|
|
14
|
+
Sun
|
|
15
|
+
} from "lucide-react";
|
|
16
|
+
import { APP_TIME_FORMAT_OPTIONS, getTimeFormatLabel } from "../../app/time-format-labels.js";
|
|
17
|
+
import { APP_DENSITIES, APP_FONT_SIZES, APP_THEMES } from "../../app/theme-axes.js";
|
|
18
|
+
import { useOptionalAppContext } from "../../app/app-provider.js";
|
|
19
|
+
import { useTranslation } from "../../i18n/use-translation.js";
|
|
20
|
+
import { Button } from "../general/button.js";
|
|
21
|
+
import { TopbarItem } from "../layout/topbar-item.js";
|
|
22
|
+
const VALUES = {
|
|
23
|
+
theme: APP_THEMES,
|
|
24
|
+
density: APP_DENSITIES,
|
|
25
|
+
fontSize: APP_FONT_SIZES,
|
|
26
|
+
timeFormat: APP_TIME_FORMAT_OPTIONS.map((option) => option.value)
|
|
27
|
+
};
|
|
28
|
+
const VALUE_ICON = {
|
|
29
|
+
theme: { light: Sun, dark: Moon, system: Monitor },
|
|
30
|
+
density: { compact: Rows4, default: Rows3, comfortable: Rows2 },
|
|
31
|
+
fontSize: { sm: AArrowDown, default: ALargeSmall, lg: AArrowUp },
|
|
32
|
+
// 12h vs 24h is a NOTATION, not a picture: `Clock3`/`Clock12` differ only by hand position, which
|
|
33
|
+
// reads as a time of day. So this kind shows the kind glyph plus the value as text instead.
|
|
34
|
+
timeFormat: {}
|
|
35
|
+
};
|
|
36
|
+
const KIND_ICON = {
|
|
37
|
+
theme: Sun,
|
|
38
|
+
density: Rows3,
|
|
39
|
+
fontSize: ALargeSmall,
|
|
40
|
+
timeFormat: Clock
|
|
41
|
+
};
|
|
42
|
+
const ARIA_KEY = {
|
|
43
|
+
theme: "navigation.themePicker.ariaLabel",
|
|
44
|
+
density: "navigation.densityPicker.ariaLabel",
|
|
45
|
+
fontSize: "navigation.fontSizePicker.ariaLabel",
|
|
46
|
+
timeFormat: "navigation.timeFormatPicker.ariaLabel"
|
|
47
|
+
};
|
|
48
|
+
const AppSettingToggle = React.forwardRef(
|
|
49
|
+
function AppSettingToggle2({ kind, appearance = "bar", className, disabled, id, value, onValueChange }, ref) {
|
|
50
|
+
const ctx = useOptionalAppContext();
|
|
51
|
+
const { t, locale, fallbackLocale } = useTranslation();
|
|
52
|
+
const raw = value ?? ctx?.[kind];
|
|
53
|
+
const current = raw == null ? void 0 : String(raw);
|
|
54
|
+
const setter = ctx ? {
|
|
55
|
+
theme: ctx.setTheme,
|
|
56
|
+
density: ctx.setDensity,
|
|
57
|
+
fontSize: ctx.setFontSize,
|
|
58
|
+
timeFormat: ctx.setTimeFormat
|
|
59
|
+
}[kind] : void 0;
|
|
60
|
+
const handleChange = onValueChange ?? setter;
|
|
61
|
+
const unbound = current === void 0 || !handleChange;
|
|
62
|
+
const values = VALUES[kind];
|
|
63
|
+
const handleClick = () => {
|
|
64
|
+
if (current === void 0 || !handleChange) return;
|
|
65
|
+
handleChange(values[(values.indexOf(current) + 1) % values.length]);
|
|
66
|
+
};
|
|
67
|
+
const ValueIcon = current === void 0 ? void 0 : VALUE_ICON[kind][current];
|
|
68
|
+
const Icon = ValueIcon ?? KIND_ICON[kind];
|
|
69
|
+
const valueLabel = current === void 0 ? "" : kind === "timeFormat" ? getTimeFormatLabel(current, locale, fallbackLocale) : t(`navigation.${kind}Picker.${current}`);
|
|
70
|
+
const shared = {
|
|
71
|
+
ref,
|
|
72
|
+
id,
|
|
73
|
+
type: "button",
|
|
74
|
+
disabled: disabled || unbound,
|
|
75
|
+
onClick: handleClick,
|
|
76
|
+
"data-kind": kind,
|
|
77
|
+
// The button has no visible label, so this aria-label is its ONLY accessible name — and it
|
|
78
|
+
// must name the VALUE too, or a cycler announces the same string at every step.
|
|
79
|
+
"aria-label": t("navigation.settingToggle.label", {
|
|
80
|
+
setting: t(ARIA_KEY[kind]),
|
|
81
|
+
value: valueLabel
|
|
82
|
+
}),
|
|
83
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
|
|
85
|
+
ValueIcon ? null : /* @__PURE__ */ jsx("span", { children: current })
|
|
86
|
+
] })
|
|
87
|
+
};
|
|
88
|
+
if (appearance === "bar") {
|
|
89
|
+
return /* @__PURE__ */ jsx(TopbarItem, { className, ...shared });
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsx(Button, { variant: "ghost", size: ValueIcon ? "icon" : "sm", className, ...shared });
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
export {
|
|
95
|
+
AppSettingToggle
|
|
96
|
+
};
|
|
@@ -1,24 +1,205 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare
|
|
10
|
-
|
|
2
|
+
import { type MenuItemRenderProps, type PopoverProps, type PopoverRenderProps } from "react-aria-components";
|
|
3
|
+
/**
|
|
4
|
+
* Dịch trạng thái item của RAC sang bộ `data-*` mà Radix phát ra và CSS của kho đang bám.
|
|
5
|
+
*
|
|
6
|
+
* `data-highlighted` là móc tô sáng bàn phím (`.ui-dropdown-menu-item[data-highlighted]`);
|
|
7
|
+
* `data-state` mang cả hai nghĩa của Radix — "open" cho sub-trigger, "checked" cho hàng có chọn.
|
|
8
|
+
*/
|
|
9
|
+
export declare function radixItemState(state: MenuItemRenderProps): Record<string, string | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Dịch trạng thái popover của RAC sang `data-state` / `data-side` của Radix.
|
|
12
|
+
*
|
|
13
|
+
* ĐI KÈM: hai chỗ gọi nó đều bỏ `role` khỏi DOM (`role={undefined}`). RAC tự gắn `role="dialog"`
|
|
14
|
+
* cho MỌI popover modal — "Automatically render Popover with role=dialog except when isNonModal is
|
|
15
|
+
* true" — kể cả khi ruột của nó là một `role="menu"`. Radix không làm thế, và hợp đồng của tệp này
|
|
16
|
+
* là giữ hình dạng Radix ở CẢ cây a11y chứ không chỉ ở tên prop.
|
|
17
|
+
*
|
|
18
|
+
* Cái giá, đo được ở consumer chuột bạch (godx-chat, 08/09/2026): mở một hộp thoại TỪ một mục menu
|
|
19
|
+
* để lại HAI phần tử `role="dialog"` trong DOM suốt ~300ms — popover của menu đang chạy animation
|
|
20
|
+
* thoát (`data-exiting`), cộng chính hộp thoại vừa mở. 12 phép kiểm Playwright đỏ bằng "strict mode
|
|
21
|
+
* violation" trên `getByRole('dialog')`, thứ Playwright KHÔNG thử lại. Và với trình đọc màn hình,
|
|
22
|
+
* một menu vẫn tự xưng là "dialog".
|
|
23
|
+
*
|
|
24
|
+
* Bỏ đúng THUỘC TÍNH, không đụng hành vi: state `isDialog` bên trong RAC không đổi, nên việc đưa
|
|
25
|
+
* tiêu điểm vào popover lúc mở vẫn chạy nguyên như cũ.
|
|
26
|
+
*/
|
|
27
|
+
export declare function radixSurfaceState(state: PopoverRenderProps): Record<string, string | undefined>;
|
|
28
|
+
/** Radix `side` + `align` → `placement` của RAC. `align="center"` là placement trần. */
|
|
29
|
+
export declare function toPlacement(side?: "top" | "right" | "bottom" | "left", align?: "start" | "center" | "end"): PopoverProps["placement"];
|
|
30
|
+
/**
|
|
31
|
+
* Radix trao cho `onSelect` một `Event` huỷ được. RAC's `onAction` không có sự kiện nào, nên ta
|
|
32
|
+
* dựng một cái tương đương để consumer gọi `preventDefault()` không nổ — nhưng nó KHÔNG còn giữ
|
|
33
|
+
* menu mở được nữa (xem báo cáo di trú).
|
|
34
|
+
*/
|
|
35
|
+
export declare function selectEvent(name: string): Event;
|
|
36
|
+
interface DropdownMenuPropsOwn {
|
|
37
|
+
/** Trạng thái mở có kiểm soát (Radix). Bên trong là `isOpen` của RAC. */
|
|
38
|
+
open?: boolean;
|
|
39
|
+
defaultOpen?: boolean;
|
|
40
|
+
onOpenChange?: (open: boolean) => void;
|
|
41
|
+
/** `modal={false}` → `isNonModal` của RAC: nền không bị khoá cuộn, không bị `inert`. */
|
|
42
|
+
modal?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Radix đọc `dir` để đảo mũi tên trái/phải. RAC lấy hướng từ locale (`I18nProvider` /
|
|
45
|
+
* `useLocale`), nên prop này còn trong API vì hợp đồng, nhưng không tự đảo hướng.
|
|
46
|
+
*/
|
|
47
|
+
dir?: "ltr" | "rtl";
|
|
48
|
+
}
|
|
49
|
+
type DropdownMenuProps = React.PropsWithChildren<DropdownMenuPropsOwn>;
|
|
50
|
+
export declare function DropdownMenu({ children, open, defaultOpen, onOpenChange, modal, dir, }: DropdownMenuProps): React.JSX.Element;
|
|
51
|
+
interface DropdownMenuTriggerProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
52
|
+
/** Giao hành vi mở cho phần tử con thay vì `<button>` mặc định — như Radix. */
|
|
53
|
+
asChild?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* RAC không nhận một `<button>` trần làm trigger: hành vi nhấn đi qua `PressResponder`, và chỉ
|
|
57
|
+
* `Pressable` (hoặc một component gọi `usePress`) mới nhận được nó. `asChild` vì vậy trở thành
|
|
58
|
+
* "bọc con trong `Pressable`" thay vì "hợp nhất props vào con" — kết quả với consumer là như nhau:
|
|
59
|
+
* chính phần tử của họ mang `aria-haspopup` / `aria-expanded` và nhận cú nhấn.
|
|
60
|
+
*/
|
|
61
|
+
export declare function DropdownMenuTrigger({ asChild, children, ...props }: DropdownMenuTriggerProps): React.JSX.Element;
|
|
62
|
+
interface DropdownMenuPortalPropsOwn {
|
|
63
|
+
/** Giữ tên vì hợp đồng: RAC `Popover` tự cổng ra `document.body`, không có bản dựng cưỡng bức. */
|
|
64
|
+
forceMount?: true;
|
|
65
|
+
}
|
|
66
|
+
type DropdownMenuPortalProps = React.PropsWithChildren<DropdownMenuPortalPropsOwn>;
|
|
67
|
+
/** RAC `Popover` đã tự cổng, nên Portal chỉ còn là chỗ giữ hình dạng cây của Radix. */
|
|
68
|
+
export declare function DropdownMenuPortal({ children }: DropdownMenuPortalProps): React.JSX.Element;
|
|
69
|
+
interface DropdownMenuGroupPropsOwn {
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
type DropdownMenuGroupProps = React.PropsWithChildren<DropdownMenuGroupPropsOwn>;
|
|
73
|
+
/** Radix dựng `<div role="group">`; RAC `MenuSection` dựng `<section role="group">`. */
|
|
74
|
+
export declare function DropdownMenuGroup({ children, className }: DropdownMenuGroupProps): React.JSX.Element;
|
|
75
|
+
interface DropdownMenuRadioGroupPropsOwn {
|
|
76
|
+
className?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
onValueChange?: (value: string) => void;
|
|
79
|
+
}
|
|
80
|
+
type DropdownMenuRadioGroupProps = React.PropsWithChildren<DropdownMenuRadioGroupPropsOwn>;
|
|
81
|
+
/**
|
|
82
|
+
* Radix giữ trạng thái chọn ở chính RadioGroup; RAC giữ ở collection, khoá theo `id` của item.
|
|
83
|
+
* Nên `value` của consumer trở thành `selectedKeys` và `value` của RadioItem trở thành khoá.
|
|
84
|
+
*/
|
|
85
|
+
export declare function DropdownMenuRadioGroup({ children, className, value, onValueChange, }: DropdownMenuRadioGroupProps): React.JSX.Element;
|
|
86
|
+
interface DropdownMenuSubPropsOwn {
|
|
87
|
+
/**
|
|
88
|
+
* RAC `SubmenuTrigger` tự giữ trạng thái mở của submenu và không phơi ra chỗ nào để điều khiển
|
|
89
|
+
* nó. Ba prop này còn trong API vì hợp đồng, nhưng không còn tác dụng.
|
|
90
|
+
*/
|
|
91
|
+
open?: boolean;
|
|
92
|
+
defaultOpen?: boolean;
|
|
93
|
+
onOpenChange?: (open: boolean) => void;
|
|
94
|
+
}
|
|
95
|
+
type DropdownMenuSubProps = React.PropsWithChildren<DropdownMenuSubPropsOwn>;
|
|
96
|
+
/**
|
|
97
|
+
* `SubmenuTrigger` đọc children THEO VỊ TRÍ — `children[0]` là item mở submenu, `children[1]` là
|
|
98
|
+
* popover — nên thứ tự `<SubTrigger/>` rồi `<SubContent/>` của Radix ánh xạ thẳng.
|
|
99
|
+
*/
|
|
100
|
+
export declare function DropdownMenuSub({ children }: DropdownMenuSubProps): React.JSX.Element;
|
|
101
|
+
interface DropdownMenuContentPropsOwn {
|
|
102
|
+
className?: string;
|
|
103
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
104
|
+
align?: "start" | "center" | "end";
|
|
105
|
+
sideOffset?: number;
|
|
106
|
+
alignOffset?: number;
|
|
107
|
+
avoidCollisions?: boolean;
|
|
108
|
+
collisionPadding?: number;
|
|
109
|
+
/** Radix `loop` cho điều hướng bàn phím → `shouldFocusWrap` của RAC. */
|
|
110
|
+
loop?: boolean;
|
|
111
|
+
/** Giữ tên vì hợp đồng; RAC không có bản dựng cưỡng bức và không tự tháo khi trigger rời màn. */
|
|
112
|
+
forceMount?: true;
|
|
113
|
+
hideWhenDetached?: boolean;
|
|
114
|
+
sticky?: "partial" | "always";
|
|
115
|
+
}
|
|
116
|
+
type DropdownMenuContentProps = React.PropsWithChildren<DropdownMenuContentPropsOwn>;
|
|
117
|
+
/**
|
|
118
|
+
* Một phần tử của Radix (`Content`) tách thành HAI ở RAC: `Popover` là hộp được định vị, `Menu` là
|
|
119
|
+
* phần tử mang `role="menu"`. `data-slot` và lớp `ui-dropdown-menu-content` ở lại trên HỘP, cùng
|
|
120
|
+
* chỗ với `data-state` / `data-side` mà các utility animate đang đọc.
|
|
121
|
+
*
|
|
122
|
+
* `useInertHiddenBackground` đã được gỡ ở đây: RAC gọi `ariaHideOutside(..., {shouldUseInert:
|
|
123
|
+
* true})` — nền thành `inert` thật chứ không chỉ `aria-hidden`, nên axe `aria-hidden-focus` không
|
|
124
|
+
* còn cửa để nổ. Và hiệu ứng đó khoá theo `state.isOpen`, không theo unmount, nên `inert` được nhả
|
|
125
|
+
* NGAY ở ý định đóng: đúng lớp lỗi gh#385, đã sửa ở thượng nguồn. Phép đo là
|
|
126
|
+
* `src/components/__tests__/overlay-inert-release-385.test.tsx`.
|
|
127
|
+
*/
|
|
128
|
+
export declare function DropdownMenuContent({ children, className, side, align, sideOffset, alignOffset, avoidCollisions, collisionPadding, loop, hideWhenDetached, sticky, forceMount, }: DropdownMenuContentProps): React.JSX.Element;
|
|
129
|
+
interface DropdownMenuItemPropsOwn {
|
|
130
|
+
className?: string;
|
|
11
131
|
inset?: boolean;
|
|
12
132
|
variant?: "default" | "destructive";
|
|
13
|
-
|
|
14
|
-
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
onSelect?: (event: Event) => void;
|
|
135
|
+
textValue?: string;
|
|
136
|
+
/** Mượn thẻ của con thay vì dựng `<div>` riêng — chỗ để nhét một `<Link>` vào một mục menu. */
|
|
137
|
+
asChild?: boolean;
|
|
138
|
+
}
|
|
139
|
+
type DropdownMenuItemProps = React.PropsWithChildren<DropdownMenuItemPropsOwn>;
|
|
140
|
+
export declare function DropdownMenuItem({ children, className, inset, variant, disabled, onSelect, textValue, asChild, }: DropdownMenuItemProps): React.JSX.Element;
|
|
141
|
+
interface DropdownMenuLabelPropsOwn {
|
|
142
|
+
className?: string;
|
|
15
143
|
inset?: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
144
|
+
/** Mượn thẻ của con thay vì dựng `<header>` riêng. */
|
|
145
|
+
asChild?: boolean;
|
|
146
|
+
}
|
|
147
|
+
type DropdownMenuLabelProps = React.PropsWithChildren<DropdownMenuLabelPropsOwn>;
|
|
148
|
+
/**
|
|
149
|
+
* Radix dựng `<div>`; nút nhãn của một collection RAC là `Header`, tức `<header>`.
|
|
150
|
+
*
|
|
151
|
+
* `Header` không đi qua `useRenderProps`, nên `props.children` trong `render` CHÍNH là children của
|
|
152
|
+
* consumer — không có `Provider` chen vào như ở `MenuItem`. `Slot` vì thế nhận thẳng gói props.
|
|
153
|
+
*/
|
|
154
|
+
export declare function DropdownMenuLabel({ children, className, inset, asChild }: DropdownMenuLabelProps): React.JSX.Element;
|
|
155
|
+
interface DropdownMenuSeparatorProps {
|
|
156
|
+
className?: string;
|
|
157
|
+
}
|
|
158
|
+
export declare function DropdownMenuSeparator({ className }: DropdownMenuSeparatorProps): React.JSX.Element;
|
|
159
|
+
interface DropdownMenuCheckboxItemPropsOwn {
|
|
160
|
+
className?: string;
|
|
161
|
+
checked?: boolean;
|
|
162
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
163
|
+
disabled?: boolean;
|
|
164
|
+
textValue?: string;
|
|
165
|
+
/** Mượn thẻ của con thay vì dựng `<div>` riêng; ô đánh dấu vẫn nằm bên trong thẻ mượn. */
|
|
166
|
+
asChild?: boolean;
|
|
167
|
+
}
|
|
168
|
+
type DropdownMenuCheckboxItemProps = React.PropsWithChildren<DropdownMenuCheckboxItemPropsOwn>;
|
|
169
|
+
export declare function DropdownMenuCheckboxItem({ children, className, checked, onCheckedChange, disabled, textValue, asChild, }: DropdownMenuCheckboxItemProps): React.JSX.Element;
|
|
170
|
+
interface DropdownMenuRadioItemPropsOwn {
|
|
171
|
+
className?: string;
|
|
172
|
+
value: string;
|
|
173
|
+
disabled?: boolean;
|
|
174
|
+
textValue?: string;
|
|
175
|
+
/** Mượn thẻ của con thay vì dựng `<div>` riêng. */
|
|
176
|
+
asChild?: boolean;
|
|
177
|
+
}
|
|
178
|
+
type DropdownMenuRadioItemProps = React.PropsWithChildren<DropdownMenuRadioItemPropsOwn>;
|
|
179
|
+
export declare function DropdownMenuRadioItem({ children, className, value, disabled, textValue, asChild, }: DropdownMenuRadioItemProps): React.JSX.Element;
|
|
180
|
+
interface DropdownMenuSubTriggerPropsOwn {
|
|
181
|
+
className?: string;
|
|
21
182
|
inset?: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
183
|
+
disabled?: boolean;
|
|
184
|
+
textValue?: string;
|
|
185
|
+
/** Mượn thẻ của con thay vì dựng `<div>` riêng; mũi tên submenu vẫn nằm bên trong thẻ mượn. */
|
|
186
|
+
asChild?: boolean;
|
|
187
|
+
}
|
|
188
|
+
type DropdownMenuSubTriggerProps = React.PropsWithChildren<DropdownMenuSubTriggerPropsOwn>;
|
|
189
|
+
export declare function DropdownMenuSubTrigger({ children, className, inset, disabled, textValue, asChild, }: DropdownMenuSubTriggerProps): React.JSX.Element;
|
|
190
|
+
interface DropdownMenuSubContentPropsOwn {
|
|
191
|
+
className?: string;
|
|
192
|
+
align?: "start" | "center" | "end";
|
|
193
|
+
alignOffset?: number;
|
|
194
|
+
sideOffset?: number;
|
|
195
|
+
avoidCollisions?: boolean;
|
|
196
|
+
collisionPadding?: number;
|
|
197
|
+
loop?: boolean;
|
|
198
|
+
forceMount?: true;
|
|
199
|
+
hideWhenDetached?: boolean;
|
|
200
|
+
sticky?: "partial" | "always";
|
|
201
|
+
}
|
|
202
|
+
type DropdownMenuSubContentProps = React.PropsWithChildren<DropdownMenuSubContentPropsOwn>;
|
|
203
|
+
export declare function DropdownMenuSubContent({ children, className, align, alignOffset, sideOffset, avoidCollisions, collisionPadding, loop, forceMount, hideWhenDetached, sticky, }: DropdownMenuSubContentProps): React.JSX.Element;
|
|
24
204
|
export declare const DropdownMenuShortcut: ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => React.JSX.Element;
|
|
205
|
+
export {};
|