@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.
- package/README.md +56 -65
- package/_install.js +11 -0
- package/accordion/accordion-item.d.ts +3 -20
- package/accordion/accordion-item.js +93 -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 +88 -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 +221 -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 +83 -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 +15 -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 +24 -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 +86 -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 +41 -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 +126 -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 +17 -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 +60 -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 +307 -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 +33 -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 +94 -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 +32 -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
|
@@ -1,304 +1,105 @@
|
|
|
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, nothing } from "lit";
|
|
41
|
-
import { property, state } from "lit/decorators.js";
|
|
42
|
-
import { consume } from "@lit/context";
|
|
43
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
44
|
-
import { customEvent } from "@deepfuture/dui-core/event";
|
|
45
|
-
import { accordionContext, } from "./accordion-context.js";
|
|
46
|
-
export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
|
|
1
|
+
import { css, unsafeCSS } from "lit";
|
|
2
|
+
// Chevron-down SVG encoded for use as a CSS mask
|
|
3
|
+
const chevronMask = unsafeCSS(`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")`);
|
|
47
4
|
const styles = css `
|
|
48
|
-
|
|
49
|
-
|
|
5
|
+
/* ── Item ── */
|
|
6
|
+
|
|
7
|
+
[part="item"] {
|
|
8
|
+
border-bottom: var(
|
|
9
|
+
--accordion-item-border,
|
|
10
|
+
var(--border-width-thin) solid var(--border)
|
|
11
|
+
);
|
|
50
12
|
}
|
|
51
13
|
|
|
14
|
+
/* ── Trigger ── */
|
|
15
|
+
|
|
52
16
|
[part="trigger"] {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
17
|
+
gap: var(--space-4);
|
|
18
|
+
padding-block: var(--space-2);
|
|
19
|
+
padding-inline: 0;
|
|
20
|
+
color: var(--text-1);
|
|
21
|
+
font-family: var(--font-sans);
|
|
22
|
+
font-weight: var(--font-weight-semibold);
|
|
23
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
24
|
+
text-box: trim-both cap alphabetic;
|
|
25
|
+
height: var(--component-height-md);
|
|
26
|
+
border-radius: var(--radius-sm);
|
|
27
|
+
transition-property: background, box-shadow, filter, transform;
|
|
28
|
+
transition-duration: var(--duration-fast);
|
|
29
|
+
transition-timing-function: var(--ease-out-3);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (hover: hover) {
|
|
33
|
+
[part="trigger"]:hover {
|
|
34
|
+
background: oklch(from var(--foreground) l c h / 0.05);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[part="trigger"]:focus-visible {
|
|
39
|
+
box-shadow:
|
|
40
|
+
0 0 0 var(--focus-ring-offset) var(--background),
|
|
41
|
+
0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);
|
|
42
|
+
z-index: 1;
|
|
64
43
|
}
|
|
65
44
|
|
|
66
45
|
[part="trigger"][data-disabled] {
|
|
67
|
-
|
|
46
|
+
opacity: 0.4;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ── Indicator (theme-owned) ── */
|
|
50
|
+
|
|
51
|
+
[part="trigger"]::after {
|
|
52
|
+
content: "";
|
|
53
|
+
display: var(--collapsible-indicator-display, block);
|
|
54
|
+
width: var(--space-4);
|
|
55
|
+
height: var(--space-4);
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
background: currentColor;
|
|
58
|
+
-webkit-mask: ${chevronMask} center / contain no-repeat;
|
|
59
|
+
mask: ${chevronMask} center / contain no-repeat;
|
|
60
|
+
transition-property: transform;
|
|
61
|
+
transition-duration: var(--duration-fast);
|
|
62
|
+
transition-timing-function: var(--ease-out-3);
|
|
68
63
|
}
|
|
69
64
|
|
|
65
|
+
[part="trigger"][data-open]::after {
|
|
66
|
+
transform: rotate(180deg);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* ── Panel ── */
|
|
70
|
+
|
|
70
71
|
[part="panel"] {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
transition-duration: var(--duration-fast);
|
|
73
|
+
transition-timing-function: var(--ease-out-3);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part="panel"][data-starting-style],
|
|
77
|
+
[part="panel"][data-ending-style] {
|
|
78
|
+
height: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[part="content"] {
|
|
82
|
+
padding: var(--space-1_5) 0 var(--space-4);
|
|
83
|
+
font-family: var(--font-sans);
|
|
84
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
85
|
+
font-weight: var(--font-weight-regular);
|
|
86
|
+
color: var(--text-2);
|
|
87
|
+
text-box: trim-both cap alphabetic;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* ── Reduced motion ── */
|
|
91
|
+
|
|
92
|
+
@media (prefers-reduced-motion: reduce) {
|
|
93
|
+
[part="trigger"],
|
|
94
|
+
[part="trigger"]::after,
|
|
95
|
+
[part="panel"] {
|
|
96
|
+
transition-duration: 0s;
|
|
97
|
+
}
|
|
74
98
|
}
|
|
75
99
|
`;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let _disabled_initializers = [];
|
|
83
|
-
let _disabled_extraInitializers = [];
|
|
84
|
-
let __ctx_decorators;
|
|
85
|
-
let __ctx_initializers = [];
|
|
86
|
-
let __ctx_extraInitializers = [];
|
|
87
|
-
let _private_starting_decorators;
|
|
88
|
-
let _private_starting_initializers = [];
|
|
89
|
-
let _private_starting_extraInitializers = [];
|
|
90
|
-
let _private_starting_descriptor;
|
|
91
|
-
let _private_ending_decorators;
|
|
92
|
-
let _private_ending_initializers = [];
|
|
93
|
-
let _private_ending_extraInitializers = [];
|
|
94
|
-
let _private_ending_descriptor;
|
|
95
|
-
let _private_panelHeight_decorators;
|
|
96
|
-
let _private_panelHeight_initializers = [];
|
|
97
|
-
let _private_panelHeight_extraInitializers = [];
|
|
98
|
-
let _private_panelHeight_descriptor;
|
|
99
|
-
let _private_visible_decorators;
|
|
100
|
-
let _private_visible_initializers = [];
|
|
101
|
-
let _private_visible_extraInitializers = [];
|
|
102
|
-
let _private_visible_descriptor;
|
|
103
|
-
return class DuiAccordionItem extends _classSuper {
|
|
104
|
-
static {
|
|
105
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
106
|
-
_value_decorators = [property({ type: String })];
|
|
107
|
-
_disabled_decorators = [property({ type: Boolean })];
|
|
108
|
-
__ctx_decorators = [consume({ context: accordionContext, subscribe: true })];
|
|
109
|
-
_private_starting_decorators = [state()];
|
|
110
|
-
_private_ending_decorators = [state()];
|
|
111
|
-
_private_panelHeight_decorators = [state()];
|
|
112
|
-
_private_visible_decorators = [state()];
|
|
113
|
-
__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);
|
|
114
|
-
__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);
|
|
115
|
-
__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);
|
|
116
|
-
__esDecorate(this, _private_starting_descriptor = { get: __setFunctionName(function () { return this.#starting_accessor_storage; }, "#starting", "get"), set: __setFunctionName(function (value) { this.#starting_accessor_storage = value; }, "#starting", "set") }, _private_starting_decorators, { kind: "accessor", name: "#starting", static: false, private: true, access: { has: obj => #starting in obj, get: obj => obj.#starting, set: (obj, value) => { obj.#starting = value; } }, metadata: _metadata }, _private_starting_initializers, _private_starting_extraInitializers);
|
|
117
|
-
__esDecorate(this, _private_ending_descriptor = { get: __setFunctionName(function () { return this.#ending_accessor_storage; }, "#ending", "get"), set: __setFunctionName(function (value) { this.#ending_accessor_storage = value; }, "#ending", "set") }, _private_ending_decorators, { kind: "accessor", name: "#ending", static: false, private: true, access: { has: obj => #ending in obj, get: obj => obj.#ending, set: (obj, value) => { obj.#ending = value; } }, metadata: _metadata }, _private_ending_initializers, _private_ending_extraInitializers);
|
|
118
|
-
__esDecorate(this, _private_panelHeight_descriptor = { get: __setFunctionName(function () { return this.#panelHeight_accessor_storage; }, "#panelHeight", "get"), set: __setFunctionName(function (value) { this.#panelHeight_accessor_storage = value; }, "#panelHeight", "set") }, _private_panelHeight_decorators, { kind: "accessor", name: "#panelHeight", static: false, private: true, access: { has: obj => #panelHeight in obj, get: obj => obj.#panelHeight, set: (obj, value) => { obj.#panelHeight = value; } }, metadata: _metadata }, _private_panelHeight_initializers, _private_panelHeight_extraInitializers);
|
|
119
|
-
__esDecorate(this, _private_visible_descriptor = { get: __setFunctionName(function () { return this.#visible_accessor_storage; }, "#visible", "get"), set: __setFunctionName(function (value) { this.#visible_accessor_storage = value; }, "#visible", "set") }, _private_visible_decorators, { kind: "accessor", name: "#visible", static: false, private: true, access: { has: obj => #visible in obj, get: obj => obj.#visible, set: (obj, value) => { obj.#visible = value; } }, metadata: _metadata }, _private_visible_initializers, _private_visible_extraInitializers);
|
|
120
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
121
|
-
}
|
|
122
|
-
static tagName = "dui-accordion-item";
|
|
123
|
-
static styles = [base, styles];
|
|
124
|
-
#value_accessor_storage = __runInitializers(this, _value_initializers, "");
|
|
125
|
-
get value() { return this.#value_accessor_storage; }
|
|
126
|
-
set value(value) { this.#value_accessor_storage = value; }
|
|
127
|
-
#disabled_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
128
|
-
get disabled() { return this.#disabled_accessor_storage; }
|
|
129
|
-
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
130
|
-
#_ctx_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, __ctx_initializers, void 0));
|
|
131
|
-
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
132
|
-
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
133
|
-
#starting_accessor_storage = (__runInitializers(this, __ctx_extraInitializers), __runInitializers(this, _private_starting_initializers, false));
|
|
134
|
-
get #starting() { return _private_starting_descriptor.get.call(this); }
|
|
135
|
-
set #starting(value) { return _private_starting_descriptor.set.call(this, value); }
|
|
136
|
-
#ending_accessor_storage = (__runInitializers(this, _private_starting_extraInitializers), __runInitializers(this, _private_ending_initializers, false));
|
|
137
|
-
get #ending() { return _private_ending_descriptor.get.call(this); }
|
|
138
|
-
set #ending(value) { return _private_ending_descriptor.set.call(this, value); }
|
|
139
|
-
#panelHeight_accessor_storage = (__runInitializers(this, _private_ending_extraInitializers), __runInitializers(this, _private_panelHeight_initializers, "0"));
|
|
140
|
-
get #panelHeight() { return _private_panelHeight_descriptor.get.call(this); }
|
|
141
|
-
set #panelHeight(value) { return _private_panelHeight_descriptor.set.call(this, value); }
|
|
142
|
-
#visible_accessor_storage = (__runInitializers(this, _private_panelHeight_extraInitializers), __runInitializers(this, _private_visible_initializers, false));
|
|
143
|
-
get #visible() { return _private_visible_descriptor.get.call(this); }
|
|
144
|
-
set #visible(value) { return _private_visible_descriptor.set.call(this, value); }
|
|
145
|
-
#prevOpen = (__runInitializers(this, _private_visible_extraInitializers), undefined);
|
|
146
|
-
#animGen = 0;
|
|
147
|
-
get #open() {
|
|
148
|
-
return this._ctx?.openValues.includes(this.value) ?? false;
|
|
149
|
-
}
|
|
150
|
-
get #isDisabled() {
|
|
151
|
-
return this.disabled || this._ctx?.disabled;
|
|
152
|
-
}
|
|
153
|
-
get #triggerId() {
|
|
154
|
-
return `dui-trigger-${this.value}`;
|
|
155
|
-
}
|
|
156
|
-
get #panelId() {
|
|
157
|
-
return `dui-panel-${this.value}`;
|
|
158
|
-
}
|
|
159
|
-
connectedCallback() {
|
|
160
|
-
super.connectedCallback();
|
|
161
|
-
this._ctx?.registerItem(this.value, this);
|
|
162
|
-
}
|
|
163
|
-
disconnectedCallback() {
|
|
164
|
-
super.disconnectedCallback();
|
|
165
|
-
this._ctx?.unregisterItem(this.value);
|
|
166
|
-
}
|
|
167
|
-
willUpdate() {
|
|
168
|
-
const isOpen = this.#open;
|
|
169
|
-
if (this.#prevOpen === undefined) {
|
|
170
|
-
this.#visible = isOpen;
|
|
171
|
-
this.#panelHeight = isOpen ? "auto" : "0";
|
|
172
|
-
}
|
|
173
|
-
else if (this.#prevOpen !== isOpen) {
|
|
174
|
-
if (isOpen) {
|
|
175
|
-
this.#startOpenAnimation();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
this.#startCloseAnimation();
|
|
179
|
-
}
|
|
180
|
-
this.dispatchEvent(openChangeEvent({ value: this.value, open: isOpen }));
|
|
181
|
-
}
|
|
182
|
-
this.#prevOpen = isOpen;
|
|
183
|
-
}
|
|
184
|
-
#startOpenAnimation() {
|
|
185
|
-
const gen = ++this.#animGen;
|
|
186
|
-
this.#ending = false;
|
|
187
|
-
this.#visible = true;
|
|
188
|
-
this.#starting = true;
|
|
189
|
-
this.#panelHeight = "0";
|
|
190
|
-
requestAnimationFrame(() => {
|
|
191
|
-
if (this.#animGen !== gen)
|
|
192
|
-
return;
|
|
193
|
-
const panel = this.shadowRoot?.querySelector("[part='panel']");
|
|
194
|
-
if (panel) {
|
|
195
|
-
this.#panelHeight = `${panel.scrollHeight}px`;
|
|
196
|
-
}
|
|
197
|
-
this.#starting = false;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
#startCloseAnimation() {
|
|
201
|
-
const gen = ++this.#animGen;
|
|
202
|
-
this.#starting = false;
|
|
203
|
-
const panel = this.shadowRoot?.querySelector("[part='panel']");
|
|
204
|
-
if (panel) {
|
|
205
|
-
this.#panelHeight = `${panel.scrollHeight}px`;
|
|
206
|
-
}
|
|
207
|
-
requestAnimationFrame(() => {
|
|
208
|
-
if (this.#animGen !== gen)
|
|
209
|
-
return;
|
|
210
|
-
this.#ending = true;
|
|
211
|
-
this.#panelHeight = "0";
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
#onTransitionEnd = (event) => {
|
|
215
|
-
if (event.propertyName !== "height")
|
|
216
|
-
return;
|
|
217
|
-
if (this.#ending) {
|
|
218
|
-
this.#ending = false;
|
|
219
|
-
if (!this._ctx?.keepMounted) {
|
|
220
|
-
this.#visible = false;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
else if (this.#open) {
|
|
224
|
-
this.#panelHeight = "auto";
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
#onClick = () => {
|
|
228
|
-
if (this.#isDisabled)
|
|
229
|
-
return;
|
|
230
|
-
this._ctx.toggle(this.value);
|
|
231
|
-
};
|
|
232
|
-
#onKeyDown = (event) => {
|
|
233
|
-
if (this.#isDisabled)
|
|
234
|
-
return;
|
|
235
|
-
const isVertical = this._ctx.orientation === "vertical";
|
|
236
|
-
const nextKey = isVertical ? "ArrowDown" : "ArrowRight";
|
|
237
|
-
const prevKey = isVertical ? "ArrowUp" : "ArrowLeft";
|
|
238
|
-
switch (event.key) {
|
|
239
|
-
case nextKey:
|
|
240
|
-
event.preventDefault();
|
|
241
|
-
this._ctx.focusItem(this.value, "next");
|
|
242
|
-
break;
|
|
243
|
-
case prevKey:
|
|
244
|
-
event.preventDefault();
|
|
245
|
-
this._ctx.focusItem(this.value, "prev");
|
|
246
|
-
break;
|
|
247
|
-
case "Home":
|
|
248
|
-
event.preventDefault();
|
|
249
|
-
this._ctx.focusItem(this.value, "first");
|
|
250
|
-
break;
|
|
251
|
-
case "End":
|
|
252
|
-
event.preventDefault();
|
|
253
|
-
this._ctx.focusItem(this.value, "last");
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
render() {
|
|
258
|
-
const shouldRender = this.#visible || this._ctx?.keepMounted;
|
|
259
|
-
return html `
|
|
260
|
-
<div
|
|
261
|
-
part="item"
|
|
262
|
-
?data-open=${this.#open}
|
|
263
|
-
?data-disabled=${this.#isDisabled}
|
|
264
|
-
>
|
|
265
|
-
<h3 part="header">
|
|
266
|
-
<button
|
|
267
|
-
part="trigger"
|
|
268
|
-
id=${this.#triggerId}
|
|
269
|
-
aria-expanded=${this.#open}
|
|
270
|
-
aria-controls=${this.#panelId}
|
|
271
|
-
?data-open=${this.#open}
|
|
272
|
-
?data-disabled=${this.#isDisabled}
|
|
273
|
-
@click=${this.#onClick}
|
|
274
|
-
@keydown=${this.#onKeyDown}
|
|
275
|
-
>
|
|
276
|
-
<slot name="trigger"></slot>
|
|
277
|
-
</button>
|
|
278
|
-
</h3>
|
|
279
|
-
${shouldRender
|
|
280
|
-
? html `
|
|
281
|
-
<div
|
|
282
|
-
part="panel"
|
|
283
|
-
id=${this.#panelId}
|
|
284
|
-
role="region"
|
|
285
|
-
aria-labelledby=${this.#triggerId}
|
|
286
|
-
style="height: ${this.#panelHeight}"
|
|
287
|
-
?data-open=${this.#open && !this.#starting}
|
|
288
|
-
?data-starting-style=${this.#starting}
|
|
289
|
-
?data-ending-style=${this.#ending}
|
|
290
|
-
?hidden=${!this.#visible && !this.#ending}
|
|
291
|
-
@transitionend=${this.#onTransitionEnd}
|
|
292
|
-
>
|
|
293
|
-
<div part="content">
|
|
294
|
-
<slot></slot>
|
|
295
|
-
</div>
|
|
296
|
-
</div>
|
|
297
|
-
`
|
|
298
|
-
: nothing}
|
|
299
|
-
</div>
|
|
300
|
-
`;
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
})();
|
|
304
|
-
export { DuiAccordionItem };
|
|
100
|
+
import { DuiAccordionItemPrimitive } from "@deepfuture/dui-primitives/accordion";
|
|
101
|
+
import "../_install.js";
|
|
102
|
+
export class DuiAccordionItem extends DuiAccordionItemPrimitive {
|
|
103
|
+
static styles = [...DuiAccordionItemPrimitive.styles, styles];
|
|
104
|
+
}
|
|
105
|
+
customElements.define(DuiAccordionItem.tagName, DuiAccordionItem);
|
package/accordion/accordion.d.ts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare const valueChangeEvent: (detail: string[]) => CustomEvent<string[]>;
|
|
5
|
-
export declare class DuiAccordion extends LitElement {
|
|
6
|
-
#private;
|
|
7
|
-
static tagName: "dui-accordion";
|
|
1
|
+
import { DuiAccordionPrimitive } from "@deepfuture/dui-primitives/accordion";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiAccordion extends DuiAccordionPrimitive {
|
|
8
4
|
static styles: import("lit").CSSResult[];
|
|
9
|
-
accessor value: string[] | undefined;
|
|
10
|
-
accessor defaultValue: string[];
|
|
11
|
-
accessor disabled: boolean;
|
|
12
|
-
accessor multiple: boolean;
|
|
13
|
-
accessor loopFocus: boolean;
|
|
14
|
-
accessor orientation: "vertical" | "horizontal";
|
|
15
|
-
accessor keepMounted: boolean;
|
|
16
|
-
accessor _ctx: AccordionContext;
|
|
17
|
-
connectedCallback(): void;
|
|
18
|
-
willUpdate(): void;
|
|
19
|
-
render(): TemplateResult;
|
|
20
5
|
}
|