@deepfuture/dui-components 0.0.21 → 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 -194
  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 -535
  176. package/select/index.d.ts +3 -4
  177. package/select/index.js +2 -3
  178. package/select/select.d.ts +3 -39
  179. package/select/select.js +115 -425
  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 -85
  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 -33
  223. package/split-button/split-button.js +307 -394
  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
package/tabs/tabs-list.js CHANGED
@@ -1,123 +1,24 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/tabs */
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
- import { css, html, LitElement } from "lit";
37
- import { consume } from "@lit/context";
38
- import { base } from "@deepfuture/dui-core/base";
39
- import { tabsContext } from "./tabs-context.js";
1
+ import { css } from "lit";
2
+ import { DuiTabsListPrimitive } from "@deepfuture/dui-primitives/tabs";
3
+ import "../_install.js";
40
4
  const styles = css `
41
5
  :host {
42
- display: block;
6
+ --tabs-list-justify: start;
43
7
  }
44
8
 
45
9
  [part="list"] {
46
- display: flex;
47
- position: relative;
48
- z-index: 0;
10
+ justify-content: var(--tabs-list-justify);
11
+ padding-inline: 0;
12
+ gap: 0;
49
13
  }
50
14
 
51
15
  [part="list"][data-orientation="vertical"] {
52
- flex-direction: column;
16
+ box-shadow: inset -1px 0 var(--border);
17
+ padding-inline: 0;
18
+ padding-block: var(--space-1);
53
19
  }
54
20
  `;
55
- /**
56
- * Container for tab triggers. Manages indicator positioning via CSS custom properties.
57
- */
58
- let DuiTabsList = (() => {
59
- let _classSuper = LitElement;
60
- let __ctx_decorators;
61
- let __ctx_initializers = [];
62
- let __ctx_extraInitializers = [];
63
- return class DuiTabsList extends _classSuper {
64
- static {
65
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
66
- __ctx_decorators = [consume({ context: tabsContext, subscribe: true })];
67
- __esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
68
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
69
- }
70
- static tagName = "dui-tabs-list";
71
- static styles = [base, styles];
72
- #_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, void 0);
73
- get _ctx() { return this.#_ctx_accessor_storage; }
74
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
75
- #resizeObserver = __runInitializers(this, __ctx_extraInitializers);
76
- connectedCallback() {
77
- super.connectedCallback();
78
- this.#resizeObserver = new ResizeObserver(() => {
79
- this.#updateIndicatorPosition();
80
- });
81
- }
82
- disconnectedCallback() {
83
- super.disconnectedCallback();
84
- this.#resizeObserver?.disconnect();
85
- }
86
- firstUpdated() {
87
- const list = this.shadowRoot?.querySelector("[part='list']");
88
- if (list) {
89
- this.#resizeObserver?.observe(list);
90
- }
91
- this.#updateIndicatorPosition();
92
- }
93
- updated() {
94
- this.#updateIndicatorPosition();
95
- }
96
- #updateIndicatorPosition() {
97
- const list = this.shadowRoot?.querySelector("[part='list']");
98
- if (!list)
99
- return;
100
- const slot = this.shadowRoot?.querySelector("slot");
101
- const slottedElements = slot?.assignedElements() ?? [];
102
- const activeTab = slottedElements.find((el) => el.tagName === "DUI-TAB" &&
103
- el.getAttribute("value") === this._ctx?.value);
104
- if (activeTab) {
105
- const listRect = list.getBoundingClientRect();
106
- const tabRect = activeTab.getBoundingClientRect();
107
- const left = tabRect.left - listRect.left;
108
- const width = tabRect.width;
109
- list.style.setProperty("--active-tab-left", `${left}px`);
110
- list.style.setProperty("--active-tab-width", `${width}px`);
111
- }
112
- }
113
- render() {
114
- const orientation = this._ctx?.orientation ?? "horizontal";
115
- return html `
116
- <div part="list" role="tablist" data-orientation=${orientation}>
117
- <slot></slot>
118
- </div>
119
- `;
120
- }
121
- };
122
- })();
123
- export { DuiTabsList };
21
+ export class DuiTabsList extends DuiTabsListPrimitive {
22
+ static styles = [...DuiTabsListPrimitive.styles, styles];
23
+ }
24
+ customElements.define(DuiTabsList.tagName, DuiTabsList);
@@ -1,18 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/tabs */
2
- import { LitElement, type TemplateResult } from "lit";
3
- import { type TabsContext } from "./tabs-context.js";
4
- /**
5
- * Content panel for a tab. Shown when the matching tab is active.
6
- */
7
- export declare class DuiTabsPanel extends LitElement {
8
- #private;
9
- static tagName: "dui-tabs-panel";
1
+ import { DuiTabsPanelPrimitive } from "@deepfuture/dui-primitives/tabs";
2
+ import "../_install.js";
3
+ export declare class DuiTabsPanel extends DuiTabsPanelPrimitive {
10
4
  static styles: import("lit").CSSResult[];
11
- /** Panel value — must match the corresponding tab's value. */
12
- accessor value: string;
13
- /** Keep panel in DOM when not active. */
14
- accessor keepMounted: boolean;
15
- accessor _ctx: TabsContext;
16
- willUpdate(): void;
17
- render(): TemplateResult;
18
5
  }
@@ -1,124 +1,42 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/tabs */
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
- import { css, html, LitElement, nothing } from "lit";
37
- import { property } from "lit/decorators.js";
38
- import { consume } from "@lit/context";
39
- import { base } from "@deepfuture/dui-core/base";
40
- import { tabsContext } from "./tabs-context.js";
1
+ import { css } from "lit";
2
+ import { DuiTabsPanelPrimitive } from "@deepfuture/dui-primitives/tabs";
3
+ import "../_install.js";
41
4
  const styles = css `
42
5
  :host {
43
- display: block;
6
+ --tabs-panel-padding: var(--space-3);
7
+ --tabs-panel-border-width: var(--border-width-thin);
8
+ --tabs-panel-border-color: var(--border);
9
+ --tabs-panel-border-radius: var(--radius-md);
10
+ --tabs-panel-background: none;
44
11
  }
45
12
 
46
- .wrapper {
47
- display: contents;
13
+ :host(:not([data-hidden])) {
14
+ flex: 1;
15
+ min-height: 0;
16
+ padding: var(--tabs-panel-padding);
17
+ border: var(--tabs-panel-border-width) solid var(--tabs-panel-border-color);
18
+ border-radius: var(--tabs-panel-border-radius);
19
+ background: var(--tabs-panel-background);
48
20
  }
49
21
 
50
- .wrapper[hidden] {
51
- display: none;
22
+ [part="panel"] {
23
+ transition-property: box-shadow;
24
+ transition-duration: var(--duration-fast);
25
+ font-family: var(--font-sans);
26
+ font-size: var(--text-sm); line-height: var(--text-sm--line-height);
27
+ font-weight: var(--font-weight-regular);
28
+ color: var(--text-2);
52
29
  }
53
30
 
54
- [part="panel"] {
55
- position: relative;
56
- outline: 0;
31
+ [part="panel"]:focus-visible {
32
+ box-shadow:
33
+ 0 0 0 var(--focus-ring-offset) var(--background),
34
+ 0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width))
35
+ var(--focus-ring-color);
36
+ border-radius: var(--radius-md);
57
37
  }
58
38
  `;
59
- /**
60
- * Content panel for a tab. Shown when the matching tab is active.
61
- */
62
- let DuiTabsPanel = (() => {
63
- let _classSuper = LitElement;
64
- let _value_decorators;
65
- let _value_initializers = [];
66
- let _value_extraInitializers = [];
67
- let _keepMounted_decorators;
68
- let _keepMounted_initializers = [];
69
- let _keepMounted_extraInitializers = [];
70
- let __ctx_decorators;
71
- let __ctx_initializers = [];
72
- let __ctx_extraInitializers = [];
73
- return class DuiTabsPanel extends _classSuper {
74
- static {
75
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
76
- _value_decorators = [property()];
77
- _keepMounted_decorators = [property({ type: Boolean, attribute: "keep-mounted" })];
78
- __ctx_decorators = [consume({ context: tabsContext, subscribe: true })];
79
- __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
80
- __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);
81
- __esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
82
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
83
- }
84
- static tagName = "dui-tabs-panel";
85
- static styles = [base, styles];
86
- #value_accessor_storage = __runInitializers(this, _value_initializers, "");
87
- /** Panel value — must match the corresponding tab's value. */
88
- get value() { return this.#value_accessor_storage; }
89
- set value(value) { this.#value_accessor_storage = value; }
90
- #keepMounted_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _keepMounted_initializers, false));
91
- /** Keep panel in DOM when not active. */
92
- get keepMounted() { return this.#keepMounted_accessor_storage; }
93
- set keepMounted(value) { this.#keepMounted_accessor_storage = value; }
94
- #_ctx_accessor_storage = (__runInitializers(this, _keepMounted_extraInitializers), __runInitializers(this, __ctx_initializers, void 0));
95
- get _ctx() { return this.#_ctx_accessor_storage; }
96
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
97
- get #isActive() {
98
- return this._ctx?.value === this.value;
99
- }
100
- willUpdate() {
101
- if (this.#isActive) {
102
- this.removeAttribute("data-hidden");
103
- }
104
- else {
105
- this.setAttribute("data-hidden", "");
106
- }
107
- }
108
- render() {
109
- const isActive = this.#isActive;
110
- return html `
111
- <div class="wrapper" ?hidden=${!isActive}>
112
- ${isActive || this.keepMounted
113
- ? html `<div part="panel" role="tabpanel" tabindex="0"><slot></slot></div>`
114
- : nothing}
115
- </div>
116
- `;
117
- }
118
- constructor() {
119
- super(...arguments);
120
- __runInitializers(this, __ctx_extraInitializers);
121
- }
122
- };
123
- })();
124
- export { DuiTabsPanel };
39
+ export class DuiTabsPanel extends DuiTabsPanelPrimitive {
40
+ static styles = [...DuiTabsPanelPrimitive.styles, styles];
41
+ }
42
+ customElements.define(DuiTabsPanel.tagName, DuiTabsPanel);
package/tabs/tabs.d.ts CHANGED
@@ -1,24 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/tabs */
2
- import { LitElement, type TemplateResult } from "lit";
3
- import { type TabsContext } from "./tabs-context.js";
4
- export declare const valueChangeEvent: (detail: string) => CustomEvent<string>;
5
- /**
6
- * A tabbed interface component with animated indicator and keyboard navigation.
7
- */
8
- export declare class DuiTabs extends LitElement {
9
- #private;
10
- static tagName: "dui-tabs";
1
+ import { DuiTabsPrimitive } from "@deepfuture/dui-primitives/tabs";
2
+ import "../_install.js";
3
+ export declare class DuiTabs extends DuiTabsPrimitive {
11
4
  static styles: import("lit").CSSResult[];
12
- /** Controlled active tab value. */
13
- accessor value: string | undefined;
14
- /** Initial active tab value (uncontrolled mode). */
15
- accessor defaultValue: string | undefined;
16
- /** Layout orientation. */
17
- accessor orientation: "horizontal" | "vertical";
18
- /** Whether tab list appears above or below content. */
19
- accessor controls: "header" | "footer";
20
- accessor _ctx: TabsContext;
21
- connectedCallback(): void;
22
- willUpdate(): void;
23
- render(): TemplateResult;
24
5
  }
package/tabs/tabs.js CHANGED
@@ -1,170 +1,8 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/tabs */
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 { provide } from "@lit/context";
43
- import { base } from "@deepfuture/dui-core/base";
44
- import { customEvent } from "@deepfuture/dui-core/event";
45
- import { tabsContext } from "./tabs-context.js";
46
- export const valueChangeEvent = customEvent("value-change", {
47
- bubbles: true,
48
- composed: true,
49
- });
50
- const styles = css `
51
- :host {
52
- display: block;
53
- }
54
-
55
- [part="root"] {
56
- display: flex;
57
- flex-direction: column;
58
- }
59
-
60
- [part="root"][data-orientation="vertical"] {
61
- flex-direction: row;
62
- }
63
-
64
- :host([controls="footer"]) [part="root"] {
65
- flex-direction: column-reverse;
66
- }
67
- `;
68
- /**
69
- * A tabbed interface component with animated indicator and keyboard navigation.
70
- */
71
- let DuiTabs = (() => {
72
- let _classSuper = LitElement;
73
- let _value_decorators;
74
- let _value_initializers = [];
75
- let _value_extraInitializers = [];
76
- let _defaultValue_decorators;
77
- let _defaultValue_initializers = [];
78
- let _defaultValue_extraInitializers = [];
79
- let _orientation_decorators;
80
- let _orientation_initializers = [];
81
- let _orientation_extraInitializers = [];
82
- let _controls_decorators;
83
- let _controls_initializers = [];
84
- let _controls_extraInitializers = [];
85
- let _private_internalValue_decorators;
86
- let _private_internalValue_initializers = [];
87
- let _private_internalValue_extraInitializers = [];
88
- let _private_internalValue_descriptor;
89
- let __ctx_decorators;
90
- let __ctx_initializers = [];
91
- let __ctx_extraInitializers = [];
92
- return class DuiTabs extends _classSuper {
93
- static {
94
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
95
- _value_decorators = [property()];
96
- _defaultValue_decorators = [property({ attribute: "default-value" })];
97
- _orientation_decorators = [property({ reflect: true })];
98
- _controls_decorators = [property({ reflect: true })];
99
- _private_internalValue_decorators = [state()];
100
- __ctx_decorators = [provide({ context: tabsContext }), state()];
101
- __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
102
- __esDecorate(this, null, _defaultValue_decorators, { kind: "accessor", name: "defaultValue", static: false, private: false, access: { has: obj => "defaultValue" in obj, get: obj => obj.defaultValue, set: (obj, value) => { obj.defaultValue = value; } }, metadata: _metadata }, _defaultValue_initializers, _defaultValue_extraInitializers);
103
- __esDecorate(this, null, _orientation_decorators, { kind: "accessor", name: "orientation", static: false, private: false, access: { has: obj => "orientation" in obj, get: obj => obj.orientation, set: (obj, value) => { obj.orientation = value; } }, metadata: _metadata }, _orientation_initializers, _orientation_extraInitializers);
104
- __esDecorate(this, null, _controls_decorators, { kind: "accessor", name: "controls", static: false, private: false, access: { has: obj => "controls" in obj, get: obj => obj.controls, set: (obj, value) => { obj.controls = value; } }, metadata: _metadata }, _controls_initializers, _controls_extraInitializers);
105
- __esDecorate(this, _private_internalValue_descriptor = { get: __setFunctionName(function () { return this.#internalValue_accessor_storage; }, "#internalValue", "get"), set: __setFunctionName(function (value) { this.#internalValue_accessor_storage = value; }, "#internalValue", "set") }, _private_internalValue_decorators, { kind: "accessor", name: "#internalValue", static: false, private: true, access: { has: obj => #internalValue in obj, get: obj => obj.#internalValue, set: (obj, value) => { obj.#internalValue = value; } }, metadata: _metadata }, _private_internalValue_initializers, _private_internalValue_extraInitializers);
106
- __esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
107
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
108
- }
109
- static tagName = "dui-tabs";
110
- static styles = [base, styles];
111
- #value_accessor_storage = __runInitializers(this, _value_initializers, undefined);
112
- /** Controlled active tab value. */
113
- get value() { return this.#value_accessor_storage; }
114
- set value(value) { this.#value_accessor_storage = value; }
115
- #defaultValue_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _defaultValue_initializers, undefined));
116
- /** Initial active tab value (uncontrolled mode). */
117
- get defaultValue() { return this.#defaultValue_accessor_storage; }
118
- set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
119
- #orientation_accessor_storage = (__runInitializers(this, _defaultValue_extraInitializers), __runInitializers(this, _orientation_initializers, "horizontal"));
120
- /** Layout orientation. */
121
- get orientation() { return this.#orientation_accessor_storage; }
122
- set orientation(value) { this.#orientation_accessor_storage = value; }
123
- #controls_accessor_storage = (__runInitializers(this, _orientation_extraInitializers), __runInitializers(this, _controls_initializers, "header"));
124
- /** Whether tab list appears above or below content. */
125
- get controls() { return this.#controls_accessor_storage; }
126
- set controls(value) { this.#controls_accessor_storage = value; }
127
- #internalValue_accessor_storage = (__runInitializers(this, _controls_extraInitializers), __runInitializers(this, _private_internalValue_initializers, undefined));
128
- get #internalValue() { return _private_internalValue_descriptor.get.call(this); }
129
- set #internalValue(value) { return _private_internalValue_descriptor.set.call(this, value); }
130
- #getValue = (__runInitializers(this, _private_internalValue_extraInitializers), () => this.value ?? this.#internalValue);
131
- #select = (tabValue) => {
132
- if (this.value === undefined) {
133
- this.#internalValue = tabValue;
134
- }
135
- this.dispatchEvent(valueChangeEvent(tabValue));
136
- };
137
- #_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
138
- get _ctx() { return this.#_ctx_accessor_storage; }
139
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
140
- #buildContext() {
141
- return {
142
- value: this.#getValue(),
143
- orientation: this.orientation,
144
- select: this.#select,
145
- };
146
- }
147
- connectedCallback() {
148
- super.connectedCallback();
149
- if (this.value === undefined && this.defaultValue !== undefined) {
150
- this.#internalValue = this.defaultValue;
151
- }
152
- this._ctx = this.#buildContext();
153
- }
154
- willUpdate() {
155
- this._ctx = this.#buildContext();
156
- }
157
- render() {
158
- return html `
159
- <div part="root" data-orientation=${this.orientation}>
160
- <slot></slot>
161
- </div>
162
- `;
163
- }
164
- constructor() {
165
- super(...arguments);
166
- __runInitializers(this, __ctx_extraInitializers);
167
- }
168
- };
169
- })();
170
- export { DuiTabs };
1
+ import { css } from "lit";
2
+ import { DuiTabsPrimitive } from "@deepfuture/dui-primitives/tabs";
3
+ import "../_install.js";
4
+ const styles = css ``;
5
+ export class DuiTabs extends DuiTabsPrimitive {
6
+ static styles = [...DuiTabsPrimitive.styles, styles];
7
+ }
8
+ customElements.define(DuiTabs.tagName, DuiTabs);
@@ -1,4 +1,4 @@
1
- import { DuiTextarea, textareaChangeEvent } from "./textarea.js";
2
- export { DuiTextarea, textareaChangeEvent };
3
- export type { TextareaResize } from "./textarea.js";
4
- export declare const textareaFamily: (typeof DuiTextarea)[];
1
+ import "./textarea.js";
2
+ export { DuiTextarea } from "./textarea.js";
3
+ export type { TextareaResize } from "@deepfuture/dui-primitives/textarea";
4
+ export { textareaChangeEvent } from "@deepfuture/dui-primitives/textarea";
package/textarea/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { DuiTextarea, textareaChangeEvent } from "./textarea.js";
2
- export { DuiTextarea, textareaChangeEvent };
3
- export const textareaFamily = [DuiTextarea];
1
+ import "./textarea.js";
2
+ export { DuiTextarea } from "./textarea.js";
3
+ export { textareaChangeEvent } from "@deepfuture/dui-primitives/textarea";
@@ -1,38 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/textarea */
2
- import { LitElement, type TemplateResult } from "lit";
3
- export type TextareaResize = "none" | "vertical" | "horizontal" | "both" | "auto";
4
- export declare const textareaChangeEvent: (detail: {
5
- value: string;
6
- }) => CustomEvent<{
7
- value: string;
8
- }>;
9
- /**
10
- * A multi-line text input with resize modes including auto-grow.
11
- */
12
- export declare class DuiTextarea extends LitElement {
13
- #private;
14
- static tagName: "dui-textarea";
15
- static formAssociated: boolean;
16
- static shadowRootOptions: ShadowRootInit;
1
+ import { DuiTextareaPrimitive } from "@deepfuture/dui-primitives/textarea";
2
+ import "../_install.js";
3
+ export declare class DuiTextarea extends DuiTextareaPrimitive {
17
4
  static styles: import("lit").CSSResult[];
18
- constructor();
19
- /** Current textarea value. */
20
- accessor value: string;
21
- /** Placeholder text. */
22
- accessor placeholder: string;
23
- accessor disabled: boolean;
24
- accessor required: boolean;
25
- accessor readonly: boolean;
26
- /** Number of visible text rows. */
27
- accessor rows: number | undefined;
28
- accessor minLength: number | undefined;
29
- accessor maxLength: number | undefined;
30
- accessor name: string;
31
- /** Resize behavior: "none" | "vertical" | "horizontal" | "both" | "auto". */
32
- accessor resize: TextareaResize;
33
- /** Maximum height (CSS value). Textarea scrolls when content exceeds this. */
34
- accessor maxHeight: string | undefined;
35
- willUpdate(): void;
36
- updated(): void;
37
- render(): TemplateResult;
38
5
  }