@joralvmel/cosmos-core 0.2.0 → 0.4.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/catalog.d.ts +3 -3
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +25 -6
- package/dist/catalog.js.map +1 -1
- package/dist/codegen.d.ts +16 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +396 -57
- package/dist/codegen.js.map +1 -1
- package/dist/headless/calendar.d.ts +32 -0
- package/dist/headless/calendar.d.ts.map +1 -0
- package/dist/headless/calendar.js +242 -0
- package/dist/headless/calendar.js.map +1 -0
- package/dist/headless/listbox.d.ts +9 -0
- package/dist/headless/listbox.d.ts.map +1 -0
- package/dist/headless/listbox.js +103 -0
- package/dist/headless/listbox.js.map +1 -0
- package/dist/headless/pagination.d.ts +34 -0
- package/dist/headless/pagination.d.ts.map +1 -0
- package/dist/headless/pagination.js +92 -0
- package/dist/headless/pagination.js.map +1 -0
- package/dist/headless/radio-group.d.ts +10 -0
- package/dist/headless/radio-group.d.ts.map +1 -0
- package/dist/headless/radio-group.js +59 -0
- package/dist/headless/radio-group.js.map +1 -0
- package/dist/headless/select.d.ts +4 -0
- package/dist/headless/select.d.ts.map +1 -0
- package/dist/headless/select.js +7 -0
- package/dist/headless/select.js.map +1 -0
- package/dist/headless/size.d.ts +3 -0
- package/dist/headless/size.d.ts.map +1 -0
- package/dist/headless/size.js +7 -0
- package/dist/headless/size.js.map +1 -0
- package/dist/headless/text-field.d.ts +25 -0
- package/dist/headless/text-field.d.ts.map +1 -0
- package/dist/headless/text-field.js +12 -0
- package/dist/headless/text-field.js.map +1 -0
- package/dist/index.d.ts +1709 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +7 -3
- package/dist/markdown.js.map +1 -1
- package/dist/specs/badge.d.ts +65 -0
- package/dist/specs/badge.d.ts.map +1 -0
- package/dist/specs/badge.js +64 -0
- package/dist/specs/badge.js.map +1 -0
- package/dist/specs/badge.scenarios.d.ts +21 -0
- package/dist/specs/badge.scenarios.d.ts.map +1 -0
- package/dist/specs/badge.scenarios.js +35 -0
- package/dist/specs/badge.scenarios.js.map +1 -0
- package/dist/specs/calendar.d.ts +120 -0
- package/dist/specs/calendar.d.ts.map +1 -0
- package/dist/specs/calendar.js +121 -0
- package/dist/specs/calendar.js.map +1 -0
- package/dist/specs/calendar.scenarios.d.ts +39 -0
- package/dist/specs/calendar.scenarios.d.ts.map +1 -0
- package/dist/specs/calendar.scenarios.js +139 -0
- package/dist/specs/calendar.scenarios.js.map +1 -0
- package/dist/specs/checkbox.d.ts +139 -0
- package/dist/specs/checkbox.d.ts.map +1 -0
- package/dist/specs/checkbox.js +129 -0
- package/dist/specs/checkbox.js.map +1 -0
- package/dist/specs/checkbox.scenarios.d.ts +28 -0
- package/dist/specs/checkbox.scenarios.d.ts.map +1 -0
- package/dist/specs/checkbox.scenarios.js +54 -0
- package/dist/specs/checkbox.scenarios.js.map +1 -0
- package/dist/specs/dialog.d.ts +167 -0
- package/dist/specs/dialog.d.ts.map +1 -0
- package/dist/specs/dialog.js +136 -0
- package/dist/specs/dialog.js.map +1 -0
- package/dist/specs/dialog.scenarios.d.ts +42 -0
- package/dist/specs/dialog.scenarios.d.ts.map +1 -0
- package/dist/specs/dialog.scenarios.js +129 -0
- package/dist/specs/dialog.scenarios.js.map +1 -0
- package/dist/specs/icon-button.d.ts +136 -0
- package/dist/specs/icon-button.d.ts.map +1 -0
- package/dist/specs/icon-button.js +119 -0
- package/dist/specs/icon-button.js.map +1 -0
- package/dist/specs/icon-button.scenarios.d.ts +28 -0
- package/dist/specs/icon-button.scenarios.d.ts.map +1 -0
- package/dist/specs/icon-button.scenarios.js +95 -0
- package/dist/specs/icon-button.scenarios.js.map +1 -0
- package/dist/specs/icon.d.ts +11 -20
- package/dist/specs/icon.d.ts.map +1 -1
- package/dist/specs/icon.js +11 -20
- package/dist/specs/icon.js.map +1 -1
- package/dist/specs/icon.scenarios.d.ts +9 -1
- package/dist/specs/icon.scenarios.d.ts.map +1 -1
- package/dist/specs/icon.scenarios.js +70 -6
- package/dist/specs/icon.scenarios.js.map +1 -1
- package/dist/specs/listbox.d.ts +157 -0
- package/dist/specs/listbox.d.ts.map +1 -0
- package/dist/specs/listbox.js +144 -0
- package/dist/specs/listbox.js.map +1 -0
- package/dist/specs/listbox.scenarios.d.ts +37 -0
- package/dist/specs/listbox.scenarios.d.ts.map +1 -0
- package/dist/specs/listbox.scenarios.js +110 -0
- package/dist/specs/listbox.scenarios.js.map +1 -0
- package/dist/specs/pagination.d.ts +147 -0
- package/dist/specs/pagination.d.ts.map +1 -0
- package/dist/specs/pagination.js +122 -0
- package/dist/specs/pagination.js.map +1 -0
- package/dist/specs/pagination.scenarios.d.ts +15 -0
- package/dist/specs/pagination.scenarios.d.ts.map +1 -0
- package/dist/specs/pagination.scenarios.js +29 -0
- package/dist/specs/pagination.scenarios.js.map +1 -0
- package/dist/specs/popover.d.ts +201 -0
- package/dist/specs/popover.d.ts.map +1 -0
- package/dist/specs/popover.js +169 -0
- package/dist/specs/popover.js.map +1 -0
- package/dist/specs/popover.scenarios.d.ts +83 -0
- package/dist/specs/popover.scenarios.d.ts.map +1 -0
- package/dist/specs/popover.scenarios.js +368 -0
- package/dist/specs/popover.scenarios.js.map +1 -0
- package/dist/specs/radio-group.d.ts +154 -0
- package/dist/specs/radio-group.d.ts.map +1 -0
- package/dist/specs/radio-group.js +133 -0
- package/dist/specs/radio-group.js.map +1 -0
- package/dist/specs/radio-group.scenarios.d.ts +35 -0
- package/dist/specs/radio-group.scenarios.d.ts.map +1 -0
- package/dist/specs/radio-group.scenarios.js +67 -0
- package/dist/specs/radio-group.scenarios.js.map +1 -0
- package/dist/specs/select.d.ts +167 -0
- package/dist/specs/select.d.ts.map +1 -0
- package/dist/specs/select.js +148 -0
- package/dist/specs/select.js.map +1 -0
- package/dist/specs/select.scenarios.d.ts +37 -0
- package/dist/specs/select.scenarios.d.ts.map +1 -0
- package/dist/specs/select.scenarios.js +77 -0
- package/dist/specs/select.scenarios.js.map +1 -0
- package/dist/specs/switch.d.ts +123 -0
- package/dist/specs/switch.d.ts.map +1 -0
- package/dist/specs/switch.js +113 -0
- package/dist/specs/switch.js.map +1 -0
- package/dist/specs/switch.scenarios.d.ts +27 -0
- package/dist/specs/switch.scenarios.d.ts.map +1 -0
- package/dist/specs/switch.scenarios.js +54 -0
- package/dist/specs/switch.scenarios.js.map +1 -0
- package/dist/specs/text-field.d.ts +232 -0
- package/dist/specs/text-field.d.ts.map +1 -0
- package/dist/specs/text-field.js +220 -0
- package/dist/specs/text-field.js.map +1 -0
- package/dist/specs/text-field.scenarios.d.ts +52 -0
- package/dist/specs/text-field.scenarios.d.ts.map +1 -0
- package/dist/specs/text-field.scenarios.js +106 -0
- package/dist/specs/text-field.scenarios.js.map +1 -0
- package/dist/specs/textarea.d.ts +144 -0
- package/dist/specs/textarea.d.ts.map +1 -0
- package/dist/specs/textarea.js +134 -0
- package/dist/specs/textarea.js.map +1 -0
- package/dist/specs/textarea.scenarios.d.ts +33 -0
- package/dist/specs/textarea.scenarios.d.ts.map +1 -0
- package/dist/specs/textarea.scenarios.js +82 -0
- package/dist/specs/textarea.scenarios.js.map +1 -0
- package/llms.md +797 -6
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { defineContract } from '../contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Single-line text entry with an accessible label and native form semantics on the web.
|
|
4
|
+
* The editable value follows the controlled/autonomous ownership rules in ADR 0003.
|
|
5
|
+
*/
|
|
6
|
+
export const textFieldContract = defineContract({
|
|
7
|
+
name: 'text-field',
|
|
8
|
+
tag: 'cosm-text-field',
|
|
9
|
+
description: 'Accepts a single line of text with an accessible label, optional helper and error text, and native form validation on the web.',
|
|
10
|
+
role: 'textbox',
|
|
11
|
+
pattern: 'https://html.spec.whatwg.org/multipage/input.html',
|
|
12
|
+
props: {
|
|
13
|
+
label: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'Accessible name for the editable control. It is rendered above the control unless visually hidden.',
|
|
17
|
+
},
|
|
18
|
+
labelHidden: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
default: false,
|
|
21
|
+
reflect: true,
|
|
22
|
+
description: 'Visually hides the label while keeping it available to assistive technology.',
|
|
23
|
+
},
|
|
24
|
+
value: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value.',
|
|
27
|
+
},
|
|
28
|
+
defaultValue: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
description: 'Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits.',
|
|
32
|
+
},
|
|
33
|
+
type: {
|
|
34
|
+
type: 'enum',
|
|
35
|
+
values: ['text', 'email', 'password', 'tel', 'url', 'search'],
|
|
36
|
+
default: 'text',
|
|
37
|
+
reflect: true,
|
|
38
|
+
description: 'Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior.',
|
|
39
|
+
},
|
|
40
|
+
variant: {
|
|
41
|
+
type: 'enum',
|
|
42
|
+
values: ['outlined', 'filled'],
|
|
43
|
+
default: 'outlined',
|
|
44
|
+
reflect: true,
|
|
45
|
+
description: 'Visual treatment of the editable control.',
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
type: 'enum',
|
|
49
|
+
values: ['sm', 'md', 'lg'],
|
|
50
|
+
default: 'md',
|
|
51
|
+
reflect: true,
|
|
52
|
+
description: 'Small, medium or large editable control.',
|
|
53
|
+
},
|
|
54
|
+
placeholder: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'Short input hint; it never replaces the accessible label.',
|
|
57
|
+
},
|
|
58
|
+
helperText: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'Optional supporting text associated with the editable control.',
|
|
61
|
+
},
|
|
62
|
+
errorText: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state.',
|
|
65
|
+
},
|
|
66
|
+
invalid: {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
default: false,
|
|
69
|
+
reflect: true,
|
|
70
|
+
description: 'External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation.',
|
|
71
|
+
},
|
|
72
|
+
required: {
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
default: false,
|
|
75
|
+
reflect: true,
|
|
76
|
+
description: 'Exposes required semantics. On web, participates in native HTML constraint validation.',
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
default: false,
|
|
81
|
+
reflect: true,
|
|
82
|
+
description: 'Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission.',
|
|
83
|
+
},
|
|
84
|
+
readOnly: {
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
default: false,
|
|
87
|
+
reflect: true,
|
|
88
|
+
description: 'Prevents editing while remaining focusable and form-submittable on web; distinct from disabled.',
|
|
89
|
+
},
|
|
90
|
+
minLength: {
|
|
91
|
+
type: 'number',
|
|
92
|
+
description: 'Minimum number of characters. Web uses native HTML validity; native business validation remains the consumer’s responsibility.',
|
|
93
|
+
},
|
|
94
|
+
maxLength: {
|
|
95
|
+
type: 'number',
|
|
96
|
+
description: 'Maximum number of characters. Web uses native HTML validity and native applies supported input limits.',
|
|
97
|
+
},
|
|
98
|
+
pattern: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
platforms: ['web', 'react', 'angular'],
|
|
101
|
+
description: 'Web-only HTML pattern constraint. Native does not emulate HTML regular-expression validation.',
|
|
102
|
+
},
|
|
103
|
+
name: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
reflect: true,
|
|
106
|
+
platforms: ['web', 'react', 'angular'],
|
|
107
|
+
description: 'Form field name on web. React Native has no HTML form association or name-based submission.',
|
|
108
|
+
},
|
|
109
|
+
autoComplete: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: 'Consumer-provided completion/autofill hint, mapped to attributes supported by each platform.',
|
|
112
|
+
},
|
|
113
|
+
inputMode: {
|
|
114
|
+
type: 'union',
|
|
115
|
+
variants: [
|
|
116
|
+
{
|
|
117
|
+
type: 'enum',
|
|
118
|
+
values: ['none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url'],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
description: 'Input or keyboard hint (none, text, decimal, numeric, tel, search, email or url); it does not add numeric or multiline field behavior.',
|
|
122
|
+
},
|
|
123
|
+
startIcon: {
|
|
124
|
+
type: 'reference',
|
|
125
|
+
reference: 'IconDefinition',
|
|
126
|
+
options: ['search', 'house', 'heart', 'star'],
|
|
127
|
+
example: 'search',
|
|
128
|
+
description: 'Optional structured decorative icon before the editable text.',
|
|
129
|
+
},
|
|
130
|
+
endIcon: {
|
|
131
|
+
type: 'reference',
|
|
132
|
+
reference: 'IconDefinition',
|
|
133
|
+
options: ['search', 'house', 'heart', 'star'],
|
|
134
|
+
example: 'search',
|
|
135
|
+
description: 'Optional structured decorative icon after the editable text.',
|
|
136
|
+
},
|
|
137
|
+
prefix: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
description: 'Optional non-interactive text decoration before the editable text.',
|
|
140
|
+
},
|
|
141
|
+
suffix: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
description: 'Optional non-interactive text decoration after the editable text.',
|
|
144
|
+
},
|
|
145
|
+
clearable: {
|
|
146
|
+
type: 'boolean',
|
|
147
|
+
default: false,
|
|
148
|
+
reflect: true,
|
|
149
|
+
description: 'Shows a clear action for non-empty editable fields. Supply clearLabel when enabled.',
|
|
150
|
+
},
|
|
151
|
+
clearLabel: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
description: 'Consumer-supplied localized accessible name for the clear action.',
|
|
154
|
+
},
|
|
155
|
+
passwordReveal: {
|
|
156
|
+
type: 'boolean',
|
|
157
|
+
default: false,
|
|
158
|
+
reflect: true,
|
|
159
|
+
description: 'Opts into a reveal action for password fields. Supply both revealPasswordLabel and hidePasswordLabel when enabled.',
|
|
160
|
+
},
|
|
161
|
+
revealPasswordLabel: {
|
|
162
|
+
type: 'string',
|
|
163
|
+
description: 'Consumer-supplied localized accessible name while the password is concealed.',
|
|
164
|
+
},
|
|
165
|
+
hidePasswordLabel: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
description: 'Consumer-supplied localized accessible name while the password is revealed.',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
events: {
|
|
171
|
+
change: {
|
|
172
|
+
description: 'Proposes the current text after each user edit, including clear; this is not a blur/commit event.',
|
|
173
|
+
detail: 'TextFieldChangeDetail',
|
|
174
|
+
names: {
|
|
175
|
+
dom: 'cosm-change',
|
|
176
|
+
react: 'onChange',
|
|
177
|
+
angular: 'valueChange',
|
|
178
|
+
native: 'onValueChange',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
submit: {
|
|
182
|
+
description: 'Reports the current text when the user invokes the field submit action (Enter/return).',
|
|
183
|
+
detail: 'TextFieldSubmitDetail',
|
|
184
|
+
names: {
|
|
185
|
+
dom: 'cosm-submit',
|
|
186
|
+
react: 'onSubmit',
|
|
187
|
+
angular: 'submit',
|
|
188
|
+
native: 'onSubmitEditing',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
states: [{ prop: 'value', event: 'change', defaultProp: 'defaultValue' }],
|
|
193
|
+
slots: {},
|
|
194
|
+
parts: {
|
|
195
|
+
label: 'Accessible label above the control.',
|
|
196
|
+
control: 'Visual control containing the editable input and decorations.',
|
|
197
|
+
input: 'The single-line editable input.',
|
|
198
|
+
start: 'Start icon or prefix decoration.',
|
|
199
|
+
end: 'End icon, suffix decoration or clear/reveal action.',
|
|
200
|
+
help: 'Supporting text associated with the editable input.',
|
|
201
|
+
error: 'External or native-validity error text associated with the editable input.',
|
|
202
|
+
'clear-button': 'Optional accessible clear action.',
|
|
203
|
+
'reveal-button': 'Optional accessible password visibility action.',
|
|
204
|
+
},
|
|
205
|
+
cssProperties: {
|
|
206
|
+
'--cosm-text-field-background': 'Editable control background.',
|
|
207
|
+
'--cosm-text-field-color': 'Editable and decoration text color.',
|
|
208
|
+
'--cosm-text-field-placeholder': 'Placeholder text color.',
|
|
209
|
+
'--cosm-text-field-border': 'Editable control boundary color.',
|
|
210
|
+
'--cosm-text-field-focus': 'Visible focus indicator color.',
|
|
211
|
+
'--cosm-text-field-radius': 'Editable control corner radius.',
|
|
212
|
+
'--cosm-text-field-start-icon-color': 'Start icon color, independent of text and affixes.',
|
|
213
|
+
'--cosm-text-field-end-icon-color': 'End icon color, independent of text and affixes.',
|
|
214
|
+
},
|
|
215
|
+
keyboard: [
|
|
216
|
+
{ keys: ['Tab', 'Shift+Tab'], action: 'Moves focus to or from the enabled editable control.' },
|
|
217
|
+
{ keys: ['Enter'], action: 'Invokes the submit action; web form behavior remains native.' },
|
|
218
|
+
],
|
|
219
|
+
});
|
|
220
|
+
//# sourceMappingURL=text-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../src/specs/text-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAYhD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC9C,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,iBAAiB;IACtB,WAAW,EACT,gIAAgI;IAClI,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,mDAAmD;IAC5D,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,oGAAoG;SACvG;QACD,WAAW,EAAE;YACX,IAAI,EAAE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AM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IACzE,KAAK,EAAE,EAAE;IACT,KAAK,EAAE;QACL,KAAK,EAAE,qCAAqC;QAC5C,OAAO,EAAE,+DAA+D;QACxE,KAAK,EAAE,iCAAiC;QACxC,KAAK,EAAE,kCAAkC;QACzC,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,qDAAqD;QAC3D,KAAK,EAAE,4EAA4E;QACnF,cAAc,EAAE,mCAAmC;QACnD,eAAe,EAAE,iDAAiD;KACnE;IACD,aAAa,EAAE;QACb,8BAA8B,EAAE,8BAA8B;QAC9D,yBAAyB,EAAE,qCAAqC;QAChE,+BAA+B,EAAE,yBAAyB;QAC1D,0BAA0B,EAAE,kCAAkC;QAC9D,yBAAyB,EAAE,gCAAgC;QAC3D,0BAA0B,EAAE,iCAAiC;QAC7D,oCAAoC,EAAE,oDAAoD;QAC1F,kCAAkC,EAAE,kDAAkD;KACvF;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,sDAAsD,EAAE;QAC9F,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,8DAA8D,EAAE;KAC5F;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Platform } from '../contract.js';
|
|
2
|
+
export type TextFieldAction = {
|
|
3
|
+
type: 'edit';
|
|
4
|
+
value: string;
|
|
5
|
+
selectionStart?: number;
|
|
6
|
+
composing?: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'sync';
|
|
9
|
+
value: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'clear';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'reveal';
|
|
14
|
+
} | {
|
|
15
|
+
type: 'hide';
|
|
16
|
+
} | {
|
|
17
|
+
type: 'submit';
|
|
18
|
+
value?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'reset';
|
|
21
|
+
};
|
|
22
|
+
export interface TextFieldScenario {
|
|
23
|
+
name: string;
|
|
24
|
+
props: {
|
|
25
|
+
value?: string;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
clearable?: boolean;
|
|
30
|
+
passwordReveal?: boolean;
|
|
31
|
+
invalid?: boolean;
|
|
32
|
+
errorText?: string;
|
|
33
|
+
type?: 'text' | 'email' | 'password' | 'tel' | 'url' | 'search';
|
|
34
|
+
};
|
|
35
|
+
actions: readonly TextFieldAction[];
|
|
36
|
+
expected: {
|
|
37
|
+
value: string;
|
|
38
|
+
changes: readonly string[];
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
submits?: readonly string[];
|
|
41
|
+
focused?: boolean;
|
|
42
|
+
selectionStart?: number;
|
|
43
|
+
compositionPreserved?: boolean;
|
|
44
|
+
passwordVisible?: boolean;
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
};
|
|
47
|
+
platforms?: readonly Platform[];
|
|
48
|
+
}
|
|
49
|
+
/** Shared state and interaction expectations for all text-field platform drivers. */
|
|
50
|
+
export declare const textFieldScenarios: readonly TextFieldScenario[];
|
|
51
|
+
export declare const textFieldScenariosFor: (platform: Platform) => TextFieldScenario[];
|
|
52
|
+
//# sourceMappingURL=text-field.scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-field.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/text-field.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EA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;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAED,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,EAAE,SAAS,iBAAiB,EAsG1D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,UAAU,QAAQ,wBAGrD,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Shared state and interaction expectations for all text-field platform drivers. */
|
|
2
|
+
export const textFieldScenarios = [
|
|
3
|
+
{
|
|
4
|
+
name: 'autonomous edits update the owned value and propose each edit',
|
|
5
|
+
props: { defaultValue: 'draft' },
|
|
6
|
+
actions: [{ type: 'edit', value: 'drafted' }],
|
|
7
|
+
expected: { value: 'drafted', changes: ['drafted'], disabled: false },
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'controlled edits wait for the owner to accept the proposal',
|
|
11
|
+
props: { value: 'before' },
|
|
12
|
+
actions: [
|
|
13
|
+
{ type: 'edit', value: 'after' },
|
|
14
|
+
{ type: 'sync', value: 'after' },
|
|
15
|
+
],
|
|
16
|
+
expected: { value: 'after', changes: ['after'], disabled: false },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'a refused controlled edit restores the value and preserves selection and composition',
|
|
20
|
+
props: { value: 'stable' },
|
|
21
|
+
actions: [{ type: 'edit', value: 'stablex', selectionStart: 6, composing: true }],
|
|
22
|
+
expected: {
|
|
23
|
+
value: 'stable',
|
|
24
|
+
changes: ['stablex'],
|
|
25
|
+
disabled: false,
|
|
26
|
+
selectionStart: 6,
|
|
27
|
+
compositionPreserved: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'an empty controlled value remains controlled',
|
|
32
|
+
props: { value: '' },
|
|
33
|
+
actions: [{ type: 'edit', value: 'draft' }],
|
|
34
|
+
expected: { value: '', changes: ['draft'], disabled: false },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'clear proposes an empty value and retains focus',
|
|
38
|
+
props: { defaultValue: 'draft', clearable: true },
|
|
39
|
+
actions: [{ type: 'clear' }],
|
|
40
|
+
expected: { value: '', changes: [''], disabled: false, focused: true },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'a refused controlled clear restores its value and retains focus',
|
|
44
|
+
props: { value: 'draft', clearable: true },
|
|
45
|
+
actions: [{ type: 'clear' }],
|
|
46
|
+
expected: { value: 'draft', changes: [''], disabled: false, focused: true },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'disabled fields ignore edits and clear requests',
|
|
50
|
+
props: { value: 'draft', disabled: true, clearable: true },
|
|
51
|
+
actions: [{ type: 'edit', value: 'changed' }, { type: 'clear' }],
|
|
52
|
+
expected: { value: 'draft', changes: [], disabled: true },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'read-only fields ignore edits and clear requests',
|
|
56
|
+
props: { value: 'draft', readOnly: true, clearable: true },
|
|
57
|
+
actions: [{ type: 'edit', value: 'changed' }, { type: 'clear' }],
|
|
58
|
+
expected: { value: 'draft', changes: [], disabled: false },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'password reveal toggles presentation without changing the value',
|
|
62
|
+
props: { value: 'secret', type: 'password', passwordReveal: true },
|
|
63
|
+
actions: [{ type: 'reveal' }, { type: 'hide' }],
|
|
64
|
+
expected: { value: 'secret', changes: [], disabled: false, passwordVisible: false },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'submit reports the current value without proposing an edit',
|
|
68
|
+
props: { value: 'ready' },
|
|
69
|
+
actions: [{ type: 'submit' }],
|
|
70
|
+
expected: { value: 'ready', changes: [], disabled: false, submits: ['ready'] },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'nonempty error text exposes invalid state',
|
|
74
|
+
props: { defaultValue: 'draft', errorText: 'Enter a valid value.' },
|
|
75
|
+
actions: [],
|
|
76
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: true },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'blank error text does not expose invalid state',
|
|
80
|
+
props: { defaultValue: 'draft', errorText: ' ' },
|
|
81
|
+
actions: [],
|
|
82
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: false },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'invalid exposes external invalid state without error text',
|
|
86
|
+
props: { defaultValue: 'draft', invalid: true },
|
|
87
|
+
actions: [],
|
|
88
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: true },
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'autonomous web form reset restores the default value',
|
|
92
|
+
props: { defaultValue: 'initial' },
|
|
93
|
+
actions: [{ type: 'edit', value: 'changed' }, { type: 'reset' }],
|
|
94
|
+
expected: { value: 'initial', changes: ['changed'], disabled: false },
|
|
95
|
+
platforms: ['web', 'react', 'angular'],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'controlled web form reset proposes the default value',
|
|
99
|
+
props: { value: 'current', defaultValue: 'initial' },
|
|
100
|
+
actions: [{ type: 'reset' }],
|
|
101
|
+
expected: { value: 'current', changes: ['initial'], disabled: false },
|
|
102
|
+
platforms: ['web', 'react', 'angular'],
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
export const textFieldScenariosFor = (platform) => textFieldScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
106
|
+
//# sourceMappingURL=text-field.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-field.scenarios.js","sourceRoot":"","sources":["../../src/specs/text-field.scenarios.ts"],"names":[],"mappings":"AAuCA,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D;QACE,IAAI,EAAE,+DAA+D;QACrE,KAAK,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE;QAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EA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etail {
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Labeled, multiline plain-text input with native form semantics on the web.
|
|
7
|
+
* The editable value follows the controlled/autonomous ownership rules in ADR 0003.
|
|
8
|
+
*/
|
|
9
|
+
export declare const textareaContract: {
|
|
10
|
+
readonly name: "textarea";
|
|
11
|
+
readonly tag: "cosm-textarea";
|
|
12
|
+
readonly description: "Accepts multiline plain text with an accessible label, optional helper and error text, and native form behavior on the web.";
|
|
13
|
+
readonly role: "textbox";
|
|
14
|
+
readonly pattern: "https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element";
|
|
15
|
+
readonly props: {
|
|
16
|
+
readonly label: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly required: true;
|
|
19
|
+
readonly description: "Accessible name for the editable control. It is rendered above the control unless visually hidden.";
|
|
20
|
+
};
|
|
21
|
+
readonly labelHidden: {
|
|
22
|
+
readonly type: "boolean";
|
|
23
|
+
readonly default: false;
|
|
24
|
+
readonly reflect: true;
|
|
25
|
+
readonly description: "Visually hides the label while keeping it available to assistive technology.";
|
|
26
|
+
};
|
|
27
|
+
readonly value: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value.";
|
|
30
|
+
};
|
|
31
|
+
readonly defaultValue: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly default: "";
|
|
34
|
+
readonly description: "Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits.";
|
|
35
|
+
};
|
|
36
|
+
readonly rows: {
|
|
37
|
+
readonly type: "number";
|
|
38
|
+
readonly default: 4;
|
|
39
|
+
readonly reflect: true;
|
|
40
|
+
readonly description: "Visible line count of the multiline editor. It is independent of the visual size.";
|
|
41
|
+
};
|
|
42
|
+
readonly variant: {
|
|
43
|
+
readonly type: "enum";
|
|
44
|
+
readonly values: readonly ["outlined", "filled"];
|
|
45
|
+
readonly default: "outlined";
|
|
46
|
+
readonly reflect: true;
|
|
47
|
+
readonly description: "Visual treatment of the editable control.";
|
|
48
|
+
};
|
|
49
|
+
readonly size: {
|
|
50
|
+
readonly type: "enum";
|
|
51
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
52
|
+
readonly default: "md";
|
|
53
|
+
readonly reflect: true;
|
|
54
|
+
readonly description: "Visual size of the editable control, independent of rows.";
|
|
55
|
+
};
|
|
56
|
+
readonly placeholder: {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
readonly description: "Short input hint; it never replaces the accessible label.";
|
|
59
|
+
};
|
|
60
|
+
readonly helperText: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly description: "Optional supporting text associated with the editable control.";
|
|
63
|
+
};
|
|
64
|
+
readonly errorText: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly description: "Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state.";
|
|
67
|
+
};
|
|
68
|
+
readonly invalid: {
|
|
69
|
+
readonly type: "boolean";
|
|
70
|
+
readonly default: false;
|
|
71
|
+
readonly reflect: true;
|
|
72
|
+
readonly description: "External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation.";
|
|
73
|
+
};
|
|
74
|
+
readonly required: {
|
|
75
|
+
readonly type: "boolean";
|
|
76
|
+
readonly default: false;
|
|
77
|
+
readonly reflect: true;
|
|
78
|
+
readonly description: "Exposes required semantics. On web, participates in native HTML constraint validation.";
|
|
79
|
+
};
|
|
80
|
+
readonly disabled: {
|
|
81
|
+
readonly type: "boolean";
|
|
82
|
+
readonly default: false;
|
|
83
|
+
readonly reflect: true;
|
|
84
|
+
readonly description: "Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission.";
|
|
85
|
+
};
|
|
86
|
+
readonly readOnly: {
|
|
87
|
+
readonly type: "boolean";
|
|
88
|
+
readonly default: false;
|
|
89
|
+
readonly reflect: true;
|
|
90
|
+
readonly description: "Prevents editing while remaining focusable and form-submittable on web; distinct from disabled.";
|
|
91
|
+
};
|
|
92
|
+
readonly maxLength: {
|
|
93
|
+
readonly type: "number";
|
|
94
|
+
readonly description: "Maximum number of characters. Web uses native HTML length constraints and native applies supported input limits.";
|
|
95
|
+
};
|
|
96
|
+
readonly name: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly reflect: true;
|
|
99
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
100
|
+
readonly description: "Form field name on web. React Native has no HTML form association or name-based submission.";
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
readonly events: {
|
|
104
|
+
readonly change: {
|
|
105
|
+
readonly description: "Proposes the current text after each user edit; this is not a blur/commit event.";
|
|
106
|
+
readonly detail: "TextareaChangeDetail";
|
|
107
|
+
readonly names: {
|
|
108
|
+
readonly dom: "cosm-change";
|
|
109
|
+
readonly react: "onChange";
|
|
110
|
+
readonly angular: "valueChange";
|
|
111
|
+
readonly native: "onValueChange";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly states: readonly [{
|
|
116
|
+
readonly prop: "value";
|
|
117
|
+
readonly event: "change";
|
|
118
|
+
readonly defaultProp: "defaultValue";
|
|
119
|
+
}];
|
|
120
|
+
readonly slots: {};
|
|
121
|
+
readonly parts: {
|
|
122
|
+
readonly label: "Accessible label above the control.";
|
|
123
|
+
readonly control: "Visual control containing the editable textarea.";
|
|
124
|
+
readonly textarea: "The native multiline editable textarea.";
|
|
125
|
+
readonly help: "Supporting text associated with the editable textarea.";
|
|
126
|
+
readonly error: "External or native-constraint error text associated with the editable textarea.";
|
|
127
|
+
};
|
|
128
|
+
readonly cssProperties: {
|
|
129
|
+
readonly '--cosm-textarea-background': "Editable control background.";
|
|
130
|
+
readonly '--cosm-textarea-color': "Editable text color.";
|
|
131
|
+
readonly '--cosm-textarea-placeholder': "Placeholder text color.";
|
|
132
|
+
readonly '--cosm-textarea-border': "Editable control boundary color.";
|
|
133
|
+
readonly '--cosm-textarea-focus': "Visible focus indicator color.";
|
|
134
|
+
readonly '--cosm-textarea-radius': "Editable control corner radius.";
|
|
135
|
+
};
|
|
136
|
+
readonly keyboard: readonly [{
|
|
137
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
138
|
+
readonly action: "Moves focus to or from the enabled editable control.";
|
|
139
|
+
}, {
|
|
140
|
+
readonly keys: readonly ["Enter"];
|
|
141
|
+
readonly action: "Inserts a newline in the editable text.";
|
|
142
|
+
}];
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/specs/textarea.ts"],"names":[],"mappings":"AAEA,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4I3B,CAAC"}
|