@ds-mo/ui 9.0.0 → 9.1.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.
- package/README.md +28 -0
- package/dist/.build-stamp +1 -1
- package/dist/agent-patterns.json +233 -0
- package/dist/agent.json +155 -19
- package/dist/angular/ds-menu.d.ts +6 -1
- package/dist/angular/ds-menu.js +7 -4
- package/dist/angular/ds-swatch-picker.d.ts +15 -0
- package/dist/angular/ds-swatch-picker.js +42 -0
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +1 -0
- package/dist/angular/proxies.d.ts +1 -0
- package/dist/angular/proxies.js +1 -0
- package/dist/components/ds-app-shell.js +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-nav.js.map +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-panel-nav.js +1 -1
- package/dist/components/ds-panel-nav.js.map +1 -1
- package/dist/components/ds-select-multi.js +1 -1
- package/dist/components/ds-select-multi.js.map +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-select.js.map +1 -1
- package/dist/components/ds-shell-gradient-picker.js +1 -1
- package/dist/components/ds-shell-gradient-picker.js.map +1 -1
- package/dist/components/ds-shell-gradient-swatch.js +1 -1
- package/dist/components/ds-shell-gradient-swatch.js.map +1 -1
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-slider.js.map +1 -1
- package/dist/components/ds-swatch-picker.d.ts +11 -0
- package/dist/components/ds-swatch-picker.js +2 -0
- package/dist/components/ds-swatch-picker.js.map +1 -0
- package/dist/components/ds-tooltip-data-viz.js +1 -1
- package/dist/components/p-D1HFMTdC.js +2 -0
- package/dist/components/p-D1HFMTdC.js.map +1 -0
- package/dist/components/p-HBIxvS5C.js +2 -0
- package/dist/components/p-HBIxvS5C.js.map +1 -0
- package/dist/components/p-l6PmnW_P.js +2 -0
- package/dist/components/p-l6PmnW_P.js.map +1 -0
- package/dist/components/p-tQ1QHeOE.js +2 -0
- package/dist/components/p-tQ1QHeOE.js.map +1 -0
- package/dist/docs/components.json +268 -30
- package/dist/lib/components/Menu/menu-placement.d.ts +6 -3
- package/dist/lib/shell/index.d.ts +2 -2
- package/dist/lib/shell/index.js +40 -39
- package/dist/lib/shell/index.js.map +3 -3
- package/dist/lib/shell/shell-gradient-presets.d.ts +15 -0
- package/dist/lib/utils/choice-popup-alignment.d.ts +20 -0
- package/dist/lib/utils/index.d.ts +2 -0
- package/dist/lib/utils/index.js +16 -0
- package/dist/lib/utils/index.js.map +3 -3
- package/dist/mcp/cli.js +31409 -0
- package/dist/mcp-data/registry/app-shell.json +210 -0
- package/dist/mcp-data/registry/badge.json +289 -0
- package/dist/mcp-data/registry/banner.json +206 -0
- package/dist/mcp-data/registry/bar-nav.json +341 -0
- package/dist/mcp-data/registry/button-filled.json +386 -0
- package/dist/mcp-data/registry/button-unfilled.json +537 -0
- package/dist/mcp-data/registry/card-data-viz-donut.json +143 -0
- package/dist/mcp-data/registry/card-setting.json +194 -0
- package/dist/mcp-data/registry/card-shell-data-viz.json +173 -0
- package/dist/mcp-data/registry/card.json +126 -0
- package/dist/mcp-data/registry/chart-bar.json +121 -0
- package/dist/mcp-data/registry/chart-donut.json +257 -0
- package/dist/mcp-data/registry/chart-legend.json +209 -0
- package/dist/mcp-data/registry/chart-line.json +153 -0
- package/dist/mcp-data/registry/checkbox.json +361 -0
- package/dist/mcp-data/registry/chip.json +276 -0
- package/dist/mcp-data/registry/divider.json +225 -0
- package/dist/mcp-data/registry/empty-state.json +197 -0
- package/dist/mcp-data/registry/field.json +222 -0
- package/dist/mcp-data/registry/icon.json +242 -0
- package/dist/mcp-data/registry/input.json +597 -0
- package/dist/mcp-data/registry/loader.json +192 -0
- package/dist/mcp-data/registry/menu.json +459 -0
- package/dist/mcp-data/registry/modal.json +150 -0
- package/dist/mcp-data/registry/panel-nav.json +622 -0
- package/dist/mcp-data/registry/panel-sub-nav.json +249 -0
- package/dist/mcp-data/registry/panel-tools.json +374 -0
- package/dist/mcp-data/registry/radio.json +374 -0
- package/dist/mcp-data/registry/registry.json +5389 -0
- package/dist/mcp-data/registry/select-multi.json +755 -0
- package/dist/mcp-data/registry/select.json +740 -0
- package/dist/mcp-data/registry/shell-gradient-picker.json +195 -0
- package/dist/mcp-data/registry/shell-gradient-swatch.json +215 -0
- package/dist/mcp-data/registry/skeleton.json +282 -0
- package/dist/mcp-data/registry/slider.json +657 -0
- package/dist/mcp-data/registry/swatch-picker.json +231 -0
- package/dist/mcp-data/registry/switch.json +361 -0
- package/dist/mcp-data/registry/tab-group.json +255 -0
- package/dist/mcp-data/registry/tag.json +352 -0
- package/dist/mcp-data/registry/text.json +371 -0
- package/dist/mcp-data/registry/tooltip-data-viz.json +158 -0
- package/dist/mcp-data/registry/tooltip.json +311 -0
- package/dist/react/components.d.ts +1 -0
- package/dist/react/components.js +1 -0
- package/dist/react/ds-menu.d.ts +1 -0
- package/dist/react/ds-menu.js +2 -1
- package/dist/react/ds-swatch-picker.d.ts +12 -0
- package/dist/react/ds-swatch-picker.js +12 -0
- package/dist/types/components/Menu/Menu.d.ts +7 -1
- package/dist/types/components/Menu/menu-placement.d.ts +6 -3
- package/dist/types/components/Menu/menu-types.d.ts +14 -1
- package/dist/types/components/ShellGradientPicker/ShellGradientPicker.d.ts +2 -5
- package/dist/types/components/ShellGradientSwatch/ShellGradientSwatch.d.ts +1 -0
- package/dist/types/components/SwatchPicker/SwatchPicker.d.ts +21 -0
- package/dist/types/components/SwatchPicker/swatch-picker-types.d.ts +26 -0
- package/dist/types/components.d.ts +117 -0
- package/dist/types/shell/index.d.ts +2 -2
- package/dist/types/shell/shell-gradient-presets.d.ts +15 -0
- package/dist/types/utils/choice-popup-alignment.d.ts +21 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +6 -2
- package/dist/components/p-Bafp65bw.js +0 -2
- package/dist/components/p-Bafp65bw.js.map +0 -1
- package/dist/components/p-BdnR3jxi.js +0 -2
- package/dist/components/p-BdnR3jxi.js.map +0 -1
- package/dist/components/p-C_cu-HIT.js +0 -2
- package/dist/components/p-C_cu-HIT.js.map +0 -1
- package/dist/components/p-D0B9uDTP.js +0 -2
- package/dist/components/p-D0B9uDTP.js.map +0 -1
- package/dist/components/p-DF0yLZG_.js +0 -2
- package/dist/components/p-DF0yLZG_.js.map +0 -1
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "text",
|
|
4
|
+
"title": "Text",
|
|
5
|
+
"description": "Semantic plain UI text with atomic tokenized typography recipes, measurable line boxes, and composition-owned wrapping and truncation.",
|
|
6
|
+
"type": "registry:ui",
|
|
7
|
+
"meta": {
|
|
8
|
+
"library": "@ds-mo/ui",
|
|
9
|
+
"distribution": "npm",
|
|
10
|
+
"storybook": "https://zainadeel.github.io/compomo/?path=/story/text",
|
|
11
|
+
"source": "src/wc/components/Text/Text.tsx",
|
|
12
|
+
"intentStatus": "complete",
|
|
13
|
+
"intent": {
|
|
14
|
+
"audience": "general",
|
|
15
|
+
"status": "stable",
|
|
16
|
+
"summary": "Semantic plain UI text with atomic tokenized typography recipes, measurable line boxes, and composition-owned wrapping and truncation.",
|
|
17
|
+
"useWhen": [
|
|
18
|
+
"Plain UI text needs a complete design-system typography recipe.",
|
|
19
|
+
"Headings, paragraphs, labels, or inline phrasing need native HTML semantics independent from their visual scale.",
|
|
20
|
+
"A component needs a stable measurable text box aligned to shared typography metrics.",
|
|
21
|
+
"Changing numeric values need tabular glyph widths."
|
|
22
|
+
],
|
|
23
|
+
"avoidWhen": [
|
|
24
|
+
"Content is markdown, rich prose, or an arbitrary nested document structure.",
|
|
25
|
+
"The element is interactive; use the correct native or design-system control and compose Text only for its label.",
|
|
26
|
+
"Individual font metrics must be overridden instead of selecting an existing complete variant.",
|
|
27
|
+
"Typography alone would be used to repair an incorrect heading hierarchy."
|
|
28
|
+
],
|
|
29
|
+
"alternatives": [
|
|
30
|
+
{
|
|
31
|
+
"when": "Predictable text geometry is pending while content loads.",
|
|
32
|
+
"component": "component:ds-skeleton",
|
|
33
|
+
"reason": "Skeleton owns aria-hidden loading geometry aligned to Text line metrics."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"when": "Compact static metadata or semantic status needs a contained treatment.",
|
|
37
|
+
"component": "component:ds-tag",
|
|
38
|
+
"reason": "Tag owns compact labelled metadata and intent surfaces."
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"commonlyComposedWith": [
|
|
42
|
+
"component:ds-icon",
|
|
43
|
+
"component:ds-card",
|
|
44
|
+
"component:ds-field",
|
|
45
|
+
"component:ds-button-filled"
|
|
46
|
+
],
|
|
47
|
+
"accessibility": [
|
|
48
|
+
"Choose the native element from document meaning and hierarchy; choose the visual variant independently.",
|
|
49
|
+
"Composition authors preserve logical h1–h6 order regardless of visual size.",
|
|
50
|
+
"Visible content and the selected native element provide accessible meaning; avoid redundant roles and labels.",
|
|
51
|
+
"Use label semantics and its for association only for a real form control.",
|
|
52
|
+
"When truncating essential content, the owner provides an accessible way to obtain the omitted text.",
|
|
53
|
+
"Tertiary and quaternary foregrounds are restricted to text inside genuinely inactive or disabled UI, or to purely decorative content whose removal would not change meaning; quaternary is the fainter tier, and aria-hidden alone does not exempt meaningful visible text from contrast requirements.",
|
|
54
|
+
"Underline link text by default. Brand-blue links may omit the resting underline when color already supplies the affordance.",
|
|
55
|
+
"Use dotted underline for hidden or supplemental interaction such as a tooltip; the owning trigger must provide focus, keyboard interaction, and accessible tooltip semantics."
|
|
56
|
+
],
|
|
57
|
+
"states": [
|
|
58
|
+
"A variant is atomic: font size, line height, weight, and letter spacing stay together and are not overridden by consumers.",
|
|
59
|
+
"Emphasis selects the supported stronger recipe for local hierarchy; it does not independently mean selected or active.",
|
|
60
|
+
"Omitted color inherits currentColor. Explicit semantic aliases or CSS-variable references are used only when Text has an independent color role.",
|
|
61
|
+
"Prefer the owning control's isInactive or native disabled state over manually selecting tertiary or quaternary so visual treatment and inactive semantics remain synchronized.",
|
|
62
|
+
"Line truncation and wrapping require an owner-supplied width constraint and content-aware composition decision.",
|
|
63
|
+
"Solid underline is the default link affordance; brand-blue links may omit it at rest. Dotted underline communicates hidden or supplemental interaction such as a tooltip. Decoration does not make Text interactive by itself.",
|
|
64
|
+
"Tabular numbers are for changing numeric values or aligned numeric columns where stable glyph width matters.",
|
|
65
|
+
"Shimmer is reserved for visible generating/loading status text whose owner provides status semantics; reduced motion keeps static readable text."
|
|
66
|
+
],
|
|
67
|
+
"responsiveBehavior": [
|
|
68
|
+
"The composition owns width, wrapping, truncation, alignment, and any responsive variant change.",
|
|
69
|
+
"Text preserves complete token recipes and does not scale fluidly or infer breakpoints."
|
|
70
|
+
],
|
|
71
|
+
"frameworkCaveats": {
|
|
72
|
+
"customElements": [
|
|
73
|
+
"Set as explicitly for inline text, headings, and labels; omitted as renders a paragraph."
|
|
74
|
+
],
|
|
75
|
+
"react": [
|
|
76
|
+
"Keep semantic as choices aligned with the rendered document hierarchy rather than component styling."
|
|
77
|
+
],
|
|
78
|
+
"angular": [
|
|
79
|
+
"Use the for prop only when Text renders a label associated with a real control ID."
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"references": [
|
|
83
|
+
{
|
|
84
|
+
"label": "Storybook examples",
|
|
85
|
+
"path": "src/wc/components/Text/Text.stories.ts"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"label": "Typography contract",
|
|
89
|
+
"path": "AGENTS.md"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"api": {
|
|
94
|
+
"props": {
|
|
95
|
+
"align": {
|
|
96
|
+
"type": "TextAlign | undefined",
|
|
97
|
+
"resolvedType": "\"center\" | \"left\" | \"right\" | undefined",
|
|
98
|
+
"attribute": "align",
|
|
99
|
+
"required": false,
|
|
100
|
+
"mutable": false
|
|
101
|
+
},
|
|
102
|
+
"as": {
|
|
103
|
+
"type": "TextElement",
|
|
104
|
+
"resolvedType": "\"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\" | \"p\" | \"span\"",
|
|
105
|
+
"attribute": "as",
|
|
106
|
+
"default": "'p'",
|
|
107
|
+
"required": false,
|
|
108
|
+
"mutable": false
|
|
109
|
+
},
|
|
110
|
+
"color": {
|
|
111
|
+
"type": "TextColor",
|
|
112
|
+
"resolvedType": "\"ai\" | \"brand\" | \"caution\" | \"inherit\" | \"negative\" | \"on-bold\" | \"on-strong\" | \"positive\" | \"primary\" | \"quaternary\" | \"secondary\" | \"tertiary\" | \"warning\" | `var(--${string})`",
|
|
113
|
+
"attribute": "color",
|
|
114
|
+
"default": "'inherit'",
|
|
115
|
+
"required": false,
|
|
116
|
+
"mutable": false,
|
|
117
|
+
"description": "Semantic foreground color token or CSS variable. `tertiary` and the\nstill-fainter `quaternary` are restricted to genuinely inactive/disabled\nUI content or purely decorative content; prefer the owning control's\ninactive state whenever one exists."
|
|
118
|
+
},
|
|
119
|
+
"decoration": {
|
|
120
|
+
"type": "TextDecoration | undefined",
|
|
121
|
+
"resolvedType": "\"dotted-underline\" | \"none\" | \"underline\" | undefined",
|
|
122
|
+
"attribute": "decoration",
|
|
123
|
+
"required": false,
|
|
124
|
+
"mutable": false,
|
|
125
|
+
"description": "Link underline or dotted hidden-interaction affordance; does not add semantics."
|
|
126
|
+
},
|
|
127
|
+
"emphasis": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"resolvedType": "boolean",
|
|
130
|
+
"attribute": "emphasis",
|
|
131
|
+
"default": "false",
|
|
132
|
+
"required": false,
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"description": "Heavier weight + tighter letter-spacing for the variant.\n`false` (default): one step below emphasis (display semibold, title/body\nmedium, caption medium).\n`true`: display bold, title/caption semibold, body medium."
|
|
135
|
+
},
|
|
136
|
+
"fontFeature": {
|
|
137
|
+
"type": "TextFontFeature",
|
|
138
|
+
"resolvedType": "\"normal\" | \"tabular-nums\"",
|
|
139
|
+
"attribute": "font-feature",
|
|
140
|
+
"default": "'normal'",
|
|
141
|
+
"required": false,
|
|
142
|
+
"mutable": false
|
|
143
|
+
},
|
|
144
|
+
"for": {
|
|
145
|
+
"type": "string | undefined",
|
|
146
|
+
"resolvedType": "string | undefined",
|
|
147
|
+
"attribute": "for",
|
|
148
|
+
"required": false,
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"description": "Maps to `for` attribute on <label> elements."
|
|
151
|
+
},
|
|
152
|
+
"italic": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"resolvedType": "boolean",
|
|
155
|
+
"attribute": "italic",
|
|
156
|
+
"default": "false",
|
|
157
|
+
"required": false,
|
|
158
|
+
"mutable": false
|
|
159
|
+
},
|
|
160
|
+
"lineTruncation": {
|
|
161
|
+
"type": "LineTruncation",
|
|
162
|
+
"resolvedType": "\"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"none\" | 1 | 2 | 3 | 4 | 5",
|
|
163
|
+
"attribute": "line-truncation",
|
|
164
|
+
"default": "'none'",
|
|
165
|
+
"required": false,
|
|
166
|
+
"mutable": false
|
|
167
|
+
},
|
|
168
|
+
"shimmer": {
|
|
169
|
+
"type": "boolean",
|
|
170
|
+
"resolvedType": "boolean",
|
|
171
|
+
"attribute": "shimmer",
|
|
172
|
+
"default": "false",
|
|
173
|
+
"required": false,
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"description": "Animate the visible glyphs with the shared loading shimmer treatment."
|
|
176
|
+
},
|
|
177
|
+
"textId": {
|
|
178
|
+
"type": "string | undefined",
|
|
179
|
+
"resolvedType": "string | undefined",
|
|
180
|
+
"attribute": "text-id",
|
|
181
|
+
"required": false,
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"description": "Forwarded to the inner element (e.g. aria-labelledby targets)."
|
|
184
|
+
},
|
|
185
|
+
"variant": {
|
|
186
|
+
"type": "TextVariant",
|
|
187
|
+
"resolvedType": "\"text-body-large\" | \"text-body-medium\" | \"text-body-small\" | \"text-caption\" | \"text-display-medium\" | \"text-display-small\" | \"text-title-large\" | \"text-title-medium\" | \"text-title-small\"",
|
|
188
|
+
"attribute": "variant",
|
|
189
|
+
"default": "'text-body-medium'",
|
|
190
|
+
"required": false,
|
|
191
|
+
"mutable": false
|
|
192
|
+
},
|
|
193
|
+
"wrap": {
|
|
194
|
+
"type": "TextWrap | undefined",
|
|
195
|
+
"resolvedType": "\"balance\" | \"nowrap\" | \"pretty\" | \"wrap\" | undefined",
|
|
196
|
+
"attribute": "wrap",
|
|
197
|
+
"required": false,
|
|
198
|
+
"mutable": false
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"events": [],
|
|
202
|
+
"methods": [],
|
|
203
|
+
"slots": []
|
|
204
|
+
},
|
|
205
|
+
"props": {
|
|
206
|
+
"align": {
|
|
207
|
+
"type": "TextAlign | undefined",
|
|
208
|
+
"resolvedType": "\"center\" | \"left\" | \"right\" | undefined",
|
|
209
|
+
"attribute": "align",
|
|
210
|
+
"required": false,
|
|
211
|
+
"mutable": false
|
|
212
|
+
},
|
|
213
|
+
"as": {
|
|
214
|
+
"type": "TextElement",
|
|
215
|
+
"resolvedType": "\"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\" | \"p\" | \"span\"",
|
|
216
|
+
"attribute": "as",
|
|
217
|
+
"default": "'p'",
|
|
218
|
+
"required": false,
|
|
219
|
+
"mutable": false
|
|
220
|
+
},
|
|
221
|
+
"color": {
|
|
222
|
+
"type": "TextColor",
|
|
223
|
+
"resolvedType": "\"ai\" | \"brand\" | \"caution\" | \"inherit\" | \"negative\" | \"on-bold\" | \"on-strong\" | \"positive\" | \"primary\" | \"quaternary\" | \"secondary\" | \"tertiary\" | \"warning\" | `var(--${string})`",
|
|
224
|
+
"attribute": "color",
|
|
225
|
+
"default": "'inherit'",
|
|
226
|
+
"required": false,
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"description": "Semantic foreground color token or CSS variable. `tertiary` and the\nstill-fainter `quaternary` are restricted to genuinely inactive/disabled\nUI content or purely decorative content; prefer the owning control's\ninactive state whenever one exists."
|
|
229
|
+
},
|
|
230
|
+
"decoration": {
|
|
231
|
+
"type": "TextDecoration | undefined",
|
|
232
|
+
"resolvedType": "\"dotted-underline\" | \"none\" | \"underline\" | undefined",
|
|
233
|
+
"attribute": "decoration",
|
|
234
|
+
"required": false,
|
|
235
|
+
"mutable": false,
|
|
236
|
+
"description": "Link underline or dotted hidden-interaction affordance; does not add semantics."
|
|
237
|
+
},
|
|
238
|
+
"emphasis": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"resolvedType": "boolean",
|
|
241
|
+
"attribute": "emphasis",
|
|
242
|
+
"default": "false",
|
|
243
|
+
"required": false,
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"description": "Heavier weight + tighter letter-spacing for the variant.\n`false` (default): one step below emphasis (display semibold, title/body\nmedium, caption medium).\n`true`: display bold, title/caption semibold, body medium."
|
|
246
|
+
},
|
|
247
|
+
"fontFeature": {
|
|
248
|
+
"type": "TextFontFeature",
|
|
249
|
+
"resolvedType": "\"normal\" | \"tabular-nums\"",
|
|
250
|
+
"attribute": "font-feature",
|
|
251
|
+
"default": "'normal'",
|
|
252
|
+
"required": false,
|
|
253
|
+
"mutable": false
|
|
254
|
+
},
|
|
255
|
+
"for": {
|
|
256
|
+
"type": "string | undefined",
|
|
257
|
+
"resolvedType": "string | undefined",
|
|
258
|
+
"attribute": "for",
|
|
259
|
+
"required": false,
|
|
260
|
+
"mutable": false,
|
|
261
|
+
"description": "Maps to `for` attribute on <label> elements."
|
|
262
|
+
},
|
|
263
|
+
"italic": {
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"resolvedType": "boolean",
|
|
266
|
+
"attribute": "italic",
|
|
267
|
+
"default": "false",
|
|
268
|
+
"required": false,
|
|
269
|
+
"mutable": false
|
|
270
|
+
},
|
|
271
|
+
"lineTruncation": {
|
|
272
|
+
"type": "LineTruncation",
|
|
273
|
+
"resolvedType": "\"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"none\" | 1 | 2 | 3 | 4 | 5",
|
|
274
|
+
"attribute": "line-truncation",
|
|
275
|
+
"default": "'none'",
|
|
276
|
+
"required": false,
|
|
277
|
+
"mutable": false
|
|
278
|
+
},
|
|
279
|
+
"shimmer": {
|
|
280
|
+
"type": "boolean",
|
|
281
|
+
"resolvedType": "boolean",
|
|
282
|
+
"attribute": "shimmer",
|
|
283
|
+
"default": "false",
|
|
284
|
+
"required": false,
|
|
285
|
+
"mutable": false,
|
|
286
|
+
"description": "Animate the visible glyphs with the shared loading shimmer treatment."
|
|
287
|
+
},
|
|
288
|
+
"textId": {
|
|
289
|
+
"type": "string | undefined",
|
|
290
|
+
"resolvedType": "string | undefined",
|
|
291
|
+
"attribute": "text-id",
|
|
292
|
+
"required": false,
|
|
293
|
+
"mutable": false,
|
|
294
|
+
"description": "Forwarded to the inner element (e.g. aria-labelledby targets)."
|
|
295
|
+
},
|
|
296
|
+
"variant": {
|
|
297
|
+
"type": "TextVariant",
|
|
298
|
+
"resolvedType": "\"text-body-large\" | \"text-body-medium\" | \"text-body-small\" | \"text-caption\" | \"text-display-medium\" | \"text-display-small\" | \"text-title-large\" | \"text-title-medium\" | \"text-title-small\"",
|
|
299
|
+
"attribute": "variant",
|
|
300
|
+
"default": "'text-body-medium'",
|
|
301
|
+
"required": false,
|
|
302
|
+
"mutable": false
|
|
303
|
+
},
|
|
304
|
+
"wrap": {
|
|
305
|
+
"type": "TextWrap | undefined",
|
|
306
|
+
"resolvedType": "\"balance\" | \"nowrap\" | \"pretty\" | \"wrap\" | undefined",
|
|
307
|
+
"attribute": "wrap",
|
|
308
|
+
"required": false,
|
|
309
|
+
"mutable": false
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
"events": [],
|
|
313
|
+
"methods": [],
|
|
314
|
+
"slots": [],
|
|
315
|
+
"exports": {
|
|
316
|
+
"customElement": "ds-text",
|
|
317
|
+
"react": "DsText",
|
|
318
|
+
"angular": "DsText"
|
|
319
|
+
},
|
|
320
|
+
"consumption": {
|
|
321
|
+
"install": "npm install @ds-mo/ui @ds-mo/tokens @ds-mo/icons",
|
|
322
|
+
"cssSetup": "import '@ds-mo/tokens';\nimport '@ds-mo/tokens/reset';\nimport '@ds-mo/tokens/globals';",
|
|
323
|
+
"customElements": {
|
|
324
|
+
"import": "import '@ds-mo/ui/dist/components/ds-text.js';",
|
|
325
|
+
"example": "<ds-text></ds-text>"
|
|
326
|
+
},
|
|
327
|
+
"react": {
|
|
328
|
+
"import": "import { DsText } from '@ds-mo/ui/react';",
|
|
329
|
+
"example": "<DsText />"
|
|
330
|
+
},
|
|
331
|
+
"angular": {
|
|
332
|
+
"import": "import { DsText } from '@ds-mo/ui/angular/ds-text';",
|
|
333
|
+
"example": "<ds-text></ds-text>"
|
|
334
|
+
},
|
|
335
|
+
"peerDependencies": {
|
|
336
|
+
"required": [
|
|
337
|
+
"@ds-mo/tokens ^3.1.1",
|
|
338
|
+
"@ds-mo/icons ^6.2.0"
|
|
339
|
+
],
|
|
340
|
+
"frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
"dependencies": [
|
|
345
|
+
"@ds-mo/ui",
|
|
346
|
+
"@ds-mo/tokens"
|
|
347
|
+
],
|
|
348
|
+
"registryDependencies": [],
|
|
349
|
+
"files": [
|
|
350
|
+
{
|
|
351
|
+
"path": "src/wc/components/Text/Text.css",
|
|
352
|
+
"content": "@import '../../utils/typography.css';\n@import '../../utils/shimmer.css';\n\n:host {\n box-sizing: border-box;\n max-width: 100%;\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n font-family: var(--typography-font-family);\n}\n\n:host(:where(.ds-text--inline-box)) {\n display: inline-block;\n}\n\n:host(:where(.ds-text--block-box)) {\n display: block;\n width: 100%;\n}\n\n/*\n * The host is the measurable typography box. The semantic inner element fills\n * it and inherits every text metric without adding margins, padding, or its own\n * line-height strut. One rendered line therefore measures exactly one token\n * line-height; N lines measure N × that token.\n */\n.ds-text__element {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n text-transform: inherit;\n text-align: inherit;\n text-decoration: inherit;\n font-style: inherit;\n font-variant-numeric: inherit;\n font-feature-settings: inherit;\n white-space: inherit;\n text-wrap: inherit;\n overflow-wrap: inherit;\n word-break: inherit;\n /* Consumer truncation on the host (PanelNav, ChartLegend, …) must reach the\n text node — overflow/text-overflow are not inherited by default. */\n overflow: inherit;\n text-overflow: inherit;\n}\n\n/* ── Truncation ─────────────────────────────────────────────────────────── */\n\n:host(.ds-text--truncate-1) {\n overflow: hidden;\n}\n\n:host(.ds-text--truncate-1) .ds-text__element {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n:host(.ds-text--truncate-2),\n:host(.ds-text--truncate-3),\n:host(.ds-text--truncate-4),\n:host(.ds-text--truncate-5) {\n overflow: hidden;\n}\n\n:host(.ds-text--truncate-2) .ds-text__element,\n:host(.ds-text--truncate-3) .ds-text__element,\n:host(.ds-text--truncate-4) .ds-text__element,\n:host(.ds-text--truncate-5) .ds-text__element {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n\n:host(.ds-text--truncate-2) .ds-text__element { -webkit-line-clamp: 2; }\n:host(.ds-text--truncate-3) .ds-text__element { -webkit-line-clamp: 3; }\n:host(.ds-text--truncate-4) .ds-text__element { -webkit-line-clamp: 4; }\n:host(.ds-text--truncate-5) .ds-text__element { -webkit-line-clamp: 5; }\n\n/* ── Wrap ───────────────────────────────────────────────────────────────── */\n\n:host(.ds-text--nowrap),\n:host(.ds-text--nowrap) .ds-text__element {\n white-space: nowrap;\n word-break: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n:host(.ds-text--balance),\n:host(.ds-text--balance) .ds-text__element { text-wrap: balance; }\n\n:host(.ds-text--pretty),\n:host(.ds-text--pretty) .ds-text__element { text-wrap: pretty; }\n\n/* ── Color ──────────────────────────────────────────────────────────────── */\n\n:host(.ds-text--color-primary) { color: var(--color-foreground-primary); }\n:host(.ds-text--color-secondary) { color: var(--color-foreground-secondary); }\n:host(.ds-text--color-tertiary) { color: var(--color-foreground-tertiary); }\n:host(.ds-text--color-quaternary) { color: var(--color-foreground-quaternary); }\n:host(.ds-text--color-brand) { color: var(--color-foreground-bold-brand); }\n:host(.ds-text--color-negative) { color: var(--color-foreground-bold-negative); }\n:host(.ds-text--color-positive) { color: var(--color-foreground-bold-positive); }\n:host(.ds-text--color-warning) { color: var(--color-foreground-bold-warning); }\n:host(.ds-text--color-caution) { color: var(--color-foreground-bold-caution); }\n:host(.ds-text--color-ai) { color: var(--color-foreground-bold-ai); }\n:host(.ds-text--color-on-strong) { color: var(--color-foreground-on-strong-background-primary); }\n:host(.ds-text--color-on-bold) { color: var(--color-foreground-on-bold-background-primary); }\n:host(.ds-text--color-inherit) { color: inherit; }\n\n/* ── Decorations ─────────────────────────────────────────────────────────── */\n\n:host(.ds-text--decoration-underline) {\n text-decoration: underline;\n text-underline-offset: 2px;\n text-decoration-thickness: 1px;\n}\n\n:host(.ds-text--decoration-dotted-underline) {\n text-decoration: underline dotted;\n text-underline-offset: 2px;\n text-decoration-thickness: 1px;\n}\n\n/* ── Style ──────────────────────────────────────────────────────────────── */\n\n:host(.ds-text--italic) { font-style: italic; }\n\n:host(.ds-text--font-feature-tabular-nums) {\n font-variant-numeric: tabular-nums;\n font-feature-settings: 'tnum';\n}\n\n/* ── Align ──────────────────────────────────────────────────────────────── */\n\n:host(.ds-text--align-left) { text-align: left; }\n:host(.ds-text--align-center) { text-align: center; }\n:host(.ds-text--align-right) { text-align: right; }\n",
|
|
353
|
+
"type": "registry:ui"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"path": "src/wc/components/Text/Text.tsx",
|
|
357
|
+
"content": "import { Component, Prop, h, Host } from '@stencil/core';\nimport { textDisplayClass, textVariantClass } from './text-utils';\nimport type {\n TextAlign,\n TextColor,\n TextDecoration,\n TextElement,\n TextFontFeature,\n TextVariant,\n LineTruncation,\n TextWrap,\n} from './text-types';\n\n@Component({\n tag: 'ds-text',\n styleUrl: 'Text.css',\n scoped: true,\n})\nexport class Text {\n @Prop() variant: TextVariant = 'text-body-medium';\n /**\n * Heavier weight + tighter letter-spacing for the variant.\n * `false` (default): one step below emphasis (display semibold, title/body\n * medium, caption medium).\n * `true`: display bold, title/caption semibold, body medium.\n */\n @Prop() emphasis: boolean = false;\n /**\n * Semantic foreground color token or CSS variable. `tertiary` and the\n * still-fainter `quaternary` are restricted to genuinely inactive/disabled\n * UI content or purely decorative content; prefer the owning control's\n * inactive state whenever one exists.\n */\n @Prop() color: TextColor = 'inherit';\n /** Link underline or dotted hidden-interaction affordance; does not add semantics. */\n @Prop() decoration: TextDecoration | undefined;\n @Prop() italic: boolean = false;\n /** Animate the visible glyphs with the shared loading shimmer treatment. */\n @Prop() shimmer: boolean = false;\n @Prop() align: TextAlign | undefined;\n @Prop() lineTruncation: LineTruncation = 'none';\n @Prop() wrap: TextWrap | undefined;\n @Prop() fontFeature: TextFontFeature = 'normal';\n @Prop() as: TextElement = 'p';\n /** Maps to `for` attribute on <label> elements. */\n @Prop() for: string | undefined;\n /** Forwarded to the inner element (e.g. aria-labelledby targets). */\n @Prop() textId: string | undefined;\n\n render() {\n // Polymorphic element: TSX treats a variable tag as a component, so a\n // dynamic intrinsic element name must be cast to `any` to render.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const Tag = this.as as any;\n const isCustomColor = (c: TextColor) => typeof c === 'string' && c.startsWith('var(--');\n const truncationLines = Number(this.lineTruncation);\n\n const cls: Record<string, boolean> = {\n 'ds-text': true,\n [textDisplayClass(this.as)]: true,\n [textVariantClass(this.variant)]: true,\n 'ds-text--emphasis': this.emphasis,\n 'ds-text--regular': !this.emphasis,\n 'ds-text--nowrap': this.wrap === 'nowrap',\n 'ds-text--balance': this.wrap === 'balance',\n 'ds-text--pretty': this.wrap === 'pretty',\n 'ds-text--truncate-1': truncationLines === 1 && this.wrap !== 'nowrap',\n 'ds-text--truncate-2': truncationLines === 2 && this.wrap !== 'nowrap',\n 'ds-text--truncate-3': truncationLines === 3 && this.wrap !== 'nowrap',\n 'ds-text--truncate-4': truncationLines === 4 && this.wrap !== 'nowrap',\n 'ds-text--truncate-5': truncationLines === 5 && this.wrap !== 'nowrap',\n 'ds-text--color-primary': this.color === 'primary',\n 'ds-text--color-secondary': this.color === 'secondary',\n 'ds-text--color-tertiary': this.color === 'tertiary',\n 'ds-text--color-quaternary': this.color === 'quaternary',\n 'ds-text--color-brand': this.color === 'brand',\n 'ds-text--color-negative': this.color === 'negative',\n 'ds-text--color-positive': this.color === 'positive',\n 'ds-text--color-warning': this.color === 'warning',\n 'ds-text--color-caution': this.color === 'caution',\n 'ds-text--color-ai': this.color === 'ai',\n 'ds-text--color-on-strong': this.color === 'on-strong',\n 'ds-text--color-on-bold': this.color === 'on-bold',\n 'ds-text--color-inherit': this.color === 'inherit',\n 'ds-text--decoration-underline': this.decoration === 'underline',\n 'ds-text--decoration-dotted-underline': this.decoration === 'dotted-underline',\n 'ds-text--italic': this.italic,\n 'ds-text--align-left': this.align === 'left',\n 'ds-text--align-center': this.align === 'center',\n 'ds-text--align-right': this.align === 'right',\n 'ds-text--font-feature-tabular-nums': this.fontFeature === 'tabular-nums',\n };\n\n const style = this.color && isCustomColor(this.color)\n ? { color: this.color as string }\n : undefined;\n\n const extraProps: Record<string, string> = {};\n if (this.as === 'label' && this.for) extraProps['for'] = this.for;\n if (this.textId) extraProps['id'] = this.textId;\n\n return (\n <Host class={cls} style={style}>\n <Tag\n class={{\n 'ds-text__element': true,\n 'ds-shimmer-text': this.shimmer,\n }}\n {...extraProps}\n >\n <slot />\n </Tag>\n </Host>\n );\n }\n}\n",
|
|
358
|
+
"type": "registry:ui"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"path": "src/wc/components/Text/text-types.ts",
|
|
362
|
+
"content": "export type TextVariant =\n | 'text-display-medium'\n | 'text-display-small'\n | 'text-title-large'\n | 'text-title-medium'\n | 'text-title-small'\n | 'text-body-large'\n | 'text-body-medium'\n | 'text-body-small'\n | 'text-caption';\n\nexport type TextColorToken =\n | 'primary' | 'secondary' | 'tertiary' | 'quaternary'\n | 'brand' | 'negative' | 'positive' | 'warning' | 'caution' | 'ai'\n | 'on-strong' | 'on-bold' | 'inherit';\n\nexport type TextColor = TextColorToken | `var(--${string})`;\nexport type TextDecoration = 'none' | 'underline' | 'dotted-underline';\nexport type TextAlign = 'left' | 'center' | 'right';\nexport type LineTruncation = 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5' | 'none';\nexport type TextWrap = 'wrap' | 'nowrap' | 'balance' | 'pretty';\nexport type TextElement = 'p' | 'span' | 'div' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\nexport type TextFontFeature = 'normal' | 'tabular-nums';\n",
|
|
363
|
+
"type": "registry:ui"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"path": "src/wc/components/Text/text-utils.ts",
|
|
367
|
+
"content": "import type { TextElement, TextVariant } from './text-types';\n\n/** `text-body-medium` → `ds-text--body-medium` */\nexport function textVariantClass(variant: TextVariant): string {\n return `ds-text--${variant.replace(/^text-/, '')}`;\n}\n\n/** Inline semantics get a measurable inline box; paragraphs/headings get a block box. */\nexport function textDisplayClass(element: TextElement): string {\n return element === 'span' || element === 'label'\n ? 'ds-text--inline-box'\n : 'ds-text--block-box';\n}\n",
|
|
368
|
+
"type": "registry:ui"
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "tooltip-data-viz",
|
|
4
|
+
"title": "TooltipDataViz",
|
|
5
|
+
"description": "Positioned value/label callout for chart hover interactions (bar, line point, …).\nDonut charts skip this — legend sync already surfaces the hovered slice.\nUnlike `ds-tooltip`, this doesn't bind to a slotted anchor element —\ncharts hover-highlight data that lives inside an SVG, so the chart itself computes\nthe anchor point (e.g. the cursor position while hovering) and passes it in as `x`/`y`.\n\nRenders `position: absolute` — place inside a `position: relative` chart wrapper,\nwith `x`/`y` as pixel coordinates within that wrapper. Defaults to sitting below-right\nof the anchor (matching cursor-following tooltips), flipping to whichever side/edge\nkeeps it on-screen.\n\nMount (or remount) when a hover session starts so `delay` applies once per hover;\nkeep the instance mounted while the cursor moves so tracking stays instant.",
|
|
6
|
+
"type": "registry:ui",
|
|
7
|
+
"meta": {
|
|
8
|
+
"library": "@ds-mo/ui",
|
|
9
|
+
"distribution": "npm",
|
|
10
|
+
"storybook": "https://zainadeel.github.io/compomo/?path=/story/tooltip-data-viz",
|
|
11
|
+
"source": "src/wc/components/TooltipDataViz/TooltipDataViz.tsx",
|
|
12
|
+
"intentStatus": "migration-pending",
|
|
13
|
+
"intent": null,
|
|
14
|
+
"api": {
|
|
15
|
+
"props": {
|
|
16
|
+
"delay": {
|
|
17
|
+
"type": "number | string",
|
|
18
|
+
"resolvedType": "number | string",
|
|
19
|
+
"attribute": "delay",
|
|
20
|
+
"default": "TOKEN_DEFAULTS.animationDelayInstant",
|
|
21
|
+
"required": false,
|
|
22
|
+
"mutable": false,
|
|
23
|
+
"description": "Show delay after mount before the callout appears.\nDefault: `--effect-animation-delay-instant` (0ms). Accepts a number (ms)\nor a TokoMo time token / `var(--effect-animation-delay-*)`. Charts need\nimmediate feedback while scrubbing; prefer the default. Mount once per\nhover session so any non-zero delay runs once, then track `x`/`y` instantly."
|
|
24
|
+
},
|
|
25
|
+
"label": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"resolvedType": "string",
|
|
28
|
+
"attribute": "label",
|
|
29
|
+
"default": "''",
|
|
30
|
+
"required": false,
|
|
31
|
+
"mutable": false
|
|
32
|
+
},
|
|
33
|
+
"value": {
|
|
34
|
+
"type": "string | number",
|
|
35
|
+
"resolvedType": "number | string",
|
|
36
|
+
"attribute": "value",
|
|
37
|
+
"default": "''",
|
|
38
|
+
"required": false,
|
|
39
|
+
"mutable": false
|
|
40
|
+
},
|
|
41
|
+
"x": {
|
|
42
|
+
"type": "number",
|
|
43
|
+
"resolvedType": "number",
|
|
44
|
+
"attribute": "x",
|
|
45
|
+
"default": "0",
|
|
46
|
+
"required": false,
|
|
47
|
+
"mutable": false,
|
|
48
|
+
"description": "Anchor point in px, relative to the nearest `position: relative` ancestor — e.g. the cursor."
|
|
49
|
+
},
|
|
50
|
+
"y": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"resolvedType": "number",
|
|
53
|
+
"attribute": "y",
|
|
54
|
+
"default": "0",
|
|
55
|
+
"required": false,
|
|
56
|
+
"mutable": false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"events": [],
|
|
60
|
+
"methods": [],
|
|
61
|
+
"slots": []
|
|
62
|
+
},
|
|
63
|
+
"props": {
|
|
64
|
+
"delay": {
|
|
65
|
+
"type": "number | string",
|
|
66
|
+
"resolvedType": "number | string",
|
|
67
|
+
"attribute": "delay",
|
|
68
|
+
"default": "TOKEN_DEFAULTS.animationDelayInstant",
|
|
69
|
+
"required": false,
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"description": "Show delay after mount before the callout appears.\nDefault: `--effect-animation-delay-instant` (0ms). Accepts a number (ms)\nor a TokoMo time token / `var(--effect-animation-delay-*)`. Charts need\nimmediate feedback while scrubbing; prefer the default. Mount once per\nhover session so any non-zero delay runs once, then track `x`/`y` instantly."
|
|
72
|
+
},
|
|
73
|
+
"label": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"resolvedType": "string",
|
|
76
|
+
"attribute": "label",
|
|
77
|
+
"default": "''",
|
|
78
|
+
"required": false,
|
|
79
|
+
"mutable": false
|
|
80
|
+
},
|
|
81
|
+
"value": {
|
|
82
|
+
"type": "string | number",
|
|
83
|
+
"resolvedType": "number | string",
|
|
84
|
+
"attribute": "value",
|
|
85
|
+
"default": "''",
|
|
86
|
+
"required": false,
|
|
87
|
+
"mutable": false
|
|
88
|
+
},
|
|
89
|
+
"x": {
|
|
90
|
+
"type": "number",
|
|
91
|
+
"resolvedType": "number",
|
|
92
|
+
"attribute": "x",
|
|
93
|
+
"default": "0",
|
|
94
|
+
"required": false,
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"description": "Anchor point in px, relative to the nearest `position: relative` ancestor — e.g. the cursor."
|
|
97
|
+
},
|
|
98
|
+
"y": {
|
|
99
|
+
"type": "number",
|
|
100
|
+
"resolvedType": "number",
|
|
101
|
+
"attribute": "y",
|
|
102
|
+
"default": "0",
|
|
103
|
+
"required": false,
|
|
104
|
+
"mutable": false
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"events": [],
|
|
108
|
+
"methods": [],
|
|
109
|
+
"slots": [],
|
|
110
|
+
"exports": {
|
|
111
|
+
"customElement": "ds-tooltip-data-viz",
|
|
112
|
+
"react": "DsTooltipDataViz",
|
|
113
|
+
"angular": "DsTooltipDataViz"
|
|
114
|
+
},
|
|
115
|
+
"consumption": {
|
|
116
|
+
"install": "npm install @ds-mo/ui @ds-mo/tokens @ds-mo/icons",
|
|
117
|
+
"cssSetup": "import '@ds-mo/tokens';\nimport '@ds-mo/tokens/reset';\nimport '@ds-mo/tokens/globals';",
|
|
118
|
+
"customElements": {
|
|
119
|
+
"import": "import '@ds-mo/ui/dist/components/ds-tooltip-data-viz.js';",
|
|
120
|
+
"example": "<ds-tooltip-data-viz></ds-tooltip-data-viz>"
|
|
121
|
+
},
|
|
122
|
+
"react": {
|
|
123
|
+
"import": "import { DsTooltipDataViz } from '@ds-mo/ui/react';",
|
|
124
|
+
"example": "<DsTooltipDataViz />"
|
|
125
|
+
},
|
|
126
|
+
"angular": {
|
|
127
|
+
"import": "import { DsTooltipDataViz } from '@ds-mo/ui/angular/ds-tooltip-data-viz';",
|
|
128
|
+
"example": "<ds-tooltip-data-viz></ds-tooltip-data-viz>"
|
|
129
|
+
},
|
|
130
|
+
"peerDependencies": {
|
|
131
|
+
"required": [
|
|
132
|
+
"@ds-mo/tokens ^3.1.1",
|
|
133
|
+
"@ds-mo/icons ^6.2.0"
|
|
134
|
+
],
|
|
135
|
+
"frameworks": "Custom Elements; React 18/19 wrappers; Angular 19-22 standalone adapters."
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"dependencies": [
|
|
140
|
+
"@ds-mo/ui",
|
|
141
|
+
"@ds-mo/tokens"
|
|
142
|
+
],
|
|
143
|
+
"registryDependencies": [
|
|
144
|
+
"text"
|
|
145
|
+
],
|
|
146
|
+
"files": [
|
|
147
|
+
{
|
|
148
|
+
"path": "src/wc/components/TooltipDataViz/TooltipDataViz.css",
|
|
149
|
+
"content": "@import '../../utils/control-density.css';\n\n/* No padding here — the item div below owns all the spacing, so there's exactly one padding\n box instead of stacking the host's padding on top of the item's. */\n:host {\n position: absolute;\n z-index: var(--dimension-z-index-tooltip);\n display: block;\n box-sizing: border-box;\n background-color: var(--color-translucent-translucent);\n backdrop-filter: blur(var(--effect-blur-md));\n -webkit-backdrop-filter: blur(var(--effect-blur-md));\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 opacity: 0;\n}\n\n:host(.tooltip-data-viz--visible) {\n animation: tooltip-data-viz-fade-in var(--effect-motion-short-2) forwards;\n}\n\n/* Density: md control recipe (height / pad / label inset) — non-interactive, no interaction-fill. */\n.tooltip-data-viz__item {\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(--dimension-space-025);\n padding: 0 var(--ds-control-padding-inline, var(--dimension-space-075));\n}\n\n.tooltip-data-viz__label,\n.tooltip-data-viz__value {\n padding: 0 var(--ds-control-label-inset, var(--dimension-space-025));\n}\n\n@keyframes tooltip-data-viz-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host(.tooltip-data-viz--visible) {\n animation: none;\n opacity: 1;\n }\n}\n",
|
|
150
|
+
"type": "registry:ui"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"path": "src/wc/components/TooltipDataViz/TooltipDataViz.tsx",
|
|
154
|
+
"content": "import { Component, Prop, State, Element, Watch, h, Host } from '@stencil/core';\nimport { resolveCssTimeMs, TOKEN_DEFAULTS } from '../../utils';\n\nconst CURSOR_OFFSET_PX = 12;\nconst VIEWPORT_PAD_PX = 8;\n\nexport type TooltipDataVizSide = 'left' | 'right';\nexport type TooltipDataVizAlign = 'top' | 'bottom';\n\n/**\n * Positioned value/label callout for chart hover interactions (bar, line point, …).\n * Donut charts skip this — legend sync already surfaces the hovered slice.\n * Unlike `ds-tooltip`, this doesn't bind to a slotted anchor element —\n * charts hover-highlight data that lives inside an SVG, so the chart itself computes\n * the anchor point (e.g. the cursor position while hovering) and passes it in as `x`/`y`.\n *\n * Renders `position: absolute` — place inside a `position: relative` chart wrapper,\n * with `x`/`y` as pixel coordinates within that wrapper. Defaults to sitting below-right\n * of the anchor (matching cursor-following tooltips), flipping to whichever side/edge\n * keeps it on-screen.\n *\n * Mount (or remount) when a hover session starts so `delay` applies once per hover;\n * keep the instance mounted while the cursor moves so tracking stays instant.\n */\n@Component({\n tag: 'ds-tooltip-data-viz',\n styleUrl: 'TooltipDataViz.css',\n scoped: true,\n})\nexport class TooltipDataViz {\n @Element() el!: HTMLElement;\n\n @Prop() value: string | number = '';\n @Prop() label: string = '';\n /** Anchor point in px, relative to the nearest `position: relative` ancestor — e.g. the cursor. */\n @Prop() x: number = 0;\n @Prop() y: number = 0;\n\n /**\n * Show delay after mount before the callout appears.\n * Default: `--effect-animation-delay-instant` (0ms). Accepts a number (ms)\n * or a TokoMo time token / `var(--effect-animation-delay-*)`. Charts need\n * immediate feedback while scrubbing; prefer the default. Mount once per\n * hover session so any non-zero delay runs once, then track `x`/`y` instantly.\n */\n @Prop() delay: number | string = TOKEN_DEFAULTS.animationDelayInstant;\n\n @State() private side: TooltipDataVizSide = 'right';\n @State() private align: TooltipDataVizAlign = 'bottom';\n @State() private visible: boolean = false;\n\n private delayTimer: ReturnType<typeof setTimeout> | null = null;\n\n componentDidLoad() {\n this.scheduleShow();\n this.calculatePlacement();\n }\n\n disconnectedCallback() {\n this.clearDelayTimer();\n }\n\n @Watch('x')\n @Watch('y')\n onAnchorChange() {\n requestAnimationFrame(() => this.calculatePlacement());\n }\n\n @Watch('delay')\n onDelayChange() {\n if (!this.visible) this.scheduleShow();\n }\n\n private get showDelayMs(): number {\n return resolveCssTimeMs(this.delay, TOKEN_DEFAULTS.animationDelayInstant);\n }\n\n private clearDelayTimer() {\n if (this.delayTimer) {\n clearTimeout(this.delayTimer);\n this.delayTimer = null;\n }\n }\n\n private scheduleShow() {\n this.clearDelayTimer();\n this.visible = false;\n const ms = this.showDelayMs;\n if (ms <= 0) {\n this.visible = true;\n return;\n }\n this.delayTimer = setTimeout(() => {\n this.delayTimer = null;\n this.visible = true;\n requestAnimationFrame(() => this.calculatePlacement());\n }, ms);\n }\n\n private calculatePlacement() {\n const rect = this.el.getBoundingClientRect();\n if (!rect.width || !rect.height) return;\n\n const nextSide: TooltipDataVizSide = rect.right > window.innerWidth - VIEWPORT_PAD_PX ? 'left' : 'right';\n const nextAlign: TooltipDataVizAlign = rect.bottom > window.innerHeight - VIEWPORT_PAD_PX ? 'top' : 'bottom';\n\n if (nextSide !== this.side) this.side = nextSide;\n if (nextAlign !== this.align) this.align = nextAlign;\n }\n\n render() {\n const translateX = this.side === 'right' ? `${CURSOR_OFFSET_PX}px` : `calc(-100% - ${CURSOR_OFFSET_PX}px)`;\n const translateY = this.align === 'bottom' ? `${CURSOR_OFFSET_PX}px` : `calc(-100% - ${CURSOR_OFFSET_PX}px)`;\n\n return (\n <Host\n class={{\n 'tooltip-data-viz': true,\n 'tooltip-data-viz--visible': this.visible,\n }}\n style={{ left: `${this.x}px`, top: `${this.y}px`, transform: `translate(${translateX}, ${translateY})` }}\n >\n <div class=\"tooltip-data-viz__item ds-control--md\">\n <ds-text\n class=\"tooltip-data-viz__label\"\n as=\"span\"\n variant=\"text-body-medium\"\n color=\"var(--color-translucent-foreground-secondary)\"\n >\n {this.label}\n </ds-text>\n <ds-text\n class=\"tooltip-data-viz__value\"\n as=\"span\"\n variant=\"text-body-medium\"\n emphasis\n color=\"var(--color-translucent-foreground-primary)\"\n >\n {this.value}\n </ds-text>\n </div>\n </Host>\n );\n }\n}\n",
|
|
155
|
+
"type": "registry:ui"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|