@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,484 +1,121 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/data-table */
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, nothing } from "lit";
41
- import { property, state } from "lit/decorators.js";
42
- import { repeat } from "lit/directives/repeat.js";
43
- import { styleMap } from "lit/directives/style-map.js";
44
- import { base } from "@deepfuture/dui-core/base";
45
- import { customEvent } from "@deepfuture/dui-core/event";
46
- // ── Events ─────────────────────────────────────────────────────────────
47
- export const sortChangeEvent = customEvent("sort-change", {
48
- bubbles: true,
49
- composed: true,
50
- });
51
- export const pageChangeEvent = customEvent("page-change", {
52
- bubbles: true,
53
- composed: true,
54
- });
55
- // ── Inline SVG sort icons ──────────────────────────────────────────────
56
- const chevronUpDown = html `<svg
57
- xmlns="http://www.w3.org/2000/svg"
58
- width="100%"
59
- height="100%"
60
- viewBox="0 0 24 24"
61
- fill="none"
62
- stroke="currentColor"
63
- stroke-width="2"
64
- stroke-linecap="round"
65
- stroke-linejoin="round"
66
- >
67
- <path d="m7 15 5 5 5-5" />
68
- <path d="m7 9 5-5 5 5" />
69
- </svg>`;
70
- const chevronUp = html `<svg
71
- xmlns="http://www.w3.org/2000/svg"
72
- width="100%"
73
- height="100%"
74
- viewBox="0 0 24 24"
75
- fill="none"
76
- stroke="currentColor"
77
- stroke-width="2"
78
- stroke-linecap="round"
79
- stroke-linejoin="round"
80
- >
81
- <path d="m18 15-6-6-6 6" />
82
- </svg>`;
83
- const chevronDown = html `<svg
84
- xmlns="http://www.w3.org/2000/svg"
85
- width="100%"
86
- height="100%"
87
- viewBox="0 0 24 24"
88
- fill="none"
89
- stroke="currentColor"
90
- stroke-width="2"
91
- stroke-linecap="round"
92
- stroke-linejoin="round"
93
- >
94
- <path d="m6 9 6 6 6-6" />
95
- </svg>`;
96
- // ── Pure helpers ────────────────────────────────────────────────────────
97
- function compareValues(a, b) {
98
- if (a == null && b == null)
99
- return 0;
100
- if (a == null)
101
- return -1;
102
- if (b == null)
103
- return 1;
104
- if (typeof a === "number" && typeof b === "number")
105
- return a - b;
106
- if (typeof a === "string" && typeof b === "string")
107
- return a.localeCompare(b);
108
- if (a instanceof Date && b instanceof Date)
109
- return a.getTime() - b.getTime();
110
- return String(a).localeCompare(String(b));
111
- }
112
- function sortData(data, sort) {
113
- if (!sort)
114
- return [...data];
115
- const { column, direction } = sort;
116
- const multiplier = direction === "asc" ? 1 : -1;
117
- return [...data].sort((a, b) => multiplier * compareValues(a[column], b[column]));
118
- }
119
- function paginateData(data, page, pageSize) {
120
- const start = (page - 1) * pageSize;
121
- return data.slice(start, start + pageSize);
122
- }
123
- // ── Styles ─────────────────────────────────────────────────────────────
124
- const hostStyles = css `
125
- :host {
126
- display: block;
127
- }
128
- `;
129
- const componentStyles = css `
1
+ import { css } from "lit";
2
+ import { DuiDataTablePrimitive } from "@deepfuture/dui-primitives/data-table";
3
+ import "../_install.js";
4
+ const styles = css `
130
5
  .DataTable {
131
- display: flex;
132
- flex-direction: column;
6
+ gap: var(--space-2);
133
7
  }
134
8
 
135
9
  .TableWindow {
136
- overflow: auto;
10
+ border: var(--border-width-thin) solid var(--border);
11
+ border-radius: var(--radius-md);
12
+ scrollbar-color: var(--text-2) transparent;
13
+ scrollbar-width: thin;
137
14
  }
138
15
 
139
16
  table {
140
- border-collapse: collapse;
141
- min-width: 100%;
142
- }
143
-
144
- thead {
145
- position: sticky;
146
- top: 0;
147
- z-index: 1;
17
+ font-family: var(--font-sans);
18
+ font-size: var(--text-sm); line-height: var(--text-sm--line-height);
19
+ text-box: trim-both cap alphabetic;
148
20
  }
149
21
 
150
22
  th {
151
- text-align: left;
152
- white-space: nowrap;
153
- user-select: none;
23
+ height: var(--component-height-lg);
24
+ padding: 0 var(--space-3);
25
+ font-weight: var(--font-weight-medium);
26
+ font-size: var(--text-xs); line-height: var(--text-xs--line-height);
27
+ text-box: trim-both cap alphabetic;
28
+ color: var(--text-2);
29
+ background: var(--surface-1);
30
+ border-bottom: var(--border-width-thin) solid var(--border);
154
31
  }
155
32
 
156
- th[aria-sort] {
157
- cursor: pointer;
33
+ th[aria-sort]:hover {
34
+ color: var(--text-1);
158
35
  }
159
36
 
160
37
  .HeaderContent {
161
- display: inline-flex;
162
- align-items: center;
38
+ gap: var(--space-1);
163
39
  }
164
40
 
165
41
  .SortIcon {
166
- display: inline-flex;
167
- flex-shrink: 0;
42
+ width: var(--space-3_5);
43
+ height: var(--space-3_5);
44
+ opacity: 0.4;
45
+ }
46
+
47
+ th[aria-sort="ascending"] .SortIcon,
48
+ th[aria-sort="descending"] .SortIcon {
49
+ opacity: 1;
50
+ color: var(--text-1);
51
+ }
52
+
53
+ tbody tr {
54
+ border-bottom: var(--border-width-thin) solid var(--border);
55
+ transition-property: background, filter, transform;
56
+ transition-duration: var(--duration-fast);
57
+ }
58
+
59
+ tbody tr:last-child {
60
+ border-bottom: none;
61
+ }
62
+
63
+ tbody tr:hover {
64
+ background: var(--surface-1);
65
+ }
66
+
67
+ td {
68
+ padding: var(--space-2) var(--space-3);
69
+ vertical-align: middle;
70
+ }
71
+
72
+ .EmptyRow td {
73
+ height: var(--space-24);
74
+ text-align: center;
75
+ color: var(--text-2);
168
76
  }
169
77
 
170
78
  .Pagination {
171
- display: flex;
172
- align-items: center;
173
- justify-content: space-between;
79
+ padding: 0 var(--space-1);
80
+ font-size: var(--text-sm); line-height: var(--text-sm--line-height);
81
+ color: var(--text-2);
174
82
  }
175
83
 
176
84
  .PageInfo {
177
- display: flex;
178
- align-items: center;
85
+ gap: var(--space-1);
179
86
  }
180
87
 
181
88
  .PageControls {
182
- display: flex;
183
- align-items: center;
89
+ gap: var(--space-1);
184
90
  }
185
91
 
186
92
  .PageButton {
187
- display: inline-flex;
188
- align-items: center;
189
- justify-content: center;
190
- cursor: pointer;
191
- border: none;
192
- background: transparent;
93
+ width: var(--component-height-sm);
94
+ height: var(--component-height-sm);
95
+ border: var(--border-width-thin) solid var(--border);
96
+ border-radius: var(--radius-md);
97
+ color: var(--text-1);
98
+ font-size: var(--text-sm); line-height: var(--text-sm--line-height);
99
+ transition-property: background;
100
+ transition-duration: var(--duration-fast);
101
+ }
102
+
103
+ .PageButton:hover:not(:disabled) {
104
+ background: var(--surface-1);
193
105
  }
194
106
 
195
107
  .PageButton:disabled {
196
- cursor: not-allowed;
108
+ opacity: 0.4;
109
+ }
110
+
111
+ .PageButton:focus-visible {
112
+ outline: none;
113
+ box-shadow:
114
+ 0 0 0 var(--focus-ring-offset) var(--background),
115
+ 0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);
197
116
  }
198
117
  `;
199
- // ── Component ──────────────────────────────────────────────────────────
200
- /**
201
- * `<dui-data-table>` — A sortable, paginated data table.
202
- *
203
- * Accepts column definitions and row data, with optional sorting and
204
- * pagination. Cells can be customized via column `render` functions.
205
- *
206
- * @fires sort-change - Fired when a sortable column header is clicked. Detail: SortState
207
- * @fires page-change - Fired when the page changes. Detail: PageState
208
- */
209
- let DuiDataTable = (() => {
210
- let _classSuper = LitElement;
211
- let _columns_decorators;
212
- let _columns_initializers = [];
213
- let _columns_extraInitializers = [];
214
- let _data_decorators;
215
- let _data_initializers = [];
216
- let _data_extraInitializers = [];
217
- let _pageSize_decorators;
218
- let _pageSize_initializers = [];
219
- let _pageSize_extraInitializers = [];
220
- let _rowKey_decorators;
221
- let _rowKey_initializers = [];
222
- let _rowKey_extraInitializers = [];
223
- let _emptyText_decorators;
224
- let _emptyText_initializers = [];
225
- let _emptyText_extraInitializers = [];
226
- let _private_sort_decorators;
227
- let _private_sort_initializers = [];
228
- let _private_sort_extraInitializers = [];
229
- let _private_sort_descriptor;
230
- let _private_page_decorators;
231
- let _private_page_initializers = [];
232
- let _private_page_extraInitializers = [];
233
- let _private_page_descriptor;
234
- let _private_displayRows_decorators;
235
- let _private_displayRows_initializers = [];
236
- let _private_displayRows_extraInitializers = [];
237
- let _private_displayRows_descriptor;
238
- return class DuiDataTable extends _classSuper {
239
- static {
240
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
241
- _columns_decorators = [property({ attribute: false })];
242
- _data_decorators = [property({ attribute: false })];
243
- _pageSize_decorators = [property({ type: Number, attribute: "page-size" })];
244
- _rowKey_decorators = [property({ attribute: false })];
245
- _emptyText_decorators = [property({ attribute: "empty-text" })];
246
- _private_sort_decorators = [state()];
247
- _private_page_decorators = [state()];
248
- _private_displayRows_decorators = [state()];
249
- __esDecorate(this, null, _columns_decorators, { kind: "accessor", name: "columns", static: false, private: false, access: { has: obj => "columns" in obj, get: obj => obj.columns, set: (obj, value) => { obj.columns = value; } }, metadata: _metadata }, _columns_initializers, _columns_extraInitializers);
250
- __esDecorate(this, null, _data_decorators, { kind: "accessor", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
251
- __esDecorate(this, null, _pageSize_decorators, { kind: "accessor", name: "pageSize", static: false, private: false, access: { has: obj => "pageSize" in obj, get: obj => obj.pageSize, set: (obj, value) => { obj.pageSize = value; } }, metadata: _metadata }, _pageSize_initializers, _pageSize_extraInitializers);
252
- __esDecorate(this, null, _rowKey_decorators, { kind: "accessor", name: "rowKey", static: false, private: false, access: { has: obj => "rowKey" in obj, get: obj => obj.rowKey, set: (obj, value) => { obj.rowKey = value; } }, metadata: _metadata }, _rowKey_initializers, _rowKey_extraInitializers);
253
- __esDecorate(this, null, _emptyText_decorators, { kind: "accessor", name: "emptyText", static: false, private: false, access: { has: obj => "emptyText" in obj, get: obj => obj.emptyText, set: (obj, value) => { obj.emptyText = value; } }, metadata: _metadata }, _emptyText_initializers, _emptyText_extraInitializers);
254
- __esDecorate(this, _private_sort_descriptor = { get: __setFunctionName(function () { return this.#sort_accessor_storage; }, "#sort", "get"), set: __setFunctionName(function (value) { this.#sort_accessor_storage = value; }, "#sort", "set") }, _private_sort_decorators, { kind: "accessor", name: "#sort", static: false, private: true, access: { has: obj => #sort in obj, get: obj => obj.#sort, set: (obj, value) => { obj.#sort = value; } }, metadata: _metadata }, _private_sort_initializers, _private_sort_extraInitializers);
255
- __esDecorate(this, _private_page_descriptor = { get: __setFunctionName(function () { return this.#page_accessor_storage; }, "#page", "get"), set: __setFunctionName(function (value) { this.#page_accessor_storage = value; }, "#page", "set") }, _private_page_decorators, { kind: "accessor", name: "#page", static: false, private: true, access: { has: obj => #page in obj, get: obj => obj.#page, set: (obj, value) => { obj.#page = value; } }, metadata: _metadata }, _private_page_initializers, _private_page_extraInitializers);
256
- __esDecorate(this, _private_displayRows_descriptor = { get: __setFunctionName(function () { return this.#displayRows_accessor_storage; }, "#displayRows", "get"), set: __setFunctionName(function (value) { this.#displayRows_accessor_storage = value; }, "#displayRows", "set") }, _private_displayRows_decorators, { kind: "accessor", name: "#displayRows", static: false, private: true, access: { has: obj => #displayRows in obj, get: obj => obj.#displayRows, set: (obj, value) => { obj.#displayRows = value; } }, metadata: _metadata }, _private_displayRows_initializers, _private_displayRows_extraInitializers);
257
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
258
- }
259
- static tagName = "dui-data-table";
260
- static styles = [base, hostStyles, componentStyles];
261
- #columns_accessor_storage = __runInitializers(this, _columns_initializers, []);
262
- /** Column definitions describing each visible column. */
263
- get columns() { return this.#columns_accessor_storage; }
264
- set columns(value) { this.#columns_accessor_storage = value; }
265
- #data_accessor_storage = (__runInitializers(this, _columns_extraInitializers), __runInitializers(this, _data_initializers, []));
266
- /** The full data array. Sorting and pagination are applied internally. */
267
- get data() { return this.#data_accessor_storage; }
268
- set data(value) { this.#data_accessor_storage = value; }
269
- #pageSize_accessor_storage = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _pageSize_initializers, 10));
270
- /** Number of rows per page. Set to 0 to disable pagination. */
271
- get pageSize() { return this.#pageSize_accessor_storage; }
272
- set pageSize(value) { this.#pageSize_accessor_storage = value; }
273
- #rowKey_accessor_storage = (__runInitializers(this, _pageSize_extraInitializers), __runInitializers(this, _rowKey_initializers, undefined));
274
- /** Key function to derive a unique identifier from each row. */
275
- get rowKey() { return this.#rowKey_accessor_storage; }
276
- set rowKey(value) { this.#rowKey_accessor_storage = value; }
277
- #emptyText_accessor_storage = (__runInitializers(this, _rowKey_extraInitializers), __runInitializers(this, _emptyText_initializers, "No results."));
278
- /** Text shown when the data array is empty. */
279
- get emptyText() { return this.#emptyText_accessor_storage; }
280
- set emptyText(value) { this.#emptyText_accessor_storage = value; }
281
- #sort_accessor_storage = (__runInitializers(this, _emptyText_extraInitializers), __runInitializers(this, _private_sort_initializers, null));
282
- get #sort() { return _private_sort_descriptor.get.call(this); }
283
- set #sort(value) { return _private_sort_descriptor.set.call(this, value); }
284
- #page_accessor_storage = (__runInitializers(this, _private_sort_extraInitializers), __runInitializers(this, _private_page_initializers, 1));
285
- get #page() { return _private_page_descriptor.get.call(this); }
286
- set #page(value) { return _private_page_descriptor.set.call(this, value); }
287
- #displayRows_accessor_storage = (__runInitializers(this, _private_page_extraInitializers), __runInitializers(this, _private_displayRows_initializers, []));
288
- get #displayRows() { return _private_displayRows_descriptor.get.call(this); }
289
- set #displayRows(value) { return _private_displayRows_descriptor.set.call(this, value); }
290
- // ── Lifecycle ──────────────────────────────────────────────────────
291
- willUpdate(changed) {
292
- // Recompute display rows when data, sort, page, or pageSize change.
293
- if (changed.has("data") ||
294
- changed.has("pageSize") ||
295
- changed.has("#sort") ||
296
- changed.has("#page")) {
297
- // Reset page when data changes.
298
- if (changed.has("data")) {
299
- this.#page = 1;
300
- }
301
- const sorted = sortData(this.data, this.#sort);
302
- if (this.pageSize > 0) {
303
- this.#displayRows = paginateData(sorted, this.#page, this.pageSize);
304
- }
305
- else {
306
- this.#displayRows = sorted;
307
- }
308
- }
309
- }
310
- // ── Computed ───────────────────────────────────────────────────────
311
- get #totalPages() {
312
- if (this.pageSize <= 0)
313
- return 1;
314
- return Math.max(1, Math.ceil(this.data.length / this.pageSize));
315
- }
316
- get #pageState() {
317
- return {
318
- page: this.#page,
319
- pageSize: this.pageSize,
320
- totalRows: this.data.length,
321
- totalPages: this.#totalPages,
322
- };
323
- }
324
- // ── Sort handling ─────────────────────────────────────────────────
325
- #handleSort(column) {
326
- if (this.#sort?.column === column) {
327
- if (this.#sort.direction === "asc") {
328
- this.#sort = { column, direction: "desc" };
329
- }
330
- else {
331
- // desc → clear
332
- this.#sort = null;
333
- }
334
- }
335
- else {
336
- this.#sort = { column, direction: "asc" };
337
- }
338
- this.#page = 1;
339
- this.dispatchEvent(sortChangeEvent(this.#sort));
340
- }
341
- // ── Pagination handling ───────────────────────────────────────────
342
- #goToPage(page) {
343
- this.#page = Math.max(1, Math.min(page, this.#totalPages));
344
- this.dispatchEvent(pageChangeEvent(this.#pageState));
345
- }
346
- // ── Render ────────────────────────────────────────────────────────
347
- #renderSortIcon(column) {
348
- if (!column.sortable)
349
- return nothing;
350
- if (this.#sort?.column === column.key) {
351
- return html `<span class="SortIcon"
352
- >${this.#sort.direction === "asc" ? chevronUp : chevronDown}</span
353
- >`;
354
- }
355
- return html `<span class="SortIcon">${chevronUpDown}</span>`;
356
- }
357
- #renderHeader() {
358
- return html `
359
- <thead>
360
- <tr>
361
- ${this.columns.map((col) => {
362
- const style = col.width ? { width: col.width } : {};
363
- const sortAttr = col.sortable
364
- ? this.#sort?.column === col.key
365
- ? this.#sort.direction === "asc"
366
- ? "ascending"
367
- : "descending"
368
- : "none"
369
- : undefined;
370
- return html `
371
- <th
372
- style=${styleMap(style)}
373
- aria-sort=${sortAttr ?? nothing}
374
- @click=${col.sortable
375
- ? () => this.#handleSort(col.key)
376
- : nothing}
377
- >
378
- <span class="HeaderContent">
379
- ${col.header} ${this.#renderSortIcon(col)}
380
- </span>
381
- </th>
382
- `;
383
- })}
384
- </tr>
385
- </thead>
386
- `;
387
- }
388
- #renderBody() {
389
- if (this.#displayRows.length === 0) {
390
- return html `
391
- <tbody>
392
- <tr class="EmptyRow">
393
- <td colspan=${this.columns.length}>${this.emptyText}</td>
394
- </tr>
395
- </tbody>
396
- `;
397
- }
398
- const keyFn = this.rowKey
399
- ? (row, index) => this.rowKey(row)
400
- : (_row, index) => index;
401
- return html `
402
- <tbody>
403
- ${repeat(this.#displayRows, keyFn, (row) => html `
404
- <tr>
405
- ${this.columns.map((col) => {
406
- const value = row[col.key];
407
- const content = col.render
408
- ? col.render(value, row)
409
- : (value ?? "");
410
- return html `<td>${content}</td>`;
411
- })}
412
- </tr>
413
- `)}
414
- </tbody>
415
- `;
416
- }
417
- #renderPagination() {
418
- if (this.pageSize <= 0 || this.data.length === 0)
419
- return nothing;
420
- const start = (this.#page - 1) * this.pageSize + 1;
421
- const end = Math.min(this.#page * this.pageSize, this.data.length);
422
- const isFirst = this.#page === 1;
423
- const isLast = this.#page === this.#totalPages;
424
- return html `
425
- <div class="Pagination" part="pagination">
426
- <div class="PageInfo">
427
- <span>${start}-${end} of ${this.data.length}</span>
428
- </div>
429
- <div class="PageControls">
430
- <button
431
- class="PageButton"
432
- ?disabled=${isFirst}
433
- @click=${() => this.#goToPage(1)}
434
- aria-label="First page"
435
- >
436
- <dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m11 17-5-5 5-5"/><path d="m18 17-5-5 5-5"/></svg></dui-icon>
437
- </button>
438
- <button
439
- class="PageButton"
440
- ?disabled=${isFirst}
441
- @click=${() => this.#goToPage(this.#page - 1)}
442
- aria-label="Previous page"
443
- >
444
- <dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg></dui-icon>
445
- </button>
446
- <button
447
- class="PageButton"
448
- ?disabled=${isLast}
449
- @click=${() => this.#goToPage(this.#page + 1)}
450
- aria-label="Next page"
451
- >
452
- <dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg></dui-icon>
453
- </button>
454
- <button
455
- class="PageButton"
456
- ?disabled=${isLast}
457
- @click=${() => this.#goToPage(this.#totalPages)}
458
- aria-label="Last page"
459
- >
460
- <dui-icon style="--icon-size: var(--text-sm)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 17 5-5-5-5"/><path d="m13 17 5-5-5-5"/></svg></dui-icon>
461
- </button>
462
- </div>
463
- </div>
464
- `;
465
- }
466
- render() {
467
- return html `
468
- <div class="DataTable" part="root">
469
- <div class="TableWindow" part="table-window">
470
- <table part="table">
471
- ${this.#renderHeader()} ${this.#renderBody()}
472
- </table>
473
- </div>
474
- ${this.#renderPagination()}
475
- </div>
476
- `;
477
- }
478
- constructor() {
479
- super(...arguments);
480
- __runInitializers(this, _private_displayRows_extraInitializers);
481
- }
482
- };
483
- })();
484
- export { DuiDataTable };
118
+ export class DuiDataTable extends DuiDataTablePrimitive {
119
+ static styles = [...DuiDataTablePrimitive.styles, styles];
120
+ }
121
+ customElements.define(DuiDataTable.tagName, DuiDataTable);
@@ -1,4 +1,3 @@
1
- import { DuiDataTable } from "./data-table.js";
2
- export { DuiDataTable };
3
- export type { ColumnDef, SortDirection, SortState, PageState } from "./data-table.js";
4
- export declare const dataTableFamily: (typeof DuiDataTable)[];
1
+ import "./data-table.js";
2
+ export { DuiDataTable } from "./data-table.js";
3
+ export type { ColumnDef, SortDirection, SortState, PageState } from "@deepfuture/dui-primitives/data-table";
@@ -1,3 +1,2 @@
1
- import { DuiDataTable } from "./data-table.js";
2
- export { DuiDataTable };
3
- export const dataTableFamily = [DuiDataTable];
1
+ import "./data-table.js";
2
+ export { DuiDataTable } from "./data-table.js";
@@ -1,15 +1,4 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
2
- import { LitElement, type TemplateResult } from "lit";
3
- /**
4
- * `<dui-dialog-close>` — A close button wrapper for the dialog.
5
- *
6
- * Wraps slotted content and closes the dialog on click.
7
- *
8
- * @slot - Content that closes the dialog (usually a button).
9
- */
10
- export declare class DuiDialogClose extends LitElement {
11
- #private;
12
- static tagName: "dui-dialog-close";
13
- static styles: import("lit").CSSResult[];
14
- render(): TemplateResult;
1
+ import { DuiDialogClosePrimitive } from "@deepfuture/dui-primitives/dialog";
2
+ import "../_install.js";
3
+ export declare class DuiDialogClose extends DuiDialogClosePrimitive {
15
4
  }
@@ -1,35 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
2
- import { css, html, LitElement } from "lit";
3
- import { ContextConsumer } from "@lit/context";
4
- import { base } from "@deepfuture/dui-core/base";
5
- import { dialogContext } from "./dialog-context.js";
6
- const hostStyles = css `
7
- :host {
8
- display: contents;
9
- }
10
- `;
11
- /**
12
- * `<dui-dialog-close>` — A close button wrapper for the dialog.
13
- *
14
- * Wraps slotted content and closes the dialog on click.
15
- *
16
- * @slot - Content that closes the dialog (usually a button).
17
- */
18
- export class DuiDialogClose extends LitElement {
19
- static tagName = "dui-dialog-close";
20
- static styles = [base, hostStyles];
21
- #ctx = new ContextConsumer(this, {
22
- context: dialogContext,
23
- subscribe: true,
24
- });
25
- #handleClick = () => {
26
- this.#ctx.value?.closeDialog();
27
- };
28
- render() {
29
- return html `
30
- <span @click="${this.#handleClick}">
31
- <slot></slot>
32
- </span>
33
- `;
34
- }
1
+ import { DuiDialogClosePrimitive } from "@deepfuture/dui-primitives/dialog";
2
+ import "../_install.js";
3
+ export class DuiDialogClose extends DuiDialogClosePrimitive {
35
4
  }
5
+ customElements.define(DuiDialogClose.tagName, DuiDialogClose);