@ds-mo/ui 14.5.0 → 14.7.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 (118) hide show
  1. package/dist/.package-ready.json +1 -1
  2. package/dist/agent-patterns.json +6 -6
  3. package/dist/agent.json +80 -26
  4. package/dist/angular/ds-menu.d.ts +7 -1
  5. package/dist/angular/ds-menu.js +5 -2
  6. package/dist/angular/ds-table.d.ts +4 -1
  7. package/dist/angular/ds-table.js +7 -4
  8. package/dist/angular/ds-tooltip.d.ts +1 -1
  9. package/dist/angular/ds-tooltip.js +4 -3
  10. package/dist/components/ds-agent-questionnaire.js +1 -1
  11. package/dist/components/ds-agent-response.js +1 -1
  12. package/dist/components/ds-banner.js +1 -1
  13. package/dist/components/ds-bar-nav.js +1 -1
  14. package/dist/components/ds-bar-title.js +1 -1
  15. package/dist/components/ds-bar-workflow.js +1 -1
  16. package/dist/components/ds-bar-workflow.js.map +1 -1
  17. package/dist/components/ds-button-unfilled.js +1 -1
  18. package/dist/components/ds-card-chart.js +1 -1
  19. package/dist/components/ds-card-overview.js +1 -1
  20. package/dist/components/ds-card-setting.js +1 -1
  21. package/dist/components/ds-code-block.js +1 -1
  22. package/dist/components/ds-conversation-list-item.js +1 -1
  23. package/dist/components/ds-conversation-list-item.js.map +1 -1
  24. package/dist/components/ds-filter-menu.js +1 -1
  25. package/dist/components/ds-filter-menu.js.map +1 -1
  26. package/dist/components/ds-input.js +1 -1
  27. package/dist/components/ds-markdown.js +1 -1
  28. package/dist/components/ds-menu.js +1 -1
  29. package/dist/components/ds-message-actions.js +1 -1
  30. package/dist/components/ds-message-composer.js +1 -1
  31. package/dist/components/ds-message-scroller.js +1 -1
  32. package/dist/components/ds-mobile-header.js +1 -1
  33. package/dist/components/ds-mobile-section-switcher.js +1 -1
  34. package/dist/components/ds-mobile-sheet-nav.js +1 -1
  35. package/dist/components/ds-modal.js +1 -1
  36. package/dist/components/ds-pagination.js +1 -1
  37. package/dist/components/ds-panel-nav.js +1 -1
  38. package/dist/components/ds-panel-tool-header.js +1 -1
  39. package/dist/components/ds-panel-tool-search.js +1 -1
  40. package/dist/components/ds-panel-tools.js +1 -1
  41. package/dist/components/ds-select.js +1 -1
  42. package/dist/components/ds-shell-app.js +1 -1
  43. package/dist/components/ds-shell-tools.js +1 -1
  44. package/dist/components/ds-table.js +1 -1
  45. package/dist/components/ds-table.js.map +1 -1
  46. package/dist/components/ds-toast.js +1 -1
  47. package/dist/components/ds-tooltip.js +1 -1
  48. package/dist/components/{p-w64TmQd-.js → p--VFa9x3k.js} +2 -2
  49. package/dist/components/{p-o1v7Choa.js → p-B5um-ps9.js} +2 -2
  50. package/dist/components/{p-BiIdszv1.js → p-BAebDW3a.js} +2 -2
  51. package/dist/components/p-BKWgofxz.js +2 -0
  52. package/dist/components/p-BKWgofxz.js.map +1 -0
  53. package/dist/components/p-BXPQmp7q.js +2 -0
  54. package/dist/components/p-BXPQmp7q.js.map +1 -0
  55. package/dist/components/{p-CXqVVdW2.js → p-BmqfTAXM.js} +2 -2
  56. package/dist/components/{p-B2hqUkg-.js → p-C-L4InQ0.js} +2 -2
  57. package/dist/components/{p-BGGm1NB1.js → p-C1jsgfeh.js} +2 -2
  58. package/dist/components/{p-nImbYpwo.js → p-CoQSB3tl.js} +2 -2
  59. package/dist/components/{p-BXNLaPbw.js → p-CvwtYbmh.js} +2 -2
  60. package/dist/components/{p-ohWEVGHg.js → p-D5VglrfF.js} +2 -2
  61. package/dist/components/{p-DkPNCBA8.js → p-D5bPuNiF.js} +2 -2
  62. package/dist/components/{p-Ba1l3Yot.js → p-DOC4RaAy.js} +2 -2
  63. package/dist/components/{p-CvpsV-jC.js → p-DQUxg6Si.js} +2 -2
  64. package/dist/components/{p-Dkkid-rh.js → p-bQm3gfr1.js} +2 -2
  65. package/dist/components/{p-CTTDiW33.js → p-c_5SXjwx.js} +2 -2
  66. package/dist/components/p-c_5SXjwx.js.map +1 -0
  67. package/dist/components/p-mLRtp5A4.js +2 -0
  68. package/dist/components/{p-CRLRjtsc.js.map → p-mLRtp5A4.js.map} +1 -1
  69. package/dist/docs/components.json +315 -16
  70. package/dist/lib/utils/index.d.ts +1 -0
  71. package/dist/lib/utils/index.js +8 -0
  72. package/dist/lib/utils/index.js.map +3 -3
  73. package/dist/lib/utils/is-element-truncated.d.ts +6 -0
  74. package/dist/mcp-data/registry/button-unfilled.json +6 -6
  75. package/dist/mcp-data/registry/menu.json +40 -12
  76. package/dist/mcp-data/registry/registry.json +79 -25
  77. package/dist/mcp-data/registry/table.json +110 -15
  78. package/dist/mcp-data/registry/tooltip.json +68 -7
  79. package/dist/react/ds-menu.d.ts +2 -1
  80. package/dist/react/ds-menu.js +2 -1
  81. package/dist/react/ds-table.d.ts +2 -1
  82. package/dist/react/ds-table.js +2 -1
  83. package/dist/styles/table.css +81 -2
  84. package/dist/types/components/ButtonUnfilled/ButtonUnfilled.d.ts +4 -2
  85. package/dist/types/components/Menu/Menu.d.ts +19 -1
  86. package/dist/types/components/Menu/menu-reorder.d.ts +21 -0
  87. package/dist/types/components/Menu/menu-types.d.ts +12 -0
  88. package/dist/types/components/Table/Table.d.ts +50 -1
  89. package/dist/types/components/Table/index.d.ts +1 -1
  90. package/dist/types/components/Table/table-action-menu.d.ts +15 -0
  91. package/dist/types/components/Table/table-cell-model.d.ts +16 -1
  92. package/dist/types/components/Table/table-column-customizer.d.ts +33 -0
  93. package/dist/types/components/Table/table-truncate.d.ts +6 -0
  94. package/dist/types/components/Table/table-types.d.ts +44 -2
  95. package/dist/types/components/Tooltip/Tooltip.d.ts +15 -0
  96. package/dist/types/components.d.ts +74 -6
  97. package/dist/types/utils/index.d.ts +1 -0
  98. package/dist/types/utils/is-element-truncated.d.ts +7 -0
  99. package/package.json +1 -1
  100. package/dist/components/p-CRLRjtsc.js +0 -2
  101. package/dist/components/p-CTTDiW33.js.map +0 -1
  102. package/dist/components/p-Ccq1RmOb.js +0 -2
  103. package/dist/components/p-Ccq1RmOb.js.map +0 -1
  104. package/dist/components/p-CtOK5oZ1.js +0 -2
  105. package/dist/components/p-CtOK5oZ1.js.map +0 -1
  106. /package/dist/components/{p-w64TmQd-.js.map → p--VFa9x3k.js.map} +0 -0
  107. /package/dist/components/{p-o1v7Choa.js.map → p-B5um-ps9.js.map} +0 -0
  108. /package/dist/components/{p-BiIdszv1.js.map → p-BAebDW3a.js.map} +0 -0
  109. /package/dist/components/{p-CXqVVdW2.js.map → p-BmqfTAXM.js.map} +0 -0
  110. /package/dist/components/{p-B2hqUkg-.js.map → p-C-L4InQ0.js.map} +0 -0
  111. /package/dist/components/{p-BGGm1NB1.js.map → p-C1jsgfeh.js.map} +0 -0
  112. /package/dist/components/{p-nImbYpwo.js.map → p-CoQSB3tl.js.map} +0 -0
  113. /package/dist/components/{p-BXNLaPbw.js.map → p-CvwtYbmh.js.map} +0 -0
  114. /package/dist/components/{p-ohWEVGHg.js.map → p-D5VglrfF.js.map} +0 -0
  115. /package/dist/components/{p-DkPNCBA8.js.map → p-D5bPuNiF.js.map} +0 -0
  116. /package/dist/components/{p-Ba1l3Yot.js.map → p-DOC4RaAy.js.map} +0 -0
  117. /package/dist/components/{p-CvpsV-jC.js.map → p-DQUxg6Si.js.map} +0 -0
  118. /package/dist/components/{p-Dkkid-rh.js.map → p-bQm3gfr1.js.map} +0 -0
@@ -45,12 +45,13 @@
45
45
  "component:ds-button-filled",
46
46
  "component:ds-button-unfilled",
47
47
  "component:ds-panel-nav",
48
- "component:ds-panel-tools"
48
+ "component:ds-panel-tools",
49
+ "component:ds-table"
49
50
  ],
50
51
  "accessibility": [
51
52
  "The slotted trigger must have its own accessible name, usually an aria-label that closely matches the visual tooltip label.",
52
53
  "Tooltip content is supplementary and non-essential; touch input intentionally does not open it.",
53
- "While open, the trigger is linked to the role=tooltip popup with aria-describedby; the relationship is removed when the popup leaves the DOM without disturbing consumer description IDs.",
54
+ "While open, the trigger is linked to the role=tooltip popup with aria-describedby by default; the relationship is removed when the popup leaves the DOM without disturbing consumer description IDs. Hosts that already expose the full string, such as a truncated table cell, disable that relationship.",
54
55
  "Keyboard focus opens the tooltip and Escape dismisses it without moving focus."
55
56
  ],
56
57
  "states": [
@@ -58,18 +59,20 @@
58
59
  "An empty or whitespace-only label suppresses the popup while preserving the wrapper.",
59
60
  "Only one tooltip remains active globally; warm handoff removes the previous popup before showing the next.",
60
61
  "Disconnecting and reinserting the tooltip host rebinds the current slotted trigger.",
62
+ "A host may present the popup against an external anchor it already owns, without wrapping that trigger or binding hover on it.",
61
63
  "The preferred side flips when it cannot fit, then alignment is clamped to viewport padding.",
62
64
  "Reduced motion removes enter and exit fades while retaining the final visible or hidden state."
63
65
  ],
64
66
  "responsiveBehavior": [
65
67
  "The portaled popup follows trigger and popup resize, viewport resize, and nested scrolling while open.",
66
68
  "Touch users rely on the trigger's accessible and visible context rather than tooltip disclosure.",
67
- "Keep labels concise and non-wrapping; use inline text or a larger disclosure component for essential explanation."
69
+ "Keep labels concise and non-wrapping by default; omitted table cell values may wrap at panel-xs."
68
70
  ],
69
71
  "frameworkCaveats": {
70
72
  "customElements": [
71
73
  "Place exactly one trigger element as the component's light-DOM child.",
72
74
  "Replacing the slotted trigger rebinds pointer and focus behavior automatically.",
75
+ "A table or similar host can present the popup against an overflowing text node instead of wrapping that node.",
73
76
  "sideOffset, alignOffset, and delay accept numbers or TokoMo CSS values."
74
77
  ],
75
78
  "react": [
@@ -122,6 +125,15 @@
122
125
  "mutable": false,
123
126
  "description": "Hover show delay before the tooltip appears.\nDefault: `--effect-animation-delay-medium-3` (1000ms). Accepts a number (ms)\nor a TokoMo time token / `var(--effect-animation-delay-*)`. Applies to the\ninitial hover/focus show only — after a recent dismiss, reopen is instant.\nPrefer the default; override only for denser chrome or rare/destructive actions."
124
127
  },
128
+ "describedBy": {
129
+ "type": "boolean",
130
+ "resolvedType": "boolean",
131
+ "attribute": "described-by",
132
+ "default": "true",
133
+ "required": false,
134
+ "mutable": false,
135
+ "description": "Link the trigger with aria-describedby while the popup is open. Disable when\nthe label is already in the DOM, such as a truncated table cell."
136
+ },
125
137
  "label": {
126
138
  "type": "string",
127
139
  "resolvedType": "string",
@@ -170,10 +182,30 @@
170
182
  "required": false,
171
183
  "mutable": false,
172
184
  "description": "Control density (height, padding, type)."
185
+ },
186
+ "wrapLabel": {
187
+ "type": "boolean",
188
+ "resolvedType": "boolean",
189
+ "attribute": "wrap-label",
190
+ "default": "false",
191
+ "required": false,
192
+ "mutable": false,
193
+ "description": "Allow the label to wrap at a panel-xs max width instead of a single line."
173
194
  }
174
195
  },
175
196
  "events": [],
176
- "methods": [],
197
+ "methods": [
198
+ {
199
+ "name": "dismiss",
200
+ "signature": "dismiss() => Promise<void>",
201
+ "description": "Dismiss a popup opened through presentFrom or the slotted trigger."
202
+ },
203
+ {
204
+ "name": "presentFrom",
205
+ "signature": "presentFrom(anchor: HTMLElement, label?: string) => Promise<void>",
206
+ "description": "Present against an external anchor the host already measured.\nDoes not bind hover or focus on that anchor — the owner drives show/hide."
207
+ }
208
+ ],
177
209
  "slots": []
178
210
  },
179
211
  "props": {
@@ -203,6 +235,15 @@
203
235
  "mutable": false,
204
236
  "description": "Hover show delay before the tooltip appears.\nDefault: `--effect-animation-delay-medium-3` (1000ms). Accepts a number (ms)\nor a TokoMo time token / `var(--effect-animation-delay-*)`. Applies to the\ninitial hover/focus show only — after a recent dismiss, reopen is instant.\nPrefer the default; override only for denser chrome or rare/destructive actions."
205
237
  },
238
+ "describedBy": {
239
+ "type": "boolean",
240
+ "resolvedType": "boolean",
241
+ "attribute": "described-by",
242
+ "default": "true",
243
+ "required": false,
244
+ "mutable": false,
245
+ "description": "Link the trigger with aria-describedby while the popup is open. Disable when\nthe label is already in the DOM, such as a truncated table cell."
246
+ },
206
247
  "label": {
207
248
  "type": "string",
208
249
  "resolvedType": "string",
@@ -251,10 +292,30 @@
251
292
  "required": false,
252
293
  "mutable": false,
253
294
  "description": "Control density (height, padding, type)."
295
+ },
296
+ "wrapLabel": {
297
+ "type": "boolean",
298
+ "resolvedType": "boolean",
299
+ "attribute": "wrap-label",
300
+ "default": "false",
301
+ "required": false,
302
+ "mutable": false,
303
+ "description": "Allow the label to wrap at a panel-xs max width instead of a single line."
254
304
  }
255
305
  },
256
306
  "events": [],
257
- "methods": [],
307
+ "methods": [
308
+ {
309
+ "name": "dismiss",
310
+ "signature": "dismiss() => Promise<void>",
311
+ "description": "Dismiss a popup opened through presentFrom or the slotted trigger."
312
+ },
313
+ {
314
+ "name": "presentFrom",
315
+ "signature": "presentFrom(anchor: HTMLElement, label?: string) => Promise<void>",
316
+ "description": "Present against an external anchor the host already measured.\nDoes not bind hover or focus on that anchor — the owner drives show/hide."
317
+ }
318
+ ],
258
319
  "slots": [],
259
320
  "exports": {
260
321
  "customElement": "ds-tooltip",
@@ -295,12 +356,12 @@
295
356
  "files": [
296
357
  {
297
358
  "path": "src/wc/components/Tooltip/Tooltip.css",
298
- "content": "@import '../../utils/control-density.css';\n@import '../../utils/key-hint.css';\n@import '../../utils/forced-colors.css';\n\n.tooltip-popup {\n box-sizing: border-box;\n background-color: var(--color-background-primary);\n border-radius: var(--ds-control-radius, var(--dimension-radius-025));\n box-shadow: var(--effect-elevation-elevated-floating);\n white-space: nowrap;\n pointer-events: none;\n animation: tooltipFadeIn var(--effect-motion-short-2) forwards;\n will-change: transform;\n backface-visibility: hidden;\n}\n\n/* Warm handoff between nearby triggers — no enter fade (avoids 20–100ms lag). */\n.tooltip-popup--instant {\n animation: none;\n opacity: 1;\n}\n\n.tooltip-popup--closing {\n animation: tooltipFadeOut var(--effect-motion-short-3) forwards;\n}\n\n/* Density: md / sm / xs via `.ds-control--*` on `.tooltip-inner`. */\n.tooltip-inner {\n box-sizing: border-box;\n height: var(--ds-control-height, var(--dimension-size-400));\n display: flex;\n align-items: center;\n gap: var(--ds-control-gap, var(--dimension-space-050));\n padding: 0 var(--ds-control-padding-inline, var(--dimension-space-075));\n}\n\n/*\n * Label layout lives on ds-text (metric-box + control label-inset).\n * NOTE: Stencil scopes this to `ds-text.sc-ds-tooltip`, but portaled\n * createElement ds-text loses that class when Text's <Host class> renders.\n * `renderPopupContent` therefore also sets these as inline styles.\n */\n.tooltip-inner > ds-text {\n flex-shrink: 0;\n min-width: max-content;\n max-width: none;\n padding: 0 var(--ds-control-label-inset, var(--dimension-space-025));\n color: var(--color-foreground-primary);\n}\n\n@keyframes tooltipFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes tooltipFadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tooltip-popup,\n .tooltip-popup--instant {\n animation: none;\n opacity: 1;\n }\n\n .tooltip-popup--closing {\n animation: none;\n opacity: 0;\n }\n}\n\n@media (forced-colors: active) {\n .tooltip-popup {\n box-shadow: none;\n outline: var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);\n outline-offset: calc(-1 * var(--dimension-stroke-width-012));\n }\n}\n",
359
+ "content": "@import '../../utils/control-density.css';\n@import '../../utils/key-hint.css';\n@import '../../utils/forced-colors.css';\n\n.tooltip-popup {\n box-sizing: border-box;\n background-color: var(--color-background-primary);\n border-radius: var(--ds-control-radius, var(--dimension-radius-025));\n box-shadow: var(--effect-elevation-elevated-floating);\n white-space: nowrap;\n pointer-events: none;\n animation: tooltipFadeIn var(--effect-motion-short-2) forwards;\n will-change: transform;\n backface-visibility: hidden;\n}\n\n/* Warm handoff between nearby triggers — no enter fade (avoids 20–100ms lag). */\n.tooltip-popup--instant {\n animation: none;\n opacity: 1;\n}\n\n.tooltip-popup--closing {\n animation: tooltipFadeOut var(--effect-motion-short-3) forwards;\n}\n\n/* Density: md / sm / xs via `.ds-control--*` on `.tooltip-inner`. */\n.tooltip-inner {\n box-sizing: border-box;\n height: var(--ds-control-height, var(--dimension-size-400));\n display: flex;\n align-items: center;\n gap: var(--ds-control-gap, var(--dimension-space-050));\n padding: 0 var(--ds-control-padding-inline, var(--dimension-space-075));\n}\n\n/*\n * Label layout lives on ds-text (metric-box + control label-inset).\n * NOTE: Stencil scopes this to `ds-text.sc-ds-tooltip`, but portaled\n * createElement ds-text loses that class when Text's <Host class> renders.\n * `renderPopupContent` therefore also sets these as inline styles.\n */\n.tooltip-inner > ds-text {\n flex-shrink: 0;\n min-width: max-content;\n max-width: none;\n padding: 0 var(--ds-control-label-inset, var(--dimension-space-025));\n color: var(--color-foreground-primary);\n}\n\n.tooltip-popup--wrap {\n white-space: normal;\n max-inline-size: var(--dimension-panel-width-xs);\n}\n\n.tooltip-popup--wrap .tooltip-inner {\n height: auto;\n min-height: var(--ds-control-height, var(--dimension-size-400));\n padding-block: var(--dimension-space-050);\n align-items: flex-start;\n}\n\n.tooltip-popup--wrap .tooltip-inner > ds-text {\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n white-space: normal;\n}\n\n@keyframes tooltipFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes tooltipFadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tooltip-popup,\n .tooltip-popup--instant {\n animation: none;\n opacity: 1;\n }\n\n .tooltip-popup--closing {\n animation: none;\n opacity: 0;\n }\n}\n\n@media (forced-colors: active) {\n .tooltip-popup {\n box-shadow: none;\n outline: var(--dimension-stroke-width-012) solid var(--ds-forced-color-content);\n outline-offset: calc(-1 * var(--dimension-stroke-width-012));\n }\n}\n",
299
360
  "type": "registry:ui"
300
361
  },
301
362
  {
302
363
  "path": "src/wc/components/Tooltip/Tooltip.tsx",
303
- "content": "import { Component, Prop, Element, Watch, h, Host } from '@stencil/core';\nimport {\n CONTROL_TEXT_VARIANT,\n resolveCssLengthPx,\n resolveCssTimeMs,\n resolveMotionTimeMs,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n} from '../../utils';\nimport type { TextVariant } from '../Text/text-types';\nimport { shortcutKeyLabels } from '../../utils/shortcut-key';\nimport { AnchoredPositionController } from '../../utils/anchored-position-controller';\n// Side-effect: register `ds-text` — the portal builds it via createElement, not JSX.\nimport '../Text/Text';\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left';\nexport type TooltipAlign = 'start' | 'center' | 'end';\nexport type TooltipSize = 'md' | 'sm' | 'xs';\n\nconst FALLBACK_HEIGHT: Record<TooltipSize, string> = {\n md: TOKEN_DEFAULTS.size400,\n sm: TOKEN_DEFAULTS.size300,\n xs: TOKEN_DEFAULTS.size200,\n};\n\nlet lastDismissedAt = 0;\nlet tooltipIdCounter = 0;\n/** Currently open tooltip — force-cleared on warm handoff so tips don't cross-fade. */\nlet activeTooltip: Tooltip | null = null;\n\ntype DsTextEl = HTMLElement & {\n as: string;\n variant: TextVariant;\n emphasis: boolean;\n color: string;\n wrap: string;\n};\n\nfunction createDsText(opts: {\n variant: TextVariant;\n emphasis?: boolean;\n color?: string;\n wrap?: 'wrap' | 'nowrap' | 'balance' | 'pretty';\n text: string;\n}): DsTextEl {\n const el = document.createElement('ds-text') as DsTextEl;\n el.as = 'span';\n el.variant = opts.variant;\n el.emphasis = opts.emphasis ?? false;\n el.color = opts.color ?? 'inherit';\n if (opts.wrap) el.wrap = opts.wrap;\n el.textContent = opts.text;\n return el;\n}\n\n/**\n * Control-density label styles for portaled ds-text.\n * Scoped CSS requires `sc-ds-tooltip` on the host, but Text's `<Host class>`\n * overwrites imperative className — so these must be inline to stick.\n */\nfunction styleTooltipLabel(el: HTMLElement) {\n el.style.flexShrink = '0';\n el.style.minWidth = 'max-content';\n el.style.maxWidth = 'none';\n el.style.padding = '0 var(--ds-control-label-inset, var(--dimension-space-025))';\n el.style.color = 'var(--color-foreground-primary)';\n}\n\n/**\n * Imperative body portal for the popup.\n * Stencil must not own the portaled node — moving a VDOM child to `document.body`\n * causes recreate → re-portal → @State loops that freeze the page.\n */\n@Component({\n tag: 'ds-tooltip',\n styleUrl: 'Tooltip.css',\n scoped: true,\n})\nexport class Tooltip {\n @Element() el!: HTMLElement;\n\n /**\n * Tooltip text. Empty/whitespace skips show — useful when the wrapper must stay\n * mounted for layout/animation stability (e.g. PanelNav expand/collapse).\n */\n @Prop() label!: string;\n\n /** Control density (height, padding, type). */\n @Prop() size: TooltipSize = 'md';\n\n @Prop() side: TooltipSide = 'top';\n @Prop() align: TooltipAlign = 'center';\n /** Gap between anchor and tooltip — number (px) or TokoMo length. */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number (px) or TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n /**\n * Hover show delay before the tooltip appears.\n * Default: `--effect-animation-delay-medium-3` (1000ms). Accepts a number (ms)\n * or a TokoMo time token / `var(--effect-animation-delay-*)`. Applies to the\n * initial hover/focus show only — after a recent dismiss, reopen is instant.\n * Prefer the default; override only for denser chrome or rare/destructive actions.\n */\n @Prop() delay: number | string = TOKEN_DEFAULTS.animationDelayMedium3;\n @Prop() shortcutKey: string | undefined;\n @Prop() shortcutKeyPosition: 'start' | 'end' = 'end';\n\n private tooltipId = `ds-tooltip-${++tooltipIdCounter}`;\n private delayTimer: ReturnType<typeof setTimeout> | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private anchor: HTMLElement | null = null;\n private popupEl: HTMLElement | null = null;\n private anchorObserver: MutationObserver | null = null;\n private didLoad = false;\n private readonly position = new AnchoredPositionController({\n getAnchor: () => this.anchor,\n getPopup: () => this.popupEl,\n measure: (anchor, tip) => ({\n anchorRect: anchor.getBoundingClientRect(),\n // Fall back to token metrics until `ds-text` upgrades and reports a width.\n popupWidth: tip.offsetWidth || this.tooltipFallbackWidthPx,\n popupHeight: tip.offsetHeight || this.tooltipFallbackHeightPx,\n side: this.side,\n align: this.align,\n sideOffsetPx: this.sideOffsetPx,\n alignOffsetPx: this.alignOffsetPx,\n viewportPadPx: this.viewportPadPx,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n }),\n apply: ({ x, y, resolvedSide }) => {\n if (!this.popupEl) return;\n this.popupEl.dataset.side = resolvedSide;\n this.popupEl.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;\n },\n liveUpdate: 'frame',\n observeResize: true,\n });\n private skipEnterAnimation = false;\n private isOpen = false;\n private lastInteractionWasKeyboard = false;\n private pointerEnterHandler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return;\n this.show();\n };\n private pointerLeaveHandler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return;\n this.hide();\n };\n private pointerDownHandler = (event: PointerEvent) => {\n this.lastInteractionWasKeyboard = false;\n if (event.pointerType === 'touch' && (this.isOpen || this.popupEl)) this.hideInstant();\n };\n private keyDownHandler = () => {\n this.lastInteractionWasKeyboard = true;\n };\n /** focusin/focusout so nested focus targets (e.g. ds-button-* inner button) still open the tip. */\n private focusHandler = () => {\n if (this.lastInteractionWasKeyboard || this.anchor?.matches(':focus-visible')) this.show();\n };\n private blurHandler: (e: FocusEvent) => void = (e) => {\n const next = e.relatedTarget as Node | null;\n if (next && this.anchor?.contains(next)) return;\n this.hide();\n };\n private escapeHandler = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !this.isOpen) return;\n event.preventDefault();\n this.hide();\n };\n\n connectedCallback() {\n if (!this.didLoad) return;\n this.connectAnchor();\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.connectAnchor();\n }\n\n private connectAnchor() {\n this.bindAnchor();\n if (this.anchorObserver) return;\n this.anchorObserver = new MutationObserver(() => this.handleSlotChange());\n this.anchorObserver.observe(this.el, { childList: true });\n }\n\n disconnectedCallback() {\n if (activeTooltip === this) activeTooltip = null;\n this.anchorObserver?.disconnect();\n this.anchorObserver = null;\n this.unbindAnchor();\n this.clearTimers();\n this.destroyPopup();\n }\n\n @Watch('label')\n @Watch('size')\n @Watch('side')\n @Watch('align')\n @Watch('sideOffset')\n @Watch('alignOffset')\n @Watch('shortcutKey')\n @Watch('shortcutKeyPosition')\n onContentOrPositionChange() {\n if (!this.label?.trim()) {\n if (this.isOpen || this.popupEl) this.hideInstant();\n return;\n }\n if (!this.popupEl || !this.isOpen) return;\n this.renderPopupContent();\n this.schedulePosition();\n }\n\n private get viewportPadPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get sideOffsetPx(): number {\n return resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050);\n }\n\n private get alignOffsetPx(): number {\n return resolveCssLengthPx(this.alignOffset, 0);\n }\n\n private get hoverDelayMs(): number {\n return resolveCssTimeMs(this.delay, TOKEN_DEFAULTS.animationDelayMedium3);\n }\n\n private get instantReopenMs(): number {\n return resolveCssTimeMs(\n TOKEN_DEFAULTS.animationDurationMedium1,\n TOKEN_DEFAULTS.animationDurationMedium1,\n );\n }\n\n private get fadeOutMs(): number {\n return resolveMotionTimeMs(TOKEN_DEFAULTS.motionShort3, TOKEN_DEFAULTS.animationDurationShort3);\n }\n\n private get tooltipFallbackWidthPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.tooltipFallbackWidth, TOKEN_DEFAULTS.tooltipFallbackWidth);\n }\n\n private get tooltipFallbackHeightPx(): number {\n const token = FALLBACK_HEIGHT[this.size];\n return resolveCssLengthPx(token, token);\n }\n\n private bindAnchor() {\n const slot = this.el.querySelector('slot') as HTMLSlotElement | null;\n const slotted = slot?.assignedElements?.() ?? [];\n const child = (slotted[0] ?? this.el.firstElementChild) as HTMLElement | null;\n if (!child || child === this.anchor) return;\n this.anchor = child;\n child.addEventListener('pointerenter', this.pointerEnterHandler);\n child.addEventListener('pointerleave', this.pointerLeaveHandler);\n child.addEventListener('pointerdown', this.pointerDownHandler);\n child.addEventListener('keydown', this.keyDownHandler);\n child.addEventListener('focusin', this.focusHandler);\n child.addEventListener('focusout', this.blurHandler);\n }\n\n private unbindAnchor() {\n if (!this.anchor) return;\n this.unlinkDescribedBy();\n this.anchor.removeEventListener('pointerenter', this.pointerEnterHandler);\n this.anchor.removeEventListener('pointerleave', this.pointerLeaveHandler);\n this.anchor.removeEventListener('pointerdown', this.pointerDownHandler);\n this.anchor.removeEventListener('keydown', this.keyDownHandler);\n this.anchor.removeEventListener('focusin', this.focusHandler);\n this.anchor.removeEventListener('focusout', this.blurHandler);\n this.anchor = null;\n }\n\n private linkDescribedBy() {\n if (!this.anchor || !this.popupEl) return;\n const ids = new Set((this.anchor.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter(Boolean));\n ids.add(this.tooltipId);\n this.anchor.setAttribute('aria-describedby', Array.from(ids).join(' '));\n }\n\n private unlinkDescribedBy() {\n if (!this.anchor) return;\n const ids = (this.anchor.getAttribute('aria-describedby') ?? '')\n .split(/\\s+/)\n .filter(id => id && id !== this.tooltipId);\n if (ids.length) this.anchor.setAttribute('aria-describedby', ids.join(' '));\n else this.anchor.removeAttribute('aria-describedby');\n }\n\n private handleSlotChange = () => {\n const slot = this.el.querySelector('slot') as HTMLSlotElement | null;\n const next = (slot?.assignedElements?.()[0] ?? this.el.firstElementChild) as HTMLElement | null;\n if (next === this.anchor) return;\n if (this.isOpen || this.popupEl) this.hideInstant();\n this.unbindAnchor();\n this.bindAnchor();\n };\n\n private clearTimers() {\n if (this.delayTimer) { clearTimeout(this.delayTimer); this.delayTimer = null; }\n if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null; }\n }\n\n private setupOpenListeners() {\n // Binds scroll/resize + the resize observer; placement itself is scheduled\n // by schedulePosition() so the label restyle stays interleaved.\n this.position.observe();\n document.addEventListener('keydown', this.escapeHandler);\n }\n\n private teardownOpenListeners() {\n this.position.unobserve();\n document.removeEventListener('keydown', this.escapeHandler);\n }\n\n private destroyPopup() {\n this.teardownOpenListeners();\n this.unlinkDescribedBy();\n if (!this.popupEl) return;\n this.popupEl.remove();\n this.popupEl = null;\n }\n\n /**\n * Position after `ds-text` upgrades and lays out. Measuring synchronously in\n * `mountPopup` reads a collapsed/fallback width and places left/right tips wrong.\n */\n private schedulePosition() {\n if (!this.popupEl) return;\n\n const reapplyLabelStyles = () => {\n const label = this.popupEl?.querySelector(':scope > .tooltip-inner > ds-text');\n if (label instanceof HTMLElement) styleTooltipLabel(label);\n };\n\n requestAnimationFrame(() => {\n reapplyLabelStyles();\n this.position.update();\n requestAnimationFrame(() => {\n reapplyLabelStyles();\n this.position.update();\n });\n });\n\n // The popup remounts on every show, so re-target the observer bound in start().\n this.position.observeResizeTargets();\n }\n\n /** Drop the open tip immediately (warm handoff to another tooltip). */\n private hideInstant() {\n this.clearTimers();\n lastDismissedAt = Date.now();\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n }\n\n private show() {\n // Empty label = wrapper present for DOM stability (e.g. PanelNav expand/collapse)\n // but no tip should appear.\n if (!this.label?.trim()) return;\n this.clearTimers();\n let instant = Date.now() - lastDismissedAt < this.instantReopenMs;\n if (activeTooltip && activeTooltip !== this) {\n activeTooltip.hideInstant();\n instant = true;\n }\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- module singleton tracks the active instance\n activeTooltip = this;\n this.skipEnterAnimation = instant;\n if (instant) {\n this.mountPopup();\n return;\n }\n this.delayTimer = setTimeout(() => {\n this.delayTimer = null;\n if (!this.label?.trim()) return;\n this.mountPopup();\n }, this.hoverDelayMs);\n }\n\n private hide() {\n this.clearTimers();\n if (!this.popupEl && !this.isOpen) return;\n lastDismissedAt = Date.now();\n if (!this.popupEl) {\n this.isOpen = false;\n return;\n }\n this.popupEl.classList.remove('tooltip-popup--instant');\n this.popupEl.classList.add('tooltip-popup--closing');\n if (this.fadeOutMs === 0) {\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n return;\n }\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n }, this.fadeOutMs);\n }\n\n private mountPopup() {\n if (!this.popupEl) {\n const tip = document.createElement('div');\n tip.id = this.tooltipId;\n tip.setAttribute('role', 'tooltip');\n // `sc-ds-tooltip` is required for Stencil scoped CSS to match outside the host.\n tip.className = 'tooltip-popup ds-forced-colors-scope sc-ds-tooltip';\n Object.assign(tip.style, {\n position: 'fixed',\n left: '0',\n top: '0',\n zIndex: 'var(--dimension-z-index-tooltip)',\n pointerEvents: 'none',\n });\n document.body.appendChild(tip);\n this.popupEl = tip;\n }\n\n this.setupOpenListeners();\n this.linkDescribedBy();\n this.popupEl.classList.toggle('tooltip-popup--instant', this.skipEnterAnimation);\n this.popupEl.classList.remove('tooltip-popup--closing');\n this.renderPopupContent();\n this.schedulePosition();\n this.isOpen = true;\n }\n\n private renderPopupContent() {\n if (!this.popupEl) return;\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const density =\n this.size === 'md' ? 'ds-control--md' : this.size === 'sm' ? 'ds-control--sm' : 'ds-control--xs';\n // Every layout node needs `sc-ds-tooltip` so scoped selectors (`.foo.sc-ds-tooltip`) match.\n const sc = 'sc-ds-tooltip';\n\n const inner = document.createElement('div');\n inner.className = `tooltip-inner ${density} ${sc}`;\n\n const appendShortcut = (position: 'start' | 'end') => {\n if (!this.shortcutKey || this.shortcutKeyPosition !== position) return;\n const group = document.createElement('span');\n group.className = `key-hint-group ${sc}`;\n group.setAttribute('aria-hidden', 'true');\n\n for (const label of shortcutKeyLabels(this.shortcutKey)) {\n const hint = document.createElement('span');\n const wide = Array.from(label).length > 1 ? ' key-hint--wide' : '';\n hint.className = `key-hint${wide} ${sc}`;\n const text = document.createElement('span');\n text.className = `key-hint__label ${sc}`;\n text.textContent = label;\n hint.appendChild(text);\n group.appendChild(hint);\n }\n inner.appendChild(group);\n };\n\n appendShortcut('start');\n\n // ds-text is the layout box (metric-box + 2px control label-inset).\n // Inline styles required — see styleTooltipLabel.\n const label = createDsText({ variant: textVariant, wrap: 'nowrap', text: this.label });\n styleTooltipLabel(label);\n inner.appendChild(label);\n\n appendShortcut('end');\n\n this.popupEl.replaceChildren(inner);\n }\n\n render() {\n return (\n <Host style={{ display: 'contents' }}>\n <slot onSlotchange={this.handleSlotChange} />\n </Host>\n );\n }\n}\n",
364
+ "content": "import { Component, Prop, Element, Method, Watch, h, Host } from '@stencil/core';\nimport {\n CONTROL_TEXT_VARIANT,\n resolveCssLengthPx,\n resolveCssTimeMs,\n resolveMotionTimeMs,\n TOKEN_CSS_LENGTHS,\n TOKEN_DEFAULTS,\n} from '../../utils';\nimport type { TextVariant } from '../Text/text-types';\nimport { shortcutKeyLabels } from '../../utils/shortcut-key';\nimport { AnchoredPositionController } from '../../utils/anchored-position-controller';\n// Side-effect: register `ds-text` — the portal builds it via createElement, not JSX.\nimport '../Text/Text';\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left';\nexport type TooltipAlign = 'start' | 'center' | 'end';\nexport type TooltipSize = 'md' | 'sm' | 'xs';\n\nconst FALLBACK_HEIGHT: Record<TooltipSize, string> = {\n md: TOKEN_DEFAULTS.size400,\n sm: TOKEN_DEFAULTS.size300,\n xs: TOKEN_DEFAULTS.size200,\n};\n\nlet lastDismissedAt = 0;\nlet tooltipIdCounter = 0;\n/** Currently open tooltip — force-cleared on warm handoff so tips don't cross-fade. */\nlet activeTooltip: Tooltip | null = null;\n\ntype DsTextEl = HTMLElement & {\n as: string;\n variant: TextVariant;\n emphasis: boolean;\n color: string;\n wrap: string;\n};\n\nfunction createDsText(opts: {\n variant: TextVariant;\n emphasis?: boolean;\n color?: string;\n wrap?: 'wrap' | 'nowrap' | 'balance' | 'pretty';\n text: string;\n}): DsTextEl {\n const el = document.createElement('ds-text') as DsTextEl;\n el.as = 'span';\n el.variant = opts.variant;\n el.emphasis = opts.emphasis ?? false;\n el.color = opts.color ?? 'inherit';\n if (opts.wrap) el.wrap = opts.wrap;\n el.textContent = opts.text;\n return el;\n}\n\n/**\n * Control-density label styles for portaled ds-text.\n * Scoped CSS requires `sc-ds-tooltip` on the host, but Text's `<Host class>`\n * overwrites imperative className — so these must be inline to stick.\n */\nfunction styleTooltipLabel(el: HTMLElement, wrapLabel = false) {\n el.style.flexShrink = wrapLabel ? '1' : '0';\n el.style.minWidth = wrapLabel ? '0' : 'max-content';\n el.style.maxWidth = wrapLabel ? '100%' : 'none';\n el.style.whiteSpace = wrapLabel ? 'normal' : '';\n el.style.padding = '0 var(--ds-control-label-inset, var(--dimension-space-025))';\n el.style.color = 'var(--color-foreground-primary)';\n}\n\n/**\n * Imperative body portal for the popup.\n * Stencil must not own the portaled node — moving a VDOM child to `document.body`\n * causes recreate → re-portal → @State loops that freeze the page.\n */\n@Component({\n tag: 'ds-tooltip',\n styleUrl: 'Tooltip.css',\n scoped: true,\n})\nexport class Tooltip {\n @Element() el!: HTMLElement;\n\n /**\n * Tooltip text. Empty/whitespace skips show — useful when the wrapper must stay\n * mounted for layout/animation stability (e.g. PanelNav expand/collapse).\n */\n @Prop() label!: string;\n\n /** Control density (height, padding, type). */\n @Prop() size: TooltipSize = 'md';\n\n @Prop() side: TooltipSide = 'top';\n @Prop() align: TooltipAlign = 'center';\n /** Gap between anchor and tooltip — number (px) or TokoMo length. */\n @Prop() sideOffset: number | string = TOKEN_CSS_LENGTHS.space050;\n /** Cross-axis offset — number (px) or TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n /**\n * Hover show delay before the tooltip appears.\n * Default: `--effect-animation-delay-medium-3` (1000ms). Accepts a number (ms)\n * or a TokoMo time token / `var(--effect-animation-delay-*)`. Applies to the\n * initial hover/focus show only — after a recent dismiss, reopen is instant.\n * Prefer the default; override only for denser chrome or rare/destructive actions.\n */\n @Prop() delay: number | string = TOKEN_DEFAULTS.animationDelayMedium3;\n @Prop() shortcutKey: string | undefined;\n @Prop() shortcutKeyPosition: 'start' | 'end' = 'end';\n /**\n * Link the trigger with aria-describedby while the popup is open. Disable when\n * the label is already in the DOM, such as a truncated table cell.\n */\n @Prop() describedBy = true;\n /** Allow the label to wrap at a panel-xs max width instead of a single line. */\n @Prop() wrapLabel = false;\n\n private tooltipId = `ds-tooltip-${++tooltipIdCounter}`;\n private delayTimer: ReturnType<typeof setTimeout> | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private anchor: HTMLElement | null = null;\n private popupEl: HTMLElement | null = null;\n private anchorObserver: MutationObserver | null = null;\n private didLoad = false;\n private readonly position = new AnchoredPositionController({\n getAnchor: () => this.anchor,\n getPopup: () => this.popupEl,\n measure: (anchor, tip) => ({\n anchorRect: anchor.getBoundingClientRect(),\n // Fall back to token metrics until `ds-text` upgrades and reports a width.\n popupWidth: tip.offsetWidth || this.tooltipFallbackWidthPx,\n popupHeight: tip.offsetHeight || this.tooltipFallbackHeightPx,\n side: this.side,\n align: this.align,\n sideOffsetPx: this.sideOffsetPx,\n alignOffsetPx: this.alignOffsetPx,\n viewportPadPx: this.viewportPadPx,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n }),\n apply: ({ x, y, resolvedSide }) => {\n if (!this.popupEl) return;\n this.popupEl.dataset.side = resolvedSide;\n this.popupEl.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;\n },\n liveUpdate: 'frame',\n observeResize: true,\n });\n private skipEnterAnimation = false;\n private isOpen = false;\n private programmaticAnchor = false;\n private lastInteractionWasKeyboard = false;\n private pointerEnterHandler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return;\n this.show();\n };\n private pointerLeaveHandler = (event: PointerEvent) => {\n if (event.pointerType === 'touch') return;\n this.hide();\n };\n private pointerDownHandler = (event: PointerEvent) => {\n this.lastInteractionWasKeyboard = false;\n if (event.pointerType === 'touch' && (this.isOpen || this.popupEl)) this.hideInstant();\n };\n private keyDownHandler = () => {\n this.lastInteractionWasKeyboard = true;\n };\n /** focusin/focusout so nested focus targets (e.g. ds-button-* inner button) still open the tip. */\n private focusHandler = () => {\n if (this.lastInteractionWasKeyboard || this.anchor?.matches(':focus-visible')) this.show();\n };\n private blurHandler: (e: FocusEvent) => void = (e) => {\n const next = e.relatedTarget as Node | null;\n if (next && this.anchor?.contains(next)) return;\n this.hide();\n };\n private escapeHandler = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !this.isOpen) return;\n event.preventDefault();\n this.hide();\n };\n\n connectedCallback() {\n if (!this.didLoad) return;\n this.connectAnchor();\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.connectAnchor();\n }\n\n private connectAnchor() {\n this.bindAnchor();\n if (this.anchorObserver) return;\n this.anchorObserver = new MutationObserver(() => this.handleSlotChange());\n this.anchorObserver.observe(this.el, { childList: true });\n }\n\n disconnectedCallback() {\n if (activeTooltip === this) activeTooltip = null;\n this.anchorObserver?.disconnect();\n this.anchorObserver = null;\n this.unbindAnchor();\n this.clearTimers();\n this.destroyPopup();\n }\n\n @Watch('label')\n @Watch('size')\n @Watch('side')\n @Watch('align')\n @Watch('sideOffset')\n @Watch('alignOffset')\n @Watch('shortcutKey')\n @Watch('shortcutKeyPosition')\n @Watch('wrapLabel')\n onContentOrPositionChange() {\n if (!this.label?.trim()) {\n if (this.isOpen || this.popupEl) this.hideInstant();\n return;\n }\n if (!this.popupEl || !this.isOpen) return;\n this.renderPopupContent();\n this.schedulePosition();\n }\n\n private get viewportPadPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get sideOffsetPx(): number {\n return resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050);\n }\n\n private get alignOffsetPx(): number {\n return resolveCssLengthPx(this.alignOffset, 0);\n }\n\n private get hoverDelayMs(): number {\n return resolveCssTimeMs(this.delay, TOKEN_DEFAULTS.animationDelayMedium3);\n }\n\n private get instantReopenMs(): number {\n return resolveCssTimeMs(\n TOKEN_DEFAULTS.animationDurationMedium1,\n TOKEN_DEFAULTS.animationDurationMedium1,\n );\n }\n\n private get fadeOutMs(): number {\n return resolveMotionTimeMs(TOKEN_DEFAULTS.motionShort3, TOKEN_DEFAULTS.animationDurationShort3);\n }\n\n private get tooltipFallbackWidthPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.tooltipFallbackWidth, TOKEN_DEFAULTS.tooltipFallbackWidth);\n }\n\n private get tooltipFallbackHeightPx(): number {\n const token = FALLBACK_HEIGHT[this.size];\n return resolveCssLengthPx(token, token);\n }\n\n /**\n * Present against an external anchor the host already measured.\n * Does not bind hover or focus on that anchor — the owner drives show/hide.\n */\n @Method()\n async presentFrom(anchor: HTMLElement, label?: string) {\n if (label != null) this.label = label;\n if (!this.label?.trim()) {\n this.hide();\n return;\n }\n const sameAnchor = this.anchor === anchor;\n if (!sameAnchor) {\n this.unbindAnchor();\n this.anchor = anchor;\n this.programmaticAnchor = true;\n if (this.popupEl && this.describedBy) this.linkDescribedBy();\n }\n if (this.popupEl) {\n this.renderPopupContent();\n this.schedulePosition();\n return;\n }\n if (this.delayTimer && sameAnchor) return;\n this.show();\n }\n\n /** Dismiss a popup opened through presentFrom or the slotted trigger. */\n @Method()\n async dismiss() {\n this.hide();\n }\n\n private bindAnchor() {\n if (this.programmaticAnchor) return;\n const slot = this.el.querySelector('slot') as HTMLSlotElement | null;\n const slotted = slot?.assignedElements?.() ?? [];\n const child = (slotted[0] ?? this.el.firstElementChild) as HTMLElement | null;\n if (!child || child.tagName === 'SLOT' || child === this.anchor) return;\n this.anchor = child;\n child.addEventListener('pointerenter', this.pointerEnterHandler);\n child.addEventListener('pointerleave', this.pointerLeaveHandler);\n child.addEventListener('pointerdown', this.pointerDownHandler);\n child.addEventListener('keydown', this.keyDownHandler);\n child.addEventListener('focusin', this.focusHandler);\n child.addEventListener('focusout', this.blurHandler);\n }\n\n private unbindAnchor() {\n if (!this.anchor) return;\n this.unlinkDescribedBy();\n if (!this.programmaticAnchor) {\n this.anchor.removeEventListener('pointerenter', this.pointerEnterHandler);\n this.anchor.removeEventListener('pointerleave', this.pointerLeaveHandler);\n this.anchor.removeEventListener('pointerdown', this.pointerDownHandler);\n this.anchor.removeEventListener('keydown', this.keyDownHandler);\n this.anchor.removeEventListener('focusin', this.focusHandler);\n this.anchor.removeEventListener('focusout', this.blurHandler);\n }\n this.anchor = null;\n this.programmaticAnchor = false;\n }\n\n private linkDescribedBy() {\n if (!this.describedBy || !this.anchor || !this.popupEl) return;\n const ids = new Set((this.anchor.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter(Boolean));\n ids.add(this.tooltipId);\n this.anchor.setAttribute('aria-describedby', Array.from(ids).join(' '));\n }\n\n private unlinkDescribedBy() {\n if (!this.anchor) return;\n const ids = (this.anchor.getAttribute('aria-describedby') ?? '')\n .split(/\\s+/)\n .filter(id => id && id !== this.tooltipId);\n if (ids.length) this.anchor.setAttribute('aria-describedby', ids.join(' '));\n else this.anchor.removeAttribute('aria-describedby');\n }\n\n private handleSlotChange = () => {\n if (this.programmaticAnchor) return;\n const slot = this.el.querySelector('slot') as HTMLSlotElement | null;\n const next = (slot?.assignedElements?.()[0] ?? this.el.firstElementChild) as HTMLElement | null;\n if (next === this.anchor || next?.tagName === 'SLOT') return;\n if (this.isOpen || this.popupEl) this.hideInstant();\n this.unbindAnchor();\n this.bindAnchor();\n };\n\n private clearTimers() {\n if (this.delayTimer) { clearTimeout(this.delayTimer); this.delayTimer = null; }\n if (this.closeTimer) { clearTimeout(this.closeTimer); this.closeTimer = null; }\n }\n\n private setupOpenListeners() {\n // Binds scroll/resize + the resize observer; placement itself is scheduled\n // by schedulePosition() so the label restyle stays interleaved.\n this.position.observe();\n document.addEventListener('keydown', this.escapeHandler);\n }\n\n private teardownOpenListeners() {\n this.position.unobserve();\n document.removeEventListener('keydown', this.escapeHandler);\n }\n\n private destroyPopup() {\n this.teardownOpenListeners();\n this.unlinkDescribedBy();\n if (!this.popupEl) return;\n this.popupEl.remove();\n this.popupEl = null;\n }\n\n /**\n * Position after `ds-text` upgrades and lays out. Measuring synchronously in\n * `mountPopup` reads a collapsed/fallback width and places left/right tips wrong.\n */\n private schedulePosition() {\n if (!this.popupEl) return;\n\n const reapplyLabelStyles = () => {\n const label = this.popupEl?.querySelector(':scope > .tooltip-inner > ds-text');\n if (label instanceof HTMLElement) styleTooltipLabel(label, this.wrapLabel);\n };\n\n requestAnimationFrame(() => {\n reapplyLabelStyles();\n this.position.update();\n requestAnimationFrame(() => {\n reapplyLabelStyles();\n this.position.update();\n });\n });\n\n // The popup remounts on every show, so re-target the observer bound in start().\n this.position.observeResizeTargets();\n }\n\n /** Drop the open tip immediately (warm handoff to another tooltip). */\n private hideInstant() {\n this.clearTimers();\n lastDismissedAt = Date.now();\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n }\n\n private show() {\n // Empty label = wrapper present for DOM stability (e.g. PanelNav expand/collapse)\n // but no tip should appear.\n if (!this.label?.trim()) return;\n this.clearTimers();\n let instant = Date.now() - lastDismissedAt < this.instantReopenMs;\n if (activeTooltip && activeTooltip !== this) {\n activeTooltip.hideInstant();\n instant = true;\n }\n // eslint-disable-next-line @typescript-eslint/no-this-alias -- module singleton tracks the active instance\n activeTooltip = this;\n this.skipEnterAnimation = instant;\n if (instant) {\n this.mountPopup();\n return;\n }\n this.delayTimer = setTimeout(() => {\n this.delayTimer = null;\n if (!this.label?.trim()) return;\n this.mountPopup();\n }, this.hoverDelayMs);\n }\n\n private hide() {\n this.clearTimers();\n if (!this.popupEl && !this.isOpen) return;\n lastDismissedAt = Date.now();\n if (!this.popupEl) {\n this.isOpen = false;\n return;\n }\n this.popupEl.classList.remove('tooltip-popup--instant');\n this.popupEl.classList.add('tooltip-popup--closing');\n if (this.fadeOutMs === 0) {\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n return;\n }\n this.closeTimer = setTimeout(() => {\n this.closeTimer = null;\n if (activeTooltip === this) activeTooltip = null;\n this.destroyPopup();\n this.isOpen = false;\n this.skipEnterAnimation = false;\n }, this.fadeOutMs);\n }\n\n private mountPopup() {\n if (!this.popupEl) {\n const tip = document.createElement('div');\n tip.id = this.tooltipId;\n tip.setAttribute('role', 'tooltip');\n // `sc-ds-tooltip` is required for Stencil scoped CSS to match outside the host.\n tip.className = 'tooltip-popup ds-forced-colors-scope sc-ds-tooltip';\n Object.assign(tip.style, {\n position: 'fixed',\n left: '0',\n top: '0',\n zIndex: 'var(--dimension-z-index-tooltip)',\n pointerEvents: 'none',\n });\n document.body.appendChild(tip);\n this.popupEl = tip;\n }\n\n this.setupOpenListeners();\n this.linkDescribedBy();\n this.popupEl.classList.toggle('tooltip-popup--instant', this.skipEnterAnimation);\n this.popupEl.classList.toggle('tooltip-popup--wrap', this.wrapLabel);\n this.popupEl.classList.remove('tooltip-popup--closing');\n this.renderPopupContent();\n this.schedulePosition();\n this.isOpen = true;\n }\n\n private renderPopupContent() {\n if (!this.popupEl) return;\n this.popupEl.classList.toggle('tooltip-popup--wrap', this.wrapLabel);\n const textVariant = CONTROL_TEXT_VARIANT[this.size];\n const density =\n this.size === 'md' ? 'ds-control--md' : this.size === 'sm' ? 'ds-control--sm' : 'ds-control--xs';\n // Every layout node needs `sc-ds-tooltip` so scoped selectors (`.foo.sc-ds-tooltip`) match.\n const sc = 'sc-ds-tooltip';\n\n const inner = document.createElement('div');\n inner.className = `tooltip-inner ${density} ${sc}`;\n\n const appendShortcut = (position: 'start' | 'end') => {\n if (!this.shortcutKey || this.shortcutKeyPosition !== position) return;\n const group = document.createElement('span');\n group.className = `key-hint-group ${sc}`;\n group.setAttribute('aria-hidden', 'true');\n\n for (const label of shortcutKeyLabels(this.shortcutKey)) {\n const hint = document.createElement('span');\n const wide = Array.from(label).length > 1 ? ' key-hint--wide' : '';\n hint.className = `key-hint${wide} ${sc}`;\n const text = document.createElement('span');\n text.className = `key-hint__label ${sc}`;\n text.textContent = label;\n hint.appendChild(text);\n group.appendChild(hint);\n }\n inner.appendChild(group);\n };\n\n appendShortcut('start');\n\n // ds-text is the layout box (metric-box + 2px control label-inset).\n // Inline styles required — see styleTooltipLabel.\n const label = createDsText({\n variant: textVariant,\n wrap: this.wrapLabel ? 'wrap' : 'nowrap',\n text: this.label,\n });\n styleTooltipLabel(label, this.wrapLabel);\n inner.appendChild(label);\n\n appendShortcut('end');\n\n this.popupEl.replaceChildren(inner);\n }\n\n render() {\n return (\n <Host style={{ display: 'contents' }}>\n <slot onSlotchange={this.handleSlotChange} />\n </Host>\n );\n }\n}\n",
304
365
  "type": "registry:ui"
305
366
  }
306
367
  ]
@@ -3,7 +3,7 @@
3
3
  * Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
4
4
  */
5
5
  import type { EventName, StencilReactComponent } from './react-runtime.js';
6
- import { type DsMenuCustomEvent, type MenuItemData } from "@ds-mo/ui";
6
+ import { type DsMenuCustomEvent, type MenuItemData, type MenuReorderDetail } from "@ds-mo/ui";
7
7
  import type { Components } from "@ds-mo/ui/dist/components";
8
8
  import { DsMenu as DsMenuElement } from "@ds-mo/ui/dist/components/ds-menu.js";
9
9
  export type DsMenuEvents = {
@@ -11,5 +11,6 @@ export type DsMenuEvents = {
11
11
  onDsAfterClose: EventName<DsMenuCustomEvent<void>>;
12
12
  onDsSelect: EventName<DsMenuCustomEvent<MenuItemData>>;
13
13
  onDsSwatchSelect: EventName<DsMenuCustomEvent<string>>;
14
+ onDsReorder: EventName<DsMenuCustomEvent<MenuReorderDetail>>;
14
15
  };
15
16
  export declare const DsMenu: StencilReactComponent<DsMenuElement, DsMenuEvents, Components.DsMenu>;
@@ -11,7 +11,8 @@ export const DsMenu = /*@__PURE__*/ createComponent({
11
11
  onDsClose: 'dsClose',
12
12
  onDsAfterClose: 'dsAfterClose',
13
13
  onDsSelect: 'dsSelect',
14
- onDsSwatchSelect: 'dsSwatchSelect'
14
+ onDsSwatchSelect: 'dsSwatchSelect',
15
+ onDsReorder: 'dsReorder'
15
16
  },
16
17
  defineCustomElement: defineDsMenu
17
18
  });
@@ -3,7 +3,7 @@
3
3
  * Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
4
4
  */
5
5
  import type { EventName, StencilReactComponent } from './react-runtime.js';
6
- import { type DsTableCustomEvent, type PaginationChangeDetail, type TableCellActionDetail, type TableGroupCollapseChangeDetail, type TableGroupLoadMoreDetail, type TableLoadMoreDetail, type TableRowActivateDetail, type TableSelectionChangeDetail, type TableSortChangeDetail } from "@ds-mo/ui";
6
+ import { type DsTableCustomEvent, type PaginationChangeDetail, type TableCellActionDetail, type TableColumnsConfigChangeDetail, type TableGroupCollapseChangeDetail, type TableGroupLoadMoreDetail, type TableLoadMoreDetail, type TableRowActivateDetail, type TableSelectionChangeDetail, type TableSortChangeDetail } from "@ds-mo/ui";
7
7
  import type { Components } from "@ds-mo/ui/dist/components";
8
8
  import { DsTable as DsTableElement } from "@ds-mo/ui/dist/components/ds-table.js";
9
9
  export type DsTableEvents = {
@@ -15,5 +15,6 @@ export type DsTableEvents = {
15
15
  onDsPaginationChange: EventName<DsTableCustomEvent<PaginationChangeDetail>>;
16
16
  onDsCellAction: EventName<DsTableCustomEvent<TableCellActionDetail>>;
17
17
  onDsRowActivate: EventName<DsTableCustomEvent<TableRowActivateDetail>>;
18
+ onDsColumnsConfigChange: EventName<DsTableCustomEvent<TableColumnsConfigChangeDetail>>;
18
19
  };
19
20
  export declare const DsTable: StencilReactComponent<DsTableElement, DsTableEvents, Components.DsTable, 'caption'>;
@@ -15,7 +15,8 @@ export const DsTable = /*@__PURE__*/ createComponent({
15
15
  onDsGroupLoadMore: 'dsGroupLoadMore',
16
16
  onDsPaginationChange: 'dsPaginationChange',
17
17
  onDsCellAction: 'dsCellAction',
18
- onDsRowActivate: 'dsRowActivate'
18
+ onDsRowActivate: 'dsRowActivate',
19
+ onDsColumnsConfigChange: 'dsColumnsConfigChange'
19
20
  },
20
21
  defineCustomElement: defineDsTable
21
22
  });
@@ -25,6 +25,31 @@
25
25
  + var(--dimension-space-025)
26
26
  + var(--dimension-size-250)
27
27
  );
28
+ /*
29
+ * Wrapping primary on a 1-track cell occupies later tracks instead of a
30
+ * private leading scale. Keep body-medium size; add the 2px stack gap to
31
+ * line-height and leave the leftover first-track inset as padding-block
32
+ * so 1 / 2 / 3 wrapped lines measure 40 / 62 / 84 like named tracks.
33
+ */
34
+ --_table-wrap-primary-line-height: calc(
35
+ var(--typography-lineheight-md) + var(--dimension-space-025)
36
+ );
37
+ --_table-wrap-primary-padding-block: calc(
38
+ (
39
+ var(--_table-cell-track-min-block-size)
40
+ - var(--typography-lineheight-md)
41
+ - var(--dimension-space-025)
42
+ ) / 2
43
+ );
44
+ /*
45
+ * Wrapping secondary on a 2-track cell occupies later tracks. Zero the copy
46
+ * gap and use later-track + gap as line-height so 1 / 2 / 3 secondary lines
47
+ * land on 62 / 84 / 106 with primary remaining the first 24px track.
48
+ */
49
+ --_table-wrap-secondary-line-height: calc(
50
+ var(--dimension-size-250) + var(--dimension-space-025)
51
+ );
52
+ --_table-wrap-secondary-padding-block: 0;
28
53
  --_table-surface: var(--ds-table-surface, var(--color-background-primary));
29
54
  --_table-header-surface: var(--ds-table-header-surface, var(--color-background-primary));
30
55
  --_table-group-surface: var(--ds-table-group-surface, var(--color-background-faint-neutral));
@@ -260,7 +285,28 @@
260
285
  max-inline-size: 100%;
261
286
  }
262
287
 
263
- :where(.ds-table__caption-content > slot) {
288
+ :where(.ds-table__caption-content--trailing) {
289
+ grid-template-columns: minmax(0, 1fr) auto;
290
+ column-gap: var(--dimension-space-100);
291
+ }
292
+
293
+ :where(.ds-table__caption-trailing) {
294
+ display: flex;
295
+ align-items: center;
296
+ flex: 0 0 auto;
297
+ min-inline-size: 0;
298
+ gap: var(--dimension-space-100);
299
+ }
300
+
301
+ :where(.ds-table__caption-leading) {
302
+ display: grid;
303
+ grid-template-columns: minmax(0, 1fr);
304
+ align-items: center;
305
+ min-inline-size: 0;
306
+ max-inline-size: 100%;
307
+ }
308
+
309
+ :where(.ds-table__caption-leading > slot) {
264
310
  display: contents;
265
311
  }
266
312
 
@@ -795,7 +841,11 @@
795
841
  * checkbox) sits in a 24px track (2px block inset). Text tracks keep that
796
842
  * 2px plus the 2px label inset, so padding-inline is 4px and copy lines up
797
843
  * with column-header labels. Later body-small tracks stay 20px, stacked with
798
- * a 2px gap. Header and group rows keep their own recipes.
844
+ * a 2px gap. Wrapping 1-track primary folds that gap into line-height so
845
+ * extra lines land on the same 62px and 84px rows as 2- and 3-track cells.
846
+ * Wrapping secondary keeps primary on track 1 and consumes later tracks the
847
+ * same way, including a 106px fourth track when secondary wraps to three lines.
848
+ * Header and group rows keep their own recipes.
799
849
  */
800
850
  :where(.ds-table__cell-primary),
801
851
  :where(.ds-table__cell--empty .ds-table__cell-track) {
@@ -970,6 +1020,35 @@
970
1020
  overflow-wrap: anywhere;
971
1021
  }
972
1022
 
1023
+ /*
1024
+ * Wrapping tracks must be block boxes so ds-text line-clamp (a -webkit-box
1025
+ * inner) can grow onto later tracks. Flex + line-clamp otherwise collapses
1026
+ * to the 40px single-track row.
1027
+ */
1028
+ :where(.ds-table__cell--text-wrap .ds-table__cell-track--text),
1029
+ :where(.ds-table__cell--icon-text-wrap .ds-table__cell-track--text) {
1030
+ display: block;
1031
+ }
1032
+
1033
+ :where(.ds-table__cell--text-wrap.ds-table__cell--text-single .ds-table__cell-primary),
1034
+ :where(.ds-table__cell--text-wrap.ds-table__cell--text-multi .ds-table__cell-primary),
1035
+ :where(.ds-table__cell--icon-text-wrap.ds-table__cell--icon-text-single .ds-table__cell-primary),
1036
+ :where(.ds-table__cell--icon-text-wrap.ds-table__cell--icon-text-multi .ds-table__cell-primary) {
1037
+ line-height: var(--_table-wrap-primary-line-height);
1038
+ padding-block: var(--_table-wrap-primary-padding-block);
1039
+ }
1040
+
1041
+ :where(.ds-table__cell--text-wrap.ds-table__cell--text-multi .ds-table__cell-copy),
1042
+ :where(.ds-table__cell--icon-text-wrap.ds-table__cell--icon-text-multi .ds-table__cell-copy) {
1043
+ gap: 0;
1044
+ }
1045
+
1046
+ :where(.ds-table__cell--text-wrap.ds-table__cell--text-multi .ds-table__cell-secondary),
1047
+ :where(.ds-table__cell--icon-text-wrap.ds-table__cell--icon-text-multi .ds-table__cell-secondary) {
1048
+ line-height: var(--_table-wrap-secondary-line-height);
1049
+ padding-block: var(--_table-wrap-secondary-padding-block);
1050
+ }
1051
+
973
1052
  :where(.ds-table__cell--align-center),
974
1053
  :where(.ds-table__cell--align-center .ds-table__cell-content),
975
1054
  :where(.ds-table__cell--align-center .ds-table__cell-track),
@@ -76,8 +76,10 @@ export declare class ButtonUnfilled {
76
76
  *
77
77
  * - `label` / `icon-label` — the action *has* a menu; a trailing chevron carries
78
78
  * the affordance.
79
- * - `icon` — the button *is* a menu, i.e. the overflow / more-options control.
80
- * No chevron is added, so the glyph must convey it on its own; use `Ellipses`.
79
+ * - `icon` — the button *is* a menu. No chevron is added, so the glyph must
80
+ * convey the menu on its own. Use `Ellipses` for generic more-options;
81
+ * use a specific icon when the menu has a named purpose, such as
82
+ * `Preferences` for Customize table.
81
83
  *
82
84
  * Use `haspopup` directly for non-menu popups.
83
85
  */
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import { type ChoicePopupAnchorAlignment, type ControlSize } from '../../utils';
3
3
  import type { MenuAlign, MenuSide } from './menu-position';
4
- import { type MenuItemData, type MenuSection } from './menu-types';
4
+ import { type MenuItemData, type MenuReorderDetail, type MenuSection } from './menu-types';
5
5
  export type MenuSelectionMode = 'none' | 'single';
6
6
  export type MenuSize = ControlSize;
7
7
  export declare class Menu {
@@ -38,14 +38,22 @@ export declare class Menu {
38
38
  private focusedIndex;
39
39
  private positionReady;
40
40
  private focusRingVisible;
41
+ private reorderFromFlat;
42
+ private reorderInsertBefore;
43
+ private reorderAnnouncement;
41
44
  dsClose: EventEmitter<void>;
42
45
  /** Emitted after the popup's exit motion is complete and its rendered content is removed. */
43
46
  dsAfterClose: EventEmitter<void>;
44
47
  dsSelect: EventEmitter<MenuItemData>;
45
48
  /** Emitted when a generic `swatch-picker` section option is chosen. */
46
49
  dsSwatchSelect: EventEmitter<string>;
50
+ /** Emitted after a pointer drop or keyboard move; Menu never mutates item order. */
51
+ dsReorder: EventEmitter<MenuReorderDetail>;
47
52
  private clickOutsideHandler;
48
53
  private closeTimer;
54
+ private positionReadyCallback;
55
+ private suppressItemClick;
56
+ private reorderPointer;
49
57
  /**
50
58
  * Anchored placement. The choice-cell measurement stays here on purpose: the
51
59
  * inner-cell align offset and the `--dimension-menu-width-xs` floor are Menu
@@ -94,6 +102,16 @@ export declare class Menu {
94
102
  private focusItem;
95
103
  private handleItemClick;
96
104
  private handleSwatchSelect;
105
+ private handleReorderKey;
106
+ private emitReorder;
107
+ private flatIndexFor;
108
+ private announceReorder;
109
+ private onReorderPointerDown;
110
+ private onReorderPointerMove;
111
+ private onReorderPointerUp;
112
+ private onReorderPointerCancel;
113
+ private resolveReorderInsertBefore;
114
+ private clearReorderPointer;
97
115
  render(): any;
98
116
  }
99
117
  //# sourceMappingURL=Menu.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { type MenuItemData, type MenuReorderDetail, type MenuSection } from './menu-types';
2
+ export interface MenuReorderRange {
3
+ start: number;
4
+ end: number;
5
+ }
6
+ /** Contiguous reorderable run containing `index`, or null when that row cannot move. */
7
+ export declare function menuReorderableRange(items: readonly MenuItemData[], index: number): MenuReorderRange | null;
8
+ /**
9
+ * Move a reorderable row so it would be inserted before `insertBefore`.
10
+ * `insertBefore` is clamped to the contiguous reorderable run.
11
+ */
12
+ export declare function moveReorderableMenuItemBefore(items: readonly MenuItemData[], fromIndex: number, insertBefore: number): MenuItemData[] | null;
13
+ /** Keyboard step: move one slot within the reorderable run. */
14
+ export declare function moveReorderableMenuItemBy(items: readonly MenuItemData[], fromIndex: number, offset: number): MenuItemData[] | null;
15
+ export declare function locateMenuItem(sections: readonly MenuSection[], flatIndex: number): {
16
+ sectionIndex: number;
17
+ itemIndex: number;
18
+ items: MenuItemData[];
19
+ } | null;
20
+ export declare function createMenuReorderDetail(items: MenuItemData[], fromIndex: number, nextItems: MenuItemData[], sectionIndex: number): MenuReorderDetail | null;
21
+ //# sourceMappingURL=menu-reorder.d.ts.map
@@ -12,6 +12,8 @@ export interface MenuItemData {
12
12
  label: string;
13
13
  value?: string;
14
14
  subtext?: string;
15
+ /** Leading decorative icon. Ignored when `reorderable` is true. */
16
+ icon?: string;
15
17
  /** Show a supplemental brand notification dot. */
16
18
  dot?: boolean;
17
19
  /** Show a non-interactive tag at the trailing edge of the row. */
@@ -22,6 +24,16 @@ export interface MenuItemData {
22
24
  /** Render a compact switch indicator; the menu row owns interaction. */
23
25
  showSwitch?: boolean;
24
26
  switchValue?: boolean;
27
+ /** Prefix a drag handle and allow pointer and keyboard reorder within the contiguous reorderable run. */
28
+ reorderable?: boolean;
29
+ }
30
+ /** Next section item order after a pointer or keyboard reorder. */
31
+ export interface MenuReorderDetail {
32
+ item: MenuItemData;
33
+ fromIndex: number;
34
+ toIndex: number;
35
+ sectionIndex: number;
36
+ items: MenuItemData[];
25
37
  }
26
38
  export interface MenuItemsSection {
27
39
  header?: string;
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import type { PaginationChangeDetail } from '../Pagination/pagination-types';
3
- import type { TableCaptionVisibility, TableCellActionDetail, TableColumn, TableDataMode, TableGroup, TableGroupCollapseChangeDetail, TableGroupLoadMoreDetail, TableGroupingState, TableLoadMoreDetail, TableLoadMoreMode, TablePaginationState, TableRow, TableRowActivateDetail, TableSelectionChangeDetail, TableSelectionMode, TableSortChangeDetail, TableSortState } from './table-types';
3
+ import type { TableCaptionVisibility, TableCellActionDetail, TableColumn, TableColumnsConfigChangeDetail, TableDataMode, TableGroup, TableGroupCollapseChangeDetail, TableGroupLoadMoreDetail, TableGroupingState, TableLoadMoreDetail, TableLoadMoreMode, TablePaginationState, TableRow, TableRowActivateDetail, TableSelectionChangeDetail, TableSelectionMode, TableSortChangeDetail, TableSortState } from './table-types';
4
4
  export declare class Table {
5
5
  el: HTMLElement;
6
6
  /** Stable column definitions. Assign through JavaScript. */
@@ -19,6 +19,16 @@ export declare class Table {
19
19
  caption: string;
20
20
  /** Shows a matching presentational title bar above the native table frame. */
21
21
  captionVisibility: TableCaptionVisibility;
22
+ /**
23
+ * Opt in to the table-owned column customizer. The `columns` prop remains the
24
+ * catalog; hidden and ordered columns are controlled separately. The trigger
25
+ * opens the shared Menu of live show/hide switch rows.
26
+ */
27
+ columnCustomizer: boolean;
28
+ /** Controlled hidden data-column identities. Action ids are ignored. */
29
+ hiddenColumnIds: string[];
30
+ /** Controlled data-column identities in display order. Omitted ids append in catalog order. */
31
+ columnOrder: string[];
22
32
  /**
23
33
  * Optional result summary footer. When both `displayedCount` and `totalCount`
24
34
  * are finite numbers, the table shows “Displaying {displayed} of {total}”.
@@ -91,6 +101,7 @@ export declare class Table {
91
101
  dsPaginationChange: EventEmitter<PaginationChangeDetail>;
92
102
  dsCellAction: EventEmitter<TableCellActionDetail>;
93
103
  dsRowActivate: EventEmitter<TableRowActivateDetail>;
104
+ dsColumnsConfigChange: EventEmitter<TableColumnsConfigChangeDetail>;
94
105
  private overflowStart;
95
106
  private overflowEnd;
96
107
  private scrollable;
@@ -99,6 +110,16 @@ export declare class Table {
99
110
  private viewportFitSettled;
100
111
  private headerPresent;
101
112
  private fitPageSize;
113
+ private actionMenu;
114
+ private actionMenuInitialFocusVisible;
115
+ private truncateTooltipLabel;
116
+ private columnCustomizerOpen;
117
+ private columnCustomizerInitialFocusVisible;
118
+ private readonly actionMenuElementId;
119
+ private readonly columnCustomizerElementId;
120
+ private truncateTooltipEl?;
121
+ private truncateAnchor;
122
+ private truncateTooltipBound;
102
123
  private rootEl;
103
124
  private viewportEl;
104
125
  private frameEl;
@@ -142,9 +163,13 @@ export declare class Table {
142
163
  handleLoadingMoreChange(loading: boolean): void;
143
164
  handleLoadMoreErrorChange(error: string | undefined): void;
144
165
  handleHasMoreChange(hasMore: boolean, hadMore: boolean): void;
166
+ handleColumnCustomizerAvailability(): void;
145
167
  private get grouped();
146
168
  private get hasIncrementalState();
147
169
  private get selectable();
170
+ private get visibleColumns();
171
+ private get showsColumnCustomizer();
172
+ private get showsCaptionTrailing();
148
173
  private get documentStickyHeader();
149
174
  private get fixedHeight();
150
175
  private get boundedComposition();
@@ -166,6 +191,21 @@ export declare class Table {
166
191
  private emitGroupSelection;
167
192
  private rowEventOwnsActivation;
168
193
  private emitRowActivation;
194
+ private syncActionMenu;
195
+ private closeActionMenu;
196
+ private handleActionMenuSelect;
197
+ private toggleActionMenu;
198
+ private renderOverflowActionMenu;
199
+ private connectTruncateTooltip;
200
+ private disconnectTruncateTooltip;
201
+ private onTruncatePointerOver;
202
+ private onTruncatePointerOut;
203
+ private onTruncateFocusIn;
204
+ private onTruncateFocusOut;
205
+ private presentOrDismissTruncateTrack;
206
+ private dismissTruncateTooltip;
207
+ private renderTruncateTooltip;
208
+ private truncateAttr;
169
209
  private handleRowKeydown;
170
210
  private renderSelectionControl;
171
211
  private renderStickyEdge;
@@ -195,6 +235,15 @@ export declare class Table {
195
235
  private get hasResultFooter();
196
236
  private renderResultFooter;
197
237
  private renderCaptionBar;
238
+ private renderCaptionTrailing;
239
+ private renderColumnCustomizerTrigger;
240
+ private renderColumnCustomizerMenu;
241
+ private toggleColumnCustomizer;
242
+ private openColumnCustomizer;
243
+ private closeColumnCustomizer;
244
+ private emitColumnsConfigChange;
245
+ private handleColumnCustomizerReorder;
246
+ private handleColumnCustomizerSelect;
198
247
  render(): any;
199
248
  }
200
249
  //# sourceMappingURL=Table.d.ts.map
@@ -1,2 +1,2 @@
1
- export type { TableCaptionVisibility, TableCellAlign, TableCellAction, TableCellActionDetail, TableCellBlank, TableCellEmpty, TableCellLinkTarget, TableCellIcon, TableCellIconText, TableCellImage, TableCellImageTracks, TableCellPrimaryText, TableCellSkeleton, TableCellText, TableCellTextRun, TableCellTextTrack, TableCellTag, TableCellTagVariant, TableCellValue, TableSkeletonWidth, TableColumn, TableColumnSticky, TableColumnWidth, TableDataMode, TableGroup, TableGroupCollapseChangeDetail, TableGroupLoadMoreDetail, TableGroupIntent, TableHeaderSegment, TableGroupingState, TableLoadMoreDetail, TableLoadMoreMode, TableLoadMoreReason, TablePaginationState, TableRow, TableRowActivateDetail, TableSelectionChangeDetail, TableSelectionMode, TableSortChangeDetail, TableSortDirection, TableSortState, } from './table-types';
1
+ export type { TableCaptionVisibility, TableCellAlign, TableCellAction, TableCellActionDetail, TableCellActionDivider, TableCellActionMenuEntry, TableCellActionMenuItem, TableCellBlank, TableCellEmpty, TableCellLinkTarget, TableCellIcon, TableCellIconText, TableCellImage, TableCellImageTracks, TableCellPrimaryText, TableCellSkeleton, TableCellText, TableCellTextRun, TableCellTextTrack, TableCellTag, TableCellTagVariant, TableCellValue, TableSkeletonWidth, TableColumn, TableColumnsConfigChangeDetail, TableColumnSticky, TableColumnWidth, TableDataMode, TableGroup, TableGroupCollapseChangeDetail, TableGroupLoadMoreDetail, TableGroupIntent, TableHeaderSegment, TableGroupingState, TableLoadMoreDetail, TableLoadMoreMode, TableLoadMoreReason, TablePaginationState, TableRow, TableRowActivateDetail, TableSelectionChangeDetail, TableSelectionMode, TableSortChangeDetail, TableSortDirection, TableSortState, } from './table-types';
2
2
  //# sourceMappingURL=index.d.ts.map