@deepfuture/dui-components 0.0.12 → 0.0.14
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/_deprecated/center/center.js +2 -2
- package/_deprecated/hstack/hstack.js +79 -33
- package/_deprecated/page-inset/page-inset.js +104 -56
- package/_deprecated/vstack/vstack.js +61 -19
- package/accordion/accordion-item.js +217 -147
- package/accordion/accordion.js +214 -149
- package/alert-dialog/alert-dialog-close.js +2 -2
- package/alert-dialog/alert-dialog-popup.js +230 -166
- package/alert-dialog/alert-dialog-trigger.js +2 -2
- package/alert-dialog/alert-dialog.js +128 -73
- package/avatar/avatar.js +175 -115
- package/badge/badge.js +2 -2
- package/breadcrumb/breadcrumb-ellipsis.js +2 -2
- package/breadcrumb/breadcrumb-item.js +2 -2
- package/breadcrumb/breadcrumb-link.js +2 -2
- package/breadcrumb/breadcrumb-page.js +2 -2
- package/breadcrumb/breadcrumb-separator.js +2 -2
- package/breadcrumb/breadcrumb.js +2 -2
- package/button/button.js +109 -65
- package/calendar/calendar.js +368 -290
- package/checkbox/checkbox-group.js +146 -87
- package/checkbox/checkbox.js +232 -167
- package/collapsible/collapsible.js +210 -132
- package/combobox/combobox.js +318 -252
- package/command/command-empty.js +67 -25
- package/command/command-group.js +87 -47
- package/command/command-input.js +84 -44
- package/command/command-item.js +168 -124
- package/command/command-list.js +60 -18
- package/command/command-separator.js +2 -2
- package/command/command-shortcut.js +2 -2
- package/command/command.js +297 -232
- package/data-table/data-table.js +225 -153
- package/dialog/dialog-close.js +2 -2
- package/dialog/dialog-popup.js +247 -181
- package/dialog/dialog-trigger.js +2 -2
- package/dialog/dialog.js +128 -73
- package/dropzone/dropzone.js +310 -249
- package/icon/icon.js +2 -2
- package/input/input.js +204 -143
- package/link/link.js +62 -24
- package/menu/menu-item.js +66 -24
- package/menu/menu.js +189 -136
- package/menubar/menubar.js +142 -91
- package/number-field/number-field.js +277 -204
- package/package.json +2 -3
- package/popover/popover-close.js +2 -2
- package/popover/popover-popup.js +126 -76
- package/popover/popover-trigger.js +2 -2
- package/popover/popover.js +181 -120
- package/portal/portal.js +128 -86
- package/preview-card/preview-card-popup.js +114 -66
- package/preview-card/preview-card-trigger.js +2 -2
- package/preview-card/preview-card.js +211 -142
- package/progress/progress.js +91 -45
- package/radio/radio-group.js +153 -90
- package/radio/radio.js +137 -94
- package/scroll-area/scroll-area.js +382 -283
- package/select/select.js +260 -203
- package/separator/separator.js +60 -18
- package/sidebar/sidebar-content.js +2 -2
- package/sidebar/sidebar-footer.js +2 -2
- package/sidebar/sidebar-group-label.js +2 -2
- package/sidebar/sidebar-group.js +2 -2
- package/sidebar/sidebar-header.js +2 -2
- package/sidebar/sidebar-inset.js +2 -2
- package/sidebar/sidebar-menu-button.js +118 -74
- package/sidebar/sidebar-menu-item.js +2 -2
- package/sidebar/sidebar-menu.js +2 -2
- package/sidebar/sidebar-provider.js +202 -129
- package/sidebar/sidebar-separator.js +2 -2
- package/sidebar/sidebar-trigger.js +2 -2
- package/sidebar/sidebar.js +150 -85
- package/slider/slider.js +217 -159
- package/spinner/spinner.js +70 -28
- package/switch/switch.js +174 -111
- package/tabs/tab.js +89 -47
- package/tabs/tabs-indicator.js +2 -2
- package/tabs/tabs-list.js +92 -54
- package/tabs/tabs-panel.js +90 -44
- package/tabs/tabs.js +130 -71
- package/textarea/textarea.js +153 -95
- package/toggle/toggle-group.js +184 -125
- package/toggle/toggle.js +131 -76
- package/toolbar/toolbar.js +79 -33
- package/tooltip/tooltip-popup.js +108 -60
- package/tooltip/tooltip-trigger.js +93 -55
- package/tooltip/tooltip.js +225 -154
- package/trunc/trunc.js +78 -34
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
/** Ported from original DUI: deep-future-app/app/client/components/dui/checkbox */
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
7
39
|
};
|
|
8
40
|
import { css, html, LitElement } from "lit";
|
|
9
41
|
import { property, state } from "lit/decorators.js";
|
|
@@ -39,73 +71,110 @@ const styles = css `
|
|
|
39
71
|
*
|
|
40
72
|
* @fires value-change - Fired when the set of checked values changes. Detail: string[]
|
|
41
73
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
:
|
|
73
|
-
|
|
74
|
-
this
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const next = checked ? [...this.allValues] : [];
|
|
80
|
-
if (this.value === undefined) {
|
|
81
|
-
this.#internalValues = next;
|
|
74
|
+
let DuiCheckboxGroup = (() => {
|
|
75
|
+
let _classSuper = LitElement;
|
|
76
|
+
let _value_decorators;
|
|
77
|
+
let _value_initializers = [];
|
|
78
|
+
let _value_extraInitializers = [];
|
|
79
|
+
let _defaultValue_decorators;
|
|
80
|
+
let _defaultValue_initializers = [];
|
|
81
|
+
let _defaultValue_extraInitializers = [];
|
|
82
|
+
let _allValues_decorators;
|
|
83
|
+
let _allValues_initializers = [];
|
|
84
|
+
let _allValues_extraInitializers = [];
|
|
85
|
+
let _disabled_decorators;
|
|
86
|
+
let _disabled_initializers = [];
|
|
87
|
+
let _disabled_extraInitializers = [];
|
|
88
|
+
let _private_internalValues_decorators;
|
|
89
|
+
let _private_internalValues_initializers = [];
|
|
90
|
+
let _private_internalValues_extraInitializers = [];
|
|
91
|
+
let _private_internalValues_descriptor;
|
|
92
|
+
let __ctx_decorators;
|
|
93
|
+
let __ctx_initializers = [];
|
|
94
|
+
let __ctx_extraInitializers = [];
|
|
95
|
+
return class DuiCheckboxGroup extends _classSuper {
|
|
96
|
+
static {
|
|
97
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
98
|
+
_value_decorators = [property({ attribute: false })];
|
|
99
|
+
_defaultValue_decorators = [property({ attribute: false })];
|
|
100
|
+
_allValues_decorators = [property({ attribute: false })];
|
|
101
|
+
_disabled_decorators = [property({ type: Boolean, reflect: true })];
|
|
102
|
+
_private_internalValues_decorators = [state()];
|
|
103
|
+
__ctx_decorators = [provide({ context: checkboxGroupContext }), state()];
|
|
104
|
+
__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);
|
|
105
|
+
__esDecorate(this, null, _defaultValue_decorators, { kind: "accessor", name: "defaultValue", static: false, private: false, access: { has: obj => "defaultValue" in obj, get: obj => obj.defaultValue, set: (obj, value) => { obj.defaultValue = value; } }, metadata: _metadata }, _defaultValue_initializers, _defaultValue_extraInitializers);
|
|
106
|
+
__esDecorate(this, null, _allValues_decorators, { kind: "accessor", name: "allValues", static: false, private: false, access: { has: obj => "allValues" in obj, get: obj => obj.allValues, set: (obj, value) => { obj.allValues = value; } }, metadata: _metadata }, _allValues_initializers, _allValues_extraInitializers);
|
|
107
|
+
__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);
|
|
108
|
+
__esDecorate(this, _private_internalValues_descriptor = { get: __setFunctionName(function () { return this.#internalValues_accessor_storage; }, "#internalValues", "get"), set: __setFunctionName(function (value) { this.#internalValues_accessor_storage = value; }, "#internalValues", "set") }, _private_internalValues_decorators, { kind: "accessor", name: "#internalValues", static: false, private: true, access: { has: obj => #internalValues in obj, get: obj => obj.#internalValues, set: (obj, value) => { obj.#internalValues = value; } }, metadata: _metadata }, _private_internalValues_initializers, _private_internalValues_extraInitializers);
|
|
109
|
+
__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);
|
|
110
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
82
111
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
static tagName = "dui-checkbox-group";
|
|
113
|
+
static styles = [base, styles];
|
|
114
|
+
#value_accessor_storage = __runInitializers(this, _value_initializers, undefined);
|
|
115
|
+
/** Checked values (controlled). */
|
|
116
|
+
get value() { return this.#value_accessor_storage; }
|
|
117
|
+
set value(value) { this.#value_accessor_storage = value; }
|
|
118
|
+
#defaultValue_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _defaultValue_initializers, []));
|
|
119
|
+
/** Initial checked values for uncontrolled usage. */
|
|
120
|
+
get defaultValue() { return this.#defaultValue_accessor_storage; }
|
|
121
|
+
set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
|
|
122
|
+
#allValues_accessor_storage = (__runInitializers(this, _defaultValue_extraInitializers), __runInitializers(this, _allValues_initializers, []));
|
|
123
|
+
/**
|
|
124
|
+
* All possible checkbox values in the group.
|
|
125
|
+
* Required when using a parent (select-all) checkbox.
|
|
126
|
+
*/
|
|
127
|
+
get allValues() { return this.#allValues_accessor_storage; }
|
|
128
|
+
set allValues(value) { this.#allValues_accessor_storage = value; }
|
|
129
|
+
#disabled_accessor_storage = (__runInitializers(this, _allValues_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
130
|
+
/** Whether all checkboxes in the group are disabled. */
|
|
131
|
+
get disabled() { return this.#disabled_accessor_storage; }
|
|
132
|
+
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
133
|
+
#internalValues_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _private_internalValues_initializers, []));
|
|
134
|
+
get #internalValues() { return _private_internalValues_descriptor.get.call(this); }
|
|
135
|
+
set #internalValues(value) { return _private_internalValues_descriptor.set.call(this, value); }
|
|
136
|
+
#getCheckedValues = (__runInitializers(this, _private_internalValues_extraInitializers), () => this.value ?? this.#internalValues);
|
|
137
|
+
#toggle = (val) => {
|
|
138
|
+
const current = this.#getCheckedValues();
|
|
139
|
+
const next = current.includes(val)
|
|
140
|
+
? current.filter((v) => v !== val)
|
|
141
|
+
: [...current, val];
|
|
142
|
+
if (this.value === undefined) {
|
|
143
|
+
this.#internalValues = next;
|
|
144
|
+
}
|
|
145
|
+
this.dispatchEvent(valueChangeEvent(next));
|
|
95
146
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
147
|
+
#toggleAll = (checked) => {
|
|
148
|
+
const next = checked ? [...this.allValues] : [];
|
|
149
|
+
if (this.value === undefined) {
|
|
150
|
+
this.#internalValues = next;
|
|
151
|
+
}
|
|
152
|
+
this.dispatchEvent(valueChangeEvent(next));
|
|
153
|
+
};
|
|
154
|
+
#_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
|
|
155
|
+
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
156
|
+
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
157
|
+
#buildContext() {
|
|
158
|
+
return {
|
|
159
|
+
checkedValues: this.#getCheckedValues(),
|
|
160
|
+
allValues: this.allValues,
|
|
161
|
+
disabled: this.disabled,
|
|
162
|
+
toggle: this.#toggle,
|
|
163
|
+
toggleAll: this.#toggleAll,
|
|
164
|
+
};
|
|
101
165
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
166
|
+
connectedCallback() {
|
|
167
|
+
super.connectedCallback();
|
|
168
|
+
if (this.value === undefined && this.defaultValue.length > 0) {
|
|
169
|
+
this.#internalValues = [...this.defaultValue];
|
|
170
|
+
}
|
|
171
|
+
this._ctx = this.#buildContext();
|
|
172
|
+
}
|
|
173
|
+
willUpdate() {
|
|
174
|
+
this._ctx = this.#buildContext();
|
|
175
|
+
}
|
|
176
|
+
render() {
|
|
177
|
+
return html `
|
|
109
178
|
<div
|
|
110
179
|
part="root"
|
|
111
180
|
role="group"
|
|
@@ -114,21 +183,11 @@ export class DuiCheckboxGroup extends LitElement {
|
|
|
114
183
|
<slot></slot>
|
|
115
184
|
</div>
|
|
116
185
|
`;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
__decorate([
|
|
126
|
-
property({ attribute: false })
|
|
127
|
-
], DuiCheckboxGroup.prototype, "allValues", null);
|
|
128
|
-
__decorate([
|
|
129
|
-
property({ type: Boolean, reflect: true })
|
|
130
|
-
], DuiCheckboxGroup.prototype, "disabled", null);
|
|
131
|
-
__decorate([
|
|
132
|
-
provide({ context: checkboxGroupContext }),
|
|
133
|
-
state()
|
|
134
|
-
], DuiCheckboxGroup.prototype, "_ctx", null);
|
|
186
|
+
}
|
|
187
|
+
constructor() {
|
|
188
|
+
super(...arguments);
|
|
189
|
+
__runInitializers(this, __ctx_extraInitializers);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
})();
|
|
193
|
+
export { DuiCheckboxGroup };
|