@xplortech/apollo-core 0.5.0 → 0.5.2

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 (188) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/style.css +102 -142
  3. package/dist/apollo-core/apollo-core.css +9 -5508
  4. package/dist/apollo-core/apollo-core.esm.js +1 -125
  5. package/dist/apollo-core/index.esm.js +0 -1
  6. package/dist/apollo-core/p-0203d4e8.entry.js +1 -0
  7. package/dist/apollo-core/p-0b2c612e.entry.js +1 -0
  8. package/dist/apollo-core/p-128a0240.entry.js +1 -0
  9. package/dist/apollo-core/p-2f90296c.js +10 -0
  10. package/dist/apollo-core/p-30003b15.entry.js +1 -0
  11. package/dist/apollo-core/p-4e56a2ca.entry.js +1 -0
  12. package/dist/apollo-core/p-5854d1e4.entry.js +1 -0
  13. package/dist/apollo-core/p-611536d8.entry.js +1 -0
  14. package/dist/apollo-core/p-7c9fee7e.entry.js +1 -0
  15. package/dist/apollo-core/p-8b6633c7.js +1 -0
  16. package/dist/apollo-core/p-97cd1f73.entry.js +1 -0
  17. package/dist/apollo-core/p-9c5ca308.entry.js +1 -0
  18. package/dist/apollo-core/p-ad90fe4d.js +1 -0
  19. package/dist/apollo-core/p-bd4a7e3c.entry.js +1 -0
  20. package/dist/apollo-core/p-dab8e7a1.entry.js +1 -0
  21. package/dist/apollo-core/p-eb63b401.entry.js +1 -0
  22. package/dist/apollo-core/p-ee2f4422.entry.js +1 -0
  23. package/dist/apollo-core/p-f167aa05.entry.js +1 -0
  24. package/dist/cjs/apollo-core.cjs.js +19 -0
  25. package/dist/cjs/index-944adb2e.js +1609 -0
  26. package/dist/cjs/index.cjs.js +2 -0
  27. package/dist/cjs/loader.cjs.js +21 -0
  28. package/dist/{apollo-core/regular-133c23b5.js → cjs/regular-872f5226.js} +3 -12
  29. package/dist/cjs/v4-14140ff3.js +77 -0
  30. package/dist/cjs/xpl-application-shell_11.cjs.entry.js +230 -0
  31. package/dist/cjs/xpl-badge.cjs.entry.js +21 -0
  32. package/dist/cjs/xpl-button-row.cjs.entry.js +24 -0
  33. package/dist/cjs/xpl-checkbox_2.cjs.entry.js +51 -0
  34. package/dist/cjs/xpl-choicelist.cjs.entry.js +36 -0
  35. package/dist/cjs/xpl-divider.cjs.entry.js +18 -0
  36. package/dist/cjs/xpl-grid-item.cjs.entry.js +25 -0
  37. package/dist/cjs/xpl-grid.cjs.entry.js +35 -0
  38. package/dist/cjs/xpl-input.cjs.entry.js +2527 -0
  39. package/dist/cjs/xpl-list.cjs.entry.js +63 -0
  40. package/dist/cjs/xpl-pagination.cjs.entry.js +76 -0
  41. package/dist/cjs/xpl-select.cjs.entry.js +623 -0
  42. package/dist/cjs/xpl-table.cjs.entry.js +89 -0
  43. package/dist/cjs/xpl-tag.cjs.entry.js +21 -0
  44. package/dist/cjs/xpl-toggle.cjs.entry.js +34 -0
  45. package/dist/collection/collection-manifest.json +37 -0
  46. package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +143 -0
  47. package/dist/collection/components/xpl-avatar/xpl-avatar.js +158 -0
  48. package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +41 -0
  49. package/dist/collection/components/xpl-badge/xpl-badge.js +50 -0
  50. package/dist/{apollo-core/xpl-breadcrumb-item.entry.js → collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js} +12 -9
  51. package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +15 -0
  52. package/dist/collection/components/xpl-button/xpl-button.js +214 -0
  53. package/dist/collection/components/xpl-button-row/xpl-button-row.js +119 -0
  54. package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +185 -0
  55. package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +143 -0
  56. package/dist/collection/components/xpl-content-area/xpl-content-area.js +39 -0
  57. package/dist/collection/components/xpl-divider/xpl-divider.js +30 -0
  58. package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +32 -0
  59. package/dist/collection/components/xpl-grid/xpl-grid.js +26 -0
  60. package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +93 -0
  61. package/dist/collection/components/xpl-input/xpl-input.js +471 -0
  62. package/dist/collection/components/xpl-list/xpl-list.js +93 -0
  63. package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +72 -0
  64. package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +10 -0
  65. package/dist/collection/components/xpl-pagination/xpl-pagination.js +189 -0
  66. package/dist/collection/components/xpl-radio/xpl-radio.js +168 -0
  67. package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +9 -0
  68. package/dist/collection/components/xpl-select/xpl-select.js +311 -0
  69. package/dist/collection/components/xpl-table/xpl-table.js +194 -0
  70. package/dist/collection/components/xpl-tag/xpl-tag.js +30 -0
  71. package/dist/collection/components/xpl-toggle/xpl-toggle.js +157 -0
  72. package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +70 -0
  73. package/dist/custom-elements/index.js +19959 -0
  74. package/dist/esm/apollo-core.js +17 -0
  75. package/dist/esm/index-899dba3b.js +1580 -0
  76. package/dist/esm/index.js +1 -0
  77. package/dist/esm/loader.js +17 -0
  78. package/dist/esm/polyfills/core-js.js +11 -0
  79. package/dist/esm/polyfills/css-shim.js +1 -0
  80. package/dist/esm/polyfills/dom.js +79 -0
  81. package/dist/esm/polyfills/es5-html-element.js +1 -0
  82. package/dist/esm/polyfills/index.js +34 -0
  83. package/dist/esm/polyfills/system.js +6 -0
  84. package/dist/esm/regular-86225e9d.js +16041 -0
  85. package/dist/esm/v4-929670b7.js +75 -0
  86. package/dist/esm/xpl-application-shell_11.entry.js +216 -0
  87. package/dist/{apollo-core → esm}/xpl-badge.entry.js +1 -1
  88. package/dist/{apollo-core → esm}/xpl-button-row.entry.js +1 -1
  89. package/dist/esm/xpl-checkbox_2.entry.js +46 -0
  90. package/dist/{apollo-core → esm}/xpl-choicelist.entry.js +1 -1
  91. package/dist/{apollo-core → esm}/xpl-divider.entry.js +1 -1
  92. package/dist/{apollo-core → esm}/xpl-grid-item.entry.js +1 -1
  93. package/dist/{apollo-core → esm}/xpl-grid.entry.js +1 -1
  94. package/dist/{apollo-core → esm}/xpl-input.entry.js +3 -20
  95. package/dist/{apollo-core → esm}/xpl-list.entry.js +2 -2
  96. package/dist/{apollo-core → esm}/xpl-pagination.entry.js +1 -1
  97. package/dist/{apollo-core → esm}/xpl-select.entry.js +2 -43
  98. package/dist/{apollo-core → esm}/xpl-table.entry.js +1 -1
  99. package/dist/{apollo-core → esm}/xpl-tag.entry.js +1 -1
  100. package/dist/{apollo-core → esm}/xpl-toggle.entry.js +2 -2
  101. package/dist/index.cjs.js +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/stories/application-shell.stories.js +766 -0
  104. package/dist/stories/avatar.stories.js +173 -0
  105. package/dist/stories/backdrop.stories.js +18 -0
  106. package/dist/stories/badge.stories.js +48 -0
  107. package/dist/stories/breadcrumbs.stories.js +115 -0
  108. package/dist/stories/button-row.stories.js +64 -0
  109. package/dist/stories/button.stories.js +98 -0
  110. package/dist/stories/checkbox.stories.js +76 -0
  111. package/dist/stories/choicelist.stories.js +112 -0
  112. package/dist/stories/content-area.stories.js +53 -0
  113. package/dist/stories/divider.stories.js +34 -0
  114. package/dist/stories/grid.stories.js +100 -0
  115. package/dist/stories/input.stories.js +252 -0
  116. package/dist/stories/list.stories.js +134 -0
  117. package/dist/stories/main-nav.stories.js +308 -0
  118. package/dist/stories/pagination.stories.js +84 -0
  119. package/dist/stories/radio.stories.js +66 -0
  120. package/dist/stories/secondary-nav.stories.js +76 -0
  121. package/dist/stories/select.stories.js +111 -0
  122. package/dist/stories/table.stories.js +107 -0
  123. package/dist/stories/tabs.stories.js +24 -0
  124. package/dist/stories/toggle.stories.js +80 -0
  125. package/dist/stories/utility-bar.stories.js +94 -0
  126. package/package.json +1 -1
  127. package/dist/apollo-core/app-globals-0f993ce5.js +0 -3
  128. package/dist/apollo-core/css-shim-bbdf0cc6.js +0 -4
  129. package/dist/apollo-core/dom-1f98a75f.js +0 -73
  130. package/dist/apollo-core/index-3c9f25ef.js +0 -2938
  131. package/dist/apollo-core/index-3eb5568f.js +0 -2938
  132. package/dist/apollo-core/index-912d1a21.js +0 -584
  133. package/dist/apollo-core/shadow-css-67b66845.js +0 -389
  134. package/dist/apollo-core/xpl-application-shell.entry.js +0 -52
  135. package/dist/apollo-core/xpl-avatar.entry.js +0 -19
  136. package/dist/apollo-core/xpl-backdrop.entry.js +0 -21
  137. package/dist/apollo-core/xpl-breadcrumbs.entry.js +0 -14
  138. package/dist/apollo-core/xpl-button.entry.js +0 -34
  139. package/dist/apollo-core/xpl-checkbox.entry.js +0 -25
  140. package/dist/apollo-core/xpl-content-area.entry.js +0 -16
  141. package/dist/apollo-core/xpl-main-nav.entry.js +0 -26
  142. package/dist/apollo-core/xpl-nav-item.entry.js +0 -12
  143. package/dist/apollo-core/xpl-radio.entry.js +0 -25
  144. package/dist/apollo-core/xpl-secondary-nav.entry.js +0 -12
  145. package/dist/apollo-core/xpl-utility-bar.entry.js +0 -25
  146. package/dist/types/components/xpl-application-shell/test/xpl-application-shell.e2e.d.ts +0 -1
  147. package/dist/types/components/xpl-avatar/test/xpl-avatar.e2e.d.ts +0 -1
  148. package/dist/types/components/xpl-avatar/test/xpl-avatar.spec.d.ts +0 -1
  149. package/dist/types/components/xpl-backdrop/test/xpl-backdrop.e2e.d.ts +0 -1
  150. package/dist/types/components/xpl-badge/test/xpl-badge.e2e.d.ts +0 -1
  151. package/dist/types/components/xpl-badge/test/xpl-badge.spec.d.ts +0 -1
  152. package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumb-item/test/xpl-breadcrumb-item.e2e.d.ts +0 -1
  153. package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumbs/test/xpl-breadcrumbs.e2e.d.ts +0 -1
  154. package/dist/types/components/xpl-button/test/xpl-button.e2e.d.ts +0 -1
  155. package/dist/types/components/xpl-button/test/xpl-button.spec.d.ts +0 -1
  156. package/dist/types/components/xpl-button-row/test/xpl-button-row.e2e.d.ts +0 -1
  157. package/dist/types/components/xpl-button-row/test/xpl-button-row.spec.d.ts +0 -1
  158. package/dist/types/components/xpl-checkbox/test/xpl-checkbox.e2e.d.ts +0 -1
  159. package/dist/types/components/xpl-checkbox/test/xpl-checkbox.spec.d.ts +0 -1
  160. package/dist/types/components/xpl-choicelist/test/xpl-choicelist.e2e.d.ts +0 -1
  161. package/dist/types/components/xpl-choicelist/test/xpl-choicelist.spec.d.ts +0 -1
  162. package/dist/types/components/xpl-content-area/test/xpl-content-area.e2e.d.ts +0 -1
  163. package/dist/types/components/xpl-divider/test/xpl-divider.e2e.d.ts +0 -1
  164. package/dist/types/components/xpl-divider/test/xpl-divider.spec.d.ts +0 -1
  165. package/dist/types/components/xpl-grid/test/xpl-grid.e2e.d.ts +0 -1
  166. package/dist/types/components/xpl-grid/test/xpl-grid.spec.d.ts +0 -1
  167. package/dist/types/components/xpl-grid-item/test/xpl-grid-item.e2e.d.ts +0 -1
  168. package/dist/types/components/xpl-grid-item/test/xpl-grid-item.spec.d.ts +0 -1
  169. package/dist/types/components/xpl-input/test/xpl-input.e2e.d.ts +0 -1
  170. package/dist/types/components/xpl-input/test/xpl-input.spec.d.ts +0 -1
  171. package/dist/types/components/xpl-list/test/xpl-list.e2e.d.ts +0 -1
  172. package/dist/types/components/xpl-list/test/xpl-list.spec.d.ts +0 -1
  173. package/dist/types/components/xpl-main-nav/test/xpl-main-nav.e2e.d.ts +0 -1
  174. package/dist/types/components/xpl-nav-item/test/xpl-nav-item.e2e.d.ts +0 -1
  175. package/dist/types/components/xpl-pagination/test/xpl-pagination.e2e.d.ts +0 -1
  176. package/dist/types/components/xpl-pagination/test/xpl-pagination.spec.d.ts +0 -1
  177. package/dist/types/components/xpl-radio/test/xpl-radio.e2e.d.ts +0 -1
  178. package/dist/types/components/xpl-radio/test/xpl-radio.spec.d.ts +0 -1
  179. package/dist/types/components/xpl-secondary-nav/test/secondary-nav.e2e.d.ts +0 -1
  180. package/dist/types/components/xpl-select/test/xpl-select.e2e.d.ts +0 -1
  181. package/dist/types/components/xpl-select/test/xpl-select.spec.d.ts +0 -1
  182. package/dist/types/components/xpl-table/test/xpl-table.e2e.d.ts +0 -1
  183. package/dist/types/components/xpl-table/test/xpl-table.spec.d.ts +0 -1
  184. package/dist/types/components/xpl-tag/test/xpl-tag.e2e.d.ts +0 -1
  185. package/dist/types/components/xpl-tag/test/xpl-tag.spec.d.ts +0 -1
  186. package/dist/types/components/xpl-toggle/test/xpl-toggle.e2e.d.ts +0 -1
  187. package/dist/types/components/xpl-toggle/test/xpl-toggle.spec.d.ts +0 -1
  188. package/dist/types/components/xpl-utility-bar/test/xpl-utility-bar.e2e.d.ts +0 -1
@@ -0,0 +1,30 @@
1
+ import { Component, Host, h, Prop } from '@stencil/core';
2
+ export class XplDivider {
3
+ render() {
4
+ let className = "xpl-divider";
5
+ className += ` xpl-divider--${this.tier}`;
6
+ return (h(Host, { class: className },
7
+ h("span", null,
8
+ h("slot", null))));
9
+ }
10
+ static get is() { return "xpl-divider"; }
11
+ static get properties() { return {
12
+ "tier": {
13
+ "type": "number",
14
+ "mutable": false,
15
+ "complexType": {
16
+ "original": "number",
17
+ "resolved": "number",
18
+ "references": {}
19
+ },
20
+ "required": false,
21
+ "optional": true,
22
+ "docs": {
23
+ "tags": [],
24
+ "text": "The tier should be an integer between 0 and 3.\nTier 0 dividers do not display text, and 1-3 increase\nin size with each increasing tier."
25
+ },
26
+ "attribute": "tier",
27
+ "reflect": false
28
+ }
29
+ }; }
30
+ }
@@ -0,0 +1,32 @@
1
+ /// <reference path="./dropdownchoice.d.ts"></reference>
2
+ import { h } from '@stencil/core';
3
+ export const XplDropdown = ({ active, choices, mode, selected, update, }) => {
4
+ return (h("div", { class: {
5
+ "xpl-dropdown": true,
6
+ "xpl-dropdown--multi": mode === "multi",
7
+ "active": active,
8
+ } },
9
+ h("ul", null, choices.map(({ label, isGroupHeading }, i) => {
10
+ return isGroupHeading ?
11
+ h("span", null, label) :
12
+ h("li", null,
13
+ h("button", { class: {
14
+ selected: selected[i]
15
+ }, onClick: () => {
16
+ let newSelected;
17
+ if (mode === "single") {
18
+ // @ts-expect-error
19
+ newSelected = selected.map((v, j) => {
20
+ return i === j ? !selected[i] : false;
21
+ });
22
+ active = false;
23
+ }
24
+ else if (mode === "multi") {
25
+ newSelected = selected.map((v, j) => {
26
+ return i === j ? !selected[i] : v;
27
+ });
28
+ }
29
+ update(newSelected);
30
+ }, tabIndex: active ? 0 : -1 }, label));
31
+ }))));
32
+ };
@@ -0,0 +1,26 @@
1
+ import { Component, Host, h, Element } from '@stencil/core';
2
+ export class XplGrid {
3
+ componentDidLoad() {
4
+ const items = Array.from(this.container.querySelectorAll(".xpl-grid-item"));
5
+ let lgCounter = 0, mdCounter = 0, smCounter = 0, xsCounter = 0;
6
+ items.forEach(item => {
7
+ lgCounter += +item.getAttribute("lg") || 6;
8
+ mdCounter += +item.getAttribute("md") || 6;
9
+ smCounter += +item.getAttribute("sm") || 6;
10
+ xsCounter += +item.getAttribute("xs") || 6;
11
+ if (lgCounter % 6 === 0)
12
+ item.classList.add("xpl-grid-item-lg-last");
13
+ if (mdCounter % 6 === 0)
14
+ item.classList.add("xpl-grid-item-md-last");
15
+ if (smCounter % 6 === 0)
16
+ item.classList.add("xpl-grid-item-sm-last");
17
+ if (xsCounter % 6 === 0)
18
+ item.classList.add("xpl-grid-item-xs-last");
19
+ });
20
+ }
21
+ render() {
22
+ return (h(Host, { class: "xpl-grid" }));
23
+ }
24
+ static get is() { return "xpl-grid"; }
25
+ static get elementRef() { return "container"; }
26
+ }
@@ -0,0 +1,93 @@
1
+ import { Component, Host, h, Prop } from '@stencil/core';
2
+ export class XplGridItem {
3
+ constructor() {
4
+ this.xs = 6;
5
+ this.sm = 6;
6
+ this.md = 6;
7
+ this.lg = 6;
8
+ }
9
+ render() {
10
+ let className = "xpl-grid-item";
11
+ className += ` xpl-grid-item-xs-${this.xs}`;
12
+ className += ` xpl-grid-item-sm-${this.sm}`;
13
+ className += ` xpl-grid-item-md-${this.md}`;
14
+ className += ` xpl-grid-item-lg-${this.lg}`;
15
+ return (h(Host, { class: className },
16
+ h("slot", null)));
17
+ }
18
+ static get is() { return "xpl-grid-item"; }
19
+ static get properties() { return {
20
+ "xs": {
21
+ "type": "number",
22
+ "mutable": false,
23
+ "complexType": {
24
+ "original": "number",
25
+ "resolved": "number",
26
+ "references": {}
27
+ },
28
+ "required": false,
29
+ "optional": false,
30
+ "docs": {
31
+ "tags": [],
32
+ "text": ""
33
+ },
34
+ "attribute": "xs",
35
+ "reflect": false,
36
+ "defaultValue": "6"
37
+ },
38
+ "sm": {
39
+ "type": "number",
40
+ "mutable": false,
41
+ "complexType": {
42
+ "original": "number",
43
+ "resolved": "number",
44
+ "references": {}
45
+ },
46
+ "required": false,
47
+ "optional": false,
48
+ "docs": {
49
+ "tags": [],
50
+ "text": ""
51
+ },
52
+ "attribute": "sm",
53
+ "reflect": false,
54
+ "defaultValue": "6"
55
+ },
56
+ "md": {
57
+ "type": "number",
58
+ "mutable": false,
59
+ "complexType": {
60
+ "original": "number",
61
+ "resolved": "number",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ },
70
+ "attribute": "md",
71
+ "reflect": false,
72
+ "defaultValue": "6"
73
+ },
74
+ "lg": {
75
+ "type": "number",
76
+ "mutable": false,
77
+ "complexType": {
78
+ "original": "number",
79
+ "resolved": "number",
80
+ "references": {}
81
+ },
82
+ "required": false,
83
+ "optional": false,
84
+ "docs": {
85
+ "tags": [],
86
+ "text": ""
87
+ },
88
+ "attribute": "lg",
89
+ "reflect": false,
90
+ "defaultValue": "6"
91
+ }
92
+ }; }
93
+ }
@@ -0,0 +1,471 @@
1
+ import { Component, Host, h, Prop, State } from '@stencil/core';
2
+ import { v4 as uuid } from "uuid";
3
+ import flatpickr from "flatpickr";
4
+ import "../../../font-awesome/fontawesome";
5
+ import "../../../font-awesome/regular";
6
+ const arrowSvg = (rotate = false) => `<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="${rotate ? 'M0.557948 5.6813L6.06209 0.132167C6.23831 -0.0440556 6.52327 -0.0440556 6.69949 0.132167L7.44187 0.874551C7.61809 1.05077 7.61809 1.33573 7.44187 1.51195L2.99882 6L7.44187 10.488C7.61809 10.6643 7.61809 10.9492 7.44187 11.1254L6.69949 11.8678C6.52327 12.0441 6.23831 12.0441 6.06209 11.8678L0.557948 6.3187C0.381726 6.14248 0.381726 5.85752 0.557948 5.6813Z' : 'M7.44187 6.3187L1.93773 11.8678C1.76151 12.0441 1.47655 12.0441 1.30033 11.8678L0.557948 11.1254C0.381726 10.9492 0.381726 10.6643 0.557948 10.488L5.001 6L0.557948 1.51195C0.381726 1.33573 0.381726 1.05077 0.557948 0.874551L1.30033 0.132167C1.47655 -0.0440556 1.76151 -0.0440556 1.93773 0.132167L7.44187 5.6813C7.6181 5.85752 7.6181 6.14248 7.44187 6.3187Z'}" /></svg>`;
7
+ export class XplInput {
8
+ constructor() {
9
+ /**
10
+ * See https://flatpickr.js.org/formatting/
11
+ */
12
+ this.dateFormat = "Y-m-d";
13
+ /**
14
+ * For datepicker inputs, whether to allow only a single
15
+ * date or a range of dates. (Multiple non-consecutive
16
+ * dates planned to be supported in the future.)
17
+ */
18
+ this.mode = "single";
19
+ /**
20
+ * Whether to render as a singleline text input or
21
+ * as a multiline textarea. (If `true`, `pre` and `post`
22
+ * values will be ignored, if present.)
23
+ */
24
+ this.multiline = false;
25
+ this.type = "text";
26
+ this.characterCount = 0;
27
+ this.passwordVisible = false;
28
+ }
29
+ updateCharacterCount() {
30
+ this.characterCount = this.input.value.length;
31
+ }
32
+ componentWillLoad() {
33
+ if (this._id === undefined || this._id === null || this._id === "")
34
+ this._id = uuid();
35
+ if (this.multiline && this.maxCharacterCount !== undefined) {
36
+ this.characterCount = this.value !== undefined ? this.value.length : 0;
37
+ }
38
+ }
39
+ componentDidLoad() {
40
+ if (this.type === "date") {
41
+ flatpickr(this.input, {
42
+ allowInput: true,
43
+ dateFormat: this.dateFormat,
44
+ defaultDate: this.value,
45
+ maxDate: this.max,
46
+ minDate: this.min,
47
+ mode: this.mode,
48
+ nextArrow: arrowSvg(),
49
+ prevArrow: arrowSvg(true)
50
+ });
51
+ }
52
+ }
53
+ render() {
54
+ let className = "xpl-input";
55
+ if (this.disabled)
56
+ className += " xpl-input--disabled";
57
+ let hasError = false;
58
+ if (this.error !== undefined)
59
+ hasError = true;
60
+ if (this.multiline && this.maxCharacterCount !== undefined && this.characterCount > this.maxCharacterCount)
61
+ hasError = true;
62
+ if (hasError)
63
+ className += " xpl-input--error";
64
+ let type = this.type;
65
+ if (type === "password" && this.passwordVisible) {
66
+ type = "text";
67
+ }
68
+ return (h(Host, { class: className },
69
+ h("label", { class: "xpl-input-label", htmlFor: this._id },
70
+ this.label,
71
+ this.description && h("small", null, this.description)),
72
+ h("div", { class: "xpl-input-wrapper" },
73
+ this.pre && !this.multiline && h("label", { class: "xpl-input-pre", htmlFor: this._id }, this.pre),
74
+ !this.multiline ?
75
+ h("input", { autocomplete: this.type === "date" ? "off" : this.autocomplete, disabled: this.disabled, id: this._id, max: this.max, min: this.min, name: this.name, placeholder: this.placeholder, readonly: this.readonly, ref: (el) => {
76
+ this.input = el;
77
+ }, required: this.required, step: this.step, type: type, value: this.value }) :
78
+ h("textarea", { disabled: this.disabled, id: this._id, name: this.name, onInput: () => this.updateCharacterCount(), placeholder: this.placeholder, readonly: this.readonly, ref: (el) => {
79
+ this.input = el;
80
+ }, required: this.required }, this.value),
81
+ this.type === "date" && h("span", { class: "xpl-input-calendar" },
82
+ h("i", { class: "far fa-calendar-alt" })),
83
+ this.type === "password" && h("button", { class: "xpl-input-password", onClick: () => {
84
+ this.passwordVisible = !this.passwordVisible;
85
+ }, role: "presentation" },
86
+ h("span", { class: "sr-only" }, "Toggle password visibility"),
87
+ h("i", { class: "far fa-eye", style: {
88
+ display: this.passwordVisible ? "none" : "block"
89
+ } }),
90
+ h("i", { class: "far fa-eye-slash", style: {
91
+ display: this.passwordVisible ? "block" : "none"
92
+ } })),
93
+ this.post && !this.multiline && h("label", { class: "xpl-input-post", htmlFor: this._id }, this.post),
94
+ this.multiline && this.maxCharacterCount !== undefined && h("span", { class: "xpl-input-characters" },
95
+ this.characterCount,
96
+ "/",
97
+ this.maxCharacterCount)),
98
+ this.error !== undefined && this.error.length > 0 && h("label", { class: "xpl-input-error", htmlFor: this._id },
99
+ h("svg", { width: "10", height: "11", viewBox: "0 0 10 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
100
+ h("path", { d: "M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" })),
101
+ this.error)));
102
+ }
103
+ static get is() { return "xpl-input"; }
104
+ static get properties() { return {
105
+ "_id": {
106
+ "type": "string",
107
+ "mutable": false,
108
+ "complexType": {
109
+ "original": "string",
110
+ "resolved": "string",
111
+ "references": {}
112
+ },
113
+ "required": false,
114
+ "optional": true,
115
+ "docs": {
116
+ "tags": [],
117
+ "text": "Because `id` is a reserved HTMLElement attribute,\nwe prefix it with an underscore here so that it\ndoesn't get automatically applied to the outer container."
118
+ },
119
+ "attribute": "_id",
120
+ "reflect": false
121
+ },
122
+ "autocomplete": {
123
+ "type": "string",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "string",
127
+ "resolved": "string",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": true,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": ""
135
+ },
136
+ "attribute": "autocomplete",
137
+ "reflect": false
138
+ },
139
+ "dateFormat": {
140
+ "type": "string",
141
+ "mutable": false,
142
+ "complexType": {
143
+ "original": "string",
144
+ "resolved": "string",
145
+ "references": {}
146
+ },
147
+ "required": false,
148
+ "optional": true,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": "See https://flatpickr.js.org/formatting/"
152
+ },
153
+ "attribute": "date-format",
154
+ "reflect": false,
155
+ "defaultValue": "\"Y-m-d\""
156
+ },
157
+ "description": {
158
+ "type": "string",
159
+ "mutable": false,
160
+ "complexType": {
161
+ "original": "string",
162
+ "resolved": "string",
163
+ "references": {}
164
+ },
165
+ "required": false,
166
+ "optional": true,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": "Optional text that appears below the input label."
170
+ },
171
+ "attribute": "description",
172
+ "reflect": false
173
+ },
174
+ "disabled": {
175
+ "type": "boolean",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "boolean",
179
+ "resolved": "boolean",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": true,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": ""
187
+ },
188
+ "attribute": "disabled",
189
+ "reflect": false
190
+ },
191
+ "error": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": true,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": "If an empty string (attribute present with no value),\nwill display visually as an error. If a string is\nincluded, will display visually as an error and include\nthe value as an error message."
204
+ },
205
+ "attribute": "error",
206
+ "reflect": false
207
+ },
208
+ "label": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "string",
213
+ "resolved": "string",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": ""
221
+ },
222
+ "attribute": "label",
223
+ "reflect": false
224
+ },
225
+ "max": {
226
+ "type": "any",
227
+ "mutable": false,
228
+ "complexType": {
229
+ "original": "number | string",
230
+ "resolved": "number | string",
231
+ "references": {}
232
+ },
233
+ "required": false,
234
+ "optional": true,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": "Only used when `type` = 'number' or 'date'"
238
+ },
239
+ "attribute": "max",
240
+ "reflect": false
241
+ },
242
+ "maxCharacterCount": {
243
+ "type": "number",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "number",
247
+ "resolved": "number",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": true,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": "For multiline inputs, a max. character count will\ndisplay along with the current character count,\nand will automatically render as an error if the\ncharacter count exceeds the max."
255
+ },
256
+ "attribute": "max-character-count",
257
+ "reflect": false
258
+ },
259
+ "min": {
260
+ "type": "any",
261
+ "mutable": false,
262
+ "complexType": {
263
+ "original": "number | string",
264
+ "resolved": "number | string",
265
+ "references": {}
266
+ },
267
+ "required": false,
268
+ "optional": true,
269
+ "docs": {
270
+ "tags": [],
271
+ "text": "Only used when `type` = 'number' or 'date'"
272
+ },
273
+ "attribute": "min",
274
+ "reflect": false
275
+ },
276
+ "mode": {
277
+ "type": "string",
278
+ "mutable": false,
279
+ "complexType": {
280
+ "original": "\"single\" | /* \"multiple\" | */ \"range\"",
281
+ "resolved": "\"range\" | \"single\"",
282
+ "references": {}
283
+ },
284
+ "required": false,
285
+ "optional": true,
286
+ "docs": {
287
+ "tags": [],
288
+ "text": "For datepicker inputs, whether to allow only a single\ndate or a range of dates. (Multiple non-consecutive\ndates planned to be supported in the future.)"
289
+ },
290
+ "attribute": "mode",
291
+ "reflect": false,
292
+ "defaultValue": "\"single\""
293
+ },
294
+ "multiline": {
295
+ "type": "boolean",
296
+ "mutable": false,
297
+ "complexType": {
298
+ "original": "boolean",
299
+ "resolved": "boolean",
300
+ "references": {}
301
+ },
302
+ "required": false,
303
+ "optional": true,
304
+ "docs": {
305
+ "tags": [],
306
+ "text": "Whether to render as a singleline text input or\nas a multiline textarea. (If `true`, `pre` and `post`\nvalues will be ignored, if present.)"
307
+ },
308
+ "attribute": "multiline",
309
+ "reflect": false,
310
+ "defaultValue": "false"
311
+ },
312
+ "name": {
313
+ "type": "string",
314
+ "mutable": false,
315
+ "complexType": {
316
+ "original": "string",
317
+ "resolved": "string",
318
+ "references": {}
319
+ },
320
+ "required": false,
321
+ "optional": true,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": "Most inputs are used in forms, and should have a\n`name` associated with the input for handling form data."
325
+ },
326
+ "attribute": "name",
327
+ "reflect": false
328
+ },
329
+ "placeholder": {
330
+ "type": "string",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "string",
334
+ "resolved": "string",
335
+ "references": {}
336
+ },
337
+ "required": false,
338
+ "optional": true,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": ""
342
+ },
343
+ "attribute": "placeholder",
344
+ "reflect": false
345
+ },
346
+ "post": {
347
+ "type": "string",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "string",
351
+ "resolved": "string",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": true,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "A string (recommended max 3 characters) that gets shown\nvisually to the left of (before) the input."
359
+ },
360
+ "attribute": "post",
361
+ "reflect": false
362
+ },
363
+ "pre": {
364
+ "type": "string",
365
+ "mutable": false,
366
+ "complexType": {
367
+ "original": "string",
368
+ "resolved": "string",
369
+ "references": {}
370
+ },
371
+ "required": false,
372
+ "optional": true,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": "A string (recommended max 8 characters) that gets shown\nvisually to the right of (after) the input."
376
+ },
377
+ "attribute": "pre",
378
+ "reflect": false
379
+ },
380
+ "readonly": {
381
+ "type": "boolean",
382
+ "mutable": false,
383
+ "complexType": {
384
+ "original": "boolean",
385
+ "resolved": "boolean",
386
+ "references": {}
387
+ },
388
+ "required": false,
389
+ "optional": true,
390
+ "docs": {
391
+ "tags": [],
392
+ "text": ""
393
+ },
394
+ "attribute": "readonly",
395
+ "reflect": false
396
+ },
397
+ "required": {
398
+ "type": "boolean",
399
+ "mutable": false,
400
+ "complexType": {
401
+ "original": "boolean",
402
+ "resolved": "boolean",
403
+ "references": {}
404
+ },
405
+ "required": false,
406
+ "optional": true,
407
+ "docs": {
408
+ "tags": [],
409
+ "text": ""
410
+ },
411
+ "attribute": "required",
412
+ "reflect": false
413
+ },
414
+ "step": {
415
+ "type": "number",
416
+ "mutable": false,
417
+ "complexType": {
418
+ "original": "number",
419
+ "resolved": "number",
420
+ "references": {}
421
+ },
422
+ "required": false,
423
+ "optional": true,
424
+ "docs": {
425
+ "tags": [],
426
+ "text": ""
427
+ },
428
+ "attribute": "step",
429
+ "reflect": false
430
+ },
431
+ "type": {
432
+ "type": "string",
433
+ "mutable": false,
434
+ "complexType": {
435
+ "original": "\"date\" | \"text\" | \"number\" | \"password\"",
436
+ "resolved": "\"date\" | \"number\" | \"password\" | \"text\"",
437
+ "references": {}
438
+ },
439
+ "required": false,
440
+ "optional": true,
441
+ "docs": {
442
+ "tags": [],
443
+ "text": ""
444
+ },
445
+ "attribute": "type",
446
+ "reflect": false,
447
+ "defaultValue": "\"text\""
448
+ },
449
+ "value": {
450
+ "type": "string",
451
+ "mutable": false,
452
+ "complexType": {
453
+ "original": "string",
454
+ "resolved": "string",
455
+ "references": {}
456
+ },
457
+ "required": false,
458
+ "optional": true,
459
+ "docs": {
460
+ "tags": [],
461
+ "text": "Including a `value` will prepopulate the input\nwith the given string."
462
+ },
463
+ "attribute": "value",
464
+ "reflect": false
465
+ }
466
+ }; }
467
+ static get states() { return {
468
+ "characterCount": {},
469
+ "passwordVisible": {}
470
+ }; }
471
+ }