@und-ui/react 0.0.0-stage → 0.1.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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -2
  3. package/dist/generated/index.d.ts +44 -0
  4. package/dist/generated/index.d.ts.map +1 -0
  5. package/dist/generated/index.js +45 -0
  6. package/dist/generated/index.js.map +1 -0
  7. package/dist/generated/jsx.d.ts +176 -0
  8. package/dist/generated/jsx.d.ts.map +1 -0
  9. package/dist/generated/jsx.js +2 -0
  10. package/dist/generated/jsx.js.map +1 -0
  11. package/dist/generated/shared.d.ts +20 -0
  12. package/dist/generated/shared.d.ts.map +1 -0
  13. package/dist/generated/shared.js +55 -0
  14. package/dist/generated/shared.js.map +1 -0
  15. package/dist/generated/und-accordion.d.ts +11 -0
  16. package/dist/generated/und-accordion.d.ts.map +1 -0
  17. package/dist/generated/und-accordion.js +11 -0
  18. package/dist/generated/und-accordion.js.map +1 -0
  19. package/dist/generated/und-alert.d.ts +20 -0
  20. package/dist/generated/und-alert.d.ts.map +1 -0
  21. package/dist/generated/und-alert.js +16 -0
  22. package/dist/generated/und-alert.js.map +1 -0
  23. package/dist/generated/und-avatar-group.d.ts +17 -0
  24. package/dist/generated/und-avatar-group.d.ts.map +1 -0
  25. package/dist/generated/und-avatar-group.js +11 -0
  26. package/dist/generated/und-avatar-group.js.map +1 -0
  27. package/dist/generated/und-avatar.d.ts +27 -0
  28. package/dist/generated/und-avatar.d.ts.map +1 -0
  29. package/dist/generated/und-avatar.js +11 -0
  30. package/dist/generated/und-avatar.js.map +1 -0
  31. package/dist/generated/und-badge.d.ts +17 -0
  32. package/dist/generated/und-badge.d.ts.map +1 -0
  33. package/dist/generated/und-badge.js +11 -0
  34. package/dist/generated/und-badge.js.map +1 -0
  35. package/dist/generated/und-breadcrumb-item.d.ts +13 -0
  36. package/dist/generated/und-breadcrumb-item.d.ts.map +1 -0
  37. package/dist/generated/und-breadcrumb-item.js +11 -0
  38. package/dist/generated/und-breadcrumb-item.js.map +1 -0
  39. package/dist/generated/und-breadcrumb.d.ts +11 -0
  40. package/dist/generated/und-breadcrumb.d.ts.map +1 -0
  41. package/dist/generated/und-breadcrumb.js +11 -0
  42. package/dist/generated/und-breadcrumb.js.map +1 -0
  43. package/dist/generated/und-button.d.ts +54 -0
  44. package/dist/generated/und-button.d.ts.map +1 -0
  45. package/dist/generated/und-button.js +16 -0
  46. package/dist/generated/und-button.js.map +1 -0
  47. package/dist/generated/und-card.d.ts +19 -0
  48. package/dist/generated/und-card.d.ts.map +1 -0
  49. package/dist/generated/und-card.js +11 -0
  50. package/dist/generated/und-card.js.map +1 -0
  51. package/dist/generated/und-checkbox.d.ts +36 -0
  52. package/dist/generated/und-checkbox.d.ts.map +1 -0
  53. package/dist/generated/und-checkbox.js +23 -0
  54. package/dist/generated/und-checkbox.js.map +1 -0
  55. package/dist/generated/und-combobox.d.ts +56 -0
  56. package/dist/generated/und-combobox.d.ts.map +1 -0
  57. package/dist/generated/und-combobox.js +25 -0
  58. package/dist/generated/und-combobox.js.map +1 -0
  59. package/dist/generated/und-dialog.d.ts +39 -0
  60. package/dist/generated/und-dialog.d.ts.map +1 -0
  61. package/dist/generated/und-dialog.js +18 -0
  62. package/dist/generated/und-dialog.js.map +1 -0
  63. package/dist/generated/und-divider.d.ts +13 -0
  64. package/dist/generated/und-divider.d.ts.map +1 -0
  65. package/dist/generated/und-divider.js +11 -0
  66. package/dist/generated/und-divider.js.map +1 -0
  67. package/dist/generated/und-drawer.d.ts +41 -0
  68. package/dist/generated/und-drawer.d.ts.map +1 -0
  69. package/dist/generated/und-drawer.js +18 -0
  70. package/dist/generated/und-drawer.js.map +1 -0
  71. package/dist/generated/und-form-field.d.ts +19 -0
  72. package/dist/generated/und-form-field.d.ts.map +1 -0
  73. package/dist/generated/und-form-field.js +11 -0
  74. package/dist/generated/und-form-field.js.map +1 -0
  75. package/dist/generated/und-icon-button.d.ts +54 -0
  76. package/dist/generated/und-icon-button.d.ts.map +1 -0
  77. package/dist/generated/und-icon-button.js +16 -0
  78. package/dist/generated/und-icon-button.js.map +1 -0
  79. package/dist/generated/und-link.d.ts +23 -0
  80. package/dist/generated/und-link.d.ts.map +1 -0
  81. package/dist/generated/und-link.js +11 -0
  82. package/dist/generated/und-link.js.map +1 -0
  83. package/dist/generated/und-menu-group.d.ts +11 -0
  84. package/dist/generated/und-menu-group.d.ts.map +1 -0
  85. package/dist/generated/und-menu-group.js +11 -0
  86. package/dist/generated/und-menu-group.js.map +1 -0
  87. package/dist/generated/und-menu-item.d.ts +21 -0
  88. package/dist/generated/und-menu-item.d.ts.map +1 -0
  89. package/dist/generated/und-menu-item.js +11 -0
  90. package/dist/generated/und-menu-item.js.map +1 -0
  91. package/dist/generated/und-menu-separator.d.ts +9 -0
  92. package/dist/generated/und-menu-separator.d.ts.map +1 -0
  93. package/dist/generated/und-menu-separator.js +11 -0
  94. package/dist/generated/und-menu-separator.js.map +1 -0
  95. package/dist/generated/und-menu.d.ts +25 -0
  96. package/dist/generated/und-menu.d.ts.map +1 -0
  97. package/dist/generated/und-menu.js +17 -0
  98. package/dist/generated/und-menu.js.map +1 -0
  99. package/dist/generated/und-pagination.d.ts +30 -0
  100. package/dist/generated/und-pagination.d.ts.map +1 -0
  101. package/dist/generated/und-pagination.js +16 -0
  102. package/dist/generated/und-pagination.js.map +1 -0
  103. package/dist/generated/und-popover.d.ts +31 -0
  104. package/dist/generated/und-popover.d.ts.map +1 -0
  105. package/dist/generated/und-popover.js +18 -0
  106. package/dist/generated/und-popover.js.map +1 -0
  107. package/dist/generated/und-progress.d.ts +23 -0
  108. package/dist/generated/und-progress.d.ts.map +1 -0
  109. package/dist/generated/und-progress.js +11 -0
  110. package/dist/generated/und-progress.js.map +1 -0
  111. package/dist/generated/und-radio-group.d.ts +32 -0
  112. package/dist/generated/und-radio-group.d.ts.map +1 -0
  113. package/dist/generated/und-radio-group.js +23 -0
  114. package/dist/generated/und-radio-group.js.map +1 -0
  115. package/dist/generated/und-radio.d.ts +19 -0
  116. package/dist/generated/und-radio.d.ts.map +1 -0
  117. package/dist/generated/und-radio.js +11 -0
  118. package/dist/generated/und-radio.js.map +1 -0
  119. package/dist/generated/und-select.d.ts +38 -0
  120. package/dist/generated/und-select.d.ts.map +1 -0
  121. package/dist/generated/und-select.js +24 -0
  122. package/dist/generated/und-select.js.map +1 -0
  123. package/dist/generated/und-skeleton.d.ts +13 -0
  124. package/dist/generated/und-skeleton.d.ts.map +1 -0
  125. package/dist/generated/und-skeleton.js +11 -0
  126. package/dist/generated/und-skeleton.js.map +1 -0
  127. package/dist/generated/und-slider.d.ts +50 -0
  128. package/dist/generated/und-slider.d.ts.map +1 -0
  129. package/dist/generated/und-slider.js +23 -0
  130. package/dist/generated/und-slider.js.map +1 -0
  131. package/dist/generated/und-spinner.d.ts +15 -0
  132. package/dist/generated/und-spinner.d.ts.map +1 -0
  133. package/dist/generated/und-spinner.js +11 -0
  134. package/dist/generated/und-spinner.js.map +1 -0
  135. package/dist/generated/und-switch.d.ts +34 -0
  136. package/dist/generated/und-switch.d.ts.map +1 -0
  137. package/dist/generated/und-switch.js +23 -0
  138. package/dist/generated/und-switch.js.map +1 -0
  139. package/dist/generated/und-tab-panel.d.ts +11 -0
  140. package/dist/generated/und-tab-panel.d.ts.map +1 -0
  141. package/dist/generated/und-tab-panel.js +11 -0
  142. package/dist/generated/und-tab-panel.js.map +1 -0
  143. package/dist/generated/und-tab.d.ts +15 -0
  144. package/dist/generated/und-tab.d.ts.map +1 -0
  145. package/dist/generated/und-tab.js +11 -0
  146. package/dist/generated/und-tab.js.map +1 -0
  147. package/dist/generated/und-table.d.ts +26 -0
  148. package/dist/generated/und-table.d.ts.map +1 -0
  149. package/dist/generated/und-table.js +16 -0
  150. package/dist/generated/und-table.js.map +1 -0
  151. package/dist/generated/und-tabs.d.ts +20 -0
  152. package/dist/generated/und-tabs.d.ts.map +1 -0
  153. package/dist/generated/und-tabs.js +16 -0
  154. package/dist/generated/und-tabs.js.map +1 -0
  155. package/dist/generated/und-text-field.d.ts +58 -0
  156. package/dist/generated/und-text-field.d.ts.map +1 -0
  157. package/dist/generated/und-text-field.js +23 -0
  158. package/dist/generated/und-text-field.js.map +1 -0
  159. package/dist/generated/und-textarea.d.ts +48 -0
  160. package/dist/generated/und-textarea.d.ts.map +1 -0
  161. package/dist/generated/und-textarea.js +23 -0
  162. package/dist/generated/und-textarea.js.map +1 -0
  163. package/dist/generated/und-toast.d.ts +26 -0
  164. package/dist/generated/und-toast.d.ts.map +1 -0
  165. package/dist/generated/und-toast.js +16 -0
  166. package/dist/generated/und-toast.js.map +1 -0
  167. package/dist/generated/und-toaster.d.ts +15 -0
  168. package/dist/generated/und-toaster.d.ts.map +1 -0
  169. package/dist/generated/und-toaster.js +11 -0
  170. package/dist/generated/und-toaster.js.map +1 -0
  171. package/dist/generated/und-tooltip.d.ts +29 -0
  172. package/dist/generated/und-tooltip.d.ts.map +1 -0
  173. package/dist/generated/und-tooltip.js +16 -0
  174. package/dist/generated/und-tooltip.js.map +1 -0
  175. package/dist/generated/und-visually-hidden.d.ts +11 -0
  176. package/dist/generated/und-visually-hidden.d.ts.map +1 -0
  177. package/dist/generated/und-visually-hidden.js +11 -0
  178. package/dist/generated/und-visually-hidden.js.map +1 -0
  179. package/dist/index.d.ts +2 -0
  180. package/dist/index.d.ts.map +1 -0
  181. package/dist/index.js +2 -0
  182. package/dist/index.js.map +1 -0
  183. package/package.json +61 -3
  184. package/src/generated/index.ts +46 -0
  185. package/src/generated/jsx.ts +166 -0
  186. package/src/generated/shared.ts +67 -0
  187. package/src/generated/und-accordion.ts +19 -0
  188. package/src/generated/und-alert.ts +32 -0
  189. package/src/generated/und-avatar-group.ts +25 -0
  190. package/src/generated/und-avatar.ts +35 -0
  191. package/src/generated/und-badge.ts +25 -0
  192. package/src/generated/und-breadcrumb-item.ts +21 -0
  193. package/src/generated/und-breadcrumb.ts +19 -0
  194. package/src/generated/und-button.ts +64 -0
  195. package/src/generated/und-card.ts +27 -0
  196. package/src/generated/und-checkbox.ts +55 -0
  197. package/src/generated/und-combobox.ts +77 -0
  198. package/src/generated/und-dialog.ts +50 -0
  199. package/src/generated/und-divider.ts +21 -0
  200. package/src/generated/und-drawer.ts +52 -0
  201. package/src/generated/und-form-field.ts +27 -0
  202. package/src/generated/und-icon-button.ts +64 -0
  203. package/src/generated/und-link.ts +31 -0
  204. package/src/generated/und-menu-group.ts +19 -0
  205. package/src/generated/und-menu-item.ts +29 -0
  206. package/src/generated/und-menu-separator.ts +17 -0
  207. package/src/generated/und-menu.ts +33 -0
  208. package/src/generated/und-pagination.ts +42 -0
  209. package/src/generated/und-popover.ts +42 -0
  210. package/src/generated/und-progress.ts +31 -0
  211. package/src/generated/und-radio-group.ts +51 -0
  212. package/src/generated/und-radio.ts +27 -0
  213. package/src/generated/und-select.ts +58 -0
  214. package/src/generated/und-skeleton.ts +21 -0
  215. package/src/generated/und-slider.ts +69 -0
  216. package/src/generated/und-spinner.ts +23 -0
  217. package/src/generated/und-switch.ts +53 -0
  218. package/src/generated/und-tab-panel.ts +19 -0
  219. package/src/generated/und-tab.ts +23 -0
  220. package/src/generated/und-table.ts +38 -0
  221. package/src/generated/und-tabs.ts +32 -0
  222. package/src/generated/und-text-field.ts +77 -0
  223. package/src/generated/und-textarea.ts +67 -0
  224. package/src/generated/und-toast.ts +36 -0
  225. package/src/generated/und-toaster.ts +23 -0
  226. package/src/generated/und-tooltip.ts +38 -0
  227. package/src/generated/und-visually-hidden.ts +19 -0
  228. package/src/index.ts +1 -0
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/icon-button.js';
7
+ import type { UndIconButton as UndIconButtonElement } from '@und-ui/core';
8
+ import { type UndEvent } from './shared.js';
9
+
10
+ export interface UndIconButtonProps
11
+ extends Omit<HTMLAttributes<UndIconButtonElement>, 'variant' | 'tone' | 'size' | 'type' | 'disabled' | 'disabledFocusable' | 'loading' | 'loadingLabel' | 'label' | 'name' | 'value' | 'fullWidth' | 'toggle' | 'pressed' | 'href' | 'target' | 'rel' | 'download' | 'command' | 'commandFor' | 'onUndPressedChange'> {
12
+ /** Visual style. */
13
+ variant?: UndIconButtonElement['variant'];
14
+ /** Color intent. */
15
+ tone?: UndIconButtonElement['tone'];
16
+ /** Size of the button. */
17
+ size?: UndIconButtonElement['size'];
18
+ /** Behaviour inside a form, as on a native button. Ignored in link mode. */
19
+ type?: UndIconButtonElement['type'];
20
+ /** Disables the button. It is removed from the tab order, as natively. */
21
+ disabled?: UndIconButtonElement['disabled'];
22
+ /** Blocks activation but keeps the button in the tab order (`aria-disabled="true"`), so it can be found and explain why it is unavailable. */
23
+ disabledFocusable?: UndIconButtonElement['disabledFocusable'];
24
+ /** Shows a spinner, sets `aria-busy` and blocks activation while keeping focus on the button. */
25
+ loading?: UndIconButtonElement['loading'];
26
+ /** Text announced through a polite live region when `loading` turns on. */
27
+ loadingLabel?: UndIconButtonElement['loadingLabel'];
28
+ /** Accessible name for icon-only buttons (forwarded as `aria-label` to the inner control). Prefer visible text when you can. */
29
+ label?: UndIconButtonElement['label'];
30
+ /** Name submitted with the form data when this button submits the form. */
31
+ name?: UndIconButtonElement['name'];
32
+ /** Value submitted with `name` when this button submits the form. */
33
+ value?: UndIconButtonElement['value'];
34
+ /** Stretches the button to the inline size of its container. */
35
+ fullWidth?: UndIconButtonElement['fullWidth'];
36
+ /** Makes it a toggle button: it exposes `aria-pressed` and flips `pressed` on activation, after a cancelable `und-pressed-change`. */
37
+ toggle?: UndIconButtonElement['toggle'];
38
+ /** Pressed state of a toggle button. Setting it also exposes `aria-pressed`. */
39
+ pressed?: UndIconButtonElement['pressed'];
40
+ /** Renders a native link (`<a href>`) styled as a button. Only http(s), mailto, tel and relative URLs are linked (opt in to more with `setAllowedUrlSchemes()`). */
41
+ href?: UndIconButtonElement['href'];
42
+ /** Link target (link mode). Any target other than `_self`, `_parent` or `_top` adds `rel="noopener noreferrer"`. */
43
+ target?: UndIconButtonElement['target'];
44
+ /** Link relationship (link mode). */
45
+ rel?: UndIconButtonElement['rel'];
46
+ /** Downloads the linked resource, optionally under this file name (link mode). */
47
+ download?: UndIconButtonElement['download'];
48
+ /** Invoker command run on the `commandfor` element: `show-modal`, `close`, `request-close`, `toggle-popover`, `show-popover`, `hide-popover` or a `--custom` command. */
49
+ command?: UndIconButtonElement['command'];
50
+ /** Id of the element that `command` acts on, looked up in the button's own tree (document or shadow root). */
51
+ commandFor?: UndIconButtonElement['commandFor'];
52
+ /** A toggle button is about to change its pressed state. Cancelable. */
53
+ onUndPressedChange?: (event: UndEvent<CustomEvent<{ pressed: boolean }>, UndIconButtonElement>) => void;
54
+ ref?: Ref<UndIconButtonElement>;
55
+ }
56
+
57
+ /** An icon-only button with a required accessible label. */
58
+ export function UndIconButton(props: UndIconButtonProps): ReactElement {
59
+ const { onUndPressedChange, ...rest } = props;
60
+ return createElement('und-icon-button', {
61
+ ...rest,
62
+ 'onund-pressed-change': onUndPressedChange,
63
+ });
64
+ }
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/link.js';
7
+ import type { UndLink as UndLinkElement } from '@und-ui/core';
8
+
9
+ export interface UndLinkProps
10
+ extends Omit<HTMLAttributes<UndLinkElement>, 'href' | 'target' | 'rel' | 'download' | 'variant' | 'underline' | 'newTabLabel'> {
11
+ /** Destination URL. Only http(s), mailto, tel and relative URLs are linked (opt in to more with `setAllowedUrlSchemes()`). */
12
+ href?: UndLinkElement['href'];
13
+ /** Browsing context. Any target other than `_self`, `_parent` or `_top` adds `rel="noopener noreferrer"`; `_blank` also adds an icon and a "(opens in new tab)" note for assistive technology. */
14
+ target?: UndLinkElement['target'];
15
+ /** Link relationship tokens. */
16
+ rel?: UndLinkElement['rel'];
17
+ /** Downloads the resource, optionally under this file name. */
18
+ download?: UndLinkElement['download'];
19
+ /** `inline` sits in running text and is always underlined; `standalone` is a link on its own line (underline on hover); `subtle` takes the surrounding text color. */
20
+ variant?: UndLinkElement['variant'];
21
+ /** Overrides the variant's underline. Inline links in body text should stay underlined (WCAG 1.4.1). */
22
+ underline?: UndLinkElement['underline'];
23
+ /** Text appended for assistive technology when `target="_blank"`. Localize it. */
24
+ newTabLabel?: UndLinkElement['newTabLabel'];
25
+ ref?: Ref<UndLinkElement>;
26
+ }
27
+
28
+ /** Navigates to another page or resource. */
29
+ export function UndLink(props: UndLinkProps): ReactElement {
30
+ return createElement('und-link', props);
31
+ }
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/menu-group.js';
7
+ import type { UndMenuGroup as UndMenuGroupElement } from '@und-ui/core';
8
+
9
+ export interface UndMenuGroupProps
10
+ extends Omit<HTMLAttributes<UndMenuGroupElement>, 'label'> {
11
+ /** The group label, shown above the items and used as the group's name. */
12
+ label?: UndMenuGroupElement['label'];
13
+ ref?: Ref<UndMenuGroupElement>;
14
+ }
15
+
16
+ /** A labelled group of menu items. */
17
+ export function UndMenuGroup(props: UndMenuGroupProps): ReactElement {
18
+ return createElement('und-menu-group', props);
19
+ }
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/menu-item.js';
7
+ import type { UndMenuItem as UndMenuItemElement } from '@und-ui/core';
8
+
9
+ export interface UndMenuItemProps
10
+ extends Omit<HTMLAttributes<UndMenuItemElement>, 'type' | 'value' | 'checked' | 'disabled' | 'name' | 'keepOpen'> {
11
+ /** `normal` runs a command; `checkbox` toggles; `radio` picks one of the items that share a `name` (or an `und-menu-group`). */
12
+ type?: UndMenuItemElement['type'];
13
+ /** Value reported by `und-select`. Defaults to the label text. */
14
+ value?: UndMenuItemElement['value'];
15
+ /** Checked state of checkbox and radio items. */
16
+ checked?: UndMenuItemElement['checked'];
17
+ /** Disables the item. Arrow keys skip it. */
18
+ disabled?: UndMenuItemElement['disabled'];
19
+ /** Radio group name (radio items only). */
20
+ name?: UndMenuItemElement['name'];
21
+ /** Keeps the menu open after a normal item is chosen. Checkbox and radio items always keep it open. */
22
+ keepOpen?: UndMenuItemElement['keepOpen'];
23
+ ref?: Ref<UndMenuItemElement>;
24
+ }
25
+
26
+ /** An item in a menu. */
27
+ export function UndMenuItem(props: UndMenuItemProps): ReactElement {
28
+ return createElement('und-menu-item', props);
29
+ }
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/menu-separator.js';
7
+ import type { UndMenuSeparator as UndMenuSeparatorElement } from '@und-ui/core';
8
+
9
+ export interface UndMenuSeparatorProps
10
+ extends Omit<HTMLAttributes<UndMenuSeparatorElement>, never> {
11
+ ref?: Ref<UndMenuSeparatorElement>;
12
+ }
13
+
14
+ /** A divider between menu items. */
15
+ export function UndMenuSeparator(props: UndMenuSeparatorProps): ReactElement {
16
+ return createElement('und-menu-separator', props);
17
+ }
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/menu.js';
7
+ import type { UndMenu as UndMenuElement } from '@und-ui/core';
8
+ import { type UndEvent } from './shared.js';
9
+
10
+ export interface UndMenuProps
11
+ extends Omit<HTMLAttributes<UndMenuElement>, 'open' | 'placement' | 'label' | 'onUndOpenChange' | 'onUndSelect'> {
12
+ /** Whether the menu is open. */
13
+ open?: UndMenuElement['open'];
14
+ /** Preferred position relative to the trigger; flips when there is no room. Submenus always open beside their item. */
15
+ placement?: UndMenuElement['placement'];
16
+ /** Accessible name of the menu. Defaults to the trigger's name. */
17
+ label?: UndMenuElement['label'];
18
+ /** The menu opened or closed. */
19
+ onUndOpenChange?: (event: UndEvent<CustomEvent<{ open: boolean }>, UndMenuElement>) => void;
20
+ /** An item was chosen (dispatched on the item, bubbles). Cancelable: `preventDefault()` keeps the menu open. */
21
+ onUndSelect?: (event: UndEvent<CustomEvent<{ value: string; checked: boolean }>, UndMenuElement>) => void;
22
+ ref?: Ref<UndMenuElement>;
23
+ }
24
+
25
+ /** A button that opens a menu of actions. */
26
+ export function UndMenu(props: UndMenuProps): ReactElement {
27
+ const { onUndOpenChange, onUndSelect, ...rest } = props;
28
+ return createElement('und-menu', {
29
+ ...rest,
30
+ 'onund-open-change': onUndOpenChange,
31
+ 'onund-select': onUndSelect,
32
+ });
33
+ }
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/pagination.js';
7
+ import type { UndPagination as UndPaginationElement } from '@und-ui/core';
8
+ import { type UndEvent } from './shared.js';
9
+
10
+ export interface UndPaginationProps
11
+ extends Omit<HTMLAttributes<UndPaginationElement>, 'page' | 'total' | 'siblings' | 'boundaries' | 'hrefTemplate' | 'label' | 'previousLabel' | 'nextLabel' | 'pageLabel' | 'onUndPageChange'> {
12
+ /** The current page (1-based). */
13
+ page?: UndPaginationElement['page'];
14
+ /** Number of pages. */
15
+ total?: UndPaginationElement['total'];
16
+ /** Pages shown on each side of the current page. */
17
+ siblings?: UndPaginationElement['siblings'];
18
+ /** Pages always shown at the start and the end. */
19
+ boundaries?: UndPaginationElement['boundaries'];
20
+ /** URL pattern for page links; `{page}` is replaced by the page number (for example `?page={page}`). Without it, pages are buttons. Only http(s), mailto, tel and relative URLs are linked (see `setAllowedUrlSchemes()`). */
21
+ hrefTemplate?: UndPaginationElement['hrefTemplate'];
22
+ /** Accessible name of the navigation landmark (localise it). */
23
+ label?: UndPaginationElement['label'];
24
+ /** Accessible name of the previous-page control (localise it). */
25
+ previousLabel?: UndPaginationElement['previousLabel'];
26
+ /** Accessible name of the next-page control (localise it). */
27
+ nextLabel?: UndPaginationElement['nextLabel'];
28
+ /** Accessible name of each page; `{page}` is replaced by the formatted number. */
29
+ pageLabel?: UndPaginationElement['pageLabel'];
30
+ /** Before the page changes. Cancelable: call `preventDefault()` to handle navigation yourself. */
31
+ onUndPageChange?: (event: UndEvent<CustomEvent<unknown>, UndPaginationElement>) => void;
32
+ ref?: Ref<UndPaginationElement>;
33
+ }
34
+
35
+ /** Moves between the pages of a long list. */
36
+ export function UndPagination(props: UndPaginationProps): ReactElement {
37
+ const { onUndPageChange, ...rest } = props;
38
+ return createElement('und-pagination', {
39
+ ...rest,
40
+ 'onund-page-change': onUndPageChange,
41
+ });
42
+ }
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/popover.js';
7
+ import type { UndPopover as UndPopoverElement } from '@und-ui/core';
8
+ import { type UndEvent } from './shared.js';
9
+
10
+ export interface UndPopoverProps
11
+ extends Omit<HTMLAttributes<UndPopoverElement>, 'open' | 'placement' | 'offset' | 'htmlFor' | 'mode' | 'label' | 'onUndOpenChange' | 'onUndAfterOpen' | 'onUndAfterClose'> {
12
+ /** Whether the popover is open. Mirrors the native popover state. */
13
+ open?: UndPopoverElement['open'];
14
+ /** Preferred side and alignment relative to the trigger. It flips when there is not enough room. `-start`/`-end` follow the text direction. */
15
+ placement?: UndPopoverElement['placement'];
16
+ /** Gap between the trigger and the popover, in pixels. */
17
+ offset?: UndPopoverElement['offset'];
18
+ /** Id of the trigger in the same tree. The trigger becomes a native popover invoker (it toggles the popover and exposes `aria-expanded`). Without it, the first `[popovertarget]` or `[commandfor]` pointing at the popover is used. */
19
+ htmlFor?: UndPopoverElement['htmlFor'];
20
+ /** `auto` (default): light dismiss (Escape, outside click) and one auto popover open at a time. `manual`: only explicit actions open and close it. */
21
+ mode?: UndPopoverElement['mode'];
22
+ /** Accessible name of the popover (it is exposed as a non-modal dialog). */
23
+ label?: UndPopoverElement['label'];
24
+ /** The popover is about to open or close. Cancelable only when opening. */
25
+ onUndOpenChange?: (event: UndEvent<CustomEvent<{ open: boolean; reason: string }>, UndPopoverElement>) => void;
26
+ /** The popover opened and its entry animation finished. */
27
+ onUndAfterOpen?: (event: UndEvent<CustomEvent<undefined>, UndPopoverElement>) => void;
28
+ /** The popover closed and its exit animation finished. */
29
+ onUndAfterClose?: (event: UndEvent<CustomEvent<undefined>, UndPopoverElement>) => void;
30
+ ref?: Ref<UndPopoverElement>;
31
+ }
32
+
33
+ /** A floating panel anchored to a trigger. */
34
+ export function UndPopover(props: UndPopoverProps): ReactElement {
35
+ const { onUndOpenChange, onUndAfterOpen, onUndAfterClose, ...rest } = props;
36
+ return createElement('und-popover', {
37
+ ...rest,
38
+ 'onund-open-change': onUndOpenChange,
39
+ 'onund-after-open': onUndAfterOpen,
40
+ 'onund-after-close': onUndAfterClose,
41
+ });
42
+ }
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/progress.js';
7
+ import type { UndProgress as UndProgressElement } from '@und-ui/core';
8
+
9
+ export interface UndProgressProps
10
+ extends Omit<HTMLAttributes<UndProgressElement>, 'value' | 'max' | 'variant' | 'tone' | 'size' | 'label' | 'valueText'> {
11
+ /** Current value, from 0 to `max`. Leave it unset for an indeterminate indicator. */
12
+ value?: UndProgressElement['value'];
13
+ /** Value at completion. */
14
+ max?: UndProgressElement['max'];
15
+ /** A horizontal bar or a ring. */
16
+ variant?: UndProgressElement['variant'];
17
+ /** Color intent of the indicator. */
18
+ tone?: UndProgressElement['tone'];
19
+ /** Thickness (linear) or diameter (circular). */
20
+ size?: UndProgressElement['size'];
21
+ /** Accessible name, such as "Uploading photo". Required. */
22
+ label?: UndProgressElement['label'];
23
+ /** Overrides the spoken value, such as "3 of 10 files". */
24
+ valueText?: UndProgressElement['valueText'];
25
+ ref?: Ref<UndProgressElement>;
26
+ }
27
+
28
+ /** Determinate or indeterminate progress, as a bar or a ring. */
29
+ export function UndProgress(props: UndProgressProps): ReactElement {
30
+ return createElement('und-progress', props);
31
+ }
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/radio-group.js';
7
+ import type { UndRadioGroup as UndRadioGroupElement } from '@und-ui/core';
8
+ import { useControlledProp, type UndEvent } from './shared.js';
9
+
10
+ export interface UndRadioGroupProps
11
+ extends Omit<HTMLAttributes<UndRadioGroupElement>, 'label' | 'description' | 'error' | 'value' | 'defaultValue' | 'name' | 'required' | 'disabled' | 'orientation' | 'onInput' | 'onChange'> {
12
+ /** Visible group label (referenced by `aria-labelledby`). */
13
+ label?: UndRadioGroupElement['label'];
14
+ /** Help text for the group, referenced by `aria-describedby`. */
15
+ description?: UndRadioGroupElement['description'];
16
+ /** Error message for the group. Setting it marks the group invalid. */
17
+ error?: UndRadioGroupElement['error'];
18
+ /** Value of the checked option (`''` when none is checked). */
19
+ value?: UndRadioGroupElement['value'];
20
+ /** Value checked after a form reset (defaults to the initial value). */
21
+ defaultValue?: UndRadioGroupElement['defaultValue'];
22
+ /** Name shared by the options and submitted with the form data. */
23
+ name?: UndRadioGroupElement['name'];
24
+ /** Requires a choice before the form submits. */
25
+ required?: UndRadioGroupElement['required'];
26
+ /** Disables every option. */
27
+ disabled?: UndRadioGroupElement['disabled'];
28
+ /** Layout of the options. Arrow keys work in both directions either way. */
29
+ orientation?: UndRadioGroupElement['orientation'];
30
+ /** Native `input` from the option that became checked. */
31
+ onInput?: (event: UndEvent<InputEvent, UndRadioGroupElement>) => void;
32
+ /** Native `change` from the option that became checked (`event.target.value` is the new value). */
33
+ onChange?: (event: UndEvent<Event, UndRadioGroupElement>) => void;
34
+ ref?: Ref<UndRadioGroupElement>;
35
+ }
36
+
37
+ /** A labelled group of radio options with description and error. */
38
+ export function UndRadioGroup(props: UndRadioGroupProps): ReactElement {
39
+ const { onInput, onChange, ref, ...rest } = props;
40
+ // Controlled when `value` is set: a change the handler rejects is undone.
41
+ const controlled = useControlledProp<UndRadioGroupElement, 'value'>('value', props.value, ref);
42
+ return createElement('und-radio-group', {
43
+ ...rest,
44
+ ref: controlled.ref,
45
+ 'oninput': (event: UndEvent<InputEvent, UndRadioGroupElement>) => {
46
+ onInput?.(event);
47
+ controlled.settle();
48
+ },
49
+ 'onchange': onChange,
50
+ });
51
+ }
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/radio.js';
7
+ import type { UndRadio as UndRadioElement } from '@und-ui/core';
8
+
9
+ export interface UndRadioProps
10
+ extends Omit<HTMLAttributes<UndRadioElement>, 'value' | 'label' | 'description' | 'checked' | 'disabled'> {
11
+ /** Value submitted, and the group's `value`, when this option is checked. */
12
+ value?: UndRadioElement['value'];
13
+ /** Visible label text (or pass the label as children). */
14
+ label?: UndRadioElement['label'];
15
+ /** Help text under the option label. */
16
+ description?: UndRadioElement['description'];
17
+ /** Whether this option is checked. The group keeps it in sync; as an attribute it marks the option checked by default. */
18
+ checked?: UndRadioElement['checked'];
19
+ /** Disables this option only. */
20
+ disabled?: UndRadioElement['disabled'];
21
+ ref?: Ref<UndRadioElement>;
22
+ }
23
+
24
+ /** One option of a radio group. */
25
+ export function UndRadio(props: UndRadioProps): ReactElement {
26
+ return createElement('und-radio', props);
27
+ }
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/select.js';
7
+ import type { UndSelect as UndSelectElement } from '@und-ui/core';
8
+ import { useControlledProp, type UndEvent } from './shared.js';
9
+
10
+ export interface UndSelectProps
11
+ extends Omit<HTMLAttributes<UndSelectElement>, 'mode' | 'size' | 'label' | 'description' | 'error' | 'placeholder' | 'name' | 'disabled' | 'required' | 'open' | 'value' | 'onInput' | 'onChange' | 'onUndOpenChange'> {
12
+ /** `auto` chooses per browser; `native` always keeps the native select; `custom` always renders the ARIA listbox. */
13
+ mode?: UndSelectElement['mode'];
14
+ /** Size of the control. */
15
+ size?: UndSelectElement['size'];
16
+ /** Visible label text, shown above the select as on `und-text-field`. It is also the accessible name; a `<label for>` on the inner select, `aria-labelledby` or `aria-label` works too. */
17
+ label?: UndSelectElement['label'];
18
+ /** Help text under the label, announced as the select's description. */
19
+ description?: UndSelectElement['description'];
20
+ /** Error message. Marks the select invalid (`aria-invalid`, a custom validity error) and shows the message, prefixed with a visually hidden "Error:". A native "required" message also shows after a failed submit. */
21
+ error?: UndSelectElement['error'];
22
+ /** Text shown in the custom trigger while the value is empty. */
23
+ placeholder?: UndSelectElement['placeholder'];
24
+ /** Form field name in custom mode. Defaults to the inner select's `name`. */
25
+ name?: UndSelectElement['name'];
26
+ /** Disables the control. */
27
+ disabled?: UndSelectElement['disabled'];
28
+ /** Requires a non-empty value (the inner select's `required` also counts). */
29
+ required?: UndSelectElement['required'];
30
+ /** Whether the custom listbox is open. */
31
+ open?: UndSelectElement['open'];
32
+ /** The current value: the `value` of the selected option. */
33
+ value?: UndSelectElement['value'];
34
+ /** The user picked a different option (custom mode). */
35
+ onInput?: (event: UndEvent<Event, UndSelectElement>) => void;
36
+ /** The user picked a different option (custom mode; in native mode the native `change` bubbles from the select). */
37
+ onChange?: (event: UndEvent<Event, UndSelectElement>) => void;
38
+ /** The custom listbox opened or closed. */
39
+ onUndOpenChange?: (event: UndEvent<CustomEvent<unknown>, UndSelectElement>) => void;
40
+ ref?: Ref<UndSelectElement>;
41
+ }
42
+
43
+ /** Chooses one option from a list. */
44
+ export function UndSelect(props: UndSelectProps): ReactElement {
45
+ const { onInput, onChange, onUndOpenChange, ref, ...rest } = props;
46
+ // Controlled when `value` is set: a change the handler rejects is undone.
47
+ const controlled = useControlledProp<UndSelectElement, 'value'>('value', props.value, ref);
48
+ return createElement('und-select', {
49
+ ...rest,
50
+ ref: controlled.ref,
51
+ 'oninput': (event: UndEvent<Event, UndSelectElement>) => {
52
+ onInput?.(event);
53
+ controlled.settle();
54
+ },
55
+ 'onchange': onChange,
56
+ 'onund-open-change': onUndOpenChange,
57
+ });
58
+ }
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/skeleton.js';
7
+ import type { UndSkeleton as UndSkeletonElement } from '@und-ui/core';
8
+
9
+ export interface UndSkeletonProps
10
+ extends Omit<HTMLAttributes<UndSkeletonElement>, 'shape' | 'lines'> {
11
+ /** Placeholder shape. */
12
+ shape?: UndSkeletonElement['shape'];
13
+ /** Number of text lines (`text` shape). The last of several lines is shorter. */
14
+ lines?: UndSkeletonElement['lines'];
15
+ ref?: Ref<UndSkeletonElement>;
16
+ }
17
+
18
+ /** Placeholder shapes for loading content. */
19
+ export function UndSkeleton(props: UndSkeletonProps): ReactElement {
20
+ return createElement('und-skeleton', props);
21
+ }
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/slider.js';
7
+ import type { UndSlider as UndSliderElement } from '@und-ui/core';
8
+ import { useControlledProp, type UndEvent } from './shared.js';
9
+
10
+ export interface UndSliderProps
11
+ extends Omit<HTMLAttributes<UndSliderElement>, 'value' | 'valueEnd' | 'min' | 'max' | 'step' | 'largeStep' | 'range' | 'startLabel' | 'endLabel' | 'formatOptions' | 'valueText' | 'label' | 'description' | 'error' | 'required' | 'optional' | 'disabled' | 'name' | 'onInput' | 'onChange'> {
12
+ /** The value (single mode) or the start of the range (range mode). */
13
+ value?: UndSliderElement['value'];
14
+ /** The end of the range (range mode). Defaults to `max`. */
15
+ valueEnd?: UndSliderElement['valueEnd'];
16
+ /** Smallest value. */
17
+ min?: UndSliderElement['min'];
18
+ /** Largest value. */
19
+ max?: UndSliderElement['max'];
20
+ /** Granularity of the value (arrow keys move one step). */
21
+ step?: UndSliderElement['step'];
22
+ /** Step for PageUp/PageDown. Defaults to 10% of the range, rounded to `step`. */
23
+ largeStep?: UndSliderElement['largeStep'];
24
+ /** Two thumbs: `value` is the start and `value-end` the end of the range. */
25
+ range?: UndSliderElement['range'];
26
+ /** Accessible name suffix of the start thumb in range mode. */
27
+ startLabel?: UndSliderElement['startLabel'];
28
+ /** Accessible name suffix of the end thumb in range mode. */
29
+ endLabel?: UndSliderElement['endLabel'];
30
+ /** `Intl.NumberFormat` options for `aria-valuetext`, in the element's language, for example `{ style: 'currency', currency: 'INR' }` gives "₹1,50,000" in `en-IN`. */
31
+ formatOptions?: UndSliderElement['formatOptions'];
32
+ /** Custom `aria-valuetext` formatter; wins over `formatOptions`. */
33
+ valueText?: UndSliderElement['valueText'];
34
+ /** Visible label text. Rich content (links) can be passed as children instead on choice controls. */
35
+ label?: UndSliderElement['label'];
36
+ /** Help text under the label, referenced by `aria-describedby`. */
37
+ description?: UndSliderElement['description'];
38
+ /** Error message. Setting it marks the control invalid (`aria-invalid`, `setCustomValidity`) and shows the message, prefixed with a visually hidden "Error:". Native validation messages are shown automatically after a failed submit and cleared once the value is valid. */
39
+ error?: UndSliderElement['error'];
40
+ /** Requires a value before the form submits (native constraint validation). */
41
+ required?: UndSliderElement['required'];
42
+ /** Shows an "(optional)" marker after the label (GOV.UK style). Ignored when `required` is set. */
43
+ optional?: UndSliderElement['optional'];
44
+ /** Disables the control. A disabled ancestor `<fieldset>` also disables it. */
45
+ disabled?: UndSliderElement['disabled'];
46
+ /** Name submitted with the form data. */
47
+ name?: UndSliderElement['name'];
48
+ /** Native `input` from the moving thumb, continuously while it moves. */
49
+ onInput?: (event: UndEvent<InputEvent, UndSliderElement>) => void;
50
+ /** Native `change` when the user commits a value. */
51
+ onChange?: (event: UndEvent<Event, UndSliderElement>) => void;
52
+ ref?: Ref<UndSliderElement>;
53
+ }
54
+
55
+ /** A slider for a value or a range, with Intl-formatted value text. */
56
+ export function UndSlider(props: UndSliderProps): ReactElement {
57
+ const { onInput, onChange, ref, ...rest } = props;
58
+ // Controlled when `value` is set: a change the handler rejects is undone.
59
+ const controlled = useControlledProp<UndSliderElement, 'value'>('value', props.value, ref);
60
+ return createElement('und-slider', {
61
+ ...rest,
62
+ ref: controlled.ref,
63
+ 'oninput': (event: UndEvent<InputEvent, UndSliderElement>) => {
64
+ onInput?.(event);
65
+ controlled.settle();
66
+ },
67
+ 'onchange': onChange,
68
+ });
69
+ }
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/spinner.js';
7
+ import type { UndSpinner as UndSpinnerElement } from '@und-ui/core';
8
+
9
+ export interface UndSpinnerProps
10
+ extends Omit<HTMLAttributes<UndSpinnerElement>, 'size' | 'label' | 'decorative'> {
11
+ /** Size of the spinner. */
12
+ size?: UndSpinnerElement['size'];
13
+ /** Accessible name. Localize it. */
14
+ label?: UndSpinnerElement['label'];
15
+ /** Hides the spinner from assistive technology, for places that already expose the busy state (a loading button, an `aria-busy` region). */
16
+ decorative?: UndSpinnerElement['decorative'];
17
+ ref?: Ref<UndSpinnerElement>;
18
+ }
19
+
20
+ /** Shows that something is loading. */
21
+ export function UndSpinner(props: UndSpinnerProps): ReactElement {
22
+ return createElement('und-spinner', props);
23
+ }
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ // GENERATED FILE. DO NOT EDIT.
3
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
4
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
5
+ import { createElement, type HTMLAttributes, type ReactElement, type Ref } from 'react';
6
+ import '@und-ui/core/switch.js';
7
+ import type { UndSwitch as UndSwitchElement } from '@und-ui/core';
8
+ import { useControlledProp, type UndEvent } from './shared.js';
9
+
10
+ export interface UndSwitchProps
11
+ extends Omit<HTMLAttributes<UndSwitchElement>, 'checked' | 'defaultChecked' | 'value' | 'label' | 'description' | 'error' | 'required' | 'optional' | 'disabled' | 'name' | 'onInput' | 'onChange'> {
12
+ /** Whether the control is checked. The `checked` attribute also sets the default restored by a form reset, as on a native checkbox. */
13
+ checked?: UndSwitchElement['checked'];
14
+ /** Checked state restored on form reset (defaults to the initial `checked`). */
15
+ defaultChecked?: UndSwitchElement['defaultChecked'];
16
+ /** Value submitted with `name` when checked. */
17
+ value?: UndSwitchElement['value'];
18
+ /** Visible label text. Rich content (links) can be passed as children instead on choice controls. */
19
+ label?: UndSwitchElement['label'];
20
+ /** Help text under the label, referenced by `aria-describedby`. */
21
+ description?: UndSwitchElement['description'];
22
+ /** Error message. Setting it marks the control invalid (`aria-invalid`, `setCustomValidity`) and shows the message, prefixed with a visually hidden "Error:". Native validation messages are shown automatically after a failed submit and cleared once the value is valid. */
23
+ error?: UndSwitchElement['error'];
24
+ /** Requires a value before the form submits (native constraint validation). */
25
+ required?: UndSwitchElement['required'];
26
+ /** Shows an "(optional)" marker after the label (GOV.UK style). Ignored when `required` is set. */
27
+ optional?: UndSwitchElement['optional'];
28
+ /** Disables the control. A disabled ancestor `<fieldset>` also disables it. */
29
+ disabled?: UndSwitchElement['disabled'];
30
+ /** Name submitted with the form data. */
31
+ name?: UndSwitchElement['name'];
32
+ /** Native `input` from the inner switch input. */
33
+ onInput?: (event: UndEvent<InputEvent, UndSwitchElement>) => void;
34
+ /** Native `change` after the user toggles the switch. */
35
+ onChange?: (event: UndEvent<Event, UndSwitchElement>) => void;
36
+ ref?: Ref<UndSwitchElement>;
37
+ }
38
+
39
+ /** An on/off switch with label, description and error. */
40
+ export function UndSwitch(props: UndSwitchProps): ReactElement {
41
+ const { onInput, onChange, ref, ...rest } = props;
42
+ // Controlled when `checked` is set: a change the handler rejects is undone.
43
+ const controlled = useControlledProp<UndSwitchElement, 'checked'>('checked', props.checked, ref);
44
+ return createElement('und-switch', {
45
+ ...rest,
46
+ ref: controlled.ref,
47
+ 'oninput': onInput,
48
+ 'onchange': (event: UndEvent<Event, UndSwitchElement>) => {
49
+ onChange?.(event);
50
+ controlled.settle();
51
+ },
52
+ });
53
+ }