@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/field/field.js
CHANGED
|
@@ -1,363 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
-
};
|
|
39
|
-
import { css, html, LitElement } from "lit";
|
|
40
|
-
import { property, state } from "lit/decorators.js";
|
|
41
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
42
|
-
/** Selector matching all DUI form controls that can be wired by a field. */
|
|
43
|
-
const CONTROL_SELECTOR = [
|
|
44
|
-
"dui-input",
|
|
45
|
-
"dui-textarea",
|
|
46
|
-
"dui-select",
|
|
47
|
-
"dui-checkbox",
|
|
48
|
-
"dui-checkbox-group",
|
|
49
|
-
"dui-radio",
|
|
50
|
-
"dui-radio-group",
|
|
51
|
-
"dui-switch",
|
|
52
|
-
"dui-number-field",
|
|
53
|
-
"dui-stepper",
|
|
54
|
-
"dui-slider",
|
|
55
|
-
"dui-combobox",
|
|
56
|
-
"dui-dropzone",
|
|
57
|
-
].join(", ");
|
|
58
|
-
/** Structural styles only — layout CSS. */
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiFieldPrimitive } from "@deepfuture/dui-primitives/field";
|
|
3
|
+
import "../_install.js";
|
|
59
4
|
const styles = css `
|
|
60
|
-
:host {
|
|
61
|
-
display: block;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
5
|
[part="root"] {
|
|
65
|
-
|
|
66
|
-
flex-direction: column;
|
|
6
|
+
gap: var(--space-2);
|
|
67
7
|
}
|
|
68
8
|
|
|
69
9
|
[part="root"][data-orientation="horizontal"] {
|
|
70
|
-
|
|
71
|
-
align-items: start;
|
|
10
|
+
gap: var(--space-3);
|
|
72
11
|
}
|
|
73
12
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
13
|
+
[part="label"] {
|
|
14
|
+
font-family: var(--font-sans);
|
|
15
|
+
font-size: var(--text-sm);
|
|
16
|
+
font-weight: var(--font-weight-medium);
|
|
17
|
+
line-height: var(--line-height-normal);
|
|
18
|
+
color: var(--text-1);
|
|
19
|
+
}
|
|
78
20
|
|
|
79
|
-
[part="
|
|
21
|
+
[part="label"][data-disabled] {
|
|
22
|
+
opacity: 0.4;
|
|
23
|
+
}
|
|
80
24
|
|
|
81
|
-
[part="
|
|
82
|
-
|
|
25
|
+
[part="description"] {
|
|
26
|
+
font-family: var(--font-sans);
|
|
27
|
+
font-size: var(--text-xs);
|
|
28
|
+
line-height: var(--line-height-normal);
|
|
29
|
+
color: var(--text-3);
|
|
30
|
+
margin: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[part="error"][data-invalid] {
|
|
34
|
+
font-family: var(--font-sans);
|
|
35
|
+
font-size: var(--text-xs);
|
|
36
|
+
line-height: var(--line-height-normal);
|
|
37
|
+
color: var(--destructive);
|
|
38
|
+
margin: 0;
|
|
39
|
+
}
|
|
83
40
|
`;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* form control. Manages ARIA wiring, field state (dirty, touched, focused,
|
|
89
|
-
* filled), disabled propagation, and label click-to-focus.
|
|
90
|
-
*
|
|
91
|
-
* @slot label - Label text (e.g. `<span slot="label">Email</span>`).
|
|
92
|
-
* @slot - Default slot for the form control.
|
|
93
|
-
* @slot description - Help text (e.g. `<span slot="description">…</span>`).
|
|
94
|
-
* @slot error - Error message (e.g. `<span slot="error">Required</span>`).
|
|
95
|
-
* @csspart root - The field container element.
|
|
96
|
-
* @csspart label - The label wrapper.
|
|
97
|
-
* @csspart description - The description wrapper.
|
|
98
|
-
* @csspart error - The error wrapper (hidden unless invalid).
|
|
99
|
-
*/
|
|
100
|
-
let DuiField = (() => {
|
|
101
|
-
let _classSuper = LitElement;
|
|
102
|
-
let _disabled_decorators;
|
|
103
|
-
let _disabled_initializers = [];
|
|
104
|
-
let _disabled_extraInitializers = [];
|
|
105
|
-
let _invalid_decorators;
|
|
106
|
-
let _invalid_initializers = [];
|
|
107
|
-
let _invalid_extraInitializers = [];
|
|
108
|
-
let _orientation_decorators;
|
|
109
|
-
let _orientation_initializers = [];
|
|
110
|
-
let _orientation_extraInitializers = [];
|
|
111
|
-
let _private_dirty_decorators;
|
|
112
|
-
let _private_dirty_initializers = [];
|
|
113
|
-
let _private_dirty_extraInitializers = [];
|
|
114
|
-
let _private_dirty_descriptor;
|
|
115
|
-
let _private_touched_decorators;
|
|
116
|
-
let _private_touched_initializers = [];
|
|
117
|
-
let _private_touched_extraInitializers = [];
|
|
118
|
-
let _private_touched_descriptor;
|
|
119
|
-
let _private_focused_decorators;
|
|
120
|
-
let _private_focused_initializers = [];
|
|
121
|
-
let _private_focused_extraInitializers = [];
|
|
122
|
-
let _private_focused_descriptor;
|
|
123
|
-
let _private_filled_decorators;
|
|
124
|
-
let _private_filled_initializers = [];
|
|
125
|
-
let _private_filled_extraInitializers = [];
|
|
126
|
-
let _private_filled_descriptor;
|
|
127
|
-
let _private_hasLabel_decorators;
|
|
128
|
-
let _private_hasLabel_initializers = [];
|
|
129
|
-
let _private_hasLabel_extraInitializers = [];
|
|
130
|
-
let _private_hasLabel_descriptor;
|
|
131
|
-
let _private_hasDescription_decorators;
|
|
132
|
-
let _private_hasDescription_initializers = [];
|
|
133
|
-
let _private_hasDescription_extraInitializers = [];
|
|
134
|
-
let _private_hasDescription_descriptor;
|
|
135
|
-
let _private_hasError_decorators;
|
|
136
|
-
let _private_hasError_initializers = [];
|
|
137
|
-
let _private_hasError_extraInitializers = [];
|
|
138
|
-
let _private_hasError_descriptor;
|
|
139
|
-
return class DuiField extends _classSuper {
|
|
140
|
-
static {
|
|
141
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
142
|
-
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
143
|
-
_invalid_decorators = [property({ type: Boolean, reflect: true })];
|
|
144
|
-
_orientation_decorators = [property()];
|
|
145
|
-
_private_dirty_decorators = [state()];
|
|
146
|
-
_private_touched_decorators = [state()];
|
|
147
|
-
_private_focused_decorators = [state()];
|
|
148
|
-
_private_filled_decorators = [state()];
|
|
149
|
-
_private_hasLabel_decorators = [state()];
|
|
150
|
-
_private_hasDescription_decorators = [state()];
|
|
151
|
-
_private_hasError_decorators = [state()];
|
|
152
|
-
__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);
|
|
153
|
-
__esDecorate(this, null, _invalid_decorators, { kind: "accessor", name: "invalid", static: false, private: false, access: { has: obj => "invalid" in obj, get: obj => obj.invalid, set: (obj, value) => { obj.invalid = value; } }, metadata: _metadata }, _invalid_initializers, _invalid_extraInitializers);
|
|
154
|
-
__esDecorate(this, null, _orientation_decorators, { kind: "accessor", name: "orientation", static: false, private: false, access: { has: obj => "orientation" in obj, get: obj => obj.orientation, set: (obj, value) => { obj.orientation = value; } }, metadata: _metadata }, _orientation_initializers, _orientation_extraInitializers);
|
|
155
|
-
__esDecorate(this, _private_dirty_descriptor = { get: __setFunctionName(function () { return this.#dirty_accessor_storage; }, "#dirty", "get"), set: __setFunctionName(function (value) { this.#dirty_accessor_storage = value; }, "#dirty", "set") }, _private_dirty_decorators, { kind: "accessor", name: "#dirty", static: false, private: true, access: { has: obj => #dirty in obj, get: obj => obj.#dirty, set: (obj, value) => { obj.#dirty = value; } }, metadata: _metadata }, _private_dirty_initializers, _private_dirty_extraInitializers);
|
|
156
|
-
__esDecorate(this, _private_touched_descriptor = { get: __setFunctionName(function () { return this.#touched_accessor_storage; }, "#touched", "get"), set: __setFunctionName(function (value) { this.#touched_accessor_storage = value; }, "#touched", "set") }, _private_touched_decorators, { kind: "accessor", name: "#touched", static: false, private: true, access: { has: obj => #touched in obj, get: obj => obj.#touched, set: (obj, value) => { obj.#touched = value; } }, metadata: _metadata }, _private_touched_initializers, _private_touched_extraInitializers);
|
|
157
|
-
__esDecorate(this, _private_focused_descriptor = { get: __setFunctionName(function () { return this.#focused_accessor_storage; }, "#focused", "get"), set: __setFunctionName(function (value) { this.#focused_accessor_storage = value; }, "#focused", "set") }, _private_focused_decorators, { kind: "accessor", name: "#focused", static: false, private: true, access: { has: obj => #focused in obj, get: obj => obj.#focused, set: (obj, value) => { obj.#focused = value; } }, metadata: _metadata }, _private_focused_initializers, _private_focused_extraInitializers);
|
|
158
|
-
__esDecorate(this, _private_filled_descriptor = { get: __setFunctionName(function () { return this.#filled_accessor_storage; }, "#filled", "get"), set: __setFunctionName(function (value) { this.#filled_accessor_storage = value; }, "#filled", "set") }, _private_filled_decorators, { kind: "accessor", name: "#filled", static: false, private: true, access: { has: obj => #filled in obj, get: obj => obj.#filled, set: (obj, value) => { obj.#filled = value; } }, metadata: _metadata }, _private_filled_initializers, _private_filled_extraInitializers);
|
|
159
|
-
__esDecorate(this, _private_hasLabel_descriptor = { get: __setFunctionName(function () { return this.#hasLabel_accessor_storage; }, "#hasLabel", "get"), set: __setFunctionName(function (value) { this.#hasLabel_accessor_storage = value; }, "#hasLabel", "set") }, _private_hasLabel_decorators, { kind: "accessor", name: "#hasLabel", static: false, private: true, access: { has: obj => #hasLabel in obj, get: obj => obj.#hasLabel, set: (obj, value) => { obj.#hasLabel = value; } }, metadata: _metadata }, _private_hasLabel_initializers, _private_hasLabel_extraInitializers);
|
|
160
|
-
__esDecorate(this, _private_hasDescription_descriptor = { get: __setFunctionName(function () { return this.#hasDescription_accessor_storage; }, "#hasDescription", "get"), set: __setFunctionName(function (value) { this.#hasDescription_accessor_storage = value; }, "#hasDescription", "set") }, _private_hasDescription_decorators, { kind: "accessor", name: "#hasDescription", static: false, private: true, access: { has: obj => #hasDescription in obj, get: obj => obj.#hasDescription, set: (obj, value) => { obj.#hasDescription = value; } }, metadata: _metadata }, _private_hasDescription_initializers, _private_hasDescription_extraInitializers);
|
|
161
|
-
__esDecorate(this, _private_hasError_descriptor = { get: __setFunctionName(function () { return this.#hasError_accessor_storage; }, "#hasError", "get"), set: __setFunctionName(function (value) { this.#hasError_accessor_storage = value; }, "#hasError", "set") }, _private_hasError_decorators, { kind: "accessor", name: "#hasError", static: false, private: true, access: { has: obj => #hasError in obj, get: obj => obj.#hasError, set: (obj, value) => { obj.#hasError = value; } }, metadata: _metadata }, _private_hasError_initializers, _private_hasError_extraInitializers);
|
|
162
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
163
|
-
}
|
|
164
|
-
static tagName = "dui-field";
|
|
165
|
-
static styles = [base, styles];
|
|
166
|
-
#disabled_accessor_storage = __runInitializers(this, _disabled_initializers, false);
|
|
167
|
-
/** Whether the child control is disabled. */
|
|
168
|
-
get disabled() { return this.#disabled_accessor_storage; }
|
|
169
|
-
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
170
|
-
#invalid_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _invalid_initializers, false));
|
|
171
|
-
/** Whether the field is in an invalid state. */
|
|
172
|
-
get invalid() { return this.#invalid_accessor_storage; }
|
|
173
|
-
set invalid(value) { this.#invalid_accessor_storage = value; }
|
|
174
|
-
#orientation_accessor_storage = (__runInitializers(this, _invalid_extraInitializers), __runInitializers(this, _orientation_initializers, "vertical"));
|
|
175
|
-
/** Layout direction: vertical (column) or horizontal (row). */
|
|
176
|
-
get orientation() { return this.#orientation_accessor_storage; }
|
|
177
|
-
set orientation(value) { this.#orientation_accessor_storage = value; }
|
|
178
|
-
#dirty_accessor_storage = (__runInitializers(this, _orientation_extraInitializers), __runInitializers(this, _private_dirty_initializers, false));
|
|
179
|
-
// --- Internal state ---
|
|
180
|
-
get #dirty() { return _private_dirty_descriptor.get.call(this); }
|
|
181
|
-
set #dirty(value) { return _private_dirty_descriptor.set.call(this, value); }
|
|
182
|
-
#touched_accessor_storage = (__runInitializers(this, _private_dirty_extraInitializers), __runInitializers(this, _private_touched_initializers, false));
|
|
183
|
-
get #touched() { return _private_touched_descriptor.get.call(this); }
|
|
184
|
-
set #touched(value) { return _private_touched_descriptor.set.call(this, value); }
|
|
185
|
-
#focused_accessor_storage = (__runInitializers(this, _private_touched_extraInitializers), __runInitializers(this, _private_focused_initializers, false));
|
|
186
|
-
get #focused() { return _private_focused_descriptor.get.call(this); }
|
|
187
|
-
set #focused(value) { return _private_focused_descriptor.set.call(this, value); }
|
|
188
|
-
#filled_accessor_storage = (__runInitializers(this, _private_focused_extraInitializers), __runInitializers(this, _private_filled_initializers, false));
|
|
189
|
-
get #filled() { return _private_filled_descriptor.get.call(this); }
|
|
190
|
-
set #filled(value) { return _private_filled_descriptor.set.call(this, value); }
|
|
191
|
-
#hasLabel_accessor_storage = (__runInitializers(this, _private_filled_extraInitializers), __runInitializers(this, _private_hasLabel_initializers, false));
|
|
192
|
-
get #hasLabel() { return _private_hasLabel_descriptor.get.call(this); }
|
|
193
|
-
set #hasLabel(value) { return _private_hasLabel_descriptor.set.call(this, value); }
|
|
194
|
-
#hasDescription_accessor_storage = (__runInitializers(this, _private_hasLabel_extraInitializers), __runInitializers(this, _private_hasDescription_initializers, false));
|
|
195
|
-
get #hasDescription() { return _private_hasDescription_descriptor.get.call(this); }
|
|
196
|
-
set #hasDescription(value) { return _private_hasDescription_descriptor.set.call(this, value); }
|
|
197
|
-
#hasError_accessor_storage = (__runInitializers(this, _private_hasDescription_extraInitializers), __runInitializers(this, _private_hasError_initializers, false));
|
|
198
|
-
get #hasError() { return _private_hasError_descriptor.get.call(this); }
|
|
199
|
-
set #hasError(value) { return _private_hasError_descriptor.set.call(this, value); }
|
|
200
|
-
// --- Stable IDs ---
|
|
201
|
-
#fieldId = (__runInitializers(this, _private_hasError_extraInitializers), crypto.randomUUID().slice(0, 8));
|
|
202
|
-
get #labelId() {
|
|
203
|
-
return `field-${this.#fieldId}-label`;
|
|
204
|
-
}
|
|
205
|
-
get #descriptionId() {
|
|
206
|
-
return `field-${this.#fieldId}-desc`;
|
|
207
|
-
}
|
|
208
|
-
get #errorId() {
|
|
209
|
-
return `field-${this.#fieldId}-error`;
|
|
210
|
-
}
|
|
211
|
-
// --- Control reference ---
|
|
212
|
-
#control;
|
|
213
|
-
#controlWasDisabled = false;
|
|
214
|
-
// --- Lifecycle ---
|
|
215
|
-
connectedCallback() {
|
|
216
|
-
super.connectedCallback();
|
|
217
|
-
this.addEventListener("focusin", this.#onFocusIn);
|
|
218
|
-
this.addEventListener("focusout", this.#onFocusOut);
|
|
219
|
-
this.addEventListener("input", this.#onInput);
|
|
220
|
-
this.addEventListener("change", this.#onChange);
|
|
221
|
-
}
|
|
222
|
-
disconnectedCallback() {
|
|
223
|
-
super.disconnectedCallback();
|
|
224
|
-
this.removeEventListener("focusin", this.#onFocusIn);
|
|
225
|
-
this.removeEventListener("focusout", this.#onFocusOut);
|
|
226
|
-
this.removeEventListener("input", this.#onInput);
|
|
227
|
-
this.removeEventListener("change", this.#onChange);
|
|
228
|
-
}
|
|
229
|
-
willUpdate(changed) {
|
|
230
|
-
if (changed.has("invalid") && this.#control) {
|
|
231
|
-
this.#wireControl();
|
|
232
|
-
}
|
|
233
|
-
if (changed.has("disabled") && this.#control) {
|
|
234
|
-
if (this.disabled) {
|
|
235
|
-
this.#controlWasDisabled = this.#control.hasAttribute("disabled");
|
|
236
|
-
this.#control.setAttribute("disabled", "");
|
|
237
|
-
}
|
|
238
|
-
else if (!this.#controlWasDisabled) {
|
|
239
|
-
this.#control.removeAttribute("disabled");
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
// --- Field state from DOM events ---
|
|
244
|
-
#onFocusIn = () => {
|
|
245
|
-
this.#focused = true;
|
|
246
|
-
};
|
|
247
|
-
#onFocusOut = () => {
|
|
248
|
-
this.#focused = false;
|
|
249
|
-
this.#touched = true;
|
|
250
|
-
};
|
|
251
|
-
#onInput = () => {
|
|
252
|
-
this.#dirty = true;
|
|
253
|
-
this.#filled = true;
|
|
254
|
-
};
|
|
255
|
-
#onChange = () => {
|
|
256
|
-
this.#dirty = true;
|
|
257
|
-
};
|
|
258
|
-
// --- Slot change handlers ---
|
|
259
|
-
#onControlSlotChange = () => {
|
|
260
|
-
const slot = this.shadowRoot?.querySelector("slot:not([name])");
|
|
261
|
-
const nodes = slot?.assignedElements({ flatten: true }) ?? [];
|
|
262
|
-
this.#control = nodes.find((el) => el.matches(CONTROL_SELECTOR));
|
|
263
|
-
if (this.#control) {
|
|
264
|
-
this.#wireControl();
|
|
265
|
-
if (this.disabled) {
|
|
266
|
-
this.#controlWasDisabled = this.#control.hasAttribute("disabled");
|
|
267
|
-
this.#control.setAttribute("disabled", "");
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
#onLabelSlotChange = (e) => {
|
|
272
|
-
const slot = e.target;
|
|
273
|
-
this.#hasLabel = slot.assignedNodes({ flatten: true }).length > 0;
|
|
274
|
-
};
|
|
275
|
-
#onDescriptionSlotChange = (e) => {
|
|
276
|
-
const slot = e.target;
|
|
277
|
-
this.#hasDescription = slot.assignedNodes({ flatten: true }).length > 0;
|
|
278
|
-
this.#wireControl();
|
|
279
|
-
};
|
|
280
|
-
#onErrorSlotChange = (e) => {
|
|
281
|
-
const slot = e.target;
|
|
282
|
-
this.#hasError = slot.assignedNodes({ flatten: true }).length > 0;
|
|
283
|
-
this.#wireControl();
|
|
284
|
-
};
|
|
285
|
-
// --- ARIA wiring ---
|
|
286
|
-
#wireControl() {
|
|
287
|
-
const ctrl = this.#control;
|
|
288
|
-
if (!ctrl)
|
|
289
|
-
return;
|
|
290
|
-
// Build aria-describedby from present slots
|
|
291
|
-
const parts = [];
|
|
292
|
-
if (this.#hasDescription)
|
|
293
|
-
parts.push(this.#descriptionId);
|
|
294
|
-
if (this.invalid && this.#hasError)
|
|
295
|
-
parts.push(this.#errorId);
|
|
296
|
-
const describedBy = parts.join(" ") || null;
|
|
297
|
-
if (describedBy)
|
|
298
|
-
ctrl.setAttribute("aria-describedby", describedBy);
|
|
299
|
-
else
|
|
300
|
-
ctrl.removeAttribute("aria-describedby");
|
|
301
|
-
ctrl.setAttribute("aria-invalid", String(this.invalid));
|
|
302
|
-
}
|
|
303
|
-
// --- Label click-to-focus ---
|
|
304
|
-
#onLabelClick = () => {
|
|
305
|
-
if (!this.disabled) {
|
|
306
|
-
this.#control?.focus();
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
// --- Render ---
|
|
310
|
-
render() {
|
|
311
|
-
return html `
|
|
312
|
-
<div
|
|
313
|
-
part="root"
|
|
314
|
-
role="group"
|
|
315
|
-
?data-disabled="${this.disabled}"
|
|
316
|
-
?data-invalid="${this.invalid}"
|
|
317
|
-
?data-valid="${!this.invalid}"
|
|
318
|
-
?data-dirty="${this.#dirty}"
|
|
319
|
-
?data-touched="${this.#touched}"
|
|
320
|
-
?data-filled="${this.#filled}"
|
|
321
|
-
?data-focused="${this.#focused}"
|
|
322
|
-
data-orientation="${this.orientation}"
|
|
323
|
-
>
|
|
324
|
-
<div
|
|
325
|
-
part="label"
|
|
326
|
-
id="${this.#labelId}"
|
|
327
|
-
?data-slotted="${this.#hasLabel}"
|
|
328
|
-
?data-disabled="${this.disabled}"
|
|
329
|
-
@click="${this.#onLabelClick}"
|
|
330
|
-
>
|
|
331
|
-
<slot
|
|
332
|
-
name="label"
|
|
333
|
-
@slotchange="${this.#onLabelSlotChange}"
|
|
334
|
-
></slot>
|
|
335
|
-
</div>
|
|
336
|
-
<slot @slotchange="${this.#onControlSlotChange}"></slot>
|
|
337
|
-
<div
|
|
338
|
-
part="description"
|
|
339
|
-
id="${this.#descriptionId}"
|
|
340
|
-
?data-slotted="${this.#hasDescription}"
|
|
341
|
-
>
|
|
342
|
-
<slot
|
|
343
|
-
name="description"
|
|
344
|
-
@slotchange="${this.#onDescriptionSlotChange}"
|
|
345
|
-
></slot>
|
|
346
|
-
</div>
|
|
347
|
-
<div
|
|
348
|
-
part="error"
|
|
349
|
-
id="${this.#errorId}"
|
|
350
|
-
role="alert"
|
|
351
|
-
?data-invalid="${this.invalid}"
|
|
352
|
-
>
|
|
353
|
-
<slot
|
|
354
|
-
name="error"
|
|
355
|
-
@slotchange="${this.#onErrorSlotChange}"
|
|
356
|
-
></slot>
|
|
357
|
-
</div>
|
|
358
|
-
</div>
|
|
359
|
-
`;
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
})();
|
|
363
|
-
export { DuiField };
|
|
41
|
+
export class DuiField extends DuiFieldPrimitive {
|
|
42
|
+
static styles = [...DuiFieldPrimitive.styles, styles];
|
|
43
|
+
}
|
|
44
|
+
customElements.define(DuiField.tagName, DuiField);
|
package/field/index.d.ts
CHANGED
package/field/index.js
CHANGED
package/fieldset/fieldset.d.ts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Wraps content in a native `<fieldset>` element, providing semantic
|
|
6
|
-
* grouping for radio groups, checkbox groups, or logical field clusters.
|
|
7
|
-
*
|
|
8
|
-
* @slot legend - Legend text (e.g. `<span slot="legend">Personal Info</span>`).
|
|
9
|
-
* @slot - Default slot for field children.
|
|
10
|
-
* @csspart root - The native `<fieldset>` element.
|
|
11
|
-
* @csspart legend - The native `<legend>` element.
|
|
12
|
-
*/
|
|
13
|
-
export declare class DuiFieldset extends LitElement {
|
|
14
|
-
#private;
|
|
15
|
-
static tagName: "dui-fieldset";
|
|
1
|
+
import { DuiFieldsetPrimitive } from "@deepfuture/dui-primitives/fieldset";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiFieldset extends DuiFieldsetPrimitive {
|
|
16
4
|
static styles: import("lit").CSSResult[];
|
|
17
|
-
/** Disables all child form controls. */
|
|
18
|
-
accessor disabled: boolean;
|
|
19
|
-
render(): TemplateResult;
|
|
20
5
|
}
|
package/fieldset/fieldset.js
CHANGED
|
@@ -1,116 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
-
};
|
|
39
|
-
import { css, html, LitElement } from "lit";
|
|
40
|
-
import { property, state } from "lit/decorators.js";
|
|
41
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
42
|
-
/** Structural styles only — layout CSS. */
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiFieldsetPrimitive } from "@deepfuture/dui-primitives/fieldset";
|
|
3
|
+
import "../_install.js";
|
|
43
4
|
const styles = css `
|
|
44
|
-
|
|
45
|
-
display:
|
|
5
|
+
[part="root"] {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--space-4);
|
|
46
9
|
}
|
|
47
10
|
|
|
48
|
-
[part="root"] {
|
|
49
|
-
|
|
50
|
-
margin: 0;
|
|
51
|
-
padding: 0;
|
|
52
|
-
min-width: 0;
|
|
11
|
+
[part="root"][data-disabled] {
|
|
12
|
+
opacity: 0.4;
|
|
53
13
|
}
|
|
54
14
|
|
|
55
|
-
[part="legend"]
|
|
56
|
-
|
|
15
|
+
[part="legend"] {
|
|
16
|
+
font-family: var(--font-sans);
|
|
17
|
+
font-size: var(--text-sm);
|
|
18
|
+
font-weight: var(--font-weight-semibold);
|
|
19
|
+
line-height: var(--line-height-normal);
|
|
20
|
+
color: var(--text-1);
|
|
21
|
+
margin-bottom: var(--space-2);
|
|
22
|
+
}
|
|
57
23
|
`;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* grouping for radio groups, checkbox groups, or logical field clusters.
|
|
63
|
-
*
|
|
64
|
-
* @slot legend - Legend text (e.g. `<span slot="legend">Personal Info</span>`).
|
|
65
|
-
* @slot - Default slot for field children.
|
|
66
|
-
* @csspart root - The native `<fieldset>` element.
|
|
67
|
-
* @csspart legend - The native `<legend>` element.
|
|
68
|
-
*/
|
|
69
|
-
let DuiFieldset = (() => {
|
|
70
|
-
let _classSuper = LitElement;
|
|
71
|
-
let _disabled_decorators;
|
|
72
|
-
let _disabled_initializers = [];
|
|
73
|
-
let _disabled_extraInitializers = [];
|
|
74
|
-
let _private_hasLegend_decorators;
|
|
75
|
-
let _private_hasLegend_initializers = [];
|
|
76
|
-
let _private_hasLegend_extraInitializers = [];
|
|
77
|
-
let _private_hasLegend_descriptor;
|
|
78
|
-
return class DuiFieldset extends _classSuper {
|
|
79
|
-
static {
|
|
80
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
81
|
-
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
82
|
-
_private_hasLegend_decorators = [state()];
|
|
83
|
-
__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);
|
|
84
|
-
__esDecorate(this, _private_hasLegend_descriptor = { get: __setFunctionName(function () { return this.#hasLegend_accessor_storage; }, "#hasLegend", "get"), set: __setFunctionName(function (value) { this.#hasLegend_accessor_storage = value; }, "#hasLegend", "set") }, _private_hasLegend_decorators, { kind: "accessor", name: "#hasLegend", static: false, private: true, access: { has: obj => #hasLegend in obj, get: obj => obj.#hasLegend, set: (obj, value) => { obj.#hasLegend = value; } }, metadata: _metadata }, _private_hasLegend_initializers, _private_hasLegend_extraInitializers);
|
|
85
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
86
|
-
}
|
|
87
|
-
static tagName = "dui-fieldset";
|
|
88
|
-
static styles = [base, styles];
|
|
89
|
-
#disabled_accessor_storage = __runInitializers(this, _disabled_initializers, false);
|
|
90
|
-
/** Disables all child form controls. */
|
|
91
|
-
get disabled() { return this.#disabled_accessor_storage; }
|
|
92
|
-
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
93
|
-
#hasLegend_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _private_hasLegend_initializers, false));
|
|
94
|
-
get #hasLegend() { return _private_hasLegend_descriptor.get.call(this); }
|
|
95
|
-
set #hasLegend(value) { return _private_hasLegend_descriptor.set.call(this, value); }
|
|
96
|
-
#onLegendSlotChange = (__runInitializers(this, _private_hasLegend_extraInitializers), (e) => {
|
|
97
|
-
const slot = e.target;
|
|
98
|
-
this.#hasLegend = slot.assignedNodes({ flatten: true }).length > 0;
|
|
99
|
-
});
|
|
100
|
-
render() {
|
|
101
|
-
return html `
|
|
102
|
-
<fieldset
|
|
103
|
-
part="root"
|
|
104
|
-
?disabled="${this.disabled}"
|
|
105
|
-
?data-disabled="${this.disabled}"
|
|
106
|
-
>
|
|
107
|
-
<legend part="legend" ?data-slotted="${this.#hasLegend}">
|
|
108
|
-
<slot name="legend" @slotchange="${this.#onLegendSlotChange}"></slot>
|
|
109
|
-
</legend>
|
|
110
|
-
<slot></slot>
|
|
111
|
-
</fieldset>
|
|
112
|
-
`;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
})();
|
|
116
|
-
export { DuiFieldset };
|
|
24
|
+
export class DuiFieldset extends DuiFieldsetPrimitive {
|
|
25
|
+
static styles = [...DuiFieldsetPrimitive.styles, styles];
|
|
26
|
+
}
|
|
27
|
+
customElements.define(DuiFieldset.tagName, DuiFieldset);
|
package/fieldset/index.d.ts
CHANGED
package/fieldset/index.js
CHANGED
package/icon/icon.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Consumers provide their own SVG via the default slot. The icon inherits
|
|
6
|
-
* `currentColor` and sizes itself via `--icon-size`.
|
|
7
|
-
*
|
|
8
|
-
* @slot - SVG element to display.
|
|
9
|
-
* @cssprop [--icon-size=1em] - Icon dimensions.
|
|
10
|
-
* @cssprop [--icon-color=currentColor] - Icon color.
|
|
11
|
-
*/
|
|
12
|
-
export declare class DuiIcon extends LitElement {
|
|
13
|
-
static tagName: "dui-icon";
|
|
14
|
-
static styles: import("lit").CSSResult[];
|
|
15
|
-
render(): import("lit").TemplateResult<1>;
|
|
1
|
+
import { DuiIconPrimitive } from "@deepfuture/dui-primitives/icon";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiIcon extends DuiIconPrimitive {
|
|
16
4
|
}
|
package/icon/icon.js
CHANGED
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
:host {
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
width: var(--icon-size, 1em);
|
|
9
|
-
height: var(--icon-size, 1em);
|
|
10
|
-
color: var(--icon-color, currentColor);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
::slotted(svg) {
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
/**
|
|
19
|
-
* `<dui-icon>` — Slot-based SVG icon container.
|
|
20
|
-
*
|
|
21
|
-
* Consumers provide their own SVG via the default slot. The icon inherits
|
|
22
|
-
* `currentColor` and sizes itself via `--icon-size`.
|
|
23
|
-
*
|
|
24
|
-
* @slot - SVG element to display.
|
|
25
|
-
* @cssprop [--icon-size=1em] - Icon dimensions.
|
|
26
|
-
* @cssprop [--icon-color=currentColor] - Icon color.
|
|
27
|
-
*/
|
|
28
|
-
export class DuiIcon extends LitElement {
|
|
29
|
-
static tagName = "dui-icon";
|
|
30
|
-
static styles = [base, styles];
|
|
31
|
-
render() {
|
|
32
|
-
return html `<slot></slot>`;
|
|
33
|
-
}
|
|
1
|
+
import { DuiIconPrimitive } from "@deepfuture/dui-primitives/icon";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export class DuiIcon extends DuiIconPrimitive {
|
|
34
4
|
}
|
|
5
|
+
customElements.define(DuiIcon.tagName, DuiIcon);
|
package/icon/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { DuiIcon };
|
|
3
|
-
export declare const iconFamily: (typeof DuiIcon)[];
|
|
1
|
+
import "./icon.js";
|
|
2
|
+
export { DuiIcon } from "./icon.js";
|
package/icon/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { DuiIcon };
|
|
3
|
-
export const iconFamily = [DuiIcon];
|
|
1
|
+
import "./icon.js";
|
|
2
|
+
export { DuiIcon } from "./icon.js";
|