@torpor/ui 0.2.0 → 0.2.1

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 (213) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/Accordion/Accordion.torp +23 -11
  3. package/dist/Accordion/AccordionContent.torp +13 -6
  4. package/dist/Accordion/AccordionHeader.torp +14 -5
  5. package/dist/Accordion/AccordionItem.torp +22 -8
  6. package/dist/Accordion/AccordionTrigger.torp +14 -6
  7. package/dist/Accordion/AccordionTypes.ts +2 -0
  8. package/dist/Accordion/index.d.ts +100 -35
  9. package/dist/Breadcrumb/Breadcrumb.torp +12 -3
  10. package/dist/Breadcrumb/BreadcrumbItem.torp +12 -3
  11. package/dist/Breadcrumb/BreadcrumbSeparator.torp +10 -1
  12. package/dist/Breadcrumb/index.d.ts +49 -21
  13. package/dist/Calendar/Calendar.torp +9 -1
  14. package/dist/Calendar/CalendarDay.torp +9 -1
  15. package/dist/Calendar/index.d.ts +16 -18
  16. package/dist/Dialog/Dialog.torp +13 -3
  17. package/dist/Dialog/DialogBody.torp +11 -3
  18. package/dist/Dialog/DialogButton.torp +16 -4
  19. package/dist/Dialog/DialogFooter.torp +11 -1
  20. package/dist/Dialog/DialogHeader.torp +11 -2
  21. package/dist/Dialog/index.d.ts +78 -35
  22. package/dist/Disclosure/Disclosure.torp +17 -7
  23. package/dist/Disclosure/DisclosureContent.torp +13 -6
  24. package/dist/Disclosure/DisclosureHeader.torp +14 -5
  25. package/dist/Disclosure/DisclosureTrigger.torp +10 -2
  26. package/dist/Disclosure/index.d.ts +67 -28
  27. package/dist/Drawer/Drawer.torp +11 -1
  28. package/dist/Drawer/index.d.ts +10 -9
  29. package/dist/Form/Field.torp +93 -0
  30. package/dist/Form/Form.torp +131 -0
  31. package/dist/Form/FormTypes.ts +30 -0
  32. package/dist/Form/Input.torp +94 -0
  33. package/dist/Form/Label.torp +31 -0
  34. package/dist/Form/Message.torp +35 -0
  35. package/dist/Form/StandardSchemaV1.ts +70 -0
  36. package/dist/Form/index.d.ts +117 -0
  37. package/dist/Form/index.js +22 -0
  38. package/dist/Form/index.js.map +1 -0
  39. package/dist/Menu/Menu.torp +12 -3
  40. package/dist/Menu/MenuButton.torp +14 -3
  41. package/dist/Menu/MenuCheck.torp +14 -3
  42. package/dist/Menu/MenuGroup.torp +13 -3
  43. package/dist/Menu/MenuIndicator.torp +12 -3
  44. package/dist/Menu/MenuPopout.torp +17 -6
  45. package/dist/Menu/MenuPopoutContent.torp +13 -4
  46. package/dist/Menu/MenuPopoutTrigger.torp +13 -4
  47. package/dist/Menu/MenuRadio.torp +16 -5
  48. package/dist/Menu/MenuRadioGroup.torp +16 -5
  49. package/dist/Menu/MenuSeparator.torp +11 -1
  50. package/dist/Menu/index.d.ts +170 -77
  51. package/dist/MenuBar/MenuBar.torp +13 -4
  52. package/dist/MenuBar/MenuBarItem.torp +17 -6
  53. package/dist/MenuBar/MenuBarItemContent.torp +13 -4
  54. package/dist/MenuBar/MenuBarItemTrigger.torp +11 -2
  55. package/dist/MenuBar/index.d.ts +79 -28
  56. package/dist/NavMenu/NavMenu.torp +13 -4
  57. package/dist/NavMenu/NavMenuButton.torp +12 -5
  58. package/dist/NavMenu/NavMenuElement.torp +14 -6
  59. package/dist/NavMenu/NavMenuGroup.torp +12 -3
  60. package/dist/NavMenu/NavMenuGroupHeader.torp +12 -4
  61. package/dist/NavMenu/NavMenuLink.torp +16 -8
  62. package/dist/NavMenu/NavMenuPopout.torp +11 -3
  63. package/dist/NavMenu/NavMenuPopoutButton.torp +14 -8
  64. package/dist/NavMenu/NavMenuPopoutContent.torp +13 -3
  65. package/dist/NavMenu/NavMenuSeparator.torp +10 -1
  66. package/dist/NavMenu/index.d.ts +147 -70
  67. package/dist/Notification/Notification.torp +15 -5
  68. package/dist/Notification/NotificationClose.torp +10 -1
  69. package/dist/Notification/NotificationContainer.torp +11 -1
  70. package/dist/Notification/NotificationContent.torp +11 -1
  71. package/dist/Notification/index.d.ts +46 -28
  72. package/dist/Popover/Popover.torp +20 -6
  73. package/dist/Popover/PopoverContent.torp +10 -1
  74. package/dist/Popover/PopoverContentAnchored.torp +13 -6
  75. package/dist/Popover/PopoverContentContextual.torp +10 -1
  76. package/dist/Popover/PopoverOverlay.torp +10 -1
  77. package/dist/Popover/PopoverTrigger.torp +10 -1
  78. package/dist/Popover/PopoverTriggerContextual.torp +10 -1
  79. package/dist/Popover/PopoverTriggerHover.torp +11 -2
  80. package/dist/Popover/index.d.ts +101 -56
  81. package/dist/TabGroup/TabContent.torp +11 -5
  82. package/dist/TabGroup/TabGroup.torp +21 -9
  83. package/dist/TabGroup/TabHeader.torp +14 -5
  84. package/dist/TabGroup/TabList.torp +13 -4
  85. package/dist/TabGroup/TabTrigger.torp +12 -4
  86. package/dist/TabGroup/index.d.ts +93 -35
  87. package/dist/icons/ArrowDown.torp +3 -3
  88. package/dist/icons/ArrowLeft.torp +3 -3
  89. package/dist/icons/ArrowRight.torp +3 -3
  90. package/dist/icons/ArrowUp.torp +3 -3
  91. package/dist/icons/Bars.torp +3 -3
  92. package/dist/icons/Check.torp +3 -3
  93. package/dist/icons/ChevronDown.torp +3 -3
  94. package/dist/icons/ChevronLeft.torp +3 -3
  95. package/dist/icons/ChevronRight.torp +3 -3
  96. package/dist/icons/ChevronUp.torp +3 -3
  97. package/dist/icons/Cross.torp +3 -3
  98. package/dist/icons/Loading.torp +3 -3
  99. package/dist/icons/Minus.torp +3 -3
  100. package/dist/icons/Plus.torp +3 -3
  101. package/dist/icons/index.d.ts +14 -126
  102. package/dist/metafile-esm.json +1 -1
  103. package/package.json +13 -4
  104. package/src/Accordion/Accordion.torp +23 -11
  105. package/src/Accordion/AccordionContent.torp +13 -6
  106. package/src/Accordion/AccordionHeader.torp +14 -5
  107. package/src/Accordion/AccordionItem.torp +22 -8
  108. package/src/Accordion/AccordionTrigger.torp +14 -6
  109. package/src/Accordion/AccordionTypes.ts +2 -0
  110. package/src/Breadcrumb/Breadcrumb.torp +12 -3
  111. package/src/Breadcrumb/BreadcrumbItem.torp +12 -3
  112. package/src/Breadcrumb/BreadcrumbSeparator.torp +10 -1
  113. package/src/Calendar/Calendar.torp +9 -1
  114. package/src/Calendar/CalendarDay.torp +9 -1
  115. package/src/Dialog/Dialog.torp +13 -3
  116. package/src/Dialog/DialogBody.torp +11 -3
  117. package/src/Dialog/DialogButton.torp +16 -4
  118. package/src/Dialog/DialogFooter.torp +11 -1
  119. package/src/Dialog/DialogHeader.torp +11 -2
  120. package/src/Disclosure/Disclosure.torp +17 -7
  121. package/src/Disclosure/DisclosureContent.torp +13 -6
  122. package/src/Disclosure/DisclosureHeader.torp +14 -5
  123. package/src/Disclosure/DisclosureTrigger.torp +10 -2
  124. package/src/Drawer/Drawer.torp +11 -1
  125. package/src/Form/Field.torp +93 -0
  126. package/src/Form/Form.torp +131 -0
  127. package/src/Form/FormTypes.ts +30 -0
  128. package/src/Form/Input.torp +94 -0
  129. package/src/Form/Label.torp +31 -0
  130. package/src/Form/Message.torp +35 -0
  131. package/src/Form/StandardSchemaV1.ts +70 -0
  132. package/src/Form/index.ts +7 -0
  133. package/src/Menu/Menu.torp +12 -3
  134. package/src/Menu/MenuButton.torp +14 -3
  135. package/src/Menu/MenuCheck.torp +14 -3
  136. package/src/Menu/MenuGroup.torp +13 -3
  137. package/src/Menu/MenuIndicator.torp +12 -3
  138. package/src/Menu/MenuPopout.torp +17 -6
  139. package/src/Menu/MenuPopoutContent.torp +13 -4
  140. package/src/Menu/MenuPopoutTrigger.torp +13 -4
  141. package/src/Menu/MenuRadio.torp +16 -5
  142. package/src/Menu/MenuRadioGroup.torp +16 -5
  143. package/src/Menu/MenuSeparator.torp +11 -1
  144. package/src/MenuBar/MenuBar.torp +13 -4
  145. package/src/MenuBar/MenuBarItem.torp +17 -6
  146. package/src/MenuBar/MenuBarItemContent.torp +13 -4
  147. package/src/MenuBar/MenuBarItemTrigger.torp +11 -2
  148. package/src/NavMenu/NavMenu.torp +13 -4
  149. package/src/NavMenu/NavMenuButton.torp +12 -5
  150. package/src/NavMenu/NavMenuElement.torp +14 -6
  151. package/src/NavMenu/NavMenuGroup.torp +12 -3
  152. package/src/NavMenu/NavMenuGroupHeader.torp +12 -4
  153. package/src/NavMenu/NavMenuLink.torp +16 -8
  154. package/src/NavMenu/NavMenuPopout.torp +11 -3
  155. package/src/NavMenu/NavMenuPopoutButton.torp +14 -8
  156. package/src/NavMenu/NavMenuPopoutContent.torp +13 -3
  157. package/src/NavMenu/NavMenuSeparator.torp +10 -1
  158. package/src/Notification/Notification.torp +15 -5
  159. package/src/Notification/NotificationClose.torp +10 -1
  160. package/src/Notification/NotificationContainer.torp +11 -1
  161. package/src/Notification/NotificationContent.torp +11 -1
  162. package/src/Popover/Popover.torp +20 -6
  163. package/src/Popover/PopoverContent.torp +10 -1
  164. package/src/Popover/PopoverContentAnchored.torp +13 -6
  165. package/src/Popover/PopoverContentContextual.torp +10 -1
  166. package/src/Popover/PopoverOverlay.torp +10 -1
  167. package/src/Popover/PopoverTrigger.torp +10 -1
  168. package/src/Popover/PopoverTriggerContextual.torp +10 -1
  169. package/src/Popover/PopoverTriggerHover.torp +11 -2
  170. package/src/TabGroup/TabContent.torp +11 -5
  171. package/src/TabGroup/TabGroup.torp +21 -9
  172. package/src/TabGroup/TabHeader.torp +14 -5
  173. package/src/TabGroup/TabList.torp +13 -4
  174. package/src/TabGroup/TabTrigger.torp +12 -4
  175. package/src/icons/ArrowDown.torp +3 -3
  176. package/src/icons/ArrowLeft.torp +3 -3
  177. package/src/icons/ArrowRight.torp +3 -3
  178. package/src/icons/ArrowUp.torp +3 -3
  179. package/src/icons/Bars.torp +3 -3
  180. package/src/icons/Check.torp +3 -3
  181. package/src/icons/ChevronDown.torp +3 -3
  182. package/src/icons/ChevronLeft.torp +3 -3
  183. package/src/icons/ChevronRight.torp +3 -3
  184. package/src/icons/ChevronUp.torp +3 -3
  185. package/src/icons/Cross.torp +3 -3
  186. package/src/icons/Loading.torp +3 -3
  187. package/src/icons/Minus.torp +3 -3
  188. package/src/icons/Plus.torp +3 -3
  189. package/test/Accordion/components/AccordionAccessibility.torp +2 -0
  190. package/test/Accordion/components/AccordionKeyboard.torp +2 -0
  191. package/test/Accordion/components/AccordionList.torp +2 -0
  192. package/test/Accordion/components/AccordionMultiple.torp +2 -0
  193. package/test/Accordion/components/AccordionSingle.torp +2 -0
  194. package/test/Disclosure/accessibility.test.ts +3 -2
  195. package/test/Disclosure/components/DisclosureTest.torp +2 -0
  196. package/test/Disclosure/toggle.test.ts +3 -2
  197. package/test/Form/components/FieldTest.torp +25 -0
  198. package/test/Form/components/FormTest.torp +31 -0
  199. package/test/Form/components/InputTest.torp +9 -0
  200. package/test/Form/field.test.ts +34 -0
  201. package/test/Form/form.test.ts +34 -0
  202. package/test/Form/input.test.ts +19 -0
  203. package/test/Menu/accessibility.test.ts +3 -2
  204. package/test/Menu/basic.test.ts +11 -10
  205. package/test/MenuBar/accessibility.test.ts +3 -2
  206. package/test/MenuBar/basic.test.ts +3 -2
  207. package/test/NavMenu/basic.test.ts +1 -1
  208. package/test/NavMenu/components/{NavMenu.torp → NavMenuBasic.torp} +1 -1
  209. package/test/TabGroup/components/TabGroupAccessibility.torp +2 -0
  210. package/test/TabGroup/components/TabGroupKeyboard.torp +2 -0
  211. package/test/TabGroup/components/TabGroupList.torp +2 -0
  212. package/test/TabGroup/components/TabGroupTrigger.torp +2 -0
  213. package/tsup.config.ts +1 -1
@@ -1,180 +1,257 @@
1
1
  import { type SlotRender } from "@torpor/view";
2
2
 
3
3
 
4
+ interface NavMenuProps {
5
+ /** An ID for the root element */
6
+ id?: string;
7
+ /** Class name(s) for the root element */
8
+ class?: string,
9
+ /** An ARIA label for describing the menu to screen readers */
10
+ ariaLabel?: string | undefined,
11
+ /** The orientation of the menu, which affects keyboard navigation */
12
+ orientation?: "horizontal" | "vertical",
13
+ }
14
+
4
15
  /**
5
- * Mounts or hydrates the component into the supplied parent node.
6
- * @param $parent -- The parent node.
7
- * @param $anchor -- The node to mount the component before.
8
- * @param $props -- The values that have been passed into the component as properties.
9
- * @param $context -- Values that have been passed into the component from its ancestors.
10
- * @param $slots -- Functions for rendering children into slot nodes within the component.
16
+ * A list of links for navigating a website.
17
+ *
18
+ * See [the WAI ARIA guidelines for Menus](https://www.w3.org/WAI/ARIA/apg/patterns/menu/).
19
+ *
20
+ * The structure of a NavMenu is:
21
+ *
22
+ * ```
23
+ * <NavMenu>
24
+ * <NavMenuLink />
25
+ * <NavMenuSeparator /> (optional)
26
+ * <NavMenuPopout /> (optional)
27
+ * ...
28
+ * </NavMenu>
29
+ * ```
11
30
  */
12
31
  declare function NavMenu(
13
32
  $parent: ParentNode,
14
33
  $anchor: Node | null,
15
- $props: any,
34
+ $props: NavMenuProps,
16
35
  $context?: Record<PropertyKey, any>,
17
36
  $slots?: Record<string, SlotRender>,
18
37
  ): void;
19
38
 
20
39
 
21
40
 
41
+ interface NavMenuButtonProps {
42
+ /** An ID for the root element */
43
+ id?: string;
44
+ /** Class name(s) for the root element */
45
+ class?: string,
46
+ /** Whether this button is disabled */
47
+ disabled?: boolean,
48
+ }
49
+
22
50
  /**
23
- * Mounts or hydrates the component into the supplied parent node.
24
- * @param $parent -- The parent node.
25
- * @param $anchor -- The node to mount the component before.
26
- * @param $props -- The values that have been passed into the component as properties.
27
- * @param $context -- Values that have been passed into the component from its ancestors.
28
- * @param $slots -- Functions for rendering children into slot nodes within the component.
51
+ * A button that is placed in a NavMenu to carry out a non-navigation action such as logging out.
52
+ *
29
53
  */
30
54
  declare function NavMenuButton(
31
55
  $parent: ParentNode,
32
56
  $anchor: Node | null,
33
- $props: any,
57
+ $props: NavMenuButtonProps,
34
58
  $context?: Record<PropertyKey, any>,
35
59
  $slots?: Record<string, SlotRender>,
36
60
  ): void;
37
61
 
38
62
 
39
63
 
64
+ interface NavMenuElementProps {
65
+ /** An ID for the root element */
66
+ id?: string;
67
+ /** Class name(s) for the root element */
68
+ class?: string,
69
+ /** Whether this button is disabled */
70
+ disabled?: boolean,
71
+ /** An element that can be focused via keyboard navigation */
72
+ element?: HTMLElement,
73
+ }
74
+
40
75
  /**
41
- * Mounts or hydrates the component into the supplied parent node.
42
- * @param $parent -- The parent node.
43
- * @param $anchor -- The node to mount the component before.
44
- * @param $props -- The values that have been passed into the component as properties.
45
- * @param $context -- Values that have been passed into the component from its ancestors.
46
- * @param $slots -- Functions for rendering children into slot nodes within the component.
76
+ * An element of any type that can be placed in a NavMenu.
77
+ *
47
78
  */
48
79
  declare function NavMenuElement(
49
80
  $parent: ParentNode,
50
81
  $anchor: Node | null,
51
- $props: any,
82
+ $props: NavMenuElementProps,
52
83
  $context?: Record<PropertyKey, any>,
53
84
  $slots?: Record<string, SlotRender>,
54
85
  ): void;
55
86
 
56
87
 
57
88
 
89
+ interface NavMenuGroupProps {
90
+ /** An ID for the root element */
91
+ id?: string;
92
+ /** Class name(s) for the root element */
93
+ class?: string,
94
+ /** An ARIA label for describing the group to screen readers */
95
+ ariaLabel?: string,
96
+ }
97
+
58
98
  /**
59
- * Mounts or hydrates the component into the supplied parent node.
60
- * @param $parent -- The parent node.
61
- * @param $anchor -- The node to mount the component before.
62
- * @param $props -- The values that have been passed into the component as properties.
63
- * @param $context -- Values that have been passed into the component from its ancestors.
64
- * @param $slots -- Functions for rendering children into slot nodes within the component.
99
+ * A container for a logical group of navigation menu items.
65
100
  */
66
101
  declare function NavMenuGroup(
67
102
  $parent: ParentNode,
68
103
  $anchor: Node | null,
69
- $props: any,
104
+ $props: NavMenuGroupProps,
70
105
  $context?: Record<PropertyKey, any>,
71
106
  $slots?: Record<string, SlotRender>,
72
107
  ): void;
73
108
 
74
109
 
75
110
 
111
+ interface NavMenuGroupHeaderProps {
112
+ /** An ID for the root element */
113
+ id?: string;
114
+ /** Class name(s) for the root element */
115
+ class?: string,
116
+ /** The type of HTML header to use */
117
+ as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6",
118
+ }
119
+
76
120
  /**
77
- * Mounts or hydrates the component into the supplied parent node.
78
- * @param $parent -- The parent node.
79
- * @param $anchor -- The node to mount the component before.
80
- * @param $props -- The values that have been passed into the component as properties.
81
- * @param $context -- Values that have been passed into the component from its ancestors.
82
- * @param $slots -- Functions for rendering children into slot nodes within the component.
121
+ * The header for a NavMenuGroup.
83
122
  */
84
123
  declare function NavMenuGroupHeader(
85
124
  $parent: ParentNode,
86
125
  $anchor: Node | null,
87
- $props: any,
126
+ $props: NavMenuGroupHeaderProps,
88
127
  $context?: Record<PropertyKey, any>,
89
128
  $slots?: Record<string, SlotRender>,
90
129
  ): void;
91
130
 
92
131
 
93
132
 
133
+ interface NavMenuLinkProps {
134
+ /** An ID for the root element */
135
+ id?: string;
136
+ /** Class name(s) for the root element */
137
+ class?: string,
138
+ /** The URL for the menu link */
139
+ href: string,
140
+ /** Whether the menu link should open in a new tab/window */
141
+ newWindow?: boolean,
142
+ /** Whether this link is disabled */
143
+ disabled?: boolean,
144
+ }
145
+
94
146
  /**
95
- * Mounts or hydrates the component into the supplied parent node.
96
- * @param $parent -- The parent node.
97
- * @param $anchor -- The node to mount the component before.
98
- * @param $props -- The values that have been passed into the component as properties.
99
- * @param $context -- Values that have been passed into the component from its ancestors.
100
- * @param $slots -- Functions for rendering children into slot nodes within the component.
147
+ * A link that is placed in a NavMenu and signals a response by a user.
148
+ *
101
149
  */
102
150
  declare function NavMenuLink(
103
151
  $parent: ParentNode,
104
152
  $anchor: Node | null,
105
- $props: any,
153
+ $props: NavMenuLinkProps,
106
154
  $context?: Record<PropertyKey, any>,
107
155
  $slots?: Record<string, SlotRender>,
108
156
  ): void;
109
157
 
110
158
 
111
159
 
160
+ interface NavMenuPopoutProps {
161
+ /** An ID for the root element */
162
+ id?: string;
163
+ /** Class name(s) for the root element */
164
+ class?: string,
165
+ /** Whether the popout is visible */
166
+ visible?: boolean,
167
+ }
168
+
112
169
  /**
113
- * Mounts or hydrates the component into the supplied parent node.
114
- * @param $parent -- The parent node.
115
- * @param $anchor -- The node to mount the component before.
116
- * @param $props -- The values that have been passed into the component as properties.
117
- * @param $context -- Values that have been passed into the component from its ancestors.
118
- * @param $slots -- Functions for rendering children into slot nodes within the component.
170
+ * A popout that is attached to a menu button and can be used to show a submenu.
171
+ *
172
+ * The structure of a NavMenuPopout is:
173
+ *
174
+ * ```
175
+ * <NavMenuPopout>
176
+ * <NavMenuPopoutButton />
177
+ * <NavMenuPopoutContent />
178
+ * </NavMenuPopout>
179
+ * ```
119
180
  */
120
181
  declare function NavMenuPopout(
121
182
  $parent: ParentNode,
122
183
  $anchor: Node | null,
123
- $props: any,
184
+ $props: NavMenuPopoutProps,
124
185
  $context?: Record<PropertyKey, any>,
125
186
  $slots?: Record<string, SlotRender>,
126
187
  ): void;
127
188
 
128
189
 
129
190
 
191
+ interface NavMenuPopoutButtonProps {
192
+ /** An ID for the root element */
193
+ id?: string;
194
+ /** Class name(s) for the root element */
195
+ class?: string,
196
+ /** The delay before showing the popout, in milliseconds */
197
+ hoverDelay?: number,
198
+ /** Whether this button is disabled */
199
+ disabled?: boolean,
200
+ }
201
+
130
202
  /**
131
- * Mounts or hydrates the component into the supplied parent node.
132
- * @param $parent -- The parent node.
133
- * @param $anchor -- The node to mount the component before.
134
- * @param $props -- The values that have been passed into the component as properties.
135
- * @param $context -- Values that have been passed into the component from its ancestors.
136
- * @param $slots -- Functions for rendering children into slot nodes within the component.
203
+ * A button that is placed in a NavMenu and signals a response by a user.
204
+ *
137
205
  */
138
206
  declare function NavMenuPopoutButton(
139
207
  $parent: ParentNode,
140
208
  $anchor: Node | null,
141
- $props: any,
209
+ $props: NavMenuPopoutButtonProps,
142
210
  $context?: Record<PropertyKey, any>,
143
211
  $slots?: Record<string, SlotRender>,
144
212
  ): void;
145
213
 
146
214
 
147
215
 
216
+ interface NavMenuPopoutContentProps {
217
+ /** An ID for the root element */
218
+ id?: string;
219
+ /** Class name(s) for the root element */
220
+ class?: string,
221
+ /** Where the popout will be shown, relative to the popout button */
222
+ side?: "top" | "right" | "bottom" | "left",
223
+ /** How the popout will be aligned, relative to the popout button */
224
+ alignment?: "start" | "center" | "end",
225
+ }
226
+
148
227
  /**
149
- * Mounts or hydrates the component into the supplied parent node.
150
- * @param $parent -- The parent node.
151
- * @param $anchor -- The node to mount the component before.
152
- * @param $props -- The values that have been passed into the component as properties.
153
- * @param $context -- Values that have been passed into the component from its ancestors.
154
- * @param $slots -- Functions for rendering children into slot nodes within the component.
228
+ * The content that is displayed for a NavMenuPopout when it is open.
229
+ *
155
230
  */
156
231
  declare function NavMenuPopoutContent(
157
232
  $parent: ParentNode,
158
233
  $anchor: Node | null,
159
- $props: any,
234
+ $props: NavMenuPopoutContentProps,
160
235
  $context?: Record<PropertyKey, any>,
161
236
  $slots?: Record<string, SlotRender>,
162
237
  ): void;
163
238
 
164
239
 
165
240
 
241
+ interface NavMenuSeparatorProps {
242
+ /** An ID for the root element */
243
+ id?: string;
244
+ /** Class name(s) for the root element */
245
+ class?: string,
246
+ }
247
+
166
248
  /**
167
- * Mounts or hydrates the component into the supplied parent node.
168
- * @param $parent -- The parent node.
169
- * @param $anchor -- The node to mount the component before.
170
- * @param $props -- The values that have been passed into the component as properties.
171
- * @param $context -- Values that have been passed into the component from its ancestors.
172
- * @param $slots -- Functions for rendering children into slot nodes within the component.
249
+ * An element in a menu that separates logical sets of menu items.
173
250
  */
174
251
  declare function NavMenuSeparator(
175
252
  $parent: ParentNode,
176
253
  $anchor: Node | null,
177
- $props: any,
254
+ $props: NavMenuSeparatorProps,
178
255
  $context?: Record<PropertyKey, any>,
179
256
  $slots?: Record<string, SlotRender>,
180
257
  ): void;
@@ -1,16 +1,26 @@
1
1
  import { NotificationContextName, type NotificationContext } from "./NotificationTypes";
2
2
 
3
+ interface NotificationProps {
4
+ /** An ID for the root element */
5
+ id?: string;
6
+ /** Class name(s) for the root element */
7
+ class?: string,
8
+ /** Whether the notification is visible */
9
+ visible?: boolean,
10
+ /** The duration, in milliseconds, to keep the notification visible */
11
+ duration?: number,
12
+ /** Raised when the notification has closed, either after the duration has elapsed, or when the user has pressed the close button */
13
+ onclose?: () => void,
14
+ }
15
+
3
16
  /**
4
17
  * An element that displays a brief, important message in a way that attracts
5
18
  * the user's attention without interrupting the user's task.
6
19
  *
7
20
  * See [the WAI ARIA guidelines for Alerts](https://www.w3.org/WAI/ARIA/apg/patterns/alert/).
8
- *
9
- * @prop {boolean} visible -- Whether the notification is visible
10
- * @prop {number | undefined} duration -- The duration, in milliseconds, to keep the notification visible
11
- * @prop {() => void} onclose -- Raised when the notification has closed, either after the duration has elapsed, or when the user has pressed the close button
12
21
  */
13
- export default function Notification($props) {
22
+ export default function Notification($props: NotificationProps) {
23
+ $props ??= $watch({});
14
24
  $props.visible ??= true;
15
25
  $props.duration ??= 5000;
16
26
 
@@ -1,9 +1,18 @@
1
1
  import { NotificationContextName, type NotificationContext } from "./NotificationTypes";
2
2
 
3
+ interface NotificationCloseProps {
4
+ /** An ID for the root element */
5
+ id?: string;
6
+ /** Class name(s) for the root element */
7
+ class?: string,
8
+ }
9
+
3
10
  /**
4
11
  * The button that a user can press to close this Notification.
5
12
  */
6
- export default function NotificationClose() {
13
+ export default function NotificationClose($props: NotificationCloseProps) {
14
+ $props ??= $watch({});
15
+
7
16
  // Get stuff out of the NotificationContext
8
17
  const context = $context[NotificationContextName] as NotificationContext;
9
18
  if (!context) {
@@ -1,8 +1,18 @@
1
+
2
+ interface NotificationContainerProps {
3
+ /** An ID for the root element */
4
+ id?: string;
5
+ /** Class name(s) for the root element */
6
+ class?: string,
7
+ }
8
+
1
9
  /**
2
10
  * The container for one or more Notifications, which can be used to position
3
11
  * the notifications inside the viewport.
4
12
  */
5
- export default function NotificationContainer() {
13
+ export default function NotificationContainer($props: NotificationContainerProps) {
14
+ $props ??= $watch({});
15
+
6
16
  @render {
7
17
  <div
8
18
  {$props.id}
@@ -1,7 +1,17 @@
1
+
2
+ interface NotificationContentProps {
3
+ /** An ID for the root element */
4
+ id?: string;
5
+ /** Class name(s) for the root element */
6
+ class?: string,
7
+ }
8
+
1
9
  /**
2
10
  * The content to display within a Notification.
3
11
  */
4
- export default function NotificationContent() {
12
+ export default function NotificationContent($props: NotificationContentProps) {
13
+ $props ??= $watch({});
14
+
5
15
  @render {
6
16
  <div
7
17
  {$props.id}
@@ -1,72 +1,90 @@
1
1
  import { type SlotRender } from "@torpor/view";
2
2
 
3
3
 
4
+ interface NotificationProps {
5
+ /** An ID for the root element */
6
+ id?: string;
7
+ /** Class name(s) for the root element */
8
+ class?: string,
9
+ /** Whether the notification is visible */
10
+ visible?: boolean,
11
+ /** The duration, in milliseconds, to keep the notification visible */
12
+ duration?: number,
13
+ /** Raised when the notification has closed, either after the duration has elapsed, or when the user has pressed the close button */
14
+ onclose?: () => void,
15
+ }
16
+
4
17
  /**
5
- * Mounts or hydrates the component into the supplied parent node.
6
- * @param $parent -- The parent node.
7
- * @param $anchor -- The node to mount the component before.
8
- * @param $props -- The values that have been passed into the component as properties.
9
- * @param $context -- Values that have been passed into the component from its ancestors.
10
- * @param $slots -- Functions for rendering children into slot nodes within the component.
18
+ * An element that displays a brief, important message in a way that attracts
19
+ * the user's attention without interrupting the user's task.
20
+ *
21
+ * See [the WAI ARIA guidelines for Alerts](https://www.w3.org/WAI/ARIA/apg/patterns/alert/).
11
22
  */
12
23
  declare function Notification(
13
24
  $parent: ParentNode,
14
25
  $anchor: Node | null,
15
- $props,
26
+ $props: NotificationProps,
16
27
  $context?: Record<PropertyKey, any>,
17
28
  $slots?: Record<string, SlotRender>,
18
29
  ): void;
19
30
 
20
31
 
21
32
 
33
+ interface NotificationCloseProps {
34
+ /** An ID for the root element */
35
+ id?: string;
36
+ /** Class name(s) for the root element */
37
+ class?: string,
38
+ }
39
+
22
40
  /**
23
- * Mounts or hydrates the component into the supplied parent node.
24
- * @param $parent -- The parent node.
25
- * @param $anchor -- The node to mount the component before.
26
- * @param $props -- The values that have been passed into the component as properties.
27
- * @param $context -- Values that have been passed into the component from its ancestors.
28
- * @param $slots -- Functions for rendering children into slot nodes within the component.
41
+ * The button that a user can press to close this Notification.
29
42
  */
30
43
  declare function NotificationClose(
31
44
  $parent: ParentNode,
32
45
  $anchor: Node | null,
33
- $props?: Record<PropertyKey, any>,
46
+ $props: NotificationCloseProps,
34
47
  $context?: Record<PropertyKey, any>,
35
48
  $slots?: Record<string, SlotRender>,
36
49
  ): void;
37
50
 
38
51
 
39
52
 
53
+ interface NotificationContainerProps {
54
+ /** An ID for the root element */
55
+ id?: string;
56
+ /** Class name(s) for the root element */
57
+ class?: string,
58
+ }
59
+
40
60
  /**
41
- * Mounts or hydrates the component into the supplied parent node.
42
- * @param $parent -- The parent node.
43
- * @param $anchor -- The node to mount the component before.
44
- * @param $props -- The values that have been passed into the component as properties.
45
- * @param $context -- Values that have been passed into the component from its ancestors.
46
- * @param $slots -- Functions for rendering children into slot nodes within the component.
61
+ * The container for one or more Notifications, which can be used to position
62
+ * the notifications inside the viewport.
47
63
  */
48
64
  declare function NotificationContainer(
49
65
  $parent: ParentNode,
50
66
  $anchor: Node | null,
51
- $props?: Record<PropertyKey, any>,
67
+ $props: NotificationContainerProps,
52
68
  $context?: Record<PropertyKey, any>,
53
69
  $slots?: Record<string, SlotRender>,
54
70
  ): void;
55
71
 
56
72
 
57
73
 
74
+ interface NotificationContentProps {
75
+ /** An ID for the root element */
76
+ id?: string;
77
+ /** Class name(s) for the root element */
78
+ class?: string,
79
+ }
80
+
58
81
  /**
59
- * Mounts or hydrates the component into the supplied parent node.
60
- * @param $parent -- The parent node.
61
- * @param $anchor -- The node to mount the component before.
62
- * @param $props -- The values that have been passed into the component as properties.
63
- * @param $context -- Values that have been passed into the component from its ancestors.
64
- * @param $slots -- Functions for rendering children into slot nodes within the component.
82
+ * The content to display within a Notification.
65
83
  */
66
84
  declare function NotificationContent(
67
85
  $parent: ParentNode,
68
86
  $anchor: Node | null,
69
- $props?: Record<PropertyKey, any>,
87
+ $props: NotificationContentProps,
70
88
  $context?: Record<PropertyKey, any>,
71
89
  $slots?: Record<string, SlotRender>,
72
90
  ): void;
@@ -1,5 +1,22 @@
1
1
  import { PopoverContextName, type Point, type PopoverContext, type PopoverState } from "./PopoverTypes";
2
2
 
3
+ interface PopoverProps {
4
+ /** An ID for the root element */
5
+ id?: string;
6
+ /** Class name(s) for the root element */
7
+ class?: string,
8
+ /** Whether the popover is modal. If true, an overlay should be supplied to obscure outside content, and only the popover content will be visible to screen readers */
9
+ modal?: boolean,
10
+ /** Whether the popover is visible */
11
+ visible?: boolean,
12
+ /** The element to anchor this popover to, as an alternative to supplying a PopoverTrigger */
13
+ anchor?: HTMLElement,
14
+ /** The position to display this popover at if it's contextual, as an alternative to supplying a PopoverTriggerContextual */
15
+ position?: Point,
16
+ /** A function to be called when the user selects a response */
17
+ callback?: ((value: any) => void),
18
+ }
19
+
3
20
  /**
4
21
  * A popover that can be used to show rich content or obtain information from a user.
5
22
  *
@@ -14,13 +31,10 @@ import { PopoverContextName, type Point, type PopoverContext, type PopoverState
14
31
  * <PopoverContent/PopoverContentAnchored/PopoverContentContextual />
15
32
  * </Popover>
16
33
  * ```
17
- * @prop {boolean} modal -- Whether the popover is modal. If true, an overlay should be supplied to obscure outside content, and only the popover content will be visible to screen readers
18
- * @prop {boolean} visible -- Whether the popover is visible
19
- * @prop {HTMLElement | undefined} anchor -- The element to anchor this popover to, as an alternative to supplying a PopoverTrigger
20
- * @prop {Point | undefined} position -- The position to display this popover at if it's contextual, as an alternative to supplying a PopoverTriggerContextual
21
- * @prop {((value: any) => void) | undefined} [callback] -- A function to be called when the user selects a response
22
34
  */
23
- export default function Popover($props: any) {
35
+ export default function Popover($props: PopoverProps) {
36
+ $props ??= $watch({});
37
+
24
38
  let $state: PopoverState = $watch({
25
39
  visible: false,
26
40
  position: { x: 0, y: 0 }
@@ -1,11 +1,20 @@
1
1
  import { addDocumentEvent, removeDocumentEvent } from "../utils/documentEvents";
2
2
  import { PopoverContextName, type PopoverContext } from "./PopoverTypes";
3
3
 
4
+ interface PopoverContentProps {
5
+ /** An ID for the root element */
6
+ id?: string;
7
+ /** Class name(s) for the root element */
8
+ class?: string,
9
+ }
10
+
4
11
  /**
5
12
  * The content that is displayed for a Popover when it is open, such as a Dialog
6
13
  * in the middle of the screen or a div that slides in from the side.
7
14
  */
8
- export default function PopoverContent($props: any) {
15
+ export default function PopoverContent($props: PopoverContentProps) {
16
+ $props ??= $watch({});
17
+
9
18
  let div: HTMLDivElement;
10
19
  let shown = false;
11
20
  let closeOnClick = false;
@@ -3,16 +3,23 @@ import getScrollParent from "../utils/getScrollParent";
3
3
  import setPopoverPosition from "../utils/setPopoverPosition";
4
4
  import { PopoverContextName, type PopoverContext } from "./PopoverTypes";
5
5
 
6
+ interface PopoverContentAnchoredProps {
7
+ /** An ID for the root element */
8
+ id?: string;
9
+ /** Class name(s) for the root element */
10
+ class?: string,
11
+ /** Where the popover will be shown, relative to the popover button */
12
+ side?: "top" | "right" | "bottom" | "left",
13
+ /** How the popover will be aligned, relative to the popover button */
14
+ alignment?: "start" | "center" | "end",
15
+ }
16
+
6
17
  /**
7
18
  * The content that is displayed for a Popover when it is open, displayed
8
19
  * alongside an element.
9
- *
10
- * @prop {"top" | "right" | "bottom" | "left"} site -- Where the popover will be
11
- * shown, relative to the popover button
12
- * @prop {"start" | "center" | "end"} alignment -- How the popover will be
13
- * aligned, relative to the popover button
14
20
  */
15
- export default function PopoverContentAnchored($props: any) {
21
+ export default function PopoverContentAnchored($props: PopoverContentAnchoredProps) {
22
+ $props ??= $watch({});
16
23
  $props.side ??= "bottom";
17
24
  $props.alignment ??= "center";
18
25
 
@@ -4,11 +4,20 @@ import getScrollParent from "../utils/getScrollParent";
4
4
  import setContextPosition from "../utils/setContextPosition";
5
5
  import { PopoverContextName, type PopoverContext } from "./PopoverTypes";
6
6
 
7
+ interface PopoverContentContextualProps {
8
+ /** An ID for the root element */
9
+ id?: string;
10
+ /** Class name(s) for the root element */
11
+ class?: string,
12
+ }
13
+
7
14
  /**
8
15
  * The content that is displayed for a Popover when it is open, displayed at the
9
16
  * position that the user right-clicked.
10
17
  */
11
- export default function PopoverContentContextual($props: any) {
18
+ export default function PopoverContentContextual($props: PopoverContentContextualProps) {
19
+ $props ??= $watch({});
20
+
12
21
  let div: HTMLDivElement;
13
22
  let shown = false;
14
23
  let closeOnClick = false;