@tylertech/forge 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/custom-elements.json +1538 -300
  2. package/dist/esm/accordion/index.js +1 -1
  3. package/dist/esm/app-bar/help-button/index.js +1 -1
  4. package/dist/esm/app-bar/index.js +1 -1
  5. package/dist/esm/app-bar/menu-button/index.js +1 -1
  6. package/dist/esm/app-bar/notification-button/index.js +1 -1
  7. package/dist/esm/app-bar/profile-button/index.js +1 -1
  8. package/dist/esm/app-bar/search/index.js +1 -1
  9. package/dist/esm/autocomplete/index.js +1 -1
  10. package/dist/esm/banner/index.js +1 -1
  11. package/dist/esm/bottom-sheet/index.js +1 -1
  12. package/dist/esm/button-area/index.js +7 -0
  13. package/dist/esm/button-area/index.js.map +7 -0
  14. package/dist/esm/button-toggle/index.js +1 -1
  15. package/dist/esm/calendar/calendar-dropdown/index.js +1 -1
  16. package/dist/esm/calendar/calendar-menu/index.js +1 -1
  17. package/dist/esm/calendar/index.js +1 -1
  18. package/dist/esm/checkbox/index.js +1 -1
  19. package/dist/esm/chip-field/index.js +1 -1
  20. package/dist/esm/chips/chip/index.js +1 -1
  21. package/dist/esm/chips/chip-set/index.js +1 -1
  22. package/dist/esm/chips/index.js +1 -1
  23. package/dist/esm/chunks/{chunk.HHDEJSOK.js → chunk.23QPY6PU.js} +2 -2
  24. package/dist/esm/chunks/{chunk.6BTPAMJ7.js → chunk.2EAQ36QO.js} +2 -2
  25. package/dist/esm/chunks/{chunk.OYIW3AI6.js → chunk.3NHRJPT4.js} +2 -2
  26. package/dist/esm/chunks/{chunk.UW2HWAVL.js → chunk.42QTJZSF.js} +2 -2
  27. package/dist/esm/chunks/chunk.4DKCMH6P.js +7 -0
  28. package/dist/esm/chunks/chunk.4DKCMH6P.js.map +7 -0
  29. package/dist/esm/chunks/{chunk.QJ7LOIUK.js → chunk.54KXJVRY.js} +2 -2
  30. package/dist/esm/chunks/{chunk.T6NVM7TN.js → chunk.67G7HT5S.js} +2 -2
  31. package/dist/esm/chunks/{chunk.YMBLWKRP.js → chunk.7IHNVPY5.js} +2 -2
  32. package/dist/esm/chunks/{chunk.XFAOB6LU.js → chunk.7NHFZL6J.js} +2 -2
  33. package/dist/esm/chunks/{chunk.SATUJNQX.js → chunk.AD4NVLFA.js} +2 -2
  34. package/dist/esm/chunks/{chunk.D24CE6KE.js → chunk.AZFF62ZK.js} +2 -2
  35. package/dist/esm/chunks/{chunk.JPVIN4NH.js → chunk.BJRQ67AD.js} +2 -2
  36. package/dist/esm/chunks/{chunk.Y7N4KA4U.js → chunk.D43PPRFO.js} +2 -2
  37. package/dist/esm/chunks/chunk.DBKVUCUQ.js +7 -0
  38. package/dist/esm/chunks/chunk.DBKVUCUQ.js.map +7 -0
  39. package/dist/esm/chunks/{chunk.FBHCNPUL.js → chunk.GEWDZDXN.js} +2 -2
  40. package/dist/esm/chunks/{chunk.WVRUVLT4.js → chunk.GSFM6MH4.js} +2 -2
  41. package/dist/esm/chunks/{chunk.MSFGXRCM.js → chunk.IV2GMOPB.js} +2 -2
  42. package/dist/esm/chunks/chunk.IWICN773.js +7 -0
  43. package/dist/esm/chunks/chunk.IWICN773.js.map +7 -0
  44. package/dist/esm/chunks/{chunk.HTH3CEDN.js → chunk.J2PHUKSR.js} +2 -2
  45. package/dist/esm/chunks/{chunk.BKNYDA4V.js → chunk.JCDIPDQR.js} +2 -2
  46. package/dist/esm/chunks/{chunk.RGAPFLQE.js → chunk.JMRXBELV.js} +2 -2
  47. package/dist/esm/chunks/{chunk.WRV4KYM5.js → chunk.JOLJ7WVN.js} +2 -2
  48. package/dist/esm/chunks/{chunk.FOLQAW63.js → chunk.K55FBLTW.js} +2 -2
  49. package/dist/esm/chunks/{chunk.XNCXVZJA.js → chunk.KNVCEYY2.js} +2 -2
  50. package/dist/esm/chunks/{chunk.L4CNH27W.js → chunk.MXVJSEF3.js} +2 -2
  51. package/dist/esm/chunks/{chunk.SQTM36C3.js → chunk.N6XHXCZE.js} +2 -2
  52. package/dist/esm/chunks/{chunk.JDLEPQKN.js → chunk.OEZZ2NEY.js} +2 -2
  53. package/dist/esm/chunks/chunk.P4VJUJQN.js +7 -0
  54. package/dist/esm/chunks/{chunk.K4SWLH26.js.map → chunk.P4VJUJQN.js.map} +3 -3
  55. package/dist/esm/chunks/{chunk.Z7KJ4SA5.js → chunk.P67RC5S3.js} +2 -2
  56. package/dist/esm/chunks/chunk.PBWUHK7Q.js +7 -0
  57. package/dist/esm/chunks/chunk.PBWUHK7Q.js.map +7 -0
  58. package/dist/esm/chunks/{chunk.BKAZC53W.js → chunk.PILDKQOE.js} +2 -2
  59. package/dist/esm/chunks/{chunk.CR2XZYFM.js → chunk.QZ2NXIGY.js} +2 -2
  60. package/dist/esm/chunks/chunk.RH4E52PS.js +7 -0
  61. package/dist/esm/chunks/chunk.RH4E52PS.js.map +7 -0
  62. package/dist/esm/chunks/{chunk.CG5CVENX.js → chunk.RLWX5BFQ.js} +2 -2
  63. package/dist/esm/chunks/{chunk.ZPWB74RA.js → chunk.ROWBKHIO.js} +2 -2
  64. package/dist/esm/chunks/{chunk.274MFEUZ.js → chunk.SFTWKDQV.js} +2 -2
  65. package/dist/esm/chunks/{chunk.WO32MVS4.js → chunk.SNVWMZNK.js} +2 -2
  66. package/dist/esm/chunks/{chunk.WO32MVS4.js.map → chunk.SNVWMZNK.js.map} +1 -1
  67. package/dist/esm/chunks/{chunk.Q5YD3PKM.js → chunk.TH7RLTJK.js} +2 -2
  68. package/dist/esm/chunks/{chunk.K6LBO4KJ.js → chunk.UVL4TIK2.js} +2 -2
  69. package/dist/esm/chunks/{chunk.H5XOBZLW.js → chunk.WOTVTBJS.js} +2 -2
  70. package/dist/esm/chunks/{chunk.RW6UJSE4.js → chunk.WPJEXVHM.js} +2 -2
  71. package/dist/esm/chunks/{chunk.AMES2WWC.js → chunk.XAPKK4ZJ.js} +2 -2
  72. package/dist/esm/chunks/{chunk.NX4EECNP.js → chunk.XTMXGKUO.js} +2 -2
  73. package/dist/esm/chunks/{chunk.2DAPNN6B.js → chunk.Y2I2VRMF.js} +2 -2
  74. package/dist/esm/chunks/chunk.YG2UMTJN.js +12 -0
  75. package/dist/esm/chunks/chunk.YG2UMTJN.js.map +7 -0
  76. package/dist/esm/color-picker/index.js +1 -1
  77. package/dist/esm/core/index.js +1 -1
  78. package/dist/esm/date-picker/index.js +1 -1
  79. package/dist/esm/date-range-picker/index.js +1 -1
  80. package/dist/esm/expansion-panel/index.js +1 -1
  81. package/dist/esm/file-picker/index.js +1 -1
  82. package/dist/esm/floating-label/index.js +1 -1
  83. package/dist/esm/icon/index.js +1 -1
  84. package/dist/esm/icon-button/index.js +1 -1
  85. package/dist/esm/index.js +1 -1
  86. package/dist/esm/list-dropdown/index.js +1 -1
  87. package/dist/esm/menu/index.js +1 -1
  88. package/dist/esm/open-icon/index.js +1 -1
  89. package/dist/esm/paginator/index.js +1 -1
  90. package/dist/esm/profile-card/index.js +1 -1
  91. package/dist/esm/quantity-field/index.js +1 -1
  92. package/dist/esm/select/core/index.js +1 -1
  93. package/dist/esm/select/index.js +1 -1
  94. package/dist/esm/select/select/index.js +1 -1
  95. package/dist/esm/select/select-dropdown/index.js +1 -1
  96. package/dist/esm/slider/index.js +1 -1
  97. package/dist/esm/split-view/index.js +1 -1
  98. package/dist/esm/split-view/split-view/index.js +1 -1
  99. package/dist/esm/split-view/split-view-panel/index.js +1 -1
  100. package/dist/esm/stepper/index.js +1 -1
  101. package/dist/esm/stepper/step/index.js +1 -1
  102. package/dist/esm/stepper/stepper/index.js +1 -1
  103. package/dist/esm/switch/index.js +1 -1
  104. package/dist/esm/table/index.js +1 -1
  105. package/dist/esm/tabs/index.js +1 -1
  106. package/dist/esm/tabs/tab-bar/index.js +1 -1
  107. package/dist/esm/text-field/index.js +1 -1
  108. package/dist/esm/time-picker/index.js +1 -1
  109. package/dist/esm/toast/index.js +1 -1
  110. package/esm/button-area/button-area-adapter.d.ts +45 -0
  111. package/esm/button-area/button-area-adapter.js +106 -0
  112. package/esm/button-area/button-area-constants.d.ts +24 -0
  113. package/esm/button-area/button-area-constants.js +30 -0
  114. package/esm/button-area/button-area-foundation.d.ts +29 -0
  115. package/esm/button-area/button-area-foundation.js +93 -0
  116. package/esm/button-area/button-area.d.ts +24 -0
  117. package/esm/button-area/button-area.js +50 -0
  118. package/esm/button-area/index.d.ts +10 -0
  119. package/esm/button-area/index.js +14 -0
  120. package/esm/expansion-panel/expansion-panel-adapter.d.ts +1 -0
  121. package/esm/expansion-panel/expansion-panel-adapter.js +7 -2
  122. package/esm/field/field-foundation.d.ts +1 -0
  123. package/esm/field/field-foundation.js +17 -7
  124. package/esm/floating-label/floating-label-foundation.d.ts +4 -1
  125. package/esm/floating-label/floating-label-foundation.js +9 -6
  126. package/esm/floating-label/floating-label.d.ts +6 -2
  127. package/esm/floating-label/floating-label.js +2 -2
  128. package/esm/icon/icon-adapter.d.ts +0 -2
  129. package/esm/icon/icon-adapter.js +4 -5
  130. package/esm/icon/icon-foundation.js +0 -1
  131. package/esm/index.d.ts +1 -0
  132. package/esm/index.js +3 -0
  133. package/esm/paginator/paginator-adapter.d.ts +28 -24
  134. package/esm/paginator/paginator-adapter.js +55 -0
  135. package/esm/paginator/paginator-foundation.d.ts +33 -80
  136. package/esm/paginator/paginator-foundation.js +218 -255
  137. package/esm/paginator/paginator.d.ts +0 -2
  138. package/esm/paginator/paginator.js +0 -2
  139. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  140. package/package.json +1 -1
  141. package/styles/button-area/_mixins.scss +47 -0
  142. package/styles/button-area/button-area.scss +16 -0
  143. package/dist/esm/chunks/chunk.AMWDVFAU.js +0 -7
  144. package/dist/esm/chunks/chunk.AMWDVFAU.js.map +0 -7
  145. package/dist/esm/chunks/chunk.K4SWLH26.js +0 -7
  146. package/dist/esm/chunks/chunk.KIBLZSFZ.js +0 -7
  147. package/dist/esm/chunks/chunk.KIBLZSFZ.js.map +0 -7
  148. package/dist/esm/chunks/chunk.MCIDFQOG.js +0 -12
  149. package/dist/esm/chunks/chunk.MCIDFQOG.js.map +0 -7
  150. package/dist/esm/chunks/chunk.S2YVOMLW.js +0 -7
  151. package/dist/esm/chunks/chunk.S2YVOMLW.js.map +0 -7
  152. package/dist/esm/chunks/chunk.USXO7YKN.js +0 -7
  153. package/dist/esm/chunks/chunk.USXO7YKN.js.map +0 -7
  154. /package/dist/esm/chunks/{chunk.HHDEJSOK.js.map → chunk.23QPY6PU.js.map} +0 -0
  155. /package/dist/esm/chunks/{chunk.6BTPAMJ7.js.map → chunk.2EAQ36QO.js.map} +0 -0
  156. /package/dist/esm/chunks/{chunk.OYIW3AI6.js.map → chunk.3NHRJPT4.js.map} +0 -0
  157. /package/dist/esm/chunks/{chunk.UW2HWAVL.js.map → chunk.42QTJZSF.js.map} +0 -0
  158. /package/dist/esm/chunks/{chunk.QJ7LOIUK.js.map → chunk.54KXJVRY.js.map} +0 -0
  159. /package/dist/esm/chunks/{chunk.T6NVM7TN.js.map → chunk.67G7HT5S.js.map} +0 -0
  160. /package/dist/esm/chunks/{chunk.YMBLWKRP.js.map → chunk.7IHNVPY5.js.map} +0 -0
  161. /package/dist/esm/chunks/{chunk.XFAOB6LU.js.map → chunk.7NHFZL6J.js.map} +0 -0
  162. /package/dist/esm/chunks/{chunk.SATUJNQX.js.map → chunk.AD4NVLFA.js.map} +0 -0
  163. /package/dist/esm/chunks/{chunk.D24CE6KE.js.map → chunk.AZFF62ZK.js.map} +0 -0
  164. /package/dist/esm/chunks/{chunk.JPVIN4NH.js.map → chunk.BJRQ67AD.js.map} +0 -0
  165. /package/dist/esm/chunks/{chunk.Y7N4KA4U.js.map → chunk.D43PPRFO.js.map} +0 -0
  166. /package/dist/esm/chunks/{chunk.FBHCNPUL.js.map → chunk.GEWDZDXN.js.map} +0 -0
  167. /package/dist/esm/chunks/{chunk.WVRUVLT4.js.map → chunk.GSFM6MH4.js.map} +0 -0
  168. /package/dist/esm/chunks/{chunk.MSFGXRCM.js.map → chunk.IV2GMOPB.js.map} +0 -0
  169. /package/dist/esm/chunks/{chunk.HTH3CEDN.js.map → chunk.J2PHUKSR.js.map} +0 -0
  170. /package/dist/esm/chunks/{chunk.BKNYDA4V.js.map → chunk.JCDIPDQR.js.map} +0 -0
  171. /package/dist/esm/chunks/{chunk.RGAPFLQE.js.map → chunk.JMRXBELV.js.map} +0 -0
  172. /package/dist/esm/chunks/{chunk.WRV4KYM5.js.map → chunk.JOLJ7WVN.js.map} +0 -0
  173. /package/dist/esm/chunks/{chunk.FOLQAW63.js.map → chunk.K55FBLTW.js.map} +0 -0
  174. /package/dist/esm/chunks/{chunk.XNCXVZJA.js.map → chunk.KNVCEYY2.js.map} +0 -0
  175. /package/dist/esm/chunks/{chunk.L4CNH27W.js.map → chunk.MXVJSEF3.js.map} +0 -0
  176. /package/dist/esm/chunks/{chunk.SQTM36C3.js.map → chunk.N6XHXCZE.js.map} +0 -0
  177. /package/dist/esm/chunks/{chunk.JDLEPQKN.js.map → chunk.OEZZ2NEY.js.map} +0 -0
  178. /package/dist/esm/chunks/{chunk.Z7KJ4SA5.js.map → chunk.P67RC5S3.js.map} +0 -0
  179. /package/dist/esm/chunks/{chunk.BKAZC53W.js.map → chunk.PILDKQOE.js.map} +0 -0
  180. /package/dist/esm/chunks/{chunk.CR2XZYFM.js.map → chunk.QZ2NXIGY.js.map} +0 -0
  181. /package/dist/esm/chunks/{chunk.CG5CVENX.js.map → chunk.RLWX5BFQ.js.map} +0 -0
  182. /package/dist/esm/chunks/{chunk.ZPWB74RA.js.map → chunk.ROWBKHIO.js.map} +0 -0
  183. /package/dist/esm/chunks/{chunk.274MFEUZ.js.map → chunk.SFTWKDQV.js.map} +0 -0
  184. /package/dist/esm/chunks/{chunk.Q5YD3PKM.js.map → chunk.TH7RLTJK.js.map} +0 -0
  185. /package/dist/esm/chunks/{chunk.K6LBO4KJ.js.map → chunk.UVL4TIK2.js.map} +0 -0
  186. /package/dist/esm/chunks/{chunk.H5XOBZLW.js.map → chunk.WOTVTBJS.js.map} +0 -0
  187. /package/dist/esm/chunks/{chunk.RW6UJSE4.js.map → chunk.WPJEXVHM.js.map} +0 -0
  188. /package/dist/esm/chunks/{chunk.AMES2WWC.js.map → chunk.XAPKK4ZJ.js.map} +0 -0
  189. /package/dist/esm/chunks/{chunk.NX4EECNP.js.map → chunk.XTMXGKUO.js.map} +0 -0
  190. /package/dist/esm/chunks/{chunk.2DAPNN6B.js.map → chunk.Y2I2VRMF.js.map} +0 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { addClass, getShadowElement, removeClass, toggleClass } from '@tylertech/forge-core';
7
+ import { BaseAdapter, userInteractionListener } from '../core';
8
+ import { ForgeRipple, ForgeRippleFoundation } from '../ripple';
9
+ import { BUTTON_AREA_CONSTANTS } from './button-area-constants';
10
+ export class ButtonAreaAdapter extends BaseAdapter {
11
+ constructor(component) {
12
+ super(component);
13
+ this._rootElement = getShadowElement(component, BUTTON_AREA_CONSTANTS.selectors.ROOT);
14
+ this._buttonSlotElement = getShadowElement(component, BUTTON_AREA_CONSTANTS.selectors.BUTTON_SLOT);
15
+ }
16
+ get root() {
17
+ return this._rootElement;
18
+ }
19
+ get unbounded() {
20
+ return false;
21
+ }
22
+ get disabled() {
23
+ return this.buttonIsDisabled();
24
+ }
25
+ setDisabled(value) {
26
+ var _a;
27
+ toggleClass(this._rootElement, value, BUTTON_AREA_CONSTANTS.classes.DISABLED);
28
+ (_a = this._buttonElement) === null || _a === void 0 ? void 0 : _a.toggleAttribute(BUTTON_AREA_CONSTANTS.attributes.DISABLED, value);
29
+ }
30
+ addListener(type, listener) {
31
+ this._rootElement.addEventListener(type, listener);
32
+ }
33
+ removeListener(type, listener) {
34
+ this._rootElement.removeEventListener(type, listener);
35
+ }
36
+ addSlotChangeListener(listener) {
37
+ this._buttonSlotElement.addEventListener('slotchange', listener);
38
+ }
39
+ removeSlotChangeListener(listener) {
40
+ this._buttonSlotElement.removeEventListener('slotchange', listener);
41
+ }
42
+ startButtonObserver(callback) {
43
+ if (this._buttonElement) {
44
+ this._buttonObserver = new MutationObserver(callback);
45
+ this._buttonObserver.observe(this._buttonElement, { attributeFilter: [BUTTON_AREA_CONSTANTS.attributes.DISABLED] });
46
+ }
47
+ }
48
+ stopButtonObserver() {
49
+ if (this._buttonObserver) {
50
+ this._buttonObserver.disconnect();
51
+ this._buttonObserver = undefined;
52
+ }
53
+ }
54
+ detectSlottedButton() {
55
+ this._buttonElement = this._buttonSlotElement.assignedElements()[0];
56
+ }
57
+ buttonIsDisabled() {
58
+ var _a, _b;
59
+ return (_b = (_a = this._buttonElement) === null || _a === void 0 ? void 0 : _a.disabled) !== null && _b !== void 0 ? _b : true;
60
+ }
61
+ requestDisabledButtonFrame() {
62
+ if (this._buttonElement) {
63
+ this._buttonElement.disabled = true;
64
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65
+ requestAnimationFrame(() => this._buttonElement.disabled = false);
66
+ }
67
+ }
68
+ async createRipple() {
69
+ if (!this._rippleInstance) {
70
+ const type = await this._userInteractionListener();
71
+ if (!this._rippleInstance) {
72
+ const adapter = Object.assign(Object.assign({}, ForgeRipple.createAdapter(this)), { isSurfaceActive: () => { var _a, _b; return this._rootElement.matches(':active') || ((_b = (_a = this._buttonElement) === null || _a === void 0 ? void 0 : _a.matches(':active')) !== null && _b !== void 0 ? _b : false); }, isSurfaceDisabled: () => { var _a; return (_a = this.disabled) !== null && _a !== void 0 ? _a : true; }, isUnbounded: () => !!this.unbounded, registerInteractionHandler: (evtType, handler) => {
73
+ var _a;
74
+ if (this._isRootEvent(evtType)) {
75
+ this._rootElement.addEventListener(evtType, handler, { passive: true });
76
+ }
77
+ else {
78
+ (_a = this._buttonElement) === null || _a === void 0 ? void 0 : _a.addEventListener(evtType, handler, { passive: true });
79
+ }
80
+ }, deregisterInteractionHandler: (evtType, handler) => {
81
+ var _a;
82
+ if (this._isRootEvent(evtType)) {
83
+ this._rootElement.removeEventListener(evtType, handler, { passive: true });
84
+ }
85
+ else {
86
+ (_a = this._buttonElement) === null || _a === void 0 ? void 0 : _a.removeEventListener(evtType, handler, { passive: true });
87
+ }
88
+ }, addClass: (className) => addClass(className, this._rootElement), removeClass: (className) => removeClass(className, this._rootElement), updateCssVariable: (varName, value) => this._rootElement.style.setProperty(varName, value) });
89
+ this._rippleInstance = new ForgeRipple(this._rootElement, new ForgeRippleFoundation(adapter));
90
+ if (type === 'focusin') {
91
+ this._rippleInstance.handleFocus();
92
+ }
93
+ }
94
+ }
95
+ else {
96
+ this._rippleInstance.destroy();
97
+ this._rippleInstance = undefined;
98
+ }
99
+ }
100
+ _userInteractionListener() {
101
+ return userInteractionListener(this._rootElement);
102
+ }
103
+ _isRootEvent(evtType) {
104
+ return ['touchstart', 'pointerdown', 'mousedown'].includes(evtType);
105
+ }
106
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ export declare const BUTTON_AREA_CONSTANTS: {
7
+ elementName: string;
8
+ attributes: {
9
+ DISABLED: string;
10
+ IGNORE: string;
11
+ IGNORE_ALT: string;
12
+ };
13
+ ids: {
14
+ ROOT: string;
15
+ BUTTON_SLOT: string;
16
+ };
17
+ classes: {
18
+ DISABLED: string;
19
+ };
20
+ selectors: {
21
+ ROOT: string;
22
+ BUTTON_SLOT: string;
23
+ };
24
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { COMPONENT_NAME_PREFIX } from '../constants';
7
+ const elementName = `${COMPONENT_NAME_PREFIX}button-area`;
8
+ const attributes = {
9
+ DISABLED: 'disabled',
10
+ IGNORE: 'data-forge-ignore',
11
+ IGNORE_ALT: 'forge-ignore'
12
+ };
13
+ const ids = {
14
+ ROOT: 'root',
15
+ BUTTON_SLOT: 'button'
16
+ };
17
+ const classes = {
18
+ DISABLED: `forge-button-area--disabled`
19
+ };
20
+ const selectors = {
21
+ ROOT: `#${ids.ROOT}`,
22
+ BUTTON_SLOT: `slot[name=button]`
23
+ };
24
+ export const BUTTON_AREA_CONSTANTS = {
25
+ elementName,
26
+ attributes,
27
+ ids,
28
+ classes,
29
+ selectors
30
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { ICustomElementFoundation } from '@tylertech/forge-core';
7
+ import { IButtonAreaAdapter } from './button-area-adapter';
8
+ export interface IButtonAreaFoundation extends ICustomElementFoundation {
9
+ disabled: boolean;
10
+ }
11
+ export declare class ButtonAreaFoundation implements IButtonAreaFoundation {
12
+ private _adapter;
13
+ private _disabled;
14
+ private _clickListener;
15
+ private _keydownListener;
16
+ private _pointerdownListener;
17
+ private _slotListener;
18
+ constructor(_adapter: IButtonAreaAdapter);
19
+ initialize(): void;
20
+ disconnect(): void;
21
+ private _handleClick;
22
+ private _handleKeydown;
23
+ private _handlePointerdown;
24
+ private _handleSlotChange;
25
+ private _handleButtonDisabled;
26
+ private _shouldIgnoreEvent;
27
+ get disabled(): boolean;
28
+ set disabled(value: boolean);
29
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { getEventPath } from '@tylertech/forge-core';
7
+ import { BUTTON_AREA_CONSTANTS } from './button-area-constants';
8
+ export class ButtonAreaFoundation {
9
+ constructor(_adapter) {
10
+ this._adapter = _adapter;
11
+ this._disabled = false;
12
+ this._clickListener = event => this._handleClick(event);
13
+ this._keydownListener = event => this._handleKeydown(event);
14
+ this._pointerdownListener = event => this._handlePointerdown(event);
15
+ this._slotListener = () => this._handleSlotChange();
16
+ }
17
+ initialize() {
18
+ this._adapter.addListener('click', this._clickListener);
19
+ this._adapter.addListener('keydown', this._keydownListener);
20
+ this._adapter.addListener('pointerdown', this._pointerdownListener);
21
+ this._adapter.addSlotChangeListener(this._slotListener);
22
+ this._adapter.createRipple();
23
+ }
24
+ disconnect() {
25
+ this._adapter.removeListener('click', this._clickListener);
26
+ this._adapter.removeSlotChangeListener(this._slotListener);
27
+ this._adapter.stopButtonObserver();
28
+ }
29
+ _handleClick(event) {
30
+ var _a;
31
+ // Prevent the click if disabled
32
+ if (this._disabled) {
33
+ event.stopPropagation();
34
+ }
35
+ // Prevent the click if a selection was made
36
+ const selectionType = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.type;
37
+ if (selectionType === 'Range') {
38
+ event.stopPropagation();
39
+ }
40
+ // Prevent the click if it originates from an ignored element
41
+ if (this._shouldIgnoreEvent(event)) {
42
+ event.stopPropagation();
43
+ }
44
+ }
45
+ _handleKeydown(event) {
46
+ if (event.key !== ' ' && event.key !== 'Enter') {
47
+ return;
48
+ }
49
+ // Prevent the keydown if it originates from an ignored element
50
+ if (this._shouldIgnoreEvent(event)) {
51
+ event.stopPropagation();
52
+ }
53
+ }
54
+ _handlePointerdown(event) {
55
+ if (this._disabled) {
56
+ return;
57
+ }
58
+ // Prevent the ripple animation when ignored children are clicked
59
+ if (this._shouldIgnoreEvent(event)) {
60
+ this._adapter.requestDisabledButtonFrame();
61
+ }
62
+ }
63
+ _handleSlotChange() {
64
+ // Clear old button-connected listeners
65
+ this._adapter.stopButtonObserver();
66
+ this._adapter.detectSlottedButton();
67
+ this._adapter.startButtonObserver(() => this._handleButtonDisabled());
68
+ // Match the component and button states if either is disabled
69
+ if (this._adapter.buttonIsDisabled()) {
70
+ this.disabled = true;
71
+ }
72
+ else if (this._disabled) {
73
+ this._adapter.setDisabled(true);
74
+ }
75
+ }
76
+ _handleButtonDisabled() {
77
+ this.disabled = this._adapter.buttonIsDisabled();
78
+ }
79
+ _shouldIgnoreEvent(event) {
80
+ const eventPath = getEventPath(event);
81
+ return eventPath.some(el => el.nodeType === 1 && (el.hasAttribute(BUTTON_AREA_CONSTANTS.attributes.IGNORE) || el.hasAttribute(BUTTON_AREA_CONSTANTS.attributes.IGNORE_ALT)));
82
+ }
83
+ get disabled() {
84
+ return this._disabled;
85
+ }
86
+ set disabled(value) {
87
+ if (this._disabled !== value) {
88
+ this._disabled = value;
89
+ this._adapter.setDisabled(this._disabled);
90
+ this._adapter.toggleHostAttribute(BUTTON_AREA_CONSTANTS.attributes.DISABLED, this._disabled);
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { ICustomElement } from '@tylertech/forge-core';
7
+ export interface IButtonAreaComponent extends ICustomElement {
8
+ disabled: boolean;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'forge-button-area': IButtonAreaComponent;
13
+ }
14
+ }
15
+ export declare class ButtonAreaComponent extends HTMLElement implements IButtonAreaComponent {
16
+ static get observedAttributes(): string[];
17
+ private _foundation;
18
+ constructor();
19
+ connectedCallback(): void;
20
+ disconnectedCallback(): void;
21
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
22
+ /** Controls whether the component and associated button element are disabled. */
23
+ disabled: boolean;
24
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { CustomElement, attachShadowTemplate, FoundationProperty, coerceBoolean } from '@tylertech/forge-core';
8
+ import { ButtonAreaAdapter } from './button-area-adapter';
9
+ import { ButtonAreaFoundation } from './button-area-foundation';
10
+ import { BUTTON_AREA_CONSTANTS } from './button-area-constants';
11
+ import { RippleComponent } from '../ripple';
12
+ const template = '<template><div class=\"forge-button-area\" id=\"root\" part=\"root\"><div class=\"forge-button-area__button\" id=\"button\" part=\"button\"><slot name=\"button\"></slot></div><slot></slot></div></template>';
13
+ const styles = '@-webkit-keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(0.4,0,0.2,1);animation-timing-function:cubic-bezier(0.4,0,0.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}@keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(0.4,0,0.2,1);animation-timing-function:cubic-bezier(0.4,0,0.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}@-webkit-keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@-webkit-keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}@keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:transparent;will-change:transform,opacity;position:relative;outline:0;overflow:hidden}.mdc-ripple-surface::after,.mdc-ripple-surface::before{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-ripple-surface::before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index,1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index,0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{-webkit-animation:mdc-ripple-fg-opacity-out 150ms;animation:mdc-ripple-fg-opacity-out 150ms;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}.mdc-ripple-surface::after,.mdc-ripple-surface::before{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-upgraded--unbounded::after,.mdc-ripple-upgraded--unbounded::before{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before{top:var(--mdc-ripple-top,calc(50% - 50%));left:var(--mdc-ripple-left,calc(50% - 50%));width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.mdc-ripple-surface::after,.mdc-ripple-surface::before{background-color:#000;background-color:var(--mdc-ripple-color,#000)}.mdc-ripple-surface.mdc-ripple-surface--hover::before,.mdc-ripple-surface:hover::before{opacity:.04;opacity:var(--mdc-ripple-hover-opacity, .04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-focus-opacity, .12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{-webkit-transition:opacity 150ms linear;transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-press-opacity, .12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface::after,.mdc-ripple-surface::before{--mdc-ripple-color:var(--mdc-theme-on-surface)}.forge-button-area{overflow:hidden}.forge-button-area:not(.forge-button-area--disabled).forge-button-area{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:transparent;will-change:transform,opacity;cursor:pointer}.forge-button-area:not(.forge-button-area--disabled).forge-button-area::after,.forge-button-area:not(.forge-button-area--disabled).forge-button-area::before{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.forge-button-area:not(.forge-button-area--disabled).forge-button-area::before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index,1)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area::after{z-index:0;z-index:var(--mdc-ripple-z-index,0)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded::after{top:0;left:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;transform-origin:center center}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded--foreground-activation::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded--foreground-deactivation::after{-webkit-animation:mdc-ripple-fg-opacity-out 150ms;animation:mdc-ripple-fg-opacity-out 150ms;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}.forge-button-area:not(.forge-button-area--disabled).forge-button-area::after,.forge-button-area:not(.forge-button-area--disabled).forge-button-area::before{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area::after,.forge-button-area:not(.forge-button-area--disabled).forge-button-area::before{background-color:#6200ee;background-color:var(--mdc-ripple-color,var(--mdc-theme-primary,#6200ee))}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-surface--hover::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area:hover::before{opacity:.04;opacity:var(--mdc-ripple-hover-opacity, .04)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded--background-focused::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area:not(.mdc-ripple-upgraded):focus::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-focus-opacity, .12)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area:not(.mdc-ripple-upgraded)::after{-webkit-transition:opacity 150ms linear;transition:opacity 150ms linear}.forge-button-area:not(.forge-button-area--disabled).forge-button-area:not(.mdc-ripple-upgraded):active::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12;opacity:var(--mdc-ripple-press-opacity, .12)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated::before{opacity:.12;opacity:var(--mdc-ripple-activated-opacity, .12)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated::after,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated::before{background-color:#6200ee;background-color:var(--mdc-ripple-color,var(--mdc-theme-primary,#6200ee))}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated.mdc-ripple-surface--hover::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated:hover::before{opacity:.16;opacity:var(--mdc-ripple-hover-opacity, .16)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated.mdc-ripple-upgraded--background-focused::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated:not(.mdc-ripple-upgraded):focus::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24;opacity:var(--mdc-ripple-focus-opacity, .24)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated:not(.mdc-ripple-upgraded)::after{-webkit-transition:opacity 150ms linear;transition:opacity 150ms linear}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated:not(.mdc-ripple-upgraded):active::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.24;opacity:var(--mdc-ripple-press-opacity, .24)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected::before{opacity:.08;opacity:var(--mdc-ripple-selected-opacity, .08)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected::after,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected::before{background-color:#6200ee;background-color:var(--mdc-ripple-color,var(--mdc-theme-primary,#6200ee))}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected.mdc-ripple-surface--hover::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected:hover::before{opacity:.12;opacity:var(--mdc-ripple-hover-opacity, .12)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected.mdc-ripple-upgraded--background-focused::before,.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected:not(.mdc-ripple-upgraded):focus::before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.2;opacity:var(--mdc-ripple-focus-opacity, .2)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected:not(.mdc-ripple-upgraded)::after{-webkit-transition:opacity 150ms linear;transition:opacity 150ms linear}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected:not(.mdc-ripple-upgraded):active::after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.2;opacity:var(--mdc-ripple-press-opacity, .2)}.forge-button-area:not(.forge-button-area--disabled).forge-button-area--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.forge-button-area__button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}:host{display:block}:host([hidden]){display:none}';
14
+ let ButtonAreaComponent = class ButtonAreaComponent extends HTMLElement {
15
+ constructor() {
16
+ super();
17
+ attachShadowTemplate(this, template, styles);
18
+ this._foundation = new ButtonAreaFoundation(new ButtonAreaAdapter(this));
19
+ }
20
+ static get observedAttributes() {
21
+ return [
22
+ BUTTON_AREA_CONSTANTS.attributes.DISABLED
23
+ ];
24
+ }
25
+ connectedCallback() {
26
+ this._foundation.initialize();
27
+ }
28
+ disconnectedCallback() {
29
+ this._foundation.disconnect();
30
+ }
31
+ attributeChangedCallback(name, oldValue, newValue) {
32
+ switch (name) {
33
+ case BUTTON_AREA_CONSTANTS.attributes.DISABLED:
34
+ this.disabled = coerceBoolean(newValue);
35
+ break;
36
+ }
37
+ }
38
+ };
39
+ __decorate([
40
+ FoundationProperty()
41
+ ], ButtonAreaComponent.prototype, "disabled", void 0);
42
+ ButtonAreaComponent = __decorate([
43
+ CustomElement({
44
+ name: BUTTON_AREA_CONSTANTS.elementName,
45
+ dependencies: [
46
+ RippleComponent
47
+ ]
48
+ })
49
+ ], ButtonAreaComponent);
50
+ export { ButtonAreaComponent };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ export * from './button-area-adapter';
7
+ export * from './button-area-constants';
8
+ export * from './button-area-foundation';
9
+ export * from './button-area';
10
+ export declare function defineButtonAreaComponent(): void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { defineCustomElement } from '@tylertech/forge-core';
7
+ import { ButtonAreaComponent } from './button-area';
8
+ export * from './button-area-adapter';
9
+ export * from './button-area-constants';
10
+ export * from './button-area-foundation';
11
+ export * from './button-area';
12
+ export function defineButtonAreaComponent() {
13
+ defineCustomElement(ButtonAreaComponent);
14
+ }
@@ -20,6 +20,7 @@ export declare class ExpansionPanelAdapter extends BaseAdapter<IExpansionPanelCo
20
20
  private _headerElement;
21
21
  private _contentElement;
22
22
  private _headerSlotElement;
23
+ private _activeAnimationFrame;
23
24
  constructor(component: IExpansionPanelComponent);
24
25
  initialize(open: boolean, orientation?: string): void;
25
26
  setHeaderVisibility(visible: boolean): void;
@@ -98,8 +98,9 @@ export class ExpansionPanelAdapter extends BaseAdapter {
98
98
  else {
99
99
  this._contentElement.style.transition = EXPANSION_PANEL_CONSTANTS.strings.EXPANSION_VERTICAL_TRANSITION;
100
100
  }
101
- window.requestAnimationFrame(() => {
102
- window.requestAnimationFrame(() => {
101
+ this._activeAnimationFrame = window.requestAnimationFrame(() => {
102
+ this._activeAnimationFrame = window.requestAnimationFrame(() => {
103
+ this._activeAnimationFrame = undefined;
103
104
  if (opening) {
104
105
  if (orientation === EXPANSION_PANEL_CONSTANTS.strings.ORIENTATION_HORIZONTAL) {
105
106
  this._contentElement.style.width = `${this._contentElement.scrollWidth}px`;
@@ -130,6 +131,10 @@ export class ExpansionPanelAdapter extends BaseAdapter {
130
131
  });
131
132
  }
132
133
  else {
134
+ if (this._activeAnimationFrame) {
135
+ window.cancelAnimationFrame(this._activeAnimationFrame);
136
+ this._activeAnimationFrame = undefined;
137
+ }
133
138
  this._contentElement.style.removeProperty('transition');
134
139
  if (opening) {
135
140
  if (orientation === EXPANSION_PANEL_CONSTANTS.strings.ORIENTATION_HORIZONTAL) {
@@ -51,6 +51,7 @@ export declare class FieldFoundation {
51
51
  protected _onTrailingSlotChanged(evt: Event): void;
52
52
  protected _onAddonEndSlotChanged(evt: Event): void;
53
53
  protected _initializeLabel(): void;
54
+ private _destroyFloatingLabel;
54
55
  protected _detectLeadingContent(): void;
55
56
  protected _detectTrailingContent(): void;
56
57
  protected _detectAddonEndContent(): void;
@@ -85,10 +85,16 @@ export class FieldFoundation {
85
85
  }
86
86
  set density(value) {
87
87
  if (this._density !== value) {
88
+ const prevDensity = this._density;
88
89
  this._density = value;
89
90
  if (this._isInitialized) {
90
91
  this._applyDensity();
91
- this._initializeLabel();
92
+ if (this._density === 'dense') {
93
+ this._destroyFloatingLabel({ cancelFloat: true });
94
+ }
95
+ else if (prevDensity === 'dense') {
96
+ this._initializeLabel();
97
+ }
92
98
  }
93
99
  this._adapter.setHostAttribute(FIELD_CONSTANTS.attributes.DENSITY, this._density.toString());
94
100
  }
@@ -186,9 +192,8 @@ export class FieldFoundation {
186
192
  this._detectAddonEndContent();
187
193
  }
188
194
  _initializeLabel() {
189
- if (this._floatingLabel) {
190
- this._floatingLabel.destroy();
191
- }
195
+ var _a;
196
+ (_a = this._floatingLabel) === null || _a === void 0 ? void 0 : _a.destroy();
192
197
  this._adapter.detectLabel();
193
198
  if (this._adapter.hasLabel() && this._density !== 'dense') {
194
199
  this._floatingLabel = this._adapter.initializeFloatingLabel();
@@ -197,11 +202,16 @@ export class FieldFoundation {
197
202
  this._adapter.setRootClass(FIELD_CONSTANTS.classes.LABEL);
198
203
  }
199
204
  else {
200
- this._adapter.removeHostAttribute(FIELD_CONSTANTS.attributes.HOST_LABEL_FLOATING);
201
- this._adapter.removeRootClass(FIELD_CONSTANTS.classes.LABEL);
202
- this._floatingLabel = undefined;
205
+ this._destroyFloatingLabel();
203
206
  }
204
207
  }
208
+ _destroyFloatingLabel({ cancelFloat = false } = {}) {
209
+ var _a;
210
+ this._adapter.removeHostAttribute(FIELD_CONSTANTS.attributes.HOST_LABEL_FLOATING);
211
+ this._adapter.removeRootClass(FIELD_CONSTANTS.classes.LABEL);
212
+ (_a = this._floatingLabel) === null || _a === void 0 ? void 0 : _a.destroy({ cancelFloat });
213
+ this._floatingLabel = undefined;
214
+ }
205
215
  _detectLeadingContent() {
206
216
  if (this._adapter.hasLeadingNodes()) {
207
217
  this._adapter.setRootClass(FIELD_CONSTANTS.classes.LEADING);
@@ -7,9 +7,12 @@ import { IFloatingLabelAdapter } from './floating-label-adapter';
7
7
  export declare class FloatingLabelFoundation {
8
8
  protected _adapter: IFloatingLabelAdapter;
9
9
  private _floatAnimationEndHandler;
10
+ private _activeFrame;
10
11
  constructor(_adapter: IFloatingLabelAdapter);
11
12
  initialize(): void;
12
- disconnect(): void;
13
+ disconnect({ cancelFloat }?: {
14
+ cancelFloat?: boolean | undefined;
15
+ }): void;
13
16
  float(shouldFloat: boolean, alwaysFloat?: boolean): void;
14
17
  getWidth(): number;
15
18
  get isFloating(): boolean;
@@ -18,7 +18,10 @@ export class FloatingLabelFoundation {
18
18
  this._adapter.addLabelListener('transitionend', this._floatAnimationEndHandler);
19
19
  }
20
20
  }
21
- disconnect() {
21
+ disconnect({ cancelFloat = false } = {}) {
22
+ if (cancelFloat && this._activeFrame) {
23
+ window.cancelAnimationFrame(this._activeFrame);
24
+ }
22
25
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOATING_LABEL);
23
26
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE);
24
27
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE_END_KEYFRAME);
@@ -32,9 +35,9 @@ export class FloatingLabelFoundation {
32
35
  if (this._adapter.hasLabelClass(FLOATING_LABEL_CONSTANTS.classes.UNFLOAT_ABOVE_START_KEYFRAME)) {
33
36
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.UNFLOAT_ABOVE_START_KEYFRAME);
34
37
  }
35
- requestAnimationFrame(() => {
36
- requestAnimationFrame(() => {
37
- if (alwaysFloat || this._adapter.hasLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE)) {
38
+ this._activeFrame = window.requestAnimationFrame(() => {
39
+ this._activeFrame = window.requestAnimationFrame(() => {
40
+ if (alwaysFloat || this.isFloating) {
38
41
  this._adapter.addLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE_END_KEYFRAME);
39
42
  }
40
43
  this._adapter.addLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE);
@@ -46,8 +49,8 @@ export class FloatingLabelFoundation {
46
49
  if (this._adapter.hasLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE_END_KEYFRAME)) {
47
50
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.FLOAT_ABOVE_END_KEYFRAME);
48
51
  this._adapter.addLabelClass(FLOATING_LABEL_CONSTANTS.classes.UNFLOAT_ABOVE_START_KEYFRAME);
49
- requestAnimationFrame(() => {
50
- requestAnimationFrame(() => {
52
+ this._activeFrame = window.requestAnimationFrame(() => {
53
+ this._activeFrame = window.requestAnimationFrame(() => {
51
54
  this._adapter.removeLabelClass(FLOATING_LABEL_CONSTANTS.classes.UNFLOAT_ABOVE_START_KEYFRAME);
52
55
  });
53
56
  });
@@ -7,7 +7,9 @@ export interface IFloatingLabel {
7
7
  isFloating: boolean;
8
8
  float(float: boolean, alwaysFloat?: boolean): void;
9
9
  getWidth(): number;
10
- destroy(): void;
10
+ destroy(opts?: {
11
+ cancelFloat?: boolean;
12
+ }): void;
11
13
  }
12
14
  export declare class FloatingLabel implements IFloatingLabel {
13
15
  private _labelElement;
@@ -15,7 +17,9 @@ export declare class FloatingLabel implements IFloatingLabel {
15
17
  constructor(_labelElement: HTMLLabelElement);
16
18
  /** Returns the current label floating state. */
17
19
  get isFloating(): boolean;
18
- destroy(): void;
20
+ destroy({ cancelFloat }?: {
21
+ cancelFloat?: boolean | undefined;
22
+ }): void;
19
23
  /**
20
24
  * Sets the floating state of the label element.
21
25
  * @param shouldFloat If true, sets the label to float, otherwise un-float.
@@ -15,8 +15,8 @@ export class FloatingLabel {
15
15
  get isFloating() {
16
16
  return this._foundation.isFloating;
17
17
  }
18
- destroy() {
19
- this._foundation.disconnect();
18
+ destroy({ cancelFloat = false } = {}) {
19
+ this._foundation.disconnect({ cancelFloat });
20
20
  this._labelElement = undefined;
21
21
  }
22
22
  /**
@@ -6,7 +6,6 @@
6
6
  import { IIconComponent } from './icon';
7
7
  import { BaseAdapter, IBaseAdapter } from '../core';
8
8
  export interface IIconAdapter extends IBaseAdapter {
9
- initialize(): void;
10
9
  canLazyLoad(): boolean;
11
10
  observeVisibility(listener: () => void): void;
12
11
  destroyVisibilityObserver(): void;
@@ -15,7 +14,6 @@ export interface IIconAdapter extends IBaseAdapter {
15
14
  export declare class IconAdapter extends BaseAdapter<IIconComponent> implements IIconAdapter {
16
15
  private _observer;
17
16
  constructor(component: IIconComponent);
18
- initialize(): void;
19
17
  canLazyLoad(): boolean;
20
18
  observeVisibility(listener: () => void): void;
21
19
  destroyVisibilityObserver(): void;
@@ -9,11 +9,6 @@ export class IconAdapter extends BaseAdapter {
9
9
  constructor(component) {
10
10
  super(component);
11
11
  }
12
- initialize() {
13
- if (!this._component.hasAttribute('aria-hidden')) {
14
- this._component.setAttribute('aria-hidden', 'true');
15
- }
16
- }
17
12
  canLazyLoad() {
18
13
  return !!window.IntersectionObserver;
19
14
  }
@@ -33,9 +28,13 @@ export class IconAdapter extends BaseAdapter {
33
28
  }
34
29
  }
35
30
  setContent(content) {
31
+ var _a;
36
32
  const shadowRoot = this._component.shadowRoot;
37
33
  const styleTag = shadowRoot.querySelector('style');
38
34
  shadowRoot.innerHTML = content;
35
+ if (content) {
36
+ (_a = shadowRoot.firstElementChild) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
37
+ }
39
38
  if (styleTag) {
40
39
  shadowRoot.appendChild(styleTag);
41
40
  }
@@ -13,7 +13,6 @@ export class IconFoundation {
13
13
  this._lazyListener = () => this._loadIcon();
14
14
  }
15
15
  initialize() {
16
- this._adapter.initialize();
17
16
  this._applyIcon();
18
17
  }
19
18
  disconnect() {
package/esm/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from './banner';
13
13
  export * from './bottom-sheet';
14
14
  export * from './busy-indicator';
15
15
  export * from './button';
16
+ export * from './button-area';
16
17
  export * from './button-toggle';
17
18
  export * from './calendar';
18
19
  export * from './card';