@m3e/select 1.0.6

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 matraic
4
+ Contact: matraic@yahoo.com
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @m3e/select
2
+
3
+ The `m3e-select` component provides a form control for selecting a value from a set of predefined options. Following Material Design 3 principles, it supports both single and multiple selection modes, customizable validation states, accessible keyboard navigation, and extensive theming via CSS custom properties.
4
+
5
+ > **This package is part of [M3E](https://github.com/matraic/m3e) monorepo**, a unified suite of Material 3 web components. [Explore the docs](https://matraic.github.io/m3e) to see them in action.
6
+
7
+ ## ๐Ÿ“ฆ Installation
8
+
9
+ ```bash
10
+ npm install @m3e/select
11
+ ```
12
+
13
+ ## ๐Ÿ’ป Editor Integration
14
+
15
+ This package includes a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) to support enhanced editor tooling and developer experience.
16
+
17
+ ### Visual Studio Code
18
+
19
+ To enable autocomplete and hover documentation for `@m3e/select`, install the [Custom Elements Manifest Language Server](https://marketplace.visualstudio.com/items?itemName=pwrs.cem-language-server-vscode) extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
20
+
21
+ Alternately, you can explicitly reference the `html-custom-data.json` and `css-custom-data.json` in your workspace settings:
22
+
23
+ ```json
24
+ {
25
+ "html.customData": ["./node_modules/@m3e/select/dist/html-custom-data.json"],
26
+ "css.customData": ["./node_modules/@m3e/select/dist/css-custom-data.json"]
27
+ }
28
+ ```
29
+
30
+ ## ๐Ÿš€ Native Module Support
31
+
32
+ This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
33
+
34
+ ```html
35
+ <script type="module" src="/node_modules/@m3e/select/dist/index.js"></script>
36
+ ```
37
+
38
+ You also need a module script for `@m3e/option` due to it being a dependency.
39
+
40
+ ```html
41
+ <script type="module" src="/node_modules/@m3e/option/dist/index.js"></script>
42
+ ```
43
+
44
+ In addition, you must use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) to include additional dependencies.
45
+
46
+ ```html
47
+ <script type="importmap">
48
+ {
49
+ "imports": {
50
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
51
+ "@m3e/core": "/node_modules/@m3e/core/dist/index.js",
52
+ "@m3e/core/a11y": "/node_modules/@m3e/core/dist/a11y.js",
53
+ "@m3e/core/anchoring": "/node_modules/@m3e/core/dist/anchoring.js"
54
+ }
55
+ }
56
+ </script>
57
+ ```
58
+
59
+ > For production, use index.min.js, a11y.min.js, and anchoring.min.js for faster load times.
60
+
61
+ ## ๐Ÿ—‚๏ธ Elements
62
+
63
+ - `m3e-select` โ€” A form control that allows users to select a value from a set of predefined options with support for single and multiple selection.
64
+
65
+ ## ๐Ÿงช Example
66
+
67
+ The following demonstrates a `m3e-select` component wrapped in a `m3e-form-field` with a slotted label. The label is associated with the select via the `for` and `id` attributes, ensuring accessible form semantics. Each `m3e-option` defines an option within the dropdown.
68
+
69
+ ```html
70
+ <m3e-form-field>
71
+ <label slot="label" for="select">Choose your favorite fruit</label>
72
+ <m3e-select id="select">
73
+ <m3e-option>Apples</m3e-option>
74
+ <m3e-option>Oranges</m3e-option>
75
+ <m3e-option>Bananas</m3e-option>
76
+ <m3e-option>Grapes</m3e-option>
77
+ </m3e-select>
78
+ </m3e-form-field>
79
+ ```
80
+
81
+ Multiple selection:
82
+
83
+ ```html
84
+ <m3e-select multi>
85
+ <m3e-option value="javascript">JavaScript</m3e-option>
86
+ <m3e-option value="typescript">TypeScript</m3e-option>
87
+ <m3e-option value="python">Python</m3e-option>
88
+ </m3e-select>
89
+ ```
90
+
91
+ ## ๐Ÿ“– API Reference
92
+
93
+ ### ๐Ÿ—‚๏ธ m3e-select
94
+
95
+ This section details the attributes, slots, events and CSS custom properties available for the `m3e-select` component.
96
+
97
+ #### โš™๏ธ Attributes
98
+
99
+ | Attribute | Type | Default | Description |
100
+ | -------------------------- | --------- | ------- | ------------------------------------------------------------------------- |
101
+ | `disabled` | `boolean` | `false` | Whether the element is disabled. |
102
+ | `hide-selection-indicator` | `boolean` | `false` | Whether to hide the selection indicator for single select options. |
103
+ | `multi` | `boolean` | `false` | Whether multiple options can be selected. |
104
+ | `name` | `string` | | The name that identifies the element when submitting the associated form. |
105
+ | `required` | `boolean` | `false` | Whether the element is required. |
106
+
107
+ #### ๐Ÿ”” Events
108
+
109
+ | Event | Description |
110
+ | -------- | ---------------------------------------- |
111
+ | `input` | Emitted when the selected state changes. |
112
+ | `change` | Emitted when the selected state changes. |
113
+
114
+ #### ๐Ÿงฉ Slots
115
+
116
+ | Slot | Description |
117
+ | ----------- | ---------------------------------- |
118
+ | _(default)_ | Renders the options of the select. |
119
+ | `arrow` | Renders the dropdown arrow. |
120
+ | `value` | Renders the selected value(s). |
121
+
122
+ #### ๐ŸŽ›๏ธ CSS Custom Properties
123
+
124
+ | Property | Description |
125
+ | ------------------------------------- | ----------------------------------------------------- |
126
+ | `--m3e-form-field-font-size` | The font size of the select control. |
127
+ | `--m3e-form-field-font-weight` | The font weight of the select control. |
128
+ | `--m3e-form-field-line-height` | The line height of the select control. |
129
+ | `--m3e-form-field-tracking` | The letter spacing of the select control. |
130
+ | `--m3e-select-container-shape` | The corner radius of the select container. |
131
+ | `--m3e-select-disabled-color` | The text color when the select is disabled. |
132
+ | `--m3e-select-disabled-color-opacity` | The opacity level applied to the disabled text color. |
133
+ | `--m3e-select-icon-size` | The size of the dropdown arrow icon. |
134
+
135
+ ## ๐Ÿค Contributing
136
+
137
+ See the root monorepo `CONTRIBUTING.md` for guidelines on contributing to this package.
138
+
139
+ ## ๐Ÿ“„ License
140
+
141
+ This package is licensed under the MIT License.
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [
5
+ {
6
+ "name": "--m3e-form-field-font-size",
7
+ "description": "The font size of the select control.",
8
+ "values": []
9
+ },
10
+ {
11
+ "name": "--m3e-form-field-font-weight",
12
+ "description": "The font weight of the select control.",
13
+ "values": []
14
+ },
15
+ {
16
+ "name": "--m3e-form-field-line-height",
17
+ "description": "The line height of the select control.",
18
+ "values": []
19
+ },
20
+ {
21
+ "name": "--m3e-form-field-tracking",
22
+ "description": "The letter spacing of the select control.",
23
+ "values": []
24
+ },
25
+ {
26
+ "name": "--m3e-select-container-shape",
27
+ "description": "The corner radius of the select container.",
28
+ "values": []
29
+ },
30
+ {
31
+ "name": "--m3e-select-disabled-color",
32
+ "description": "The text color when the select is disabled.",
33
+ "values": []
34
+ },
35
+ {
36
+ "name": "--m3e-select-disabled-color-opacity",
37
+ "description": "The opacity level applied to the disabled text color.",
38
+ "values": []
39
+ },
40
+ {
41
+ "name": "--m3e-select-icon-size",
42
+ "description": "The size of the dropdown arrow icon.",
43
+ "values": []
44
+ }
45
+ ],
46
+ "pseudoElements": []
47
+ }