@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,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,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,gFAAgF;IACzF,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,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K,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,YAAY,EAAE,OAAO,EAAE;QAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC7C,QAAQ,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