@vaadin/select 25.3.0-alpha3 → 25.3.0-alpha5
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/custom-elements.json +303 -3
- package/package.json +16 -16
- package/src/lit/renderer-directives.d.ts +1 -0
- package/src/lit/renderer-directives.js +1 -0
- package/src/vaadin-select-base-mixin.d.ts +4 -2
- package/src/vaadin-select-base-mixin.js +51 -4
- package/src/vaadin-select-item.d.ts +33 -1
- package/src/vaadin-select-item.js +33 -2
- package/src/vaadin-select-list-box.d.ts +20 -1
- package/src/vaadin-select-list-box.js +20 -2
- package/src/vaadin-select-overlay-mixin.js +10 -3
- package/src/vaadin-select.d.ts +30 -9
- package/src/vaadin-select.js +26 -10
- package/vaadin-select-item.d.ts +1 -0
- package/vaadin-select-item.js +2 -0
- package/vaadin-select-list-box.d.ts +1 -0
- package/vaadin-select-list-box.js +2 -0
- package/web-types.json +128 -3
- package/web-types.lit.json +51 -2
package/custom-elements.json
CHANGED
|
@@ -17,6 +17,36 @@
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "vaadin-select-list-box.js",
|
|
23
|
+
"declarations": [],
|
|
24
|
+
"exports": [
|
|
25
|
+
{
|
|
26
|
+
"kind": "js",
|
|
27
|
+
"name": "*",
|
|
28
|
+
"declaration": {
|
|
29
|
+
"name": "*",
|
|
30
|
+
"module": "src/vaadin-select-list-box.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "javascript-module",
|
|
37
|
+
"path": "vaadin-select-item.js",
|
|
38
|
+
"declarations": [],
|
|
39
|
+
"exports": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "js",
|
|
42
|
+
"name": "*",
|
|
43
|
+
"declaration": {
|
|
44
|
+
"name": "*",
|
|
45
|
+
"module": "src/vaadin-select-item.js"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
20
50
|
{
|
|
21
51
|
"kind": "javascript-module",
|
|
22
52
|
"path": "src/vaadin-select-base-mixin.js",
|
|
@@ -143,7 +173,7 @@
|
|
|
143
173
|
"name": "items",
|
|
144
174
|
"privacy": "public",
|
|
145
175
|
"type": {
|
|
146
|
-
"text": "!Array<!
|
|
176
|
+
"text": "!Array<!SelectItemData>"
|
|
147
177
|
},
|
|
148
178
|
"description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.\nTo render the item with a custom component, provide a tag name by the `component` property.",
|
|
149
179
|
"attribute": "items"
|
|
@@ -234,6 +264,7 @@
|
|
|
234
264
|
"text": "!SelectRenderer | undefined"
|
|
235
265
|
},
|
|
236
266
|
"description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
|
|
267
|
+
"deprecated": "Use a slotted `<vaadin-select-list-box>` or the `items` property instead",
|
|
237
268
|
"attribute": "renderer"
|
|
238
269
|
},
|
|
239
270
|
{
|
|
@@ -453,6 +484,7 @@
|
|
|
453
484
|
"text": "!SelectRenderer | undefined"
|
|
454
485
|
},
|
|
455
486
|
"description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
|
|
487
|
+
"deprecated": "Use a slotted `<vaadin-select-list-box>` or the `items` property instead",
|
|
456
488
|
"fieldName": "renderer"
|
|
457
489
|
},
|
|
458
490
|
{
|
|
@@ -512,6 +544,272 @@
|
|
|
512
544
|
}
|
|
513
545
|
]
|
|
514
546
|
},
|
|
547
|
+
{
|
|
548
|
+
"kind": "javascript-module",
|
|
549
|
+
"path": "src/vaadin-select-item.js",
|
|
550
|
+
"declarations": [
|
|
551
|
+
{
|
|
552
|
+
"kind": "class",
|
|
553
|
+
"description": "`<vaadin-select-item>` is a Web Component for creating `<vaadin-select>` items.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-item-border-radius` |\n| `--vaadin-item-checkmark-color` |\n| `--vaadin-item-gap` |\n| `--vaadin-item-height` |\n| `--vaadin-item-padding` |\n| `--vaadin-item-text-align` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
554
|
+
"name": "SelectItem",
|
|
555
|
+
"members": [
|
|
556
|
+
{
|
|
557
|
+
"kind": "field",
|
|
558
|
+
"name": "disabled",
|
|
559
|
+
"privacy": "public",
|
|
560
|
+
"type": {
|
|
561
|
+
"text": "boolean"
|
|
562
|
+
},
|
|
563
|
+
"description": "If true, the user cannot interact with this element.",
|
|
564
|
+
"attribute": "disabled",
|
|
565
|
+
"inheritedFrom": {
|
|
566
|
+
"name": "DisabledMixin",
|
|
567
|
+
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"kind": "field",
|
|
572
|
+
"name": "selected",
|
|
573
|
+
"privacy": "public",
|
|
574
|
+
"type": {
|
|
575
|
+
"text": "boolean"
|
|
576
|
+
},
|
|
577
|
+
"description": "If true, the item is in selected state.",
|
|
578
|
+
"attribute": "selected",
|
|
579
|
+
"inheritedFrom": {
|
|
580
|
+
"name": "ItemMixin",
|
|
581
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
"kind": "field",
|
|
586
|
+
"name": "value",
|
|
587
|
+
"description": "Submittable string value. The default value is the trimmed text content of the element.",
|
|
588
|
+
"type": {
|
|
589
|
+
"text": "string"
|
|
590
|
+
},
|
|
591
|
+
"inheritedFrom": {
|
|
592
|
+
"name": "ItemMixin",
|
|
593
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
],
|
|
597
|
+
"attributes": [
|
|
598
|
+
{
|
|
599
|
+
"name": "disabled",
|
|
600
|
+
"type": {
|
|
601
|
+
"text": "boolean"
|
|
602
|
+
},
|
|
603
|
+
"description": "If true, the user cannot interact with this element.",
|
|
604
|
+
"fieldName": "disabled",
|
|
605
|
+
"inheritedFrom": {
|
|
606
|
+
"name": "DisabledMixin",
|
|
607
|
+
"package": "@vaadin/a11y-base/src/disabled-mixin.js"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"name": "selected",
|
|
612
|
+
"type": {
|
|
613
|
+
"text": "boolean"
|
|
614
|
+
},
|
|
615
|
+
"description": "If true, the item is in selected state.",
|
|
616
|
+
"fieldName": "selected",
|
|
617
|
+
"inheritedFrom": {
|
|
618
|
+
"name": "ItemMixin",
|
|
619
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
],
|
|
623
|
+
"mixins": [
|
|
624
|
+
{
|
|
625
|
+
"name": "ItemMixin",
|
|
626
|
+
"package": "@vaadin/item/src/vaadin-item-mixin.js"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"name": "ThemableMixin",
|
|
630
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "DirMixin",
|
|
634
|
+
"package": "@vaadin/component-base/src/dir-mixin.js"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
"name": "PolylitMixin",
|
|
638
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"name": "LumoInjectionMixin",
|
|
642
|
+
"package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
|
|
643
|
+
}
|
|
644
|
+
],
|
|
645
|
+
"superclass": {
|
|
646
|
+
"name": "LitElement",
|
|
647
|
+
"package": "lit"
|
|
648
|
+
},
|
|
649
|
+
"tagName": "vaadin-select-item",
|
|
650
|
+
"customElement": true,
|
|
651
|
+
"events": []
|
|
652
|
+
}
|
|
653
|
+
],
|
|
654
|
+
"exports": [
|
|
655
|
+
{
|
|
656
|
+
"kind": "js",
|
|
657
|
+
"name": "SelectItem",
|
|
658
|
+
"declaration": {
|
|
659
|
+
"name": "SelectItem",
|
|
660
|
+
"module": "src/vaadin-select-item.js"
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
]
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"kind": "javascript-module",
|
|
667
|
+
"path": "src/vaadin-select-list-box.js",
|
|
668
|
+
"declarations": [
|
|
669
|
+
{
|
|
670
|
+
"kind": "class",
|
|
671
|
+
"description": "`<vaadin-select-list-box>` is a Web Component for wrapping `<vaadin-select>` items.\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"foo\">Foo</vaadin-select-item>\n <vaadin-select-item value=\"bar\">Bar</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------------|------------------------\n`items` | The items container\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
672
|
+
"name": "SelectListBox",
|
|
673
|
+
"members": [
|
|
674
|
+
{
|
|
675
|
+
"kind": "field",
|
|
676
|
+
"name": "disabled",
|
|
677
|
+
"privacy": "public",
|
|
678
|
+
"type": {
|
|
679
|
+
"text": "boolean"
|
|
680
|
+
},
|
|
681
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
682
|
+
"attribute": "disabled",
|
|
683
|
+
"inheritedFrom": {
|
|
684
|
+
"name": "ListMixin",
|
|
685
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"kind": "field",
|
|
690
|
+
"name": "items",
|
|
691
|
+
"privacy": "public",
|
|
692
|
+
"type": {
|
|
693
|
+
"text": "!Array<!Element> | undefined"
|
|
694
|
+
},
|
|
695
|
+
"description": "A read-only list of items from which a selection can be made.\nIt is populated from the elements passed to the light DOM,\nand updated dynamically when adding or removing items.",
|
|
696
|
+
"attribute": "items",
|
|
697
|
+
"readonly": true,
|
|
698
|
+
"inheritedFrom": {
|
|
699
|
+
"name": "ListMixin",
|
|
700
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"kind": "field",
|
|
705
|
+
"name": "orientation",
|
|
706
|
+
"privacy": "public",
|
|
707
|
+
"type": {
|
|
708
|
+
"text": "string"
|
|
709
|
+
},
|
|
710
|
+
"description": "Define how items are disposed in the dom.\nPossible values are: `horizontal|vertical`.\nIt also changes navigation keys from left/right to up/down.",
|
|
711
|
+
"attribute": "orientation",
|
|
712
|
+
"readonly": true,
|
|
713
|
+
"inheritedFrom": {
|
|
714
|
+
"name": "ListMixin",
|
|
715
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"kind": "field",
|
|
720
|
+
"name": "selected",
|
|
721
|
+
"privacy": "public",
|
|
722
|
+
"type": {
|
|
723
|
+
"text": "number"
|
|
724
|
+
},
|
|
725
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
726
|
+
"attribute": "selected",
|
|
727
|
+
"inheritedFrom": {
|
|
728
|
+
"name": "ListMixin",
|
|
729
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
],
|
|
733
|
+
"attributes": [
|
|
734
|
+
{
|
|
735
|
+
"name": "disabled",
|
|
736
|
+
"type": {
|
|
737
|
+
"text": "boolean"
|
|
738
|
+
},
|
|
739
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
740
|
+
"fieldName": "disabled",
|
|
741
|
+
"inheritedFrom": {
|
|
742
|
+
"name": "ListMixin",
|
|
743
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"name": "orientation",
|
|
748
|
+
"type": {
|
|
749
|
+
"text": "string"
|
|
750
|
+
},
|
|
751
|
+
"description": "Define how items are disposed in the dom.\nPossible values are: `horizontal|vertical`.\nIt also changes navigation keys from left/right to up/down.",
|
|
752
|
+
"fieldName": "orientation",
|
|
753
|
+
"inheritedFrom": {
|
|
754
|
+
"name": "ListMixin",
|
|
755
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"name": "selected",
|
|
760
|
+
"type": {
|
|
761
|
+
"text": "number"
|
|
762
|
+
},
|
|
763
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
764
|
+
"fieldName": "selected",
|
|
765
|
+
"inheritedFrom": {
|
|
766
|
+
"name": "ListMixin",
|
|
767
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
],
|
|
771
|
+
"mixins": [
|
|
772
|
+
{
|
|
773
|
+
"name": "ListMixin",
|
|
774
|
+
"package": "@vaadin/a11y-base/src/list-mixin.js"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"name": "ThemableMixin",
|
|
778
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"name": "DirMixin",
|
|
782
|
+
"package": "@vaadin/component-base/src/dir-mixin.js"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"name": "PolylitMixin",
|
|
786
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"name": "LumoInjectionMixin",
|
|
790
|
+
"package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
|
|
791
|
+
}
|
|
792
|
+
],
|
|
793
|
+
"superclass": {
|
|
794
|
+
"name": "LitElement",
|
|
795
|
+
"package": "lit"
|
|
796
|
+
},
|
|
797
|
+
"tagName": "vaadin-select-list-box",
|
|
798
|
+
"customElement": true,
|
|
799
|
+
"events": []
|
|
800
|
+
}
|
|
801
|
+
],
|
|
802
|
+
"exports": [
|
|
803
|
+
{
|
|
804
|
+
"kind": "js",
|
|
805
|
+
"name": "SelectListBox",
|
|
806
|
+
"declaration": {
|
|
807
|
+
"name": "SelectListBox",
|
|
808
|
+
"module": "src/vaadin-select-list-box.js"
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
515
813
|
{
|
|
516
814
|
"kind": "javascript-module",
|
|
517
815
|
"path": "src/vaadin-select-overlay-mixin.js",
|
|
@@ -1034,7 +1332,7 @@
|
|
|
1034
1332
|
"declarations": [
|
|
1035
1333
|
{
|
|
1036
1334
|
"kind": "class",
|
|
1037
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function
|
|
1335
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n---------------------------------|-----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-select-overlay-width` | Width of the overlay |\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and toggle button\n`field-button` | Set on the toggle button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).\n- [`<vaadin-select-list-box>`](#/elements/vaadin-select-list-box) - a list-box element.\n- [`<vaadin-select-item>`](#/elements/vaadin-select-item) - an item element.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
1038
1336
|
"name": "Select",
|
|
1039
1337
|
"members": [
|
|
1040
1338
|
{
|
|
@@ -1154,7 +1452,7 @@
|
|
|
1154
1452
|
"name": "items",
|
|
1155
1453
|
"privacy": "public",
|
|
1156
1454
|
"type": {
|
|
1157
|
-
"text": "!Array<!
|
|
1455
|
+
"text": "!Array<!SelectItemData>"
|
|
1158
1456
|
},
|
|
1159
1457
|
"description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.\nTo render the item with a custom component, provide a tag name by the `component` property.",
|
|
1160
1458
|
"attribute": "items",
|
|
@@ -1269,6 +1567,7 @@
|
|
|
1269
1567
|
"text": "!SelectRenderer | undefined"
|
|
1270
1568
|
},
|
|
1271
1569
|
"description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
|
|
1570
|
+
"deprecated": "Use a slotted `<vaadin-select-list-box>` or the `items` property instead",
|
|
1272
1571
|
"attribute": "renderer",
|
|
1273
1572
|
"inheritedFrom": {
|
|
1274
1573
|
"name": "SelectBaseMixin",
|
|
@@ -1575,6 +1874,7 @@
|
|
|
1575
1874
|
"text": "!SelectRenderer | undefined"
|
|
1576
1875
|
},
|
|
1577
1876
|
"description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
|
|
1877
|
+
"deprecated": "Use a slotted `<vaadin-select-list-box>` or the `items` property instead",
|
|
1578
1878
|
"fieldName": "renderer",
|
|
1579
1879
|
"inheritedFrom": {
|
|
1580
1880
|
"name": "SelectBaseMixin",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
41
|
-
"@vaadin/button": "25.3.0-
|
|
42
|
-
"@vaadin/component-base": "25.3.0-
|
|
43
|
-
"@vaadin/field-base": "25.3.0-
|
|
44
|
-
"@vaadin/input-container": "25.3.0-
|
|
45
|
-
"@vaadin/item": "25.3.0-
|
|
46
|
-
"@vaadin/list-box": "25.3.0-
|
|
47
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
48
|
-
"@vaadin/overlay": "25.3.0-
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.3.0-alpha5",
|
|
41
|
+
"@vaadin/button": "25.3.0-alpha5",
|
|
42
|
+
"@vaadin/component-base": "25.3.0-alpha5",
|
|
43
|
+
"@vaadin/field-base": "25.3.0-alpha5",
|
|
44
|
+
"@vaadin/input-container": "25.3.0-alpha5",
|
|
45
|
+
"@vaadin/item": "25.3.0-alpha5",
|
|
46
|
+
"@vaadin/list-box": "25.3.0-alpha5",
|
|
47
|
+
"@vaadin/lit-renderer": "25.3.0-alpha5",
|
|
48
|
+
"@vaadin/overlay": "25.3.0-alpha5",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha5",
|
|
50
50
|
"lit": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@vaadin/aura": "25.3.0-
|
|
54
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
55
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
53
|
+
"@vaadin/aura": "25.3.0-alpha5",
|
|
54
|
+
"@vaadin/chai-plugins": "25.3.0-alpha5",
|
|
55
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha5",
|
|
56
56
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
57
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
57
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha5",
|
|
58
58
|
"sinon": "^22.0.0"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "custom-elements.json",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"web-types.json",
|
|
63
63
|
"web-types.lit.json"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "0be2142cd8b95a562d58735033f947f7109103ab"
|
|
66
66
|
}
|
|
@@ -52,6 +52,7 @@ export class SelectRendererDirective extends LitRendererDirective<Select, Select
|
|
|
52
52
|
* @param renderer the renderer callback that returns a Lit template.
|
|
53
53
|
* @param dependencies a single dependency or an array of dependencies
|
|
54
54
|
* which trigger a re-render when changed.
|
|
55
|
+
* @deprecated Use a slotted `<vaadin-select-list-box>` or the `items` property instead
|
|
55
56
|
*/
|
|
56
57
|
export declare function selectRenderer(
|
|
57
58
|
renderer: SelectLitRenderer,
|
|
@@ -56,5 +56,6 @@ export class SelectRendererDirective extends LitRendererDirective {
|
|
|
56
56
|
* @param renderer the renderer callback that returns a Lit template.
|
|
57
57
|
* @param dependencies a single dependency or an array of dependencies
|
|
58
58
|
* which trigger a re-render when changed.
|
|
59
|
+
* @deprecated Use a slotted `<vaadin-select-list-box>` or the `items` property instead
|
|
59
60
|
*/
|
|
60
61
|
export const selectRenderer = directive(SelectRendererDirective);
|
|
@@ -13,7 +13,7 @@ import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegat
|
|
|
13
13
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
14
14
|
import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
|
|
15
15
|
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
|
|
16
|
-
import type {
|
|
16
|
+
import type { SelectItemData, SelectRenderer } from './vaadin-select.js';
|
|
17
17
|
|
|
18
18
|
export declare function SelectBaseMixin<T extends Constructor<HTMLElement>>(
|
|
19
19
|
base: T,
|
|
@@ -49,7 +49,7 @@ export declare class SelectBaseMixinClass {
|
|
|
49
49
|
* Note: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.
|
|
50
50
|
* To render the item with a custom component, provide a tag name by the `component` property.
|
|
51
51
|
*/
|
|
52
|
-
items:
|
|
52
|
+
items: SelectItemData[] | null | undefined;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Set when the select is open
|
|
@@ -62,6 +62,8 @@ export declare class SelectBaseMixinClass {
|
|
|
62
62
|
*
|
|
63
63
|
* - `root` The internal container DOM element. Append your content to it.
|
|
64
64
|
* - `select` The reference to the `<vaadin-select>` element.
|
|
65
|
+
*
|
|
66
|
+
* @deprecated Use a slotted `<vaadin-select-list-box>` or the `items` property instead
|
|
65
67
|
*/
|
|
66
68
|
renderer: SelectRenderer | undefined;
|
|
67
69
|
|
|
@@ -10,6 +10,7 @@ import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mi
|
|
|
10
10
|
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
|
|
11
11
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
12
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
13
|
+
import { issueWarning } from '@vaadin/component-base/src/warnings.js';
|
|
13
14
|
import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
|
|
14
15
|
import { LabelController } from '@vaadin/field-base/src/label-controller.js';
|
|
15
16
|
import { ButtonController } from './button-controller.js';
|
|
@@ -37,7 +38,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
37
38
|
* Note: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.
|
|
38
39
|
* To render the item with a custom component, provide a tag name by the `component` property.
|
|
39
40
|
*
|
|
40
|
-
* @type {!Array<!
|
|
41
|
+
* @type {!Array<!SelectItemData>}
|
|
41
42
|
*/
|
|
42
43
|
items: {
|
|
43
44
|
type: Array,
|
|
@@ -62,7 +63,9 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
62
63
|
*
|
|
63
64
|
* - `root` The internal container DOM element. Append your content to it.
|
|
64
65
|
* - `select` The reference to the `<vaadin-select>` element.
|
|
66
|
+
*
|
|
65
67
|
* @type {!SelectRenderer | undefined}
|
|
68
|
+
* @deprecated Use a slotted `<vaadin-select-list-box>` or the `items` property instead
|
|
66
69
|
*/
|
|
67
70
|
renderer: {
|
|
68
71
|
type: Object,
|
|
@@ -138,6 +141,15 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
138
141
|
|
|
139
142
|
/** @private */
|
|
140
143
|
_items: Object,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The `<vaadin-select-list-box>` slotted directly into the overlay slot.
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
__slottedListBox: {
|
|
150
|
+
type: Object,
|
|
151
|
+
sync: true,
|
|
152
|
+
},
|
|
141
153
|
};
|
|
142
154
|
}
|
|
143
155
|
|
|
@@ -199,6 +211,25 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
199
211
|
if (props.has('_phone')) {
|
|
200
212
|
this.toggleAttribute('phone', this._phone);
|
|
201
213
|
}
|
|
214
|
+
|
|
215
|
+
if (props.has('__slottedListBox')) {
|
|
216
|
+
const slottedListBox = this.__slottedListBox;
|
|
217
|
+
if (slottedListBox) {
|
|
218
|
+
// Slotted list-box takes precedence over the `renderer` and `items`.
|
|
219
|
+
if (this.items?.length || this.renderer) {
|
|
220
|
+
issueWarning(
|
|
221
|
+
'WARNING: Both a slotted <vaadin-select-list-box> and the "items" / "renderer"' +
|
|
222
|
+
' property are set on <vaadin-select>. The slotted list-box takes precedence.',
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
this._assignMenuElement(slottedListBox);
|
|
227
|
+
} else if (props.get('__slottedListBox')) {
|
|
228
|
+
this._menuElement = null;
|
|
229
|
+
this._items = null;
|
|
230
|
+
this.__lastMenuElement = null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
202
233
|
}
|
|
203
234
|
|
|
204
235
|
/**
|
|
@@ -231,8 +262,8 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
231
262
|
}
|
|
232
263
|
|
|
233
264
|
/**
|
|
234
|
-
* @param {
|
|
235
|
-
* @param {
|
|
265
|
+
* @param {SelectItemData[] | undefined | null} newItems
|
|
266
|
+
* @param {SelectItemData[] | undefined | null} oldItems
|
|
236
267
|
* @private
|
|
237
268
|
*/
|
|
238
269
|
__itemsChanged(newItems, oldItems) {
|
|
@@ -241,6 +272,17 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
241
272
|
}
|
|
242
273
|
}
|
|
243
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Detects a `<vaadin-select-list-box>` slotted directly into the overlay
|
|
277
|
+
* slot (instead of the default one rendered into slotted `div` element).
|
|
278
|
+
*
|
|
279
|
+
* @param {!Event} e
|
|
280
|
+
* @private
|
|
281
|
+
*/
|
|
282
|
+
__onOverlaySlotChange(e) {
|
|
283
|
+
this.__slottedListBox = e.target.assignedElements().find((el) => el._hasVaadinListMixin);
|
|
284
|
+
}
|
|
285
|
+
|
|
244
286
|
/**
|
|
245
287
|
* @param {HTMLElement} menuElement
|
|
246
288
|
* @protected
|
|
@@ -467,7 +509,7 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
467
509
|
}
|
|
468
510
|
|
|
469
511
|
/**
|
|
470
|
-
* @param {!
|
|
512
|
+
* @param {!SelectItemData} item
|
|
471
513
|
* @private
|
|
472
514
|
*/
|
|
473
515
|
__createItemElement(item) {
|
|
@@ -651,6 +693,11 @@ export const SelectBaseMixin = (superClass) =>
|
|
|
651
693
|
* @private
|
|
652
694
|
*/
|
|
653
695
|
__defaultRenderer(root, _select) {
|
|
696
|
+
if (this.__slottedListBox) {
|
|
697
|
+
root.textContent = '';
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
654
701
|
if (!this.items || this.items.length === 0) {
|
|
655
702
|
root.textContent = '';
|
|
656
703
|
return;
|
|
@@ -8,7 +8,39 @@ import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
|
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* `<vaadin-select-item>` is a Web Component for creating `<vaadin-select>` items.
|
|
12
|
+
*
|
|
13
|
+
* ### Styling
|
|
14
|
+
*
|
|
15
|
+
* The following shadow DOM parts are available for styling:
|
|
16
|
+
*
|
|
17
|
+
* Part name | Description
|
|
18
|
+
* -------------|----------------
|
|
19
|
+
* `checkmark` | The graphical checkmark shown for a selected item
|
|
20
|
+
* `content` | The element that wraps the slot
|
|
21
|
+
*
|
|
22
|
+
* The following state attributes are available for styling:
|
|
23
|
+
*
|
|
24
|
+
* Attribute | Description
|
|
25
|
+
* -------------|-------------
|
|
26
|
+
* `active` | Set when the item is pressed down, either with mouse, touch or the keyboard.
|
|
27
|
+
* `disabled` | Set when the item is disabled.
|
|
28
|
+
* `focus-ring` | Set when the item is focused using the keyboard.
|
|
29
|
+
* `focused` | Set when the item is focused.
|
|
30
|
+
* `selected` | Set when the item is selected
|
|
31
|
+
*
|
|
32
|
+
* The following custom CSS properties are available for styling:
|
|
33
|
+
*
|
|
34
|
+
* Custom CSS property |
|
|
35
|
+
* :----------------------------------|
|
|
36
|
+
* | `--vaadin-item-border-radius` |
|
|
37
|
+
* | `--vaadin-item-checkmark-color` |
|
|
38
|
+
* | `--vaadin-item-gap` |
|
|
39
|
+
* | `--vaadin-item-height` |
|
|
40
|
+
* | `--vaadin-item-padding` |
|
|
41
|
+
* | `--vaadin-item-text-align` |
|
|
42
|
+
*
|
|
43
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
12
44
|
*/
|
|
13
45
|
declare class SelectItem extends ItemMixin(DirMixin(ThemableMixin(HTMLElement))) {}
|
|
14
46
|
|
|
@@ -13,11 +13,42 @@ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection
|
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* `<vaadin-select-item>` is a Web Component for creating `<vaadin-select>` items.
|
|
17
|
+
*
|
|
18
|
+
* ### Styling
|
|
19
|
+
*
|
|
20
|
+
* The following shadow DOM parts are available for styling:
|
|
21
|
+
*
|
|
22
|
+
* Part name | Description
|
|
23
|
+
* -------------|----------------
|
|
24
|
+
* `checkmark` | The graphical checkmark shown for a selected item
|
|
25
|
+
* `content` | The element that wraps the slot
|
|
26
|
+
*
|
|
27
|
+
* The following state attributes are available for styling:
|
|
28
|
+
*
|
|
29
|
+
* Attribute | Description
|
|
30
|
+
* -------------|-------------
|
|
31
|
+
* `active` | Set when the item is pressed down, either with mouse, touch or the keyboard.
|
|
32
|
+
* `disabled` | Set when the item is disabled.
|
|
33
|
+
* `focus-ring` | Set when the item is focused using the keyboard.
|
|
34
|
+
* `focused` | Set when the item is focused.
|
|
35
|
+
* `selected` | Set when the item is selected
|
|
36
|
+
*
|
|
37
|
+
* The following custom CSS properties are available for styling:
|
|
38
|
+
*
|
|
39
|
+
* Custom CSS property |
|
|
40
|
+
* :----------------------------------|
|
|
41
|
+
* | `--vaadin-item-border-radius` |
|
|
42
|
+
* | `--vaadin-item-checkmark-color` |
|
|
43
|
+
* | `--vaadin-item-gap` |
|
|
44
|
+
* | `--vaadin-item-height` |
|
|
45
|
+
* | `--vaadin-item-padding` |
|
|
46
|
+
* | `--vaadin-item-text-align` |
|
|
47
|
+
*
|
|
48
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
17
49
|
*
|
|
18
50
|
* @customElement vaadin-select-item
|
|
19
51
|
* @extends HTMLElement
|
|
20
|
-
* @protected
|
|
21
52
|
*/
|
|
22
53
|
class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
23
54
|
static get is() {
|
|
@@ -8,7 +8,26 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* `<vaadin-select-list-box>` is a Web Component for wrapping `<vaadin-select>` items.
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <vaadin-select>
|
|
15
|
+
* <vaadin-select-list-box slot="overlay">
|
|
16
|
+
* <vaadin-select-item value="foo">Foo</vaadin-select-item>
|
|
17
|
+
* <vaadin-select-item value="bar">Bar</vaadin-select-item>
|
|
18
|
+
* </vaadin-select-list-box>
|
|
19
|
+
* </vaadin-select>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ### Styling
|
|
23
|
+
*
|
|
24
|
+
* The following shadow DOM parts are available for styling:
|
|
25
|
+
*
|
|
26
|
+
* Part name | Description
|
|
27
|
+
* ------------------|------------------------
|
|
28
|
+
* `items` | The items container
|
|
29
|
+
*
|
|
30
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
12
31
|
*/
|
|
13
32
|
declare class SelectListBox extends ListMixin(DirMixin(ThemableMixin(HTMLElement))) {}
|
|
14
33
|
|
|
@@ -13,11 +13,29 @@ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection
|
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* `<vaadin-select-list-box>` is a Web Component for wrapping `<vaadin-select>` items.
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <vaadin-select>
|
|
20
|
+
* <vaadin-select-list-box slot="overlay">
|
|
21
|
+
* <vaadin-select-item value="foo">Foo</vaadin-select-item>
|
|
22
|
+
* <vaadin-select-item value="bar">Bar</vaadin-select-item>
|
|
23
|
+
* </vaadin-select-list-box>
|
|
24
|
+
* </vaadin-select>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ### Styling
|
|
28
|
+
*
|
|
29
|
+
* The following shadow DOM parts are available for styling:
|
|
30
|
+
*
|
|
31
|
+
* Part name | Description
|
|
32
|
+
* ------------------|------------------------
|
|
33
|
+
* `items` | The items container
|
|
34
|
+
*
|
|
35
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
17
36
|
*
|
|
18
37
|
* @customElement vaadin-select-list-box
|
|
19
38
|
* @extends HTMLElement
|
|
20
|
-
* @protected
|
|
21
39
|
*/
|
|
22
40
|
class SelectListBox extends ListMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
23
41
|
static get is() {
|
|
@@ -21,12 +21,14 @@ export const SelectOverlayMixin = (superClass) =>
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Override method from OverlayFocusMixin to use
|
|
24
|
+
* Override method from OverlayFocusMixin to use the content root that
|
|
25
|
+
* actually holds the focused item, so focus is restored on close.
|
|
26
|
+
*
|
|
25
27
|
* @protected
|
|
26
28
|
* @override
|
|
27
29
|
*/
|
|
28
30
|
get _contentRoot() {
|
|
29
|
-
return this._rendererRoot;
|
|
31
|
+
return this.owner.__slottedListBox || this._rendererRoot;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -70,7 +72,12 @@ export const SelectOverlayMixin = (superClass) =>
|
|
|
70
72
|
|
|
71
73
|
/** @protected */
|
|
72
74
|
_getMenuElement() {
|
|
73
|
-
|
|
75
|
+
const slot = this.owner.shadowRoot.querySelector('slot[name="overlay"]');
|
|
76
|
+
const assigned = slot.assignedElements();
|
|
77
|
+
return (
|
|
78
|
+
assigned.find((el) => el._hasVaadinListMixin) ||
|
|
79
|
+
assigned.flatMap((el) => [...el.children]).find((el) => el._hasVaadinListMixin)
|
|
80
|
+
);
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
/** @private */
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
|
7
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
8
|
import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface SelectItemData {
|
|
11
11
|
label?: string;
|
|
12
12
|
value?: string;
|
|
13
13
|
component?: string;
|
|
@@ -15,6 +15,11 @@ export interface SelectItem {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `SelectItemData` instead.
|
|
20
|
+
*/
|
|
21
|
+
export type SelectItem = SelectItemData;
|
|
22
|
+
|
|
18
23
|
/**
|
|
19
24
|
* Fired when the user commits a value change.
|
|
20
25
|
*/
|
|
@@ -90,7 +95,26 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
|
|
|
90
95
|
*
|
|
91
96
|
* ### Rendering
|
|
92
97
|
*
|
|
93
|
-
* Alternatively, the content of the select can be populated by using
|
|
98
|
+
* Alternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`
|
|
99
|
+
* with `<vaadin-select-item>` children:
|
|
100
|
+
*
|
|
101
|
+
* ```html
|
|
102
|
+
* <vaadin-select>
|
|
103
|
+
* <vaadin-select-list-box slot="overlay">
|
|
104
|
+
* <vaadin-select-item value="recent">Most recent first</vaadin-select-item>
|
|
105
|
+
* <vaadin-select-item value="rating-asc">Rating: low to high</vaadin-select-item>
|
|
106
|
+
* <vaadin-select-item value="rating-desc">Rating: high to low</vaadin-select-item>
|
|
107
|
+
* </vaadin-select-list-box>
|
|
108
|
+
* </vaadin-select>
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* * Hint: By setting the `label` property of inner vaadin-items you will
|
|
112
|
+
* be able to change the visual representation of the selected value in the input part.
|
|
113
|
+
*
|
|
114
|
+
* #### Renderer (deprecated)
|
|
115
|
+
*
|
|
116
|
+
* The content of the select can also be populated by using the renderer callback function, although
|
|
117
|
+
* this approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.
|
|
94
118
|
*
|
|
95
119
|
* The renderer function provides `root`, `select` arguments.
|
|
96
120
|
* Generate DOM content, append it to the `root` element and control the state
|
|
@@ -118,9 +142,6 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
|
|
|
118
142
|
* in the next renderer call and will be provided with the `root` argument.
|
|
119
143
|
* On first call it will be empty.
|
|
120
144
|
*
|
|
121
|
-
* * Hint: By setting the `label` property of inner vaadin-items you will
|
|
122
|
-
* be able to change the visual representation of the selected value in the input part.
|
|
123
|
-
*
|
|
124
145
|
* ### Styling
|
|
125
146
|
*
|
|
126
147
|
* The following custom properties are available for styling:
|
|
@@ -163,12 +184,12 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
|
|
|
163
184
|
*
|
|
164
185
|
* ### Internal components
|
|
165
186
|
*
|
|
166
|
-
* In addition to `<vaadin-select>` itself, the following internal
|
|
167
|
-
*
|
|
187
|
+
* In addition to `<vaadin-select>` itself, the following internal components are used
|
|
188
|
+
* and themable:
|
|
168
189
|
*
|
|
169
190
|
* - `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
|
|
170
|
-
* - `<vaadin-select-list-box>`
|
|
171
|
-
* - `<vaadin-select-item>`
|
|
191
|
+
* - [`<vaadin-select-list-box>`](#/elements/vaadin-select-list-box) - a list-box element.
|
|
192
|
+
* - [`<vaadin-select-item>`](#/elements/vaadin-select-item) - an item element.
|
|
172
193
|
*
|
|
173
194
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
174
195
|
*
|
package/src/vaadin-select.js
CHANGED
|
@@ -46,7 +46,26 @@ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
|
46
46
|
*
|
|
47
47
|
* ### Rendering
|
|
48
48
|
*
|
|
49
|
-
* Alternatively, the content of the select can be populated by using
|
|
49
|
+
* Alternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`
|
|
50
|
+
* with `<vaadin-select-item>` children:
|
|
51
|
+
*
|
|
52
|
+
* ```html
|
|
53
|
+
* <vaadin-select>
|
|
54
|
+
* <vaadin-select-list-box slot="overlay">
|
|
55
|
+
* <vaadin-select-item value="recent">Most recent first</vaadin-select-item>
|
|
56
|
+
* <vaadin-select-item value="rating-asc">Rating: low to high</vaadin-select-item>
|
|
57
|
+
* <vaadin-select-item value="rating-desc">Rating: high to low</vaadin-select-item>
|
|
58
|
+
* </vaadin-select-list-box>
|
|
59
|
+
* </vaadin-select>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* * Hint: By setting the `label` property of inner vaadin-items you will
|
|
63
|
+
* be able to change the visual representation of the selected value in the input part.
|
|
64
|
+
*
|
|
65
|
+
* #### Renderer (deprecated)
|
|
66
|
+
*
|
|
67
|
+
* The content of the select can also be populated by using the renderer callback function, although
|
|
68
|
+
* this approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.
|
|
50
69
|
*
|
|
51
70
|
* The renderer function provides `root`, `select` arguments.
|
|
52
71
|
* Generate DOM content, append it to the `root` element and control the state
|
|
@@ -74,9 +93,6 @@ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
|
74
93
|
* in the next renderer call and will be provided with the `root` argument.
|
|
75
94
|
* On first call it will be empty.
|
|
76
95
|
*
|
|
77
|
-
* * Hint: By setting the `label` property of inner vaadin-items you will
|
|
78
|
-
* be able to change the visual representation of the selected value in the input part.
|
|
79
|
-
*
|
|
80
96
|
* ### Styling
|
|
81
97
|
*
|
|
82
98
|
* The following custom properties are available for styling:
|
|
@@ -119,12 +135,12 @@ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
|
|
|
119
135
|
*
|
|
120
136
|
* ### Internal components
|
|
121
137
|
*
|
|
122
|
-
* In addition to `<vaadin-select>` itself, the following internal
|
|
123
|
-
*
|
|
138
|
+
* In addition to `<vaadin-select>` itself, the following internal components are used
|
|
139
|
+
* and themable:
|
|
124
140
|
*
|
|
125
141
|
* - `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
|
|
126
|
-
* - `<vaadin-select-list-box>`
|
|
127
|
-
* - `<vaadin-select-item>`
|
|
142
|
+
* - [`<vaadin-select-list-box>`](#/elements/vaadin-select-list-box) - a list-box element.
|
|
143
|
+
* - [`<vaadin-select-item>`](#/elements/vaadin-select-item) - an item element.
|
|
128
144
|
*
|
|
129
145
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
130
146
|
*
|
|
@@ -188,7 +204,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lum
|
|
|
188
204
|
.positionTarget="${this._inputContainer}"
|
|
189
205
|
.opened="${this.opened}"
|
|
190
206
|
.withBackdrop="${this._phone}"
|
|
191
|
-
.renderer="${this.renderer || this.__defaultRenderer}"
|
|
207
|
+
.renderer="${this.__slottedListBox ? undefined : this.renderer || this.__defaultRenderer}"
|
|
192
208
|
?phone="${this._phone}"
|
|
193
209
|
theme="${ifDefined(this._theme)}"
|
|
194
210
|
?no-vertical-overlap="${this.noVerticalOverlap}"
|
|
@@ -196,7 +212,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lum
|
|
|
196
212
|
@opened-changed="${this._onOpenedChanged}"
|
|
197
213
|
@vaadin-overlay-open="${this._onOverlayOpen}"
|
|
198
214
|
>
|
|
199
|
-
<slot name="overlay"></slot>
|
|
215
|
+
<slot name="overlay" @slotchange="${this.__onOverlaySlotChange}"></slot>
|
|
200
216
|
</vaadin-select-overlay>
|
|
201
217
|
|
|
202
218
|
<slot name="tooltip"></slot>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-select-item.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/vaadin-select-list-box.js';
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,139 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha5",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-select-item",
|
|
11
|
+
"description": "`<vaadin-select-item>` is a Web Component for creating `<vaadin-select>` items.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-item-border-radius` |\n| `--vaadin-item-checkmark-color` |\n| `--vaadin-item-gap` |\n| `--vaadin-item-height` |\n| `--vaadin-item-padding` |\n| `--vaadin-item-text-align` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "disabled",
|
|
15
|
+
"description": "If true, the user cannot interact with this element.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"boolean"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "selected",
|
|
24
|
+
"description": "If true, the item is in selected state.",
|
|
25
|
+
"value": {
|
|
26
|
+
"type": [
|
|
27
|
+
"boolean"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "theme",
|
|
33
|
+
"description": "The theme variants to apply to the component.",
|
|
34
|
+
"value": {
|
|
35
|
+
"type": [
|
|
36
|
+
"string",
|
|
37
|
+
"null",
|
|
38
|
+
"undefined"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"js": {
|
|
44
|
+
"properties": [
|
|
45
|
+
{
|
|
46
|
+
"name": "disabled",
|
|
47
|
+
"description": "If true, the user cannot interact with this element.",
|
|
48
|
+
"value": {
|
|
49
|
+
"type": [
|
|
50
|
+
"boolean"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "selected",
|
|
56
|
+
"description": "If true, the item is in selected state.",
|
|
57
|
+
"value": {
|
|
58
|
+
"type": [
|
|
59
|
+
"boolean"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "value",
|
|
65
|
+
"description": "Submittable string value. The default value is the trimmed text content of the element.",
|
|
66
|
+
"value": {
|
|
67
|
+
"type": [
|
|
68
|
+
"string"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"events": []
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "vaadin-select-list-box",
|
|
78
|
+
"description": "`<vaadin-select-list-box>` is a Web Component for wrapping `<vaadin-select>` items.\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"foo\">Foo</vaadin-select-item>\n <vaadin-select-item value=\"bar\">Bar</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------------|------------------------\n`items` | The items container\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
79
|
+
"attributes": [
|
|
80
|
+
{
|
|
81
|
+
"name": "disabled",
|
|
82
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
83
|
+
"value": {
|
|
84
|
+
"type": [
|
|
85
|
+
"boolean"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "selected",
|
|
91
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
92
|
+
"value": {
|
|
93
|
+
"type": [
|
|
94
|
+
"number"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "theme",
|
|
100
|
+
"description": "The theme variants to apply to the component.",
|
|
101
|
+
"value": {
|
|
102
|
+
"type": [
|
|
103
|
+
"string",
|
|
104
|
+
"null",
|
|
105
|
+
"undefined"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"js": {
|
|
111
|
+
"properties": [
|
|
112
|
+
{
|
|
113
|
+
"name": "disabled",
|
|
114
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
115
|
+
"value": {
|
|
116
|
+
"type": [
|
|
117
|
+
"boolean"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "selected",
|
|
123
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
124
|
+
"value": {
|
|
125
|
+
"type": [
|
|
126
|
+
"number"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"events": []
|
|
132
|
+
}
|
|
133
|
+
},
|
|
9
134
|
{
|
|
10
135
|
"name": "vaadin-select",
|
|
11
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function
|
|
136
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n---------------------------------|-----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-select-overlay-width` | Width of the overlay |\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and toggle button\n`field-button` | Set on the toggle button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-button).\n- [`<vaadin-select-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-select-list-box) - a list-box element.\n- [`<vaadin-select-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-select-item) - an item element.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
137
|
"attributes": [
|
|
13
138
|
{
|
|
14
139
|
"name": "accessible-name",
|
|
@@ -236,7 +361,7 @@
|
|
|
236
361
|
"description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.\nTo render the item with a custom component, provide a tag name by the `component` property.",
|
|
237
362
|
"value": {
|
|
238
363
|
"type": [
|
|
239
|
-
"Array<
|
|
364
|
+
"Array<SelectItemData>"
|
|
240
365
|
]
|
|
241
366
|
}
|
|
242
367
|
},
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/select",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha5",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -14,9 +14,58 @@
|
|
|
14
14
|
"contributions": {
|
|
15
15
|
"html": {
|
|
16
16
|
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-select-item",
|
|
19
|
+
"description": "`<vaadin-select-item>` is a Web Component for creating `<vaadin-select>` items.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------|----------------\n`checkmark` | The graphical checkmark shown for a selected item\n`content` | The element that wraps the slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`active` | Set when the item is pressed down, either with mouse, touch or the keyboard.\n`disabled` | Set when the item is disabled.\n`focus-ring` | Set when the item is focused using the keyboard.\n`focused` | Set when the item is focused.\n`selected` | Set when the item is selected\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-item-border-radius` |\n| `--vaadin-item-checkmark-color` |\n| `--vaadin-item-gap` |\n| `--vaadin-item-height` |\n| `--vaadin-item-padding` |\n| `--vaadin-item-text-align` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?disabled",
|
|
24
|
+
"description": "If true, the user cannot interact with this element.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "?selected",
|
|
31
|
+
"description": "If true, the item is in selected state.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".value",
|
|
38
|
+
"description": "Submittable string value. The default value is the trimmed text content of the element.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "vaadin-select-list-box",
|
|
47
|
+
"description": "`<vaadin-select-list-box>` is a Web Component for wrapping `<vaadin-select>` items.\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"foo\">Foo</vaadin-select-item>\n <vaadin-select-item value=\"bar\">Bar</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n------------------|------------------------\n`items` | The items container\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
48
|
+
"extension": true,
|
|
49
|
+
"attributes": [
|
|
50
|
+
{
|
|
51
|
+
"name": "?disabled",
|
|
52
|
+
"description": "If true, the user cannot interact with this element.\nWhen the element is disabled, the selected item is\nnot updated when `selected` property is changed.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": ".selected",
|
|
59
|
+
"description": "The index of the item selected in the items array.\nNote: Not updated when used in `multiple` selection mode.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
17
66
|
{
|
|
18
67
|
"name": "vaadin-select",
|
|
19
|
-
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function
|
|
68
|
+
"description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using a slotted `<vaadin-select-list-box>`\nwith `<vaadin-select-item>` children:\n\n```html\n<vaadin-select>\n <vaadin-select-list-box slot=\"overlay\">\n <vaadin-select-item value=\"recent\">Most recent first</vaadin-select-item>\n <vaadin-select-item value=\"rating-asc\">Rating: low to high</vaadin-select-item>\n <vaadin-select-item value=\"rating-desc\">Rating: high to low</vaadin-select-item>\n </vaadin-select-list-box>\n</vaadin-select>\n```\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n#### Renderer (deprecated)\n\nThe content of the select can also be populated by using the renderer callback function, although\nthis approach is deprecated in favor of the `items` property or a slotted `<vaadin-select-list-box>`.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n---------------------------------|-----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-select-overlay-width` | Width of the overlay |\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and toggle button\n`field-button` | Set on the toggle button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal components are used\nand themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-button).\n- [`<vaadin-select-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-select-list-box) - a list-box element.\n- [`<vaadin-select-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0-alpha5/#/elements/vaadin-select-item) - an item element.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
69
|
"extension": true,
|
|
21
70
|
"attributes": [
|
|
22
71
|
{
|