@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
package/slider/slider.js CHANGED
@@ -1,414 +1,129 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/slider */
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 { base } from "@deepfuture/dui-core/base";
43
- import { customEvent } from "@deepfuture/dui-core/event";
44
- export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
45
- export const valueCommittedEvent = customEvent("value-committed", { bubbles: true, composed: true });
1
+ import { css } from "lit";
2
+ import { DuiSliderPrimitive } from "@deepfuture/dui-primitives/slider";
3
+ import "../_install.js";
46
4
  const styles = css `
47
5
  :host {
48
- display: block;
6
+ --slider-track-height: var(--space-1_5);
7
+ --slider-thumb-size: var(--space-4_5);
49
8
  }
50
9
 
51
10
  [part="root"] {
52
- position: relative;
53
- display: flex;
54
- flex-direction: column;
55
- width: 100%;
56
- touch-action: none;
57
- user-select: none;
11
+ height: var(--slider-thumb-size);
58
12
  }
59
13
 
60
14
  [part="root"][data-disabled] {
61
- pointer-events: none;
15
+ opacity: 0.4;
62
16
  }
63
17
 
18
+ /* -----------------------------------------------------------
19
+ * New parts: hidden by default
20
+ * ----------------------------------------------------------- */
21
+
64
22
  [part="label"] {
65
- display: flex;
66
- align-items: center;
67
- flex-shrink: 0;
23
+ display: none;
68
24
  }
69
25
 
70
- .slider-row {
71
- position: relative;
72
- display: flex;
73
- align-items: center;
74
- width: 100%;
26
+ [part="readout"] {
27
+ display: none;
75
28
  }
76
29
 
77
- [part="track"] {
78
- position: relative;
79
- flex-grow: 1;
80
- overflow: hidden;
30
+ [part="unit"] {
31
+ display: none;
81
32
  }
82
33
 
83
- [part="indicator"] {
84
- position: absolute;
85
- top: 0;
86
- left: 0;
87
- height: 100%;
88
- width: var(--slider-progress, 0%);
34
+ /* -----------------------------------------------------------
35
+ * Track: gradient support via --slider-track-bg
36
+ * ----------------------------------------------------------- */
37
+
38
+ [part="track"] {
39
+ height: var(--slider-track-height);
40
+ background: var(--slider-track-bg, color-mix(in oklch, var(--foreground) 15%, transparent));
41
+ border-radius: calc(var(--slider-track-height) / 2);
89
42
  }
90
43
 
91
- [part="readout"] {
92
- position: absolute;
93
- inset: 0;
94
- box-sizing: border-box;
95
- display: flex;
96
- align-items: center;
97
- justify-content: center;
98
- font: inherit;
99
- color: inherit;
100
- pointer-events: none;
101
- z-index: 2;
44
+ [part="indicator"] {
45
+ background: var(--accent);
46
+ border-radius: calc(var(--slider-track-height) / 2);
47
+ transition: width var(--duration-fast) ease-out;
102
48
  }
103
49
 
104
- [part="unit"] {
105
- position: absolute;
106
- right: 0;
107
- top: 50%;
108
- transform: translateY(-50%);
109
- pointer-events: none;
110
- z-index: 2;
50
+ [part="root"][data-dragging] [part="indicator"] {
51
+ transition: none;
111
52
  }
112
53
 
113
54
  [part="thumb"] {
114
- position: absolute;
115
- left: var(--slider-progress, 0%);
116
- transform: translateX(-50%);
117
- cursor: grab;
118
- outline: none;
55
+ width: var(--slider-thumb-size);
56
+ height: var(--slider-thumb-size);
57
+ background: white;
58
+ border: var(--border-width-medium) solid var(--accent);
59
+ border-radius: 50%;
60
+ transition-property: left, box-shadow;
61
+ transition-duration: var(--duration-fast), var(--duration-fast);
62
+ transition-timing-function: ease-out, ease;
119
63
  }
120
64
 
121
65
  [part="root"][data-dragging] [part="thumb"] {
122
- cursor: grabbing;
66
+ transition: box-shadow var(--duration-fast);
123
67
  }
124
68
 
125
- /* Hidden native input for accessibility */
126
- .native-input {
127
- position: absolute;
128
- width: 1px;
129
- height: 1px;
130
- padding: 0;
131
- margin: -1px;
132
- overflow: hidden;
133
- clip: rect(0, 0, 0, 0);
134
- white-space: nowrap;
135
- border: 0;
69
+ @media (hover: hover) {
70
+ [part="thumb"]:hover {
71
+ box-shadow: 0 0 0 var(--space-1) color-mix(in oklch, var(--accent) 20%, transparent);
72
+ }
73
+ }
74
+
75
+ [part="thumb"]:focus-visible {
76
+ box-shadow:
77
+ 0 0 0 var(--focus-ring-offset) var(--background),
78
+ 0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);
136
79
  }
137
- `;
138
- /**
139
- * A slider for selecting numeric values within a range.
140
- *
141
- * Supports pointer drag, keyboard navigation (arrows, Page Up/Down, Home/End),
142
- * a hidden native range input for accessibility, and an optional click-to-type
143
- * value readout (enabled via the `field` variant).
144
- */
145
- let DuiSlider = (() => {
146
- let _classSuper = LitElement;
147
- let _value_decorators;
148
- let _value_initializers = [];
149
- let _value_extraInitializers = [];
150
- let _min_decorators;
151
- let _min_initializers = [];
152
- let _min_extraInitializers = [];
153
- let _max_decorators;
154
- let _max_initializers = [];
155
- let _max_extraInitializers = [];
156
- let _step_decorators;
157
- let _step_initializers = [];
158
- let _step_extraInitializers = [];
159
- let _disabled_decorators;
160
- let _disabled_initializers = [];
161
- let _disabled_extraInitializers = [];
162
- let _name_decorators;
163
- let _name_initializers = [];
164
- let _name_extraInitializers = [];
165
- let _label_decorators;
166
- let _label_initializers = [];
167
- let _label_extraInitializers = [];
168
- let _unit_decorators;
169
- let _unit_initializers = [];
170
- let _unit_extraInitializers = [];
171
- let _precision_decorators;
172
- let _precision_initializers = [];
173
- let _precision_extraInitializers = [];
174
- let _private_dragging_decorators;
175
- let _private_dragging_initializers = [];
176
- let _private_dragging_extraInitializers = [];
177
- let _private_dragging_descriptor;
178
- return class DuiSlider extends _classSuper {
179
- static {
180
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
181
- _value_decorators = [property({ type: Number })];
182
- _min_decorators = [property({ type: Number })];
183
- _max_decorators = [property({ type: Number })];
184
- _step_decorators = [property({ type: Number })];
185
- _disabled_decorators = [property({ type: Boolean, reflect: true })];
186
- _name_decorators = [property()];
187
- _label_decorators = [property({ reflect: true })];
188
- _unit_decorators = [property({ reflect: true })];
189
- _precision_decorators = [property({ type: Number })];
190
- _private_dragging_decorators = [state()];
191
- __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);
192
- __esDecorate(this, null, _min_decorators, { kind: "accessor", name: "min", static: false, private: false, access: { has: obj => "min" in obj, get: obj => obj.min, set: (obj, value) => { obj.min = value; } }, metadata: _metadata }, _min_initializers, _min_extraInitializers);
193
- __esDecorate(this, null, _max_decorators, { kind: "accessor", name: "max", static: false, private: false, access: { has: obj => "max" in obj, get: obj => obj.max, set: (obj, value) => { obj.max = value; } }, metadata: _metadata }, _max_initializers, _max_extraInitializers);
194
- __esDecorate(this, null, _step_decorators, { kind: "accessor", name: "step", static: false, private: false, access: { has: obj => "step" in obj, get: obj => obj.step, set: (obj, value) => { obj.step = value; } }, metadata: _metadata }, _step_initializers, _step_extraInitializers);
195
- __esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
196
- __esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
197
- __esDecorate(this, null, _label_decorators, { kind: "accessor", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
198
- __esDecorate(this, null, _unit_decorators, { kind: "accessor", name: "unit", static: false, private: false, access: { has: obj => "unit" in obj, get: obj => obj.unit, set: (obj, value) => { obj.unit = value; } }, metadata: _metadata }, _unit_initializers, _unit_extraInitializers);
199
- __esDecorate(this, null, _precision_decorators, { kind: "accessor", name: "precision", static: false, private: false, access: { has: obj => "precision" in obj, get: obj => obj.precision, set: (obj, value) => { obj.precision = value; } }, metadata: _metadata }, _precision_initializers, _precision_extraInitializers);
200
- __esDecorate(this, _private_dragging_descriptor = { get: __setFunctionName(function () { return this.#dragging_accessor_storage; }, "#dragging", "get"), set: __setFunctionName(function (value) { this.#dragging_accessor_storage = value; }, "#dragging", "set") }, _private_dragging_decorators, { kind: "accessor", name: "#dragging", static: false, private: true, access: { has: obj => #dragging in obj, get: obj => obj.#dragging, set: (obj, value) => { obj.#dragging = value; } }, metadata: _metadata }, _private_dragging_initializers, _private_dragging_extraInitializers);
201
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
202
- }
203
- static tagName = "dui-slider";
204
- static formAssociated = true;
205
- static styles = [base, styles];
206
- #internals;
207
- constructor() {
208
- super();
209
- this.#internals = this.attachInternals();
210
- }
211
- #value_accessor_storage = __runInitializers(this, _value_initializers, 0);
212
- /** Current value. */
213
- get value() { return this.#value_accessor_storage; }
214
- set value(value) { this.#value_accessor_storage = value; }
215
- #min_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _min_initializers, 0));
216
- /** Minimum value. */
217
- get min() { return this.#min_accessor_storage; }
218
- set min(value) { this.#min_accessor_storage = value; }
219
- #max_accessor_storage = (__runInitializers(this, _min_extraInitializers), __runInitializers(this, _max_initializers, 100));
220
- /** Maximum value. */
221
- get max() { return this.#max_accessor_storage; }
222
- set max(value) { this.#max_accessor_storage = value; }
223
- #step_accessor_storage = (__runInitializers(this, _max_extraInitializers), __runInitializers(this, _step_initializers, 1));
224
- /** Step increment. */
225
- get step() { return this.#step_accessor_storage; }
226
- set step(value) { this.#step_accessor_storage = value; }
227
- #disabled_accessor_storage = (__runInitializers(this, _step_extraInitializers), __runInitializers(this, _disabled_initializers, false));
228
- /** Whether the slider is disabled. */
229
- get disabled() { return this.#disabled_accessor_storage; }
230
- set disabled(value) { this.#disabled_accessor_storage = value; }
231
- #name_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _name_initializers, ""));
232
- /** Name for form submission. */
233
- get name() { return this.#name_accessor_storage; }
234
- set name(value) { this.#name_accessor_storage = value; }
235
- #label_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _label_initializers, ""));
236
- /** Label text displayed by the slider. */
237
- get label() { return this.#label_accessor_storage; }
238
- set label(value) { this.#label_accessor_storage = value; }
239
- #unit_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _unit_initializers, ""));
240
- /** Unit suffix on the value readout (e.g. `m`, `°`, `%`). */
241
- get unit() { return this.#unit_accessor_storage; }
242
- set unit(value) { this.#unit_accessor_storage = value; }
243
- #precision_accessor_storage = (__runInitializers(this, _unit_extraInitializers), __runInitializers(this, _precision_initializers, undefined));
244
- /** Decimal places for value readout. Auto-inferred from `step` if not set. */
245
- get precision() { return this.#precision_accessor_storage; }
246
- set precision(value) { this.#precision_accessor_storage = value; }
247
- willUpdate() {
248
- this.#internals.setFormValue(String(this.value));
249
- }
250
- #dragging_accessor_storage = (__runInitializers(this, _precision_extraInitializers), __runInitializers(this, _private_dragging_initializers, false));
251
- get #dragging() { return _private_dragging_descriptor.get.call(this); }
252
- set #dragging(value) { return _private_dragging_descriptor.set.call(this, value); }
253
- get #progress() {
254
- const range = this.max - this.min;
255
- if (range === 0)
256
- return 0;
257
- return ((this.value - this.min) / range) * 100;
258
- }
259
- get #inferredPrecision() {
260
- const stepStr = String(this.step);
261
- const dotIndex = stepStr.indexOf(".");
262
- if (dotIndex === -1)
263
- return 0;
264
- return stepStr.length - dotIndex - 1;
265
- }
266
- get #displayValue() {
267
- const p = this.precision ?? this.#inferredPrecision;
268
- return this.value.toFixed(p);
269
- }
270
- #clampValue(value) {
271
- const stepped = Math.round(value / this.step) * this.step;
272
- return Math.max(this.min, Math.min(this.max, stepped));
273
- }
274
- #getValueFromPosition(clientX) {
275
- const track = this.shadowRoot?.querySelector("[part='track']");
276
- if (!track)
277
- return this.value;
278
- const rect = track.getBoundingClientRect();
279
- const percentage = (clientX - rect.left) / rect.width;
280
- const rawValue = this.min + percentage * (this.max - this.min);
281
- return this.#clampValue(rawValue);
282
- }
283
- #onPointerDown = (__runInitializers(this, _private_dragging_extraInitializers), (event) => {
284
- if (this.disabled)
285
- return;
286
- event.preventDefault();
287
- const newValue = this.#getValueFromPosition(event.clientX);
288
- if (newValue !== this.value) {
289
- this.value = newValue;
290
- this.dispatchEvent(valueChangeEvent({ value: newValue }));
291
- }
292
- document.addEventListener("pointermove", this.#onPointerMove);
293
- document.addEventListener("pointerup", this.#onPointerUp);
294
- });
295
- #onPointerMove = (event) => {
296
- if (!this.#dragging)
297
- this.#dragging = true;
298
- const newValue = this.#getValueFromPosition(event.clientX);
299
- if (newValue !== this.value) {
300
- this.value = newValue;
301
- this.dispatchEvent(valueChangeEvent({ value: newValue }));
302
- }
303
- };
304
- #onPointerUp = () => {
305
- const wasDragging = this.#dragging;
306
- this.#dragging = false;
307
- document.removeEventListener("pointermove", this.#onPointerMove);
308
- document.removeEventListener("pointerup", this.#onPointerUp);
309
- this.dispatchEvent(valueCommittedEvent({ value: this.value }));
310
- };
311
- #onKeyDown = (event) => {
312
- if (this.disabled)
313
- return;
314
- let newValue = this.value;
315
- const largeStep = this.step * 10;
316
- switch (event.key) {
317
- case "ArrowRight":
318
- case "ArrowUp":
319
- event.preventDefault();
320
- newValue = this.#clampValue(this.value + this.step);
321
- break;
322
- case "ArrowLeft":
323
- case "ArrowDown":
324
- event.preventDefault();
325
- newValue = this.#clampValue(this.value - this.step);
326
- break;
327
- case "PageUp":
328
- event.preventDefault();
329
- newValue = this.#clampValue(this.value + largeStep);
330
- break;
331
- case "PageDown":
332
- event.preventDefault();
333
- newValue = this.#clampValue(this.value - largeStep);
334
- break;
335
- case "Home":
336
- event.preventDefault();
337
- newValue = this.min;
338
- break;
339
- case "End":
340
- event.preventDefault();
341
- newValue = this.max;
342
- break;
343
- default:
344
- return;
345
- }
346
- if (newValue !== this.value) {
347
- this.value = newValue;
348
- this.dispatchEvent(valueChangeEvent({ value: newValue }));
349
- this.dispatchEvent(valueCommittedEvent({ value: newValue }));
350
- }
351
- };
352
- #onNativeInput = (event) => {
353
- const target = event.target;
354
- const newValue = parseFloat(target.value);
355
- if (!isNaN(newValue) && newValue !== this.value) {
356
- this.value = newValue;
357
- this.dispatchEvent(valueChangeEvent({ value: newValue }));
358
- }
359
- };
360
- #onNativeChange = () => {
361
- this.dispatchEvent(valueCommittedEvent({ value: this.value }));
362
- };
363
- disconnectedCallback() {
364
- super.disconnectedCallback();
365
- document.removeEventListener("pointermove", this.#onPointerMove);
366
- document.removeEventListener("pointerup", this.#onPointerUp);
367
- }
368
- render() {
369
- return html `
370
- <div
371
- part="root"
372
- role="group"
373
- ?data-disabled=${this.disabled}
374
- ?data-dragging=${this.#dragging}
375
- style="--slider-progress: ${this.#progress}%"
376
- @pointerdown=${this.#onPointerDown}
377
- >
378
- <span part="label">${this.label}</span>
379
80
 
380
- <div class="slider-row">
381
- <div part="track">
382
- <div part="indicator"></div>
383
- <span part="readout">${this.#displayValue}</span>
384
- <span part="unit">${this.unit}</span>
385
- </div>
386
- <div
387
- part="thumb"
388
- tabindex=${this.disabled ? -1 : 0}
389
- @keydown=${this.#onKeyDown}
390
- ></div>
391
- </div>
81
+ /* -----------------------------------------------------------
82
+ * Variant: field (compact slider-field with value readout)
83
+ * ----------------------------------------------------------- */
392
84
 
393
- <input
394
- class="native-input"
395
- type="range"
396
- name=${this.name}
397
- .value=${String(this.value)}
398
- min=${this.min}
399
- max=${this.max}
400
- step=${this.step}
401
- ?disabled=${this.disabled}
402
- aria-valuenow=${this.value}
403
- aria-valuemin=${this.min}
404
- aria-valuemax=${this.max}
405
- aria-label=${this.label || "Slider"}
406
- @input=${this.#onNativeInput}
407
- @change=${this.#onNativeChange}
408
- />
409
- </div>
410
- `;
411
- }
412
- };
413
- })();
414
- export { DuiSlider };
85
+ :host([variant="field"]) {
86
+ --slider-track-height: var(--component-height-sm);
87
+ /* --slider-thumb-size: 0px; */
88
+ }
89
+
90
+ :host([variant="field"]) [part="root"] {
91
+ height: auto;
92
+ }
93
+
94
+ :host([variant="field"]) [part="track"] {
95
+ border-radius: var(--radius-sm);
96
+ border: var(--border-width-thin) solid var(--border);
97
+ background: var(--slider-track-bg, transparent);
98
+ transition: border-color var(--duration-fast);
99
+ }
100
+
101
+ :host([variant="field"]) [part="track"]:hover {
102
+ border-color: var(--ring);
103
+ }
104
+
105
+ :host([variant="field"]) [part="indicator"] {
106
+ background: var(--slider-indicator-color, var(--accent));
107
+ opacity: var(--slider-indicator-opacity, 0.08);
108
+ border-radius: var(--radius-sm);
109
+ }
110
+
111
+
112
+
113
+
114
+
115
+ :host([variant="field"][label]:not([label=""])) [part="label"] {
116
+ display: flex;
117
+ font-size: var(--text-xs);
118
+ color: var(--muted-foreground);
119
+ margin-bottom: var(--space-1);
120
+ }
121
+
122
+ :host([variant="field"][disabled]) {
123
+ opacity: 0.5;
124
+ }
125
+ `;
126
+ export class DuiSlider extends DuiSliderPrimitive {
127
+ static styles = [...DuiSliderPrimitive.styles, styles];
128
+ }
129
+ customElements.define(DuiSlider.tagName, DuiSlider);
@@ -1,3 +1,2 @@
1
- import { DuiSpinner } from "./spinner.js";
2
- export { DuiSpinner };
3
- export declare const spinnerFamily: (typeof DuiSpinner)[];
1
+ import "./spinner.js";
2
+ export { DuiSpinner } from "./spinner.js";
package/spinner/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import { DuiSpinner } from "./spinner.js";
2
- export { DuiSpinner };
3
- export const spinnerFamily = [DuiSpinner];
1
+ import "./spinner.js";
2
+ export { DuiSpinner } from "./spinner.js";
@@ -1,13 +1,5 @@
1
- /** Ported from original DUI: deep-future-app/app/client/components/dui/spinner */
2
- import { LitElement, type TemplateResult } from "lit";
3
- /**
4
- * A loading indicator with multiple animation variants and sizes.
5
- */
6
- export declare class DuiSpinner extends LitElement {
7
- #private;
8
- static tagName: "dui-spinner";
1
+ import { DuiSpinnerPrimitive } from "@deepfuture/dui-primitives/spinner";
2
+ import "../_install.js";
3
+ export declare class DuiSpinner extends DuiSpinnerPrimitive {
9
4
  static styles: import("lit").CSSResult[];
10
- /** Animation variant. */
11
- accessor variant: string;
12
- render(): TemplateResult;
13
5
  }