@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,119 @@
|
|
|
1
|
+
import { defineContract } from '../contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* An icon-only action or toggle with a required accessible name.
|
|
4
|
+
*
|
|
5
|
+
* | State | Autonomous | Controlled | Event |
|
|
6
|
+
* | --- | --- | --- | --- |
|
|
7
|
+
* | pressed | Starts at defaultPressed and commits each toggle | A supplied pressed, including false, stays unchanged until the owner updates it | pressedChange proposes the opposite value |
|
|
8
|
+
*
|
|
9
|
+
* Controlled ownership is determined by whether pressed is supplied, not its default value.
|
|
10
|
+
* Toggle mode exposes the pressed state (aria-pressed on web); action mode does not expose or change it.
|
|
11
|
+
*
|
|
12
|
+
* | Event | DOM | React | Angular | Native |
|
|
13
|
+
* | --- | --- | --- | --- | --- |
|
|
14
|
+
* | press | cosm-press | onPress | press | onPress |
|
|
15
|
+
* | pressedChange | cosm-pressed-change | onPressedChange | pressedChange | onPressedChange |
|
|
16
|
+
* See ADR 0003 and the WAI-ARIA APG button pattern.
|
|
17
|
+
*/
|
|
18
|
+
export const iconButtonContract = defineContract({
|
|
19
|
+
name: 'icon-button',
|
|
20
|
+
tag: 'cosm-icon-button',
|
|
21
|
+
description: 'Activates an action or toggles a boolean state using a labeled icon.',
|
|
22
|
+
role: 'button',
|
|
23
|
+
pattern: 'https://www.w3.org/WAI/ARIA/apg/patterns/button/',
|
|
24
|
+
props: {
|
|
25
|
+
label: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'Required localized accessible name. Missing, empty or whitespace-only labels are rejected.',
|
|
29
|
+
},
|
|
30
|
+
mode: {
|
|
31
|
+
type: 'enum',
|
|
32
|
+
values: ['action', 'toggle'],
|
|
33
|
+
default: 'action',
|
|
34
|
+
reflect: true,
|
|
35
|
+
description: 'Action activates without toggle state; toggle exposes and changes pressed state.',
|
|
36
|
+
},
|
|
37
|
+
variant: {
|
|
38
|
+
type: 'enum',
|
|
39
|
+
values: ['solid', 'soft', 'outline', 'ghost'],
|
|
40
|
+
default: 'solid',
|
|
41
|
+
reflect: true,
|
|
42
|
+
description: 'Visual emphasis, from highest (solid) to lowest (ghost).',
|
|
43
|
+
},
|
|
44
|
+
tone: {
|
|
45
|
+
type: 'enum',
|
|
46
|
+
values: ['primary', 'neutral', 'danger'],
|
|
47
|
+
default: 'primary',
|
|
48
|
+
reflect: true,
|
|
49
|
+
description: 'Color role. Use danger for destructive actions.',
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
type: 'enum',
|
|
53
|
+
values: ['sm', 'md', 'lg'],
|
|
54
|
+
default: 'md',
|
|
55
|
+
reflect: true,
|
|
56
|
+
description: 'Size of the square visual control.',
|
|
57
|
+
},
|
|
58
|
+
disabled: {
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
default: false,
|
|
61
|
+
reflect: true,
|
|
62
|
+
description: 'Prevents activation and removes the web button from the tab order.',
|
|
63
|
+
},
|
|
64
|
+
type: {
|
|
65
|
+
type: 'enum',
|
|
66
|
+
values: ['button', 'submit', 'reset'],
|
|
67
|
+
default: 'button',
|
|
68
|
+
platforms: ['web', 'react', 'angular'],
|
|
69
|
+
description: 'Native web button form behavior.',
|
|
70
|
+
},
|
|
71
|
+
pressed: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
description: 'Toggle state. If supplied, including false, activation proposes changes without committing them until the owner updates this prop.',
|
|
75
|
+
},
|
|
76
|
+
defaultPressed: {
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
default: false,
|
|
79
|
+
description: 'Initial toggle state when pressed is not supplied; it does not control later changes.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
events: {
|
|
83
|
+
press: {
|
|
84
|
+
description: 'Reports each enabled activation by pointer, keyboard or programmatically.',
|
|
85
|
+
detail: 'IconButtonPressDetail',
|
|
86
|
+
names: { dom: 'cosm-press', react: 'onPress', angular: 'press', native: 'onPress' },
|
|
87
|
+
},
|
|
88
|
+
pressedChange: {
|
|
89
|
+
description: 'Reports the proposed next pressed state on toggle activation; controlled state waits for the owner.',
|
|
90
|
+
detail: 'IconButtonPressedChangeDetail',
|
|
91
|
+
names: {
|
|
92
|
+
dom: 'cosm-pressed-change',
|
|
93
|
+
react: 'onPressedChange',
|
|
94
|
+
angular: 'pressedChange',
|
|
95
|
+
native: 'onPressedChange',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
states: [{ prop: 'pressed', event: 'pressedChange', defaultProp: 'defaultPressed' }],
|
|
100
|
+
slots: {
|
|
101
|
+
'': 'Decorative icon content; the label supplies the accessible name.',
|
|
102
|
+
},
|
|
103
|
+
parts: { base: 'The native button element.' },
|
|
104
|
+
cssProperties: {
|
|
105
|
+
'--cosm-icon-button-background': 'Control background.',
|
|
106
|
+
'--cosm-icon-button-color': 'Icon foreground color.',
|
|
107
|
+
'--cosm-icon-button-border': 'Control border color.',
|
|
108
|
+
'--cosm-icon-button-radius': 'Control corner radius.',
|
|
109
|
+
'--cosm-icon-button-focus': 'Visible focus indicator color.',
|
|
110
|
+
},
|
|
111
|
+
keyboard: [
|
|
112
|
+
{ keys: ['Tab', 'Shift+Tab'], action: 'Moves focus to or from the enabled button.' },
|
|
113
|
+
{
|
|
114
|
+
keys: ['Enter', 'Space'],
|
|
115
|
+
action: 'Activates the button; toggle mode also proposes a change.',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=icon-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/specs/icon-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAWhD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;IAC/C,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,kBAAkB;IACvB,WAAW,EAAE,sEAAsE;IACnF,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,kDAAkD;IAC3D,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,4FAA4F;SAC/F;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;YAC5B,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,IAAI;YACb,WAAW,EACT,kFAAkF;SACrF;QACD,OAAO,EAAE;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O,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;SACpF;QACD,aAAa,EAAE;YACb,WAAW,EACT,qGAAqG;YACvG,MAAM,EAAE,+BAA+B;YACvC,KAAK,EAAE;gBACL,GAAG,EAAE,qBAAqB;gBAC1B,KAAK,EAAE,iBAAiB;gBACxB,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,iBAAiB;aAC1B;SACF;KACF;IACD,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;IACpF,KAAK,EAAE;QACL,EAAE,EAAE,kEAAkE;KACvE;IACD,KAAK,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE;IAC7C,aAAa,EAAE;QACb,+BAA+B,EAAE,qBAAqB;QACtD,0BAA0B,EAAE,wBAAwB;QACpD,2BAA2B,EAAE,uBAAuB;QACpD,2BAA2B,EAAE,wBAAwB;QACrD,0BAA0B,EAAE,gCAAgC;KAC7D;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,4CAA4C,EAAE;QACpF;YACE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;YACxB,MAAM,EAAE,2DAA2D;SACpE;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ContractProps, Platform } from '../contract.js';
|
|
2
|
+
import type { PressSource } from './button.js';
|
|
3
|
+
import type { ButtonAction } from './button.scenarios.js';
|
|
4
|
+
import type { iconButtonContract } from './icon-button.js';
|
|
5
|
+
/** A sync action simulates the owner supplying a new controlled pressed prop. */
|
|
6
|
+
export type IconButtonAction = ButtonAction | {
|
|
7
|
+
type: 'sync';
|
|
8
|
+
pressed: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface IconButtonScenario {
|
|
11
|
+
name: string;
|
|
12
|
+
props: ContractProps<typeof iconButtonContract, 'web'>;
|
|
13
|
+
actions: readonly IconButtonAction[];
|
|
14
|
+
expected: {
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
presses: number;
|
|
17
|
+
sources: readonly PressSource[];
|
|
18
|
+
/** Ordered pressed-change detail values. */
|
|
19
|
+
changes: readonly boolean[];
|
|
20
|
+
/** Exposed toggle state; null means action mode has no pressed semantics. */
|
|
21
|
+
pressed: boolean | null;
|
|
22
|
+
};
|
|
23
|
+
platforms?: readonly Platform[];
|
|
24
|
+
}
|
|
25
|
+
/** Shared state and interaction expectations for platform drivers. */
|
|
26
|
+
export declare const iconButtonScenarios: readonly IconButtonScenario[];
|
|
27
|
+
export declare const iconButtonScenariosFor: (platform: Platform) => IconButtonScenario[];
|
|
28
|
+
//# sourceMappingURL=icon-button.scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/icon-button.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC,OAAO,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACvD,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,QAAQ,EAAE;QACR,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;QAChC,4CAA4C;QAC5C,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;QAC5B,6EAA6E;QAC7E,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACjC;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,EAAE,SAAS,kBAAkB,EA2F5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,UAAU,QAAQ,yBAGtD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** Shared state and interaction expectations for platform drivers. */
|
|
2
|
+
export const iconButtonScenarios = [
|
|
3
|
+
{
|
|
4
|
+
name: 'action activation reports a press without toggle state',
|
|
5
|
+
props: { label: 'Favorite', pressed: true },
|
|
6
|
+
actions: [{ type: 'press', source: 'pointer' }],
|
|
7
|
+
expected: { disabled: false, presses: 1, sources: ['pointer'], changes: [], pressed: null },
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'disabled toggle ignores activation',
|
|
11
|
+
props: { label: 'Favorite', mode: 'toggle', disabled: true, defaultPressed: true },
|
|
12
|
+
actions: [{ type: 'press', source: 'pointer' }],
|
|
13
|
+
expected: { disabled: true, presses: 0, sources: [], changes: [], pressed: true },
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'autonomous toggle commits each activation',
|
|
17
|
+
props: { label: 'Favorite', mode: 'toggle' },
|
|
18
|
+
actions: [
|
|
19
|
+
{ type: 'press', source: 'pointer' },
|
|
20
|
+
{ type: 'press', source: 'pointer' },
|
|
21
|
+
],
|
|
22
|
+
expected: {
|
|
23
|
+
disabled: false,
|
|
24
|
+
presses: 2,
|
|
25
|
+
sources: ['pointer', 'pointer'],
|
|
26
|
+
changes: [true, false],
|
|
27
|
+
pressed: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'controlled false stays false when the owner refuses repeated proposals',
|
|
32
|
+
props: { label: 'Favorite', mode: 'toggle', pressed: false, defaultPressed: true },
|
|
33
|
+
actions: [
|
|
34
|
+
{ type: 'press', source: 'pointer' },
|
|
35
|
+
{ type: 'press', source: 'pointer' },
|
|
36
|
+
],
|
|
37
|
+
expected: {
|
|
38
|
+
disabled: false,
|
|
39
|
+
presses: 2,
|
|
40
|
+
sources: ['pointer', 'pointer'],
|
|
41
|
+
changes: [true, true],
|
|
42
|
+
pressed: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'controlled toggle uses the value accepted by the owner',
|
|
47
|
+
props: { label: 'Favorite', mode: 'toggle', pressed: false },
|
|
48
|
+
actions: [
|
|
49
|
+
{ type: 'press', source: 'pointer' },
|
|
50
|
+
{ type: 'sync', pressed: true },
|
|
51
|
+
{ type: 'press', source: 'pointer' },
|
|
52
|
+
],
|
|
53
|
+
expected: {
|
|
54
|
+
disabled: false,
|
|
55
|
+
presses: 2,
|
|
56
|
+
sources: ['pointer', 'pointer'],
|
|
57
|
+
changes: [true, false],
|
|
58
|
+
pressed: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'defaultPressed initializes an autonomous toggle',
|
|
63
|
+
props: { label: 'Favorite', mode: 'toggle', defaultPressed: true },
|
|
64
|
+
actions: [{ type: 'press', source: 'pointer' }],
|
|
65
|
+
expected: {
|
|
66
|
+
disabled: false,
|
|
67
|
+
presses: 1,
|
|
68
|
+
sources: ['pointer'],
|
|
69
|
+
changes: [false],
|
|
70
|
+
pressed: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Enter activates an action button',
|
|
75
|
+
props: { label: 'Favorite' },
|
|
76
|
+
actions: [{ type: 'key', key: 'Enter' }],
|
|
77
|
+
expected: { disabled: false, presses: 1, sources: ['keyboard'], changes: [], pressed: null },
|
|
78
|
+
platforms: ['web', 'react', 'angular'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Space activates a toggle button',
|
|
82
|
+
props: { label: 'Favorite', mode: 'toggle' },
|
|
83
|
+
actions: [{ type: 'key', key: ' ' }],
|
|
84
|
+
expected: {
|
|
85
|
+
disabled: false,
|
|
86
|
+
presses: 1,
|
|
87
|
+
sources: ['keyboard'],
|
|
88
|
+
changes: [true],
|
|
89
|
+
pressed: true,
|
|
90
|
+
},
|
|
91
|
+
platforms: ['web', 'react', 'angular'],
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
export const iconButtonScenariosFor = (platform) => iconButtonScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
95
|
+
//# sourceMappingURL=icon-button.scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.scenarios.js","sourceRoot":"","sources":["../../src/specs/icon-button.scenarios.ts"],"names":[],"mappings":"AAwBA,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE;QACE,IAAI,EAAE,wDAAwD;QAC9D,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/C,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5F;IACD;QACE,IAAI,EAAE,oCAAoC;QAC1C,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;QAClF,OAAO,EAAE,CAAC,EAAE,IAAI,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AiC;QACvC,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACpC,QAAQ,EAAE;YACR,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,OAAO,EAAE,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,IAAI;SACd;QACD,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC;KACvC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAkB,EAAE,EAAE,CAC3D,mBAAmB,CAAC,MAAM,CACxB,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACzE,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"}
|
|
@@ -3,22 +3,86 @@ export const iconScenarios = [
|
|
|
3
3
|
{
|
|
4
4
|
name: 'uses the medium decorative default',
|
|
5
5
|
props: {},
|
|
6
|
-
expected: {
|
|
6
|
+
expected: {
|
|
7
|
+
size: 'md',
|
|
8
|
+
variant: 'outline',
|
|
9
|
+
decorative: true,
|
|
10
|
+
color: 'currentColor',
|
|
11
|
+
filled: false,
|
|
12
|
+
},
|
|
7
13
|
},
|
|
8
14
|
{
|
|
9
|
-
name: '
|
|
10
|
-
props: { size: 'sm',
|
|
11
|
-
expected: {
|
|
15
|
+
name: 'becomes informative with a nonempty label',
|
|
16
|
+
props: { size: 'sm', label: 'Home' },
|
|
17
|
+
expected: {
|
|
18
|
+
size: 'sm',
|
|
19
|
+
variant: 'outline',
|
|
20
|
+
decorative: false,
|
|
21
|
+
label: 'Home',
|
|
22
|
+
color: 'currentColor',
|
|
23
|
+
filled: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'stays decorative with a blank label',
|
|
28
|
+
props: { label: ' ' },
|
|
29
|
+
expected: {
|
|
30
|
+
size: 'md',
|
|
31
|
+
variant: 'outline',
|
|
32
|
+
decorative: true,
|
|
33
|
+
color: 'currentColor',
|
|
34
|
+
filled: false,
|
|
35
|
+
},
|
|
12
36
|
},
|
|
13
37
|
{
|
|
14
38
|
name: 'supports a large decorative icon',
|
|
15
39
|
props: { size: 'lg' },
|
|
16
|
-
expected: {
|
|
40
|
+
expected: {
|
|
41
|
+
size: 'lg',
|
|
42
|
+
variant: 'outline',
|
|
43
|
+
decorative: true,
|
|
44
|
+
color: 'currentColor',
|
|
45
|
+
filled: false,
|
|
46
|
+
},
|
|
17
47
|
},
|
|
18
48
|
{
|
|
19
49
|
name: 'supports a numeric decorative size',
|
|
20
50
|
props: { size: 32 },
|
|
21
|
-
expected: {
|
|
51
|
+
expected: {
|
|
52
|
+
size: 32,
|
|
53
|
+
variant: 'outline',
|
|
54
|
+
decorative: true,
|
|
55
|
+
color: 'currentColor',
|
|
56
|
+
filled: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'applies an explicit color',
|
|
61
|
+
props: { color: '#ff0000' },
|
|
62
|
+
expected: { size: 'md', variant: 'outline', decorative: true, color: '#ff0000', filled: false },
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'fills shapes with the inherited color in the filled variant',
|
|
66
|
+
props: { variant: 'filled' },
|
|
67
|
+
expected: {
|
|
68
|
+
size: 'md',
|
|
69
|
+
variant: 'filled',
|
|
70
|
+
decorative: true,
|
|
71
|
+
color: 'currentColor',
|
|
72
|
+
filled: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'fills an informative icon with an explicit color',
|
|
77
|
+
props: { variant: 'filled', color: '#ff0000', label: 'Favorite' },
|
|
78
|
+
expected: {
|
|
79
|
+
size: 'md',
|
|
80
|
+
variant: 'filled',
|
|
81
|
+
decorative: false,
|
|
82
|
+
label: 'Favorite',
|
|
83
|
+
color: '#ff0000',
|
|
84
|
+
filled: true,
|
|
85
|
+
},
|
|
22
86
|
},
|
|
23
87
|
];
|
|
24
88
|
export const iconScenariosFor = (platform) => iconScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.scenarios.js","sourceRoot":"","sources":["../../src/specs/icon.scenarios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.scenarios.js","sourceRoot":"","sources":["../../src/specs/icon.scenarios.ts"],"names":[],"mappings":"AAyBA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD;QACE,IAAI,EAAE,oCAAoC;QAC1C,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,KAAK;SACd;KACF;IACD;QACE,IAAI,EAAE,2CAA2C;QACjD,KAAK,EAAE,EAAE,IAA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