@umbraco-ui/uui 2.0.0-rc.0 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/custom-elements.json +38 -2
  2. package/dist/components/breadcrumbs/breadcrumb-item.element.d.ts +1 -0
  3. package/dist/components/breadcrumbs/breadcrumb-item.element.js +22 -5
  4. package/dist/components/breadcrumbs/breadcrumb-item.element.js.map +1 -1
  5. package/dist/components/input/input.element.js +2 -2
  6. package/dist/components/input/input.element.js.map +1 -1
  7. package/dist/components/modal/modal-container.js +2 -6
  8. package/dist/components/modal/modal-container.js.map +1 -1
  9. package/dist/components/modal/modal-dialog.element.js +5 -5
  10. package/dist/components/modal/modal-dialog.element.js.map +1 -1
  11. package/dist/components/modal/modal-sidebar.element.js +10 -14
  12. package/dist/components/modal/modal-sidebar.element.js.map +1 -1
  13. package/dist/components/modal/modal.element.d.ts +1 -3
  14. package/dist/components/modal/modal.element.js +12 -31
  15. package/dist/components/modal/modal.element.js.map +1 -1
  16. package/dist/components/pagination/pagination.element.js +1 -0
  17. package/dist/components/pagination/pagination.element.js.map +1 -1
  18. package/dist/components/popover-container/popover-container-nestedslottester.element.d.ts +26 -0
  19. package/dist/components/popover-container/popover-container.element.d.ts +1 -0
  20. package/dist/components/popover-container/popover-container.element.js +30 -6
  21. package/dist/components/popover-container/popover-container.element.js.map +1 -1
  22. package/dist/components/table/table-row.element.js +2 -2
  23. package/dist/components/table/table-row.element.js.map +1 -1
  24. package/dist/components/table/table.element.js +1 -1
  25. package/dist/components/table/table.element.js.map +1 -1
  26. package/dist/components/tabs/tab-group.element.js +17 -1
  27. package/dist/components/tabs/tab-group.element.js.map +1 -1
  28. package/dist/components/tabs/tab.element.js +3 -3
  29. package/dist/components/tabs/tab.element.js.map +1 -1
  30. package/dist/package.json.js +1 -1
  31. package/package.json +10 -10
  32. package/vscode.html-custom-data.json +326 -533
  33. package/dist/components/modal/modal-with-toasts-example.element.d.ts +0 -22
@@ -3002,7 +3002,7 @@
3002
3002
  {
3003
3003
  "name": "selectable",
3004
3004
  "description": "Enable the ability to select this element.",
3005
- "type": "boolean",
3005
+ "type": "Symbol()",
3006
3006
  "default": "true"
3007
3007
  },
3008
3008
  {
@@ -3055,7 +3055,7 @@
3055
3055
  "name": "selectable",
3056
3056
  "attribute": "selectable",
3057
3057
  "description": "Enable the ability to select this element.",
3058
- "type": "boolean",
3058
+ "type": "Symbol()",
3059
3059
  "default": "true"
3060
3060
  },
3061
3061
  {
@@ -5832,6 +5832,42 @@
5832
5832
  }
5833
5833
  ]
5834
5834
  },
5835
+ {
5836
+ "name": "uui-popover-container-scroll-level-1",
5837
+ "path": "./src/components/popover-container/popover-container-nestedslottester.element.ts",
5838
+ "description": "Outermost scroll level — blue outline.",
5839
+ "properties": [
5840
+ {
5841
+ "name": "styles",
5842
+ "type": "CSSResult",
5843
+ "default": "\"css`\\n .scroll-host {\\n height: 200px;\\n overflow: auto;\\n outline: 2px dashed royalblue;\\n width: 320px;\\n }\\n .spacer {\\n height: 140px;\\n }\\n `\""
5844
+ }
5845
+ ]
5846
+ },
5847
+ {
5848
+ "name": "uui-popover-container-scroll-level-2",
5849
+ "path": "./src/components/popover-container/popover-container-nestedslottester.element.ts",
5850
+ "description": "Middle scroll level — orange outline.",
5851
+ "properties": [
5852
+ {
5853
+ "name": "styles",
5854
+ "type": "CSSResult",
5855
+ "default": "\"css`\\n .scroll-host {\\n height: 180px;\\n overflow: auto;\\n outline: 2px dashed darkorange;\\n width: 290px;\\n }\\n .spacer {\\n height: 120px;\\n }\\n `\""
5856
+ }
5857
+ ]
5858
+ },
5859
+ {
5860
+ "name": "uui-popover-container-scroll-level-3",
5861
+ "path": "./src/components/popover-container/popover-container-nestedslottester.element.ts",
5862
+ "description": "Innermost scroll level — green outline.",
5863
+ "properties": [
5864
+ {
5865
+ "name": "styles",
5866
+ "type": "CSSResult",
5867
+ "default": "\"css`\\n .scroll-host {\\n height: 160px;\\n overflow: auto;\\n outline: 2px dashed green;\\n width: 260px;\\n }\\n .spacer {\\n height: 100px;\\n }\\n `\""
5868
+ }
5869
+ ]
5870
+ },
5835
5871
  {
5836
5872
  "name": "uui-popover-container-shadowdomtester",
5837
5873
  "path": "./src/components/popover-container/popover-container-shadowdomtester.element.ts"
@@ -20,6 +20,7 @@ export declare class UUIBreadcrumbItemElement extends LitElement {
20
20
  * @default 'false'
21
21
  */
22
22
  lastItem: boolean;
23
+ private _onKeydown;
23
24
  renderLinkAndSeparator(): import("lit-html").TemplateResult<1>;
24
25
  renderCurrent(): import("lit-html").TemplateResult<1>;
25
26
  render(): import("lit-html").TemplateResult<1>;
@@ -17,8 +17,19 @@ const _UUIBreadcrumbItemElement = class _UUIBreadcrumbItemElement extends LitEle
17
17
  connectedCallback() {
18
18
  super.connectedCallback();
19
19
  }
20
+ _onKeydown(e) {
21
+ if (e.key === "Enter") {
22
+ e.currentTarget.click();
23
+ }
24
+ }
20
25
  renderLinkAndSeparator() {
21
- const item = this.href ? html`<a id="link" href=${this.href}><slot></slot></a>` : html`<span id="link"><slot></slot></span>`;
26
+ const item = this.href ? html`<a id="link" href=${this.href}><slot></slot></a>` : html`<span
27
+ id="link"
28
+ tabindex="0"
29
+ role="link"
30
+ @keydown=${this._onKeydown}
31
+ ><slot></slot
32
+ ></span>`;
22
33
  return html`${item}<span part="separator"></span>`;
23
34
  }
24
35
  renderCurrent() {
@@ -36,17 +47,23 @@ _UUIBreadcrumbItemElement.styles = [
36
47
  }
37
48
 
38
49
  a,
39
- a:visited {
50
+ a:visited,
51
+ span#link {
40
52
  color: currentColor;
53
+ cursor: pointer;
54
+ text-decoration: underline;
41
55
  }
42
- a:hover {
56
+ a:hover,
57
+ span#link:hover {
43
58
  color: var(--uui-color-interactive-emphasis);
44
59
  }
45
- a:focus {
60
+ a:focus,
61
+ span#link:focus {
46
62
  color: var(--uui-color-focus);
47
63
  }
48
64
 
49
- a:focus-visible {
65
+ a:focus-visible,
66
+ span#link:focus-visible {
50
67
  border-radius: var(--uui-border-radius);
51
68
  outline: 2px solid var(--uui-color-focus);
52
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumb-item.element.js","sources":["../../../src/components/breadcrumbs/breadcrumb-item.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * A breadcrumb-item to be used with the breadcrumbs component.\n * @element uui-breadcrumb-item\n * @slot - This slot displays elements inside the breadcrumb\n * @csspart separator - change the content of the after element of this part to change the separator\n */\nexport class UUIBreadcrumbItemElement extends LitElement {\n connectedCallback() {\n super.connectedCallback();\n }\n\n /**\n * Specifies the link href.\n * @type {String}\n * @default undefined\n */\n @property()\n href?: string;\n\n /**\n * Specifies if the element is the last item in the uui-breadcrumbs. Last item will not render as a link\n * @type {Boolean}\n * @attr last-item\n * @default 'false'\n */\n @property({ type: Boolean, attribute: 'last-item' })\n lastItem = false;\n\n renderLinkAndSeparator() {\n const item = this.href\n ? html`<a id=\"link\" href=${this.href}><slot></slot></a>`\n : html`<span id=\"link\"><slot></slot></span>`;\n\n return html`${item}<span part=\"separator\"></span>`;\n }\n\n renderCurrent() {\n return html`<span id=\"last-item\"><slot></slot></span>`;\n }\n\n render() {\n return html`${this.lastItem\n ? this.renderCurrent()\n : this.renderLinkAndSeparator()}`;\n }\n\n static override readonly styles = [\n css`\n :host {\n font-size: var(--uui-type-small-size);\n color: currentColor;\n }\n\n a,\n a:visited {\n color: currentColor;\n }\n a:hover {\n color: var(--uui-color-interactive-emphasis);\n }\n a:focus {\n color: var(--uui-color-focus);\n }\n\n a:focus-visible {\n border-radius: var(--uui-border-radius);\n outline: 2px solid var(--uui-color-focus);\n }\n\n [part='separator']::after {\n content: '/';\n speak: never;\n position: relative;\n top: 1px;\n margin: -3px 1px 0;\n color: var(--uui-color-border);\n }\n\n #link,\n #last-item {\n padding: 0 4px;\n max-width: 150px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AASO,MAAM,4BAAN,MAAM,kCAAiC,WAAW;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AAoBL,SAAA,WAAW;AAAA,EAAA;AAAA,EAnBX,oBAAoB;AAClB,UAAM,kBAAA;AAAA,EACR;AAAA,EAmBA,yBAAyB;AACvB,UAAM,OAAO,KAAK,OACd,yBAAyB,KAAK,IAAI,uBAClC;AAEJ,WAAO,OAAO,IAAI;AAAA,EACpB;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,EACT;AAAA,EAEA,SAAS;AACP,WAAO,OAAO,KAAK,WACf,KAAK,kBACL,KAAK,wBAAwB;AAAA,EACnC;AA4CF;AA1CE,0BAAyB,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;AAzCG,IAAM,2BAAN;AAWL,gBAAA;AAAA,EADC,SAAA;AAAS,GAVC,yBAWX,WAAA,MAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,aAAa;AAAA,GAnBxC,yBAoBX,WAAA,UAAA;"}
1
+ {"version":3,"file":"breadcrumb-item.element.js","sources":["../../../src/components/breadcrumbs/breadcrumb-item.element.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n/**\n * A breadcrumb-item to be used with the breadcrumbs component.\n * @element uui-breadcrumb-item\n * @slot - This slot displays elements inside the breadcrumb\n * @csspart separator - change the content of the after element of this part to change the separator\n */\nexport class UUIBreadcrumbItemElement extends LitElement {\n connectedCallback() {\n super.connectedCallback();\n }\n\n /**\n * Specifies the link href.\n * @type {String}\n * @default undefined\n */\n @property()\n href?: string;\n\n /**\n * Specifies if the element is the last item in the uui-breadcrumbs. Last item will not render as a link\n * @type {Boolean}\n * @attr last-item\n * @default 'false'\n */\n @property({ type: Boolean, attribute: 'last-item' })\n lastItem = false;\n\n private _onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n (e.currentTarget as HTMLElement).click();\n }\n }\n\n renderLinkAndSeparator() {\n const item = this.href\n ? html`<a id=\"link\" href=${this.href}><slot></slot></a>`\n : html`<span\n id=\"link\"\n tabindex=\"0\"\n role=\"link\"\n @keydown=${this._onKeydown}\n ><slot></slot\n ></span>`;\n\n return html`${item}<span part=\"separator\"></span>`;\n }\n\n renderCurrent() {\n return html`<span id=\"last-item\"><slot></slot></span>`;\n }\n\n render() {\n return html`${this.lastItem\n ? this.renderCurrent()\n : this.renderLinkAndSeparator()}`;\n }\n\n static override readonly styles = [\n css`\n :host {\n font-size: var(--uui-type-small-size);\n color: currentColor;\n }\n\n a,\n a:visited,\n span#link {\n color: currentColor;\n cursor: pointer;\n text-decoration: underline;\n }\n a:hover,\n span#link:hover {\n color: var(--uui-color-interactive-emphasis);\n }\n a:focus,\n span#link:focus {\n color: var(--uui-color-focus);\n }\n\n a:focus-visible,\n span#link:focus-visible {\n border-radius: var(--uui-border-radius);\n outline: 2px solid var(--uui-color-focus);\n }\n\n [part='separator']::after {\n content: '/';\n speak: never;\n position: relative;\n top: 1px;\n margin: -3px 1px 0;\n color: var(--uui-color-border);\n }\n\n #link,\n #last-item {\n padding: 0 4px;\n max-width: 150px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;AASO,MAAM,4BAAN,MAAM,kCAAiC,WAAW;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AAoBL,SAAA,WAAW;AAAA,EAAA;AAAA,EAnBX,oBAAoB;AAClB,UAAM,kBAAA;AAAA,EACR;AAAA,EAmBQ,WAAW,GAAkB;AACnC,QAAI,EAAE,QAAQ,SAAS;AACpB,QAAE,cAA8B,MAAA;AAAA,IACnC;AAAA,EACF;AAAA,EAEA,yBAAyB;AACvB,UAAM,OAAO,KAAK,OACd,yBAAyB,KAAK,IAAI,uBAClC;AAAA;AAAA;AAAA;AAAA,qBAIa,KAAK,UAAU;AAAA;AAAA;AAIhC,WAAO,OAAO,IAAI;AAAA,EACpB;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,EACT;AAAA,EAEA,SAAS;AACP,WAAO,OAAO,KAAK,WACf,KAAK,kBACL,KAAK,wBAAwB;AAAA,EACnC;AAkDF;AAhDE,0BAAyB,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;AArDG,IAAM,2BAAN;AAWL,gBAAA;AAAA,EADC,SAAA;AAAS,GAVC,yBAWX,WAAA,MAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,aAAa;AAAA,GAnBxC,yBAoBX,WAAA,UAAA;"}
@@ -189,9 +189,9 @@ _UUIInputElement.styles = [
189
189
  var(--uui-input-border-color, var(--uui-color-border));
190
190
  border-radius: var(--uui-input-border-radius, var(--uui-border-radius));
191
191
  min-width: 0;
192
+ overflow: hidden;
192
193
 
193
- --uui-input-padding: 1px var(--uui-size-space-3) 3px
194
- var(--uui-size-space-3);
194
+ --uui-input-padding: 1px var(--uui-size-3);
195
195
  --uui-button-height: 100%;
196
196
  --uui-button-border-radius: var(
197
197
  --uui-input-border-radius,
@@ -1 +1 @@
1
- {"version":3,"file":"input.element.js","sources":["../../../src/components/input/input.element.ts"],"sourcesContent":["import {\n UUIFormControlWithBasicsMixin,\n LabelMixin,\n} from '../../internal/mixins/index.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { UUIInputEvent } from './UUIInputEvent.js';\n\nexport type InputType =\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'password'\n | 'search'\n | 'month'\n | 'week'\n | 'time'\n | 'date'\n | 'datetime-local'\n | 'number'\n | 'color';\n\nexport type InputMode =\n | 'text'\n | 'none'\n | 'decimal'\n | 'numeric'\n | 'tel'\n | 'search'\n | 'email'\n | 'url';\n\n/**\n * Custom element wrapping the native input element.This is a formAssociated element, meaning it can participate in a native HTMLForm. A name:value pair will be submitted.\n * @element uui-input\n * @slot prepend - for components to render to the left of the input.\n * @slot append - for components to render to the right of the input.\n * @property {boolean} spellcheck - get/set native spellcheck attribute\n * @attribute spellcheck - native spellcheck attribute\n * @property {string} value - get/set the value of the input\n * @attribute value - get/set the value of the input\n * @property {string} name - get/set the name of the input\n * @attribute name - get/set the name of the input\n * @fires UUIInputEvent#change on change\n * @fires InputEvent#input on input\n * @fires KeyboardEvent#keyup on keyup\n * @cssprop --uui-input-height - Height of the element\n * @cssprop --uui-input-background-color - Background color of the element\n * @cssprop --uui-input-background-color-disabled - Background color when disabled\n * @cssprop --uui-input-background-color-readonly - Background color when readonly\n * @cssprop --uui-input-border-width - Border width\n * @cssprop --uui-input-border-radius - Border radius\n * @cssprop --uui-input-border-color - Border color\n * @cssprop --uui-input-border-color-hover - Border color on hover\n * @cssprop --uui-input-border-color-focus - Border color on focus\n * @cssprop --uui-input-border-color-disabled - Border color when disabled\n * @cssprop --uui-input-border-color-readonly - Border color when readonly\n */\nexport class UUIInputElement extends UUIFormControlWithBasicsMixin(\n LabelMixin('', LitElement),\n '',\n) {\n /**\n * This is a static class field indicating that the element is can be used inside a native form and participate in its events. It may require a polyfill, check support here https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals. Read more about form controls here https://web.dev/more-capable-form-controls/\n * @type {boolean}\n */\n static readonly formAssociated = true;\n\n /**\n * Sets the min value of the input.\n * Examples: the first date the user may pick in date and datetime-local, or the min numeric value the user can pick in a number input.\n * @type {number | string}\n * @attr\n * @default undefined\n */\n @property()\n min?: number | string;\n\n /**\n * Sets the minimum length of the value of the input.\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * Minlength validation message.\n * @attr minlength-message\n * @default\n */\n @property({ attribute: 'minlength-message' })\n minlengthMessage: string | ((charsLeft: number) => string) = charsLeft =>\n `${charsLeft} characters left`;\n\n /**\n * Sets the max value of the input.\n * Examples: the last date the user may pick in date and datetime-local, or the max numeric value the user can pick in a number input.\n * @type {number | string}\n * @attr\n * @default undefined\n */\n @property()\n max?: number | string;\n\n /**\n * Sets the maximum length of the value of the input.\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * Maxlength validation message.\n * @attr maxlength-message\n * @default\n */\n @property({ attribute: 'maxlength-message' })\n maxlengthMessage: string | ((max: number, current: number) => string) = (\n max,\n current,\n ) => `Maximum ${max} characters, ${current - max} too many.`;\n\n /**\n * Specifies the interval between legal numbers of the input\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n step?: number;\n\n /**\n * Disables the input.\n * @type {boolean}\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.\n * @type {boolean}\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * Defines the input placeholder.\n * @type {string}\n * @attr\n * @default ''\n */\n @property()\n placeholder = '';\n\n /**\n * Defines the input autocomplete.\n * @type {string}\n * @attr\n * @default undefined\n */\n @property()\n autocomplete?: string;\n\n /**\n * Sets the input width to fit the value or placeholder if empty\n * @type {boolean}\n * @attr auto-width\n */\n @property({ type: Boolean, reflect: true, attribute: 'auto-width' })\n autoWidth = false;\n\n /**\n * This property specifies the type of input that will be rendered.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types|MDN} for further information\n * @type {'text' | 'tel' | 'url' | 'email' | 'password' | 'date' | 'month' | 'week' | 'time' | 'datetime-local' | 'number' | 'color'}\n * @attr\n * @default text\n */\n @property({ type: String })\n get type(): InputType {\n return this._type;\n }\n set type(value: InputType) {\n this._type = value;\n }\n\n /**\n * The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode|MDN} for further information\n * @type {'text' | 'none' | 'decimal' | 'number' | 'tel' | 'search' | 'email' | 'url'}\n * @attr\n * @default text\n */\n @property({ attribute: 'inputmode' })\n inputMode: InputMode = 'text';\n\n /**\n * Validates the input based on the Regex pattern\n * @type {string}\n * @attr\n */\n @property({ type: String })\n pattern?: string;\n\n /**\n * Set the input tabindex, set this to `-1` to avoid tabbing into the input.\n * @type {number}\n * @attr\n */\n @property({ type: Number, reflect: false, attribute: 'tabindex' })\n tabIndex: number = 0;\n\n @query('#input')\n readonly _input!: HTMLInputElement;\n\n private _type: InputType = 'text';\n\n constructor() {\n super();\n\n this.addEventListener('keydown', this.#onKeyDown);\n\n this.addValidator(\n 'tooShort',\n () => {\n const label = this.minlengthMessage;\n if (typeof label === 'function') {\n return label(\n this.minlength ? this.minlength - String(this.value).length : 0,\n );\n }\n return label;\n },\n () => !!this.minlength && String(this.value).length < this.minlength,\n );\n this.addValidator(\n 'tooLong',\n () => {\n const label = this.maxlengthMessage;\n if (typeof label === 'function') {\n return label(this.maxlength ?? 0, String(this.value).length);\n }\n return label;\n },\n () => !!this.maxlength && String(this.value).length > this.maxlength,\n );\n\n this.updateComplete.then(() => {\n this.addFormControlElement(this._input);\n });\n }\n\n #onKeyDown(e: KeyboardEvent): void {\n if (this.type !== 'color' && e.key == 'Enter') {\n this.submit();\n }\n }\n\n /**\n * Removes focus from the input.\n */\n async blur() {\n await this.updateComplete;\n this._input.blur();\n }\n\n /**\n * This method enables <label for=\"...\"> to focus the input\n */\n async focus() {\n await this.updateComplete;\n this._input.focus();\n }\n\n /**\n * Selects all the text in the input.\n */\n async select() {\n await this.updateComplete;\n this._input.select();\n }\n\n protected getFormElement(): HTMLElement {\n return this.shadowRoot?.querySelector('input') as HTMLElement;\n }\n\n protected onInput(e: Event) {\n e.stopPropagation();\n this.value = (e.target as HTMLInputElement).value;\n\n this.dispatchEvent(new UUIInputEvent(UUIInputEvent.INPUT));\n }\n\n protected onChange(e: Event) {\n e.stopPropagation();\n this.pristine = false;\n\n this.dispatchEvent(new UUIInputEvent(UUIInputEvent.CHANGE));\n }\n\n protected renderPrepend() {\n return html`<slot name=\"prepend\"></slot>`;\n }\n\n protected renderAppend() {\n return html`<slot name=\"append\"></slot>`;\n }\n\n render() {\n return html`\n ${this.renderPrepend()}\n <div id=\"inner\">\n <slot></slot>\n ${this.autoWidth ? this.renderInputWithAutoWidth() : this.renderInput()}\n </div>\n ${this.renderAppend()}\n `;\n }\n\n private renderInputWithAutoWidth() {\n return html`<div id=\"autoWidth\">\n ${this.renderInput()}${this.renderAutoWidthBackground()}\n </div>`;\n }\n\n renderInput() {\n return html`<input\n id=\"input\"\n size=${ifDefined(this.autoWidth ? '1' : undefined)}\n .type=${this.type}\n .value=${this.value as string}\n .name=${this.name}\n pattern=${ifDefined(this.pattern)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step)}\n spellcheck=${this.spellcheck}\n autocomplete=${ifDefined(this.autocomplete as any)}\n placeholder=${ifDefined(this.placeholder)}\n aria-label=${ifDefined(\n this.getAttribute('aria-label') || this.label || undefined,\n )}\n aria-labelledby=${ifDefined(\n this.getAttribute('aria-labelledby') || undefined,\n )}\n inputmode=${ifDefined(this.inputMode)}\n ?disabled=${this.disabled}\n ?autofocus=${this.autofocus}\n ?required=${this.required}\n ?readonly=${this.readonly}\n tabindex=${ifDefined(this.tabIndex)}\n @input=${this.onInput}\n @change=${this.onChange} />`;\n }\n\n private renderAutoWidthBackground() {\n return html` <div id=\"auto\" aria-hidden=\"true\">${this.renderText()}</div>`;\n }\n\n private renderText() {\n return html`${(this.value as string).length > 0\n ? this.value\n : this.placeholder}`;\n }\n\n static override readonly styles = [\n css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: stretch;\n height: var(--uui-input-height, var(--uui-size-11));\n text-align: left;\n color: var(--uui-color-text);\n color-scheme: var(--uui-color-scheme, normal);\n box-sizing: border-box;\n background-color: var(\n --uui-input-background-color,\n var(--uui-color-surface)\n );\n border: var(--uui-input-border-width, 1px) solid\n var(--uui-input-border-color, var(--uui-color-border));\n border-radius: var(--uui-input-border-radius, var(--uui-border-radius));\n min-width: 0;\n\n --uui-input-padding: 1px var(--uui-size-space-3) 3px\n var(--uui-size-space-3);\n --uui-button-height: 100%;\n --uui-button-border-radius: var(\n --uui-input-border-radius,\n var(--uui-border-radius)\n );\n --auto-width-text-margin-right: 0;\n --auto-width-text-margin-left: 0;\n }\n\n #autoWidth {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n justify-content: center;\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0;\n }\n\n #auto {\n border: 0 1px solid transparent;\n visibility: hidden;\n white-space: pre;\n z-index: -1;\n height: 0px;\n padding: 0 var(--uui-size-space-3);\n margin: 0 var(--auto-width-text-margin-right) 0\n var(--auto-width-text-margin-left);\n }\n\n :host(:hover) {\n border-color: var(\n --uui-input-border-color-hover,\n var(--uui-color-border-standalone)\n );\n }\n /* TODO: Fix so we dont get double outline when there is focus on things in the slot. */\n :host(:focus-within) {\n border-color: var(\n --uui-input-border-color-focus,\n var(--uui-color-border-emphasis)\n );\n outline: 2px solid var(--uui-color-focus);\n }\n :host(:focus) {\n border-color: var(\n --uui-input-border-color-focus,\n var(--uui-color-border-emphasis)\n );\n }\n :host([disabled]) {\n background-color: var(\n --uui-input-background-color-disabled,\n var(--uui-color-disabled)\n );\n border-color: var(\n --uui-input-border-color-disabled,\n var(--uui-color-disabled)\n );\n\n color: var(--uui-color-disabled-contrast);\n }\n :host([disabled]) input {\n -webkit-text-fill-color: var(\n --uui-color-disabled-contrast\n ); /* required on Safari and IOS */\n }\n :host([readonly]) {\n background-color: var(\n --uui-input-background-color-readonly,\n var(--uui-color-disabled)\n );\n border-color: var(\n --uui-input-border-color-readonly,\n var(--uui-color-disabled-standalone)\n );\n }\n\n :host(:not([pristine]):invalid),\n /* polyfill support */\n :host(:not([pristine])[internals-invalid]) {\n border-color: var(--uui-color-invalid);\n }\n\n input {\n font-family: inherit;\n padding: var(--uui-input-padding);\n font-size: inherit;\n color: inherit;\n border-radius: var(--uui-border-radius);\n box-sizing: border-box;\n border: none;\n background: none;\n min-width: 0;\n flex-grow: 1;\n flex-shrink: 1;\n height: inherit;\n text-align: inherit;\n outline: none;\n text-overflow: ellipsis;\n line-height: 1;\n flex: 1 1 auto;\n min-width: 60px;\n }\n\n input[type='password']::-ms-reveal {\n display: none;\n }\n\n /* TODO: make sure color looks good, or remove it as an option as we want to provide color-picker component */\n input[type='color'] {\n width: 30px;\n padding: 0;\n border: none;\n }\n\n slot[name='prepend'],\n slot[name='append'] {\n display: flex;\n align-items: center;\n line-height: 1;\n height: 100%;\n min-width: 0;\n }\n\n uui-input,\n uui-input-lock,\n ::slotted(uui-input),\n ::slotted(uui-input-lock) {\n height: 100%;\n --uui-input-border-width: 0;\n }\n\n uui-button,\n ::slotted(uui-button) {\n height: 100%;\n --uui-button-border-width: 0;\n }\n\n #inner {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px;\n flex: 1 1 auto;\n min-width: 0;\n padding: 2px;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA1Ef,gBA2EX,WAAA,QAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAnF/B,gBAoFX,WAAA,YAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GA5F/B,gBA6FX,WAAA,YAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAA;AAAS,GArGC,gBAsGX,WAAA,eAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAA;AAAS,GA9GC,gBA+GX,WAAA,gBAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,cAAc;AAAA,GAtHxD,gBAuHX,WAAA,aAAA,CAAA;AAUI,gBAAA;AAAA,EADH,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAhIf,gBAiIP,WAAA,QAAA,CAAA;AAeJ,gBAAA;AAAA,EADC,SAAS,EAAE,WAAW,YAAA,CAAa;AAAA,GA/IzB,gBAgJX,WAAA,aAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAvJf,gBAwJX,WAAA,WAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAO,WAAW,YAAY;AAAA,GA/JtD,gBAgKX,WAAA,YAAA,CAAA;AAGS,gBAAA;AAAA,EADR,MAAM,QAAQ;AAAA,GAlKJ,gBAmKF,WAAA,UAAA,CAAA;"}
1
+ {"version":3,"file":"input.element.js","sources":["../../../src/components/input/input.element.ts"],"sourcesContent":["import {\n UUIFormControlWithBasicsMixin,\n LabelMixin,\n} from '../../internal/mixins/index.js';\nimport { css, html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { UUIInputEvent } from './UUIInputEvent.js';\n\nexport type InputType =\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'password'\n | 'search'\n | 'month'\n | 'week'\n | 'time'\n | 'date'\n | 'datetime-local'\n | 'number'\n | 'color';\n\nexport type InputMode =\n | 'text'\n | 'none'\n | 'decimal'\n | 'numeric'\n | 'tel'\n | 'search'\n | 'email'\n | 'url';\n\n/**\n * Custom element wrapping the native input element.This is a formAssociated element, meaning it can participate in a native HTMLForm. A name:value pair will be submitted.\n * @element uui-input\n * @slot prepend - for components to render to the left of the input.\n * @slot append - for components to render to the right of the input.\n * @property {boolean} spellcheck - get/set native spellcheck attribute\n * @attribute spellcheck - native spellcheck attribute\n * @property {string} value - get/set the value of the input\n * @attribute value - get/set the value of the input\n * @property {string} name - get/set the name of the input\n * @attribute name - get/set the name of the input\n * @fires UUIInputEvent#change on change\n * @fires InputEvent#input on input\n * @fires KeyboardEvent#keyup on keyup\n * @cssprop --uui-input-height - Height of the element\n * @cssprop --uui-input-background-color - Background color of the element\n * @cssprop --uui-input-background-color-disabled - Background color when disabled\n * @cssprop --uui-input-background-color-readonly - Background color when readonly\n * @cssprop --uui-input-border-width - Border width\n * @cssprop --uui-input-border-radius - Border radius\n * @cssprop --uui-input-border-color - Border color\n * @cssprop --uui-input-border-color-hover - Border color on hover\n * @cssprop --uui-input-border-color-focus - Border color on focus\n * @cssprop --uui-input-border-color-disabled - Border color when disabled\n * @cssprop --uui-input-border-color-readonly - Border color when readonly\n */\nexport class UUIInputElement extends UUIFormControlWithBasicsMixin(\n LabelMixin('', LitElement),\n '',\n) {\n /**\n * This is a static class field indicating that the element is can be used inside a native form and participate in its events. It may require a polyfill, check support here https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals. Read more about form controls here https://web.dev/more-capable-form-controls/\n * @type {boolean}\n */\n static readonly formAssociated = true;\n\n /**\n * Sets the min value of the input.\n * Examples: the first date the user may pick in date and datetime-local, or the min numeric value the user can pick in a number input.\n * @type {number | string}\n * @attr\n * @default undefined\n */\n @property()\n min?: number | string;\n\n /**\n * Sets the minimum length of the value of the input.\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * Minlength validation message.\n * @attr minlength-message\n * @default\n */\n @property({ attribute: 'minlength-message' })\n minlengthMessage: string | ((charsLeft: number) => string) = charsLeft =>\n `${charsLeft} characters left`;\n\n /**\n * Sets the max value of the input.\n * Examples: the last date the user may pick in date and datetime-local, or the max numeric value the user can pick in a number input.\n * @type {number | string}\n * @attr\n * @default undefined\n */\n @property()\n max?: number | string;\n\n /**\n * Sets the maximum length of the value of the input.\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * Maxlength validation message.\n * @attr maxlength-message\n * @default\n */\n @property({ attribute: 'maxlength-message' })\n maxlengthMessage: string | ((max: number, current: number) => string) = (\n max,\n current,\n ) => `Maximum ${max} characters, ${current - max} too many.`;\n\n /**\n * Specifies the interval between legal numbers of the input\n * @type {number}\n * @attr\n * @default undefined\n */\n @property({ type: Number })\n step?: number;\n\n /**\n * Disables the input.\n * @type {boolean}\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.\n * @type {boolean}\n * @attr\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * Defines the input placeholder.\n * @type {string}\n * @attr\n * @default ''\n */\n @property()\n placeholder = '';\n\n /**\n * Defines the input autocomplete.\n * @type {string}\n * @attr\n * @default undefined\n */\n @property()\n autocomplete?: string;\n\n /**\n * Sets the input width to fit the value or placeholder if empty\n * @type {boolean}\n * @attr auto-width\n */\n @property({ type: Boolean, reflect: true, attribute: 'auto-width' })\n autoWidth = false;\n\n /**\n * This property specifies the type of input that will be rendered.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types|MDN} for further information\n * @type {'text' | 'tel' | 'url' | 'email' | 'password' | 'date' | 'month' | 'week' | 'time' | 'datetime-local' | 'number' | 'color'}\n * @attr\n * @default text\n */\n @property({ type: String })\n get type(): InputType {\n return this._type;\n }\n set type(value: InputType) {\n this._type = value;\n }\n\n /**\n * The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode|MDN} for further information\n * @type {'text' | 'none' | 'decimal' | 'number' | 'tel' | 'search' | 'email' | 'url'}\n * @attr\n * @default text\n */\n @property({ attribute: 'inputmode' })\n inputMode: InputMode = 'text';\n\n /**\n * Validates the input based on the Regex pattern\n * @type {string}\n * @attr\n */\n @property({ type: String })\n pattern?: string;\n\n /**\n * Set the input tabindex, set this to `-1` to avoid tabbing into the input.\n * @type {number}\n * @attr\n */\n @property({ type: Number, reflect: false, attribute: 'tabindex' })\n tabIndex: number = 0;\n\n @query('#input')\n readonly _input!: HTMLInputElement;\n\n private _type: InputType = 'text';\n\n constructor() {\n super();\n\n this.addEventListener('keydown', this.#onKeyDown);\n\n this.addValidator(\n 'tooShort',\n () => {\n const label = this.minlengthMessage;\n if (typeof label === 'function') {\n return label(\n this.minlength ? this.minlength - String(this.value).length : 0,\n );\n }\n return label;\n },\n () => !!this.minlength && String(this.value).length < this.minlength,\n );\n this.addValidator(\n 'tooLong',\n () => {\n const label = this.maxlengthMessage;\n if (typeof label === 'function') {\n return label(this.maxlength ?? 0, String(this.value).length);\n }\n return label;\n },\n () => !!this.maxlength && String(this.value).length > this.maxlength,\n );\n\n this.updateComplete.then(() => {\n this.addFormControlElement(this._input);\n });\n }\n\n #onKeyDown(e: KeyboardEvent): void {\n if (this.type !== 'color' && e.key == 'Enter') {\n this.submit();\n }\n }\n\n /**\n * Removes focus from the input.\n */\n async blur() {\n await this.updateComplete;\n this._input.blur();\n }\n\n /**\n * This method enables <label for=\"...\"> to focus the input\n */\n async focus() {\n await this.updateComplete;\n this._input.focus();\n }\n\n /**\n * Selects all the text in the input.\n */\n async select() {\n await this.updateComplete;\n this._input.select();\n }\n\n protected getFormElement(): HTMLElement {\n return this.shadowRoot?.querySelector('input') as HTMLElement;\n }\n\n protected onInput(e: Event) {\n e.stopPropagation();\n this.value = (e.target as HTMLInputElement).value;\n\n this.dispatchEvent(new UUIInputEvent(UUIInputEvent.INPUT));\n }\n\n protected onChange(e: Event) {\n e.stopPropagation();\n this.pristine = false;\n\n this.dispatchEvent(new UUIInputEvent(UUIInputEvent.CHANGE));\n }\n\n protected renderPrepend() {\n return html`<slot name=\"prepend\"></slot>`;\n }\n\n protected renderAppend() {\n return html`<slot name=\"append\"></slot>`;\n }\n\n render() {\n return html`\n ${this.renderPrepend()}\n <div id=\"inner\">\n <slot></slot>\n ${this.autoWidth ? this.renderInputWithAutoWidth() : this.renderInput()}\n </div>\n ${this.renderAppend()}\n `;\n }\n\n private renderInputWithAutoWidth() {\n return html`<div id=\"autoWidth\">\n ${this.renderInput()}${this.renderAutoWidthBackground()}\n </div>`;\n }\n\n renderInput() {\n return html`<input\n id=\"input\"\n size=${ifDefined(this.autoWidth ? '1' : undefined)}\n .type=${this.type}\n .value=${this.value as string}\n .name=${this.name}\n pattern=${ifDefined(this.pattern)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n step=${ifDefined(this.step)}\n spellcheck=${this.spellcheck}\n autocomplete=${ifDefined(this.autocomplete as any)}\n placeholder=${ifDefined(this.placeholder)}\n aria-label=${ifDefined(\n this.getAttribute('aria-label') || this.label || undefined,\n )}\n aria-labelledby=${ifDefined(\n this.getAttribute('aria-labelledby') || undefined,\n )}\n inputmode=${ifDefined(this.inputMode)}\n ?disabled=${this.disabled}\n ?autofocus=${this.autofocus}\n ?required=${this.required}\n ?readonly=${this.readonly}\n tabindex=${ifDefined(this.tabIndex)}\n @input=${this.onInput}\n @change=${this.onChange} />`;\n }\n\n private renderAutoWidthBackground() {\n return html` <div id=\"auto\" aria-hidden=\"true\">${this.renderText()}</div>`;\n }\n\n private renderText() {\n return html`${(this.value as string).length > 0\n ? this.value\n : this.placeholder}`;\n }\n\n static override readonly styles = [\n css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: stretch;\n height: var(--uui-input-height, var(--uui-size-11));\n text-align: left;\n color: var(--uui-color-text);\n color-scheme: var(--uui-color-scheme, normal);\n box-sizing: border-box;\n background-color: var(\n --uui-input-background-color,\n var(--uui-color-surface)\n );\n border: var(--uui-input-border-width, 1px) solid\n var(--uui-input-border-color, var(--uui-color-border));\n border-radius: var(--uui-input-border-radius, var(--uui-border-radius));\n min-width: 0;\n overflow: hidden;\n\n --uui-input-padding: 1px var(--uui-size-3);\n --uui-button-height: 100%;\n --uui-button-border-radius: var(\n --uui-input-border-radius,\n var(--uui-border-radius)\n );\n --auto-width-text-margin-right: 0;\n --auto-width-text-margin-left: 0;\n }\n\n #autoWidth {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n justify-content: center;\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0;\n }\n\n #auto {\n border: 0 1px solid transparent;\n visibility: hidden;\n white-space: pre;\n z-index: -1;\n height: 0px;\n padding: 0 var(--uui-size-space-3);\n margin: 0 var(--auto-width-text-margin-right) 0\n var(--auto-width-text-margin-left);\n }\n\n :host(:hover) {\n border-color: var(\n --uui-input-border-color-hover,\n var(--uui-color-border-standalone)\n );\n }\n /* TODO: Fix so we dont get double outline when there is focus on things in the slot. */\n :host(:focus-within) {\n border-color: var(\n --uui-input-border-color-focus,\n var(--uui-color-border-emphasis)\n );\n outline: 2px solid var(--uui-color-focus);\n }\n :host(:focus) {\n border-color: var(\n --uui-input-border-color-focus,\n var(--uui-color-border-emphasis)\n );\n }\n :host([disabled]) {\n background-color: var(\n --uui-input-background-color-disabled,\n var(--uui-color-disabled)\n );\n border-color: var(\n --uui-input-border-color-disabled,\n var(--uui-color-disabled)\n );\n\n color: var(--uui-color-disabled-contrast);\n }\n :host([disabled]) input {\n -webkit-text-fill-color: var(\n --uui-color-disabled-contrast\n ); /* required on Safari and IOS */\n }\n :host([readonly]) {\n background-color: var(\n --uui-input-background-color-readonly,\n var(--uui-color-disabled)\n );\n border-color: var(\n --uui-input-border-color-readonly,\n var(--uui-color-disabled-standalone)\n );\n }\n\n :host(:not([pristine]):invalid),\n /* polyfill support */\n :host(:not([pristine])[internals-invalid]) {\n border-color: var(--uui-color-invalid);\n }\n\n input {\n font-family: inherit;\n padding: var(--uui-input-padding);\n font-size: inherit;\n color: inherit;\n border-radius: var(--uui-border-radius);\n box-sizing: border-box;\n border: none;\n background: none;\n min-width: 0;\n flex-grow: 1;\n flex-shrink: 1;\n height: inherit;\n text-align: inherit;\n outline: none;\n text-overflow: ellipsis;\n line-height: 1;\n flex: 1 1 auto;\n min-width: 60px;\n }\n\n input[type='password']::-ms-reveal {\n display: none;\n }\n\n /* TODO: make sure color looks good, or remove it as an option as we want to provide color-picker component */\n input[type='color'] {\n width: 30px;\n padding: 0;\n border: none;\n }\n\n slot[name='prepend'],\n slot[name='append'] {\n display: flex;\n align-items: center;\n line-height: 1;\n height: 100%;\n min-width: 0;\n }\n\n uui-input,\n uui-input-lock,\n ::slotted(uui-input),\n ::slotted(uui-input-lock) {\n height: 100%;\n --uui-input-border-width: 0;\n }\n\n uui-button,\n ::slotted(uui-button) {\n height: 100%;\n --uui-button-border-width: 0;\n }\n\n #inner {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 4px;\n flex: 1 1 auto;\n min-width: 0;\n padding: 2px;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6DO,MAAM,mBAAN,MAAM,yBAAwB;AAAA,EACnC,WAAW,IAAI,UAAU;AAAA,EACzB;AACF,EAAE;AAAA,EAoKA,cAAc;AACZ,UAAA;AAxKG;AAmCL,SAAA,mBAA6D,CAAA,cAC3D,GAAG,SAAS;AA2Bd,SAAA,mBAAwE,CACtE,KACA,YACG,WA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AE,MAAM,SAAS,SAAS,MAAM;AAAA,GA5F/B,gBA6FX,WAAA,YAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAA;AAAS,GArGC,gBAsGX,WAAA,eAAA,CAAA;AASA,gBAAA;AAAA,EADC,SAAA;AAAS,GA9GC,gBA+GX,WAAA,gBAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,cAAc;AAAA,GAtHxD,gBAuHX,WAAA,aAAA,CAAA;AAUI,gBAAA;AAAA,EADH,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAhIf,gBAiIP,WAAA,QAAA,CAAA;AAeJ,gBAAA;AAAA,EADC,SAAS,EAAE,WAAW,YAAA,CAAa;AAAA,GA/IzB,gBAgJX,WAAA,aAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAvJf,gBAwJX,WAAA,WAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAO,WAAW,YAAY;AAAA,GA/JtD,gBAgKX,WAAA,YAAA,CAAA;AAGS,gBAAA;AAAA,EADR,MAAM,QAAQ;AAAA,GAlKJ,gBAmKF,WAAA,UAAA,CAAA;"}
@@ -113,8 +113,8 @@ updateSidebars_fn = function() {
113
113
  );
114
114
  });
115
115
  if (nextSidebar?.hasAttribute("hide")) break;
116
- const currentWidth = sidebar.shadowRoot?.querySelector("[popover]")?.getBoundingClientRect().width ?? 0;
117
- const nextWidth = nextSidebar?.shadowRoot?.querySelector("[popover]")?.getBoundingClientRect().width ?? 0;
116
+ const currentWidth = sidebar.shadowRoot?.querySelector("dialog")?.getBoundingClientRect().width ?? 0;
117
+ const nextWidth = nextSidebar?.shadowRoot?.querySelector("dialog")?.getBoundingClientRect().width ?? 0;
118
118
  const distance = currentWidth + sidebarOffset + this.sidebarGap - nextWidth;
119
119
  sidebarOffset = Math.max(distance, 0);
120
120
  }
@@ -137,10 +137,6 @@ _UUIModalContainerElement.styles = css`
137
137
  :host([backdrop])::after {
138
138
  opacity: 1;
139
139
  }
140
- :host([backdrop])::after {
141
- opacity: 1;
142
- pointer-events: auto;
143
- }
144
140
  `;
145
141
  let UUIModalContainerElement = _UUIModalContainerElement;
146
142
  __decorateClass([
@@ -1 +1 @@
1
- {"version":3,"file":"modal-container.js","sources":["../../../src/components/modal/modal-container.ts"],"sourcesContent":["import type { PropertyValueMap } from 'lit';\nimport { LitElement, css, html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { UUIModalSidebarElement } from './modal-sidebar.element.js';\nimport { UUIModalCloseEvent, UUIModalElement } from './modal.element.js';\nexport class UUIModalContainerElement extends LitElement {\n @query('slot')\n modalSlot?: HTMLSlotElement;\n\n @state()\n private _modals?: Array<UUIModalElement>;\n\n @state()\n private _sidebars?: Array<UUIModalSidebarElement>;\n\n @property({ type: Number })\n sidebarGap = 64;\n\n @property({ type: Number })\n transitionDurationMS = 250;\n\n constructor() {\n super();\n this.addEventListener(UUIModalCloseEvent, this.#onCloseModalClose);\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n this.style.setProperty(\n '--uui-modal-transition-duration',\n this.transitionDurationMS + 'ms',\n );\n }\n\n readonly #onSlotChange = () => {\n const existingModals = this._modals ?? [];\n\n this._modals =\n (this.modalSlot\n ?.assignedElements({ flatten: true })\n .filter(\n el => el instanceof UUIModalElement,\n ) as Array<UUIModalElement>) ?? [];\n\n const oldModals = existingModals.filter(\n modal => !this._modals!.includes(modal),\n );\n oldModals.forEach(modal =>\n modal.removeEventListener(UUIModalCloseEvent, this.#onCloseModalClose),\n );\n\n const newModals = this._modals.filter(\n modal => !existingModals.includes(modal),\n );\n newModals.forEach(modal =>\n modal.addEventListener(UUIModalCloseEvent, this.#onCloseModalClose),\n );\n\n this._sidebars = this._modals.filter(\n el => el instanceof UUIModalSidebarElement,\n );\n\n if (this._modals.length === 0) {\n this.removeAttribute('backdrop');\n return;\n }\n\n this.#updateModals();\n this.#updateSidebars();\n };\n\n readonly #onCloseModalClose = (event: Event) => {\n event.stopImmediatePropagation();\n\n event.target?.removeEventListener(\n UUIModalCloseEvent,\n this.#onCloseModalClose,\n );\n if (!this._modals || this._modals.length <= 1) {\n this.removeAttribute('backdrop');\n return;\n }\n\n this.#updateModals();\n this.#updateSidebars();\n };\n\n #updateModals() {\n this.setAttribute('backdrop', '');\n\n const reverse =\n this._modals?.filter(modal => !modal.isClosing).reverse() ?? [];\n\n //set index to all modals, the one in front is 0\n reverse?.forEach((modal, index) => {\n modal.index = index;\n modal.transitionDuration = this.transitionDurationMS;\n });\n\n //set unique-index on all modals based on which modal of the same type it is, the one in front is 0.\n reverse?.forEach(modal => {\n const sameType = reverse?.filter(\n m => m.constructor.name === modal.constructor.name,\n );\n\n modal.uniqueIndex = sameType?.indexOf(modal) ?? 0;\n });\n }\n\n #updateSidebars() {\n requestAnimationFrame(() => {\n let sidebarOffset = 0;\n const reversed =\n this._sidebars?.filter(modal => !modal.isClosing).reverse() ?? [];\n\n for (let i = 0; i < reversed.length; i++) {\n const sidebar = reversed[i];\n const nextSidebar = reversed[i + 1];\n const tempSidebarOffset = sidebarOffset; // Cache to prevent it from being overwritten before the updateComplete.\n // The sidebar checks it's own width at sets it's --uui-modal-offset to negative that width.\n // This enables it to slide in from the right. So we need to set the new --uui-modal-offset after the updateComplete.\n sidebar.updateComplete.then(() => {\n sidebar.style.setProperty(\n '--uui-modal-offset',\n tempSidebarOffset + 'px',\n );\n });\n\n // Stop the calculations if the next sidebar is hidden\n if (nextSidebar?.hasAttribute('hide')) break;\n\n //TODO: is there a better way to get the width of the sidebar?\n const currentWidth =\n sidebar.shadowRoot\n ?.querySelector('[popover]')\n ?.getBoundingClientRect().width ?? 0;\n\n //TODO: is there a better way to get the width of the sidebar?\n const nextWidth =\n nextSidebar?.shadowRoot\n ?.querySelector('[popover]')\n ?.getBoundingClientRect().width ?? 0;\n const distance =\n currentWidth + sidebarOffset + this.sidebarGap - nextWidth;\n sidebarOffset = Math.max(distance, 0);\n }\n });\n }\n\n render() {\n return html`<slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n static readonly styles = css`\n :host {\n position: fixed;\n --uui-modal-color-backdrop: rgba(0, 0, 0, 0.5);\n }\n :host::after {\n content: '';\n position: fixed;\n inset: 0;\n background-color: var(--uui-modal-color-backdrop, rgba(0, 0, 0, 0.5));\n opacity: 0;\n pointer-events: none;\n transition: opacity var(--uui-modal-transition-duration, 250ms);\n }\n :host([backdrop])::after {\n opacity: 1;\n }\n :host([backdrop])::after {\n opacity: 1;\n pointer-events: auto;\n }\n `;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,4BAAN,MAAM,kCAAiC,WAAW;AAAA,EAgBvD,cAAc;AACZ,UAAA;AAjBG;AAgCI;AAqCA;AA1DT,SAAA,aAAa;AAGb,SAAA,uBAAuB;AAkBvB,uBAAS,eAAgB,MAAM;AAC7B,YAAM,iBAAiB,KAAK,WAAW,CAAA;AAEvC,WAAK,UACF,KAAK,WACF,iBAAiB,EAAE,SAAS,KAAA,CAAM,EACnC;AAAA,QACC,QAAM,cAAc;AAAA,MAAA,KACU,CAAA;AAEpC,YAAM,YAAY,eAAe;AAAA,QAC/B,CAAA,UAAS,CAAC,KAAK,QAAS,SAAS,KAAK;AAAA,MAAA;AAExC,gBAAU;AAAA,QAAQ,CAAA,UAChB,MAAM,oBAAoB,oBAAoB,mBAAK,mBAAkB;AAAA,MAAA;AAGvE,YAAM,YAAY,KAAK,QAAQ;AAAA,QAC7B,CAAA,UAAS,CAAC,eAAe,SAAS,KAAK;AAAA,MAAA;AAEzC,gBAAU;AAAA,QAAQ,CAAA,UAChB,MAAM,iBAAiB,oBAAoB,mBAAK,mBAAkB;AAAA,MAAA;AAGpE,WAAK,YAAY,KAAK,QAAQ;AAAA,QAC5B,Q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O,CAAA,UAAS,CAAC,MAAM,SAAS,EAAE,QAAA,KAAa,CAAA;AAEjE,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,UAAU,SAAS,CAAC;AAC1B,YAAM,cAAc,SAAS,IAAI,CAAC;AAClC,YAAM,oBAAoB;AAG1B,cAAQ,eAAe,KAAK,MAAM;AAChC,gBAAQ,MAAM;AAAA,UACZ;AAAA,UACA,oBAAoB;AAAA,QAAA;AAAA,MAExB,CAAC;AAGD,UAAI,aAAa,aAAa,MAAM,EAAG;AAGvC,YAAM,eACJ,QAAQ,YACJ,cAAc,WAAW,GACzB,wBAAwB,SAAS;AAGvC,YAAM,YACJ,aAAa,YACT,cAAc,WAAW,GACzB,wBAAwB,SAAS;AACvC,YAAM,WACJ,eAAe,gBAAgB,KAAK,aAAa;AACnD,sBAAgB,KAAK,IAAI,UAAU,CAAC;AAAA,IACtC;AAAA,EACF,CAAC;AACH;AAKA,0BAAgB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAtJpB,IAAM,2BAAN;AAEL,gBAAA;AAAA,EADC,MAAM,MAAM;AAAA,GADF,yBAEX,WAAA,WAAA;AAGQ,gBAAA;AAAA,EADP,MAAA;AAAM,GAJI,yBAKH,WAAA,SAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAPI,yBAQH,WAAA,WAAA;AAGR,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAVf,yBAWX,WAAA,YAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAbf,yBAcX,WAAA,sBAAA;"}
1
+ {"version":3,"file":"modal-container.js","sources":["../../../src/components/modal/modal-container.ts"],"sourcesContent":["import type { PropertyValueMap } from 'lit';\nimport { LitElement, css, html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { UUIModalSidebarElement } from './modal-sidebar.element.js';\nimport { UUIModalCloseEvent, UUIModalElement } from './modal.element.js';\nexport class UUIModalContainerElement extends LitElement {\n @query('slot')\n modalSlot?: HTMLSlotElement;\n\n @state()\n private _modals?: Array<UUIModalElement>;\n\n @state()\n private _sidebars?: Array<UUIModalSidebarElement>;\n\n @property({ type: Number })\n sidebarGap = 64;\n\n @property({ type: Number })\n transitionDurationMS = 250;\n\n constructor() {\n super();\n this.addEventListener(UUIModalCloseEvent, this.#onCloseModalClose);\n }\n\n protected firstUpdated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n this.style.setProperty(\n '--uui-modal-transition-duration',\n this.transitionDurationMS + 'ms',\n );\n }\n\n readonly #onSlotChange = () => {\n const existingModals = this._modals ?? [];\n\n this._modals =\n (this.modalSlot\n ?.assignedElements({ flatten: true })\n .filter(\n el => el instanceof UUIModalElement,\n ) as Array<UUIModalElement>) ?? [];\n\n const oldModals = existingModals.filter(\n modal => !this._modals!.includes(modal),\n );\n oldModals.forEach(modal =>\n modal.removeEventListener(UUIModalCloseEvent, this.#onCloseModalClose),\n );\n\n const newModals = this._modals.filter(\n modal => !existingModals.includes(modal),\n );\n newModals.forEach(modal =>\n modal.addEventListener(UUIModalCloseEvent, this.#onCloseModalClose),\n );\n\n this._sidebars = this._modals.filter(\n el => el instanceof UUIModalSidebarElement,\n );\n\n if (this._modals.length === 0) {\n this.removeAttribute('backdrop');\n return;\n }\n\n this.#updateModals();\n this.#updateSidebars();\n };\n\n readonly #onCloseModalClose = (event: Event) => {\n event.stopImmediatePropagation();\n\n event.target?.removeEventListener(\n UUIModalCloseEvent,\n this.#onCloseModalClose,\n );\n if (!this._modals || this._modals.length <= 1) {\n this.removeAttribute('backdrop');\n return;\n }\n\n this.#updateModals();\n this.#updateSidebars();\n };\n\n #updateModals() {\n this.setAttribute('backdrop', '');\n\n const reverse =\n this._modals?.filter(modal => !modal.isClosing).reverse() ?? [];\n\n //set index to all modals, the one in front is 0\n reverse?.forEach((modal, index) => {\n modal.index = index;\n modal.transitionDuration = this.transitionDurationMS;\n });\n\n //set unique-index on all modals based on which modal of the same type it is, the one in front is 0.\n reverse?.forEach(modal => {\n const sameType = reverse?.filter(\n m => m.constructor.name === modal.constructor.name,\n );\n\n modal.uniqueIndex = sameType?.indexOf(modal) ?? 0;\n });\n }\n\n #updateSidebars() {\n requestAnimationFrame(() => {\n let sidebarOffset = 0;\n const reversed =\n this._sidebars?.filter(modal => !modal.isClosing).reverse() ?? [];\n\n for (let i = 0; i < reversed.length; i++) {\n const sidebar = reversed[i];\n const nextSidebar = reversed[i + 1];\n const tempSidebarOffset = sidebarOffset; // Cache to prevent it from being overwritten before the updateComplete.\n // The sidebar checks it's own width at sets it's --uui-modal-offset to negative that width.\n // This enables it to slide in from the right. So we need to set the new --uui-modal-offset after the updateComplete.\n sidebar.updateComplete.then(() => {\n sidebar.style.setProperty(\n '--uui-modal-offset',\n tempSidebarOffset + 'px',\n );\n });\n\n // Stop the calculations if the next sidebar is hidden\n if (nextSidebar?.hasAttribute('hide')) break;\n\n //TODO: is there a better way to get the width of the sidebar?\n const currentWidth =\n sidebar.shadowRoot?.querySelector('dialog')?.getBoundingClientRect()\n .width ?? 0;\n\n //TODO: is there a better way to get the width of the sidebar?\n const nextWidth =\n nextSidebar?.shadowRoot\n ?.querySelector('dialog')\n ?.getBoundingClientRect().width ?? 0;\n const distance =\n currentWidth + sidebarOffset + this.sidebarGap - nextWidth;\n sidebarOffset = Math.max(distance, 0);\n }\n });\n }\n\n render() {\n return html`<slot @slotchange=${this.#onSlotChange}></slot>`;\n }\n static readonly styles = css`\n :host {\n position: fixed;\n --uui-modal-color-backdrop: rgba(0, 0, 0, 0.5);\n }\n :host::after {\n content: '';\n position: fixed;\n inset: 0;\n background-color: var(--uui-modal-color-backdrop, rgba(0, 0, 0, 0.5));\n opacity: 0;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AAY,cAAc,QAAQ,GAAG,wBAC1C,SAAS;AAGd,YAAM,YACJ,aAAa,YACT,cAAc,QAAQ,GACtB,wBAAwB,SAAS;AACvC,YAAM,WACJ,eAAe,gBAAgB,KAAK,aAAa;AACnD,sBAAgB,KAAK,IAAI,UAAU,CAAC;AAAA,IACtC;AAAA,EACF,CAAC;AACH;AAKA,0BAAgB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AArJpB,IAAM,2BAAN;AAEL,gBAAA;AAAA,EADC,MAAM,MAAM;AAAA,GADF,yBAEX,WAAA,WAAA;AAGQ,gBAAA;AAAA,EADP,MAAA;AAAM,GAJI,yBAKH,WAAA,SAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAPI,yBAQH,WAAA,WAAA;AAGR,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAVf,yBAWX,WAAA,YAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAbf,yBAcX,WAAA,sBAAA;"}
@@ -3,9 +3,9 @@ import { UUIModalElement } from "./modal.element.js";
3
3
  const _UUIModalDialogElement = class _UUIModalDialogElement extends UUIModalElement {
4
4
  render() {
5
5
  return html`
6
- <div popover="manual" role="dialog" aria-modal="true" aria-label="Dialog">
6
+ <dialog>
7
7
  <slot></slot>
8
- </div>
8
+ </dialog>
9
9
  `;
10
10
  }
11
11
  };
@@ -16,7 +16,7 @@ _UUIModalDialogElement.styles = [
16
16
  outline: none;
17
17
  --uui-modal-dialog-background: var(--uui-color-surface);
18
18
  }
19
- [popover] {
19
+ dialog {
20
20
  margin: auto;
21
21
  max-width: 100%;
22
22
  max-height: 100%;
@@ -29,10 +29,10 @@ _UUIModalDialogElement.styles = [
29
29
  var(--uui-color-surface)
30
30
  );
31
31
  }
32
- :host([index='0']) [popover] {
32
+ :host([index='0']) dialog {
33
33
  box-shadow: var(--uui-shadow-depth-5);
34
34
  }
35
- :host(:not([index='0'])) [popover] {
35
+ :host(:not([index='0'])) dialog {
36
36
  outline: 1px solid rgba(0, 0, 0, 0.1);
37
37
  }
38
38
  `
@@ -1 +1 @@
1
- {"version":3,"file":"modal-dialog.element.js","sources":["../../../src/components/modal/modal-dialog.element.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { UUIModalElement } from './modal.element.js';\nexport class UUIModalDialogElement extends UUIModalElement {\n render() {\n return html`\n <div popover=\"manual\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Dialog\">\n <slot></slot>\n </div>\n `;\n }\n\n static override readonly styles = [\n ...UUIModalElement.styles,\n css`\n :host {\n outline: none;\n --uui-modal-dialog-background: var(--uui-color-surface);\n }\n [popover] {\n margin: auto;\n max-width: 100%;\n max-height: 100%;\n border-radius: var(\n --uui-modal-dialog-border-radius,\n var(--uui-border-radius-3)\n );\n background: var(\n --uui-modal-dialog-background,\n var(--uui-color-surface)\n );\n }\n :host([index='0']) [popover] {\n box-shadow: var(--uui-shadow-depth-5);\n }\n :host(:not([index='0'])) [popover] {\n outline: 1px solid rgba(0, 0, 0, 0.1);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;AAEO,MAAM,yBAAN,MAAM,+BAA8B,gBAAgB;AAAA,EACzD,SAAS;AACP,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKT;AA8BF;AA5BE,uBAAyB,SAAS;AAAA,EAChC,GAAG,gBAAgB;AAAA,EACnB;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;AAXG,IAAM,wBAAN;"}
1
+ {"version":3,"file":"modal-dialog.element.js","sources":["../../../src/components/modal/modal-dialog.element.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { UUIModalElement } from './modal.element.js';\nexport class UUIModalDialogElement extends UUIModalElement {\n render() {\n return html`\n <dialog>\n <slot></slot>\n </dialog>\n `;\n }\n\n static override readonly styles = [\n ...UUIModalElement.styles,\n css`\n :host {\n outline: none;\n --uui-modal-dialog-background: var(--uui-color-surface);\n }\n dialog {\n margin: auto;\n max-width: 100%;\n max-height: 100%;\n border-radius: var(\n --uui-modal-dialog-border-radius,\n var(--uui-border-radius-3)\n );\n background: var(\n --uui-modal-dialog-background,\n var(--uui-color-surface)\n );\n }\n :host([index='0']) dialog {\n box-shadow: var(--uui-shadow-depth-5);\n }\n :host(:not([index='0'])) dialog {\n outline: 1px solid rgba(0, 0, 0, 0.1);\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;AAEO,MAAM,yBAAN,MAAM,+BAA8B,gBAAgB;AAAA,EACzD,SAAS;AACP,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKT;AA8BF;AA5BE,uBAAyB,SAAS;AAAA,EAChC,GAAG,gBAAgB;AAAA,EACnB;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;AAXG,IAAM,wBAAN;"}
@@ -44,18 +44,14 @@ const _UUIModalSidebarElement = class _UUIModalSidebarElement extends UUIModalEl
44
44
  }, this.transitionDuration);
45
45
  }
46
46
  render() {
47
- return html`<div
48
- popover="manual"
49
- role="dialog"
50
- aria-modal="true"
51
- aria-label="Dialog">
47
+ return html`<dialog>
52
48
  <slot></slot>
53
- </div>`;
49
+ </dialog>`;
54
50
  }
55
51
  };
56
52
  _UUIModalSidebarElement_instances = new WeakSet();
57
53
  getWidth_get = function() {
58
- return this._popoverElement?.getBoundingClientRect().width ?? 0;
54
+ return this._dialogElement?.getBoundingClientRect().width ?? 0;
59
55
  };
60
56
  _UUIModalSidebarElement.styles = [
61
57
  ...UUIModalElement.styles,
@@ -70,7 +66,7 @@ _UUIModalSidebarElement.styles = [
70
66
  --uui-modal-sidebar-left-gap: 64px;
71
67
  }
72
68
  }
73
- [popover] {
69
+ dialog {
74
70
  height: 100%;
75
71
  width: 100%;
76
72
  box-sizing: border-box;
@@ -83,22 +79,22 @@ _UUIModalSidebarElement.styles = [
83
79
  var(--uui-color-surface)
84
80
  );
85
81
  }
86
- :host([index='0']) [popover] {
82
+ :host([index='0']) dialog {
87
83
  box-shadow: var(--uui-shadow-depth-5);
88
84
  }
89
- :host(:not([index='0'])) [popover] {
85
+ :host(:not([index='0'])) dialog {
90
86
  outline: 1px solid rgba(0, 0, 0, 0.1);
91
87
  }
92
- :host([hide]) [popover] {
88
+ :host([hide]) dialog {
93
89
  display: none;
94
90
  }
95
- :host([size='large']) [popover] {
91
+ :host([size='large']) dialog {
96
92
  max-width: min(1200px, calc(100% - var(--uui-modal-sidebar-left-gap)));
97
93
  }
98
- :host([size='medium']) [popover] {
94
+ :host([size='medium']) dialog {
99
95
  max-width: min(800px, calc(100% - var(--uui-modal-sidebar-left-gap)));
100
96
  }
101
- :host([size='small']) [popover] {
97
+ :host([size='small']) dialog {
102
98
  max-width: min(500px, calc(100% - var(--uui-modal-sidebar-left-gap)));
103
99
  }
104
100
  `
@@ -1 +1 @@
1
- {"version":3,"file":"modal-sidebar.element.js","sources":["../../../src/components/modal/modal-sidebar.element.ts"],"sourcesContent":["import type { PropertyValueMap } from 'lit';\nimport { css, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { UUIModalElement } from './modal.element.js';\nexport type UUIModalSidebarSize = 'small' | 'medium' | 'large' | 'full';\n\nexport class UUIModalSidebarElement extends UUIModalElement {\n /**\n * @attr\n */\n @property({ reflect: true })\n size: UUIModalSidebarSize = 'full';\n\n protected firstUpdated(\n _changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n this.style.setProperty('--uui-modal-offset', -this.#getWidth + 'px');\n }\n\n protected updated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.updated(_changedProperties);\n\n // if we've reached over X layers of sidebars, hide for better performance.\n if (this.uniqueIndex > 10) {\n this.setAttribute('hide', '');\n } else {\n this.removeAttribute('hide');\n }\n }\n\n get #getWidth() {\n return this._popoverElement?.getBoundingClientRect().width ?? 0;\n }\n\n forceClose() {\n if (this.isClosing) return;\n\n this.isClosing = true;\n this.style.setProperty('--uui-modal-offset', -this.#getWidth + 'px');\n\n setTimeout(() => {\n super.forceClose();\n }, this.transitionDuration);\n }\n\n render() {\n return html`<div\n popover=\"manual\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Dialog\">\n <slot></slot>\n </div>`;\n }\n\n static override readonly styles = [\n ...UUIModalElement.styles,\n css`\n :host {\n outline: none;\n --uui-modal-sidebar-left-gap: 24px;\n --uui-modal-sidebar-background: var(--uui-color-surface);\n }\n @media (min-width: 600px) {\n :host {\n --uui-modal-sidebar-left-gap: 64px;\n }\n }\n [popover] {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n max-width: calc(100% - var(--uui-modal-sidebar-left-gap));\n margin-left: auto;\n right: var(--uui-modal-offset);\n transition: right var(--uui-modal-transition-duration, 250ms);\n background: var(\n --uui-modal-sidebar-background,\n var(--uui-color-surface)\n );\n }\n :host([index='0']) [popover] {\n box-shadow: var(--uui-shadow-depth-5);\n }\n :host(:not([index='0'])) [popover] {\n outline: 1px solid rgba(0, 0, 0, 0.1);\n }\n :host([hide]) [popover] {\n display: none;\n }\n :host([size='large']) [popover] {\n max-width: min(1200px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n :host([size='medium']) [popover] {\n max-width: min(800px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n :host([size='small']) [popover] {\n max-width: min(500px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMO,MAAM,0BAAN,M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src/components/modal/modal-sidebar.element.ts"],"sourcesContent":["import type { PropertyValueMap } from 'lit';\nimport { css, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { UUIModalElement } from './modal.element.js';\nexport type UUIModalSidebarSize = 'small' | 'medium' | 'large' | 'full';\n\nexport class UUIModalSidebarElement extends UUIModalElement {\n /**\n * @attr\n */\n @property({ reflect: true })\n size: UUIModalSidebarSize = 'full';\n\n protected firstUpdated(\n _changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n this.style.setProperty('--uui-modal-offset', -this.#getWidth + 'px');\n }\n\n protected updated(\n _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,\n ): void {\n super.updated(_changedProperties);\n\n // if we've reached over X layers of sidebars, hide for better performance.\n if (this.uniqueIndex > 10) {\n this.setAttribute('hide', '');\n } else {\n this.removeAttribute('hide');\n }\n }\n\n get #getWidth() {\n return this._dialogElement?.getBoundingClientRect().width ?? 0;\n }\n\n forceClose() {\n if (this.isClosing) return;\n\n this.isClosing = true;\n this.style.setProperty('--uui-modal-offset', -this.#getWidth + 'px');\n\n setTimeout(() => {\n super.forceClose();\n }, this.transitionDuration);\n }\n\n render() {\n return html`<dialog>\n <slot></slot>\n </dialog>`;\n }\n\n static override readonly styles = [\n ...UUIModalElement.styles,\n css`\n :host {\n outline: none;\n --uui-modal-sidebar-left-gap: 24px;\n --uui-modal-sidebar-background: var(--uui-color-surface);\n }\n @media (min-width: 600px) {\n :host {\n --uui-modal-sidebar-left-gap: 64px;\n }\n }\n dialog {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n max-width: calc(100% - var(--uui-modal-sidebar-left-gap));\n margin-left: auto;\n right: var(--uui-modal-offset);\n transition: right var(--uui-modal-transition-duration, 250ms);\n background: var(\n --uui-modal-sidebar-background,\n var(--uui-color-surface)\n );\n }\n :host([index='0']) dialog {\n box-shadow: var(--uui-shadow-depth-5);\n }\n :host(:not([index='0'])) dialog {\n outline: 1px solid rgba(0, 0, 0, 0.1);\n }\n :host([hide]) dialog {\n display: none;\n }\n :host([size='large']) dialog {\n max-width: min(1200px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n :host([size='medium']) dialog {\n max-width: min(800px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n :host([size='small']) dialog {\n max-width: min(500px, calc(100% - var(--uui-modal-sidebar-left-gap)));\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMO,MAAM,0BAAN,MAAM,gCAA+B,gBAAgB;AAAA,EAArD,cAAA;AAAA,UAAA,GAAA,SAAA;AAAA;AAKL,SAAA,OAA4B;AAAA,EAAA;AAAA,EAElB,aACR,oBACM;AACN,UAAM,aAAa,kBAAkB;AAErC,SAAK,MAAM,YAAY,sBAAsB,CAAC,mBAAK,mDAAY,IAAI;AAAA,EACrE;AAAA,EAEU,QACR,oBACM;AACN,UAAM,QAAQ,kBAAkB;AAGhC,QAAI,KAAK,cAAc,IAAI;AACzB,WAAK,aAAa,QAAQ,EAAE;AAAA,IAC9B,OAAO;AACL,WAAK,gBAAgB,MAAM;AAAA,IAC7B;AAAA,EACF;AAAA,EAMA,aAAa;AACX,QAAI,KAAK,UAAW;AAEpB,SAAK,YAAY;AACjB,SAAK,MAAM,YAAY,sBAAsB,CAAC,mBAAK,mDAAY,IAAI;AAEnE,eAAW,MAAM;AACf,YAAM,WAAA;AAAA,IACR,GAAG,KAAK,kBAAkB;AAAA,EAC5B;AAAA,EAEA,SAAS;AACP,WAAO;AAAA;AAAA;AAAA,EAGT;AAgDF;AA/FO;AA4BD,eAAA,WAAY;AACd,SAAO,KAAK,gBAAgB,sBAAA,EAAwB,SAAS;AAC/D;AAmBA,wBAAyB,SAAS;AAAA,EAChC,GAAG,gBAAgB;AAAA,EACnB;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;AAnDG,IAAM,yBAAN;AAKL,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAJhB,uBAKX,WAAA,MAAA;"}
@@ -3,7 +3,7 @@ export declare const UUIModalOpenEvent = "uui:modal-open";
3
3
  export declare const UUIModalCloseEvent = "uui:modal-close";
4
4
  export declare const UUIModalCloseEndEvent = "uui:modal-close-end";
5
5
  export declare class UUIModalElement extends LitElement {
6
- protected readonly _popoverElement?: HTMLElement;
6
+ protected readonly _dialogElement?: HTMLDialogElement;
7
7
  isOpen: boolean;
8
8
  isClosing: boolean;
9
9
  index: number;
@@ -16,7 +16,5 @@ export declare class UUIModalElement extends LitElement {
16
16
  close: (event?: Event) => void;
17
17
  protected _openModal(): void;
18
18
  forceClose(): void;
19
- private readonly _onKeydown;
20
- private readonly _onFocusTrap;
21
19
  static readonly styles: import("lit").CSSResult[];
22
20
  }
@@ -45,17 +45,6 @@ const _UUIModalElement = class _UUIModalElement extends LitElement {
45
45
  if (closeEvent.defaultPrevented) return;
46
46
  this.forceClose();
47
47
  };
48
- this._onKeydown = (e) => {
49
- if (e.key === "Escape" && this.index === 0) {
50
- this.close();
51
- }
52
- };
53
- this._onFocusTrap = (e) => {
54
- if (this.index !== 0) return;
55
- if (!this._popoverElement?.contains(e.target)) {
56
- this._popoverElement?.focus();
57
- }
58
- };
59
48
  }
60
49
  get transitionDuration() {
61
50
  return this._transitionDuration;
@@ -75,19 +64,13 @@ const _UUIModalElement = class _UUIModalElement extends LitElement {
75
64
  }
76
65
  _openModal() {
77
66
  this.isOpen = true;
78
- this._popoverElement?.showPopover();
79
- if (!this._popoverElement?.hasAttribute("tabindex")) {
80
- this._popoverElement?.setAttribute("tabindex", "-1");
81
- }
82
- document.addEventListener("keydown", this._onKeydown);
83
- document.addEventListener("focus", this._onFocusTrap, true);
67
+ this._dialogElement?.showModal();
68
+ this._dialogElement?.addEventListener("cancel", this.close);
84
69
  }
85
70
  forceClose() {
86
71
  this.isClosing = true;
87
72
  this.isOpen = false;
88
- this._popoverElement?.hidePopover();
89
- document.removeEventListener("keydown", this._onKeydown);
90
- document.removeEventListener("focus", this._onFocusTrap, true);
73
+ this._dialogElement?.close();
91
74
  this.dispatchEvent(new CustomEvent("close-end"));
92
75
  this.dispatchEvent(new CustomEvent(UUIModalCloseEndEvent));
93
76
  this.remove();
@@ -95,9 +78,7 @@ const _UUIModalElement = class _UUIModalElement extends LitElement {
95
78
  };
96
79
  _UUIModalElement.styles = [
97
80
  css`
98
- [popover] {
99
- position: fixed;
100
- inset: 0;
81
+ dialog {
101
82
  display: block;
102
83
  margin: 0;
103
84
  padding: 0;
@@ -107,7 +88,11 @@ _UUIModalElement.styles = [
107
88
  background: none;
108
89
  color: var(--uui-color-text);
109
90
  }
110
- [popover]::after {
91
+ dialog::backdrop {
92
+ background: none;
93
+ opacity: 0;
94
+ }
95
+ dialog::after {
111
96
  content: '';
112
97
  position: absolute;
113
98
  inset: 0;
@@ -117,19 +102,15 @@ _UUIModalElement.styles = [
117
102
  transition: opacity var(--uui-modal-transition-duration, 250ms);
118
103
  z-index: 1;
119
104
  }
120
- :host([index='0']) [popover]::after {
105
+ :host([index='0']) dialog::after {
121
106
  opacity: 0;
122
- pointer-events: none;
123
- }
124
- :host(:not([index='0'])) [popover]::after {
125
- pointer-events: auto;
126
107
  }
127
108
  `
128
109
  ];
129
110
  let UUIModalElement = _UUIModalElement;
130
111
  __decorateClass([
131
- query("[popover]")
132
- ], UUIModalElement.prototype, "_popoverElement", 2);
112
+ query("dialog")
113
+ ], UUIModalElement.prototype, "_dialogElement", 2);
133
114
  __decorateClass([
134
115
  property({ type: Boolean, reflect: true, attribute: "is-open" })
135
116
  ], UUIModalElement.prototype, "isOpen", 2);
@@ -1 +1 @@
1
- {"version":3,"file":"modal.element.js","sources":["../../../src/components/modal/modal.element.ts"],"sourcesContent":["import { LitElement, css } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nexport const UUIModalOpenEvent = 'uui:modal-open';\nexport const UUIModalCloseEvent = 'uui:modal-close';\nexport const UUIModalCloseEndEvent = 'uui:modal-close-end';\n\nexport class UUIModalElement extends LitElement {\n @query('[popover]')\n protected readonly _popoverElement?: HTMLElement;\n\n @property({ type: Boolean, reflect: true, attribute: 'is-open' })\n isOpen = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'is-closing' })\n isClosing = false;\n\n @property({ type: Number, reflect: true })\n index = 0;\n\n @property({ type: Number, reflect: true, attribute: 'unique-index' })\n uniqueIndex = 0;\n\n private _transitionDuration = 250;\n\n @property({ type: Number, attribute: 'transition-duration' })\n public get transitionDuration() {\n return this._transitionDuration;\n }\n public set transitionDuration(value: number) {\n this._transitionDuration = value;\n this.style.setProperty(\n '--uui-modal-transition-duration',\n this._transitionDuration + 'ms',\n );\n }\n\n protected firstUpdated(\n _changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n if (!this.isClosing) {\n this.open();\n }\n }\n\n public open = (event?: Event) => {\n event?.preventDefault();\n event?.stopImmediatePropagation();\n\n const openEvent = new CustomEvent(UUIModalOpenEvent, {\n cancelable: true,\n });\n const legacyOpenEvent = new CustomEvent('open', {\n cancelable: true,\n });\n\n this.dispatchEvent(openEvent);\n this.dispatchEvent(legacyOpenEvent);\n if (openEvent.defaultPrevented || legacyOpenEvent.defaultPrevented) return;\n\n this._openModal();\n };\n\n public close = (event?: Event) => {\n event?.preventDefault();\n event?.stopImmediatePropagation();\n\n const closeEvent = new CustomEvent(UUIModalCloseEvent, {\n cancelable: true,\n });\n this.dispatchEvent(closeEvent);\n\n if (closeEvent.defaultPrevented) return;\n\n this.forceClose();\n };\n\n protected _openModal() {\n this.isOpen = true;\n this._popoverElement?.showPopover();\n if (!this._popoverElement?.hasAttribute('tabindex')) {\n this._popoverElement?.setAttribute('tabindex', '-1');\n }\n document.addEventListener('keydown', this._onKeydown);\n document.addEventListener('focus', this._onFocusTrap, true);\n }\n\n public forceClose() {\n this.isClosing = true;\n this.isOpen = false;\n this._popoverElement?.hidePopover();\n document.removeEventListener('keydown', this._onKeydown);\n document.removeEventListener('focus', this._onFocusTrap, true);\n\n this.dispatchEvent(new CustomEvent('close-end'));\n this.dispatchEvent(new CustomEvent(UUIModalCloseEndEvent));\n\n this.remove();\n }\n\n private readonly _onKeydown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && this.index === 0) {\n this.close();\n }\n };\n\n private readonly _onFocusTrap = (e: FocusEvent) => {\n if (this.index !== 0) return;\n if (!this._popoverElement?.contains(e.target as Node)) {\n this._popoverElement?.focus();\n }\n };\n\n static override readonly styles = [\n css`\n [popover] {\n position: fixed;\n inset: 0;\n display: block;\n margin: 0;\n padding: 0;\n max-width: unset;\n max-height: unset;\n border: none;\n background: none;\n color: var(--uui-color-text);\n }\n [popover]::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--uui-modal-color-backdrop, rgba(0, 0, 0, 0.5));\n pointer-events: none;\n opacity: 1;\n transition: opacity var(--uui-modal-transition-duration, 250ms);\n z-index: 1;\n }\n :host([index='0']) [popover]::after {\n opacity: 0;\n pointer-events: none;\n }\n :host(:not([index='0'])) [popover]::after {\n pointer-events: auto;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAGO,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,mBAAN,MAAM,yBAAwB,WAAW;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AAKL,SAAA,SAAS;AAGT,SAAA,YAAY;AAGZ,SAAA,QAAQ;AAGR,SAAA,cAAc;AAEd,SAAQ,sBAAsB;AAwB9B,SAAO,OAAO,CAAC,UAAkB;AAC/B,aAAO,eAAA;AACP,aAA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,WAAW,uBAAuB;AAAA,GAlBjD,gBAmBA,WAAA,sBAAA,CAAA;"}
1
+ {"version":3,"file":"modal.element.js","sources":["../../../src/components/modal/modal.element.ts"],"sourcesContent":["import { LitElement, css } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nexport const UUIModalOpenEvent = 'uui:modal-open';\nexport const UUIModalCloseEvent = 'uui:modal-close';\nexport const UUIModalCloseEndEvent = 'uui:modal-close-end';\n\nexport class UUIModalElement extends LitElement {\n @query('dialog')\n protected readonly _dialogElement?: HTMLDialogElement;\n\n @property({ type: Boolean, reflect: true, attribute: 'is-open' })\n isOpen = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'is-closing' })\n isClosing = false;\n\n @property({ type: Number, reflect: true })\n index = 0;\n\n @property({ type: Number, reflect: true, attribute: 'unique-index' })\n uniqueIndex = 0;\n\n private _transitionDuration = 250;\n\n @property({ type: Number, attribute: 'transition-duration' })\n public get transitionDuration() {\n return this._transitionDuration;\n }\n public set transitionDuration(value: number) {\n this._transitionDuration = value;\n this.style.setProperty(\n '--uui-modal-transition-duration',\n this._transitionDuration + 'ms',\n );\n }\n\n protected firstUpdated(\n _changedProperties: Map<string | number | symbol, unknown>,\n ): void {\n super.firstUpdated(_changedProperties);\n\n if (!this.isClosing) {\n this.open();\n }\n }\n\n public open = (event?: Event) => {\n event?.preventDefault();\n event?.stopImmediatePropagation();\n\n const openEvent = new CustomEvent(UUIModalOpenEvent, {\n cancelable: true,\n });\n const legacyOpenEvent = new CustomEvent('open', {\n cancelable: true,\n });\n\n this.dispatchEvent(openEvent);\n this.dispatchEvent(legacyOpenEvent);\n if (openEvent.defaultPrevented || legacyOpenEvent.defaultPrevented) return;\n\n this._openModal();\n };\n\n public close = (event?: Event) => {\n event?.preventDefault();\n event?.stopImmediatePropagation();\n\n const closeEvent = new CustomEvent(UUIModalCloseEvent, {\n cancelable: true,\n });\n this.dispatchEvent(closeEvent);\n\n if (closeEvent.defaultPrevented) return;\n\n this.forceClose();\n };\n\n protected _openModal() {\n this.isOpen = true;\n this._dialogElement?.showModal();\n this._dialogElement?.addEventListener('cancel', this.close);\n }\n\n public forceClose() {\n this.isClosing = true;\n this.isOpen = false;\n this._dialogElement?.close();\n\n this.dispatchEvent(new CustomEvent('close-end'));\n this.dispatchEvent(new CustomEvent(UUIModalCloseEndEvent));\n\n this.remove();\n }\n\n static override readonly styles = [\n css`\n dialog {\n display: block;\n margin: 0;\n padding: 0;\n max-width: unset;\n max-height: unset;\n border: none;\n background: none;\n color: var(--uui-color-text);\n }\n dialog::backdrop {\n background: none;\n opacity: 0;\n }\n dialog::after {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--uui-modal-color-backdrop, rgba(0, 0, 0, 0.5));\n pointer-events: none;\n opacity: 1;\n transition: opacity var(--uui-modal-transition-duration, 250ms);\n z-index: 1;\n }\n :host([index='0']) dialog::after {\n opacity: 0;\n }\n `,\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAGO,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,mBAAN,MAAM,yBAAwB,WAAW;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AAKL,SAAA,SAAS;AAGT,SAAA,YAAY;AAGZ,SAAA,QAAQ;AAGR,SAAA,cAAc;AAEd,SAAQ,sBAAsB;AAwB9B,SAAO,OAAO,CAAC,UAAkB;AAC/B,aAAO,eAAA;AACP,aAAO,yBAAA;AAEP,YAAM,YAAY,IAAI,YAAY,mBAAmB;AAAA,QACnD,YAAY;AAAA,MAAA,CACb;AACD,YAAM,kBAAkB,IAAI,YAAY,QAAQ;AAAA,QAC9C,YAAY;AAAA,MAAA,CACb;AAED,WAAK,cAAc,SAAS;AAC5B,WAAK,cAAc,eAAe;AAClC,UAAI,UAAU,oBAAoB,gBAAgB,iBAAkB;AAEpE,WAAK,WAAA;AAAA,IACP;AAEA,SAAO,QAAQ,CAAC,UAAkB;AAChC,aAAO,e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UAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,cAAc;AAAA,GAPxD,gBAQX,WAAA,aAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM;AAAA,GAV9B,gBAWX,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,gBAAgB;AAAA,GAbzD,gBAcX,WAAA,eAAA,CAAA;AAKW,gBAAA;AAAA,EADV,SAAS,EAAE,MAAM,QAAQ,WAAW,uBAAuB;AAAA,GAlBjD,gBAmBA,WAAA,sBAAA,CAAA;"}
@@ -241,6 +241,7 @@ _UUIPaginationElement.styles = [
241
241
  }
242
242
  uui-button-group {
243
243
  flex-grow: 1;
244
+ justify-content: center;
244
245
  }
245
246
 
246
247
  uui-button-group uui-button {