@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 @@
|
|
|
1
|
+
{"version":3,"file":"popover.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/popover.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,GAA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OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO,CAAC;QACd,oFAAoF;QACpF,mBAAmB,EAAE,SAAS,OAAO,EAAE,CAAC;QACxC,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAC;QAC7C;;;WAGG;QACH,KAAK,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,CAAC;QAC3D,qFAAqF;QACrF,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,eAAe,EAyWtD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,UAAU,QAAQ,sBAC6C,CAAC"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
const opening = { open: true, reason: 'trigger', canceled: false };
|
|
2
|
+
const closing = (reason, canceled = false) => ({
|
|
3
|
+
open: false,
|
|
4
|
+
reason,
|
|
5
|
+
canceled,
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* Shared normative cases, not a platform implementation. Drivers use a first focusable
|
|
9
|
+
* panel child unless the fixture opts out. "panel-first" asserts that first panel child.
|
|
10
|
+
* Opening never moves focus, so focus reaches the panel only through `focusStart` or a
|
|
11
|
+
* `focus` action. For outside presses on
|
|
12
|
+
* a nonfocusable target, the fixture preserves focus so lack of restoration is observable.
|
|
13
|
+
* Native Escape cases exercise React Native Web; hardware Escape is not supported on Android
|
|
14
|
+
* or iOS. Back cases are native Android cases; native drivers must run them in Android mode.
|
|
15
|
+
*/
|
|
16
|
+
export const popoverScenarios = [
|
|
17
|
+
...[false, true].map((cancel) => ({
|
|
18
|
+
name: `close button ${cancel ? 'respects cancellation' : 'closes autonomous state'}`,
|
|
19
|
+
props: { defaultOpen: true, closable: true },
|
|
20
|
+
fixture: { focusStart: 'panel' },
|
|
21
|
+
actions: [{ type: 'close-button', cancel }],
|
|
22
|
+
expected: {
|
|
23
|
+
open: cancel,
|
|
24
|
+
openAfterEachAction: [cancel],
|
|
25
|
+
changes: [closing('close-button', cancel)],
|
|
26
|
+
focus: cancel ? 'panel-first' : 'trigger',
|
|
27
|
+
outsidePresses: 0,
|
|
28
|
+
},
|
|
29
|
+
})),
|
|
30
|
+
{
|
|
31
|
+
name: 'closed by default without a proposal',
|
|
32
|
+
props: {},
|
|
33
|
+
actions: [],
|
|
34
|
+
expected: {
|
|
35
|
+
open: false,
|
|
36
|
+
openAfterEachAction: [],
|
|
37
|
+
changes: [],
|
|
38
|
+
focus: 'trigger',
|
|
39
|
+
outsidePresses: 0,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
...['pointer', 'touch', 'keyboard'].map((source) => ({
|
|
43
|
+
name: `${source} trigger toggles autonomous state once per activation`,
|
|
44
|
+
props: {},
|
|
45
|
+
actions: [
|
|
46
|
+
{ type: 'trigger', source },
|
|
47
|
+
{ type: 'trigger', source },
|
|
48
|
+
],
|
|
49
|
+
expected: {
|
|
50
|
+
open: false,
|
|
51
|
+
openAfterEachAction: [true, false],
|
|
52
|
+
changes: [opening, closing('trigger')],
|
|
53
|
+
focus: 'trigger',
|
|
54
|
+
outsidePresses: 0,
|
|
55
|
+
},
|
|
56
|
+
...(source === 'keyboard' ? { platforms: ['web', 'react', 'angular'] } : {}),
|
|
57
|
+
})),
|
|
58
|
+
{
|
|
59
|
+
name: 'defaultOpen initializes autonomous state but later defaults do not reset it',
|
|
60
|
+
props: { defaultOpen: true },
|
|
61
|
+
actions: [{ type: 'set-default', defaultOpen: false }],
|
|
62
|
+
expected: {
|
|
63
|
+
open: true,
|
|
64
|
+
openAfterEachAction: [true],
|
|
65
|
+
changes: [],
|
|
66
|
+
focus: 'trigger',
|
|
67
|
+
outsidePresses: 0,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'controlled false overrides defaultOpen and refuses repeated open proposals',
|
|
72
|
+
props: { open: false, defaultOpen: true },
|
|
73
|
+
actions: [
|
|
74
|
+
{ type: 'trigger', source: 'pointer' },
|
|
75
|
+
{ type: 'trigger', source: 'pointer' },
|
|
76
|
+
],
|
|
77
|
+
expected: {
|
|
78
|
+
open: false,
|
|
79
|
+
openAfterEachAction: [false, false],
|
|
80
|
+
changes: [opening, opening],
|
|
81
|
+
focus: 'trigger',
|
|
82
|
+
outsidePresses: 0,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'controlled acceptance waits for sync and prop updates emit no proposals',
|
|
87
|
+
props: { open: false },
|
|
88
|
+
actions: [
|
|
89
|
+
{ type: 'trigger', source: 'pointer' },
|
|
90
|
+
{ type: 'sync', open: true },
|
|
91
|
+
{ type: 'focus', target: 'panel' },
|
|
92
|
+
{ type: 'action' },
|
|
93
|
+
{ type: 'sync', open: false },
|
|
94
|
+
],
|
|
95
|
+
expected: {
|
|
96
|
+
open: false,
|
|
97
|
+
openAfterEachAction: [false, true, true, true, false],
|
|
98
|
+
changes: [opening, closing('action')],
|
|
99
|
+
focus: 'trigger',
|
|
100
|
+
outsidePresses: 0,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'unsolicited controlled opening applies without a proposal or moving focus',
|
|
105
|
+
props: { open: false },
|
|
106
|
+
actions: [{ type: 'sync', open: true }],
|
|
107
|
+
expected: {
|
|
108
|
+
open: true,
|
|
109
|
+
openAfterEachAction: [true],
|
|
110
|
+
changes: [],
|
|
111
|
+
focus: 'trigger',
|
|
112
|
+
outsidePresses: 0,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'controlled close proposals leave the panel and its focus unchanged',
|
|
117
|
+
props: { open: true },
|
|
118
|
+
fixture: { focusStart: 'panel' },
|
|
119
|
+
actions: [{ type: 'action' }, { type: 'escape' }],
|
|
120
|
+
expected: {
|
|
121
|
+
open: true,
|
|
122
|
+
openAfterEachAction: [true, true],
|
|
123
|
+
changes: [closing('action'), closing('escape')],
|
|
124
|
+
focus: 'panel-first',
|
|
125
|
+
outsidePresses: 0,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
...['trigger', 'escape', 'outside', 'action', 'back'].flatMap((reason) => [false, true].map(canceled => ({
|
|
129
|
+
name: `${reason} close ${canceled ? 'can be canceled' : 'commits autonomously'}`,
|
|
130
|
+
props: { defaultOpen: true },
|
|
131
|
+
fixture: { focusStart: 'panel' },
|
|
132
|
+
actions: reason === 'trigger'
|
|
133
|
+
? [
|
|
134
|
+
{ type: 'focus', target: 'trigger' },
|
|
135
|
+
{ type: 'trigger', source: 'pointer', cancel: canceled },
|
|
136
|
+
]
|
|
137
|
+
: [
|
|
138
|
+
reason === 'outside'
|
|
139
|
+
? { type: 'outside', focusable: true, cancel: canceled }
|
|
140
|
+
: { type: reason, cancel: canceled },
|
|
141
|
+
],
|
|
142
|
+
expected: {
|
|
143
|
+
open: canceled,
|
|
144
|
+
openAfterEachAction: reason === 'trigger' ? [true, canceled] : [canceled],
|
|
145
|
+
changes: [closing(reason, canceled)],
|
|
146
|
+
focus: reason === 'outside'
|
|
147
|
+
? 'outside'
|
|
148
|
+
: reason !== 'trigger' && canceled
|
|
149
|
+
? 'panel-first'
|
|
150
|
+
: 'trigger',
|
|
151
|
+
outsidePresses: reason === 'outside' ? 1 : 0,
|
|
152
|
+
},
|
|
153
|
+
...(reason === 'back' ? { platforms: ['native'] } : {}),
|
|
154
|
+
}))),
|
|
155
|
+
{
|
|
156
|
+
name: 'controlled action cancellation is visible to the owner without committing',
|
|
157
|
+
props: { open: true },
|
|
158
|
+
fixture: { focusStart: 'panel' },
|
|
159
|
+
actions: [{ type: 'action', cancel: true }],
|
|
160
|
+
expected: {
|
|
161
|
+
open: true,
|
|
162
|
+
openAfterEachAction: [true],
|
|
163
|
+
changes: [closing('action', true)],
|
|
164
|
+
focus: 'panel-first',
|
|
165
|
+
outsidePresses: 0,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'disabled dismissal policies do not suppress explicit panel actions',
|
|
170
|
+
props: { defaultOpen: true, closeOnEscape: false, closeOnOutsidePress: false },
|
|
171
|
+
actions: [{ type: 'escape' }, { type: 'outside', focusable: true }, { type: 'action' }],
|
|
172
|
+
expected: {
|
|
173
|
+
open: false,
|
|
174
|
+
openAfterEachAction: [true, true, false],
|
|
175
|
+
changes: [closing('action')],
|
|
176
|
+
focus: 'outside',
|
|
177
|
+
outsidePresses: 1,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'disabling Escape still permits outside dismissal',
|
|
182
|
+
props: { defaultOpen: true, closeOnEscape: false },
|
|
183
|
+
actions: [{ type: 'escape' }, { type: 'outside', focusable: true }],
|
|
184
|
+
expected: {
|
|
185
|
+
open: false,
|
|
186
|
+
openAfterEachAction: [true, false],
|
|
187
|
+
changes: [closing('outside')],
|
|
188
|
+
focus: 'outside',
|
|
189
|
+
outsidePresses: 1,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'disabling outside dismissal still permits Escape',
|
|
194
|
+
props: { defaultOpen: true, closeOnOutsidePress: false },
|
|
195
|
+
actions: [{ type: 'outside', focusable: true }, { type: 'escape' }],
|
|
196
|
+
expected: {
|
|
197
|
+
open: false,
|
|
198
|
+
openAfterEachAction: [true, false],
|
|
199
|
+
changes: [closing('escape')],
|
|
200
|
+
focus: 'outside',
|
|
201
|
+
outsidePresses: 1,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'Android Back is independent of Escape and outside dismissal policies',
|
|
206
|
+
props: { defaultOpen: true, closeOnEscape: false, closeOnOutsidePress: false },
|
|
207
|
+
actions: [{ type: 'back' }],
|
|
208
|
+
expected: {
|
|
209
|
+
open: false,
|
|
210
|
+
openAfterEachAction: [false],
|
|
211
|
+
changes: [closing('back')],
|
|
212
|
+
focus: 'trigger',
|
|
213
|
+
outsidePresses: 0,
|
|
214
|
+
},
|
|
215
|
+
platforms: ['native'],
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'a child-handled Escape is ignored',
|
|
219
|
+
props: { defaultOpen: true },
|
|
220
|
+
actions: [{ type: 'escape', handled: true }],
|
|
221
|
+
expected: {
|
|
222
|
+
open: true,
|
|
223
|
+
openAfterEachAction: [true],
|
|
224
|
+
changes: [],
|
|
225
|
+
focus: 'trigger',
|
|
226
|
+
outsidePresses: 0,
|
|
227
|
+
},
|
|
228
|
+
platforms: ['web', 'react', 'angular'],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'dismissals and action requests while closed emit nothing',
|
|
232
|
+
props: {},
|
|
233
|
+
actions: [{ type: 'escape' }, { type: 'action' }, { type: 'outside', focusable: true }],
|
|
234
|
+
expected: {
|
|
235
|
+
open: false,
|
|
236
|
+
openAfterEachAction: [false, false, false],
|
|
237
|
+
changes: [],
|
|
238
|
+
focus: 'outside',
|
|
239
|
+
outsidePresses: 1,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
...[true, false].map((panelHasFocusableContent) => ({
|
|
243
|
+
name: `opening keeps focus on the trigger ${panelHasFocusableContent ? 'with' : 'without'} focusable content`,
|
|
244
|
+
props: { closable: panelHasFocusableContent },
|
|
245
|
+
fixture: { panelHasFocusableContent },
|
|
246
|
+
actions: [{ type: 'trigger', source: 'pointer' }],
|
|
247
|
+
expected: {
|
|
248
|
+
open: true,
|
|
249
|
+
openAfterEachAction: [true],
|
|
250
|
+
changes: [opening],
|
|
251
|
+
focus: 'trigger',
|
|
252
|
+
outsidePresses: 0,
|
|
253
|
+
},
|
|
254
|
+
})),
|
|
255
|
+
{
|
|
256
|
+
name: 'outside closure never restores even if its target cannot take focus',
|
|
257
|
+
props: { defaultOpen: true },
|
|
258
|
+
fixture: { focusStart: 'panel' },
|
|
259
|
+
actions: [{ type: 'outside', focusable: false }],
|
|
260
|
+
expected: {
|
|
261
|
+
open: false,
|
|
262
|
+
openAfterEachAction: [false],
|
|
263
|
+
changes: [closing('outside')],
|
|
264
|
+
focus: 'unmanaged',
|
|
265
|
+
outsidePresses: 1,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'an outside controlled proposal still delivers the outside interaction',
|
|
270
|
+
props: { open: true },
|
|
271
|
+
fixture: { focusStart: 'panel' },
|
|
272
|
+
actions: [{ type: 'outside', focusable: true }],
|
|
273
|
+
expected: {
|
|
274
|
+
open: true,
|
|
275
|
+
openAfterEachAction: [true],
|
|
276
|
+
changes: [closing('outside')],
|
|
277
|
+
focus: 'outside',
|
|
278
|
+
outsidePresses: 1,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'restoration does not steal focus moved outside before owner acceptance',
|
|
283
|
+
props: { open: true },
|
|
284
|
+
fixture: { focusStart: 'panel' },
|
|
285
|
+
actions: [
|
|
286
|
+
{ type: 'escape' },
|
|
287
|
+
{ type: 'focus', target: 'outside' },
|
|
288
|
+
{ type: 'sync', open: false },
|
|
289
|
+
],
|
|
290
|
+
expected: {
|
|
291
|
+
open: false,
|
|
292
|
+
openAfterEachAction: [true, true, false],
|
|
293
|
+
changes: [closing('escape')],
|
|
294
|
+
focus: 'outside',
|
|
295
|
+
outsidePresses: 0,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'an unsolicited controlled close does not restore focus',
|
|
300
|
+
props: { open: true },
|
|
301
|
+
fixture: { focusStart: 'panel' },
|
|
302
|
+
actions: [{ type: 'sync', open: false }],
|
|
303
|
+
expected: {
|
|
304
|
+
open: false,
|
|
305
|
+
openAfterEachAction: [false],
|
|
306
|
+
changes: [],
|
|
307
|
+
focus: 'unmanaged',
|
|
308
|
+
outsidePresses: 0,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: 'the latest close reason supersedes an earlier controlled proposal',
|
|
313
|
+
props: { open: true },
|
|
314
|
+
fixture: { focusStart: 'panel' },
|
|
315
|
+
actions: [
|
|
316
|
+
{ type: 'escape' },
|
|
317
|
+
{ type: 'outside', focusable: false },
|
|
318
|
+
{ type: 'sync', open: false },
|
|
319
|
+
],
|
|
320
|
+
expected: {
|
|
321
|
+
open: false,
|
|
322
|
+
openAfterEachAction: [true, true, false],
|
|
323
|
+
changes: [closing('escape'), closing('outside')],
|
|
324
|
+
focus: 'unmanaged',
|
|
325
|
+
outsidePresses: 1,
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'a canceled proposal clears any earlier restoration intent',
|
|
330
|
+
props: { open: true },
|
|
331
|
+
fixture: { focusStart: 'panel' },
|
|
332
|
+
actions: [{ type: 'escape' }, { type: 'action', cancel: true }, { type: 'sync', open: false }],
|
|
333
|
+
expected: {
|
|
334
|
+
open: false,
|
|
335
|
+
openAfterEachAction: [true, true, false],
|
|
336
|
+
changes: [closing('escape'), closing('action', true)],
|
|
337
|
+
focus: 'unmanaged',
|
|
338
|
+
outsidePresses: 0,
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: 'restoration requires a usable trigger',
|
|
343
|
+
props: { defaultOpen: true },
|
|
344
|
+
fixture: { triggerFocusable: false, focusStart: 'panel' },
|
|
345
|
+
actions: [{ type: 'action' }],
|
|
346
|
+
expected: {
|
|
347
|
+
open: false,
|
|
348
|
+
openAfterEachAction: [false],
|
|
349
|
+
changes: [closing('action')],
|
|
350
|
+
focus: 'unmanaged',
|
|
351
|
+
outsidePresses: 0,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'focus leaving the panel alone does not dismiss',
|
|
356
|
+
props: { defaultOpen: true },
|
|
357
|
+
actions: [{ type: 'focus', target: 'outside' }],
|
|
358
|
+
expected: {
|
|
359
|
+
open: true,
|
|
360
|
+
openAfterEachAction: [true],
|
|
361
|
+
changes: [],
|
|
362
|
+
focus: 'outside',
|
|
363
|
+
outsidePresses: 0,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
];
|
|
367
|
+
export const popoverScenariosFor = (platform) => popoverScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
368
|
+
//# sourceMappingURL=popover.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.scenarios.js","sourceRoot":"","sources":["../../src/specs/popover.scenarios.ts"],"names":[],"mappings":"AAoDA,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAW,CAAC;AAC5E,MAAM,OAAO,GAAG,CAAC,MAA0B,EAAE,QAAQ,GAAG,KAAK,EAA4B,EAAE,CAAC,CAAC;IAC3F,IAAI,EAAE,KAAK;IACX,MAAM;IACN,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,GAAI,CAAC,KAAK,EAAE,IAAI,CAAW,CAAC,GAAG,CAC7B,CAAC,MAAM,EAAmB,EAAE,CAAC,CAAC;QAC5B,IAAI,EAAE,gBAAgB,MAAM,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,yBAAyB,EAAE;QACpF,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC5C,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE;QAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;QAC3C,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YAC1C,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EAAE,uCAAuC;QAC7C,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;QACzD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC7B,QAAQ,EAAE;YACR,IAAI,EAAE,KAAK;YACX,mBAAmB,EAAE,CAAC,KAAK,CAAC;YAC5B,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC5B,KAAK,EAAE,WAAW;YAClB,cAAc,EAAE,CAAC;SAClB;KACF;IACD;QACE,IAAI,EAAE,gDAAgD;QACtD,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/C,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI;YACV,mBAAmB,EAAE,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,SAAS;YAChB,cAAc,EAAE,CAAC;SAClB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAkB,EAAE,EAAE,CACxD,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export interface RadioGroupOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type RadioGroupOptions = readonly RadioGroupOption[];
|
|
8
|
+
export type RadioGroupValue = string | null;
|
|
9
|
+
export type RadioGroupReferences = {
|
|
10
|
+
RadioGroupOptions: RadioGroupOptions;
|
|
11
|
+
RadioGroupValue: RadioGroupValue;
|
|
12
|
+
};
|
|
13
|
+
/** A proposed selection; null is used only when restoring a controlled form reset. */
|
|
14
|
+
export interface RadioGroupChangeDetail {
|
|
15
|
+
value: RadioGroupValue;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A single-selection form control with optional selection and native Web form behavior.
|
|
19
|
+
*
|
|
20
|
+
* | State | Autonomous | Controlled | Event |
|
|
21
|
+
* | --- | --- | --- | --- |
|
|
22
|
+
* | value | Starts at defaultValue (null by default) and commits selection | A supplied value, including null, proposes changes without committing | change |
|
|
23
|
+
*/
|
|
24
|
+
export declare const radioGroupContract: {
|
|
25
|
+
readonly name: "radio-group";
|
|
26
|
+
readonly tag: "cosm-radio-group";
|
|
27
|
+
readonly description: "Selects one option from a labeled collection, with optional selection and native Web form behavior.";
|
|
28
|
+
readonly role: "radiogroup";
|
|
29
|
+
readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/radio/";
|
|
30
|
+
readonly props: {
|
|
31
|
+
readonly label: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly required: true;
|
|
34
|
+
readonly description: "Required visible accessible name for the group.";
|
|
35
|
+
};
|
|
36
|
+
readonly options: {
|
|
37
|
+
readonly type: "reference";
|
|
38
|
+
readonly reference: "RadioGroupOptions";
|
|
39
|
+
readonly required: true;
|
|
40
|
+
readonly options: readonly ["contact-methods"];
|
|
41
|
+
readonly example: "contact-methods";
|
|
42
|
+
readonly description: "Readonly flat options with unique nonempty values and labels, optional descriptions and disabled states.";
|
|
43
|
+
};
|
|
44
|
+
readonly value: {
|
|
45
|
+
readonly type: "reference";
|
|
46
|
+
readonly reference: "RadioGroupValue";
|
|
47
|
+
readonly options: readonly ["none", "email", "phone", "basic", "plus", "premium", "weekly", "monthly"];
|
|
48
|
+
readonly description: "Controlled selected value; null means no selection, and a supplied null remains controlled.";
|
|
49
|
+
};
|
|
50
|
+
readonly defaultValue: {
|
|
51
|
+
readonly type: "reference";
|
|
52
|
+
readonly reference: "RadioGroupValue";
|
|
53
|
+
readonly options: readonly ["none", "email", "phone", "basic", "plus", "premium", "weekly", "monthly"];
|
|
54
|
+
readonly description: "Initial autonomous selection; null by default.";
|
|
55
|
+
};
|
|
56
|
+
readonly size: {
|
|
57
|
+
readonly type: "enum";
|
|
58
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
59
|
+
readonly default: "md";
|
|
60
|
+
readonly reflect: true;
|
|
61
|
+
readonly description: "Small, medium or large radio indicator.";
|
|
62
|
+
};
|
|
63
|
+
readonly orientation: {
|
|
64
|
+
readonly type: "enum";
|
|
65
|
+
readonly values: readonly ["vertical", "horizontal"];
|
|
66
|
+
readonly default: "vertical";
|
|
67
|
+
readonly reflect: true;
|
|
68
|
+
readonly description: "Vertical list or wrapping horizontal options.";
|
|
69
|
+
};
|
|
70
|
+
readonly disabled: {
|
|
71
|
+
readonly type: "boolean";
|
|
72
|
+
readonly default: false;
|
|
73
|
+
readonly reflect: true;
|
|
74
|
+
readonly description: "Prevents interaction and excludes the value from Web form submission.";
|
|
75
|
+
};
|
|
76
|
+
readonly required: {
|
|
77
|
+
readonly type: "boolean";
|
|
78
|
+
readonly default: false;
|
|
79
|
+
readonly reflect: true;
|
|
80
|
+
readonly description: "Requires a selection in Web form validation; Native exposes descriptive semantics.";
|
|
81
|
+
};
|
|
82
|
+
readonly invalid: {
|
|
83
|
+
readonly type: "boolean";
|
|
84
|
+
readonly default: false;
|
|
85
|
+
readonly reflect: true;
|
|
86
|
+
readonly description: "Externally supplied invalid presentation state when the visible error is supplied elsewhere.";
|
|
87
|
+
};
|
|
88
|
+
readonly helperText: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly description: "Optional supporting text associated with the group.";
|
|
91
|
+
};
|
|
92
|
+
readonly errorText: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly description: "Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state.";
|
|
95
|
+
};
|
|
96
|
+
readonly name: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly reflect: true;
|
|
99
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
100
|
+
readonly description: "Web form field name; React Native has no HTML form association.";
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
readonly events: {
|
|
104
|
+
readonly change: {
|
|
105
|
+
readonly description: "Proposes a selection after enabled user activation; autonomous state commits and controlled state waits for the owner.";
|
|
106
|
+
readonly detail: "RadioGroupChangeDetail";
|
|
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 base: "Group wrapper and accessible fieldset.";
|
|
123
|
+
readonly label: "Visible group label.";
|
|
124
|
+
readonly options: "Option collection.";
|
|
125
|
+
readonly option: "Selectable option row.";
|
|
126
|
+
readonly input: "Native radio input and Web focus target.";
|
|
127
|
+
readonly control: "Visible circular radio boundary.";
|
|
128
|
+
readonly indicator: "Selected radio dot.";
|
|
129
|
+
readonly 'option-label': "Primary option text.";
|
|
130
|
+
readonly description: "Optional option description.";
|
|
131
|
+
readonly 'help-text': "Supporting text associated with the group.";
|
|
132
|
+
readonly 'error-text': "Error description associated with the group.";
|
|
133
|
+
};
|
|
134
|
+
readonly cssProperties: {
|
|
135
|
+
readonly '--cosm-radio-group-gap': "Space between option rows.";
|
|
136
|
+
readonly '--cosm-radio-group-option-gap': "Space between the radio control and option content.";
|
|
137
|
+
readonly '--cosm-radio-group-control-size': "Diameter of the visible radio control.";
|
|
138
|
+
readonly '--cosm-radio-group-border': "Unchecked radio boundary color.";
|
|
139
|
+
readonly '--cosm-radio-group-selected-border': "Selected radio boundary color.";
|
|
140
|
+
readonly '--cosm-radio-group-indicator': "Selected radio dot color.";
|
|
141
|
+
readonly '--cosm-radio-group-focus': "Visible keyboard focus indicator color.";
|
|
142
|
+
};
|
|
143
|
+
readonly keyboard: readonly [{
|
|
144
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
145
|
+
readonly action: "Enters or leaves the group as one tab stop.";
|
|
146
|
+
}, {
|
|
147
|
+
readonly keys: readonly ["Space"];
|
|
148
|
+
readonly action: "Selects the focused enabled option.";
|
|
149
|
+
}, {
|
|
150
|
+
readonly keys: readonly ["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp"];
|
|
151
|
+
readonly action: "Moves focus and selection through enabled options with wrapping.";
|
|
152
|
+
}];
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/specs/radio-group.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,gBAAgB,EAAE,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF,sFAAsF;AACtF,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkI7B,CAAC"}
|