@tylertech/forge 3.7.0 → 3.8.0-dev.1
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 +175 -131
- package/dist/button/forge-button.css +3 -2
- package/dist/dialog/forge-dialog.css +3 -0
- package/dist/lib.js +23 -15
- package/dist/lib.js.map +4 -4
- package/dist/switch/forge-switch.css +1 -1
- package/dist/vscode.html-custom-data.json +9 -30
- package/esm/app-bar/notification-button/app-bar-notification-button-adapter.js +4 -5
- package/esm/app-bar/notification-button/app-bar-notification-button.js +6 -3
- package/esm/app-bar/profile-button/app-bar-profile-button.js +1 -1
- package/esm/autocomplete/autocomplete-adapter.js +1 -1
- package/esm/avatar/avatar-constants.d.ts +1 -0
- package/esm/avatar/avatar-constants.js +1 -0
- package/esm/avatar/avatar.d.ts +1 -1
- package/esm/avatar/avatar.js +1 -1
- package/esm/badge/badge-component-delegate.js +1 -2
- package/esm/badge/badge-constants.d.ts +1 -0
- package/esm/badge/badge-constants.js +1 -0
- package/esm/badge/badge.d.ts +20 -23
- package/esm/badge/badge.js +57 -47
- package/esm/badge/index.js +3 -3
- package/esm/bottom-sheet/bottom-sheet-constants.d.ts +1 -1
- package/esm/bottom-sheet/bottom-sheet.d.ts +3 -1
- package/esm/button/button.js +1 -1
- package/esm/button-toggle/button-toggle-group/button-toggle-group-adapter.js +1 -2
- package/esm/button-toggle/button-toggle-group/button-toggle-group.d.ts +6 -6
- package/esm/button-toggle/button-toggle-group/button-toggle-group.js +6 -6
- package/esm/card/card-constants.d.ts +1 -0
- package/esm/card/card-constants.js +1 -0
- package/esm/card/card.d.ts +12 -13
- package/esm/card/card.js +25 -34
- package/esm/card/index.js +3 -3
- package/esm/checkbox/checkbox.d.ts +5 -1
- package/esm/chips/chip/chip-constants.d.ts +1 -1
- package/esm/core/delegates/base-component-delegate.d.ts +1 -1
- package/esm/core/mask/date-input-mask.d.ts +3 -3
- package/esm/core/mask/date-input-mask.js +7 -8
- package/esm/core/mask/intermediate-time-parser.d.ts +2 -2
- package/esm/core/mask/intermediate-time-parser.js +2 -3
- package/esm/core/mask/time-input-mask.d.ts +3 -3
- package/esm/core/mask/time-input-mask.js +4 -5
- package/esm/core/mixins/label/with-label-aware.d.ts +4 -1
- package/esm/core/utils/a11y-utils.d.ts +0 -8
- package/esm/core/utils/a11y-utils.js +5 -25
- package/esm/core/utils/dismissible-stack.d.ts +7 -0
- package/esm/core/utils/position-utils.d.ts +1 -2
- package/esm/core/utils/position-utils.js +7 -22
- package/esm/core/utils/utils.d.ts +8 -0
- package/esm/core/utils/utils.js +26 -1
- package/esm/date-picker/base/base-date-picker-constants.d.ts +2 -2
- package/esm/deprecated/button/deprecated-button.js +1 -1
- package/esm/dialog/dialog-core.js +2 -2
- package/esm/dialog/dialog.d.ts +2 -0
- package/esm/dialog/dialog.js +1 -1
- package/esm/expansion-panel/expansion-panel-adapter.d.ts +31 -0
- package/esm/expansion-panel/expansion-panel-adapter.js +60 -1
- package/esm/expansion-panel/expansion-panel-constants.d.ts +4 -0
- package/esm/expansion-panel/expansion-panel-constants.js +4 -1
- package/esm/expansion-panel/expansion-panel-core.d.ts +13 -1
- package/esm/expansion-panel/expansion-panel-core.js +63 -1
- package/esm/expansion-panel/expansion-panel.d.ts +9 -0
- package/esm/expansion-panel/expansion-panel.js +14 -0
- package/esm/floating-action-button/floating-action-button-constants.d.ts +1 -1
- package/esm/icon/icon-constants.d.ts +1 -1
- package/esm/icon/icon-registry.d.ts +6 -0
- package/esm/icon-button/icon-button-constants.d.ts +1 -1
- package/esm/label/label-adapter.js +1 -1
- package/esm/list/list-item/list-item.js +1 -1
- package/esm/meter/meter/meter.js +2 -1
- package/esm/meter/meter-group/meter-group.js +2 -1
- package/esm/overlay/base/base-overlay-core.d.ts +3 -3
- package/esm/overlay/base/base-overlay.d.ts +3 -3
- package/esm/overlay/base/base-overlay.js +11 -1
- package/esm/overlay/base/overlay-aware-core.d.ts +3 -3
- package/esm/overlay/base/overlay-aware-core.js +2 -1
- package/esm/overlay/overlay-adapter.d.ts +2 -2
- package/esm/overlay/overlay-adapter.js +6 -14
- package/esm/overlay/overlay-constants.d.ts +2 -5
- package/esm/overlay/overlay-constants.js +2 -23
- package/esm/overlay/overlay-core.d.ts +3 -3
- package/esm/overlay/overlay-core.js +13 -3
- package/esm/overlay/overlay.d.ts +2 -2
- package/esm/overlay/overlay.js +2 -2
- package/esm/popover/popover.js +1 -1
- package/esm/profile-card/profile-card-core.js +4 -4
- package/esm/radio/core/radio-group-manager.d.ts +2 -1
- package/esm/radio/radio/radio.d.ts +1 -0
- package/esm/split-button/split-button-constants.d.ts +2 -2
- package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
- package/esm/stepper/stepper/stepper-constants.d.ts +1 -3
- package/esm/switch/switch.d.ts +5 -1
- package/esm/switch/switch.js +1 -1
- package/esm/table/table-core.js +10 -2
- package/esm/table/table-utils.js +8 -4
- package/esm/time-picker/time-picker-constants.d.ts +2 -2
- package/esm/toast/toast-constants.d.ts +1 -1
- package/esm/tooltip/tooltip-constants.d.ts +1 -1
- package/package.json +4 -4
- package/sass/badge/badge.scss +10 -10
- package/sass/button/_core.scss +1 -0
- package/sass/calendar/_variables.scss +3 -2
- package/sass/card/card.scss +1 -1
- package/sass/core/styles/tokens/button/_tokens.scss +2 -2
- package/sass/core/styles/tokens/slider/_tokens.scss +10 -4
- package/sass/core/styles/tokens/switch/_tokens.scss +1 -1
- package/sass/dialog/dialog.scss +8 -0
- package/sass/dialog/forge-dialog.scss +4 -0
- package/sass/linear-progress/linear-progress.scss +7 -3
- package/sass/list/list-item/list-item.scss +1 -1
- package/sass/popover/popover.scss +0 -1
- package/sass/slider/_core.scss +2 -3
|
@@ -160,3 +160,11 @@ export declare function isInstanceOf<T>(obj: any, name: string): obj is T;
|
|
|
160
160
|
* @returns `true` if the element is visible, otherwise `false`.
|
|
161
161
|
*/
|
|
162
162
|
export declare function checkVisibility(element: HTMLElement): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Adds or removes a state from an element's custom state set.
|
|
165
|
+
*
|
|
166
|
+
* @param internals - The element's internals object.
|
|
167
|
+
* @param state - The name of the custom state to toggle.
|
|
168
|
+
* @param value - Whether to add or remove the state.
|
|
169
|
+
*/
|
|
170
|
+
export declare function toggleState(internals: ElementInternals, state: string, value: boolean): void;
|
package/esm/core/utils/utils.js
CHANGED
|
@@ -276,7 +276,7 @@ export function tryCreateAriaControlsPlaceholder() {
|
|
|
276
276
|
*/
|
|
277
277
|
export function setAriaControls(component) {
|
|
278
278
|
const placeholderDiv = document.getElementById(ARIA_CONTROLS_PLACEHOLDER_ID);
|
|
279
|
-
if (placeholderDiv) {
|
|
279
|
+
if (placeholderDiv && component) {
|
|
280
280
|
component.setAttribute('aria-controls', placeholderDiv.id);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
@@ -323,3 +323,28 @@ export function checkVisibility(element) {
|
|
|
323
323
|
style.opacity !== '0' &&
|
|
324
324
|
style.getPropertyValue('content-visibility') !== 'hidden');
|
|
325
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Adds or removes a state from an element's custom state set.
|
|
328
|
+
*
|
|
329
|
+
* @param internals - The element's internals object.
|
|
330
|
+
* @param state - The name of the custom state to toggle.
|
|
331
|
+
* @param value - Whether to add or remove the state.
|
|
332
|
+
*/
|
|
333
|
+
export function toggleState(internals, state, value) {
|
|
334
|
+
if (value) {
|
|
335
|
+
try {
|
|
336
|
+
internals.states.add(state);
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
internals.states.add(`--${state}`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
try {
|
|
344
|
+
internals.states.delete(state);
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
internals.states.delete(`--${state}`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { Masked, InputMask, type AppendFlags, type FactoryArg } from 'imask';
|
|
7
7
|
import { DayOfWeek, ICalendarDateSelectEventData } from '../../calendar';
|
|
8
8
|
export declare type DatePickerParseCallback = (value: string) => Date | null;
|
|
9
9
|
export declare type DatePickerFormatCallback = (value: Date | null) => string;
|
|
10
|
-
export declare type DatePickerPrepareMaskCallback = (value: string, masked: Masked<string>, flags:
|
|
10
|
+
export declare type DatePickerPrepareMaskCallback = (value: string, masked: Masked<string>, flags: AppendFlags, maskInstance: InputMask<FactoryArg>) => string;
|
|
11
11
|
export declare type DatePickerValueMode = 'object' | 'string' | 'iso-string';
|
|
12
12
|
export interface IDatePickerCalendarDropdownConfig<T> {
|
|
13
13
|
value?: T | null;
|
|
@@ -10,7 +10,7 @@ import { StateLayerComponent, STATE_LAYER_CONSTANTS } from '../../state-layer';
|
|
|
10
10
|
import { DEPRECATED_BUTTON_CONSTANTS } from './deprecated-button-constants';
|
|
11
11
|
import { BaseComponent } from '../../core/base/base-component';
|
|
12
12
|
const template = '<template><slot></slot><forge-focus-indicator part=\"focus-indicator\"></forge-focus-indicator><forge-state-layer exportparts=\"surface:state-layer\"></forge-state-layer></template>';
|
|
13
|
-
const styles = ':host{--_button-primary-color:var(--forge-button-primary-color, var(--forge-theme-primary, #3f51b5));--_button-text-color:var(--forge-button-text-color, var(--_button-primary-color));--_button-disabled-color:var(--forge-button-disabled-color, var(--forge-theme-surface-container, #e0e0e0));--_button-padding:var(--forge-button-padding, var(--forge-spacing-medium, 16px));--_button-display:var(--forge-button-display, inline-flex);--_button-justify:var(--forge-button-justify, center);--_button-shape:var(--forge-button-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_button-height:var(--forge-button-height, 36px);--_button-min-width:var(--forge-button-min-width, 64px);--_button-spacing:var(--forge-button-spacing, var(--forge-spacing-xsmall, 8px));--_button-border-width:var(--forge-button-border-width, medium);--_button-border-style:var(--forge-button-border-style, none);--_button-border-color:var(--forge-button-border-color, currentColor);--_button-shape-start-start-radius:var(--forge-button-shape-start-start-radius, var(--_button-shape));--_button-shape-start-end-radius:var(--forge-button-shape-start-end-radius, var(--_button-shape));--_button-shape-end-start-radius:var(--forge-button-shape-end-start-radius, var(--_button-shape));--_button-shape-end-end-radius:var(--forge-button-shape-end-end-radius, var(--_button-shape));--_button-padding-block:var(--forge-button-padding-block, var(--_button-padding));--_button-padding-inline:var(--forge-button-padding-inline, var(--_button-padding));--_button-background:var(--forge-button-background, transparent);--_button-hover-background:var(--forge-button-hover-background, var(--_button-background));--_button-active-background:var(--forge-button-active-background, var(--_button-background));--_button-color:var(--forge-button-color, var(--_button-text-color));--_button-icon-size:var(--forge-button-icon-size, calc(var(--forge-typography-font-size, 1rem) * 1.125));--_button-shadow:var(--forge-button-shadow, none);--_button-hover-shadow:var(--forge-button-hover-shadow, none);--_button-active-shadow:var(--forge-button-active-shadow, none);--_button-cursor:var(--forge-button-cursor, pointer);--_button-transition-duration:var(--forge-button-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-transition-timing:var(--forge-button-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-text-padding-inline:var(--forge-button-text-padding-inline, var(--forge-spacing-xsmall, 8px));--_button-outlined-background:var(--forge-button-outlined-background, transparent);--_button-outlined-color:var(--forge-button-outlined-color, var(--_button-primary-color));--_button-outlined-border-width:var(--forge-button-outlined-border-width, var(--forge-border-thin, 1px));--_button-outlined-border-style:var(--forge-button-outlined-border-style, solid);--_button-outlined-border-color:var(--forge-button-outlined-border-color, var(--_button-primary-color));--_button-tonal-background:var(--forge-button-tonal-background, var(--forge-theme-primary-container, #d1d5ed));--_button-tonal-disabled-background:var(--forge-button-tonal-disabled-background, var(--_button-disabled-color));--_button-tonal-color:var(--forge-button-tonal-color, var(--forge-theme-on-primary-container, #222c62));--_button-tonal-disabled-color:var(--forge-button-tonal-disabled-color, var(--_button-disabled-text-color));--_button-filled-background:var(--forge-button-filled-background, var(--_button-primary-color));--_button-filled-disabled-background:var(--forge-button-filled-disabled-background, var(--_button-disabled-color));--_button-filled-color:var(--forge-button-filled-color, var(--forge-theme-on-primary, #ffffff));--_button-filled-disabled-color:var(--forge-button-filled-disabled-color, var(--_button-disabled-text-color));--_button-raised-background:var(--forge-button-raised-background, var(--_button-primary-color));--_button-raised-disabled-background:var(--forge-button-raised-disabled-background, var(--_button-disabled-color));--_button-raised-color:var(--forge-button-raised-color, var(--forge-theme-on-primary, #ffffff));--_button-raised-disabled-color:var(--forge-button-raised-disabled-color, var(--_button-disabled-text-color));--_button-raised-shadow:var(--forge-button-raised-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));--_button-raised-hover-shadow:var(--forge-button-raised-hover-shadow, 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));--_button-raised-active-shadow:var(--forge-button-raised-active-shadow, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12));--_button-raised-disabled-shadow:var(--forge-button-raised-disabled-shadow, none);--_button-link-color:var(--forge-button-link-color, var(--_button-primary-color));--_button-link-text-decoration:var(--forge-button-link-text-decoration, underline);--_button-link-height:var(--forge-button-link-height, auto);--_button-link-padding:var(--forge-button-link-padding, 0);--_button-link-line-height:var(--forge-button-link-line-height, normal);--_button-link-width:var(--forge-button-link-width, auto);--_button-link-hover-text-decoration:var(--forge-button-link-hover-text-decoration, none);--_button-link-active-opacity:var(--forge-button-link-active-opacity, 0.65);--_button-link-transition-duration:var(--forge-button-link-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-link-transition-timing:var(--forge-button-link-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-disabled-cursor:var(--forge-button-disabled-cursor, not-allowed);--_button-disabled-text-color:var(--forge-button-disabled-text-color, var(--forge-theme-text-low, rgba(0, 0, 0, 0.38)));--_button-disabled-background:var(--forge-button-disabled-background, transparent);--_button-disabled-border-color:var(--forge-button-disabled-border-color, var(--_button-disabled-color));--_button-disabled-shadow:var(--forge-button-disabled-shadow, none);--_button-dense-height:var(--forge-button-dense-height, 24px);--_button-pill-shape:var(--forge-button-pill-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_button-pill-padding-inline:var(--forge-button-pill-padding-inline, var(--forge-spacing-small, 12px));--_button-focus-indicator-offset:var(--forge-button-focus-indicator-offset, 4px);--_button-text-focus-indicator-offset:var(--forge-button-text-focus-indicator-offset, 0px);--_button-link-focus-indicator-offset:var(--forge-button-link-focus-indicator-offset, 2px);--_button-popover-icon-transition-duration:var(--forge-button-popover-icon-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-popover-icon-transition-timing:var(--forge-button-popover-icon-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-popover-icon-open-rotation:var(--forge-button-popover-icon-open-rotation, 180deg)}:host{display:var(--_button-display);position:relative;outline:0;vertical-align:middle;-webkit-tap-highlight-color:transparent;border-radius:var(--_button-shape)}:host([hidden]){display:none}::slotted(:is(button,a)){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-button-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-button-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-button-font-size-scale, .875)));font-weight:var(--forge-typography-button-font-weight,500);line-height:var(--forge-typography-button-line-height, normal);letter-spacing:var(--forge-typography-button-letter-spacing, .0714285714em);text-transform:var(--forge-typography-button-text-transform,inherit);text-decoration:var(--forge-typography-button-text-decoration,inherit);position:relative;display:var(--_button-display);align-items:center;justify-content:var(--_button-justify);gap:var(--_button-spacing);z-index:0;box-sizing:border-box;min-inline-size:var(--_button-min-width);height:var(--_button-height);inline-size:100%;border-width:var(--_button-border-width);border-style:var(--_button-border-style);border-color:var(--_button-border-color);border-start-start-radius:var(--_button-shape-start-start-radius);border-start-end-radius:var(--_button-shape-start-end-radius);border-end-start-radius:var(--_button-shape-end-start-radius);border-end-end-radius:var(--_button-shape-end-end-radius);padding-block:var(--_button-padding-block);padding-inline:var(--_button-padding-inline);box-shadow:var(--_button-shadow);outline:0;user-select:none;-webkit-appearance:none;vertical-align:middle;text-decoration:none;white-space:nowrap;background:var(--_button-background);color:var(--_button-color);cursor:var(--_button-cursor);transition-property:box-shadow,background;transition-duration:var(--_button-transition-duration);transition-timing-function:var(--_button-transition-timing);--forge-icon-font-size:1.25em}::slotted(:is(button,a))::-moz-focus-inner{padding:0;border:0}::slotted(:is(button,a)):hover{--_button-shadow:var(--_button-hover-shadow);background:var(--_button-hover-background)}::slotted(:is(button,a)):active{--_button-shadow:var(--_button-active-shadow);background:var(--_button-active-background)}::slotted(a){text-decoration:none;--forge-typography-link-text-decoration:none}forge-state-layer{--forge-state-layer-color:var(--_button-color)}forge-focus-indicator{--forge-focus-indicator-color:var(--_button-primary-color);--forge-focus-indicator-outward-offset:var(--_button-focus-indicator-offset)}:host(:is([type*=unelevated],[type*=raised])) ::slotted(:is(button,a)){--_button-background:var(--_button-filled-background);--_button-color:var(--_button-filled-color)}:host(:is([type*=unelevated],[type*=raised])) forge-state-layer{--forge-state-layer-color:var(--_button-filled-color)}:host([type*=raised]) ::slotted(:is(button,a)){--_button-background:var(--_button-raised-background);--_button-color:var(--_button-raised-color);--_button-shadow:var(--_button-raised-shadow)}:host([type*=raised]) ::slotted(:is(button,a)):hover{--_button-shadow:var(--_button-raised-hover-shadow)}:host([type*=raised]) ::slotted(:is(button,a)):active{--_button-shadow:var(--_button-raised-active-shadow)}:host([type*=outlined]) ::slotted(:is(button,a)){--_button-background:var(--_button-outlined-background);--_button-color:var(--_button-outlined-color);--_button-border-width:var(--_button-outlined-border-width);--_button-border-style:var(--_button-outlined-border-style);--_button-border-color:var(--_button-outlined-border-color)}:host([full-width]){width:100%}:host(:is([dense],[type*=dense])) ::slotted(:is(button,a)){--_button-height:var(--_button-dense-height)}:host([disabled]){cursor:var(--_button-disabled-cursor)}:host([disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-disabled-background);--_button-color:var(--_button-disabled-text-color);--_button-shadow:var(--_button-disabled-shadow);pointer-events:none}:host([type*=outlined][disabled]) ::slotted(button[disabled]){--_button-border-color:var(--_button-disabled-border-color)}:host(:is([type*=unelevated],[type*=raised])[disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-filled-disabled-background);--_button-color:var(--_button-filled-disabled-color)}:host([type*=raised][disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-raised-disabled-background);--_button-color:var(--_button-raised-disabled-color);--_button-shadow:var(--_button-raised-disabled-shadow)}';
|
|
13
|
+
const styles = ':host{--_button-primary-color:var(--forge-button-primary-color, var(--forge-theme-primary, #3f51b5));--_button-text-color:var(--forge-button-text-color, var(--_button-primary-color));--_button-disabled-color:var(--forge-button-disabled-color, var(--forge-theme-surface-container, #e0e0e0));--_button-padding:var(--forge-button-padding, var(--forge-spacing-medium, 16px));--_button-display:var(--forge-button-display, inline-grid);--_button-justify:var(--forge-button-justify, center);--_button-shape:var(--forge-button-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_button-height:var(--forge-button-height, 36px);--_button-min-width:var(--forge-button-min-width, 64px);--_button-spacing:var(--forge-button-spacing, var(--forge-spacing-xsmall, 8px));--_button-border-width:var(--forge-button-border-width, medium);--_button-border-style:var(--forge-button-border-style, none);--_button-border-color:var(--forge-button-border-color, currentColor);--_button-shape-start-start-radius:var(--forge-button-shape-start-start-radius, var(--_button-shape));--_button-shape-start-end-radius:var(--forge-button-shape-start-end-radius, var(--_button-shape));--_button-shape-end-start-radius:var(--forge-button-shape-end-start-radius, var(--_button-shape));--_button-shape-end-end-radius:var(--forge-button-shape-end-end-radius, var(--_button-shape));--_button-padding-block:var(--forge-button-padding-block, var(--_button-0));--_button-padding-inline:var(--forge-button-padding-inline, var(--_button-padding));--_button-background:var(--forge-button-background, transparent);--_button-hover-background:var(--forge-button-hover-background, var(--_button-background));--_button-active-background:var(--forge-button-active-background, var(--_button-background));--_button-color:var(--forge-button-color, var(--_button-text-color));--_button-icon-size:var(--forge-button-icon-size, calc(var(--forge-typography-font-size, 1rem) * 1.125));--_button-shadow:var(--forge-button-shadow, none);--_button-hover-shadow:var(--forge-button-hover-shadow, none);--_button-active-shadow:var(--forge-button-active-shadow, none);--_button-cursor:var(--forge-button-cursor, pointer);--_button-transition-duration:var(--forge-button-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-transition-timing:var(--forge-button-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-text-padding-inline:var(--forge-button-text-padding-inline, var(--forge-spacing-xsmall, 8px));--_button-outlined-background:var(--forge-button-outlined-background, transparent);--_button-outlined-color:var(--forge-button-outlined-color, var(--_button-primary-color));--_button-outlined-border-width:var(--forge-button-outlined-border-width, var(--forge-border-thin, 1px));--_button-outlined-border-style:var(--forge-button-outlined-border-style, solid);--_button-outlined-border-color:var(--forge-button-outlined-border-color, var(--_button-primary-color));--_button-tonal-background:var(--forge-button-tonal-background, var(--forge-theme-primary-container, #d1d5ed));--_button-tonal-disabled-background:var(--forge-button-tonal-disabled-background, var(--_button-disabled-color));--_button-tonal-color:var(--forge-button-tonal-color, var(--forge-theme-on-primary-container, #222c62));--_button-tonal-disabled-color:var(--forge-button-tonal-disabled-color, var(--_button-disabled-text-color));--_button-filled-background:var(--forge-button-filled-background, var(--_button-primary-color));--_button-filled-disabled-background:var(--forge-button-filled-disabled-background, var(--_button-disabled-color));--_button-filled-color:var(--forge-button-filled-color, var(--forge-theme-on-primary, #ffffff));--_button-filled-disabled-color:var(--forge-button-filled-disabled-color, var(--_button-disabled-text-color));--_button-raised-background:var(--forge-button-raised-background, var(--_button-primary-color));--_button-raised-disabled-background:var(--forge-button-raised-disabled-background, var(--_button-disabled-color));--_button-raised-color:var(--forge-button-raised-color, var(--forge-theme-on-primary, #ffffff));--_button-raised-disabled-color:var(--forge-button-raised-disabled-color, var(--_button-disabled-text-color));--_button-raised-shadow:var(--forge-button-raised-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));--_button-raised-hover-shadow:var(--forge-button-raised-hover-shadow, 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));--_button-raised-active-shadow:var(--forge-button-raised-active-shadow, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12));--_button-raised-disabled-shadow:var(--forge-button-raised-disabled-shadow, none);--_button-link-color:var(--forge-button-link-color, var(--_button-primary-color));--_button-link-text-decoration:var(--forge-button-link-text-decoration, underline);--_button-link-height:var(--forge-button-link-height, auto);--_button-link-padding:var(--forge-button-link-padding, 0);--_button-link-line-height:var(--forge-button-link-line-height, normal);--_button-link-width:var(--forge-button-link-width, auto);--_button-link-hover-text-decoration:var(--forge-button-link-hover-text-decoration, none);--_button-link-active-opacity:var(--forge-button-link-active-opacity, 0.65);--_button-link-transition-duration:var(--forge-button-link-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-link-transition-timing:var(--forge-button-link-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-disabled-cursor:var(--forge-button-disabled-cursor, not-allowed);--_button-disabled-text-color:var(--forge-button-disabled-text-color, var(--forge-theme-text-low, rgba(0, 0, 0, 0.38)));--_button-disabled-background:var(--forge-button-disabled-background, transparent);--_button-disabled-border-color:var(--forge-button-disabled-border-color, var(--_button-disabled-color));--_button-disabled-shadow:var(--forge-button-disabled-shadow, none);--_button-dense-height:var(--forge-button-dense-height, 24px);--_button-pill-shape:var(--forge-button-pill-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_button-pill-padding-inline:var(--forge-button-pill-padding-inline, var(--forge-spacing-small, 12px));--_button-focus-indicator-offset:var(--forge-button-focus-indicator-offset, 4px);--_button-text-focus-indicator-offset:var(--forge-button-text-focus-indicator-offset, 0px);--_button-link-focus-indicator-offset:var(--forge-button-link-focus-indicator-offset, 2px);--_button-popover-icon-transition-duration:var(--forge-button-popover-icon-transition-duration, var(--forge-animation-duration-short3, 150ms));--_button-popover-icon-transition-timing:var(--forge-button-popover-icon-transition-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_button-popover-icon-open-rotation:var(--forge-button-popover-icon-open-rotation, 180deg)}:host{display:var(--_button-display);position:relative;outline:0;vertical-align:middle;-webkit-tap-highlight-color:transparent;border-radius:var(--_button-shape)}:host([hidden]){display:none}::slotted(:is(button,a)){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-button-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-button-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-button-font-size-scale, .875)));font-weight:var(--forge-typography-button-font-weight,500);line-height:var(--forge-typography-button-line-height, normal);letter-spacing:var(--forge-typography-button-letter-spacing, .0714285714em);text-transform:var(--forge-typography-button-text-transform,inherit);text-decoration:var(--forge-typography-button-text-decoration,inherit);position:relative;display:var(--_button-display);grid-auto-flow:column;align-items:center;justify-content:var(--_button-justify);gap:var(--_button-spacing);z-index:0;box-sizing:border-box;min-inline-size:var(--_button-min-width);height:var(--_button-height);inline-size:100%;border-width:var(--_button-border-width);border-style:var(--_button-border-style);border-color:var(--_button-border-color);border-start-start-radius:var(--_button-shape-start-start-radius);border-start-end-radius:var(--_button-shape-start-end-radius);border-end-start-radius:var(--_button-shape-end-start-radius);border-end-end-radius:var(--_button-shape-end-end-radius);padding-block:var(--_button-padding-block);padding-inline:var(--_button-padding-inline);box-shadow:var(--_button-shadow);outline:0;user-select:none;-webkit-appearance:none;vertical-align:middle;text-decoration:none;white-space:nowrap;background:var(--_button-background);color:var(--_button-color);cursor:var(--_button-cursor);transition-property:box-shadow,background;transition-duration:var(--_button-transition-duration);transition-timing-function:var(--_button-transition-timing);--forge-icon-font-size:1.25em}::slotted(:is(button,a))::-moz-focus-inner{padding:0;border:0}::slotted(:is(button,a)):hover{--_button-shadow:var(--_button-hover-shadow);background:var(--_button-hover-background)}::slotted(:is(button,a)):active{--_button-shadow:var(--_button-active-shadow);background:var(--_button-active-background)}::slotted(a){text-decoration:none;--forge-typography-link-text-decoration:none}forge-state-layer{--forge-state-layer-color:var(--_button-color)}forge-focus-indicator{--forge-focus-indicator-color:var(--_button-primary-color);--forge-focus-indicator-outward-offset:var(--_button-focus-indicator-offset)}:host(:is([type*=unelevated],[type*=raised])) ::slotted(:is(button,a)){--_button-background:var(--_button-filled-background);--_button-color:var(--_button-filled-color)}:host(:is([type*=unelevated],[type*=raised])) forge-state-layer{--forge-state-layer-color:var(--_button-filled-color)}:host([type*=raised]) ::slotted(:is(button,a)){--_button-background:var(--_button-raised-background);--_button-color:var(--_button-raised-color);--_button-shadow:var(--_button-raised-shadow)}:host([type*=raised]) ::slotted(:is(button,a)):hover{--_button-shadow:var(--_button-raised-hover-shadow)}:host([type*=raised]) ::slotted(:is(button,a)):active{--_button-shadow:var(--_button-raised-active-shadow)}:host([type*=outlined]) ::slotted(:is(button,a)){--_button-background:var(--_button-outlined-background);--_button-color:var(--_button-outlined-color);--_button-border-width:var(--_button-outlined-border-width);--_button-border-style:var(--_button-outlined-border-style);--_button-border-color:var(--_button-outlined-border-color)}:host([full-width]){width:100%}:host(:is([dense],[type*=dense])) ::slotted(:is(button,a)){--_button-height:var(--_button-dense-height)}:host([disabled]){cursor:var(--_button-disabled-cursor)}:host([disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-disabled-background);--_button-color:var(--_button-disabled-text-color);--_button-shadow:var(--_button-disabled-shadow);pointer-events:none}:host([type*=outlined][disabled]) ::slotted(button[disabled]){--_button-border-color:var(--_button-disabled-border-color)}:host(:is([type*=unelevated],[type*=raised])[disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-filled-disabled-background);--_button-color:var(--_button-filled-disabled-color)}:host([type*=raised][disabled]) ::slotted(button[disabled]){--_button-background:var(--_button-raised-disabled-background);--_button-color:var(--_button-raised-disabled-color);--_button-shadow:var(--_button-raised-disabled-shadow)}';
|
|
14
14
|
/**
|
|
15
15
|
* @tag forge-deprecated-button
|
|
16
16
|
*
|
|
@@ -73,7 +73,7 @@ export class DialogCore {
|
|
|
73
73
|
this._adapter.addDialogFormSubmitListener(this._dialogFormSubmitListener);
|
|
74
74
|
DismissibleStack.instance.add(this._adapter.hostElement);
|
|
75
75
|
if (this._mode === 'modal' || this._mode === 'inline-modal') {
|
|
76
|
-
this._adapter.addDocumentListener('keydown', this._escapeDismissListener);
|
|
76
|
+
this._adapter.addDocumentListener('keydown', this._escapeDismissListener, { capture: true });
|
|
77
77
|
}
|
|
78
78
|
if (!this._persistent) {
|
|
79
79
|
this._adapter.addBackdropDismissListener(this._backdropDismissListener);
|
|
@@ -99,7 +99,7 @@ export class DialogCore {
|
|
|
99
99
|
}
|
|
100
100
|
_release() {
|
|
101
101
|
this._adapter.removeDialogFormSubmitListener(this._dialogFormSubmitListener);
|
|
102
|
-
this._adapter.removeDocumentListener('keydown', this._escapeDismissListener);
|
|
102
|
+
this._adapter.removeDocumentListener('keydown', this._escapeDismissListener, { capture: true });
|
|
103
103
|
this._adapter.removeBackdropDismissListener(this._backdropDismissListener);
|
|
104
104
|
DismissibleStack.instance.remove(this._adapter.hostElement);
|
|
105
105
|
}
|
package/esm/dialog/dialog.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface IDialogProperties {
|
|
|
25
25
|
moveable: boolean;
|
|
26
26
|
label: string;
|
|
27
27
|
description: string;
|
|
28
|
+
[showBackdrop](): void;
|
|
29
|
+
[hideBackdrop](): void;
|
|
28
30
|
}
|
|
29
31
|
export interface IDialogComponent extends IDialogProperties, IWithDefaultAria, IWithElementInternals, IDismissible {
|
|
30
32
|
show(): void;
|
package/esm/dialog/dialog.js
CHANGED
|
@@ -15,7 +15,7 @@ import { DialogAdapter } from './dialog-adapter';
|
|
|
15
15
|
import { DIALOG_CONSTANTS, dialogStack, hideBackdrop, showBackdrop } from './dialog-constants';
|
|
16
16
|
import { DialogCore } from './dialog-core';
|
|
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}.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}}}';
|
|
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}::slotted(forge-scaffold){height:auto}.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
|
*
|
|
@@ -6,27 +6,58 @@
|
|
|
6
6
|
import { BaseAdapter, IBaseAdapter } from '../core/base/base-adapter';
|
|
7
7
|
import { IExpansionPanelComponent } from './expansion-panel';
|
|
8
8
|
export interface IExpansionPanelAdapter extends IBaseAdapter {
|
|
9
|
+
readonly triggerElement?: HTMLElement | null;
|
|
9
10
|
setAnimationCompleteListener(listener: () => void): void;
|
|
11
|
+
addContentSlotListener(listener: EventListener): void;
|
|
10
12
|
addHeaderListener(type: keyof HTMLElementEventMap, listener: EventListener): void;
|
|
13
|
+
removeTriggerListeners(options?: {
|
|
14
|
+
reset: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
addTriggerListener(type: keyof HTMLElementEventMap, listener: EventListener): void;
|
|
11
17
|
tryToggleOpenIcon(value: boolean): void;
|
|
12
18
|
setContentVisibility(visible: boolean): void;
|
|
13
19
|
animationStart(): void;
|
|
14
20
|
animationEnd(): void;
|
|
21
|
+
setTriggerElementById(id: string): void;
|
|
22
|
+
setTriggerElement(el?: HTMLElement | null): void;
|
|
23
|
+
setContentId(): void;
|
|
24
|
+
updateAriaControls(): void;
|
|
25
|
+
updateAriaExpanded(open: boolean): void;
|
|
26
|
+
detachTriggerAria(): void;
|
|
15
27
|
}
|
|
16
28
|
export declare class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelComponent> implements IExpansionPanelAdapter {
|
|
17
29
|
private _headerElement;
|
|
18
30
|
private _contentElement;
|
|
19
31
|
private _innerElement;
|
|
32
|
+
private _defaultSlotElement;
|
|
33
|
+
private _triggerListenerController;
|
|
34
|
+
private _triggerElement?;
|
|
20
35
|
private _transitionStartListener;
|
|
21
36
|
private _transitionEndListener;
|
|
22
37
|
private _transitionCompleteListener;
|
|
23
38
|
constructor(component: IExpansionPanelComponent);
|
|
39
|
+
get triggerElement(): HTMLElement | null | undefined;
|
|
40
|
+
private get _slottedContentElement();
|
|
41
|
+
private set _slottedContentId(value);
|
|
42
|
+
private get _slottedContentId();
|
|
43
|
+
setTriggerElementById(id: string): void;
|
|
24
44
|
setAnimationCompleteListener(listener: () => void): void;
|
|
45
|
+
addContentSlotListener(listener: EventListener): void;
|
|
25
46
|
addHeaderListener(type: keyof HTMLElementEventMap, listener: EventListener): void;
|
|
47
|
+
removeTriggerListeners(options?: {
|
|
48
|
+
reset: boolean;
|
|
49
|
+
}): void;
|
|
50
|
+
addTriggerListener(type: keyof HTMLElementEventMap, listener: EventListener): void;
|
|
26
51
|
tryToggleOpenIcon(value: boolean): void;
|
|
27
52
|
setContentVisibility(visible: boolean): void;
|
|
28
53
|
private _onTransitionStart;
|
|
29
54
|
private _onTransitionEnd;
|
|
30
55
|
animationStart(): void;
|
|
31
56
|
animationEnd(): void;
|
|
57
|
+
setTriggerElement(el: HTMLElement | null): void;
|
|
58
|
+
setContentId(): void;
|
|
59
|
+
updateAriaControls(): void;
|
|
60
|
+
updateAriaExpanded(open: boolean): void;
|
|
61
|
+
detachTriggerAria(): void;
|
|
62
|
+
private _getTriggerElementById;
|
|
32
63
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { getShadowElement } from '@tylertech/forge-core';
|
|
6
|
+
import { getShadowElement, randomChars, toggleAttribute } from '@tylertech/forge-core';
|
|
7
7
|
import { BaseAdapter } from '../core/base/base-adapter';
|
|
8
8
|
import { EXPANSION_PANEL_CONSTANTS } from './expansion-panel-constants';
|
|
9
9
|
export class ExpansionPanelAdapter extends BaseAdapter {
|
|
@@ -14,15 +14,43 @@ export class ExpansionPanelAdapter extends BaseAdapter {
|
|
|
14
14
|
this._headerElement = getShadowElement(this._component, EXPANSION_PANEL_CONSTANTS.selectors.HEADER);
|
|
15
15
|
this._contentElement = getShadowElement(this._component, EXPANSION_PANEL_CONSTANTS.selectors.CONTENT);
|
|
16
16
|
this._innerElement = getShadowElement(this._component, EXPANSION_PANEL_CONSTANTS.selectors.INNER);
|
|
17
|
+
this._defaultSlotElement = getShadowElement(this._component, EXPANSION_PANEL_CONSTANTS.selectors.DEFAULT_SLOT);
|
|
18
|
+
}
|
|
19
|
+
get triggerElement() {
|
|
20
|
+
return this._triggerElement;
|
|
21
|
+
}
|
|
22
|
+
get _slottedContentElement() {
|
|
23
|
+
return this._defaultSlotElement.assignedElements({ flatten: true })[0];
|
|
24
|
+
}
|
|
25
|
+
set _slottedContentId(id) {
|
|
26
|
+
this._slottedContentElement?.setAttribute('id', id);
|
|
27
|
+
}
|
|
28
|
+
get _slottedContentId() {
|
|
29
|
+
return this._slottedContentElement?.getAttribute('id') ?? '';
|
|
30
|
+
}
|
|
31
|
+
setTriggerElementById(id) {
|
|
32
|
+
this._triggerElement = this._getTriggerElementById(id);
|
|
17
33
|
}
|
|
18
34
|
setAnimationCompleteListener(listener) {
|
|
19
35
|
this._transitionCompleteListener = listener;
|
|
20
36
|
this._contentElement.addEventListener('transitionstart', this._transitionStartListener);
|
|
21
37
|
this._contentElement.addEventListener('transitionend', this._transitionEndListener);
|
|
22
38
|
}
|
|
39
|
+
addContentSlotListener(listener) {
|
|
40
|
+
this._defaultSlotElement.addEventListener('slotchange', listener);
|
|
41
|
+
}
|
|
23
42
|
addHeaderListener(type, listener) {
|
|
24
43
|
this._headerElement.addEventListener(type, listener);
|
|
25
44
|
}
|
|
45
|
+
removeTriggerListeners(options = { reset: false }) {
|
|
46
|
+
this._triggerListenerController?.abort();
|
|
47
|
+
if (options?.reset) {
|
|
48
|
+
this._triggerListenerController = new AbortController();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
addTriggerListener(type, listener) {
|
|
52
|
+
this._triggerElement?.addEventListener(type, listener, { signal: this._triggerListenerController.signal });
|
|
53
|
+
}
|
|
26
54
|
tryToggleOpenIcon(value) {
|
|
27
55
|
const openIconElement = this._component.querySelector(EXPANSION_PANEL_CONSTANTS.selectors.OPEN_ICON);
|
|
28
56
|
if (openIconElement) {
|
|
@@ -49,4 +77,35 @@ export class ExpansionPanelAdapter extends BaseAdapter {
|
|
|
49
77
|
animationEnd() {
|
|
50
78
|
this._innerElement.style.removeProperty('overflow');
|
|
51
79
|
}
|
|
80
|
+
setTriggerElement(el) {
|
|
81
|
+
this._triggerElement = el;
|
|
82
|
+
}
|
|
83
|
+
setContentId() {
|
|
84
|
+
if (!this._slottedContentId) {
|
|
85
|
+
this._slottedContentId = `forge-expansion-panel-content-${randomChars()}`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
updateAriaControls() {
|
|
89
|
+
if (this._triggerElement) {
|
|
90
|
+
toggleAttribute(this._triggerElement, !!this._slottedContentId, 'aria-controls', this._slottedContentId);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
updateAriaExpanded(open) {
|
|
94
|
+
if (this._triggerElement) {
|
|
95
|
+
toggleAttribute(this._triggerElement, true, 'aria-expanded', open.toString());
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
detachTriggerAria() {
|
|
99
|
+
this._triggerElement?.removeAttribute('aria-controls');
|
|
100
|
+
this._triggerElement?.removeAttribute('aria-expanded');
|
|
101
|
+
}
|
|
102
|
+
_getTriggerElementById(id) {
|
|
103
|
+
if (id) {
|
|
104
|
+
const rootNode = this._component.getRootNode();
|
|
105
|
+
return rootNode.getElementById(id);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
52
111
|
}
|
|
@@ -9,12 +9,14 @@ export declare const EXPANSION_PANEL_CONSTANTS: {
|
|
|
9
9
|
OPEN: string;
|
|
10
10
|
ORIENTATION: string;
|
|
11
11
|
ANIMATION_TYPE: string;
|
|
12
|
+
TRIGGER: string;
|
|
12
13
|
};
|
|
13
14
|
attributes: {
|
|
14
15
|
OPENING: string;
|
|
15
16
|
OPEN: string;
|
|
16
17
|
ORIENTATION: string;
|
|
17
18
|
ANIMATION_TYPE: string;
|
|
19
|
+
TRIGGER: string;
|
|
18
20
|
};
|
|
19
21
|
classes: {
|
|
20
22
|
HIDDEN: string;
|
|
@@ -23,6 +25,8 @@ export declare const EXPANSION_PANEL_CONSTANTS: {
|
|
|
23
25
|
HEADER: string;
|
|
24
26
|
CONTENT: string;
|
|
25
27
|
INNER: string;
|
|
28
|
+
HEADER_SLOT: string;
|
|
29
|
+
DEFAULT_SLOT: string;
|
|
26
30
|
IGNORE: string;
|
|
27
31
|
OPEN_ICON: string;
|
|
28
32
|
};
|
|
@@ -9,7 +9,8 @@ const elementName = `${COMPONENT_NAME_PREFIX}expansion-panel`;
|
|
|
9
9
|
const observedAttributes = {
|
|
10
10
|
OPEN: 'open',
|
|
11
11
|
ORIENTATION: 'orientation',
|
|
12
|
-
ANIMATION_TYPE: 'animation-type'
|
|
12
|
+
ANIMATION_TYPE: 'animation-type',
|
|
13
|
+
TRIGGER: 'trigger'
|
|
13
14
|
};
|
|
14
15
|
const attributes = {
|
|
15
16
|
...observedAttributes,
|
|
@@ -22,6 +23,8 @@ const selectors = {
|
|
|
22
23
|
HEADER: '.header',
|
|
23
24
|
CONTENT: '.content',
|
|
24
25
|
INNER: '.inner',
|
|
26
|
+
HEADER_SLOT: 'slot[name=header]',
|
|
27
|
+
DEFAULT_SLOT: 'slot:not([name])',
|
|
25
28
|
IGNORE: ':is([data-forge-ignore],[forge-ignore])',
|
|
26
29
|
OPEN_ICON: `:is([slot=header] ${OPEN_ICON_CONSTANTS.elementName}, ${OPEN_ICON_CONSTANTS.elementName}[slot^=header])`
|
|
27
30
|
};
|
|
@@ -9,6 +9,8 @@ export interface IExpansionPanelCore {
|
|
|
9
9
|
open: boolean;
|
|
10
10
|
orientation: ExpansionPanelOrientation;
|
|
11
11
|
animationType: ExpansionPanelAnimationType;
|
|
12
|
+
trigger: string;
|
|
13
|
+
triggerElement?: HTMLElement | null;
|
|
12
14
|
dispatchToggleEvent(): void;
|
|
13
15
|
}
|
|
14
16
|
export declare class ExpansionPanelCore implements IExpansionPanelCore {
|
|
@@ -16,11 +18,17 @@ export declare class ExpansionPanelCore implements IExpansionPanelCore {
|
|
|
16
18
|
private _open;
|
|
17
19
|
private _orientation;
|
|
18
20
|
private _animationType;
|
|
21
|
+
private _trigger;
|
|
19
22
|
private _clickListener;
|
|
20
23
|
private _keydownListener;
|
|
21
24
|
private _animationCompleteListener;
|
|
25
|
+
private _slotListener;
|
|
22
26
|
constructor(_adapter: IExpansionPanelAdapter);
|
|
23
|
-
initialize(): void
|
|
27
|
+
initialize(): Promise<void>;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
private _handleContentSlotChange;
|
|
30
|
+
private _clearTrigger;
|
|
31
|
+
private _syncTrigger;
|
|
24
32
|
private _onClick;
|
|
25
33
|
private _onKeydown;
|
|
26
34
|
private _onAnimationComplete;
|
|
@@ -33,4 +41,8 @@ export declare class ExpansionPanelCore implements IExpansionPanelCore {
|
|
|
33
41
|
set orientation(value: ExpansionPanelOrientation);
|
|
34
42
|
get animationType(): ExpansionPanelAnimationType;
|
|
35
43
|
set animationType(value: ExpansionPanelAnimationType);
|
|
44
|
+
get trigger(): string;
|
|
45
|
+
set trigger(value: string);
|
|
46
|
+
get triggerElement(): HTMLElement | null | undefined;
|
|
47
|
+
set triggerElement(el: HTMLElement | null | undefined);
|
|
36
48
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { frame } from '../core';
|
|
6
7
|
import { EXPANSION_PANEL_CONSTANTS } from './expansion-panel-constants';
|
|
7
8
|
export class ExpansionPanelCore {
|
|
8
9
|
constructor(_adapter) {
|
|
@@ -10,14 +11,49 @@ export class ExpansionPanelCore {
|
|
|
10
11
|
this._open = false;
|
|
11
12
|
this._orientation = 'vertical';
|
|
12
13
|
this._animationType = 'default';
|
|
14
|
+
this._trigger = '';
|
|
13
15
|
this._clickListener = this._onClick.bind(this);
|
|
14
16
|
this._keydownListener = this._onKeydown.bind(this);
|
|
15
17
|
this._animationCompleteListener = this._onAnimationComplete.bind(this);
|
|
18
|
+
this._slotListener = this._handleContentSlotChange.bind(this);
|
|
16
19
|
}
|
|
17
|
-
initialize() {
|
|
20
|
+
async initialize() {
|
|
18
21
|
this._adapter.addHeaderListener('click', this._clickListener);
|
|
19
22
|
this._adapter.addHeaderListener('keydown', this._keydownListener);
|
|
20
23
|
this._adapter.setAnimationCompleteListener(this._animationCompleteListener);
|
|
24
|
+
this._adapter.addContentSlotListener(this._slotListener);
|
|
25
|
+
this._adapter.setContentId();
|
|
26
|
+
await frame();
|
|
27
|
+
this._syncTrigger();
|
|
28
|
+
}
|
|
29
|
+
destroy() {
|
|
30
|
+
this._adapter.detachTriggerAria();
|
|
31
|
+
this._adapter.removeTriggerListeners();
|
|
32
|
+
this._adapter.setTriggerElement(undefined);
|
|
33
|
+
}
|
|
34
|
+
_handleContentSlotChange() {
|
|
35
|
+
this._adapter.setContentId();
|
|
36
|
+
this._syncTrigger();
|
|
37
|
+
}
|
|
38
|
+
_clearTrigger() {
|
|
39
|
+
this._adapter.removeTriggerListeners({ reset: true });
|
|
40
|
+
this._adapter.detachTriggerAria();
|
|
41
|
+
}
|
|
42
|
+
_syncTrigger() {
|
|
43
|
+
if (!this._adapter.triggerElement?.isConnected) {
|
|
44
|
+
this._clearTrigger();
|
|
45
|
+
if (this._trigger) {
|
|
46
|
+
this._adapter.setTriggerElementById(this._trigger);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this._adapter.setTriggerElement(undefined);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this._adapter.updateAriaControls();
|
|
53
|
+
this._adapter.updateAriaExpanded(this._open);
|
|
54
|
+
this._adapter.removeTriggerListeners({ reset: true });
|
|
55
|
+
this._adapter.addTriggerListener('click', this._clickListener);
|
|
56
|
+
this._adapter.addTriggerListener('keydown', this._keydownListener);
|
|
21
57
|
}
|
|
22
58
|
_onClick(evt) {
|
|
23
59
|
const fromIgnoredEl = evt
|
|
@@ -50,6 +86,7 @@ export class ExpansionPanelCore {
|
|
|
50
86
|
_togglePanel() {
|
|
51
87
|
this._adapter.toggleHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.OPEN, this._open);
|
|
52
88
|
this._adapter.tryToggleOpenIcon(this._open);
|
|
89
|
+
this._adapter.updateAriaExpanded(this._open);
|
|
53
90
|
if (this._open) {
|
|
54
91
|
if (this._animationType !== 'none') {
|
|
55
92
|
this._adapter.animationStart();
|
|
@@ -96,4 +133,29 @@ export class ExpansionPanelCore {
|
|
|
96
133
|
this._adapter.setHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.ANIMATION_TYPE, this._animationType);
|
|
97
134
|
}
|
|
98
135
|
}
|
|
136
|
+
get trigger() {
|
|
137
|
+
return this._trigger;
|
|
138
|
+
}
|
|
139
|
+
set trigger(value) {
|
|
140
|
+
if (this._trigger !== value) {
|
|
141
|
+
this._clearTrigger();
|
|
142
|
+
this._trigger = value;
|
|
143
|
+
this._adapter.setTriggerElementById(this._trigger);
|
|
144
|
+
if (this._adapter.isConnected) {
|
|
145
|
+
this._syncTrigger();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
get triggerElement() {
|
|
150
|
+
return this._adapter.triggerElement;
|
|
151
|
+
}
|
|
152
|
+
set triggerElement(el) {
|
|
153
|
+
if (this._adapter.triggerElement !== el) {
|
|
154
|
+
this._clearTrigger();
|
|
155
|
+
this._adapter.setTriggerElement(el);
|
|
156
|
+
if (this._adapter.isConnected) {
|
|
157
|
+
this._syncTrigger();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
99
161
|
}
|
|
@@ -9,7 +9,10 @@ export interface IExpansionPanelComponent extends IBaseComponent {
|
|
|
9
9
|
open: boolean;
|
|
10
10
|
orientation: ExpansionPanelOrientation;
|
|
11
11
|
animationType: ExpansionPanelAnimationType;
|
|
12
|
+
trigger: string;
|
|
13
|
+
triggerElement: HTMLElement | null;
|
|
12
14
|
toggle(): void;
|
|
15
|
+
[emulateUserToggle](open: boolean): void;
|
|
13
16
|
}
|
|
14
17
|
declare global {
|
|
15
18
|
interface HTMLElementTagNameMap {
|
|
@@ -28,10 +31,13 @@ declare global {
|
|
|
28
31
|
* @property {boolean} [open=false] - Whether the panel is open or closed.
|
|
29
32
|
* @property {ExpansionPanelOrientation} [orientation="vertical"] - The orientation of the panel.
|
|
30
33
|
* @property {ExpansionPanelAnimationType} [animationType="default"] - The type of animation to use when opening/closing the panel.
|
|
34
|
+
* @property {string} trigger - The id of the element that the expansion panel should be toggled by.
|
|
35
|
+
* @property {HTMLElement | null} triggerElement - The element that the expansion panel should be toggled by.
|
|
31
36
|
*
|
|
32
37
|
* @attribute {boolean} [open=false] - Whether the panel is open or closed.
|
|
33
38
|
* @attribute {ExpansionPanelOrientation} [orientation="vertical"] - The orientation of the panel.
|
|
34
39
|
* @attribute {ExpansionPanelAnimationType} [animation-type="default"] - The type of animation to use when opening/closing the panel.
|
|
40
|
+
* @attribute {string} [trigger] - The id of the button that the expansion panel is associated with.
|
|
35
41
|
*
|
|
36
42
|
* @fires {CustomEvent<boolean>} forge-expansion-panel-toggle - Event fired when the panel is toggled open or closed.
|
|
37
43
|
* @fires {CustomEvent<boolean>} forge-expansion-panel-animation-complete - Event fired when the panel has finished animating when toggling.
|
|
@@ -55,10 +61,13 @@ export declare class ExpansionPanelComponent extends BaseComponent implements IE
|
|
|
55
61
|
private _core;
|
|
56
62
|
constructor();
|
|
57
63
|
connectedCallback(): void;
|
|
64
|
+
disconnectedCallback(): void;
|
|
58
65
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
59
66
|
open: boolean;
|
|
60
67
|
orientation: ExpansionPanelOrientation;
|
|
61
68
|
animationType: ExpansionPanelAnimationType;
|
|
69
|
+
trigger: string;
|
|
70
|
+
triggerElement: HTMLElement | null;
|
|
62
71
|
/**
|
|
63
72
|
* Toggles the open state of the panel.
|
|
64
73
|
*/
|
|
@@ -19,10 +19,13 @@ const styles = ':host{display:block}:host([hidden]){display:none}.forge-expansio
|
|
|
19
19
|
* @property {boolean} [open=false] - Whether the panel is open or closed.
|
|
20
20
|
* @property {ExpansionPanelOrientation} [orientation="vertical"] - The orientation of the panel.
|
|
21
21
|
* @property {ExpansionPanelAnimationType} [animationType="default"] - The type of animation to use when opening/closing the panel.
|
|
22
|
+
* @property {string} trigger - The id of the element that the expansion panel should be toggled by.
|
|
23
|
+
* @property {HTMLElement | null} triggerElement - The element that the expansion panel should be toggled by.
|
|
22
24
|
*
|
|
23
25
|
* @attribute {boolean} [open=false] - Whether the panel is open or closed.
|
|
24
26
|
* @attribute {ExpansionPanelOrientation} [orientation="vertical"] - The orientation of the panel.
|
|
25
27
|
* @attribute {ExpansionPanelAnimationType} [animation-type="default"] - The type of animation to use when opening/closing the panel.
|
|
28
|
+
* @attribute {string} [trigger] - The id of the button that the expansion panel is associated with.
|
|
26
29
|
*
|
|
27
30
|
* @fires {CustomEvent<boolean>} forge-expansion-panel-toggle - Event fired when the panel is toggled open or closed.
|
|
28
31
|
* @fires {CustomEvent<boolean>} forge-expansion-panel-animation-complete - Event fired when the panel has finished animating when toggling.
|
|
@@ -53,6 +56,9 @@ let ExpansionPanelComponent = class ExpansionPanelComponent extends BaseComponen
|
|
|
53
56
|
connectedCallback() {
|
|
54
57
|
this._core.initialize();
|
|
55
58
|
}
|
|
59
|
+
disconnectedCallback() {
|
|
60
|
+
this._core.destroy();
|
|
61
|
+
}
|
|
56
62
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
57
63
|
switch (name) {
|
|
58
64
|
case EXPANSION_PANEL_CONSTANTS.observedAttributes.OPEN:
|
|
@@ -64,6 +70,8 @@ let ExpansionPanelComponent = class ExpansionPanelComponent extends BaseComponen
|
|
|
64
70
|
case EXPANSION_PANEL_CONSTANTS.observedAttributes.ANIMATION_TYPE:
|
|
65
71
|
this.animationType = newValue;
|
|
66
72
|
break;
|
|
73
|
+
case EXPANSION_PANEL_CONSTANTS.observedAttributes.TRIGGER:
|
|
74
|
+
this.trigger = newValue;
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
/**
|
|
@@ -94,6 +102,12 @@ __decorate([
|
|
|
94
102
|
__decorate([
|
|
95
103
|
coreProperty()
|
|
96
104
|
], ExpansionPanelComponent.prototype, "animationType", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
coreProperty()
|
|
107
|
+
], ExpansionPanelComponent.prototype, "trigger", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
coreProperty()
|
|
110
|
+
], ExpansionPanelComponent.prototype, "triggerElement", void 0);
|
|
97
111
|
ExpansionPanelComponent = __decorate([
|
|
98
112
|
customElement({
|
|
99
113
|
name: EXPANSION_PANEL_CONSTANTS.elementName
|