@canonical/react-ds-global 0.31.0 → 0.33.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.
Files changed (73) hide show
  1. package/dist/esm/lib/_work_in_progress/Announcement/Announcement.js.map +1 -0
  2. package/dist/esm/lib/_work_in_progress/Announcement/index.js.map +1 -0
  3. package/dist/esm/lib/_work_in_progress/Announcement/types.js.map +1 -0
  4. package/dist/esm/lib/_work_in_progress/index.js +1 -0
  5. package/dist/esm/lib/_work_in_progress/index.js.map +1 -1
  6. package/dist/esm/lib/component/Accordion/common/Item/styles.css +70 -0
  7. package/dist/esm/lib/component/Button/styles.css +58 -42
  8. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js +6 -5
  9. package/dist/esm/lib/component/ContextualMenu/ContextualMenu.js.map +1 -1
  10. package/dist/esm/lib/component/KeyboardKey/KeyboardKey.js +5 -1
  11. package/dist/esm/lib/component/KeyboardKey/KeyboardKey.js.map +1 -1
  12. package/dist/esm/lib/component/KeyboardKey/styles.css +23 -5
  13. package/dist/esm/lib/component/Tabs/common/Item/styles.css +12 -0
  14. package/dist/esm/lib/component/Tooltip/Tooltip.js +1 -1
  15. package/dist/esm/lib/component/Tooltip/index.js +0 -1
  16. package/dist/esm/lib/component/Tooltip/index.js.map +1 -1
  17. package/dist/esm/lib/component/Tooltip/styles.css +17 -0
  18. package/dist/esm/lib/component/Tooltip/withTooltip.js +70 -7
  19. package/dist/esm/lib/component/Tooltip/withTooltip.js.map +1 -1
  20. package/dist/esm/lib/component/index.js +0 -1
  21. package/dist/esm/lib/component/index.js.map +1 -1
  22. package/dist/esm/lib/group/KeyboardKeys/styles.css +2 -1
  23. package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js +19 -4
  24. package/dist/esm/lib/hooks/useWindowFitment/readingDirection.js.map +1 -1
  25. package/dist/types/lib/_work_in_progress/Announcement/Announcement.d.ts.map +1 -0
  26. package/dist/types/lib/_work_in_progress/Announcement/index.d.ts.map +1 -0
  27. package/dist/types/lib/_work_in_progress/Announcement/types.d.ts.map +1 -0
  28. package/dist/types/lib/_work_in_progress/index.d.ts +1 -0
  29. package/dist/types/lib/_work_in_progress/index.d.ts.map +1 -1
  30. package/dist/types/lib/component/ContextualMenu/ContextualMenu.d.ts.map +1 -1
  31. package/dist/types/lib/component/KeyboardKey/KeyboardKey.d.ts.map +1 -1
  32. package/dist/types/lib/component/Tooltip/Tooltip.d.ts +1 -1
  33. package/dist/types/lib/component/Tooltip/index.d.ts +0 -1
  34. package/dist/types/lib/component/Tooltip/index.d.ts.map +1 -1
  35. package/dist/types/lib/component/Tooltip/types.d.ts +60 -0
  36. package/dist/types/lib/component/Tooltip/types.d.ts.map +1 -1
  37. package/dist/types/lib/component/Tooltip/withTooltip.d.ts +10 -12
  38. package/dist/types/lib/component/Tooltip/withTooltip.d.ts.map +1 -1
  39. package/dist/types/lib/component/index.d.ts +0 -1
  40. package/dist/types/lib/component/index.d.ts.map +1 -1
  41. package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts +12 -4
  42. package/dist/types/lib/hooks/useWindowFitment/readingDirection.d.ts.map +1 -1
  43. package/package.json +16 -16
  44. package/dist/esm/lib/component/Announcement/Announcement.js.map +0 -1
  45. package/dist/esm/lib/component/Announcement/index.js.map +0 -1
  46. package/dist/esm/lib/component/Announcement/types.js.map +0 -1
  47. package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js +0 -60
  48. package/dist/esm/lib/component/Tooltip/common/TooltipArea/TooltipArea.js.map +0 -1
  49. package/dist/esm/lib/component/Tooltip/common/TooltipArea/index.js +0 -2
  50. package/dist/esm/lib/component/Tooltip/common/TooltipArea/index.js.map +0 -1
  51. package/dist/esm/lib/component/Tooltip/common/TooltipArea/styles.css +0 -13
  52. package/dist/esm/lib/component/Tooltip/common/TooltipArea/types.js +0 -2
  53. package/dist/esm/lib/component/Tooltip/common/TooltipArea/types.js.map +0 -1
  54. package/dist/esm/lib/component/Tooltip/common/index.js +0 -2
  55. package/dist/esm/lib/component/Tooltip/common/index.js.map +0 -1
  56. package/dist/types/lib/component/Announcement/Announcement.d.ts.map +0 -1
  57. package/dist/types/lib/component/Announcement/index.d.ts.map +0 -1
  58. package/dist/types/lib/component/Announcement/types.d.ts.map +0 -1
  59. package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts +0 -10
  60. package/dist/types/lib/component/Tooltip/common/TooltipArea/TooltipArea.d.ts.map +0 -1
  61. package/dist/types/lib/component/Tooltip/common/TooltipArea/index.d.ts +0 -3
  62. package/dist/types/lib/component/Tooltip/common/TooltipArea/index.d.ts.map +0 -1
  63. package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts +0 -47
  64. package/dist/types/lib/component/Tooltip/common/TooltipArea/types.d.ts.map +0 -1
  65. package/dist/types/lib/component/Tooltip/common/index.d.ts +0 -2
  66. package/dist/types/lib/component/Tooltip/common/index.d.ts.map +0 -1
  67. /package/dist/esm/lib/{component → _work_in_progress}/Announcement/Announcement.js +0 -0
  68. /package/dist/esm/lib/{component → _work_in_progress}/Announcement/index.js +0 -0
  69. /package/dist/esm/lib/{component → _work_in_progress}/Announcement/styles.css +0 -0
  70. /package/dist/esm/lib/{component → _work_in_progress}/Announcement/types.js +0 -0
  71. /package/dist/types/lib/{component → _work_in_progress}/Announcement/Announcement.d.ts +0 -0
  72. /package/dist/types/lib/{component → _work_in_progress}/Announcement/index.d.ts +0 -0
  73. /package/dist/types/lib/{component → _work_in_progress}/Announcement/types.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Announcement.js","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/Announcement.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,WAAW,GAAG,aAAa,EAC3B,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACU,EAAsB,EAAE,CAAC,CAC3C,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,WAAW,EAAE,SAAS,CAAC;SACvD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,aAOT,eAAM,SAAS,EAAC,MAAM,iBAAa,MAAM,GAAG,EAC5C,gBAAM,SAAS,EAAC,MAAM,aACnB,OAAO,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,SAAS,YAAE,OAAO,GAAQ,EAC9D,eAAM,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAQ,IACtC,IACH,CACP,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/types.ts"],"names":[],"mappings":""}
@@ -1,4 +1,5 @@
1
1
  // Work-in-progress tier barrel: components not yet promoted to a stable tier.
2
+ export * from "./Announcement/index.js";
2
3
  export * from "./CategoriesSection/index.js";
3
4
  export * from "./ChatSection/index.js";
4
5
  export * from "./DescriptionSection/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/_work_in_progress/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/_work_in_progress/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -254,3 +254,73 @@
254
254
  var(--dimension-stroke-thickness-medium)
255
255
  );
256
256
  }
257
+
258
+ /* ── Density seat (intrinsic) — the header is a control-height row ───────────
259
+ * Inside a density scope the header takes the SHARED control seat from
260
+ * @canonical/styles (modifiers.density.css), exactly like the Button and the
261
+ * form inputs: the heading's own line box (`--control-seat-line`, the cell
262
+ * minus one baseline of headroom per side) is the header interior;
263
+ * `--seat-before` lands its baseline on the density target; `--seat-after`
264
+ * closes the row to EXACTLY the density cell (32px apps-comfortable, 24px
265
+ * apps-dense, …) with no block-size anywhere. So an accordion header, a
266
+ * button, and an input in the same cell are the same height and their text
267
+ * shares one baseline index.
268
+ *
269
+ * The header carries no border of its own — the item's DIVIDER plays that
270
+ * role, and only on the collapsed face: collapsed, the divider renders
271
+ * directly under the header, so the closing pad absorbs its thickness
272
+ * (header + divider = the cell); expanded, the divider sits after the content
273
+ * and the content's own compensation above owns it — the header keeps the full
274
+ * closing pad. This is the per-state split the pre-density compensation rules
275
+ * above apply to the legacy (non-density) look.
276
+ *
277
+ * The chevron needs no new rule: the header's `align-items: center` centres it
278
+ * on the flex line, whose cross-size IS the heading's line box — the same
279
+ * "centre on the glyph run" pairing the input affixes use.
280
+ *
281
+ * KNOWN LIMIT: an <h6> heading keeps its own engine line-height (see the
282
+ * heading rule above), so its line box may differ from --control-seat-line;
283
+ * the h6-in-header case is owned by a later pass. The default (body-tier)
284
+ * heading is exact. */
285
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item {
286
+ /* The CONTENT panel consumes the density system's semantic spacing rung for
287
+ its block padding — space-md (16px apps-comfortable, 8px apps-dense,
288
+ 20/12px sites) — instead of the fixed 1 bU, so the panel's breathing room
289
+ follows the density cell. Every rung is a whole baseline multiple, so the
290
+ rhythm holds; the [open] divider compensation reads this same token, so it
291
+ follows automatically. Outside a density scope the :root default stands. */
292
+ --accordion-item-content-padding-block: var(
293
+ --density-space-md,
294
+ var(--dimension-100)
295
+ );
296
+ }
297
+
298
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.accordion-item > .header {
299
+ /* No border above the heading inside the header, so no border term. Rounded
300
+ to ¼px for exact layout-unit representability (see the shared seat). */
301
+ --seat-before: round(nearest, max(0px, var(--control-seat-basis)), 0.25px);
302
+ --seat-after: max(
303
+ 0px,
304
+ calc(
305
+ var(--density-line-height-effective) -
306
+ var(--control-seat-line) -
307
+ var(--seat-before)
308
+ )
309
+ );
310
+ padding-block: var(--seat-before) var(--seat-after);
311
+ }
312
+ :is(.comfortable, .dense, .app, .site, .docs)
313
+ .ds.accordion-item:not([open])
314
+ > .header {
315
+ /* Collapsed: absorb the item divider below, keeping header + divider = cell. */
316
+ padding-block-end: max(
317
+ 0px,
318
+ calc(var(--seat-after) - var(--dimension-stroke-thickness-medium))
319
+ );
320
+ }
321
+ :is(.comfortable, .dense, .app, .site, .docs)
322
+ .ds.accordion-item
323
+ > .header
324
+ > .heading {
325
+ line-height: var(--control-seat-line);
326
+ }
@@ -76,11 +76,20 @@
76
76
 
77
77
  color: var(--modifier-color-text, var(--button-color-text));
78
78
  background-color: var(--modifier-surface, var(--button-color-background));
79
- border-color: var(--modifier-color-border, var(--button-color-border));
79
+ /* The outline flag (0/1) toggles the border's COLOUR, not its width: the
80
+ border is ALWAYS present at the nominal width (transparent when hidden), so
81
+ a bordered and a borderless importance share byte-identical geometry and
82
+ the density seat below subtracts one constant. (The previous
83
+ width-multiplied toggle left the primary 2px shorter than the secondary
84
+ and seated its label ~1px high.) */
85
+ border-color: color-mix(
86
+ in srgb,
87
+ var(--modifier-color-border, var(--button-color-border))
88
+ calc(var(--modifier-outline, 0) * 100%),
89
+ transparent
90
+ );
80
91
  border-style: solid;
81
- /* The outline flag (0/1) toggles the border on: multiplying the width means
82
- a borderless importance simply resolves to 0 with no separate rule. */
83
- border-width: calc(var(--modifier-outline, 0) * var(--button-border-width));
92
+ border-width: var(--button-border-width);
84
93
 
85
94
  /* Label typography tokens (text-secondary tier, 14px). The block placement that
86
95
  lands the label on the baseline grid comes from the density seat at the end of
@@ -231,48 +240,55 @@
231
240
  }
232
241
  }
233
242
 
234
- /* ── Density seat (apps 32 / sites 36, dense 24 / 28) ────────────────────────
235
- * The button consumes the density primitives from @canonical/styles (context ×
236
- * density on an ancestor) to size its box to the cell and seat its label on the
237
- * 4px baseline grid. This lives HERE (ds-global) and not in
238
- * @canonical/react-ds-global-form's density.css, because the Button is a ds-global
239
- * component: an app that ships ds-global without the form package must still get a
240
- * seated button, not a flat one. The primitives are read from the shared styles
241
- * layer, so there is no form dependency.
243
+ /* ── Density seat (apps 32 / sites 36, dense 24 / 28) — intrinsic ────────────
244
+ * The button consumes the SHARED control seat from @canonical/styles
245
+ * (modifiers.density.css): the label's own line box (cell − 2 baselines) is the
246
+ * button interior, `--control-seat-before` puts its baseline on the density
247
+ * target, `--control-seat-after` closes the box to EXACTLY the density cell.
248
+ * The height is INTRINSIC — no block-size: border + pads + line-height add up
249
+ * to the cell, and both outer edges land on grid lines.
250
+ *
251
+ * This lives HERE (ds-global) and not in ds-global-form's density.css, because
252
+ * the Button is a ds-global component: an app that ships ds-global without the
253
+ * form package must still get a seated button. The seat vars come from the
254
+ * shared styles layer, so there is no form dependency.
255
+ *
256
+ * The seat subtracts the NOMINAL --button-border-width for BOTH importances —
257
+ * the border is constant width and transparent when not shown (the
258
+ * --modifier-outline pattern), so a bordered and a borderless button share one
259
+ * geometry; no per-importance branch.
242
260
  *
243
- * `:is()` on the density scope (0,1,0) so `:is(...) .ds.button` (0,2,0) beats the
244
- * button's own `.ds.button { align-items: center }` (0,1,0) — otherwise the label
245
- * stays flex-CENTRED and the padding-based baseline placement can't govern. */
261
+ * `:is()` on the density scope (0,1,0) so `:is(...) .ds.button` (0,2,0) beats
262
+ * the button's own `.ds.button { align-items: center }` (0,1,0) — otherwise the
263
+ * label stays flex-CENTRED and the padding-based seat can't govern. */
246
264
  :is(.comfortable, .dense, .app, .site, .docs) .ds.button {
247
- box-sizing: border-box;
248
- /* Fixed grid-multiple height (the density cell), border-box so the border is
249
- absorbed into the height — a bordered and a borderless button of one density
250
- are the same height. Top-referenced so the space-before below governs. */
251
- block-size: var(--density-line-height-effective);
252
- min-block-size: var(--density-line-height-effective);
253
- align-items: flex-start;
254
- justify-content: flex-start;
255
- /* Kill only the UA bottom padding; the placement below owns padding-block-start
256
- (a `padding-block: 0` shorthand would out-specify and wipe the start). */
257
- padding-block-end: 0;
258
-
259
- /* Crush to line-height:1 for the seat; the baseline within that box is the cap
260
- approximation (1em + 1cap)/2. The label font tier (--font-size/--font-family)
261
- is the button's own (text-secondary, 14px), set on the base rule. */
262
- line-height: 1;
263
- --natural-baseline: calc((1em + 1cap) / 2);
264
- /* The box's top border sits above the label and counts toward the target, so
265
- subtract the NOMINAL --button-border-width for BOTH importances — the primary's
266
- 0-outline (borderless) is handled by the grid maths, not by zeroing this term
267
- (a per-importance term lifts the primary a pixel; regression, reverted). */
268
- --border-top-width: var(--button-border-width, 0px);
269
- --space-before: max(
265
+ /* Fold the button's own border into the shared basis HERE (a var() inside a
266
+ custom property substitutes at its declaring element, so the shared layer
267
+ cannot read this border). `1cap` in the basis resolves against the button's
268
+ own label font. */
269
+ /* Rounded to ¼px so the pad is exactly representable in the browser's 1/64px
270
+ layout units — the fractional 1cap term otherwise leaves ~1/60px residues
271
+ on the box height. */
272
+ --seat-before: round(
273
+ nearest,
274
+ max(0px, calc(var(--control-seat-basis) - var(--button-border-width, 0px))),
275
+ 0.25px
276
+ );
277
+ --seat-after: max(
270
278
  0px,
271
279
  calc(
272
- var(--density-target-baseline-px, 0px) -
273
- var(--natural-baseline) -
274
- var(--border-top-width, 0px)
280
+ var(--density-line-height-effective) -
281
+ var(--control-seat-line) -
282
+ var(--seat-before) -
283
+ 2 *
284
+ var(--button-border-width, 0px)
275
285
  )
276
286
  );
277
- padding-block-start: var(--space-before);
287
+
288
+ box-sizing: border-box;
289
+ block-size: auto;
290
+ align-items: flex-start;
291
+ justify-content: flex-start;
292
+ line-height: var(--control-seat-line);
293
+ padding-block: var(--seat-before) var(--seat-after);
278
294
  }
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getItemId } from "@canonical/utils";
3
3
  import { useMemo } from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { MENU_PLACEMENT, useContextualMenu, useIsMounted, } from "../../hooks/index.js";
5
+ import { MENU_ROOT_PLACEMENT, useContextualMenu, useIsMounted, } from "../../hooks/index.js";
6
6
  import MenuContext from "./common/MenuContext.js";
7
7
  import SubMenu from "./common/SubMenu/index.js";
8
8
  import "./styles.css";
@@ -29,10 +29,11 @@ const ContextualMenu = ({ trigger, groups, label, className, preferredDirections
29
29
  const menu = useContextualMenu({
30
30
  root,
31
31
  isOpen: open,
32
- // Open toward the trigger's leading edge, top-aligned, flipping side/
33
- // alignment as space runs out. MENU_PLACEMENT is logical (inline-*), so the
34
- // hook mirrors it in RTL automatically — no direction read here.
35
- preferredDirections: preferredDirections ?? MENU_PLACEMENT,
32
+ // Open BELOW the trigger, leading-aligned, flipping above then to the side
33
+ // as space runs out (design review). MENU_ROOT_PLACEMENT is logical, so the
34
+ // hook mirrors alignment in RTL automatically — no direction read here.
35
+ // (Submenus keep the side-opening MENU_PLACEMENT — see SubMenu.)
36
+ preferredDirections: preferredDirections ?? MENU_ROOT_PLACEMENT,
36
37
  distance,
37
38
  gutter,
38
39
  maxWidth,
@@ -1 +1 @@
1
- {"version":3,"file":"ContextualMenu.js","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/ContextualMenu.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,OAAO,MAAM,2BAA2B,CAAC;AAEhD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,CAAC,EACtB,OAAO,EACP,MAAM,EACN,KAAK,EACL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,GAAG,KAAK,EACY,EAAsB,EAAE;IAC5C,0EAA0E;IAC1E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,IAAI,GAAG,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EACtD,CAAC,MAAM,CAAC,CACT,CAAC;IACF,wEAAwE;IACxE,4EAA4E;IAC5E,qEAAqE;IACrE,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,iBAAiB,CAAC;QAC7B,IAAI;QACJ,MAAM,EAAE,IAAI;QACZ,sEAAsE;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CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ContextualMenu.js","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/ContextualMenu.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,OAAO,MAAM,2BAA2B,CAAC;AAEhD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,CAAC,EACtB,OAAO,EACP,MAAM,EACN,KAAK,EACL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,GAAG,KAAK,EACY,EAAsB,EAAE;IAC5C,0EAA0E;IAC1E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,IAAI,GAAG,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EACtD,CAAC,MAAM,CAAC,CACT,CAAC;IACF,wEAAwE;IACxE,4EAA4E;IAC5E,qEAAqE;IACrE,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,iBAAiB,CAAC;QAC7B,IAAI;QACJ,MAAM,EAAE,IAAI;QACZ,2EAA2E;QAC3E,4EAA4E;QAC5E,wEAAwE;QACxE,iEAAiE;QACjE,mBAAmB,EAAE,mBAAmB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
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ARIA_LABELS, KEY_LABELS } from "./constants.js";
3
3
  import "./styles.css";
4
- const componentCssClassName = "ds keyboard-key";
4
+ // The key establishes its own `.surface`, so it consumes a full surface step
5
+ // rather than hard-wiring a layer: nested inside an ambient surface it picks up
6
+ // the next layer's ghost fill (surface+1, "like inputs"), and it composes
7
+ // correctly at any depth instead of being pinned to layer2.
8
+ const componentCssClassName = "ds keyboard-key surface";
5
9
  /**
6
10
  * The KeyboardKey component renders a single keyboard key as a styled
7
11
  * kbd element. It maps a key identifier (letters, digits, modifiers,
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardKey.js","sourceRoot":"","sources":["../../../../../src/lib/component/KeyboardKey/KeyboardKey.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACS,EAAsB,EAAE,CAAC,CAC1C,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,MAAM,EAAE,SAAS,CAAC;SAClD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,gBACA,WAAW,CAAC,QAAQ,CAAC,KAC7B,KAAK,YAER,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAC7B,CACP,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"KeyboardKey.js","sourceRoot":"","sources":["../../../../../src/lib/component/KeyboardKey/KeyboardKey.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,gFAAgF;AAChF,0EAA0E;AAC1E,4DAA4D;AAC5D,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACS,EAAsB,EAAE,CAAC,CAC1C,cACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,MAAM,EAAE,SAAS,CAAC;SAClD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,gBACA,WAAW,CAAC,QAAQ,CAAC,KAC7B,KAAK,YAER,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAC7B,CACP,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,10 +1,18 @@
1
1
  :root {
2
- --keyboard-key-color-background: var(--color-background);
3
- --keyboard-key-color-text: var(--color-text-muted);
4
- --keyboard-key-color-border: var(--color-text-muted);
2
+ /* Static (surface-independent) chrome tokens only. The COLOUR reads that
3
+ depend on the surface stack are NOT declared here — a custom property set at
4
+ `:root` resolves its `var(--surface-color-*)` immediately at `:root`, where
5
+ there is no `.surface` ancestor, so it would freeze to layer1 and the
6
+ surface stepping would never happen. Those reads live on `.ds.keyboard-key`
7
+ below, where the key's own `.surface` scope is in effect. */
8
+ --keyboard-key-color-border: var(--color-border-muted);
5
9
 
10
+ /* Figma corner radius is 2px, but that token is not yet validated / does not
11
+ exist — the spec note says "maybe 0 for now", so this stays on radius-small
12
+ (currently 0). Revisit once a 2px radius token lands. */
6
13
  --keyboard-key-border-radius: var(--dimension-radius-small);
7
14
  --keyboard-key-border-width: var(--dimension-stroke-thickness-medium);
15
+ /* 4px inline padding (Figma: 4px left/right). */
8
16
  --keyboard-key-padding-inline: var(--dimension-050);
9
17
  }
10
18
 
@@ -17,8 +25,18 @@
17
25
  .ds.keyboard-key {
18
26
  display: inline-block;
19
27
 
20
- color: var(--keyboard-key-color-text);
21
- background-color: var(--keyboard-key-color-background);
28
+ /* Figma (26.10 Keyboard Key, node 6004-72): a key-cap sits on a surface+1 fill
29
+ "like an input", with a muted border and the surface's text colour.
30
+
31
+ The key establishes its own `.surface` (see KeyboardKey.tsx), so it IS the
32
+ next surface layer and paints ITSELF with that layer's background — exactly
33
+ like the Tile. These reads MUST be here on the class (not `:root`) so
34
+ `--surface-color-*` resolves against the key's own surface depth: nested in
35
+ the ambient surface the background steps to the next layer (the "surface+1,
36
+ like inputs" the spec asks for), and on a `.contrasted` surface it inverts
37
+ for free. The fallbacks keep it sane when placed outside any surface. */
38
+ background-color: var(--surface-color-background, var(--color-background));
39
+ color: var(--surface-color-text, var(--color-text));
22
40
 
23
41
  border-style: solid;
24
42
  border-width: var(--keyboard-key-border-width);
@@ -15,6 +15,8 @@
15
15
  --tabs-tab-padding-inline: var(--space-200); /* 16px */
16
16
  /* 5bU = 40px tab height on the 8px baseline grid. */
17
17
  --tabs-tab-min-block-size: calc(var(--baseline-height) * 5);
18
+ --tabs-tab-focus-ring-width: var(--dimension-strokeThickness-large, 2px);
19
+ --tabs-tab-focus-ring-color: var(--color-focusRing);
18
20
  }
19
21
 
20
22
  .ds.tabs-item {
@@ -38,6 +40,16 @@
38
40
  /* Transparent underline reserved so the row never shifts when a border
39
41
  appears on hover/active. */
40
42
  border-bottom: var(--tabs-tab-border-width) solid transparent;
43
+
44
+ /* Keyboard focus: a design-system focus ring (design review) instead of the
45
+ UA default outline. Inset offset so the ring hugs the tab and the row's
46
+ `overflow` never clips it; :focus-visible only, so pointer clicks stay
47
+ quiet. */
48
+ &:focus-visible {
49
+ outline: var(--tabs-tab-focus-ring-width) solid
50
+ var(--tabs-tab-focus-ring-color);
51
+ outline-offset: calc(-1 * var(--tabs-tab-focus-ring-width));
52
+ }
41
53
  }
42
54
 
43
55
  /* Hover: a muted bottom border hints the tab is navigable, and settles faster
@@ -6,7 +6,7 @@ const componentCssClassName = "ds tooltip contrasted";
6
6
  /**
7
7
  * The Tooltip component renders the message part of a tooltip. It has no
8
8
  * interactivity or positioning logic and is generally consumed via
9
- * TooltipArea or the withTooltip HOC.
9
+ * the withTooltip HOC.
10
10
  *
11
11
  * @implements ds:global.component.tooltip
12
12
  */
@@ -1,4 +1,3 @@
1
- export * from "./common/index.js";
2
1
  export { default as Tooltip } from "./Tooltip.js";
3
2
  export { default as withTooltip } from "./withTooltip.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,3 +1,20 @@
1
+ /* The tooltip engine wrapper (rendered by `withTooltip`) — a relatively
2
+ positioned inline span around the target. The `.target` child carries the
3
+ measuring ref and strips margins from its content so placement is exact. */
4
+ .ds.tooltip-area {
5
+ position: relative;
6
+ & .target {
7
+ cursor: pointer;
8
+ position: relative;
9
+ display: inline-block;
10
+
11
+ & > * {
12
+ /* biome-ignore lint/complexity/noImportantStyles: The tooltip targets must have no margin in order for tooltip placements to work correctly */
13
+ margin: 0 !important;
14
+ }
15
+ }
16
+ }
17
+
1
18
  /* Component tokens — sourced from @canonical/design-tokens.
2
19
  The tooltip runs on the `contrasted` surface so its colours invert against
3
20
  the ambient theme (dark chip on a light UI, light chip on a dark UI). The
@@ -1,14 +1,77 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { TooltipArea } from "./common/TooltipArea/index.js";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createPortal } from "react-dom";
3
+ import { useDisclosure, useIsMounted } from "../../hooks/index.js";
4
+ import Tooltip from "./Tooltip.js";
5
+ import "./styles.css";
6
+ const componentCssClassName = "ds tooltip-area";
3
7
  /**
4
- * A higher-order component that wraps a component with a tooltip.
5
- * @param Component The component function to wrap. If you need to use a Node instead of a function, use [`TooltipArea`](/?path=/docs/tooltip-withtooltip--docs) instead.
6
- * @param Message The content of the tooltip
7
- * @param popupProps Tooltip options forwarded to the underlying `TooltipArea`
8
+ * The tooltip engine: wraps a target element with a hover/focus tooltip. It
9
+ * drives {@link useDisclosure} in `hover` mode, portals the message to the
10
+ * client only, positions it against the target span, and points the arrow. This
11
+ * is the shared implementation that {@link withTooltip} builds on — it renders
12
+ * the wrapped component as its `children` target.
13
+ */
14
+ const TooltipEngine = ({ children, style, className, Message, icon, open, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
15
+ const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
16
+ // `open` is the public alias for the hook's controlled `isOpen`; when set it
17
+ // overrides hover/focus so the tooltip stays in the given state.
18
+ } = useDisclosure({
19
+ distance,
20
+ autoFit,
21
+ ...props,
22
+ isOpen: open ?? props.isOpen,
23
+ mode: "hover",
24
+ });
25
+ const triggerProps = getToggleProps();
26
+ const contentProps = getContentProps();
27
+ // The message is portalled to the client only. Rendering it on the server (or
28
+ // on the first client render) would differ from the post-mount portal output
29
+ // and force a hydration mismatch + full re-mount — which resets the fitment
30
+ // refs to null and re-triggers the unpositioned first frame. Deferring to a
31
+ // mounted gate makes the server and first client render identical (nothing
32
+ // at the call site); the tooltip mounts once, cleanly, after hydration.
33
+ const mounted = useIsMounted();
34
+ // The always-on arrow offset keeps the arrow pointing at the target centre
35
+ // for every placement, not only when auto-fit clamps.
36
+ const arrowStyle = arrowOffset
37
+ ? {
38
+ [arrowOffset.axis === "x"
39
+ ? "--tooltip-arrow-offset-left"
40
+ : "--tooltip-arrow-offset-top"]: `${arrowOffset.offset}px`,
41
+ }
42
+ : {};
43
+ const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [bestPosition?.positionName, messageElementClassName]
44
+ .filter(Boolean)
45
+ .join(" "), icon: icon, onPointerEnter: contentProps.onPointerEnter, ref: popupRef, style: {
46
+ ...messageElementStyle,
47
+ ...popupPositionStyle,
48
+ ...arrowStyle,
49
+ },
50
+ // Reveal only once a position has been resolved. Until `bestPosition`
51
+ // exists the popup would render at the fallback top:0/left:0 with no
52
+ // placement class (and so no arrow); gating the reveal on it means that
53
+ // unpositioned frame stays `visibility:hidden` and never paints — no
54
+ // visible 0,0 flash, and the open fade always runs from an anchored spot.
55
+ isOpen: isOpen && Boolean(bestPosition), children: Message }));
56
+ return (
57
+ // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper forwards pointer/focus to the tooltip trigger
58
+ _jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus: triggerProps.onFocus, onBlur: triggerProps.onBlur, onPointerEnter: triggerProps.onPointerEnter, onPointerLeave: triggerProps.onPointerLeave, children: [_jsx("span", { id: targetElementId, style: targetElementStyle, className: ["target", targetElementClassName].filter(Boolean).join(" "), ref: targetRef, "aria-describedby": popupId, children: children }), mounted
59
+ ? createPortal(TooltipMessageElement, parentElement || document.body)
60
+ : null] }));
61
+ };
62
+ /**
63
+ * A higher-order component that wraps a component with a tooltip. It is the
64
+ * single public tooltip primitive: it owns the engine (hover-mode
65
+ * {@link useDisclosure}, client-only portal, arrow positioning) and renders the
66
+ * wrapped component as the tooltip target.
67
+ * @param Component The component type to wrap.
68
+ * @param Message The content of the tooltip.
69
+ * @param popupProps Tooltip options — positioning, sizing, timing, plus `open`,
70
+ * `icon`, `distance`, `autoFit`, `messageElementStyle`, etc.
8
71
  */
9
72
  const withTooltip = (Component, Message, popupProps = {}) => {
10
73
  const WrappedComponent = (props) => {
11
- return (_jsx(TooltipArea, { Message: Message, ...popupProps, children: _jsx(Component, { ...props }) }));
74
+ return (_jsx(TooltipEngine, { Message: Message, ...popupProps, children: _jsx(Component, { ...props }) }));
12
75
  };
13
76
  // Set the displayName for easier debugging
14
77
  WrappedComponent.displayName = `withTooltip(${Component.displayName || Component.name || "Component"})`;
@@ -1 +1 @@
1
- {"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAW5D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAClB,SAAgC,EAChC,OAAkB,EAClB,aAAiC,EAAE,EACvB,EAAE;IACd,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAwB,EAAE;QAC/D,OAAO,CACL,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,KAAM,UAAU,YAC3C,KAAC,SAAS,OAAK,KAAK,GAAI,GACZ,CACf,CAAC;IACJ,CAAC,CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,eAC7B,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAC7C,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"withTooltip.js","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,EACrB,QAAQ,EACR,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CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,eAC7B,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAC7C,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +1,5 @@
1
1
  // ds:Component tier barrel: the standalone global components.
2
2
  export * from "./Accordion/index.js";
3
- export * from "./Announcement/index.js";
4
3
  export * from "./Badge/index.js";
5
4
  export * from "./Breadcrumbs/index.js";
6
5
  export * from "./Button/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  :root {
2
- --keyboard-keys-gap: var(--dimension-050);
2
+ /* Figma (node 6004-72): 2px between adjacent keys in a chord. */
3
+ --keyboard-keys-gap: var(--dimension-025);
3
4
  --keyboard-keys-margin-inline: var(--dimension-050);
4
5
  }
5
6
 
@@ -1,8 +1,23 @@
1
1
  /**
2
- * Contextual-menu placements: open toward the trigger's reading-flow (leading)
3
- * edge, top-aligned, flipping alignment then side as space runs out. Logical, so
4
- * it mirrors automatically — resolves to the historical right-start/… order in
5
- * LTR and left-start/… in RTL.
2
+ * ROOT contextual-menu placements: open BELOW the trigger, leading-aligned
3
+ * (design review), flipping to above then to the side as space runs out.
4
+ * Logical, so alignment mirrors automatically (leading = left in LTR, right in
5
+ * RTL). Used by the top-level menu opened from a trigger.
6
+ */
7
+ export const MENU_ROOT_PLACEMENT = [
8
+ { side: "block-end", align: "start" }, // below, leading-aligned (default)
9
+ { side: "block-end", align: "end" }, // horizontal overflow → trailing-aligned
10
+ { side: "block-start", align: "start" }, // vertical overflow → flip above
11
+ { side: "block-start", align: "end" },
12
+ { side: "inline-end", align: "start" }, // no room above/below → to the side
13
+ { side: "inline-start", align: "start" },
14
+ ];
15
+ /**
16
+ * SUBMENU (nested) placements: expand toward the trigger's reading-flow
17
+ * (leading) edge, top-aligned, flipping alignment then side as space runs out —
18
+ * standard cascade behaviour, a submenu opens beside its parent item, not below
19
+ * it. Logical, so it mirrors automatically (right-start… in LTR, left-start… in
20
+ * RTL).
6
21
  */
7
22
  export const MENU_PLACEMENT = [
8
23
  { side: "inline-end", align: "start" }, // right-start LTR / left-start RTL
@@ -1 +1 @@
1
- {"version":3,"file":"readingDirection.js","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/readingDirection.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM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EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mCAAmC;IAC3E,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,uCAAuC;IAC7E,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,kCAAkC;IAC5E,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE;IACtC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,6BAA6B;IACrE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,aAAa;CACxD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAwB;IACpD,YAAY;IACZ,WAAW;IACX,cAAc;IACd,aAAa;CACd,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Announcement.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/Announcement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,GAAI,yDAMnB,iBAAiB,KAAG,KAAK,CAAC,YAkB5B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_work_in_progress/Announcement/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAE5C,0DAA0D;IAC1D,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAC;IAEpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1,3 +1,4 @@
1
+ export * from "./Announcement/index.js";
1
2
  export * from "./CategoriesSection/index.js";
2
3
  export * from "./ChatSection/index.js";
3
4
  export * from "./DescriptionSection/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/_work_in_progress/index.ts"],"names":[],"mappings":"AACA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/_work_in_progress/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextualMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/ContextualMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,YAAY,CAAC;AAChE,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,cAAc,GAAI,+IAerB,mBAAmB,KAAG,KAAK,CAAC,YAqJ9B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ContextualMenu.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/ContextualMenu/ContextualMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,YAAY,CAAC;AAChE,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,cAAc,GAAI,+IAerB,mBAAmB,KAAG,KAAK,CAAC,YAsJ9B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardKey.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/KeyboardKey/KeyboardKey.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,WAAW,GAAI,mCAIlB,gBAAgB,KAAG,KAAK,CAAC,YAU3B,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"KeyboardKey.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/KeyboardKey/KeyboardKey.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,cAAc,CAAC;AAQtB;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,WAAW,GAAI,mCAIlB,gBAAgB,KAAG,KAAK,CAAC,YAU3B,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -4,7 +4,7 @@ import type { TooltipProps } from "./types.js";
4
4
  /**
5
5
  * The Tooltip component renders the message part of a tooltip. It has no
6
6
  * interactivity or positioning logic and is generally consumed via
7
- * TooltipArea or the withTooltip HOC.
7
+ * the withTooltip HOC.
8
8
  *
9
9
  * @implements ds:global.component.tooltip
10
10
  */
@@ -1,4 +1,3 @@
1
- export * from "./common/index.js";
2
1
  export { default as Tooltip } from "./Tooltip.js";
3
2
  export type * from "./types.js";
4
3
  export { default as withTooltip } from "./withTooltip.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,64 @@
1
1
  import type { CSSProperties, FocusEventHandler, PointerEventHandler, ReactNode, RefObject } from "react";
2
+ import type { UseDisclosureProps } from "../../hooks/index.js";
3
+ /**
4
+ * The full option surface of the tooltip engine that `withTooltip` owns:
5
+ * everything the wrapped component's tooltip accepts, including the target
6
+ * `children` and the `Message`. Consumers use {@link WithTooltipOptions}
7
+ * (this minus `children`/`Message`); this internal shape exists so the engine
8
+ * and the HOC share one prop definition.
9
+ */
10
+ export interface TooltipEngineProps extends Omit<UseDisclosureProps, "mode"> {
11
+ /**
12
+ * The target element to which the tooltip should be attached.
13
+ * This can be any valid React element.
14
+ */
15
+ children: ReactNode;
16
+ /**
17
+ * The content of the tooltip. This can be a string or any valid React node.
18
+ */
19
+ Message: ReactNode;
20
+ /**
21
+ * An optional leading icon for the tooltip, rendered before the message
22
+ * (Figma: 16px glyph, dimension-100 gap). Purely decorative.
23
+ */
24
+ icon?: ReactNode;
25
+ /**
26
+ * Force the tooltip open (or closed), overriding hover/focus. When a boolean
27
+ * is passed the tooltip is fully controlled and ignores pointer/keyboard —
28
+ * useful for stories, visual tests, or driving the tooltip from outside.
29
+ * Leave undefined for the default hover behaviour.
30
+ */
31
+ open?: boolean;
32
+ /** Styles applied to the tooltip area */
33
+ style?: CSSProperties;
34
+ /** Class name applied to the tooltip area */
35
+ className?: string;
36
+ /** ID applied to the target element */
37
+ targetElementId?: string;
38
+ /** Class name applied to the target element */
39
+ targetElementClassName?: string;
40
+ /** Style object applied to the target element */
41
+ targetElementStyle?: CSSProperties;
42
+ /** Class name applied to the tooltip/message element */
43
+ messageElementClassName?: string;
44
+ /** Styles applied to the tooltip/message element */
45
+ messageElementStyle?: CSSProperties;
46
+ /**
47
+ * The element to which the tooltip should be attached.
48
+ * This can be any valid React element.
49
+ * When not provided, the tooltip will be attached to the `document.body`.
50
+ * No default is provided at the engine signature level in order to prevent the component from failing builds in server environments, where `document` is not available.
51
+ */
52
+ parentElement?: HTMLElement;
53
+ }
54
+ /**
55
+ * The tooltip options for {@link withTooltip}: everything the tooltip engine
56
+ * accepts except the wrapped content and the message (which are supplied
57
+ * separately). Includes `open` (force the tooltip open/closed — handy for
58
+ * stories), `icon`, `preferredDirections`, `distance`, `autoFit`, `maxWidth`,
59
+ * timing, etc.
60
+ */
61
+ export type WithTooltipOptions = Omit<TooltipEngineProps, "children" | "Message">;
2
62
  export interface TooltipProps {
3
63
  id?: string;
4
64
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAE3B,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvC,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC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import type { ComponentType, FC, ReactNode } from "react";
2
- import type { TooltipAreaProps } from "./common/TooltipArea/types.js";
2
+ import type { WithTooltipOptions } from "./types.js";
3
+ import "./styles.css";
3
4
  /**
4
- * The tooltip options for {@link withTooltip}: everything `TooltipArea` accepts
5
- * except the wrapped content and the message (which are supplied separately).
6
- * Includes `open` (force the tooltip open/closed — handy for stories), `icon`,
7
- * `preferredDirections`, `distance`, `autoFit`, `maxWidth`, timing, etc.
8
- */
9
- export type WithTooltipOptions = Omit<TooltipAreaProps, "children" | "Message">;
10
- /**
11
- * A higher-order component that wraps a component with a tooltip.
12
- * @param Component The component function to wrap. If you need to use a Node instead of a function, use [`TooltipArea`](/?path=/docs/tooltip-withtooltip--docs) instead.
13
- * @param Message The content of the tooltip
14
- * @param popupProps Tooltip options forwarded to the underlying `TooltipArea`
5
+ * A higher-order component that wraps a component with a tooltip. It is the
6
+ * single public tooltip primitive: it owns the engine (hover-mode
7
+ * {@link useDisclosure}, client-only portal, arrow positioning) and renders the
8
+ * wrapped component as the tooltip target.
9
+ * @param Component The component type to wrap.
10
+ * @param Message The content of the tooltip.
11
+ * @param popupProps Tooltip options — positioning, sizing, timing, plus `open`,
12
+ * `icon`, `distance`, `autoFit`, `messageElementStyle`, etc.
15
13
  */
16
14
  declare const withTooltip: <TProps extends object>(Component: ComponentType<TProps>, Message: ReactNode, popupProps?: WithTooltipOptions) => FC<TProps>;
17
15
  export default withTooltip;
@@ -1 +1 @@
1
- {"version":3,"file":"withTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,SAAS,MAAM,EACxC,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,SAAS,EAClB,aAAY,kBAAuB,KAClC,EAAE,CAAC,MAAM,CAeX,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"withTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Tooltip/withTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,EAAE,EAEF,SAAS,EACV,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,cAAc,CAAC;AA6HtB;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,SAAS,MAAM,EACxC,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,SAAS,EAClB,aAAY,kBAAuB,KAClC,EAAE,CAAC,MAAM,CAeX,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export * from "./Accordion/index.js";
2
- export * from "./Announcement/index.js";
3
2
  export * from "./Badge/index.js";
4
3
  export * from "./Breadcrumbs/index.js";
5
4
  export * from "./Button/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/component/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -1,9 +1,17 @@
1
1
  import type { WindowFitmentPlacement, WindowFitmentSide } from "./types.js";
2
2
  /**
3
- * Contextual-menu placements: open toward the trigger's reading-flow (leading)
4
- * edge, top-aligned, flipping alignment then side as space runs out. Logical, so
5
- * it mirrors automatically — resolves to the historical right-start/… order in
6
- * LTR and left-start/… in RTL.
3
+ * ROOT contextual-menu placements: open BELOW the trigger, leading-aligned
4
+ * (design review), flipping to above then to the side as space runs out.
5
+ * Logical, so alignment mirrors automatically (leading = left in LTR, right in
6
+ * RTL). Used by the top-level menu opened from a trigger.
7
+ */
8
+ export declare const MENU_ROOT_PLACEMENT: WindowFitmentPlacement[];
9
+ /**
10
+ * SUBMENU (nested) placements: expand toward the trigger's reading-flow
11
+ * (leading) edge, top-aligned, flipping alignment then side as space runs out —
12
+ * standard cascade behaviour, a submenu opens beside its parent item, not below
13
+ * it. Logical, so it mirrors automatically (right-start… in LTR, left-start… in
14
+ * RTL).
7
15
  */
8
16
  export declare const MENU_PLACEMENT: WindowFitmentPlacement[];
9
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"readingDirection.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/readingDirection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,sBAAsB,EAOlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,EAKhD,CAAC"}
1
+ {"version":3,"file":"readingDirection.d.ts","sourceRoot":"","sources":["../../../../../src/lib/hooks/useWindowFitment/readingDirection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,sBAAsB,EAOvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,sBAAsB,EAOlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,EAKhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-ds-global",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -43,25 +43,25 @@
43
43
  "test:vitest:watch": "vitest"
44
44
  },
45
45
  "dependencies": {
46
- "@canonical/design-tokens": "0.6.2-contrasted.0",
47
- "@canonical/ds-assets": "^0.31.0",
48
- "@canonical/react-hooks": "^0.31.0",
49
- "@canonical/storybook-config": "^0.31.0",
50
- "@canonical/styles": "^0.31.0",
51
- "@canonical/utils": "^0.31.0",
46
+ "@canonical/design-tokens": "0.8.1",
47
+ "@canonical/ds-assets": "^0.33.0",
48
+ "@canonical/react-hooks": "^0.33.0",
49
+ "@canonical/storybook-config": "^0.33.0",
50
+ "@canonical/styles": "^0.33.0",
51
+ "@canonical/utils": "^0.33.0",
52
52
  "react": "^19.2.4",
53
53
  "react-dom": "^19.2.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@biomejs/biome": "2.4.9",
57
- "@canonical/biome-config": "^0.31.0",
58
- "@canonical/ds-types": "^0.31.0",
59
- "@canonical/router-core": "^0.31.0",
60
- "@canonical/router-react": "^0.31.0",
61
- "@canonical/storybook-helpers": "^0.31.0",
62
- "@canonical/typescript-config-react": "^0.31.0",
63
- "@canonical/vitest-config-react": "^0.31.0",
64
- "@canonical/webarchitect": "^0.31.0",
57
+ "@canonical/biome-config": "^0.33.0",
58
+ "@canonical/ds-types": "^0.33.0",
59
+ "@canonical/router-core": "^0.33.0",
60
+ "@canonical/router-react": "^0.33.0",
61
+ "@canonical/storybook-helpers": "^0.33.0",
62
+ "@canonical/typescript-config-react": "^0.33.0",
63
+ "@canonical/vitest-config-react": "^0.33.0",
64
+ "@canonical/webarchitect": "^0.33.0",
65
65
  "@chromatic-com/storybook": "^5.0.1",
66
66
  "@storybook/addon-docs": "^10.3.1",
67
67
  "@storybook/react-vite": "^10.3.1",
@@ -79,5 +79,5 @@
79
79
  "vite": "^8.0.1",
80
80
  "vitest": "^4.0.18"
81
81
  },
82
- "gitHead": "d4a67ebe42e62b8cf3de77f42f537309ca88d672"
82
+ "gitHead": "fca2bc4440fff2d511fc8db6686f9b19222fdbc7"
83
83
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Announcement.js","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/Announcement.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,WAAW,GAAG,aAAa,EAC3B,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACU,EAAsB,EAAE,CAAC,CAC3C,eACE,SAAS,EAAE,CAAC,qBAAqB,EAAE,WAAW,EAAE,SAAS,CAAC;SACvD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,aAOT,eAAM,SAAS,EAAC,MAAM,iBAAa,MAAM,GAAG,EAC5C,gBAAM,SAAS,EAAC,MAAM,aACnB,OAAO,IAAI,IAAI,IAAI,eAAM,SAAS,EAAC,SAAS,YAAE,OAAO,GAAQ,EAC9D,eAAM,SAAS,EAAC,SAAS,YAAE,QAAQ,GAAQ,IACtC,IACH,CACP,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/types.ts"],"names":[],"mappings":""}
@@ -1,60 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createPortal } from "react-dom";
3
- import { useDisclosure, useIsMounted } from "../../../../hooks/index.js";
4
- import { Tooltip } from "../../index.js";
5
- import "./styles.css";
6
- const componentCssClassName = "ds tooltip-area";
7
- /**
8
- * Wraps a target element with a tooltip.
9
- * This component allows you to attach a tooltip to any JSX fragment.
10
- */
11
- const TooltipArea = ({ children, style, className, Message, icon, open, distance = "6px", targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }) => {
12
- const { targetRef, popupRef, popupPositionStyle, popupId, isOpen, bestPosition, arrowOffset, getToggleProps, getContentProps,
13
- // `open` is the public alias for the hook's controlled `isOpen`; when set it
14
- // overrides hover/focus so the tooltip stays in the given state.
15
- } = useDisclosure({
16
- distance,
17
- autoFit,
18
- ...props,
19
- isOpen: open ?? props.isOpen,
20
- mode: "hover",
21
- });
22
- const triggerProps = getToggleProps();
23
- const contentProps = getContentProps();
24
- // The message is portalled to the client only. Rendering it on the server (or
25
- // on the first client render) would differ from the post-mount portal output
26
- // and force a hydration mismatch + full re-mount — which resets the fitment
27
- // refs to null and re-triggers the unpositioned first frame. Deferring to a
28
- // mounted gate makes the server and first client render identical (nothing
29
- // at the call site); the tooltip mounts once, cleanly, after hydration.
30
- const mounted = useIsMounted();
31
- // The always-on arrow offset keeps the arrow pointing at the target centre
32
- // for every placement, not only when auto-fit clamps.
33
- const arrowStyle = arrowOffset
34
- ? {
35
- [arrowOffset.axis === "x"
36
- ? "--tooltip-arrow-offset-left"
37
- : "--tooltip-arrow-offset-top"]: `${arrowOffset.offset}px`,
38
- }
39
- : {};
40
- const TooltipMessageElement = (_jsx(Tooltip, { id: popupId, className: [bestPosition?.positionName, messageElementClassName]
41
- .filter(Boolean)
42
- .join(" "), icon: icon, onPointerEnter: contentProps.onPointerEnter, ref: popupRef, style: {
43
- ...messageElementStyle,
44
- ...popupPositionStyle,
45
- ...arrowStyle,
46
- },
47
- // Reveal only once a position has been resolved. Until `bestPosition`
48
- // exists the popup would render at the fallback top:0/left:0 with no
49
- // placement class (and so no arrow); gating the reveal on it means that
50
- // unpositioned frame stays `visibility:hidden` and never paints — no
51
- // visible 0,0 flash, and the open fade always runs from an anchored spot.
52
- isOpen: isOpen && Boolean(bestPosition), children: Message }));
53
- return (
54
- // biome-ignore lint/a11y/noStaticElementInteractions: the wrapper forwards pointer/focus to the tooltip trigger
55
- _jsxs("span", { className: [componentCssClassName, className].filter(Boolean).join(" "), style: style, onFocus: triggerProps.onFocus, onBlur: triggerProps.onBlur, onPointerEnter: triggerProps.onPointerEnter, onPointerLeave: triggerProps.onPointerLeave, children: [_jsx("span", { id: targetElementId, style: targetElementStyle, className: ["target", targetElementClassName].filter(Boolean).join(" "), ref: targetRef, "aria-describedby": popupId, children: children }), mounted
56
- ? createPortal(TooltipMessageElement, parentElement || document.body)
57
- : null] }));
58
- };
59
- export default TooltipArea;
60
- //# sourceMappingURL=TooltipArea.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TooltipArea.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,cAAc,CAAC;AAEtB,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,GAAG,KAAK,EACS,EAAgB,EAAE;IACnC,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe;IACf,6EAA6E;IAC7E,iEAAiE;MAClE,GAAG,aAAa,CAAC;QAChB,QAAQ;QACR,OAAO;QACP,GAAG,KAAK;QACR,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM;QAC5B,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IAEvC,8EAA8E;IAC9E,6EAA6E;IAC7E,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAE/B,2EAA2E;IAC3E,sDAAsD;IACtD,MAAM,UAAU,GAAkB,WAAW;QAC3C,CAAC,CAAC;YACE,CAAC,WAAW,CAAC,IAAI,KAAK,GAAG;gBACv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E,aAAa,IAAI,QAAQ,CAAC,IAAI,CAAC;gBACrE,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as TooltipArea } from "./TooltipArea.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,13 +0,0 @@
1
- .ds.tooltip-area {
2
- position: relative;
3
- & .target {
4
- cursor: pointer;
5
- position: relative;
6
- display: inline-block;
7
-
8
- & > * {
9
- /* biome-ignore lint/complexity/noImportantStyles: The tooltip targets must have no margin in order for tooltip placements to work correctly */
10
- margin: 0 !important;
11
- }
12
- }
13
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from "./TooltipArea/index.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/component/Tooltip/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Announcement.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/Announcement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,GAAI,yDAMnB,iBAAiB,KAAG,KAAK,CAAC,YAkB5B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,mBAAmB,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/component/Announcement/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAE5C,0DAA0D;IAC1D,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAC;IAEpB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1,10 +0,0 @@
1
- import type { ReactElement } from "react";
2
- import type { TooltipAreaProps } from "./types.js";
3
- import "./styles.css";
4
- /**
5
- * Wraps a target element with a tooltip.
6
- * This component allows you to attach a tooltip to any JSX fragment.
7
- */
8
- declare const TooltipArea: ({ children, style, className, Message, icon, open, distance, targetElementId, targetElementClassName, targetElementStyle, messageElementClassName, messageElementStyle, parentElement, autoFit, ...props }: TooltipAreaProps) => ReactElement;
9
- export default TooltipArea;
10
- //# sourceMappingURL=TooltipArea.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TooltipArea.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/TooltipArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,cAAc,CAAC;AAItB;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,4MAgBlB,gBAAgB,KAAG,YAgGrB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as TooltipArea } from "./TooltipArea.js";
2
- export type * from "./types.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,mBAAmB,YAAY,CAAC"}
@@ -1,47 +0,0 @@
1
- import type { CSSProperties, ReactNode } from "react";
2
- import type { UseDisclosureProps } from "../../../../hooks/index.js";
3
- export interface TooltipAreaProps extends Omit<UseDisclosureProps, "mode"> {
4
- /**
5
- * The target element to which the tooltip should be attached.
6
- * This can be any valid React element.
7
- */
8
- children: ReactNode;
9
- /**
10
- * The content of the tooltip. This can be a string or any valid React node.
11
- */
12
- Message: ReactNode;
13
- /**
14
- * An optional leading icon for the tooltip, rendered before the message
15
- * (Figma: 16px glyph, dimension-100 gap). Purely decorative.
16
- */
17
- icon?: ReactNode;
18
- /**
19
- * Force the tooltip open (or closed), overriding hover/focus. When a boolean
20
- * is passed the tooltip is fully controlled and ignores pointer/keyboard —
21
- * useful for stories, visual tests, or driving the tooltip from outside.
22
- * Leave undefined for the default hover behaviour.
23
- */
24
- open?: boolean;
25
- /** Styles applied to the tooltip area */
26
- style?: CSSProperties;
27
- /** Class name applied to the tooltip area */
28
- className?: string;
29
- /** ID applied to the target element */
30
- targetElementId?: string;
31
- /** Class name applied to the target element */
32
- targetElementClassName?: string;
33
- /** Style object applied to the target element */
34
- targetElementStyle?: CSSProperties;
35
- /** Class name applied to the tooltip/message element */
36
- messageElementClassName?: string;
37
- /** Styles applied to the tooltip/message element */
38
- messageElementStyle?: CSSProperties;
39
- /**
40
- * The element to which the tooltip should be attached.
41
- * This can be any valid React element.
42
- * When not provided, the tooltip will be attached to the `document.body`.
43
- * No default is provided at the TooltipArea signature level in order to prevent the component from failing builds in server environments, where `document` is not available.
44
- */
45
- parentElement?: HTMLElement;
46
- }
47
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/component/Tooltip/common/TooltipArea/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,wDAAwD;IACxD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,aAAa,CAAC;IACpC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;CAC7B"}
@@ -1,2 +0,0 @@
1
- export * from "./TooltipArea/index.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/component/Tooltip/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}