@igne-agency/react-web-ui 0.5.0 → 0.6.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 (254) hide show
  1. package/dist/components/accordion/accordion.css +21 -21
  2. package/dist/components/accordion/accordion.d.ts +17 -4
  3. package/dist/components/accordion/accordion.js +83 -36
  4. package/dist/components/accordion/accordion.module.js +6 -6
  5. package/dist/components/attachment-tile/attachment-preview.d.ts +56 -13
  6. package/dist/components/attachment-tile/attachment-preview.js +388 -119
  7. package/dist/components/attachment-tile/attachment-tile.css +31 -25
  8. package/dist/components/attachment-tile/attachment-tile.d.ts +32 -10
  9. package/dist/components/attachment-tile/attachment-tile.js +160 -43
  10. package/dist/components/attachment-tile/attachment-tile.module.js +8 -8
  11. package/dist/components/attachment-tile/index.d.ts +1 -1
  12. package/dist/components/avatar/avatar.css +9 -9
  13. package/dist/components/avatar/avatar.d.ts +50 -5
  14. package/dist/components/avatar/avatar.js +178 -64
  15. package/dist/components/avatar/avatar.module.js +3 -3
  16. package/dist/components/avatar-group/avatar-group-context.d.ts +2 -4
  17. package/dist/components/avatar-group/avatar-group-context.js +2 -2
  18. package/dist/components/avatar-group/avatar-group.css +26 -20
  19. package/dist/components/avatar-group/avatar-group.d.ts +85 -27
  20. package/dist/components/avatar-group/avatar-group.js +400 -246
  21. package/dist/components/avatar-group/avatar-group.module.js +8 -8
  22. package/dist/components/breadcrumbs/breadcrumbs.css +12 -12
  23. package/dist/components/breadcrumbs/breadcrumbs.d.ts +69 -23
  24. package/dist/components/breadcrumbs/breadcrumbs.js +299 -248
  25. package/dist/components/breadcrumbs/breadcrumbs.module.js +8 -8
  26. package/dist/components/button/button.css +29 -31
  27. package/dist/components/button/button.d.ts +20 -16
  28. package/dist/components/button/button.js +140 -145
  29. package/dist/components/button/button.module.js +1 -1
  30. package/dist/components/button/index.js +1 -1
  31. package/dist/components/checkbox-field/checkbox-field.js +63 -49
  32. package/dist/components/checkbox-field/checkbox.css +105 -56
  33. package/dist/components/checkbox-field/checkbox.d.ts +3 -2
  34. package/dist/components/checkbox-field/checkbox.js +12 -9
  35. package/dist/components/checkbox-field/checkbox.module.js +4 -4
  36. package/dist/components/checkbox-group-field/checkbox-group-field.js +78 -72
  37. package/dist/components/checkbox-group-field/checkbox-group.css +14 -10
  38. package/dist/components/checkbox-group-field/checkbox-group.d.ts +2 -2
  39. package/dist/components/checkbox-group-field/checkbox-group.js +2 -2
  40. package/dist/components/checkbox-group-field/checkbox-group.module.js +2 -2
  41. package/dist/components/collapsible/collapsible.css +20 -20
  42. package/dist/components/collapsible/collapsible.d.ts +17 -4
  43. package/dist/components/collapsible/collapsible.js +83 -36
  44. package/dist/components/collapsible/collapsible.module.js +5 -5
  45. package/dist/components/combobox-field/combobox-field.js +206 -158
  46. package/dist/components/combobox-field/combobox.css +492 -277
  47. package/dist/components/combobox-field/combobox.d.ts +148 -39
  48. package/dist/components/combobox-field/combobox.js +506 -206
  49. package/dist/components/combobox-field/combobox.module.js +21 -21
  50. package/dist/components/combobox-field/value-state-view.css +5 -5
  51. package/dist/components/combobox-field/value-state-view.module.js +4 -4
  52. package/dist/components/composer/composer-attachments.d.ts +30 -11
  53. package/dist/components/composer/composer-attachments.js +45 -40
  54. package/dist/components/composer/composer-editor.css +40 -35
  55. package/dist/components/composer/composer-editor.d.ts +14 -4
  56. package/dist/components/composer/composer-editor.js +134 -44
  57. package/dist/components/composer/composer-editor.module.js +5 -5
  58. package/dist/components/composer/composer.css +22 -22
  59. package/dist/components/composer/composer.d.ts +13 -2
  60. package/dist/components/composer/composer.js +78 -63
  61. package/dist/components/composer/composer.module.js +5 -5
  62. package/dist/components/composer/index.d.ts +2 -2
  63. package/dist/components/composer/mention-text.css +5 -5
  64. package/dist/components/composer/mention-text.module.js +1 -1
  65. package/dist/components/confirm-dialog/confirm-dialog.css +29 -29
  66. package/dist/components/confirm-dialog/confirm-dialog.d.ts +57 -3
  67. package/dist/components/confirm-dialog/confirm-dialog.js +266 -108
  68. package/dist/components/confirm-dialog/confirm-dialog.module.js +5 -5
  69. package/dist/components/conversation/conversation.css +52 -52
  70. package/dist/components/conversation/conversation.d.ts +43 -18
  71. package/dist/components/conversation/conversation.js +120 -78
  72. package/dist/components/conversation/conversation.module.js +15 -15
  73. package/dist/components/date-field/date-field.d.ts +1 -1
  74. package/dist/components/date-field/date-field.js +202 -100
  75. package/dist/components/date-field/date-input.d.ts +73 -37
  76. package/dist/components/date-field/date-input.js +72 -45
  77. package/dist/components/date-field/index.d.ts +1 -1
  78. package/dist/components/date-range-field/date-range-field.d.ts +1 -1
  79. package/dist/components/date-range-field/date-range-field.js +219 -107
  80. package/dist/components/date-range-field/date-range-input.d.ts +84 -40
  81. package/dist/components/date-range-field/date-range-input.js +83 -48
  82. package/dist/components/dialog/dialog.css +32 -32
  83. package/dist/components/dialog/dialog.d.ts +8 -7
  84. package/dist/components/dialog/dialog.js +8 -26
  85. package/dist/components/dialog/dialog.module.js +6 -6
  86. package/dist/components/divider/divider.css +6 -6
  87. package/dist/components/divider/divider.d.ts +36 -2
  88. package/dist/components/divider/divider.js +195 -29
  89. package/dist/components/divider/divider.module.js +3 -3
  90. package/dist/components/drawer/drawer.css +55 -56
  91. package/dist/components/drawer/drawer.d.ts +8 -7
  92. package/dist/components/drawer/drawer.js +8 -26
  93. package/dist/components/drawer/drawer.module.js +6 -6
  94. package/dist/components/field/field.css +34 -24
  95. package/dist/components/field/field.d.ts +60 -37
  96. package/dist/components/field/field.js +242 -157
  97. package/dist/components/field/field.module.js +12 -10
  98. package/dist/components/field/input-parts.d.ts +11 -13
  99. package/dist/components/field/input-parts.js +23 -42
  100. package/dist/components/field-placeholder/field-placeholder.css +6 -6
  101. package/dist/components/field-placeholder/field-placeholder.module.js +4 -4
  102. package/dist/components/fieldset/field-group.d.ts +1 -1
  103. package/dist/components/fieldset/field-group.js +48 -42
  104. package/dist/components/fieldset/fieldset-root.d.ts +1 -1
  105. package/dist/components/fieldset/fieldset-root.js +19 -17
  106. package/dist/components/fieldset/fieldset.d.ts +2 -2
  107. package/dist/components/fieldset/fieldset.js +2 -2
  108. package/dist/components/file-field/file-field.css +126 -60
  109. package/dist/components/file-field/file-field.js +201 -109
  110. package/dist/components/file-field/file-field.module.js +4 -4
  111. package/dist/components/file-field/file-input.d.ts +66 -40
  112. package/dist/components/file-field/file-input.js +188 -132
  113. package/dist/components/filter-bar/filter-bar.css +8 -8
  114. package/dist/components/filter-bar/filter-bar.d.ts +12 -3
  115. package/dist/components/filter-bar/filter-bar.js +23 -25
  116. package/dist/components/filter-bar/filter-bar.module.js +5 -5
  117. package/dist/components/form/form.d.ts +19 -7
  118. package/dist/components/form/form.js +80 -29
  119. package/dist/components/icon/icon.css +2 -2
  120. package/dist/components/icon/icon.module.js +1 -1
  121. package/dist/components/link/link.css +6 -5
  122. package/dist/components/link/link.module.js +1 -1
  123. package/dist/components/menu/menu.css +52 -47
  124. package/dist/components/menu/menu.d.ts +32 -25
  125. package/dist/components/menu/menu.js +75 -124
  126. package/dist/components/menu/menu.module.js +8 -8
  127. package/dist/components/nav/nav-context.d.ts +1 -1
  128. package/dist/components/nav/nav-item-view.d.ts +10 -13
  129. package/dist/components/nav/nav-item-view.js +42 -54
  130. package/dist/components/nav/nav.css +150 -119
  131. package/dist/components/nav/nav.d.ts +61 -17
  132. package/dist/components/nav/nav.js +271 -176
  133. package/dist/components/nav/nav.module.js +17 -15
  134. package/dist/components/number-field/number-field.css +153 -64
  135. package/dist/components/number-field/number-field.d.ts +2 -2
  136. package/dist/components/number-field/number-field.js +112 -91
  137. package/dist/components/number-field/number-field.module.js +6 -6
  138. package/dist/components/number-field/number-input.d.ts +43 -23
  139. package/dist/components/number-field/number-input.js +179 -125
  140. package/dist/components/otp-field/otp-field.css +153 -60
  141. package/dist/components/otp-field/otp-field.d.ts +2 -2
  142. package/dist/components/otp-field/otp-field.js +62 -46
  143. package/dist/components/otp-field/otp-field.module.js +4 -4
  144. package/dist/components/otp-field/otp-input.d.ts +8 -6
  145. package/dist/components/otp-field/otp-input.js +92 -92
  146. package/dist/components/pagination/pagination.d.ts +46 -15
  147. package/dist/components/pagination/pagination.js +217 -224
  148. package/dist/components/password-field/password-field.css +23 -23
  149. package/dist/components/password-field/password-field.js +107 -85
  150. package/dist/components/password-field/password-field.module.js +8 -8
  151. package/dist/components/password-field/password-strength.d.ts +107 -3
  152. package/dist/components/password-field/password-strength.js +569 -92
  153. package/dist/components/photo-field/photo-field.js +137 -112
  154. package/dist/components/photo-field/photo-input.css +67 -44
  155. package/dist/components/photo-field/photo-input.d.ts +59 -15
  156. package/dist/components/photo-field/photo-input.js +173 -86
  157. package/dist/components/photo-field/photo-input.module.js +10 -8
  158. package/dist/components/popover/popover.css +41 -41
  159. package/dist/components/popover/popover.d.ts +66 -25
  160. package/dist/components/popover/popover.js +332 -217
  161. package/dist/components/popover/popover.module.js +15 -19
  162. package/dist/components/radio-group-field/radio-group-field.js +80 -71
  163. package/dist/components/radio-group-field/radio-group.css +112 -60
  164. package/dist/components/radio-group-field/radio-group.d.ts +19 -3
  165. package/dist/components/radio-group-field/radio-group.js +66 -23
  166. package/dist/components/radio-group-field/radio-group.module.js +4 -4
  167. package/dist/components/segmented-control-field/segmented-control-field.d.ts +1 -1
  168. package/dist/components/segmented-control-field/segmented-control-field.js +111 -96
  169. package/dist/components/segmented-control-field/segmented-control.css +132 -79
  170. package/dist/components/segmented-control-field/segmented-control.d.ts +39 -15
  171. package/dist/components/segmented-control-field/segmented-control.js +124 -41
  172. package/dist/components/segmented-control-field/segmented-control.module.js +4 -4
  173. package/dist/components/select-field/select.css +214 -101
  174. package/dist/components/select-field/select.d.ts +43 -11
  175. package/dist/components/select-field/select.js +194 -109
  176. package/dist/components/select-field/select.module.js +14 -14
  177. package/dist/components/skeleton/skeleton.css +4 -4
  178. package/dist/components/skeleton/skeleton.module.js +3 -3
  179. package/dist/components/stale/stale.css +15 -15
  180. package/dist/components/stale/stale.d.ts +27 -3
  181. package/dist/components/stale/stale.js +147 -66
  182. package/dist/components/stale/stale.module.js +6 -6
  183. package/dist/components/status-message/status-message.css +22 -22
  184. package/dist/components/status-message/status-message.module.js +6 -6
  185. package/dist/components/switch-field/switch-field.js +77 -57
  186. package/dist/components/switch-field/switch.css +112 -63
  187. package/dist/components/switch-field/switch.d.ts +20 -3
  188. package/dist/components/switch-field/switch.js +70 -27
  189. package/dist/components/switch-field/switch.module.js +4 -4
  190. package/dist/components/tabs/tabs.css +32 -32
  191. package/dist/components/tabs/tabs.d.ts +21 -7
  192. package/dist/components/tabs/tabs.js +73 -14
  193. package/dist/components/tabs/tabs.module.js +7 -7
  194. package/dist/components/tag/tag.css +84 -84
  195. package/dist/components/tag/tag.module.js +3 -3
  196. package/dist/components/tag-group/tag-group.css +94 -94
  197. package/dist/components/tag-group/tag-group.module.js +4 -4
  198. package/dist/components/text-field/text-field.css +159 -82
  199. package/dist/components/text-field/text-field.d.ts +1 -1
  200. package/dist/components/text-field/text-field.js +139 -110
  201. package/dist/components/text-field/text-field.module.js +9 -9
  202. package/dist/components/text-field/text-input.d.ts +81 -45
  203. package/dist/components/text-field/text-input.js +366 -217
  204. package/dist/components/textarea-field/textarea-field.css +7 -2
  205. package/dist/components/textarea-field/textarea-field.js +72 -56
  206. package/dist/components/textarea-field/textarea-field.module.js +2 -2
  207. package/dist/components/time-field/time-field.js +153 -60
  208. package/dist/components/time-field/time-input.d.ts +21 -10
  209. package/dist/components/time-field/time-input.js +22 -11
  210. package/dist/components/toast/toast-provider.css +34 -31
  211. package/dist/components/toast/toast-provider.d.ts +63 -14
  212. package/dist/components/toast/toast-provider.js +174 -111
  213. package/dist/components/toast/toast-provider.module.js +7 -7
  214. package/dist/components/toggle-group-field/toggle-group-field.d.ts +1 -1
  215. package/dist/components/toggle-group-field/toggle-group-field.js +95 -89
  216. package/dist/components/toggle-group-field/toggle-group.css +117 -67
  217. package/dist/components/toggle-group-field/toggle-group.d.ts +2 -2
  218. package/dist/components/toggle-group-field/toggle-group.js +2 -2
  219. package/dist/components/toggle-group-field/toggle-group.module.js +2 -2
  220. package/dist/components/tooltip/tooltip.css +4 -4
  221. package/dist/components/tooltip/tooltip.module.js +1 -1
  222. package/dist/data-table/data-table-content.js +6 -5
  223. package/dist/data-table/data-table-parts.d.ts +41 -13
  224. package/dist/data-table/data-table-parts.js +213 -172
  225. package/dist/data-table/data-table-selection.d.ts +105 -3
  226. package/dist/data-table/data-table-selection.js +654 -145
  227. package/dist/data-table/data-table.css +125 -128
  228. package/dist/data-table/data-table.d.ts +21 -26
  229. package/dist/data-table/data-table.js +20 -23
  230. package/dist/data-table/data-table.module.js +32 -34
  231. package/dist/data-table/index.d.ts +2 -2
  232. package/dist/index.js +3 -3
  233. package/dist/lib/calendar/calendar-navigation.d.ts +39 -5
  234. package/dist/lib/calendar/calendar-navigation.js +185 -118
  235. package/dist/lib/calendar/calendar-parts.d.ts +143 -0
  236. package/dist/lib/calendar/calendar-parts.js +540 -0
  237. package/dist/lib/calendar/calendar-prefab.d.ts +52 -0
  238. package/dist/lib/calendar/calendar-prefab.js +311 -0
  239. package/dist/lib/calendar/calendar-year.d.ts +3 -1
  240. package/dist/lib/calendar/calendar-year.js +139 -131
  241. package/dist/lib/calendar/temporal.css +325 -232
  242. package/dist/lib/calendar/temporal.d.ts +67 -82
  243. package/dist/lib/calendar/temporal.js +258 -569
  244. package/dist/lib/calendar/temporal.module.js +38 -38
  245. package/dist/lib/forms/use-connected-field.d.ts +1 -1
  246. package/dist/lib/forms/use-connected-field.js +1 -1
  247. package/dist/lib/render-as.d.ts +13 -0
  248. package/dist/lib/render-as.js +46 -0
  249. package/dist/tokens.css +6 -3
  250. package/package.json +1 -1
  251. package/tokens/dark.tokens.json +6 -0
  252. package/tokens/sys.tokens.json +7 -0
  253. package/dist/components/button/close-button.d.ts +0 -16
  254. package/dist/components/button/close-button.js +0 -30
@@ -1,68 +1,68 @@
1
1
  @layer kit.reset, kit.base, kit.components;
2
2
  @layer kit.components {
3
- ._backdrop_19j93_3 {
4
- --overlay-dim: 0.4;
3
+ ._backdrop_19hfo_3 {
4
+ --_overlay-dim: 0.4;
5
5
  --overlay-opacity: 1;
6
6
  position: fixed;
7
7
  inset: 0;
8
- background-color: rgb(0, 0, 0, var(--overlay-dim));
9
- backdrop-filter: blur(1px);
8
+ background-color: var(--overlay-bg, rgb(0, 0, 0, var(--overlay-dim, var(--_overlay-dim))));
9
+ backdrop-filter: var(--overlay-backdrop-filter, blur(1px));
10
10
  opacity: var(--overlay-opacity);
11
11
  }
12
12
  @media not (prefers-reduced-motion) {
13
- ._backdrop_19j93_3 {
13
+ ._backdrop_19hfo_3 {
14
14
  transition: opacity var(--sys-motion-short) var(--sys-motion-standard);
15
15
  }
16
16
  }
17
- html[data-theme="dark"] ._backdrop_19j93_3 {
18
- --overlay-dim: 0.6;
17
+ html[data-theme="dark"] ._backdrop_19hfo_3 {
18
+ --_overlay-dim: 0.6;
19
19
  }
20
20
  @media (prefers-color-scheme: dark) {
21
- html:not([data-theme="light"]) ._backdrop_19j93_3 {
22
- --overlay-dim: 0.6;
21
+ html:not([data-theme="light"]) ._backdrop_19hfo_3 {
22
+ --_overlay-dim: 0.6;
23
23
  }
24
24
  }
25
- ._backdrop_19j93_3[data-starting-style], ._backdrop_19j93_3[data-ending-style] {
25
+ ._backdrop_19hfo_3[data-starting-style], ._backdrop_19hfo_3[data-ending-style] {
26
26
  opacity: 0;
27
27
  }
28
- ._popup_19j93_28 {
28
+ ._popup_19hfo_28 {
29
29
  position: fixed;
30
30
  top: 50%;
31
31
  left: 50%;
32
32
  box-sizing: border-box;
33
- inline-size: min(32rem, 100dvw - var(--sys-unit-16));
33
+ inline-size: min(var(--dialog-inline-size, 32rem), var(--dialog-max-inline-size, calc(100dvw - var(--sys-unit-16))));
34
34
  border: none;
35
- border-radius: var(--sys-radius-xl);
36
- background: var(--sys-color-surface-overlay);
37
- color: var(--sys-color-text);
35
+ border-radius: var(--dialog-radius, var(--sys-radius-xl));
36
+ background: var(--dialog-bg, var(--sys-color-surface-overlay));
37
+ color: var(--dialog-fg, var(--sys-color-text));
38
38
  transform: translate(-50%, -50%);
39
39
  }
40
40
  @media not (prefers-reduced-motion) {
41
- ._popup_19j93_28 {
41
+ ._popup_19hfo_28 {
42
42
  transition: opacity var(--sys-motion-short) var(--sys-motion-standard), transform var(--sys-motion-short) var(--sys-motion-emphasized);
43
43
  }
44
44
  }
45
- ._popup_19j93_28[data-starting-style], ._popup_19j93_28[data-ending-style] {
45
+ ._popup_19hfo_28[data-starting-style], ._popup_19hfo_28[data-ending-style] {
46
46
  opacity: 0;
47
47
  transform: translate(-50%, -48%) scale(0.96);
48
48
  }
49
- ._popup_19j93_28 {
50
- padding: var(--sys-unit-20);
49
+ ._popup_19hfo_28 {
50
+ padding: var(--confirm-dialog-pad, var(--sys-unit-20));
51
51
  }
52
- ._title_19j93_52 {
53
- color: var(--sys-color-text);
54
- font: var(--sys-font-heading-small);
55
- margin-block-end: var(--sys-unit-8);
52
+ ._title_19hfo_52 {
53
+ color: var(--dialog-title-fg, var(--dialog-fg, var(--sys-color-text)));
54
+ font: var(--dialog-title-font, var(--sys-font-heading-small));
55
+ margin-block-end: var(--dialog-title-space, var(--sys-unit-8));
56
56
  }
57
- ._description_19j93_57 {
58
- color: var(--sys-color-text-muted);
59
- font: var(--sys-font-body-medium);
57
+ ._description_19hfo_57 {
58
+ color: var(--dialog-description-fg, var(--sys-color-text-muted));
59
+ font: var(--dialog-description-font, var(--sys-font-body-medium));
60
60
  }
61
- ._actions_19j93_61 {
61
+ ._actions_19hfo_61 {
62
62
  display: flex;
63
63
  flex-wrap: wrap;
64
64
  justify-content: end;
65
- gap: var(--sys-unit-8);
66
- margin-block-start: var(--sys-unit-20);
65
+ gap: var(--dialog-actions-gap, var(--sys-unit-8));
66
+ margin-block-start: var(--dialog-actions-space, var(--sys-unit-20));
67
67
  }
68
68
  }
@@ -1,6 +1,7 @@
1
1
  import { AlertDialog } from "@base-ui/react/alert-dialog";
2
2
  import { type ComponentProps, type ReactNode } from "react";
3
3
  import { type ButtonTone } from "../button/button.tsx";
4
+ import { type SpinnerProps } from "../spinner/spinner.tsx";
4
5
  /** What a confirm runs: a promise keeps the dialog open and busy until it settles. */
5
6
  export type ConfirmAction = () => void | Promise<unknown>;
6
7
  export type ConfirmDialogRootProps = Readonly<{
@@ -10,8 +11,43 @@ export type ConfirmDialogRootProps = Readonly<{
10
11
  onOpenChange: (open: boolean) => void;
11
12
  children: ReactNode;
12
13
  }>;
13
- /** The controlled alert dialog: its portal, backdrop and surface. */
14
+ /**
15
+ * Holds the controlled alert dialog's open state and its confirm for the parts
16
+ * inside it. It renders no element of its own.
17
+ *
18
+ * @example
19
+ * <ConfirmDialog.Root open={open} onOpenChange={setOpen}>
20
+ * <ConfirmDialog.Content>…</ConfirmDialog.Content>
21
+ * </ConfirmDialog.Root>
22
+ */
14
23
  declare const ConfirmDialogRoot: ({ open, onOpenChange, children, }: ConfirmDialogRootProps) => ReactNode;
24
+ /**
25
+ * The dimmed layer behind the dialog.
26
+ *
27
+ * @example
28
+ * <ConfirmDialog.Backdrop />
29
+ */
30
+ declare const ConfirmDialogBackdrop: ({ className, ...props }: AlertDialog.Backdrop.Props) => ReactNode;
31
+ /**
32
+ * The dialog's surface, marked busy while a confirm is pending.
33
+ *
34
+ * @example
35
+ * <ConfirmDialog.Popup>…</ConfirmDialog.Popup>
36
+ */
37
+ declare const ConfirmDialogPopup: ({ className, ...props }: AlertDialog.Popup.Props) => ReactNode;
38
+ export type ConfirmDialogContentProps = AlertDialog.Popup.Props & Readonly<{
39
+ /** The element the dialog is portalled into. @default document.body */
40
+ container?: AlertDialog.Portal.Props["container"];
41
+ }>;
42
+ /**
43
+ * `Portal`, `Backdrop` and `Popup` in one: the dialog's surface, above the page.
44
+ *
45
+ * @example
46
+ * <ConfirmDialog.Content>
47
+ * <ConfirmDialog.Title>Delete this invoice?</ConfirmDialog.Title>
48
+ * </ConfirmDialog.Content>
49
+ */
50
+ declare const ConfirmDialogContent: ({ container, ...props }: ConfirmDialogContentProps) => ReactNode;
15
51
  /** The question the dialog asks. */
16
52
  declare const ConfirmDialogTitle: ({ className, ...props }: AlertDialog.Title.Props) => ReactNode;
17
53
  /** What confirming does; renders nothing without children. */
@@ -34,8 +70,20 @@ export type ConfirmDialogConfirmProps = Readonly<{
34
70
  tone?: ButtonTone;
35
71
  children: ReactNode;
36
72
  }>;
37
- /** Acts, then closes once the action has settled. */
73
+ /** Acts, then closes once the action has settled. Put a `Spinner` in it to show the wait. */
38
74
  declare const ConfirmDialogConfirm: ({ onConfirm, tone, children, }: ConfirmDialogConfirmProps) => ReactNode;
75
+ export type ConfirmDialogSpinnerProps = Omit<SpinnerProps, "size"> & Readonly<{
76
+ /** Size relative to the current font size (in `em`). @default 1 */
77
+ size?: number;
78
+ }>;
79
+ /**
80
+ * The spinner a pending confirm shows once it has run long enough to notice.
81
+ * Renders nothing otherwise.
82
+ *
83
+ * @example
84
+ * <ConfirmDialog.Confirm onConfirm={send}><ConfirmDialog.Spinner />Send</ConfirmDialog.Confirm>
85
+ */
86
+ declare const ConfirmDialogSpinner: ({ size, ...props }: ConfirmDialogSpinnerProps) => ReactNode;
39
87
  export type ConfirmDialogProps = Omit<ConfirmDialogRootProps, "children"> & Omit<ConfirmDialogConfirmProps, "children"> & Readonly<{
40
88
  /** Heading text. */
41
89
  title: ReactNode;
@@ -49,16 +97,22 @@ export type ConfirmDialogProps = Omit<ConfirmDialogRootProps, "children"> & Omit
49
97
  declare const ConfirmDialogShorthand: ({ open, onOpenChange, title, description, confirmLabel, cancelLabel, onConfirm, tone, }: ConfirmDialogProps) => ReactNode;
50
98
  type ConfirmDialogParts = typeof ConfirmDialogShorthand & Readonly<{
51
99
  Root: typeof ConfirmDialogRoot;
100
+ Portal: typeof AlertDialog.Portal;
101
+ Backdrop: typeof ConfirmDialogBackdrop;
102
+ Popup: typeof ConfirmDialogPopup;
103
+ Content: typeof ConfirmDialogContent;
52
104
  Title: typeof ConfirmDialogTitle;
53
105
  Description: typeof ConfirmDialogDescription;
54
106
  Footer: typeof ConfirmDialogFooter;
55
107
  Cancel: typeof ConfirmDialogCancel;
56
108
  Confirm: typeof ConfirmDialogConfirm;
109
+ Spinner: typeof ConfirmDialogSpinner;
57
110
  }>;
58
111
  /**
59
112
  * A controlled confirmation over base-ui's `AlertDialog`. A promise from
60
113
  * `onConfirm` keeps it busy until it settles, closing on resolve and staying open
61
- * on reject; the parts hanging off it build one by hand.
114
+ * on reject; the parts hanging off it build one by hand, with `Content`
115
+ * bundling the portal, backdrop and popup.
62
116
  *
63
117
  * @example
64
118
  * <ConfirmDialog
@@ -72,9 +72,17 @@ var useConfirmAttempt = (close) => {
72
72
  } else t3 = $[8];
73
73
  return t3;
74
74
  };
75
- /** The controlled alert dialog: its portal, backdrop and surface. */
75
+ /**
76
+ * Holds the controlled alert dialog's open state and its confirm for the parts
77
+ * inside it. It renders no element of its own.
78
+ *
79
+ * @example
80
+ * <ConfirmDialog.Root open={open} onOpenChange={setOpen}>
81
+ * <ConfirmDialog.Content>…</ConfirmDialog.Content>
82
+ * </ConfirmDialog.Root>
83
+ */
76
84
  var ConfirmDialogRoot = (t0) => {
77
- const $ = c(19);
85
+ const $ = c(15);
78
86
  const { open, onOpenChange, children } = t0;
79
87
  let t1;
80
88
  if ($[0] !== onOpenChange) {
@@ -84,11 +92,11 @@ var ConfirmDialogRoot = (t0) => {
84
92
  } else t1 = $[1];
85
93
  const attempt = useConfirmAttempt(t1);
86
94
  let t2;
87
- if ($[2] !== attempt.pending || $[3] !== onOpenChange) {
95
+ if ($[2] !== attempt || $[3] !== onOpenChange) {
88
96
  t2 = (next) => {
89
97
  if (!attempt.pending) onOpenChange(next);
90
98
  };
91
- $[2] = attempt.pending;
99
+ $[2] = attempt;
92
100
  $[3] = onOpenChange;
93
101
  $[4] = t2;
94
102
  } else t2 = $[4];
@@ -101,47 +109,152 @@ var ConfirmDialogRoot = (t0) => {
101
109
  $[6] = t3;
102
110
  } else t3 = $[6];
103
111
  let t4;
104
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
105
- t4 = /* @__PURE__ */ jsx(AlertDialog.Backdrop, { className: confirm_dialog_module_default.backdrop });
106
- $[7] = t4;
107
- } else t4 = $[7];
108
- const t5 = attempt.pending || void 0;
109
- let t6;
110
- if ($[8] !== attempt || $[9] !== children) {
111
- t6 = /* @__PURE__ */ jsx(ConfirmContext, {
112
+ if ($[7] !== attempt || $[8] !== children) {
113
+ t4 = /* @__PURE__ */ jsx(ConfirmContext, {
112
114
  value: attempt,
113
115
  children
114
116
  });
115
- $[8] = attempt;
116
- $[9] = children;
117
- $[10] = t6;
118
- } else t6 = $[10];
119
- let t7;
120
- if ($[11] !== t5 || $[12] !== t6) {
121
- t7 = /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [t4, /* @__PURE__ */ jsx(AlertDialog.Popup, {
122
- className: confirm_dialog_module_default.popup,
123
- "aria-busy": t5,
124
- children: t6
125
- })] });
126
- $[11] = t5;
127
- $[12] = t6;
128
- $[13] = t7;
129
- } else t7 = $[13];
130
- let t8;
131
- if ($[14] !== open || $[15] !== t2 || $[16] !== t3 || $[17] !== t7) {
132
- t8 = /* @__PURE__ */ jsx(AlertDialog.Root, {
117
+ $[7] = attempt;
118
+ $[8] = children;
119
+ $[9] = t4;
120
+ } else t4 = $[9];
121
+ let t5;
122
+ if ($[10] !== open || $[11] !== t2 || $[12] !== t3 || $[13] !== t4) {
123
+ t5 = /* @__PURE__ */ jsx(AlertDialog.Root, {
133
124
  open,
134
125
  onOpenChange: t2,
135
126
  onOpenChangeComplete: t3,
136
- children: t7
127
+ children: t4
137
128
  });
138
- $[14] = open;
139
- $[15] = t2;
140
- $[16] = t3;
141
- $[17] = t7;
142
- $[18] = t8;
143
- } else t8 = $[18];
144
- return t8;
129
+ $[10] = open;
130
+ $[11] = t2;
131
+ $[12] = t3;
132
+ $[13] = t4;
133
+ $[14] = t5;
134
+ } else t5 = $[14];
135
+ return t5;
136
+ };
137
+ /**
138
+ * The dimmed layer behind the dialog.
139
+ *
140
+ * @example
141
+ * <ConfirmDialog.Backdrop />
142
+ */
143
+ var ConfirmDialogBackdrop = (t0) => {
144
+ const $ = c(8);
145
+ let className;
146
+ let props;
147
+ if ($[0] !== t0) {
148
+ ({className, ...props} = t0);
149
+ $[0] = t0;
150
+ $[1] = className;
151
+ $[2] = props;
152
+ } else {
153
+ className = $[1];
154
+ props = $[2];
155
+ }
156
+ let t1;
157
+ if ($[3] !== className) {
158
+ t1 = clsx(confirm_dialog_module_default.backdrop, className);
159
+ $[3] = className;
160
+ $[4] = t1;
161
+ } else t1 = $[4];
162
+ let t2;
163
+ if ($[5] !== props || $[6] !== t1) {
164
+ t2 = /* @__PURE__ */ jsx(AlertDialog.Backdrop, {
165
+ className: t1,
166
+ ...props
167
+ });
168
+ $[5] = props;
169
+ $[6] = t1;
170
+ $[7] = t2;
171
+ } else t2 = $[7];
172
+ return t2;
173
+ };
174
+ /**
175
+ * The dialog's surface, marked busy while a confirm is pending.
176
+ *
177
+ * @example
178
+ * <ConfirmDialog.Popup>…</ConfirmDialog.Popup>
179
+ */
180
+ var ConfirmDialogPopup = (t0) => {
181
+ const $ = c(9);
182
+ let className;
183
+ let props;
184
+ if ($[0] !== t0) {
185
+ ({className, ...props} = t0);
186
+ $[0] = t0;
187
+ $[1] = className;
188
+ $[2] = props;
189
+ } else {
190
+ className = $[1];
191
+ props = $[2];
192
+ }
193
+ const { pending } = useContext(ConfirmContext);
194
+ let t1;
195
+ if ($[3] !== className) {
196
+ t1 = clsx(confirm_dialog_module_default.popup, className);
197
+ $[3] = className;
198
+ $[4] = t1;
199
+ } else t1 = $[4];
200
+ const t2 = pending || void 0;
201
+ let t3;
202
+ if ($[5] !== props || $[6] !== t1 || $[7] !== t2) {
203
+ t3 = /* @__PURE__ */ jsx(AlertDialog.Popup, {
204
+ className: t1,
205
+ "aria-busy": t2,
206
+ ...props
207
+ });
208
+ $[5] = props;
209
+ $[6] = t1;
210
+ $[7] = t2;
211
+ $[8] = t3;
212
+ } else t3 = $[8];
213
+ return t3;
214
+ };
215
+ /**
216
+ * `Portal`, `Backdrop` and `Popup` in one: the dialog's surface, above the page.
217
+ *
218
+ * @example
219
+ * <ConfirmDialog.Content>
220
+ * <ConfirmDialog.Title>Delete this invoice?</ConfirmDialog.Title>
221
+ * </ConfirmDialog.Content>
222
+ */
223
+ var ConfirmDialogContent = (t0) => {
224
+ const $ = c(9);
225
+ let container;
226
+ let props;
227
+ if ($[0] !== t0) {
228
+ ({container, ...props} = t0);
229
+ $[0] = t0;
230
+ $[1] = container;
231
+ $[2] = props;
232
+ } else {
233
+ container = $[1];
234
+ props = $[2];
235
+ }
236
+ let t1;
237
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
238
+ t1 = /* @__PURE__ */ jsx(ConfirmDialogBackdrop, {});
239
+ $[3] = t1;
240
+ } else t1 = $[3];
241
+ let t2;
242
+ if ($[4] !== props) {
243
+ t2 = /* @__PURE__ */ jsx(ConfirmDialogPopup, { ...props });
244
+ $[4] = props;
245
+ $[5] = t2;
246
+ } else t2 = $[5];
247
+ let t3;
248
+ if ($[6] !== container || $[7] !== t2) {
249
+ t3 = /* @__PURE__ */ jsxs(AlertDialog.Portal, {
250
+ container,
251
+ children: [t1, t2]
252
+ });
253
+ $[6] = container;
254
+ $[7] = t2;
255
+ $[8] = t3;
256
+ } else t3 = $[8];
257
+ return t3;
145
258
  };
146
259
  /** The question the dialog asks. */
147
260
  var ConfirmDialogTitle = (t0) => {
@@ -264,56 +377,84 @@ var ConfirmDialogCancel = (t0) => {
264
377
  } else t2 = $[4];
265
378
  return t2;
266
379
  };
267
- /** Acts, then closes once the action has settled. */
380
+ /** Acts, then closes once the action has settled. Put a `Spinner` in it to show the wait. */
268
381
  var ConfirmDialogConfirm = (t0) => {
269
- const $ = c(14);
382
+ const $ = c(9);
270
383
  const { onConfirm, tone: t1, children } = t0;
271
384
  const tone = t1 === void 0 ? "brand" : t1;
272
385
  const { pending, confirm } = useContext(ConfirmContext);
273
- let t2;
274
- if ($[0] !== pending) {
275
- t2 = { busy: pending };
276
- $[0] = pending;
277
- $[1] = t2;
278
- } else t2 = $[1];
279
- const phase = useBusyPhase(t2);
386
+ const t2 = pending || void 0;
280
387
  const t3 = pending || void 0;
281
- const t4 = pending || void 0;
388
+ let t4;
389
+ if ($[0] !== confirm || $[1] !== onConfirm) {
390
+ t4 = () => confirm(onConfirm);
391
+ $[0] = confirm;
392
+ $[1] = onConfirm;
393
+ $[2] = t4;
394
+ } else t4 = $[2];
282
395
  let t5;
283
- if ($[2] !== confirm || $[3] !== onConfirm) {
284
- t5 = () => confirm(onConfirm);
285
- $[2] = confirm;
286
- $[3] = onConfirm;
287
- $[4] = t5;
288
- } else t5 = $[4];
289
- let t6;
290
- if ($[5] !== phase) {
291
- t6 = phase === "fresh" ? null : /* @__PURE__ */ jsx(Spinner, { size: 1 });
292
- $[5] = phase;
293
- $[6] = t6;
294
- } else t6 = $[6];
295
- let t7;
296
- if ($[7] !== children || $[8] !== t3 || $[9] !== t4 || $[10] !== t5 || $[11] !== t6 || $[12] !== tone) {
297
- t7 = /* @__PURE__ */ jsxs(Button, {
396
+ if ($[3] !== children || $[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== tone) {
397
+ t5 = /* @__PURE__ */ jsx(Button, {
298
398
  variant: "primary",
299
399
  tone,
300
- "aria-busy": t3,
301
- "aria-disabled": t4,
302
- onClick: t5,
303
- children: [t6, children]
400
+ "aria-busy": t2,
401
+ "aria-disabled": t3,
402
+ onClick: t4,
403
+ children
304
404
  });
305
- $[7] = children;
405
+ $[3] = children;
406
+ $[4] = t2;
407
+ $[5] = t3;
408
+ $[6] = t4;
409
+ $[7] = tone;
410
+ $[8] = t5;
411
+ } else t5 = $[8];
412
+ return t5;
413
+ };
414
+ /**
415
+ * The spinner a pending confirm shows once it has run long enough to notice.
416
+ * Renders nothing otherwise.
417
+ *
418
+ * @example
419
+ * <ConfirmDialog.Confirm onConfirm={send}><ConfirmDialog.Spinner />Send</ConfirmDialog.Confirm>
420
+ */
421
+ var ConfirmDialogSpinner = (t0) => {
422
+ const $ = c(9);
423
+ let props;
424
+ let t1;
425
+ if ($[0] !== t0) {
426
+ ({size: t1, ...props} = t0);
427
+ $[0] = t0;
428
+ $[1] = props;
429
+ $[2] = t1;
430
+ } else {
431
+ props = $[1];
432
+ t1 = $[2];
433
+ }
434
+ const size = t1 === void 0 ? 1 : t1;
435
+ const { pending } = useContext(ConfirmContext);
436
+ let t2;
437
+ if ($[3] !== pending) {
438
+ t2 = { busy: pending };
439
+ $[3] = pending;
440
+ $[4] = t2;
441
+ } else t2 = $[4];
442
+ const phase = useBusyPhase(t2);
443
+ let t3;
444
+ if ($[5] !== phase || $[6] !== props || $[7] !== size) {
445
+ t3 = phase === "fresh" ? null : /* @__PURE__ */ jsx(Spinner, {
446
+ size,
447
+ ...props
448
+ });
449
+ $[5] = phase;
450
+ $[6] = props;
451
+ $[7] = size;
306
452
  $[8] = t3;
307
- $[9] = t4;
308
- $[10] = t5;
309
- $[11] = t6;
310
- $[12] = tone;
311
- $[13] = t7;
312
- } else t7 = $[13];
313
- return t7;
453
+ } else t3 = $[8];
454
+ return t3;
314
455
  };
315
456
  var ConfirmDialogShorthand = (t0) => {
316
- const $ = c(19);
457
+ const $ = c(22);
317
458
  const { open, onOpenChange, title, description, confirmLabel, cancelLabel, onConfirm, tone } = t0;
318
459
  let t1;
319
460
  if ($[0] !== title) {
@@ -334,48 +475,60 @@ var ConfirmDialogShorthand = (t0) => {
334
475
  $[5] = t3;
335
476
  } else t3 = $[5];
336
477
  let t4;
337
- if ($[6] !== confirmLabel || $[7] !== onConfirm || $[8] !== tone) {
338
- t4 = /* @__PURE__ */ jsx(ConfirmDialogConfirm, {
478
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
479
+ t4 = /* @__PURE__ */ jsx(ConfirmDialogSpinner, {});
480
+ $[6] = t4;
481
+ } else t4 = $[6];
482
+ let t5;
483
+ if ($[7] !== confirmLabel || $[8] !== onConfirm || $[9] !== tone) {
484
+ t5 = /* @__PURE__ */ jsxs(ConfirmDialogConfirm, {
339
485
  onConfirm,
340
486
  tone,
341
- children: confirmLabel
487
+ children: [t4, confirmLabel]
342
488
  });
343
- $[6] = confirmLabel;
344
- $[7] = onConfirm;
345
- $[8] = tone;
346
- $[9] = t4;
347
- } else t4 = $[9];
348
- let t5;
349
- if ($[10] !== t3 || $[11] !== t4) {
350
- t5 = /* @__PURE__ */ jsxs(ConfirmDialogFooter, { children: [t3, t4] });
351
- $[10] = t3;
352
- $[11] = t4;
353
- $[12] = t5;
354
- } else t5 = $[12];
489
+ $[7] = confirmLabel;
490
+ $[8] = onConfirm;
491
+ $[9] = tone;
492
+ $[10] = t5;
493
+ } else t5 = $[10];
355
494
  let t6;
356
- if ($[13] !== onOpenChange || $[14] !== open || $[15] !== t1 || $[16] !== t2 || $[17] !== t5) {
357
- t6 = /* @__PURE__ */ jsxs(ConfirmDialogRoot, {
495
+ if ($[11] !== t3 || $[12] !== t5) {
496
+ t6 = /* @__PURE__ */ jsxs(ConfirmDialogFooter, { children: [t3, t5] });
497
+ $[11] = t3;
498
+ $[12] = t5;
499
+ $[13] = t6;
500
+ } else t6 = $[13];
501
+ let t7;
502
+ if ($[14] !== t1 || $[15] !== t2 || $[16] !== t6) {
503
+ t7 = /* @__PURE__ */ jsxs(ConfirmDialogContent, { children: [
504
+ t1,
505
+ t2,
506
+ t6
507
+ ] });
508
+ $[14] = t1;
509
+ $[15] = t2;
510
+ $[16] = t6;
511
+ $[17] = t7;
512
+ } else t7 = $[17];
513
+ let t8;
514
+ if ($[18] !== onOpenChange || $[19] !== open || $[20] !== t7) {
515
+ t8 = /* @__PURE__ */ jsx(ConfirmDialogRoot, {
358
516
  open,
359
517
  onOpenChange,
360
- children: [
361
- t1,
362
- t2,
363
- t5
364
- ]
518
+ children: t7
365
519
  });
366
- $[13] = onOpenChange;
367
- $[14] = open;
368
- $[15] = t1;
369
- $[16] = t2;
370
- $[17] = t5;
371
- $[18] = t6;
372
- } else t6 = $[18];
373
- return t6;
520
+ $[18] = onOpenChange;
521
+ $[19] = open;
522
+ $[20] = t7;
523
+ $[21] = t8;
524
+ } else t8 = $[21];
525
+ return t8;
374
526
  };
375
527
  /**
376
528
  * A controlled confirmation over base-ui's `AlertDialog`. A promise from
377
529
  * `onConfirm` keeps it busy until it settles, closing on resolve and staying open
378
- * on reject; the parts hanging off it build one by hand.
530
+ * on reject; the parts hanging off it build one by hand, with `Content`
531
+ * bundling the portal, backdrop and popup.
379
532
  *
380
533
  * @example
381
534
  * <ConfirmDialog
@@ -391,10 +544,15 @@ var ConfirmDialogShorthand = (t0) => {
391
544
  */
392
545
  var ConfirmDialog = Object.assign(ConfirmDialogShorthand, {
393
546
  Root: ConfirmDialogRoot,
547
+ Portal: AlertDialog.Portal,
548
+ Backdrop: ConfirmDialogBackdrop,
549
+ Popup: ConfirmDialogPopup,
550
+ Content: ConfirmDialogContent,
394
551
  Title: ConfirmDialogTitle,
395
552
  Description: ConfirmDialogDescription,
396
553
  Footer: ConfirmDialogFooter,
397
554
  Cancel: ConfirmDialogCancel,
398
- Confirm: ConfirmDialogConfirm
555
+ Confirm: ConfirmDialogConfirm,
556
+ Spinner: ConfirmDialogSpinner
399
557
  });
400
558
  export { ConfirmDialog };
@@ -1,9 +1,9 @@
1
1
  import './confirm-dialog.css';// src/components/confirm-dialog/confirm-dialog.module.scss
2
- var backdrop = "_backdrop_19j93_3";
3
- var popup = "_popup_19j93_28";
4
- var title = "_title_19j93_52";
5
- var description = "_description_19j93_57";
6
- var actions = "_actions_19j93_61";
2
+ var backdrop = "_backdrop_19hfo_3";
3
+ var popup = "_popup_19hfo_28";
4
+ var title = "_title_19hfo_52";
5
+ var description = "_description_19hfo_57";
6
+ var actions = "_actions_19hfo_61";
7
7
  var confirm_dialog_module_default = {
8
8
  backdrop,
9
9
  popup,