@joralvmel/cosmos-core 0.3.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.map +1 -1
- package/dist/catalog.js +11 -3
- package/dist/catalog.js.map +1 -1
- package/dist/codegen.d.ts +6 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +207 -4
- 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.map +1 -1
- package/dist/headless/listbox.js +2 -6
- package/dist/headless/listbox.js.map +1 -1
- 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 +3 -3
- package/dist/headless/text-field.d.ts.map +1 -1
- package/dist/headless/text-field.js +2 -2
- package/dist/headless/text-field.js.map +1 -1
- package/dist/index.d.ts +1132 -77
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -1
- package/dist/index.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.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 +3 -8
- package/dist/specs/listbox.d.ts.map +1 -1
- package/dist/specs/listbox.js +3 -3
- package/dist/specs/listbox.js.map +1 -1
- 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 +16 -28
- package/dist/specs/popover.d.ts.map +1 -1
- package/dist/specs/popover.js +16 -28
- package/dist/specs/popover.js.map +1 -1
- package/dist/specs/popover.scenarios.d.ts +10 -4
- package/dist/specs/popover.scenarios.d.ts.map +1 -1
- package/dist/specs/popover.scenarios.js +38 -38
- package/dist/specs/popover.scenarios.js.map +1 -1
- 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 +8 -22
- package/dist/specs/text-field.d.ts.map +1 -1
- package/dist/specs/text-field.js +8 -17
- package/dist/specs/text-field.js.map +1 -1
- package/dist/specs/text-field.scenarios.d.ts +3 -0
- package/dist/specs/text-field.scenarios.d.ts.map +1 -1
- package/dist/specs/text-field.scenarios.js +18 -0
- package/dist/specs/text-field.scenarios.js.map +1 -1
- 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 +550 -21
- package/package.json +1 -1
|
@@ -69,6 +69,24 @@ export const textFieldScenarios = [
|
|
|
69
69
|
actions: [{ type: 'submit' }],
|
|
70
70
|
expected: { value: 'ready', changes: [], disabled: false, submits: ['ready'] },
|
|
71
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
|
+
},
|
|
72
90
|
{
|
|
73
91
|
name: 'autonomous web form reset restores the default value',
|
|
74
92
|
props: { defaultValue: 'initial' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.scenarios.js","sourceRoot":"","sources":["../../src/specs/text-field.scenarios.ts"],"names":[],"mappings":"
|
|
1
|
+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AAE,EAAE,CAC1D,kBAAkB,CAAC,MAAM,CACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACzE,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** Value proposed when the user edits the textarea. */
|
|
2
|
+
export interface TextareaChangeDetail {
|
|
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"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineContract } from '../contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Labeled, multiline plain-text input with native form semantics on the web.
|
|
4
|
+
* The editable value follows the controlled/autonomous ownership rules in ADR 0003.
|
|
5
|
+
*/
|
|
6
|
+
export const textareaContract = defineContract({
|
|
7
|
+
name: 'textarea',
|
|
8
|
+
tag: 'cosm-textarea',
|
|
9
|
+
description: 'Accepts multiline plain text with an accessible label, optional helper and error text, and native form behavior on the web.',
|
|
10
|
+
role: 'textbox',
|
|
11
|
+
pattern: 'https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element',
|
|
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
|
+
rows: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
default: 4,
|
|
36
|
+
reflect: true,
|
|
37
|
+
description: 'Visible line count of the multiline editor. It is independent of the visual size.',
|
|
38
|
+
},
|
|
39
|
+
variant: {
|
|
40
|
+
type: 'enum',
|
|
41
|
+
values: ['outlined', 'filled'],
|
|
42
|
+
default: 'outlined',
|
|
43
|
+
reflect: true,
|
|
44
|
+
description: 'Visual treatment of the editable control.',
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
type: 'enum',
|
|
48
|
+
values: ['sm', 'md', 'lg'],
|
|
49
|
+
default: 'md',
|
|
50
|
+
reflect: true,
|
|
51
|
+
description: 'Visual size of the editable control, independent of rows.',
|
|
52
|
+
},
|
|
53
|
+
placeholder: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Short input hint; it never replaces the accessible label.',
|
|
56
|
+
},
|
|
57
|
+
helperText: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Optional supporting text associated with the editable control.',
|
|
60
|
+
},
|
|
61
|
+
errorText: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state.',
|
|
64
|
+
},
|
|
65
|
+
invalid: {
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
default: false,
|
|
68
|
+
reflect: true,
|
|
69
|
+
description: 'External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation.',
|
|
70
|
+
},
|
|
71
|
+
required: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
reflect: true,
|
|
75
|
+
description: 'Exposes required semantics. On web, participates in native HTML constraint validation.',
|
|
76
|
+
},
|
|
77
|
+
disabled: {
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
default: false,
|
|
80
|
+
reflect: true,
|
|
81
|
+
description: 'Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission.',
|
|
82
|
+
},
|
|
83
|
+
readOnly: {
|
|
84
|
+
type: 'boolean',
|
|
85
|
+
default: false,
|
|
86
|
+
reflect: true,
|
|
87
|
+
description: 'Prevents editing while remaining focusable and form-submittable on web; distinct from disabled.',
|
|
88
|
+
},
|
|
89
|
+
maxLength: {
|
|
90
|
+
type: 'number',
|
|
91
|
+
description: 'Maximum number of characters. Web uses native HTML length constraints and native applies supported input limits.',
|
|
92
|
+
},
|
|
93
|
+
name: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
reflect: true,
|
|
96
|
+
platforms: ['web', 'react', 'angular'],
|
|
97
|
+
description: 'Form field name on web. React Native has no HTML form association or name-based submission.',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
events: {
|
|
101
|
+
change: {
|
|
102
|
+
description: 'Proposes the current text after each user edit; this is not a blur/commit event.',
|
|
103
|
+
detail: 'TextareaChangeDetail',
|
|
104
|
+
names: {
|
|
105
|
+
dom: 'cosm-change',
|
|
106
|
+
react: 'onChange',
|
|
107
|
+
angular: 'valueChange',
|
|
108
|
+
native: 'onValueChange',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
states: [{ prop: 'value', event: 'change', defaultProp: 'defaultValue' }],
|
|
113
|
+
slots: {},
|
|
114
|
+
parts: {
|
|
115
|
+
label: 'Accessible label above the control.',
|
|
116
|
+
control: 'Visual control containing the editable textarea.',
|
|
117
|
+
textarea: 'The native multiline editable textarea.',
|
|
118
|
+
help: 'Supporting text associated with the editable textarea.',
|
|
119
|
+
error: 'External or native-constraint error text associated with the editable textarea.',
|
|
120
|
+
},
|
|
121
|
+
cssProperties: {
|
|
122
|
+
'--cosm-textarea-background': 'Editable control background.',
|
|
123
|
+
'--cosm-textarea-color': 'Editable text color.',
|
|
124
|
+
'--cosm-textarea-placeholder': 'Placeholder text color.',
|
|
125
|
+
'--cosm-textarea-border': 'Editable control boundary color.',
|
|
126
|
+
'--cosm-textarea-focus': 'Visible focus indicator color.',
|
|
127
|
+
'--cosm-textarea-radius': 'Editable control corner radius.',
|
|
128
|
+
},
|
|
129
|
+
keyboard: [
|
|
130
|
+
{ keys: ['Tab', 'Shift+Tab'], action: 'Moves focus to or from the enabled editable control.' },
|
|
131
|
+
{ keys: ['Enter'], action: 'Inserts a newline in the editable text.' },
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/specs/textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOhD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;IAC7C,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,eAAe;IACpB,WAAW,EACT,6HAA6H;IAC/H,I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C;QAC5D,uBAAuB,EAAE,gCAAgC;QACzD,wBAAwB,EAAE,iCAAiC;KAC5D;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,yCAAyC,EAAE;KACvE;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Platform } from '../contract.js';
|
|
2
|
+
export type TextareaAction = {
|
|
3
|
+
type: 'edit';
|
|
4
|
+
value: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'sync';
|
|
7
|
+
value: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'reset';
|
|
10
|
+
};
|
|
11
|
+
export interface TextareaScenario {
|
|
12
|
+
name: string;
|
|
13
|
+
props: {
|
|
14
|
+
value?: string;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
};
|
|
21
|
+
actions: readonly TextareaAction[];
|
|
22
|
+
expected: {
|
|
23
|
+
value: string;
|
|
24
|
+
changes: readonly string[];
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
invalid?: boolean;
|
|
27
|
+
};
|
|
28
|
+
platforms?: readonly Platform[];
|
|
29
|
+
}
|
|
30
|
+
/** Shared state and interaction expectations for all textarea platform drivers. */
|
|
31
|
+
export declare const textareaScenarios: readonly TextareaScenario[];
|
|
32
|
+
export declare const textareaScenariosFor: (platform: Platform) => TextareaScenario[];
|
|
33
|
+
//# sourceMappingURL=textarea.scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/textarea.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QAC3B,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,EAAE,SAAS,gBAAgB,EA8ExD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAU,QAAQ,uBAGpD,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Shared state and interaction expectations for all textarea platform drivers. */
|
|
2
|
+
export const textareaScenarios = [
|
|
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: 'an ignored controlled edit restores the owner value',
|
|
20
|
+
props: { value: 'stable' },
|
|
21
|
+
actions: [{ type: 'edit', value: 'unaccepted' }],
|
|
22
|
+
expected: { value: 'stable', changes: ['unaccepted'], disabled: false },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'an empty controlled value remains controlled',
|
|
26
|
+
props: { value: '' },
|
|
27
|
+
actions: [{ type: 'edit', value: 'draft' }],
|
|
28
|
+
expected: { value: '', changes: ['draft'], disabled: false },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'disabled textareas ignore edits',
|
|
32
|
+
props: { value: 'draft', disabled: true },
|
|
33
|
+
actions: [{ type: 'edit', value: 'changed' }],
|
|
34
|
+
expected: { value: 'draft', changes: [], disabled: true },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'read-only textareas ignore edits',
|
|
38
|
+
props: { value: 'draft', readOnly: true },
|
|
39
|
+
actions: [{ type: 'edit', value: 'changed' }],
|
|
40
|
+
expected: { value: 'draft', changes: [], disabled: false },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Enter edits preserve embedded newlines',
|
|
44
|
+
props: { defaultValue: 'first' },
|
|
45
|
+
actions: [{ type: 'edit', value: 'first\nsecond' }],
|
|
46
|
+
expected: { value: 'first\nsecond', changes: ['first\nsecond'], disabled: false },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'nonempty error text exposes invalid state',
|
|
50
|
+
props: { defaultValue: 'draft', errorText: 'Enter a valid value.' },
|
|
51
|
+
actions: [],
|
|
52
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: true },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'blank error text does not expose invalid state',
|
|
56
|
+
props: { defaultValue: 'draft', errorText: ' ' },
|
|
57
|
+
actions: [],
|
|
58
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: false },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'invalid exposes external invalid state without error text',
|
|
62
|
+
props: { defaultValue: 'draft', invalid: true },
|
|
63
|
+
actions: [],
|
|
64
|
+
expected: { value: 'draft', changes: [], disabled: false, invalid: true },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'autonomous web form reset restores the default value',
|
|
68
|
+
props: { defaultValue: 'initial' },
|
|
69
|
+
actions: [{ type: 'edit', value: 'changed' }, { type: 'reset' }],
|
|
70
|
+
expected: { value: 'initial', changes: ['changed'], disabled: false },
|
|
71
|
+
platforms: ['web', 'react', 'angular'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'controlled web form reset proposes the default value',
|
|
75
|
+
props: { value: 'current', defaultValue: 'initial' },
|
|
76
|
+
actions: [{ type: 'reset' }],
|
|
77
|
+
expected: { value: 'current', changes: ['initial'], disabled: false },
|
|
78
|
+
platforms: ['web', 'react', 'angular'],
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
export const textareaScenariosFor = (platform) => textareaScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
82
|
+
//# sourceMappingURL=textarea.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.scenarios.js","sourceRoot":"","sources":["../../src/specs/textarea.scenarios.ts"],"names":[],"mappings":"AA2BA,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D;QACE,IAAI,EAAE,+DAA+D;QACrE,KAAK,EAAE,EAAE,YAA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