@tylertech/forge 3.0.0-next.20 → 3.0.0-next.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/custom-elements.json +141 -309
  2. package/dist/esm/accordion/index.js +1 -1
  3. package/dist/esm/autocomplete/index.js +1 -1
  4. package/dist/esm/button-area/index.js +1 -1
  5. package/dist/esm/chunks/{chunk.OFXSMOV6.js → chunk.5UGN5FYV.js} +2 -2
  6. package/dist/esm/chunks/{chunk.2N5KNNQX.js → chunk.5UZ2DEW3.js} +2 -2
  7. package/dist/esm/chunks/chunk.656X22EF.js +7 -0
  8. package/dist/esm/chunks/chunk.656X22EF.js.map +7 -0
  9. package/dist/esm/chunks/chunk.6JVMCBCR.js +7 -0
  10. package/dist/esm/chunks/{chunk.OT4AIOMN.js.map → chunk.6JVMCBCR.js.map} +3 -3
  11. package/dist/esm/chunks/{chunk.O56VP4OZ.js → chunk.A6BIUNPW.js} +2 -2
  12. package/dist/esm/chunks/{chunk.KEFJZO5K.js → chunk.BMQAVBWZ.js} +2 -2
  13. package/dist/esm/chunks/{chunk.KEFJZO5K.js.map → chunk.BMQAVBWZ.js.map} +1 -1
  14. package/dist/esm/chunks/{chunk.5S7XNYRQ.js → chunk.GL2H6QOP.js} +2 -2
  15. package/dist/esm/chunks/chunk.HMJODLAS.js +7 -0
  16. package/dist/esm/chunks/chunk.HMJODLAS.js.map +7 -0
  17. package/dist/esm/chunks/{chunk.ZAREP2QH.js → chunk.HYTFCFP6.js} +2 -2
  18. package/dist/esm/chunks/{chunk.TPNZYEC7.js → chunk.NIUX6DVF.js} +2 -2
  19. package/dist/esm/chunks/{chunk.VOTT5COZ.js → chunk.OSBNFFCI.js} +2 -2
  20. package/dist/esm/chunks/chunk.RJC42RNR.js +7 -0
  21. package/dist/esm/chunks/chunk.RJC42RNR.js.map +7 -0
  22. package/dist/esm/chunks/chunk.V7ILFIOR.js +7 -0
  23. package/dist/esm/chunks/chunk.V7ILFIOR.js.map +7 -0
  24. package/dist/esm/date-picker/index.js +1 -1
  25. package/dist/esm/date-range-picker/index.js +1 -1
  26. package/dist/esm/expansion-panel/index.js +1 -1
  27. package/dist/esm/field-next/index.js +1 -1
  28. package/dist/esm/index.js +1 -1
  29. package/dist/esm/split-view/index.js +1 -1
  30. package/dist/esm/split-view/split-view/index.js +1 -1
  31. package/dist/esm/split-view/split-view-panel/index.js +1 -1
  32. package/dist/esm/stepper/index.js +1 -1
  33. package/dist/esm/stepper/step/index.js +1 -1
  34. package/dist/esm/stepper/stepper/index.js +1 -1
  35. package/dist/esm/table/index.js +1 -1
  36. package/dist/esm/text-field/index.js +1 -1
  37. package/dist/esm/time-picker/index.js +1 -1
  38. package/dist/forge.css +1 -1
  39. package/esm/button-area/button-area-foundation.js +2 -3
  40. package/esm/expansion-panel/expansion-panel-adapter.d.ts +13 -20
  41. package/esm/expansion-panel/expansion-panel-adapter.js +22 -159
  42. package/esm/expansion-panel/expansion-panel-constants.d.ts +16 -22
  43. package/esm/expansion-panel/expansion-panel-constants.js +16 -30
  44. package/esm/expansion-panel/expansion-panel-foundation.d.ts +14 -37
  45. package/esm/expansion-panel/expansion-panel-foundation.js +50 -117
  46. package/esm/expansion-panel/expansion-panel.d.ts +29 -32
  47. package/esm/expansion-panel/expansion-panel.js +32 -32
  48. package/esm/field-next/field.js +1 -1
  49. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  50. package/esm/stepper/step/step-adapter.js +2 -2
  51. package/esm/table/table-utils.js +5 -4
  52. package/package.json +1 -1
  53. package/styles/core/styles/tokens/expansion-panel/_tokens.scss +17 -0
  54. package/styles/expansion-panel/_core.scss +65 -0
  55. package/styles/expansion-panel/_token-utils.scss +30 -0
  56. package/styles/expansion-panel/expansion-panel.scss +83 -3
  57. package/styles/expansion-panel/index.scss +6 -0
  58. package/styles/field-next/_core.layout.scss +2 -6
  59. package/styles/field-next/_core.scss +2 -1
  60. package/styles/field-next/field.scss +0 -4
  61. package/styles/forge.scss +0 -1
  62. package/dist/esm/chunks/chunk.IZ63EJ32.js +0 -7
  63. package/dist/esm/chunks/chunk.IZ63EJ32.js.map +0 -7
  64. package/dist/esm/chunks/chunk.LGEZI5SZ.js +0 -7
  65. package/dist/esm/chunks/chunk.LGEZI5SZ.js.map +0 -7
  66. package/dist/esm/chunks/chunk.OT4AIOMN.js +0 -7
  67. package/dist/esm/chunks/chunk.SIGRWU4V.js +0 -7
  68. package/dist/esm/chunks/chunk.SIGRWU4V.js.map +0 -7
  69. package/dist/esm/chunks/chunk.USO2XVOI.js +0 -7
  70. package/dist/esm/chunks/chunk.USO2XVOI.js.map +0 -7
  71. package/dist/expansion-panel/forge-expansion-panel.css +0 -6
  72. package/styles/expansion-panel/_mixins.scss +0 -88
  73. package/styles/expansion-panel/forge-expansion-panel.scss +0 -16
  74. /package/dist/esm/chunks/{chunk.OFXSMOV6.js.map → chunk.5UGN5FYV.js.map} +0 -0
  75. /package/dist/esm/chunks/{chunk.2N5KNNQX.js.map → chunk.5UZ2DEW3.js.map} +0 -0
  76. /package/dist/esm/chunks/{chunk.O56VP4OZ.js.map → chunk.A6BIUNPW.js.map} +0 -0
  77. /package/dist/esm/chunks/{chunk.5S7XNYRQ.js.map → chunk.GL2H6QOP.js.map} +0 -0
  78. /package/dist/esm/chunks/{chunk.ZAREP2QH.js.map → chunk.HYTFCFP6.js.map} +0 -0
  79. /package/dist/esm/chunks/{chunk.TPNZYEC7.js.map → chunk.NIUX6DVF.js.map} +0 -0
  80. /package/dist/esm/chunks/{chunk.VOTT5COZ.js.map → chunk.OSBNFFCI.js.map} +0 -0
@@ -5,36 +5,30 @@
5
5
  */
6
6
  export declare const EXPANSION_PANEL_CONSTANTS: {
7
7
  elementName: "forge-expansion-panel";
8
+ observedAttributes: {
9
+ OPEN: string;
10
+ ORIENTATION: string;
11
+ ANIMATION_TYPE: string;
12
+ };
13
+ attributes: {
14
+ OPENING: string;
15
+ OPEN: string;
16
+ ORIENTATION: string;
17
+ ANIMATION_TYPE: string;
18
+ };
8
19
  classes: {
9
- CONTAINER: string;
10
- HEADER: string;
11
- CONTENT: string;
20
+ HIDDEN: string;
12
21
  };
13
22
  selectors: {
14
- CONTAINER: string;
15
23
  HEADER: string;
16
24
  CONTENT: string;
17
- HEADER_SLOT: string;
25
+ IGNORE: string;
18
26
  OPEN_ICON: string;
19
27
  };
20
28
  events: {
21
29
  TOGGLE: string;
22
- };
23
- attributes: {
24
- OPEN: string;
25
- ORIENTATION: string;
26
- USE_ANIMATIONS: string;
27
- IGNORE: string;
28
- IGNORE_ALT: string;
29
- };
30
- numbers: {
31
- COLLAPSE_ANIMATION_DURATION: number;
32
- CLICK_DEBOUNCE_THRESHOLD: number;
33
- };
34
- strings: {
35
- ORIENTATION_VERTICAL: string;
36
- ORIENTATION_HORIZONTAL: string;
37
- EXPANSION_VERTICAL_TRANSITION: string;
38
- EXPANSION_HORIZONTAL_TRANSITION: string;
30
+ ANIMATION_COMPLETE: string;
39
31
  };
40
32
  };
33
+ export type ExpansionPanelOrientation = 'horizontal' | 'vertical';
34
+ export type ExpansionPanelAnimationType = 'default' | 'none';
@@ -6,44 +6,30 @@
6
6
  import { COMPONENT_NAME_PREFIX } from '../constants';
7
7
  import { OPEN_ICON_CONSTANTS } from '../open-icon';
8
8
  const elementName = `${COMPONENT_NAME_PREFIX}expansion-panel`;
9
+ const observedAttributes = {
10
+ OPEN: 'open',
11
+ ORIENTATION: 'orientation',
12
+ ANIMATION_TYPE: 'animation-type'
13
+ };
14
+ const attributes = Object.assign(Object.assign({}, observedAttributes), { OPENING: 'opening' });
9
15
  const classes = {
10
- CONTAINER: 'forge-expansion-panel',
11
- HEADER: 'forge-expansion-panel__header',
12
- CONTENT: 'forge-expansion-panel__content'
16
+ HIDDEN: 'hidden'
13
17
  };
14
18
  const selectors = {
15
- CONTAINER: `.${classes.CONTAINER}`,
16
- HEADER: `.${classes.HEADER}`,
17
- CONTENT: `.${classes.CONTENT}`,
18
- HEADER_SLOT: `.${classes.HEADER} > slot[name=header]`,
19
- OPEN_ICON: `[slot=header] ${OPEN_ICON_CONSTANTS.elementName}`
19
+ HEADER: '.header',
20
+ CONTENT: '.content',
21
+ IGNORE: ':is([data-forge-ignore],[forge-ignore])',
22
+ OPEN_ICON: `:is([slot=header] ${OPEN_ICON_CONSTANTS.elementName}, ${OPEN_ICON_CONSTANTS.elementName}[slot^=header])`
20
23
  };
21
24
  const events = {
22
- TOGGLE: `${elementName}-toggle`
23
- };
24
- const attributes = {
25
- OPEN: 'open',
26
- ORIENTATION: 'orientation',
27
- USE_ANIMATIONS: 'use-animations',
28
- IGNORE: 'data-forge-ignore',
29
- IGNORE_ALT: 'forge-ignore'
30
- };
31
- const numbers = {
32
- COLLAPSE_ANIMATION_DURATION: 400,
33
- CLICK_DEBOUNCE_THRESHOLD: 200
34
- };
35
- const strings = {
36
- ORIENTATION_VERTICAL: 'vertical',
37
- ORIENTATION_HORIZONTAL: 'horizontal',
38
- EXPANSION_VERTICAL_TRANSITION: `height ${numbers.COLLAPSE_ANIMATION_DURATION}ms cubic-bezier(0.4, 0, 0.2, 1), opacity ${numbers.COLLAPSE_ANIMATION_DURATION}ms ease-in-out`,
39
- EXPANSION_HORIZONTAL_TRANSITION: `width ${numbers.COLLAPSE_ANIMATION_DURATION}ms cubic-bezier(0.4, 0, 0.2, 1), opacity ${numbers.COLLAPSE_ANIMATION_DURATION}ms ease-in-out`
25
+ TOGGLE: `${elementName}-toggle`,
26
+ ANIMATION_COMPLETE: `${elementName}-animation-complete`
40
27
  };
41
28
  export const EXPANSION_PANEL_CONSTANTS = {
42
29
  elementName,
30
+ observedAttributes,
31
+ attributes,
43
32
  classes,
44
33
  selectors,
45
- events,
46
- attributes,
47
- numbers,
48
- strings
34
+ events
49
35
  };
@@ -5,55 +5,32 @@
5
5
  */
6
6
  import { ICustomElementFoundation } from '@tylertech/forge-core';
7
7
  import { IExpansionPanelAdapter } from './expansion-panel-adapter';
8
+ import { ExpansionPanelAnimationType, ExpansionPanelOrientation } from './expansion-panel-constants';
8
9
  export interface IExpansionPanelFoundation extends ICustomElementFoundation {
9
10
  open: boolean;
10
- orientation: string;
11
- useAnimations: boolean;
12
- openCallback: () => void | Promise<void>;
13
- closeCallback: () => void | Promise<void>;
14
- setOpenImmediate(open: boolean): void;
11
+ orientation: ExpansionPanelOrientation;
12
+ animationType: ExpansionPanelAnimationType;
15
13
  }
16
14
  export declare class ExpansionPanelFoundation implements IExpansionPanelFoundation {
17
15
  private _adapter;
18
16
  private _open;
19
- private _useAnimations;
20
- private _openCallback;
21
- private _closeCallback;
22
17
  private _orientation;
18
+ private _animationType;
23
19
  private _clickListener;
24
20
  private _keydownListener;
25
- private _headerSlotChangeListener;
26
- private _isInitialized;
21
+ private _animationCompleteListener;
27
22
  constructor(_adapter: IExpansionPanelAdapter);
28
23
  initialize(): void;
29
- connect(): void;
30
- disconnect(): void;
31
- setOpenImmediate(open: boolean): void;
32
- private _applyOpen;
33
- /** Controls the open state of the panel. */
34
- get open(): boolean;
35
- set open(value: boolean);
36
- get openCallback(): () => void | Promise<void>;
37
- set openCallback(callback: () => void | Promise<void>);
38
- get closeCallback(): () => void | Promise<void>;
39
- set closeCallback(callback: () => void | Promise<void>);
40
- get orientation(): string;
41
- set orientation(value: string);
42
- get useAnimations(): boolean;
43
- set useAnimations(value: boolean);
44
- /**
45
- * Handles click events on the header element.
46
- * @param {MouseEvent} evt The click event.
47
- */
48
24
  private _onClick;
49
- /**
50
- * Handles keydown events on the header.
51
- * @param {KeyboardEvent} evt The keydown event
52
- */
53
25
  private _onKeydown;
54
- private _emitEvent;
26
+ private _onAnimationComplete;
27
+ private _togglePanel;
28
+ private _dispatchToggleEvent;
55
29
  private _toggle;
56
- private _openPanel;
57
- private _closePanel;
58
- private _onHeaderSlotChanged;
30
+ get open(): boolean;
31
+ set open(value: boolean);
32
+ get orientation(): ExpansionPanelOrientation;
33
+ set orientation(value: ExpansionPanelOrientation);
34
+ get animationType(): ExpansionPanelAnimationType;
35
+ set animationType(value: ExpansionPanelAnimationType);
59
36
  }
@@ -3,152 +3,85 @@
3
3
  * Copyright 2023 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import { debounce, getEventPath } from '@tylertech/forge-core';
7
6
  import { EXPANSION_PANEL_CONSTANTS } from './expansion-panel-constants';
8
7
  export class ExpansionPanelFoundation {
9
8
  constructor(_adapter) {
10
9
  this._adapter = _adapter;
11
10
  this._open = false;
12
- this._useAnimations = true;
13
- this._orientation = EXPANSION_PANEL_CONSTANTS.strings.ORIENTATION_VERTICAL;
14
- this._isInitialized = false;
15
- this._clickListener = debounce((evt) => this._onClick(evt), EXPANSION_PANEL_CONSTANTS.numbers.CLICK_DEBOUNCE_THRESHOLD, true);
16
- this._keydownListener = (evt) => this._onKeydown(evt);
17
- this._headerSlotChangeListener = (evt) => this._onHeaderSlotChanged(evt);
11
+ this._orientation = 'vertical';
12
+ this._animationType = 'default';
13
+ this._clickListener = this._onClick.bind(this);
14
+ this._keydownListener = this._onKeydown.bind(this);
15
+ this._animationCompleteListener = this._onAnimationComplete.bind(this);
18
16
  }
19
17
  initialize() {
20
- this.connect();
21
- this._adapter.initialize(this._open, this._orientation);
22
- this._isInitialized = true;
18
+ this._adapter.addHeaderListener('click', this._clickListener);
19
+ this._adapter.addHeaderListener('keydown', this._keydownListener);
20
+ this._adapter.setAnimationCompleteListener(this._animationCompleteListener);
23
21
  }
24
- connect() {
25
- this._adapter.registerHeaderSlotListener(this._headerSlotChangeListener);
26
- this._adapter.registerClickListener(this._clickListener);
27
- this._adapter.registerKeydownListener(this._keydownListener);
28
- }
29
- disconnect() {
30
- this._adapter.deregisterHeaderSlotListener(this._headerSlotChangeListener);
31
- this._adapter.deregisterClickListener(this._clickListener);
32
- this._adapter.deregisterKeydownListener(this._keydownListener);
33
- }
34
- setOpenImmediate(open) {
35
- if (open) {
36
- this._openPanel(false);
37
- }
38
- else {
39
- this._closePanel(false);
22
+ _onClick(evt) {
23
+ const fromIgnoredEl = evt.composedPath().find((el) => el.nodeType === Node.ELEMENT_NODE && el.matches(EXPANSION_PANEL_CONSTANTS.selectors.IGNORE));
24
+ if (fromIgnoredEl) {
25
+ return;
40
26
  }
27
+ evt.stopPropagation();
28
+ this._toggle();
29
+ this._dispatchToggleEvent();
41
30
  }
42
- _applyOpen(value) {
43
- if (!this._isInitialized) {
44
- this._open = value;
45
- return;
31
+ _onKeydown(evt) {
32
+ if (evt.key === ' ' || evt.key === 'Enter') {
33
+ evt.stopPropagation();
34
+ evt.preventDefault();
35
+ this._toggle();
36
+ this._dispatchToggleEvent();
46
37
  }
47
- if (value) {
48
- if (this._openCallback) {
49
- Promise.resolve(this._openCallback())
50
- .then(() => {
51
- this._open = value;
52
- this._openPanel(this._useAnimations);
53
- })
54
- .catch(() => { });
55
- }
56
- else {
57
- this._open = value;
58
- this._openPanel(this._useAnimations);
59
- }
38
+ }
39
+ _onAnimationComplete() {
40
+ if (!this._open) {
41
+ this._adapter.setContentVisibility(false);
60
42
  }
61
- else {
62
- if (this._closeCallback) {
63
- Promise.resolve(this._closeCallback())
64
- .then(() => {
65
- this._open = value;
66
- this._closePanel(this._useAnimations);
67
- })
68
- .catch(() => { });
69
- }
70
- else {
71
- this._open = value;
72
- this._closePanel(this._useAnimations);
73
- }
43
+ this._adapter.dispatchHostEvent(new CustomEvent(EXPANSION_PANEL_CONSTANTS.events.ANIMATION_COMPLETE, { detail: this._open }));
44
+ }
45
+ _togglePanel() {
46
+ this._adapter.toggleHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.OPEN, this._open);
47
+ this._adapter.tryToggleOpenIcon(this._open);
48
+ if (this._open) {
49
+ this._adapter.setContentVisibility(true);
74
50
  }
75
51
  }
76
- /** Controls the open state of the panel. */
52
+ _dispatchToggleEvent() {
53
+ const evt = new CustomEvent(EXPANSION_PANEL_CONSTANTS.events.TOGGLE, { detail: this._open, bubbles: true, composed: true });
54
+ this._adapter.dispatchHostEvent(evt);
55
+ }
56
+ _toggle() {
57
+ this.open = !this.open;
58
+ }
77
59
  get open() {
78
60
  return this._open;
79
61
  }
80
62
  set open(value) {
81
63
  value = Boolean(value);
82
64
  if (this._open !== value) {
83
- this._applyOpen(value);
65
+ this._open = value;
66
+ this._togglePanel();
84
67
  }
85
68
  }
86
- get openCallback() {
87
- return this._openCallback;
88
- }
89
- set openCallback(callback) {
90
- this._openCallback = callback;
91
- }
92
- get closeCallback() {
93
- return this._closeCallback;
94
- }
95
- set closeCallback(callback) {
96
- this._closeCallback = callback;
97
- }
98
69
  get orientation() {
99
70
  return this._orientation;
100
71
  }
101
72
  set orientation(value) {
102
- this._orientation = value;
103
- }
104
- get useAnimations() {
105
- return this._useAnimations;
106
- }
107
- set useAnimations(value) {
108
- if (this._useAnimations !== !!value) {
109
- this._useAnimations = !!value;
110
- this._adapter.setHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.USE_ANIMATIONS, `${this._useAnimations}`);
73
+ if (this._orientation !== value) {
74
+ this._orientation = value;
75
+ this._adapter.setHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.ORIENTATION, this._orientation);
111
76
  }
112
77
  }
113
- /**
114
- * Handles click events on the header element.
115
- * @param {MouseEvent} evt The click event.
116
- */
117
- _onClick(evt) {
118
- if (getEventPath(evt).find(p => p.nodeType === 1 && (p.hasAttribute(EXPANSION_PANEL_CONSTANTS.attributes.IGNORE) || p.hasAttribute(EXPANSION_PANEL_CONSTANTS.attributes.IGNORE_ALT)))) {
119
- return;
120
- }
121
- evt.stopPropagation();
122
- this._toggle();
123
- this._emitEvent();
78
+ get animationType() {
79
+ return this._animationType;
124
80
  }
125
- /**
126
- * Handles keydown events on the header.
127
- * @param {KeyboardEvent} evt The keydown event
128
- */
129
- _onKeydown(evt) {
130
- if (evt.key === ' ' || evt.key === 'Enter') {
131
- evt.stopPropagation();
132
- evt.preventDefault();
133
- this._toggle();
134
- this._emitEvent();
81
+ set animationType(value) {
82
+ if (this._animationType !== value) {
83
+ this._animationType = value;
84
+ this._adapter.setHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.ANIMATION_TYPE, this._animationType);
135
85
  }
136
86
  }
137
- _emitEvent() {
138
- this._adapter.emitHostEvent(EXPANSION_PANEL_CONSTANTS.events.TOGGLE, this._open);
139
- }
140
- _toggle() {
141
- this.open = !this.open;
142
- }
143
- _openPanel(animate) {
144
- this._adapter.setHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.OPEN, '');
145
- this._adapter.setOpenState(true, this._orientation, animate);
146
- }
147
- _closePanel(animate) {
148
- this._adapter.removeHostAttribute(EXPANSION_PANEL_CONSTANTS.attributes.OPEN);
149
- this._adapter.setOpenState(false, this._orientation, animate);
150
- }
151
- _onHeaderSlotChanged(evt) {
152
- this._adapter.setHeaderVisibility(!!evt.target.assignedNodes().length);
153
- }
154
87
  }
@@ -4,14 +4,12 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { BaseComponent, IBaseComponent } from '../core/base/base-component';
7
+ import { ExpansionPanelAnimationType, ExpansionPanelOrientation } from './expansion-panel-constants';
7
8
  export interface IExpansionPanelComponent extends IBaseComponent {
8
9
  open: boolean;
9
- useAnimations: boolean;
10
- openCallback: () => void | Promise<void>;
11
- closeCallback: () => void | Promise<void>;
12
- orientation: string;
10
+ orientation: ExpansionPanelOrientation;
11
+ animationType: ExpansionPanelAnimationType;
13
12
  toggle(): void;
14
- setOpenImmediate(open: boolean): void;
15
13
  }
16
14
  declare global {
17
15
  interface HTMLElementTagNameMap {
@@ -19,44 +17,43 @@ declare global {
19
17
  }
20
18
  interface HTMLElementEventMap {
21
19
  'forge-expansion-panel-toggle': CustomEvent<boolean>;
20
+ 'forge-expansion-panel-animation-complete': CustomEvent<boolean>;
22
21
  }
23
22
  }
24
23
  /**
25
- * A web component that encapsulates the functionality of expanding/collapsing content when clicked.
26
- *
27
24
  * @tag forge-expansion-panel
25
+ *
26
+ * @summary Expansion panels provide progressive disclosure of content.
27
+ *
28
+ * @property {boolean} open - Whether the panel is open or closed.
29
+ * @property {ExpansionPanelOrientation} orientation - The orientation of the panel.
30
+ * @property {ExpansionPanelAnimationType} animationType - The type of animation to use when opening/closing the panel.
31
+ *
32
+ * @attribute {boolean} open - Whether the panel is open or closed.
33
+ * @attribute {ExpansionPanelOrientation} orientation - The orientation of the panel.
34
+ * @attribute {ExpansionPanelAnimationType} animation-type - The type of animation to use when opening/closing the panel.
35
+ *
36
+ * @fires forge-expansion-panel-toggle - Event fired when the panel is toggled open or closed.
37
+ * @fires forge-expansion-panel-animation-complete - Event fired when the panel has finished animating when toggling.
38
+ *
39
+ * @cssproperty --forge-expansion-animation-duration - The duration of the open/close animation.
40
+ * @cssproperty --forge-expansion-animation-easing - The easing function of the open/close animation.
41
+ *
42
+ * @csspart root - The root element of the panel.
43
+ * @csspart header - The header of the panel.
44
+ * @csspart content - The content of the panel.
45
+ *
46
+ * @slot - The content of the panel.
47
+ * @slot header - The header of the panel.
28
48
  */
29
49
  export declare class ExpansionPanelComponent extends BaseComponent implements IExpansionPanelComponent {
30
50
  static get observedAttributes(): string[];
31
51
  private _foundation;
32
52
  constructor();
33
- initializedCallback(): void;
34
53
  connectedCallback(): void;
35
54
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
36
- disconnectedCallback(): void;
37
- /** Controls the open state of the panel. */
38
55
  open: boolean;
39
- /**
40
- * Sets the function to call when the panel wants to open.
41
- * The function must return a promise which can be resolved to
42
- * open the panel or rejected which cancels the panel open.
43
- */
44
- openCallback: () => void | Promise<void>;
45
- /**
46
- * Sets the function to call when the panel wants to close.
47
- * The function must return a promise which can be resolved to
48
- * close the panel or rejected which cancels the panel close.
49
- */
50
- closeCallback: () => void | Promise<void>;
51
- /**
52
- * Sets the orientation of the panel expansion.
53
- * Valid values are 'vertical' (default) or 'horizontal'.
54
- */
55
- orientation: string;
56
- /** Gets/sets if animations are used in the expand/collapse transition. */
57
- useAnimations: boolean;
58
- /** Toggles the collapsed state. */
56
+ orientation: ExpansionPanelOrientation;
57
+ animationType: ExpansionPanelAnimationType;
59
58
  toggle(): void;
60
- /** Forces the expansion panel to expand/collapse without transition animations. */
61
- setOpenImmediate(open: boolean): void;
62
59
  }
@@ -9,72 +9,72 @@ import { BaseComponent } from '../core/base/base-component';
9
9
  import { ExpansionPanelAdapter } from './expansion-panel-adapter';
10
10
  import { EXPANSION_PANEL_CONSTANTS } from './expansion-panel-constants';
11
11
  import { ExpansionPanelFoundation } from './expansion-panel-foundation';
12
- const template = '<template><div class=\"forge-expansion-panel\" part=\"root\"><div class=\"forge-expansion-panel__header\" part=\"header\"><slot name=\"header\"></slot></div><div class=\"forge-expansion-panel__content\" style=\"height: 0; opacity: 0; visibility: hidden;\" part=\"content\"><slot></slot></div></div></template>';
13
- const styles = '.forge-expansion-panel{display:block;display:var(--forge-expansion-panel-display,block);height:auto;height:var(--forge-expansion-panel-height,auto)}.forge-expansion-panel__header{outline:0;-webkit-tap-highlight-color:transparent}.forge-expansion-panel__header:hover{cursor:pointer}.forge-expansion-panel__header forge-open-icon{margin-left:auto}.forge-expansion-panel__content{overflow:hidden;overflow:var(--forge-expansion-panel-content-overflow,hidden);max-height:none;max-height:var(--forge-expansion-panel-content-max-height,none)}.forge-expansion-panel__content::-webkit-scrollbar{height:var(--forge-scrollbar-height,16px);width:var(--forge-scrollbar-width,16px)}.forge-expansion-panel__content::-webkit-scrollbar-track{background-color:var(--forge-scrollbar-track-container,var(--forge-theme-surface-container-low,#ebebeb))}.forge-expansion-panel__content::-webkit-scrollbar-track:hover{background-color:var(--forge-scrollbar-track-container-hover,var(--forge-theme-surface-container-low,#ebebeb))}.forge-expansion-panel__content::-webkit-scrollbar-corner{background-color:var(--forge-scrollbar-track-container,var(--forge-theme-surface-container-low,#ebebeb))}.forge-expansion-panel__content::-webkit-scrollbar-thumb{height:var(--forge-scrollbar-thumb-min-height,32px);width:var(--forge-scrollbar-thumb-min-width,32px);border-radius:var(--forge-scrollbar-border-radius,var(--forge-shape-full,9999px));border-width:var(--forge-scrollbar-border-width,3px);border-style:solid;border-color:transparent;background-color:var(--forge-scrollbar-thumb-container,var(--forge-theme-surface-container-medium,#c2c2c2));background-clip:content-box}.forge-expansion-panel__content::-webkit-scrollbar-thumb:hover{background-color:var(--forge-scrollbar-thumb-container-hover,var(--forge-theme-surface-container-high,#9e9e9e))}:host{display:block}:host([hidden]){display:none}';
12
+ const template = '<template><div class=\"forge-expansion-panel\" part=\"root\"><div class=\"header\" part=\"header\"><slot name=\"header\"></slot></div><div class=\"content hidden\" part=\"content\"><div class=\"inner\"><slot></slot></div></div></div></template>';
13
+ const styles = ':host{display:block}:host([hidden]){display:none}.forge-expansion-panel{--_expansion-panel-animation-duration:var(--forge-expansion-panel-animation-duration, var(--forge-animation-duration-medium4, 400ms));--_expansion-panel-animation-easing:var(--forge-expansion-panel-animation-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)))}.header{outline:0;-webkit-tap-highlight-color:transparent;cursor:pointer}.content{display:grid;grid-template-rows:0fr;-webkit-transition-property:opacity,grid-template-rows;transition-property:opacity,grid-template-rows;transition-property:opacity,grid-template-rows,-ms-grid-rows;-webkit-transition-duration:var(--_expansion-panel-animation-duration);transition-duration:var(--_expansion-panel-animation-duration);-webkit-transition-timing-function:var(--_expansion-panel-animation-easing);transition-timing-function:var(--_expansion-panel-animation-easing);min-height:0;overflow:hidden;opacity:0}.content .inner{display:grid;grid-template-rows:1fr;overflow:hidden}.hidden{visibility:hidden}@media (prefers-reduced-motion:reduce){.content{-webkit-transition:none;transition:none}}:host([open]) .content{opacity:1}:host([open]:is(:not([orientation]),[orientation=vertical])) .content{grid-template-rows:1fr}:host([open][orientation=horizontal]) .content{grid-template-columns:1fr}:host([orientation=horizontal]) .forge-expansion-panel{display:grid;grid-template-columns:auto 1fr}:host([orientation=horizontal]) .content{-webkit-transition-property:opacity,grid-template-columns;transition-property:opacity,grid-template-columns;transition-property:opacity,grid-template-columns,-ms-grid-columns;grid-template-rows:none;grid-template-columns:0fr}:host([animation-type=none]) .content{-webkit-transition:none;transition:none}';
14
14
  /**
15
- * A web component that encapsulates the functionality of expanding/collapsing content when clicked.
16
- *
17
15
  * @tag forge-expansion-panel
16
+ *
17
+ * @summary Expansion panels provide progressive disclosure of content.
18
+ *
19
+ * @property {boolean} open - Whether the panel is open or closed.
20
+ * @property {ExpansionPanelOrientation} orientation - The orientation of the panel.
21
+ * @property {ExpansionPanelAnimationType} animationType - The type of animation to use when opening/closing the panel.
22
+ *
23
+ * @attribute {boolean} open - Whether the panel is open or closed.
24
+ * @attribute {ExpansionPanelOrientation} orientation - The orientation of the panel.
25
+ * @attribute {ExpansionPanelAnimationType} animation-type - The type of animation to use when opening/closing the panel.
26
+ *
27
+ * @fires forge-expansion-panel-toggle - Event fired when the panel is toggled open or closed.
28
+ * @fires forge-expansion-panel-animation-complete - Event fired when the panel has finished animating when toggling.
29
+ *
30
+ * @cssproperty --forge-expansion-animation-duration - The duration of the open/close animation.
31
+ * @cssproperty --forge-expansion-animation-easing - The easing function of the open/close animation.
32
+ *
33
+ * @csspart root - The root element of the panel.
34
+ * @csspart header - The header of the panel.
35
+ * @csspart content - The content of the panel.
36
+ *
37
+ * @slot - The content of the panel.
38
+ * @slot header - The header of the panel.
18
39
  */
19
40
  let ExpansionPanelComponent = class ExpansionPanelComponent extends BaseComponent {
20
41
  static get observedAttributes() {
21
- return [
22
- EXPANSION_PANEL_CONSTANTS.attributes.OPEN,
23
- EXPANSION_PANEL_CONSTANTS.attributes.ORIENTATION,
24
- EXPANSION_PANEL_CONSTANTS.attributes.USE_ANIMATIONS
25
- ];
42
+ return Object.values(EXPANSION_PANEL_CONSTANTS.observedAttributes);
26
43
  }
27
44
  constructor() {
28
45
  super();
29
46
  attachShadowTemplate(this, template, styles);
30
47
  this._foundation = new ExpansionPanelFoundation(new ExpansionPanelAdapter(this));
31
48
  }
32
- initializedCallback() {
33
- this._foundation.initialize();
34
- }
35
49
  connectedCallback() {
36
- this._foundation.connect();
50
+ this._foundation.initialize();
37
51
  }
38
52
  attributeChangedCallback(name, oldValue, newValue) {
39
53
  switch (name) {
40
- case EXPANSION_PANEL_CONSTANTS.attributes.OPEN:
54
+ case EXPANSION_PANEL_CONSTANTS.observedAttributes.OPEN:
41
55
  this.open = coerceBoolean(newValue);
42
56
  break;
43
- case EXPANSION_PANEL_CONSTANTS.attributes.ORIENTATION:
57
+ case EXPANSION_PANEL_CONSTANTS.observedAttributes.ORIENTATION:
44
58
  this.orientation = newValue;
45
59
  break;
46
- case EXPANSION_PANEL_CONSTANTS.attributes.USE_ANIMATIONS:
47
- this.useAnimations = coerceBoolean(newValue);
60
+ case EXPANSION_PANEL_CONSTANTS.observedAttributes.ANIMATION_TYPE:
61
+ this.animationType = newValue;
48
62
  break;
49
63
  }
50
64
  }
51
- disconnectedCallback() {
52
- this._foundation.disconnect();
53
- }
54
- /** Toggles the collapsed state. */
55
65
  toggle() {
56
66
  this.open = !this.open;
57
67
  }
58
- /** Forces the expansion panel to expand/collapse without transition animations. */
59
- setOpenImmediate(open) {
60
- this._foundation.setOpenImmediate(open);
61
- }
62
68
  };
63
69
  __decorate([
64
70
  FoundationProperty()
65
71
  ], ExpansionPanelComponent.prototype, "open", void 0);
66
- __decorate([
67
- FoundationProperty()
68
- ], ExpansionPanelComponent.prototype, "openCallback", void 0);
69
- __decorate([
70
- FoundationProperty()
71
- ], ExpansionPanelComponent.prototype, "closeCallback", void 0);
72
72
  __decorate([
73
73
  FoundationProperty()
74
74
  ], ExpansionPanelComponent.prototype, "orientation", void 0);
75
75
  __decorate([
76
76
  FoundationProperty()
77
- ], ExpansionPanelComponent.prototype, "useAnimations", void 0);
77
+ ], ExpansionPanelComponent.prototype, "animationType", void 0);
78
78
  ExpansionPanelComponent = __decorate([
79
79
  CustomElement({
80
80
  name: EXPANSION_PANEL_CONSTANTS.elementName