@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const may = { defaultValue: '2024-05-15', locale: 'en-US' };
|
|
2
|
+
/** Normative date selection and navigation cases shared by platform drivers. */
|
|
3
|
+
export const calendarScenarios = [
|
|
4
|
+
{
|
|
5
|
+
name: 'defaultValue initializes autonomous selection',
|
|
6
|
+
props: may,
|
|
7
|
+
actions: [],
|
|
8
|
+
expected: {
|
|
9
|
+
value: '2024-05-15',
|
|
10
|
+
changes: [],
|
|
11
|
+
month: '2024-05-01',
|
|
12
|
+
activeDate: '2024-05-15',
|
|
13
|
+
disabled: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'autonomous selection commits and proposes an enabled date',
|
|
18
|
+
props: may,
|
|
19
|
+
actions: [{ type: 'select', value: '2024-05-16' }],
|
|
20
|
+
expected: {
|
|
21
|
+
value: '2024-05-16',
|
|
22
|
+
changes: ['2024-05-16'],
|
|
23
|
+
month: '2024-05-01',
|
|
24
|
+
activeDate: '2024-05-16',
|
|
25
|
+
disabled: false,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'controlled selection waits for the owner',
|
|
30
|
+
props: { value: '2024-05-15', locale: 'en-US' },
|
|
31
|
+
actions: [{ type: 'select', value: '2024-05-16' }],
|
|
32
|
+
expected: {
|
|
33
|
+
value: '2024-05-15',
|
|
34
|
+
changes: ['2024-05-16'],
|
|
35
|
+
month: '2024-05-01',
|
|
36
|
+
activeDate: '2024-05-16',
|
|
37
|
+
disabled: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'controlled selection follows an accepted value',
|
|
42
|
+
props: { value: '2024-05-15', locale: 'en-US' },
|
|
43
|
+
actions: [
|
|
44
|
+
{ type: 'select', value: '2024-05-16' },
|
|
45
|
+
{ type: 'sync', value: '2024-05-16' },
|
|
46
|
+
],
|
|
47
|
+
expected: {
|
|
48
|
+
value: '2024-05-16',
|
|
49
|
+
changes: ['2024-05-16'],
|
|
50
|
+
month: '2024-05-01',
|
|
51
|
+
activeDate: '2024-05-16',
|
|
52
|
+
disabled: false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'bounds prevent out-of-range selection',
|
|
57
|
+
props: { ...may, min: '2024-05-10', max: '2024-05-20' },
|
|
58
|
+
actions: [
|
|
59
|
+
{ type: 'select', value: '2024-05-09' },
|
|
60
|
+
{ type: 'select', value: '2024-05-21' },
|
|
61
|
+
],
|
|
62
|
+
expected: {
|
|
63
|
+
value: '2024-05-15',
|
|
64
|
+
changes: [],
|
|
65
|
+
month: '2024-05-01',
|
|
66
|
+
activeDate: '2024-05-15',
|
|
67
|
+
disabled: false,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'disabled calendar prevents selection and navigation',
|
|
72
|
+
props: { ...may, disabled: true },
|
|
73
|
+
actions: [
|
|
74
|
+
{ type: 'select', value: '2024-05-16' },
|
|
75
|
+
{ type: 'navigate', months: 1 },
|
|
76
|
+
],
|
|
77
|
+
expected: {
|
|
78
|
+
value: '2024-05-15',
|
|
79
|
+
changes: [],
|
|
80
|
+
month: '2024-05-01',
|
|
81
|
+
activeDate: undefined,
|
|
82
|
+
disabled: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'selecting an adjacent-month date updates the visible month',
|
|
87
|
+
props: may,
|
|
88
|
+
actions: [{ type: 'select', value: '2024-04-30' }],
|
|
89
|
+
expected: {
|
|
90
|
+
value: '2024-04-30',
|
|
91
|
+
changes: ['2024-04-30'],
|
|
92
|
+
month: '2024-04-01',
|
|
93
|
+
activeDate: '2024-04-30',
|
|
94
|
+
disabled: false,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'keyboard navigation changes focus before selection',
|
|
99
|
+
props: may,
|
|
100
|
+
actions: [
|
|
101
|
+
{ type: 'key', key: 'ArrowRight' },
|
|
102
|
+
{ type: 'key', key: 'Enter' },
|
|
103
|
+
],
|
|
104
|
+
expected: {
|
|
105
|
+
value: '2024-05-16',
|
|
106
|
+
changes: ['2024-05-16'],
|
|
107
|
+
month: '2024-05-01',
|
|
108
|
+
activeDate: '2024-05-16',
|
|
109
|
+
disabled: false,
|
|
110
|
+
},
|
|
111
|
+
platforms: ['web', 'react', 'angular'],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'month navigation preserves selection',
|
|
115
|
+
props: may,
|
|
116
|
+
actions: [{ type: 'navigate', months: 1 }],
|
|
117
|
+
expected: {
|
|
118
|
+
value: '2024-05-15',
|
|
119
|
+
changes: [],
|
|
120
|
+
month: '2024-06-01',
|
|
121
|
+
activeDate: '2024-06-15',
|
|
122
|
+
disabled: false,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'month navigation can browse toward a future minimum',
|
|
127
|
+
props: { ...may, min: '2024-07-01' },
|
|
128
|
+
actions: [{ type: 'navigate', months: 1 }],
|
|
129
|
+
expected: {
|
|
130
|
+
value: '2024-05-15',
|
|
131
|
+
changes: [],
|
|
132
|
+
month: '2024-06-01',
|
|
133
|
+
activeDate: '2024-06-15',
|
|
134
|
+
disabled: false,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
export const calendarScenariosFor = (platform) => calendarScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
139
|
+
//# sourceMappingURL=calendar.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.scenarios.js","sourceRoot":"","sources":["../../src/specs/calendar.scenarios.ts"],"names":[],"mappings":"AA2CA,MAAM,GAAG,GAAG,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAE5D,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D;QACE,IAAI,EAAE,+CAA+C;QACrD,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE;YACR,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,KAAK;SAChB;KACF;IACD;QACE,IAAI,EAAE,2DAA2D;QACjE,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAClD,QAAQ,EAAE;YACR,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,CAAC,YAAY,CAAC;YACvB,KAAK,EAAE,YAAY;YACnB,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,KAAK;SAChB;KACF;IACD;QACE,IAAI,EAAE,0CAA0C;QAChD,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE;QAC/C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAClD,QAAQ,EAAE;YACR,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,CAAC,YAAY,CAAC;YACvB,KAAK,EAAE,YAAY;YACnB,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,KAA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nB,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,KAAK;SAChB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAkB,EAAE,EAAE,CACzD,iBAAiB,CAAC,MAAM,CACtB,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACzE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** A proposed checked value after user activation. */
|
|
2
|
+
export interface CheckboxCheckedChangeDetail {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* An independent boolean form choice with controlled or autonomous checked state.
|
|
7
|
+
*
|
|
8
|
+
* | State | Autonomous | Controlled | Event |
|
|
9
|
+
* | --- | --- | --- | --- |
|
|
10
|
+
* | checked | Starts at defaultChecked and commits activation | A supplied checked, including false, waits for the owner | checkedChange |
|
|
11
|
+
* | indeterminate | Presentation only; autonomous activation clears it | Remains as supplied until the owner changes it | None |
|
|
12
|
+
*/
|
|
13
|
+
export declare const checkboxContract: {
|
|
14
|
+
readonly name: "checkbox";
|
|
15
|
+
readonly tag: "cosm-checkbox";
|
|
16
|
+
readonly description: "Selects an independent boolean value with accessible labeling and native form behavior on the web.";
|
|
17
|
+
readonly role: "checkbox";
|
|
18
|
+
readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/";
|
|
19
|
+
readonly props: {
|
|
20
|
+
readonly label: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly required: true;
|
|
23
|
+
readonly description: "Required accessible name, visible unless labelHidden is true.";
|
|
24
|
+
};
|
|
25
|
+
readonly labelHidden: {
|
|
26
|
+
readonly type: "boolean";
|
|
27
|
+
readonly default: false;
|
|
28
|
+
readonly reflect: true;
|
|
29
|
+
readonly description: "Visually hides the label while keeping it available to assistive technology.";
|
|
30
|
+
};
|
|
31
|
+
readonly checked: {
|
|
32
|
+
readonly type: "boolean";
|
|
33
|
+
readonly default: false;
|
|
34
|
+
readonly description: "Controlled checked value when supplied, including false; activation proposes changes without self-committing.";
|
|
35
|
+
};
|
|
36
|
+
readonly defaultChecked: {
|
|
37
|
+
readonly type: "boolean";
|
|
38
|
+
readonly default: false;
|
|
39
|
+
readonly description: "Initial autonomous checked value; later changes do not reset it.";
|
|
40
|
+
};
|
|
41
|
+
readonly indeterminate: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly default: false;
|
|
44
|
+
readonly reflect: true;
|
|
45
|
+
readonly description: "Presentation-only mixed state. Autonomous activation clears it; controlled use leaves it to the owner.";
|
|
46
|
+
};
|
|
47
|
+
readonly size: {
|
|
48
|
+
readonly type: "enum";
|
|
49
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
50
|
+
readonly default: "md";
|
|
51
|
+
readonly reflect: true;
|
|
52
|
+
readonly description: "Small, medium or large visual box.";
|
|
53
|
+
};
|
|
54
|
+
readonly disabled: {
|
|
55
|
+
readonly type: "boolean";
|
|
56
|
+
readonly default: false;
|
|
57
|
+
readonly reflect: true;
|
|
58
|
+
readonly description: "Prevents user interaction and excludes the value from web form submission.";
|
|
59
|
+
};
|
|
60
|
+
readonly required: {
|
|
61
|
+
readonly type: "boolean";
|
|
62
|
+
readonly default: false;
|
|
63
|
+
readonly reflect: true;
|
|
64
|
+
readonly description: "Exposes required semantics and participates in native web form validation. Native has no automatic validation.";
|
|
65
|
+
};
|
|
66
|
+
readonly invalid: {
|
|
67
|
+
readonly type: "boolean";
|
|
68
|
+
readonly default: false;
|
|
69
|
+
readonly reflect: true;
|
|
70
|
+
readonly description: "Externally supplied invalid presentation state when the visible error is supplied elsewhere; web form validity remains based on required.";
|
|
71
|
+
};
|
|
72
|
+
readonly helperText: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly description: "Optional consumer-localized supporting text associated with the checkbox.";
|
|
75
|
+
};
|
|
76
|
+
readonly errorText: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly description: "Optional consumer-localized error description; a nonempty trimmed value also exposes invalid state.";
|
|
79
|
+
};
|
|
80
|
+
readonly name: {
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
readonly reflect: true;
|
|
83
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
84
|
+
readonly description: "Web form field name; React Native has no HTML form association.";
|
|
85
|
+
};
|
|
86
|
+
readonly value: {
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
readonly default: "on";
|
|
89
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
90
|
+
readonly description: "Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value.";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly events: {
|
|
94
|
+
readonly checkedChange: {
|
|
95
|
+
readonly description: "Proposes the next checked value after enabled user activation; controlled state waits for the owner.";
|
|
96
|
+
readonly detail: "CheckboxCheckedChangeDetail";
|
|
97
|
+
readonly names: {
|
|
98
|
+
readonly dom: "cosm-checked-change";
|
|
99
|
+
readonly react: "onCheckedChange";
|
|
100
|
+
readonly angular: "checkedChange";
|
|
101
|
+
readonly native: "onCheckedChange";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
readonly states: readonly [{
|
|
106
|
+
readonly prop: "checked";
|
|
107
|
+
readonly event: "checkedChange";
|
|
108
|
+
readonly defaultProp: "defaultChecked";
|
|
109
|
+
}];
|
|
110
|
+
readonly slots: {
|
|
111
|
+
readonly '': "Optional noninteractive inline label content; links and buttons are not allowed.";
|
|
112
|
+
};
|
|
113
|
+
readonly parts: {
|
|
114
|
+
readonly base: "The label and visual checkbox control.";
|
|
115
|
+
readonly input: "The native checkbox input and web focus target.";
|
|
116
|
+
readonly box: "The visible checkbox box and indicator.";
|
|
117
|
+
readonly label: "Visible or visually hidden label text.";
|
|
118
|
+
readonly 'help-text': "Supporting text associated with the checkbox.";
|
|
119
|
+
readonly 'error-text': "Error description associated with the checkbox.";
|
|
120
|
+
};
|
|
121
|
+
readonly cssProperties: {
|
|
122
|
+
readonly '--cosm-checkbox-size': "Visual box width and height.";
|
|
123
|
+
readonly '--cosm-checkbox-background': "Unchecked box background.";
|
|
124
|
+
readonly '--cosm-checkbox-checked-background': "Checked and mixed box background.";
|
|
125
|
+
readonly '--cosm-checkbox-color': "Checked indicator foreground.";
|
|
126
|
+
readonly '--cosm-checkbox-border': "Box boundary color.";
|
|
127
|
+
readonly '--cosm-checkbox-radius': "Box corner radius.";
|
|
128
|
+
readonly '--cosm-checkbox-focus': "Visible keyboard focus indicator color.";
|
|
129
|
+
readonly '--cosm-checkbox-gap': "Space between the box and label.";
|
|
130
|
+
};
|
|
131
|
+
readonly keyboard: readonly [{
|
|
132
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
133
|
+
readonly action: "Moves focus to or from the enabled checkbox.";
|
|
134
|
+
}, {
|
|
135
|
+
readonly keys: readonly ["Space"];
|
|
136
|
+
readonly action: "Toggles checked state and emits a checkedChange proposal.";
|
|
137
|
+
}];
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/specs/checkbox.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8H3B,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineContract } from '../contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* An independent boolean form choice with controlled or autonomous checked state.
|
|
4
|
+
*
|
|
5
|
+
* | State | Autonomous | Controlled | Event |
|
|
6
|
+
* | --- | --- | --- | --- |
|
|
7
|
+
* | checked | Starts at defaultChecked and commits activation | A supplied checked, including false, waits for the owner | checkedChange |
|
|
8
|
+
* | indeterminate | Presentation only; autonomous activation clears it | Remains as supplied until the owner changes it | None |
|
|
9
|
+
*/
|
|
10
|
+
export const checkboxContract = defineContract({
|
|
11
|
+
name: 'checkbox',
|
|
12
|
+
tag: 'cosm-checkbox',
|
|
13
|
+
description: 'Selects an independent boolean value with accessible labeling and native form behavior on the web.',
|
|
14
|
+
role: 'checkbox',
|
|
15
|
+
pattern: 'https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/',
|
|
16
|
+
props: {
|
|
17
|
+
label: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true,
|
|
20
|
+
description: 'Required accessible name, visible unless labelHidden is true.',
|
|
21
|
+
},
|
|
22
|
+
labelHidden: {
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
default: false,
|
|
25
|
+
reflect: true,
|
|
26
|
+
description: 'Visually hides the label while keeping it available to assistive technology.',
|
|
27
|
+
},
|
|
28
|
+
checked: {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: false,
|
|
31
|
+
description: 'Controlled checked value when supplied, including false; activation proposes changes without self-committing.',
|
|
32
|
+
},
|
|
33
|
+
defaultChecked: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
default: false,
|
|
36
|
+
description: 'Initial autonomous checked value; later changes do not reset it.',
|
|
37
|
+
},
|
|
38
|
+
indeterminate: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: false,
|
|
41
|
+
reflect: true,
|
|
42
|
+
description: 'Presentation-only mixed state. Autonomous activation clears it; controlled use leaves it to the owner.',
|
|
43
|
+
},
|
|
44
|
+
size: {
|
|
45
|
+
type: 'enum',
|
|
46
|
+
values: ['sm', 'md', 'lg'],
|
|
47
|
+
default: 'md',
|
|
48
|
+
reflect: true,
|
|
49
|
+
description: 'Small, medium or large visual box.',
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
reflect: true,
|
|
55
|
+
description: 'Prevents user interaction and excludes the value from web form submission.',
|
|
56
|
+
},
|
|
57
|
+
required: {
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
default: false,
|
|
60
|
+
reflect: true,
|
|
61
|
+
description: 'Exposes required semantics and participates in native web form validation. Native has no automatic validation.',
|
|
62
|
+
},
|
|
63
|
+
invalid: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
default: false,
|
|
66
|
+
reflect: true,
|
|
67
|
+
description: 'Externally supplied invalid presentation state when the visible error is supplied elsewhere; web form validity remains based on required.',
|
|
68
|
+
},
|
|
69
|
+
helperText: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: 'Optional consumer-localized supporting text associated with the checkbox.',
|
|
72
|
+
},
|
|
73
|
+
errorText: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'Optional consumer-localized error description; a nonempty trimmed value also exposes invalid state.',
|
|
76
|
+
},
|
|
77
|
+
name: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
reflect: true,
|
|
80
|
+
platforms: ['web', 'react', 'angular'],
|
|
81
|
+
description: 'Web form field name; React Native has no HTML form association.',
|
|
82
|
+
},
|
|
83
|
+
value: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: 'on',
|
|
86
|
+
platforms: ['web', 'react', 'angular'],
|
|
87
|
+
description: 'Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value.',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
events: {
|
|
91
|
+
checkedChange: {
|
|
92
|
+
description: 'Proposes the next checked value after enabled user activation; controlled state waits for the owner.',
|
|
93
|
+
detail: 'CheckboxCheckedChangeDetail',
|
|
94
|
+
names: {
|
|
95
|
+
dom: 'cosm-checked-change',
|
|
96
|
+
react: 'onCheckedChange',
|
|
97
|
+
angular: 'checkedChange',
|
|
98
|
+
native: 'onCheckedChange',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
states: [{ prop: 'checked', event: 'checkedChange', defaultProp: 'defaultChecked' }],
|
|
103
|
+
slots: {
|
|
104
|
+
'': 'Optional noninteractive inline label content; links and buttons are not allowed.',
|
|
105
|
+
},
|
|
106
|
+
parts: {
|
|
107
|
+
base: 'The label and visual checkbox control.',
|
|
108
|
+
input: 'The native checkbox input and web focus target.',
|
|
109
|
+
box: 'The visible checkbox box and indicator.',
|
|
110
|
+
label: 'Visible or visually hidden label text.',
|
|
111
|
+
'help-text': 'Supporting text associated with the checkbox.',
|
|
112
|
+
'error-text': 'Error description associated with the checkbox.',
|
|
113
|
+
},
|
|
114
|
+
cssProperties: {
|
|
115
|
+
'--cosm-checkbox-size': 'Visual box width and height.',
|
|
116
|
+
'--cosm-checkbox-background': 'Unchecked box background.',
|
|
117
|
+
'--cosm-checkbox-checked-background': 'Checked and mixed box background.',
|
|
118
|
+
'--cosm-checkbox-color': 'Checked indicator foreground.',
|
|
119
|
+
'--cosm-checkbox-border': 'Box boundary color.',
|
|
120
|
+
'--cosm-checkbox-radius': 'Box corner radius.',
|
|
121
|
+
'--cosm-checkbox-focus': 'Visible keyboard focus indicator color.',
|
|
122
|
+
'--cosm-checkbox-gap': 'Space between the box and label.',
|
|
123
|
+
},
|
|
124
|
+
keyboard: [
|
|
125
|
+
{ keys: ['Tab', 'Shift+Tab'], action: 'Moves focus to or from the enabled checkbox.' },
|
|
126
|
+
{ keys: ['Space'], action: 'Toggles checked state and emits a checkedChange proposal.' },
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/spec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AE,mCAAmC;QACzE,uBAAuB,EAAE,+BAA+B;QACxD,wBAAwB,EAAE,qBAAqB;QAC/C,wBAAwB,EAAE,oBAAoB;QAC9C,uBAAuB,EAAE,yCAAyC;QAClE,qBAAqB,EAAE,kCAAkC;KAC1D;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,8CAA8C,EAAE;QACtF,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,2DAA2D,EAAE;KACzF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Platform } from '../contract.js';
|
|
2
|
+
export type CheckboxAction = {
|
|
3
|
+
type: 'activate';
|
|
4
|
+
} | {
|
|
5
|
+
type: 'sync';
|
|
6
|
+
checked: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface CheckboxScenario {
|
|
9
|
+
name: string;
|
|
10
|
+
props: {
|
|
11
|
+
label: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
indeterminate?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
actions: readonly CheckboxAction[];
|
|
18
|
+
expected: {
|
|
19
|
+
checked: boolean;
|
|
20
|
+
changes: readonly boolean[];
|
|
21
|
+
indeterminate?: boolean;
|
|
22
|
+
};
|
|
23
|
+
platforms?: readonly Platform[];
|
|
24
|
+
}
|
|
25
|
+
/** Normative checked-state cases shared by platform drivers. */
|
|
26
|
+
export declare const checkboxScenarios: readonly CheckboxScenario[];
|
|
27
|
+
export declare const checkboxScenariosFor: (platform: Platform) => CheckboxScenario[];
|
|
28
|
+
//# sourceMappingURL=checkbox.scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/checkbox.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;QAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAID,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,EAAE,SAAS,gBAAgB,EAiDxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAU,QAAQ,uBAGpD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const fixture = { label: 'Accept terms' };
|
|
2
|
+
/** Normative checked-state cases shared by platform drivers. */
|
|
3
|
+
export const checkboxScenarios = [
|
|
4
|
+
{
|
|
5
|
+
name: 'starts unchecked without a proposal',
|
|
6
|
+
props: fixture,
|
|
7
|
+
actions: [],
|
|
8
|
+
expected: { checked: false, changes: [] },
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'defaultChecked initializes autonomous state',
|
|
12
|
+
props: { ...fixture, defaultChecked: true },
|
|
13
|
+
actions: [],
|
|
14
|
+
expected: { checked: true, changes: [] },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'autonomous activation toggles and proposes each next value',
|
|
18
|
+
props: fixture,
|
|
19
|
+
actions: [{ type: 'activate' }, { type: 'activate' }],
|
|
20
|
+
expected: { checked: false, changes: [true, false] },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'disabled prevents activation and proposals',
|
|
24
|
+
props: { ...fixture, disabled: true, defaultChecked: true },
|
|
25
|
+
actions: [{ type: 'activate' }],
|
|
26
|
+
expected: { checked: true, changes: [] },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'a controlled false value refuses proposals without self-committing',
|
|
30
|
+
props: { ...fixture, checked: false },
|
|
31
|
+
actions: [{ type: 'activate' }, { type: 'activate' }],
|
|
32
|
+
expected: { checked: false, changes: [true, true] },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'controlled state follows the value accepted by the owner',
|
|
36
|
+
props: { ...fixture, checked: false },
|
|
37
|
+
actions: [{ type: 'activate' }, { type: 'sync', checked: true }, { type: 'activate' }],
|
|
38
|
+
expected: { checked: true, changes: [true, false] },
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'autonomous activation clears mixed presentation',
|
|
42
|
+
props: { ...fixture, indeterminate: true },
|
|
43
|
+
actions: [{ type: 'activate' }],
|
|
44
|
+
expected: { checked: true, changes: [true], indeterminate: false },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'controlled activation leaves mixed presentation to the owner',
|
|
48
|
+
props: { ...fixture, checked: false, indeterminate: true },
|
|
49
|
+
actions: [{ type: 'activate' }],
|
|
50
|
+
expected: { checked: false, changes: [true], indeterminate: true },
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
export const checkboxScenariosFor = (platform) => checkboxScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
54
|
+
//# sourceMappingURL=checkbox.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|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