@deepfuture/dui-components 0.0.21 → 1.0.1
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.
- package/README.md +56 -65
- package/_install.js +11 -0
- package/accordion/accordion-item.d.ts +3 -20
- package/accordion/accordion-item.js +92 -292
- package/accordion/accordion.d.ts +3 -18
- package/accordion/accordion.js +9 -247
- package/accordion/index.d.ts +6 -6
- package/accordion/index.js +5 -5
- package/alert-dialog/alert-dialog-close.d.ts +3 -14
- package/alert-dialog/alert-dialog-close.js +4 -34
- package/alert-dialog/alert-dialog-popup.d.ts +3 -32
- package/alert-dialog/alert-dialog-popup.js +68 -317
- package/alert-dialog/alert-dialog-trigger.d.ts +3 -14
- package/alert-dialog/alert-dialog-trigger.js +4 -51
- package/alert-dialog/alert-dialog.d.ts +3 -30
- package/alert-dialog/alert-dialog.js +8 -158
- package/alert-dialog/index.d.ts +11 -11
- package/alert-dialog/index.js +9 -9
- package/all.d.ts +159 -123
- package/all.js +134 -231
- package/avatar/avatar.d.ts +3 -39
- package/avatar/avatar.js +18 -238
- package/avatar/index.d.ts +4 -4
- package/avatar/index.js +3 -3
- package/badge/badge.d.ts +3 -10
- package/badge/badge.js +87 -22
- package/badge/index.d.ts +2 -3
- package/badge/index.js +2 -3
- package/breadcrumb/breadcrumb-ellipsis.d.ts +3 -12
- package/breadcrumb/breadcrumb-ellipsis.js +8 -34
- package/breadcrumb/breadcrumb-item.d.ts +3 -11
- package/breadcrumb/breadcrumb-item.js +7 -26
- package/breadcrumb/breadcrumb-link.d.ts +3 -12
- package/breadcrumb/breadcrumb-link.js +16 -26
- package/breadcrumb/breadcrumb-page.d.ts +3 -11
- package/breadcrumb/breadcrumb-page.js +8 -31
- package/breadcrumb/breadcrumb-separator.d.ts +3 -12
- package/breadcrumb/breadcrumb-separator.js +8 -31
- package/breadcrumb/breadcrumb.d.ts +3 -12
- package/breadcrumb/breadcrumb.js +10 -33
- package/breadcrumb/index.d.ts +12 -13
- package/breadcrumb/index.js +12 -13
- package/button/button.d.ts +3 -32
- package/button/button.js +220 -165
- package/button/index.d.ts +3 -3
- package/button/index.js +3 -3
- package/calendar/calendar.d.ts +3 -31
- package/calendar/calendar.js +71 -481
- package/calendar/index.d.ts +3 -3
- package/calendar/index.js +3 -3
- package/card/card.d.ts +3 -27
- package/card/card.js +80 -163
- package/card/index.d.ts +2 -3
- package/card/index.js +2 -3
- package/card-grid/card-grid.d.ts +3 -15
- package/card-grid/card-grid.js +8 -106
- package/card-grid/index.d.ts +2 -3
- package/card-grid/index.js +2 -3
- package/checkbox/checkbox-group.d.ts +3 -34
- package/checkbox/checkbox-group.js +11 -188
- package/checkbox/checkbox.d.ts +3 -47
- package/checkbox/checkbox.js +43 -341
- package/checkbox/index.d.ts +6 -6
- package/checkbox/index.js +5 -5
- package/collapsible/collapsible.d.ts +3 -20
- package/collapsible/collapsible.js +82 -277
- package/collapsible/index.d.ts +3 -3
- package/collapsible/index.js +3 -3
- package/combobox/combobox.d.ts +3 -47
- package/combobox/combobox.js +136 -538
- package/combobox/index.d.ts +4 -4
- package/combobox/index.js +3 -3
- package/command/command-empty.d.ts +3 -8
- package/command/command-empty.js +10 -88
- package/command/command-group.d.ts +3 -13
- package/command/command-group.js +14 -114
- package/command/command-input.d.ts +3 -11
- package/command/command-input.js +20 -136
- package/command/command-item.d.ts +3 -18
- package/command/command-item.js +23 -212
- package/command/command-list.d.ts +3 -7
- package/command/command-list.js +11 -79
- package/command/command-separator.d.ts +3 -5
- package/command/command-separator.js +10 -11
- package/command/command-shortcut.d.ts +3 -5
- package/command/command-shortcut.js +9 -12
- package/command/command.d.ts +3 -23
- package/command/command.js +10 -339
- package/command/index.d.ts +17 -19
- package/command/index.js +16 -18
- package/data-table/data-table.d.ts +3 -57
- package/data-table/data-table.js +85 -449
- package/data-table/index.d.ts +3 -4
- package/data-table/index.js +2 -3
- package/dialog/dialog-close.d.ts +3 -14
- package/dialog/dialog-close.js +4 -34
- package/dialog/dialog-popup.d.ts +3 -34
- package/dialog/dialog-popup.js +70 -336
- package/dialog/dialog-trigger.d.ts +3 -14
- package/dialog/dialog-trigger.js +4 -51
- package/dialog/dialog.d.ts +3 -30
- package/dialog/dialog.js +8 -158
- package/dialog/index.d.ts +11 -11
- package/dialog/index.js +9 -9
- package/dropzone/dropzone.d.ts +3 -72
- package/dropzone/dropzone.js +29 -407
- package/dropzone/index.d.ts +4 -4
- package/dropzone/index.js +3 -3
- package/field/field.d.ts +3 -30
- package/field/field.js +34 -353
- package/field/index.d.ts +1 -0
- package/field/index.js +1 -0
- package/fieldset/fieldset.d.ts +3 -18
- package/fieldset/fieldset.js +21 -110
- package/fieldset/index.d.ts +1 -0
- package/fieldset/index.js +1 -0
- package/icon/icon.d.ts +3 -15
- package/icon/icon.js +4 -33
- package/icon/index.d.ts +2 -3
- package/icon/index.js +2 -3
- package/input/index.d.ts +3 -3
- package/input/index.js +3 -3
- package/input/input.d.ts +3 -49
- package/input/input.js +57 -238
- package/menu/index.d.ts +4 -5
- package/menu/index.js +4 -5
- package/menu/menu-item.d.ts +3 -13
- package/menu/menu-item.js +40 -91
- package/menu/menu.d.ts +3 -15
- package/menu/menu.js +27 -277
- package/menubar/index.d.ts +3 -4
- package/menubar/index.js +2 -3
- package/menubar/menubar.d.ts +3 -19
- package/menubar/menubar.js +12 -183
- package/number-field/index.d.ts +3 -3
- package/number-field/index.js +3 -3
- package/number-field/number-field.d.ts +3 -55
- package/number-field/number-field.js +205 -698
- package/package.json +125 -113
- package/popover/index.d.ts +11 -11
- package/popover/index.js +9 -9
- package/popover/popover-close.d.ts +3 -12
- package/popover/popover-close.js +4 -32
- package/popover/popover-popup.d.ts +3 -18
- package/popover/popover-popup.js +28 -205
- package/popover/popover-trigger.d.ts +3 -13
- package/popover/popover-trigger.js +4 -73
- package/popover/popover.d.ts +3 -29
- package/popover/popover.js +8 -207
- package/portal/index.d.ts +3 -4
- package/portal/index.js +2 -3
- package/portal/portal.d.ts +3 -27
- package/portal/portal.js +8 -157
- package/preview-card/index.d.ts +9 -9
- package/preview-card/index.js +7 -7
- package/preview-card/preview-card-popup.d.ts +3 -14
- package/preview-card/preview-card-popup.js +29 -194
- package/preview-card/preview-card-trigger.d.ts +3 -12
- package/preview-card/preview-card-trigger.js +4 -74
- package/preview-card/preview-card.d.ts +3 -33
- package/preview-card/preview-card.js +8 -239
- package/progress/index.d.ts +2 -3
- package/progress/index.js +2 -3
- package/progress/progress.d.ts +3 -17
- package/progress/progress.js +28 -130
- package/radio/index.d.ts +6 -6
- package/radio/index.js +5 -5
- package/radio/radio-group.d.ts +3 -37
- package/radio/radio-group.js +8 -200
- package/radio/radio.d.ts +3 -28
- package/radio/radio.js +38 -213
- package/scroll-area/index.d.ts +2 -3
- package/scroll-area/index.js +2 -3
- package/scroll-area/scroll-area.d.ts +3 -36
- package/scroll-area/scroll-area.js +25 -535
- package/select/index.d.ts +3 -4
- package/select/index.js +2 -3
- package/select/select.d.ts +3 -39
- package/select/select.js +115 -425
- package/separator/index.d.ts +2 -3
- package/separator/index.js +2 -3
- package/separator/separator.d.ts +3 -10
- package/separator/separator.js +23 -85
- package/sidebar/index.d.ts +29 -29
- package/sidebar/index.js +27 -32
- package/sidebar/sidebar-content.d.ts +3 -12
- package/sidebar/sidebar-content.js +7 -29
- package/sidebar/sidebar-footer.d.ts +3 -10
- package/sidebar/sidebar-footer.js +7 -20
- package/sidebar/sidebar-group-label.d.ts +3 -15
- package/sidebar/sidebar-group-label.js +16 -41
- package/sidebar/sidebar-group.d.ts +3 -13
- package/sidebar/sidebar-group.js +7 -24
- package/sidebar/sidebar-header.d.ts +3 -10
- package/sidebar/sidebar-header.js +7 -16
- package/sidebar/sidebar-inset.d.ts +3 -13
- package/sidebar/sidebar-inset.js +7 -28
- package/sidebar/sidebar-menu-button.d.ts +3 -26
- package/sidebar/sidebar-menu-button.js +59 -217
- package/sidebar/sidebar-menu-item.d.ts +3 -10
- package/sidebar/sidebar-menu-item.js +7 -19
- package/sidebar/sidebar-menu.d.ts +3 -12
- package/sidebar/sidebar-menu.js +7 -25
- package/sidebar/sidebar-provider.d.ts +3 -34
- package/sidebar/sidebar-provider.js +22 -232
- package/sidebar/sidebar-separator.d.ts +3 -10
- package/sidebar/sidebar-separator.js +9 -19
- package/sidebar/sidebar-trigger.d.ts +3 -14
- package/sidebar/sidebar-trigger.js +10 -46
- package/sidebar/sidebar.d.ts +3 -19
- package/sidebar/sidebar.js +65 -262
- package/slider/index.d.ts +3 -3
- package/slider/index.js +3 -3
- package/slider/slider.d.ts +3 -45
- package/slider/slider.js +97 -382
- package/spinner/index.d.ts +2 -3
- package/spinner/index.js +2 -3
- package/spinner/spinner.d.ts +3 -11
- package/spinner/spinner.js +20 -163
- package/split-button/index.d.ts +3 -1
- package/split-button/index.js +3 -1
- package/split-button/split-button.d.ts +3 -33
- package/split-button/split-button.js +306 -394
- package/stepper/index.d.ts +3 -3
- package/stepper/index.js +3 -3
- package/stepper/stepper.d.ts +3 -41
- package/stepper/stepper.js +57 -381
- package/switch/index.d.ts +3 -3
- package/switch/index.js +3 -3
- package/switch/switch.d.ts +3 -30
- package/switch/switch.js +63 -228
- package/tabs/index.d.ts +12 -12
- package/tabs/index.js +11 -11
- package/tabs/tab.d.ts +3 -14
- package/tabs/tab.js +32 -131
- package/tabs/tabs-indicator.d.ts +3 -9
- package/tabs/tabs-indicator.js +17 -22
- package/tabs/tabs-list.d.ts +3 -15
- package/tabs/tabs-list.js +14 -113
- package/tabs/tabs-panel.d.ts +3 -16
- package/tabs/tabs-panel.js +32 -114
- package/tabs/tabs.d.ts +3 -22
- package/tabs/tabs.js +8 -170
- package/textarea/index.d.ts +4 -4
- package/textarea/index.js +3 -3
- package/textarea/textarea.d.ts +3 -36
- package/textarea/textarea.js +63 -220
- package/toggle/index.d.ts +6 -6
- package/toggle/index.js +5 -5
- package/toggle/toggle-group.d.ts +3 -27
- package/toggle/toggle-group.js +9 -224
- package/toggle/toggle.d.ts +3 -26
- package/toggle/toggle.js +93 -178
- package/tokens/properties.css +361 -0
- package/tokens/prose.css +250 -0
- package/tokens/prose.d.ts +2 -0
- package/tokens/prose.js +4 -0
- package/tokens/tokens-raw.d.ts +2 -0
- package/tokens/tokens-raw.js +2 -0
- package/tokens/tokens.css +409 -0
- package/tokens/tokens.d.ts +2 -0
- package/tokens/tokens.js +5 -0
- package/toolbar/index.d.ts +2 -3
- package/toolbar/index.js +2 -3
- package/toolbar/toolbar.d.ts +3 -11
- package/toolbar/toolbar.js +25 -116
- package/tooltip/index.d.ts +9 -9
- package/tooltip/index.js +7 -7
- package/tooltip/tooltip-popup.d.ts +3 -14
- package/tooltip/tooltip-popup.js +31 -185
- package/tooltip/tooltip-trigger.d.ts +3 -14
- package/tooltip/tooltip-trigger.js +5 -148
- package/tooltip/tooltip.d.ts +3 -35
- package/tooltip/tooltip.js +8 -253
- package/trunc/index.d.ts +2 -3
- package/trunc/index.js +2 -3
- package/trunc/trunc.d.ts +3 -17
- package/trunc/trunc.js +10 -108
- package/_deprecated/center/center.d.ts +0 -14
- package/_deprecated/center/center.js +0 -37
- package/_deprecated/center/index.d.ts +0 -3
- package/_deprecated/center/index.js +0 -3
- package/_deprecated/center/register.js +0 -4
- package/_deprecated/hstack/hstack.d.ts +0 -25
- package/_deprecated/hstack/hstack.js +0 -187
- package/_deprecated/hstack/index.d.ts +0 -4
- package/_deprecated/hstack/index.js +0 -3
- package/_deprecated/hstack/register.d.ts +0 -1
- package/_deprecated/hstack/register.js +0 -4
- package/_deprecated/page-inset/index.d.ts +0 -3
- package/_deprecated/page-inset/index.js +0 -3
- package/_deprecated/page-inset/page-inset.d.ts +0 -28
- package/_deprecated/page-inset/page-inset.js +0 -151
- package/_deprecated/page-inset/register.d.ts +0 -1
- package/_deprecated/page-inset/register.js +0 -4
- package/_deprecated/vstack/index.d.ts +0 -3
- package/_deprecated/vstack/index.js +0 -3
- package/_deprecated/vstack/register.d.ts +0 -1
- package/_deprecated/vstack/register.js +0 -4
- package/_deprecated/vstack/vstack.d.ts +0 -17
- package/_deprecated/vstack/vstack.js +0 -125
- package/accordion/accordion-context.d.ts +0 -15
- package/accordion/accordion-context.js +0 -3
- package/alert-dialog/alert-dialog-context.d.ts +0 -13
- package/alert-dialog/alert-dialog-context.js +0 -3
- package/checkbox/checkbox-group-context.d.ts +0 -11
- package/checkbox/checkbox-group-context.js +0 -3
- package/command/command-context.d.ts +0 -30
- package/command/command-context.js +0 -3
- package/command/command-score.d.ts +0 -6
- package/command/command-score.js +0 -31
- package/dialog/dialog-context.d.ts +0 -13
- package/dialog/dialog-context.js +0 -3
- package/global.d.ts +0 -179
- package/menubar/menubar-context.d.ts +0 -9
- package/menubar/menubar-context.js +0 -2
- package/popover/popover-context.d.ts +0 -17
- package/popover/popover-context.js +0 -3
- package/preview-card/preview-card-context.d.ts +0 -16
- package/preview-card/preview-card-context.js +0 -3
- package/radio/radio-group-context.d.ts +0 -11
- package/radio/radio-group-context.js +0 -2
- package/sidebar/sidebar-context.d.ts +0 -15
- package/sidebar/sidebar-context.js +0 -3
- package/split-button/register.d.ts +0 -1
- package/split-button/register.js +0 -4
- package/tabs/tabs-context.d.ts +0 -8
- package/tabs/tabs-context.js +0 -2
- package/toggle/toggle-group-context.d.ts +0 -9
- package/toggle/toggle-group-context.js +0 -2
- package/tooltip/tooltip-context.d.ts +0 -17
- package/tooltip/tooltip-context.js +0 -3
- /package/{_deprecated/center/register.d.ts → _install.d.ts} +0 -0
package/slider/slider.js
CHANGED
|
@@ -1,414 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
+
opacity: 0.4;
|
|
62
16
|
}
|
|
63
17
|
|
|
18
|
+
/* -----------------------------------------------------------
|
|
19
|
+
* New parts: hidden by default
|
|
20
|
+
* ----------------------------------------------------------- */
|
|
21
|
+
|
|
64
22
|
[part="label"] {
|
|
65
|
-
display:
|
|
66
|
-
align-items: center;
|
|
67
|
-
flex-shrink: 0;
|
|
23
|
+
display: none;
|
|
68
24
|
}
|
|
69
25
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
width: 100%;
|
|
26
|
+
[part="readout"] {
|
|
27
|
+
display: none;
|
|
75
28
|
}
|
|
76
29
|
|
|
77
|
-
[part="
|
|
78
|
-
|
|
79
|
-
flex-grow: 1;
|
|
80
|
-
overflow: hidden;
|
|
30
|
+
[part="unit"] {
|
|
31
|
+
display: none;
|
|
81
32
|
}
|
|
82
33
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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="
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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="
|
|
105
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
66
|
+
transition: box-shadow var(--duration-fast);
|
|
123
67
|
}
|
|
124
68
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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);
|
package/spinner/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
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
|
|
2
|
-
export { DuiSpinner };
|
|
3
|
-
export const spinnerFamily = [DuiSpinner];
|
|
1
|
+
import "./spinner.js";
|
|
2
|
+
export { DuiSpinner } from "./spinner.js";
|
package/spinner/spinner.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
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
|
}
|