@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.
Files changed (157) hide show
  1. package/dist/catalog.d.ts +3 -3
  2. package/dist/catalog.d.ts.map +1 -1
  3. package/dist/catalog.js +25 -6
  4. package/dist/catalog.js.map +1 -1
  5. package/dist/codegen.d.ts +16 -0
  6. package/dist/codegen.d.ts.map +1 -1
  7. package/dist/codegen.js +396 -57
  8. package/dist/codegen.js.map +1 -1
  9. package/dist/headless/calendar.d.ts +32 -0
  10. package/dist/headless/calendar.d.ts.map +1 -0
  11. package/dist/headless/calendar.js +242 -0
  12. package/dist/headless/calendar.js.map +1 -0
  13. package/dist/headless/listbox.d.ts +9 -0
  14. package/dist/headless/listbox.d.ts.map +1 -0
  15. package/dist/headless/listbox.js +103 -0
  16. package/dist/headless/listbox.js.map +1 -0
  17. package/dist/headless/pagination.d.ts +34 -0
  18. package/dist/headless/pagination.d.ts.map +1 -0
  19. package/dist/headless/pagination.js +92 -0
  20. package/dist/headless/pagination.js.map +1 -0
  21. package/dist/headless/radio-group.d.ts +10 -0
  22. package/dist/headless/radio-group.d.ts.map +1 -0
  23. package/dist/headless/radio-group.js +59 -0
  24. package/dist/headless/radio-group.js.map +1 -0
  25. package/dist/headless/select.d.ts +4 -0
  26. package/dist/headless/select.d.ts.map +1 -0
  27. package/dist/headless/select.js +7 -0
  28. package/dist/headless/select.js.map +1 -0
  29. package/dist/headless/size.d.ts +3 -0
  30. package/dist/headless/size.d.ts.map +1 -0
  31. package/dist/headless/size.js +7 -0
  32. package/dist/headless/size.js.map +1 -0
  33. package/dist/headless/text-field.d.ts +25 -0
  34. package/dist/headless/text-field.d.ts.map +1 -0
  35. package/dist/headless/text-field.js +12 -0
  36. package/dist/headless/text-field.js.map +1 -0
  37. package/dist/index.d.ts +1709 -19
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +60 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/markdown.d.ts.map +1 -1
  42. package/dist/markdown.js +7 -3
  43. package/dist/markdown.js.map +1 -1
  44. package/dist/specs/badge.d.ts +65 -0
  45. package/dist/specs/badge.d.ts.map +1 -0
  46. package/dist/specs/badge.js +64 -0
  47. package/dist/specs/badge.js.map +1 -0
  48. package/dist/specs/badge.scenarios.d.ts +21 -0
  49. package/dist/specs/badge.scenarios.d.ts.map +1 -0
  50. package/dist/specs/badge.scenarios.js +35 -0
  51. package/dist/specs/badge.scenarios.js.map +1 -0
  52. package/dist/specs/calendar.d.ts +120 -0
  53. package/dist/specs/calendar.d.ts.map +1 -0
  54. package/dist/specs/calendar.js +121 -0
  55. package/dist/specs/calendar.js.map +1 -0
  56. package/dist/specs/calendar.scenarios.d.ts +39 -0
  57. package/dist/specs/calendar.scenarios.d.ts.map +1 -0
  58. package/dist/specs/calendar.scenarios.js +139 -0
  59. package/dist/specs/calendar.scenarios.js.map +1 -0
  60. package/dist/specs/checkbox.d.ts +139 -0
  61. package/dist/specs/checkbox.d.ts.map +1 -0
  62. package/dist/specs/checkbox.js +129 -0
  63. package/dist/specs/checkbox.js.map +1 -0
  64. package/dist/specs/checkbox.scenarios.d.ts +28 -0
  65. package/dist/specs/checkbox.scenarios.d.ts.map +1 -0
  66. package/dist/specs/checkbox.scenarios.js +54 -0
  67. package/dist/specs/checkbox.scenarios.js.map +1 -0
  68. package/dist/specs/dialog.d.ts +167 -0
  69. package/dist/specs/dialog.d.ts.map +1 -0
  70. package/dist/specs/dialog.js +136 -0
  71. package/dist/specs/dialog.js.map +1 -0
  72. package/dist/specs/dialog.scenarios.d.ts +42 -0
  73. package/dist/specs/dialog.scenarios.d.ts.map +1 -0
  74. package/dist/specs/dialog.scenarios.js +129 -0
  75. package/dist/specs/dialog.scenarios.js.map +1 -0
  76. package/dist/specs/icon-button.d.ts +136 -0
  77. package/dist/specs/icon-button.d.ts.map +1 -0
  78. package/dist/specs/icon-button.js +119 -0
  79. package/dist/specs/icon-button.js.map +1 -0
  80. package/dist/specs/icon-button.scenarios.d.ts +28 -0
  81. package/dist/specs/icon-button.scenarios.d.ts.map +1 -0
  82. package/dist/specs/icon-button.scenarios.js +95 -0
  83. package/dist/specs/icon-button.scenarios.js.map +1 -0
  84. package/dist/specs/icon.d.ts +11 -20
  85. package/dist/specs/icon.d.ts.map +1 -1
  86. package/dist/specs/icon.js +11 -20
  87. package/dist/specs/icon.js.map +1 -1
  88. package/dist/specs/icon.scenarios.d.ts +9 -1
  89. package/dist/specs/icon.scenarios.d.ts.map +1 -1
  90. package/dist/specs/icon.scenarios.js +70 -6
  91. package/dist/specs/icon.scenarios.js.map +1 -1
  92. package/dist/specs/listbox.d.ts +157 -0
  93. package/dist/specs/listbox.d.ts.map +1 -0
  94. package/dist/specs/listbox.js +144 -0
  95. package/dist/specs/listbox.js.map +1 -0
  96. package/dist/specs/listbox.scenarios.d.ts +37 -0
  97. package/dist/specs/listbox.scenarios.d.ts.map +1 -0
  98. package/dist/specs/listbox.scenarios.js +110 -0
  99. package/dist/specs/listbox.scenarios.js.map +1 -0
  100. package/dist/specs/pagination.d.ts +147 -0
  101. package/dist/specs/pagination.d.ts.map +1 -0
  102. package/dist/specs/pagination.js +122 -0
  103. package/dist/specs/pagination.js.map +1 -0
  104. package/dist/specs/pagination.scenarios.d.ts +15 -0
  105. package/dist/specs/pagination.scenarios.d.ts.map +1 -0
  106. package/dist/specs/pagination.scenarios.js +29 -0
  107. package/dist/specs/pagination.scenarios.js.map +1 -0
  108. package/dist/specs/popover.d.ts +201 -0
  109. package/dist/specs/popover.d.ts.map +1 -0
  110. package/dist/specs/popover.js +169 -0
  111. package/dist/specs/popover.js.map +1 -0
  112. package/dist/specs/popover.scenarios.d.ts +83 -0
  113. package/dist/specs/popover.scenarios.d.ts.map +1 -0
  114. package/dist/specs/popover.scenarios.js +368 -0
  115. package/dist/specs/popover.scenarios.js.map +1 -0
  116. package/dist/specs/radio-group.d.ts +154 -0
  117. package/dist/specs/radio-group.d.ts.map +1 -0
  118. package/dist/specs/radio-group.js +133 -0
  119. package/dist/specs/radio-group.js.map +1 -0
  120. package/dist/specs/radio-group.scenarios.d.ts +35 -0
  121. package/dist/specs/radio-group.scenarios.d.ts.map +1 -0
  122. package/dist/specs/radio-group.scenarios.js +67 -0
  123. package/dist/specs/radio-group.scenarios.js.map +1 -0
  124. package/dist/specs/select.d.ts +167 -0
  125. package/dist/specs/select.d.ts.map +1 -0
  126. package/dist/specs/select.js +148 -0
  127. package/dist/specs/select.js.map +1 -0
  128. package/dist/specs/select.scenarios.d.ts +37 -0
  129. package/dist/specs/select.scenarios.d.ts.map +1 -0
  130. package/dist/specs/select.scenarios.js +77 -0
  131. package/dist/specs/select.scenarios.js.map +1 -0
  132. package/dist/specs/switch.d.ts +123 -0
  133. package/dist/specs/switch.d.ts.map +1 -0
  134. package/dist/specs/switch.js +113 -0
  135. package/dist/specs/switch.js.map +1 -0
  136. package/dist/specs/switch.scenarios.d.ts +27 -0
  137. package/dist/specs/switch.scenarios.d.ts.map +1 -0
  138. package/dist/specs/switch.scenarios.js +54 -0
  139. package/dist/specs/switch.scenarios.js.map +1 -0
  140. package/dist/specs/text-field.d.ts +232 -0
  141. package/dist/specs/text-field.d.ts.map +1 -0
  142. package/dist/specs/text-field.js +220 -0
  143. package/dist/specs/text-field.js.map +1 -0
  144. package/dist/specs/text-field.scenarios.d.ts +52 -0
  145. package/dist/specs/text-field.scenarios.d.ts.map +1 -0
  146. package/dist/specs/text-field.scenarios.js +106 -0
  147. package/dist/specs/text-field.scenarios.js.map +1 -0
  148. package/dist/specs/textarea.d.ts +144 -0
  149. package/dist/specs/textarea.d.ts.map +1 -0
  150. package/dist/specs/textarea.js +134 -0
  151. package/dist/specs/textarea.js.map +1 -0
  152. package/dist/specs/textarea.scenarios.d.ts +33 -0
  153. package/dist/specs/textarea.scenarios.d.ts.map +1 -0
  154. package/dist/specs/textarea.scenarios.js +82 -0
  155. package/dist/specs/textarea.scenarios.js.map +1 -0
  156. package/llms.md +797 -6
  157. package/package.json +1 -1
@@ -0,0 +1,122 @@
1
+ import { defineContract } from '../contract.js';
2
+ /** A bounded button-based navigation landmark for a known number of pages. */
3
+ export const paginationContract = defineContract({
4
+ name: 'pagination',
5
+ tag: 'cosm-pagination',
6
+ description: 'Navigates a known number of pages using buttons.',
7
+ role: 'navigation',
8
+ pattern: 'https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/',
9
+ props: {
10
+ totalPages: {
11
+ type: 'number',
12
+ required: true,
13
+ description: 'Required nonnegative safe integer page count.',
14
+ },
15
+ page: {
16
+ type: 'number',
17
+ description: 'Controlled one-based safe integer page; out-of-range values are displayed clamped.',
18
+ },
19
+ defaultPage: {
20
+ type: 'number',
21
+ default: 1,
22
+ description: 'Initial one-based page for autonomous state.',
23
+ },
24
+ label: {
25
+ type: 'string',
26
+ required: true,
27
+ description: 'Required localized navigation landmark label.',
28
+ },
29
+ previousLabel: {
30
+ type: 'string',
31
+ default: 'Previous page',
32
+ description: 'Previous button label.',
33
+ },
34
+ nextLabel: { type: 'string', default: 'Next page', description: 'Next button label.' },
35
+ firstLabel: { type: 'string', default: 'First page', description: 'First button label.' },
36
+ lastLabel: { type: 'string', default: 'Last page', description: 'Last button label.' },
37
+ pageLabel: {
38
+ type: 'string',
39
+ default: 'Page {page}',
40
+ description: 'Page button label template; {page} is replaced with the localized number.',
41
+ },
42
+ summaryLabel: {
43
+ type: 'string',
44
+ default: 'Page {page} of {total}',
45
+ description: 'Compact summary template with {page} and {total} placeholders.',
46
+ },
47
+ locale: { type: 'string', description: 'Locale for formatted page numbers.' },
48
+ direction: {
49
+ type: 'enum',
50
+ values: ['ltr', 'rtl'],
51
+ default: 'ltr',
52
+ description: 'Layout and directional icon direction.',
53
+ },
54
+ presentation: {
55
+ type: 'enum',
56
+ values: ['numbered', 'compact'],
57
+ default: 'numbered',
58
+ reflect: true,
59
+ description: 'Show up to seven fixed-width numbered positions or a compact summary.',
60
+ },
61
+ variant: {
62
+ type: 'enum',
63
+ values: ['solid', 'soft', 'outline'],
64
+ default: 'solid',
65
+ reflect: true,
66
+ description: 'Selected page emphasis.',
67
+ },
68
+ size: {
69
+ type: 'enum',
70
+ values: ['sm', 'md', 'lg'],
71
+ default: 'md',
72
+ reflect: true,
73
+ description: 'Control size.',
74
+ },
75
+ showFirstLast: {
76
+ type: 'boolean',
77
+ default: false,
78
+ description: 'Show first and last page controls.',
79
+ },
80
+ disabled: {
81
+ type: 'boolean',
82
+ default: false,
83
+ reflect: true,
84
+ description: 'Disable all controls.',
85
+ },
86
+ },
87
+ events: {
88
+ change: {
89
+ description: 'Proposes a different page after enabled user activation.',
90
+ detail: 'PaginationChangeDetail',
91
+ names: {
92
+ dom: 'cosm-change',
93
+ react: 'onChange',
94
+ angular: 'pageChange',
95
+ native: 'onPageChange',
96
+ },
97
+ },
98
+ },
99
+ states: [{ prop: 'page', event: 'change', defaultProp: 'defaultPage' }],
100
+ slots: {},
101
+ parts: {
102
+ base: 'Navigation landmark.',
103
+ control: 'Navigation control.',
104
+ page: 'Page control.',
105
+ current: 'Current page control.',
106
+ ellipsis: 'Decorative omitted-page indicator.',
107
+ summary: 'Compact summary.',
108
+ },
109
+ cssProperties: {
110
+ '--cosm-pagination-gap': 'Gap between controls.',
111
+ '--cosm-pagination-min-height': 'Minimum control height.',
112
+ '--cosm-pagination-radius': 'Control corner radius.',
113
+ '--cosm-pagination-current-background': 'Current page background.',
114
+ '--cosm-pagination-current-color': 'Current page foreground.',
115
+ '--cosm-pagination-current-border': 'Current page border color.',
116
+ },
117
+ keyboard: [
118
+ { keys: ['Tab', 'Shift+Tab'], action: 'Moves between enabled controls.' },
119
+ { keys: ['Enter', 'Space'], action: 'Activates the focused control.' },
120
+ ],
121
+ });
122
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/specs/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,M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,aAAa,EAAE,CAAC;IACvE,KAAK,EAAE,EAAE;IACT,KAAK,EAAE;QACL,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,qBAAqB;QAC9B,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,oCAAoC;QAC9C,OAAO,EAAE,kBAAkB;KAC5B;IACD,aAAa,EAAE;QACb,uBAAuB,EAAE,uBAAuB;QAChD,8BAA8B,EAAE,yBAAyB;QACzD,0BAA0B,EAAE,wBAAwB;QACpD,sCAAsC,EAAE,0BAA0B;QAClE,iCAAiC,EAAE,0BAA0B;QAC7D,kCAAkC,EAAE,4BAA4B;KACjE;IACD,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE;QACzE,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,gCAAgC,EAAE;KACvE;CACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ContractProps, Platform } from '../contract.js';
2
+ import type { paginationContract } from './pagination.js';
3
+ export interface PaginationScenario {
4
+ name: string;
5
+ props: ContractProps<typeof paginationContract, 'web'>;
6
+ target: number;
7
+ expected: {
8
+ page: number;
9
+ changes: number[];
10
+ };
11
+ }
12
+ /** State ownership and disabled activation shared by all platform drivers. */
13
+ export declare const paginationScenarios: readonly PaginationScenario[];
14
+ export declare const paginationScenariosFor: (_platform: Platform) => readonly PaginationScenario[];
15
+ //# sourceMappingURL=pagination.scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/pagination.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC,OAAO,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC/C;AAED,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,EAAE,SAAS,kBAAkB,EAyB5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,WAAW,QAAQ,kCAAwB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** State ownership and disabled activation shared by all platform drivers. */
2
+ export const paginationScenarios = [
3
+ {
4
+ name: 'commits autonomous selection',
5
+ props: { totalPages: 10, label: 'Results', defaultPage: 5 },
6
+ target: 6,
7
+ expected: { page: 6, changes: [6] },
8
+ },
9
+ {
10
+ name: 'proposes controlled selection without committing',
11
+ props: { totalPages: 10, label: 'Results', page: 5 },
12
+ target: 6,
13
+ expected: { page: 5, changes: [6] },
14
+ },
15
+ {
16
+ name: 'ignores the current page',
17
+ props: { totalPages: 10, label: 'Results', defaultPage: 5 },
18
+ target: 5,
19
+ expected: { page: 5, changes: [] },
20
+ },
21
+ {
22
+ name: 'ignores disabled selection',
23
+ props: { totalPages: 10, label: 'Results', defaultPage: 5, disabled: true },
24
+ target: 6,
25
+ expected: { page: 5, changes: [] },
26
+ },
27
+ ];
28
+ export const paginationScenariosFor = (_platform) => paginationScenarios;
29
+ //# sourceMappingURL=pagination.scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.scenarios.js","sourceRoot":"","sources":["../../src/specs/pagination.scenarios.ts"],"names":[],"mappings":"AAUA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAkC;IAChE;QACE,IAAI,EAAE,8BAA8B;QACpC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE;QAC3D,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE;KACpC;IACD;QACE,IAAI,EAAE,kDAAkD;QACxD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE;QACpD,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE;KACpC;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE;QAC3D,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;KACnC;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3E,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;KACnC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC"}
@@ -0,0 +1,201 @@
1
+ /** Cause of a close request, not notification that the panel has closed. */
2
+ export type PopoverCloseReason = 'trigger' | 'escape' | 'outside' | 'action' | 'back' | 'close-button' | 'hover' | 'focus';
3
+ /**
4
+ * An opening proposal cannot be vetoed. Closing proposals can be vetoed synchronously.
5
+ * On web, detail.preventDefault() and the original CustomEvent.preventDefault() share
6
+ * cancellation state; React/Angular receive that original event. Native receives this detail.
7
+ * Returning false or canceling after dispatch has completed has no effect.
8
+ */
9
+ export type PopoverOpenChangeDetail = {
10
+ open: true;
11
+ reason: 'trigger' | 'hover' | 'focus';
12
+ } | {
13
+ open: false;
14
+ reason: PopoverCloseReason;
15
+ readonly defaultPrevented: boolean;
16
+ preventDefault(): void;
17
+ };
18
+ /** Requested physical side of the trigger; alignment uses the current writing direction. */
19
+ export type PopoverSide = 'top' | 'right' | 'bottom' | 'left';
20
+ export type PopoverAlign = 'start' | 'center' | 'end';
21
+ /**
22
+ * Imperative action-close surface: the web element, React ref, Angular component instance
23
+ * and native ref expose requestClose(). It proposes reason "action" only while open.
24
+ * It does not force controlled state, bypass cancellation or emit a committed-close event.
25
+ */
26
+ export interface PopoverHandle {
27
+ requestClose(): void;
28
+ }
29
+ /**
30
+ * Generic non-modal anchored content. There is no generic APG Popover pattern; the HTML
31
+ * Popover specification is a reference, not a requirement to use its native auto behavior.
32
+ *
33
+ * | State | Autonomous | Controlled | Event |
34
+ * | --- | --- | --- | --- |
35
+ * | open | Initialized once from defaultOpen; commits uncanceled proposals | Supplied open, including false, stays unchanged until the owner updates it | openChange proposes the next value |
36
+ *
37
+ * | Event | DOM | React | Angular | Native |
38
+ * | --- | --- | --- | --- | --- |
39
+ * | openChange | cosm-open-change | onOpenChange | openChange | onOpenChange |
40
+ *
41
+ * Web events bubble and are composed; only closing proposals are cancelable. Cancellation
42
+ * precedes autonomous commit. Owners must also honor a canceled controlled proposal.
43
+ * Owner prop updates never emit proposals and cannot be vetoed. A refused/canceled close
44
+ * never hides the panel or moves focus. Focus effects wait for an actual state transition.
45
+ * A controlled acceptance may restore focus only for its latest uncanceled close proposal;
46
+ * a later proposal supersedes it. Unsolicited prop closure does not restore focus.
47
+ *
48
+ * Consumers supply one keyboard-operable trigger and the panel content (web named trigger
49
+ * slot/default slot; native trigger content/children). Expose committed expanded state on
50
+ * the trigger (aria-expanded/accessibilityState.expanded); preserve its accessible name.
51
+ * Do not add a panel role, aria-modal, aria-haspopup, a focus trap or menu keyboard behavior.
52
+ * Content semantics/naming belong to the consumer. Closed content is hidden from focus and
53
+ * accessibility. Enter/Space use the trigger's ordinary activation, never duplicate it.
54
+ *
55
+ * Escape already handled by a child does not dismiss. Outside means a press outside both
56
+ * trigger and panel, including their descendants; never consume that target's interaction,
57
+ * even when closure is canceled. Focus leaving by Tab alone does not close the panel.
58
+ * Escape is supported on web and React Native Web, not by native Android or iOS hardware
59
+ * keyboards. Android Back requests reason "back" while open, consumes that Back even if vetoed, and
60
+ * does not navigate behind the panel. A canceled predictive Back gesture does not request
61
+ * closure. Back has no effect on other platforms. Guaranteed nested-overlay ordering is
62
+ * excluded.
63
+ *
64
+ * requestClose() is an imperative method, not a prop/event; see PopoverHandle.
65
+ * Hover mode adds pointer/focus opening on web (including React Native Web), never removes
66
+ * press activation, never steals focus on hover/focus opening, and keeps content reachable
67
+ * across the gap. Leaving both trigger and panel requests closure after 150ms unless focus
68
+ * remains inside. Escape/close-button dismissal suppresses reopening until pointer and focus
69
+ * leave. Android/iOS use press activation. No tooltip semantics are inferred.
70
+ * The optional close control uses IconButton and an individual Lucide X (ADR 0005).
71
+ *
72
+ * Positioning is not configurable beyond side and align: the panel sits at the theme space-sm
73
+ * distance (8 CSS pixels/logical units by default) from the trigger, measured to the arrow tip
74
+ * when shown. When the requested side overflows the viewport/safe area, the opposite side is
75
+ * used only if it reduces main-axis overflow (ties keep the requested side); the panel is then
76
+ * shifted and constrained within the available bounds. Collision handling takes priority over
77
+ * the distance. Recompute for trigger/panel size, viewport/safe-area, scrolling and orientation.
78
+ *
79
+ * Focus policy is fixed: opening never moves focus (it stays on the trigger; users reach the
80
+ * content with Tab or screen-reader navigation, or the consumer focuses its own content).
81
+ * After committed trigger, Escape, action, close-button or Back closure, focus returns to the
82
+ * trigger only if it was inside the panel and the trigger is connected and focusable. Never
83
+ * steal outside focus, restore after an outside press, or restore for unsolicited prop closure.
84
+ *
85
+ * Arrow follows the actual side and trigger center, hiding when corners or collisions prevent
86
+ * a correct pointer. No animation, named sizes or tones are added.
87
+ */
88
+ export declare const popoverContract: {
89
+ readonly name: "popover";
90
+ readonly tag: "cosm-popover";
91
+ readonly description: "Non-modal content anchored to a consumer trigger, with cancelable close requests and no imposed panel semantics.";
92
+ readonly role: "";
93
+ readonly pattern: "https://html.spec.whatwg.org/multipage/popover.html";
94
+ readonly props: {
95
+ readonly open: {
96
+ readonly type: "boolean";
97
+ readonly default: false;
98
+ readonly reflect: true;
99
+ readonly description: "Committed visibility. Supplying this prop, including false, controls state; its metadata default does not establish a binding.";
100
+ };
101
+ readonly defaultOpen: {
102
+ readonly type: "boolean";
103
+ readonly default: false;
104
+ readonly description: "Initial autonomous visibility only; ignored when open is supplied. Later updates do not reset state.";
105
+ };
106
+ readonly triggerMode: {
107
+ readonly type: "enum";
108
+ readonly values: readonly ["press", "hover"];
109
+ readonly default: "press";
110
+ readonly description: "Hover adds pointer and keyboard-focus opening on web and React Native Web, while keeping press activation. Android/iOS use press. Does not change panel semantics.";
111
+ };
112
+ readonly closable: {
113
+ readonly type: "boolean";
114
+ readonly default: false;
115
+ readonly description: "Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button.";
116
+ };
117
+ readonly closeLabel: {
118
+ readonly type: "string";
119
+ readonly default: "Close";
120
+ readonly description: "Localized accessible name of the close button. Must be non-empty when closable is true.";
121
+ };
122
+ readonly arrow: {
123
+ readonly type: "boolean";
124
+ readonly default: false;
125
+ readonly description: "Shows a decorative triangular pointer (16 wide, 8 deep), following the actual side, panel background and border. Hidden if it cannot point to the trigger without crossing a corner or viewport edge.";
126
+ };
127
+ readonly closeOnEscape: {
128
+ readonly type: "boolean";
129
+ readonly default: true;
130
+ readonly description: "Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported.";
131
+ };
132
+ readonly closeOnOutsidePress: {
133
+ readonly type: "boolean";
134
+ readonly default: true;
135
+ readonly description: "Requests closure on an outside press without preventing its interaction or restoring trigger focus.";
136
+ };
137
+ readonly side: {
138
+ readonly type: "enum";
139
+ readonly values: readonly ["top", "right", "bottom", "left"];
140
+ readonly default: "bottom";
141
+ readonly reflect: true;
142
+ readonly description: "Requested physical side; actual placement flips to the opposite side when that reduces viewport/safe-area overflow, then shifts within bounds.";
143
+ };
144
+ readonly align: {
145
+ readonly type: "enum";
146
+ readonly values: readonly ["start", "center", "end"];
147
+ readonly default: "center";
148
+ readonly reflect: true;
149
+ readonly description: "Cross-axis alignment. On top/bottom, start/end follow inline direction (RTL reverses them); on left/right they mean top/bottom.";
150
+ };
151
+ };
152
+ readonly events: {
153
+ readonly openChange: {
154
+ readonly description: "Proposes visibility changes by trigger, hover or focus, or closure by Escape, outside press, panel action, close button or Android Back. Closing only is cancelable, synchronously via the web event or detail.preventDefault(); native uses detail.preventDefault(). Not a committed-state notification.";
155
+ readonly detail: "PopoverOpenChangeDetail";
156
+ readonly cancelable: true;
157
+ readonly names: {
158
+ readonly dom: "cosm-open-change";
159
+ readonly react: "onOpenChange";
160
+ readonly angular: "openChange";
161
+ readonly native: "onOpenChange";
162
+ };
163
+ };
164
+ };
165
+ readonly states: readonly [{
166
+ readonly prop: "open";
167
+ readonly event: "openChange";
168
+ readonly defaultProp: "defaultOpen";
169
+ }];
170
+ readonly slots: {
171
+ readonly trigger: "Consumer-supplied accessible trigger; its appearance and label belong to the consumer. Native accepts content or a render function receiving onPress, ref and accessibilityState for composing an IconButton without nested buttons.";
172
+ readonly '': "Consumer-supplied panel content and semantics. Native maps this content to children.";
173
+ };
174
+ readonly parts: {
175
+ readonly trigger: "Trigger container.";
176
+ readonly panel: "Non-modal anchored surface.";
177
+ readonly body: "Scrollable consumer content.";
178
+ readonly close: "Optional close IconButton.";
179
+ readonly arrow: "Decorative pointer; follows panel colors.";
180
+ };
181
+ readonly cssProperties: {
182
+ readonly '--cosm-popover-z-index': "Panel stacking level.";
183
+ readonly '--cosm-popover-padding': "Panel padding.";
184
+ readonly '--cosm-popover-radius': "Panel corner radius.";
185
+ readonly '--cosm-popover-shadow': "Panel shadow.";
186
+ };
187
+ readonly keyboard: readonly [{
188
+ readonly keys: readonly ["Enter", "Space"];
189
+ readonly action: "The focused trigger activates once and toggles open.";
190
+ }, {
191
+ readonly keys: readonly ["Escape"];
192
+ readonly action: "On web and React Native Web, requests close when open and closeOnEscape is true, unless a child already handled the key.";
193
+ }, {
194
+ readonly keys: readonly ["Tab", "Shift+Tab"];
195
+ readonly action: "Moves focus normally without a focus trap or automatic dismissal.";
196
+ }, {
197
+ readonly keys: readonly ["Android Back"];
198
+ readonly action: "Requests close while open on Android only.";
199
+ }];
200
+ };
201
+ //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/specs/popover.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,MAAM,GACN,cAAc,GACd,OAAO,GACP,OAAO,CAAC;AAEZ;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;CAAE,GACrD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,cAAc,IAAI,IAAI,CAAC;CACxB,CAAC;AAEN,4FAA4F;AAC5F,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,IAAI,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyH1B,CAAC"}
@@ -0,0 +1,169 @@
1
+ import { defineContract } from '../contract.js';
2
+ /**
3
+ * Generic non-modal anchored content. There is no generic APG Popover pattern; the HTML
4
+ * Popover specification is a reference, not a requirement to use its native auto behavior.
5
+ *
6
+ * | State | Autonomous | Controlled | Event |
7
+ * | --- | --- | --- | --- |
8
+ * | open | Initialized once from defaultOpen; commits uncanceled proposals | Supplied open, including false, stays unchanged until the owner updates it | openChange proposes the next value |
9
+ *
10
+ * | Event | DOM | React | Angular | Native |
11
+ * | --- | --- | --- | --- | --- |
12
+ * | openChange | cosm-open-change | onOpenChange | openChange | onOpenChange |
13
+ *
14
+ * Web events bubble and are composed; only closing proposals are cancelable. Cancellation
15
+ * precedes autonomous commit. Owners must also honor a canceled controlled proposal.
16
+ * Owner prop updates never emit proposals and cannot be vetoed. A refused/canceled close
17
+ * never hides the panel or moves focus. Focus effects wait for an actual state transition.
18
+ * A controlled acceptance may restore focus only for its latest uncanceled close proposal;
19
+ * a later proposal supersedes it. Unsolicited prop closure does not restore focus.
20
+ *
21
+ * Consumers supply one keyboard-operable trigger and the panel content (web named trigger
22
+ * slot/default slot; native trigger content/children). Expose committed expanded state on
23
+ * the trigger (aria-expanded/accessibilityState.expanded); preserve its accessible name.
24
+ * Do not add a panel role, aria-modal, aria-haspopup, a focus trap or menu keyboard behavior.
25
+ * Content semantics/naming belong to the consumer. Closed content is hidden from focus and
26
+ * accessibility. Enter/Space use the trigger's ordinary activation, never duplicate it.
27
+ *
28
+ * Escape already handled by a child does not dismiss. Outside means a press outside both
29
+ * trigger and panel, including their descendants; never consume that target's interaction,
30
+ * even when closure is canceled. Focus leaving by Tab alone does not close the panel.
31
+ * Escape is supported on web and React Native Web, not by native Android or iOS hardware
32
+ * keyboards. Android Back requests reason "back" while open, consumes that Back even if vetoed, and
33
+ * does not navigate behind the panel. A canceled predictive Back gesture does not request
34
+ * closure. Back has no effect on other platforms. Guaranteed nested-overlay ordering is
35
+ * excluded.
36
+ *
37
+ * requestClose() is an imperative method, not a prop/event; see PopoverHandle.
38
+ * Hover mode adds pointer/focus opening on web (including React Native Web), never removes
39
+ * press activation, never steals focus on hover/focus opening, and keeps content reachable
40
+ * across the gap. Leaving both trigger and panel requests closure after 150ms unless focus
41
+ * remains inside. Escape/close-button dismissal suppresses reopening until pointer and focus
42
+ * leave. Android/iOS use press activation. No tooltip semantics are inferred.
43
+ * The optional close control uses IconButton and an individual Lucide X (ADR 0005).
44
+ *
45
+ * Positioning is not configurable beyond side and align: the panel sits at the theme space-sm
46
+ * distance (8 CSS pixels/logical units by default) from the trigger, measured to the arrow tip
47
+ * when shown. When the requested side overflows the viewport/safe area, the opposite side is
48
+ * used only if it reduces main-axis overflow (ties keep the requested side); the panel is then
49
+ * shifted and constrained within the available bounds. Collision handling takes priority over
50
+ * the distance. Recompute for trigger/panel size, viewport/safe-area, scrolling and orientation.
51
+ *
52
+ * Focus policy is fixed: opening never moves focus (it stays on the trigger; users reach the
53
+ * content with Tab or screen-reader navigation, or the consumer focuses its own content).
54
+ * After committed trigger, Escape, action, close-button or Back closure, focus returns to the
55
+ * trigger only if it was inside the panel and the trigger is connected and focusable. Never
56
+ * steal outside focus, restore after an outside press, or restore for unsolicited prop closure.
57
+ *
58
+ * Arrow follows the actual side and trigger center, hiding when corners or collisions prevent
59
+ * a correct pointer. No animation, named sizes or tones are added.
60
+ */
61
+ export const popoverContract = defineContract({
62
+ name: 'popover',
63
+ tag: 'cosm-popover',
64
+ description: 'Non-modal content anchored to a consumer trigger, with cancelable close requests and no imposed panel semantics.',
65
+ role: '',
66
+ pattern: 'https://html.spec.whatwg.org/multipage/popover.html',
67
+ props: {
68
+ open: {
69
+ type: 'boolean',
70
+ default: false,
71
+ reflect: true,
72
+ description: 'Committed visibility. Supplying this prop, including false, controls state; its metadata default does not establish a binding.',
73
+ },
74
+ defaultOpen: {
75
+ type: 'boolean',
76
+ default: false,
77
+ description: 'Initial autonomous visibility only; ignored when open is supplied. Later updates do not reset state.',
78
+ },
79
+ triggerMode: {
80
+ type: 'enum',
81
+ values: ['press', 'hover'],
82
+ default: 'press',
83
+ description: 'Hover adds pointer and keyboard-focus opening on web and React Native Web, while keeping press activation. Android/iOS use press. Does not change panel semantics.',
84
+ },
85
+ closable: {
86
+ type: 'boolean',
87
+ default: false,
88
+ description: 'Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button.',
89
+ },
90
+ closeLabel: {
91
+ type: 'string',
92
+ default: 'Close',
93
+ description: 'Localized accessible name of the close button. Must be non-empty when closable is true.',
94
+ },
95
+ arrow: {
96
+ type: 'boolean',
97
+ default: false,
98
+ description: 'Shows a decorative triangular pointer (16 wide, 8 deep), following the actual side, panel background and border. Hidden if it cannot point to the trigger without crossing a corner or viewport edge.',
99
+ },
100
+ closeOnEscape: {
101
+ type: 'boolean',
102
+ default: true,
103
+ description: 'Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported.',
104
+ },
105
+ closeOnOutsidePress: {
106
+ type: 'boolean',
107
+ default: true,
108
+ description: 'Requests closure on an outside press without preventing its interaction or restoring trigger focus.',
109
+ },
110
+ side: {
111
+ type: 'enum',
112
+ values: ['top', 'right', 'bottom', 'left'],
113
+ default: 'bottom',
114
+ reflect: true,
115
+ description: 'Requested physical side; actual placement flips to the opposite side when that reduces viewport/safe-area overflow, then shifts within bounds.',
116
+ },
117
+ align: {
118
+ type: 'enum',
119
+ values: ['start', 'center', 'end'],
120
+ default: 'center',
121
+ reflect: true,
122
+ description: 'Cross-axis alignment. On top/bottom, start/end follow inline direction (RTL reverses them); on left/right they mean top/bottom.',
123
+ },
124
+ },
125
+ events: {
126
+ openChange: {
127
+ description: 'Proposes visibility changes by trigger, hover or focus, or closure by Escape, outside press, panel action, close button or Android Back. Closing only is cancelable, synchronously via the web event or detail.preventDefault(); native uses detail.preventDefault(). Not a committed-state notification.',
128
+ detail: 'PopoverOpenChangeDetail',
129
+ cancelable: true,
130
+ names: {
131
+ dom: 'cosm-open-change',
132
+ react: 'onOpenChange',
133
+ angular: 'openChange',
134
+ native: 'onOpenChange',
135
+ },
136
+ },
137
+ },
138
+ states: [{ prop: 'open', event: 'openChange', defaultProp: 'defaultOpen' }],
139
+ slots: {
140
+ trigger: 'Consumer-supplied accessible trigger; its appearance and label belong to the consumer. Native accepts content or a render function receiving onPress, ref and accessibilityState for composing an IconButton without nested buttons.',
141
+ '': 'Consumer-supplied panel content and semantics. Native maps this content to children.',
142
+ },
143
+ parts: {
144
+ trigger: 'Trigger container.',
145
+ panel: 'Non-modal anchored surface.',
146
+ body: 'Scrollable consumer content.',
147
+ close: 'Optional close IconButton.',
148
+ arrow: 'Decorative pointer; follows panel colors.',
149
+ },
150
+ cssProperties: {
151
+ '--cosm-popover-z-index': 'Panel stacking level.',
152
+ '--cosm-popover-padding': 'Panel padding.',
153
+ '--cosm-popover-radius': 'Panel corner radius.',
154
+ '--cosm-popover-shadow': 'Panel shadow.',
155
+ },
156
+ keyboard: [
157
+ { keys: ['Enter', 'Space'], action: 'The focused trigger activates once and toggles open.' },
158
+ {
159
+ keys: ['Escape'],
160
+ action: 'On web and React Native Web, requests close when open and closeOnEscape is true, unless a child already handled the key.',
161
+ },
162
+ {
163
+ keys: ['Tab', 'Shift+Tab'],
164
+ action: 'Moves focus normally without a focus trap or automatic dismissal.',
165
+ },
166
+ { keys: ['Android Back'], action: 'Requests close while open on Android only.' },
167
+ ],
168
+ });
169
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/specs/popover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAyChD;;;;;;;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AE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,4CAA4C,EAAE;KACjF;CACF,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type { ContractProps, Platform } from '../contract.js';
2
+ import type { PopoverCloseReason, popoverContract } from './popover.js';
3
+ /**
4
+ * Drivers install cancellation before the action, using the original event on web/wrappers
5
+ * or detail.preventDefault() on native. They record proposals even when canceled.
6
+ * A sync simulates the owner setting open; it never emits a proposal.
7
+ */
8
+ export type PopoverAction = {
9
+ type: 'trigger';
10
+ source: 'pointer' | 'touch' | 'keyboard';
11
+ cancel?: boolean;
12
+ } | {
13
+ type: 'escape';
14
+ handled?: boolean;
15
+ cancel?: boolean;
16
+ } | {
17
+ type: 'outside';
18
+ focusable: boolean;
19
+ cancel?: boolean;
20
+ } | {
21
+ type: 'action' | 'back' | 'close-button';
22
+ cancel?: boolean;
23
+ } | {
24
+ type: 'sync';
25
+ open: boolean;
26
+ } | {
27
+ type: 'set-default';
28
+ defaultOpen: boolean;
29
+ } | {
30
+ type: 'focus';
31
+ target: 'trigger' | 'panel' | 'outside';
32
+ };
33
+ /** Serializable projection of a proposal; cancellation functions are not snapshot data. */
34
+ export type PopoverChangeExpectation = {
35
+ open: true;
36
+ reason: 'trigger' | 'hover' | 'focus';
37
+ canceled: false;
38
+ } | {
39
+ open: false;
40
+ reason: PopoverCloseReason;
41
+ canceled: boolean;
42
+ };
43
+ export interface PopoverScenario {
44
+ name: string;
45
+ props: ContractProps<typeof popoverContract, 'web'>;
46
+ /**
47
+ * Focus starts on the trigger, or on the first panel child with `focusStart: 'panel'`
48
+ * (only for initially open scenarios; it simulates the user tabbing into the panel).
49
+ * By default the panel contains a focusable child.
50
+ */
51
+ fixture?: {
52
+ panelHasFocusableContent?: boolean;
53
+ triggerFocusable?: boolean;
54
+ focusStart?: 'trigger' | 'panel';
55
+ };
56
+ actions: readonly PopoverAction[];
57
+ expected: {
58
+ open: boolean;
59
+ /** Committed visibility after every action, including syncs and ignored actions. */
60
+ openAfterEachAction: readonly boolean[];
61
+ changes: readonly PopoverChangeExpectation[];
62
+ /**
63
+ * Unmanaged means hiding focused content leaves fallback to the platform: assert
64
+ * no component restoration, not that focus remains in hidden/unmounted content.
65
+ */
66
+ focus: 'trigger' | 'panel-first' | 'outside' | 'unmanaged';
67
+ /** Outside targets receive every press, even when closed, controlled or canceled. */
68
+ outsidePresses: number;
69
+ };
70
+ platforms?: readonly Platform[];
71
+ }
72
+ /**
73
+ * Shared normative cases, not a platform implementation. Drivers use a first focusable
74
+ * panel child unless the fixture opts out. "panel-first" asserts that first panel child.
75
+ * Opening never moves focus, so focus reaches the panel only through `focusStart` or a
76
+ * `focus` action. For outside presses on
77
+ * a nonfocusable target, the fixture preserves focus so lack of restoration is observable.
78
+ * Native Escape cases exercise React Native Web; hardware Escape is not supported on Android
79
+ * or iOS. Back cases are native Android cases; native drivers must run them in Android mode.
80
+ */
81
+ export declare const popoverScenarios: readonly PopoverScenario[];
82
+ export declare const popoverScenariosFor: (platform: Platform) => PopoverScenario[];
83
+ //# sourceMappingURL=popover.scenarios.d.ts.map