@deepfuture/dui-components 0.0.20 → 1.0.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 (333) hide show
  1. package/README.md +56 -65
  2. package/_install.js +11 -0
  3. package/accordion/accordion-item.d.ts +3 -20
  4. package/accordion/accordion-item.js +93 -292
  5. package/accordion/accordion.d.ts +3 -18
  6. package/accordion/accordion.js +9 -247
  7. package/accordion/index.d.ts +6 -6
  8. package/accordion/index.js +5 -5
  9. package/alert-dialog/alert-dialog-close.d.ts +3 -14
  10. package/alert-dialog/alert-dialog-close.js +4 -34
  11. package/alert-dialog/alert-dialog-popup.d.ts +3 -32
  12. package/alert-dialog/alert-dialog-popup.js +68 -317
  13. package/alert-dialog/alert-dialog-trigger.d.ts +3 -14
  14. package/alert-dialog/alert-dialog-trigger.js +4 -51
  15. package/alert-dialog/alert-dialog.d.ts +3 -30
  16. package/alert-dialog/alert-dialog.js +8 -158
  17. package/alert-dialog/index.d.ts +11 -11
  18. package/alert-dialog/index.js +9 -9
  19. package/all.d.ts +159 -123
  20. package/all.js +134 -231
  21. package/avatar/avatar.d.ts +3 -39
  22. package/avatar/avatar.js +18 -238
  23. package/avatar/index.d.ts +4 -4
  24. package/avatar/index.js +3 -3
  25. package/badge/badge.d.ts +3 -10
  26. package/badge/badge.js +88 -22
  27. package/badge/index.d.ts +2 -3
  28. package/badge/index.js +2 -3
  29. package/breadcrumb/breadcrumb-ellipsis.d.ts +3 -12
  30. package/breadcrumb/breadcrumb-ellipsis.js +8 -34
  31. package/breadcrumb/breadcrumb-item.d.ts +3 -11
  32. package/breadcrumb/breadcrumb-item.js +7 -26
  33. package/breadcrumb/breadcrumb-link.d.ts +3 -12
  34. package/breadcrumb/breadcrumb-link.js +16 -26
  35. package/breadcrumb/breadcrumb-page.d.ts +3 -11
  36. package/breadcrumb/breadcrumb-page.js +8 -31
  37. package/breadcrumb/breadcrumb-separator.d.ts +3 -12
  38. package/breadcrumb/breadcrumb-separator.js +8 -31
  39. package/breadcrumb/breadcrumb.d.ts +3 -12
  40. package/breadcrumb/breadcrumb.js +10 -33
  41. package/breadcrumb/index.d.ts +12 -13
  42. package/breadcrumb/index.js +12 -13
  43. package/button/button.d.ts +3 -32
  44. package/button/button.js +221 -165
  45. package/button/index.d.ts +3 -3
  46. package/button/index.js +3 -3
  47. package/calendar/calendar.d.ts +3 -31
  48. package/calendar/calendar.js +71 -481
  49. package/calendar/index.d.ts +3 -3
  50. package/calendar/index.js +3 -3
  51. package/card/card.d.ts +3 -27
  52. package/card/card.js +80 -163
  53. package/card/index.d.ts +2 -3
  54. package/card/index.js +2 -3
  55. package/card-grid/card-grid.d.ts +3 -15
  56. package/card-grid/card-grid.js +8 -106
  57. package/card-grid/index.d.ts +2 -3
  58. package/card-grid/index.js +2 -3
  59. package/checkbox/checkbox-group.d.ts +3 -34
  60. package/checkbox/checkbox-group.js +11 -188
  61. package/checkbox/checkbox.d.ts +3 -47
  62. package/checkbox/checkbox.js +43 -341
  63. package/checkbox/index.d.ts +6 -6
  64. package/checkbox/index.js +5 -5
  65. package/collapsible/collapsible.d.ts +3 -20
  66. package/collapsible/collapsible.js +83 -277
  67. package/collapsible/index.d.ts +3 -3
  68. package/collapsible/index.js +3 -3
  69. package/combobox/combobox.d.ts +3 -47
  70. package/combobox/combobox.js +136 -538
  71. package/combobox/index.d.ts +4 -4
  72. package/combobox/index.js +3 -3
  73. package/command/command-empty.d.ts +3 -8
  74. package/command/command-empty.js +10 -88
  75. package/command/command-group.d.ts +3 -13
  76. package/command/command-group.js +15 -114
  77. package/command/command-input.d.ts +3 -11
  78. package/command/command-input.js +20 -136
  79. package/command/command-item.d.ts +3 -18
  80. package/command/command-item.js +24 -212
  81. package/command/command-list.d.ts +3 -7
  82. package/command/command-list.js +11 -79
  83. package/command/command-separator.d.ts +3 -5
  84. package/command/command-separator.js +10 -11
  85. package/command/command-shortcut.d.ts +3 -5
  86. package/command/command-shortcut.js +9 -12
  87. package/command/command.d.ts +3 -23
  88. package/command/command.js +10 -339
  89. package/command/index.d.ts +17 -19
  90. package/command/index.js +16 -18
  91. package/data-table/data-table.d.ts +3 -57
  92. package/data-table/data-table.js +86 -449
  93. package/data-table/index.d.ts +3 -4
  94. package/data-table/index.js +2 -3
  95. package/dialog/dialog-close.d.ts +3 -14
  96. package/dialog/dialog-close.js +4 -34
  97. package/dialog/dialog-popup.d.ts +3 -34
  98. package/dialog/dialog-popup.js +70 -336
  99. package/dialog/dialog-trigger.d.ts +3 -14
  100. package/dialog/dialog-trigger.js +4 -51
  101. package/dialog/dialog.d.ts +3 -30
  102. package/dialog/dialog.js +8 -158
  103. package/dialog/index.d.ts +11 -11
  104. package/dialog/index.js +9 -9
  105. package/dropzone/dropzone.d.ts +3 -72
  106. package/dropzone/dropzone.js +29 -407
  107. package/dropzone/index.d.ts +4 -4
  108. package/dropzone/index.js +3 -3
  109. package/field/field.d.ts +3 -30
  110. package/field/field.js +34 -353
  111. package/field/index.d.ts +1 -0
  112. package/field/index.js +1 -0
  113. package/fieldset/fieldset.d.ts +3 -18
  114. package/fieldset/fieldset.js +21 -110
  115. package/fieldset/index.d.ts +1 -0
  116. package/fieldset/index.js +1 -0
  117. package/icon/icon.d.ts +3 -15
  118. package/icon/icon.js +4 -33
  119. package/icon/index.d.ts +2 -3
  120. package/icon/index.js +2 -3
  121. package/input/index.d.ts +3 -3
  122. package/input/index.js +3 -3
  123. package/input/input.d.ts +3 -49
  124. package/input/input.js +57 -238
  125. package/menu/index.d.ts +4 -5
  126. package/menu/index.js +4 -5
  127. package/menu/menu-item.d.ts +3 -13
  128. package/menu/menu-item.js +41 -91
  129. package/menu/menu.d.ts +3 -15
  130. package/menu/menu.js +27 -277
  131. package/menubar/index.d.ts +3 -4
  132. package/menubar/index.js +2 -3
  133. package/menubar/menubar.d.ts +3 -19
  134. package/menubar/menubar.js +12 -183
  135. package/number-field/index.d.ts +3 -3
  136. package/number-field/index.js +3 -3
  137. package/number-field/number-field.d.ts +3 -55
  138. package/number-field/number-field.js +205 -698
  139. package/package.json +126 -113
  140. package/popover/index.d.ts +11 -11
  141. package/popover/index.js +9 -9
  142. package/popover/popover-close.d.ts +3 -12
  143. package/popover/popover-close.js +4 -32
  144. package/popover/popover-popup.d.ts +3 -18
  145. package/popover/popover-popup.js +28 -205
  146. package/popover/popover-trigger.d.ts +3 -13
  147. package/popover/popover-trigger.js +4 -73
  148. package/popover/popover.d.ts +3 -29
  149. package/popover/popover.js +8 -207
  150. package/portal/index.d.ts +3 -4
  151. package/portal/index.js +2 -3
  152. package/portal/portal.d.ts +3 -27
  153. package/portal/portal.js +8 -157
  154. package/preview-card/index.d.ts +9 -9
  155. package/preview-card/index.js +7 -7
  156. package/preview-card/preview-card-popup.d.ts +3 -14
  157. package/preview-card/preview-card-popup.js +29 -193
  158. package/preview-card/preview-card-trigger.d.ts +3 -12
  159. package/preview-card/preview-card-trigger.js +4 -74
  160. package/preview-card/preview-card.d.ts +3 -33
  161. package/preview-card/preview-card.js +8 -239
  162. package/progress/index.d.ts +2 -3
  163. package/progress/index.js +2 -3
  164. package/progress/progress.d.ts +3 -17
  165. package/progress/progress.js +28 -130
  166. package/radio/index.d.ts +6 -6
  167. package/radio/index.js +5 -5
  168. package/radio/radio-group.d.ts +3 -37
  169. package/radio/radio-group.js +8 -200
  170. package/radio/radio.d.ts +3 -28
  171. package/radio/radio.js +38 -213
  172. package/scroll-area/index.d.ts +2 -3
  173. package/scroll-area/index.js +2 -3
  174. package/scroll-area/scroll-area.d.ts +3 -36
  175. package/scroll-area/scroll-area.js +25 -546
  176. package/select/index.d.ts +3 -4
  177. package/select/index.js +2 -3
  178. package/select/select.d.ts +3 -37
  179. package/select/select.js +115 -403
  180. package/separator/index.d.ts +2 -3
  181. package/separator/index.js +2 -3
  182. package/separator/separator.d.ts +3 -10
  183. package/separator/separator.js +23 -84
  184. package/sidebar/index.d.ts +29 -29
  185. package/sidebar/index.js +27 -32
  186. package/sidebar/sidebar-content.d.ts +3 -12
  187. package/sidebar/sidebar-content.js +7 -29
  188. package/sidebar/sidebar-footer.d.ts +3 -10
  189. package/sidebar/sidebar-footer.js +7 -20
  190. package/sidebar/sidebar-group-label.d.ts +3 -15
  191. package/sidebar/sidebar-group-label.js +17 -41
  192. package/sidebar/sidebar-group.d.ts +3 -13
  193. package/sidebar/sidebar-group.js +7 -24
  194. package/sidebar/sidebar-header.d.ts +3 -10
  195. package/sidebar/sidebar-header.js +7 -16
  196. package/sidebar/sidebar-inset.d.ts +3 -13
  197. package/sidebar/sidebar-inset.js +7 -28
  198. package/sidebar/sidebar-menu-button.d.ts +3 -26
  199. package/sidebar/sidebar-menu-button.js +60 -217
  200. package/sidebar/sidebar-menu-item.d.ts +3 -10
  201. package/sidebar/sidebar-menu-item.js +7 -19
  202. package/sidebar/sidebar-menu.d.ts +3 -12
  203. package/sidebar/sidebar-menu.js +7 -25
  204. package/sidebar/sidebar-provider.d.ts +3 -34
  205. package/sidebar/sidebar-provider.js +22 -232
  206. package/sidebar/sidebar-separator.d.ts +3 -10
  207. package/sidebar/sidebar-separator.js +9 -19
  208. package/sidebar/sidebar-trigger.d.ts +3 -14
  209. package/sidebar/sidebar-trigger.js +10 -46
  210. package/sidebar/sidebar.d.ts +3 -19
  211. package/sidebar/sidebar.js +65 -262
  212. package/slider/index.d.ts +3 -3
  213. package/slider/index.js +3 -3
  214. package/slider/slider.d.ts +3 -45
  215. package/slider/slider.js +97 -382
  216. package/spinner/index.d.ts +2 -3
  217. package/spinner/index.js +2 -3
  218. package/spinner/spinner.d.ts +3 -11
  219. package/spinner/spinner.js +20 -163
  220. package/split-button/index.d.ts +3 -1
  221. package/split-button/index.js +3 -1
  222. package/split-button/split-button.d.ts +3 -31
  223. package/split-button/split-button.js +307 -384
  224. package/stepper/index.d.ts +3 -3
  225. package/stepper/index.js +3 -3
  226. package/stepper/stepper.d.ts +3 -41
  227. package/stepper/stepper.js +57 -381
  228. package/switch/index.d.ts +3 -3
  229. package/switch/index.js +3 -3
  230. package/switch/switch.d.ts +3 -30
  231. package/switch/switch.js +63 -228
  232. package/tabs/index.d.ts +12 -12
  233. package/tabs/index.js +11 -11
  234. package/tabs/tab.d.ts +3 -14
  235. package/tabs/tab.js +33 -131
  236. package/tabs/tabs-indicator.d.ts +3 -9
  237. package/tabs/tabs-indicator.js +17 -22
  238. package/tabs/tabs-list.d.ts +3 -15
  239. package/tabs/tabs-list.js +14 -113
  240. package/tabs/tabs-panel.d.ts +3 -16
  241. package/tabs/tabs-panel.js +32 -114
  242. package/tabs/tabs.d.ts +3 -22
  243. package/tabs/tabs.js +8 -170
  244. package/textarea/index.d.ts +4 -4
  245. package/textarea/index.js +3 -3
  246. package/textarea/textarea.d.ts +3 -36
  247. package/textarea/textarea.js +63 -220
  248. package/toggle/index.d.ts +6 -6
  249. package/toggle/index.js +5 -5
  250. package/toggle/toggle-group.d.ts +3 -27
  251. package/toggle/toggle-group.js +9 -224
  252. package/toggle/toggle.d.ts +3 -26
  253. package/toggle/toggle.js +94 -178
  254. package/tokens/properties.css +361 -0
  255. package/tokens/prose.css +250 -0
  256. package/tokens/prose.d.ts +2 -0
  257. package/tokens/prose.js +4 -0
  258. package/tokens/tokens-raw.d.ts +2 -0
  259. package/tokens/tokens-raw.js +2 -0
  260. package/tokens/tokens.css +409 -0
  261. package/tokens/tokens.d.ts +2 -0
  262. package/tokens/tokens.js +5 -0
  263. package/toolbar/index.d.ts +2 -3
  264. package/toolbar/index.js +2 -3
  265. package/toolbar/toolbar.d.ts +3 -11
  266. package/toolbar/toolbar.js +25 -116
  267. package/tooltip/index.d.ts +9 -9
  268. package/tooltip/index.js +7 -7
  269. package/tooltip/tooltip-popup.d.ts +3 -14
  270. package/tooltip/tooltip-popup.js +32 -185
  271. package/tooltip/tooltip-trigger.d.ts +3 -14
  272. package/tooltip/tooltip-trigger.js +5 -148
  273. package/tooltip/tooltip.d.ts +3 -35
  274. package/tooltip/tooltip.js +8 -253
  275. package/trunc/index.d.ts +2 -3
  276. package/trunc/index.js +2 -3
  277. package/trunc/trunc.d.ts +3 -17
  278. package/trunc/trunc.js +10 -108
  279. package/_deprecated/center/center.d.ts +0 -14
  280. package/_deprecated/center/center.js +0 -37
  281. package/_deprecated/center/index.d.ts +0 -3
  282. package/_deprecated/center/index.js +0 -3
  283. package/_deprecated/center/register.js +0 -4
  284. package/_deprecated/hstack/hstack.d.ts +0 -25
  285. package/_deprecated/hstack/hstack.js +0 -187
  286. package/_deprecated/hstack/index.d.ts +0 -4
  287. package/_deprecated/hstack/index.js +0 -3
  288. package/_deprecated/hstack/register.d.ts +0 -1
  289. package/_deprecated/hstack/register.js +0 -4
  290. package/_deprecated/page-inset/index.d.ts +0 -3
  291. package/_deprecated/page-inset/index.js +0 -3
  292. package/_deprecated/page-inset/page-inset.d.ts +0 -28
  293. package/_deprecated/page-inset/page-inset.js +0 -151
  294. package/_deprecated/page-inset/register.d.ts +0 -1
  295. package/_deprecated/page-inset/register.js +0 -4
  296. package/_deprecated/vstack/index.d.ts +0 -3
  297. package/_deprecated/vstack/index.js +0 -3
  298. package/_deprecated/vstack/register.d.ts +0 -1
  299. package/_deprecated/vstack/register.js +0 -4
  300. package/_deprecated/vstack/vstack.d.ts +0 -17
  301. package/_deprecated/vstack/vstack.js +0 -125
  302. package/accordion/accordion-context.d.ts +0 -15
  303. package/accordion/accordion-context.js +0 -3
  304. package/alert-dialog/alert-dialog-context.d.ts +0 -13
  305. package/alert-dialog/alert-dialog-context.js +0 -3
  306. package/checkbox/checkbox-group-context.d.ts +0 -11
  307. package/checkbox/checkbox-group-context.js +0 -3
  308. package/command/command-context.d.ts +0 -30
  309. package/command/command-context.js +0 -3
  310. package/command/command-score.d.ts +0 -6
  311. package/command/command-score.js +0 -31
  312. package/dialog/dialog-context.d.ts +0 -13
  313. package/dialog/dialog-context.js +0 -3
  314. package/global.d.ts +0 -179
  315. package/menubar/menubar-context.d.ts +0 -9
  316. package/menubar/menubar-context.js +0 -2
  317. package/popover/popover-context.d.ts +0 -17
  318. package/popover/popover-context.js +0 -3
  319. package/preview-card/preview-card-context.d.ts +0 -16
  320. package/preview-card/preview-card-context.js +0 -3
  321. package/radio/radio-group-context.d.ts +0 -11
  322. package/radio/radio-group-context.js +0 -2
  323. package/sidebar/sidebar-context.d.ts +0 -15
  324. package/sidebar/sidebar-context.js +0 -3
  325. package/split-button/register.d.ts +0 -1
  326. package/split-button/register.js +0 -4
  327. package/tabs/tabs-context.d.ts +0 -8
  328. package/tabs/tabs-context.js +0 -2
  329. package/toggle/toggle-group-context.d.ts +0 -9
  330. package/toggle/toggle-group-context.js +0 -2
  331. package/tooltip/tooltip-context.d.ts +0 -17
  332. package/tooltip/tooltip-context.js +0 -3
  333. /package/{_deprecated/center/register.d.ts → _install.d.ts} +0 -0
@@ -1,324 +1,75 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/alert-dialog */
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
25
- }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
- };
40
- import { css, html, LitElement } from "lit";
41
- import { property, state } from "lit/decorators.js";
42
- import { ContextConsumer } from "@lit/context";
43
- import { base } from "@deepfuture/dui-core/base";
44
- import { getComposedFocusableElements, queryComposedAutofocus, } from "@deepfuture/dui-core/dom";
45
- import { alertDialogContext } from "./alert-dialog-context.js";
46
- const hostStyles = css `
47
- :host {
48
- display: contents;
49
- }
1
+ import { css } from "lit";
2
+ import { DuiAlertDialogPopupPrimitive } from "@deepfuture/dui-primitives/alert-dialog";
3
+ import "../_install.js";
4
+ const styles = css `
5
+ /* ── Backdrop ── */
50
6
 
51
- :host(:not([mounted])) [part="backdrop"],
52
- :host(:not([mounted])) [part="popup"] {
53
- display: none;
54
- }
55
- `;
56
- const componentStyles = css `
57
7
  [part="backdrop"] {
58
- position: fixed;
59
- min-height: 100dvh;
60
- inset: 0;
61
- z-index: 999;
8
+ background: var(--scrim);
9
+ transition: opacity var(--duration-fast) var(--ease-out-3);
62
10
  }
63
11
 
12
+ [part="backdrop"][data-starting-style],
13
+ [part="backdrop"][data-ending-style] {
14
+ opacity: 0;
15
+ }
16
+
17
+ /* ── Popup ── */
18
+
64
19
  [part="popup"] {
65
- box-sizing: border-box;
66
- position: fixed;
67
- top: 50%;
68
- left: 50%;
69
- transform: translate(-50%, -50%);
70
- width: 24rem;
71
- max-width: calc(100vw - 3rem);
72
- overflow: hidden;
73
- z-index: 1000;
74
- transition-property: opacity, transform;
20
+ margin-top: calc(-1 * var(--space-8));
21
+ padding: var(--space-6) var(--space-5) var(--space-5);
22
+ border-radius: var(--radius-lg);
23
+ border: var(--border-width-thin) solid var(--border);
24
+ background: var(--surface-2);
25
+ color: var(--text-1);
26
+ font-family: var(--font-sans);
27
+ box-shadow: var(--shadow-lg);
28
+ transition-duration: var(--duration-fast);
29
+ display: flex;
30
+ flex-direction: column;
31
+ gap: var(--space-5);
32
+ }
33
+
34
+ [part="popup"][data-starting-style],
35
+ [part="popup"][data-ending-style] {
36
+ opacity: 0;
37
+ transform: translate(-50%, -50%) scale(0.9);
38
+ }
39
+
40
+ /* ── Title ── */
41
+
42
+ [part="title"] {
43
+ font-family: var(--font-sans);
44
+ font-size: var(--text-base);
45
+ line-height: var(--text-base--line-height);
46
+ font-weight: var(--font-weight-semibold);
47
+ color: var(--text-1);
48
+ text-box: trim-both cap alphabetic;
49
+ text-wrap: pretty;
50
+ }
51
+
52
+ /* ── Description ── */
53
+
54
+ [part="description"] {
55
+ margin: 0;
56
+ font-family: var(--font-sans);
57
+ font-size: var(--text-sm);
58
+ line-height: var(--text-sm--line-height);
59
+ color: var(--text-2);
60
+ text-box: trim-both cap alphabetic;
61
+ }
62
+
63
+ /* ── Reduced motion ── */
64
+
65
+ @media (prefers-reduced-motion: reduce) {
66
+ [part="backdrop"],
67
+ [part="popup"] {
68
+ transition-duration: 0s;
69
+ }
75
70
  }
76
71
  `;
77
- /**
78
- * `<dui-alert-dialog-popup>` The popup overlay for the alert dialog.
79
- *
80
- * Renders a backdrop and a centered dialog popup with focus trapping.
81
- * Handles open/close animations via `data-starting-style` / `data-ending-style`.
82
- * Does NOT close on backdrop click — requires explicit user action.
83
- *
84
- * Title and description are provided via named slots and rendered as
85
- * semantic `<h2>` and `<p>` elements with ARIA linkage.
86
- *
87
- * @slot title - Title text for the alert dialog (rendered as `<h2>`).
88
- * @slot description - Description text for the alert dialog (rendered as `<p>`).
89
- * @slot - Default slot for dialog content (actions, etc.).
90
- * @csspart backdrop - The overlay backdrop behind the dialog.
91
- * @csspart popup - The dialog popup container.
92
- * @csspart title - The heading element wrapping the title slot.
93
- * @csspart description - The paragraph element wrapping the description slot.
94
- */
95
- let DuiAlertDialogPopup = (() => {
96
- let _classSuper = LitElement;
97
- let _keepMounted_decorators;
98
- let _keepMounted_initializers = [];
99
- let _keepMounted_extraInitializers = [];
100
- let _initialFocus_decorators;
101
- let _initialFocus_initializers = [];
102
- let _initialFocus_extraInitializers = [];
103
- let _finalFocus_decorators;
104
- let _finalFocus_initializers = [];
105
- let _finalFocus_extraInitializers = [];
106
- let _private_mounted_decorators;
107
- let _private_mounted_initializers = [];
108
- let _private_mounted_extraInitializers = [];
109
- let _private_mounted_descriptor;
110
- let _private_startingStyle_decorators;
111
- let _private_startingStyle_initializers = [];
112
- let _private_startingStyle_extraInitializers = [];
113
- let _private_startingStyle_descriptor;
114
- let _private_endingStyle_decorators;
115
- let _private_endingStyle_initializers = [];
116
- let _private_endingStyle_extraInitializers = [];
117
- let _private_endingStyle_descriptor;
118
- return class DuiAlertDialogPopup extends _classSuper {
119
- static {
120
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
121
- _keepMounted_decorators = [property({ type: Boolean, attribute: "keep-mounted" })];
122
- _initialFocus_decorators = [property({ attribute: "initial-focus" })];
123
- _finalFocus_decorators = [property({ attribute: "final-focus" })];
124
- _private_mounted_decorators = [state()];
125
- _private_startingStyle_decorators = [state()];
126
- _private_endingStyle_decorators = [state()];
127
- __esDecorate(this, null, _keepMounted_decorators, { kind: "accessor", name: "keepMounted", static: false, private: false, access: { has: obj => "keepMounted" in obj, get: obj => obj.keepMounted, set: (obj, value) => { obj.keepMounted = value; } }, metadata: _metadata }, _keepMounted_initializers, _keepMounted_extraInitializers);
128
- __esDecorate(this, null, _initialFocus_decorators, { kind: "accessor", name: "initialFocus", static: false, private: false, access: { has: obj => "initialFocus" in obj, get: obj => obj.initialFocus, set: (obj, value) => { obj.initialFocus = value; } }, metadata: _metadata }, _initialFocus_initializers, _initialFocus_extraInitializers);
129
- __esDecorate(this, null, _finalFocus_decorators, { kind: "accessor", name: "finalFocus", static: false, private: false, access: { has: obj => "finalFocus" in obj, get: obj => obj.finalFocus, set: (obj, value) => { obj.finalFocus = value; } }, metadata: _metadata }, _finalFocus_initializers, _finalFocus_extraInitializers);
130
- __esDecorate(this, _private_mounted_descriptor = { get: __setFunctionName(function () { return this.#mounted_accessor_storage; }, "#mounted", "get"), set: __setFunctionName(function (value) { this.#mounted_accessor_storage = value; }, "#mounted", "set") }, _private_mounted_decorators, { kind: "accessor", name: "#mounted", static: false, private: true, access: { has: obj => #mounted in obj, get: obj => obj.#mounted, set: (obj, value) => { obj.#mounted = value; } }, metadata: _metadata }, _private_mounted_initializers, _private_mounted_extraInitializers);
131
- __esDecorate(this, _private_startingStyle_descriptor = { get: __setFunctionName(function () { return this.#startingStyle_accessor_storage; }, "#startingStyle", "get"), set: __setFunctionName(function (value) { this.#startingStyle_accessor_storage = value; }, "#startingStyle", "set") }, _private_startingStyle_decorators, { kind: "accessor", name: "#startingStyle", static: false, private: true, access: { has: obj => #startingStyle in obj, get: obj => obj.#startingStyle, set: (obj, value) => { obj.#startingStyle = value; } }, metadata: _metadata }, _private_startingStyle_initializers, _private_startingStyle_extraInitializers);
132
- __esDecorate(this, _private_endingStyle_descriptor = { get: __setFunctionName(function () { return this.#endingStyle_accessor_storage; }, "#endingStyle", "get"), set: __setFunctionName(function (value) { this.#endingStyle_accessor_storage = value; }, "#endingStyle", "set") }, _private_endingStyle_decorators, { kind: "accessor", name: "#endingStyle", static: false, private: true, access: { has: obj => #endingStyle in obj, get: obj => obj.#endingStyle, set: (obj, value) => { obj.#endingStyle = value; } }, metadata: _metadata }, _private_endingStyle_initializers, _private_endingStyle_extraInitializers);
133
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
134
- }
135
- static tagName = "dui-alert-dialog-popup";
136
- static styles = [base, hostStyles, componentStyles];
137
- #keepMounted_accessor_storage = __runInitializers(this, _keepMounted_initializers, false);
138
- /** Keep the popup in the DOM when closed. */
139
- get keepMounted() { return this.#keepMounted_accessor_storage; }
140
- set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
141
- #initialFocus_accessor_storage = (__runInitializers(this, _keepMounted_extraInitializers), __runInitializers(this, _initialFocus_initializers, undefined));
142
- /** CSS selector within the popup to focus when the dialog opens. */
143
- get initialFocus() { return this.#initialFocus_accessor_storage; }
144
- set initialFocus(value) { this.#initialFocus_accessor_storage = value; }
145
- #finalFocus_accessor_storage = (__runInitializers(this, _initialFocus_extraInitializers), __runInitializers(this, _finalFocus_initializers, undefined));
146
- /** CSS selector in the document to focus when the dialog closes. */
147
- get finalFocus() { return this.#finalFocus_accessor_storage; }
148
- set finalFocus(value) { this.#finalFocus_accessor_storage = value; }
149
- #mounted_accessor_storage = (__runInitializers(this, _finalFocus_extraInitializers), __runInitializers(this, _private_mounted_initializers, false));
150
- get #mounted() { return _private_mounted_descriptor.get.call(this); }
151
- set #mounted(value) { return _private_mounted_descriptor.set.call(this, value); }
152
- #startingStyle_accessor_storage = (__runInitializers(this, _private_mounted_extraInitializers), __runInitializers(this, _private_startingStyle_initializers, false));
153
- get #startingStyle() { return _private_startingStyle_descriptor.get.call(this); }
154
- set #startingStyle(value) { return _private_startingStyle_descriptor.set.call(this, value); }
155
- #endingStyle_accessor_storage = (__runInitializers(this, _private_startingStyle_extraInitializers), __runInitializers(this, _private_endingStyle_initializers, false));
156
- get #endingStyle() { return _private_endingStyle_descriptor.get.call(this); }
157
- set #endingStyle(value) { return _private_endingStyle_descriptor.set.call(this, value); }
158
- #previouslyFocused = __runInitializers(this, _private_endingStyle_extraInitializers);
159
- #ctx = new ContextConsumer(this, {
160
- context: alertDialogContext,
161
- subscribe: true,
162
- });
163
- updated() {
164
- const isOpen = this.#ctx.value?.open ?? false;
165
- if (isOpen && !this.#mounted) {
166
- this.#animateOpen();
167
- }
168
- else if (!isOpen && this.#mounted && !this.#endingStyle) {
169
- this.#animateClose();
170
- }
171
- }
172
- async #animateOpen() {
173
- this.#previouslyFocused =
174
- document.activeElement ?? undefined;
175
- this.#mounted = true;
176
- this.#startingStyle = true;
177
- await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
178
- this.#startingStyle = false;
179
- await this.updateComplete;
180
- this.#trapFocusIn();
181
- }
182
- #animateClose() {
183
- this.#endingStyle = true;
184
- const popup = this.shadowRoot?.querySelector('[part="popup"]');
185
- if (!popup) {
186
- this.#finishClose();
187
- return;
188
- }
189
- let called = false;
190
- const done = () => {
191
- if (called)
192
- return;
193
- called = true;
194
- popup.removeEventListener("transitionend", onEnd);
195
- clearTimeout(timer);
196
- this.#finishClose();
197
- };
198
- const onEnd = (e) => {
199
- if (e.propertyName === "opacity") {
200
- done();
201
- }
202
- };
203
- popup.addEventListener("transitionend", onEnd);
204
- const timer = setTimeout(done, 200);
205
- }
206
- #finishClose() {
207
- if (!this.#endingStyle && !this.#mounted)
208
- return;
209
- this.#endingStyle = false;
210
- if (!this.keepMounted) {
211
- this.#mounted = false;
212
- }
213
- this.#restoreFocus();
214
- }
215
- #trapFocusIn() {
216
- const popup = this.shadowRoot?.querySelector('[part="popup"]');
217
- if (!popup)
218
- return;
219
- if (this.initialFocus) {
220
- const target = popup.querySelector(this.initialFocus);
221
- if (target) {
222
- target.focus();
223
- return;
224
- }
225
- }
226
- const autoEl = queryComposedAutofocus(popup);
227
- if (autoEl) {
228
- autoEl.focus();
229
- return;
230
- }
231
- const focusables = getComposedFocusableElements(popup);
232
- if (focusables.length > 0) {
233
- focusables[0].focus();
234
- return;
235
- }
236
- popup.focus();
237
- }
238
- #restoreFocus() {
239
- if (this.finalFocus) {
240
- const target = document.querySelector(this.finalFocus);
241
- target?.focus();
242
- return;
243
- }
244
- this.#previouslyFocused?.focus();
245
- this.#previouslyFocused = undefined;
246
- }
247
- #handleKeyDown = (e) => {
248
- if (e.key === "Escape") {
249
- e.preventDefault();
250
- e.stopPropagation();
251
- this.#ctx.value?.closeDialog();
252
- }
253
- if (e.key === "Tab") {
254
- this.#handleTabTrap(e);
255
- }
256
- };
257
- #handleTabTrap(e) {
258
- const popup = this.shadowRoot?.querySelector('[part="popup"]');
259
- if (!popup)
260
- return;
261
- const focusables = getComposedFocusableElements(popup);
262
- if (focusables.length === 0) {
263
- e.preventDefault();
264
- return;
265
- }
266
- const first = focusables[0];
267
- const last = focusables[focusables.length - 1];
268
- const isFirst = first.matches(":focus");
269
- const isLast = last.matches(":focus");
270
- const popupHasFocus = !focusables.some((el) => el.matches(":focus"));
271
- if (e.shiftKey && (isFirst || popupHasFocus)) {
272
- e.preventDefault();
273
- last.focus();
274
- }
275
- else if (!e.shiftKey && isLast) {
276
- e.preventDefault();
277
- first.focus();
278
- }
279
- }
280
- willUpdate() {
281
- if (this.#mounted || this.keepMounted) {
282
- this.setAttribute("mounted", "");
283
- }
284
- else {
285
- this.removeAttribute("mounted");
286
- }
287
- }
288
- render() {
289
- const isOpen = this.#ctx.value?.open ?? false;
290
- const titleId = this.#ctx.value?.titleId ?? "";
291
- const descriptionId = this.#ctx.value?.descriptionId ?? "";
292
- if (!this.#mounted && !this.keepMounted) {
293
- return html ``;
294
- }
295
- return html `
296
- <div
297
- part="backdrop"
298
- ?data-open="${isOpen && !this.#endingStyle}"
299
- ?data-closed="${!isOpen || this.#endingStyle}"
300
- ?data-starting-style="${this.#startingStyle}"
301
- ?data-ending-style="${this.#endingStyle}"
302
- ></div>
303
- <div
304
- part="popup"
305
- role="alertdialog"
306
- aria-modal="true"
307
- aria-labelledby="${titleId}"
308
- aria-describedby="${descriptionId}"
309
- ?data-open="${isOpen && !this.#endingStyle}"
310
- ?data-closed="${!isOpen || this.#endingStyle}"
311
- ?data-starting-style="${this.#startingStyle}"
312
- ?data-ending-style="${this.#endingStyle}"
313
- tabindex="-1"
314
- @keydown="${this.#handleKeyDown}"
315
- >
316
- <h2 part="title" id="${titleId}"><slot name="title"></slot></h2>
317
- <p part="description" id="${descriptionId}"><slot name="description"></slot></p>
318
- <slot></slot>
319
- </div>
320
- `;
321
- }
322
- };
323
- })();
324
- export { DuiAlertDialogPopup };
72
+ export class DuiAlertDialogPopup extends DuiAlertDialogPopupPrimitive {
73
+ static styles = [...DuiAlertDialogPopupPrimitive.styles, styles];
74
+ }
75
+ customElements.define(DuiAlertDialogPopup.tagName, DuiAlertDialogPopup);
@@ -1,15 +1,4 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/alert-dialog */
2
- import { LitElement, type TemplateResult } from "lit";
3
- /**
4
- * `<dui-alert-dialog-trigger>` — Behavioral wrapper that opens the alert dialog.
5
- *
6
- * Wraps slotted content and opens the alert dialog on click.
7
- *
8
- * @slot - Content that triggers the alert dialog (usually a `<dui-button>`).
9
- */
10
- export declare class DuiAlertDialogTrigger extends LitElement {
11
- #private;
12
- static tagName: "dui-alert-dialog-trigger";
13
- static styles: import("lit").CSSResult[];
14
- render(): TemplateResult;
1
+ import { DuiAlertDialogTriggerPrimitive } from "@deepfuture/dui-primitives/alert-dialog";
2
+ import "../_install.js";
3
+ export declare class DuiAlertDialogTrigger extends DuiAlertDialogTriggerPrimitive {
15
4
  }
@@ -1,52 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/alert-dialog */
2
- import { css, html, LitElement } from "lit";
3
- import { ContextConsumer } from "@lit/context";
4
- import { base } from "@deepfuture/dui-core/base";
5
- import { alertDialogContext } from "./alert-dialog-context.js";
6
- const hostStyles = css `
7
- :host {
8
- display: contents;
9
- }
10
- `;
11
- const componentStyles = css `
12
- .Trigger {
13
- display: contents;
14
- }
15
- `;
16
- /**
17
- * `<dui-alert-dialog-trigger>` — Behavioral wrapper that opens the alert dialog.
18
- *
19
- * Wraps slotted content and opens the alert dialog on click.
20
- *
21
- * @slot - Content that triggers the alert dialog (usually a `<dui-button>`).
22
- */
23
- export class DuiAlertDialogTrigger extends LitElement {
24
- static tagName = "dui-alert-dialog-trigger";
25
- static styles = [base, hostStyles, componentStyles];
26
- #ctx = new ContextConsumer(this, {
27
- context: alertDialogContext,
28
- subscribe: true,
29
- });
30
- #handleClick = () => {
31
- this.#ctx.value?.openDialog();
32
- };
33
- render() {
34
- const isOpen = this.#ctx.value?.open ?? false;
35
- const triggerId = this.#ctx.value?.triggerId ?? "";
36
- const dialogId = this.#ctx.value?.dialogId ?? "";
37
- return html `
38
- <span
39
- class="Trigger"
40
- part="trigger"
41
- id="${triggerId}"
42
- aria-haspopup="dialog"
43
- aria-expanded="${isOpen}"
44
- aria-controls="${isOpen ? dialogId : ""}"
45
- ?data-popup-open="${isOpen}"
46
- @click="${this.#handleClick}"
47
- >
48
- <slot></slot>
49
- </span>
50
- `;
51
- }
1
+ import { DuiAlertDialogTriggerPrimitive } from "@deepfuture/dui-primitives/alert-dialog";
2
+ import "../_install.js";
3
+ export class DuiAlertDialogTrigger extends DuiAlertDialogTriggerPrimitive {
52
4
  }
5
+ customElements.define(DuiAlertDialogTrigger.tagName, DuiAlertDialogTrigger);
@@ -1,32 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/alert-dialog */
2
- import { LitElement, type TemplateResult } from "lit";
3
- import { type AlertDialogContext } from "./alert-dialog-context.js";
4
- export type AlertDialogOpenChangeDetail = {
5
- open: boolean;
6
- };
7
- export declare const openChangeEvent: (detail: AlertDialogOpenChangeDetail) => CustomEvent<AlertDialogOpenChangeDetail>;
8
- /**
9
- * `<dui-alert-dialog>` — Root element for the alert dialog compound component.
10
- *
11
- * Manages open/close state and provides context to child elements.
12
- * Does not render visible DOM — uses `display: contents`.
13
- *
14
- * Unlike `<dui-dialog>`, alert dialogs do NOT close on backdrop click,
15
- * requiring explicit user action to dismiss.
16
- *
17
- * @slot - Default slot for trigger, popup, and other alert dialog parts.
18
- * @fires open-change - Fired when the dialog opens or closes. Detail: { open: boolean }
19
- */
20
- export declare class DuiAlertDialog extends LitElement {
21
- #private;
22
- static tagName: "dui-alert-dialog";
1
+ import { DuiAlertDialogPrimitive } from "@deepfuture/dui-primitives/alert-dialog";
2
+ import "../_install.js";
3
+ export declare class DuiAlertDialog extends DuiAlertDialogPrimitive {
23
4
  static styles: import("lit").CSSResult[];
24
- /** Controls the dialog open state (controlled mode). */
25
- accessor open: boolean | undefined;
26
- /** Initial open state for uncontrolled mode. */
27
- accessor defaultOpen: boolean;
28
- accessor _ctx: AlertDialogContext;
29
- connectedCallback(): void;
30
- willUpdate(): void;
31
- render(): TemplateResult;
32
5
  }