@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.
Files changed (89) hide show
  1. package/_deprecated/center/center.js +2 -2
  2. package/_deprecated/hstack/hstack.js +79 -33
  3. package/_deprecated/page-inset/page-inset.js +104 -56
  4. package/_deprecated/vstack/vstack.js +61 -19
  5. package/accordion/accordion-item.js +217 -147
  6. package/accordion/accordion.js +214 -149
  7. package/alert-dialog/alert-dialog-close.js +2 -2
  8. package/alert-dialog/alert-dialog-popup.js +230 -166
  9. package/alert-dialog/alert-dialog-trigger.js +2 -2
  10. package/alert-dialog/alert-dialog.js +128 -73
  11. package/avatar/avatar.js +175 -115
  12. package/badge/badge.js +2 -2
  13. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  14. package/breadcrumb/breadcrumb-item.js +2 -2
  15. package/breadcrumb/breadcrumb-link.js +2 -2
  16. package/breadcrumb/breadcrumb-page.js +2 -2
  17. package/breadcrumb/breadcrumb-separator.js +2 -2
  18. package/breadcrumb/breadcrumb.js +2 -2
  19. package/button/button.js +109 -65
  20. package/calendar/calendar.js +368 -290
  21. package/checkbox/checkbox-group.js +146 -87
  22. package/checkbox/checkbox.js +232 -167
  23. package/collapsible/collapsible.js +210 -132
  24. package/combobox/combobox.js +318 -252
  25. package/command/command-empty.js +67 -25
  26. package/command/command-group.js +87 -47
  27. package/command/command-input.js +84 -44
  28. package/command/command-item.js +168 -124
  29. package/command/command-list.js +60 -18
  30. package/command/command-separator.js +2 -2
  31. package/command/command-shortcut.js +2 -2
  32. package/command/command.js +297 -232
  33. package/data-table/data-table.js +225 -153
  34. package/dialog/dialog-close.js +2 -2
  35. package/dialog/dialog-popup.js +247 -181
  36. package/dialog/dialog-trigger.js +2 -2
  37. package/dialog/dialog.js +128 -73
  38. package/dropzone/dropzone.js +310 -249
  39. package/icon/icon.js +2 -2
  40. package/input/input.js +204 -143
  41. package/link/link.js +62 -24
  42. package/menu/menu-item.js +66 -24
  43. package/menu/menu.js +189 -136
  44. package/menubar/menubar.js +142 -91
  45. package/number-field/number-field.js +277 -204
  46. package/package.json +2 -3
  47. package/popover/popover-close.js +2 -2
  48. package/popover/popover-popup.js +126 -76
  49. package/popover/popover-trigger.js +2 -2
  50. package/popover/popover.js +181 -120
  51. package/portal/portal.js +128 -86
  52. package/preview-card/preview-card-popup.js +114 -66
  53. package/preview-card/preview-card-trigger.js +2 -2
  54. package/preview-card/preview-card.js +211 -142
  55. package/progress/progress.js +91 -45
  56. package/radio/radio-group.js +153 -90
  57. package/radio/radio.js +137 -94
  58. package/scroll-area/scroll-area.js +382 -283
  59. package/select/select.js +260 -203
  60. package/separator/separator.js +60 -18
  61. package/sidebar/sidebar-content.js +2 -2
  62. package/sidebar/sidebar-footer.js +2 -2
  63. package/sidebar/sidebar-group-label.js +2 -2
  64. package/sidebar/sidebar-group.js +2 -2
  65. package/sidebar/sidebar-header.js +2 -2
  66. package/sidebar/sidebar-inset.js +2 -2
  67. package/sidebar/sidebar-menu-button.js +118 -74
  68. package/sidebar/sidebar-menu-item.js +2 -2
  69. package/sidebar/sidebar-menu.js +2 -2
  70. package/sidebar/sidebar-provider.js +202 -129
  71. package/sidebar/sidebar-separator.js +2 -2
  72. package/sidebar/sidebar-trigger.js +2 -2
  73. package/sidebar/sidebar.js +150 -85
  74. package/slider/slider.js +217 -159
  75. package/spinner/spinner.js +70 -28
  76. package/switch/switch.js +174 -111
  77. package/tabs/tab.js +89 -47
  78. package/tabs/tabs-indicator.js +2 -2
  79. package/tabs/tabs-list.js +92 -54
  80. package/tabs/tabs-panel.js +90 -44
  81. package/tabs/tabs.js +130 -71
  82. package/textarea/textarea.js +153 -95
  83. package/toggle/toggle-group.js +184 -125
  84. package/toggle/toggle.js +131 -76
  85. package/toolbar/toolbar.js +79 -33
  86. package/tooltip/tooltip-popup.js +108 -60
  87. package/tooltip/tooltip-trigger.js +93 -55
  88. package/tooltip/tooltip.js +225 -154
  89. package/trunc/trunc.js +78 -34
@@ -1,9 +1,41 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/radio */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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";
@@ -41,70 +73,117 @@ const styles = css `
41
73
  * @csspart root - The group container element.
42
74
  * @fires value-change - Fired when the selected value changes. Detail: { value: string }
43
75
  */
44
- export class DuiRadioGroup extends LitElement {
45
- static { this.tagName = "dui-radio-group"; }
46
- static { this.styles = [base, styles]; }
47
- #name_accessor_storage = undefined;
48
- /** The name attribute for form submission. */
49
- get name() { return this.#name_accessor_storage; }
50
- set name(value) { this.#name_accessor_storage = value; }
51
- #value_accessor_storage = undefined;
52
- /** Selected value (controlled). */
53
- get value() { return this.#value_accessor_storage; }
54
- set value(value) { this.#value_accessor_storage = value; }
55
- #defaultValue_accessor_storage = undefined;
56
- /** Initial selected value for uncontrolled usage. */
57
- get defaultValue() { return this.#defaultValue_accessor_storage; }
58
- set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
59
- #disabled_accessor_storage = false;
60
- /** Whether all radios in the group are disabled. */
61
- get disabled() { return this.#disabled_accessor_storage; }
62
- set disabled(value) { this.#disabled_accessor_storage = value; }
63
- #readOnly_accessor_storage = false;
64
- /** Whether all radios in the group are read-only. */
65
- get readOnly() { return this.#readOnly_accessor_storage; }
66
- set readOnly(value) { this.#readOnly_accessor_storage = value; }
67
- #required_accessor_storage = false;
68
- /** Whether a selection is required. */
69
- get required() { return this.#required_accessor_storage; }
70
- set required(value) { this.#required_accessor_storage = value; }
71
- #internalValue_accessor_storage = undefined;
72
- get #internalValue() { return this.#internalValue_accessor_storage; }
73
- set #internalValue(value) { this.#internalValue_accessor_storage = value; }
74
- #getSelectedValue = () => this.value ?? this.#internalValue;
75
- #select = (val) => {
76
- if (this.disabled || this.readOnly)
77
- return;
78
- if (this.value === undefined) {
79
- this.#internalValue = val;
76
+ let DuiRadioGroup = (() => {
77
+ let _classSuper = LitElement;
78
+ let _name_decorators;
79
+ let _name_initializers = [];
80
+ let _name_extraInitializers = [];
81
+ let _value_decorators;
82
+ let _value_initializers = [];
83
+ let _value_extraInitializers = [];
84
+ let _defaultValue_decorators;
85
+ let _defaultValue_initializers = [];
86
+ let _defaultValue_extraInitializers = [];
87
+ let _disabled_decorators;
88
+ let _disabled_initializers = [];
89
+ let _disabled_extraInitializers = [];
90
+ let _readOnly_decorators;
91
+ let _readOnly_initializers = [];
92
+ let _readOnly_extraInitializers = [];
93
+ let _required_decorators;
94
+ let _required_initializers = [];
95
+ let _required_extraInitializers = [];
96
+ let _private_internalValue_decorators;
97
+ let _private_internalValue_initializers = [];
98
+ let _private_internalValue_extraInitializers = [];
99
+ let _private_internalValue_descriptor;
100
+ let __ctx_decorators;
101
+ let __ctx_initializers = [];
102
+ let __ctx_extraInitializers = [];
103
+ return class DuiRadioGroup extends _classSuper {
104
+ static {
105
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
106
+ _name_decorators = [property()];
107
+ _value_decorators = [property()];
108
+ _defaultValue_decorators = [property({ attribute: "default-value" })];
109
+ _disabled_decorators = [property({ type: Boolean, reflect: true })];
110
+ _readOnly_decorators = [property({ type: Boolean, reflect: true, attribute: "read-only" })];
111
+ _required_decorators = [property({ type: Boolean, reflect: true })];
112
+ _private_internalValue_decorators = [state()];
113
+ __ctx_decorators = [provide({ context: radioGroupContext }), state()];
114
+ __esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
115
+ __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);
116
+ __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);
117
+ __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);
118
+ __esDecorate(this, null, _readOnly_decorators, { kind: "accessor", name: "readOnly", static: false, private: false, access: { has: obj => "readOnly" in obj, get: obj => obj.readOnly, set: (obj, value) => { obj.readOnly = value; } }, metadata: _metadata }, _readOnly_initializers, _readOnly_extraInitializers);
119
+ __esDecorate(this, null, _required_decorators, { kind: "accessor", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
120
+ __esDecorate(this, _private_internalValue_descriptor = { get: __setFunctionName(function () { return this.#internalValue_accessor_storage; }, "#internalValue", "get"), set: __setFunctionName(function (value) { this.#internalValue_accessor_storage = value; }, "#internalValue", "set") }, _private_internalValue_decorators, { kind: "accessor", name: "#internalValue", static: false, private: true, access: { has: obj => #internalValue in obj, get: obj => obj.#internalValue, set: (obj, value) => { obj.#internalValue = value; } }, metadata: _metadata }, _private_internalValue_initializers, _private_internalValue_extraInitializers);
121
+ __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);
122
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
80
123
  }
81
- this.dispatchEvent(valueChangeEvent({ value: val }));
82
- };
83
- #_ctx_accessor_storage = this.#buildContext();
84
- get _ctx() { return this.#_ctx_accessor_storage; }
85
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
86
- #buildContext() {
87
- return {
88
- name: this.name,
89
- value: this.#getSelectedValue(),
90
- disabled: this.disabled,
91
- readOnly: this.readOnly,
92
- required: this.required,
93
- select: this.#select,
124
+ static tagName = "dui-radio-group";
125
+ static styles = [base, styles];
126
+ #name_accessor_storage = __runInitializers(this, _name_initializers, undefined);
127
+ /** The name attribute for form submission. */
128
+ get name() { return this.#name_accessor_storage; }
129
+ set name(value) { this.#name_accessor_storage = value; }
130
+ #value_accessor_storage = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _value_initializers, undefined));
131
+ /** Selected value (controlled). */
132
+ get value() { return this.#value_accessor_storage; }
133
+ set value(value) { this.#value_accessor_storage = value; }
134
+ #defaultValue_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _defaultValue_initializers, undefined));
135
+ /** Initial selected value for uncontrolled usage. */
136
+ get defaultValue() { return this.#defaultValue_accessor_storage; }
137
+ set defaultValue(value) { this.#defaultValue_accessor_storage = value; }
138
+ #disabled_accessor_storage = (__runInitializers(this, _defaultValue_extraInitializers), __runInitializers(this, _disabled_initializers, false));
139
+ /** Whether all radios in the group are disabled. */
140
+ get disabled() { return this.#disabled_accessor_storage; }
141
+ set disabled(value) { this.#disabled_accessor_storage = value; }
142
+ #readOnly_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _readOnly_initializers, false));
143
+ /** Whether all radios in the group are read-only. */
144
+ get readOnly() { return this.#readOnly_accessor_storage; }
145
+ set readOnly(value) { this.#readOnly_accessor_storage = value; }
146
+ #required_accessor_storage = (__runInitializers(this, _readOnly_extraInitializers), __runInitializers(this, _required_initializers, false));
147
+ /** Whether a selection is required. */
148
+ get required() { return this.#required_accessor_storage; }
149
+ set required(value) { this.#required_accessor_storage = value; }
150
+ #internalValue_accessor_storage = (__runInitializers(this, _required_extraInitializers), __runInitializers(this, _private_internalValue_initializers, undefined));
151
+ get #internalValue() { return _private_internalValue_descriptor.get.call(this); }
152
+ set #internalValue(value) { return _private_internalValue_descriptor.set.call(this, value); }
153
+ #getSelectedValue = (__runInitializers(this, _private_internalValue_extraInitializers), () => this.value ?? this.#internalValue);
154
+ #select = (val) => {
155
+ if (this.disabled || this.readOnly)
156
+ return;
157
+ if (this.value === undefined) {
158
+ this.#internalValue = val;
159
+ }
160
+ this.dispatchEvent(valueChangeEvent({ value: val }));
94
161
  };
95
- }
96
- connectedCallback() {
97
- super.connectedCallback();
98
- if (this.value === undefined && this.defaultValue !== undefined) {
99
- this.#internalValue = this.defaultValue;
162
+ #_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
163
+ get _ctx() { return this.#_ctx_accessor_storage; }
164
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
165
+ #buildContext() {
166
+ return {
167
+ name: this.name,
168
+ value: this.#getSelectedValue(),
169
+ disabled: this.disabled,
170
+ readOnly: this.readOnly,
171
+ required: this.required,
172
+ select: this.#select,
173
+ };
100
174
  }
101
- this._ctx = this.#buildContext();
102
- }
103
- willUpdate() {
104
- this._ctx = this.#buildContext();
105
- }
106
- render() {
107
- return html `
175
+ connectedCallback() {
176
+ super.connectedCallback();
177
+ if (this.value === undefined && this.defaultValue !== undefined) {
178
+ this.#internalValue = this.defaultValue;
179
+ }
180
+ this._ctx = this.#buildContext();
181
+ }
182
+ willUpdate() {
183
+ this._ctx = this.#buildContext();
184
+ }
185
+ render() {
186
+ return html `
108
187
  <div
109
188
  part="root"
110
189
  role="radiogroup"
@@ -115,27 +194,11 @@ export class DuiRadioGroup extends LitElement {
115
194
  <slot></slot>
116
195
  </div>
117
196
  `;
118
- }
119
- }
120
- __decorate([
121
- property()
122
- ], DuiRadioGroup.prototype, "name", null);
123
- __decorate([
124
- property()
125
- ], DuiRadioGroup.prototype, "value", null);
126
- __decorate([
127
- property({ attribute: "default-value" })
128
- ], DuiRadioGroup.prototype, "defaultValue", null);
129
- __decorate([
130
- property({ type: Boolean, reflect: true })
131
- ], DuiRadioGroup.prototype, "disabled", null);
132
- __decorate([
133
- property({ type: Boolean, reflect: true, attribute: "read-only" })
134
- ], DuiRadioGroup.prototype, "readOnly", null);
135
- __decorate([
136
- property({ type: Boolean, reflect: true })
137
- ], DuiRadioGroup.prototype, "required", null);
138
- __decorate([
139
- provide({ context: radioGroupContext }),
140
- state()
141
- ], DuiRadioGroup.prototype, "_ctx", null);
197
+ }
198
+ constructor() {
199
+ super(...arguments);
200
+ __runInitializers(this, __ctx_extraInitializers);
201
+ }
202
+ };
203
+ })();
204
+ export { DuiRadioGroup };
package/radio/radio.js CHANGED
@@ -1,9 +1,37 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/radio */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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;
7
35
  };
8
36
  import { css, html, LitElement, nothing } from "lit";
9
37
  import { property, state } from "lit/decorators.js";
@@ -76,82 +104,108 @@ const styles = css `
76
104
  * @csspart indicator - The selected state indicator.
77
105
  * @cssprop --radio-size - Size of the radio button.
78
106
  */
79
- export class DuiRadio extends LitElement {
80
- static { this.tagName = "dui-radio"; }
81
- static { this.styles = [base, styles]; }
82
- #value_accessor_storage = "";
83
- /** The value attribute for this radio option. */
84
- get value() { return this.#value_accessor_storage; }
85
- set value(value) { this.#value_accessor_storage = value; }
86
- #disabled_accessor_storage = false;
87
- /** Whether the radio is disabled. */
88
- get disabled() { return this.#disabled_accessor_storage; }
89
- set disabled(value) { this.#disabled_accessor_storage = value; }
90
- #readOnly_accessor_storage = false;
91
- /** Whether the radio is read-only. */
92
- get readOnly() { return this.#readOnly_accessor_storage; }
93
- set readOnly(value) { this.#readOnly_accessor_storage = value; }
94
- #groupCtx = new ContextConsumer(this, {
95
- context: radioGroupContext,
96
- subscribe: true,
97
- });
98
- #_fieldCtx_accessor_storage;
99
- get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
100
- set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
101
- get #isChecked() {
102
- return this.#groupCtx.value?.value === this.value;
103
- }
104
- get #isDisabled() {
105
- return (this.disabled ||
106
- (this.#groupCtx.value?.disabled ?? false) ||
107
- (this._fieldCtx?.disabled ?? false));
108
- }
109
- get #isReadOnly() {
110
- return this.readOnly || (this.#groupCtx.value?.readOnly ?? false);
111
- }
112
- get #isRequired() {
113
- return this.#groupCtx.value?.required ?? false;
114
- }
115
- get #isInvalid() {
116
- return this._fieldCtx?.invalid ?? false;
117
- }
118
- connectedCallback() {
119
- super.connectedCallback();
120
- this.addEventListener("click", this.#handleHostClick);
121
- }
122
- disconnectedCallback() {
123
- super.disconnectedCallback();
124
- this.removeEventListener("click", this.#handleHostClick);
125
- }
126
- #handleHostClick = (e) => {
127
- if (e.target.closest("[part='root']"))
128
- return;
129
- this.#handleClick(e);
130
- };
131
- #handleClick = (_e) => {
132
- if (this.#isDisabled || this.#isReadOnly)
133
- return;
134
- const ctx = this.#groupCtx.value;
135
- if (ctx) {
136
- ctx.select(this.value);
137
- this._fieldCtx?.markDirty();
138
- this._fieldCtx?.markTouched();
107
+ let DuiRadio = (() => {
108
+ let _classSuper = LitElement;
109
+ let _value_decorators;
110
+ let _value_initializers = [];
111
+ let _value_extraInitializers = [];
112
+ let _disabled_decorators;
113
+ let _disabled_initializers = [];
114
+ let _disabled_extraInitializers = [];
115
+ let _readOnly_decorators;
116
+ let _readOnly_initializers = [];
117
+ let _readOnly_extraInitializers = [];
118
+ let __fieldCtx_decorators;
119
+ let __fieldCtx_initializers = [];
120
+ let __fieldCtx_extraInitializers = [];
121
+ return class DuiRadio extends _classSuper {
122
+ static {
123
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
124
+ _value_decorators = [property()];
125
+ _disabled_decorators = [property({ type: Boolean, reflect: true })];
126
+ _readOnly_decorators = [property({ type: Boolean, reflect: true, attribute: "read-only" })];
127
+ __fieldCtx_decorators = [consume({ context: fieldContext, subscribe: true }), state()];
128
+ __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);
129
+ __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);
130
+ __esDecorate(this, null, _readOnly_decorators, { kind: "accessor", name: "readOnly", static: false, private: false, access: { has: obj => "readOnly" in obj, get: obj => obj.readOnly, set: (obj, value) => { obj.readOnly = value; } }, metadata: _metadata }, _readOnly_initializers, _readOnly_extraInitializers);
131
+ __esDecorate(this, null, __fieldCtx_decorators, { kind: "accessor", name: "_fieldCtx", static: false, private: false, access: { has: obj => "_fieldCtx" in obj, get: obj => obj._fieldCtx, set: (obj, value) => { obj._fieldCtx = value; } }, metadata: _metadata }, __fieldCtx_initializers, __fieldCtx_extraInitializers);
132
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
139
133
  }
140
- };
141
- #handleKeyDown = (e) => {
142
- if (e.key === " ") {
143
- e.preventDefault();
144
- this.#handleClick(e);
134
+ static tagName = "dui-radio";
135
+ static styles = [base, styles];
136
+ #value_accessor_storage = __runInitializers(this, _value_initializers, "");
137
+ /** The value attribute for this radio option. */
138
+ get value() { return this.#value_accessor_storage; }
139
+ set value(value) { this.#value_accessor_storage = value; }
140
+ #disabled_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _disabled_initializers, false));
141
+ /** Whether the radio is disabled. */
142
+ get disabled() { return this.#disabled_accessor_storage; }
143
+ set disabled(value) { this.#disabled_accessor_storage = value; }
144
+ #readOnly_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _readOnly_initializers, false));
145
+ /** Whether the radio is read-only. */
146
+ get readOnly() { return this.#readOnly_accessor_storage; }
147
+ set readOnly(value) { this.#readOnly_accessor_storage = value; }
148
+ #groupCtx = (__runInitializers(this, _readOnly_extraInitializers), new ContextConsumer(this, {
149
+ context: radioGroupContext,
150
+ subscribe: true,
151
+ }));
152
+ #_fieldCtx_accessor_storage = __runInitializers(this, __fieldCtx_initializers, void 0);
153
+ get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
154
+ set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
155
+ get #isChecked() {
156
+ return this.#groupCtx.value?.value === this.value;
145
157
  }
146
- };
147
- render() {
148
- const isChecked = this.#isChecked;
149
- const isDisabled = this.#isDisabled;
150
- const isReadOnly = this.#isReadOnly;
151
- const isRequired = this.#isRequired;
152
- const isInvalid = this.#isInvalid;
153
- const controlId = this._fieldCtx?.controlId ?? "";
154
- return html `
158
+ get #isDisabled() {
159
+ return (this.disabled ||
160
+ (this.#groupCtx.value?.disabled ?? false) ||
161
+ (this._fieldCtx?.disabled ?? false));
162
+ }
163
+ get #isReadOnly() {
164
+ return this.readOnly || (this.#groupCtx.value?.readOnly ?? false);
165
+ }
166
+ get #isRequired() {
167
+ return this.#groupCtx.value?.required ?? false;
168
+ }
169
+ get #isInvalid() {
170
+ return this._fieldCtx?.invalid ?? false;
171
+ }
172
+ connectedCallback() {
173
+ super.connectedCallback();
174
+ this.addEventListener("click", this.#handleHostClick);
175
+ }
176
+ disconnectedCallback() {
177
+ super.disconnectedCallback();
178
+ this.removeEventListener("click", this.#handleHostClick);
179
+ }
180
+ #handleHostClick = (__runInitializers(this, __fieldCtx_extraInitializers), (e) => {
181
+ if (e.target.closest("[part='root']"))
182
+ return;
183
+ this.#handleClick(e);
184
+ });
185
+ #handleClick = (_e) => {
186
+ if (this.#isDisabled || this.#isReadOnly)
187
+ return;
188
+ const ctx = this.#groupCtx.value;
189
+ if (ctx) {
190
+ ctx.select(this.value);
191
+ this._fieldCtx?.markDirty();
192
+ this._fieldCtx?.markTouched();
193
+ }
194
+ };
195
+ #handleKeyDown = (e) => {
196
+ if (e.key === " ") {
197
+ e.preventDefault();
198
+ this.#handleClick(e);
199
+ }
200
+ };
201
+ render() {
202
+ const isChecked = this.#isChecked;
203
+ const isDisabled = this.#isDisabled;
204
+ const isReadOnly = this.#isReadOnly;
205
+ const isRequired = this.#isRequired;
206
+ const isInvalid = this.#isInvalid;
207
+ const controlId = this._fieldCtx?.controlId ?? "";
208
+ return html `
155
209
  <span
156
210
  part="root"
157
211
  role="radio"
@@ -192,18 +246,7 @@ export class DuiRadio extends LitElement {
192
246
  </span>
193
247
  <slot></slot>
194
248
  `;
195
- }
196
- }
197
- __decorate([
198
- property()
199
- ], DuiRadio.prototype, "value", null);
200
- __decorate([
201
- property({ type: Boolean, reflect: true })
202
- ], DuiRadio.prototype, "disabled", null);
203
- __decorate([
204
- property({ type: Boolean, reflect: true, attribute: "read-only" })
205
- ], DuiRadio.prototype, "readOnly", null);
206
- __decorate([
207
- consume({ context: fieldContext, subscribe: true }),
208
- state()
209
- ], DuiRadio.prototype, "_fieldCtx", null);
249
+ }
250
+ };
251
+ })();
252
+ export { DuiRadio };