@gravitee/graphene-core 3.37.0 → 3.38.0-fix-found-404-flow-form-sheet-ids.5c67e32

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/USAGE_GUIDE.md CHANGED
@@ -1054,7 +1054,7 @@ The platform e2e suite selects elements by `data-testid` only. These are the rul
1054
1054
 
1055
1055
  - **One attribute.** The test id is the `data-testid` attribute, on every component, base and composed. There is no `testId` or `testIdPrefix` prop, and no `data-test`, `data-cy` or `id` alias.
1056
1056
  - **Your id wins.** The id you pass always wins. An element you compose yourself (a `DialogClose`, a `SelectItem`, a `Button` placed in a slot such as `actions` or `children`) keeps your own id.
1057
- - **No default ids.** Graphene never sets an id when you pass none.
1057
+ - **No default ids.** Graphene never sets an id when you pass none. The one exception is `PolicyStudio` (below).
1058
1058
  - **Where the id lands.**
1059
1059
  - Form fields: the native control (`button`, `input`, `textarea`, the `button[role=checkbox|switch|radio]`).
1060
1060
  - Anything that opens an overlay: the trigger.
@@ -1080,6 +1080,9 @@ The components that derive ids from yours. A part exists only when you pass an i
1080
1080
  | `Calendar` | `${id}-day-<yyyy-MM-dd>` | Day button, with `mode` or `onDayClick`; an outside day too, unless another displayed month shows its date |
1081
1081
  | `Calendar` | `${id}-month-<n>` | Month dropdown of the displayed month at position `n` (from 0), with a dropdown `captionLayout` |
1082
1082
  | `Calendar` | `${id}-year-<n>` | Year dropdown of the displayed month at position `n` (from 0), with a dropdown `captionLayout` |
1083
+ | `DialogContent` | `${id}-close` | Built-in close button, with `showCloseButton` (the default) |
1084
+ | `DialogFooter` | `${id}-close` | Built-in close button, with `showCloseButton` |
1085
+ | `SheetContent` | `${id}-close` | Built-in close button, with `showCloseButton` (the default) |
1083
1086
 
1084
1087
  The `Calendar` day keys are dates as react-day-picker formats them: they assume react-day-picker's default `numerals` (`latn`) and no `dateLib` override (Gregorian calendar); the `locale` doesn't change them. The dropdown keys are positions: navigating or picking a month doesn't change them. A `Calendar` part you replace through `components` gets no id. Replacing `MonthCaption` also drops the `month` and `year` ids, even though the dropdowns still render.
1085
1088
 
@@ -1087,6 +1090,10 @@ The `Calendar` day keys are dates as react-day-picker formats them: they assume
1087
1090
 
1088
1091
  A toast is created by a function call, so pass `toast(message, { testId })`. Sonner renders it as `data-testid` on the toast element. It is the only entry point that is not the `data-testid` attribute. Sonner's built-in close and action buttons can't be tagged.
1089
1092
 
1093
+ **Exception: `PolicyStudio`**
1094
+
1095
+ `PolicyStudio` sets ids without one from you, because you can't tag anything inside it. Its ids derive from the prefix `policy-studio`; a `data-testid` on `PolicyStudio` replaces that prefix. Two studios on one page each need their own `data-testid`. The sub-exports (`FlowsSidebar`, `PolicyStudioLayout`, …) set no default: they take the prefix from a `data-testid` on `PolicyStudioProvider`. Every studio id is listed in the studio's id map, `docs/test-ids.md`, shipped in the `@gravitee/graphene-policy-studio` package.
1096
+
1090
1097
  ## Common mistakes to avoid
1091
1098
 
1092
1099
  - Importing `@gravitee/graphene-core/styles` **before** the app Tailwind entry when using Tier 2 (preflight can override Graphene base styles such as default border color).
@@ -7,10 +7,14 @@ declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPri
7
7
  declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
8
8
  declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
9
  showCloseButton?: boolean;
10
+ /** Lands on the content node; the built-in close button gets `${id}-close`. */
11
+ 'data-testid'?: string;
10
12
  }): React.JSX.Element;
11
13
  declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
14
  declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<'div'> & {
13
15
  showCloseButton?: boolean;
16
+ /** Lands on the footer; the built-in close button, with `showCloseButton`, gets `${id}-close`. */
17
+ 'data-testid'?: string;
14
18
  }): React.JSX.Element;
15
19
  declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
16
20
  declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/base/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAE9E;AAED,iBAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAExF;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAEtF;AAED,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpF;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAWnG;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,qBA0BA;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAEzE;AAED,iBAAS,YAAY,CAA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Aa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAWnG;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,qBAkCA;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAEzE;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,eAAuB,EACvB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,qBAuBA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQ/F;AAED,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,qBAW3G;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
@@ -7,6 +7,8 @@ declare function SheetContent({ className, children, side, showCloseButton, over
7
7
  side?: 'top' | 'right' | 'bottom' | 'left';
8
8
  showCloseButton?: boolean;
9
9
  overlayClassName?: string;
10
+ /** Lands on the content node; the built-in close button gets `${id}-close`. */
11
+ 'data-testid'?: string;
10
12
  }): React.JSX.Element;
11
13
  declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
14
  declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../../../src/base/Sheet/Sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAEtF;AAED,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAElF;AAmBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG;IACvD,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,qBA2BA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAExE;AAED,iBAAS,WAAW,CAAC,EAAE,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,GAAG,MAAM,CAAC;IAC3C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,qBAmCA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAExE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAExE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAQ7F;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,qBAQzG;AAED,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -17403,6 +17403,7 @@ function OF({ className: e, ...n }) {
17403
17403
  });
17404
17404
  }
17405
17405
  function kF({ className: e, children: n, showCloseButton: r = !0, ...i }) {
17406
+ let a = i["data-testid"];
17406
17407
  return /* @__PURE__ */ G(EF, { children: [/* @__PURE__ */ W(OF, {}), /* @__PURE__ */ W(Wd, {
17407
17408
  "data-slot": "dialog-content",
17408
17409
  className: t("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-var(--spacing-8))] -translate-1/2 gap-4 rounded-xl bg-card p-4 text-sm text-card-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
@@ -17413,6 +17414,7 @@ function kF({ className: e, children: n, showCloseButton: r = !0, ...i }) {
17413
17414
  variant: "ghost",
17414
17415
  className: "absolute top-2 right-2",
17415
17416
  size: "icon-sm",
17417
+ "data-testid": bC(a, "close"),
17416
17418
  children: [/* @__PURE__ */ W(Se, { "aria-hidden": "true" }), /* @__PURE__ */ W("span", {
17417
17419
  className: "sr-only",
17418
17420
  children: "Close"
@@ -17429,6 +17431,7 @@ function AF({ className: e, ...n }) {
17429
17431
  });
17430
17432
  }
17431
17433
  function jF({ className: e, showCloseButton: n = !1, children: r, ...i }) {
17434
+ let a = i["data-testid"];
17432
17435
  return /* @__PURE__ */ G("div", {
17433
17436
  "data-slot": "dialog-footer",
17434
17437
  className: t("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end", e),
@@ -17437,6 +17440,7 @@ function jF({ className: e, showCloseButton: n = !1, children: r, ...i }) {
17437
17440
  asChild: !0,
17438
17441
  children: /* @__PURE__ */ W(ry, {
17439
17442
  variant: "outline",
17443
+ "data-testid": bC(a, "close"),
17440
17444
  children: "Close"
17441
17445
  })
17442
17446
  }), r]
@@ -23551,6 +23555,7 @@ function FH({ className: e, ...n }) {
23551
23555
  });
23552
23556
  }
23553
23557
  function IH({ className: e, children: n, side: r = "right", showCloseButton: i = !0, overlayClassName: a, ...o }) {
23558
+ let s = o["data-testid"];
23554
23559
  return /* @__PURE__ */ G(PH, { children: [/* @__PURE__ */ W(FH, { className: a }), /* @__PURE__ */ W(Wd, {
23555
23560
  "data-slot": "sheet-content",
23556
23561
  "data-side": r,
@@ -23563,6 +23568,7 @@ function IH({ className: e, children: n, side: r = "right", showCloseButton: i =
23563
23568
  variant: "ghost",
23564
23569
  className: "absolute top-3 right-3",
23565
23570
  size: "icon-sm",
23571
+ "data-testid": bC(s, "close"),
23566
23572
  children: [/* @__PURE__ */ W(Se, { "aria-hidden": "true" }), /* @__PURE__ */ W("span", {
23567
23573
  className: "sr-only",
23568
23574
  children: "Close"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/graphene-core",
3
- "version": "3.37.0",
3
+ "version": "3.38.0-fix-found-404-flow-form-sheet-ids.5c67e32",
4
4
  "type": "module",
5
5
  "description": "Gravitee's Graphene design system: accessible React components, design tokens, icons, and shared ESLint/TypeScript configs. Built on shadcn/ui and Tailwind.",
6
6
  "keywords": [
@@ -103,6 +103,7 @@
103
103
  },
104
104
  "peerDependencies": {
105
105
  "@fontsource/dm-sans": ">=5.0.0",
106
+ "@gravitee/graphene-core": "3.38.0-fix-found-404-flow-form-sheet-ids.5c67e32",
106
107
  "@monaco-editor/react": "^4.7.0",
107
108
  "@tanstack/react-table": "^8.0.0",
108
109
  "@testing-library/dom": ">=10.0.0",