@godxjp/ui 32.1.3 → 32.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.1.3.** If the project you are editing has a different
6
+ **This catalog describes `@godxjp/ui` 32.2.1.** 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`. The trigger gets `aria-keyshortcuts` automatically (an explicit consumer value wins); show the key visibly too (e.g. `DropdownMenuShortcut`). Never fires from inside a dialog, menu or listbox that does not contain the menu (gh#1267).",
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,23 @@
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
+ },
93
+ {
94
+ "defaultValue": "\"above\"",
95
+ "description": "Where `views` sits (gh#1267). `above` is its own row over the strip; `inline` puts it at the START of the strip's first row so an idle bar stays ONE row (with `above`, an idle bar measured 55 → 95px and one table row fewer above the fold at 1440×900).",
96
+ "name": "viewsPlacement",
97
+ "type": "\"above\" | \"inline\""
98
+ },
82
99
  {
83
100
  "description": "Extra classes on the root element.",
84
101
  "name": "className",
@@ -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`. The trigger gets `aria-keyshortcuts` automatically (an explicit consumer value wins); show the key visibly too (e.g. `DropdownMenuShortcut`). Never fires from inside a dialog, menu or listbox that does not contain the menu (gh#1267).",
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,23 @@
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
+ },
8563
+ {
8564
+ "defaultValue": "\"above\"",
8565
+ "description": "Where `views` sits (gh#1267). `above` is its own row over the strip; `inline` puts it at the START of the strip's first row so an idle bar stays ONE row (with `above`, an idle bar measured 55 → 95px and one table row fewer above the fold at 1440×900).",
8566
+ "name": "viewsPlacement",
8567
+ "type": "\"above\" | \"inline\""
8568
+ },
8547
8569
  {
8548
8570
  "description": "Extra classes on the root element.",
8549
8571
  "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.1.3/agent/index.json"
51
+ "pinned": "https://raw.githubusercontent.com/godx-jp/godxjp-ui/v32.2.1/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.1.3"
65
+ "version": "32.2.1"
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.1.3.
4
+ > 43 cardinal rules. This file is the entry point for AI agents. Catalog version 32.2.1.
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.1.3`). It is searchable and version-locked. These files exist for agents
7
+ (`npx @godxjp/ui-mcp@32.2.1`). 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.1.3/agent/...`. A catalog that does not match the installed
29
+ the tag: `.../godx-jp/godxjp-ui/v32.2.1/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.
@@ -916,7 +916,7 @@ DataTable.Content = function DataTableContent() {
916
916
  const el = scrollRef.current;
917
917
  if (!el) return;
918
918
  for (const cell of el.querySelectorAll("tbody td.ui-data-table-ellipsis")) {
919
- if (cell === document.activeElement) continue;
919
+ if (cell.contains(document.activeElement)) continue;
920
920
  const ownTitle = cell.dataset.truncatedTitle !== void 0;
921
921
  if (cell.scrollWidth - cell.clientWidth > 1) {
922
922
  cell.dataset.truncated = "";
@@ -13,8 +13,7 @@ import {
13
13
  CommandList
14
14
  } from "./command.js";
15
15
  import { useTranslation } from "../../i18n/use-translation.js";
16
- import { isImeComposing } from "../../lib/ime.js";
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 (!isImeComposing(event) && shortcutMatches(shortcutSpec, event)) {
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,12 @@ 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 { isImeComposing } from "../../lib/ime.js";
12
- import { parseShortcut, shortcutHint, shortcutMatches } from "../../lib/shortcut.js";
11
+ import {
12
+ ariaKeyShortcuts,
13
+ parseShortcut,
14
+ shortcutHint,
15
+ shouldHandleShortcut
16
+ } from "../../lib/shortcut.js";
13
17
  function SearchInput({
14
18
  value: controlledValue,
15
19
  defaultValue = "",
@@ -56,7 +60,7 @@ function SearchInput({
56
60
  React.useEffect(() => {
57
61
  if (!shortcutSpec || disabled) return;
58
62
  const handleKeyDown = (event) => {
59
- if (isImeComposing(event) || !shortcutMatches(shortcutSpec, event)) return;
63
+ if (!shouldHandleShortcut(shortcutSpec, event, inputRef.current)) return;
60
64
  event.preventDefault();
61
65
  inputRef.current?.focus();
62
66
  };
@@ -79,6 +83,7 @@ function SearchInput({
79
83
  id: inputId,
80
84
  type: "text",
81
85
  role: "searchbox",
86
+ "aria-keyshortcuts": shortcutSpec ? ariaKeyShortcuts(shortcutSpec) : void 0,
82
87
  value,
83
88
  onChange: (e) => {
84
89
  setValue(e.target.value);
@@ -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 { ariaKeyShortcuts, 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(
@@ -176,9 +189,10 @@ function DropdownMenu({
176
189
  disabled,
177
190
  hover,
178
191
  racOwnsContextMenu,
179
- openedByHover
192
+ openedByHover,
193
+ keyShortcuts: shortcutSpec && !disabled ? ariaKeyShortcuts(shortcutSpec) : void 0
180
194
  }),
181
- [modal, wantsContextMenu, disabled, hover, racOwnsContextMenu, wantsHover]
195
+ [modal, wantsContextMenu, disabled, hover, racOwnsContextMenu, wantsHover, shortcutSpec]
182
196
  );
183
197
  return /* @__PURE__ */ jsx(DropdownMenuModalContext.Provider, { value: options, children: /* @__PURE__ */ jsx(
184
198
  MenuTrigger,
@@ -195,7 +209,7 @@ function DropdownMenuTrigger({ asChild, children, ...props }) {
195
209
  const menuState = React.useContext(
196
210
  RootMenuTriggerStateContext
197
211
  );
198
- const { contextMenuGesture, disabled, hover, racOwnsContextMenu } = React.useContext(DropdownMenuModalContext);
212
+ const { contextMenuGesture, disabled, hover, racOwnsContextMenu, keyShortcuts } = React.useContext(DropdownMenuModalContext);
199
213
  const dataState = state?.isOpen ? "open" : "closed";
200
214
  const wantsContextMenu = contextMenuGesture;
201
215
  const isDisabled = disabled || props.disabled;
@@ -238,6 +252,8 @@ function DropdownMenuTrigger({ asChild, children, ...props }) {
238
252
  return /* @__PURE__ */ jsx(Pressable, { isDisabled, children: React.cloneElement(children, {
239
253
  "data-slot": "dropdown-menu-trigger",
240
254
  "data-state": dataState,
255
+ // The root's `shortcut`, announced (gh#1267); a consumer's own value wins.
256
+ ...keyShortcuts && children.props["aria-keyshortcuts"] === void 0 ? { "aria-keyshortcuts": keyShortcuts } : {},
241
257
  // A right click target is usually a region rather than a button, and Shift+F10 needs it
242
258
  // focusable — so it is given a tab stop unless the consumer already placed one.
243
259
  ...wantsContextMenu && children.props.tabIndex === void 0 ? { tabIndex: 0 } : {},
@@ -257,6 +273,7 @@ function DropdownMenuTrigger({ asChild, children, ...props }) {
257
273
  isDisabled,
258
274
  "data-slot": "dropdown-menu-trigger",
259
275
  "data-state": dataState,
276
+ "aria-keyshortcuts": props["aria-keyshortcuts"] ?? keyShortcuts,
260
277
  children
261
278
  }
262
279
  );
@@ -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, viewsPlacement, 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,50 @@ function Toolbar({
22
23
  loading,
23
24
  disabled,
24
25
  error,
26
+ clearDisplay = "label",
27
+ views,
28
+ viewsPlacement = "above",
25
29
  className,
26
30
  children
27
31
  }) {
28
32
  const { t } = useTranslation();
29
33
  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;
34
+ 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;
35
+ const clearButton = (isDisabled) => {
36
+ const label = t("common.clearFilters");
37
+ if (clearDisplay === "icon") {
38
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
39
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
40
+ Button,
41
+ {
42
+ variant: "ghost",
43
+ size: "icon-sm",
44
+ onClick: onClear,
45
+ disabled: isDisabled,
46
+ "aria-label": label,
47
+ className: "ui-toolbar-clear",
48
+ "data-display": "icon",
49
+ children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
50
+ }
51
+ ) }),
52
+ /* @__PURE__ */ jsx(TooltipContent, { children: label })
53
+ ] });
54
+ }
55
+ return /* @__PURE__ */ jsxs(
56
+ Button,
57
+ {
58
+ variant: "ghost",
59
+ size: "sm",
60
+ onClick: onClear,
61
+ disabled: isDisabled,
62
+ className: "ui-toolbar-clear",
63
+ children: [
64
+ /* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
65
+ label
66
+ ]
67
+ }
68
+ );
69
+ };
31
70
  if (!hasModel) {
32
71
  return /* @__PURE__ */ jsxs(
33
72
  "div",
@@ -38,10 +77,7 @@ function Toolbar({
38
77
  className: cn("ui-toolbar", sticky && "ui-toolbar-sticky", className),
39
78
  children: [
40
79
  children,
41
- onClear && hasActiveFilters && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onClear, className: "ui-toolbar-clear", children: [
42
- /* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
43
- t("common.clearFilters")
44
- ] })
80
+ onClear && hasActiveFilters && clearButton()
45
81
  ]
46
82
  }
47
83
  );
@@ -55,6 +91,7 @@ function Toolbar({
55
91
  className: cn("ui-filter-bar", sticky && "ui-toolbar-sticky", className),
56
92
  "data-loading": loading || void 0,
57
93
  children: [
94
+ views != null && viewsPlacement === "above" && /* @__PURE__ */ jsx("div", { className: "ui-filter-bar-views", children: views }),
58
95
  /* @__PURE__ */ jsxs(
59
96
  "div",
60
97
  {
@@ -64,6 +101,7 @@ function Toolbar({
64
101
  "data-overflow": overflow,
65
102
  className: "ui-toolbar",
66
103
  children: [
104
+ views != null && viewsPlacement === "inline" && /* @__PURE__ */ jsx("div", { className: "ui-filter-bar-views", "data-placement": "inline", children: views }),
67
105
  search && /* @__PURE__ */ jsx(
68
106
  SearchInput,
69
107
  {
@@ -107,20 +145,7 @@ function Toolbar({
107
145
  }),
108
146
  children,
109
147
  (showClear || actions != null) && /* @__PURE__ */ jsxs("div", { className: "ui-filter-bar-end", children: [
110
- showClear && /* @__PURE__ */ jsxs(
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
- ),
148
+ showClear && clearButton(disabled),
124
149
  actions != null && /* @__PURE__ */ jsx("div", { className: "ui-filter-bar-actions", children: actions })
125
150
  ] })
126
151
  ]
@@ -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.1.3",
3
+ "version": "32.2.1",
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,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * A global keyboard shortcut, parsed from a combo string. Shared by `CommandPalette` (toggles the
3
- * dialog) and `SearchInput` (focuses the field) so both read `"mod+k"` the same way (gh#1250).
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,25 @@ 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
+ * - never from inside a dialog/menu/listbox that does not contain `owner` (gh#1267);
29
+ * - the combo must match;
30
+ * - a shortcut with NO command modifier (`"/"`, `"f"`, `"shift+?"`) is ignored while focus is in
31
+ * an editable element, where that key is text. A modified one (`"mod+k"`) still fires there —
32
+ * no text field types ⌘K — which is how GitHub's and Linear's palettes behave.
33
+ */
34
+ export declare function shouldHandleShortcut(spec: ShortcutSpec, event: KeyboardEvent, owner?: Element | null): boolean;
35
+ /**
36
+ * The `aria-keyshortcuts` value for a spec (WAI-ARIA 1.2: modifiers then key, `+`-joined, with
37
+ * `Control`/`Meta`/`Alt`/`Shift` spelled out and a letter upper-cased): `mod+k` → `Meta+K` on
38
+ * Apple platforms, `Control+K` elsewhere; `"/"` → `/` (gh#1267).
39
+ */
40
+ export declare function ariaKeyShortcuts(spec: ShortcutSpec): string;
@@ -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,52 @@ 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, owner) {
55
+ if (isImeComposing(event) || !shortcutMatches(spec, event)) return false;
56
+ if (inForeignLayer(event.target, owner)) return false;
57
+ const commandModifier = spec.mod || spec.meta || spec.ctrl || spec.alt;
58
+ return commandModifier || !isEditableTarget(event.target);
59
+ }
60
+ const SHORTCUT_LAYER = '[role="dialog"], [role="alertdialog"], [aria-modal="true"], [role="menu"], [role="listbox"]';
61
+ function inForeignLayer(target, owner) {
62
+ if (!(target instanceof Element)) return false;
63
+ const layer = target.closest(SHORTCUT_LAYER);
64
+ return layer !== null && !(owner && layer.contains(owner));
65
+ }
66
+ function ariaKeyShortcuts(spec) {
67
+ return [
68
+ spec.ctrl || spec.mod && !isApplePlatform() ? "Control" : "",
69
+ spec.meta || spec.mod && isApplePlatform() ? "Meta" : "",
70
+ spec.alt ? "Alt" : "",
71
+ spec.shift ? "Shift" : "",
72
+ spec.key.length === 1 ? spec.key.toUpperCase() : spec.key
73
+ ].filter(Boolean).join("+");
74
+ }
33
75
  export {
76
+ ariaKeyShortcuts,
77
+ isEditableTarget,
34
78
  parseShortcut,
35
79
  shortcutHint,
36
- shortcutMatches
80
+ shortcutMatches,
81
+ shouldHandleShortcut
37
82
  };
@@ -100,9 +100,31 @@ 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;
115
+ /**
116
+ * Where `views` sits (gh#1267). `above` (default) is its own row over the strip; `inline` puts it
117
+ * at the START of the strip's first row, so an idle bar stays ONE row — measured with `above`: an
118
+ * idle bar 55 → 95px, one table row fewer above the fold at 1440×900.
119
+ */
120
+ viewsPlacement?: FilterBarViewsPlacementProp;
103
121
  className?: ClassNameProp;
104
122
  children?: ChildrenProp;
105
123
  };
124
+ /** @see ToolbarProp.viewsPlacement */
125
+ export type FilterBarViewsPlacementProp = "above" | "inline";
126
+ /** @see ToolbarProp.clearDisplay */
127
+ export type FilterBarClearDisplayProp = "label" | "icon";
106
128
  /** @see ToolbarGroup */
107
129
  export type ToolbarGroupProp = {
108
130
  label: LabelProp;
@@ -2591,6 +2591,16 @@ 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
+ };
2599
+ readonly FilterBarViewsPlacementProp: {
2600
+ readonly group: "navigation";
2601
+ readonly file: "components/navigation.prop.ts";
2602
+ readonly vocabulary: readonly [];
2603
+ };
2594
2604
  readonly FilterBarOverflowProp: {
2595
2605
  readonly group: "navigation";
2596
2606
  readonly file: "components/navigation.prop.ts";
@@ -3023,6 +3023,16 @@ 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
+ },
3031
+ FilterBarViewsPlacementProp: {
3032
+ group: "navigation",
3033
+ file: "components/navigation.prop.ts",
3034
+ vocabulary: []
3035
+ },
3026
3036
  FilterBarOverflowProp: {
3027
3037
  group: "navigation",
3028
3038
  file: "components/navigation.prop.ts",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "32.1.3",
2
+ "version": "32.2.1",
3
3
  "generatedBy": "scripts/gen-style-layers.mjs — do not edit by hand; run `pnpm gen:style-layers`",
4
4
  "base": "base.css",
5
5
  "fonts": "fonts.css",
@@ -1529,6 +1529,10 @@
1529
1529
  gap: var(--filter-bar-section-gap);
1530
1530
  }
1531
1531
 
1532
+ .ui-filter-bar-views {
1533
+ min-inline-size: 0;
1534
+ }
1535
+
1532
1536
  .ui-filter-bar .ui-filter-bar-search {
1533
1537
  inline-size: 100%;
1534
1538
  }
@@ -535,7 +535,8 @@
535
535
  white-space: nowrap;
536
536
  }
537
537
 
538
- .ui-data-table-ellipsis[data-truncated]:focus-visible {
538
+ .ui-data-table-ellipsis[data-truncated]:focus-visible,
539
+ .ui-data-table-ellipsis[data-truncated]:has(:focus-visible) {
539
540
  white-space: normal;
540
541
  overflow-wrap: anywhere;
541
542
  }