@godxjp/ui 32.1.3 → 32.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/agent/START-HERE.md +1 -1
- package/agent/components/DropdownMenu.json +5 -0
- package/agent/components/SearchInput.json +1 -1
- package/agent/components/Toolbar.json +11 -0
- package/agent/components.json +17 -1
- package/agent/index.json +2 -2
- package/agent/llms.txt +3 -3
- package/dist/components/data-entry/command-palette.js +2 -3
- package/dist/components/data-entry/search-input.js +2 -3
- package/dist/components/navigation/dropdown-menu.d.ts +8 -1
- package/dist/components/navigation/dropdown-menu.js +14 -1
- package/dist/components/navigation/toolbar.d.ts +1 -1
- package/dist/components/navigation/toolbar.js +42 -19
- package/dist/contracts/measurement.json +1 -1
- package/dist/lib/shortcut.d.ts +17 -1
- package/dist/lib/shortcut.js +29 -1
- package/dist/props/components/navigation.prop.d.ts +14 -0
- package/dist/props/registry.d.ts +5 -0
- package/dist/props/registry.js +5 -0
- package/dist/styles/layers.json +1 -1
- package/dist/styles/layout.css +4 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/agent/START-HERE.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
You are about to write code against a design system you did not author. This file is the whole
|
|
4
4
|
contract. Read it before you write JSX.
|
|
5
5
|
|
|
6
|
-
**This catalog describes `@godxjp/ui` 32.
|
|
6
|
+
**This catalog describes `@godxjp/ui` 32.2.0.** If the project you are editing has a different
|
|
7
7
|
version in its `package.json`, read the pinned catalog for THAT version instead
|
|
8
8
|
(`…/v<their-version>/agent/…`). A catalog newer than the installed package describes props that do
|
|
9
9
|
not exist yet; older, and it hides props that do. Neither failure announces itself.
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"name": "mouseLeaveDelay",
|
|
38
38
|
"type": "number"
|
|
39
39
|
},
|
|
40
|
+
{
|
|
41
|
+
"description": "On the ROOT. A page-level key that OPENS the menu — `\"f\"` for a filter menu, `\"mod+shift+v\"` for a view menu (gh#1264). Same combo syntax and guard as SearchInput/CommandPalette: a bare key is ignored while focus is in an editable element or an IME is composing. Off by default; ignored while `disabled`. Show the key in the trigger (e.g. with `DropdownMenuShortcut`) so it is discoverable.",
|
|
42
|
+
"name": "shortcut",
|
|
43
|
+
"type": "string"
|
|
44
|
+
},
|
|
40
45
|
{
|
|
41
46
|
"description": "Open-state change handler (Ant Design `onOpenChange`).",
|
|
42
47
|
"name": "onOpenChange",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"defaultValue": "false",
|
|
73
|
-
"description": "A global shortcut that FOCUSES the field (gh#1250). `false` (default) binds none — two search boxes on one page must not fight over one key; `true` is ⌘K on Apple platforms and Ctrl+K elsewhere (never both, so Ctrl+K keeps its editing meaning on a Mac); a combo string (`\"mod+/\"`, `\"mod+shift+f\"`) is read exactly as CommandPalette `shortcut`. A trailing aria-hidden key cap shows the combo while the field is empty — the clear ✕ takes the slot once there is text. Never fires during IME composition, nor while `disabled`.",
|
|
73
|
+
"description": "A global shortcut that FOCUSES the field (gh#1250). `false` (default) binds none — two search boxes on one page must not fight over one key; `true` is ⌘K on Apple platforms and Ctrl+K elsewhere (never both, so Ctrl+K keeps its editing meaning on a Mac); a combo string (`\"mod+/\"`, `\"mod+shift+f\"`) is read exactly as CommandPalette `shortcut`. A trailing aria-hidden key cap shows the combo while the field is empty — the clear ✕ takes the slot once there is text. Never fires during IME composition, nor while `disabled`. A BARE key (`\"/\"`) is ignored while focus is in an editable element or an IME is composing, so it stays text there; a modified combo (`mod+k`) still fires from a field (gh#1264).",
|
|
74
74
|
"name": "shortcut",
|
|
75
75
|
"type": "boolean | string"
|
|
76
76
|
},
|
|
@@ -79,6 +79,17 @@
|
|
|
79
79
|
"name": "error",
|
|
80
80
|
"type": "ReactNode"
|
|
81
81
|
},
|
|
82
|
+
{
|
|
83
|
+
"defaultValue": "\"label\"",
|
|
84
|
+
"description": "How the clear-all button shows itself (gh#1264). `label` is ✕ + the localized \"Clear filters\"; `icon` is the ✕ alone — same accessible name, a tooltip with the text, a control-height square instead of ~150px — so a bar with a few active filters keeps one row.",
|
|
85
|
+
"name": "clearDisplay",
|
|
86
|
+
"type": "\"label\" | \"icon\""
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"description": "Typed model — the saved-VIEW switcher rendered ABOVE the filter strip (e.g. `<Tabs>` of Open / Mine / All), the GitHub/Linear layout (gh#1264). A view selects a whole filter set, so it is not one more filter inside the strip; do not pass view tabs as children.",
|
|
90
|
+
"name": "views",
|
|
91
|
+
"type": "ReactNode"
|
|
92
|
+
},
|
|
82
93
|
{
|
|
83
94
|
"description": "Extra classes on the root element.",
|
|
84
95
|
"name": "className",
|
package/agent/components.json
CHANGED
|
@@ -6245,7 +6245,7 @@
|
|
|
6245
6245
|
},
|
|
6246
6246
|
{
|
|
6247
6247
|
"defaultValue": "false",
|
|
6248
|
-
"description": "A global shortcut that FOCUSES the field (gh#1250). `false` (default) binds none — two search boxes on one page must not fight over one key; `true` is ⌘K on Apple platforms and Ctrl+K elsewhere (never both, so Ctrl+K keeps its editing meaning on a Mac); a combo string (`\"mod+/\"`, `\"mod+shift+f\"`) is read exactly as CommandPalette `shortcut`. A trailing aria-hidden key cap shows the combo while the field is empty — the clear ✕ takes the slot once there is text. Never fires during IME composition, nor while `disabled`.",
|
|
6248
|
+
"description": "A global shortcut that FOCUSES the field (gh#1250). `false` (default) binds none — two search boxes on one page must not fight over one key; `true` is ⌘K on Apple platforms and Ctrl+K elsewhere (never both, so Ctrl+K keeps its editing meaning on a Mac); a combo string (`\"mod+/\"`, `\"mod+shift+f\"`) is read exactly as CommandPalette `shortcut`. A trailing aria-hidden key cap shows the combo while the field is empty — the clear ✕ takes the slot once there is text. Never fires during IME composition, nor while `disabled`. A BARE key (`\"/\"`) is ignored while focus is in an editable element or an IME is composing, so it stays text there; a modified combo (`mod+k`) still fires from a field (gh#1264).",
|
|
6249
6249
|
"name": "shortcut",
|
|
6250
6250
|
"type": "boolean | string"
|
|
6251
6251
|
},
|
|
@@ -8300,6 +8300,11 @@
|
|
|
8300
8300
|
"name": "mouseLeaveDelay",
|
|
8301
8301
|
"type": "number"
|
|
8302
8302
|
},
|
|
8303
|
+
{
|
|
8304
|
+
"description": "On the ROOT. A page-level key that OPENS the menu — `\"f\"` for a filter menu, `\"mod+shift+v\"` for a view menu (gh#1264). Same combo syntax and guard as SearchInput/CommandPalette: a bare key is ignored while focus is in an editable element or an IME is composing. Off by default; ignored while `disabled`. Show the key in the trigger (e.g. with `DropdownMenuShortcut`) so it is discoverable.",
|
|
8305
|
+
"name": "shortcut",
|
|
8306
|
+
"type": "string"
|
|
8307
|
+
},
|
|
8303
8308
|
{
|
|
8304
8309
|
"description": "Open-state change handler (Ant Design `onOpenChange`).",
|
|
8305
8310
|
"name": "onOpenChange",
|
|
@@ -8544,6 +8549,17 @@
|
|
|
8544
8549
|
"name": "error",
|
|
8545
8550
|
"type": "ReactNode"
|
|
8546
8551
|
},
|
|
8552
|
+
{
|
|
8553
|
+
"defaultValue": "\"label\"",
|
|
8554
|
+
"description": "How the clear-all button shows itself (gh#1264). `label` is ✕ + the localized \"Clear filters\"; `icon` is the ✕ alone — same accessible name, a tooltip with the text, a control-height square instead of ~150px — so a bar with a few active filters keeps one row.",
|
|
8555
|
+
"name": "clearDisplay",
|
|
8556
|
+
"type": "\"label\" | \"icon\""
|
|
8557
|
+
},
|
|
8558
|
+
{
|
|
8559
|
+
"description": "Typed model — the saved-VIEW switcher rendered ABOVE the filter strip (e.g. `<Tabs>` of Open / Mine / All), the GitHub/Linear layout (gh#1264). A view selects a whole filter set, so it is not one more filter inside the strip; do not pass view tabs as children.",
|
|
8560
|
+
"name": "views",
|
|
8561
|
+
"type": "ReactNode"
|
|
8562
|
+
},
|
|
8547
8563
|
{
|
|
8548
8564
|
"description": "Extra classes on the root element.",
|
|
8549
8565
|
"name": "className",
|
package/agent/index.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"note": "Pin to the tag that matches the @godxjp/ui version you installed. A catalog newer than your package describes props you do not have; older, and it hides props you do.",
|
|
49
49
|
"read": {
|
|
50
50
|
"live": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/main/agent/index.json",
|
|
51
|
-
"pinned": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/v32.
|
|
51
|
+
"pinned": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/v32.2.0/agent/index.json"
|
|
52
52
|
},
|
|
53
53
|
"source": "mcp/src/data — the same data @godxjp/ui-mcp serves — plus the foundation and semantic token tiers, read from src/tokens/*.css",
|
|
54
54
|
"start": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/main/agent/START-HERE.md",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"foundation": "the seeds a consumer is invited to set — --primary, --background, --radius",
|
|
63
63
|
"semantic": "named roles that follow the seeds — --ring, --text-link, --overlay-background"
|
|
64
64
|
},
|
|
65
|
-
"version": "32.
|
|
65
|
+
"version": "32.2.0"
|
|
66
66
|
}
|
package/agent/llms.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @godxjp/ui
|
|
2
2
|
|
|
3
3
|
> A Japanese-enterprise React design system: 161 components, 2193 design tokens,
|
|
4
|
-
> 43 cardinal rules. This file is the entry point for AI agents. Catalog version 32.
|
|
4
|
+
> 43 cardinal rules. This file is the entry point for AI agents. Catalog version 32.2.0.
|
|
5
5
|
|
|
6
6
|
If your client can run a process, do not read these files — run the MCP server instead
|
|
7
|
-
(`npx @godxjp/ui-mcp@32.
|
|
7
|
+
(`npx @godxjp/ui-mcp@32.2.0`). It is searchable and version-locked. These files exist for agents
|
|
8
8
|
that can only fetch URLs.
|
|
9
9
|
|
|
10
10
|
## Start
|
|
@@ -26,7 +26,7 @@ that can only fetch URLs.
|
|
|
26
26
|
## Pinning
|
|
27
27
|
|
|
28
28
|
Every URL above tracks `main`. To pin to the release a project actually installed, swap `main` for
|
|
29
|
-
the tag: `.../godx-jp/godxjp-ui/v32.
|
|
29
|
+
the tag: `.../godx-jp/godxjp-ui/v32.2.0/agent/...`. A catalog that does not match the installed
|
|
30
30
|
package describes props that are absent, or hides props that are present, and says nothing either way.
|
|
31
31
|
|
|
32
32
|
Pinned catalogs only exist for releases whose tag actually contains `agent/`. If `…/v<version>/agent/index.json` returns 404, that release predates this catalog: read `…/main/…` instead and compare `index.json` → `version` against the package you have, so you at least know which way it drifted.
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
CommandList
|
|
14
14
|
} from "./command.js";
|
|
15
15
|
import { useTranslation } from "../../i18n/use-translation.js";
|
|
16
|
-
import {
|
|
17
|
-
import { parseShortcut, shortcutHint, shortcutMatches } from "../../lib/shortcut.js";
|
|
16
|
+
import { parseShortcut, shortcutHint, shouldHandleShortcut } from "../../lib/shortcut.js";
|
|
18
17
|
const modifiersOf = (event) => ({
|
|
19
18
|
metaKey: event.metaKey,
|
|
20
19
|
ctrlKey: event.ctrlKey,
|
|
@@ -80,7 +79,7 @@ function CommandPalette({
|
|
|
80
79
|
React.useEffect(() => {
|
|
81
80
|
if (!shortcutSpec) return;
|
|
82
81
|
const handleKeyDown = (event) => {
|
|
83
|
-
if (
|
|
82
|
+
if (shouldHandleShortcut(shortcutSpec, event)) {
|
|
84
83
|
event.preventDefault();
|
|
85
84
|
if (!open && document.activeElement instanceof HTMLElement) {
|
|
86
85
|
shortcutRestoreFocusRef.current = document.activeElement;
|
|
@@ -8,8 +8,7 @@ import { Label } from "../data-entry/label.js";
|
|
|
8
8
|
import { cn } from "../../lib/utils.js";
|
|
9
9
|
import { resolveFieldA11y } from "../../lib/field-a11y.js";
|
|
10
10
|
import { useDebouncedValue } from "../../lib/hooks.js";
|
|
11
|
-
import {
|
|
12
|
-
import { parseShortcut, shortcutHint, shortcutMatches } from "../../lib/shortcut.js";
|
|
11
|
+
import { parseShortcut, shortcutHint, shouldHandleShortcut } from "../../lib/shortcut.js";
|
|
13
12
|
function SearchInput({
|
|
14
13
|
value: controlledValue,
|
|
15
14
|
defaultValue = "",
|
|
@@ -56,7 +55,7 @@ function SearchInput({
|
|
|
56
55
|
React.useEffect(() => {
|
|
57
56
|
if (!shortcutSpec || disabled) return;
|
|
58
57
|
const handleKeyDown = (event) => {
|
|
59
|
-
if (
|
|
58
|
+
if (!shouldHandleShortcut(shortcutSpec, event)) return;
|
|
60
59
|
event.preventDefault();
|
|
61
60
|
inputRef.current?.focus();
|
|
62
61
|
};
|
|
@@ -55,9 +55,16 @@ interface DropdownMenuPropsOwn {
|
|
|
55
55
|
mouseEnterDelay?: number;
|
|
56
56
|
/** Ant Design `mouseLeaveDelay`, in SECONDS. Default 0.1 — long enough to cross the gap. */
|
|
57
57
|
mouseLeaveDelay?: number;
|
|
58
|
+
/**
|
|
59
|
+
* A page-level key that OPENS the menu — `"f"` for a filter menu, `"mod+shift+v"` for a view
|
|
60
|
+
* menu (gh#1264). The same combo syntax and the same guard as `SearchInput`/`CommandPalette`: a
|
|
61
|
+
* bare key is ignored while focus is in an editable element or an IME is composing. Off by
|
|
62
|
+
* default; ignored while `disabled`. Show the key in the trigger with `DropdownMenuShortcut`.
|
|
63
|
+
*/
|
|
64
|
+
shortcut?: string;
|
|
58
65
|
}
|
|
59
66
|
type DropdownMenuProps = React.PropsWithChildren<DropdownMenuPropsOwn>;
|
|
60
|
-
export declare function DropdownMenu({ children, open, defaultOpen, onOpenChange, modal, dir, trigger, disabled, mouseEnterDelay, mouseLeaveDelay, }: DropdownMenuProps): React.JSX.Element;
|
|
67
|
+
export declare function DropdownMenu({ children, open, defaultOpen, onOpenChange, modal, dir, trigger, disabled, mouseEnterDelay, mouseLeaveDelay, shortcut, }: DropdownMenuProps): React.JSX.Element;
|
|
61
68
|
interface DropdownMenuTriggerProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
62
69
|
/** Giao hành vi mở cho phần tử con thay vì `<button>` mặc định — như Radix. */
|
|
63
70
|
asChild?: boolean;
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
useLocale
|
|
21
21
|
} from "react-aria-components";
|
|
22
22
|
import { Check, ChevronRight } from "lucide-react";
|
|
23
|
+
import { parseShortcut, shouldHandleShortcut } from "../../lib/shortcut.js";
|
|
23
24
|
import { cn } from "../../lib/utils.js";
|
|
24
25
|
import { Slot } from "../../lib/slot.js";
|
|
25
26
|
const DROPDOWN_MENU_PLACEMENT = {
|
|
@@ -117,7 +118,8 @@ function DropdownMenu({
|
|
|
117
118
|
trigger = DROPDOWN_MENU_DEFAULT_TRIGGER,
|
|
118
119
|
disabled = false,
|
|
119
120
|
mouseEnterDelay = DROPDOWN_MENU_MOUSE_ENTER_DELAY,
|
|
120
|
-
mouseLeaveDelay = DROPDOWN_MENU_MOUSE_LEAVE_DELAY
|
|
121
|
+
mouseLeaveDelay = DROPDOWN_MENU_MOUSE_LEAVE_DELAY,
|
|
122
|
+
shortcut
|
|
121
123
|
}) {
|
|
122
124
|
void dir;
|
|
123
125
|
const wantsHover = !disabled && trigger.includes("hover");
|
|
@@ -139,6 +141,17 @@ function DropdownMenu({
|
|
|
139
141
|
},
|
|
140
142
|
[disabled, open, onOpenChange]
|
|
141
143
|
);
|
|
144
|
+
const shortcutSpec = React.useMemo(() => shortcut ? parseShortcut(shortcut) : null, [shortcut]);
|
|
145
|
+
React.useEffect(() => {
|
|
146
|
+
if (!shortcutSpec || disabled) return;
|
|
147
|
+
const handleKeyDown = (event) => {
|
|
148
|
+
if (isOpenRef.current || !shouldHandleShortcut(shortcutSpec, event)) return;
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
setOpen(true);
|
|
151
|
+
};
|
|
152
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
153
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
154
|
+
}, [shortcutSpec, disabled, setOpen]);
|
|
142
155
|
const enterTimer = React.useRef(null);
|
|
143
156
|
const leaveTimer = React.useRef(null);
|
|
144
157
|
React.useEffect(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ToolbarGroupProp, ToolbarProp } from "../../props/components/navigation.prop.js";
|
|
2
2
|
export type { FilterBarChipProp, FilterBarChipProp as FilterBarChipProps, FilterBarFilterProp, FilterBarFilterProp as FilterBarFilterProps, FilterBarOverflowProp, FilterBarSearchProp, FilterBarSearchProp as FilterBarSearchProps, ToolbarGroupProp, ToolbarGroupProp as ToolbarGroupProps, ToolbarGroupProp as FilterBarGroupProp, ToolbarGroupProp as FilterBarGroupProps, ToolbarProp, ToolbarProp as ToolbarProps, ToolbarProp as FilterBarProp, ToolbarProp as FilterBarProps, } from "../../props/components/navigation.prop.js";
|
|
3
|
-
export declare function Toolbar({ onClear, hasActiveFilters, sticky, overflow, search, filters, chips, onChipRemove, actions, resultCount, loading, disabled, error, className, children, }: ToolbarProp): import("react").JSX.Element;
|
|
3
|
+
export declare function Toolbar({ onClear, hasActiveFilters, sticky, overflow, search, filters, chips, onChipRemove, actions, resultCount, loading, disabled, error, clearDisplay, views, className, children, }: ToolbarProp): import("react").JSX.Element;
|
|
4
4
|
export declare function ToolbarGroup({ label, controlId, className, children }: ToolbarGroupProp): import("react").JSX.Element;
|
|
5
5
|
/** Canonical list-page filter strip. `Toolbar` remains available for backwards compatibility. */
|
|
6
6
|
export declare const FilterBar: typeof Toolbar;
|
|
@@ -7,6 +7,7 @@ import { Button } from "../general/button.js";
|
|
|
7
7
|
import { Badge } from "../data-display/badge.js";
|
|
8
8
|
import { SearchInput } from "../data-entry/search-input.js";
|
|
9
9
|
import { Select } from "../data-entry/select.js";
|
|
10
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../feedback/tooltip.js";
|
|
10
11
|
import { cn } from "../../lib/utils.js";
|
|
11
12
|
function Toolbar({
|
|
12
13
|
onClear,
|
|
@@ -22,12 +23,49 @@ function Toolbar({
|
|
|
22
23
|
loading,
|
|
23
24
|
disabled,
|
|
24
25
|
error,
|
|
26
|
+
clearDisplay = "label",
|
|
27
|
+
views,
|
|
25
28
|
className,
|
|
26
29
|
children
|
|
27
30
|
}) {
|
|
28
31
|
const { t } = useTranslation();
|
|
29
32
|
const reactId = useId();
|
|
30
|
-
const hasModel = search !== void 0 || filters !== void 0 || chips !== void 0 || onChipRemove !== void 0 || actions !== void 0 || resultCount !== void 0 || loading !== void 0 || disabled !== void 0 || error !== void 0;
|
|
33
|
+
const hasModel = search !== void 0 || filters !== void 0 || chips !== void 0 || onChipRemove !== void 0 || actions !== void 0 || resultCount !== void 0 || loading !== void 0 || disabled !== void 0 || error !== void 0 || views !== void 0;
|
|
34
|
+
const clearButton = (isDisabled) => {
|
|
35
|
+
const label = t("common.clearFilters");
|
|
36
|
+
if (clearDisplay === "icon") {
|
|
37
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
39
|
+
Button,
|
|
40
|
+
{
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "icon-sm",
|
|
43
|
+
onClick: onClear,
|
|
44
|
+
disabled: isDisabled,
|
|
45
|
+
"aria-label": label,
|
|
46
|
+
className: "ui-toolbar-clear",
|
|
47
|
+
"data-display": "icon",
|
|
48
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: label })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
Button,
|
|
56
|
+
{
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: "sm",
|
|
59
|
+
onClick: onClear,
|
|
60
|
+
disabled: isDisabled,
|
|
61
|
+
className: "ui-toolbar-clear",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
64
|
+
label
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
31
69
|
if (!hasModel) {
|
|
32
70
|
return /* @__PURE__ */ jsxs(
|
|
33
71
|
"div",
|
|
@@ -38,10 +76,7 @@ function Toolbar({
|
|
|
38
76
|
className: cn("ui-toolbar", sticky && "ui-toolbar-sticky", className),
|
|
39
77
|
children: [
|
|
40
78
|
children,
|
|
41
|
-
onClear && hasActiveFilters &&
|
|
42
|
-
/* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
43
|
-
t("common.clearFilters")
|
|
44
|
-
] })
|
|
79
|
+
onClear && hasActiveFilters && clearButton()
|
|
45
80
|
]
|
|
46
81
|
}
|
|
47
82
|
);
|
|
@@ -55,6 +90,7 @@ function Toolbar({
|
|
|
55
90
|
className: cn("ui-filter-bar", sticky && "ui-toolbar-sticky", className),
|
|
56
91
|
"data-loading": loading || void 0,
|
|
57
92
|
children: [
|
|
93
|
+
views != null && /* @__PURE__ */ jsx("div", { className: "ui-filter-bar-views", children: views }),
|
|
58
94
|
/* @__PURE__ */ jsxs(
|
|
59
95
|
"div",
|
|
60
96
|
{
|
|
@@ -107,20 +143,7 @@ function Toolbar({
|
|
|
107
143
|
}),
|
|
108
144
|
children,
|
|
109
145
|
(showClear || actions != null) && /* @__PURE__ */ jsxs("div", { className: "ui-filter-bar-end", children: [
|
|
110
|
-
showClear &&
|
|
111
|
-
Button,
|
|
112
|
-
{
|
|
113
|
-
variant: "ghost",
|
|
114
|
-
size: "sm",
|
|
115
|
-
onClick: onClear,
|
|
116
|
-
disabled,
|
|
117
|
-
className: "ui-toolbar-clear",
|
|
118
|
-
children: [
|
|
119
|
-
/* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
120
|
-
t("common.clearFilters")
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
),
|
|
146
|
+
showClear && clearButton(disabled),
|
|
124
147
|
actions != null && /* @__PURE__ */ jsx("div", { className: "ui-filter-bar-actions", children: actions })
|
|
125
148
|
] })
|
|
126
149
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "AUTO-GENERATED by scripts/gen-measurement-contract.mjs — do not edit. Read this instead of guessing: docs/MEASUREMENT-CONTRACT.md.",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.2.0",
|
|
4
4
|
"targetSize": {
|
|
5
5
|
"standard": "WCAG 2.2 SC 2.5.8 Target Size (Minimum), level AA — 24×24 CSS px",
|
|
6
6
|
"min": 24,
|
package/dist/lib/shortcut.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A global keyboard shortcut, parsed from a combo string. Shared by `CommandPalette` (toggles the
|
|
3
|
-
* dialog)
|
|
3
|
+
* dialog), `SearchInput` (focuses the field) and `DropdownMenu` (opens the menu) so all three read
|
|
4
|
+
* `"mod+k"` the same way (gh#1250).
|
|
4
5
|
*/
|
|
5
6
|
export type ShortcutSpec = {
|
|
6
7
|
key: string;
|
|
@@ -15,3 +16,18 @@ export declare function parseShortcut(shortcut: boolean | string): ShortcutSpec
|
|
|
15
16
|
export declare function shortcutMatches(spec: ShortcutSpec, event: KeyboardEvent): boolean;
|
|
16
17
|
/** The hint a trigger shows: `mod+shift+p` → `⌘⇧P`. */
|
|
17
18
|
export declare function shortcutHint(spec: ShortcutSpec): string;
|
|
19
|
+
/**
|
|
20
|
+
* Is focus somewhere the user is TYPING — an input, a textarea, a select, a contenteditable or an
|
|
21
|
+
* ARIA textbox/combobox? A bare key is text there: `"/"` typed into a dialog field is a slash,
|
|
22
|
+
* not "focus the search box" (gh#1264, measured: typing `a/b` lost the `/`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function isEditableTarget(target: EventTarget | null): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Should this keydown run the shortcut? The ONE gate every global shortcut goes through:
|
|
27
|
+
* - never during IME composition (the key belongs to the conversion, gh#1054);
|
|
28
|
+
* - the combo must match;
|
|
29
|
+
* - a shortcut with NO command modifier (`"/"`, `"f"`, `"shift+?"`) is ignored while focus is in
|
|
30
|
+
* an editable element, where that key is text. A modified one (`"mod+k"`) still fires there —
|
|
31
|
+
* no text field types ⌘K — which is how GitHub's and Linear's palettes behave.
|
|
32
|
+
*/
|
|
33
|
+
export declare function shouldHandleShortcut(spec: ShortcutSpec, event: KeyboardEvent): boolean;
|
package/dist/lib/shortcut.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isImeComposing } from "./ime.js";
|
|
1
2
|
import { isApplePlatform } from "./platform.js";
|
|
2
3
|
function parseShortcut(shortcut) {
|
|
3
4
|
if (shortcut === false) return null;
|
|
@@ -30,8 +31,35 @@ function shortcutHint(spec) {
|
|
|
30
31
|
spec.key.length === 1 ? spec.key.toUpperCase() : spec.key
|
|
31
32
|
].join("");
|
|
32
33
|
}
|
|
34
|
+
function isEditableTarget(target) {
|
|
35
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
36
|
+
if (target.isContentEditable) return true;
|
|
37
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return true;
|
|
38
|
+
if (target instanceof HTMLInputElement) {
|
|
39
|
+
return ![
|
|
40
|
+
"button",
|
|
41
|
+
"checkbox",
|
|
42
|
+
"radio",
|
|
43
|
+
"range",
|
|
44
|
+
"reset",
|
|
45
|
+
"submit",
|
|
46
|
+
"color",
|
|
47
|
+
"file",
|
|
48
|
+
"image"
|
|
49
|
+
].includes(target.type);
|
|
50
|
+
}
|
|
51
|
+
const role = target.getAttribute("role");
|
|
52
|
+
return role === "textbox" || role === "combobox" || role === "searchbox";
|
|
53
|
+
}
|
|
54
|
+
function shouldHandleShortcut(spec, event) {
|
|
55
|
+
if (isImeComposing(event) || !shortcutMatches(spec, event)) return false;
|
|
56
|
+
const commandModifier = spec.mod || spec.meta || spec.ctrl || spec.alt;
|
|
57
|
+
return commandModifier || !isEditableTarget(event.target);
|
|
58
|
+
}
|
|
33
59
|
export {
|
|
60
|
+
isEditableTarget,
|
|
34
61
|
parseShortcut,
|
|
35
62
|
shortcutHint,
|
|
36
|
-
shortcutMatches
|
|
63
|
+
shortcutMatches,
|
|
64
|
+
shouldHandleShortcut
|
|
37
65
|
};
|
|
@@ -100,9 +100,23 @@ export type ToolbarProp = {
|
|
|
100
100
|
disabled?: DisabledProp;
|
|
101
101
|
/** Typed model — consumer error content, announced via `role="alert"` in place of the count. */
|
|
102
102
|
error?: ErrorProp;
|
|
103
|
+
/**
|
|
104
|
+
* How the clear-all button shows itself (gh#1264). `label` (default) is the ✕ plus the localized
|
|
105
|
+
* "Clear filters" text; `icon` is the ✕ alone — the same accessible name, a tooltip with the text,
|
|
106
|
+
* and a control-height square instead of ~150px, so a bar with a few active filters keeps one row.
|
|
107
|
+
*/
|
|
108
|
+
clearDisplay?: FilterBarClearDisplayProp;
|
|
109
|
+
/**
|
|
110
|
+
* Typed model — the saved-VIEW switcher above the filter strip (e.g. `<Tabs>` of "Open / Mine /
|
|
111
|
+
* All"), as GitHub and Linear put view tabs over their filters (gh#1264). A view selects a whole
|
|
112
|
+
* filter set, so it is not one more filter in the strip.
|
|
113
|
+
*/
|
|
114
|
+
views?: React.ReactNode;
|
|
103
115
|
className?: ClassNameProp;
|
|
104
116
|
children?: ChildrenProp;
|
|
105
117
|
};
|
|
118
|
+
/** @see ToolbarProp.clearDisplay */
|
|
119
|
+
export type FilterBarClearDisplayProp = "label" | "icon";
|
|
106
120
|
/** @see ToolbarGroup */
|
|
107
121
|
export type ToolbarGroupProp = {
|
|
108
122
|
label: LabelProp;
|
package/dist/props/registry.d.ts
CHANGED
|
@@ -2591,6 +2591,11 @@ export declare const COMPONENT_PROP_REGISTRY: {
|
|
|
2591
2591
|
readonly file: "components/navigation.prop.ts";
|
|
2592
2592
|
readonly vocabulary: readonly ["OnClearFiltersProp", "HasActiveFiltersProp", "StickyProp", "ActionsProp", "PendingProp", "DisabledProp", "ErrorProp", "ClassNameProp", "ChildrenProp"];
|
|
2593
2593
|
};
|
|
2594
|
+
readonly FilterBarClearDisplayProp: {
|
|
2595
|
+
readonly group: "navigation";
|
|
2596
|
+
readonly file: "components/navigation.prop.ts";
|
|
2597
|
+
readonly vocabulary: readonly [];
|
|
2598
|
+
};
|
|
2594
2599
|
readonly FilterBarOverflowProp: {
|
|
2595
2600
|
readonly group: "navigation";
|
|
2596
2601
|
readonly file: "components/navigation.prop.ts";
|
package/dist/props/registry.js
CHANGED
|
@@ -3023,6 +3023,11 @@ const COMPONENT_PROP_REGISTRY = {
|
|
|
3023
3023
|
"ChildrenProp"
|
|
3024
3024
|
]
|
|
3025
3025
|
},
|
|
3026
|
+
FilterBarClearDisplayProp: {
|
|
3027
|
+
group: "navigation",
|
|
3028
|
+
file: "components/navigation.prop.ts",
|
|
3029
|
+
vocabulary: []
|
|
3030
|
+
},
|
|
3026
3031
|
FilterBarOverflowProp: {
|
|
3027
3032
|
group: "navigation",
|
|
3028
3033
|
file: "components/navigation.prop.ts",
|
package/dist/styles/layers.json
CHANGED