@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,167 @@
|
|
|
1
|
+
/** Source of a request to close the modal. */
|
|
2
|
+
export type DialogCloseReason = 'close-button' | 'escape' | 'back' | 'backdrop' | 'action';
|
|
3
|
+
/** Opening is not cancelable. Closing can be vetoed synchronously. */
|
|
4
|
+
export type DialogOpenChangeDetail = {
|
|
5
|
+
open: true;
|
|
6
|
+
reason: 'action';
|
|
7
|
+
} | {
|
|
8
|
+
open: false;
|
|
9
|
+
reason: DialogCloseReason;
|
|
10
|
+
readonly defaultPrevented: boolean;
|
|
11
|
+
preventDefault(): void;
|
|
12
|
+
};
|
|
13
|
+
/** Platform adapters supply their own focus-target type, never a DOM type in core. */
|
|
14
|
+
export type DialogReferences<T> = {
|
|
15
|
+
DialogFocusTarget: T;
|
|
16
|
+
};
|
|
17
|
+
/** Named standard maximum widths, in CSS pixels or native logical points. */
|
|
18
|
+
export type DialogSize = 'sm' | 'md' | 'lg';
|
|
19
|
+
/** Imperative proposals; neither method forces controlled state. */
|
|
20
|
+
export interface DialogHandle {
|
|
21
|
+
requestOpen(): void;
|
|
22
|
+
requestClose(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Modal dialog. A bound open prop (including false) controls visibility; otherwise defaultOpen
|
|
26
|
+
* initializes autonomous state once. Open-change events are proposals, not notifications of
|
|
27
|
+
* committed changes. Closing is synchronously cancelable using the event or detail on web and
|
|
28
|
+
* detail on native; a canceled request leaves the modal and focus intact.
|
|
29
|
+
*
|
|
30
|
+
* A committed opening moves focus inside; a committed close restores it to returnFocusTarget,
|
|
31
|
+
* the invoking control, or an available logical fallback. initialFocusTarget, if supplied and
|
|
32
|
+
* usable, takes precedence over the first focusable content. Targets are platform-specific.
|
|
33
|
+
* The title provides the accessible name; an optional short description describes the modal.
|
|
34
|
+
* Escape is web-only, Android Back is native-only, and backdrop dismissal defaults to off.
|
|
35
|
+
* Guaranteed nested-modal coordination and iOS swipe dismissal are excluded.
|
|
36
|
+
*
|
|
37
|
+
* Standard sizes cap width at sm=400, md=640, lg=960. Responsive fullscreen activates below 640
|
|
38
|
+
* viewport CSS pixels/native logical points; explicit fullscreen always wins. The dialog is
|
|
39
|
+
* always centered. Web consumers customize the standard maximum with --cosm-dialog-max-width and
|
|
40
|
+
* fill width through ::part(base); native consumers override the surface style.
|
|
41
|
+
*/
|
|
42
|
+
export declare const dialogContract: {
|
|
43
|
+
readonly name: "dialog";
|
|
44
|
+
readonly tag: "cosm-dialog";
|
|
45
|
+
readonly description: "Modal content with a title, actions and cancelable close requests.";
|
|
46
|
+
readonly role: "dialog";
|
|
47
|
+
readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/";
|
|
48
|
+
readonly props: {
|
|
49
|
+
readonly open: {
|
|
50
|
+
readonly type: "boolean";
|
|
51
|
+
readonly default: false;
|
|
52
|
+
readonly reflect: true;
|
|
53
|
+
readonly description: "Committed visibility; supplying this prop, including false, controls state.";
|
|
54
|
+
};
|
|
55
|
+
readonly defaultOpen: {
|
|
56
|
+
readonly type: "boolean";
|
|
57
|
+
readonly default: false;
|
|
58
|
+
readonly description: "Initial autonomous visibility; subsequent changes do not reset state.";
|
|
59
|
+
};
|
|
60
|
+
readonly presentation: {
|
|
61
|
+
readonly type: "enum";
|
|
62
|
+
readonly values: readonly ["standard", "fullscreen"];
|
|
63
|
+
readonly default: "standard";
|
|
64
|
+
readonly reflect: true;
|
|
65
|
+
readonly description: "Centered standard surface or fullscreen surface.";
|
|
66
|
+
};
|
|
67
|
+
readonly size: {
|
|
68
|
+
readonly type: "enum";
|
|
69
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
70
|
+
readonly default: "md";
|
|
71
|
+
readonly reflect: true;
|
|
72
|
+
readonly description: "Maximum standard width: sm 400, md 640, lg 960 pixels or logical points.";
|
|
73
|
+
};
|
|
74
|
+
readonly responsiveFullscreen: {
|
|
75
|
+
readonly type: "boolean";
|
|
76
|
+
readonly default: false;
|
|
77
|
+
readonly description: "Use fullscreen when available viewport width is below 640 pixels or logical points.";
|
|
78
|
+
};
|
|
79
|
+
readonly closeLabel: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly default: "Close";
|
|
82
|
+
readonly description: "Non-empty localized accessible name of the built-in close button.";
|
|
83
|
+
};
|
|
84
|
+
readonly closeOnEscape: {
|
|
85
|
+
readonly type: "boolean";
|
|
86
|
+
readonly default: true;
|
|
87
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
88
|
+
readonly description: "Request closure on unhandled Escape on web.";
|
|
89
|
+
};
|
|
90
|
+
readonly closeOnAndroidBack: {
|
|
91
|
+
readonly type: "boolean";
|
|
92
|
+
readonly default: true;
|
|
93
|
+
readonly platforms: readonly ["native"];
|
|
94
|
+
readonly description: "Request closure on Android Back; consume Back even if the request is canceled.";
|
|
95
|
+
};
|
|
96
|
+
readonly closeOnBackdropPress: {
|
|
97
|
+
readonly type: "boolean";
|
|
98
|
+
readonly default: false;
|
|
99
|
+
readonly description: "Request closure when the backdrop itself is pressed.";
|
|
100
|
+
};
|
|
101
|
+
readonly initialFocusTarget: {
|
|
102
|
+
readonly type: "reference";
|
|
103
|
+
readonly reference: "DialogFocusTarget";
|
|
104
|
+
readonly description: "Optional platform focus target used on committed opening; it must be inside the dialog.";
|
|
105
|
+
};
|
|
106
|
+
readonly returnFocusTarget: {
|
|
107
|
+
readonly type: "reference";
|
|
108
|
+
readonly reference: "DialogFocusTarget";
|
|
109
|
+
readonly description: "Optional platform focus target used after committed closure.";
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
readonly events: {
|
|
113
|
+
readonly openChange: {
|
|
114
|
+
readonly description: "Proposes opening or closing; only closing is synchronously cancelable.";
|
|
115
|
+
readonly detail: "DialogOpenChangeDetail";
|
|
116
|
+
readonly cancelable: true;
|
|
117
|
+
readonly names: {
|
|
118
|
+
readonly dom: "cosm-open-change";
|
|
119
|
+
readonly react: "onOpenChange";
|
|
120
|
+
readonly angular: "openChange";
|
|
121
|
+
readonly native: "onOpenChange";
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
readonly states: readonly [{
|
|
126
|
+
readonly prop: "open";
|
|
127
|
+
readonly event: "openChange";
|
|
128
|
+
readonly defaultProp: "defaultOpen";
|
|
129
|
+
}];
|
|
130
|
+
readonly slots: {
|
|
131
|
+
readonly title: "Required accessible title content.";
|
|
132
|
+
readonly description: "Optional short accessible description.";
|
|
133
|
+
readonly '': "Scrollable body content.";
|
|
134
|
+
readonly actions: "Consumer-supplied actions.";
|
|
135
|
+
};
|
|
136
|
+
readonly parts: {
|
|
137
|
+
readonly backdrop: "Modal backdrop.";
|
|
138
|
+
readonly base: "Dialog surface.";
|
|
139
|
+
readonly header: "Title and close control area.";
|
|
140
|
+
readonly title: "Title container.";
|
|
141
|
+
readonly description: "Description container.";
|
|
142
|
+
readonly body: "Scrollable body.";
|
|
143
|
+
readonly actions: "Actions container.";
|
|
144
|
+
readonly close: "Close IconButton.";
|
|
145
|
+
};
|
|
146
|
+
readonly cssProperties: {
|
|
147
|
+
readonly '--cosm-dialog-z-index': "Modal stacking level.";
|
|
148
|
+
readonly '--cosm-dialog-max-width': "Standard surface maximum width.";
|
|
149
|
+
readonly '--cosm-dialog-backdrop': "Backdrop background.";
|
|
150
|
+
readonly '--cosm-dialog-surface': "Surface background.";
|
|
151
|
+
readonly '--cosm-dialog-border': "Surface border.";
|
|
152
|
+
readonly '--cosm-dialog-radius': "Surface radius.";
|
|
153
|
+
readonly '--cosm-dialog-shadow': "Surface shadow.";
|
|
154
|
+
readonly '--cosm-dialog-padding': "Section spacing.";
|
|
155
|
+
};
|
|
156
|
+
readonly keyboard: readonly [{
|
|
157
|
+
readonly keys: readonly ["Escape"];
|
|
158
|
+
readonly action: "On web request close unless handled by a child or disabled.";
|
|
159
|
+
}, {
|
|
160
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
161
|
+
readonly action: "Keep keyboard focus inside the modal.";
|
|
162
|
+
}, {
|
|
163
|
+
readonly keys: readonly ["Android Back"];
|
|
164
|
+
readonly action: "On Android request close unless disabled.";
|
|
165
|
+
}];
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/specs/dialog.ts"],"names":[],"mappings":"AAEA,8CAA8C;AAC9C,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE3F,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,GAChC;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,cAAc,IAAI,IAAI,CAAC;CACxB,CAAC;AAEN,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,iBAAiB,EAAE,CAAC,CAAA;CAAE,CAAC;AAE3D,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,WAAW,IAAI,IAAI,CAAC;IACpB,YAAY,IAAI,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHzB,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { defineContract } from '../contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Modal dialog. A bound open prop (including false) controls visibility; otherwise defaultOpen
|
|
4
|
+
* initializes autonomous state once. Open-change events are proposals, not notifications of
|
|
5
|
+
* committed changes. Closing is synchronously cancelable using the event or detail on web and
|
|
6
|
+
* detail on native; a canceled request leaves the modal and focus intact.
|
|
7
|
+
*
|
|
8
|
+
* A committed opening moves focus inside; a committed close restores it to returnFocusTarget,
|
|
9
|
+
* the invoking control, or an available logical fallback. initialFocusTarget, if supplied and
|
|
10
|
+
* usable, takes precedence over the first focusable content. Targets are platform-specific.
|
|
11
|
+
* The title provides the accessible name; an optional short description describes the modal.
|
|
12
|
+
* Escape is web-only, Android Back is native-only, and backdrop dismissal defaults to off.
|
|
13
|
+
* Guaranteed nested-modal coordination and iOS swipe dismissal are excluded.
|
|
14
|
+
*
|
|
15
|
+
* Standard sizes cap width at sm=400, md=640, lg=960. Responsive fullscreen activates below 640
|
|
16
|
+
* viewport CSS pixels/native logical points; explicit fullscreen always wins. The dialog is
|
|
17
|
+
* always centered. Web consumers customize the standard maximum with --cosm-dialog-max-width and
|
|
18
|
+
* fill width through ::part(base); native consumers override the surface style.
|
|
19
|
+
*/
|
|
20
|
+
export const dialogContract = defineContract({
|
|
21
|
+
name: 'dialog',
|
|
22
|
+
tag: 'cosm-dialog',
|
|
23
|
+
description: 'Modal content with a title, actions and cancelable close requests.',
|
|
24
|
+
role: 'dialog',
|
|
25
|
+
pattern: 'https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/',
|
|
26
|
+
props: {
|
|
27
|
+
open: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
default: false,
|
|
30
|
+
reflect: true,
|
|
31
|
+
description: 'Committed visibility; supplying this prop, including false, controls state.',
|
|
32
|
+
},
|
|
33
|
+
defaultOpen: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
default: false,
|
|
36
|
+
description: 'Initial autonomous visibility; subsequent changes do not reset state.',
|
|
37
|
+
},
|
|
38
|
+
presentation: {
|
|
39
|
+
type: 'enum',
|
|
40
|
+
values: ['standard', 'fullscreen'],
|
|
41
|
+
default: 'standard',
|
|
42
|
+
reflect: true,
|
|
43
|
+
description: 'Centered standard surface or fullscreen surface.',
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
type: 'enum',
|
|
47
|
+
values: ['sm', 'md', 'lg'],
|
|
48
|
+
default: 'md',
|
|
49
|
+
reflect: true,
|
|
50
|
+
description: 'Maximum standard width: sm 400, md 640, lg 960 pixels or logical points.',
|
|
51
|
+
},
|
|
52
|
+
responsiveFullscreen: {
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
default: false,
|
|
55
|
+
description: 'Use fullscreen when available viewport width is below 640 pixels or logical points.',
|
|
56
|
+
},
|
|
57
|
+
closeLabel: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
default: 'Close',
|
|
60
|
+
description: 'Non-empty localized accessible name of the built-in close button.',
|
|
61
|
+
},
|
|
62
|
+
closeOnEscape: {
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
default: true,
|
|
65
|
+
platforms: ['web', 'react', 'angular'],
|
|
66
|
+
description: 'Request closure on unhandled Escape on web.',
|
|
67
|
+
},
|
|
68
|
+
closeOnAndroidBack: {
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
default: true,
|
|
71
|
+
platforms: ['native'],
|
|
72
|
+
description: 'Request closure on Android Back; consume Back even if the request is canceled.',
|
|
73
|
+
},
|
|
74
|
+
closeOnBackdropPress: {
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
default: false,
|
|
77
|
+
description: 'Request closure when the backdrop itself is pressed.',
|
|
78
|
+
},
|
|
79
|
+
initialFocusTarget: {
|
|
80
|
+
type: 'reference',
|
|
81
|
+
reference: 'DialogFocusTarget',
|
|
82
|
+
description: 'Optional platform focus target used on committed opening; it must be inside the dialog.',
|
|
83
|
+
},
|
|
84
|
+
returnFocusTarget: {
|
|
85
|
+
type: 'reference',
|
|
86
|
+
reference: 'DialogFocusTarget',
|
|
87
|
+
description: 'Optional platform focus target used after committed closure.',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
events: {
|
|
91
|
+
openChange: {
|
|
92
|
+
description: 'Proposes opening or closing; only closing is synchronously cancelable.',
|
|
93
|
+
detail: 'DialogOpenChangeDetail',
|
|
94
|
+
cancelable: true,
|
|
95
|
+
names: {
|
|
96
|
+
dom: 'cosm-open-change',
|
|
97
|
+
react: 'onOpenChange',
|
|
98
|
+
angular: 'openChange',
|
|
99
|
+
native: 'onOpenChange',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
states: [{ prop: 'open', event: 'openChange', defaultProp: 'defaultOpen' }],
|
|
104
|
+
slots: {
|
|
105
|
+
title: 'Required accessible title content.',
|
|
106
|
+
description: 'Optional short accessible description.',
|
|
107
|
+
'': 'Scrollable body content.',
|
|
108
|
+
actions: 'Consumer-supplied actions.',
|
|
109
|
+
},
|
|
110
|
+
parts: {
|
|
111
|
+
backdrop: 'Modal backdrop.',
|
|
112
|
+
base: 'Dialog surface.',
|
|
113
|
+
header: 'Title and close control area.',
|
|
114
|
+
title: 'Title container.',
|
|
115
|
+
description: 'Description container.',
|
|
116
|
+
body: 'Scrollable body.',
|
|
117
|
+
actions: 'Actions container.',
|
|
118
|
+
close: 'Close IconButton.',
|
|
119
|
+
},
|
|
120
|
+
cssProperties: {
|
|
121
|
+
'--cosm-dialog-z-index': 'Modal stacking level.',
|
|
122
|
+
'--cosm-dialog-max-width': 'Standard surface maximum width.',
|
|
123
|
+
'--cosm-dialog-backdrop': 'Backdrop background.',
|
|
124
|
+
'--cosm-dialog-surface': 'Surface background.',
|
|
125
|
+
'--cosm-dialog-border': 'Surface border.',
|
|
126
|
+
'--cosm-dialog-radius': 'Surface radius.',
|
|
127
|
+
'--cosm-dialog-shadow': 'Surface shadow.',
|
|
128
|
+
'--cosm-dialog-padding': 'Section spacing.',
|
|
129
|
+
},
|
|
130
|
+
keyboard: [
|
|
131
|
+
{ keys: ['Escape'], action: 'On web request close unless handled by a child or disabled.' },
|
|
132
|
+
{ keys: ['Tab', 'Shift+Tab'], action: 'Keep keyboard focus inside the modal.' },
|
|
133
|
+
{ keys: ['Android Back'], action: 'On Android request close unless disabled.' },
|
|
134
|
+
],
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/specs/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA2BhD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,aAAa;IAClB,WAAW,EAAE,oEAAoE;IACjF,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,wDAAwD;IACjE,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,6EAA6E;SAC3F;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,uEAAuE;SACrF;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,CAAC,UAAU,EAAE,YAAY,C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cAAc;gBACrB,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,cAAc;aACvB;SACF;KACF;IACD,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;IAC3E,KAAK,EAAE;QACL,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EAAE,wCAAwC;QACrD,EAAE,EAAE,0BAA0B;QAC9B,OAAO,EAAE,4BAA4B;KACtC;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,iBAAiB;QAC3B,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,+BAA+B;QACvC,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,oBAAoB;QAC7B,KAAK,EAAE,mBAAmB;KAC3B;IACD,aAAa,EAAE;QACb,uBAAuB,EAAE,uBAAuB;QAChD,yBAAyB,EAAE,iCAAiC;QAC5D,wBAAwB,EAAE,sBAAsB;QAChD,uBAAuB,EAAE,qBAAqB;QAC9C,sBAAsB,EAAE,iBAAiB;QACzC,sBAAsB,EAAE,iBAAiB;QACzC,sBAAsB,EAAE,iBAAiB;QACzC,uBAAuB,EAAE,kBAAkB;KAC5C;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,6DAA6D,EAAE;QAC3F,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,uCAAuC,EAAE;QAC/E,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,2CAA2C,EAAE;KAChF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ContractProps, Platform } from '../contract.js';
|
|
2
|
+
import type { DialogCloseReason, DialogReferences, dialogContract } from './dialog.js';
|
|
3
|
+
export type DialogAction = {
|
|
4
|
+
type: 'open' | 'action' | 'close-button' | 'escape' | 'back' | 'backdrop';
|
|
5
|
+
cancel?: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'sync';
|
|
8
|
+
open: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'set-default';
|
|
11
|
+
defaultOpen: boolean;
|
|
12
|
+
};
|
|
13
|
+
export interface DialogScenario {
|
|
14
|
+
name: string;
|
|
15
|
+
props: ContractProps<typeof dialogContract, 'native', DialogReferences<unknown>> & ContractProps<typeof dialogContract, 'web', DialogReferences<unknown>>;
|
|
16
|
+
actions: readonly DialogAction[];
|
|
17
|
+
expected: {
|
|
18
|
+
openAfterEachAction: readonly boolean[];
|
|
19
|
+
changes: readonly {
|
|
20
|
+
open: boolean;
|
|
21
|
+
reason: DialogCloseReason;
|
|
22
|
+
canceled: boolean;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
platforms?: readonly Platform[];
|
|
26
|
+
}
|
|
27
|
+
/** Platform-independent proposals and state ownership. Focus and modal semantics require platform tests. */
|
|
28
|
+
export declare const dialogScenarios: readonly DialogScenario[];
|
|
29
|
+
export declare const dialogScenariosFor: (platform: Platform) => DialogScenario[];
|
|
30
|
+
/** Layout expectations are independent of platform rendering and focus mechanics. */
|
|
31
|
+
export interface DialogLayoutScenario {
|
|
32
|
+
name: string;
|
|
33
|
+
props: Pick<DialogScenario['props'], 'size' | 'presentation' | 'responsiveFullscreen'>;
|
|
34
|
+
viewportWidth: number;
|
|
35
|
+
/** maxWidth is the effective standard maximum, or null when fullscreen. */
|
|
36
|
+
expected: {
|
|
37
|
+
fullscreen: boolean;
|
|
38
|
+
maxWidth: number | null;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare const dialogLayoutScenarios: readonly DialogLayoutScenario[];
|
|
42
|
+
//# sourceMappingURL=dialog.scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.scenarios.d.ts","s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,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,sBAAsB,CAAC,CAAC;IACvF,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC5D;AAED,eAAO,MAAM,qBAAqB,EAAE,SAAS,oBAAoB,EAqChE,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const close = (reason, canceled = false) => ({ open: false, reason, canceled });
|
|
2
|
+
const opening = { open: true, reason: 'action', canceled: false };
|
|
3
|
+
/** Platform-independent proposals and state ownership. Focus and modal semantics require platform tests. */
|
|
4
|
+
export const dialogScenarios = [
|
|
5
|
+
{
|
|
6
|
+
name: 'closed by default',
|
|
7
|
+
props: {},
|
|
8
|
+
actions: [],
|
|
9
|
+
expected: { openAfterEachAction: [], changes: [] },
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'autonomous open and action close',
|
|
13
|
+
props: {},
|
|
14
|
+
actions: [{ type: 'open' }, { type: 'action' }],
|
|
15
|
+
expected: { openAfterEachAction: [true, false], changes: [opening, close('action')] },
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'default open only initializes once',
|
|
19
|
+
props: { defaultOpen: true },
|
|
20
|
+
actions: [{ type: 'set-default', defaultOpen: false }],
|
|
21
|
+
expected: { openAfterEachAction: [true], changes: [] },
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'controlled false is not overridden by defaultOpen',
|
|
25
|
+
props: { open: false, defaultOpen: true },
|
|
26
|
+
actions: [{ type: 'open' }],
|
|
27
|
+
expected: { openAfterEachAction: [false], changes: [opening] },
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'controlled acceptance requires owner sync',
|
|
31
|
+
props: { open: false },
|
|
32
|
+
actions: [
|
|
33
|
+
{ type: 'open' },
|
|
34
|
+
{ type: 'sync', open: true },
|
|
35
|
+
{ type: 'action' },
|
|
36
|
+
{ type: 'sync', open: false },
|
|
37
|
+
],
|
|
38
|
+
expected: {
|
|
39
|
+
openAfterEachAction: [false, true, true, false],
|
|
40
|
+
changes: [opening, close('action')],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
...['close-button', 'action'].flatMap(reason => [false, true].map(cancel => ({
|
|
44
|
+
name: `${reason} ${cancel ? 'canceled' : 'committed'}`,
|
|
45
|
+
props: { defaultOpen: true },
|
|
46
|
+
actions: [{ type: reason, cancel }],
|
|
47
|
+
expected: { openAfterEachAction: [cancel], changes: [close(reason, cancel)] },
|
|
48
|
+
}))),
|
|
49
|
+
{
|
|
50
|
+
name: 'backdrop does not dismiss by default',
|
|
51
|
+
props: { defaultOpen: true },
|
|
52
|
+
actions: [{ type: 'backdrop' }],
|
|
53
|
+
expected: { openAfterEachAction: [true], changes: [] },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'enabled backdrop requests close',
|
|
57
|
+
props: { defaultOpen: true, closeOnBackdropPress: true },
|
|
58
|
+
actions: [{ type: 'backdrop' }],
|
|
59
|
+
expected: { openAfterEachAction: [false], changes: [close('backdrop')] },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Escape requests close',
|
|
63
|
+
props: { defaultOpen: true },
|
|
64
|
+
actions: [{ type: 'escape' }],
|
|
65
|
+
expected: { openAfterEachAction: [false], changes: [close('escape')] },
|
|
66
|
+
platforms: ['web', 'react', 'angular'],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'disabled Escape does not close',
|
|
70
|
+
props: { defaultOpen: true, closeOnEscape: false },
|
|
71
|
+
actions: [{ type: 'escape' }],
|
|
72
|
+
expected: { openAfterEachAction: [true], changes: [] },
|
|
73
|
+
platforms: ['web', 'react', 'angular'],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Android Back requests close',
|
|
77
|
+
props: { defaultOpen: true },
|
|
78
|
+
actions: [{ type: 'back' }],
|
|
79
|
+
expected: { openAfterEachAction: [false], changes: [close('back')] },
|
|
80
|
+
platforms: ['native'],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'disabled Android Back does not close',
|
|
84
|
+
props: { defaultOpen: true, closeOnAndroidBack: false },
|
|
85
|
+
actions: [{ type: 'back' }],
|
|
86
|
+
expected: { openAfterEachAction: [true], changes: [] },
|
|
87
|
+
platforms: ['native'],
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
export const dialogScenariosFor = (platform) => dialogScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
91
|
+
export const dialogLayoutScenarios = [
|
|
92
|
+
{
|
|
93
|
+
name: 'default medium',
|
|
94
|
+
props: {},
|
|
95
|
+
viewportWidth: 1200,
|
|
96
|
+
expected: { fullscreen: false, maxWidth: 640 },
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'small maximum',
|
|
100
|
+
props: { size: 'sm' },
|
|
101
|
+
viewportWidth: 1200,
|
|
102
|
+
expected: { fullscreen: false, maxWidth: 400 },
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'large maximum',
|
|
106
|
+
props: { size: 'lg' },
|
|
107
|
+
viewportWidth: 1200,
|
|
108
|
+
expected: { fullscreen: false, maxWidth: 960 },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'responsive fullscreen below boundary',
|
|
112
|
+
props: { responsiveFullscreen: true },
|
|
113
|
+
viewportWidth: 639,
|
|
114
|
+
expected: { fullscreen: true, maxWidth: null },
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'responsive boundary remains standard',
|
|
118
|
+
props: { responsiveFullscreen: true },
|
|
119
|
+
viewportWidth: 640,
|
|
120
|
+
expected: { fullscreen: false, maxWidth: 640 },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'explicit fullscreen wins',
|
|
124
|
+
props: { presentation: 'fullscreen', size: 'sm' },
|
|
125
|
+
viewportWidth: 1200,
|
|
126
|
+
expected: { fullscreen: true, maxWidth: null },
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
//# sourceMappingURL=dialog.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.scenarios.js","sourceRoot":"","sources":["../../src/specs/dialog.scenarios.ts"],"names":[],"mappings":"AAoBA,MAAM,KAAK,GAAG,CAAC,MAAyB,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AACnG,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAW,CAAC;AAE3E,4GAA4G;AAC5G,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;KACnD;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC/C,QAAQ,EAAE,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE;KACtF;IACD;QACE,IAAI,EAAE,oCAAoC;QAC1C,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;QAC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E,IAAI,EAAE,IAAI,EAAE;QACrB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;KAC/C;IACD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACrB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;KAC/C;IACD;QACE,IAAI,EAAE,sCAAsC;QAC5C,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE;QACrC,aAAa,EAAE,GAAG;QAClB,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/C;IACD;QACE,IAAI,EAAE,sCAAsC;QAC5C,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE;QACrC,aAAa,EAAE,GAAG;QAClB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;KAC/C;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;QACjD,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/C;CACF,CAAC"}
|
package/dist/specs/icon.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const iconContract: {
|
|
3
3
|
readonly name: "icon";
|
|
4
4
|
readonly tag: "cosm-icon";
|
|
5
|
-
readonly description: "Renders a structured SVG icon.
|
|
5
|
+
readonly description: "Renders a structured SVG icon. Icons are decorative and hidden from assistive technology unless a nonempty label makes them informative.";
|
|
6
6
|
readonly role: "img";
|
|
7
7
|
readonly pattern: "https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA24";
|
|
8
8
|
readonly props: {
|
|
@@ -26,30 +26,21 @@ export declare const iconContract: {
|
|
|
26
26
|
readonly reflect: true;
|
|
27
27
|
readonly description: "Semantic size (16, 20 or 24) or a positive finite number in pixels / native units.";
|
|
28
28
|
};
|
|
29
|
-
readonly
|
|
30
|
-
readonly type: "
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
29
|
+
readonly variant: {
|
|
30
|
+
readonly type: "enum";
|
|
31
|
+
readonly values: readonly ["outline", "filled"];
|
|
32
|
+
readonly default: "outline";
|
|
33
|
+
readonly reflect: true;
|
|
34
|
+
readonly description: "Appearance. outline draws only the stroke; filled also fills the shapes with the icon color (for example a favorite star or heart). Explicit node fills in the definition always win.";
|
|
33
35
|
};
|
|
34
|
-
readonly
|
|
36
|
+
readonly color: {
|
|
35
37
|
readonly type: "string";
|
|
36
|
-
readonly default: "
|
|
37
|
-
readonly description: "
|
|
38
|
-
};
|
|
39
|
-
readonly strokeWidth: {
|
|
40
|
-
readonly type: "number";
|
|
41
|
-
readonly default: 2;
|
|
42
|
-
readonly description: "Finite nonnegative stroke width in SVG viewBox units.";
|
|
38
|
+
readonly default: "currentColor";
|
|
39
|
+
readonly description: "Icon color (stroke, currentColor fills and the filled variant). currentColor inherits the surrounding text color on web and the parent control or theme foreground on native; otherwise a supported color without URLs.";
|
|
43
40
|
};
|
|
44
41
|
readonly label: {
|
|
45
42
|
readonly type: "string";
|
|
46
|
-
readonly description: "Accessible name
|
|
47
|
-
};
|
|
48
|
-
readonly decorative: {
|
|
49
|
-
readonly type: "boolean";
|
|
50
|
-
readonly default: true;
|
|
51
|
-
readonly reflect: true;
|
|
52
|
-
readonly description: "Hides the icon from assistive technology when true.";
|
|
43
|
+
readonly description: "Accessible name. A nonempty label makes the icon an informative image; without one the icon is decorative and hidden from assistive technology.";
|
|
53
44
|
};
|
|
54
45
|
};
|
|
55
46
|
readonly events: {};
|
package/dist/specs/icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/specs/icon.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/specs/icon.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDvB,CAAC"}
|
package/dist/specs/icon.js
CHANGED
|
@@ -3,7 +3,7 @@ import { defineContract } from '../contract.js';
|
|
|
3
3
|
export const iconContract = defineContract({
|
|
4
4
|
name: 'icon',
|
|
5
5
|
tag: 'cosm-icon',
|
|
6
|
-
description: 'Renders a structured SVG icon.
|
|
6
|
+
description: 'Renders a structured SVG icon. Icons are decorative and hidden from assistive technology unless a nonempty label makes them informative.',
|
|
7
7
|
role: 'img',
|
|
8
8
|
pattern: 'https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA24',
|
|
9
9
|
props: {
|
|
@@ -22,30 +22,21 @@ export const iconContract = defineContract({
|
|
|
22
22
|
reflect: true,
|
|
23
23
|
description: 'Semantic size (16, 20 or 24) or a positive finite number in pixels / native units.',
|
|
24
24
|
},
|
|
25
|
-
|
|
26
|
-
type: '
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
variant: {
|
|
26
|
+
type: 'enum',
|
|
27
|
+
values: ['outline', 'filled'],
|
|
28
|
+
default: 'outline',
|
|
29
|
+
reflect: true,
|
|
30
|
+
description: 'Appearance. outline draws only the stroke; filled also fills the shapes with the icon color (for example a favorite star or heart). Explicit node fills in the definition always win.',
|
|
29
31
|
},
|
|
30
|
-
|
|
32
|
+
color: {
|
|
31
33
|
type: 'string',
|
|
32
|
-
default: '
|
|
33
|
-
description: '
|
|
34
|
-
},
|
|
35
|
-
strokeWidth: {
|
|
36
|
-
type: 'number',
|
|
37
|
-
default: 2,
|
|
38
|
-
description: 'Finite nonnegative stroke width in SVG viewBox units.',
|
|
34
|
+
default: 'currentColor',
|
|
35
|
+
description: 'Icon color (stroke, currentColor fills and the filled variant). currentColor inherits the surrounding text color on web and the parent control or theme foreground on native; otherwise a supported color without URLs.',
|
|
39
36
|
},
|
|
40
37
|
label: {
|
|
41
38
|
type: 'string',
|
|
42
|
-
description: 'Accessible name
|
|
43
|
-
},
|
|
44
|
-
decorative: {
|
|
45
|
-
type: 'boolean',
|
|
46
|
-
default: true,
|
|
47
|
-
reflect: true,
|
|
48
|
-
description: 'Hides the icon from assistive technology when true.',
|
|
39
|
+
description: 'Accessible name. A nonempty label makes the icon an informative image; without one the icon is decorative and hidden from assistive technology.',
|
|
49
40
|
},
|
|
50
41
|
},
|
|
51
42
|
events: {},
|
package/dist/specs/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/specs/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;IACzC,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,WAAW;IAChB,WAAW,EACT
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/specs/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;IACzC,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,WAAW;IAChB,WAAW,EACT,0IAA0I;IAC5I,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,sDAAsD;IAC/D,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,gBAAgB;YAC3B,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC;YAC7C,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,6EAA6E;SAC3F;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC5E,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,WAAW,EACT,oFAAoF;SACvF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;YAC7B,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,IAAI;YACb,WAAW,EACT,uLAAuL;SAC1L;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,cAAc;YACvB,WAAW,EACT,yNAAyN;SAC5N;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,iJAAiJ;SACpJ;KACF;IACD,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE;IACtC,aAAa,EAAE,EAAE,kBAAkB,EAAE,8CAA8C,EAAE;IACrF,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -3,13 +3,21 @@ export interface IconScenario {
|
|
|
3
3
|
name: string;
|
|
4
4
|
props: {
|
|
5
5
|
size?: 'sm' | 'md' | 'lg' | number;
|
|
6
|
+
variant?: 'outline' | 'filled';
|
|
6
7
|
label?: string;
|
|
7
|
-
|
|
8
|
+
color?: string;
|
|
8
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* `decorative` is derived: an icon is informative only with a nonempty trimmed label.
|
|
12
|
+
* `filled` is derived from `variant`: filled icons paint their shapes with the resolved color.
|
|
13
|
+
*/
|
|
9
14
|
expected: {
|
|
10
15
|
size: 'sm' | 'md' | 'lg' | number;
|
|
16
|
+
variant: 'outline' | 'filled';
|
|
11
17
|
label?: string;
|
|
12
18
|
decorative: boolean;
|
|
19
|
+
color: string;
|
|
20
|
+
filled: boolean;
|
|
13
21
|
};
|
|
14
22
|
platforms?: readonly Platform[];
|
|
15
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/icon.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"icon.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/icon.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;QACnC,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;OAGG;IACH,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;QAClC,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,OAAO,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAED,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAqFhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,QAAQ,mBAC6C,CAAC"}
|