@warp-ds/elements 2.11.0 → 2.12.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +323 -0
- package/dist/docs/index.md +1 -0
- package/dist/docs/textfield/api.md +12 -0
- package/dist/docs/textfield/textfield.md +12 -0
- package/dist/docs/tooltip/accessibility.md +9 -0
- package/dist/docs/tooltip/api.md +87 -0
- package/dist/docs/tooltip/examples.md +32 -0
- package/dist/docs/tooltip/styling.md +47 -0
- package/dist/docs/tooltip/tooltip.md +197 -0
- package/dist/docs/tooltip/usage.md +10 -0
- package/dist/entrypoint-react.d.ts +1 -0
- package/dist/entrypoint-react.js +1 -0
- package/dist/index.d.ts +159 -0
- package/dist/packages/affix/affix.js +3 -3
- package/dist/packages/affix/affix.js.map +2 -2
- package/dist/packages/affix/styles.js +1 -1
- package/dist/packages/attention/attention.stories.js +5 -1
- package/dist/packages/select/select.js +1 -1
- package/dist/packages/select/select.js.map +2 -2
- package/dist/packages/select/styles.js +1 -1
- package/dist/packages/tab/react.d.ts +1 -0
- package/dist/packages/tab/react.js +2 -1
- package/dist/packages/tabs/tabs.js +4 -4
- package/dist/packages/tabs/tabs.js.map +3 -3
- package/dist/packages/tabs/tabs.react.stories.js +5 -5
- package/dist/packages/textarea/styles.js +1 -1
- package/dist/packages/textarea/textarea.js +6 -6
- package/dist/packages/textarea/textarea.js.map +2 -2
- package/dist/packages/textfield/input-styles.js +1 -1
- package/dist/packages/textfield/react.d.ts +1 -1
- package/dist/packages/textfield/styles.js +1 -1
- package/dist/packages/textfield/textfield.d.ts +8 -0
- package/dist/packages/textfield/textfield.js +32 -15
- package/dist/packages/textfield/textfield.js.map +3 -3
- package/dist/packages/textfield/textfield.react.stories.d.ts +2 -2
- package/dist/packages/tooltip/locales/da/messages.d.mts +1 -0
- package/dist/packages/tooltip/locales/da/messages.mjs +1 -0
- package/dist/packages/tooltip/locales/en/messages.d.mts +1 -0
- package/dist/packages/tooltip/locales/en/messages.mjs +1 -0
- package/dist/packages/tooltip/locales/fi/messages.d.mts +1 -0
- package/dist/packages/tooltip/locales/fi/messages.mjs +1 -0
- package/dist/packages/tooltip/locales/nb/messages.d.mts +1 -0
- package/dist/packages/tooltip/locales/nb/messages.mjs +1 -0
- package/dist/packages/tooltip/locales/sv/messages.d.mts +1 -0
- package/dist/packages/tooltip/locales/sv/messages.mjs +1 -0
- package/dist/packages/tooltip/react.d.ts +16 -0
- package/dist/packages/tooltip/react.js +28 -0
- package/dist/packages/tooltip/styles.d.ts +1 -0
- package/dist/packages/tooltip/styles.js +66 -0
- package/dist/packages/tooltip/tooltip.d.ts +72 -0
- package/dist/packages/tooltip/tooltip.hydration.test.d.ts +1 -0
- package/dist/packages/tooltip/tooltip.hydration.test.js +13 -0
- package/dist/packages/tooltip/tooltip.js +2528 -0
- package/dist/packages/tooltip/tooltip.js.map +7 -0
- package/dist/packages/tooltip/tooltip.react.stories.d.ts +12 -0
- package/dist/packages/tooltip/tooltip.react.stories.js +12 -0
- package/dist/packages/tooltip/tooltip.stories.d.ts +17 -0
- package/dist/packages/tooltip/tooltip.stories.js +115 -0
- package/dist/packages/tooltip/tooltip.test.d.ts +2 -0
- package/dist/packages/tooltip/tooltip.test.js +130 -0
- package/dist/web-types.json +87 -1
- package/eik/index.js +19 -19
- package/package.json +2 -1
|
@@ -252,6 +252,16 @@
|
|
|
252
252
|
"attribute": "autocomplete",
|
|
253
253
|
"reflects": true
|
|
254
254
|
},
|
|
255
|
+
{
|
|
256
|
+
"kind": "field",
|
|
257
|
+
"name": "tooltip",
|
|
258
|
+
"type": {
|
|
259
|
+
"text": "string | undefined"
|
|
260
|
+
},
|
|
261
|
+
"description": "Suplementary information that should show in a tooltip behind an information icon after the label.\n\nUse the `tooltip` slot if you need markup and not just text.\n\nYou must provide a label to be able to show an info icon with a tooltip.",
|
|
262
|
+
"attribute": "tooltip",
|
|
263
|
+
"reflects": true
|
|
264
|
+
},
|
|
255
265
|
{
|
|
256
266
|
"kind": "field",
|
|
257
267
|
"name": "formatter",
|
|
@@ -512,6 +522,14 @@
|
|
|
512
522
|
},
|
|
513
523
|
"description": "A space-separated string that hints to browsers [what type of content it can suggest](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete#value) to autofill.",
|
|
514
524
|
"fieldName": "autocomplete"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"name": "tooltip",
|
|
528
|
+
"type": {
|
|
529
|
+
"text": "string | undefined"
|
|
530
|
+
},
|
|
531
|
+
"description": "Suplementary information that should show in a tooltip behind an information icon after the label.\n\nUse the `tooltip` slot if you need markup and not just text.\n\nYou must provide a label to be able to show an info icon with a tooltip.",
|
|
532
|
+
"fieldName": "tooltip"
|
|
515
533
|
}
|
|
516
534
|
],
|
|
517
535
|
"mixins": [
|
|
@@ -9310,6 +9328,311 @@
|
|
|
9310
9328
|
}
|
|
9311
9329
|
}
|
|
9312
9330
|
]
|
|
9331
|
+
},
|
|
9332
|
+
{
|
|
9333
|
+
"kind": "javascript-module",
|
|
9334
|
+
"path": "packages/tooltip/tooltip.ts",
|
|
9335
|
+
"declarations": [
|
|
9336
|
+
{
|
|
9337
|
+
"kind": "class",
|
|
9338
|
+
"description": "A tooltip is a message box that is displayed when a user hovers over or gives focus to a UI element.\n\nTooltips should be used sparingly and contain succinct, supplementary information.",
|
|
9339
|
+
"name": "WarpTooltip",
|
|
9340
|
+
"members": [
|
|
9341
|
+
{
|
|
9342
|
+
"kind": "field",
|
|
9343
|
+
"name": "for",
|
|
9344
|
+
"type": {
|
|
9345
|
+
"text": "string"
|
|
9346
|
+
},
|
|
9347
|
+
"default": "\"\"",
|
|
9348
|
+
"description": "ID of the element that triggers the tooltip on hover or focus.",
|
|
9349
|
+
"attribute": "for"
|
|
9350
|
+
},
|
|
9351
|
+
{
|
|
9352
|
+
"kind": "field",
|
|
9353
|
+
"name": "noArrow",
|
|
9354
|
+
"type": {
|
|
9355
|
+
"text": "boolean"
|
|
9356
|
+
},
|
|
9357
|
+
"default": "false",
|
|
9358
|
+
"description": "Hide the arrow pointing toward the tooltip target.",
|
|
9359
|
+
"attribute": "no-arrow"
|
|
9360
|
+
},
|
|
9361
|
+
{
|
|
9362
|
+
"kind": "field",
|
|
9363
|
+
"name": "open",
|
|
9364
|
+
"type": {
|
|
9365
|
+
"text": "boolean"
|
|
9366
|
+
},
|
|
9367
|
+
"default": "false",
|
|
9368
|
+
"description": "Indicates whether the tooltip is visible or not.",
|
|
9369
|
+
"attribute": "open"
|
|
9370
|
+
},
|
|
9371
|
+
{
|
|
9372
|
+
"kind": "field",
|
|
9373
|
+
"name": "placement",
|
|
9374
|
+
"type": {
|
|
9375
|
+
"text": "TooltipPlacement"
|
|
9376
|
+
},
|
|
9377
|
+
"default": "\"top\"",
|
|
9378
|
+
"description": "Sets the placement of the tooltip relative to its target.\n\nThe tooltip will try to position itself at the given placement. If there is no room it will flip to the opposite side automatically.",
|
|
9379
|
+
"attribute": "placement",
|
|
9380
|
+
"parsedType": {
|
|
9381
|
+
"text": "'top' | 'right' | 'bottom' | 'left'"
|
|
9382
|
+
}
|
|
9383
|
+
},
|
|
9384
|
+
{
|
|
9385
|
+
"kind": "field",
|
|
9386
|
+
"name": "#actualPlacement",
|
|
9387
|
+
"privacy": "private",
|
|
9388
|
+
"type": {
|
|
9389
|
+
"text": "Placement"
|
|
9390
|
+
},
|
|
9391
|
+
"default": "\"top\""
|
|
9392
|
+
},
|
|
9393
|
+
{
|
|
9394
|
+
"kind": "field",
|
|
9395
|
+
"name": "showDelay",
|
|
9396
|
+
"type": {
|
|
9397
|
+
"text": "number"
|
|
9398
|
+
},
|
|
9399
|
+
"default": "150",
|
|
9400
|
+
"description": "Milliseconds to wait before showing the tooltip on hover.\n\nKeep at a non-zero value to avoid flickering the tooltip on and off when cursors move quickly past the target element.\n\nFocusing the target element shows the tooltip immediately.",
|
|
9401
|
+
"attribute": "show-delay",
|
|
9402
|
+
"reflects": true
|
|
9403
|
+
},
|
|
9404
|
+
{
|
|
9405
|
+
"kind": "field",
|
|
9406
|
+
"name": "hideDelay",
|
|
9407
|
+
"type": {
|
|
9408
|
+
"text": "number"
|
|
9409
|
+
},
|
|
9410
|
+
"default": "0",
|
|
9411
|
+
"description": "Milliseconds to wait before hiding the tooltip on mouseout.",
|
|
9412
|
+
"attribute": "hide-delay",
|
|
9413
|
+
"reflects": true
|
|
9414
|
+
},
|
|
9415
|
+
{
|
|
9416
|
+
"kind": "field",
|
|
9417
|
+
"name": "target",
|
|
9418
|
+
"type": {
|
|
9419
|
+
"text": "Element | null"
|
|
9420
|
+
},
|
|
9421
|
+
"privacy": "private",
|
|
9422
|
+
"default": "null"
|
|
9423
|
+
},
|
|
9424
|
+
{
|
|
9425
|
+
"kind": "field",
|
|
9426
|
+
"name": "tooltip",
|
|
9427
|
+
"type": {
|
|
9428
|
+
"text": "HTMLDivElement"
|
|
9429
|
+
},
|
|
9430
|
+
"privacy": "private"
|
|
9431
|
+
},
|
|
9432
|
+
{
|
|
9433
|
+
"kind": "field",
|
|
9434
|
+
"name": "hoverBridge",
|
|
9435
|
+
"type": {
|
|
9436
|
+
"text": "HTMLDivElement"
|
|
9437
|
+
},
|
|
9438
|
+
"privacy": "private"
|
|
9439
|
+
},
|
|
9440
|
+
{
|
|
9441
|
+
"kind": "field",
|
|
9442
|
+
"name": "arrow",
|
|
9443
|
+
"type": {
|
|
9444
|
+
"text": "HTMLDivElement"
|
|
9445
|
+
},
|
|
9446
|
+
"privacy": "private"
|
|
9447
|
+
},
|
|
9448
|
+
{
|
|
9449
|
+
"kind": "field",
|
|
9450
|
+
"name": "beak",
|
|
9451
|
+
"type": {
|
|
9452
|
+
"text": "HTMLDivElement"
|
|
9453
|
+
},
|
|
9454
|
+
"privacy": "private"
|
|
9455
|
+
},
|
|
9456
|
+
{
|
|
9457
|
+
"kind": "field",
|
|
9458
|
+
"name": "#accessibleDescription",
|
|
9459
|
+
"privacy": "private",
|
|
9460
|
+
"readonly": true
|
|
9461
|
+
},
|
|
9462
|
+
{
|
|
9463
|
+
"kind": "field",
|
|
9464
|
+
"name": "#cleanup",
|
|
9465
|
+
"privacy": "private",
|
|
9466
|
+
"type": {
|
|
9467
|
+
"text": "ReturnType<typeof autoUpdate> | null"
|
|
9468
|
+
},
|
|
9469
|
+
"default": "null"
|
|
9470
|
+
},
|
|
9471
|
+
{
|
|
9472
|
+
"kind": "field",
|
|
9473
|
+
"name": "#hoverTimeout",
|
|
9474
|
+
"privacy": "private",
|
|
9475
|
+
"type": {
|
|
9476
|
+
"text": "number | undefined"
|
|
9477
|
+
}
|
|
9478
|
+
},
|
|
9479
|
+
{
|
|
9480
|
+
"kind": "field",
|
|
9481
|
+
"name": "handleBlur",
|
|
9482
|
+
"privacy": "private"
|
|
9483
|
+
},
|
|
9484
|
+
{
|
|
9485
|
+
"kind": "field",
|
|
9486
|
+
"name": "handleFocus",
|
|
9487
|
+
"privacy": "private"
|
|
9488
|
+
},
|
|
9489
|
+
{
|
|
9490
|
+
"kind": "field",
|
|
9491
|
+
"name": "handleMouseOver",
|
|
9492
|
+
"privacy": "private"
|
|
9493
|
+
},
|
|
9494
|
+
{
|
|
9495
|
+
"kind": "field",
|
|
9496
|
+
"name": "handleKeydown",
|
|
9497
|
+
"privacy": "private"
|
|
9498
|
+
},
|
|
9499
|
+
{
|
|
9500
|
+
"kind": "field",
|
|
9501
|
+
"name": "handleMouseOut",
|
|
9502
|
+
"privacy": "private"
|
|
9503
|
+
},
|
|
9504
|
+
{
|
|
9505
|
+
"kind": "method",
|
|
9506
|
+
"name": "#handleForChange",
|
|
9507
|
+
"privacy": "private"
|
|
9508
|
+
},
|
|
9509
|
+
{
|
|
9510
|
+
"kind": "method",
|
|
9511
|
+
"name": "hide",
|
|
9512
|
+
"type": {
|
|
9513
|
+
"text": "hide() => void"
|
|
9514
|
+
}
|
|
9515
|
+
},
|
|
9516
|
+
{
|
|
9517
|
+
"kind": "method",
|
|
9518
|
+
"name": "show",
|
|
9519
|
+
"type": {
|
|
9520
|
+
"text": "show() => void"
|
|
9521
|
+
}
|
|
9522
|
+
},
|
|
9523
|
+
{
|
|
9524
|
+
"kind": "method",
|
|
9525
|
+
"name": "#handleOpenChange",
|
|
9526
|
+
"privacy": "private"
|
|
9527
|
+
},
|
|
9528
|
+
{
|
|
9529
|
+
"kind": "method",
|
|
9530
|
+
"name": "#startPositioning",
|
|
9531
|
+
"privacy": "private"
|
|
9532
|
+
},
|
|
9533
|
+
{
|
|
9534
|
+
"kind": "method",
|
|
9535
|
+
"name": "#stopPositioning",
|
|
9536
|
+
"privacy": "private"
|
|
9537
|
+
},
|
|
9538
|
+
{
|
|
9539
|
+
"kind": "method",
|
|
9540
|
+
"name": "#updatePosition",
|
|
9541
|
+
"privacy": "private"
|
|
9542
|
+
},
|
|
9543
|
+
{
|
|
9544
|
+
"kind": "method",
|
|
9545
|
+
"name": "#updateHoverBridge",
|
|
9546
|
+
"privacy": "private"
|
|
9547
|
+
}
|
|
9548
|
+
],
|
|
9549
|
+
"attributes": [
|
|
9550
|
+
{
|
|
9551
|
+
"name": "for",
|
|
9552
|
+
"type": {
|
|
9553
|
+
"text": "string"
|
|
9554
|
+
},
|
|
9555
|
+
"default": "\"\"",
|
|
9556
|
+
"description": "ID of the element that triggers the tooltip on hover or focus.",
|
|
9557
|
+
"fieldName": "for"
|
|
9558
|
+
},
|
|
9559
|
+
{
|
|
9560
|
+
"name": "no-arrow",
|
|
9561
|
+
"type": {
|
|
9562
|
+
"text": "boolean"
|
|
9563
|
+
},
|
|
9564
|
+
"default": "false",
|
|
9565
|
+
"description": "Hide the arrow pointing toward the tooltip target.",
|
|
9566
|
+
"fieldName": "noArrow"
|
|
9567
|
+
},
|
|
9568
|
+
{
|
|
9569
|
+
"name": "open",
|
|
9570
|
+
"type": {
|
|
9571
|
+
"text": "boolean"
|
|
9572
|
+
},
|
|
9573
|
+
"default": "false",
|
|
9574
|
+
"description": "Indicates whether the tooltip is visible or not.",
|
|
9575
|
+
"fieldName": "open"
|
|
9576
|
+
},
|
|
9577
|
+
{
|
|
9578
|
+
"name": "placement",
|
|
9579
|
+
"type": {
|
|
9580
|
+
"text": "TooltipPlacement"
|
|
9581
|
+
},
|
|
9582
|
+
"default": "\"top\"",
|
|
9583
|
+
"description": "Sets the placement of the tooltip relative to its target.\n\nThe tooltip will try to position itself at the given placement. If there is no room it will flip to the opposite side automatically.",
|
|
9584
|
+
"fieldName": "placement",
|
|
9585
|
+
"parsedType": {
|
|
9586
|
+
"text": "'top' | 'right' | 'bottom' | 'left'"
|
|
9587
|
+
}
|
|
9588
|
+
},
|
|
9589
|
+
{
|
|
9590
|
+
"name": "show-delay",
|
|
9591
|
+
"type": {
|
|
9592
|
+
"text": "number"
|
|
9593
|
+
},
|
|
9594
|
+
"default": "150",
|
|
9595
|
+
"description": "Milliseconds to wait before showing the tooltip on hover.\n\nKeep at a non-zero value to avoid flickering the tooltip on and off when cursors move quickly past the target element.\n\nFocusing the target element shows the tooltip immediately.",
|
|
9596
|
+
"fieldName": "showDelay"
|
|
9597
|
+
},
|
|
9598
|
+
{
|
|
9599
|
+
"name": "hide-delay",
|
|
9600
|
+
"type": {
|
|
9601
|
+
"text": "number"
|
|
9602
|
+
},
|
|
9603
|
+
"default": "0",
|
|
9604
|
+
"description": "Milliseconds to wait before hiding the tooltip on mouseout.",
|
|
9605
|
+
"fieldName": "hideDelay"
|
|
9606
|
+
}
|
|
9607
|
+
],
|
|
9608
|
+
"superclass": {
|
|
9609
|
+
"name": "LitElement",
|
|
9610
|
+
"package": "lit"
|
|
9611
|
+
},
|
|
9612
|
+
"tagName": "w-tooltip",
|
|
9613
|
+
"customElement": true,
|
|
9614
|
+
"modulePath": "packages/tooltip/tooltip.ts",
|
|
9615
|
+
"definitionPath": "packages/tooltip/tooltip.ts"
|
|
9616
|
+
}
|
|
9617
|
+
],
|
|
9618
|
+
"exports": [
|
|
9619
|
+
{
|
|
9620
|
+
"kind": "js",
|
|
9621
|
+
"name": "WarpTooltip",
|
|
9622
|
+
"declaration": {
|
|
9623
|
+
"name": "WarpTooltip",
|
|
9624
|
+
"module": "packages/tooltip/tooltip.ts"
|
|
9625
|
+
}
|
|
9626
|
+
},
|
|
9627
|
+
{
|
|
9628
|
+
"kind": "custom-element-definition",
|
|
9629
|
+
"name": "w-tooltip",
|
|
9630
|
+
"declaration": {
|
|
9631
|
+
"name": "WarpTooltip",
|
|
9632
|
+
"module": "packages/tooltip/tooltip.ts"
|
|
9633
|
+
}
|
|
9634
|
+
}
|
|
9635
|
+
]
|
|
9313
9636
|
}
|
|
9314
9637
|
]
|
|
9315
9638
|
}
|
package/dist/docs/index.md
CHANGED
|
@@ -47,3 +47,4 @@ Generated by `pnpm build:docs`. This file indexes the Markdown documentation shi
|
|
|
47
47
|
| Textarea | `<w-textarea>` | `textarea` | A multi-line text input with built-in form validation, auto-resizing, and styling support. Warp component reference | [textarea.md](./textarea/textarea.md) |
|
|
48
48
|
| Textfield | `<w-textfield>` | `textfield` | A single-line input component used for entering and editing textual or numeric data. Warp component reference | [textfield.md](./textfield/textfield.md) |
|
|
49
49
|
| Toast | `@warp-ds/elements/toast` | `toast` | Toasts are brief user feedback messages that overlay content. | [toast.md](./toast/toast.md) |
|
|
50
|
+
| Tooltip | `<w-tooltip>` | `tooltip` | A tooltip is a message box that is displayed when a user hovers over or gives focus to a UI element. Tooltips should be used sparingly and contain succinct, supplementary information. | [tooltip.md](./tooltip/tooltip.md) |
|
|
@@ -31,6 +31,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
31
31
|
| size | `string \| undefined` | `-` | Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs. |
|
|
32
32
|
| step | `number \| undefined` | `-` | Forces `number` inputs to be a whole number of `step` |
|
|
33
33
|
| suffixSlotChange (JS only) | `suffixSlotChange() => void` | `-` | - |
|
|
34
|
+
| tooltip | `string \| undefined` | `-` | Suplementary information that should show in a tooltip behind an information icon after the label. |
|
|
34
35
|
| type | `string \| undefined` | `-` | The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types). |
|
|
35
36
|
| value | `string \| undefined` | `-` | Lets you set the current value. |
|
|
36
37
|
|
|
@@ -230,6 +231,17 @@ Using arrow up and down in the input field increments and decrements by 5.
|
|
|
230
231
|
- Type: `suffixSlotChange() => void`
|
|
231
232
|
- Default: `-`
|
|
232
233
|
|
|
234
|
+
#### tooltip
|
|
235
|
+
|
|
236
|
+
Suplementary information that should show in a tooltip behind an information icon after the label.
|
|
237
|
+
|
|
238
|
+
Use the `tooltip` slot if you need markup and not just text.
|
|
239
|
+
|
|
240
|
+
You must provide a label to be able to show an info icon with a tooltip.
|
|
241
|
+
|
|
242
|
+
- Type: `string | undefined`
|
|
243
|
+
- Default: `-`
|
|
244
|
+
|
|
233
245
|
#### type
|
|
234
246
|
|
|
235
247
|
The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).
|
|
@@ -313,6 +313,7 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
|
|
|
313
313
|
| size | `string \| undefined` | `-` | Sets the [size](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#size) (width) of the input field to fit the expected length of inputs. |
|
|
314
314
|
| step | `number \| undefined` | `-` | Forces `number` inputs to be a whole number of `step` |
|
|
315
315
|
| suffixSlotChange (JS only) | `suffixSlotChange() => void` | `-` | - |
|
|
316
|
+
| tooltip | `string \| undefined` | `-` | Suplementary information that should show in a tooltip behind an information icon after the label. |
|
|
316
317
|
| type | `string \| undefined` | `-` | The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types). |
|
|
317
318
|
| value | `string \| undefined` | `-` | Lets you set the current value. |
|
|
318
319
|
|
|
@@ -512,6 +513,17 @@ Using arrow up and down in the input field increments and decrements by 5.
|
|
|
512
513
|
- Type: `suffixSlotChange() => void`
|
|
513
514
|
- Default: `-`
|
|
514
515
|
|
|
516
|
+
#### tooltip
|
|
517
|
+
|
|
518
|
+
Suplementary information that should show in a tooltip behind an information icon after the label.
|
|
519
|
+
|
|
520
|
+
Use the `tooltip` slot if you need markup and not just text.
|
|
521
|
+
|
|
522
|
+
You must provide a label to be able to show an info icon with a tooltip.
|
|
523
|
+
|
|
524
|
+
- Type: `string | undefined`
|
|
525
|
+
- Default: `-`
|
|
526
|
+
|
|
515
527
|
#### type
|
|
516
528
|
|
|
517
529
|
The [type of input](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Accessibility
|
|
2
|
+
|
|
3
|
+
### ARIA attribute
|
|
4
|
+
|
|
5
|
+
We use `aria-labelledby` instead of `aria-describedby` to create the relationship between the tooltip and its target.
|
|
6
|
+
|
|
7
|
+
The ARIA Authoring Practices Guide (APG) recommends `aria-describedby`, but at time of writing that must be set directly on the focusable element. Since `w-button`'s focusable `button` element is inside a shadow root we can't set up that relationship. Cross-root references by ID is impossible and the related ARIA properties on the `Element` are read only.
|
|
8
|
+
|
|
9
|
+
We might revisit this design later should cross-root ARIA references become supported.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## `<w-tooltip>` API
|
|
2
|
+
|
|
3
|
+
Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
|
|
4
|
+
|
|
5
|
+
### Properties
|
|
6
|
+
|
|
7
|
+
| Name | Type | Default | Summary |
|
|
8
|
+
|-|-|-|-|
|
|
9
|
+
| for | `string` | `""` | ID of the element that triggers the tooltip on hover or focus. |
|
|
10
|
+
| hide (JS only) | `hide() => void` | `-` | - |
|
|
11
|
+
| hide-delay | `number` | `0` | Milliseconds to wait before hiding the tooltip on mouseout. |
|
|
12
|
+
| no-arrow | `boolean` | `false` | Hide the arrow pointing toward the tooltip target. |
|
|
13
|
+
| open | `boolean` | `false` | Indicates whether the tooltip is visible or not. |
|
|
14
|
+
| placement | [`TooltipPlacement`](#tooltipplacement) | `"top"` | Sets the placement of the tooltip relative to its target. |
|
|
15
|
+
| show (JS only) | `show() => void` | `-` | - |
|
|
16
|
+
| show-delay | `number` | `150` | Milliseconds to wait before showing the tooltip on hover. |
|
|
17
|
+
|
|
18
|
+
### Property Details
|
|
19
|
+
|
|
20
|
+
#### for
|
|
21
|
+
|
|
22
|
+
ID of the element that triggers the tooltip on hover or focus.
|
|
23
|
+
|
|
24
|
+
- Type: `string`
|
|
25
|
+
- Default: `""`
|
|
26
|
+
|
|
27
|
+
#### hide (JS only)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- Type: `hide() => void`
|
|
32
|
+
- Default: `-`
|
|
33
|
+
|
|
34
|
+
#### hide-delay
|
|
35
|
+
|
|
36
|
+
Milliseconds to wait before hiding the tooltip on mouseout.
|
|
37
|
+
|
|
38
|
+
- Type: `number`
|
|
39
|
+
- Default: `0`
|
|
40
|
+
|
|
41
|
+
#### no-arrow
|
|
42
|
+
|
|
43
|
+
Hide the arrow pointing toward the tooltip target.
|
|
44
|
+
|
|
45
|
+
- Type: `boolean`
|
|
46
|
+
- Default: `false`
|
|
47
|
+
|
|
48
|
+
#### open
|
|
49
|
+
|
|
50
|
+
Indicates whether the tooltip is visible or not.
|
|
51
|
+
|
|
52
|
+
- Type: `boolean`
|
|
53
|
+
- Default: `false`
|
|
54
|
+
|
|
55
|
+
#### placement
|
|
56
|
+
|
|
57
|
+
Sets the placement of the tooltip relative to its target.
|
|
58
|
+
|
|
59
|
+
The tooltip will try to position itself at the given placement. If there is no room it will flip to the opposite side automatically.
|
|
60
|
+
|
|
61
|
+
- Type: [`TooltipPlacement`](#tooltipplacement)
|
|
62
|
+
- Default: `"top"`
|
|
63
|
+
|
|
64
|
+
#### show (JS only)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- Type: `show() => void`
|
|
69
|
+
- Default: `-`
|
|
70
|
+
|
|
71
|
+
#### show-delay
|
|
72
|
+
|
|
73
|
+
Milliseconds to wait before showing the tooltip on hover.
|
|
74
|
+
|
|
75
|
+
Keep at a non-zero value to avoid flickering the tooltip on and off when cursors move quickly past the target element.
|
|
76
|
+
|
|
77
|
+
Focusing the target element shows the tooltip immediately.
|
|
78
|
+
|
|
79
|
+
- Type: `number`
|
|
80
|
+
- Default: `150`
|
|
81
|
+
|
|
82
|
+
### Types
|
|
83
|
+
|
|
84
|
+
#### TooltipPlacement
|
|
85
|
+
|
|
86
|
+
`'top' | 'right' | 'bottom' | 'left'`
|
|
87
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
By default the tooltip is placed above the target element if there is room. If there's no room above it flips side and is placed below the target.
|
|
4
|
+
|
|
5
|
+
<elements-example>
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<w-button id="basic-button" aria-labelledby="basic-tooltip">Hover over me</w-button>
|
|
9
|
+
<w-tooltip id="basic-tooltip" for="basic-button">I am a tooltip</w-tooltip>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
</elements-example>
|
|
13
|
+
|
|
14
|
+
### Adjust placement
|
|
15
|
+
|
|
16
|
+
You can specify a different initial placement. If there's no room the tooltip flips to the opposite side of the target.
|
|
17
|
+
|
|
18
|
+
Available positions:
|
|
19
|
+
|
|
20
|
+
- `top` (this is the default)
|
|
21
|
+
- `bottom`
|
|
22
|
+
- `left`
|
|
23
|
+
- `right`
|
|
24
|
+
|
|
25
|
+
<elements-example>
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<w-button id="placed-button" aria-labelledby="placed-tooltip">Hover over me</w-button>
|
|
29
|
+
<w-tooltip id="placed-tooltip" for="placed-button" placement="right">I am a tooltip</w-tooltip>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
</elements-example>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
## Styling API
|
|
2
|
+
|
|
3
|
+
This component supports styling through **component tokens** (CSS custom properties with a --w-c- prefix) and **parts**.
|
|
4
|
+
|
|
5
|
+
### Parts
|
|
6
|
+
|
|
7
|
+
Use `::part(...)` from outside the component.
|
|
8
|
+
|
|
9
|
+
- `tooltip` - the tooltip container with background color, padding etc.
|
|
10
|
+
- `arrow` - a square container used for positioning the visual part of the arrow
|
|
11
|
+
- `beak` - the visual part of the arrow pointing at the target
|
|
12
|
+
- `hover-bridge` - an invisible element there to ensure the tooltip doesn't close when moving the cursor from the target to the tooltip
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
w-tooltip::part(tooltip) {
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Component tokens
|
|
23
|
+
|
|
24
|
+
Set these on `w-tooltip` to override visuals.
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
w-tooltip {
|
|
28
|
+
--w-c-tooltip-bg: lime;
|
|
29
|
+
--w-c-tooltip-color: black;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Layout & typography
|
|
34
|
+
|
|
35
|
+
- `--w-c-tooltip-z-index`
|
|
36
|
+
|
|
37
|
+
#### Background
|
|
38
|
+
|
|
39
|
+
- `--w-c-tooltip-bg`
|
|
40
|
+
|
|
41
|
+
#### Text color
|
|
42
|
+
|
|
43
|
+
- `--w-c-tooltip-color`
|
|
44
|
+
|
|
45
|
+
##### Shadow
|
|
46
|
+
|
|
47
|
+
- `--w-c-tooltip-box-shadow`
|