globuswebcomponents 2.18.5 → 2.18.8

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 (235) hide show
  1. package/dist/cjs/{gb-accordion-card_78.cjs.entry.js → gb-accordion-card_87.cjs.entry.js} +3803 -199
  2. package/dist/cjs/globuscomponents.cjs.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/reusableModels-_LRAKnsh.js.map +1 -1
  5. package/dist/collection/assets/icons/bookmark-03/bulk/rounded.svg +4 -0
  6. package/dist/collection/assets/icons/bookmark-03/duotone/rounded.svg +4 -0
  7. package/dist/collection/assets/icons/bookmark-03/solid/rounded.svg +3 -0
  8. package/dist/collection/assets/icons/bookmark-03/solid/sharp.svg +3 -0
  9. package/dist/collection/assets/icons/bookmark-03/stroke/rounded.svg +3 -0
  10. package/dist/collection/assets/icons/bookmark-03/stroke/sharp.svg +3 -0
  11. package/dist/collection/assets/icons/bookmark-03/two-tone/rounded.svg +4 -0
  12. package/dist/collection/assets/icons/bookmark-add-02/bulk/rounded.svg +4 -0
  13. package/dist/collection/assets/icons/bookmark-add-02/duotone/rounded.svg +4 -0
  14. package/dist/collection/assets/icons/bookmark-add-02/solid/rounded.svg +4 -0
  15. package/dist/collection/assets/icons/bookmark-add-02/solid/sharp.svg +4 -0
  16. package/dist/collection/assets/icons/bookmark-add-02/stroke/rounded.svg +3 -0
  17. package/dist/collection/assets/icons/bookmark-add-02/stroke/sharp.svg +3 -0
  18. package/dist/collection/assets/icons/bookmark-add-02/two-tone/rounded.svg +4 -0
  19. package/dist/collection/assets/icons/bookmark-block-02/bulk/rounded.svg +4 -0
  20. package/dist/collection/assets/icons/bookmark-block-02/duotone/rounded.svg +4 -0
  21. package/dist/collection/assets/icons/bookmark-block-02/solid/rounded.svg +4 -0
  22. package/dist/collection/assets/icons/bookmark-block-02/solid/sharp.svg +4 -0
  23. package/dist/collection/assets/icons/bookmark-block-02/stroke/rounded.svg +3 -0
  24. package/dist/collection/assets/icons/bookmark-block-02/stroke/sharp.svg +3 -0
  25. package/dist/collection/assets/icons/bookmark-block-02/two-tone/rounded.svg +4 -0
  26. package/dist/collection/assets/icons/bookmark-minus-02/bulk/rounded.svg +4 -0
  27. package/dist/collection/assets/icons/bookmark-minus-02/duotone/rounded.svg +4 -0
  28. package/dist/collection/assets/icons/bookmark-minus-02/solid/rounded.svg +4 -0
  29. package/dist/collection/assets/icons/bookmark-minus-02/solid/sharp.svg +4 -0
  30. package/dist/collection/assets/icons/bookmark-minus-02/stroke/rounded.svg +3 -0
  31. package/dist/collection/assets/icons/bookmark-minus-02/stroke/sharp.svg +3 -0
  32. package/dist/collection/assets/icons/bookmark-minus-02/two-tone/rounded.svg +4 -0
  33. package/dist/collection/assets/icons/bookmark-remove-02/bulk/rounded.svg +4 -0
  34. package/dist/collection/assets/icons/bookmark-remove-02/duotone/rounded.svg +4 -0
  35. package/dist/collection/assets/icons/bookmark-remove-02/solid/rounded.svg +4 -0
  36. package/dist/collection/assets/icons/bookmark-remove-02/solid/sharp.svg +4 -0
  37. package/dist/collection/assets/icons/bookmark-remove-02/stroke/rounded.svg +3 -0
  38. package/dist/collection/assets/icons/bookmark-remove-02/stroke/sharp.svg +3 -0
  39. package/dist/collection/assets/icons/bookmark-remove-02/two-tone/rounded.svg +4 -0
  40. package/dist/collection/assets/icons/collections-bookmark/bulk/rounded.svg +5 -0
  41. package/dist/collection/assets/icons/collections-bookmark/duotone/rounded.svg +4 -0
  42. package/dist/collection/assets/icons/collections-bookmark/solid/rounded.svg +4 -0
  43. package/dist/collection/assets/icons/collections-bookmark/solid/sharp.svg +4 -0
  44. package/dist/collection/assets/icons/collections-bookmark/stroke/rounded.svg +3 -0
  45. package/dist/collection/assets/icons/collections-bookmark/stroke/sharp.svg +3 -0
  46. package/dist/collection/assets/icons/collections-bookmark/two-tone/rounded.svg +4 -0
  47. package/dist/collection/assets/icons/favourite/bulk/rounded.svg +4 -0
  48. package/dist/collection/assets/icons/favourite/duotone/rounded.svg +4 -0
  49. package/dist/collection/assets/icons/favourite/solid/rounded.svg +3 -0
  50. package/dist/collection/assets/icons/favourite/solid/sharp.svg +3 -0
  51. package/dist/collection/assets/icons/favourite/stroke/rounded.svg +3 -0
  52. package/dist/collection/assets/icons/favourite/stroke/sharp.svg +3 -0
  53. package/dist/collection/assets/icons/favourite/two-tone/rounded.svg +4 -0
  54. package/dist/collection/assets/icons/favourite-square/bulk/rounded.svg +4 -0
  55. package/dist/collection/assets/icons/favourite-square/duotone/rounded.svg +5 -0
  56. package/dist/collection/assets/icons/favourite-square/solid/rounded.svg +3 -0
  57. package/dist/collection/assets/icons/favourite-square/solid/sharp.svg +3 -0
  58. package/dist/collection/assets/icons/favourite-square/stroke/rounded.svg +3 -0
  59. package/dist/collection/assets/icons/favourite-square/stroke/sharp.svg +3 -0
  60. package/dist/collection/assets/icons/favourite-square/two-tone/rounded.svg +4 -0
  61. package/dist/collection/components/gb-button/gb-button.js +96 -31
  62. package/dist/collection/components/gb-button/gb-button.js.map +1 -1
  63. package/dist/collection/components/gb-button/gb-button.tsx +29 -17
  64. package/dist/collection/components/gb-button/readme.md +6 -5
  65. package/dist/collection/components/gb-input-field/gb-input-field.css +5 -5
  66. package/dist/collection/components/gb-rich-text/gb-rich-text.css +30 -6
  67. package/dist/collection/components/gb-rich-text/gb-rich-text.js +4 -4
  68. package/dist/collection/components/gb-rich-text/gb-rich-text.js.map +1 -1
  69. package/dist/collection/components/gb-rich-text/resizable-image.js +84 -0
  70. package/dist/collection/components/gb-rich-text/resizable-image.js.map +1 -0
  71. package/dist/collection/components/gb-sidebar/gb-sidebar.js +62 -9
  72. package/dist/collection/components/gb-sidebar/gb-sidebar.js.map +1 -1
  73. package/dist/collection/components/gb-table/gb-table.css +1 -0
  74. package/dist/collection/components/gb-table/gb-table.js +25 -14
  75. package/dist/collection/components/gb-table/gb-table.js.map +1 -1
  76. package/dist/collection/models/reusableModels.js.map +1 -1
  77. package/dist/components/gb-action-panel.js +1 -1
  78. package/dist/components/gb-approval-modal.js +2 -2
  79. package/dist/components/gb-button.js +1 -1
  80. package/dist/components/gb-checkbox-group-item.js +1 -1
  81. package/dist/components/gb-checkbox-group.js +2 -2
  82. package/dist/components/gb-comment.js +1 -1
  83. package/dist/components/gb-date-picker.js +1 -1
  84. package/dist/components/gb-detail-cell.js +1 -1
  85. package/dist/components/gb-empty-state.js +1 -1
  86. package/dist/components/gb-file-upload-item-base.js +1 -1
  87. package/dist/components/gb-file-upload.js +2 -2
  88. package/dist/components/gb-filter-button.js +1 -1
  89. package/dist/components/gb-filter-modal.js +1 -1
  90. package/dist/components/gb-header.js +4 -4
  91. package/dist/components/gb-input-dropdown-test.js +3 -3
  92. package/dist/components/gb-input-dropdown.js +1 -1
  93. package/dist/components/gb-input-field.js +1 -1
  94. package/dist/components/gb-modal-action.js +1 -1
  95. package/dist/components/gb-modal.js +2 -2
  96. package/dist/components/gb-notification-pane.js +1 -1
  97. package/dist/components/gb-pagination.js +1 -1
  98. package/dist/components/gb-password-button.js +1 -1
  99. package/dist/components/gb-prompt-modal.js +1 -1
  100. package/dist/components/gb-rich-text.js +262 -179
  101. package/dist/components/gb-rich-text.js.map +1 -1
  102. package/dist/components/gb-sidebar.js +23 -9
  103. package/dist/components/gb-sidebar.js.map +1 -1
  104. package/dist/components/gb-table-header.js +1 -1
  105. package/dist/components/gb-table.js +1 -1
  106. package/dist/components/gb-toast.js +1 -1
  107. package/dist/components/gb-wysiwyg-toolbar.js +1 -1
  108. package/dist/components/{p-BI0Ex54P.js → p-2-ReMaeh.js} +3 -3
  109. package/dist/components/{p-BI0Ex54P.js.map → p-2-ReMaeh.js.map} +1 -1
  110. package/dist/components/{p-WXjkXlUF.js → p-5qmO-l_B.js} +3 -3
  111. package/dist/components/{p-WXjkXlUF.js.map → p-5qmO-l_B.js.map} +1 -1
  112. package/dist/components/{p-By402klS.js → p-BK5yReBS.js} +3 -3
  113. package/dist/components/{p-By402klS.js.map → p-BK5yReBS.js.map} +1 -1
  114. package/dist/components/{p-BD74vctU.js → p-BlXVy-Sk.js} +6 -6
  115. package/dist/components/{p-BD74vctU.js.map → p-BlXVy-Sk.js.map} +1 -1
  116. package/dist/components/{p-DHXR9Sxk.js → p-Bl_5_lD7.js} +3 -3
  117. package/dist/components/{p-DHXR9Sxk.js.map → p-Bl_5_lD7.js.map} +1 -1
  118. package/dist/components/{p-D1fnUzqW.js → p-BwGYY38l.js} +34 -15
  119. package/dist/components/p-BwGYY38l.js.map +1 -0
  120. package/dist/components/{p-CTisVkYS.js → p-C-g-JRze.js} +3 -3
  121. package/dist/components/{p-CTisVkYS.js.map → p-C-g-JRze.js.map} +1 -1
  122. package/dist/components/{p-q1BXlX2S.js → p-CE-hAyqa.js} +5 -5
  123. package/dist/components/p-CE-hAyqa.js.map +1 -0
  124. package/dist/components/{p-JNQBEWGY.js → p-CT9m_YAo.js} +5 -5
  125. package/dist/components/{p-JNQBEWGY.js.map → p-CT9m_YAo.js.map} +1 -1
  126. package/dist/components/{p-B2cesIns.js → p-CnyS0R-Z.js} +3 -3
  127. package/dist/components/{p-B2cesIns.js.map → p-CnyS0R-Z.js.map} +1 -1
  128. package/dist/components/{p-DYpvfQik.js → p-D-ksQb0i.js} +7 -7
  129. package/dist/components/{p-DYpvfQik.js.map → p-D-ksQb0i.js.map} +1 -1
  130. package/dist/components/{p-C2nwKlIB.js → p-D7yyPEXU.js} +6 -6
  131. package/dist/components/{p-C2nwKlIB.js.map → p-D7yyPEXU.js.map} +1 -1
  132. package/dist/components/{p-DIFK2uPX.js → p-D9K58rye.js} +3 -3
  133. package/dist/components/{p-DIFK2uPX.js.map → p-D9K58rye.js.map} +1 -1
  134. package/dist/components/{p-B-eg7Ble.js → p-DyUQxVF2.js} +3 -3
  135. package/dist/components/{p-B-eg7Ble.js.map → p-DyUQxVF2.js.map} +1 -1
  136. package/dist/components/{p-6aww0fa8.js → p-XLmf4Wa9.js} +4 -4
  137. package/dist/components/{p-6aww0fa8.js.map → p-XLmf4Wa9.js.map} +1 -1
  138. package/dist/components/p-cHn6O-Kf.js.map +1 -1
  139. package/dist/components/{p-DQyU_YBJ.js → p-kR-8qSSj.js} +39 -28
  140. package/dist/components/p-kR-8qSSj.js.map +1 -0
  141. package/dist/components/{p-jUlrLXgu.js → p-tlvcPh6E.js} +3 -3
  142. package/dist/components/{p-jUlrLXgu.js.map → p-tlvcPh6E.js.map} +1 -1
  143. package/dist/components/test-wrapper.js +12 -12
  144. package/dist/docs.json +209 -47
  145. package/dist/esm/{gb-accordion-card_78.entry.js → gb-accordion-card_87.entry.js} +3795 -200
  146. package/dist/esm/globuscomponents.js +1 -1
  147. package/dist/esm/loader.js +1 -1
  148. package/dist/esm/reusableModels-cHn6O-Kf.js.map +1 -1
  149. package/dist/globuscomponents/assets/icons/bookmark-03/bulk/rounded.svg +4 -0
  150. package/dist/globuscomponents/assets/icons/bookmark-03/duotone/rounded.svg +4 -0
  151. package/dist/globuscomponents/assets/icons/bookmark-03/solid/rounded.svg +3 -0
  152. package/dist/globuscomponents/assets/icons/bookmark-03/solid/sharp.svg +3 -0
  153. package/dist/globuscomponents/assets/icons/bookmark-03/stroke/rounded.svg +3 -0
  154. package/dist/globuscomponents/assets/icons/bookmark-03/stroke/sharp.svg +3 -0
  155. package/dist/globuscomponents/assets/icons/bookmark-03/two-tone/rounded.svg +4 -0
  156. package/dist/globuscomponents/assets/icons/bookmark-add-02/bulk/rounded.svg +4 -0
  157. package/dist/globuscomponents/assets/icons/bookmark-add-02/duotone/rounded.svg +4 -0
  158. package/dist/globuscomponents/assets/icons/bookmark-add-02/solid/rounded.svg +4 -0
  159. package/dist/globuscomponents/assets/icons/bookmark-add-02/solid/sharp.svg +4 -0
  160. package/dist/globuscomponents/assets/icons/bookmark-add-02/stroke/rounded.svg +3 -0
  161. package/dist/globuscomponents/assets/icons/bookmark-add-02/stroke/sharp.svg +3 -0
  162. package/dist/globuscomponents/assets/icons/bookmark-add-02/two-tone/rounded.svg +4 -0
  163. package/dist/globuscomponents/assets/icons/bookmark-block-02/bulk/rounded.svg +4 -0
  164. package/dist/globuscomponents/assets/icons/bookmark-block-02/duotone/rounded.svg +4 -0
  165. package/dist/globuscomponents/assets/icons/bookmark-block-02/solid/rounded.svg +4 -0
  166. package/dist/globuscomponents/assets/icons/bookmark-block-02/solid/sharp.svg +4 -0
  167. package/dist/globuscomponents/assets/icons/bookmark-block-02/stroke/rounded.svg +3 -0
  168. package/dist/globuscomponents/assets/icons/bookmark-block-02/stroke/sharp.svg +3 -0
  169. package/dist/globuscomponents/assets/icons/bookmark-block-02/two-tone/rounded.svg +4 -0
  170. package/dist/globuscomponents/assets/icons/bookmark-minus-02/bulk/rounded.svg +4 -0
  171. package/dist/globuscomponents/assets/icons/bookmark-minus-02/duotone/rounded.svg +4 -0
  172. package/dist/globuscomponents/assets/icons/bookmark-minus-02/solid/rounded.svg +4 -0
  173. package/dist/globuscomponents/assets/icons/bookmark-minus-02/solid/sharp.svg +4 -0
  174. package/dist/globuscomponents/assets/icons/bookmark-minus-02/stroke/rounded.svg +3 -0
  175. package/dist/globuscomponents/assets/icons/bookmark-minus-02/stroke/sharp.svg +3 -0
  176. package/dist/globuscomponents/assets/icons/bookmark-minus-02/two-tone/rounded.svg +4 -0
  177. package/dist/globuscomponents/assets/icons/bookmark-remove-02/bulk/rounded.svg +4 -0
  178. package/dist/globuscomponents/assets/icons/bookmark-remove-02/duotone/rounded.svg +4 -0
  179. package/dist/globuscomponents/assets/icons/bookmark-remove-02/solid/rounded.svg +4 -0
  180. package/dist/globuscomponents/assets/icons/bookmark-remove-02/solid/sharp.svg +4 -0
  181. package/dist/globuscomponents/assets/icons/bookmark-remove-02/stroke/rounded.svg +3 -0
  182. package/dist/globuscomponents/assets/icons/bookmark-remove-02/stroke/sharp.svg +3 -0
  183. package/dist/globuscomponents/assets/icons/bookmark-remove-02/two-tone/rounded.svg +4 -0
  184. package/dist/globuscomponents/assets/icons/collections-bookmark/bulk/rounded.svg +5 -0
  185. package/dist/globuscomponents/assets/icons/collections-bookmark/duotone/rounded.svg +4 -0
  186. package/dist/globuscomponents/assets/icons/collections-bookmark/solid/rounded.svg +4 -0
  187. package/dist/globuscomponents/assets/icons/collections-bookmark/solid/sharp.svg +4 -0
  188. package/dist/globuscomponents/assets/icons/collections-bookmark/stroke/rounded.svg +3 -0
  189. package/dist/globuscomponents/assets/icons/collections-bookmark/stroke/sharp.svg +3 -0
  190. package/dist/globuscomponents/assets/icons/collections-bookmark/two-tone/rounded.svg +4 -0
  191. package/dist/globuscomponents/assets/icons/favourite/bulk/rounded.svg +4 -0
  192. package/dist/globuscomponents/assets/icons/favourite/duotone/rounded.svg +4 -0
  193. package/dist/globuscomponents/assets/icons/favourite/solid/rounded.svg +3 -0
  194. package/dist/globuscomponents/assets/icons/favourite/solid/sharp.svg +3 -0
  195. package/dist/globuscomponents/assets/icons/favourite/stroke/rounded.svg +3 -0
  196. package/dist/globuscomponents/assets/icons/favourite/stroke/sharp.svg +3 -0
  197. package/dist/globuscomponents/assets/icons/favourite/two-tone/rounded.svg +4 -0
  198. package/dist/globuscomponents/assets/icons/favourite-square/bulk/rounded.svg +4 -0
  199. package/dist/globuscomponents/assets/icons/favourite-square/duotone/rounded.svg +5 -0
  200. package/dist/globuscomponents/assets/icons/favourite-square/solid/rounded.svg +3 -0
  201. package/dist/globuscomponents/assets/icons/favourite-square/solid/sharp.svg +3 -0
  202. package/dist/globuscomponents/assets/icons/favourite-square/stroke/rounded.svg +3 -0
  203. package/dist/globuscomponents/assets/icons/favourite-square/stroke/sharp.svg +3 -0
  204. package/dist/globuscomponents/assets/icons/favourite-square/two-tone/rounded.svg +4 -0
  205. package/dist/globuscomponents/gb-button.tsx +29 -17
  206. package/dist/globuscomponents/globuscomponents.esm.js +1 -1
  207. package/dist/globuscomponents/{p-9a44bc13.entry.js → p-6e89b968.entry.js} +2 -2
  208. package/dist/globuscomponents/p-6e89b968.entry.js.map +1 -0
  209. package/dist/globuscomponents/p-cHn6O-Kf.js.map +1 -1
  210. package/dist/globuscomponents/readme.md +6 -5
  211. package/dist/types/components/gb-button/gb-button.d.ts +9 -10
  212. package/dist/types/components/gb-rich-text/resizable-image.d.ts +1 -0
  213. package/dist/types/components/gb-sidebar/gb-sidebar.d.ts +3 -2
  214. package/dist/types/components/gb-table/gb-table.d.ts +1 -0
  215. package/dist/types/components.d.ts +44 -20
  216. package/dist/types/models/reusableModels.d.ts +1 -1
  217. package/package.json +1 -1
  218. package/dist/cjs/gb-filter-modal.gb-pagination.gb-pagination-button-group-base.gb-pagination-number-base.gb-portal.gb-table-header.gb-toggle.gb-toggle-base.entry.cjs.js.map +0 -1
  219. package/dist/cjs/gb-filter-modal_8.cjs.entry.js +0 -2253
  220. package/dist/cjs/gb-table.cjs.entry.js +0 -1240
  221. package/dist/cjs/gb-table.entry.cjs.js.map +0 -1
  222. package/dist/components/p-D1fnUzqW.js.map +0 -1
  223. package/dist/components/p-DQyU_YBJ.js.map +0 -1
  224. package/dist/components/p-q1BXlX2S.js.map +0 -1
  225. package/dist/esm/gb-filter-modal.gb-pagination.gb-pagination-button-group-base.gb-pagination-number-base.gb-portal.gb-table-header.gb-toggle.gb-toggle-base.entry.js.map +0 -1
  226. package/dist/esm/gb-filter-modal_8.entry.js +0 -2244
  227. package/dist/esm/gb-table.entry.js +0 -1238
  228. package/dist/esm/gb-table.entry.js.map +0 -1
  229. package/dist/globuscomponents/gb-filter-modal.gb-pagination.gb-pagination-button-group-base.gb-pagination-number-base.gb-portal.gb-table-header.gb-toggle.gb-toggle-base.entry.esm.js.map +0 -1
  230. package/dist/globuscomponents/gb-table.entry.esm.js.map +0 -1
  231. package/dist/globuscomponents/p-7b3bf29c.entry.js +0 -2
  232. package/dist/globuscomponents/p-7b3bf29c.entry.js.map +0 -1
  233. package/dist/globuscomponents/p-9a44bc13.entry.js.map +0 -1
  234. package/dist/globuscomponents/p-dbc76ebb.entry.js +0 -2
  235. package/dist/globuscomponents/p-dbc76ebb.entry.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { getAssetPath, h, Fragment } from "@stencil/core";
2
+ import { getIconPath } from "../../utils/icons";
2
3
  export class GbButton {
3
4
  constructor() {
4
5
  this.size = 'xl';
@@ -14,11 +15,14 @@ export class GbButton {
14
15
  this.arrow = 'bottom_center';
15
16
  this.event = false;
16
17
  this.rounded = false;
17
- this.iconLeadingStyle = '';
18
- this.iconLeadingType = '';
19
- this.iconTrailingStyle = '';
20
- this.iconTrailingType = '';
18
+ this.iconLeadingStyle = 'stroke';
19
+ this.iconLeadingType = 'rounded';
20
+ this.iconTrailingStyle = 'stroke';
21
+ this.iconTrailingType = 'rounded';
22
+ this.iconLeadingName = '';
23
+ this.iconTrailingName = '';
21
24
  this.fullWidth = true;
25
+ this.iconPath = '';
22
26
  this.leadingIconSvg = '';
23
27
  this.trailingIconSvg = '';
24
28
  this.internalButtonState = '';
@@ -32,11 +36,17 @@ export class GbButton {
32
36
  }
33
37
  componentWillLoad() {
34
38
  var _a;
35
- if (this.iconLeading && this.iconLeadingSwap) {
36
- this.loadIcon(this.iconLeadingSwap, 'leading');
39
+ if (this.iconLeadingSwap) {
40
+ this.loadIcon(this.iconLeadingSwap, 'leading', 'swap');
37
41
  }
38
- if (this.iconTrailing && this.iconTrailingSwap) {
39
- this.loadIcon(this.iconTrailingSwap, 'trailing');
42
+ else if (this.iconLeadingName) {
43
+ this.loadIcon(this.iconLeadingName, 'leading', 'name');
44
+ }
45
+ if (this.iconTrailingSwap) {
46
+ this.loadIcon(this.iconTrailingSwap, 'trailing', 'swap');
47
+ }
48
+ else if (this.iconTrailingName) {
49
+ this.loadIcon(this.iconTrailingName, 'trailing', 'name');
40
50
  }
41
51
  const buttonSlot = (_a = this.el) === null || _a === void 0 ? void 0 : _a.querySelector('p');
42
52
  if (this.state === 'loading') {
@@ -47,9 +57,16 @@ export class GbButton {
47
57
  buttonSlot.classList.add('nowrap');
48
58
  }
49
59
  }
50
- async loadIcon(iconName, type) {
51
- const iconPath = getAssetPath(`${iconName}`);
52
- const response = await fetch(iconPath);
60
+ async loadIcon(iconName, type, mode) {
61
+ if (mode === 'name') {
62
+ const style = type === 'leading' ? this.iconLeadingStyle : this.iconTrailingStyle;
63
+ const iconType = type === 'leading' ? this.iconLeadingType : this.iconTrailingType;
64
+ this.iconPath = getAssetPath(getIconPath(iconName, style, iconType));
65
+ }
66
+ else {
67
+ this.iconPath = getAssetPath(`${iconName}`);
68
+ }
69
+ const response = await fetch(this.iconPath);
53
70
  const svg = await response.text();
54
71
  if (type === 'leading') {
55
72
  this.leadingIconSvg = svg;
@@ -94,7 +111,7 @@ export class GbButton {
94
111
  this.buttonClicked.emit();
95
112
  }
96
113
  render() {
97
- return (h("div", { key: 'fd9dacc4a9e22b47faf99a8ff63c0655c2817149', class: `button_wrapper ${this.fullWidth ? 'full_width' : ''}`, onClick: () => this.emitButtonEvent() }, h("button", { key: '7f643aed374f2df3aab26476230ab87ced037953', disabled: this.state === 'disabled', class: this.getButtonClasses(), onMouseEnter: () => (this.tooltipShown = true), onMouseLeave: () => (this.tooltipShown = false) }, this.state === 'loading' && h("div", { key: 'a2057ee45cadbd314ef35f761e430b5ad83450e9', class: `loader ${this.hierarchy} ${this.size} ${this.icon} ${this.destructive ? 'destructive' : ''}` }), this.state !== 'loading' && (h(Fragment, null, this.iconLeading && this.icon === 'default' && this.renderLeadingIcon(), this.icon === 'default' && (h("div", { key: 'b5a28562daa46f120c1d11385b0aa09f82f3d6e0', class: `btn_text` }, h("slot", { key: '9a046982747755c6a652e7490dcf8c346f1a95d4' }))), this.iconTrailing && this.renderTrailingIcon(), this.icon === 'only' && this.renderLeadingIcon()))), this.tooltipText && this.icon === 'only' && this.tooltipShown && (h("gb-tooltip", { key: 'ce85fdaed53700e9318981fd219b40390c87ecd7', "show-arrow": true, arrow: this.arrow, class: `tooltip ${this.size}` }, h("p", { key: '3312175445c9981986ffd180e4bd44ac7efed89d', slot: "label" }, this.tooltipText)))));
114
+ return (h("div", { key: 'f456fd93837e9cf6162f8a009333b8fb05a68ec6', class: `button_wrapper ${this.fullWidth ? 'full_width' : ''}`, onClick: () => this.emitButtonEvent() }, h("button", { key: 'f4971fcf213f675d213dcdfa1daf0201ecd584d8', disabled: this.state === 'disabled', class: this.getButtonClasses(), onMouseEnter: () => (this.tooltipShown = true), onMouseLeave: () => (this.tooltipShown = false) }, this.state === 'loading' && h("div", { key: '95d2d607b600384ba07dfc3cac51bae7e8e6ef86', class: `loader ${this.hierarchy} ${this.size} ${this.icon} ${this.destructive ? 'destructive' : ''}` }), this.state !== 'loading' && (h(Fragment, null, this.iconLeading && this.icon === 'default' && this.renderLeadingIcon(), this.icon === 'default' && (h("div", { key: '6b8251dfd4507cbfc495f261bbca531b8c782954', class: `btn_text` }, h("slot", { key: 'c73983e48f284706c1219e2ab010aac8ac44be30' }))), this.iconTrailing && this.icon === 'default' && this.renderTrailingIcon(), this.icon === 'only' && this.renderLeadingIcon()))), this.tooltipText && this.icon === 'only' && this.tooltipShown && (h("gb-tooltip", { key: '5333f9805b40d1066e12d231953e906331b466c5', "show-arrow": true, arrow: this.arrow, class: `tooltip ${this.size}` }, h("p", { key: '387a4d8493d1c5fe0c15d8a3c7d2bd268dfd7376', slot: "label" }, this.tooltipText)))));
98
115
  }
99
116
  static get is() { return "gb-button"; }
100
117
  static get encapsulation() { return "shadow"; }
@@ -399,9 +416,15 @@ export class GbButton {
399
416
  "type": "string",
400
417
  "mutable": false,
401
418
  "complexType": {
402
- "original": "string",
403
- "resolved": "string",
404
- "references": {}
419
+ "original": "IconStyles",
420
+ "resolved": "\"bulk\" | \"duotone\" | \"solid\" | \"stroke\" | \"two-tone\"",
421
+ "references": {
422
+ "IconStyles": {
423
+ "location": "import",
424
+ "path": "../../models/reusableModels",
425
+ "id": "src/models/reusableModels.ts::IconStyles"
426
+ }
427
+ }
405
428
  },
406
429
  "required": false,
407
430
  "optional": false,
@@ -413,15 +436,21 @@ export class GbButton {
413
436
  "setter": false,
414
437
  "reflect": false,
415
438
  "attribute": "icon-leading-style",
416
- "defaultValue": "''"
439
+ "defaultValue": "'stroke'"
417
440
  },
418
441
  "iconLeadingType": {
419
442
  "type": "string",
420
443
  "mutable": false,
421
444
  "complexType": {
422
- "original": "string",
423
- "resolved": "string",
424
- "references": {}
445
+ "original": "IconTypes",
446
+ "resolved": "\"rounded\" | \"sharp\"",
447
+ "references": {
448
+ "IconTypes": {
449
+ "location": "import",
450
+ "path": "../../models/reusableModels",
451
+ "id": "src/models/reusableModels.ts::IconTypes"
452
+ }
453
+ }
425
454
  },
426
455
  "required": false,
427
456
  "optional": false,
@@ -433,15 +462,21 @@ export class GbButton {
433
462
  "setter": false,
434
463
  "reflect": false,
435
464
  "attribute": "icon-leading-type",
436
- "defaultValue": "''"
465
+ "defaultValue": "'rounded'"
437
466
  },
438
467
  "iconTrailingStyle": {
439
468
  "type": "string",
440
469
  "mutable": false,
441
470
  "complexType": {
442
- "original": "string",
443
- "resolved": "string",
444
- "references": {}
471
+ "original": "IconStyles",
472
+ "resolved": "\"bulk\" | \"duotone\" | \"solid\" | \"stroke\" | \"two-tone\"",
473
+ "references": {
474
+ "IconStyles": {
475
+ "location": "import",
476
+ "path": "../../models/reusableModels",
477
+ "id": "src/models/reusableModels.ts::IconStyles"
478
+ }
479
+ }
445
480
  },
446
481
  "required": false,
447
482
  "optional": false,
@@ -453,9 +488,35 @@ export class GbButton {
453
488
  "setter": false,
454
489
  "reflect": false,
455
490
  "attribute": "icon-trailing-style",
456
- "defaultValue": "''"
491
+ "defaultValue": "'stroke'"
457
492
  },
458
493
  "iconTrailingType": {
494
+ "type": "string",
495
+ "mutable": false,
496
+ "complexType": {
497
+ "original": "IconTypes",
498
+ "resolved": "\"rounded\" | \"sharp\"",
499
+ "references": {
500
+ "IconTypes": {
501
+ "location": "import",
502
+ "path": "../../models/reusableModels",
503
+ "id": "src/models/reusableModels.ts::IconTypes"
504
+ }
505
+ }
506
+ },
507
+ "required": false,
508
+ "optional": false,
509
+ "docs": {
510
+ "tags": [],
511
+ "text": ""
512
+ },
513
+ "getter": false,
514
+ "setter": false,
515
+ "reflect": false,
516
+ "attribute": "icon-trailing-type",
517
+ "defaultValue": "'rounded'"
518
+ },
519
+ "iconLeadingName": {
459
520
  "type": "string",
460
521
  "mutable": false,
461
522
  "complexType": {
@@ -472,25 +533,28 @@ export class GbButton {
472
533
  "getter": false,
473
534
  "setter": false,
474
535
  "reflect": false,
475
- "attribute": "icon-trailing-type",
536
+ "attribute": "icon-leading-name",
476
537
  "defaultValue": "''"
477
538
  },
478
- "iconConfig": {
479
- "type": "unknown",
539
+ "iconTrailingName": {
540
+ "type": "string",
480
541
  "mutable": false,
481
542
  "complexType": {
482
- "original": "{\r\n iconLeadingStyle: string,\r\n iconLeadingType: string\r\n }",
483
- "resolved": "{ iconLeadingStyle: string; iconLeadingType: string; }",
543
+ "original": "string",
544
+ "resolved": "string",
484
545
  "references": {}
485
546
  },
486
547
  "required": false,
487
- "optional": true,
548
+ "optional": false,
488
549
  "docs": {
489
550
  "tags": [],
490
551
  "text": ""
491
552
  },
492
553
  "getter": false,
493
- "setter": false
554
+ "setter": false,
555
+ "reflect": false,
556
+ "attribute": "icon-trailing-name",
557
+ "defaultValue": "''"
494
558
  },
495
559
  "fullWidth": {
496
560
  "type": "boolean",
@@ -516,6 +580,7 @@ export class GbButton {
516
580
  }
517
581
  static get states() {
518
582
  return {
583
+ "iconPath": {},
519
584
  "leadingIconSvg": {},
520
585
  "trailingIconSvg": {},
521
586
  "internalButtonState": {},
@@ -1 +1 @@
1
- {"version":3,"file":"gb-button.js","sourceRoot":"","sources":["../../../src/components/gb-button/gb-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AASxH,MAAM,OAAO,QAAQ;IANrB;QAOU,SAAI,GAAiB,IAAI,CAAC;QA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, getAssetPath, h, Prop, State, Fragment, Method, Event, EventEmitter } from '@stencil/core';\r\nimport { ArrowPositions, GeneralHierarchies, GeneralSizes, StateType } from '../../models/reusableModels';\r\n\r\n@Component({\r\n tag: 'gb-button',\r\n styleUrl: 'gb-button.css',\r\n shadow: true,\r\n assetsDirs: [''],\r\n})\r\nexport class GbButton {\r\n @Prop() size: GeneralSizes = 'xl';\r\n @Prop() hierarchy: GeneralHierarchies = 'primary';\r\n @Prop() icon: 'default' | 'only' = 'default';\r\n @Prop() destructive: boolean = false;\r\n @Prop() state: StateType = 'default';\r\n @Prop() iconLeading: boolean = false;\r\n @Prop() iconLeadingSwap: string = '';\r\n @Prop() iconTrailing: boolean = false;\r\n @Prop() iconTrailingSwap: string = '';\r\n @Prop() tooltipText: string = '';\r\n @Prop() arrow: ArrowPositions = 'bottom_center';\r\n @Prop() event: boolean = false;\r\n @Prop() rounded: boolean = false;\r\n @Prop() iconLeadingStyle: string = '';\r\n @Prop() iconLeadingType: string = '';\r\n @Prop() iconTrailingStyle: string = '';\r\n @Prop() iconTrailingType: string = '';\r\n @Prop() iconConfig?: {\r\n iconLeadingStyle: string,\r\n iconLeadingType: string\r\n }\r\n @Prop() fullWidth: boolean = true;\r\n @Element() el: HTMLElement;\r\n @State() leadingIconSvg: string = '';\r\n @State() trailingIconSvg: string = '';\r\n @State() internalButtonState: string = '';\r\n @State() internalIconLeadingState: string = '';\r\n @State() internalIconTrailingState: string = '';\r\n @State() tooltipShown: boolean = false;\r\n @Event() buttonClicked: EventEmitter<void>;\r\n\r\n @Method()\r\n async getNativeButton(): Promise<HTMLButtonElement | null> {\r\n return this.el.shadowRoot.querySelector('button') ?? null;\r\n }\r\n\r\n componentWillLoad() {\r\n if (this.iconLeading && this.iconLeadingSwap) {\r\n this.loadIcon(this.iconLeadingSwap, 'leading');\r\n }\r\n if (this.iconTrailing && this.iconTrailingSwap) {\r\n this.loadIcon(this.iconTrailingSwap, 'trailing');\r\n }\r\n\r\n const buttonSlot = this.el?.querySelector('p');\r\n\r\n if (this.state === 'loading') {\r\n buttonSlot.style.display = 'none';\r\n }\r\n\r\n if (buttonSlot) {\r\n buttonSlot.classList.add(this.getButtonTextClasses() || '');\r\n buttonSlot.classList.add('nowrap');\r\n }\r\n }\r\n\r\n async loadIcon(iconName: string, type: 'leading' | 'trailing') {\r\n const iconPath = getAssetPath(`${iconName}`);\r\n const response = await fetch(iconPath);\r\n const svg = await response.text();\r\n if (type === 'leading') {\r\n this.leadingIconSvg = svg;\r\n } else {\r\n this.trailingIconSvg = svg;\r\n }\r\n }\r\n\r\n // Helper to apply color styles based on the button state\r\n getButtonClasses() {\r\n return {\r\n button: true,\r\n [this.size]: true,\r\n [this.hierarchy]: true,\r\n destructive: this.destructive,\r\n disabled: this.state === 'disabled',\r\n only: this.icon === 'only',\r\n rounded: this.rounded && this.icon === 'only',\r\n };\r\n }\r\n\r\n getButtonTextClasses() {\r\n switch (this.size) {\r\n case 'xxl':\r\n return 'text-md-semi-bold';\r\n case 'xl':\r\n return 'text-md-semi-bold';\r\n case 'lg':\r\n return 'text-md-semi-bold';\r\n case 'md':\r\n return 'text-sm-semi-bold';\r\n case 'sm':\r\n return 'text-sm-semi-bold';\r\n }\r\n }\r\n\r\n renderLeadingIcon() {\r\n return <div class={`icon left-icon ${this.size}`} innerHTML={this.leadingIconSvg}></div>;\r\n }\r\n\r\n renderTrailingIcon() {\r\n return <div class=\"icon right-icon\" innerHTML={this.trailingIconSvg}></div>;\r\n }\r\n\r\n emitButtonEvent() {\r\n this.buttonClicked.emit();\r\n }\r\n\r\n render() {\r\n return (\r\n <div class={`button_wrapper ${this.fullWidth ? 'full_width' : ''}`} onClick={() => this.emitButtonEvent()}>\r\n <button\r\n disabled={this.state === 'disabled'}\r\n class={this.getButtonClasses()}\r\n onMouseEnter={() => (this.tooltipShown = true)}\r\n onMouseLeave={() => (this.tooltipShown = false)}\r\n >\r\n {this.state === 'loading' && <div class={`loader ${this.hierarchy} ${this.size} ${this.icon} ${this.destructive ? 'destructive' : ''}`}></div>}\r\n {this.state !== 'loading' && (\r\n <>\r\n {this.iconLeading && this.icon === 'default' && this.renderLeadingIcon()}\r\n {this.icon === 'default' && (\r\n <div class={`btn_text`}>\r\n <slot></slot>\r\n </div>\r\n )}\r\n {this.iconTrailing && this.renderTrailingIcon()}\r\n {this.icon === 'only' && this.renderLeadingIcon()}\r\n </>\r\n )}\r\n </button>\r\n {this.tooltipText && this.icon === 'only' && this.tooltipShown && (\r\n <gb-tooltip show-arrow={true} arrow={this.arrow} class={`tooltip ${this.size}`}>\r\n <p slot=\"label\">{this.tooltipText}</p>\r\n </gb-tooltip>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gb-button.js","sourceRoot":"","sources":["../../../src/components/gb-button/gb-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAExH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQhD,MAAM,OAAO,QAAQ;IANrB;QAOU,SAAI,GAAiB,IAAI,CAAC;QAC1B,cAAS,GAAuB,SAAS,CAAC;QAC1C,SAAI,GAAuB,SAAS,CAAC;QACrC,gBAAW,GAAY,KAAK,CAAC;QAC7B,UAAK,GAAc,SAAS,CAAC;QAC7B,gBAAW,GAAY,KAAK,CAAC;QAC7B,oBAAe,GAAW,EAAE,CAAC;QAC7B,iBAAY,GAAY,KAAK,CAAC;QAC9B,qBAAgB,GAAW,EAAE,CAAC;QAC9B,gBAAW,GAAW,EAAE,CAAC;QACzB,UAAK,GAAmB,eAAe,CAAC;QACxC,UAAK,GAAY,KAAK,CAAC;QACvB,YAAO,GAAY,KAAK,CAAC;QACzB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, getAssetPath, h, Prop, State, Fragment, Method, Event, EventEmitter } from '@stencil/core';\r\nimport { ArrowPositions, GeneralHierarchies, GeneralSizes, IconStyles, IconTypes, StateType } from '../../models/reusableModels';\r\nimport { getIconPath } from '../../utils/icons';\r\n\r\n@Component({\r\n tag: 'gb-button',\r\n styleUrl: 'gb-button.css',\r\n shadow: true,\r\n assetsDirs: [''],\r\n})\r\nexport class GbButton {\r\n @Prop() size: GeneralSizes = 'xl';\r\n @Prop() hierarchy: GeneralHierarchies = 'primary';\r\n @Prop() icon: 'default' | 'only' = 'default';\r\n @Prop() destructive: boolean = false;\r\n @Prop() state: StateType = 'default';\r\n @Prop() iconLeading: boolean = false;\r\n @Prop() iconLeadingSwap: string = '';\r\n @Prop() iconTrailing: boolean = false;\r\n @Prop() iconTrailingSwap: string = '';\r\n @Prop() tooltipText: string = '';\r\n @Prop() arrow: ArrowPositions = 'bottom_center';\r\n @Prop() event: boolean = false;\r\n @Prop() rounded: boolean = false;\r\n @Prop() iconLeadingStyle: IconStyles = 'stroke';\r\n @Prop() iconLeadingType: IconTypes = 'rounded';\r\n @Prop() iconTrailingStyle: IconStyles = 'stroke';\r\n @Prop() iconTrailingType: IconTypes = 'rounded';\r\n @Prop() iconLeadingName: string = '';\r\n @Prop() iconTrailingName: string = '';\r\n @Prop() fullWidth: boolean = true;\r\n @Element() el: HTMLElement;\r\n @State() iconPath: string = '';\r\n @State() leadingIconSvg: string = '';\r\n @State() trailingIconSvg: string = '';\r\n @State() internalButtonState: string = '';\r\n @State() internalIconLeadingState: string = '';\r\n @State() internalIconTrailingState: string = '';\r\n @State() tooltipShown: boolean = false;\r\n @Event() buttonClicked: EventEmitter<void>;\r\n\r\n @Method()\r\n async getNativeButton(): Promise<HTMLButtonElement | null> {\r\n return this.el.shadowRoot.querySelector('button') ?? null;\r\n }\r\n\r\n componentWillLoad() {\r\n if (this.iconLeadingSwap) {\r\n this.loadIcon(this.iconLeadingSwap, 'leading', 'swap');\r\n } else if (this.iconLeadingName) {\r\n this.loadIcon(this.iconLeadingName, 'leading', 'name');\r\n }\r\n\r\n if (this.iconTrailingSwap) {\r\n this.loadIcon(this.iconTrailingSwap, 'trailing', 'swap');\r\n } else if (this.iconTrailingName) {\r\n this.loadIcon(this.iconTrailingName, 'trailing', 'name');\r\n }\r\n\r\n const buttonSlot = this.el?.querySelector('p');\r\n\r\n if (this.state === 'loading') {\r\n buttonSlot.style.display = 'none';\r\n }\r\n\r\n if (buttonSlot) {\r\n buttonSlot.classList.add(this.getButtonTextClasses() || '');\r\n buttonSlot.classList.add('nowrap');\r\n }\r\n }\r\n\r\n async loadIcon(iconName: string, type: 'leading' | 'trailing', mode: 'swap' | 'name') {\r\n if (mode === 'name') {\r\n const style = type === 'leading' ? this.iconLeadingStyle : this.iconTrailingStyle;\r\n const iconType = type === 'leading' ? this.iconLeadingType : this.iconTrailingType;\r\n this.iconPath = getAssetPath(getIconPath(iconName, style, iconType));\r\n } else {\r\n this.iconPath = getAssetPath(`${iconName}`);\r\n }\r\n\r\n const response = await fetch(this.iconPath);\r\n const svg = await response.text();\r\n if (type === 'leading') {\r\n this.leadingIconSvg = svg;\r\n } else {\r\n this.trailingIconSvg = svg;\r\n }\r\n }\r\n\r\n // Helper to apply color styles based on the button state\r\n getButtonClasses() {\r\n return {\r\n button: true,\r\n [this.size]: true,\r\n [this.hierarchy]: true,\r\n destructive: this.destructive,\r\n disabled: this.state === 'disabled',\r\n only: this.icon === 'only',\r\n rounded: this.rounded && this.icon === 'only',\r\n };\r\n }\r\n\r\n getButtonTextClasses() {\r\n switch (this.size) {\r\n case 'xxl':\r\n return 'text-md-semi-bold';\r\n case 'xl':\r\n return 'text-md-semi-bold';\r\n case 'lg':\r\n return 'text-md-semi-bold';\r\n case 'md':\r\n return 'text-sm-semi-bold';\r\n case 'sm':\r\n return 'text-sm-semi-bold';\r\n }\r\n }\r\n\r\n renderLeadingIcon() {\r\n return <div class={`icon left-icon ${this.size}`} innerHTML={this.leadingIconSvg}></div>;\r\n }\r\n\r\n renderTrailingIcon() {\r\n return <div class=\"icon right-icon\" innerHTML={this.trailingIconSvg}></div>;\r\n }\r\n\r\n emitButtonEvent() {\r\n this.buttonClicked.emit();\r\n }\r\n\r\n render() {\r\n return (\r\n <div class={`button_wrapper ${this.fullWidth ? 'full_width' : ''}`} onClick={() => this.emitButtonEvent()}>\r\n <button\r\n disabled={this.state === 'disabled'}\r\n class={this.getButtonClasses()}\r\n onMouseEnter={() => (this.tooltipShown = true)}\r\n onMouseLeave={() => (this.tooltipShown = false)}\r\n >\r\n {this.state === 'loading' && <div class={`loader ${this.hierarchy} ${this.size} ${this.icon} ${this.destructive ? 'destructive' : ''}`}></div>}\r\n {this.state !== 'loading' && (\r\n <>\r\n {this.iconLeading && this.icon === 'default' && this.renderLeadingIcon()}\r\n {this.icon === 'default' && (\r\n <div class={`btn_text`}>\r\n <slot></slot>\r\n </div>\r\n )}\r\n {this.iconTrailing && this.icon === 'default' && this.renderTrailingIcon()}\r\n {this.icon === 'only' && this.renderLeadingIcon()}\r\n </>\r\n )}\r\n </button>\r\n {this.tooltipText && this.icon === 'only' && this.tooltipShown && (\r\n <gb-tooltip show-arrow={true} arrow={this.arrow} class={`tooltip ${this.size}`}>\r\n <p slot=\"label\">{this.tooltipText}</p>\r\n </gb-tooltip>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Component, Element, getAssetPath, h, Prop, State, Fragment, Method, Event, EventEmitter } from '@stencil/core';
2
- import { ArrowPositions, GeneralHierarchies, GeneralSizes, StateType } from '../../models/reusableModels';
2
+ import { ArrowPositions, GeneralHierarchies, GeneralSizes, IconStyles, IconTypes, StateType } from '../../models/reusableModels';
3
+ import { getIconPath } from '../../utils/icons';
3
4
 
4
5
  @Component({
5
6
  tag: 'gb-button',
@@ -21,16 +22,15 @@ export class GbButton {
21
22
  @Prop() arrow: ArrowPositions = 'bottom_center';
22
23
  @Prop() event: boolean = false;
23
24
  @Prop() rounded: boolean = false;
24
- @Prop() iconLeadingStyle: string = '';
25
- @Prop() iconLeadingType: string = '';
26
- @Prop() iconTrailingStyle: string = '';
27
- @Prop() iconTrailingType: string = '';
28
- @Prop() iconConfig?: {
29
- iconLeadingStyle: string,
30
- iconLeadingType: string
31
- }
25
+ @Prop() iconLeadingStyle: IconStyles = 'stroke';
26
+ @Prop() iconLeadingType: IconTypes = 'rounded';
27
+ @Prop() iconTrailingStyle: IconStyles = 'stroke';
28
+ @Prop() iconTrailingType: IconTypes = 'rounded';
29
+ @Prop() iconLeadingName: string = '';
30
+ @Prop() iconTrailingName: string = '';
32
31
  @Prop() fullWidth: boolean = true;
33
32
  @Element() el: HTMLElement;
33
+ @State() iconPath: string = '';
34
34
  @State() leadingIconSvg: string = '';
35
35
  @State() trailingIconSvg: string = '';
36
36
  @State() internalButtonState: string = '';
@@ -45,11 +45,16 @@ export class GbButton {
45
45
  }
46
46
 
47
47
  componentWillLoad() {
48
- if (this.iconLeading && this.iconLeadingSwap) {
49
- this.loadIcon(this.iconLeadingSwap, 'leading');
48
+ if (this.iconLeadingSwap) {
49
+ this.loadIcon(this.iconLeadingSwap, 'leading', 'swap');
50
+ } else if (this.iconLeadingName) {
51
+ this.loadIcon(this.iconLeadingName, 'leading', 'name');
50
52
  }
51
- if (this.iconTrailing && this.iconTrailingSwap) {
52
- this.loadIcon(this.iconTrailingSwap, 'trailing');
53
+
54
+ if (this.iconTrailingSwap) {
55
+ this.loadIcon(this.iconTrailingSwap, 'trailing', 'swap');
56
+ } else if (this.iconTrailingName) {
57
+ this.loadIcon(this.iconTrailingName, 'trailing', 'name');
53
58
  }
54
59
 
55
60
  const buttonSlot = this.el?.querySelector('p');
@@ -64,9 +69,16 @@ export class GbButton {
64
69
  }
65
70
  }
66
71
 
67
- async loadIcon(iconName: string, type: 'leading' | 'trailing') {
68
- const iconPath = getAssetPath(`${iconName}`);
69
- const response = await fetch(iconPath);
72
+ async loadIcon(iconName: string, type: 'leading' | 'trailing', mode: 'swap' | 'name') {
73
+ if (mode === 'name') {
74
+ const style = type === 'leading' ? this.iconLeadingStyle : this.iconTrailingStyle;
75
+ const iconType = type === 'leading' ? this.iconLeadingType : this.iconTrailingType;
76
+ this.iconPath = getAssetPath(getIconPath(iconName, style, iconType));
77
+ } else {
78
+ this.iconPath = getAssetPath(`${iconName}`);
79
+ }
80
+
81
+ const response = await fetch(this.iconPath);
70
82
  const svg = await response.text();
71
83
  if (type === 'leading') {
72
84
  this.leadingIconSvg = svg;
@@ -133,7 +145,7 @@ export class GbButton {
133
145
  <slot></slot>
134
146
  </div>
135
147
  )}
136
- {this.iconTrailing && this.renderTrailingIcon()}
148
+ {this.iconTrailing && this.icon === 'default' && this.renderTrailingIcon()}
137
149
  {this.icon === 'only' && this.renderLeadingIcon()}
138
150
  </>
139
151
  )}
@@ -13,15 +13,16 @@
13
13
  | `fullWidth` | `full-width` | | `boolean` | `true` |
14
14
  | `hierarchy` | `hierarchy` | | `"link_color" \| "link_gray" \| "primary" \| "secondary_color" \| "secondary_gray" \| "tertiary_color" \| "tertiary_gray"` | `'primary'` |
15
15
  | `icon` | `icon` | | `"default" \| "only"` | `'default'` |
16
- | `iconConfig` | -- | | `{ iconLeadingStyle: string; iconLeadingType: string; }` | `undefined` |
17
16
  | `iconLeading` | `icon-leading` | | `boolean` | `false` |
18
- | `iconLeadingStyle` | `icon-leading-style` | | `string` | `''` |
17
+ | `iconLeadingName` | `icon-leading-name` | | `string` | `''` |
18
+ | `iconLeadingStyle` | `icon-leading-style` | | `"bulk" \| "duotone" \| "solid" \| "stroke" \| "two-tone"` | `'stroke'` |
19
19
  | `iconLeadingSwap` | `icon-leading-swap` | | `string` | `''` |
20
- | `iconLeadingType` | `icon-leading-type` | | `string` | `''` |
20
+ | `iconLeadingType` | `icon-leading-type` | | `"rounded" \| "sharp"` | `'rounded'` |
21
21
  | `iconTrailing` | `icon-trailing` | | `boolean` | `false` |
22
- | `iconTrailingStyle` | `icon-trailing-style` | | `string` | `''` |
22
+ | `iconTrailingName` | `icon-trailing-name` | | `string` | `''` |
23
+ | `iconTrailingStyle` | `icon-trailing-style` | | `"bulk" \| "duotone" \| "solid" \| "stroke" \| "two-tone"` | `'stroke'` |
23
24
  | `iconTrailingSwap` | `icon-trailing-swap` | | `string` | `''` |
24
- | `iconTrailingType` | `icon-trailing-type` | | `string` | `''` |
25
+ | `iconTrailingType` | `icon-trailing-type` | | `"rounded" \| "sharp"` | `'rounded'` |
25
26
  | `rounded` | `rounded` | | `boolean` | `false` |
26
27
  | `size` | `size` | | `"lg" \| "md" \| "profile_lg" \| "profile_md" \| "profile_sm" \| "sm" \| "xl" \| "xs" \| "xxl" \| "xxs" \| "xxxl" \| "xxxxl"` | `'xl'` |
27
28
  | `state` | `state` | | `"applied" \| "default" \| "disabled" \| "loading" \| "open"` | `'default'` |
@@ -2664,11 +2664,11 @@ input:-webkit-autofill:hover,
2664
2664
  input:-webkit-autofill:focus,
2665
2665
  input:-webkit-autofill:active {
2666
2666
  /* Make the text use your normal color */
2667
- -webkit-text-fill-color: var(--color-text, #4b5565);
2667
+ -webkit-text-fill-color: var(--color-text, #4b5565) !important;
2668
2668
 
2669
2669
  /* Remove the yellow background Chrome applies by covering it */
2670
- -webkit-transition: background-color 9999s ease-in-out 0s;
2671
- transition: background-color 9999s ease-in-out 0s;
2670
+ -webkit-transition: background-color 9999s ease-in-out 0s !important;
2671
+ transition: background-color 9999s ease-in-out 0s !important;
2672
2672
 
2673
2673
  /* Or explicitly paint your own background */
2674
2674
  box-shadow: 0 0 0 1000px transparent inset !important;
@@ -2676,11 +2676,11 @@ input:-webkit-autofill:active {
2676
2676
  /* Firefox */
2677
2677
  input:-webkit-autofill {
2678
2678
  background-color: transparent !important;
2679
- color: var(--color-text, #4b5565);
2679
+ color: var(--color-text, #4b5565) !important;
2680
2680
  }
2681
2681
  input:autofill {
2682
2682
  background-color: transparent !important;
2683
- color: var(--color-text, #4b5565);
2683
+ color: var(--color-text, #4b5565) !important;
2684
2684
  }
2685
2685
  .input_container,
2686
2686
  .input_with_label {
@@ -2785,10 +2785,34 @@
2785
2785
  background: var(--color-background-gray-subtler, #eef2f6);
2786
2786
  color: var(--color-icon-default, #364152);
2787
2787
  }
2788
- .ProseMirror-selectednode,
2789
- .ProseMirror-focused img{
2790
- max-width: 100%; /* never wider than the editor */
2791
- max-height: 300px; /* cap the height so tall portraits don't take over */
2792
- width: auto; /* let width scale naturally */
2793
- height: auto;
2788
+ .gb-rich-text__content .ProseMirror img {
2789
+ max-width: 100%; /* never wider than the editor, still overridable by the resize handle's inline width */
2790
+ height: auto; /* preserve aspect ratio as width changes */
2791
+ }
2792
+ /* === Resizable image (see resizable-image.ts) === */
2793
+ .gb-rich-text__content .ProseMirror .gb-resizable-image {
2794
+ position: relative;
2795
+ display: inline-block;
2796
+ max-width: 100%;
2797
+ line-height: 0;
2798
+ }
2799
+ .gb-rich-text__content .ProseMirror .gb-resizable-image img {
2800
+ display: block;
2801
+ }
2802
+ .gb-rich-text__content .ProseMirror .gb-resizable-image__handle {
2803
+ position: absolute;
2804
+ right: -4px;
2805
+ bottom: -4px;
2806
+ width: 10px;
2807
+ height: 10px;
2808
+ border: 1.5px solid var(--color-background-card, #ffffff);
2809
+ border-radius: 2px;
2810
+ background: var(--color-border-selected, #075db2);
2811
+ cursor: nwse-resize;
2812
+ opacity: 0;
2813
+ transition: opacity 0.15s;
2814
+ }
2815
+ .gb-rich-text__content .ProseMirror .gb-resizable-image:hover .gb-resizable-image__handle,
2816
+ .gb-rich-text__content .ProseMirror .gb-resizable-image.ProseMirror-selectednode .gb-resizable-image__handle {
2817
+ opacity: 1;
2794
2818
  }
@@ -1,11 +1,11 @@
1
1
  import { h, Fragment } from "@stencil/core";
2
2
  import { Editor } from "@tiptap/core";
3
- import Image from "@tiptap/extension-image";
4
3
  import Link from "@tiptap/extension-link";
5
4
  import Placeholder from "@tiptap/extension-placeholder";
6
5
  import Underline from "@tiptap/extension-underline";
7
6
  import StarterKit from "@tiptap/starter-kit";
8
7
  import FileHandler from "@tiptap/extension-file-handler";
8
+ import { ResizableImage } from "./resizable-image";
9
9
  export class GbRichText {
10
10
  constructor() {
11
11
  this.label = '';
@@ -38,7 +38,7 @@ export class GbRichText {
38
38
  StarterKit,
39
39
  Underline,
40
40
  Link.configure({ openOnClick: false }),
41
- Image,
41
+ ResizableImage,
42
42
  Placeholder.configure({ placeholder: this.placeholder }),
43
43
  FileHandler.configure({
44
44
  allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],
@@ -162,12 +162,12 @@ export class GbRichText {
162
162
  (_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
163
163
  }
164
164
  render() {
165
- return (h("div", { key: '9928f07fa557418f107fc8970a8a6d660c2eb664', class: {
165
+ return (h("div", { key: '8e35f372364f6b6e7423b3be278b025d65bf3329', class: {
166
166
  'gb-rich-text': true,
167
167
  'gb-rich-text--focused': this.isFocused,
168
168
  'gb-rich-text--error': this.destructive,
169
169
  'gb-rich-text--disabled': this.disabled,
170
- } }, this.label && h("label", { key: '0d092f589d34c35df40a7932055e5d61a666df30', class: "gb-rich-text__label text-sm-medium" }, this.label), h("div", { key: '6333cc24ecf0e4f52f870814ecf8d945e7953a76', class: "gb-rich-text__wrapper" }, h("gb-wysiwyg-toolbar", { key: 'bc9f60b4124bbff6bd9c7d728c18428f7d57cfc1', disabledIcons: this.disabledIcons, "is-bold": this.isBold, "is-italic": this.isItalic, "is-h1": this.isH1, "is-h2": this.isH2, "is-underline": this.isUnderline, "is-quote": this.isQuote, "is-link": this.isLink, "is-bullet-list": this.isBulletList, "is-ordered-list": this.isOrderedList, onToolbarAction: (ev) => this.handleToolbarAction(ev) }), this.destructive && (h("svg", { key: '18133040ecb1d5eaa5d92ee8b067a9303d260841', xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", class: "alert_circle" }, h("path", { key: 'ebb0dce0726e0b7eda10429e44ee2f1c76fac057', d: "M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z", stroke: "var(--color-icon-danger, #B51726)", "stroke-width": "1.33333", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.attachments.length > 0 && (h("div", { key: '23044031819bef9cd45f3533dc0f9b4d291d810d', class: "gb-rich-text__attachments" }, this.attachments.map((attachment, index) => (h("div", { class: "gb-rich-text__attachment-item", key: index }, h("span", { class: "gb-rich-text__attachment-icon" }, h("gb-file-type-icon", { "file-type": this.getFileExtension(attachment.name), "file-style": "default" })), h("div", { class: "gb-rich-text__attachment-info" }, h("span", { class: "gb-rich-text__attachment-name text-sm-medium" }, attachment.name), h("span", { class: "gb-rich-text__attachment-size text-xs-regular" }, this.formatFileSize(attachment.size))), h("gb-button-close", { color: "gray", size: "sm", onClick: () => this.removeAttachment(index) })))))), h("input", { key: '5843d797ed6ebb90db7aa4847eb295460ab7ff8a', ref: el => (this.fileInputEl = el), type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => this.handleFileInput(e) }), h("input", { key: '210cceded9489a05a77b04df351c433f00bb844b', ref: el => (this.attachmentInputEl = el), type: "file", accept: ".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip", style: { display: 'none' }, onChange: (e) => this.handleAttachmentInput(e) }), h("div", { key: 'cee6e40b4249eb5bcfc4f2f1fa9a791f6d09a52e', class: "gb-rich-text__content" })), this.showHintText && (h(Fragment, null, !this.destructive ? h("p", { class: "gb-rich-text__hint text-sm-regular" }, this.hintText) : h("p", { class: "error_text text-sm-regular" }, this.errorText)))));
170
+ } }, this.label && h("label", { key: '48fa31760874f4ba046f8bd1927b0e3ee478e8a9', class: "gb-rich-text__label text-sm-medium" }, this.label), h("div", { key: '4a8d857144b9d32e729bc529596a9179757aca2e', class: "gb-rich-text__wrapper" }, h("gb-wysiwyg-toolbar", { key: 'bb7a7cf92d4463f6b675c81378fc2f5ad44e636a', disabledIcons: this.disabledIcons, "is-bold": this.isBold, "is-italic": this.isItalic, "is-h1": this.isH1, "is-h2": this.isH2, "is-underline": this.isUnderline, "is-quote": this.isQuote, "is-link": this.isLink, "is-bullet-list": this.isBulletList, "is-ordered-list": this.isOrderedList, onToolbarAction: (ev) => this.handleToolbarAction(ev) }), this.destructive && (h("svg", { key: 'e98e952ce38dee168aaeed851be0b7264c3dd677', xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", class: "alert_circle" }, h("path", { key: '5ed5812e747f848d6bacea85a65e5cc1241d940f', d: "M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z", stroke: "var(--color-icon-danger, #B51726)", "stroke-width": "1.33333", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.attachments.length > 0 && (h("div", { key: 'd8f8bfb37e2ec6db50d26967bf5c0b4bf957a0cf', class: "gb-rich-text__attachments" }, this.attachments.map((attachment, index) => (h("div", { class: "gb-rich-text__attachment-item", key: index }, h("span", { class: "gb-rich-text__attachment-icon" }, h("gb-file-type-icon", { "file-type": this.getFileExtension(attachment.name), "file-style": "default" })), h("div", { class: "gb-rich-text__attachment-info" }, h("span", { class: "gb-rich-text__attachment-name text-sm-medium" }, attachment.name), h("span", { class: "gb-rich-text__attachment-size text-xs-regular" }, this.formatFileSize(attachment.size))), h("gb-button-close", { color: "gray", size: "sm", onClick: () => this.removeAttachment(index) })))))), h("input", { key: '29f63449b3e265aad6ffb9415de48768ac47e4a5', ref: el => (this.fileInputEl = el), type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => this.handleFileInput(e) }), h("input", { key: '204ddc471af0da8d0f9388c729b792e59bcbcb6a', ref: el => (this.attachmentInputEl = el), type: "file", accept: ".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip", style: { display: 'none' }, onChange: (e) => this.handleAttachmentInput(e) }), h("div", { key: '5e2aadf828780b43417670e05296279b12f921be', class: "gb-rich-text__content" })), this.showHintText && (h(Fragment, null, !this.destructive ? h("p", { class: "gb-rich-text__hint text-sm-regular" }, this.hintText) : h("p", { class: "error_text text-sm-regular" }, this.errorText)))));
171
171
  }
172
172
  static get is() { return "gb-rich-text"; }
173
173
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"gb-rich-text.js","sourceRoot":"","sources":["../../../src/components/gb-rich-text/gb-rich-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch, h, Fragment } from '@stencil/core';\r\nimport { Editor } from '@tiptap/core';\r\nimport Image from '@tiptap/extension-image';\r\nimport Link from '@tiptap/extension-link';\r\nimport Placeholder from '@tiptap/extension-placeholder';\r\nimport Underline from '@tiptap/extension-underline';\r\nimport StarterKit from '@tiptap/starter-kit';\r\nimport FileHandler from '@tiptap/extension-file-handler';\r\n\r\n@Component({\r\n tag: 'gb-rich-text',\r\n styleUrl: 'gb-rich-text.css',\r\n shadow: false,\r\n})\r\nexport class GbRichText {\r\n @Prop() label: string = '';\r\n @Prop() placeholder: string = '';\r\n @Prop() showHintText: boolean = true;\r\n @Prop() hintText: string = '';\r\n @Prop() value: any;\r\n @Prop() disabled: boolean = false;\r\n @Prop() destructive: boolean = false;\r\n @Prop() errorText: string = '';\r\n // Toolbar icons to disable, e.g. disabled-icons=\"photo,attachment\" or ['photo', 'attachment'].\r\n @Prop() disabledIcons: string | string[] = [];\r\n\r\n // Active states tracked for toolbar highlighting\r\n @State() isFocused: boolean = false;\r\n @State() isBold: boolean = false;\r\n @State() isItalic: boolean = false;\r\n @State() isH1: boolean = false;\r\n @State() isH2: boolean = false;\r\n @State() isUnderline: boolean = false;\r\n @State() isQuote: boolean = false;\r\n @State() isLink: boolean = false;\r\n @State() isBulletList: boolean = false;\r\n @State() isOrderedList: boolean = false;\r\n @State() attachments: { file: File; name: string; size: number; type: string }[] = [];\r\n @Event() richTextValueChanged: EventEmitter<{ json: any; html: any }>;\r\n @Event() richTextAttachmentAdded: EventEmitter<{ file: File; name: string; size: number; type: string }>;\r\n @Event() gbBlur: EventEmitter<void>;\r\n @Event() gbFocus: EventEmitter<void>;\r\n\r\n @Element() el: HTMLElement;\r\n\r\n private editor: Editor;\r\n private fileInputEl: HTMLInputElement;\r\n private attachmentInputEl: HTMLInputElement;\r\n\r\n componentDidLoad() {\r\n const editorEl = this.el.querySelector('.gb-rich-text__content') as HTMLElement;\r\n\r\n this.editor = new Editor({\r\n element: editorEl,\r\n extensions: [\r\n StarterKit,\r\n Underline,\r\n Link.configure({ openOnClick: false }),\r\n Image,\r\n Placeholder.configure({ placeholder: this.placeholder }),\r\n FileHandler.configure({\r\n allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],\r\n }),\r\n ],\r\n content: this.value,\r\n onUpdate: ({ editor }) => {\r\n const json = editor.getJSON();\r\n const html = editor.getHTML();\r\n this.richTextValueChanged.emit({ json: json, html: html });\r\n this.syncActiveStates(editor);\r\n },\r\n onSelectionUpdate: ({ editor }) => {\r\n this.syncActiveStates(editor);\r\n },\r\n onFocus: () => {\r\n this.isFocused = true;\r\n this.gbFocus.emit();\r\n },\r\n onBlur: () => {\r\n this.isFocused = false;\r\n this.gbBlur.emit();\r\n },\r\n });\r\n }\r\n\r\n private handleFileInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const src = reader.result as string;\r\n this.editor.chain().focus().setImage({ src }).run();\r\n };\r\n reader.readAsDataURL(file);\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private handleAttachmentInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n\r\n const attachment = { file, name: file.name, size: file.size, type: file.type };\r\n\r\n // Push to local state so UI renders it\r\n this.attachments = [...this.attachments, attachment];\r\n\r\n // Emit to Angular parent\r\n this.richTextAttachmentAdded.emit(attachment);\r\n\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private removeAttachment(index: number) {\r\n this.attachments = this.attachments.filter((_, i) => i !== index);\r\n }\r\n\r\n private formatFileSize(bytes: number): string {\r\n if (bytes < 1024) return `${bytes} B`;\r\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\r\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\r\n }\r\n\r\n private getFileExtension(name: string): string {\r\n const ext = name.split('.').pop()?.toLowerCase() ?? '';\r\n return ext;\r\n }\r\n\r\n // Syncs toolbar active states to current editor selection\r\n private syncActiveStates(editor: Editor) {\r\n this.isBold = editor.isActive('bold');\r\n this.isItalic = editor.isActive('italic');\r\n this.isUnderline = editor.isActive('underline');\r\n this.isH1 = editor.isActive('heading', { level: 1 });\r\n this.isH2 = editor.isActive('heading', { level: 2 });\r\n this.isQuote = editor.isActive('blockquote');\r\n this.isLink = editor.isActive('link');\r\n this.isBulletList = editor.isActive('bulletList');\r\n this.isOrderedList = editor.isActive('orderedList');\r\n }\r\n\r\n // Handles all toolbar action events from gb-wysiwyg-toolbar\r\n private handleToolbarAction(ev: CustomEvent<string>) {\r\n const e = this.editor;\r\n if (!e) return;\r\n\r\n const actionMap: Record<string, () => void> = {\r\n bold: () => e.chain().focus().toggleBold().run(),\r\n italic: () => e.chain().focus().toggleItalic().run(),\r\n underline: () => e.chain().focus().toggleUnderline().run(),\r\n h1: () => e.chain().focus().toggleHeading({ level: 1 }).run(),\r\n h2: () => e.chain().focus().toggleHeading({ level: 2 }).run(),\r\n quote: () => e.chain().focus().toggleBlockquote().run(),\r\n link: () => {\r\n const url = window.prompt('Enter URL');\r\n if (url) e.chain().focus().setLink({ href: url }).run();\r\n },\r\n bulletList: () => e.chain().focus().toggleBulletList().run(),\r\n orderedList: () => e.chain().focus().toggleOrderedList().run(),\r\n photo: () => this.fileInputEl?.click(),\r\n attachment: () => this.attachmentInputEl?.click(),\r\n };\r\n\r\n actionMap[ev.detail]?.();\r\n this.syncActiveStates(e);\r\n }\r\n\r\n @Watch('value')\r\n handleValueChange(newValue: string) {\r\n if (this.editor && newValue) {\r\n this.editor.commands.setContent(newValue);\r\n }\r\n }\r\n\r\n @Method()\r\n async getRichTextHTML(): Promise<string> {\r\n return this.editor?.getHTML() ?? '';\r\n }\r\n\r\n @Method()\r\n async clearContent(): Promise<void> {\r\n this.editor?.commands.clearContent();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.editor?.destroy();\r\n }\r\n\r\n render() {\r\n return (\r\n <div\r\n class={{\r\n 'gb-rich-text': true,\r\n 'gb-rich-text--focused': this.isFocused,\r\n 'gb-rich-text--error': this.destructive,\r\n 'gb-rich-text--disabled': this.disabled,\r\n }}\r\n >\r\n {this.label && <label class=\"gb-rich-text__label text-sm-medium\">{this.label}</label>}\r\n\r\n <div class=\"gb-rich-text__wrapper\">\r\n <gb-wysiwyg-toolbar\r\n disabledIcons={this.disabledIcons}\r\n is-bold={this.isBold}\r\n is-italic={this.isItalic}\r\n is-h1={this.isH1}\r\n is-h2={this.isH2}\r\n is-underline={this.isUnderline}\r\n is-quote={this.isQuote}\r\n is-link={this.isLink}\r\n is-bullet-list={this.isBulletList}\r\n is-ordered-list={this.isOrderedList}\r\n onToolbarAction={(ev: CustomEvent<string>) => this.handleToolbarAction(ev)}\r\n ></gb-wysiwyg-toolbar>\r\n\r\n {this.destructive && (\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"alert_circle\">\r\n <path\r\n d=\"M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z\"\r\n stroke=\"var(--color-icon-danger, #B51726)\"\r\n stroke-width=\"1.33333\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n )}\r\n {this.attachments.length > 0 && (\r\n <div class=\"gb-rich-text__attachments\">\r\n {this.attachments.map((attachment, index) => (\r\n <div class=\"gb-rich-text__attachment-item\" key={index}>\r\n {/* <span class=\"gb-rich-text__attachment-icon\">{this.getFileIcon(attachment.type)}</span> */}\r\n <span class=\"gb-rich-text__attachment-icon\">\r\n <gb-file-type-icon file-type={this.getFileExtension(attachment.name)} file-style=\"default\"></gb-file-type-icon>\r\n </span>\r\n <div class=\"gb-rich-text__attachment-info\">\r\n <span class=\"gb-rich-text__attachment-name text-sm-medium\">{attachment.name}</span>\r\n <span class=\"gb-rich-text__attachment-size text-xs-regular\">{this.formatFileSize(attachment.size)}</span>\r\n </div>\r\n {/* <button\r\n class=\"gb-rich-text__attachment-remove\"\r\n onMouseDown={(ev: MouseEvent) => {\r\n ev.preventDefault();\r\n this.removeAttachment(index);\r\n }}\r\n aria-label=\"Remove attachment\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\r\n <path d=\"M12 4L4 12M4 4l8 8\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\r\n </svg>\r\n </button> */}\r\n <gb-button-close color=\"gray\" size=\"sm\" onClick={() => this.removeAttachment(index)}></gb-button-close>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n\r\n {/* Hidden file input for local image selection */}\r\n <input\r\n ref={el => (this.fileInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\"image/*\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleFileInput(e)}\r\n />\r\n\r\n {/* Hidden file input for attachments */}\r\n <input\r\n ref={el => (this.attachmentInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleAttachmentInput(e)}\r\n />\r\n <div class=\"gb-rich-text__content\"></div>\r\n </div>\r\n\r\n {/* {(this.showHintText || this.errorText) && <span class=\"gb-rich-text__hint text-sm-regular\">{this.destructive ? this.errorText : this.hintText}</span>} */}\r\n {this.showHintText && (\r\n <>{!this.destructive ? <p class=\"gb-rich-text__hint text-sm-regular\">{this.hintText}</p> : <p class=\"error_text text-sm-regular\">{this.errorText}</p>}</>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gb-rich-text.js","sourceRoot":"","sources":["../../../src/components/gb-rich-text/gb-rich-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,IAAI,MAAM,wBAAwB,CAAC;AAC1C,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,MAAM,OAAO,UAAU;IALvB;QAMU,UAAK,GAAW,EAAE,CAAC;QACnB,gBAAW,GAAW,EAAE,CAAC;QACzB,iBAAY,GAAY,IAAI,CAAC;QAC7B,aAAQ,GAAW,EAAE,CAAC;QAEtB,aAAQ,GAAY,KAAK,CAAC;QAC1B,gBAAW,GAAY,KAAK,CAAC;QAC7B,cAAS,GAAW,EAAE,CAAC;QAC/B,+FAA+F;QACvF,kBAAa,GAAsB,EAAE,CAAC;QAE9C,iDAAiD;QACxC,cAAS,GAAY,KAAK,CAAC;QAC3B,WAAM,GAAY,KAAK,CAAC;QACxB,aAAQ,GAAY,KAAK,CAAC;QAC1B,SAAI,GAAY,KAAK,CAAC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qB,CAAC,CAAC,CAAC,GACrD;gBACF,4DAAK,KAAK,EAAC,uBAAuB,GAAO,CACrC;YAGL,IAAI,CAAC,YAAY,IAAI,CACpB,kBAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,oCAAoC,IAAE,IAAI,CAAC,QAAQ,CAAK,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,SAAS,CAAK,CAAI,CAC1J,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch, h, Fragment } from '@stencil/core';\r\nimport { Editor } from '@tiptap/core';\r\nimport Link from '@tiptap/extension-link';\r\nimport Placeholder from '@tiptap/extension-placeholder';\r\nimport Underline from '@tiptap/extension-underline';\r\nimport StarterKit from '@tiptap/starter-kit';\r\nimport FileHandler from '@tiptap/extension-file-handler';\r\nimport { ResizableImage } from './resizable-image';\r\n\r\n@Component({\r\n tag: 'gb-rich-text',\r\n styleUrl: 'gb-rich-text.css',\r\n shadow: false,\r\n})\r\nexport class GbRichText {\r\n @Prop() label: string = '';\r\n @Prop() placeholder: string = '';\r\n @Prop() showHintText: boolean = true;\r\n @Prop() hintText: string = '';\r\n @Prop() value: any;\r\n @Prop() disabled: boolean = false;\r\n @Prop() destructive: boolean = false;\r\n @Prop() errorText: string = '';\r\n // Toolbar icons to disable, e.g. disabled-icons=\"photo,attachment\" or ['photo', 'attachment'].\r\n @Prop() disabledIcons: string | string[] = [];\r\n\r\n // Active states tracked for toolbar highlighting\r\n @State() isFocused: boolean = false;\r\n @State() isBold: boolean = false;\r\n @State() isItalic: boolean = false;\r\n @State() isH1: boolean = false;\r\n @State() isH2: boolean = false;\r\n @State() isUnderline: boolean = false;\r\n @State() isQuote: boolean = false;\r\n @State() isLink: boolean = false;\r\n @State() isBulletList: boolean = false;\r\n @State() isOrderedList: boolean = false;\r\n @State() attachments: { file: File; name: string; size: number; type: string }[] = [];\r\n @Event() richTextValueChanged: EventEmitter<{ json: any; html: any }>;\r\n @Event() richTextAttachmentAdded: EventEmitter<{ file: File; name: string; size: number; type: string }>;\r\n @Event() gbBlur: EventEmitter<void>;\r\n @Event() gbFocus: EventEmitter<void>;\r\n\r\n @Element() el: HTMLElement;\r\n\r\n private editor: Editor;\r\n private fileInputEl: HTMLInputElement;\r\n private attachmentInputEl: HTMLInputElement;\r\n\r\n componentDidLoad() {\r\n const editorEl = this.el.querySelector('.gb-rich-text__content') as HTMLElement;\r\n\r\n this.editor = new Editor({\r\n element: editorEl,\r\n extensions: [\r\n StarterKit,\r\n Underline,\r\n Link.configure({ openOnClick: false }),\r\n ResizableImage,\r\n Placeholder.configure({ placeholder: this.placeholder }),\r\n FileHandler.configure({\r\n allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],\r\n }),\r\n ],\r\n content: this.value,\r\n onUpdate: ({ editor }) => {\r\n const json = editor.getJSON();\r\n const html = editor.getHTML();\r\n this.richTextValueChanged.emit({ json: json, html: html });\r\n this.syncActiveStates(editor);\r\n },\r\n onSelectionUpdate: ({ editor }) => {\r\n this.syncActiveStates(editor);\r\n },\r\n onFocus: () => {\r\n this.isFocused = true;\r\n this.gbFocus.emit();\r\n },\r\n onBlur: () => {\r\n this.isFocused = false;\r\n this.gbBlur.emit();\r\n },\r\n });\r\n }\r\n\r\n private handleFileInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const src = reader.result as string;\r\n this.editor.chain().focus().setImage({ src }).run();\r\n };\r\n reader.readAsDataURL(file);\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private handleAttachmentInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n\r\n const attachment = { file, name: file.name, size: file.size, type: file.type };\r\n\r\n // Push to local state so UI renders it\r\n this.attachments = [...this.attachments, attachment];\r\n\r\n // Emit to Angular parent\r\n this.richTextAttachmentAdded.emit(attachment);\r\n\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private removeAttachment(index: number) {\r\n this.attachments = this.attachments.filter((_, i) => i !== index);\r\n }\r\n\r\n private formatFileSize(bytes: number): string {\r\n if (bytes < 1024) return `${bytes} B`;\r\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\r\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\r\n }\r\n\r\n private getFileExtension(name: string): string {\r\n const ext = name.split('.').pop()?.toLowerCase() ?? '';\r\n return ext;\r\n }\r\n\r\n // Syncs toolbar active states to current editor selection\r\n private syncActiveStates(editor: Editor) {\r\n this.isBold = editor.isActive('bold');\r\n this.isItalic = editor.isActive('italic');\r\n this.isUnderline = editor.isActive('underline');\r\n this.isH1 = editor.isActive('heading', { level: 1 });\r\n this.isH2 = editor.isActive('heading', { level: 2 });\r\n this.isQuote = editor.isActive('blockquote');\r\n this.isLink = editor.isActive('link');\r\n this.isBulletList = editor.isActive('bulletList');\r\n this.isOrderedList = editor.isActive('orderedList');\r\n }\r\n\r\n // Handles all toolbar action events from gb-wysiwyg-toolbar\r\n private handleToolbarAction(ev: CustomEvent<string>) {\r\n const e = this.editor;\r\n if (!e) return;\r\n\r\n const actionMap: Record<string, () => void> = {\r\n bold: () => e.chain().focus().toggleBold().run(),\r\n italic: () => e.chain().focus().toggleItalic().run(),\r\n underline: () => e.chain().focus().toggleUnderline().run(),\r\n h1: () => e.chain().focus().toggleHeading({ level: 1 }).run(),\r\n h2: () => e.chain().focus().toggleHeading({ level: 2 }).run(),\r\n quote: () => e.chain().focus().toggleBlockquote().run(),\r\n link: () => {\r\n const url = window.prompt('Enter URL');\r\n if (url) e.chain().focus().setLink({ href: url }).run();\r\n },\r\n bulletList: () => e.chain().focus().toggleBulletList().run(),\r\n orderedList: () => e.chain().focus().toggleOrderedList().run(),\r\n photo: () => this.fileInputEl?.click(),\r\n attachment: () => this.attachmentInputEl?.click(),\r\n };\r\n\r\n actionMap[ev.detail]?.();\r\n this.syncActiveStates(e);\r\n }\r\n\r\n @Watch('value')\r\n handleValueChange(newValue: string) {\r\n if (this.editor && newValue) {\r\n this.editor.commands.setContent(newValue);\r\n }\r\n }\r\n\r\n @Method()\r\n async getRichTextHTML(): Promise<string> {\r\n return this.editor?.getHTML() ?? '';\r\n }\r\n\r\n @Method()\r\n async clearContent(): Promise<void> {\r\n this.editor?.commands.clearContent();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.editor?.destroy();\r\n }\r\n\r\n render() {\r\n return (\r\n <div\r\n class={{\r\n 'gb-rich-text': true,\r\n 'gb-rich-text--focused': this.isFocused,\r\n 'gb-rich-text--error': this.destructive,\r\n 'gb-rich-text--disabled': this.disabled,\r\n }}\r\n >\r\n {this.label && <label class=\"gb-rich-text__label text-sm-medium\">{this.label}</label>}\r\n\r\n <div class=\"gb-rich-text__wrapper\">\r\n <gb-wysiwyg-toolbar\r\n disabledIcons={this.disabledIcons}\r\n is-bold={this.isBold}\r\n is-italic={this.isItalic}\r\n is-h1={this.isH1}\r\n is-h2={this.isH2}\r\n is-underline={this.isUnderline}\r\n is-quote={this.isQuote}\r\n is-link={this.isLink}\r\n is-bullet-list={this.isBulletList}\r\n is-ordered-list={this.isOrderedList}\r\n onToolbarAction={(ev: CustomEvent<string>) => this.handleToolbarAction(ev)}\r\n ></gb-wysiwyg-toolbar>\r\n\r\n {this.destructive && (\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"alert_circle\">\r\n <path\r\n d=\"M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z\"\r\n stroke=\"var(--color-icon-danger, #B51726)\"\r\n stroke-width=\"1.33333\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n )}\r\n {this.attachments.length > 0 && (\r\n <div class=\"gb-rich-text__attachments\">\r\n {this.attachments.map((attachment, index) => (\r\n <div class=\"gb-rich-text__attachment-item\" key={index}>\r\n {/* <span class=\"gb-rich-text__attachment-icon\">{this.getFileIcon(attachment.type)}</span> */}\r\n <span class=\"gb-rich-text__attachment-icon\">\r\n <gb-file-type-icon file-type={this.getFileExtension(attachment.name)} file-style=\"default\"></gb-file-type-icon>\r\n </span>\r\n <div class=\"gb-rich-text__attachment-info\">\r\n <span class=\"gb-rich-text__attachment-name text-sm-medium\">{attachment.name}</span>\r\n <span class=\"gb-rich-text__attachment-size text-xs-regular\">{this.formatFileSize(attachment.size)}</span>\r\n </div>\r\n {/* <button\r\n class=\"gb-rich-text__attachment-remove\"\r\n onMouseDown={(ev: MouseEvent) => {\r\n ev.preventDefault();\r\n this.removeAttachment(index);\r\n }}\r\n aria-label=\"Remove attachment\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\r\n <path d=\"M12 4L4 12M4 4l8 8\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\r\n </svg>\r\n </button> */}\r\n <gb-button-close color=\"gray\" size=\"sm\" onClick={() => this.removeAttachment(index)}></gb-button-close>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n\r\n {/* Hidden file input for local image selection */}\r\n <input\r\n ref={el => (this.fileInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\"image/*\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleFileInput(e)}\r\n />\r\n\r\n {/* Hidden file input for attachments */}\r\n <input\r\n ref={el => (this.attachmentInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleAttachmentInput(e)}\r\n />\r\n <div class=\"gb-rich-text__content\"></div>\r\n </div>\r\n\r\n {/* {(this.showHintText || this.errorText) && <span class=\"gb-rich-text__hint text-sm-regular\">{this.destructive ? this.errorText : this.hintText}</span>} */}\r\n {this.showHintText && (\r\n <>{!this.destructive ? <p class=\"gb-rich-text__hint text-sm-regular\">{this.hintText}</p> : <p class=\"error_text text-sm-regular\">{this.errorText}</p>}</>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}