@roadtrip/components 3.10.0 → 3.10.1

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 (146) hide show
  1. package/dist/cjs/_commonjsHelpers-1fbbf0eb.js +23 -0
  2. package/dist/cjs/_commonjsHelpers-1fbbf0eb.js.map +1 -0
  3. package/dist/cjs/{focus-visible-a5d1ccf9.js → focus-visible-6771892b.js} +6 -20
  4. package/dist/cjs/focus-visible-6771892b.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{polyfill-c7a0fa22.js → polyfill-9453e116.js} +2 -2
  9. package/dist/cjs/{polyfill-c7a0fa22.js.map → polyfill-9453e116.js.map} +1 -1
  10. package/dist/cjs/road-accordion.cjs.entry.js +1 -1
  11. package/dist/cjs/road-area-code.cjs.entry.js +23 -2
  12. package/dist/cjs/road-area-code.cjs.entry.js.map +1 -1
  13. package/dist/cjs/road-badge_14.cjs.entry.js +5 -3
  14. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  15. package/dist/cjs/road-button-floating.cjs.entry.js +1 -1
  16. package/dist/cjs/road-checkbox.cjs.entry.js +1 -1
  17. package/dist/cjs/road-chip.cjs.entry.js +1 -1
  18. package/dist/cjs/road-global-navigation.cjs.entry.js +1 -1
  19. package/dist/cjs/road-illustration.cjs.entry.js +4 -71
  20. package/dist/cjs/road-illustration.cjs.entry.js.map +1 -1
  21. package/dist/cjs/road-navbar.cjs.entry.js +1 -1
  22. package/dist/cjs/road-phone-number-input.cjs.entry.js +1269 -5692
  23. package/dist/cjs/road-phone-number-input.cjs.entry.js.map +1 -1
  24. package/dist/cjs/road-radio.cjs.entry.js +1 -1
  25. package/dist/cjs/road-segmented-button-bar.cjs.entry.js +1 -1
  26. package/dist/cjs/road-switch.cjs.entry.js +1 -1
  27. package/dist/cjs/road-tab-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/road-tag.cjs.entry.js +1 -1
  29. package/dist/cjs/road-toggle.cjs.entry.js +1 -1
  30. package/dist/cjs/roadtrip.cjs.js +1 -1
  31. package/dist/cjs/utils-5203d152.js +82 -0
  32. package/dist/cjs/utils-5203d152.js.map +1 -0
  33. package/dist/collection/collection-manifest.json +1 -1
  34. package/dist/collection/components/area-code/area-code.css +64 -40
  35. package/dist/collection/components/area-code/area-code.js +65 -4
  36. package/dist/collection/components/area-code/area-code.js.map +1 -1
  37. package/dist/collection/components/button/button.css +36 -1
  38. package/dist/collection/components/button/button.js +22 -1
  39. package/dist/collection/components/button/button.js.map +1 -1
  40. package/dist/collection/components/button/button.stories.js +13 -0
  41. package/dist/collection/components/phone-number-input/phone-number-input.css +0 -5
  42. package/dist/collection/components/phone-number-input/phone-number-input.js +128 -62
  43. package/dist/collection/components/phone-number-input/phone-number-input.js.map +1 -1
  44. package/dist/collection/components/phone-number-input/phone-number-input.stories.js +11 -5
  45. package/dist/collection/index.js +1 -0
  46. package/dist/collection/index.js.map +1 -1
  47. package/dist/esm/_commonjsHelpers-8a9f3b18.js +19 -0
  48. package/dist/esm/_commonjsHelpers-8a9f3b18.js.map +1 -0
  49. package/dist/esm/{focus-visible-0fc6119c.js → focus-visible-75a2ea2a.js} +3 -17
  50. package/dist/esm/focus-visible-75a2ea2a.js.map +1 -0
  51. package/dist/esm/index.js +1 -0
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/loader.js +1 -1
  54. package/dist/esm/polyfill-ab80527b.js +7 -0
  55. package/dist/esm/{polyfill-2b159e86.js.map → polyfill-ab80527b.js.map} +1 -1
  56. package/dist/esm/road-accordion.entry.js +1 -1
  57. package/dist/esm/road-area-code.entry.js +23 -2
  58. package/dist/esm/road-area-code.entry.js.map +1 -1
  59. package/dist/esm/road-badge_14.entry.js +5 -3
  60. package/dist/esm/road-badge_14.entry.js.map +1 -1
  61. package/dist/esm/road-button-floating.entry.js +1 -1
  62. package/dist/esm/road-checkbox.entry.js +1 -1
  63. package/dist/esm/road-chip.entry.js +1 -1
  64. package/dist/esm/road-global-navigation.entry.js +1 -1
  65. package/dist/esm/road-illustration.entry.js +2 -69
  66. package/dist/esm/road-illustration.entry.js.map +1 -1
  67. package/dist/esm/road-navbar.entry.js +1 -1
  68. package/dist/esm/road-phone-number-input.entry.js +1269 -5692
  69. package/dist/esm/road-phone-number-input.entry.js.map +1 -1
  70. package/dist/esm/road-radio.entry.js +1 -1
  71. package/dist/esm/road-segmented-button-bar.entry.js +1 -1
  72. package/dist/esm/road-switch.entry.js +1 -1
  73. package/dist/esm/road-tab-bar.entry.js +1 -1
  74. package/dist/esm/road-tag.entry.js +1 -1
  75. package/dist/esm/road-toggle.entry.js +1 -1
  76. package/dist/esm/roadtrip.js +1 -1
  77. package/dist/esm/utils-ff713b72.js +77 -0
  78. package/dist/esm/utils-ff713b72.js.map +1 -0
  79. package/dist/html.html-data.json +18 -2
  80. package/dist/roadtrip/index.esm.js +1 -1
  81. package/dist/roadtrip/{p-f0e8feac.entry.js → p-093973f5.entry.js} +2 -2
  82. package/dist/roadtrip/{p-3237c0d8.entry.js → p-0bcf6d63.entry.js} +2 -2
  83. package/dist/roadtrip/{p-9077915a.entry.js → p-198f586b.entry.js} +2 -2
  84. package/dist/roadtrip/{p-c784a407.entry.js → p-439e1124.entry.js} +2 -2
  85. package/dist/roadtrip/{p-4b54f8e8.entry.js → p-4fd8c4db.entry.js} +2 -2
  86. package/dist/roadtrip/{p-10856fef.entry.js → p-564f4f31.entry.js} +2 -2
  87. package/dist/roadtrip/p-5f9e6c1c.entry.js +2 -0
  88. package/dist/roadtrip/p-5f9e6c1c.entry.js.map +1 -0
  89. package/dist/roadtrip/p-6598e293.entry.js +2 -0
  90. package/dist/roadtrip/p-6598e293.entry.js.map +1 -0
  91. package/dist/roadtrip/p-74980317.entry.js +2 -0
  92. package/dist/roadtrip/p-74980317.entry.js.map +1 -0
  93. package/dist/roadtrip/{p-c709f80e.entry.js → p-7c4b331c.entry.js} +2 -2
  94. package/dist/roadtrip/p-7d5dbd9a.js +2 -0
  95. package/dist/roadtrip/p-7d5dbd9a.js.map +1 -0
  96. package/dist/roadtrip/p-7ec2d494.js +2 -0
  97. package/dist/roadtrip/p-7ec2d494.js.map +1 -0
  98. package/dist/roadtrip/p-a484102a.entry.js +2 -0
  99. package/dist/roadtrip/p-a484102a.entry.js.map +1 -0
  100. package/dist/roadtrip/{p-7390ad20.entry.js → p-b5727aae.entry.js} +2 -2
  101. package/dist/roadtrip/p-c259efd7.js +2 -0
  102. package/dist/roadtrip/{p-4f31338d.js.map → p-c259efd7.js.map} +1 -1
  103. package/dist/roadtrip/{p-91070a4d.entry.js → p-c8e9807b.entry.js} +2 -2
  104. package/dist/roadtrip/p-e8c090a5.js +2 -0
  105. package/dist/roadtrip/{p-3f7c8122.entry.js → p-ebe3c26a.entry.js} +2 -2
  106. package/dist/roadtrip/{p-a1a25a51.entry.js → p-ee0196ea.entry.js} +2 -2
  107. package/dist/roadtrip/{p-c0c088c1.entry.js → p-f671758f.entry.js} +2 -2
  108. package/dist/roadtrip/roadtrip.css +1 -1
  109. package/dist/roadtrip/roadtrip.esm.js +1 -1
  110. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  111. package/dist/types/components/area-code/area-code.d.ts +4 -0
  112. package/dist/types/components/button/button.d.ts +5 -0
  113. package/dist/types/components/phone-number-input/phone-number-input.d.ts +21 -10
  114. package/dist/types/components.d.ts +33 -18
  115. package/dist/types/index.d.ts +1 -0
  116. package/hydrate/index.js +1379 -5773
  117. package/illustrations/illustrations.svg +1 -0
  118. package/illustrations/index.d.ts +11 -0
  119. package/illustrations/index.js +11 -0
  120. package/package.json +4 -2
  121. package/dist/cjs/focus-visible-a5d1ccf9.js.map +0 -1
  122. package/dist/esm/focus-visible-0fc6119c.js.map +0 -1
  123. package/dist/esm/polyfill-2b159e86.js +0 -7
  124. package/dist/roadtrip/p-0ffe42f9.entry.js +0 -2
  125. package/dist/roadtrip/p-0ffe42f9.entry.js.map +0 -1
  126. package/dist/roadtrip/p-12fd8791.js +0 -2
  127. package/dist/roadtrip/p-4f31338d.js +0 -2
  128. package/dist/roadtrip/p-6fb0d348.entry.js +0 -2
  129. package/dist/roadtrip/p-6fb0d348.entry.js.map +0 -1
  130. package/dist/roadtrip/p-80560610.entry.js +0 -2
  131. package/dist/roadtrip/p-80560610.entry.js.map +0 -1
  132. package/dist/roadtrip/p-c9a1dd14.entry.js +0 -2
  133. package/dist/roadtrip/p-c9a1dd14.entry.js.map +0 -1
  134. /package/dist/roadtrip/{p-f0e8feac.entry.js.map → p-093973f5.entry.js.map} +0 -0
  135. /package/dist/roadtrip/{p-3237c0d8.entry.js.map → p-0bcf6d63.entry.js.map} +0 -0
  136. /package/dist/roadtrip/{p-9077915a.entry.js.map → p-198f586b.entry.js.map} +0 -0
  137. /package/dist/roadtrip/{p-c784a407.entry.js.map → p-439e1124.entry.js.map} +0 -0
  138. /package/dist/roadtrip/{p-4b54f8e8.entry.js.map → p-4fd8c4db.entry.js.map} +0 -0
  139. /package/dist/roadtrip/{p-10856fef.entry.js.map → p-564f4f31.entry.js.map} +0 -0
  140. /package/dist/roadtrip/{p-c709f80e.entry.js.map → p-7c4b331c.entry.js.map} +0 -0
  141. /package/dist/roadtrip/{p-7390ad20.entry.js.map → p-b5727aae.entry.js.map} +0 -0
  142. /package/dist/roadtrip/{p-91070a4d.entry.js.map → p-c8e9807b.entry.js.map} +0 -0
  143. /package/dist/roadtrip/{p-12fd8791.js.map → p-e8c090a5.js.map} +0 -0
  144. /package/dist/roadtrip/{p-3f7c8122.entry.js.map → p-ebe3c26a.entry.js.map} +0 -0
  145. /package/dist/roadtrip/{p-a1a25a51.entry.js.map → p-ee0196ea.entry.js.map} +0 -0
  146. /package/dist/roadtrip/{p-c0c088c1.entry.js.map → p-f671758f.entry.js.map} +0 -0
@@ -1,72 +1,5 @@
1
- import { g as getAssetPath, r as registerInstance, h, H as Host, f as getElement } from './index-4b484f35.js';
2
-
3
- let CACHED_MAP;
4
- const getIllustrationMap = () => {
5
- if (typeof window === 'undefined') {
6
- return new Map();
7
- }
8
- else {
9
- if (!CACHED_MAP) {
10
- const win = window;
11
- win.Ionicons = win.Ionicons || {};
12
- CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
13
- }
14
- return CACHED_MAP;
15
- }
16
- };
17
- const getUrl = (i) => {
18
- let url = getSrc(i.src);
19
- if (url) {
20
- return url;
21
- }
22
- url = getName(i.name, i.illustration);
23
- if (url) {
24
- return getNamedUrl(url);
25
- }
26
- if (i.illustration) {
27
- url = getSrc(i.illustration);
28
- if (url) {
29
- return url;
30
- }
31
- }
32
- return null;
33
- };
34
- const getNamedUrl = (illustrationName) => {
35
- const url = getIllustrationMap().get(illustrationName);
36
- if (url) {
37
- return url;
38
- }
39
- return getAssetPath(`svg/${illustrationName}.svg`);
40
- };
41
- const getName = (illustrationName, illustration) => {
42
- if (!illustrationName && illustration && !isSrc(illustration)) {
43
- illustrationName = illustration;
44
- }
45
- if (isStr(illustrationName)) {
46
- illustrationName = toLower(illustrationName);
47
- }
48
- if (!isStr(illustrationName) || illustrationName.trim() === '') {
49
- return null;
50
- }
51
- // only allow alpha characters and dash
52
- const invalidChars = illustrationName.replace(/[a-z]|-|\d/gi, '');
53
- if (invalidChars !== '') {
54
- return null;
55
- }
56
- return illustrationName;
57
- };
58
- const getSrc = (src) => {
59
- if (isStr(src)) {
60
- src = src.trim();
61
- if (isSrc(src)) {
62
- return src;
63
- }
64
- }
65
- return null;
66
- };
67
- const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
68
- const isStr = (val) => typeof val === 'string';
69
- const toLower = (val) => val.toLowerCase();
1
+ import { r as registerInstance, h, H as Host, f as getElement } from './index-4b484f35.js';
2
+ import { i as isStr, g as getUrl, b as getName } from './utils-ff713b72.js';
70
3
 
71
4
  const validateContent = (svgContent) => {
72
5
  const div = document.createElement('div');
@@ -1 +1 @@
1
- {"file":"road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,EAAE;;UAEpC,IAAI,CAAC,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAChE;aAAM;;UAEL,yBAAyB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAC5H;OACF;KACF;IAED,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,MAAM,EAAE;MACjD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;;;MAGpD,IAAI,KAAK,EAAE;QACT,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;OAC3C;KACF;GACF;EAED,MAAM;IACJ,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,GAAG,gBAAgB,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IAC7E,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,GAAG,uBAAuB,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;IAE1F,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,GAAG,SAAS,IAAI,WAAW,EAAE,iBAAc,MAAM,KAE1D,CAAC,IAAI,CAAC,sBAAsB,KAAK,EAAE;QAC/B,WAAK,KAAK,EAAC,YAAY,EAAC,SAAS,EAAE,IAAI,CAAC,sBAAsB,GAAQ;QACtE,WAAK,KAAK,EAAC,YAAY,GAAO,EAE/B,EACP;GACH;;;;;;;;;;;;;","names":[],"sources":["./src/components/illustration/utils.ts","./src/components/illustration/validate.ts","./src/components/illustration/request.ts","./src/components/illustration/illustration.css?tag=road-illustration&encapsulation=shadow","./src/components/illustration/illustration.tsx"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { Illustration } from './illustration';\n\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const getIllustrationMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window as any;\n win.Ionicons = win.Ionicons || {};\n CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();\n }\n return CACHED_MAP;\n }\n};\n\nexport const addIllustrations = (illustrations: { [name: string]: string; }) => {\n const map = getIllustrationMap();\n Object.keys(illustrations).forEach(name => map.set(name, illustrations[name]));\n};\n\n\nexport const getUrl = (i: Illustration) => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n\n url = getName(i.name, i.illustration);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (i.illustration) {\n url = getSrc(i.illustration);\n if (url) {\n return url;\n }\n }\n\n return null;\n};\n\n\nconst getNamedUrl = (illustrationName: string) => {\n const url = getIllustrationMap().get(illustrationName);\n if (url) {\n return url;\n }\n return getAssetPath(`svg/${illustrationName}.svg`);\n};\n\n\nexport const getName = (\n illustrationName: string | undefined,\n illustration: string | undefined\n) => {\n\n if (!illustrationName && illustration && !isSrc(illustration)) {\n illustrationName = illustration;\n }\n if (isStr(illustrationName)) {\n illustrationName = toLower(illustrationName);\n }\n\n if (!isStr(illustrationName) || illustrationName.trim() === '') {\n return null;\n }\n\n // only allow alpha characters and dash\n const invalidChars = illustrationName.replace(/[a-z]|-|\\d/gi, '');\n if (invalidChars !== '') {\n return null;\n }\n\n return illustrationName;\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\n\nexport const isStr = (val: any): val is string => typeof val === 'string';\n\nexport const toLower = (val: string) => val.toLowerCase();","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string) => {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as any)) {\n return div.innerHTML;\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const val = elm.attributes[i].value;\n if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as any)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\n\nexport const roadillustrationContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>();\n\nexport const getIllustrationSvgContent = (url: string, sanitize: boolean) => {\n // see if we already have a request for this url\n let req = requests.get(url);\n\n if (!req) {\n if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {\n // we don't already have a request\n // @ts-ignore\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n svgContent = validateContent(svgContent);\n }\n roadillustrationContent.set(url, svgContent || '');\n });\n }\n roadillustrationContent.set(url, '');\n });\n\n // cache for the same requests\n requests.set(url, req);\n } else {\n // set to empty for ssr scenarios and resolve promise\n roadillustrationContent.set(url, '');\n return Promise.resolve();\n }\n }\n\n return req;\n};\n","/*\n * Illustration\n *\n * Index\n * - Sizes\n * - Colors\n * - Rotation\n */\n\n:host {\n box-sizing: content-box;\n display: inline-block;\n color: var(--road-icon);\n transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n fill: currentColor;\n contain: strict;\n}\n\n:host svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n/* SIZES\n -------------------- */\n\n:host(.illustration-sm) {\n width: 4rem;\n height: 4rem;\n}\n\n:host(.illustration-md) {\n width: 8rem;\n height: 8rem;\n}\n\n:host(.illustration-lg) {\n width: 16rem;\n height: 16rem;\n}\n\n:host(.illustration-2x) {\n width: 32rem;\n height: 32rem;\n}\n\n/* ROTATION\n -------------------- */\n\n:host(.illustration-rotate-90) {\n transform: rotate(90deg);\n}\n\n:host(.illustration-rotate-180) {\n transform: rotate(180deg);\n}\n\n:host(.illustration-rotate-270) {\n transform: rotate(270deg);\n}\n","import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getIllustrationSvgContent, roadillustrationContent } from './request';\nimport { getName, getUrl } from './utils';\n\n@Component({\n tag: 'road-illustration',\n assetsDirs: ['svg'],\n styleUrl: 'illustration.css',\n shadow: true,\n})\nexport class Illustration {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLRoadIllustrationElement;\n\n @State() private illustrationSvgContent?: string;\n\n @State() private isVisible = false;\n\n\n\n /**\n * Specifies the label to use for accessibility. Defaults to the illustration name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel?: string;\n\n /**\n * Set the illustration to hidden, respectively `true`, to remove it from the accessibility tree.\n */\n @Prop({ reflect: true }) ariaHidden?: string;\n\n /**\n * Specifies which illustration to use from the built-in set of illustrations.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() illustration?: any;\n\n /**\n * The size of the illustration.\n * Available options are: `\"sm\"`, `\"md\"`, `\"lg\"`, `\"2x\"`.\n */\n @Prop() size?: 'sm' | 'md' | 'lg' | '2x' = \"2x\";\n\n /**\n * The rotation of the illustration.\n * Available options are: `\"90\"`, `\"180\"`, `\"270\"`.\n */\n @Prop() rotate?: '90' | '180' | '270';\n\n /**\n * If enabled, road-illustration will be loaded lazily when it's visible in the viewport.\n * Default, `false`.\n */\n @Prop() lazy: boolean = false;\n\n /**\n * When set to `false`, SVG content that is HTTP fetched will not be checked\n * if the response SVG content has any `<script>` elements, or any attributes\n * that start with `on`, such as `onclick`.\n */\n @Prop() sanitize = true;\n\n componentWillLoad() {\n\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIllustration();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n private waitUntilVisible(el: HTMLRoadIllustrationElement, rootMargin: string, cb: () => void) {\n if (this.lazy && (window as any).IntersectionObserver) {\n const io = this.io = new (window as any).IntersectionObserver((data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n }, { rootMargin });\n\n io.observe(el);\n\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('illustration')\n loadIllustration() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (roadillustrationContent.has(url)) {\n // sync if it's already loaded\n this.illustrationSvgContent = roadillustrationContent.get(url);\n } else {\n // async if it hasn't been loaded\n getIllustrationSvgContent(url, this.sanitize).then(() => (this.illustrationSvgContent = roadillustrationContent.get(url)));\n }\n }\n }\n\n if (!this.ariaLabel && this.ariaHidden !== 'true') {\n const label = getName(this.name, this.illustration);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.replace(/-/g, ' ');\n }\n }\n }\n\n render() {\n const sizeClass = this.size !== undefined ? `illustration-${this.size}` : '';\n const rotateClass = this.rotate !== undefined ? `illustration-rotate-${this.rotate}` : '';\n\n return (\n <Host class={`${sizeClass} ${rotateClass}`} aria-hidden=\"true\">\n {(\n (this.illustrationSvgContent !== '')\n ? <div class=\"icon-inner\" innerHTML={this.illustrationSvgContent}></div>\n : <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}"],"version":3}
1
+ {"file":"road-illustration.entry.js","mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,UAAkB;EAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;EAC1C,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC;;EAG3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;IACnD,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;MACtD,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KACpC;GACF;;EAGD,MAAM,MAAM,GAAG,GAAG,CAAC,iBAAiB,CAAC;EACrC,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;IACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACpD,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,GAAG,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;;;;IAKhE,IAAI,OAAO,CAAC,MAAa,CAAC,EAAE;MAC1B,OAAO,GAAG,CAAC,SAAS,CAAC;KACtB;GACF;EACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEK,MAAM,OAAO,GAAG,CAAC,GAAgB;EACtC,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC,EAAE;IACtB,IAAI,GAAG,CAAC,QAAQ,CA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AW,EAAE,iBAAc,MAAM,KAE1D,CAAC,IAAI,CAAC,sBAAsB,KAAK,EAAE;QAC/B,WAAK,KAAK,EAAC,YAAY,EAAC,SAAS,EAAE,IAAI,CAAC,sBAAsB,GAAQ;QACtE,WAAK,KAAK,EAAC,YAAY,GAAO,EAE/B,EACP;GACH;;;;;;;;;;;;;","names":[],"sources":["./src/components/illustration/validate.ts","./src/components/illustration/request.ts","./src/components/illustration/illustration.css?tag=road-illustration&encapsulation=shadow","./src/components/illustration/illustration.tsx"],"sourcesContent":["import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string) => {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as any)) {\n return div.innerHTML;\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const val = elm.attributes[i].value;\n if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as any)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\n\nexport const roadillustrationContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>();\n\nexport const getIllustrationSvgContent = (url: string, sanitize: boolean) => {\n // see if we already have a request for this url\n let req = requests.get(url);\n\n if (!req) {\n if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {\n // we don't already have a request\n // @ts-ignore\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) {\n svgContent = validateContent(svgContent);\n }\n roadillustrationContent.set(url, svgContent || '');\n });\n }\n roadillustrationContent.set(url, '');\n });\n\n // cache for the same requests\n requests.set(url, req);\n } else {\n // set to empty for ssr scenarios and resolve promise\n roadillustrationContent.set(url, '');\n return Promise.resolve();\n }\n }\n\n return req;\n};\n","/*\n * Illustration\n *\n * Index\n * - Sizes\n * - Colors\n * - Rotation\n */\n\n:host {\n box-sizing: content-box;\n display: inline-block;\n color: var(--road-icon);\n transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n fill: currentColor;\n contain: strict;\n}\n\n:host svg {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n/* SIZES\n -------------------- */\n\n:host(.illustration-sm) {\n width: 4rem;\n height: 4rem;\n}\n\n:host(.illustration-md) {\n width: 8rem;\n height: 8rem;\n}\n\n:host(.illustration-lg) {\n width: 16rem;\n height: 16rem;\n}\n\n:host(.illustration-2x) {\n width: 32rem;\n height: 32rem;\n}\n\n/* ROTATION\n -------------------- */\n\n:host(.illustration-rotate-90) {\n transform: rotate(90deg);\n}\n\n:host(.illustration-rotate-180) {\n transform: rotate(180deg);\n}\n\n:host(.illustration-rotate-270) {\n transform: rotate(270deg);\n}\n","import { Build, Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { getIllustrationSvgContent, roadillustrationContent } from './request';\nimport { getName, getUrl } from './utils';\n\n@Component({\n tag: 'road-illustration',\n assetsDirs: ['svg'],\n styleUrl: 'illustration.css',\n shadow: true,\n})\nexport class Illustration {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLRoadIllustrationElement;\n\n @State() private illustrationSvgContent?: string;\n\n @State() private isVisible = false;\n\n\n\n /**\n * Specifies the label to use for accessibility. Defaults to the illustration name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel?: string;\n\n /**\n * Set the illustration to hidden, respectively `true`, to remove it from the accessibility tree.\n */\n @Prop({ reflect: true }) ariaHidden?: string;\n\n /**\n * Specifies which illustration to use from the built-in set of illustrations.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() illustration?: any;\n\n /**\n * The size of the illustration.\n * Available options are: `\"sm\"`, `\"md\"`, `\"lg\"`, `\"2x\"`.\n */\n @Prop() size?: 'sm' | 'md' | 'lg' | '2x' = \"2x\";\n\n /**\n * The rotation of the illustration.\n * Available options are: `\"90\"`, `\"180\"`, `\"270\"`.\n */\n @Prop() rotate?: '90' | '180' | '270';\n\n /**\n * If enabled, road-illustration will be loaded lazily when it's visible in the viewport.\n * Default, `false`.\n */\n @Prop() lazy: boolean = false;\n\n /**\n * When set to `false`, SVG content that is HTTP fetched will not be checked\n * if the response SVG content has any `<script>` elements, or any attributes\n * that start with `on`, such as `onclick`.\n */\n @Prop() sanitize = true;\n\n componentWillLoad() {\n\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIllustration();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n private waitUntilVisible(el: HTMLRoadIllustrationElement, rootMargin: string, cb: () => void) {\n if (this.lazy && (window as any).IntersectionObserver) {\n const io = this.io = new (window as any).IntersectionObserver((data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n }, { rootMargin });\n\n io.observe(el);\n\n } else {\n // browser doesn't support IntersectionObserver\n // so just fallback to always show it\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('illustration')\n loadIllustration() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (roadillustrationContent.has(url)) {\n // sync if it's already loaded\n this.illustrationSvgContent = roadillustrationContent.get(url);\n } else {\n // async if it hasn't been loaded\n getIllustrationSvgContent(url, this.sanitize).then(() => (this.illustrationSvgContent = roadillustrationContent.get(url)));\n }\n }\n }\n\n if (!this.ariaLabel && this.ariaHidden !== 'true') {\n const label = getName(this.name, this.illustration);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.replace(/-/g, ' ');\n }\n }\n }\n\n render() {\n const sizeClass = this.size !== undefined ? `illustration-${this.size}` : '';\n const rotateClass = this.rotate !== undefined ? `illustration-rotate-${this.rotate}` : '';\n\n return (\n <Host class={`${sizeClass} ${rotateClass}`} aria-hidden=\"true\">\n {(\n (this.illustrationSvgContent !== '')\n ? <div class=\"icon-inner\" innerHTML={this.illustrationSvgContent}></div>\n : <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}"],"version":3}
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, e as createEvent, h, H as Host } from './index-4b484f35.js';
2
- import './polyfill-2b159e86.js';
2
+ import './polyfill-ab80527b.js';
3
3
 
4
4
  const navbarCss = ":host{--z-index:3;position:fixed;bottom:0;left:0;z-index:var(--z-index);box-sizing:border-box;display:flex;align-items:center;width:100%;height:5.125rem;padding-left:0;margin:0;text-align:center;-webkit-user-select:none;user-select:none;background-color:var(--road-surface);border-top:1px solid var(--road-outline)}@media (max-width: 576px){:host{overflow-x:auto}}@media (min-width: 1200px){:host{bottom:auto;flex-direction:column;width:104px;height:100%;border-top:0;border-right:1px solid var(--road-outline)}}::slotted(.drawer-button-save){position:absolute;bottom:0;width:100%}";
5
5