@api-client/ui 0.5.47 → 0.5.48
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/build/src/elements/data-table/DataTable.d.ts +1 -1
- package/build/src/elements/data-table/DataTable.js +3 -3
- package/build/src/elements/data-table/DataTable.js.map +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.d.ts +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.d.ts.map +1 -1
- package/build/src/elements/file-system/internals/Breadcrumbs.js +3 -3
- package/build/src/elements/file-system/internals/Breadcrumbs.js.map +1 -1
- package/build/src/elements/navigation/internals/NavigationItem.d.ts +2 -0
- package/build/src/elements/navigation/internals/NavigationItem.d.ts.map +1 -1
- package/build/src/elements/navigation/internals/NavigationItem.js +4 -2
- package/build/src/elements/navigation/internals/NavigationItem.js.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.d.ts +26 -4
- package/build/src/elements/user/internals/UserAvatar.d.ts.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.js +125 -12
- package/build/src/elements/user/internals/UserAvatar.js.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.styles.d.ts.map +1 -1
- package/build/src/elements/user/internals/UserAvatar.styles.js +6 -11
- package/build/src/elements/user/internals/UserAvatar.styles.js.map +1 -1
- package/build/src/md/button/internals/base.d.ts +1 -1
- package/build/src/md/button/internals/base.d.ts.map +1 -1
- package/build/src/md/button/internals/base.js +2 -2
- package/build/src/md/button/internals/base.js.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.d.ts.map +1 -1
- package/build/src/md/checkbox/internals/CheckboxElement.js +2 -2
- package/build/src/md/checkbox/internals/CheckboxElement.js.map +1 -1
- package/build/src/md/focus-ring/internals/focus-ring.d.ts +87 -0
- package/build/src/md/focus-ring/internals/focus-ring.d.ts.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.js +206 -0
- package/build/src/md/focus-ring/internals/focus-ring.js.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.d.ts +3 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.d.ts.map +1 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.js +109 -0
- package/build/src/md/focus-ring/internals/focus-ring.styles.js.map +1 -0
- package/build/src/md/focus-ring/ui-focus-ring.d.ts +42 -0
- package/build/src/md/focus-ring/ui-focus-ring.d.ts.map +1 -0
- package/build/src/md/focus-ring/ui-focus-ring.js +58 -0
- package/build/src/md/focus-ring/ui-focus-ring.js.map +1 -0
- package/build/src/md/list/internals/ListItem.d.ts +3 -3
- package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.js +7 -6
- package/build/src/md/list/internals/ListItem.js.map +1 -1
- package/build/src/md/menu/internal/MenuItem.d.ts +0 -2
- package/build/src/md/menu/internal/MenuItem.d.ts.map +1 -1
- package/build/src/md/menu/internal/MenuItem.js +0 -2
- package/build/src/md/menu/internal/MenuItem.js.map +1 -1
- package/build/src/md/radio/internals/Radio.styles.js +1 -1
- package/build/src/md/radio/internals/Radio.styles.js.map +1 -1
- package/build/src/md/radio/internals/RadioElement.d.ts +1 -0
- package/build/src/md/radio/internals/RadioElement.d.ts.map +1 -1
- package/build/src/md/radio/internals/RadioElement.js +2 -0
- package/build/src/md/radio/internals/RadioElement.js.map +1 -1
- package/build/src/md/select/internals/Select.d.ts +1 -1
- package/build/src/md/select/internals/Select.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.js +2 -2
- package/build/src/md/select/internals/Select.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.d.ts +1 -0
- package/build/src/md/tabs/internals/Tab.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.js +3 -2
- package/build/src/md/tabs/internals/Tab.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.js +4 -4
- package/build/src/md/tabs/internals/Tabs.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/src/elements/data-table/DataTable.ts +3 -3
- package/src/elements/file-system/internals/Breadcrumbs.ts +3 -3
- package/src/elements/navigation/internals/NavigationItem.ts +4 -2
- package/src/elements/user/internals/UserAvatar.styles.ts +6 -11
- package/src/elements/user/internals/UserAvatar.ts +115 -8
- package/src/md/button/internals/base.ts +2 -2
- package/src/md/checkbox/internals/CheckboxElement.ts +2 -2
- package/src/md/focus-ring/internals/focus-ring.styles.ts +109 -0
- package/src/md/focus-ring/internals/focus-ring.ts +184 -0
- package/src/md/focus-ring/ui-focus-ring.ts +46 -0
- package/src/md/list/internals/ListItem.ts +5 -5
- package/src/md/menu/internal/MenuItem.ts +0 -2
- package/src/md/radio/internals/Radio.styles.ts +1 -1
- package/src/md/radio/internals/RadioElement.ts +2 -0
- package/src/md/select/internals/Select.ts +2 -2
- package/src/md/tabs/internals/Tab.ts +4 -2
- package/src/md/tabs/internals/Tabs.ts +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.d.ts","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAGrD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IACjD;;;OAGG;IACyB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAA;IAErE;;;;OAIG;IACyB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAEpE;;;;OAIG;IACyB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IAE5D;;;;OAIG;IACyC,QAAQ,CAAC,MAAM,UAAQ;IAEnE;;OAEG;IACyC,QAAQ,CAAC,OAAO,UAAQ;IAEpE,OAAO,CAAC,eAAe,CAAC,CAAiB;;IAOhC,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;cAKlB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAM5E;;OAEG;IACH,OAAO,CAAC,YAAY;IAkBpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAalB;;OAEG;IACH,OAAO,CAAC,WAAW,CAKlB;IAED;;OAEG;IACH,OAAO,CAAC,UAAU,CAEjB;IAED;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAExB;IAED;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAG1B;cAEkB,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;CAa1E"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
let UiFocusRing = (() => {
|
|
5
|
+
let _classSuper = LitElement;
|
|
6
|
+
let _control_decorators;
|
|
7
|
+
let _control_initializers = [];
|
|
8
|
+
let _control_extraInitializers = [];
|
|
9
|
+
let _attach_decorators;
|
|
10
|
+
let _attach_initializers = [];
|
|
11
|
+
let _attach_extraInitializers = [];
|
|
12
|
+
let _for_decorators;
|
|
13
|
+
let _for_initializers = [];
|
|
14
|
+
let _for_extraInitializers = [];
|
|
15
|
+
let _inward_decorators;
|
|
16
|
+
let _inward_initializers = [];
|
|
17
|
+
let _inward_extraInitializers = [];
|
|
18
|
+
let _visible_decorators;
|
|
19
|
+
let _visible_initializers = [];
|
|
20
|
+
let _visible_extraInitializers = [];
|
|
21
|
+
return class UiFocusRing extends _classSuper {
|
|
22
|
+
static {
|
|
23
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
24
|
+
_control_decorators = [property({ type: Object })];
|
|
25
|
+
_attach_decorators = [property({ type: Object })];
|
|
26
|
+
_for_decorators = [property({ type: String })];
|
|
27
|
+
_inward_decorators = [property({ type: Boolean, reflect: true })];
|
|
28
|
+
_visible_decorators = [property({ type: Boolean, reflect: true })];
|
|
29
|
+
__esDecorate(this, null, _control_decorators, { kind: "accessor", name: "control", static: false, private: false, access: { has: obj => "control" in obj, get: obj => obj.control, set: (obj, value) => { obj.control = value; } }, metadata: _metadata }, _control_initializers, _control_extraInitializers);
|
|
30
|
+
__esDecorate(this, null, _attach_decorators, { kind: "accessor", name: "attach", static: false, private: false, access: { has: obj => "attach" in obj, get: obj => obj.attach, set: (obj, value) => { obj.attach = value; } }, metadata: _metadata }, _attach_initializers, _attach_extraInitializers);
|
|
31
|
+
__esDecorate(this, null, _for_decorators, { kind: "accessor", name: "for", static: false, private: false, access: { has: obj => "for" in obj, get: obj => obj.for, set: (obj, value) => { obj.for = value; } }, metadata: _metadata }, _for_initializers, _for_extraInitializers);
|
|
32
|
+
__esDecorate(this, null, _inward_decorators, { kind: "accessor", name: "inward", static: false, private: false, access: { has: obj => "inward" in obj, get: obj => obj.inward, set: (obj, value) => { obj.inward = value; } }, metadata: _metadata }, _inward_initializers, _inward_extraInitializers);
|
|
33
|
+
__esDecorate(this, null, _visible_decorators, { kind: "accessor", name: "visible", static: false, private: false, access: { has: obj => "visible" in obj, get: obj => obj.visible, set: (obj, value) => { obj.visible = value; } }, metadata: _metadata }, _visible_initializers, _visible_extraInitializers);
|
|
34
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
35
|
+
}
|
|
36
|
+
#control_accessor_storage = __runInitializers(this, _control_initializers, void 0);
|
|
37
|
+
/**
|
|
38
|
+
* The control element that this focus ring is associated with.
|
|
39
|
+
* When the control gains or loses focus, the focus ring will show or hide.
|
|
40
|
+
*/
|
|
41
|
+
get control() { return this.#control_accessor_storage; }
|
|
42
|
+
set control(value) { this.#control_accessor_storage = value; }
|
|
43
|
+
#attach_accessor_storage = (__runInitializers(this, _control_extraInitializers), __runInitializers(this, _attach_initializers, void 0));
|
|
44
|
+
/**
|
|
45
|
+
* An element to attach the focus ring to. Defaults to the parent element.
|
|
46
|
+
* This is typically used when the focus ring should be positioned relative
|
|
47
|
+
* to a different element than the control.
|
|
48
|
+
*/
|
|
49
|
+
get attach() { return this.#attach_accessor_storage; }
|
|
50
|
+
set attach(value) { this.#attach_accessor_storage = value; }
|
|
51
|
+
#for_accessor_storage = (__runInitializers(this, _attach_extraInitializers), __runInitializers(this, _for_initializers, void 0));
|
|
52
|
+
/**
|
|
53
|
+
* An ID of an element that this focus ring is for.
|
|
54
|
+
* Alternative to setting the `control` property directly.
|
|
55
|
+
* @attribute
|
|
56
|
+
*/
|
|
57
|
+
get for() { return this.#for_accessor_storage; }
|
|
58
|
+
set for(value) { this.#for_accessor_storage = value; }
|
|
59
|
+
#inward_accessor_storage = (__runInitializers(this, _for_extraInitializers), __runInitializers(this, _inward_initializers, false
|
|
60
|
+
/**
|
|
61
|
+
* The internal visibility state of the focus ring.
|
|
62
|
+
*/
|
|
63
|
+
));
|
|
64
|
+
/**
|
|
65
|
+
* Whether the focus ring should render inward instead of outward.
|
|
66
|
+
* When true, the focus ring will be positioned inside the control bounds.
|
|
67
|
+
* @attribute
|
|
68
|
+
*/
|
|
69
|
+
get inward() { return this.#inward_accessor_storage; }
|
|
70
|
+
set inward(value) { this.#inward_accessor_storage = value; }
|
|
71
|
+
#visible_accessor_storage = (__runInitializers(this, _inward_extraInitializers), __runInitializers(this, _visible_initializers, false));
|
|
72
|
+
/**
|
|
73
|
+
* The internal visibility state of the focus ring.
|
|
74
|
+
*/
|
|
75
|
+
get visible() { return this.#visible_accessor_storage; }
|
|
76
|
+
set visible(value) { this.#visible_accessor_storage = value; }
|
|
77
|
+
abortController = __runInitializers(this, _visible_extraInitializers);
|
|
78
|
+
constructor() {
|
|
79
|
+
super();
|
|
80
|
+
this.addEventListener('visibility-changed', this.onVisibilityChanged);
|
|
81
|
+
}
|
|
82
|
+
connectedCallback() {
|
|
83
|
+
super.connectedCallback();
|
|
84
|
+
this.setupControl();
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
super.disconnectedCallback();
|
|
88
|
+
this.cleanupListeners();
|
|
89
|
+
}
|
|
90
|
+
willUpdate(changedProperties) {
|
|
91
|
+
if (changedProperties.has('for') || changedProperties.has('control')) {
|
|
92
|
+
this.setupControl();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sets up the control element and event listeners.
|
|
97
|
+
*/
|
|
98
|
+
setupControl() {
|
|
99
|
+
this.cleanupListeners();
|
|
100
|
+
const control = this.getControl();
|
|
101
|
+
if (!control)
|
|
102
|
+
return;
|
|
103
|
+
this.abortController = new AbortController();
|
|
104
|
+
const { signal } = this.abortController;
|
|
105
|
+
// Listen for focus and blur events
|
|
106
|
+
control.addEventListener('focus', this.handleFocus, { signal });
|
|
107
|
+
control.addEventListener('blur', this.handleBlur, { signal });
|
|
108
|
+
control.addEventListener('pointerdown', this.handlePointerDown, { signal });
|
|
109
|
+
// Set initial state
|
|
110
|
+
this.visible = control.matches(':focus-visible');
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Cleans up event listeners.
|
|
114
|
+
*/
|
|
115
|
+
cleanupListeners() {
|
|
116
|
+
this.abortController?.abort();
|
|
117
|
+
this.abortController = undefined;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Gets the control element from either the `control` property,
|
|
121
|
+
* the `for` attribute, or defaults to the parent element.
|
|
122
|
+
*/
|
|
123
|
+
getControl() {
|
|
124
|
+
if (this.control) {
|
|
125
|
+
return this.control;
|
|
126
|
+
}
|
|
127
|
+
if (this.for) {
|
|
128
|
+
const root = this.getRootNode();
|
|
129
|
+
return root.getElementById(this.for);
|
|
130
|
+
}
|
|
131
|
+
return this.parentElement;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Handles focus events from the control element.
|
|
135
|
+
*/
|
|
136
|
+
handleFocus = (event) => {
|
|
137
|
+
// Only show focus ring for keyboard navigation
|
|
138
|
+
if (this.shouldShowFocusRing(event)) {
|
|
139
|
+
this.show();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Handles blur events from the control element.
|
|
144
|
+
*/
|
|
145
|
+
handleBlur = () => {
|
|
146
|
+
this.hide();
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Handles pointer down events to hide focus ring during mouse interaction.
|
|
150
|
+
*/
|
|
151
|
+
handlePointerDown = () => {
|
|
152
|
+
this.hide();
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Determines if the focus ring should be shown based on the focus event.
|
|
156
|
+
* The focus ring should only show for keyboard navigation, not mouse clicks.
|
|
157
|
+
*/
|
|
158
|
+
shouldShowFocusRing(event) {
|
|
159
|
+
const control = event.target;
|
|
160
|
+
return control?.matches(':focus-visible') ?? false;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Shows the focus ring.
|
|
164
|
+
*/
|
|
165
|
+
show() {
|
|
166
|
+
if (this.visible)
|
|
167
|
+
return;
|
|
168
|
+
this.visible = true;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Hides the focus ring.
|
|
172
|
+
*/
|
|
173
|
+
hide() {
|
|
174
|
+
if (!this.visible)
|
|
175
|
+
return;
|
|
176
|
+
this.visible = false;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Handles the visibility changed event.
|
|
180
|
+
*/
|
|
181
|
+
onVisibilityChanged = (event) => {
|
|
182
|
+
// Stop propagation to prevent multiple focus rings from interfering
|
|
183
|
+
event.stopPropagation();
|
|
184
|
+
};
|
|
185
|
+
updated(changedProperties) {
|
|
186
|
+
super.updated(changedProperties);
|
|
187
|
+
if (changedProperties.has('visible')) {
|
|
188
|
+
this.dispatchEvent(new CustomEvent('visibility-changed', {
|
|
189
|
+
detail: { visible: this.visible },
|
|
190
|
+
bubbles: false,
|
|
191
|
+
composed: true,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
})();
|
|
197
|
+
/**
|
|
198
|
+
* A focus ring component that provides a visible focus indicator.
|
|
199
|
+
* This component automatically manages the visibility of the focus ring
|
|
200
|
+
* based on the focus state of its control element.
|
|
201
|
+
*
|
|
202
|
+
* @fires visibility-changed - Dispatched when the focus ring visibility changes.
|
|
203
|
+
* - `detail`: An object with a `visible` property (boolean).
|
|
204
|
+
*/
|
|
205
|
+
export default UiFocusRing;
|
|
206
|
+
//# sourceMappingURL=focus-ring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;;sBAUH,UAAU;;;;;;;;;;;;;;;;iBAA9B,WAAY,SAAQ,WAAU;;;mCAKhD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+BAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAO1B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mCAK1C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YA1Bf,0KAAS,OAAO,6BAAP,OAAO,yFAAyB;YAOzC,uKAAS,MAAM,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 'lit/decorators.js'\n\n/**\n * A focus ring component that provides a visible focus indicator.\n * This component automatically manages the visibility of the focus ring\n * based on the focus state of its control element.\n *\n * @fires visibility-changed - Dispatched when the focus ring visibility changes.\n * - `detail`: An object with a `visible` property (boolean).\n */\nexport default class UiFocusRing extends LitElement {\n /**\n * The control element that this focus ring is associated with.\n * When the control gains or loses focus, the focus ring will show or hide.\n */\n @property({ type: Object }) accessor control: HTMLElement | undefined\n\n /**\n * An element to attach the focus ring to. Defaults to the parent element.\n * This is typically used when the focus ring should be positioned relative\n * to a different element than the control.\n */\n @property({ type: Object }) accessor attach: HTMLElement | undefined\n\n /**\n * An ID of an element that this focus ring is for.\n * Alternative to setting the `control` property directly.\n * @attribute\n */\n @property({ type: String }) accessor for: string | undefined\n\n /**\n * Whether the focus ring should render inward instead of outward.\n * When true, the focus ring will be positioned inside the control bounds.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor inward = false\n\n /**\n * The internal visibility state of the focus ring.\n */\n @property({ type: Boolean, reflect: true }) accessor visible = false\n\n private abortController?: AbortController\n\n constructor() {\n super()\n this.addEventListener('visibility-changed', this.onVisibilityChanged as EventListener)\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setupControl()\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback()\n this.cleanupListeners()\n }\n\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('for') || changedProperties.has('control')) {\n this.setupControl()\n }\n }\n\n /**\n * Sets up the control element and event listeners.\n */\n private setupControl(): void {\n this.cleanupListeners()\n\n const control = this.getControl()\n if (!control) return\n\n this.abortController = new AbortController()\n const { signal } = this.abortController\n\n // Listen for focus and blur events\n control.addEventListener('focus', this.handleFocus, { signal })\n control.addEventListener('blur', this.handleBlur, { signal })\n control.addEventListener('pointerdown', this.handlePointerDown, { signal })\n\n // Set initial state\n this.visible = control.matches(':focus-visible')\n }\n\n /**\n * Cleans up event listeners.\n */\n private cleanupListeners(): void {\n this.abortController?.abort()\n this.abortController = undefined\n }\n\n /**\n * Gets the control element from either the `control` property,\n * the `for` attribute, or defaults to the parent element.\n */\n private getControl(): HTMLElement | null {\n if (this.control) {\n return this.control\n }\n\n if (this.for) {\n const root = this.getRootNode() as Document | ShadowRoot\n return root.getElementById(this.for)\n }\n\n return this.parentElement\n }\n\n /**\n * Handles focus events from the control element.\n */\n private handleFocus = (event: FocusEvent): void => {\n // Only show focus ring for keyboard navigation\n if (this.shouldShowFocusRing(event)) {\n this.show()\n }\n }\n\n /**\n * Handles blur events from the control element.\n */\n private handleBlur = (): void => {\n this.hide()\n }\n\n /**\n * Handles pointer down events to hide focus ring during mouse interaction.\n */\n private handlePointerDown = (): void => {\n this.hide()\n }\n\n /**\n * Determines if the focus ring should be shown based on the focus event.\n * The focus ring should only show for keyboard navigation, not mouse clicks.\n */\n private shouldShowFocusRing(event: FocusEvent): boolean {\n const control = event.target as HTMLElement\n return control?.matches(':focus-visible') ?? false\n }\n\n /**\n * Shows the focus ring.\n */\n show(): void {\n if (this.visible) return\n this.visible = true\n }\n\n /**\n * Hides the focus ring.\n */\n hide(): void {\n if (!this.visible) return\n this.visible = false\n }\n\n /**\n * Handles the visibility changed event.\n */\n private onVisibilityChanged = (event: Event): void => {\n // Stop propagation to prevent multiple focus rings from interfering\n event.stopPropagation()\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('visible')) {\n this.dispatchEvent(\n new CustomEvent('visibility-changed', {\n detail: { visible: this.visible },\n bubbles: false,\n composed: true,\n })\n )\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.styles.ts"],"names":[],"mappings":";AAEA,wBA0GC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css `
|
|
3
|
+
:host {
|
|
4
|
+
animation-delay: 0s, calc(var(--md-focus-ring-duration, 600ms) * 0.25);
|
|
5
|
+
animation-duration:
|
|
6
|
+
calc(var(--md-focus-ring-duration, 600ms) * 0.25), calc(var(--md-focus-ring-duration, 600ms) * 0.75);
|
|
7
|
+
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
color: var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));
|
|
10
|
+
display: none;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([visible]) {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host(:not([inward])) {
|
|
20
|
+
animation-name: outward-grow, outward-shrink;
|
|
21
|
+
border-end-end-radius: calc(
|
|
22
|
+
var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
23
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
24
|
+
);
|
|
25
|
+
border-end-start-radius: calc(
|
|
26
|
+
var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
27
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
28
|
+
);
|
|
29
|
+
border-start-end-radius: calc(
|
|
30
|
+
var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
31
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
32
|
+
);
|
|
33
|
+
border-start-start-radius: calc(
|
|
34
|
+
var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +
|
|
35
|
+
var(--md-focus-ring-outward-offset, 2px)
|
|
36
|
+
);
|
|
37
|
+
inset: calc(-1 * var(--md-focus-ring-outward-offset, 2px));
|
|
38
|
+
outline: var(--md-focus-ring-width, 3px) solid currentColor;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([inward]) {
|
|
42
|
+
animation-name: inward-grow, inward-shrink;
|
|
43
|
+
border-end-end-radius: calc(
|
|
44
|
+
var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
45
|
+
--md-focus-ring-inward-offset,
|
|
46
|
+
0px
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
border-end-start-radius: calc(
|
|
50
|
+
var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
51
|
+
--md-focus-ring-inward-offset,
|
|
52
|
+
0px
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
border-start-end-radius: calc(
|
|
56
|
+
var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
57
|
+
--md-focus-ring-inward-offset,
|
|
58
|
+
0px
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
border-start-start-radius: calc(
|
|
62
|
+
var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(
|
|
63
|
+
--md-focus-ring-inward-offset,
|
|
64
|
+
0px
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
border: var(--md-focus-ring-width, 3px) solid currentColor;
|
|
68
|
+
inset: var(--md-focus-ring-inward-offset, 0px);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes outward-grow {
|
|
72
|
+
from {
|
|
73
|
+
outline-width: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
to {
|
|
77
|
+
outline-width: var(--md-focus-ring-active-width, 8px);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@keyframes outward-shrink {
|
|
82
|
+
from {
|
|
83
|
+
outline-width: var(--md-focus-ring-active-width, 8px);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes inward-grow {
|
|
88
|
+
from {
|
|
89
|
+
border-width: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
to {
|
|
93
|
+
border-width: var(--md-focus-ring-active-width, 8px);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes inward-shrink {
|
|
98
|
+
from {
|
|
99
|
+
border-width: var(--md-focus-ring-active-width, 8px);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (prefers-reduced-motion) {
|
|
104
|
+
:host {
|
|
105
|
+
animation: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
//# sourceMappingURL=focus-ring.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-ring.styles.js","sourceRoot":"","sources":["../../../../../src/md/focus-ring/internals/focus-ring.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n animation-delay: 0s, calc(var(--md-focus-ring-duration, 600ms) * 0.25);\n animation-duration:\n calc(var(--md-focus-ring-duration, 600ms) * 0.25), calc(var(--md-focus-ring-duration, 600ms) * 0.75);\n animation-timing-function: cubic-bezier(0.2, 0, 0, 1);\n box-sizing: border-box;\n color: var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));\n display: none;\n pointer-events: none;\n position: absolute;\n }\n\n :host([visible]) {\n display: flex;\n }\n\n :host(:not([inward])) {\n animation-name: outward-grow, outward-shrink;\n border-end-end-radius: calc(\n var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-end-start-radius: calc(\n var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-start-end-radius: calc(\n var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n border-start-start-radius: calc(\n var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) +\n var(--md-focus-ring-outward-offset, 2px)\n );\n inset: calc(-1 * var(--md-focus-ring-outward-offset, 2px));\n outline: var(--md-focus-ring-width, 3px) solid currentColor;\n }\n\n :host([inward]) {\n animation-name: inward-grow, inward-shrink;\n border-end-end-radius: calc(\n var(--md-focus-ring-shape-end-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-end-start-radius: calc(\n var(--md-focus-ring-shape-end-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-start-end-radius: calc(\n var(--md-focus-ring-shape-start-end, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border-start-start-radius: calc(\n var(--md-focus-ring-shape-start-start, var(--md-focus-ring-shape, var(--md-sys-shape-corner-full, 9999px))) - var(\n --md-focus-ring-inward-offset,\n 0px\n )\n );\n border: var(--md-focus-ring-width, 3px) solid currentColor;\n inset: var(--md-focus-ring-inward-offset, 0px);\n }\n\n @keyframes outward-grow {\n from {\n outline-width: 0;\n }\n\n to {\n outline-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes outward-shrink {\n from {\n outline-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes inward-grow {\n from {\n border-width: 0;\n }\n\n to {\n border-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @keyframes inward-shrink {\n from {\n border-width: var(--md-focus-ring-active-width, 8px);\n }\n }\n\n @media (prefers-reduced-motion) {\n :host {\n animation: none;\n }\n }\n`\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CSSResultOrNative } from 'lit';
|
|
2
|
+
import Element from './internals/focus-ring.js';
|
|
3
|
+
/**
|
|
4
|
+
* A focus ring component that provides a visible focus indicator.
|
|
5
|
+
*
|
|
6
|
+
* This component replaces the Material Design `md-focus-ring` component
|
|
7
|
+
* and provides the same functionality with customizable styling.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <!-- Basic usage -->
|
|
12
|
+
* <ui-focus-ring></ui-focus-ring>
|
|
13
|
+
*
|
|
14
|
+
* <!-- With specific control -->
|
|
15
|
+
* <ui-focus-ring .control="${buttonElement}"></ui-focus-ring>
|
|
16
|
+
*
|
|
17
|
+
* <!-- Using for attribute -->
|
|
18
|
+
* <ui-focus-ring for="my-button"></ui-focus-ring>
|
|
19
|
+
*
|
|
20
|
+
* <!-- Inward focus ring -->
|
|
21
|
+
* <ui-focus-ring inward></ui-focus-ring>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @cssprop --ui-focus-ring-color - The color of the focus ring border.
|
|
25
|
+
* @cssprop --ui-focus-ring-width - The width of the focus ring border.
|
|
26
|
+
* @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).
|
|
27
|
+
* @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.
|
|
28
|
+
* @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.
|
|
29
|
+
* @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.
|
|
30
|
+
* @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.
|
|
31
|
+
*
|
|
32
|
+
* @csspart focus-ring - The focus ring element.
|
|
33
|
+
*/
|
|
34
|
+
export declare class UiFocusRingElement extends Element {
|
|
35
|
+
static styles: CSSResultOrNative[];
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'ui-focus-ring': Element;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=ui-focus-ring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-focus-ring.d.ts","sourceRoot":"","sources":["../../../../src/md/focus-ring/ui-focus-ring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,kBAAmB,SAAQ,OAAO;IAC7C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,OAAO,CAAA;KACzB;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import Element from './internals/focus-ring.js';
|
|
4
|
+
import styles from './internals/focus-ring.styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* A focus ring component that provides a visible focus indicator.
|
|
7
|
+
*
|
|
8
|
+
* This component replaces the Material Design `md-focus-ring` component
|
|
9
|
+
* and provides the same functionality with customizable styling.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <!-- Basic usage -->
|
|
14
|
+
* <ui-focus-ring></ui-focus-ring>
|
|
15
|
+
*
|
|
16
|
+
* <!-- With specific control -->
|
|
17
|
+
* <ui-focus-ring .control="${buttonElement}"></ui-focus-ring>
|
|
18
|
+
*
|
|
19
|
+
* <!-- Using for attribute -->
|
|
20
|
+
* <ui-focus-ring for="my-button"></ui-focus-ring>
|
|
21
|
+
*
|
|
22
|
+
* <!-- Inward focus ring -->
|
|
23
|
+
* <ui-focus-ring inward></ui-focus-ring>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @cssprop --ui-focus-ring-color - The color of the focus ring border.
|
|
27
|
+
* @cssprop --ui-focus-ring-width - The width of the focus ring border.
|
|
28
|
+
* @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).
|
|
29
|
+
* @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.
|
|
30
|
+
* @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.
|
|
31
|
+
* @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.
|
|
32
|
+
* @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.
|
|
33
|
+
*
|
|
34
|
+
* @csspart focus-ring - The focus ring element.
|
|
35
|
+
*/
|
|
36
|
+
let UiFocusRingElement = (() => {
|
|
37
|
+
let _classDecorators = [customElement('ui-focus-ring')];
|
|
38
|
+
let _classDescriptor;
|
|
39
|
+
let _classExtraInitializers = [];
|
|
40
|
+
let _classThis;
|
|
41
|
+
let _classSuper = Element;
|
|
42
|
+
var UiFocusRingElement = class extends _classSuper {
|
|
43
|
+
static { _classThis = this; }
|
|
44
|
+
static {
|
|
45
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
46
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
47
|
+
UiFocusRingElement = _classThis = _classDescriptor.value;
|
|
48
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
49
|
+
}
|
|
50
|
+
static styles = [styles];
|
|
51
|
+
static {
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return UiFocusRingElement = _classThis;
|
|
56
|
+
})();
|
|
57
|
+
export { UiFocusRingElement };
|
|
58
|
+
//# sourceMappingURL=ui-focus-ring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-focus-ring.js","sourceRoot":"","sources":["../../../../src/md/focus-ring/ui-focus-ring.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,2BAA2B,CAAA;AAC/C,OAAO,MAAM,MAAM,kCAAkC,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;IAEU,kBAAkB;4BAD9B,aAAa,CAAC,eAAe,CAAC;;;;sBACS,OAAO;kCAAf,SAAQ,WAAO;;;;YAA/C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAkB;;;;;SAAlB,kBAAkB","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/focus-ring.js'\nimport styles from './internals/focus-ring.styles.js'\n\n/**\n * A focus ring component that provides a visible focus indicator.\n *\n * This component replaces the Material Design `md-focus-ring` component\n * and provides the same functionality with customizable styling.\n *\n * @example\n * ```html\n * <!-- Basic usage -->\n * <ui-focus-ring></ui-focus-ring>\n *\n * <!-- With specific control -->\n * <ui-focus-ring .control=\"${buttonElement}\"></ui-focus-ring>\n *\n * <!-- Using for attribute -->\n * <ui-focus-ring for=\"my-button\"></ui-focus-ring>\n *\n * <!-- Inward focus ring -->\n * <ui-focus-ring inward></ui-focus-ring>\n * ```\n *\n * @cssprop --ui-focus-ring-color - The color of the focus ring border.\n * @cssprop --ui-focus-ring-width - The width of the focus ring border.\n * @cssprop --ui-focus-ring-style - The style of the focus ring border (solid, dashed, etc.).\n * @cssprop --ui-focus-ring-shape-start-start - The start-start corner radius.\n * @cssprop --ui-focus-ring-shape-start-end - The start-end corner radius.\n * @cssprop --ui-focus-ring-shape-end-end - The end-end corner radius.\n * @cssprop --ui-focus-ring-shape-end-start - The end-start corner radius.\n *\n * @csspart focus-ring - The focus ring element.\n */\n@customElement('ui-focus-ring')\nexport class UiFocusRingElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-focus-ring': Element\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { ClassInfo } from 'lit/directives/class-map.js';
|
|
|
3
3
|
import { UiElement } from '../../UiElement.js';
|
|
4
4
|
import { BeginPressConfig, EndPressConfig } from '../../../controllers/ActionController.js';
|
|
5
5
|
import UiRipple from '../../ripple/internals/ripple.js';
|
|
6
|
-
import '
|
|
6
|
+
import '../../focus-ring/ui-focus-ring.js';
|
|
7
7
|
import '../../ripple/ui-ripple.js';
|
|
8
8
|
export declare enum ListItemLines {
|
|
9
9
|
one = "one",
|
|
@@ -37,7 +37,7 @@ export default class UiListItem extends UiElement {
|
|
|
37
37
|
*/
|
|
38
38
|
set lines(value: ListItemLines);
|
|
39
39
|
/**
|
|
40
|
-
* Whether the
|
|
40
|
+
* Whether the list item is disabled. The user can't interact with the list item when `true`.
|
|
41
41
|
* @attribute
|
|
42
42
|
*/
|
|
43
43
|
accessor disabled: boolean;
|
|
@@ -90,7 +90,7 @@ export default class UiListItem extends UiElement {
|
|
|
90
90
|
protected handleEndTextSlotChange(event: Event): void;
|
|
91
91
|
getSurfaceClasses(): ClassInfo;
|
|
92
92
|
protected render(): TemplateResult;
|
|
93
|
-
protected renderRipple
|
|
93
|
+
protected renderRipple(): TemplateResult;
|
|
94
94
|
protected renderFocusRing(): TemplateResult;
|
|
95
95
|
protected getStartClasses(): ClassInfo;
|
|
96
96
|
protected renderStart(): TemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../../src/md/list/internals/ListItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAE1D,OAAO,EAAY,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAC3F,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AAGvD,OAAO,
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../../src/md/list/internals/ListItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAE1D,OAAO,EAAY,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAC3F,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AAGvD,OAAO,mCAAmC,CAAA;AAC1C,OAAO,2BAA2B,CAAA;AAElC,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS;;IAC3B,QAAQ,CAAC,MAAM,EAAG,QAAQ,CAAA;IAI9C,IAAI,KAAK,IAAI,aAAa,CAKzB;IAED;;;;OAIG;IACH,IACI,KAAK,CAAC,KAAK,EAAE,aAAa,EAI7B;IAED;;;OAGG;IACyC,QAA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KAAK,EAAE,KAAK,GAAG,IAAI;IAKrD,iBAAiB,IAAI,SAAS;cAUX,MAAM,IAAI,cAAc;IAS3C,SAAS,CAAC,YAAY,IAAI,cAAc;IAIxC,SAAS,CAAC,eAAe,IAAI,cAAc;IAS3C,SAAS,CAAC,eAAe,IAAI,SAAS;IAOtC,SAAS,CAAC,WAAW,IAAI,cAAc;IAMvC,SAAS,CAAC,aAAa,IAAI,SAAS;IAQpC,SAAS,CAAC,SAAS,IAAI,cAAc;IAOrC,SAAS,CAAC,UAAU,IAAI,cAAc;CAWvC"}
|
|
@@ -4,7 +4,7 @@ import { property, state, query } from 'lit/decorators.js';
|
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { UiElement } from '../../UiElement.js';
|
|
6
6
|
import { setDisabled } from '../../../lib/disabled.js';
|
|
7
|
-
import '
|
|
7
|
+
import '../../focus-ring/ui-focus-ring.js';
|
|
8
8
|
import '../../ripple/ui-ripple.js';
|
|
9
9
|
export var ListItemLines;
|
|
10
10
|
(function (ListItemLines) {
|
|
@@ -110,7 +110,7 @@ let UiListItem = (() => {
|
|
|
110
110
|
*/
|
|
111
111
|
);
|
|
112
112
|
/**
|
|
113
|
-
* Whether the
|
|
113
|
+
* Whether the list item is disabled. The user can't interact with the list item when `true`.
|
|
114
114
|
* @attribute
|
|
115
115
|
*/
|
|
116
116
|
get disabled() { return this.#disabled_accessor_storage; }
|
|
@@ -152,6 +152,7 @@ let UiListItem = (() => {
|
|
|
152
152
|
set hasSupportingText(value) { this.#hasSupportingText_accessor_storage = value; }
|
|
153
153
|
constructor() {
|
|
154
154
|
super();
|
|
155
|
+
__runInitializers(this, _hasSupportingText_extraInitializers);
|
|
155
156
|
this.image = ListItemImage.icon;
|
|
156
157
|
this.lines = ListItemLines.one;
|
|
157
158
|
this.addEventListener('click', this.handleClick.bind(this));
|
|
@@ -303,16 +304,16 @@ let UiListItem = (() => {
|
|
|
303
304
|
</div>
|
|
304
305
|
`;
|
|
305
306
|
}
|
|
306
|
-
renderRipple
|
|
307
|
+
renderRipple() {
|
|
307
308
|
return html `<ui-ripple class="ripple" ?disabled="${this.disabled || this.static}"></ui-ripple>`;
|
|
308
|
-
}
|
|
309
|
+
}
|
|
309
310
|
renderFocusRing() {
|
|
310
|
-
return html `<
|
|
311
|
+
return html `<ui-focus-ring
|
|
311
312
|
part="focus-ring"
|
|
312
313
|
class="focus-ring"
|
|
313
314
|
.control="${this}"
|
|
314
315
|
inward
|
|
315
|
-
></
|
|
316
|
+
></ui-focus-ring>`;
|
|
316
317
|
}
|
|
317
318
|
getStartClasses() {
|
|
318
319
|
return {
|