@tylertech/forge 3.5.1 → 3.6.0-dev.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 +1171 -1128
- package/dist/checkbox/forge-checkbox.css +1 -0
- package/dist/lib.js +27 -19
- package/dist/lib.js.map +4 -4
- package/dist/radio/forge-radio.css +2 -0
- package/dist/switch/forge-switch.css +2 -0
- package/dist/vscode.css-custom-data.json +15 -0
- package/dist/vscode.html-custom-data.json +81 -106
- package/esm/app-bar/profile-button/app-bar-profile-button.js +5 -2
- package/esm/avatar/avatar-constants.d.ts +0 -7
- package/esm/avatar/avatar-constants.js +1 -10
- package/esm/avatar/avatar.d.ts +24 -21
- package/esm/avatar/avatar.js +68 -45
- package/esm/avatar/index.d.ts +1 -3
- package/esm/avatar/index.js +4 -6
- package/esm/button/base/base-button-adapter.js +1 -1
- package/esm/button-area/button-area.js +1 -1
- package/esm/checkbox/checkbox.d.ts +1 -0
- package/esm/checkbox/checkbox.js +2 -1
- package/esm/dialog/dialog-adapter.d.ts +7 -0
- package/esm/dialog/dialog-adapter.js +43 -19
- package/esm/dialog/dialog-constants.d.ts +6 -0
- package/esm/dialog/dialog-constants.js +6 -2
- package/esm/dialog/dialog-core.d.ts +8 -0
- package/esm/dialog/dialog-core.js +20 -0
- package/esm/dialog/dialog.d.ts +14 -0
- package/esm/dialog/dialog.js +13 -1
- package/esm/icon-button/icon-button-constants.d.ts +4 -0
- package/esm/icon-button/icon-button-constants.js +2 -0
- package/esm/icon-button/icon-button-core.d.ts +4 -4
- package/esm/icon-button/icon-button-core.js +16 -14
- package/esm/icon-button/icon-button.d.ts +32 -29
- package/esm/icon-button/icon-button.js +5 -30
- package/esm/profile-card/profile-card.js +5 -2
- package/esm/radio/radio/radio.d.ts +1 -0
- package/esm/radio/radio/radio.js +2 -1
- package/esm/split-view/split-view/split-view-adapter.js +1 -0
- package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
- package/esm/switch/switch.d.ts +1 -0
- package/esm/switch/switch.js +2 -1
- package/esm/table/table-utils.js +6 -6
- package/esm/tabs/tab-bar/tab-bar-adapter.d.ts +0 -5
- package/esm/tabs/tab-bar/tab-bar-adapter.js +3 -11
- package/esm/tabs/tab-bar/tab-bar-constants.d.ts +0 -3
- package/esm/tabs/tab-bar/tab-bar-constants.js +0 -4
- package/esm/tabs/tab-bar/tab-bar-core.js +7 -7
- package/esm/tabs/tab-bar/tab-bar.d.ts +6 -3
- package/esm/tabs/tab-bar/tab-bar.js +6 -3
- package/package.json +2 -2
- package/sass/button-area/_core.scss +3 -0
- package/sass/checkbox/_core.scss +2 -2
- package/sass/core/styles/tokens/checkbox/_tokens.scss +1 -0
- package/sass/core/styles/tokens/radio/_tokens.scss +1 -0
- package/sass/core/styles/tokens/switch/_tokens.scss +1 -0
- package/sass/dialog/dialog.scss +5 -0
- package/sass/radio/radio/_core.scss +2 -2
- package/sass/switch/_core.scss +2 -2
- package/esm/avatar/avatar-adapter.d.ts +0 -36
- package/esm/avatar/avatar-adapter.js +0 -55
- package/esm/avatar/avatar-core.d.ts +0 -38
- package/esm/avatar/avatar-core.js +0 -101
package/esm/avatar/avatar.js
CHANGED
|
@@ -4,30 +4,30 @@
|
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { LitElement, html, nothing, unsafeCSS } from 'lit';
|
|
8
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
10
11
|
import { AVATAR_CONSTANTS } from './avatar-constants';
|
|
11
|
-
import { BaseComponent } from '../core/base/base-component';
|
|
12
|
-
const template = '<template><div class=\"forge-avatar\" aria-hidden=\"true\" part=\"root\"><slot></slot></div></template>';
|
|
13
12
|
const styles = ':host{display:inline-block}:host([hidden]){display:none}.forge-avatar{--_avatar-size:var(--forge-avatar-size, 40px);--_avatar-background:var(--forge-avatar-background, var(--forge-theme-tertiary, #3d5afe));--_avatar-color:var(--forge-avatar-color, var(--forge-theme-on-tertiary, #ffffff));--_avatar-transition-duration:var(--forge-avatar-transition-duration, var(--forge-animation-duration-short4, 200ms));--_avatar-transition-timing:var(--forge-avatar-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_avatar-shape:var(--forge-avatar-shape, calc(var(--forge-shape-round, 50%) * var(--forge-shape-factor, 1)))}.forge-avatar{display:flex;align-items:center;justify-content:center;overflow:hidden;transition:height var(--_avatar-transition-duration) var(--_avatar-transition-timing),width var(--_avatar-transition-duration) var(--_avatar-transition-timing);border-radius:var(--_avatar-shape);box-sizing:border-box;width:var(--_avatar-size);height:var(--_avatar-size);background-color:var(--_avatar-background);background-position:center;background-repeat:no-repeat;background-size:cover;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-subheading2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-subheading2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-subheading2-font-size-scale, 1)));font-weight:var(--forge-typography-subheading2-font-weight,400);line-height:var(--forge-typography-subheading2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-subheading2-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-subheading2-letter-spacing, normal);text-transform:var(--forge-typography-subheading2-text-transform,inherit);text-decoration:var(--forge-typography-subheading2-text-decoration,inherit);color:var(--_avatar-color)}.forge-avatar--image{background-color:inherit}';
|
|
13
|
+
const charsByLetterCount = (text, count) => {
|
|
14
|
+
if (!text?.trim()) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
if (count === 1) {
|
|
18
|
+
return text[0].toUpperCase();
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const words = text.match(/\S+/g) ?? [];
|
|
22
|
+
return words.slice(0, count).reduce((prev, curr) => (prev += curr[0].toUpperCase()), '');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const AVATAR_TAG_NAME = 'forge-avatar';
|
|
14
26
|
/**
|
|
15
27
|
* @tag forge-avatar
|
|
16
28
|
*
|
|
17
29
|
* @summary Avatars represent an entity via text or image.
|
|
18
30
|
*
|
|
19
|
-
* @description The avatar component allows you to provide text or images to display that represent an entity. By default, the
|
|
20
|
-
* avatar will display textual content as single characters (character count is configurable), or display an image or
|
|
21
|
-
* icon based on the URL provided to it.
|
|
22
|
-
*
|
|
23
|
-
* @property {string} [text=""] - The text to display in the avatar.
|
|
24
|
-
* @property {number} [letterCount=2] - Controls the number of letters to display from the text. By default the text is split on spaces and the first character of each word is used.
|
|
25
|
-
* @property {string} imageUrl - The background image URL to use.
|
|
26
|
-
*
|
|
27
|
-
* @attribute {string} [text=""] - The text to display in the avatar.
|
|
28
|
-
* @attribute {string} [letter-count=2] - Controls the number of letters to display from the text. By default the text is split on spaces and the first character of each word is used.
|
|
29
|
-
* @attribute {string} image-url - The background image URL to use.
|
|
30
|
-
*
|
|
31
31
|
* @cssproperty {string} --forge-avatar-background - The background color of the avatar.
|
|
32
32
|
* @cssproperty {number} --forge-avatar-shape - The border radius of the avatar, defaults to 50%.
|
|
33
33
|
* @cssproperty {color} --forge-avatar-color - The text color of the avatar.
|
|
@@ -41,47 +41,70 @@ const styles = ':host{display:inline-block}:host([hidden]){display:none}.forge-a
|
|
|
41
41
|
*
|
|
42
42
|
* @cssclass forge-avatar - The avatar class _(required)_.
|
|
43
43
|
*/
|
|
44
|
-
let AvatarComponent = class AvatarComponent extends
|
|
45
|
-
static get observedAttributes() {
|
|
46
|
-
return [AVATAR_CONSTANTS.attributes.TEXT, AVATAR_CONSTANTS.attributes.LETTER_COUNT, AVATAR_CONSTANTS.attributes.IMAGE_URL];
|
|
47
|
-
}
|
|
44
|
+
let AvatarComponent = class AvatarComponent extends LitElement {
|
|
48
45
|
constructor() {
|
|
49
|
-
super();
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
super(...arguments);
|
|
47
|
+
/**
|
|
48
|
+
* The text to display in the avatar.
|
|
49
|
+
* @default ''
|
|
50
|
+
* @attribute
|
|
51
|
+
*/
|
|
52
|
+
this.text = '';
|
|
53
|
+
/**
|
|
54
|
+
* Controls the number of letters to display from the text. By default the text is split on spaces and the first character of each word is used.
|
|
55
|
+
* @default 2
|
|
56
|
+
* @attribute letter-count
|
|
57
|
+
*/
|
|
58
|
+
this.letterCount = AVATAR_CONSTANTS.numbers.DEFAULT_LETTER_COUNT;
|
|
59
|
+
/**
|
|
60
|
+
* The background image URL to use.
|
|
61
|
+
* @default ''
|
|
62
|
+
* @attribute image-url
|
|
63
|
+
*/
|
|
64
|
+
this.imageUrl = '';
|
|
52
65
|
}
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
willUpdate(changedProperties) {
|
|
67
|
+
if (changedProperties.has('imageUrl')) {
|
|
68
|
+
this._tryLoadImage();
|
|
69
|
+
}
|
|
55
70
|
}
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
render() {
|
|
72
|
+
return html `
|
|
73
|
+
<div
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
part="root"
|
|
76
|
+
class=${classMap({ 'forge-avatar': true, 'forge-avatar--image': !!this._image })}
|
|
77
|
+
style=${this._image ? styleMap({ backgroundImage: `url(${this._image.src})` }) : nothing}>
|
|
78
|
+
<slot>${charsByLetterCount(this.text, this.letterCount ?? AVATAR_CONSTANTS.numbers.DEFAULT_LETTER_COUNT)}</slot>
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
58
81
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.imageUrl = newValue;
|
|
69
|
-
break;
|
|
82
|
+
async _tryLoadImage() {
|
|
83
|
+
if (this.imageUrl) {
|
|
84
|
+
const image = new Image();
|
|
85
|
+
image.onload = () => (this._image = image);
|
|
86
|
+
image.onerror = () => (this._image = undefined);
|
|
87
|
+
image.src = this.imageUrl;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this._image = undefined;
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
};
|
|
94
|
+
AvatarComponent.styles = unsafeCSS(styles);
|
|
73
95
|
__decorate([
|
|
74
|
-
|
|
96
|
+
property()
|
|
75
97
|
], AvatarComponent.prototype, "text", void 0);
|
|
76
98
|
__decorate([
|
|
77
|
-
|
|
99
|
+
property({ type: Number, attribute: 'letter-count' })
|
|
78
100
|
], AvatarComponent.prototype, "letterCount", void 0);
|
|
79
101
|
__decorate([
|
|
80
|
-
|
|
102
|
+
property({ type: String, attribute: 'image-url' })
|
|
81
103
|
], AvatarComponent.prototype, "imageUrl", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
state()
|
|
106
|
+
], AvatarComponent.prototype, "_image", void 0);
|
|
82
107
|
AvatarComponent = __decorate([
|
|
83
|
-
customElement(
|
|
84
|
-
name: AVATAR_CONSTANTS.elementName
|
|
85
|
-
})
|
|
108
|
+
customElement(AVATAR_TAG_NAME)
|
|
86
109
|
], AvatarComponent);
|
|
87
110
|
export { AvatarComponent };
|
package/esm/avatar/index.d.ts
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
export * from './avatar-adapter';
|
|
7
|
-
export * from './avatar-constants';
|
|
8
|
-
export * from './avatar-core';
|
|
9
6
|
export * from './avatar';
|
|
7
|
+
export * from './avatar-constants';
|
|
10
8
|
export declare function defineAvatarComponent(): void;
|
package/esm/avatar/index.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { AvatarComponent } from './avatar';
|
|
8
|
-
export * from './avatar-adapter';
|
|
9
|
-
export * from './avatar-constants';
|
|
10
|
-
export * from './avatar-core';
|
|
6
|
+
import { tryDefine } from '@tylertech/forge-core';
|
|
7
|
+
import { AVATAR_TAG_NAME, AvatarComponent } from './avatar';
|
|
11
8
|
export * from './avatar';
|
|
9
|
+
export * from './avatar-constants';
|
|
12
10
|
export function defineAvatarComponent() {
|
|
13
|
-
|
|
11
|
+
tryDefine(AVATAR_TAG_NAME, AvatarComponent);
|
|
14
12
|
}
|
|
@@ -61,7 +61,7 @@ export class BaseButtonAdapter extends BaseAdapter {
|
|
|
61
61
|
if (value) {
|
|
62
62
|
this._component.removeAttribute('tabindex');
|
|
63
63
|
}
|
|
64
|
-
else {
|
|
64
|
+
else if (!this._component.hasAttribute('tabindex')) {
|
|
65
65
|
this._component.setAttribute('tabindex', '0');
|
|
66
66
|
}
|
|
67
67
|
this._component[setDefaultAria]({ ariaDisabled: value ? 'true' : null });
|
|
@@ -12,7 +12,7 @@ import { FocusIndicatorComponent } from '../focus-indicator';
|
|
|
12
12
|
import { StateLayerComponent } from '../state-layer';
|
|
13
13
|
import { BaseComponent } from '../core/base/base-component';
|
|
14
14
|
const template = '<template><div class=\"forge-button-area\" id=\"root\" part=\"root\"><div class=\"button\" id=\"button\" part=\"button\"><slot name=\"button\"></slot></div><slot id=\"content\"></slot><forge-state-layer target=\"root\" exportparts=\"surface:state-layer\"></forge-state-layer><forge-focus-indicator target=\"button\" part=\"focus-indicator\" inward></forge-focus-indicator></div></template>';
|
|
15
|
-
const styles = ':host{display:block;position:relative}:host .forge-button-area{cursor:var(--_button-area-cursor)}:host([hidden]){display:none}:host([disabled]) .forge-button-area{cursor:var(--_button-area-disabled-cursor)}.forge-button-area{--_button-area-primary-color:var(--forge-button-area-primary-color, var(--forge-theme-primary, #3f51b5));--_button-area-cursor:var(--forge-button-area-cursor, pointer);--_button-area-disabled-cursor:var(--forge-button-area-disabled-cursor, not-allowed);--_button-area-focus-indicator-color:var(--forge-button-area-focus-indicator-color, var(--forge-theme-primary, #3f51b5));--_button-area-focus-indicator-offset:var(--forge-button-area-focus-indicator-offset, 4px)}.forge-button-area{position:relative;overflow:hidden}.forge-button-area .button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:fixed;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}forge-focus-indicator{z-index:1;--forge-focus-indicator-color:var(--_button-area-focus-indicator-color);--forge-focus-indicator-outward-offset:var(--_button-area-focus-indicator-offset)}forge-state-layer{--forge-state-layer-color:var(--_button-area-primary-color);border-radius:inherit}';
|
|
15
|
+
const styles = ':host{display:block;position:relative}:host .forge-button-area{cursor:var(--_button-area-cursor)}:host([hidden]){display:none}:host([disabled]) .forge-button-area{cursor:var(--_button-area-disabled-cursor)}.forge-button-area{--_button-area-primary-color:var(--forge-button-area-primary-color, var(--forge-theme-primary, #3f51b5));--_button-area-cursor:var(--forge-button-area-cursor, pointer);--_button-area-disabled-cursor:var(--forge-button-area-disabled-cursor, not-allowed);--_button-area-focus-indicator-color:var(--forge-button-area-focus-indicator-color, var(--forge-theme-primary, #3f51b5));--_button-area-focus-indicator-offset:var(--forge-button-area-focus-indicator-offset, 4px)}.forge-button-area{position:relative;overflow:hidden;block-size:100%;inline-size:100%}.forge-button-area .button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:fixed;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}forge-focus-indicator{z-index:1;--forge-focus-indicator-color:var(--_button-area-focus-indicator-color);--forge-focus-indicator-outward-offset:var(--_button-area-focus-indicator-offset)}forge-state-layer{--forge-state-layer-color:var(--_button-area-primary-color);border-radius:inherit}';
|
|
16
16
|
/**
|
|
17
17
|
* @tag forge-button-area
|
|
18
18
|
*
|
|
@@ -51,6 +51,7 @@ declare const CheckboxComponent_base: import("../constants").AbstractConstructor
|
|
|
51
51
|
* @cssproperty --forge-checkbox-elevation - The shadow of the checkbox.
|
|
52
52
|
* @cssproperty --forge-checkbox-gap - The space between the checkbox and label.
|
|
53
53
|
* @cssproperty --forge-checkbox-justify - How the checkbox and label are distributed along their main axis.
|
|
54
|
+
* @cssproperty --forge-checkbox-align - How the checkbox and label are distributed along their cross axis.
|
|
54
55
|
* @cssproperty --forge-checkbox-direction - Whether the checkbox and label are arranged along the inline or block axis.
|
|
55
56
|
* @cssproperty --forge-checkbox-checked-background - The color of the checkbox background when checked or indeterminate.
|
|
56
57
|
* @cssproperty --forge-checkbox-checked-border-width - The width of the checkbox border when checked or indeterminate.
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -18,7 +18,7 @@ import { CheckboxAdapter } from './checkbox-adapter';
|
|
|
18
18
|
import { CHECKBOX_CONSTANTS } from './checkbox-constants';
|
|
19
19
|
import { CheckboxCore } from './checkbox-core';
|
|
20
20
|
const template = '<template><div class=\"forge-checkbox\" part=\"root\"><div id=\"container\" class=\"container\"><div class=\"background\" part=\"background\"><svg class=\"icon icon--checked\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" part=\"checkmark\"><path d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path></svg> <svg class=\"icon icon--indeterminate\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" part=\"mixedmark\"><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"></line></svg><forge-focus-indicator target=\":host\" part=\"focus-indicator\"></forge-focus-indicator></div><forge-state-layer target=\":host\" exportparts=\"surface:state-layer\"></forge-state-layer></div><div id=\"label\" class=\"label\" part=\"label\"><slot></slot></div></div></template>';
|
|
21
|
-
const styles = ':host{display:inline-block;outline:0;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}.forge-checkbox{--_checkbox-primary-color:var(--forge-checkbox-primary-color, var(--forge-theme-tertiary, #3d5afe));--_checkbox-size:var(--forge-checkbox-size, 16px);--_checkbox-border-width:var(--forge-checkbox-border-width, var(--forge-border-medium, 2px));--_checkbox-icon-color:var(--forge-checkbox-icon-color, var(--forge-theme-on-tertiary, #ffffff));--_checkbox-state-layer-size:var(--forge-checkbox-state-layer-size, 40px);--_checkbox-state-layer-dense-size:var(--forge-checkbox-state-layer-dense-size, 24px);--_checkbox-background:var(--forge-checkbox-background, var(--forge-theme-surface, #ffffff));--_checkbox-width:var(--forge-checkbox-width, var(--_checkbox-size));--_checkbox-height:var(--forge-checkbox-height, var(--_checkbox-size));--_checkbox-unchecked-border-width:var(--forge-checkbox-unchecked-border-width, var(--_checkbox-border-width));--_checkbox-unchecked-border-color:var(--forge-checkbox-unchecked-border-color, var(--forge-theme-surface-container-high, #9e9e9e));--_checkbox-shape:var(--forge-checkbox-shape, calc(var(--forge-shape-small, 2px) * var(--forge-shape-factor, 1)));--_checkbox-elevation:var(--forge-checkbox-elevation, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12));--_checkbox-checked-background:var(--forge-checkbox-checked-background, var(--_checkbox-primary-color));--_checkbox-checked-border-width:var(--forge-checkbox-checked-border-width, var(--_checkbox-border-width));--_checkbox-checked-border-color:var(--forge-checkbox-checked-border-color, var(--_checkbox-checked-background));--_checkbox-icon-checked-color:var(--forge-checkbox-icon-checked-color, var(--_checkbox-icon-color));--_checkbox-icon-indeterminate-color:var(--forge-checkbox-icon-indeterminate-color, var(--_checkbox-icon-color));--_checkbox-icon-stroke-width:var(--forge-checkbox-icon-stroke-width, 4px);--_checkbox-gap:var(--forge-checkbox-gap, 0);--_checkbox-justify:var(--forge-checkbox-justify, start);--_checkbox-direction:var(--forge-checkbox-direction, initial);--_checkbox-state-layer-width:var(--forge-checkbox-state-layer-width, var(--_checkbox-state-layer-size));--_checkbox-state-layer-height:var(--forge-checkbox-state-layer-height, var(--_checkbox-state-layer-size));--_checkbox-state-layer-checked-color:var(--forge-checkbox-state-layer-checked-color, var(--_checkbox-primary-color));--_checkbox-state-layer-unchecked-color:var(--forge-checkbox-state-layer-unchecked-color, var(--_checkbox-color));--_checkbox-state-layer-shape:var(--forge-checkbox-state-layer-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_checkbox-dense-gap:var(--forge-checkbox-dense-gap, 8px);--_checkbox-state-layer-dense-width:var(--forge-checkbox-state-layer-dense-width, var(--_checkbox-state-layer-dense-size));--_checkbox-state-layer-dense-height:var(--forge-checkbox-state-layer-dense-height, var(--_checkbox-state-layer-dense-size));--_checkbox-disabled-opacity:var(--forge-checkbox-disabled-opacity, 0.38);--_checkbox-animation-duration:var(--forge-checkbox-animation-duration, var(--forge-animation-duration-short2, 100ms));--_checkbox-background-animation-timing:var(--forge-checkbox-background-animation-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_checkbox-icon-animation-timing:var(--forge-checkbox-icon-animation-timing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)))}.forge-checkbox{position:relative;flex-direction:var(--_checkbox-direction);
|
|
21
|
+
const styles = ':host{display:inline-block;outline:0;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}.forge-checkbox{--_checkbox-primary-color:var(--forge-checkbox-primary-color, var(--forge-theme-tertiary, #3d5afe));--_checkbox-size:var(--forge-checkbox-size, 16px);--_checkbox-border-width:var(--forge-checkbox-border-width, var(--forge-border-medium, 2px));--_checkbox-icon-color:var(--forge-checkbox-icon-color, var(--forge-theme-on-tertiary, #ffffff));--_checkbox-state-layer-size:var(--forge-checkbox-state-layer-size, 40px);--_checkbox-state-layer-dense-size:var(--forge-checkbox-state-layer-dense-size, 24px);--_checkbox-background:var(--forge-checkbox-background, var(--forge-theme-surface, #ffffff));--_checkbox-width:var(--forge-checkbox-width, var(--_checkbox-size));--_checkbox-height:var(--forge-checkbox-height, var(--_checkbox-size));--_checkbox-unchecked-border-width:var(--forge-checkbox-unchecked-border-width, var(--_checkbox-border-width));--_checkbox-unchecked-border-color:var(--forge-checkbox-unchecked-border-color, var(--forge-theme-surface-container-high, #9e9e9e));--_checkbox-shape:var(--forge-checkbox-shape, calc(var(--forge-shape-small, 2px) * var(--forge-shape-factor, 1)));--_checkbox-elevation:var(--forge-checkbox-elevation, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12));--_checkbox-checked-background:var(--forge-checkbox-checked-background, var(--_checkbox-primary-color));--_checkbox-checked-border-width:var(--forge-checkbox-checked-border-width, var(--_checkbox-border-width));--_checkbox-checked-border-color:var(--forge-checkbox-checked-border-color, var(--_checkbox-checked-background));--_checkbox-icon-checked-color:var(--forge-checkbox-icon-checked-color, var(--_checkbox-icon-color));--_checkbox-icon-indeterminate-color:var(--forge-checkbox-icon-indeterminate-color, var(--_checkbox-icon-color));--_checkbox-icon-stroke-width:var(--forge-checkbox-icon-stroke-width, 4px);--_checkbox-gap:var(--forge-checkbox-gap, 0);--_checkbox-justify:var(--forge-checkbox-justify, start);--_checkbox-align:var(--forge-checkbox-align, center);--_checkbox-direction:var(--forge-checkbox-direction, initial);--_checkbox-state-layer-width:var(--forge-checkbox-state-layer-width, var(--_checkbox-state-layer-size));--_checkbox-state-layer-height:var(--forge-checkbox-state-layer-height, var(--_checkbox-state-layer-size));--_checkbox-state-layer-checked-color:var(--forge-checkbox-state-layer-checked-color, var(--_checkbox-primary-color));--_checkbox-state-layer-unchecked-color:var(--forge-checkbox-state-layer-unchecked-color, var(--_checkbox-color));--_checkbox-state-layer-shape:var(--forge-checkbox-state-layer-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_checkbox-dense-gap:var(--forge-checkbox-dense-gap, 8px);--_checkbox-state-layer-dense-width:var(--forge-checkbox-state-layer-dense-width, var(--_checkbox-state-layer-dense-size));--_checkbox-state-layer-dense-height:var(--forge-checkbox-state-layer-dense-height, var(--_checkbox-state-layer-dense-size));--_checkbox-disabled-opacity:var(--forge-checkbox-disabled-opacity, 0.38);--_checkbox-animation-duration:var(--forge-checkbox-animation-duration, var(--forge-animation-duration-short2, 100ms));--_checkbox-background-animation-timing:var(--forge-checkbox-background-animation-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_checkbox-icon-animation-timing:var(--forge-checkbox-icon-animation-timing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)))}.forge-checkbox{position:relative;flex-direction:var(--_checkbox-direction);align-items:var(--_checkbox-align);justify-content:var(--_checkbox-justify);gap:var(--_checkbox-gap);display:flex}.forge-checkbox .container{position:relative;align-items:center;justify-content:center;display:flex;flex-shrink:0;border-radius:var(--_checkbox-state-layer-shape);inline-size:var(--_checkbox-state-layer-width);block-size:var(--_checkbox-state-layer-height);cursor:pointer}.forge-checkbox .background{position:relative;align-items:center;justify-content:center;display:flex;transition-property:background,border-width,border-color;transition-duration:var(--_checkbox-animation-duration);transition-timing-function:var(--_checkbox-background-animation-timing);box-shadow:var(--_checkbox-elevation);border-style:solid;border-width:var(--_checkbox-unchecked-border-width);border-color:var(--_checkbox-unchecked-border-color);border-radius:var(--_checkbox-shape);box-sizing:border-box;block-size:var(--_checkbox-height);inline-size:var(--_checkbox-width);background:var(--_checkbox-background)}.forge-checkbox .icon{position:absolute;transition-property:stroke-dashoffset;transition-duration:var(--_checkbox-animation-duration);transition-timing-function:var(--_checkbox-icon-animation-timing);fill:none;stroke-width:var(--_checkbox-icon-stroke-width)}.forge-checkbox .icon--checked{stroke:var(--_checkbox-icon-checked-color);stroke-dasharray:30;transition-delay:0s;stroke-dashoffset:30}.forge-checkbox .icon--indeterminate{stroke:var(--_checkbox-icon-indeterminate-color);stroke-dasharray:20;transition-delay:0s;stroke-dashoffset:20}.forge-checkbox .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-label2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .8125)));font-weight:var(--forge-typography-label2-font-weight,400);line-height:var(--forge-typography-label2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label2-letter-spacing, .0096153846em);text-transform:var(--forge-typography-label2-text-transform,inherit);text-decoration:var(--forge-typography-label2-text-decoration,inherit);cursor:default}:host([checked]) .background{border-style:solid;border-width:var(--_checkbox-checked-border-width);border-color:var(--_checkbox-checked-border-color);background:var(--_checkbox-checked-background)}:host([checked]) .icon--checked{transition-delay:var(--_checkbox-animation-duration);stroke-dashoffset:0}:host([checked]) .icon--checked:dir(rtl){stroke-dashoffset:60}:host([checked]) .icon--indeterminate{transition-delay:0s;stroke-dashoffset:20}:host([checked]) forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-checked-color)}:host([indeterminate]) .background{border-style:solid;border-width:var(--_checkbox-checked-border-width);border-color:var(--_checkbox-checked-border-color);background:var(--_checkbox-checked-background)}:host([indeterminate]) .icon--checked{transition-delay:0s;stroke-dashoffset:30}:host([indeterminate]) .icon--indeterminate{transition-delay:var(--_checkbox-animation-duration);stroke-dashoffset:0}:host([indeterminate]) .icon--indeterminate:dir(rtl){stroke-dashoffset:40}:host([indeterminate]) forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-checked-color)}:host([dense]) .forge-checkbox{--_checkbox-gap:var(--_checkbox-dense-gap)}:host([dense]) .forge-checkbox .container{inline-size:var(--_checkbox-state-layer-dense-width);block-size:var(--_checkbox-state-layer-dense-height)}:host([disabled]) .forge-checkbox .container{opacity:var(--_checkbox-disabled-opacity);cursor:not-allowed}:host([readonly]) .forge-checkbox .container{cursor:not-allowed}@media (prefers-reduced-motion){.forge-checkbox{--_checkbox-animation-duration:var(--forge-checkbox-animation-duration, 0s)}}forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-unchecked-color)}forge-focus-indicator{--forge-focus-indicator-shape:0px;--forge-focus-indicator-outward-offset:8px}';
|
|
22
22
|
/**
|
|
23
23
|
* @tag forge-checkbox
|
|
24
24
|
*
|
|
@@ -41,6 +41,7 @@ const styles = ':host{display:inline-block;outline:0;-webkit-tap-highlight-color
|
|
|
41
41
|
* @cssproperty --forge-checkbox-elevation - The shadow of the checkbox.
|
|
42
42
|
* @cssproperty --forge-checkbox-gap - The space between the checkbox and label.
|
|
43
43
|
* @cssproperty --forge-checkbox-justify - How the checkbox and label are distributed along their main axis.
|
|
44
|
+
* @cssproperty --forge-checkbox-align - How the checkbox and label are distributed along their cross axis.
|
|
44
45
|
* @cssproperty --forge-checkbox-direction - Whether the checkbox and label are arranged along the inline or block axis.
|
|
45
46
|
* @cssproperty --forge-checkbox-checked-background - The color of the checkbox background when checked or indeterminate.
|
|
46
47
|
* @cssproperty --forge-checkbox-checked-border-width - The width of the checkbox border when checked or indeterminate.
|
|
@@ -28,6 +28,8 @@ export interface IDialogAdapter extends IBaseAdapter<IDialogComponent> {
|
|
|
28
28
|
removeSurfaceClass(className: string): void;
|
|
29
29
|
addFullscreenListener(breakpoint: number, listener: (value: boolean) => void): void;
|
|
30
30
|
removeFullscreenListener(listener: (value: boolean) => void): void;
|
|
31
|
+
setAccessibleLabel(label: string): void;
|
|
32
|
+
setAccessibleDescription(description: string): void;
|
|
31
33
|
}
|
|
32
34
|
export declare class DialogAdapter extends BaseAdapter<IDialogComponent> implements IDialogAdapter {
|
|
33
35
|
private _dialogElement;
|
|
@@ -35,6 +37,8 @@ export declare class DialogAdapter extends BaseAdapter<IDialogComponent> impleme
|
|
|
35
37
|
private _backdropElement;
|
|
36
38
|
private _moveHandleElement;
|
|
37
39
|
private _fullscreenMediaQuery;
|
|
40
|
+
private _accessibleLabelElement;
|
|
41
|
+
private _accessibleDescriptionElement;
|
|
38
42
|
triggerElement: HTMLElement | null;
|
|
39
43
|
get moveHandleElement(): HTMLElement;
|
|
40
44
|
get surfaceElement(): HTMLElement;
|
|
@@ -59,4 +63,7 @@ export declare class DialogAdapter extends BaseAdapter<IDialogComponent> impleme
|
|
|
59
63
|
removeSurfaceClass(className: string): void;
|
|
60
64
|
addFullscreenListener(breakpoint: number, listener: (value: boolean) => void): void;
|
|
61
65
|
removeFullscreenListener(listener: (value: boolean) => void): void;
|
|
66
|
+
setAccessibleLabel(label: string): void;
|
|
67
|
+
setAccessibleDescription(description: string): void;
|
|
68
|
+
private _createVisuallyHiddenElement;
|
|
62
69
|
}
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { getShadowElement, playKeyframeAnimation } from '@tylertech/forge-core';
|
|
7
7
|
import { BACKDROP_CONSTANTS } from '../backdrop';
|
|
8
|
-
import { setDefaultAria } from '../constants';
|
|
9
8
|
import { BaseAdapter } from '../core/base/base-adapter';
|
|
10
9
|
import { DialogComponent } from './dialog';
|
|
11
|
-
import {
|
|
10
|
+
import { DIALOG_CONSTANTS, dialogStack, hideBackdrop, showBackdrop } from './dialog-constants';
|
|
12
11
|
export class DialogAdapter extends BaseAdapter {
|
|
13
12
|
get moveHandleElement() {
|
|
14
13
|
return this._moveHandleElement;
|
|
@@ -31,15 +30,14 @@ export class DialogAdapter extends BaseAdapter {
|
|
|
31
30
|
if (this._dialogElement.open) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this._component[setDefaultAria]({
|
|
37
|
-
role: this._component.type,
|
|
38
|
-
ariaModal: this._component.mode === 'modal' || this._component.mode === 'inline-modal' ? 'true' : 'false'
|
|
39
|
-
}, { setAttribute: true });
|
|
33
|
+
if (this._component.type !== 'dialog') {
|
|
34
|
+
this._dialogElement.setAttribute('role', this._component.type);
|
|
40
35
|
}
|
|
41
|
-
// Show the dialog (and backdrop) based on modal vs non-modal
|
|
42
36
|
const isModal = this._component.mode === 'modal' || this._component.mode === 'inline-modal';
|
|
37
|
+
if (!isModal) {
|
|
38
|
+
this._dialogElement.setAttribute('aria-modal', 'false');
|
|
39
|
+
}
|
|
40
|
+
// Show the dialog (and backdrop) based on modal vs non-modal
|
|
43
41
|
if (isModal) {
|
|
44
42
|
if (this._component.animationType === 'none') {
|
|
45
43
|
this._backdropElement.show();
|
|
@@ -68,13 +66,6 @@ export class DialogAdapter extends BaseAdapter {
|
|
|
68
66
|
.at(-1)?.[showBackdrop]();
|
|
69
67
|
}
|
|
70
68
|
async hide() {
|
|
71
|
-
const role = this._component.getAttribute('role');
|
|
72
|
-
if (!role || !['presentation', 'none'].includes(role)) {
|
|
73
|
-
this._component[setDefaultAria]({
|
|
74
|
-
role: null,
|
|
75
|
-
ariaModal: null
|
|
76
|
-
}, { setAttribute: true });
|
|
77
|
-
}
|
|
78
69
|
const close = () => {
|
|
79
70
|
this._surfaceElement.classList.remove(BACKDROP_CONSTANTS.classes.EXITING);
|
|
80
71
|
this._dialogElement.close();
|
|
@@ -109,9 +100,13 @@ export class DialogAdapter extends BaseAdapter {
|
|
|
109
100
|
tryAutofocus() {
|
|
110
101
|
window.requestAnimationFrame(() => {
|
|
111
102
|
window.requestAnimationFrame(() => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
const alreadyHasFocus = this._component.matches(':focus-within');
|
|
104
|
+
if (!alreadyHasFocus) {
|
|
105
|
+
this._dialogElement.focus();
|
|
106
|
+
if (this._component.open && this._dialogElement.isConnected) {
|
|
107
|
+
const autofocusElement = this._component.querySelector(DIALOG_CONSTANTS.selectors.AUTOFOCUS);
|
|
108
|
+
autofocusElement?.focus();
|
|
109
|
+
}
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
112
|
});
|
|
@@ -153,4 +148,33 @@ export class DialogAdapter extends BaseAdapter {
|
|
|
153
148
|
this._fullscreenMediaQuery?.removeEventListener('change', event => listener(event.matches));
|
|
154
149
|
this._fullscreenMediaQuery = undefined;
|
|
155
150
|
}
|
|
151
|
+
setAccessibleLabel(label) {
|
|
152
|
+
if (label?.trim()) {
|
|
153
|
+
this._accessibleLabelElement = this._createVisuallyHiddenElement(DIALOG_CONSTANTS.attributes.ARIA_LABEL_ID, label);
|
|
154
|
+
this._dialogElement.appendChild(this._accessibleLabelElement);
|
|
155
|
+
this._dialogElement.setAttribute('aria-labelledby', this._accessibleLabelElement.id);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this._dialogElement.removeAttribute('aria-labelledby');
|
|
159
|
+
this._accessibleLabelElement?.remove();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
setAccessibleDescription(description) {
|
|
163
|
+
if (description?.trim()) {
|
|
164
|
+
this._accessibleDescriptionElement = this._createVisuallyHiddenElement(DIALOG_CONSTANTS.attributes.ARIA_DESCIPTION_ID, description);
|
|
165
|
+
this._dialogElement.appendChild(this._accessibleDescriptionElement);
|
|
166
|
+
this._dialogElement.setAttribute('aria-describedby', this._accessibleDescriptionElement.id);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this._dialogElement.removeAttribute('aria-describedby');
|
|
170
|
+
this._accessibleDescriptionElement?.remove();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_createVisuallyHiddenElement(id, text) {
|
|
174
|
+
const element = document.createElement('div');
|
|
175
|
+
element.classList.add('visually-hidden');
|
|
176
|
+
element.id = id;
|
|
177
|
+
element.textContent = text.trim();
|
|
178
|
+
return element;
|
|
179
|
+
}
|
|
156
180
|
}
|
|
@@ -21,12 +21,16 @@ export declare const DIALOG_CONSTANTS: {
|
|
|
21
21
|
POSITION_STRATEGY: string;
|
|
22
22
|
PLACEMENT: string;
|
|
23
23
|
SIZE_STRATEGY: string;
|
|
24
|
+
LABEL: string;
|
|
25
|
+
DESCRIPTION: string;
|
|
24
26
|
};
|
|
25
27
|
classes: {
|
|
26
28
|
MOVED: string;
|
|
27
29
|
MOVING: string;
|
|
28
30
|
};
|
|
29
31
|
attributes: {
|
|
32
|
+
ARIA_LABEL_ID: string;
|
|
33
|
+
ARIA_DESCIPTION_ID: string;
|
|
30
34
|
OPEN: string;
|
|
31
35
|
VISIBLE: string;
|
|
32
36
|
MODE: string;
|
|
@@ -42,6 +46,8 @@ export declare const DIALOG_CONSTANTS: {
|
|
|
42
46
|
POSITION_STRATEGY: string;
|
|
43
47
|
PLACEMENT: string;
|
|
44
48
|
SIZE_STRATEGY: string;
|
|
49
|
+
LABEL: string;
|
|
50
|
+
DESCRIPTION: string;
|
|
45
51
|
};
|
|
46
52
|
selectors: {
|
|
47
53
|
DIALOG: string;
|
|
@@ -20,10 +20,14 @@ const observedAttributes = {
|
|
|
20
20
|
MOVE_TARGET: 'move-target',
|
|
21
21
|
POSITION_STRATEGY: 'position-strategy',
|
|
22
22
|
PLACEMENT: 'placement',
|
|
23
|
-
SIZE_STRATEGY: 'size-strategy'
|
|
23
|
+
SIZE_STRATEGY: 'size-strategy',
|
|
24
|
+
LABEL: 'label',
|
|
25
|
+
DESCRIPTION: 'description'
|
|
24
26
|
};
|
|
25
27
|
const attributes = {
|
|
26
|
-
...observedAttributes
|
|
28
|
+
...observedAttributes,
|
|
29
|
+
ARIA_LABEL_ID: 'forge-dialog-label',
|
|
30
|
+
ARIA_DESCIPTION_ID: 'forge-dialog-description'
|
|
27
31
|
};
|
|
28
32
|
const classes = {
|
|
29
33
|
MOVED: 'moved',
|
|
@@ -20,6 +20,8 @@ export interface IDialogCore {
|
|
|
20
20
|
sizeStrategy: DialogSizeStrategy;
|
|
21
21
|
placement: DialogPlacement;
|
|
22
22
|
moveable: boolean;
|
|
23
|
+
label: string;
|
|
24
|
+
description: string;
|
|
23
25
|
hideBackdrop(): void;
|
|
24
26
|
showBackdrop(): void;
|
|
25
27
|
dispatchBeforeCloseEvent(): boolean;
|
|
@@ -37,6 +39,8 @@ export declare class DialogCore implements IDialogCore {
|
|
|
37
39
|
private _originalFullscreenValue;
|
|
38
40
|
private _trigger;
|
|
39
41
|
private _moveable;
|
|
42
|
+
private _label;
|
|
43
|
+
private _description;
|
|
40
44
|
private _sizeStrategy;
|
|
41
45
|
private _placement;
|
|
42
46
|
private _positionStrategy;
|
|
@@ -86,6 +90,10 @@ export declare class DialogCore implements IDialogCore {
|
|
|
86
90
|
set triggerElement(element: HTMLElement | null);
|
|
87
91
|
get moveable(): boolean;
|
|
88
92
|
set moveable(value: boolean);
|
|
93
|
+
get label(): string;
|
|
94
|
+
set label(value: string);
|
|
95
|
+
get description(): string;
|
|
96
|
+
set description(value: string);
|
|
89
97
|
get positionStrategy(): DialogPositionStrategy;
|
|
90
98
|
set positionStrategy(value: DialogPositionStrategy);
|
|
91
99
|
get sizeStrategy(): DialogSizeStrategy;
|
|
@@ -19,6 +19,8 @@ export class DialogCore {
|
|
|
19
19
|
this._fullscreenThreshold = DIALOG_CONSTANTS.defaults.FULLSCREEN_THRESHOLD;
|
|
20
20
|
this._trigger = '';
|
|
21
21
|
this._moveable = false;
|
|
22
|
+
this._label = '';
|
|
23
|
+
this._description = '';
|
|
22
24
|
this._sizeStrategy = DIALOG_CONSTANTS.defaults.SIZE_STRATEGY;
|
|
23
25
|
this._placement = DIALOG_CONSTANTS.defaults.PLACEMENT;
|
|
24
26
|
this._positionStrategy = DIALOG_CONSTANTS.defaults.POSITION_STRATEGY;
|
|
@@ -319,6 +321,24 @@ export class DialogCore {
|
|
|
319
321
|
this._adapter.toggleHostAttribute(DIALOG_CONSTANTS.attributes.MOVEABLE, this._moveable);
|
|
320
322
|
}
|
|
321
323
|
}
|
|
324
|
+
get label() {
|
|
325
|
+
return this._label;
|
|
326
|
+
}
|
|
327
|
+
set label(value) {
|
|
328
|
+
if (this._label !== value) {
|
|
329
|
+
this._label = value;
|
|
330
|
+
this._adapter.setAccessibleLabel(this._label);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
get description() {
|
|
334
|
+
return this._description;
|
|
335
|
+
}
|
|
336
|
+
set description(value) {
|
|
337
|
+
if (this._description !== value) {
|
|
338
|
+
this._description = value;
|
|
339
|
+
this._adapter.setAccessibleDescription(this._description);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
322
342
|
get positionStrategy() {
|
|
323
343
|
return this._positionStrategy;
|
|
324
344
|
}
|
package/esm/dialog/dialog.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface IDialogProperties {
|
|
|
23
23
|
sizeStrategy: DialogSizeStrategy;
|
|
24
24
|
placement: DialogPlacement;
|
|
25
25
|
moveable: boolean;
|
|
26
|
+
label: string;
|
|
27
|
+
description: string;
|
|
26
28
|
}
|
|
27
29
|
export interface IDialogComponent extends IDialogProperties, IWithDefaultAria, IWithElementInternals, IDismissible {
|
|
28
30
|
show(): void;
|
|
@@ -241,6 +243,18 @@ export declare class DialogComponent extends DialogComponent_base implements IDi
|
|
|
241
243
|
* @attribute
|
|
242
244
|
*/
|
|
243
245
|
placement: DialogPlacement;
|
|
246
|
+
/**
|
|
247
|
+
* The accessible label of the dialog.
|
|
248
|
+
* @default ''
|
|
249
|
+
* @attribute
|
|
250
|
+
*/
|
|
251
|
+
label: string;
|
|
252
|
+
/**
|
|
253
|
+
* The accessible description of the dialog.
|
|
254
|
+
* @default ''
|
|
255
|
+
* @attribute
|
|
256
|
+
*/
|
|
257
|
+
description: string;
|
|
244
258
|
/** Shows the dialog. */
|
|
245
259
|
show(): void;
|
|
246
260
|
/** Hides the dialog. */
|
package/esm/dialog/dialog.js
CHANGED
|
@@ -15,7 +15,7 @@ import { DialogCore } from './dialog-core';
|
|
|
15
15
|
import { dialogStack, DIALOG_CONSTANTS, hideBackdrop, showBackdrop } from './dialog-constants';
|
|
16
16
|
import { tryDismiss } from '../core/utils/dismissible-stack';
|
|
17
17
|
const template = '<template><dialog class=\"forge-dialog\" part=\"root\"><forge-backdrop exportparts=\"root:backdrop\"></forge-backdrop><div class=\"surface\" part=\"surface\"><div class=\"move-handle-container\" part=\"move-handle-container\"><div class=\"move-handle\" part=\"move-handle\"><slot name=\"move-handle\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" part=\"move-handle-icon\"><path d=\"M3 15v-2h2v2H3m0-4V9h2v2H3m4 4v-2h2v2H7m0-4V9h2v2H7m4 4v-2h2v2h-2m0-4V9h2v2h-2m4 4v-2h2v2h-2m0-4V9h2v2h-2m4 4v-2h2v2h-2m0-4V9h2v2h-2z\"/></svg></slot></div></div><slot></slot></div></dialog></template>';
|
|
18
|
-
const styles = '@keyframes forge-dialog-zoom-in{from{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}to{opacity:1;scale:1}}@keyframes forge-dialog-zoom-out{from{opacity:1;scale:1}to{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}}@keyframes forge-dialog-fade-in{from{opacity:var(--_dialog-fade-opacity)}to{opacity:1}}@keyframes forge-dialog-fade-out{from{opacity:1}to{opacity:var(--_dialog-fade-opacity)}}@keyframes forge-dialog-slide-in{from{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}to{opacity:1;translate:0 0}}@keyframes forge-dialog-slide-out{from{opacity:1;translate:0 0}to{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}}@layer base,nonmodal,animation,placement,size-strategy,preset,fullscreen,position-strategy,media; @layer base{:host{display:none;--forge-theme-surface:var(--forge-theme-surface-bright, #ffffff)}:host([hidden]){display:none}.forge-dialog{--_dialog-background:var(--forge-dialog-background, var(--forge-theme-surface-bright, #ffffff));--_dialog-shape:var(--forge-dialog-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_dialog-elevation:var(--forge-dialog-elevation, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12));--_dialog-spacing:var(--forge-dialog-spacing, auto);--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, var(--_dialog-spacing));--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, var(--_dialog-spacing));--_dialog-inline-start-spacing:var(--forge-dialog-inline-start-spacing, var(--_dialog-spacing));--_dialog-inline-end-spacing:var(--forge-dialog-inline-end-spacing, var(--_dialog-spacing));--_dialog-padding:var(--forge-dialog-padding, 0);--_dialog-width:var(--forge-dialog-width, fit-content);--_dialog-height:var(--forge-dialog-height, fit-content);--_dialog-min-width:var(--forge-dialog-min-width, 0);--_dialog-max-width:var(--forge-dialog-max-width, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-min-height:var(--forge-dialog-min-height, 0);--_dialog-max-height:var(--forge-dialog-max-height, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-z-index:var(--forge-dialog-z-index, var(--forge-z-index-dialog, 8));--_dialog-move-handle-color:var(--forge-dialog-move-handle-color, currentColor);--_dialog-move-handle-size:var(--forge-dialog-move-handle-size, 24px);--_dialog-move-handle-hover-cursor:var(--forge-dialog-move-handle-hover-cursor, grab);--_dialog-move-handle-active-cursor:var(--forge-dialog-move-handle-active-cursor, grabbing);--_dialog-move-handle-spacing:var(--forge-dialog-move-handle-spacing, calc(var(--forge-spacing-xxsmall, 4px) * -1) 0 0);--_dialog-move-transition-duration:var(--forge-dialog-move-transition-duration, var(--forge-animation-duration-short4, 200ms));--_dialog-move-transition-easing:var(--forge-dialog-move-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-moving-opacity:var(--forge-dialog-moving-opacity, 0.54);--_dialog-enter-animation-duration:var(--forge-dialog-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-enter-animation-easing:var(--forge-dialog-enter-animation-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-exit-animation-duration:var(--forge-dialog-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-exit-animation-easing:var(--forge-dialog-exit-animation-easing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)));--_dialog-zoom-opacity:var(--forge-dialog-zoom-opacity, 0);--_dialog-zoom-scale:var(--forge-dialog-zoom-scale, 0.8);--_dialog-fade-opacity:var(--forge-dialog-fade-opacity, 0);--_dialog-slide-opacity:var(--forge-dialog-slide-opacity, 0);--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -30%);--_dialog-backdrop-opacity:var(--forge-dialog-backdrop-opacity, var(--forge-backdrop-opacity, 0.54));--_dialog-nonmodal-elevation:var(--forge-dialog-nonmodal-elevation, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12));--_dialog-fullscreen-enter-animation-duration:var(--forge-dialog-fullscreen-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-fullscreen-exit-animation-duration:var(--forge-dialog-fullscreen-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-position-x:var(--forge-dialog-position-x, 0);--_dialog-position-y:var(--forge-dialog-position-y, 0);--_dialog-preset-sheet-enter-animation-duration:var(--forge-dialog-preset-sheet-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-preset-sheet-exit-animation-duration:var(--forge-dialog-preset-sheet-exit-animation-duration, var(--forge-animation-duration-short3, 150ms))}.forge-dialog{position:fixed;inset:0;z-index:var(--_dialog-z-index);background-color:transparent;color:inherit;border:none;width:auto;height:auto;padding:0;margin:0;overflow:visible;max-width:100%;max-height:100%;box-sizing:border-box}.container{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.surface{position:absolute;inset:0;display:flex;background:var(--_dialog-background);box-shadow:var(--_dialog-elevation);z-index:var(--_dialog-z-index);overflow:hidden;border-radius:var(--_dialog-shape);margin-block-start:var(--_dialog-block-start-spacing);margin-block-end:var(--_dialog-block-end-spacing);margin-inline-start:var(--_dialog-inline-start-spacing);margin-inline-end:var(--_dialog-inline-end-spacing);padding:var(--_dialog-padding);width:var(--_dialog-width);height:var(--_dialog-height);min-width:var(--_dialog-min-width);max-width:var(--_dialog-max-width);min-height:var(--_dialog-min-height);max-height:var(--_dialog-max-height);box-sizing:border-box}dialog.forge-dialog::backdrop{display:none}forge-backdrop{--forge-backdrop-opacity:var(--_dialog-backdrop-opacity);--forge-backdrop-enter-animation-duration:var(--_dialog-enter-animation-duration);--forge-backdrop-enter-animation-easing:var(--_dialog-enter-animation-easing);--forge-backdrop-exit-animation-duration:var(--_dialog-exit-animation-duration);--forge-backdrop-exit-animation-easing:var(--_dialog-exit-animation-easing)}:host(:not([moveable])) .move-handle{display:none}:host([moveable]:not([fullscreen])) .surface{user-select:none;transition-property:opacity;transition-duration:var(--_dialog-move-transition-duration);transition-timing-function:var(--_dialog-move-transition-easing)}:host([moveable]:not([fullscreen])) .surface:not(:hover) .move-handle-container{display:none}:host([moveable]:not([fullscreen])) .surface.moved{margin:0}:host([moveable]:not([fullscreen])) .surface.moving{opacity:var(--_dialog-moving-opacity)}:host([moveable]:not([fullscreen])) .move-handle-container{position:absolute;top:0;z-index:1;display:flex;justify-content:center;width:100%}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle{fill:var(--_dialog-move-handle-color);height:var(--_dialog-move-handle-size);width:var(--_dialog-move-handle-size);margin:var(--_dialog-move-handle-spacing);touch-action:none}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:hover{cursor:var(--_dialog-move-handle-hover-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:active{cursor:var(--_dialog-move-handle-active-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle svg{fill:currentColor}:host([visible]){display:contents}}@layer nonmodal{:host([mode=nonmodal]) .forge-dialog{pointer-events:none}:host([mode=nonmodal]) .container{display:contents}:host([mode=nonmodal]) .surface{--_dialog-elevation:var(--_dialog-nonmodal-elevation);pointer-events:all}:host([mode=nonmodal]) forge-backdrop{display:none}}@layer animation{:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface{animation-duration:var(--_dialog-enter-animation-duration);animation-timing-function:var(--_dialog-enter-animation-easing)}:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface.exiting{animation-duration:var(--_dialog-exit-animation-duration);animation-timing-function:var(--_dialog-exit-animation-easing)}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-zoom-in}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-zoom-out}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-fade-in}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-fade-out}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-slide-out}}@layer placement{:host([placement=custom]) .surface{margin:0;top:var(--_dialog-position-x);left:var(--_dialog-position-y)}:host([placement=top]) .surface{--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, 0);top:0;bottom:auto}:host([placement=top-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:auto;right:0;bottom:auto}:host([placement=top-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:0;right:auto;bottom:auto}:host([placement=bottom]) .surface{--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, 0);top:auto;bottom:0}:host([placement=bottom-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:auto;right:0;bottom:0}:host([placement=bottom-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:0;right:auto;bottom:0}}@layer size-strategy{:host([size-strategy=container-inline]) .surface{width:100%}:host([size-strategy=container-block]) .surface{height:100%}}@layer preset{:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-preset-sheet-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-preset-sheet-exit-animation-duration)}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface.exiting{animation-name:forge-dialog-slide-out}:host(:is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{--_dialog-max-width:var(--forge-dialog-max-width, none);--_dialog-max-height:var(--forge-dialog-max-height, none);inset:auto;display:inline-flex}:host([preset=left-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, -100% 0)}:host([preset=left-sheet]) .surface{left:0;bottom:0;top:0;height:100%;border-top-left-radius:0;border-bottom-left-radius:0}:host([preset=right-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 100% 0)}:host([preset=right-sheet]) .surface{right:0;bottom:0;top:0;height:100%;border-top-right-radius:0;border-bottom-right-radius:0}:host([preset=top-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -100%)}:host([preset=top-sheet]) .surface{top:0;left:0;right:0;border-top-left-radius:0;border-top-right-radius:0}:host([preset=bottom-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 100%)}:host([preset=bottom-sheet]) .surface{bottom:0;left:0;right:0;border-bottom-left-radius:0;border-bottom-right-radius:0}}@layer fullscreen{:host([fullscreen]) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-fullscreen-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-fullscreen-exit-animation-duration)}:host([fullscreen]) .surface{height:100%;width:100%;max-width:none;max-height:none;border-radius:0;box-shadow:none}:host([fullscreen]) forge-backdrop{display:none}}@layer position-strategy{:host([position-strategy=viewport]) .forge-dialog{position:fixed}:host([position-strategy=container]) .forge-dialog{position:absolute}:host([position-strategy=container][preset$=-sheet]) .forge-dialog{contain:content}}@layer media{@media (prefers-reduced-motion:reduce){.surface{animation-name:forge-dialog-fade-in}.surface.exiting{animation-name:forge-dialog-fade-out}}}';
|
|
18
|
+
const styles = '@keyframes forge-dialog-zoom-in{from{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}to{opacity:1;scale:1}}@keyframes forge-dialog-zoom-out{from{opacity:1;scale:1}to{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}}@keyframes forge-dialog-fade-in{from{opacity:var(--_dialog-fade-opacity)}to{opacity:1}}@keyframes forge-dialog-fade-out{from{opacity:1}to{opacity:var(--_dialog-fade-opacity)}}@keyframes forge-dialog-slide-in{from{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}to{opacity:1;translate:0 0}}@keyframes forge-dialog-slide-out{from{opacity:1;translate:0 0}to{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}}@layer base,nonmodal,animation,placement,size-strategy,preset,fullscreen,position-strategy,media; @layer base{:host{display:none;--forge-theme-surface:var(--forge-theme-surface-bright, #ffffff)}:host([hidden]){display:none}.forge-dialog{--_dialog-background:var(--forge-dialog-background, var(--forge-theme-surface-bright, #ffffff));--_dialog-shape:var(--forge-dialog-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_dialog-elevation:var(--forge-dialog-elevation, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12));--_dialog-spacing:var(--forge-dialog-spacing, auto);--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, var(--_dialog-spacing));--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, var(--_dialog-spacing));--_dialog-inline-start-spacing:var(--forge-dialog-inline-start-spacing, var(--_dialog-spacing));--_dialog-inline-end-spacing:var(--forge-dialog-inline-end-spacing, var(--_dialog-spacing));--_dialog-padding:var(--forge-dialog-padding, 0);--_dialog-width:var(--forge-dialog-width, fit-content);--_dialog-height:var(--forge-dialog-height, fit-content);--_dialog-min-width:var(--forge-dialog-min-width, 0);--_dialog-max-width:var(--forge-dialog-max-width, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-min-height:var(--forge-dialog-min-height, 0);--_dialog-max-height:var(--forge-dialog-max-height, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-z-index:var(--forge-dialog-z-index, var(--forge-z-index-dialog, 8));--_dialog-move-handle-color:var(--forge-dialog-move-handle-color, currentColor);--_dialog-move-handle-size:var(--forge-dialog-move-handle-size, 24px);--_dialog-move-handle-hover-cursor:var(--forge-dialog-move-handle-hover-cursor, grab);--_dialog-move-handle-active-cursor:var(--forge-dialog-move-handle-active-cursor, grabbing);--_dialog-move-handle-spacing:var(--forge-dialog-move-handle-spacing, calc(var(--forge-spacing-xxsmall, 4px) * -1) 0 0);--_dialog-move-transition-duration:var(--forge-dialog-move-transition-duration, var(--forge-animation-duration-short4, 200ms));--_dialog-move-transition-easing:var(--forge-dialog-move-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-moving-opacity:var(--forge-dialog-moving-opacity, 0.54);--_dialog-enter-animation-duration:var(--forge-dialog-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-enter-animation-easing:var(--forge-dialog-enter-animation-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-exit-animation-duration:var(--forge-dialog-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-exit-animation-easing:var(--forge-dialog-exit-animation-easing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)));--_dialog-zoom-opacity:var(--forge-dialog-zoom-opacity, 0);--_dialog-zoom-scale:var(--forge-dialog-zoom-scale, 0.8);--_dialog-fade-opacity:var(--forge-dialog-fade-opacity, 0);--_dialog-slide-opacity:var(--forge-dialog-slide-opacity, 0);--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -30%);--_dialog-backdrop-opacity:var(--forge-dialog-backdrop-opacity, var(--forge-backdrop-opacity, 0.54));--_dialog-nonmodal-elevation:var(--forge-dialog-nonmodal-elevation, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12));--_dialog-fullscreen-enter-animation-duration:var(--forge-dialog-fullscreen-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-fullscreen-exit-animation-duration:var(--forge-dialog-fullscreen-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-position-x:var(--forge-dialog-position-x, 0);--_dialog-position-y:var(--forge-dialog-position-y, 0);--_dialog-preset-sheet-enter-animation-duration:var(--forge-dialog-preset-sheet-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-preset-sheet-exit-animation-duration:var(--forge-dialog-preset-sheet-exit-animation-duration, var(--forge-animation-duration-short3, 150ms))}.forge-dialog{position:fixed;inset:0;z-index:var(--_dialog-z-index);background-color:transparent;color:inherit;border:none;width:auto;height:auto;padding:0;margin:0;overflow:visible;max-width:100%;max-height:100%;box-sizing:border-box}.container{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.surface{position:absolute;inset:0;display:flex;background:var(--_dialog-background);box-shadow:var(--_dialog-elevation);z-index:var(--_dialog-z-index);overflow:hidden;border-radius:var(--_dialog-shape);margin-block-start:var(--_dialog-block-start-spacing);margin-block-end:var(--_dialog-block-end-spacing);margin-inline-start:var(--_dialog-inline-start-spacing);margin-inline-end:var(--_dialog-inline-end-spacing);padding:var(--_dialog-padding);width:var(--_dialog-width);height:var(--_dialog-height);min-width:var(--_dialog-min-width);max-width:var(--_dialog-max-width);min-height:var(--_dialog-min-height);max-height:var(--_dialog-max-height);box-sizing:border-box}.visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:fixed;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}dialog.forge-dialog::backdrop{display:none}forge-backdrop{--forge-backdrop-opacity:var(--_dialog-backdrop-opacity);--forge-backdrop-enter-animation-duration:var(--_dialog-enter-animation-duration);--forge-backdrop-enter-animation-easing:var(--_dialog-enter-animation-easing);--forge-backdrop-exit-animation-duration:var(--_dialog-exit-animation-duration);--forge-backdrop-exit-animation-easing:var(--_dialog-exit-animation-easing)}:host(:not([moveable])) .move-handle{display:none}:host([moveable]:not([fullscreen])) .surface{user-select:none;transition-property:opacity;transition-duration:var(--_dialog-move-transition-duration);transition-timing-function:var(--_dialog-move-transition-easing)}:host([moveable]:not([fullscreen])) .surface:not(:hover) .move-handle-container{display:none}:host([moveable]:not([fullscreen])) .surface.moved{margin:0}:host([moveable]:not([fullscreen])) .surface.moving{opacity:var(--_dialog-moving-opacity)}:host([moveable]:not([fullscreen])) .move-handle-container{position:absolute;top:0;z-index:1;display:flex;justify-content:center;width:100%}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle{fill:var(--_dialog-move-handle-color);height:var(--_dialog-move-handle-size);width:var(--_dialog-move-handle-size);margin:var(--_dialog-move-handle-spacing);touch-action:none}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:hover{cursor:var(--_dialog-move-handle-hover-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:active{cursor:var(--_dialog-move-handle-active-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle svg{fill:currentColor}:host([visible]){display:contents}}@layer nonmodal{:host([mode=nonmodal]) .forge-dialog{pointer-events:none}:host([mode=nonmodal]) .container{display:contents}:host([mode=nonmodal]) .surface{--_dialog-elevation:var(--_dialog-nonmodal-elevation);pointer-events:all}:host([mode=nonmodal]) forge-backdrop{display:none}}@layer animation{:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface{animation-duration:var(--_dialog-enter-animation-duration);animation-timing-function:var(--_dialog-enter-animation-easing)}:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface.exiting{animation-duration:var(--_dialog-exit-animation-duration);animation-timing-function:var(--_dialog-exit-animation-easing)}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-zoom-in}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-zoom-out}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-fade-in}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-fade-out}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-slide-out}}@layer placement{:host([placement=custom]) .surface{margin:0;top:var(--_dialog-position-x);left:var(--_dialog-position-y)}:host([placement=top]) .surface{--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, 0);top:0;bottom:auto}:host([placement=top-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:auto;right:0;bottom:auto}:host([placement=top-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:0;right:auto;bottom:auto}:host([placement=bottom]) .surface{--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, 0);top:auto;bottom:0}:host([placement=bottom-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:auto;right:0;bottom:0}:host([placement=bottom-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:0;right:auto;bottom:0}}@layer size-strategy{:host([size-strategy=container-inline]) .surface{width:100%}:host([size-strategy=container-block]) .surface{height:100%}}@layer preset{:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-preset-sheet-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-preset-sheet-exit-animation-duration)}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface.exiting{animation-name:forge-dialog-slide-out}:host(:is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{--_dialog-max-width:var(--forge-dialog-max-width, none);--_dialog-max-height:var(--forge-dialog-max-height, none);inset:auto;display:inline-flex}:host([preset=left-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, -100% 0)}:host([preset=left-sheet]) .surface{left:0;bottom:0;top:0;height:100%;border-top-left-radius:0;border-bottom-left-radius:0}:host([preset=right-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 100% 0)}:host([preset=right-sheet]) .surface{right:0;bottom:0;top:0;height:100%;border-top-right-radius:0;border-bottom-right-radius:0}:host([preset=top-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -100%)}:host([preset=top-sheet]) .surface{top:0;left:0;right:0;border-top-left-radius:0;border-top-right-radius:0}:host([preset=bottom-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 100%)}:host([preset=bottom-sheet]) .surface{bottom:0;left:0;right:0;border-bottom-left-radius:0;border-bottom-right-radius:0}}@layer fullscreen{:host([fullscreen]) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-fullscreen-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-fullscreen-exit-animation-duration)}:host([fullscreen]) .surface{height:100%;width:100%;max-width:none;max-height:none;border-radius:0;box-shadow:none}:host([fullscreen]) forge-backdrop{display:none}}@layer position-strategy{:host([position-strategy=viewport]) .forge-dialog{position:fixed}:host([position-strategy=container]) .forge-dialog{position:absolute}:host([position-strategy=container][preset$=-sheet]) .forge-dialog{contain:content}}@layer media{@media (prefers-reduced-motion:reduce){.surface{animation-name:forge-dialog-fade-in}.surface.exiting{animation-name:forge-dialog-fade-out}}}';
|
|
19
19
|
/**
|
|
20
20
|
* @tag forge-dialog
|
|
21
21
|
*
|
|
@@ -181,6 +181,12 @@ let DialogComponent = class DialogComponent extends WithDefaultAria(WithElementI
|
|
|
181
181
|
case DIALOG_CONSTANTS.observedAttributes.PLACEMENT:
|
|
182
182
|
this.placement = newValue ?? DIALOG_CONSTANTS.defaults.PLACEMENT;
|
|
183
183
|
break;
|
|
184
|
+
case DIALOG_CONSTANTS.observedAttributes.LABEL:
|
|
185
|
+
this.label = newValue;
|
|
186
|
+
break;
|
|
187
|
+
case DIALOG_CONSTANTS.observedAttributes.DESCRIPTION:
|
|
188
|
+
this.description = newValue;
|
|
189
|
+
break;
|
|
184
190
|
}
|
|
185
191
|
}
|
|
186
192
|
/** Shows the dialog. */
|
|
@@ -239,6 +245,12 @@ __decorate([
|
|
|
239
245
|
__decorate([
|
|
240
246
|
coreProperty()
|
|
241
247
|
], DialogComponent.prototype, "placement", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
coreProperty()
|
|
250
|
+
], DialogComponent.prototype, "label", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
coreProperty()
|
|
253
|
+
], DialogComponent.prototype, "description", void 0);
|
|
242
254
|
DialogComponent = __decorate([
|
|
243
255
|
customElement({
|
|
244
256
|
name: DIALOG_CONSTANTS.elementName,
|
|
@@ -8,6 +8,8 @@ export declare const ICON_BUTTON_CONSTANTS: {
|
|
|
8
8
|
elementName: "forge-icon-button";
|
|
9
9
|
observedAttributes: {
|
|
10
10
|
TOGGLE: string;
|
|
11
|
+
PRESSED: string;
|
|
12
|
+
/** @deprecated use `PRESSED` instead. */
|
|
11
13
|
ON: string;
|
|
12
14
|
VARIANT: string;
|
|
13
15
|
THEME: string;
|
|
@@ -17,6 +19,8 @@ export declare const ICON_BUTTON_CONSTANTS: {
|
|
|
17
19
|
attributes: {
|
|
18
20
|
ARIA_PRESSED: string;
|
|
19
21
|
TOGGLE: string;
|
|
22
|
+
PRESSED: string;
|
|
23
|
+
/** @deprecated use `PRESSED` instead. */
|
|
20
24
|
ON: string;
|
|
21
25
|
VARIANT: string;
|
|
22
26
|
THEME: string;
|