@tylertech/forge 3.5.1 → 3.6.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 +287 -198
- 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 +32 -47
- 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 +21 -1
- package/esm/dialog/dialog.d.ts +15 -0
- package/esm/dialog/dialog.js +14 -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 +6 -31
- 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-adapter.d.ts +4 -4
- package/esm/switch/switch-adapter.js +5 -5
- package/esm/switch/switch-component-delegate.d.ts +7 -0
- package/esm/switch/switch-component-delegate.js +15 -0
- package/esm/switch/switch-constants.d.ts +10 -0
- package/esm/switch/switch-constants.js +5 -0
- package/esm/switch/switch-core.d.ts +9 -9
- package/esm/switch/switch-core.js +26 -25
- package/esm/switch/switch.d.ts +23 -7
- package/esm/switch/switch.js +26 -17
- 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 +1 -1
- 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/icon-button/icon-button.scss +10 -10
- package/sass/radio/radio/_core.scss +2 -2
- package/sass/switch/_core.scss +2 -2
- package/sass/switch/switch.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
|
@@ -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;
|
|
@@ -29,7 +31,7 @@ export class DialogCore {
|
|
|
29
31
|
this._fullscreenListener = this._onFullscreenChange.bind(this);
|
|
30
32
|
}
|
|
31
33
|
initialize() {
|
|
32
|
-
this._adapter.tryApplyGlobalConfiguration(['animationType', 'positionStrategy', 'sizeStrategy', 'persistent', 'moveable', 'fullscreenThreshold']);
|
|
34
|
+
this._adapter.tryApplyGlobalConfiguration(['mode', 'animationType', 'positionStrategy', 'sizeStrategy', 'persistent', 'moveable', 'fullscreenThreshold']);
|
|
33
35
|
if (this._trigger && !this._adapter.triggerElement) {
|
|
34
36
|
this._adapter.tryLocateTriggerElement(this._trigger);
|
|
35
37
|
}
|
|
@@ -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;
|
|
@@ -50,6 +52,7 @@ declare const DialogComponent_base: import("..").AbstractConstructor<import("../
|
|
|
50
52
|
*
|
|
51
53
|
* @dependency forge-backdrop
|
|
52
54
|
*
|
|
55
|
+
* @globalconfig mode
|
|
53
56
|
* @globalconfig animationType
|
|
54
57
|
* @globalconfig positionStrategy
|
|
55
58
|
* @globalconfig sizeStrategy
|
|
@@ -241,6 +244,18 @@ export declare class DialogComponent extends DialogComponent_base implements IDi
|
|
|
241
244
|
* @attribute
|
|
242
245
|
*/
|
|
243
246
|
placement: DialogPlacement;
|
|
247
|
+
/**
|
|
248
|
+
* The accessible label of the dialog.
|
|
249
|
+
* @default ''
|
|
250
|
+
* @attribute
|
|
251
|
+
*/
|
|
252
|
+
label: string;
|
|
253
|
+
/**
|
|
254
|
+
* The accessible description of the dialog.
|
|
255
|
+
* @default ''
|
|
256
|
+
* @attribute
|
|
257
|
+
*/
|
|
258
|
+
description: string;
|
|
244
259
|
/** Shows the dialog. */
|
|
245
260
|
show(): void;
|
|
246
261
|
/** 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
|
*
|
|
@@ -23,6 +23,7 @@ const styles = '@keyframes forge-dialog-zoom-in{from{opacity:var(--_dialog-zoom-
|
|
|
23
23
|
*
|
|
24
24
|
* @dependency forge-backdrop
|
|
25
25
|
*
|
|
26
|
+
* @globalconfig mode
|
|
26
27
|
* @globalconfig animationType
|
|
27
28
|
* @globalconfig positionStrategy
|
|
28
29
|
* @globalconfig sizeStrategy
|
|
@@ -181,6 +182,12 @@ let DialogComponent = class DialogComponent extends WithDefaultAria(WithElementI
|
|
|
181
182
|
case DIALOG_CONSTANTS.observedAttributes.PLACEMENT:
|
|
182
183
|
this.placement = newValue ?? DIALOG_CONSTANTS.defaults.PLACEMENT;
|
|
183
184
|
break;
|
|
185
|
+
case DIALOG_CONSTANTS.observedAttributes.LABEL:
|
|
186
|
+
this.label = newValue;
|
|
187
|
+
break;
|
|
188
|
+
case DIALOG_CONSTANTS.observedAttributes.DESCRIPTION:
|
|
189
|
+
this.description = newValue;
|
|
190
|
+
break;
|
|
184
191
|
}
|
|
185
192
|
}
|
|
186
193
|
/** Shows the dialog. */
|
|
@@ -239,6 +246,12 @@ __decorate([
|
|
|
239
246
|
__decorate([
|
|
240
247
|
coreProperty()
|
|
241
248
|
], DialogComponent.prototype, "placement", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
coreProperty()
|
|
251
|
+
], DialogComponent.prototype, "label", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
coreProperty()
|
|
254
|
+
], DialogComponent.prototype, "description", void 0);
|
|
242
255
|
DialogComponent = __decorate([
|
|
243
256
|
customElement({
|
|
244
257
|
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;
|
|
@@ -7,6 +7,8 @@ import { COMPONENT_NAME_PREFIX } from '../constants';
|
|
|
7
7
|
const elementName = `${COMPONENT_NAME_PREFIX}icon-button`;
|
|
8
8
|
const observedAttributes = {
|
|
9
9
|
TOGGLE: 'toggle',
|
|
10
|
+
PRESSED: 'pressed',
|
|
11
|
+
/** @deprecated use `PRESSED` instead. */
|
|
10
12
|
ON: 'on',
|
|
11
13
|
VARIANT: 'variant',
|
|
12
14
|
THEME: 'theme',
|
|
@@ -8,7 +8,7 @@ import { IIconButtonAdapter } from './icon-button-adapter';
|
|
|
8
8
|
import { IconButtonDensity, IconButtonShape, IconButtonTheme, IconButtonVariant } from './icon-button-constants';
|
|
9
9
|
export interface IIconButtonCore extends IBaseButtonCore {
|
|
10
10
|
toggle: boolean;
|
|
11
|
-
|
|
11
|
+
pressed: boolean;
|
|
12
12
|
variant: IconButtonVariant;
|
|
13
13
|
theme: IconButtonTheme;
|
|
14
14
|
shape: IconButtonShape;
|
|
@@ -16,7 +16,7 @@ export interface IIconButtonCore extends IBaseButtonCore {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class IconButtonCore extends BaseButtonCore<IIconButtonAdapter> implements IIconButtonCore {
|
|
18
18
|
private _toggle;
|
|
19
|
-
private
|
|
19
|
+
private _pressed;
|
|
20
20
|
private _variant;
|
|
21
21
|
private _theme;
|
|
22
22
|
private _shape;
|
|
@@ -27,8 +27,8 @@ export declare class IconButtonCore extends BaseButtonCore<IIconButtonAdapter> i
|
|
|
27
27
|
private _onToggle;
|
|
28
28
|
get toggle(): boolean;
|
|
29
29
|
set toggle(value: boolean);
|
|
30
|
-
get
|
|
31
|
-
set
|
|
30
|
+
get pressed(): boolean;
|
|
31
|
+
set pressed(value: boolean);
|
|
32
32
|
get variant(): IconButtonVariant;
|
|
33
33
|
set variant(value: IconButtonVariant);
|
|
34
34
|
get theme(): IconButtonTheme;
|
|
@@ -9,7 +9,7 @@ export class IconButtonCore extends BaseButtonCore {
|
|
|
9
9
|
constructor(adapter) {
|
|
10
10
|
super(adapter);
|
|
11
11
|
this._toggle = false;
|
|
12
|
-
this.
|
|
12
|
+
this._pressed = false;
|
|
13
13
|
this._variant = ICON_BUTTON_CONSTANTS.defaults.DEFAULT_VARIANT;
|
|
14
14
|
this._theme = ICON_BUTTON_CONSTANTS.defaults.DEFAULT_THEME;
|
|
15
15
|
this._shape = ICON_BUTTON_CONSTANTS.defaults.DEFAULT_SHAPE;
|
|
@@ -27,14 +27,14 @@ export class IconButtonCore extends BaseButtonCore {
|
|
|
27
27
|
}
|
|
28
28
|
_onToggle() {
|
|
29
29
|
// Update internal state first so listeners can access the new state
|
|
30
|
-
const
|
|
31
|
-
this.
|
|
32
|
-
const cancelled = !this._adapter.emitHostEvent(ICON_BUTTON_CONSTANTS.events.TOGGLE, this.
|
|
33
|
-
this.
|
|
30
|
+
const originalPressed = this._pressed;
|
|
31
|
+
this._pressed = !this._pressed;
|
|
32
|
+
const cancelled = !this._adapter.emitHostEvent(ICON_BUTTON_CONSTANTS.events.TOGGLE, this.pressed, true, true);
|
|
33
|
+
this._pressed = originalPressed;
|
|
34
34
|
if (cancelled) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
this.
|
|
37
|
+
this.pressed = !originalPressed;
|
|
38
38
|
}
|
|
39
39
|
get toggle() {
|
|
40
40
|
return this._toggle;
|
|
@@ -43,24 +43,26 @@ export class IconButtonCore extends BaseButtonCore {
|
|
|
43
43
|
value = !!value;
|
|
44
44
|
if (this._toggle !== value) {
|
|
45
45
|
this._toggle = value;
|
|
46
|
-
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ARIA_PRESSED, this._toggle, `${this.
|
|
46
|
+
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ARIA_PRESSED, this._toggle, `${this._pressed}`);
|
|
47
47
|
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.TOGGLE, this._toggle);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
get
|
|
51
|
-
return this.
|
|
50
|
+
get pressed() {
|
|
51
|
+
return this._pressed;
|
|
52
52
|
}
|
|
53
|
-
set
|
|
53
|
+
set pressed(value) {
|
|
54
54
|
value = !!value;
|
|
55
|
-
if (this.
|
|
56
|
-
this.
|
|
55
|
+
if (this._pressed !== value) {
|
|
56
|
+
this._pressed = value;
|
|
57
57
|
if (this._toggle) {
|
|
58
|
-
this._adapter.setHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ARIA_PRESSED, `${this.
|
|
58
|
+
this._adapter.setHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ARIA_PRESSED, `${this._pressed}`);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
this._adapter.removeHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ARIA_PRESSED);
|
|
62
62
|
}
|
|
63
|
-
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.
|
|
63
|
+
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.PRESSED, this._pressed);
|
|
64
|
+
// Deprecated but left for legacy support
|
|
65
|
+
this._adapter.toggleHostAttribute(ICON_BUTTON_CONSTANTS.attributes.ON, this._pressed);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
get variant() {
|