@umbraco-ui/uui 2.0.0-alpha.1 → 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +45 -8
- package/dist/components/avatar/avatar.element.js +1 -0
- package/dist/components/avatar/avatar.element.js.map +1 -1
- package/dist/components/boolean-input/boolean-input.element.js +7 -1
- package/dist/components/boolean-input/boolean-input.element.js.map +1 -1
- package/dist/components/button/button.element.d.ts +0 -1
- package/dist/components/button/button.element.js +64 -18
- package/dist/components/button/button.element.js.map +1 -1
- package/dist/components/card-block-type/card-block-type.element.js +13 -4
- package/dist/components/card-block-type/card-block-type.element.js.map +1 -1
- package/dist/components/card-content-node/card-content-node.element.js +2 -2
- package/dist/components/card-content-node/card-content-node.element.js.map +1 -1
- package/dist/components/card-media/card-media.element.js +10 -3
- package/dist/components/card-media/card-media.element.js.map +1 -1
- package/dist/components/card-user/card-user.element.js +2 -2
- package/dist/components/card-user/card-user.element.js.map +1 -1
- package/dist/components/checkbox/checkbox.element.js +3 -6
- package/dist/components/checkbox/checkbox.element.js.map +1 -1
- package/dist/components/color-slider/color-slider.element.js +13 -3
- package/dist/components/color-slider/color-slider.element.js.map +1 -1
- package/dist/components/color-swatch/color-swatch.element.js +33 -1
- package/dist/components/color-swatch/color-swatch.element.js.map +1 -1
- package/dist/components/combobox/combobox.element.d.ts +9 -0
- package/dist/components/combobox/combobox.element.js +127 -15
- package/dist/components/combobox/combobox.element.js.map +1 -1
- package/dist/components/combobox-list/combobox-list-option.element.d.ts +1 -0
- package/dist/components/combobox-list/combobox-list-option.element.js +49 -10
- package/dist/components/combobox-list/combobox-list-option.element.js.map +1 -1
- package/dist/components/combobox-list/combobox-list.element.d.ts +14 -0
- package/dist/components/combobox-list/combobox-list.element.js +74 -25
- package/dist/components/combobox-list/combobox-list.element.js.map +1 -1
- package/dist/components/file-dropzone/file-dropzone.element.d.ts +2 -8
- package/dist/components/file-dropzone/file-dropzone.element.js +14 -25
- package/dist/components/file-dropzone/file-dropzone.element.js.map +1 -1
- package/dist/components/icon-registry-essential/UUIIconRegistryEssential.js +1 -1
- package/dist/components/icon-registry-essential/icon-registry-essential.js +33 -0
- package/dist/components/icon-registry-essential/icon-registry-essential.js.map +1 -1
- package/dist/components/index.d.ts +81 -0
- package/dist/components/input/input.element.js +33 -3
- package/dist/components/input/input.element.js.map +1 -1
- package/dist/components/input-file/input-file.element.js +33 -1
- package/dist/components/input-file/input-file.element.js.map +1 -1
- package/dist/components/input-lock/input-lock.element.js +33 -4
- package/dist/components/input-lock/input-lock.element.js.map +1 -1
- package/dist/components/input-password/input-password.element.js +33 -3
- package/dist/components/input-password/input-password.element.js.map +1 -1
- package/dist/components/keyboard-shortcut/key.element.js +7 -1
- package/dist/components/keyboard-shortcut/key.element.js.map +1 -1
- package/dist/components/loader/loader.element.js +19 -2
- package/dist/components/loader/loader.element.js.map +1 -1
- package/dist/components/modal/modal-container.js +6 -2
- package/dist/components/modal/modal-container.js.map +1 -1
- package/dist/components/modal/modal-dialog.element.js +5 -5
- package/dist/components/modal/modal-dialog.element.js.map +1 -1
- package/dist/components/modal/modal-sidebar.element.js +14 -10
- package/dist/components/modal/modal-sidebar.element.js.map +1 -1
- package/dist/components/modal/modal-with-toasts-example.element.d.ts +22 -0
- package/dist/components/modal/modal.element.d.ts +3 -1
- package/dist/components/modal/modal.element.js +31 -12
- package/dist/components/modal/modal.element.js.map +1 -1
- package/dist/components/modal/modal.js +7 -1
- package/dist/components/modal/modal.js.map +1 -1
- package/dist/components/pagination/pagination.element.d.ts +2 -0
- package/dist/components/pagination/pagination.element.js +26 -20
- package/dist/components/pagination/pagination.element.js.map +1 -1
- package/dist/components/progress-bar/progress-bar.element.js +6 -5
- package/dist/components/progress-bar/progress-bar.element.js.map +1 -1
- package/dist/components/responsive-container/responsive-container.element.js +36 -14
- package/dist/components/responsive-container/responsive-container.element.js.map +1 -1
- package/dist/components/scroll-container/scroll-container.element.js +4 -4
- package/dist/components/scroll-container/scroll-container.element.js.map +1 -1
- package/dist/components/symbol-expand/symbol-expand.element.js +1 -1
- package/dist/components/symbol-expand/symbol-expand.element.js.map +1 -1
- package/dist/components/symbol-file-thumbnail/symbol-file-thumbnail.element.js +34 -1
- package/dist/components/symbol-file-thumbnail/symbol-file-thumbnail.element.js.map +1 -1
- package/dist/components/table/table-head.element.js +4 -0
- package/dist/components/table/table-head.element.js.map +1 -1
- package/dist/components/table/table.element.js +5 -1
- package/dist/components/table/table.element.js.map +1 -1
- package/dist/components/tag/tag.element.js +4 -3
- package/dist/components/tag/tag.element.js.map +1 -1
- package/dist/components/toast-notification/toast-notification.element.js +34 -2
- package/dist/components/toast-notification/toast-notification.element.js.map +1 -1
- package/dist/components/toggle/toggle.element.js +38 -3
- package/dist/components/toggle/toggle.element.js.map +1 -1
- package/dist/index.d.ts +1 -81
- package/dist/internal/mixins/LabelMixin.js +14 -1
- package/dist/internal/mixins/LabelMixin.js.map +1 -1
- package/dist/internal/mixins/SelectOnlyMixin.d.ts +1 -1
- package/dist/internal/mixins/SelectOnlyMixin.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/themes/dark.css +1 -1
- package/dist/themes/high-contrast.css +1 -1
- package/dist/themes/light.css +1 -1
- package/package.json +26 -26
- package/vscode.html-custom-data.json +33 -18
|
@@ -6,7 +6,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
6
6
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
7
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
8
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
|
-
var _childElements, _hiddenElements, _hiddenElementsMap, _visibilityBreakpoints, _resizeObserver, _childResizeObservers, _breakPointCalculationInProgress, _isConnected, _UUIResponsiveContainerElement_instances, initialize_fn, onResize_fn, onSlotChange_fn, cleanup_fn, calculateBreakPoints_fn, updateCollapsibleItems_fn, hideElement_fn, collapseFromEnd_fn, collapseFromStart_fn, _onItemClicked;
|
|
9
|
+
var _childElements, _hiddenElements, _clonedElements, _hiddenElementsMap, _visibilityBreakpoints, _resizeObserver, _childResizeObservers, _breakPointCalculationInProgress, _isConnected, _UUIResponsiveContainerElement_instances, initialize_fn, onResize_fn, onSlotChange_fn, cleanup_fn, calculateBreakPoints_fn, updateCollapsibleItems_fn, hideElement_fn, collapseFromEnd_fn, collapseFromStart_fn, _onItemClicked, onPopoverToggle_fn, buildDropdownItems_fn;
|
|
10
10
|
import { LitElement, html, css } from "lit";
|
|
11
11
|
import { query, property, queryAssignedElements } from "lit/decorators.js";
|
|
12
12
|
import { repeat } from "lit/directives/repeat.js";
|
|
@@ -28,6 +28,7 @@ const _UUIResponsiveContainerElement = class _UUIResponsiveContainerElement exte
|
|
|
28
28
|
__privateAdd(this, _UUIResponsiveContainerElement_instances);
|
|
29
29
|
__privateAdd(this, _childElements);
|
|
30
30
|
__privateAdd(this, _hiddenElements);
|
|
31
|
+
__privateAdd(this, _clonedElements);
|
|
31
32
|
__privateAdd(this, _hiddenElementsMap);
|
|
32
33
|
__privateAdd(this, _visibilityBreakpoints);
|
|
33
34
|
__privateAdd(this, _resizeObserver);
|
|
@@ -38,6 +39,7 @@ const _UUIResponsiveContainerElement = class _UUIResponsiveContainerElement exte
|
|
|
38
39
|
this.collapse = "end";
|
|
39
40
|
__privateSet(this, _childElements, []);
|
|
40
41
|
__privateSet(this, _hiddenElements, []);
|
|
42
|
+
__privateSet(this, _clonedElements, []);
|
|
41
43
|
__privateSet(this, _hiddenElementsMap, /* @__PURE__ */ new Map());
|
|
42
44
|
__privateSet(this, _visibilityBreakpoints, []);
|
|
43
45
|
__privateSet(this, _resizeObserver, new ResizeObserver(__privateMethod(this, _UUIResponsiveContainerElement_instances, onResize_fn).bind(this)));
|
|
@@ -88,9 +90,10 @@ const _UUIResponsiveContainerElement = class _UUIResponsiveContainerElement exte
|
|
|
88
90
|
<uui-popover-container
|
|
89
91
|
id="popover-container"
|
|
90
92
|
popover
|
|
93
|
+
@beforetoggle=${__privateMethod(this, _UUIResponsiveContainerElement_instances, onPopoverToggle_fn)}
|
|
91
94
|
placement=${this.collapse === "start" ? "bottom-start" : "bottom-end"}>
|
|
92
95
|
<div id="dropdown-container">
|
|
93
|
-
${repeat(__privateGet(this,
|
|
96
|
+
${repeat(__privateGet(this, _clonedElements), (el) => html`${el}`)}
|
|
94
97
|
</div>
|
|
95
98
|
</uui-popover-container>
|
|
96
99
|
`;
|
|
@@ -98,6 +101,7 @@ const _UUIResponsiveContainerElement = class _UUIResponsiveContainerElement exte
|
|
|
98
101
|
};
|
|
99
102
|
_childElements = new WeakMap();
|
|
100
103
|
_hiddenElements = new WeakMap();
|
|
104
|
+
_clonedElements = new WeakMap();
|
|
101
105
|
_hiddenElementsMap = new WeakMap();
|
|
102
106
|
_visibilityBreakpoints = new WeakMap();
|
|
103
107
|
_resizeObserver = new WeakMap();
|
|
@@ -108,7 +112,7 @@ _UUIResponsiveContainerElement_instances = new WeakSet();
|
|
|
108
112
|
initialize_fn = async function() {
|
|
109
113
|
await this.updateComplete;
|
|
110
114
|
if (!__privateGet(this, _isConnected)) return;
|
|
111
|
-
__privateGet(this, _resizeObserver).observe(this
|
|
115
|
+
__privateGet(this, _resizeObserver).observe(this);
|
|
112
116
|
requestAnimationFrame(() => {
|
|
113
117
|
if (!__privateGet(this, _isConnected)) return;
|
|
114
118
|
__privateMethod(this, _UUIResponsiveContainerElement_instances, onSlotChange_fn).call(this);
|
|
@@ -138,9 +142,10 @@ cleanup_fn = function() {
|
|
|
138
142
|
__privateGet(this, _childResizeObservers).forEach((observer) => observer.disconnect());
|
|
139
143
|
__privateSet(this, _childResizeObservers, []);
|
|
140
144
|
__privateSet(this, _visibilityBreakpoints, []);
|
|
141
|
-
__privateGet(this,
|
|
145
|
+
__privateGet(this, _clonedElements).forEach((el) => {
|
|
142
146
|
el.removeEventListener("click", __privateGet(this, _onItemClicked));
|
|
143
147
|
});
|
|
148
|
+
__privateSet(this, _clonedElements, []);
|
|
144
149
|
__privateSet(this, _hiddenElements, []);
|
|
145
150
|
__privateGet(this, _hiddenElementsMap).clear();
|
|
146
151
|
};
|
|
@@ -162,17 +167,19 @@ calculateBreakPoints_fn = async function() {
|
|
|
162
167
|
}
|
|
163
168
|
const tolerance = 2;
|
|
164
169
|
this._mainElement.style.width = totalWidth - gap + tolerance + "px";
|
|
165
|
-
__privateMethod(this, _UUIResponsiveContainerElement_instances, updateCollapsibleItems_fn).call(this, this.
|
|
170
|
+
__privateMethod(this, _UUIResponsiveContainerElement_instances, updateCollapsibleItems_fn).call(this, this.offsetWidth);
|
|
166
171
|
__privateSet(this, _breakPointCalculationInProgress, false);
|
|
167
172
|
};
|
|
168
173
|
// The main logic that shows/hides items
|
|
169
174
|
updateCollapsibleItems_fn = function(containerWidth) {
|
|
170
175
|
const moreButtonWidth = this._moreButtonElement?.offsetWidth || 40;
|
|
171
176
|
const availableWidth = containerWidth - moreButtonWidth;
|
|
172
|
-
__privateGet(this, _hiddenElements).forEach((el) => {
|
|
173
|
-
el.removeEventListener("click", __privateGet(this, _onItemClicked));
|
|
174
|
-
});
|
|
175
177
|
__privateSet(this, _hiddenElements, []);
|
|
178
|
+
__privateGet(this, _clonedElements).forEach(
|
|
179
|
+
(el) => el.removeEventListener("click", __privateGet(this, _onItemClicked))
|
|
180
|
+
);
|
|
181
|
+
__privateSet(this, _clonedElements, []);
|
|
182
|
+
this._popoverContainerElement?.hidePopover();
|
|
176
183
|
__privateGet(this, _hiddenElementsMap).clear();
|
|
177
184
|
if (this.collapse === "end") {
|
|
178
185
|
__privateMethod(this, _UUIResponsiveContainerElement_instances, collapseFromEnd_fn).call(this, containerWidth, availableWidth);
|
|
@@ -189,12 +196,7 @@ updateCollapsibleItems_fn = function(containerWidth) {
|
|
|
189
196
|
};
|
|
190
197
|
hideElement_fn = function(element) {
|
|
191
198
|
element.style.display = "none";
|
|
192
|
-
|
|
193
|
-
clone.style.display = "";
|
|
194
|
-
clone.addEventListener("click", __privateGet(this, _onItemClicked));
|
|
195
|
-
__privateGet(this, _hiddenElementsMap).set(clone, element);
|
|
196
|
-
__privateGet(this, _hiddenElementsMap).set(element, clone);
|
|
197
|
-
__privateGet(this, _hiddenElements).push(clone);
|
|
199
|
+
__privateGet(this, _hiddenElements).push(element);
|
|
198
200
|
};
|
|
199
201
|
collapseFromEnd_fn = function(containerWidth, availableWidth) {
|
|
200
202
|
const len = __privateGet(this, _visibilityBreakpoints).length;
|
|
@@ -225,6 +227,26 @@ collapseFromStart_fn = function(containerWidth, availableWidth) {
|
|
|
225
227
|
}
|
|
226
228
|
};
|
|
227
229
|
_onItemClicked = new WeakMap();
|
|
230
|
+
onPopoverToggle_fn = function(e) {
|
|
231
|
+
if (e.newState === "open") {
|
|
232
|
+
__privateMethod(this, _UUIResponsiveContainerElement_instances, buildDropdownItems_fn).call(this);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
buildDropdownItems_fn = function() {
|
|
236
|
+
__privateGet(this, _clonedElements).forEach(
|
|
237
|
+
(el) => el.removeEventListener("click", __privateGet(this, _onItemClicked))
|
|
238
|
+
);
|
|
239
|
+
__privateSet(this, _clonedElements, []);
|
|
240
|
+
__privateGet(this, _hiddenElementsMap).clear();
|
|
241
|
+
for (const original of __privateGet(this, _hiddenElements)) {
|
|
242
|
+
const clone = original.cloneNode(true);
|
|
243
|
+
clone.style.display = "";
|
|
244
|
+
clone.addEventListener("click", __privateGet(this, _onItemClicked));
|
|
245
|
+
__privateGet(this, _hiddenElementsMap).set(clone, original);
|
|
246
|
+
__privateGet(this, _clonedElements).push(clone);
|
|
247
|
+
}
|
|
248
|
+
this.requestUpdate();
|
|
249
|
+
};
|
|
228
250
|
_UUIResponsiveContainerElement.styles = [
|
|
229
251
|
css`
|
|
230
252
|
:host {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsive-container.element.js","sources":["../../../src/components/responsive-container/responsive-container.element.ts"],"sourcesContent":["import type { UUIButtonElement } from '../button/button.js';\nimport type { UUIPopoverContainerElement } from '../popover-container/popover-container.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport '../button/button.js';\nimport '../popover-container/popover-container.js';\nimport '../symbol-more/symbol-more.js';\n\n/**\n * A responsive container that collapses overflowing children into a dropdown.\n *\n * @element uui-responsive-container\n * @slot - Default slot for child elements (buttons, etc.)\n * @cssprop --uui-responsive-container-gap - Gap between items (default: 8px)\n */\nexport class UUIResponsiveContainerElement extends LitElement {\n // These help us find elements inside the component\n @query('#more-button')\n private readonly _moreButtonElement!: UUIButtonElement;\n\n @query('#popover-container')\n private readonly _popoverContainerElement!: UUIPopoverContainerElement;\n\n @query('#main')\n private readonly _mainElement!: HTMLElement;\n\n /**\n * Controls which side items collapse from.\n * - \"end\": Items collapse from the right, more button appears on right (default)\n * - \"start\": Items collapse from the left, more button appears on left\n * @attr collapse\n * @default \"end\"\n */\n @property({ type: String, reflect: true })\n collapse: 'start' | 'end' = 'end';\n\n // This gets all elements put inside the slot\n @queryAssignedElements({ flatten: true })\n private readonly _slottedNodes?: HTMLElement[];\n\n // These store the component's internal state\n #childElements: HTMLElement[] = []; // All child elements\n #hiddenElements: HTMLElement[] = []; // Elements in the dropdown\n readonly #hiddenElementsMap: Map<HTMLElement, HTMLElement> = new Map();\n #visibilityBreakpoints: number[] = []; // Width thresholds for each item\n\n // ResizeObserver watches for size changes\n readonly #resizeObserver = new ResizeObserver(this.#onResize.bind(this));\n #childResizeObservers: ResizeObserver[] = [];\n #breakPointCalculationInProgress = false;\n\n #isConnected = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.#isConnected = true;\n this.#initialize();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.#isConnected = false;\n this.#resizeObserver.disconnect();\n this.#cleanup();\n }\n\n async #initialize() {\n await this.updateComplete;\n if (!this.#isConnected) return;\n this.#resizeObserver.observe(this._mainElement);\n\n requestAnimationFrame(() => {\n if (!this.#isConnected) return;\n this.#onSlotChange();\n });\n }\n\n // This runs when the container size changes\n #onResize(entries: ResizeObserverEntry[]) {\n if (!this.#isConnected) return;\n const newWidth = entries[0].contentBoxSize[0].inlineSize;\n this.#updateCollapsibleItems(newWidth);\n }\n\n // This runs when children are added/removed\n #onSlotChange() {\n if (!this.#isConnected) return;\n\n this.#cleanup();\n this.#childElements = this._slottedNodes ? [...this._slottedNodes] : [];\n\n this.#childElements.forEach(el => {\n const observer = new ResizeObserver(\n this.#calculateBreakPoints.bind(this),\n );\n observer.observe(el);\n this.#childResizeObservers.push(observer);\n });\n\n this.#calculateBreakPoints();\n }\n\n #cleanup() {\n this.#childResizeObservers.forEach(observer => observer.disconnect());\n this.#childResizeObservers = [];\n this.#visibilityBreakpoints = [];\n\n // Clean up hidden elements\n this.#hiddenElements.forEach(el => {\n el.removeEventListener('click', this.#onItemClicked);\n });\n this.#hiddenElements = [];\n this.#hiddenElementsMap.clear();\n }\n\n // Calculate at what widths items should hide\n async #calculateBreakPoints() {\n if (!this.#isConnected) return;\n if (this.#breakPointCalculationInProgress) return;\n\n this.#breakPointCalculationInProgress = true;\n\n await this.updateComplete;\n\n // Get the gap from CSS or use default\n const gapCSSVar = Number.parseFloat(\n getComputedStyle(this).getPropertyValue('--uui-responsive-container-gap'),\n );\n const gap = Number.isNaN(gapCSSVar) ? 8 : gapCSSVar;\n\n let totalWidth = 0;\n\n // Calculate cumulative width for each item\n for (let i = 0; i < this.#childElements.length; i++) {\n this.#childElements[i].style.display = '';\n totalWidth += this.#childElements[i].offsetWidth;\n this.#visibilityBreakpoints[i] = totalWidth;\n totalWidth += gap;\n }\n\n // Set the container width\n const tolerance = 2;\n this._mainElement.style.width = totalWidth - gap + tolerance + 'px';\n\n this.#updateCollapsibleItems(this._mainElement.offsetWidth);\n this.#breakPointCalculationInProgress = false;\n }\n\n // The main logic that shows/hides items\n #updateCollapsibleItems(containerWidth: number) {\n const moreButtonWidth = this._moreButtonElement?.offsetWidth || 40;\n const availableWidth = containerWidth - moreButtonWidth;\n\n // Clear previous hidden items\n this.#hiddenElements.forEach(el => {\n el.removeEventListener('click', this.#onItemClicked);\n });\n this.#hiddenElements = [];\n this.#hiddenElementsMap.clear();\n\n if (this.collapse === 'end') {\n this.#collapseFromEnd(containerWidth, availableWidth);\n } else {\n this.#collapseFromStart(containerWidth, availableWidth);\n }\n\n // Show/hide the \"more\" button\n if (this.#hiddenElements.length === 0) {\n this._moreButtonElement.style.display = 'none';\n this._popoverContainerElement?.hidePopover();\n } else {\n this._moreButtonElement.style.display = '';\n }\n\n this.requestUpdate();\n }\n\n #hideElement(element: HTMLElement) {\n element.style.display = 'none';\n const clone = element.cloneNode(true) as HTMLElement;\n clone.style.display = '';\n clone.addEventListener('click', this.#onItemClicked);\n\n // Link clone ↔ original (bidirectional)\n this.#hiddenElementsMap.set(clone, element);\n this.#hiddenElementsMap.set(element, clone);\n this.#hiddenElements.push(clone);\n }\n\n #collapseFromEnd(containerWidth: number, availableWidth: number) {\n const len = this.#visibilityBreakpoints.length;\n\n for (let i = 0; i < len; i++) {\n const breakpoint = this.#visibilityBreakpoints[i];\n const element = this.#childElements[i];\n\n // Last item: use full width (no more button needed if all fit)\n const widthToCheck = i === len - 1 ? containerWidth : availableWidth;\n\n if (breakpoint <= widthToCheck) {\n element.style.display = '';\n } else {\n this.#hideElement(element);\n }\n }\n }\n\n #collapseFromStart(containerWidth: number, availableWidth: number) {\n const len = this.#visibilityBreakpoints.length;\n const totalWidth = this.#visibilityBreakpoints[len - 1] || 0;\n\n for (let i = 0; i < len; i++) {\n const element = this.#childElements[i];\n // Width from this item to the end\n const widthFromEnd =\n totalWidth - (i > 0 ? this.#visibilityBreakpoints[i - 1] : 0);\n\n // First visible item: use full width (no more button needed if all fit)\n const isFirstPotentiallyVisible =\n i === 0 || this.#childElements[i - 1].style.display === 'none';\n const widthToCheck =\n isFirstPotentiallyVisible && this.#hiddenElements.length === 0\n ? containerWidth\n : availableWidth;\n\n if (widthFromEnd <= widthToCheck) {\n element.style.display = '';\n } else {\n this.#hideElement(element);\n }\n }\n }\n\n readonly #onItemClicked = (e: MouseEvent) => {\n const clickedElement = e.currentTarget as HTMLElement;\n\n // Find the original element linked to this clone\n const originalElement = this.#hiddenElementsMap.get(clickedElement);\n\n if (originalElement) {\n // Close the dropdown\n this._popoverContainerElement?.hidePopover();\n\n // Trigger click on the ORIGINAL element so its event handlers fire\n originalElement.click();\n }\n };\n\n render() {\n const moreButton = html`\n <uui-button\n popovertarget=\"popover-container\"\n style=\"display: none\"\n id=\"more-button\"\n label=\"More\"\n compact>\n <slot name=\"trigger-content\">\n <uui-symbol-more></uui-symbol-more>\n </slot>\n </uui-button>\n `;\n\n return html`\n <div id=\"main\">\n ${this.collapse === 'start' ? moreButton : ''}\n <div id=\"items-container\">\n <slot @slotchange=${this.#onSlotChange}></slot>\n </div>\n ${this.collapse === 'end' ? moreButton : ''}\n </div>\n <uui-popover-container\n id=\"popover-container\"\n popover\n placement=${this.collapse === 'start' ? 'bottom-start' : 'bottom-end'}>\n <div id=\"dropdown-container\">\n ${repeat(this.#hiddenElements, el => html`${el}`)}\n </div>\n </uui-popover-container>\n `;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: flex;\n min-width: 0;\n }\n\n #main {\n display: flex;\n overflow: hidden;\n align-items: center;\n }\n\n #items-container {\n display: flex;\n gap: var(--uui-responsive-container-gap, var(--uui-size-3));\n overflow: hidden;\n align-items: center;\n }\n\n #more-button {\n --uui-button-background-color: transparent;\n --uui-button-background-color-hover: var(--uui-color-surface-alt);\n flex-shrink: 0;\n }\n\n :host([collapse='end']) #more-button,\n :host(:not([collapse])) #more-button {\n margin-left: var(--uui-responsive-container-gap, var(--uui-size-3));\n }\n\n :host([collapse='start']) #more-button {\n margin-right: var(--uui-responsive-container-gap, var(--uui-size-3));\n }\n\n #dropdown-container {\n display: flex;\n flex-direction: column;\n background-color: var(--uui-color-surface);\n border-radius: var(--uui-border-radius);\n box-shadow: var(--uui-shadow-depth-3);\n overflow: hidden;\n padding: var(--uui-size-space-2);\n gap: var(--uui-size-space-1);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAM,iCAAN,MAAM,uCAAsC,WAAW;AAAA,EAAvD,cAAA;AAAA,UAAA,GAAA,SAAA;AAAA;AA0BL;AACA;AACS;AACT;AAGS;AACT;AACA;AAEA;AAsLS;AAvMT,SAAA,WAA4B;AAO5B,uBAAA,gBAAgC,CAAA;AAChC,uBAAA,iBAAiC,CAAA;AACjC,uBAAS,wCAAwD,IAAA;AACjE,uBAAA,wBAAmC,CAAA;AAGnC,uBAAS,iBAAkB,IAAI,eAAe,sBAAK,uDAAU,KAAK,IAAI,CAAC;AACvE,uBAAA,uBAA0C,CAAA;AAC1C,uBAAA,kCAAmC;AAEnC,uBAAA,cAAe;AAsLf,uBAAS,gBAAiB,CAAC,MAAkB;AAC3C,YAAM,iBAAiB,EAAE;AAGzB,YAAM,kBAAkB,mBAAK,oBAAmB,IAAI,cAAc;AAElE,UAAI,iBAAiB;AAEnB,aAAK,0BAA0B,YAAA;AAG/B,wBAAgB,MAAA;AAAA,MAClB;AAAA,IACF;AAAA,EAAA;AAAA,EAjMA,oBAAoB;AAClB,UAAM,kBAAA;AACN,uBAAK,cAAe;AACpB,0BAAK,yDAAL;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,UAAM,qBAAA;AACN,uBAAK,cAAe;AACpB,uBAAK,iBAAgB,WAAA;AACrB,0BAAK,sDAAL;AAAA,EACF;AAAA,EAwLA,SAAS;AACP,UAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAanB,WAAO;AAAA;AAAA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B;AAAA,IACpB;AAAA,EACF;AACF;AAES;AAgDT,+BAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA3QG,IAAM,gCAAN;AAGY,gBAAA;AAAA,EADhB,MAAM,cAAc;AAAA,GAFV,8BAGM,WAAA,oBAAA;AAGA,gBAAA;AAAA,EADhB,MAAM,oBAAoB;AAAA,GALhB,8BAMM,WAAA,0BAAA;AAGA,gBAAA;AAAA,EADhB,MAAM,OAAO;AAAA,GARH,8BASM,WAAA,cAAA;AAUjB,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM;AAAA,GAlB9B,8BAmBX,WAAA,UAAA;AAIiB,gBAAA;AAAA,EADhB,sBAAsB,EAAE,SAAS,KAAA,CAAM;AAAA,GAtB7B,8BAuBM,WAAA,eAAA;"}
|
|
1
|
+
{"version":3,"file":"responsive-container.element.js","sources":["../../../src/components/responsive-container/responsive-container.element.ts"],"sourcesContent":["import type { UUIButtonElement } from '../button/button.js';\nimport type { UUIPopoverContainerElement } from '../popover-container/popover-container.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query, queryAssignedElements } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport '../button/button.js';\nimport '../popover-container/popover-container.js';\nimport '../symbol-more/symbol-more.js';\n\n/**\n * A responsive container that collapses overflowing children into a dropdown.\n *\n * @element uui-responsive-container\n * @slot - Default slot for child elements (buttons, etc.)\n * @cssprop --uui-responsive-container-gap - Gap between items (default: 8px)\n */\nexport class UUIResponsiveContainerElement extends LitElement {\n // These help us find elements inside the component\n @query('#more-button')\n private readonly _moreButtonElement!: UUIButtonElement;\n\n @query('#popover-container')\n private readonly _popoverContainerElement!: UUIPopoverContainerElement;\n\n @query('#main')\n private readonly _mainElement!: HTMLElement;\n\n /**\n * Controls which side items collapse from.\n * - \"end\": Items collapse from the right, more button appears on right (default)\n * - \"start\": Items collapse from the left, more button appears on left\n * @attr collapse\n * @default \"end\"\n */\n @property({ type: String, reflect: true })\n collapse: 'start' | 'end' = 'end';\n\n // This gets all elements put inside the slot\n @queryAssignedElements({ flatten: true })\n private readonly _slottedNodes?: HTMLElement[];\n\n // These store the component's internal state\n #childElements: HTMLElement[] = []; // All child elements\n #hiddenElements: HTMLElement[] = []; // Elements in the dropdown\n #clonedElements: HTMLElement[] = []; // Clones of hidden elements for the dropdown\n readonly #hiddenElementsMap: Map<HTMLElement, HTMLElement> = new Map();\n #visibilityBreakpoints: number[] = []; // Width thresholds for each item\n\n // ResizeObserver watches for size changes\n readonly #resizeObserver = new ResizeObserver(this.#onResize.bind(this));\n #childResizeObservers: ResizeObserver[] = [];\n #breakPointCalculationInProgress = false;\n\n #isConnected = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.#isConnected = true;\n this.#initialize();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.#isConnected = false;\n this.#resizeObserver.disconnect();\n this.#cleanup();\n }\n\n async #initialize() {\n await this.updateComplete;\n if (!this.#isConnected) return;\n this.#resizeObserver.observe(this);\n\n requestAnimationFrame(() => {\n if (!this.#isConnected) return;\n this.#onSlotChange();\n });\n }\n\n // This runs when the container size changes\n #onResize(entries: ResizeObserverEntry[]) {\n if (!this.#isConnected) return;\n const newWidth = entries[0].contentBoxSize[0].inlineSize;\n this.#updateCollapsibleItems(newWidth);\n }\n\n // This runs when children are added/removed\n #onSlotChange() {\n if (!this.#isConnected) return;\n\n this.#cleanup();\n this.#childElements = this._slottedNodes ? [...this._slottedNodes] : [];\n\n this.#childElements.forEach(el => {\n const observer = new ResizeObserver(\n this.#calculateBreakPoints.bind(this),\n );\n observer.observe(el);\n this.#childResizeObservers.push(observer);\n });\n\n this.#calculateBreakPoints();\n }\n\n #cleanup() {\n this.#childResizeObservers.forEach(observer => observer.disconnect());\n this.#childResizeObservers = [];\n this.#visibilityBreakpoints = [];\n\n // Clean up hidden elements\n this.#clonedElements.forEach(el => {\n el.removeEventListener('click', this.#onItemClicked);\n });\n this.#clonedElements = [];\n this.#hiddenElements = [];\n this.#hiddenElementsMap.clear();\n }\n\n // Calculate at what widths items should hide\n async #calculateBreakPoints() {\n if (!this.#isConnected) return;\n if (this.#breakPointCalculationInProgress) return;\n\n this.#breakPointCalculationInProgress = true;\n\n await this.updateComplete;\n\n // Get the gap from CSS or use default\n const gapCSSVar = Number.parseFloat(\n getComputedStyle(this).getPropertyValue('--uui-responsive-container-gap'),\n );\n const gap = Number.isNaN(gapCSSVar) ? 8 : gapCSSVar;\n\n let totalWidth = 0;\n\n // Calculate cumulative width for each item\n for (let i = 0; i < this.#childElements.length; i++) {\n this.#childElements[i].style.display = '';\n totalWidth += this.#childElements[i].offsetWidth;\n this.#visibilityBreakpoints[i] = totalWidth;\n totalWidth += gap;\n }\n\n // Set the container width\n const tolerance = 2;\n this._mainElement.style.width = totalWidth - gap + tolerance + 'px';\n\n this.#updateCollapsibleItems(this.offsetWidth);\n this.#breakPointCalculationInProgress = false;\n }\n\n // The main logic that shows/hides items\n #updateCollapsibleItems(containerWidth: number) {\n const moreButtonWidth = this._moreButtonElement?.offsetWidth || 40;\n const availableWidth = containerWidth - moreButtonWidth;\n\n // Clear previous hidden items\n this.#hiddenElements = [];\n this.#clonedElements.forEach(el =>\n el.removeEventListener('click', this.#onItemClicked),\n );\n this.#clonedElements = [];\n this._popoverContainerElement?.hidePopover();\n this.#hiddenElementsMap.clear();\n\n if (this.collapse === 'end') {\n this.#collapseFromEnd(containerWidth, availableWidth);\n } else {\n this.#collapseFromStart(containerWidth, availableWidth);\n }\n\n // Show/hide the \"more\" button\n if (this.#hiddenElements.length === 0) {\n this._moreButtonElement.style.display = 'none';\n this._popoverContainerElement?.hidePopover();\n } else {\n this._moreButtonElement.style.display = '';\n }\n\n this.requestUpdate();\n }\n\n #hideElement(element: HTMLElement) {\n element.style.display = 'none';\n this.#hiddenElements.push(element);\n }\n\n #collapseFromEnd(containerWidth: number, availableWidth: number) {\n const len = this.#visibilityBreakpoints.length;\n\n for (let i = 0; i < len; i++) {\n const breakpoint = this.#visibilityBreakpoints[i];\n const element = this.#childElements[i];\n\n // Last item: use full width (no more button needed if all fit)\n const widthToCheck = i === len - 1 ? containerWidth : availableWidth;\n\n if (breakpoint <= widthToCheck) {\n element.style.display = '';\n } else {\n this.#hideElement(element);\n }\n }\n }\n\n #collapseFromStart(containerWidth: number, availableWidth: number) {\n const len = this.#visibilityBreakpoints.length;\n const totalWidth = this.#visibilityBreakpoints[len - 1] || 0;\n\n for (let i = 0; i < len; i++) {\n const element = this.#childElements[i];\n // Width from this item to the end\n const widthFromEnd =\n totalWidth - (i > 0 ? this.#visibilityBreakpoints[i - 1] : 0);\n\n // First visible item: use full width (no more button needed if all fit)\n const isFirstPotentiallyVisible =\n i === 0 || this.#childElements[i - 1].style.display === 'none';\n const widthToCheck =\n isFirstPotentiallyVisible && this.#hiddenElements.length === 0\n ? containerWidth\n : availableWidth;\n\n if (widthFromEnd <= widthToCheck) {\n element.style.display = '';\n } else {\n this.#hideElement(element);\n }\n }\n }\n\n readonly #onItemClicked = (e: MouseEvent) => {\n const clickedElement = e.currentTarget as HTMLElement;\n\n // Find the original element linked to this clone\n const originalElement = this.#hiddenElementsMap.get(clickedElement);\n\n if (originalElement) {\n // Close the dropdown\n this._popoverContainerElement?.hidePopover();\n\n // Trigger click on the ORIGINAL element so its event handlers fire\n originalElement.click();\n }\n };\n\n #onPopoverToggle(e: ToggleEvent) {\n if (e.newState === 'open') {\n this.#buildDropdownItems();\n }\n }\n\n #buildDropdownItems() {\n // Clear old clones\n this.#clonedElements.forEach(el =>\n el.removeEventListener('click', this.#onItemClicked),\n );\n this.#clonedElements = [];\n this.#hiddenElementsMap.clear();\n\n for (const original of this.#hiddenElements) {\n const clone = original.cloneNode(true) as HTMLElement;\n clone.style.display = '';\n clone.addEventListener('click', this.#onItemClicked);\n this.#hiddenElementsMap.set(clone, original);\n this.#clonedElements.push(clone);\n }\n this.requestUpdate();\n }\n\n render() {\n const moreButton = html`\n <uui-button\n popovertarget=\"popover-container\"\n style=\"display: none\"\n id=\"more-button\"\n label=\"More\"\n compact>\n <slot name=\"trigger-content\">\n <uui-symbol-more></uui-symbol-more>\n </slot>\n </uui-button>\n `;\n\n return html`\n <div id=\"main\">\n ${this.collapse === 'start' ? moreButton : ''}\n <div id=\"items-container\">\n <slot @slotchange=${this.#onSlotChange}></slot>\n </div>\n ${this.collapse === 'end' ? moreButton : ''}\n </div>\n <uui-popover-container\n id=\"popover-container\"\n popover\n @beforetoggle=${this.#onPopoverToggle}\n placement=${this.collapse === 'start' ? 'bottom-start' : 'bottom-end'}>\n <div id=\"dropdown-container\">\n ${repeat(this.#clonedElements, el => html`${el}`)}\n </div>\n </uui-popover-container>\n `;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: flex;\n min-width: 0;\n }\n\n #main {\n display: flex;\n overflow: hidden;\n align-items: center;\n }\n\n #items-container {\n display: flex;\n gap: var(--uui-responsive-container-gap, var(--uui-size-3));\n overflow: hidden;\n align-items: center;\n }\n\n #more-button {\n --uui-button-background-color: transparent;\n --uui-button-background-color-hover: var(--uui-color-surface-alt);\n flex-shrink: 0;\n }\n\n :host([collapse='end']) #more-button,\n :host(:not([collapse])) #more-button {\n margin-left: var(--uui-responsive-container-gap, var(--uui-size-3));\n }\n\n :host([collapse='start']) #more-button {\n margin-right: var(--uui-responsive-container-gap, var(--uui-size-3));\n }\n\n #dropdown-container {\n display: flex;\n flex-direction: column;\n background-color: var(--uui-color-surface);\n border-radius: var(--uui-border-radius);\n box-shadow: var(--uui-shadow-depth-3);\n overflow: hidden;\n padding: var(--uui-size-space-2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AErD,qBAAK,iBAAkB,CAAA;AACvB,qBAAK,oBAAmB,MAAA;AAExB,aAAW,YAAY,mBAAK,kBAAiB;AAC3C,UAAM,QAAQ,SAAS,UAAU,IAAI;AACrC,UAAM,MAAM,UAAU;AACtB,UAAM,iBAAiB,SAAS,mBAAK,eAAc;AACnD,uBAAK,oBAAmB,IAAI,OAAO,QAAQ;AAC3C,uBAAK,iBAAgB,KAAK,KAAK;AAAA,EACjC;AACA,OAAK,cAAA;AACP;AAoCA,+BAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAjSG,IAAM,gCAAN;AAGY,gBAAA;AAAA,EADhB,MAAM,cAAc;AAAA,GAFV,8BAGM,WAAA,oBAAA;AAGA,gBAAA;AAAA,EADhB,MAAM,oBAAoB;AAAA,GALhB,8BAMM,WAAA,0BAAA;AAGA,gBAAA;AAAA,EADhB,MAAM,OAAO;AAAA,GARH,8BASM,WAAA,cAAA;AAUjB,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM;AAAA,GAlB9B,8BAmBX,WAAA,UAAA;AAIiB,gBAAA;AAAA,EADhB,sBAAsB,EAAE,SAAS,KAAA,CAAM;AAAA,GAtB7B,8BAuBM,WAAA,eAAA;"}
|
|
@@ -32,7 +32,7 @@ _UUIScrollContainerElement.styles = [
|
|
|
32
32
|
overflow-y: overlay;
|
|
33
33
|
scrollbar-width: thin;
|
|
34
34
|
scrollbar-color: transparent transparent;
|
|
35
|
-
transition: scrollbar-color
|
|
35
|
+
transition: scrollbar-color 480ms 480ms ease-in;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
:host([enforce-scroll]) {
|
|
@@ -42,8 +42,8 @@ _UUIScrollContainerElement.styles = [
|
|
|
42
42
|
:host(:hover),
|
|
43
43
|
:host(:focus),
|
|
44
44
|
:host(:focus-within) {
|
|
45
|
-
scrollbar-color: var(--uui-color-disabled-
|
|
46
|
-
transition: scrollbar-color
|
|
45
|
+
scrollbar-color: var(--uui-color-disabled-standalone) transparent;
|
|
46
|
+
transition: scrollbar-color 120ms ease-out;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
:host::-webkit-scrollbar {
|
|
@@ -65,7 +65,7 @@ _UUIScrollContainerElement.styles = [
|
|
|
65
65
|
:host(:hover)::-webkit-scrollbar-thumb,
|
|
66
66
|
:host(:focus)::-webkit-scrollbar-thumb,
|
|
67
67
|
:host(:focus-within)::-webkit-scrollbar-thumb {
|
|
68
|
-
background-color: var(--uui-color-disabled-
|
|
68
|
+
background-color: var(--uui-color-disabled-standalone);
|
|
69
69
|
}
|
|
70
70
|
`
|
|
71
71
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-container.element.js","sources":["../../../src/components/scroll-container/scroll-container.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * @element uui-scroll-container\n * @slot - for content\n * @attribute enforce-scroll - forces the scrollbar to appear\n * @description - Component for displaying a larger amount of .\n *\n */\nexport class UUIScrollContainerElement extends LitElement {\n /**\n * @type {boolean}\n * @attr forces the scrollbar to appear\n */\n @property({ type: Boolean, reflect: true, attribute: 'enforce-scroll' })\n enforceScroll = false;\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: block;\n overflow-y: auto;\n overflow-y: overlay;\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n transition: scrollbar-color
|
|
1
|
+
{"version":3,"file":"scroll-container.element.js","sources":["../../../src/components/scroll-container/scroll-container.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * @element uui-scroll-container\n * @slot - for content\n * @attribute enforce-scroll - forces the scrollbar to appear\n * @description - Component for displaying a larger amount of .\n *\n */\nexport class UUIScrollContainerElement extends LitElement {\n /**\n * @type {boolean}\n * @attr forces the scrollbar to appear\n */\n @property({ type: Boolean, reflect: true, attribute: 'enforce-scroll' })\n enforceScroll = false;\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: block;\n overflow-y: auto;\n overflow-y: overlay;\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n transition: scrollbar-color 480ms 480ms ease-in;\n }\n\n :host([enforce-scroll]) {\n overflow-y: scroll;\n }\n :host([enforce-scroll]),\n :host(:hover),\n :host(:focus),\n :host(:focus-within) {\n scrollbar-color: var(--uui-color-disabled-standalone) transparent;\n transition: scrollbar-color 120ms ease-out;\n }\n\n :host::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n\n :host::-webkit-scrollbar-track {\n background: transparent;\n border-radius: 3px;\n }\n\n :host::-webkit-scrollbar-thumb {\n background-color: transparent;\n border-radius: 3px;\n }\n\n :host([enforce-scroll])::-webkit-scrollbar-thumb,\n :host(:hover)::-webkit-scrollbar-thumb,\n :host(:focus)::-webkit-scrollbar-thumb,\n :host(:focus-within)::-webkit-scrollbar-thumb {\n background-color: var(--uui-color-disabled-standalone);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAUO,MAAM,6BAAN,MAAM,mCAAkC,WAAW;AAAA,EAAnD,cAAA;AAAA,UAAA,GAAA,SAAA;AAML,SAAA,gBAAgB;AAAA,EAAA;AAAA,EAEhB,oBAAoB;AAClB,UAAM,kBAAA;AACN,QAAI,CAAC,KAAK,aAAa,UAAU,GAAG;AAClC,WAAK,aAAa,YAAY,GAAG;AAAA,IACnC;AAAA,EACF;AAAA,EACA,SAAS;AACP,WAAO;AAAA,EACT;AA+CF;AA7CE,2BAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAnBG,IAAM,4BAAN;AAML,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,kBAAkB;AAAA,GAL5D,0BAMX,WAAA,eAAA;"}
|
|
@@ -38,7 +38,7 @@ _UUISymbolExpandElement.styles = [
|
|
|
38
38
|
svg {
|
|
39
39
|
transform: rotate(-90deg);
|
|
40
40
|
transform-origin: 50% 50%;
|
|
41
|
-
transition: transform
|
|
41
|
+
transition: transform 240ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-expand.element.js","sources":["../../../src/components/symbol-expand/symbol-expand.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * A symbol indicating whether related composition is expanded or collapsed\n * @element uui-symbol-expand\n */\nexport class UUISymbolExpandElement extends LitElement {\n /**\n * Set this boolean to true for a open/expanded look.\n * @type {boolean}\n * @default false\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n render() {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"m4 9 8 8 8-8\"></path>\n </svg>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: inline-flex;\n width: 12px;\n vertical-align: middle;\n }\n\n svg {\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: transform
|
|
1
|
+
{"version":3,"file":"symbol-expand.element.js","sources":["../../../src/components/symbol-expand/symbol-expand.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * A symbol indicating whether related composition is expanded or collapsed\n * @element uui-symbol-expand\n */\nexport class UUISymbolExpandElement extends LitElement {\n /**\n * Set this boolean to true for a open/expanded look.\n * @type {boolean}\n * @default false\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n render() {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"m4 9 8 8 8-8\"></path>\n </svg>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: inline-flex;\n width: 12px;\n vertical-align: middle;\n }\n\n svg {\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: transform 240ms cubic-bezier(0.175, 0.885, 0.32, 1.275);\n width: 100%;\n height: 100%;\n }\n\n :host([open]) svg {\n transform: rotate(0deg);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAOO,MAAM,0BAAN,MAAM,gCAA+B,WAAW;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AAQL,SAAO,OAAO;AAAA,EAAA;AAAA,EAEd,SAAS;AACP,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUT;AAuBF;AArBE,wBAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAxBG,IAAM,yBAAN;AAQE,gBAAA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAP/B,uBAQJ,WAAA,MAAA;"}
|
|
@@ -8,8 +8,40 @@ var _UUISymbolFileThumbnailElement_instances, onImageError_fn;
|
|
|
8
8
|
import { LitElement, html, css } from "lit";
|
|
9
9
|
import { property, state } from "lit/decorators.js";
|
|
10
10
|
import { when } from "lit/directives/when.js";
|
|
11
|
-
import "../icon/
|
|
11
|
+
import "../icon-registry-essential/svgs/iconAdd.js";
|
|
12
|
+
import "../icon-registry-essential/svgs/iconAlert.js";
|
|
13
|
+
import "../icon-registry-essential/svgs/iconAttachment.js";
|
|
14
|
+
import "../icon-registry-essential/svgs/iconCalendar.js";
|
|
15
|
+
import "../icon-registry-essential/svgs/iconCheck.js";
|
|
16
|
+
import "../icon-registry-essential/svgs/iconClipboard.js";
|
|
17
|
+
import "../icon-registry-essential/svgs/iconCode.js";
|
|
18
|
+
import "../icon-registry-essential/svgs/iconColorPicker.js";
|
|
19
|
+
import "../icon-registry-essential/svgs/iconCopy.js";
|
|
20
|
+
import "../icon-registry-essential/svgs/iconDelete.js";
|
|
21
|
+
import "../icon-registry-essential/svgs/iconDocument.js";
|
|
22
|
+
import "../icon-registry-essential/svgs/iconDownload.js";
|
|
23
|
+
import "../icon-registry-essential/svgs/iconDrag.js";
|
|
24
|
+
import "../icon-registry-essential/svgs/iconEdit.js";
|
|
25
|
+
import "../icon-registry-essential/svgs/iconFavorite.js";
|
|
26
|
+
import "../icon-registry-essential/svgs/iconFolder.js";
|
|
27
|
+
import "../icon-registry-essential/svgs/iconForbidden.js";
|
|
28
|
+
import "../icon-registry-essential/svgs/iconInfo.js";
|
|
29
|
+
import "../icon-registry-essential/svgs/iconLink.js";
|
|
30
|
+
import "../icon-registry-essential/svgs/iconLock.js";
|
|
31
|
+
import "../icon-registry-essential/svgs/iconPause.js";
|
|
12
32
|
import { iconPicture } from "../icon-registry-essential/svgs/iconPicture.js";
|
|
33
|
+
import "../icon-registry-essential/svgs/iconPlay.js";
|
|
34
|
+
import "../icon-registry-essential/svgs/iconRemove.js";
|
|
35
|
+
import "../icon-registry-essential/svgs/iconSearch.js";
|
|
36
|
+
import "../icon-registry-essential/svgs/iconSee.js";
|
|
37
|
+
import "../icon-registry-essential/svgs/iconSettings.js";
|
|
38
|
+
import "../icon-registry-essential/svgs/iconSubtract.js";
|
|
39
|
+
import "../icon-registry-essential/svgs/iconSync.js";
|
|
40
|
+
import "../icon-registry-essential/svgs/iconUnlock.js";
|
|
41
|
+
import "../icon-registry-essential/svgs/iconUnsee.js";
|
|
42
|
+
import "../icon-registry-essential/svgs/iconWand.js";
|
|
43
|
+
import "../icon-registry-essential/svgs/iconWrong.js";
|
|
44
|
+
import "../icon/icon.js";
|
|
13
45
|
var __defProp = Object.defineProperty;
|
|
14
46
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
47
|
var result = void 0;
|
|
@@ -36,6 +68,7 @@ const _UUISymbolFileThumbnailElement = class _UUISymbolFileThumbnailElement exte
|
|
|
36
68
|
return when(
|
|
37
69
|
this.src && !this._imageError,
|
|
38
70
|
() => html`<img
|
|
71
|
+
decoding="async"
|
|
39
72
|
src=${this.src}
|
|
40
73
|
alt=${this.alt}
|
|
41
74
|
@error=${__privateMethod(this, _UUISymbolFileThumbnailElement_instances, onImageError_fn)} />`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-file-thumbnail.element.js","sources":["../../../src/components/symbol-file-thumbnail/symbol-file-thumbnail.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\n\nimport { iconPicture } from '../icon-registry-essential/svgs/index.js';\n\nimport '../icon/icon.js';\n\n/**\n * @element uui-symbol-file-thumbnail\n * @description - Symbol to display a thumbnail.\n */\nexport class UUISymbolFileThumbnailElement extends LitElement {\n /**\n * Source of the thumbnail.\n * @type {string}\n * @attr\n * @default ''\n */\n @property({ type: String })\n src: string = '';\n\n /**\n * Alt of the thumbnail.\n * @type {string}\n * @attr\n * @default ''\n */\n @property({ type: String })\n alt: string = '';\n\n @state()\n private _imageError = false;\n\n protected override willUpdate(changed: Map<string, unknown>) {\n if (changed.has('src')) {\n this._imageError = false;\n }\n }\n\n render() {\n return when(\n this.src && !this._imageError,\n () =>\n html`<img\n src=${this.src}\n alt=${this.alt}\n @error=${this.#onImageError} />`,\n () =>\n html`<uui-icon\n name=\"picture\"\n .fallback=${iconPicture.strings[0]}></uui-icon>`,\n );\n }\n\n #onImageError() {\n this._imageError = true;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n img {\n object-fit: contain;\n height: 100%;\n width: 100%;\n }\n\n uui-icon {\n width: 100%;\n height: 100%;\n max-width: 100%;\n display: flex;\n max-height: 100%;\n justify-content: center;\n color: var(--uui-color-surface);\n background: var(--uui-color-surface-alt);\n }\n `,\n ];\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"symbol-file-thumbnail.element.js","sources":["../../../src/components/symbol-file-thumbnail/symbol-file-thumbnail.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\n\nimport { iconPicture } from '../icon-registry-essential/svgs/index.js';\n\nimport '../icon/icon.js';\n\n/**\n * @element uui-symbol-file-thumbnail\n * @description - Symbol to display a thumbnail.\n */\nexport class UUISymbolFileThumbnailElement extends LitElement {\n /**\n * Source of the thumbnail.\n * @type {string}\n * @attr\n * @default ''\n */\n @property({ type: String })\n src: string = '';\n\n /**\n * Alt of the thumbnail.\n * @type {string}\n * @attr\n * @default ''\n */\n @property({ type: String })\n alt: string = '';\n\n @state()\n private _imageError = false;\n\n protected override willUpdate(changed: Map<string, unknown>) {\n if (changed.has('src')) {\n this._imageError = false;\n }\n }\n\n render() {\n return when(\n this.src && !this._imageError,\n () =>\n html`<img\n decoding=\"async\"\n src=${this.src}\n alt=${this.alt}\n @error=${this.#onImageError} />`,\n () =>\n html`<uui-icon\n name=\"picture\"\n .fallback=${iconPicture.strings[0]}></uui-icon>`,\n );\n }\n\n #onImageError() {\n this._imageError = true;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n img {\n object-fit: contain;\n height: 100%;\n width: 100%;\n }\n\n uui-icon {\n width: 100%;\n height: 100%;\n max-width: 100%;\n display: flex;\n max-height: 100%;\n justify-content: center;\n color: var(--uui-color-surface);\n background: var(--uui-color-surface-alt);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,MAAM,iCAAN,MAAM,uCAAsC,WAAW;AAAA,EAAvD,cAAA;AAAA,UAAA,GAAA,SAAA;AAAA;AAQL,SAAA,MAAc;AASd,SAAA,MAAc;AAGd,SAAQ,cAAc;AAAA,EAAA;AAAA,EAEH,WAAW,SAA+B;AAC3D,QAAI,QAAQ,IAAI,KAAK,GAAG;AACtB,WAAK,cAAc;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,MACL,KAAK,OAAO,CAAC,KAAK;AAAA,MAClB,MACE;AAAA;AAAA,gBAEQ,KAAK,GAAG;AAAA,gBACR,KAAK,GAAG;AAAA,mBACL,sBAAK,0DAAa;AAAA,MAC/B,MACE;AAAA;AAAA,sBAEc,YAAY,QAAQ,CAAC,CAAC;AAAA,IAAA;AAAA,EAE1C;AAgCF;AA1EO;AA4CL,kBAAA,WAAgB;AACd,OAAK,cAAc;AACrB;AAEA,+BAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAjDG,IAAM,gCAAN;AAQL,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAPf,8BAQX,WAAA,KAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAhBf,8BAiBX,WAAA,KAAA;AAGQ,gBAAA;AAAA,EADP,MAAA;AAAM,GAnBI,8BAoBH,WAAA,aAAA;"}
|
|
@@ -11,8 +11,12 @@ const _UUITableHeadElement = class _UUITableHeadElement extends LitElement {
|
|
|
11
11
|
_UUITableHeadElement.styles = [
|
|
12
12
|
css`
|
|
13
13
|
:host {
|
|
14
|
+
position: sticky;
|
|
14
15
|
display: table-header-group;
|
|
15
16
|
font-weight: bold;
|
|
17
|
+
top: 0;
|
|
18
|
+
z-index: 1;
|
|
19
|
+
background-color: var(--uui-color-surface, #fff);
|
|
16
20
|
}
|
|
17
21
|
`
|
|
18
22
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-head.element.js","sources":["../../../src/components/table/table-head.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\n\n/**\n * Table head element. Holds the styles for table head. Parent to uui-table-head-cell.\n * @element uui-table-head\n * @slot - slot for uui-table-head-cell elements.\n */\nexport class UUITableHeadElement extends LitElement {\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'row');\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: table-header-group;\n font-weight: bold;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";AAOO,MAAM,uBAAN,MAAM,6BAA4B,WAAW;AAAA,EAClD,oBAAoB;AAClB,UAAM,kBAAA;AACN,SAAK,aAAa,QAAQ,KAAK;AAAA,EACjC;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;
|
|
1
|
+
{"version":3,"file":"table-head.element.js","sources":["../../../src/components/table/table-head.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\n\n/**\n * Table head element. Holds the styles for table head. Parent to uui-table-head-cell.\n * @element uui-table-head\n * @slot - slot for uui-table-head-cell elements.\n */\nexport class UUITableHeadElement extends LitElement {\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'row');\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n position: sticky;\n display: table-header-group;\n font-weight: bold;\n top: 0;\n z-index: 1;\n background-color: var(--uui-color-surface, #fff);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";AAOO,MAAM,uBAAN,MAAM,6BAA4B,WAAW;AAAA,EAClD,oBAAoB;AAClB,UAAM,kBAAA;AACN,SAAK,aAAa,QAAQ,KAAK;AAAA,EACjC;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AAcF;AAZE,qBAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAXG,IAAM,sBAAN;"}
|
|
@@ -14,9 +14,13 @@ _UUITableElement.styles = [
|
|
|
14
14
|
:host {
|
|
15
15
|
display: table;
|
|
16
16
|
width: 100%;
|
|
17
|
-
border-radius: var(--uui-border-radius);
|
|
18
17
|
background-color: var(--uui-color-surface);
|
|
19
18
|
cursor: default;
|
|
19
|
+
|
|
20
|
+
border-radius: var(--uui-border-radius-3);
|
|
21
|
+
border-width: var(--uui-box-border-width, 1px);
|
|
22
|
+
border-style: solid;
|
|
23
|
+
border-color: var(--uui-color-divider-standalone);
|
|
20
24
|
}
|
|
21
25
|
`
|
|
22
26
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.element.js","sources":["../../../src/components/table/table.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\n\n/**\n * Recreation of native table and it's child elements. `<uui-table>` is a parent element to `<uui-table-head>` `<and uui-table-row>`. To make it fully accessible remember to add aria-label and aria-describedby.\n * @element uui-table\n * @slot - slot for `<uui-table-head>` and `<uui-table-row>` elements. Make a table out of them.\n */\nexport class UUITableElement extends LitElement {\n /* consider select-only attribute on this level? */\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'table');\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: table;\n width: 100%;\n border-radius: var(--uui-border-radius);\n
|
|
1
|
+
{"version":3,"file":"table.element.js","sources":["../../../src/components/table/table.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\n\n/**\n * Recreation of native table and it's child elements. `<uui-table>` is a parent element to `<uui-table-head>` `<and uui-table-row>`. To make it fully accessible remember to add aria-label and aria-describedby.\n * @element uui-table\n * @slot - slot for `<uui-table-head>` and `<uui-table-row>` elements. Make a table out of them.\n */\nexport class UUITableElement extends LitElement {\n /* consider select-only attribute on this level? */\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'table');\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: table;\n width: 100%;\n background-color: var(--uui-color-surface);\n cursor: default;\n\n border-radius: var(--uui-border-radius-3);\n border-width: var(--uui-box-border-width, 1px);\n border-style: solid;\n border-color: var(--uui-color-divider-standalone);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";AAOO,MAAM,mBAAN,MAAM,yBAAwB,WAAW;AAAA;AAAA,EAG9C,oBAAoB;AAClB,UAAM,kBAAA;AACN,SAAK,aAAa,QAAQ,OAAO;AAAA,EACnC;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AAiBF;AAfE,iBAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAbG,IAAM,kBAAN;"}
|
|
@@ -70,17 +70,18 @@ _UUITagElement.styles = [
|
|
|
70
70
|
:host {
|
|
71
71
|
background-color: var(--uui-color-surface);
|
|
72
72
|
color: var(--color-standalone);
|
|
73
|
-
border-color: transparent;
|
|
74
73
|
}
|
|
75
74
|
:host([look='primary']) {
|
|
76
75
|
background-color: var(--color);
|
|
77
76
|
color: var(--color-contrast);
|
|
78
|
-
border-color: transparent;
|
|
79
77
|
}
|
|
80
78
|
:host([look='secondary']) {
|
|
81
79
|
background-color: var(--uui-color-surface-alt);
|
|
82
80
|
color: var(--color-standalone);
|
|
83
|
-
border-color:
|
|
81
|
+
border-color: var(
|
|
82
|
+
--uui-tag-border-color,
|
|
83
|
+
var(--uui-color-divider-standalone)
|
|
84
|
+
);
|
|
84
85
|
}
|
|
85
86
|
:host([look='outline']) {
|
|
86
87
|
background-color: transparent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.element.js","sources":["../../../src/components/tag/tag.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type {\n UUIInterfaceColor,\n UUIInterfaceLook,\n} from '../../internal/types/index.js';\n\n/**\n *\n * @element uui-tag\n * @description Tag component from Umbraco UI components library. Comes in one shape, but different looks and sizes\n * @slot - slot for tag contents\n * @cssprop --uui-tag-font-size - overwrite the default font-size for the tag.\n * @cssprop --uui-tag-padding - overwrite the default padding size for the tag.\n * @cssprop --uui-tag-border-radius - overwrite the default border-radius for the tag.\n * @cssprop --uui-tag-border-color - overwrite the default border color for the tag.\n */\n\nexport class UUITagElement extends LitElement {\n /**\n * Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green \"confirm\" button.\n * @type {\"default\" | \"positive\" | \"warning\" | \"danger\"}\n * @attr\n * @default \"default\"\n */\n @property({ reflect: true })\n color: UUIInterfaceColor = 'default';\n\n /**\n * Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green \"confirm\" button.\n * @type {\"default\" | \"primary\" | \"secondary\" | \"outline\" | \"placeholder\"}\n * @attr\n * @default \"default\"\n */\n @property({ reflect: true })\n look: UUIInterfaceLook = 'primary';\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: inline-block;\n font-size: var(--uui-tag-font-size, var(--uui-type-small-size));\n font-weight: 700;\n line-height: 1;\n padding: var(\n --uui-tag-padding,\n var(--uui-size-space-1) calc(var(--uui-size-space-1) + 0.5em)\n );\n user-select: none;\n border-radius: var(--uui-tag-border-radius, var(--uui-size-4));\n border: 1px solid var(--uui-tag-border-color, transparent);\n }\n\n slot {\n display: block;\n align-content: center;\n margin: 2px;\n }\n\n :host {\n --color: var(--uui-color-default);\n --color-standalone: var(--uui-color-default-standalone);\n --color-contrast: var(--uui-color-default-contrast);\n }\n :host([color='positive']) {\n --color: var(--uui-color-positive);\n --color-standalone: var(--uui-color-positive-standalone);\n --color-contrast: var(--uui-color-positive-contrast);\n }\n :host([color='warning']) {\n --color: var(--uui-color-warning);\n --color-standalone: var(--uui-color-warning-standalone);\n --color-contrast: var(--uui-color-warning-contrast);\n }\n :host([color='danger']) {\n --color: var(--uui-color-danger);\n --color-standalone: var(--uui-color-danger-standalone);\n --color-contrast: var(--uui-color-danger-contrast);\n }\n :host([color='invalid']) {\n --color: var(--uui-color-invalid);\n --color-standalone: var(--uui-color-invalid-standalone);\n --color-contrast: var(--uui-color-invalid-contrast);\n }\n\n :host {\n background-color: var(--uui-color-surface);\n color: var(--color-standalone);\n
|
|
1
|
+
{"version":3,"file":"tag.element.js","sources":["../../../src/components/tag/tag.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type {\n UUIInterfaceColor,\n UUIInterfaceLook,\n} from '../../internal/types/index.js';\n\n/**\n *\n * @element uui-tag\n * @description Tag component from Umbraco UI components library. Comes in one shape, but different looks and sizes\n * @slot - slot for tag contents\n * @cssprop --uui-tag-font-size - overwrite the default font-size for the tag.\n * @cssprop --uui-tag-padding - overwrite the default padding size for the tag.\n * @cssprop --uui-tag-border-radius - overwrite the default border-radius for the tag.\n * @cssprop --uui-tag-border-color - overwrite the default border color for the tag.\n */\n\nexport class UUITagElement extends LitElement {\n /**\n * Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green \"confirm\" button.\n * @type {\"default\" | \"positive\" | \"warning\" | \"danger\"}\n * @attr\n * @default \"default\"\n */\n @property({ reflect: true })\n color: UUIInterfaceColor = 'default';\n\n /**\n * Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green \"confirm\" button.\n * @type {\"default\" | \"primary\" | \"secondary\" | \"outline\" | \"placeholder\"}\n * @attr\n * @default \"default\"\n */\n @property({ reflect: true })\n look: UUIInterfaceLook = 'primary';\n\n render() {\n return html`<slot></slot>`;\n }\n\n static override readonly styles = [\n css`\n :host {\n display: inline-block;\n font-size: var(--uui-tag-font-size, var(--uui-type-small-size));\n font-weight: 700;\n line-height: 1;\n padding: var(\n --uui-tag-padding,\n var(--uui-size-space-1) calc(var(--uui-size-space-1) + 0.5em)\n );\n user-select: none;\n border-radius: var(--uui-tag-border-radius, var(--uui-size-4));\n border: 1px solid var(--uui-tag-border-color, transparent);\n }\n\n slot {\n display: block;\n align-content: center;\n margin: 2px;\n }\n\n :host {\n --color: var(--uui-color-default);\n --color-standalone: var(--uui-color-default-standalone);\n --color-contrast: var(--uui-color-default-contrast);\n }\n :host([color='positive']) {\n --color: var(--uui-color-positive);\n --color-standalone: var(--uui-color-positive-standalone);\n --color-contrast: var(--uui-color-positive-contrast);\n }\n :host([color='warning']) {\n --color: var(--uui-color-warning);\n --color-standalone: var(--uui-color-warning-standalone);\n --color-contrast: var(--uui-color-warning-contrast);\n }\n :host([color='danger']) {\n --color: var(--uui-color-danger);\n --color-standalone: var(--uui-color-danger-standalone);\n --color-contrast: var(--uui-color-danger-contrast);\n }\n :host([color='invalid']) {\n --color: var(--uui-color-invalid);\n --color-standalone: var(--uui-color-invalid-standalone);\n --color-contrast: var(--uui-color-invalid-contrast);\n }\n\n :host {\n background-color: var(--uui-color-surface);\n color: var(--color-standalone);\n }\n :host([look='primary']) {\n background-color: var(--color);\n color: var(--color-contrast);\n }\n :host([look='secondary']) {\n background-color: var(--uui-color-surface-alt);\n color: var(--color-standalone);\n border-color: var(\n --uui-tag-border-color,\n var(--uui-color-divider-standalone)\n );\n }\n :host([look='outline']) {\n background-color: transparent;\n color: var(--color-standalone);\n border-color: var(--color-standalone);\n }\n :host([look='placeholder']) {\n border-style: dashed;\n background-color: transparent;\n color: var(--color-standalone);\n border-color: var(--uui-color-border-standalone);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkBO,MAAM,iBAAN,MAAM,uBAAsB,WAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AAQL,SAAA,QAA2B;AAS3B,SAAA,OAAyB;AAAA,EAAA;AAAA,EAEzB,SAAS;AACP,WAAO;AAAA,EACT;AA+EF;AA7EE,eAAyB,SAAS;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAxBG,IAAM,gBAAN;AAQL,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAPhB,cAQX,WAAA,OAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAhBhB,cAiBX,WAAA,MAAA;"}
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
+
import "../icon-registry-essential/svgs/iconAdd.js";
|
|
2
|
+
import "../icon-registry-essential/svgs/iconAlert.js";
|
|
3
|
+
import "../icon-registry-essential/svgs/iconAttachment.js";
|
|
4
|
+
import "../icon-registry-essential/svgs/iconCalendar.js";
|
|
5
|
+
import "../icon-registry-essential/svgs/iconCheck.js";
|
|
6
|
+
import "../icon-registry-essential/svgs/iconClipboard.js";
|
|
7
|
+
import "../icon-registry-essential/svgs/iconCode.js";
|
|
8
|
+
import "../icon-registry-essential/svgs/iconColorPicker.js";
|
|
9
|
+
import "../icon-registry-essential/svgs/iconCopy.js";
|
|
10
|
+
import "../icon-registry-essential/svgs/iconDelete.js";
|
|
11
|
+
import "../icon-registry-essential/svgs/iconDocument.js";
|
|
12
|
+
import "../icon-registry-essential/svgs/iconDownload.js";
|
|
13
|
+
import "../icon-registry-essential/svgs/iconDrag.js";
|
|
14
|
+
import "../icon-registry-essential/svgs/iconEdit.js";
|
|
15
|
+
import "../icon-registry-essential/svgs/iconFavorite.js";
|
|
16
|
+
import "../icon-registry-essential/svgs/iconFolder.js";
|
|
17
|
+
import "../icon-registry-essential/svgs/iconForbidden.js";
|
|
18
|
+
import "../icon-registry-essential/svgs/iconInfo.js";
|
|
19
|
+
import "../icon-registry-essential/svgs/iconLink.js";
|
|
20
|
+
import "../icon-registry-essential/svgs/iconLock.js";
|
|
21
|
+
import "../icon-registry-essential/svgs/iconPause.js";
|
|
22
|
+
import "../icon-registry-essential/svgs/iconPicture.js";
|
|
23
|
+
import "../icon-registry-essential/svgs/iconPlay.js";
|
|
24
|
+
import { iconRemove } from "../icon-registry-essential/svgs/iconRemove.js";
|
|
25
|
+
import "../icon-registry-essential/svgs/iconSearch.js";
|
|
26
|
+
import "../icon-registry-essential/svgs/iconSee.js";
|
|
27
|
+
import "../icon-registry-essential/svgs/iconSettings.js";
|
|
28
|
+
import "../icon-registry-essential/svgs/iconSubtract.js";
|
|
29
|
+
import "../icon-registry-essential/svgs/iconSync.js";
|
|
30
|
+
import "../icon-registry-essential/svgs/iconUnlock.js";
|
|
31
|
+
import "../icon-registry-essential/svgs/iconUnsee.js";
|
|
32
|
+
import "../icon-registry-essential/svgs/iconWand.js";
|
|
33
|
+
import "../icon-registry-essential/svgs/iconWrong.js";
|
|
1
34
|
import { LitElement, html, css } from "lit";
|
|
2
35
|
import { property, query, state } from "lit/decorators.js";
|
|
3
36
|
import { UUIToastNotificationEvent } from "./UUIToastNotificationEvent.js";
|
|
4
37
|
import "../button/button.js";
|
|
5
38
|
import "../icon/icon.js";
|
|
6
39
|
import { UUITimer } from "../../internal/utils/Timer.js";
|
|
7
|
-
import { iconRemove } from "../icon-registry-essential/svgs/iconRemove.js";
|
|
8
40
|
import { UUITextStyles } from "../../styles/uui-text.styles.js";
|
|
9
41
|
var __defProp = Object.defineProperty;
|
|
10
42
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -230,7 +262,7 @@ _UUIToastNotificationElement.styles = [
|
|
|
230
262
|
display: block;
|
|
231
263
|
|
|
232
264
|
box-sizing: border-box;
|
|
233
|
-
box-shadow: var(--uui-shadow-depth-
|
|
265
|
+
box-shadow: var(--uui-shadow-depth-3);
|
|
234
266
|
background-color: var(--uui-color-surface);
|
|
235
267
|
padding: var(--uui-size-layout-1);
|
|
236
268
|
padding-right: var(--uui-size-layout-1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-notification.element.js","sources":["../../../src/components/toast-notification/toast-notification.element.ts"],"sourcesContent":["import { UUITimer } from '../../internal/utils/index.js';\nimport { UUITextStyles } from '../../styles/index.js';\nimport { iconRemove } from '../icon-registry-essential/svgs/index.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\n\nimport { UUIToastNotificationEvent } from './UUIToastNotificationEvent.js';\nimport type { UUIInterfaceColor } from '../../internal/index.js';\n\nimport '../button/button.js';\nimport '../icon/icon.js';\n\n/**\n * @element uui-toast-notification\n * @fires {UUIToastNotificationEvent} opening - fires when the toast is starting to open\n * @fires {UUIToastNotificationEvent} opened - fires when the toast is open after the open-animation\n * @fires {UUIToastNotificationEvent} closing - fires when the toast is starting to close\n * @fires {UUIToastNotificationEvent} closed - fires when the toast is closed\n * @description - Component for displaying a toast notification, preferably used in toast-notification-container.\n * @slot - slot for dialog layout/content\n */\nexport class UUIToastNotificationElement extends LitElement {\n /**\n * Changes the color of the notification to one of the predefined, symbolic colors. Example: set this to danger to indicate errors.\n * @type {UUIInterfaceColor}\n * @attr\n * @default \"\"\n */\n @property({ reflect: true })\n color: UUIInterfaceColor = '';\n\n private _autoClose: number | null = null;\n /**\n * Set an auto-close timer.\n * @type number\n * @attr\n * @default null\n */\n @property({ type: Number })\n public get autoClose(): number | null {\n return this._autoClose;\n }\n public set autoClose(value: number | null) {\n this._autoClose = value;\n if (value === null) {\n this._timer?.destroy();\n this._timer = null;\n } else {\n if (this._timer === null) {\n this._timer = new UUITimer(this._onOpenTimerComplete, value);\n } else {\n this._timer.setDuration(value);\n }\n if (\n this._pauseTimer === false &&\n this.isOpen === true &&\n this._animate === false\n ) {\n this._timer.start();\n }\n }\n }\n\n /**\n * Pause the auto close timer.\n */\n public pauseAutoClose() {\n this._pauseTimer = true;\n if (this._timer !== null) {\n this._timer.pause();\n }\n }\n /**\n * Resume the auto close timer.\n */\n public resumeAutoClose() {\n this._pauseTimer = false;\n if (\n this._timer !== null &&\n this.isOpen === true &&\n this._animate === false\n ) {\n this._timer.restart();\n }\n }\n\n private readonly _onOpenTimerComplete = () => {\n if (this._open) {\n this.open = false;\n }\n };\n\n @query('#toast')\n private readonly _toastEl!: HTMLElement;\n private _timer: UUITimer | null = null;\n private _pauseTimer: boolean = false;\n\n protected isOpen = false;\n private _open = false;\n\n @state()\n private _animate = false;\n private _animationTimeout?: number;\n\n /**\n * define if this toast should open or close.\n * @type boolean\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public get open() {\n return this._open;\n }\n public set open(value: boolean) {\n if (value === true) {\n this._makeOpen();\n } else {\n this._makeClose();\n }\n }\n\n constructor() {\n super();\n this.addEventListener('keyup', (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.open = false;\n }\n });\n }\n\n private _getAnimationDuration(): number {\n return (\n Number.parseInt(\n getComputedStyle(this).getPropertyValue(\n '--uui-toast-notification-animation-duration',\n ),\n 10,\n ) || 480\n );\n }\n\n private _requestAnimationUpdate = 0;\n private _makeOpen() {\n if (this._open === true) {\n return;\n }\n this._open = true;\n this.updateComplete.then(() => {\n if (this._open !== true) {\n return;\n }\n cancelAnimationFrame(this._requestAnimationUpdate);\n this._requestAnimationUpdate = requestAnimationFrame(() => {\n clearTimeout(this._animationTimeout as number);\n this.isOpen = true;\n this.setAttribute('is-open', '');\n\n this.style.height = this._toastEl.getBoundingClientRect().height + 'px';\n this._animate = true;\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENING),\n );\n\n this._animationTimeout = globalThis.setTimeout(() => {\n if (this.isOpen === true) {\n this.style.height = 'auto';\n this._animate = false;\n if (this._pauseTimer === false) {\n this._timer?.start();\n }\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENED),\n );\n }\n }, this._getAnimationDuration());\n });\n });\n }\n private _makeClose() {\n if (this._open === false) {\n return;\n }\n\n const event = new UUIToastNotificationEvent(\n UUIToastNotificationEvent.CLOSING,\n { cancelable: true },\n );\n this.dispatchEvent(event);\n\n if (event.defaultPrevented === true) {\n return;\n }\n\n this._open = false;\n this._timer?.pause();\n cancelAnimationFrame(this._requestAnimationUpdate); // do cancel though isOpen wasn't set jet.\n if (this.isOpen === true) {\n this._requestAnimationUpdate = requestAnimationFrame(() => {\n clearTimeout(this._animationTimeout as number);\n this.isOpen = false;\n this.removeAttribute('is-open');\n\n this.style.height = this._toastEl.getBoundingClientRect().height + 'px';\n this._animate = true;\n\n requestAnimationFrame(() => {\n // Dont overwrite the height instantly, but instead wait one frame to ensure animate is set before setting the goal of the animation.\n this.style.height = '0';\n });\n\n this._animationTimeout = globalThis.setTimeout(() => {\n if (this.isOpen === false) {\n this._animate = false;\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.CLOSED),\n );\n this.remove();\n }\n }, this._getAnimationDuration());\n });\n }\n }\n\n render() {\n return html`\n <div id=\"toast\" class=${this._animate ? 'animate' : ''}>\n <div>\n <div id=\"close\">\n <uui-button\n .label=${'close'}\n .color=${this.color}\n .look=${this.color ? 'primary' : 'default'}\n @click=${() => (this.open = false)}>\n <uui-icon\n name=\"remove\"\n .fallback=${iconRemove.strings[0]}></uui-icon>\n </uui-button>\n </div>\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n static override readonly styles = [\n UUITextStyles,\n css`\n :host {\n --uui-toast-notification-margin: var(--uui-size-space-2);\n\n position: relative;\n display: block;\n width: 100%;\n max-width: 400px;\n margin: 0 var(--uui-toast-notification-margin);\n box-sizing: border-box;\n\n height: 0;\n pointer-events: none;\n\n transition: height\n var(--uui-toast-notification-animation-duration, 480ms) ease-in-out;\n }\n :host([is-open]) {\n pointer-events: all;\n transition-timing-function: cubic-bezier(\n 0.19,\n 1,\n 0.22,\n 1\n ); /* easeOutExpo */\n }\n\n #toast {\n position: relative;\n display: block;\n padding: calc(var(--uui-toast-notification-margin) * 0.5) 0;\n width: 100%;\n max-width: 400px;\n }\n #toast.animate {\n position: absolute;\n }\n\n #toast > div {\n position: relative;\n display: block;\n\n box-sizing: border-box;\n box-shadow: var(--uui-shadow-depth-1);\n background-color: var(--uui-color-surface);\n padding: var(--uui-size-layout-1);\n padding-right: var(--uui-size-layout-1);\n padding-left: var(--uui-size-layout-3);\n border-radius: var(--uui-border-radius-3);\n\n opacity: 0;\n transition: opacity\n var(--uui-toast-notification-animation-duration, 480ms);\n }\n :host([is-open]) #toast > div {\n opacity: 1;\n }\n\n #close {\n float: right;\n margin-top: -6px;\n margin-left: var(--uui-size-space-1);\n margin-bottom: -4px;\n }\n\n #close > uui-button {\n --uui-button-border-radius: 50px 50px 50px 50px;\n --uui-button-padding-left-factor: 1.5;\n --uui-button-padding-right-factor: 1.5;\n }\n\n :host #toast > div {\n background-color: var(--uui-color-surface);\n color: var(--uui-color-text);\n border-color: var(--uui-color-surface);\n }\n :host([color='default']) #toast > div {\n background-color: var(--uui-color-default);\n color: var(--uui-color-default-contrast);\n border-color: var(--uui-color-default-standalone);\n }\n :host([color='positive']) #toast > div {\n background-color: var(--uui-color-positive);\n color: var(--uui-color-positive-contrast);\n border-color: var(--uui-color-positive-standalone);\n }\n :host([color='warning']) #toast > div {\n background-color: var(--uui-color-warning);\n color: var(--uui-color-warning-contrast);\n border-color: var(--uui-color-warning-standalone);\n }\n :host([color='danger']) #toast > div {\n background-color: var(--uui-color-danger);\n color: var(--uui-color-danger-contrast);\n border-color: var(--uui-color-danger-standalone);\n }\n :host([color='invalid']) #toast > div {\n background-color: var(--uui-color-invalid);\n color: var(--uui-color-invalid-contrast);\n border-color: var(--uui-color-invalid-standalone);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAqBO,MAAM,+BAAN,MAAM,qCAAoC,WAAW;AAAA,EAqG1D,cAAc;AACZ,UAAA;AA9FF,SAAA,QAA2B;AAE3B,SAAQ,aAA4B;AAuDpC,SAAiB,uBAAuB,MAAM;AAC5C,UAAI,KAAK,OAAO;AACd,aAAK,OAAO;AAAA,MACd;AAAA,IACF;AAIA,SAAQ,SAA0B;AAClC,SAAQ,cAAuB;AAE/B,SAAU,SAAS;AACnB,SAAQ,QAAQ;AAGhB,SAAQ,WAAW;AAyCnB,SAAQ,0BAA0B;AAlBhC,SAAK,iBAAiB,SAAS,CAAC,UAAyB;AACvD,UAAI,MAAM,QAAQ,UAAU;AAC1B,aAAK,OAAO;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH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,EAAE,SAAS,KAAA,CAAM;AAAA,GAPhB,4BAQX,WAAA,SAAA,CAAA;AAUW,gBAAA;AAAA,EADV,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAjBf,4BAkBA,WAAA,aAAA,CAAA;AAsDM,gBAAA;AAAA,EADhB,MAAM,QAAQ;AAAA,GAvEJ,4BAwEM,WAAA,YAAA,CAAA;AAQT,gBAAA;AAAA,EADP,MAAA;AAAM,GA/EI,4BAgFH,WAAA,YAAA,CAAA;AAUG,gBAAA;AAAA,EADV,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAzF/B,4BA0FA,WAAA,QAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"toast-notification.element.js","sources":["../../../src/components/toast-notification/toast-notification.element.ts"],"sourcesContent":["import { UUITimer } from '../../internal/utils/index.js';\nimport { UUITextStyles } from '../../styles/index.js';\nimport { iconRemove } from '../icon-registry-essential/svgs/index.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\n\nimport { UUIToastNotificationEvent } from './UUIToastNotificationEvent.js';\nimport type { UUIInterfaceColor } from '../../internal/index.js';\n\nimport '../button/button.js';\nimport '../icon/icon.js';\n\n/**\n * @element uui-toast-notification\n * @fires {UUIToastNotificationEvent} opening - fires when the toast is starting to open\n * @fires {UUIToastNotificationEvent} opened - fires when the toast is open after the open-animation\n * @fires {UUIToastNotificationEvent} closing - fires when the toast is starting to close\n * @fires {UUIToastNotificationEvent} closed - fires when the toast is closed\n * @description - Component for displaying a toast notification, preferably used in toast-notification-container.\n * @slot - slot for dialog layout/content\n */\nexport class UUIToastNotificationElement extends LitElement {\n /**\n * Changes the color of the notification to one of the predefined, symbolic colors. Example: set this to danger to indicate errors.\n * @type {UUIInterfaceColor}\n * @attr\n * @default \"\"\n */\n @property({ reflect: true })\n color: UUIInterfaceColor = '';\n\n private _autoClose: number | null = null;\n /**\n * Set an auto-close timer.\n * @type number\n * @attr\n * @default null\n */\n @property({ type: Number })\n public get autoClose(): number | null {\n return this._autoClose;\n }\n public set autoClose(value: number | null) {\n this._autoClose = value;\n if (value === null) {\n this._timer?.destroy();\n this._timer = null;\n } else {\n if (this._timer === null) {\n this._timer = new UUITimer(this._onOpenTimerComplete, value);\n } else {\n this._timer.setDuration(value);\n }\n if (\n this._pauseTimer === false &&\n this.isOpen === true &&\n this._animate === false\n ) {\n this._timer.start();\n }\n }\n }\n\n /**\n * Pause the auto close timer.\n */\n public pauseAutoClose() {\n this._pauseTimer = true;\n if (this._timer !== null) {\n this._timer.pause();\n }\n }\n /**\n * Resume the auto close timer.\n */\n public resumeAutoClose() {\n this._pauseTimer = false;\n if (\n this._timer !== null &&\n this.isOpen === true &&\n this._animate === false\n ) {\n this._timer.restart();\n }\n }\n\n private readonly _onOpenTimerComplete = () => {\n if (this._open) {\n this.open = false;\n }\n };\n\n @query('#toast')\n private readonly _toastEl!: HTMLElement;\n private _timer: UUITimer | null = null;\n private _pauseTimer: boolean = false;\n\n protected isOpen = false;\n private _open = false;\n\n @state()\n private _animate = false;\n private _animationTimeout?: number;\n\n /**\n * define if this toast should open or close.\n * @type boolean\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public get open() {\n return this._open;\n }\n public set open(value: boolean) {\n if (value === true) {\n this._makeOpen();\n } else {\n this._makeClose();\n }\n }\n\n constructor() {\n super();\n this.addEventListener('keyup', (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.open = false;\n }\n });\n }\n\n private _getAnimationDuration(): number {\n return (\n Number.parseInt(\n getComputedStyle(this).getPropertyValue(\n '--uui-toast-notification-animation-duration',\n ),\n 10,\n ) || 480\n );\n }\n\n private _requestAnimationUpdate = 0;\n private _makeOpen() {\n if (this._open === true) {\n return;\n }\n this._open = true;\n this.updateComplete.then(() => {\n if (this._open !== true) {\n return;\n }\n cancelAnimationFrame(this._requestAnimationUpdate);\n this._requestAnimationUpdate = requestAnimationFrame(() => {\n clearTimeout(this._animationTimeout as number);\n this.isOpen = true;\n this.setAttribute('is-open', '');\n\n this.style.height = this._toastEl.getBoundingClientRect().height + 'px';\n this._animate = true;\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENING),\n );\n\n this._animationTimeout = globalThis.setTimeout(() => {\n if (this.isOpen === true) {\n this.style.height = 'auto';\n this._animate = false;\n if (this._pauseTimer === false) {\n this._timer?.start();\n }\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENED),\n );\n }\n }, this._getAnimationDuration());\n });\n });\n }\n private _makeClose() {\n if (this._open === false) {\n return;\n }\n\n const event = new UUIToastNotificationEvent(\n UUIToastNotificationEvent.CLOSING,\n { cancelable: true },\n );\n this.dispatchEvent(event);\n\n if (event.defaultPrevented === true) {\n return;\n }\n\n this._open = false;\n this._timer?.pause();\n cancelAnimationFrame(this._requestAnimationUpdate); // do cancel though isOpen wasn't set jet.\n if (this.isOpen === true) {\n this._requestAnimationUpdate = requestAnimationFrame(() => {\n clearTimeout(this._animationTimeout as number);\n this.isOpen = false;\n this.removeAttribute('is-open');\n\n this.style.height = this._toastEl.getBoundingClientRect().height + 'px';\n this._animate = true;\n\n requestAnimationFrame(() => {\n // Dont overwrite the height instantly, but instead wait one frame to ensure animate is set before setting the goal of the animation.\n this.style.height = '0';\n });\n\n this._animationTimeout = globalThis.setTimeout(() => {\n if (this.isOpen === false) {\n this._animate = false;\n\n this.dispatchEvent(\n new UUIToastNotificationEvent(UUIToastNotificationEvent.CLOSED),\n );\n this.remove();\n }\n }, this._getAnimationDuration());\n });\n }\n }\n\n render() {\n return html`\n <div id=\"toast\" class=${this._animate ? 'animate' : ''}>\n <div>\n <div id=\"close\">\n <uui-button\n .label=${'close'}\n .color=${this.color}\n .look=${this.color ? 'primary' : 'default'}\n @click=${() => (this.open = false)}>\n <uui-icon\n name=\"remove\"\n .fallback=${iconRemove.strings[0]}></uui-icon>\n </uui-button>\n </div>\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n static override readonly styles = [\n UUITextStyles,\n css`\n :host {\n --uui-toast-notification-margin: var(--uui-size-space-2);\n\n position: relative;\n display: block;\n width: 100%;\n max-width: 400px;\n margin: 0 var(--uui-toast-notification-margin);\n box-sizing: border-box;\n\n height: 0;\n pointer-events: none;\n\n transition: height\n var(--uui-toast-notification-animation-duration, 480ms) ease-in-out;\n }\n :host([is-open]) {\n pointer-events: all;\n transition-timing-function: cubic-bezier(\n 0.19,\n 1,\n 0.22,\n 1\n ); /* easeOutExpo */\n }\n\n #toast {\n position: relative;\n display: block;\n padding: calc(var(--uui-toast-notification-margin) * 0.5) 0;\n width: 100%;\n max-width: 400px;\n }\n #toast.animate {\n position: absolute;\n }\n\n #toast > div {\n position: relative;\n display: block;\n\n box-sizing: border-box;\n box-shadow: var(--uui-shadow-depth-3);\n background-color: var(--uui-color-surface);\n padding: var(--uui-size-layout-1);\n padding-right: var(--uui-size-layout-1);\n padding-left: var(--uui-size-layout-3);\n border-radius: var(--uui-border-radius-3);\n\n opacity: 0;\n transition: opacity\n var(--uui-toast-notification-animation-duration, 480ms);\n }\n :host([is-open]) #toast > div {\n opacity: 1;\n }\n\n #close {\n float: right;\n margin-top: -6px;\n margin-left: var(--uui-size-space-1);\n margin-bottom: -4px;\n }\n\n #close > uui-button {\n --uui-button-border-radius: 50px 50px 50px 50px;\n --uui-button-padding-left-factor: 1.5;\n --uui-button-padding-right-factor: 1.5;\n }\n\n :host #toast > div {\n background-color: var(--uui-color-surface);\n color: var(--uui-color-text);\n border-color: var(--uui-color-surface);\n }\n :host([color='default']) #toast > div {\n background-color: var(--uui-color-default);\n color: var(--uui-color-default-contrast);\n border-color: var(--uui-color-default-standalone);\n }\n :host([color='positive']) #toast > div {\n background-color: var(--uui-color-positive);\n color: var(--uui-color-positive-contrast);\n border-color: var(--uui-color-positive-standalone);\n }\n :host([color='warning']) #toast > div {\n background-color: var(--uui-color-warning);\n color: var(--uui-color-warning-contrast);\n border-color: var(--uui-color-warning-standalone);\n }\n :host([color='danger']) #toast > div {\n background-color: var(--uui-color-danger);\n color: var(--uui-color-danger-contrast);\n border-color: var(--uui-color-danger-standalone);\n }\n :host([color='invalid']) #toast > div {\n background-color: var(--uui-color-invalid);\n color: var(--uui-color-invalid-contrast);\n border-color: var(--uui-color-invalid-standalone);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,+BAAN,MAAM,qCAAoC,WAAW;AAAA,EAqG1D,cAAc;AACZ,UAAA;AA9FF,SAAA,QAA2B;AAE3B,SAAQ,aAA4B;AAuDpC,SAAiB,uBAAuB,MAAM;AAC5C,UAAI,KAAK,OAAO;AACd,aAAK,OAAO;AAAA,MACd;AAAA,IACF;AAIA,SAAQ,SAA0B;AAClC,SAAQ,cAAuB;AAE/B,SAAU,SAAS;AACnB,SAAQ,QAAQ;AAGhB,SAAQ,WAAW;AAyCnB,SAAQ,0BAA0B;AAlBhC,SAAK,iBAAiB,SAAS,CAAC,UAAyB;AACvD,UAAI,MAAM,QAAQ,UAAU;AAC1B,aAAK,OAAO;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EA1FA,IAAW,YAA2B;AACpC,WAAO,KAAK;AAAA,EACd;AAAA,EACA,IAAW,UAAU,OAAsB;AACzC,SAAK,aAAa;AAClB,QAAI,UAAU,MAAM;AAClB,WAAK,QAAQ,QAAA;AACb,WAAK,SAAS;AAAA,IAChB,OAAO;AACL,UAAI,KAAK,WAAW,MAAM;AACxB,aAAK,SAAS,IAAI,SAAS,KAAK,sBAAsB,KAAK;AAAA,MAC7D,OAAO;AACL,aAAK,OAAO,YAAY,KAAK;AAAA,MAC/B;AACA,UACE,KAAK,gBAAgB,SACrB,KAAK,WAAW,QAChB,KAAK,aAAa,OAClB;AACA,aAAK,OAAO,MAAA;AAAA,MACd;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKO,iBAA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