@abyss-project/commons-front-core 9.5.0 → 9.5.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.
package/README.md CHANGED
@@ -90,6 +90,14 @@ export const buildRumOptions = () =>
90
90
 
91
91
  ## Changements visibles
92
92
 
93
+ ### 9.5.1
94
+
95
+ - **`testId` sur `TabItem` et `MenuItem`** : rendu en `data-testid` sur l'élément interactif (`role="tab"`,
96
+ `role="menuitem"`), absent sans lui. `Menu` accepte aussi `testId` sur son conteneur. Les e2e des hôtes lisent ces
97
+ identifiants, que `Tabs` et `Menu` ne transmettaient pas.
98
+ - **`Kbd` dans les déclarations publiées** : son type est écrit à la main (un composant de `kbd`), car le type déduit
99
+ ne pouvait pas être nommé dans les `.d.ts` et `Kbd` en était absent, bien que la racine l'exporte.
100
+
93
101
  ### 9.5.0
94
102
 
95
103
  Éditeurs des outils du front principal sur le design system (carte #286, zone 4b). Pièces nouvelles, chacune documentée
@@ -17,6 +17,8 @@ export interface MenuItem {
17
17
  shortcut?: string;
18
18
  tone?: MenuItemTone;
19
19
  disabled?: boolean;
20
+ /** Rendered as `data-testid` on the item (the `role="menuitem"` element). */
21
+ testId?: string;
20
22
  onSelect(): void;
21
23
  }
22
24
  export interface MenuProps {
@@ -24,10 +26,12 @@ export interface MenuProps {
24
26
  open: boolean;
25
27
  onClose(): void;
26
28
  items: (MenuItem | MenuSeparator)[];
29
+ /** Rendered as `data-testid` on the menu container, for a host whose trigger needs it. */
30
+ testId?: string;
27
31
  }
28
32
  /**
29
33
  * A menu of actions anchored to an element (`.menu`), on the `overlay` elevation. Arrow keys move
30
34
  * between the enabled items, Enter or Space selects, Escape and Tab close it and the focus returns
31
35
  * to the anchor.
32
36
  */
33
- export declare function Menu({ anchorEl, open, onClose, items }: MenuProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function Menu({ anchorEl, open, onClose, items, testId }: MenuProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { ComponentPropsWithoutRef, ComponentType } from 'react';
2
+ /**
3
+ * A keyboard shortcut hint (`kbd` in the mock-up), shared by the menu and the command palette.
4
+ * Typed as a plain component: the inferred styled type cannot be named in the published
5
+ * declarations, which would leave `Kbd` out of them.
6
+ */
7
+ export declare const Kbd: ComponentType<ComponentPropsWithoutRef<'kbd'>>;
@@ -12,6 +12,8 @@ export interface TabItem<V extends string = string> {
12
12
  badge?: number | string;
13
13
  /** Left out of the row, as if absent (an entry the viewer has no right to). */
14
14
  hidden?: boolean;
15
+ /** Rendered as `data-testid` on the tab (the `role="tab"` element). */
16
+ testId?: string;
15
17
  }
16
18
  export interface TabsProps<V extends string = string> {
17
19
  items: TabItem<V>[];
package/dist/index.js CHANGED
@@ -5075,8 +5075,8 @@ const Es = (e) => e !== "tone", B1 = c(st, { shouldForwardProp: Es })(({ theme:
5075
5075
  textOverflow: "ellipsis",
5076
5076
  whiteSpace: "nowrap"
5077
5077
  }));
5078
- function As({ anchorEl: e, open: t, onClose: n, items: i }) {
5079
- const s = re();
5078
+ function As({ anchorEl: e, open: t, onClose: n, items: i, testId: s }) {
5079
+ const a = re();
5080
5080
  return /* @__PURE__ */ r(
5081
5081
  Mo,
5082
5082
  {
@@ -5086,27 +5086,29 @@ function As({ anchorEl: e, open: t, onClose: n, items: i }) {
5086
5086
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
5087
5087
  transformOrigin: { vertical: "top", horizontal: "left" },
5088
5088
  variant: "menu",
5089
+ "data-testid": s,
5089
5090
  children: i.map(
5090
- (a, l) => a === "divider" ? /* @__PURE__ */ r(fn, { component: "li", role: "separator" }, `divider-${l}`) : /* @__PURE__ */ f(
5091
+ (l, d) => l === "divider" ? /* @__PURE__ */ r(fn, { component: "li", role: "separator" }, `divider-${d}`) : /* @__PURE__ */ f(
5091
5092
  B1,
5092
5093
  {
5093
- "aria-labelledby": a.description === void 0 ? void 0 : `${s}-${a.id}-label`,
5094
- "aria-describedby": a.description === void 0 ? void 0 : `${s}-${a.id}-description`,
5095
- tone: a.tone ?? "default",
5096
- disabled: a.disabled,
5094
+ "aria-labelledby": l.description === void 0 ? void 0 : `${a}-${l.id}-label`,
5095
+ "aria-describedby": l.description === void 0 ? void 0 : `${a}-${l.id}-description`,
5096
+ tone: l.tone ?? "default",
5097
+ disabled: l.disabled,
5098
+ "data-testid": l.testId,
5097
5099
  onClick: () => {
5098
- a.disabled || (n(), a.onSelect());
5100
+ l.disabled || (n(), l.onSelect());
5099
5101
  },
5100
5102
  children: [
5101
- a.icon !== void 0 && /* @__PURE__ */ r(G1, { tone: a.tone ?? "default", "aria-hidden": !0, children: a.icon }),
5102
- a.description === void 0 ? /* @__PURE__ */ r(_i, { children: a.label }) : /* @__PURE__ */ f(U1, { children: [
5103
- /* @__PURE__ */ r(_i, { id: `${s}-${a.id}-label`, children: a.label }),
5104
- /* @__PURE__ */ r(V1, { id: `${s}-${a.id}-description`, children: a.description })
5103
+ l.icon !== void 0 && /* @__PURE__ */ r(G1, { tone: l.tone ?? "default", "aria-hidden": !0, children: l.icon }),
5104
+ l.description === void 0 ? /* @__PURE__ */ r(_i, { children: l.label }) : /* @__PURE__ */ f(U1, { children: [
5105
+ /* @__PURE__ */ r(_i, { id: `${a}-${l.id}-label`, children: l.label }),
5106
+ /* @__PURE__ */ r(V1, { id: `${a}-${l.id}-description`, children: l.description })
5105
5107
  ] }),
5106
- a.shortcut !== void 0 && /* @__PURE__ */ r(Ds, { "aria-hidden": !0, children: a.shortcut })
5108
+ l.shortcut !== void 0 && /* @__PURE__ */ r(Ds, { "aria-hidden": !0, children: l.shortcut })
5107
5109
  ]
5108
5110
  },
5109
- a.id
5111
+ l.id
5110
5112
  )
5111
5113
  )
5112
5114
  }
@@ -10388,6 +10390,7 @@ function t9({
10388
10390
  role: "tab",
10389
10391
  "aria-selected": v,
10390
10392
  tabIndex: x === y ? 0 : -1,
10393
+ "data-testid": h.testId,
10391
10394
  variant: i,
10392
10395
  onClick: () => n == null ? void 0 : n(h.value)
10393
10396
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/commons-front-core",
3
- "version": "9.5.0",
3
+ "version": "9.5.1",
4
4
  "description": "Front Core package of AbyssProject",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",