generator-white-label 3.2.0 → 5.0.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 (253) hide show
  1. package/README.md +140 -81
  2. package/app/README.md +19 -0
  3. package/app/assets/font/opensans/stylesheet.css +20 -60
  4. package/app/assets/image/demo/fallback.avif +0 -0
  5. package/app/assets/image/demo/fallback.jpg +0 -0
  6. package/app/assets/image/demo/fallback.webp +0 -0
  7. package/app/assets/image/demo/large.avif +0 -0
  8. package/app/assets/image/demo/large.webp +0 -0
  9. package/app/assets/image/demo/small.avif +0 -0
  10. package/app/assets/image/demo/small.webp +0 -0
  11. package/app/assets/markup/element/iframe.hbs +4 -1
  12. package/app/assets/markup/element/img.hbs +16 -1
  13. package/app/assets/markup/element/picture.hbs +30 -0
  14. package/app/assets/markup/modal/modal-example-1.handlebars +1 -1
  15. package/app/assets/script/api/{facebook.js → facebook.ts} +17 -12
  16. package/app/assets/script/api/youtube.ts +22 -0
  17. package/app/assets/script/index.ts +2 -0
  18. package/app/assets/script/mediator/global.ts +4 -0
  19. package/app/assets/script/model/singletons/countries.ts +5 -0
  20. package/app/assets/script/model/singletons/global.ts +5 -0
  21. package/app/assets/script/model/singletons/states.ts +5 -0
  22. package/app/assets/script/model/user.ts +4 -0
  23. package/app/assets/script/toolkit.ts +11 -0
  24. package/app/assets/script/types.d.ts +16 -0
  25. package/app/assets/script/utility/ajax.ts +15 -0
  26. package/app/assets/script/utility/form.ts +119 -0
  27. package/app/assets/script/utility/{regex.js → regex.ts} +15 -6
  28. package/app/assets/script/utility/share.ts +77 -0
  29. package/app/assets/script/utility/string.ts +148 -0
  30. package/app/assets/script/view/default.tsx +14 -0
  31. package/app/assets/script/view/toolkit/youtube-player-1.ts +31 -0
  32. package/app/assets/style/base/_toolkit.scss +25 -25
  33. package/app/assets/style/base/components/_modal-1.scss +8 -3
  34. package/app/assets/style/base/components/_tabpanel-1.scss +21 -16
  35. package/app/assets/style/base/components/_tabpanel-2.scss +11 -6
  36. package/app/assets/style/base/components/_youtube-player-1.scss +3 -2
  37. package/app/assets/style/base/elements/_anchors.scss +2 -0
  38. package/app/assets/style/base/elements/_buttons.scss +7 -3
  39. package/app/assets/style/base/elements/_fieldsets.scss +2 -0
  40. package/app/assets/style/base/elements/_inputs.scss +6 -2
  41. package/app/assets/style/base/elements/_labels.scss +2 -0
  42. package/app/assets/style/base/elements/_legends.scss +2 -0
  43. package/app/assets/style/base/elements/_lists.scss +2 -0
  44. package/app/assets/style/base/elements/_tables.scss +10 -6
  45. package/app/assets/style/base/layouts/_staggered-1.scss +4 -1
  46. package/app/assets/style/base/type/_fonts.scss +4 -1
  47. package/app/assets/style/base/type/_headings.scss +3 -0
  48. package/app/assets/style/base/type/_text.scss +2 -0
  49. package/app/assets/style/base/utilities/_accessibility.scss +5 -2
  50. package/app/assets/style/base/utilities/_functions.scss +62 -9
  51. package/app/assets/style/global.scss +4 -11
  52. package/app/assets/style/print.scss +1 -4
  53. package/app/assets/style/toolkit.scss +37 -37
  54. package/app/package.json +1 -0
  55. package/app/toolkit/colors.hbs +11 -11
  56. package/app/toolkit/components.hbs +16 -16
  57. package/app/toolkit/elements.hbs +52 -43
  58. package/app/toolkit/grids.hbs +111 -111
  59. package/app/toolkit/icons.hbs +2 -2
  60. package/app/toolkit/index.hbs +6 -6
  61. package/app/toolkit/type.hbs +4 -4
  62. package/dist/app/assets/data/coutries.json +992 -0
  63. package/dist/app/assets/data/states.json +204 -0
  64. package/dist/app/assets/script/api/facebook.d.ts +8 -0
  65. package/dist/app/assets/script/api/facebook.js +42 -0
  66. package/dist/app/assets/script/api/facebook.js.map +1 -0
  67. package/dist/app/assets/script/api/youtube.d.ts +8 -0
  68. package/dist/app/assets/script/api/youtube.js +22 -0
  69. package/dist/app/assets/script/api/youtube.js.map +1 -0
  70. package/dist/app/assets/script/index.d.ts +2 -0
  71. package/dist/app/assets/script/index.js +2 -0
  72. package/dist/app/assets/script/index.js.map +1 -0
  73. package/dist/app/assets/script/mediator/global.d.ts +4 -0
  74. package/dist/app/assets/script/mediator/global.js +4 -0
  75. package/dist/app/assets/script/mediator/global.js.map +1 -0
  76. package/dist/app/assets/script/model/singletons/countries.d.ts +20 -0
  77. package/dist/app/assets/script/model/singletons/countries.js +5 -0
  78. package/dist/app/assets/script/model/singletons/countries.js.map +1 -0
  79. package/dist/app/assets/script/model/singletons/global.d.ts +20 -0
  80. package/dist/app/assets/script/model/singletons/global.js +5 -0
  81. package/dist/app/assets/script/model/singletons/global.js.map +1 -0
  82. package/dist/app/assets/script/model/singletons/states.d.ts +20 -0
  83. package/dist/app/assets/script/model/singletons/states.js +5 -0
  84. package/dist/app/assets/script/model/singletons/states.js.map +1 -0
  85. package/dist/app/assets/script/model/user.d.ts +4 -0
  86. package/dist/app/assets/script/model/user.js +6 -0
  87. package/dist/app/assets/script/model/user.js.map +1 -0
  88. package/dist/app/assets/script/toolkit.d.ts +1 -0
  89. package/dist/app/assets/script/toolkit.js +7 -0
  90. package/dist/app/assets/script/toolkit.js.map +1 -0
  91. package/dist/app/assets/script/utility/ajax.d.ts +8 -0
  92. package/dist/app/assets/script/utility/ajax.js +17 -0
  93. package/dist/app/assets/script/utility/ajax.js.map +1 -0
  94. package/dist/app/assets/script/utility/form.d.ts +64 -0
  95. package/dist/app/assets/script/utility/form.js +111 -0
  96. package/dist/app/assets/script/utility/form.js.map +1 -0
  97. package/dist/app/assets/script/utility/regex.d.ts +14 -0
  98. package/dist/app/assets/script/utility/regex.js +27 -0
  99. package/dist/app/assets/script/utility/regex.js.map +1 -0
  100. package/dist/app/assets/script/utility/share.d.ts +68 -0
  101. package/dist/app/assets/script/utility/share.js +81 -0
  102. package/dist/app/assets/script/utility/share.js.map +1 -0
  103. package/dist/app/assets/script/utility/string.d.ts +64 -0
  104. package/dist/app/assets/script/utility/string.js +135 -0
  105. package/dist/app/assets/script/utility/string.js.map +1 -0
  106. package/dist/app/assets/script/view/default.d.ts +11 -0
  107. package/dist/app/assets/script/view/default.js +15 -0
  108. package/dist/app/assets/script/view/default.js.map +1 -0
  109. package/dist/app/assets/script/view/toolkit/youtube-player-1.d.ts +23 -0
  110. package/dist/app/assets/script/view/toolkit/youtube-player-1.js +32 -0
  111. package/dist/app/assets/script/view/toolkit/youtube-player-1.js.map +1 -0
  112. package/dist/generators/app/index.d.ts +18 -0
  113. package/dist/generators/app/index.js +59 -0
  114. package/dist/generators/app/index.js.map +1 -0
  115. package/dist/scripts/build.d.ts +22 -0
  116. package/dist/scripts/build.js +158 -0
  117. package/dist/scripts/build.js.map +1 -0
  118. package/generators/app/index.js +2 -43
  119. package/generators/app/index.ts +61 -0
  120. package/package.json +79 -129
  121. package/scripts/build.ts +175 -0
  122. package/tsconfig.site.json +26 -0
  123. package/.babelrc +0 -14
  124. package/.editorconfig +0 -13
  125. package/.eslintrc +0 -64
  126. package/.htmllintrc +0 -6
  127. package/.sass-lint.yml +0 -16
  128. package/.travis.yml +0 -18
  129. package/app/assets/font/opensans/generator_config.txt +0 -5
  130. package/app/assets/font/opensans/opensans-bold-webfont.eot +0 -0
  131. package/app/assets/font/opensans/opensans-bold-webfont.svg +0 -1824
  132. package/app/assets/font/opensans/opensans-bold-webfont.ttf +0 -0
  133. package/app/assets/font/opensans/opensans-bold-webfont.woff +0 -0
  134. package/app/assets/font/opensans/opensans-bolditalic-webfont.eot +0 -0
  135. package/app/assets/font/opensans/opensans-bolditalic-webfont.svg +0 -1824
  136. package/app/assets/font/opensans/opensans-bolditalic-webfont.ttf +0 -0
  137. package/app/assets/font/opensans/opensans-bolditalic-webfont.woff +0 -0
  138. package/app/assets/font/opensans/opensans-extrabold-webfont.eot +0 -0
  139. package/app/assets/font/opensans/opensans-extrabold-webfont.svg +0 -1824
  140. package/app/assets/font/opensans/opensans-extrabold-webfont.ttf +0 -0
  141. package/app/assets/font/opensans/opensans-extrabold-webfont.woff +0 -0
  142. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.eot +0 -0
  143. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.svg +0 -1824
  144. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.ttf +0 -0
  145. package/app/assets/font/opensans/opensans-extrabolditalic-webfont.woff +0 -0
  146. package/app/assets/font/opensans/opensans-italic-webfont.eot +0 -0
  147. package/app/assets/font/opensans/opensans-italic-webfont.svg +0 -1824
  148. package/app/assets/font/opensans/opensans-italic-webfont.ttf +0 -0
  149. package/app/assets/font/opensans/opensans-italic-webfont.woff +0 -0
  150. package/app/assets/font/opensans/opensans-light-webfont.eot +0 -0
  151. package/app/assets/font/opensans/opensans-light-webfont.svg +0 -1824
  152. package/app/assets/font/opensans/opensans-light-webfont.ttf +0 -0
  153. package/app/assets/font/opensans/opensans-light-webfont.woff +0 -0
  154. package/app/assets/font/opensans/opensans-lightitalic-webfont.eot +0 -0
  155. package/app/assets/font/opensans/opensans-lightitalic-webfont.svg +0 -1824
  156. package/app/assets/font/opensans/opensans-lightitalic-webfont.ttf +0 -0
  157. package/app/assets/font/opensans/opensans-lightitalic-webfont.woff +0 -0
  158. package/app/assets/font/opensans/opensans-regular-webfont.eot +0 -0
  159. package/app/assets/font/opensans/opensans-regular-webfont.svg +0 -1824
  160. package/app/assets/font/opensans/opensans-regular-webfont.ttf +0 -0
  161. package/app/assets/font/opensans/opensans-regular-webfont.woff +0 -0
  162. package/app/assets/font/opensans/opensans-semibold-webfont.eot +0 -0
  163. package/app/assets/font/opensans/opensans-semibold-webfont.svg +0 -1824
  164. package/app/assets/font/opensans/opensans-semibold-webfont.ttf +0 -0
  165. package/app/assets/font/opensans/opensans-semibold-webfont.woff +0 -0
  166. package/app/assets/font/opensans/opensans-semibolditalic-webfont.eot +0 -0
  167. package/app/assets/font/opensans/opensans-semibolditalic-webfont.svg +0 -1824
  168. package/app/assets/font/opensans/opensans-semibolditalic-webfont.ttf +0 -0
  169. package/app/assets/font/opensans/opensans-semibolditalic-webfont.woff +0 -0
  170. package/app/assets/font/opensans/specimen_files/grid_12-825-55-15.css +0 -129
  171. package/app/assets/font/opensans/specimen_files/specimen_stylesheet.css +0 -396
  172. package/app/assets/image/demo/large.jpg +0 -0
  173. package/app/assets/image/demo/medium.jpg +0 -0
  174. package/app/assets/image/demo/small.jpg +0 -0
  175. package/app/assets/image/demo/xlarge.jpg +0 -0
  176. package/app/assets/image/demo/xxlarge.jpg +0 -0
  177. package/app/assets/script/api/youtube.js +0 -18
  178. package/app/assets/script/index.js +0 -6
  179. package/app/assets/script/mediator/global.js +0 -5
  180. package/app/assets/script/model/singletons/countries.js +0 -6
  181. package/app/assets/script/model/singletons/global.js +0 -6
  182. package/app/assets/script/model/singletons/states.js +0 -6
  183. package/app/assets/script/model/user.js +0 -5
  184. package/app/assets/script/toolkit.js +0 -12
  185. package/app/assets/script/utility/ajax.js +0 -11
  186. package/app/assets/script/utility/form.js +0 -86
  187. package/app/assets/script/utility/share.js +0 -52
  188. package/app/assets/script/utility/string.js +0 -70
  189. package/app/assets/script/view/default.js +0 -11
  190. package/app/assets/script/view/toolkit/youtube-player-1.js +0 -17
  191. package/app/assets/style/base/vendor/_foundation.scss +0 -2
  192. package/app/assets/test/spec/shareSpec.js +0 -137
  193. package/app/index.html +0 -40
  194. package/app/report/istanbul/base.css +0 -213
  195. package/app/report/istanbul/prettify.css +0 -1
  196. package/app/report/istanbul/prettify.js +0 -1
  197. package/app/report/istanbul/sort-arrow-sprite.png +0 -0
  198. package/app/report/istanbul/sorter.js +0 -158
  199. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.eot +0 -0
  200. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.svg +0 -288
  201. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.ttf +0 -0
  202. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff +0 -0
  203. package/app/report/jsdoc/fonts/glyphicons-halflings-regular.woff2 +0 -0
  204. package/app/report/jsdoc/img/glyphicons-halflings-white.png +0 -0
  205. package/app/report/jsdoc/img/glyphicons-halflings.png +0 -0
  206. package/app/report/jsdoc/scripts/docstrap.lib.js +0 -11
  207. package/app/report/jsdoc/scripts/fulltext-search-ui.js +0 -89
  208. package/app/report/jsdoc/scripts/fulltext-search.js +0 -36
  209. package/app/report/jsdoc/scripts/lunr.min.js +0 -6
  210. package/app/report/jsdoc/scripts/prettify/Apache-License-2.0.txt +0 -202
  211. package/app/report/jsdoc/scripts/prettify/jquery.min.js +0 -6
  212. package/app/report/jsdoc/scripts/prettify/lang-css.js +0 -21
  213. package/app/report/jsdoc/scripts/prettify/prettify.js +0 -496
  214. package/app/report/jsdoc/scripts/sunlight.js +0 -1157
  215. package/app/report/jsdoc/scripts/toc.js +0 -203
  216. package/app/report/jsdoc/styles/darkstrap.css +0 -960
  217. package/app/report/jsdoc/styles/prettify-tomorrow.css +0 -132
  218. package/app/report/jsdoc/styles/site.cerulean.css +0 -7008
  219. package/app/report/jsdoc/styles/site.cosmo.css +0 -7061
  220. package/app/report/jsdoc/styles/site.cyborg.css +0 -7048
  221. package/app/report/jsdoc/styles/site.darkly.css +0 -7171
  222. package/app/report/jsdoc/styles/site.darkstrap.css +0 -5638
  223. package/app/report/jsdoc/styles/site.dibs-bootstrap.css +0 -5899
  224. package/app/report/jsdoc/styles/site.flatly.css +0 -7147
  225. package/app/report/jsdoc/styles/site.journal.css +0 -6973
  226. package/app/report/jsdoc/styles/site.lumen.css +0 -7298
  227. package/app/report/jsdoc/styles/site.paper.css +0 -7623
  228. package/app/report/jsdoc/styles/site.readable.css +0 -6997
  229. package/app/report/jsdoc/styles/site.sandstone.css +0 -7035
  230. package/app/report/jsdoc/styles/site.simplex.css +0 -7023
  231. package/app/report/jsdoc/styles/site.slate.css +0 -7343
  232. package/app/report/jsdoc/styles/site.spacelab.css +0 -7055
  233. package/app/report/jsdoc/styles/site.superhero.css +0 -7131
  234. package/app/report/jsdoc/styles/site.united.css +0 -6895
  235. package/app/report/jsdoc/styles/site.yeti.css +0 -7195
  236. package/app/report/jsdoc/styles/sunlight.dark.css +0 -345
  237. package/app/report/jsdoc/styles/sunlight.default.css +0 -344
  238. package/gulp/config.js +0 -224
  239. package/gulp/tasks/accessibility.js +0 -34
  240. package/gulp/tasks/build.js +0 -19
  241. package/gulp/tasks/clean.js +0 -34
  242. package/gulp/tasks/data.js +0 -22
  243. package/gulp/tasks/default.js +0 -9
  244. package/gulp/tasks/deploy.js +0 -225
  245. package/gulp/tasks/documentation.js +0 -25
  246. package/gulp/tasks/markup.js +0 -121
  247. package/gulp/tasks/script.js +0 -92
  248. package/gulp/tasks/style.js +0 -42
  249. package/gulp/tasks/unit.js +0 -38
  250. package/gulp/tasks/watch.js +0 -83
  251. package/gulpfile.js +0 -8
  252. package/jsdoc.json +0 -23
  253. package/karma.conf.js +0 -58
@@ -0,0 +1,5 @@
1
+ /** @module app/assets/script/model/singletons/countries */
2
+ import WLModel from 'white-label-model';
3
+ import data from '../../../data/coutries.json' with {type: 'json'};
4
+
5
+ export default new WLModel.Collection(data);
@@ -0,0 +1,5 @@
1
+ /** @module app/assets/script/model/singletons/global */
2
+ import WLModel from 'white-label-model';
3
+ const data: Record<string, unknown> = {cdn: '/', www: '/', service: '/service-endpoint'};
4
+
5
+ export default new WLModel.Model(data);
@@ -0,0 +1,5 @@
1
+ /** @module app/assets/script/model/singletons/states */
2
+ import WLModel from 'white-label-model';
3
+ import data from '../../../data/states.json' with {type: 'json'};
4
+
5
+ export default new WLModel.Collection(data);
@@ -0,0 +1,4 @@
1
+ /** @module app/assets/script/model/user */
2
+ import WLModel from 'white-label-model';
3
+
4
+ export default class extends WLModel.Model {};
@@ -0,0 +1,11 @@
1
+ /** @module app/assets/script/toolkit */
2
+ import APIYoutube from './api/youtube.js';
3
+
4
+
5
+
6
+ // Avoid downloading the third-party API on toolkit pages that have no player.
7
+ if (document.querySelector('.youtube-player-1')) {
8
+ new APIYoutube().initialize();
9
+ }
10
+
11
+ export {};
@@ -0,0 +1,16 @@
1
+ /** Legacy published packages have no declarations; this describes the subset used by this generator. */
2
+ declare module 'white-label-model' {
3
+ import {EventEmitter} from 'events';
4
+ class Model extends EventEmitter {constructor(data?: object); get(): Record<string, unknown>}
5
+ class Collection extends EventEmitter {constructor(data?: unknown[]); get(): unknown[]}
6
+ const api: {Model: typeof Model; Collection: typeof Collection};
7
+ export default api;
8
+ }
9
+ declare module 'white-label-view' {
10
+ export default class View {parentElement?: Element; initialize(): unknown; addListeners(): unknown}
11
+ }
12
+ interface Window {
13
+ onYouTubeIframeAPIReady?: (event?: Event) => void;
14
+ fbAsyncInit?: (event?: Event) => void;
15
+ FB: {init(options: {appId: unknown; autoLogAppEvents: boolean; xfbml: boolean; version: string}): void; AppEvents: {logPageView(): void}};
16
+ }
@@ -0,0 +1,15 @@
1
+ /** @module app/assets/script/utility/ajax */
2
+ 'use strict';
3
+ export default class {
4
+ /**
5
+ * Append an asynchronous script element; callers decide when third-party code is needed.
6
+ * @param url - URL or optional adapter argument.
7
+ * @returns No value; the browser loads the appended script asynchronously.
8
+ */
9
+ getScript(url: string) {
10
+ var newScript = document.createElement('script');
11
+ newScript.src = url;
12
+ newScript.async = true;
13
+ document.getElementsByTagName('head')[0].appendChild(newScript);
14
+ }
15
+ };
@@ -0,0 +1,119 @@
1
+ /** Select option data used by the generated form examples. */
2
+ interface Option {value: string | number; selected?: boolean; name?: string}
3
+ interface Metadata {key: string; keyID?: string; keyTitle?: string; valueID?: string; valueTitle?: string}
4
+ interface OptionInput {id: string | number; first_name?: string; last_name?: string; name?: string}
5
+ 'use strict';
6
+ export default class {
7
+ /**
8
+ * Return the values of selected options in document order.
9
+ * @param element - Select element to inspect.
10
+ * @returns Selected option values in document order.
11
+ */
12
+ multiselectGetSelectedValues(element: HTMLSelectElement) {
13
+ let values: string[] = [];
14
+ element.querySelectorAll<HTMLOptionElement>(':checked').forEach((item) => {
15
+ values.push(item.value);
16
+ });
17
+ return values;
18
+ }
19
+ /**
20
+ * Mutate option selection flags so only the matching value remains selected.
21
+ * @param data - Data supplied by the caller; validation follows the method contract.
22
+ * @param value - Value to find or format.
23
+ * @returns The same option array with updated selection flags.
24
+ */
25
+ selectMenuSelectOption(data: Option[], value: string | number) {
26
+ data.forEach ((item) => {
27
+ if (item.value === value) {
28
+ item.selected = true;
29
+ } else {
30
+ item.selected = false;
31
+ }
32
+ });
33
+ return data;
34
+ }
35
+ /**
36
+ * Return the last option matching a value, or false when none matches.
37
+ * @param data - Data supplied by the caller; validation follows the method contract.
38
+ * @param value - Value to find or format.
39
+ * @returns The matching option or false.
40
+ */
41
+ selectMenuReturnOption(data: Option[], value: string | number) {
42
+ let itemMatch: Option | false = false;
43
+ data.forEach((item) => {
44
+ if (item.value === value) {
45
+ itemMatch = item;
46
+ }
47
+ });
48
+ return itemMatch;
49
+ }
50
+ /**
51
+ * Add stable field IDs and readable labels to metadata entries in place.
52
+ * @param metaData - Metadata array to decorate or divide.
53
+ * @returns The same metadata array with IDs and labels.
54
+ */
55
+ normalizeMetaData(metaData: Metadata[]) {
56
+ let i = 0;
57
+ metaData.forEach((item) => {
58
+ item.keyID = 'meta-field-key-' + i;
59
+ item.keyTitle = 'Field Name:';
60
+ item.valueID = 'meta-field-value-' + i;
61
+ item.valueTitle = 'Field Value: ' + item.key;
62
+ i++;
63
+ });
64
+
65
+ return metaData;
66
+ }
67
+ /**
68
+ * Move the latter half of metadata into a second group, mutating the supplied array.
69
+ * @param metaData - Metadata array to decorate or divide.
70
+ * @returns Two groups; group-1 retains the mutated input array.
71
+ */
72
+ splitMetaData(metaData: Metadata[]) {
73
+ let secondRowCount = Math.floor(metaData.length / 2);
74
+ return {
75
+ 'group-1': metaData,
76
+ 'group-2': metaData.splice(metaData.length - secondRowCount, secondRowCount)
77
+ }
78
+ }
79
+ /**
80
+ * Create display options from named records and mark the requested selections.
81
+ * @param arr - Records used to build select options.
82
+ * @param selected - Selected ID or IDs.
83
+ * @returns New options containing names, values, and selection flags.
84
+ */
85
+ buildOptions(arr: OptionInput[], selected: string | number | Array<string | number>) {
86
+
87
+ const options: Option[] = [];
88
+ let option: Option;
89
+
90
+ arr.forEach((obj) => {
91
+
92
+ let name = 'not specified';
93
+
94
+ if (obj.first_name && obj.last_name) {
95
+ name = obj.first_name + ' ' + obj.last_name;
96
+ } else if (obj.name) {
97
+ name = obj.name;
98
+ }
99
+
100
+ option = {
101
+ name: name,
102
+ value: obj.id
103
+ };
104
+
105
+ if (selected === obj.id) {
106
+ option.selected = true;
107
+ } else if (Array.isArray(selected) && selected.indexOf(obj.id) !== -1) {
108
+ option.selected = true;
109
+ } else {
110
+ option.selected = false;
111
+ }
112
+
113
+ options.push(option);
114
+
115
+ });
116
+
117
+ return options;
118
+ }
119
+ };
@@ -1,8 +1,19 @@
1
- (() => {
2
- 'use strict';
3
- module.exports = class {
1
+ /** @module app/assets/script/utility/regex */
2
+ 'use strict';
3
+ export default class {
4
+ date: RegExp;
5
+ password: RegExp;
6
+ phone: RegExp;
7
+ phoneEXT: RegExp;
8
+ zip: RegExp;
9
+ characters2: RegExp;
10
+ characters25: RegExp;
11
+ currency: RegExp;
12
+
13
+ /**
14
+ * Create an instance with its own state and listener references.
15
+ */
4
16
  constructor() {
5
- /*eslint-disable*/
6
17
  this.date =  /^\$?(20|30)\d\d[- \/.](0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])?$/g;
7
18
  this.password = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{5,15}$/m;
8
19
  this.phone = /^(\+?\d[ -\.])?([\\(]{0,1}([0-9]){3}[\\\.\-)]{0,1}[ ]?([^0-1]){1}([0-9]){2}[ ]?[-\.]?[ ]?([0-9]){4})|(\d{10})$/m;
@@ -11,7 +22,5 @@
11
22
  this.characters2 = /^.{2,500}$/m;
12
23
  this.characters25 = /^.{25,500}$/m;
13
24
  this.currency = /^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$/m;
14
- /*eslint-enable*/
15
25
  }
16
26
  };
17
- })();
@@ -0,0 +1,77 @@
1
+ /** @module app/assets/script/utility/share */
2
+ 'use strict';
3
+ export default class {
4
+ /**
5
+ * Build an encoded Facebook share URL.
6
+ * @param params - Request parameters required by this operation.
7
+ * @returns An encoded Facebook share URL.
8
+ */
9
+ shareFacebookUrl(params: {url?: string; text?: string; title?: string; summary?: string; subject?: string; body?: string}) {
10
+ return 'https://www.facebook.com/sharer.php?u=' + encodeURIComponent(params.url || '');
11
+ }
12
+ /**
13
+ * Build the legacy Twitter intent URL for messages of at most 140 characters.
14
+ * @param params - Request parameters required by this operation.
15
+ * @returns An encoded intent URL, or false for missing or overlong text.
16
+ */
17
+ shareTwitterUrl(params: {url?: string; text?: string; title?: string; summary?: string; subject?: string; body?: string}) {
18
+ //check if the message is the right size and that a message is definded
19
+ if (params.text && params.text.length <= 140) {
20
+ var url = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(params.text);
21
+ // check if they passed in an url along with the message
22
+ if (params.url) {
23
+ url = url + '&url=' + encodeURIComponent(params.url)
24
+ }
25
+ // return back the full share url
26
+ return url;
27
+ } else {
28
+ return false;
29
+ }
30
+ }
31
+ /**
32
+ * Build a legacy Google Plus URL for compatibility; the external service is discontinued.
33
+ * @param params - Request parameters required by this operation.
34
+ * @returns The legacy share URL, or false when no URL is supplied.
35
+ * @deprecated Retained only to avoid silently changing older callers.
36
+ */
37
+ shareGooglePlusUrl(params: {url?: string; text?: string; title?: string; summary?: string; subject?: string; body?: string}) {
38
+ if (!params.url) {
39
+ return false;
40
+ }
41
+ return 'https://plus.google.com/share?url=' + encodeURIComponent(params.url);
42
+ }
43
+ /**
44
+ * Build an encoded LinkedIn share URL with optional title and summary.
45
+ * @param params - Request parameters required by this operation.
46
+ * @returns An encoded share URL, or false when no URL is supplied.
47
+ */
48
+ shareLinkedInUrl(params: {url?: string; text?: string; title?: string; summary?: string; subject?: string; body?: string}) {
49
+ // check it an url is defined
50
+ if (params.url) {
51
+ var url = 'https://www.linkedin.com/shareArticle?url=' + encodeURIComponent(params.url);
52
+ // if a title is passed add it to the share url
53
+ if (params.title) {
54
+ url = url + '&title=' + encodeURIComponent(params.title);
55
+ }
56
+ if (params.summary) {
57
+ // if a summary is passed add it to the share url
58
+ url = url + '&summary=' + encodeURIComponent(params.summary);
59
+ }
60
+ // return back the full share url
61
+ return url;
62
+ } else {
63
+ return false;
64
+ }
65
+ }
66
+ /**
67
+ * Build a mailto link only when both subject and body are supplied.
68
+ * @param params - Request parameters required by this operation.
69
+ * @returns An encoded mailto link, or false when subject or body is missing.
70
+ */
71
+ shareEmailUrl(params: {url?: string; text?: string; title?: string; summary?: string; subject?: string; body?: string}) {
72
+ if (!params.subject || !params.body) {
73
+ return false;
74
+ }
75
+ return 'mailto:?subject=' + encodeURIComponent(params.subject) + '&body=' + encodeURIComponent(params.body);
76
+ }
77
+ };
@@ -0,0 +1,148 @@
1
+ /** @module app/assets/script/utility/string */
2
+ const parser = new DOMParser();
3
+
4
+ const integerFormatter = new Intl.NumberFormat('en-US', {
5
+ maximumFractionDigits: 0
6
+ });
7
+ const currencyFormatter = new Intl.NumberFormat('en-US', {
8
+ currency: 'USD',
9
+ minimumFractionDigits: 2,
10
+ style: 'currency'
11
+ });
12
+
13
+ /**
14
+ * Format a numeric date component with at least two digits.
15
+ * @param number - Numeric value to inspect or format.
16
+ * @returns A string containing at least two digits.
17
+ */
18
+ function pad(number: number) {
19
+ return String(number).padStart(2, '0');
20
+ }
21
+
22
+ /**
23
+ * Format a valid date using local calendar components, or return null for invalid input.
24
+ * @param value - Value to find or format.
25
+ * @returns YYYY-MM-DD in local time, or null for invalid input.
26
+ */
27
+ function dateParts(value: string | number | Date) {
28
+ const date = new Date(value);
29
+ if (Number.isNaN(date.getTime())) {
30
+ return null;
31
+ }
32
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
33
+ }
34
+
35
+ 'use strict';
36
+
37
+ export default class {
38
+
39
+ //turn a string of html tags into a dom object
40
+ /**
41
+ * Parse trusted HTML and clone its first root node; reject empty markup.
42
+ * @param string - Trusted HTML containing at least one root node.
43
+ * @returns A clone of the first parsed root node.
44
+ * @throws When input does not satisfy the documented contract.
45
+ */
46
+ toElement(string: string) {
47
+ const element = parser.parseFromString(string, 'text/html').body.firstChild;
48
+ if (!element) throw new TypeError('HTML must contain a root node');
49
+ return element.cloneNode(true);
50
+ }
51
+
52
+ //qet data from url query string
53
+ /**
54
+ * Read and decode a query value, returning null when absent and an empty string when valueless.
55
+ * @param name - Resource, field, or parameter name.
56
+ * @param url - URL or optional adapter argument.
57
+ * @returns The decoded value, an empty string, or null when absent.
58
+ */
59
+ getQueryStringParamater(name: string, url: string) {
60
+ name = name.replace(/[[\]]/g, '\\$&');
61
+ let regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
62
+ let results = regex.exec(url);
63
+ if (!results) {
64
+ return null;
65
+ }
66
+ if (!results[2]) {
67
+ return '';
68
+ }
69
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
70
+ }
71
+
72
+ // 2014-11-10
73
+ /**
74
+ * Format a local calendar date as YYYY-MM-DD or return Invalid date.
75
+ * @param unformattedDate - Date input to format.
76
+ * @returns A local YYYY-MM-DD string or Invalid date.
77
+ */
78
+ formatDate(unformattedDate: string | number | Date) {
79
+ return dateParts(unformattedDate) || 'Invalid date';
80
+ }
81
+
82
+ //format the api accepts back
83
+ /**
84
+ * Format a calendar date using the legacy API noon timestamp convention.
85
+ * @param unformattedDate - Date input to format.
86
+ * @returns A YYYY-MM-DDT12:00 string or Invalid date.
87
+ */
88
+ formatDateAPI(unformattedDate: string) {
89
+ const formattedDate = dateParts(`${unformattedDate}T00:00:00`);
90
+ return formattedDate ? `${formattedDate}T12:00` : 'Invalid date';
91
+ }
92
+
93
+ /**
94
+ * Format a rounded number using en-US grouping.
95
+ * @param unformattedNumber - Numeric input to format.
96
+ * @returns The grouped and rounded number string.
97
+ */
98
+ formatNumber(unformattedNumber: number | string) {
99
+ return integerFormatter.format(Number(unformattedNumber));
100
+ }
101
+
102
+ /**
103
+ * Parse a base-ten integer using the existing parseInt behavior.
104
+ * @param formattedNumber - Integer text to parse.
105
+ * @returns The parsed integer, or NaN when no integer can be read.
106
+ */
107
+ unformatNumber(formattedNumber: string) {
108
+ return parseInt(formattedNumber, 10);
109
+ }
110
+
111
+ /**
112
+ * Format a numeric value as US dollars with two decimal places.
113
+ * @param unformattedCurrency - Numeric currency input.
114
+ * @returns The value formatted as US dollars.
115
+ */
116
+ formatCurrency(unformattedCurrency: number | string) {
117
+ return currencyFormatter.format(Number(unformattedCurrency));
118
+ }
119
+
120
+ /**
121
+ * Remove currency decoration and return two decimal places, falling back to 0.00 for invalid input.
122
+ * @param formattedCurrency - Decorated currency text or number.
123
+ * @returns An undecorated decimal string with two places.
124
+ */
125
+ unformatCurrency(formattedCurrency: number | string) {
126
+ const number = Number(String(formattedCurrency).replace(/[^0-9.-]/g, ''));
127
+ return Number.isFinite(number) ? number.toFixed(2) : '0.00';
128
+ }
129
+
130
+ /**
131
+ * Create a telephone link using only the supplied digits.
132
+ * @param unformattedPhoneNumber - Phone number containing optional formatting.
133
+ * @returns A tel link containing only digits.
134
+ */
135
+ formatPhoneLink(unformattedPhoneNumber: string) {
136
+ return 'tel:' + unformattedPhoneNumber.replace(/\D/g,'');
137
+ }
138
+
139
+ /**
140
+ * Create a mailto link from the supplied email address.
141
+ * @param unformattedEmailAddress - Email address to place in the link.
142
+ * @returns A mailto link.
143
+ */
144
+ formatEmailLink(unformattedEmailAddress: string) {
145
+ return 'mailto:' + unformattedEmailAddress;
146
+ }
147
+
148
+ };
@@ -0,0 +1,14 @@
1
+ /** @module app/assets/script/view/default */
2
+ import React from 'react';
3
+
4
+
5
+ 'use strict';
6
+ export default class HelloMessage extends React.Component<{name: string}> {
7
+ /**
8
+ * Render the greeting from the component name prop.
9
+ * @returns The greeting React element.
10
+ */
11
+ render() {
12
+ return <div>Hello {this.props.name}</div>;
13
+ }
14
+ };
@@ -0,0 +1,31 @@
1
+ /** @module app/assets/script/view/toolkit/youtube-player-1 */
2
+ import View from 'white-label-view';
3
+
4
+ 'use strict';
5
+ export default class extends View {
6
+ /**
7
+ * Create an instance with its own state and listener references.
8
+ */
9
+ constructor() {
10
+ super();
11
+ this.parentElement = document.querySelector('body') || undefined;
12
+ }
13
+ /**
14
+ * Extension hook for initializing a concrete YouTube player implementation.
15
+ * @returns No value.
16
+ */
17
+ initialize() {
18
+ }
19
+ /**
20
+ * Lifecycle hook for attaching listeners owned by a subclass.
21
+ * @returns No value.
22
+ */
23
+ addListeners() {
24
+ }
25
+ /**
26
+ * Legacy misspelled extension hook retained for compatibility with existing sample subclasses.
27
+ * @returns No value.
28
+ */
29
+ removeListners() {
30
+ }
31
+ };
@@ -1,39 +1,39 @@
1
1
  // ## colors
2
- @import 'colors/colors';
2
+ @forward 'colors/colors';
3
3
 
4
4
  // ## fonts
5
- @import 'type/fonts';
6
- @import 'type/text';
7
- @import 'type/headings';
5
+ @forward 'type/fonts';
6
+ @forward 'type/text';
7
+ @forward 'type/headings';
8
8
 
9
9
 
10
10
  // ## utilities
11
- @import 'utilities/accessibility';
12
- @import 'utilities/scroll';
13
- @import 'utilities/type';
11
+ @forward 'utilities/accessibility';
12
+ @forward 'utilities/scroll';
13
+ @forward 'utilities/type';
14
14
 
15
15
  // ## elements
16
- @import 'elements/anchors';
17
- @import 'elements/buttons';
18
- @import 'elements/fieldsets';
19
- @import 'elements/inputs';
20
- @import 'elements/labels';
21
- @import 'elements/landmarks';
22
- @import 'elements/legends';
23
- @import 'elements/lists';
24
- @import 'elements/pictures';
25
- @import 'elements/images';
26
- @import 'elements/tables';
16
+ @forward 'elements/anchors';
17
+ @forward 'elements/buttons';
18
+ @forward 'elements/fieldsets';
19
+ @forward 'elements/inputs';
20
+ @forward 'elements/labels';
21
+ @forward 'elements/landmarks';
22
+ @forward 'elements/legends';
23
+ @forward 'elements/lists';
24
+ @forward 'elements/pictures';
25
+ @forward 'elements/images';
26
+ @forward 'elements/tables';
27
27
 
28
28
  // ## components
29
29
 
30
- @import 'components/modal-1';
31
- @import 'components/sticky-1';
32
- @import 'components/tabpanel-base-1';
33
- @import 'components/tabpanel-1';
34
- @import 'components/tabpanel-2';
35
- @import 'components/youtube-player-1';
30
+ @forward 'components/modal-1';
31
+ @forward 'components/sticky-1';
32
+ @forward 'components/tabpanel-base-1';
33
+ @forward 'components/tabpanel-1';
34
+ @forward 'components/tabpanel-2';
35
+ @forward 'components/youtube-player-1';
36
36
 
37
37
  // ## layouts
38
38
 
39
- @import 'layouts/staggered-1';
39
+ @forward 'layouts/staggered-1';
@@ -1,3 +1,8 @@
1
+ @use "../colors/colors";
2
+ @use '../utilities/functions' as *;
3
+ @use '../type/text' as *;
4
+ @use '../utilities/accessibility' as *;
5
+
1
6
  // ## modals
2
7
 
3
8
  %modal-1 {
@@ -17,7 +22,7 @@
17
22
 
18
23
  > .modal-1-content {
19
24
 
20
- background-color: $white-1;
25
+ background-color: colors.$white-1;
21
26
  height: 100%;
22
27
  margin: 0 auto;
23
28
  position: absolute;
@@ -30,7 +35,7 @@
30
35
  }
31
36
 
32
37
  > * {
33
- background-color: $white-1;
38
+ background-color: colors.$white-1;
34
39
  }
35
40
 
36
41
  }
@@ -39,7 +44,7 @@
39
44
 
40
45
  @extend %accessibility-hidden-text-1;
41
46
 
42
- background-color: $grey-1;
47
+ background-color: colors.$grey-1;
43
48
  display: block;
44
49
  height: 100%;
45
50
  left: 0;