@telesign/boreal-web-components 0.1.0-alpha.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 (216) hide show
  1. package/LICENSE +21 -0
  2. package/components-build/bds-banner.d.ts +11 -0
  3. package/components-build/bds-banner.js +1 -0
  4. package/components-build/bds-typography.d.ts +11 -0
  5. package/components-build/bds-typography.js +1 -0
  6. package/components-build/index.d.ts +35 -0
  7. package/components-build/index.js +1 -0
  8. package/components-build/my-component.d.ts +11 -0
  9. package/components-build/my-component.js +1 -0
  10. package/components-build/p-B9wshZ_4.js +1 -0
  11. package/components-build/p-noyWJ11s.js +1 -0
  12. package/custom-elements.json +764 -0
  13. package/dist/boreal-web-components/boreal-web-components.css +1 -0
  14. package/dist/boreal-web-components/boreal-web-components.esm.js +1 -0
  15. package/dist/boreal-web-components/boreal-web-components.js +127 -0
  16. package/dist/boreal-web-components/css/boreal.css +1594 -0
  17. package/dist/boreal-web-components/css/global.css +682 -0
  18. package/dist/boreal-web-components/css/theme-connect.css +227 -0
  19. package/dist/boreal-web-components/css/theme-engage.css +227 -0
  20. package/dist/boreal-web-components/css/theme-protect.css +227 -0
  21. package/dist/boreal-web-components/css/theme-proximus.css +227 -0
  22. package/dist/boreal-web-components/index.esm.js +0 -0
  23. package/dist/boreal-web-components/p-412d037b.system.entry.js +1 -0
  24. package/dist/boreal-web-components/p-527a761b.entry.js +1 -0
  25. package/dist/boreal-web-components/p-5666a22a.system.entry.js +1 -0
  26. package/dist/boreal-web-components/p-B-PpI2Xv.system.js +1 -0
  27. package/dist/boreal-web-components/p-B9wshZ_4.js +1 -0
  28. package/dist/boreal-web-components/p-BQdH0ijK.system.js +2 -0
  29. package/dist/boreal-web-components/p-BbPAtVJG.system.js +1 -0
  30. package/dist/boreal-web-components/p-CMd-Mv-5.system.js +1 -0
  31. package/dist/boreal-web-components/p-CaVEtaG3.system.js +1 -0
  32. package/dist/boreal-web-components/p-DQuL1Twl.js +1 -0
  33. package/dist/boreal-web-components/p-DgFiTd6X.js +2 -0
  34. package/dist/boreal-web-components/p-YWpyar7R.system.js +1 -0
  35. package/dist/boreal-web-components/p-b818618b.entry.js +1 -0
  36. package/dist/boreal-web-components/p-d596406b.entry.js +1 -0
  37. package/dist/boreal-web-components/p-e37e7dba.system.entry.js +1 -0
  38. package/dist/boreal-web-components/p-noyWJ11s.js +1 -0
  39. package/dist/boreal-web-components/scss/global/_fonts.scss +1 -0
  40. package/dist/boreal-web-components/scss/global/_index.scss +3 -0
  41. package/dist/boreal-web-components/scss/global/_reset.scss +50 -0
  42. package/dist/boreal-web-components/scss/global/_typography.scss +156 -0
  43. package/dist/boreal-web-components/scss/maps/_primitives.scss +461 -0
  44. package/dist/boreal-web-components/scss/maps/_theme-connect.scss +227 -0
  45. package/dist/boreal-web-components/scss/maps/_theme-engage.scss +227 -0
  46. package/dist/boreal-web-components/scss/maps/_theme-protect.scss +227 -0
  47. package/dist/boreal-web-components/scss/maps/_theme-proximus.scss +227 -0
  48. package/dist/boreal-web-components/scss/variables/_primitives.scss +459 -0
  49. package/dist/boreal-web-components/scss/variables/_theme-connect.scss +225 -0
  50. package/dist/boreal-web-components/scss/variables/_theme-engage.scss +225 -0
  51. package/dist/boreal-web-components/scss/variables/_theme-protect.scss +225 -0
  52. package/dist/boreal-web-components/scss/variables/_theme-proximus.scss +225 -0
  53. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  54. package/dist/cjs/attributes-RPVEtBdj.js +90 -0
  55. package/dist/cjs/bds-banner.cjs.entry.js +130 -0
  56. package/dist/cjs/bds-typography.cjs.entry.js +167 -0
  57. package/dist/cjs/boreal-web-components.cjs.js +46 -0
  58. package/dist/cjs/index-CD9v53WJ.js +133 -0
  59. package/dist/cjs/index-Cdb66Tqj.js +2342 -0
  60. package/dist/cjs/index.cjs.js +2 -0
  61. package/dist/cjs/loader.cjs.js +13 -0
  62. package/dist/cjs/my-component.cjs.entry.js +29 -0
  63. package/dist/collection/collection-manifest.json +14 -0
  64. package/dist/collection/components/feedback/bds-banner/bds-banner.css +101 -0
  65. package/dist/collection/components/feedback/bds-banner/bds-banner.js +266 -0
  66. package/dist/collection/components/feedback/bds-banner/types/IBanner.js +1 -0
  67. package/dist/collection/components/my-component/my-component.css +3 -0
  68. package/dist/collection/components/my-component/my-component.js +95 -0
  69. package/dist/collection/components/titles-text/bds-typography/bds-typography.css +183 -0
  70. package/dist/collection/components/titles-text/bds-typography/bds-typography.js +577 -0
  71. package/dist/collection/components/titles-text/bds-typography/types/ITypography.js +1 -0
  72. package/dist/collection/components/titles-text/bds-typography/types/enum.js +23 -0
  73. package/dist/collection/components/titles-text/bds-typography/types/types.js +1 -0
  74. package/dist/collection/components/titles-text/bds-typography/utils/bds-typography-utils.js +41 -0
  75. package/dist/collection/css/boreal.css +1594 -0
  76. package/dist/collection/css/global.css +682 -0
  77. package/dist/collection/css/theme-connect.css +227 -0
  78. package/dist/collection/css/theme-engage.css +227 -0
  79. package/dist/collection/css/theme-protect.css +227 -0
  80. package/dist/collection/css/theme-proximus.css +227 -0
  81. package/dist/collection/index.js +1 -0
  82. package/dist/collection/mixins/anchored.mixin.js +272 -0
  83. package/dist/collection/mixins/floating.mixin.js +181 -0
  84. package/dist/collection/mixins/form-associated.mixin.js +95 -0
  85. package/dist/collection/mixins/index.js +3 -0
  86. package/dist/collection/scss/global/_fonts.scss +1 -0
  87. package/dist/collection/scss/global/_index.scss +3 -0
  88. package/dist/collection/scss/global/_reset.scss +50 -0
  89. package/dist/collection/scss/global/_typography.scss +156 -0
  90. package/dist/collection/scss/maps/_primitives.scss +461 -0
  91. package/dist/collection/scss/maps/_theme-connect.scss +227 -0
  92. package/dist/collection/scss/maps/_theme-engage.scss +227 -0
  93. package/dist/collection/scss/maps/_theme-protect.scss +227 -0
  94. package/dist/collection/scss/maps/_theme-proximus.scss +227 -0
  95. package/dist/collection/scss/variables/_primitives.scss +459 -0
  96. package/dist/collection/scss/variables/_theme-connect.scss +225 -0
  97. package/dist/collection/scss/variables/_theme-engage.scss +225 -0
  98. package/dist/collection/scss/variables/_theme-protect.scss +225 -0
  99. package/dist/collection/scss/variables/_theme-proximus.scss +225 -0
  100. package/dist/collection/services/floating/interfaces/Floating.js +1 -0
  101. package/dist/collection/services/floating/interfaces/Positioning.js +1 -0
  102. package/dist/collection/services/floating/interfaces/Props.js +1 -0
  103. package/dist/collection/services/floating/positioning.service.js +71 -0
  104. package/dist/collection/services/floating/types/Arrow.js +1 -0
  105. package/dist/collection/services/logger/Logger.js +47 -0
  106. package/dist/collection/types/alignment.js +6 -0
  107. package/dist/collection/types/form.js +1 -0
  108. package/dist/collection/types/index.js +5 -0
  109. package/dist/collection/types/position.js +11 -0
  110. package/dist/collection/types/size.js +7 -0
  111. package/dist/collection/types/states.js +22 -0
  112. package/dist/collection/types/stylesMap.js +1 -0
  113. package/dist/collection/utils/a11y/attributes.js +80 -0
  114. package/dist/collection/utils/a11y/index.js +1 -0
  115. package/dist/collection/utils/constants/common/Events.js +10 -0
  116. package/dist/collection/utils/constants/common/Keys.js +16 -0
  117. package/dist/collection/utils/dom/elements.js +22 -0
  118. package/dist/collection/utils/dom/index.js +1 -0
  119. package/dist/collection/utils/form/index.js +1 -0
  120. package/dist/collection/utils/form/internals.js +79 -0
  121. package/dist/collection/utils/helpers/common/BaseAttributes.js +17 -0
  122. package/dist/collection/utils/index.js +3 -0
  123. package/dist/css/boreal.css +1594 -0
  124. package/dist/css/global.css +682 -0
  125. package/dist/css/theme-connect.css +227 -0
  126. package/dist/css/theme-engage.css +227 -0
  127. package/dist/css/theme-protect.css +227 -0
  128. package/dist/css/theme-proximus.css +227 -0
  129. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  130. package/dist/esm/attributes-B9wshZ_4.js +86 -0
  131. package/dist/esm/bds-banner.entry.js +128 -0
  132. package/dist/esm/bds-typography.entry.js +165 -0
  133. package/dist/esm/boreal-web-components.js +42 -0
  134. package/dist/esm/index-DgFiTd6X.js +2332 -0
  135. package/dist/esm/index-noyWJ11s.js +131 -0
  136. package/dist/esm/index.js +1 -0
  137. package/dist/esm/loader.js +11 -0
  138. package/dist/esm/my-component.entry.js +27 -0
  139. package/dist/esm/polyfills/core-js.js +11 -0
  140. package/dist/esm/polyfills/dom.js +79 -0
  141. package/dist/esm/polyfills/es5-html-element.js +1 -0
  142. package/dist/esm/polyfills/index.js +34 -0
  143. package/dist/esm/polyfills/system.js +6 -0
  144. package/dist/esm-es5/app-globals-DQuL1Twl.js +1 -0
  145. package/dist/esm-es5/attributes-B9wshZ_4.js +1 -0
  146. package/dist/esm-es5/bds-banner.entry.js +1 -0
  147. package/dist/esm-es5/bds-typography.entry.js +1 -0
  148. package/dist/esm-es5/boreal-web-components.js +1 -0
  149. package/dist/esm-es5/index-DgFiTd6X.js +2 -0
  150. package/dist/esm-es5/index-noyWJ11s.js +1 -0
  151. package/dist/esm-es5/index.js +0 -0
  152. package/dist/esm-es5/loader.js +1 -0
  153. package/dist/esm-es5/my-component.entry.js +1 -0
  154. package/dist/index.cjs.js +1 -0
  155. package/dist/index.js +1 -0
  156. package/dist/scss/global/_fonts.scss +1 -0
  157. package/dist/scss/global/_index.scss +3 -0
  158. package/dist/scss/global/_reset.scss +50 -0
  159. package/dist/scss/global/_typography.scss +156 -0
  160. package/dist/scss/maps/_primitives.scss +461 -0
  161. package/dist/scss/maps/_theme-connect.scss +227 -0
  162. package/dist/scss/maps/_theme-engage.scss +227 -0
  163. package/dist/scss/maps/_theme-protect.scss +227 -0
  164. package/dist/scss/maps/_theme-proximus.scss +227 -0
  165. package/dist/scss/variables/_primitives.scss +459 -0
  166. package/dist/scss/variables/_theme-connect.scss +225 -0
  167. package/dist/scss/variables/_theme-engage.scss +225 -0
  168. package/dist/scss/variables/_theme-protect.scss +225 -0
  169. package/dist/scss/variables/_theme-proximus.scss +225 -0
  170. package/dist/types/components/feedback/bds-banner/bds-banner.d.ts +71 -0
  171. package/dist/types/components/feedback/bds-banner/types/IBanner.d.ts +10 -0
  172. package/dist/types/components/my-component/my-component.d.ts +16 -0
  173. package/dist/types/components/titles-text/bds-typography/bds-typography.d.ts +99 -0
  174. package/dist/types/components/titles-text/bds-typography/types/ITypography.d.ts +22 -0
  175. package/dist/types/components/titles-text/bds-typography/types/enum.d.ts +24 -0
  176. package/dist/types/components/titles-text/bds-typography/types/types.d.ts +4 -0
  177. package/dist/types/components/titles-text/bds-typography/utils/bds-typography-utils.d.ts +15 -0
  178. package/dist/types/components.d.ts +565 -0
  179. package/dist/types/index.d.ts +11 -0
  180. package/dist/types/mixins/anchored.mixin.d.ts +228 -0
  181. package/dist/types/mixins/floating.mixin.d.ts +158 -0
  182. package/dist/types/mixins/form-associated.mixin.d.ts +127 -0
  183. package/dist/types/mixins/index.d.ts +4 -0
  184. package/dist/types/services/floating/interfaces/Floating.d.ts +38 -0
  185. package/dist/types/services/floating/interfaces/Positioning.d.ts +22 -0
  186. package/dist/types/services/floating/interfaces/Props.d.ts +35 -0
  187. package/dist/types/services/floating/positioning.service.d.ts +45 -0
  188. package/dist/types/services/floating/types/Arrow.d.ts +7 -0
  189. package/dist/types/services/logger/Logger.d.ts +50 -0
  190. package/dist/types/stencil-public-runtime.d.ts +1858 -0
  191. package/dist/types/types/alignment.d.ts +8 -0
  192. package/dist/types/types/form.d.ts +7 -0
  193. package/dist/types/types/index.d.ts +6 -0
  194. package/dist/types/types/position.d.ts +13 -0
  195. package/dist/types/types/size.d.ts +9 -0
  196. package/dist/types/types/states.d.ts +26 -0
  197. package/dist/types/types/stylesMap.d.ts +2 -0
  198. package/dist/types/utils/a11y/attributes.d.ts +13 -0
  199. package/dist/types/utils/a11y/index.d.ts +2 -0
  200. package/dist/types/utils/constants/common/Events.d.ts +14 -0
  201. package/dist/types/utils/constants/common/Keys.d.ts +18 -0
  202. package/dist/types/utils/dom/elements.d.ts +12 -0
  203. package/dist/types/utils/dom/index.d.ts +2 -0
  204. package/dist/types/utils/form/index.d.ts +2 -0
  205. package/dist/types/utils/form/internals.d.ts +66 -0
  206. package/dist/types/utils/helpers/common/BaseAttributes.d.ts +16 -0
  207. package/dist/types/utils/index.d.ts +4 -0
  208. package/loader/cdn.js +2 -0
  209. package/loader/index.cjs.js +2 -0
  210. package/loader/index.d.ts +24 -0
  211. package/loader/index.es2017.js +2 -0
  212. package/loader/index.js +3 -0
  213. package/package.json +96 -0
  214. package/readme.md +111 -0
  215. package/scripts/copy-styles.js +18 -0
  216. package/scripts/postbuild.js +21 -0
@@ -0,0 +1,577 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { ALIGNMENT } from "../../../types/alignment";
3
+ import { SIZES } from "../../../types/size";
4
+ import { STATES } from "../../../types/states";
5
+ import { inheritAriaAttributes } from "../../../utils/a11y/index";
6
+ import { TAG_ELEMENT, VARIANT_TYPOGRAPHY } from "./types/enum";
7
+ import { FILENAME, getAttributesByTag, VARIANT_CONFIG } from "./utils/bds-typography-utils";
8
+ /**
9
+ * Typography component for displaying text with various styles, sizes, and interactive features.
10
+ *
11
+ * @summary A comprehensive typography component that supports multiple text variants, sizes, alignments, states, and link functionality.
12
+ *
13
+ * @slot - The text displayed in the typography.
14
+ *
15
+ * @attr {string} variant - The variant of the typography for styling the text. Options: label, display, heading, subheading, helper, link, code, caption
16
+ * @attr {string} element - Defines the HTML element. For `heading` variant, the text size adjusts to the HTML heading level (`h1` through `h6`).
17
+ * @attr {string} state - The state of the typography. Only available for the `helper` and `label` variants. Options: default, error, disabled, hover, active, focus, visited
18
+ * @attr {string} align - The text alignment. Options: start, center, end, inherit
19
+ * @attr {string} size - The size of the typography. For `display` variant all options are available (`xl`, `lg`, `md`, `sm`), while for `link` variant only `md` and `sm` are available.
20
+ * @attr {boolean} is-required - Shows a required indicator when used with `label` variant.
21
+ * @attr {boolean} ellipsis - Truncates text with an ellipsis when it overflows.
22
+ * @attr {number} max-lines - Maximum number of lines to show before truncating with ellipsis.
23
+ * @attr {string} href - URL when the typography is an `a` element and a `link` variant.
24
+ * @attr {string} target - Specifies where to open the link. Options: _self, _blank, _top, _parent
25
+ * @attr {boolean} is-downloadable - Makes the `link` download a file.
26
+ * @attr {string} filename - Suggested filename when downloading a file from the `link`.
27
+ * @attr {string} html-for - The for attribute when rendered as a label
28
+ * @attr {string} tooltip-text - Text to display inside the tooltip when hovering the info icon. Only applicable for `heading`, `subheading`, and `label` variants.
29
+ * @attr {string} custom-class - Additional custom CSS class
30
+ *
31
+ * @property {string} variant - The variant of the typography for styling the text. Options: label, display, heading, subheading, helper, link, code, caption
32
+ * @property {string} element - Defines the HTML element. For `heading` variant, the text size adjusts to the HTML heading level (`h1` through `h6`).
33
+ * @property {string} state - The state of the typography. Only available for the `helper` and `label` variants. Options: default, error, disabled, hover, active, focus, visited
34
+ * @property {string} align - The text alignment. Options: start, center, end, inherit
35
+ * @property {string} size - The size of the typography. For `display` variant all options are available (`xl`, `lg`, `md`, `sm`), while for `link` variant only `md` and `sm` are available.
36
+ * @property {boolean} isRequired - Shows a required indicator when used with `label` variant.
37
+ * @property {boolean} ellipsis - Truncates text with an ellipsis when it overflows.
38
+ * @property {number} maxLines - Maximum number of lines to show before truncating with ellipsis.
39
+ * @property {string} href - URL when the typography is an `a` element and a `link` variant.
40
+ * @property {string} target - Specifies where to open the link. Options: _self, _blank, _top, _parent
41
+ * @property {boolean} isDownloadable - Makes the `link` download a file.
42
+ * @property {string} filename - Suggested filename when downloading a file from the `link`.
43
+ * @property {string} htmlFor - The for attribute when rendered as a label
44
+ * @property {string} tooltipText - Text to display inside the tooltip when hovering the info icon. Only applicable for `heading`, `subheading`, and `label` variants.
45
+ * @property {string} customClass - Additional custom CSS class
46
+ *
47
+ * @default 'display' - Default variant value
48
+ * @default 'p' - Default element value
49
+ * @default 'start' - Default align value
50
+ * @default 'md' - Default size value
51
+ * @default 'default' - Default state value
52
+ * @default false - Default isRequired state
53
+ * @default false - Default ellipsis state
54
+ * @default 1 - Default maxLines value
55
+ * @default '' - Default href value
56
+ * @default '' - Default target value
57
+ * @default false - Default isDownloadable state
58
+ * @default 'download' - Default filename value
59
+ * @default '' - Default tooltipText value
60
+ */
61
+ export class BdsTypography {
62
+ constructor() {
63
+ this.inheritedAttributes = {};
64
+ /** Typography visual variant. */
65
+ this.variant = VARIANT_TYPOGRAPHY.DISPLAY;
66
+ /** Typography size token. */
67
+ this.size = SIZES.M;
68
+ /** Visual state (if supported by variant). */
69
+ this.state = STATES.DEFAULT;
70
+ /** Additional custom CSS class. */
71
+ this.customClass = '';
72
+ /** HTML tag used for rendering. */
73
+ this.element = TAG_ELEMENT.P;
74
+ /** Text alignment. */
75
+ this.align = ALIGNMENT.START;
76
+ /** Enables text ellipsis. */
77
+ this.ellipsis = false;
78
+ /** Max lines when ellipsis is enabled. */
79
+ this.maxLines = 1;
80
+ /** Tooltip text (variant must support it). */
81
+ this.tooltipText = '';
82
+ /** Marks the field as required. */
83
+ this.isRequired = false;
84
+ /** For attribute when rendered as a label. */
85
+ this.htmlFor = undefined;
86
+ /** Link href when rendered as anchor. */
87
+ this.href = null;
88
+ /** Anchor target. */
89
+ this.target = null;
90
+ /** Enables download behavior for anchor. */
91
+ this.isDownloadable = false;
92
+ /** Suggested download filename. */
93
+ this.filename = FILENAME;
94
+ /** Sanitized href for security. */
95
+ this.sanitizedHref = '';
96
+ }
97
+ async updateSanitizedHref() {
98
+ if (this.getTagName === 'a' && this.href !== null) {
99
+ const { sanitizeUrl } = await import('@braintree/sanitize-url');
100
+ this.sanitizedHref = sanitizeUrl(this.href);
101
+ }
102
+ else
103
+ this.sanitizedHref = '';
104
+ }
105
+ async componentWillLoad() {
106
+ if (this.getTagName === TAG_ELEMENT.A && this.href !== null)
107
+ await this.updateSanitizedHref();
108
+ this.inheritedAttributes = {
109
+ ...inheritAriaAttributes(this.el),
110
+ };
111
+ }
112
+ get getTagName() {
113
+ if (this.variant === VARIANT_TYPOGRAPHY.LINK)
114
+ return TAG_ELEMENT.A;
115
+ return this.element.toLowerCase();
116
+ }
117
+ getVariantConfig() {
118
+ return VARIANT_CONFIG[this.variant] ?? {};
119
+ }
120
+ getAccessibilityTags() {
121
+ const { isRequired = null } = this.getVariantConfig();
122
+ const isInteractiveTag = ['a', 'label'].includes(this.getTagName);
123
+ return {
124
+ 'aria-required': this.isRequired && isRequired,
125
+ 'aria-disabled': this.state === STATES.DISABLED && isInteractiveTag,
126
+ };
127
+ }
128
+ getVariantStateStyles() {
129
+ const config = this.getVariantConfig();
130
+ return {
131
+ [`bds-typography--${this.variant}`]: true,
132
+ [`bds-typography--align-${this.align}`]: true,
133
+ [`bds-typography--${this.state}`]: !!(config?.states && config?.states.includes(this.state)),
134
+ [`bds-typography--size-${this.size}`]: !!(config?.size && config?.size.includes(this.size)),
135
+ 'bds-typography--required': !!(config?.isRequired && this.isRequired),
136
+ 'bds-typography--ellipsis': this.ellipsis && this.maxLines <= 1,
137
+ 'bds-typography--ellipsis-multiline': this.ellipsis && this.maxLines > 1,
138
+ [this.customClass]: this.customClass !== '',
139
+ };
140
+ }
141
+ render() {
142
+ const TagName = this.getTagName;
143
+ const attributes = {
144
+ ...getAttributesByTag(this, TagName),
145
+ ...this.inheritedAttributes,
146
+ ...this.getAccessibilityTags(),
147
+ };
148
+ const classes = this.getVariantStateStyles();
149
+ const { canUseTooltip = null, isRequired = null } = this.getVariantConfig();
150
+ return (h(Host, { key: '6091692b1cb6bf1d3295f0834c8d25425633d65a', class: "bds-typography" }, h(TagName, { key: '0cc91c35fa1cc36c99101a79fae0c8b5cf44de43', class: classes, style: { webkitLineClamp: this.maxLines }, ...attributes }, h("slot", { key: '973848fba8211cb5ef869e0e48fb1806bd5efdec' }), this.isRequired && isRequired && (h("em", { key: 'dd89574e9dedd55905ae4c7bcd57604f26fbd03b', class: "bds-typography__required-indicator", "aria-hidden": "true" }, "*")), this.tooltipText && canUseTooltip && h("em", { key: '473b0de17bd095b97d54d24d2f3aa75f8a8e4922', class: "bds-typography__info-icon bds-icon-info-circle" }))));
151
+ }
152
+ static get is() { return "bds-typography"; }
153
+ static get originalStyleUrls() {
154
+ return {
155
+ "$": ["bds-typography.scss"]
156
+ };
157
+ }
158
+ static get styleUrls() {
159
+ return {
160
+ "$": ["bds-typography.css"]
161
+ };
162
+ }
163
+ static get properties() {
164
+ return {
165
+ "variant": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "ITypography['variant']",
170
+ "resolved": "\"caption\" | \"code\" | \"display\" | \"heading\" | \"helper\" | \"label\" | \"link\" | \"subheading\"",
171
+ "references": {
172
+ "ITypography": {
173
+ "location": "import",
174
+ "path": "./types/ITypography",
175
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
176
+ "referenceLocation": "ITypography"
177
+ }
178
+ }
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Typography visual variant."
185
+ },
186
+ "getter": false,
187
+ "setter": false,
188
+ "reflect": true,
189
+ "attribute": "variant",
190
+ "defaultValue": "VARIANT_TYPOGRAPHY.DISPLAY"
191
+ },
192
+ "size": {
193
+ "type": "string",
194
+ "mutable": false,
195
+ "complexType": {
196
+ "original": "ITypography['size']",
197
+ "resolved": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",
198
+ "references": {
199
+ "ITypography": {
200
+ "location": "import",
201
+ "path": "./types/ITypography",
202
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
203
+ "referenceLocation": "ITypography"
204
+ }
205
+ }
206
+ },
207
+ "required": false,
208
+ "optional": false,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "Typography size token."
212
+ },
213
+ "getter": false,
214
+ "setter": false,
215
+ "reflect": true,
216
+ "attribute": "size",
217
+ "defaultValue": "SIZES.M"
218
+ },
219
+ "state": {
220
+ "type": "string",
221
+ "mutable": false,
222
+ "complexType": {
223
+ "original": "ITypography['state']",
224
+ "resolved": "\"active\" | \"default\" | \"disabled\" | \"error\" | \"focus\" | \"hover\" | \"visited\"",
225
+ "references": {
226
+ "ITypography": {
227
+ "location": "import",
228
+ "path": "./types/ITypography",
229
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
230
+ "referenceLocation": "ITypography"
231
+ }
232
+ }
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Visual state (if supported by variant)."
239
+ },
240
+ "getter": false,
241
+ "setter": false,
242
+ "reflect": true,
243
+ "attribute": "state",
244
+ "defaultValue": "STATES.DEFAULT"
245
+ },
246
+ "customClass": {
247
+ "type": "string",
248
+ "mutable": false,
249
+ "complexType": {
250
+ "original": "string",
251
+ "resolved": "string",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Additional custom CSS class."
259
+ },
260
+ "getter": false,
261
+ "setter": false,
262
+ "reflect": false,
263
+ "attribute": "custom-class",
264
+ "defaultValue": "''"
265
+ },
266
+ "element": {
267
+ "type": "string",
268
+ "mutable": false,
269
+ "complexType": {
270
+ "original": "ITypography['element']",
271
+ "resolved": "\"a\" | \"div\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\" | \"p\" | \"span\"",
272
+ "references": {
273
+ "ITypography": {
274
+ "location": "import",
275
+ "path": "./types/ITypography",
276
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
277
+ "referenceLocation": "ITypography"
278
+ }
279
+ }
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "HTML tag used for rendering."
286
+ },
287
+ "getter": false,
288
+ "setter": false,
289
+ "reflect": false,
290
+ "attribute": "element",
291
+ "defaultValue": "TAG_ELEMENT.P"
292
+ },
293
+ "align": {
294
+ "type": "string",
295
+ "mutable": false,
296
+ "complexType": {
297
+ "original": "ITypography['align']",
298
+ "resolved": "\"center\" | \"end\" | \"inherit\" | \"start\"",
299
+ "references": {
300
+ "ITypography": {
301
+ "location": "import",
302
+ "path": "./types/ITypography",
303
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
304
+ "referenceLocation": "ITypography"
305
+ }
306
+ }
307
+ },
308
+ "required": false,
309
+ "optional": false,
310
+ "docs": {
311
+ "tags": [],
312
+ "text": "Text alignment."
313
+ },
314
+ "getter": false,
315
+ "setter": false,
316
+ "reflect": false,
317
+ "attribute": "align",
318
+ "defaultValue": "ALIGNMENT.START"
319
+ },
320
+ "ellipsis": {
321
+ "type": "boolean",
322
+ "mutable": false,
323
+ "complexType": {
324
+ "original": "ITypography['ellipsis']",
325
+ "resolved": "boolean",
326
+ "references": {
327
+ "ITypography": {
328
+ "location": "import",
329
+ "path": "./types/ITypography",
330
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
331
+ "referenceLocation": "ITypography"
332
+ }
333
+ }
334
+ },
335
+ "required": false,
336
+ "optional": false,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": "Enables text ellipsis."
340
+ },
341
+ "getter": false,
342
+ "setter": false,
343
+ "reflect": false,
344
+ "attribute": "ellipsis",
345
+ "defaultValue": "false"
346
+ },
347
+ "maxLines": {
348
+ "type": "number",
349
+ "mutable": false,
350
+ "complexType": {
351
+ "original": "ITypography['maxLines']",
352
+ "resolved": "number",
353
+ "references": {
354
+ "ITypography": {
355
+ "location": "import",
356
+ "path": "./types/ITypography",
357
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
358
+ "referenceLocation": "ITypography"
359
+ }
360
+ }
361
+ },
362
+ "required": false,
363
+ "optional": false,
364
+ "docs": {
365
+ "tags": [],
366
+ "text": "Max lines when ellipsis is enabled."
367
+ },
368
+ "getter": false,
369
+ "setter": false,
370
+ "reflect": false,
371
+ "attribute": "max-lines",
372
+ "defaultValue": "1"
373
+ },
374
+ "tooltipText": {
375
+ "type": "string",
376
+ "mutable": false,
377
+ "complexType": {
378
+ "original": "ITypography['tooltipText']",
379
+ "resolved": "string",
380
+ "references": {
381
+ "ITypography": {
382
+ "location": "import",
383
+ "path": "./types/ITypography",
384
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
385
+ "referenceLocation": "ITypography"
386
+ }
387
+ }
388
+ },
389
+ "required": false,
390
+ "optional": false,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": "Tooltip text (variant must support it)."
394
+ },
395
+ "getter": false,
396
+ "setter": false,
397
+ "reflect": false,
398
+ "attribute": "tooltip-text",
399
+ "defaultValue": "''"
400
+ },
401
+ "isRequired": {
402
+ "type": "boolean",
403
+ "mutable": false,
404
+ "complexType": {
405
+ "original": "ITypography['isRequired']",
406
+ "resolved": "boolean",
407
+ "references": {
408
+ "ITypography": {
409
+ "location": "import",
410
+ "path": "./types/ITypography",
411
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
412
+ "referenceLocation": "ITypography"
413
+ }
414
+ }
415
+ },
416
+ "required": false,
417
+ "optional": false,
418
+ "docs": {
419
+ "tags": [],
420
+ "text": "Marks the field as required."
421
+ },
422
+ "getter": false,
423
+ "setter": false,
424
+ "reflect": true,
425
+ "attribute": "is-required",
426
+ "defaultValue": "false"
427
+ },
428
+ "htmlFor": {
429
+ "type": "string",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "ITypography['htmlFor']",
433
+ "resolved": "string",
434
+ "references": {
435
+ "ITypography": {
436
+ "location": "import",
437
+ "path": "./types/ITypography",
438
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
439
+ "referenceLocation": "ITypography"
440
+ }
441
+ }
442
+ },
443
+ "required": false,
444
+ "optional": false,
445
+ "docs": {
446
+ "tags": [],
447
+ "text": "For attribute when rendered as a label."
448
+ },
449
+ "getter": false,
450
+ "setter": false,
451
+ "reflect": false,
452
+ "attribute": "html-for",
453
+ "defaultValue": "undefined"
454
+ },
455
+ "href": {
456
+ "type": "string",
457
+ "mutable": false,
458
+ "complexType": {
459
+ "original": "ITypography['href']",
460
+ "resolved": "string",
461
+ "references": {
462
+ "ITypography": {
463
+ "location": "import",
464
+ "path": "./types/ITypography",
465
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
466
+ "referenceLocation": "ITypography"
467
+ }
468
+ }
469
+ },
470
+ "required": false,
471
+ "optional": false,
472
+ "docs": {
473
+ "tags": [],
474
+ "text": "Link href when rendered as anchor."
475
+ },
476
+ "getter": false,
477
+ "setter": false,
478
+ "reflect": false,
479
+ "attribute": "href",
480
+ "defaultValue": "null"
481
+ },
482
+ "target": {
483
+ "type": "string",
484
+ "mutable": false,
485
+ "complexType": {
486
+ "original": "ITypography['target']",
487
+ "resolved": "\"\" | \"_blank\" | \"_parent\" | \"_self\" | \"_top\"",
488
+ "references": {
489
+ "ITypography": {
490
+ "location": "import",
491
+ "path": "./types/ITypography",
492
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
493
+ "referenceLocation": "ITypography"
494
+ }
495
+ }
496
+ },
497
+ "required": false,
498
+ "optional": false,
499
+ "docs": {
500
+ "tags": [],
501
+ "text": "Anchor target."
502
+ },
503
+ "getter": false,
504
+ "setter": false,
505
+ "reflect": false,
506
+ "attribute": "target",
507
+ "defaultValue": "null"
508
+ },
509
+ "isDownloadable": {
510
+ "type": "boolean",
511
+ "mutable": false,
512
+ "complexType": {
513
+ "original": "ITypography['isDownloadable']",
514
+ "resolved": "boolean",
515
+ "references": {
516
+ "ITypography": {
517
+ "location": "import",
518
+ "path": "./types/ITypography",
519
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
520
+ "referenceLocation": "ITypography"
521
+ }
522
+ }
523
+ },
524
+ "required": false,
525
+ "optional": false,
526
+ "docs": {
527
+ "tags": [],
528
+ "text": "Enables download behavior for anchor."
529
+ },
530
+ "getter": false,
531
+ "setter": false,
532
+ "reflect": false,
533
+ "attribute": "is-downloadable",
534
+ "defaultValue": "false"
535
+ },
536
+ "filename": {
537
+ "type": "string",
538
+ "mutable": false,
539
+ "complexType": {
540
+ "original": "ITypography['filename']",
541
+ "resolved": "string",
542
+ "references": {
543
+ "ITypography": {
544
+ "location": "import",
545
+ "path": "./types/ITypography",
546
+ "id": "src/components/titles-text/bds-typography/types/ITypography.ts::ITypography",
547
+ "referenceLocation": "ITypography"
548
+ }
549
+ }
550
+ },
551
+ "required": false,
552
+ "optional": false,
553
+ "docs": {
554
+ "tags": [],
555
+ "text": "Suggested download filename."
556
+ },
557
+ "getter": false,
558
+ "setter": false,
559
+ "reflect": false,
560
+ "attribute": "filename",
561
+ "defaultValue": "FILENAME"
562
+ }
563
+ };
564
+ }
565
+ static get states() {
566
+ return {
567
+ "sanitizedHref": {}
568
+ };
569
+ }
570
+ static get elementRef() { return "el"; }
571
+ static get watchers() {
572
+ return [{
573
+ "propName": "href",
574
+ "methodName": "updateSanitizedHref"
575
+ }];
576
+ }
577
+ }
@@ -0,0 +1,23 @@
1
+ export const VARIANT_TYPOGRAPHY = {
2
+ DISPLAY: 'display',
3
+ HEADING: 'heading',
4
+ SUBHEADING: 'subheading',
5
+ LABEL: 'label',
6
+ HELPER: 'helper',
7
+ LINK: 'link',
8
+ CODE: 'code',
9
+ CAPTION: 'caption',
10
+ };
11
+ export const TAG_ELEMENT = {
12
+ P: 'p',
13
+ H1: 'h1',
14
+ H2: 'h2',
15
+ H3: 'h3',
16
+ H4: 'h4',
17
+ H5: 'h5',
18
+ H6: 'h6',
19
+ SPAN: 'span',
20
+ DIV: 'div',
21
+ A: 'a',
22
+ LABEL: 'label',
23
+ };
@@ -0,0 +1,41 @@
1
+ import { STATES } from "../../../../types/states";
2
+ import { SIZES } from "../../../../types/size";
3
+ /*
4
+ * LINK consts
5
+ */
6
+ export const FILENAME = 'download';
7
+ /*
8
+ * Variant map to apply size, state, etc, styles based on variant type
9
+ */
10
+ export const VARIANT_CONFIG = {
11
+ link: {
12
+ states: [STATES.DISABLED /* STATES.VISITED, STATES.HOVER, STATES.ACTIVE, STATES.FOCUS */],
13
+ size: [SIZES.S, SIZES.M],
14
+ },
15
+ label: {
16
+ states: [STATES.DISABLED],
17
+ isRequired: true,
18
+ canUseTooltip: true,
19
+ },
20
+ heading: { canUseTooltip: true },
21
+ subheading: { canUseTooltip: true },
22
+ helper: { states: [STATES.ERROR] },
23
+ display: { size: [SIZES.XS, SIZES.S, SIZES.M, SIZES.L, SIZES.XL] },
24
+ };
25
+ /*
26
+ * ATTRIBUTE MAP
27
+ */
28
+ export const getAttributesByTag = (comp, tagName) => {
29
+ const ATTR_MAP = {
30
+ a: {
31
+ href: comp.state !== STATES.DISABLED ? comp.sanitizedHref : null,
32
+ target: comp.target,
33
+ download: comp.isDownloadable ? comp.filename : null,
34
+ rel: comp.target === '_blank' ? 'noopener noreferrer' : undefined,
35
+ },
36
+ label: {
37
+ htmlFor: comp.htmlFor,
38
+ },
39
+ };
40
+ return ATTR_MAP[tagName] || {};
41
+ };