@trimble-oss/moduswebcomponents-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +337 -0
- package/package.json +39 -0
- package/versions/1.0.0/component-docs/_all_components.json +56 -0
- package/versions/1.0.0/component-docs/modus-wc-autocomplete.json +415 -0
- package/versions/1.0.0/component-docs/modus-wc-date.json +227 -0
- package/versions/1.0.0/component-docs/modus-wc-dropdown-menu.json +164 -0
- package/versions/1.0.0/component-docs/modus-wc-logo.json +61 -0
- package/versions/1.0.0/component-docs/modus-wc-menu-item.json +165 -0
- package/versions/1.0.0/component-docs/modus-wc-menu.json +106 -0
- package/versions/1.0.0/component-docs/modus-wc-navbar.json +290 -0
- package/versions/1.0.0/component-docs/modus-wc-profile-menu.json +64 -0
- package/versions/1.0.0/component-docs/modus-wc-side-navigation.json +102 -0
- package/versions/1.0.0/component-docs/modus-wc-table.json +202 -0
- package/versions/1.0.0/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/1.0.0/component-docs/modus-wc-typography.json +78 -0
- package/versions/1.0.0/docs/_all_docs.json +15 -0
- package/versions/1.0.0/docs/angular.mdx +374 -0
- package/versions/1.0.0/docs/getting-started.mdx +131 -0
- package/versions/1.0.7/component-docs/_all_components.json +55 -0
- package/versions/1.0.7/component-docs/modus-wc-autocomplete.json +405 -0
- package/versions/1.0.7/component-docs/modus-wc-table.json +202 -0
- package/versions/1.0.7/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/1.0.7/docs/_all_docs.json +15 -0
- package/versions/1.0.7/docs/angular.mdx +374 -0
- package/versions/1.1.0/component-docs/_all_components.json +56 -0
- package/versions/1.1.0/component-docs/modus-wc-autocomplete.json +405 -0
- package/versions/1.1.0/component-docs/modus-wc-navbar.json +290 -0
- package/versions/1.1.0/component-docs/modus-wc-profile-menu.json +64 -0
- package/versions/1.1.0/component-docs/modus-wc-side-navigation.json +102 -0
- package/versions/1.1.0/component-docs/modus-wc-table.json +202 -0
- package/versions/1.1.0/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/1.1.0/component-docs/modus-wc-typography.json +78 -0
- package/versions/1.1.0/docs/_all_docs.json +15 -0
- package/versions/1.1.0/docs/angular.mdx +374 -0
- package/versions/1.1.0/docs/getting-started.mdx +131 -0
- package/versions/1.1.1/component-docs/_all_components.json +56 -0
- package/versions/1.1.1/component-docs/modus-wc-autocomplete.json +405 -0
- package/versions/1.1.1/component-docs/modus-wc-navbar.json +290 -0
- package/versions/1.1.1/component-docs/modus-wc-profile-menu.json +64 -0
- package/versions/1.1.1/component-docs/modus-wc-side-navigation.json +102 -0
- package/versions/1.1.1/component-docs/modus-wc-table.json +202 -0
- package/versions/1.1.1/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/1.1.1/component-docs/modus-wc-typography.json +78 -0
- package/versions/1.1.1/docs/_all_docs.json +15 -0
- package/versions/1.1.1/docs/angular.mdx +374 -0
- package/versions/1.1.1/docs/getting-started.mdx +131 -0
- package/versions/base/component-docs/_all_components.json +55 -0
- package/versions/base/component-docs/modus-wc-accordion.json +48 -0
- package/versions/base/component-docs/modus-wc-alert.json +112 -0
- package/versions/base/component-docs/modus-wc-autocomplete.json +397 -0
- package/versions/base/component-docs/modus-wc-avatar.json +83 -0
- package/versions/base/component-docs/modus-wc-badge.json +68 -0
- package/versions/base/component-docs/modus-wc-breadcrumbs.json +63 -0
- package/versions/base/component-docs/modus-wc-button-group.json +100 -0
- package/versions/base/component-docs/modus-wc-button.json +130 -0
- package/versions/base/component-docs/modus-wc-card.json +98 -0
- package/versions/base/component-docs/modus-wc-checkbox.json +149 -0
- package/versions/base/component-docs/modus-wc-chip.json +132 -0
- package/versions/base/component-docs/modus-wc-collapse.json +90 -0
- package/versions/base/component-docs/modus-wc-date.json +227 -0
- package/versions/base/component-docs/modus-wc-divider.json +85 -0
- package/versions/base/component-docs/modus-wc-dropdown-menu.json +154 -0
- package/versions/base/component-docs/modus-wc-file-dropzone.json +155 -0
- package/versions/base/component-docs/modus-wc-handle.json +135 -0
- package/versions/base/component-docs/modus-wc-icon.json +722 -0
- package/versions/base/component-docs/modus-wc-input-feedback.json +71 -0
- package/versions/base/component-docs/modus-wc-input-label.json +84 -0
- package/versions/base/component-docs/modus-wc-loader.json +65 -0
- package/versions/base/component-docs/modus-wc-logo.json +61 -0
- package/versions/base/component-docs/modus-wc-menu-item.json +173 -0
- package/versions/base/component-docs/modus-wc-menu.json +86 -0
- package/versions/base/component-docs/modus-wc-modal.json +108 -0
- package/versions/base/component-docs/modus-wc-navbar.json +280 -0
- package/versions/base/component-docs/modus-wc-number-input.json +219 -0
- package/versions/base/component-docs/modus-wc-pagination.json +103 -0
- package/versions/base/component-docs/modus-wc-panel.json +76 -0
- package/versions/base/component-docs/modus-wc-progress.json +86 -0
- package/versions/base/component-docs/modus-wc-radio.json +139 -0
- package/versions/base/component-docs/modus-wc-rating.json +117 -0
- package/versions/base/component-docs/modus-wc-select.json +159 -0
- package/versions/base/component-docs/modus-wc-side-navigation.json +102 -0
- package/versions/base/component-docs/modus-wc-skeleton.json +65 -0
- package/versions/base/component-docs/modus-wc-slider.json +163 -0
- package/versions/base/component-docs/modus-wc-stepper.json +47 -0
- package/versions/base/component-docs/modus-wc-switch.json +149 -0
- package/versions/base/component-docs/modus-wc-table.json +202 -0
- package/versions/base/component-docs/modus-wc-tabs.json +86 -0
- package/versions/base/component-docs/modus-wc-text-input.json +278 -0
- package/versions/base/component-docs/modus-wc-textarea.json +215 -0
- package/versions/base/component-docs/modus-wc-theme-switcher.json +49 -0
- package/versions/base/component-docs/modus-wc-time-input.json +211 -0
- package/versions/base/component-docs/modus-wc-toast.json +56 -0
- package/versions/base/component-docs/modus-wc-toolbar.json +44 -0
- package/versions/base/component-docs/modus-wc-tooltip.json +94 -0
- package/versions/base/component-docs/modus-wc-typography.json +73 -0
- package/versions/base/component-docs/modus-wc-utility-panel.json +86 -0
- package/versions/base/docs/_all_docs.json +15 -0
- package/versions/base/docs/accessibility.mdx +32 -0
- package/versions/base/docs/angular.mdx +346 -0
- package/versions/base/docs/form-inputs.mdx +86 -0
- package/versions/base/docs/getting-started.mdx +91 -0
- package/versions/base/docs/modus-figma-mcp-integration-guide.mdx +254 -0
- package/versions/base/docs/modus-icon-usage.mdx +210 -0
- package/versions/base/docs/react.mdx +129 -0
- package/versions/base/docs/styling.mdx +107 -0
- package/versions/base/docs/testing.mdx +18 -0
- package/versions/base/docs/vue.mdx +159 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A customizable input component used to create text inputs with types. The component supports a `<slot>` for injecting additional custom content inside the input, such as icons or formatted text.",
|
|
3
|
+
"properties": [
|
|
4
|
+
{
|
|
5
|
+
"name": "autoCapitalize",
|
|
6
|
+
"type": "| 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'",
|
|
7
|
+
"description": "Controls automatic capitalization in inputted text.",
|
|
8
|
+
"default": null,
|
|
9
|
+
"mutable": false,
|
|
10
|
+
"end_line": 50
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "autoComplete",
|
|
14
|
+
"type": "AutocompleteTypes",
|
|
15
|
+
"description": "Hint for form autofill feature.",
|
|
16
|
+
"default": null,
|
|
17
|
+
"mutable": false,
|
|
18
|
+
"end_line": 53
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "autoCorrect",
|
|
22
|
+
"type": "'on' | 'off'",
|
|
23
|
+
"description": "Controls automatic correction in inputted text. Support by browser varies.",
|
|
24
|
+
"default": null,
|
|
25
|
+
"mutable": false,
|
|
26
|
+
"end_line": 56
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "bordered",
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Indicates that the input should have a border.",
|
|
32
|
+
"default": "true",
|
|
33
|
+
"mutable": false,
|
|
34
|
+
"end_line": 59
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "clearAriaLabel",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "Aria label for the clear icon button.",
|
|
40
|
+
"default": "'Clear text'",
|
|
41
|
+
"mutable": false,
|
|
42
|
+
"end_line": 62
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "customClass",
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Custom CSS class to apply to the input.",
|
|
48
|
+
"default": "''",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"end_line": 65
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "disabled",
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"description": "Whether the form control is disabled.",
|
|
56
|
+
"default": "false",
|
|
57
|
+
"mutable": false,
|
|
58
|
+
"end_line": 68
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "enterkeyhint",
|
|
62
|
+
"type": "| 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'",
|
|
63
|
+
"description": "A hint to the browser for which enter key to display.",
|
|
64
|
+
"default": null,
|
|
65
|
+
"mutable": false,
|
|
66
|
+
"end_line": 78
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "feedback",
|
|
70
|
+
"type": "IInputFeedbackProp",
|
|
71
|
+
"description": "Feedback to render below the input.",
|
|
72
|
+
"default": null,
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"end_line": 81
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "includeClear",
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"description": "Show the clear button within the input field.",
|
|
80
|
+
"default": "false",
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"end_line": 84
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "includeSearch",
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"description": "Show the search icon within the input field.",
|
|
88
|
+
"default": "false",
|
|
89
|
+
"mutable": false,
|
|
90
|
+
"end_line": 87
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "inputId",
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "The ID of the input element.",
|
|
96
|
+
"default": null,
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"end_line": 90
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "inputTabIndex",
|
|
102
|
+
"type": "number",
|
|
103
|
+
"description": "Determine the control's relative ordering for sequential focus navigation (typically with the Tab key).",
|
|
104
|
+
"default": null,
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"end_line": 93
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "label",
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "The text to display within the label.",
|
|
112
|
+
"default": null,
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"end_line": 96
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "maxLength",
|
|
118
|
+
"type": "number",
|
|
119
|
+
"description": "Maximum length (number of characters) of value.",
|
|
120
|
+
"default": null,
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"end_line": 99
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "minLength",
|
|
126
|
+
"type": "number",
|
|
127
|
+
"description": "Minimum length (number of characters) of value.",
|
|
128
|
+
"default": null,
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"end_line": 102
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "name",
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "Name of the form control. Submitted with the form as part of a name/value pair.",
|
|
136
|
+
"default": null,
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"end_line": 105
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "pattern",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"description": "Pattern the value must match to be valid",
|
|
144
|
+
"default": null,
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"end_line": 108
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "placeholder",
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "Text that appears in the form control when it has no value set.",
|
|
152
|
+
"default": "''",
|
|
153
|
+
"mutable": false,
|
|
154
|
+
"end_line": 111
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "readOnly",
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"description": "Whether the value is editable.",
|
|
160
|
+
"default": "false",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"end_line": 114
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "required",
|
|
166
|
+
"type": "boolean",
|
|
167
|
+
"description": "A value is required for the form to be submittable.",
|
|
168
|
+
"default": "false",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"end_line": 117
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "size",
|
|
174
|
+
"type": "ModusSize",
|
|
175
|
+
"description": "The size of the input.",
|
|
176
|
+
"default": "'md'",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"end_line": 120
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "type",
|
|
182
|
+
"type": "TextFieldTypes",
|
|
183
|
+
"description": "Type of form control.",
|
|
184
|
+
"default": "'text'",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"end_line": 123
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "value",
|
|
190
|
+
"type": "string",
|
|
191
|
+
"description": "The value of the control.",
|
|
192
|
+
"default": "''",
|
|
193
|
+
"mutable": true,
|
|
194
|
+
"end_line": 126
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"events": [
|
|
198
|
+
{
|
|
199
|
+
"name": "clearClick",
|
|
200
|
+
"detail": "void",
|
|
201
|
+
"description": "Event emitted when the clear button is clicked.",
|
|
202
|
+
"end_line": 129
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "inputBlur",
|
|
206
|
+
"detail": "FocusEvent",
|
|
207
|
+
"description": "Event emitted when the input loses focus.",
|
|
208
|
+
"end_line": 132
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "inputChange",
|
|
212
|
+
"detail": "InputEvent",
|
|
213
|
+
"description": "Event emitted when the input value changes.",
|
|
214
|
+
"end_line": 135
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "inputFocus",
|
|
218
|
+
"detail": "FocusEvent",
|
|
219
|
+
"description": "Event emitted when the input gains focus.",
|
|
220
|
+
"end_line": 138
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"methods": [],
|
|
224
|
+
"slots": [
|
|
225
|
+
{
|
|
226
|
+
"name": "custom-icon",
|
|
227
|
+
"description": "Slot for custom-icon content"
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"examples": {
|
|
231
|
+
"basic": "<text-input-shadow-host\n .props=${{ ...args }}\n ></text-input-shadow-host>",
|
|
232
|
+
"variations": [],
|
|
233
|
+
"args": {
|
|
234
|
+
"bordered": "true",
|
|
235
|
+
"disabled": "false",
|
|
236
|
+
"include-clear": "false",
|
|
237
|
+
"include-search": "false",
|
|
238
|
+
"inputmode": "'text'",
|
|
239
|
+
"label": "'Label'",
|
|
240
|
+
"size": "'md'",
|
|
241
|
+
"spellcheck": "false",
|
|
242
|
+
"type": "'text'",
|
|
243
|
+
"value": "''"
|
|
244
|
+
},
|
|
245
|
+
"argTypes": {},
|
|
246
|
+
"usage": [],
|
|
247
|
+
"events": [
|
|
248
|
+
"clearClick",
|
|
249
|
+
"inputBlur",
|
|
250
|
+
"inputChange",
|
|
251
|
+
"inputFocus"
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"tag": "modus-wc-text-input",
|
|
255
|
+
"storyExample": {
|
|
256
|
+
"template": "<text-input-shadow-host\n .props=${{ ...args }}\n ></text-input-shadow-host>",
|
|
257
|
+
"args": {
|
|
258
|
+
"bordered": "true",
|
|
259
|
+
"disabled": "false",
|
|
260
|
+
"include-clear": "false",
|
|
261
|
+
"include-search": "false",
|
|
262
|
+
"inputmode": "'text'",
|
|
263
|
+
"label": "'Label'",
|
|
264
|
+
"size": "'md'",
|
|
265
|
+
"spellcheck": "false",
|
|
266
|
+
"type": "'text'",
|
|
267
|
+
"value": "''"
|
|
268
|
+
},
|
|
269
|
+
"argTypes": {},
|
|
270
|
+
"events": [
|
|
271
|
+
"clearClick",
|
|
272
|
+
"inputBlur",
|
|
273
|
+
"inputChange",
|
|
274
|
+
"inputFocus"
|
|
275
|
+
],
|
|
276
|
+
"fullContent": "import { withActions } from '@storybook/addon-actions/decorator';\nimport { Meta, StoryObj } from '@storybook/web-components';\nimport { html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createShadowHostClass } from '../../providers/shadow-dom/shadow-host-helper';\nimport { AutocompleteTypes, IInputFeedbackProp, ModusSize } from '../types';\n\ninterface TextInputArgs {\n 'auto-capitalize'?:\n | 'off'\n | 'none'\n | 'on'\n | 'sentences'\n | 'words'\n | 'characters';\n 'auto-complete'?: AutocompleteTypes;\n 'auto-correct'?: 'on' | 'off';\n bordered?: boolean;\n 'clear-aria-label'?: string;\n 'custom-class'?: string;\n disabled?: boolean;\n enterkeyhint?:\n | 'enter'\n | 'done'\n | 'go'\n | 'next'\n | 'previous'\n | 'search'\n | 'send';\n feedback?: IInputFeedbackProp;\n 'include-clear'?: boolean;\n 'include-search'?: boolean;\n 'input-id'?: string;\n inputmode?:\n | 'decimal'\n | 'email'\n | 'none'\n | 'numeric'\n | 'search'\n | 'tel'\n | 'text'\n | 'url';\n 'input-tab-index'?: number;\n label?: string;\n 'max-length': number;\n 'min-length': number;\n name?: string;\n pattern?: string;\n placeholder?: string;\n 'read-only'?: boolean;\n required?: boolean;\n size?: ModusSize;\n spellcheck?: boolean;\n type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url';\n value: string;\n}\n\nconst meta: Meta<TextInputArgs> = {\n title: 'Components/Forms/Text Input',\n component: 'modus-wc-text-input',\n args: {\n bordered: true,\n disabled: false,\n 'include-clear': false,\n 'include-search': false,\n inputmode: 'text',\n label: 'Label',\n size: 'md',\n spellcheck: false,\n type: 'text',\n value: '',\n },\n argTypes: {\n 'auto-capitalize': {\n options: ['off', 'none', 'on', 'sentences', 'words', 'characters'],\n },\n 'auto-complete': {\n control: { type: 'text' },\n },\n 'auto-correct': {\n options: ['on', 'off'],\n },\n enterkeyhint: {\n options: ['enter', 'done', 'go', 'next', 'previous', 'search', 'send'],\n },\n feedback: {\n description: 'Feedback prop for input components',\n table: {\n type: {\n detail: `\n Interface: IInputFeedbackProp\n Properties:\n - level ('error' | 'info' | 'success' | 'warning'): The feedback level\n - message (string, optional): The feedback message\n `,\n },\n },\n },\n inputmode: {\n control: { type: 'select' },\n options: [\n 'decimal',\n 'email',\n 'none',\n 'numeric',\n 'search',\n 'tel',\n 'text',\n 'url',\n ],\n },\n size: {\n options: ['sm', 'md', 'lg'],\n },\n spellcheck: {\n description:\n 'Whether the element may be checked for spelling errors. A hint for the browser, not a guarantee.',\n table: {\n category: 'attributes',\n defaultValue: { summary: 'false' },\n },\n },\n type: {\n options: ['email', 'password', 'search', 'tel', 'text', 'url'],\n },\n },\n decorators: [withActions],\n parameters: {\n actions: {\n handles: ['clearClick', 'inputBlur', 'inputChange', 'inputFocus'],\n },\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<TextInputArgs>;\n\nconst Template: Story = {\n render: (args) => html`\n <modus-wc-text-input\n aria-label=\"Text input\"\n auto-capitalize=${ifDefined(args['auto-capitalize'])}\n auto-complete=${ifDefined(args['auto-complete'])}\n auto-correct=${ifDefined(args['auto-correct'])}\n ?bordered=${args.bordered}\n clear-aria-label=${ifDefined(args['clear-aria-label'])}\n custom-class=${ifDefined(args['custom-class'])}\n ?disabled=${args.disabled}\n enterkeyhint=${ifDefined(args.enterkeyhint)}\n .feedback=${args.feedback}\n include-clear=${ifDefined(args['include-clear'])}\n include-search=${ifDefined(args['include-search'])}\n input-aria-invalid=${ifDefined(args['input-aria-invalid'])}\n input-id=${ifDefined(args['input-id'])}\n inputmode=${ifDefined(args.inputmode)}\n input-tab-index=${ifDefined(args['input-tab-index'])}\n label=${ifDefined(args.label)}\n max-length=${ifDefined(args['max-length'])}\n min-length=${ifDefined(args['min-length'])}\n name=${ifDefined(args.name)}\n pattern=${ifDefined(args.pattern)}\n placeholder=${ifDefined(args.placeholder)}\n ?read-only=${args['read-only']}\n ?required=${args.required}\n size=${ifDefined(args.size)}\n spellcheck=${ifDefined(args.spellcheck)}\n type=${ifDefined(args.type)}\n .value=${args.value}\n ></modus-wc-text-input>\n `,\n};\n\nexport const Default: Story = { ...Template };\n\nconst errorFeedback: IInputFeedbackProp = {\n level: 'error',\n message: 'Value is required.',\n};\n\nexport const WithErrorFeedback: Story = {\n // prettier-ignore\n render: (args) => html`\n <modus-wc-text-input\n aria-label=\"Text input with error feedback\"\n .feedback=${errorFeedback}\n id=\"error-input\"\n label=${ifDefined(args.label)}\n ?required=${true}\n .value=${args.value}\n ></modus-wc-text-input>\n <script>\n // Adding this block to show how to set feedback via JS\n //const input = document.getElementById('error-input');\n //input.feedback = { level: 'error', message: 'Value is required.' };\n </script>\n `,\n};\n\nexport const WithCustomIconSlot: Story = {\n // prettier-ignore\n render: (args) => html`\n<modus-wc-text-input\n aria-label=\"Text input with custom icon\"\n auto-capitalize=${ifDefined(args['auto-capitalize'])}\n auto-complete=${ifDefined(args['auto-complete'])}\n auto-correct=${ifDefined(args['auto-correct'])}\n ?bordered=${args.bordered}\n clear-aria-label=${ifDefined(args['clear-aria-label'])}\n custom-class=${ifDefined(args['custom-class'])}\n ?disabled=${args.disabled}\n enterkeyhint=${ifDefined(args.enterkeyhint)}\n .feedback=${args.feedback}\n include-clear=${ifDefined(args['include-clear'])}\n include-search=${ifDefined(args['include-search'])}\n input-id=${ifDefined(args['input-id'])}\n inputmode=${ifDefined(args.inputmode)}\n input-tab-index=${ifDefined(args['input-tab-index'])}\n label=${ifDefined(args.label)}\n max-length=${ifDefined(args['max-length'])}\n min-length=${ifDefined(args['min-length'])}\n name=${ifDefined(args.name)}\n pattern=${ifDefined(args.pattern)}\n placeholder=${ifDefined(args.placeholder)}\n ?read-only=${args['read-only']}\n ?required=${args.required}\n size=${ifDefined(args.size)}\n spellcheck=${ifDefined(args.spellcheck)}\n type=${ifDefined(args.type)}\n .value=${args.value}\n>\n <modus-wc-icon slot=\"custom-icon\" name=\"heart\" size=\"sm\"></modus-wc-icon>\n</modus-wc-text-input>\n `,\n args: {\n placeholder: 'Enter text here...',\n },\n};\n\nexport const ShadowDomParent: Story = {\n render: (args) => {\n // Create a unique shadow host for text-input component\n if (!customElements.get('text-input-shadow-host')) {\n const TextInputShadowHost = createShadowHostClass<TextInputArgs>({\n componentTag: 'modus-wc-text-input',\n propsMapper: (v: TextInputArgs, el: HTMLElement) => {\n const textInputEl = el as unknown as {\n autoCapitalize: string;\n autoComplete: string;\n autoCorrect: string;\n bordered: boolean;\n clearAriaLabel: string;\n customClass: string;\n disabled: boolean;\n enterkeyhint: string;\n feedback: IInputFeedbackProp;\n includeClear: boolean;\n includeSearch: boolean;\n inputId: string;\n inputTabIndex: number;\n label: string;\n maxLength: number;\n minLength: number;\n name: string;\n pattern: string;\n placeholder: string;\n readOnly: boolean;\n required: boolean;\n size: string;\n type: string;\n value: string;\n };\n textInputEl.autoCapitalize = v['auto-capitalize'] || '';\n textInputEl.autoComplete = v['auto-complete'] || '';\n textInputEl.autoCorrect = v['auto-correct'] || '';\n textInputEl.bordered = Boolean(v.bordered);\n textInputEl.clearAriaLabel =\n v['clear-aria-label'] || '' || 'Clear text';\n textInputEl.customClass = v['custom-class'] || '';\n textInputEl.disabled = Boolean(v.disabled);\n textInputEl.enterkeyhint = v.enterkeyhint || '';\n textInputEl.includeClear = Boolean(v['include-clear']);\n textInputEl.includeSearch = Boolean(v['include-search']);\n textInputEl.inputId = v['input-id'] || '';\n textInputEl.inputTabIndex = v['input-tab-index'] || 0;\n textInputEl.label = v.label || '';\n textInputEl.maxLength = v['max-length'];\n textInputEl.minLength = v['min-length'];\n textInputEl.name = v.name || '';\n textInputEl.pattern = v.pattern || '';\n textInputEl.placeholder = v.placeholder || '';\n textInputEl.readOnly = Boolean(v['read-only']);\n textInputEl.required = Boolean(v.required);\n textInputEl.size = v.size || '';\n textInputEl.type = v.type || '';\n textInputEl.value = v.value;\n },\n });\n customElements.define('text-input-shadow-host', TextInputShadowHost);\n }\n\n return html`<text-input-shadow-host\n .props=${{ ...args }}\n ></text-input-shadow-host>`;\n },\n};\n\nexport const Migration: Story = {\n parameters: {\n docs: {\n description: {\n story: `\n#### Breaking Changes\n\n - In 1.0 input state was maintained by the component. 2.0 components encourage users to follow a controlled\n input model. See the Form Inputs [documentation]([Angular](?path=/docs/documentation-form-inputs--docs) for\n additional info and examples.\n - Size values have changed from verbose names (\\`small\\`, \\`medium\\`, \\`large\\`) to abbreviations (\\`sm\\`, \\`md\\`, \\`lg\\`).\n\n#### Prop Mapping\n\n| 1.0 Prop | 2.0 Prop | Notes |\n|------------------------------|---------------------|-------------------------------------------------------------|\n| aria-label | aria-label | |\n| autocapitalize | auto-capitalize | |\n| autocorrect | auto-correct | |\n| autocomplete | autocomplete | |\n| auto-focus-input | autofocus | |\n| clearable | include-clear | |\n| disabled | disabled | |\n| enter-key-hint | enterkeyhint | |\n| error-text | feedback.message | Use \\`feedback\\` level |\n| helper-text | | Not carried over |\n| include-error-icon | | Not carried over |\n| include-search-icon | include-search | |\n| include-password-text-toggle | | Not carried over |\n| inputmode | inputmode | |\n| label | label | |\n| max-length | max-length | |\n| pattern | pattern | |\n| placeholder | placeholder | |\n| read-only | read-only | |\n| required | required | |\n| size | size | \\`small\\` → \\`sm\\`, \\`medium\\` → \\`md\\`, \\`large\\` → \\`lg\\` |\n| spellcheck | spellcheck | |\n| text-align | | Not carried over, use CSS instead |\n| type | type | |\n| valid-text | feedback.message | Use \\`feedback\\` level |\n| value | value | |\n\n#### Event Mapping\n\n| 1.0 Event | 2.0 Event | Notes |\n|-------------|-------------|------------------|\n| valueChange | inputChange | |\n `,\n },\n },\n // To hide the actual story rendering and only show docs:\n controls: { disable: true },\n canvas: { disable: true },\n },\n // Simple render function or leave it empty\n render: () => html`<div></div>`,\n};\n"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A customizable textarea component.",
|
|
3
|
+
"properties": [
|
|
4
|
+
{
|
|
5
|
+
"name": "autoCorrect",
|
|
6
|
+
"type": "'on' | 'off'",
|
|
7
|
+
"description": "Controls automatic correction in inputted text. Support by browser varies.",
|
|
8
|
+
"default": null,
|
|
9
|
+
"mutable": false,
|
|
10
|
+
"end_line": 29
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "bordered",
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "Indicates that the input should have a border.",
|
|
16
|
+
"default": "true",
|
|
17
|
+
"mutable": false,
|
|
18
|
+
"end_line": 32
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "customClass",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Custom CSS class to apply to the textarea (supports DaisyUI).",
|
|
24
|
+
"default": "''",
|
|
25
|
+
"mutable": false,
|
|
26
|
+
"end_line": 35
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "disabled",
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "The disabled state of the textarea.",
|
|
32
|
+
"default": "false",
|
|
33
|
+
"mutable": false,
|
|
34
|
+
"end_line": 38
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "enterkeyhint",
|
|
38
|
+
"type": "| 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'",
|
|
39
|
+
"description": "A hint to the browser for which enter key to display.",
|
|
40
|
+
"default": null,
|
|
41
|
+
"mutable": false,
|
|
42
|
+
"end_line": 48
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "feedback",
|
|
46
|
+
"type": "IInputFeedbackProp",
|
|
47
|
+
"description": "Feedback to render below the input.",
|
|
48
|
+
"default": null,
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"end_line": 51
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "inputId",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "The ID of the input element.",
|
|
56
|
+
"default": null,
|
|
57
|
+
"mutable": false,
|
|
58
|
+
"end_line": 54
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "inputTabIndex",
|
|
62
|
+
"type": "number",
|
|
63
|
+
"description": "The tabindex of the input.",
|
|
64
|
+
"default": null,
|
|
65
|
+
"mutable": false,
|
|
66
|
+
"end_line": 57
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "label",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "The text to display within the label.",
|
|
72
|
+
"default": null,
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"end_line": 60
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "maxLength",
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "The maximum number of characters allowed in the textarea.",
|
|
80
|
+
"default": null,
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"end_line": 63
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "minLength",
|
|
86
|
+
"type": "number",
|
|
87
|
+
"description": "The minimum number of characters required in the textarea.",
|
|
88
|
+
"default": null,
|
|
89
|
+
"mutable": false,
|
|
90
|
+
"end_line": 66
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "name",
|
|
94
|
+
"type": "string",
|
|
95
|
+
"description": "Name of the form control. Submitted with the form as part of a name/value pair.",
|
|
96
|
+
"default": null,
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"end_line": 69
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "placeholder",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "The placeholder text for the textarea.",
|
|
104
|
+
"default": "''",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"end_line": 72
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "readonly",
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"description": "The readonly state of the textarea.",
|
|
112
|
+
"default": "false",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"end_line": 75
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "required",
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"description": "A value is required for the form to be submittable.",
|
|
120
|
+
"default": "false",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"end_line": 78
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "rows",
|
|
126
|
+
"type": "number",
|
|
127
|
+
"description": "The number of visible text lines for the textarea.",
|
|
128
|
+
"default": null,
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"end_line": 81
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "size",
|
|
134
|
+
"type": "ModusSize",
|
|
135
|
+
"description": "The size of the input.",
|
|
136
|
+
"default": "'md'",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"end_line": 84
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "value",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"description": "The value of the textarea.",
|
|
144
|
+
"default": "''",
|
|
145
|
+
"mutable": true,
|
|
146
|
+
"end_line": 87
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"events": [
|
|
150
|
+
{
|
|
151
|
+
"name": "inputBlur",
|
|
152
|
+
"detail": "FocusEvent",
|
|
153
|
+
"description": "Emitted when the input loses focus.",
|
|
154
|
+
"end_line": 90
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "inputChange",
|
|
158
|
+
"detail": "InputEvent",
|
|
159
|
+
"description": "Emitted when the input value changes.",
|
|
160
|
+
"end_line": 93
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "inputFocus",
|
|
164
|
+
"detail": "FocusEvent",
|
|
165
|
+
"description": "Emitted when the input gains focus.",
|
|
166
|
+
"end_line": 96
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"methods": [],
|
|
170
|
+
"slots": [],
|
|
171
|
+
"examples": {
|
|
172
|
+
"basic": "<modus-wc-textarea\n aria-label=\"Textarea input\"\n auto-correct=${ifDefined(args['auto-correct'])}\n ?bordered=${args.bordered}\n custom-class=${ifDefined(args['custom-class'])}\n enterkeyhint=${ifDefined(args.enterkeyhint)}\n ?disabled=${args.disabled}\n .feedback=${args.feedback}\n input-aria-invalid=${ifDefined(args['input-aria-invalid'])}\n input-id=${ifDefined(args['input-id'])}\n input-tab-index=${ifDefined(args['input-tab-index'])}\n label=${ifDefined(args.label)}\n max-length=${ifDefined(args['max-length'])}\n min-length=${ifDefined(args['min-length'])}\n name=${ifDefined(args.name)}\n placeholder=${ifDefined(args.placeholder)}\n ?readonly=${args.readonly}\n ?required=${args.required}\n rows=${ifDefined(args.rows)}\n size=${ifDefined(args.size)}\n spellcheck=${ifDefined(args.spellcheck)}\n .value=${args.value}\n ></modus-wc-textarea>",
|
|
173
|
+
"variations": [],
|
|
174
|
+
"args": {
|
|
175
|
+
"bordered": "true",
|
|
176
|
+
"custom-class": "''",
|
|
177
|
+
"disabled": "false",
|
|
178
|
+
"label": "'Label'",
|
|
179
|
+
"readonly": "false",
|
|
180
|
+
"required": "false",
|
|
181
|
+
"size": "'md'",
|
|
182
|
+
"spellcheck": "false",
|
|
183
|
+
"value": "''"
|
|
184
|
+
},
|
|
185
|
+
"argTypes": {},
|
|
186
|
+
"usage": [],
|
|
187
|
+
"events": [
|
|
188
|
+
"inputBlur",
|
|
189
|
+
"inputChange",
|
|
190
|
+
"inputFocus"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"tag": "modus-wc-textarea",
|
|
194
|
+
"storyExample": {
|
|
195
|
+
"template": "<modus-wc-textarea\n aria-label=\"Textarea input\"\n auto-correct=${ifDefined(args['auto-correct'])}\n ?bordered=${args.bordered}\n custom-class=${ifDefined(args['custom-class'])}\n enterkeyhint=${ifDefined(args.enterkeyhint)}\n ?disabled=${args.disabled}\n .feedback=${args.feedback}\n input-aria-invalid=${ifDefined(args['input-aria-invalid'])}\n input-id=${ifDefined(args['input-id'])}\n input-tab-index=${ifDefined(args['input-tab-index'])}\n label=${ifDefined(args.label)}\n max-length=${ifDefined(args['max-length'])}\n min-length=${ifDefined(args['min-length'])}\n name=${ifDefined(args.name)}\n placeholder=${ifDefined(args.placeholder)}\n ?readonly=${args.readonly}\n ?required=${args.required}\n rows=${ifDefined(args.rows)}\n size=${ifDefined(args.size)}\n spellcheck=${ifDefined(args.spellcheck)}\n .value=${args.value}\n ></modus-wc-textarea>",
|
|
196
|
+
"args": {
|
|
197
|
+
"bordered": "true",
|
|
198
|
+
"custom-class": "''",
|
|
199
|
+
"disabled": "false",
|
|
200
|
+
"label": "'Label'",
|
|
201
|
+
"readonly": "false",
|
|
202
|
+
"required": "false",
|
|
203
|
+
"size": "'md'",
|
|
204
|
+
"spellcheck": "false",
|
|
205
|
+
"value": "''"
|
|
206
|
+
},
|
|
207
|
+
"argTypes": {},
|
|
208
|
+
"events": [
|
|
209
|
+
"inputBlur",
|
|
210
|
+
"inputChange",
|
|
211
|
+
"inputFocus"
|
|
212
|
+
],
|
|
213
|
+
"fullContent": "import { withActions } from '@storybook/addon-actions/decorator';\nimport { Meta, StoryObj } from '@storybook/web-components';\nimport { html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createShadowHostClass } from '../../providers/shadow-dom/shadow-host-helper';\nimport { IInputFeedbackProp, ModusSize } from '../types';\n\ninterface TextAreaArgs {\n 'auto-correct': 'on' | 'off';\n bordered?: boolean;\n 'custom-class'?: string;\n disabled?: boolean;\n enterkeyhint?:\n | 'enter'\n | 'done'\n | 'go'\n | 'next'\n | 'previous'\n | 'search'\n | 'send';\n feedback?: IInputFeedbackProp;\n 'input-aria-invalid'?: 'grammar' | 'spelling' | 'true' | 'false';\n 'input-id'?: string;\n 'input-tab-index'?: number;\n label?: string;\n 'max-length'?: number;\n 'min-length'?: number;\n name?: string;\n placeholder?: string;\n readonly?: boolean;\n required?: boolean;\n rows?: number;\n size?: ModusSize;\n spellcheck?: boolean;\n value: string;\n}\n\nconst meta: Meta<TextAreaArgs> = {\n title: 'Components/Forms/Textarea',\n component: 'modus-wc-textarea',\n args: {\n bordered: true,\n 'custom-class': '',\n disabled: false,\n label: 'Label',\n readonly: false,\n required: false,\n size: 'md',\n spellcheck: false,\n value: '',\n },\n argTypes: {\n 'auto-correct': {\n options: ['on', 'off'],\n },\n enterkeyhint: {\n options: ['enter', 'done', 'go', 'next', 'previous', 'search', 'send'],\n },\n feedback: {\n description: 'Feedback prop for input components',\n table: {\n type: {\n detail: `\n Interface: IInputFeedbackProp\n Properties:\n - level ('error' | 'info' | 'success' | 'warning'): The feedback level\n - message (string, optional): The feedback message\n `,\n },\n },\n },\n 'input-aria-invalid': {\n control: {\n type: 'select',\n },\n options: ['grammar', 'spelling', 'true', 'false'],\n },\n size: {\n control: { type: 'select' },\n options: ['sm', 'md', 'lg'],\n },\n spellcheck: {\n description:\n 'Whether the element may be checked for spelling errors. A hint for the browser, not a guarantee.',\n table: {\n category: 'attributes',\n defaultValue: { summary: 'false' },\n },\n },\n },\n decorators: [withActions],\n parameters: {\n actions: {\n handles: ['inputBlur', 'inputChange', 'inputFocus'],\n },\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<TextAreaArgs>;\n\nexport const Default: Story = {\n render: (args) => {\n return html`\n <modus-wc-textarea\n aria-label=\"Textarea input\"\n auto-correct=${ifDefined(args['auto-correct'])}\n ?bordered=${args.bordered}\n custom-class=${ifDefined(args['custom-class'])}\n enterkeyhint=${ifDefined(args.enterkeyhint)}\n ?disabled=${args.disabled}\n .feedback=${args.feedback}\n input-aria-invalid=${ifDefined(args['input-aria-invalid'])}\n input-id=${ifDefined(args['input-id'])}\n input-tab-index=${ifDefined(args['input-tab-index'])}\n label=${ifDefined(args.label)}\n max-length=${ifDefined(args['max-length'])}\n min-length=${ifDefined(args['min-length'])}\n name=${ifDefined(args.name)}\n placeholder=${ifDefined(args.placeholder)}\n ?readonly=${args.readonly}\n ?required=${args.required}\n rows=${ifDefined(args.rows)}\n size=${ifDefined(args.size)}\n spellcheck=${ifDefined(args.spellcheck)}\n .value=${args.value}\n ></modus-wc-textarea>\n `;\n },\n};\n\nconst errorFeedback: IInputFeedbackProp = {\n level: 'error',\n message: 'Value is required.',\n};\n\nexport const WithErrorFeedback: Story = {\n render: (args) => html`\n <modus-wc-textarea\n aria-label=\"Textarea input\"\n .feedback=${errorFeedback}\n id=\"error-input\"\n label=${ifDefined(args.label)}\n ?required=${true}\n .value=${args.value}\n ></modus-wc-textarea>\n <script>\n // Adding this block to show how to set feedback via JS\n //const input = document.getElementById('error-input');\n //input.feedback = { level: 'error', message: 'Value is required.' };\n </script>\n `,\n};\n\nexport const ShadowDomParent: Story = {\n render: (args) => {\n // Create a unique shadow host for textarea component\n if (!customElements.get('textarea-shadow-host')) {\n const TextareaShadowHost = createShadowHostClass<TextAreaArgs>({\n componentTag: 'modus-wc-textarea',\n propsMapper: (v: TextAreaArgs, el: HTMLElement) => {\n const textareaEl = el as unknown as {\n autoCorrect: string;\n bordered: boolean;\n customClass: string;\n disabled: boolean;\n enterkeyhint: string;\n feedback: IInputFeedbackProp;\n inputId: string;\n inputTabIndex: number;\n label: string;\n maxLength: number;\n minLength: number;\n name: string;\n placeholder: string;\n readonly: boolean;\n required: boolean;\n rows: number;\n size: string;\n };\n textareaEl.autoCorrect = v['auto-correct'];\n textareaEl.bordered = Boolean(v.bordered);\n textareaEl.customClass = v['custom-class'] || '';\n textareaEl.disabled = Boolean(v.disabled);\n textareaEl.enterkeyhint = v.enterkeyhint || '';\n\n textareaEl.inputId = v['input-id'] || '';\n textareaEl.inputTabIndex = v['input-tab-index'] || 0;\n textareaEl.label = v.label || '';\n textareaEl.maxLength = v['max-length'] || 100;\n textareaEl.minLength = v['min-length'] || 0;\n textareaEl.name = v.name || '';\n textareaEl.placeholder = v.placeholder || '';\n textareaEl.readonly = Boolean(v.readonly);\n textareaEl.required = Boolean(v.required);\n textareaEl.rows = typeof v.rows === 'number' ? v.rows : 2;\n textareaEl.size = v.size || '';\n },\n });\n customElements.define('textarea-shadow-host', TextareaShadowHost);\n }\n\n return html`<textarea-shadow-host\n .props=${{ ...args }}\n ></textarea-shadow-host>`;\n },\n};\n\nexport const Migration: Story = {\n parameters: {\n docs: {\n description: {\n story: `\n#### Breaking Changes\n\n - In 1.0 input state was maintained by the component. 2.0 components encourage users to follow a controlled\n input model. See the Form Inputs [documentation](/docs/documentation-form-inputs--docs) for\n additional info and examples.\n - Size values have changed from verbose names (\\`medium\\`, \\`large\\`) to abbreviations (\\`sm\\`, \\`md\\`, \\`lg\\`).\n\n#### Prop Mapping\n\n| 1.0 Prop | 2.0 Prop | Notes |\n|------------------------------|---------------------|-------------------------------------------------------------|\n| aria-label | aria-label | |\n| autocorrect | auto-correct | |\n| auto-focus-input | | Not carried over |\n| clearable | | Not carried over |\n| disabled | disabled | |\n| enterkeyhint | enterkeyhint | |\n| error-text | feedback.message | Use \\`feedback\\` level |\n| helper-text | | Not carried over |\n| label | label | |\n| max-length | max-length | |\n| min-length | min-length | |\n| placeholder | placeholder | |\n| read-only | readonly | |\n| rows | rows | |\n| required | required | |\n| size | size | \\`medium\\` → \\`md\\`, \\`large\\` → \\`lg\\` |\n| spellcheck | spellcheck | |\n| text-align | | Not carried over, use CSS instead |\n| valid-text | feedback.message | Use \\`feedback\\` level |\n| value | value | |\n\n#### Event Mapping\n\n| 1.0 Event | 2.0 Event | Notes |\n|-------------|-------------|------------------|\n| valueChange | inputChange | |\n `,\n },\n },\n controls: { disable: true },\n canvas: { disable: true },\n },\n render: () => html`<div></div>`,\n};\n"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "A theme switcher component used to toggle the application theme and/or mode. Allows consumers to set the initial theme (Modus Classic, Modus Modern, etc.) and end-users to toggle modes (Light, Dark).",
|
|
3
|
+
"properties": [
|
|
4
|
+
{
|
|
5
|
+
"name": "customClass",
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "Custom CSS class to apply to the theme switcher element.",
|
|
8
|
+
"default": "''",
|
|
9
|
+
"mutable": false,
|
|
10
|
+
"end_line": 33
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"events": [
|
|
14
|
+
{
|
|
15
|
+
"name": "themeChange",
|
|
16
|
+
"detail": "IThemeConfig",
|
|
17
|
+
"description": "An event that fires when the theme is changed.",
|
|
18
|
+
"end_line": 36
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"methods": [],
|
|
22
|
+
"slots": [],
|
|
23
|
+
"examples": {
|
|
24
|
+
"basic": "<modus-wc-theme-provider .initialTheme=${currentTheme}>\n <modus-wc-theme-switcher\n aria-label=\"Theme toggle\"\n custom-class=${ifDefined(args['custom-class'])}\n ></modus-wc-theme-switcher>\n </modus-wc-theme-provider>",
|
|
25
|
+
"variations": [],
|
|
26
|
+
"args": {
|
|
27
|
+
"custom-class": "undefined",
|
|
28
|
+
"initial-theme": "undefined"
|
|
29
|
+
},
|
|
30
|
+
"argTypes": {},
|
|
31
|
+
"usage": [],
|
|
32
|
+
"events": [
|
|
33
|
+
"themeChange"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"tag": "modus-wc-theme-switcher",
|
|
37
|
+
"storyExample": {
|
|
38
|
+
"template": "<modus-wc-theme-provider .initialTheme=${currentTheme}>\n <modus-wc-theme-switcher\n aria-label=\"Theme toggle\"\n custom-class=${ifDefined(args['custom-class'])}\n ></modus-wc-theme-switcher>\n </modus-wc-theme-provider>",
|
|
39
|
+
"args": {
|
|
40
|
+
"custom-class": "undefined",
|
|
41
|
+
"initial-theme": "undefined"
|
|
42
|
+
},
|
|
43
|
+
"argTypes": {},
|
|
44
|
+
"events": [
|
|
45
|
+
"themeChange"
|
|
46
|
+
],
|
|
47
|
+
"fullContent": "import { withActions } from '@storybook/addon-actions/decorator';\nimport { Meta, StoryObj } from '@storybook/web-components';\nimport { html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { IThemeConfig } from '../../providers/theme/theme.types';\n\ninterface ThemeSwitcherArgs {\n 'custom-class'?: string;\n 'initial-theme'?: Partial<IThemeConfig>;\n}\n\nconst meta: Meta<ThemeSwitcherArgs> = {\n title: 'Components/ThemeSwitcher',\n component: 'modus-wc-theme-switcher',\n args: {\n 'custom-class': undefined,\n 'initial-theme': undefined,\n },\n decorators: [withActions],\n parameters: {\n actions: {\n handles: ['themeChange'],\n },\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<ThemeSwitcherArgs>;\n// When no data-theme is set on the root element, default to the design system's base theme \"modus-modern-light\"\nconst getCurrentTheme = () => {\n const dataTheme =\n document.documentElement.getAttribute('data-theme') || 'modus-modern-light';\n const mode = dataTheme.endsWith('-dark') ? 'dark' : 'light';\n const theme = dataTheme.replace(`-${mode}`, '');\n return { theme, mode };\n};\n\nconst Template: Story = {\n // prettier-ignore\n render: (args) => {\n const currentTheme = getCurrentTheme();\n return html`\n <modus-wc-theme-provider .initialTheme=${currentTheme}>\n <modus-wc-theme-switcher\n aria-label=\"Theme toggle\"\n custom-class=${ifDefined(args['custom-class'])}\n ></modus-wc-theme-switcher>\n </modus-wc-theme-provider>\n `;\n },\n};\n\nexport const Default: Story = { ...Template };\n\n// New story for testing theme configurations\nconst ThemeTestTemplate: Story = {\n render: () => {\n const currentTheme = getCurrentTheme();\n\n return html`\n <modus-wc-theme-provider .initialTheme=${currentTheme}>\n <div style=\"padding: 40px\">\n <h2 style=\"text-align: center; color: var(--mwc-color-on-surface);\">\n Theme Configuration Test\n </h2>\n <p\n style=\"text-align: center; color: var(--mwc-color-on-surface-secondary); margin-bottom: 30px;\"\n >\n This story matches the global Storybook theme\n </p>\n\n <div\n style=\"display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 30px;\"\n >\n <modus-wc-button color=\"primary\">Primary Button</modus-wc-button>\n <modus-wc-button color=\"secondary\"\n >Secondary Button</modus-wc-button\n >\n <modus-wc-button color=\"tertiary\">Tertiary Button</modus-wc-button>\n <modus-wc-button color=\"danger\">Danger Button</modus-wc-button>\n </div>\n\n <div\n style=\"display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; align-items: center;\"\n >\n <modus-wc-badge color=\"primary\">Badge</modus-wc-badge>\n <modus-wc-badge color=\"secondary\">Badge 2</modus-wc-badge>\n <modus-wc-chip label=\"Chip 1\"></modus-wc-chip>\n <modus-wc-chip label=\"Chip 2\" active></modus-wc-chip>\n <modus-wc-switch label=\"Switch\"></modus-wc-switch>\n </div>\n </div>\n </modus-wc-theme-provider>\n `;\n },\n};\n\nexport const ThemeTest: Story = {\n ...ThemeTestTemplate,\n parameters: {\n docs: {\n description: {\n story:\n 'This example syncs with the active Storybook theme. Toggle between light and dark modes using the theme switcher on the default story to see the components adapt accordingly.',\n },\n },\n },\n};\n"
|
|
48
|
+
}
|
|
49
|
+
}
|