@internetarchive/elements 0.0.0-WEBDEV-8458-update-item-nav

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 (127) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +417 -0
  3. package/dist/src/elements/ia-button/ia-button.d.ts +47 -0
  4. package/dist/src/elements/ia-button/ia-button.d.ts.map +1 -0
  5. package/dist/src/elements/ia-button/ia-button.js +377 -0
  6. package/dist/src/elements/ia-button/ia-button.js.map +1 -0
  7. package/dist/src/elements/ia-combo-box/caret-closed.svg +8 -0
  8. package/dist/src/elements/ia-combo-box/caret-open.svg +8 -0
  9. package/dist/src/elements/ia-combo-box/clear.svg +9 -0
  10. package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts +427 -0
  11. package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts.map +1 -0
  12. package/dist/src/elements/ia-combo-box/ia-combo-box.js +1295 -0
  13. package/dist/src/elements/ia-combo-box/ia-combo-box.js.map +1 -0
  14. package/dist/src/elements/ia-combo-box/models.d.ts +76 -0
  15. package/dist/src/elements/ia-combo-box/models.d.ts.map +1 -0
  16. package/dist/src/elements/ia-combo-box/models.js +40 -0
  17. package/dist/src/elements/ia-combo-box/models.js.map +1 -0
  18. package/dist/src/elements/ia-combo-box/story-support/200-countries.json +802 -0
  19. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts +68 -0
  20. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts.map +1 -0
  21. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js +331 -0
  22. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js.map +1 -0
  23. package/dist/src/elements/ia-dropdown-search-bar/models.d.ts +17 -0
  24. package/dist/src/elements/ia-dropdown-search-bar/models.d.ts.map +1 -0
  25. package/dist/src/elements/ia-dropdown-search-bar/models.js +2 -0
  26. package/dist/src/elements/ia-dropdown-search-bar/models.js.map +1 -0
  27. package/dist/src/elements/ia-dropdown-search-bar/search.svg +10 -0
  28. package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts +97 -0
  29. package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts.map +1 -0
  30. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js +588 -0
  31. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js.map +1 -0
  32. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts +39 -0
  33. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts.map +1 -0
  34. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js +249 -0
  35. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js.map +1 -0
  36. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts +55 -0
  37. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts.map +1 -0
  38. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js +394 -0
  39. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js.map +1 -0
  40. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts +20 -0
  41. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts.map +1 -0
  42. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js +102 -0
  43. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js.map +1 -0
  44. package/dist/src/elements/ia-item-navigator/icons/collapse-sidebar.svg +7 -0
  45. package/dist/src/elements/ia-item-navigator/icons/ellipses.svg +7 -0
  46. package/dist/src/elements/ia-item-navigator/icons.d.ts +13 -0
  47. package/dist/src/elements/ia-item-navigator/icons.d.ts.map +1 -0
  48. package/dist/src/elements/ia-item-navigator/icons.js +16 -0
  49. package/dist/src/elements/ia-item-navigator/icons.js.map +1 -0
  50. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts +41 -0
  51. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts.map +1 -0
  52. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js +2 -0
  53. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js.map +1 -0
  54. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts +23 -0
  55. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts.map +1 -0
  56. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js +2 -0
  57. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js.map +1 -0
  58. package/dist/src/elements/ia-item-navigator/masked-icon.d.ts +24 -0
  59. package/dist/src/elements/ia-item-navigator/masked-icon.d.ts.map +1 -0
  60. package/dist/src/elements/ia-item-navigator/masked-icon.js +30 -0
  61. package/dist/src/elements/ia-item-navigator/masked-icon.js.map +1 -0
  62. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts +47 -0
  63. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts.map +1 -0
  64. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js +352 -0
  65. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js.map +1 -0
  66. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts +22 -0
  67. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts.map +1 -0
  68. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js +137 -0
  69. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js.map +1 -0
  70. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts +40 -0
  71. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts.map +1 -0
  72. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js +217 -0
  73. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js.map +1 -0
  74. package/dist/src/elements/ia-item-navigator/menus/icons/email.svg +6 -0
  75. package/dist/src/elements/ia-item-navigator/menus/icons/facebook.svg +6 -0
  76. package/dist/src/elements/ia-item-navigator/menus/icons/link.svg +6 -0
  77. package/dist/src/elements/ia-item-navigator/menus/icons/list.svg +3 -0
  78. package/dist/src/elements/ia-item-navigator/menus/icons/pinterest.svg +6 -0
  79. package/dist/src/elements/ia-item-navigator/menus/icons/share.svg +6 -0
  80. package/dist/src/elements/ia-item-navigator/menus/icons/sort-asc.svg +22 -0
  81. package/dist/src/elements/ia-item-navigator/menus/icons/sort-desc.svg +21 -0
  82. package/dist/src/elements/ia-item-navigator/menus/icons/sort-neutral.svg +13 -0
  83. package/dist/src/elements/ia-item-navigator/menus/icons/tumblr.svg +6 -0
  84. package/dist/src/elements/ia-item-navigator/menus/icons/twitter.svg +6 -0
  85. package/dist/src/elements/ia-item-navigator/menus/icons/viewable-files.svg +6 -0
  86. package/dist/src/elements/ia-item-navigator/menus/models.d.ts +17 -0
  87. package/dist/src/elements/ia-item-navigator/menus/models.d.ts.map +1 -0
  88. package/dist/src/elements/ia-item-navigator/menus/models.js +2 -0
  89. package/dist/src/elements/ia-item-navigator/menus/models.js.map +1 -0
  90. package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts +16 -0
  91. package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts.map +1 -0
  92. package/dist/src/elements/ia-item-navigator/menus/share-icons.js +23 -0
  93. package/dist/src/elements/ia-item-navigator/menus/share-icons.js.map +1 -0
  94. package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts +21 -0
  95. package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts.map +1 -0
  96. package/dist/src/elements/ia-otp-form/ia-otp-form.js +157 -0
  97. package/dist/src/elements/ia-otp-form/ia-otp-form.js.map +1 -0
  98. package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts +35 -0
  99. package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts.map +1 -0
  100. package/dist/src/elements/ia-otp-input/ia-otp-input.js +217 -0
  101. package/dist/src/elements/ia-otp-input/ia-otp-input.js.map +1 -0
  102. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts +10 -0
  103. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts.map +1 -0
  104. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js +43 -0
  105. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js.map +1 -0
  106. package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts +24 -0
  107. package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts.map +1 -0
  108. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +229 -0
  109. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -0
  110. package/dist/src/elements/index.d.ts +8 -0
  111. package/dist/src/elements/index.d.ts.map +1 -0
  112. package/dist/src/elements/index.js +8 -0
  113. package/dist/src/elements/index.js.map +1 -0
  114. package/dist/src/labs/ia-snow/flake.svg +1 -0
  115. package/dist/src/labs/ia-snow/ia-snow.d.ts +18 -0
  116. package/dist/src/labs/ia-snow/ia-snow.d.ts.map +1 -0
  117. package/dist/src/labs/ia-snow/ia-snow.js +100 -0
  118. package/dist/src/labs/ia-snow/ia-snow.js.map +1 -0
  119. package/dist/src/themes/theme-styles.d.ts +3 -0
  120. package/dist/src/themes/theme-styles.d.ts.map +1 -0
  121. package/dist/src/themes/theme-styles.js +168 -0
  122. package/dist/src/themes/theme-styles.js.map +1 -0
  123. package/dist/src/util/lazy-load-template.d.ts +51 -0
  124. package/dist/src/util/lazy-load-template.d.ts.map +1 -0
  125. package/dist/src/util/lazy-load-template.js +50 -0
  126. package/dist/src/util/lazy-load-template.js.map +1 -0
  127. package/package.json +128 -0
@@ -0,0 +1,23 @@
1
+ import { maskedIcon } from '../masked-icon.js';
2
+ import shareUrl from './icons/share.svg';
3
+ import twitterUrl from './icons/twitter.svg';
4
+ import facebookUrl from './icons/facebook.svg';
5
+ import tumblrUrl from './icons/tumblr.svg';
6
+ import pinterestUrl from './icons/pinterest.svg';
7
+ import emailUrl from './icons/email.svg';
8
+ import linkUrl from './icons/link.svg';
9
+ /**
10
+ * Icons taken from the `@internetarchive/icon-*` packages (v1.4.1) used by the
11
+ * share panel. They ship as standalone `.svg` files — rather than icon package
12
+ * dependencies or inline templates — so their path data stays out of the JS
13
+ * bundle, and render as CSS-masked spans (see `maskedIcon`) so the panel can
14
+ * still theme them. Icons are decorative, labelled by adjacent text.
15
+ */
16
+ export const shareIcon = maskedIcon(shareUrl);
17
+ export const twitterIcon = maskedIcon(twitterUrl);
18
+ export const facebookIcon = maskedIcon(facebookUrl);
19
+ export const tumblrIcon = maskedIcon(tumblrUrl);
20
+ export const pinterestIcon = maskedIcon(pinterestUrl);
21
+ export const emailIcon = maskedIcon(emailUrl);
22
+ export const linkIcon = maskedIcon(linkUrl);
23
+ //# sourceMappingURL=share-icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-icons.js","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/menus/share-icons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAmB,UAAU,CAAC,QAAQ,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAmB,UAAU,CAAC,UAAU,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,YAAY,GAAmB,UAAU,CAAC,WAAW,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,UAAU,GAAmB,UAAU,CAAC,SAAS,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,aAAa,GAAmB,UAAU,CAAC,YAAY,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,SAAS,GAAmB,UAAU,CAAC,QAAQ,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,QAAQ,GAAmB,UAAU,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { type TemplateResult } from 'lit';\nimport { maskedIcon } from '../masked-icon';\n\nimport shareUrl from './icons/share.svg';\nimport twitterUrl from './icons/twitter.svg';\nimport facebookUrl from './icons/facebook.svg';\nimport tumblrUrl from './icons/tumblr.svg';\nimport pinterestUrl from './icons/pinterest.svg';\nimport emailUrl from './icons/email.svg';\nimport linkUrl from './icons/link.svg';\n\n/**\n * Icons taken from the `@internetarchive/icon-*` packages (v1.4.1) used by the\n * share panel. They ship as standalone `.svg` files — rather than icon package\n * dependencies or inline templates — so their path data stays out of the JS\n * bundle, and render as CSS-masked spans (see `maskedIcon`) so the panel can\n * still theme them. Icons are decorative, labelled by adjacent text.\n */\n\nexport const shareIcon: TemplateResult = maskedIcon(shareUrl);\n\nexport const twitterIcon: TemplateResult = maskedIcon(twitterUrl);\n\nexport const facebookIcon: TemplateResult = maskedIcon(facebookUrl);\n\nexport const tumblrIcon: TemplateResult = maskedIcon(tumblrUrl);\n\nexport const pinterestIcon: TemplateResult = maskedIcon(pinterestUrl);\n\nexport const emailIcon: TemplateResult = maskedIcon(emailUrl);\n\nexport const linkIcon: TemplateResult = maskedIcon(linkUrl);\n"]}
@@ -0,0 +1,21 @@
1
+ import { LitElement, TemplateResult, CSSResultGroup, PropertyValues } from 'lit';
2
+ import type { LoadingStatus } from '../../elements/ia-status-indicator/ia-status-indicator.js';
3
+ import '../../elements/ia-status-indicator/ia-status-indicator.js';
4
+ import '../../elements/ia-otp-input/ia-otp-input.js';
5
+ import '../../elements/ia-button/ia-button.js';
6
+ /**
7
+ * Form for entering OTP codes, including success/loading/error states and a request new code button
8
+ */
9
+ export declare class IAOTPForm extends LitElement {
10
+ validationStatus: LoadingStatus;
11
+ newCodeSending: boolean;
12
+ numPasscodeChars: number;
13
+ numericOnly: boolean;
14
+ private OTPInput;
15
+ render(): TemplateResult;
16
+ protected willUpdate(changed: PropertyValues): void;
17
+ private get resendCodeButtonTemplate();
18
+ private handleNewCodeRequested;
19
+ static get styles(): CSSResultGroup;
20
+ }
21
+ //# sourceMappingURL=ia-otp-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-otp-form.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-otp-form/ia-otp-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACd,cAAc,EAGd,cAAc,EACf,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAE3F,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yCAAyC,CAAC;AACjD,OAAO,mCAAmC,CAAC;AAU3C;;GAEG;AACH,qBACa,SAAU,SAAQ,UAAU;IAGvC,gBAAgB,EAAE,aAAa,CAAW;IAI1C,cAAc,EAAE,OAAO,CAAS;IAIhC,gBAAgB,EAAE,MAAM,CAAK;IAI7B,WAAW,EAAE,OAAO,CAAQ;IAG5B,OAAO,CAAC,QAAQ,CAAc;IAE9B,MAAM,IAAI,cAAc;IAuBxB,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAenD,OAAO,KAAK,wBAAwB,GAiBnC;YAGa,sBAAsB;IAUpC,MAAM,KAAK,MAAM,IAAI,cAAc,CA8ClC;CACF"}
@@ -0,0 +1,157 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, css, nothing, } from 'lit';
3
+ import { msg } from '@lit/localize';
4
+ import { property, customElement, query } from 'lit/decorators.js';
5
+ import themeStyles from '../../themes/theme-styles.js';
6
+ import '../../elements/ia-status-indicator/ia-status-indicator.js';
7
+ import '../../elements/ia-otp-input/ia-otp-input.js';
8
+ import '../../elements/ia-button/ia-button.js';
9
+ /**
10
+ * Custom events fired by the component
11
+ */
12
+ const Events = {
13
+ NewCodeRequested: 'newCodeRequested',
14
+ CodeSubmitted: 'codeSubmitted', // Bubbles up from ia-otp-input
15
+ };
16
+ /**
17
+ * Form for entering OTP codes, including success/loading/error states and a request new code button
18
+ */
19
+ let IAOTPForm = class IAOTPForm extends LitElement {
20
+ constructor() {
21
+ super(...arguments);
22
+ /* The state of the validation process */
23
+ this.validationStatus = 'ready';
24
+ /* Whether to display a loading indicator instead of the button text */
25
+ this.newCodeSending = false;
26
+ /* Number of characters to expect for the passcode */
27
+ this.numPasscodeChars = 6;
28
+ /* Whether to restrict entry to numeric characters */
29
+ this.numericOnly = true;
30
+ }
31
+ render() {
32
+ return html `
33
+ <div class="input-section">
34
+ <ia-otp-input
35
+ .numChars=${this.numPasscodeChars}
36
+ ?numericOnly=${this.numericOnly}
37
+ ?disabled=${this.validationStatus === 'loading' ||
38
+ this.validationStatus === 'success'}
39
+ ></ia-otp-input>
40
+ <ia-status-indicator
41
+ part="status-indicator"
42
+ .mode=${this.validationStatus}
43
+ ></ia-status-indicator>
44
+ </div>
45
+ ${this.validationStatus === 'error'
46
+ ? html `<p class="error-msg">
47
+ ${msg('The code entered is invalid or expired')}
48
+ </p>`
49
+ : nothing}
50
+ ${this.resendCodeButtonTemplate}
51
+ `;
52
+ }
53
+ willUpdate(changed) {
54
+ if (changed.has('validationStatus') &&
55
+ this.OTPInput &&
56
+ this.validationStatus === 'error') {
57
+ this.OTPInput.prefillValue = '';
58
+ }
59
+ if (changed.has('newCodeSending') && this.newCodeSending && this.OTPInput) {
60
+ this.OTPInput.prefillValue = '';
61
+ }
62
+ }
63
+ /* The button to display to send a new code */
64
+ get resendCodeButtonTemplate() {
65
+ return this.newCodeSending
66
+ ? html `<span part="new-code-message" class="new-code-msg"
67
+ >${msg('Emailing...')}</span
68
+ >`
69
+ : html `
70
+ <ia-button
71
+ mode="link"
72
+ class="new-code-btn"
73
+ part="new-code-button"
74
+ .disabled=${this.validationStatus === 'loading' ||
75
+ this.validationStatus === 'success'}
76
+ @click=${this.handleNewCodeRequested}
77
+ >
78
+ ${msg('Email me another code')}
79
+ </ia-button>
80
+ `;
81
+ }
82
+ /* Emits an event to request the new code */
83
+ async handleNewCodeRequested() {
84
+ this.dispatchEvent(new CustomEvent(Events.NewCodeRequested, {
85
+ bubbles: true,
86
+ composed: true,
87
+ }));
88
+ this.OTPInput.prefillValue = '';
89
+ }
90
+ static get styles() {
91
+ return [
92
+ themeStyles,
93
+ css `
94
+ :host {
95
+ --font-size-standard--: var(--font-size-standard);
96
+ --font-size-lg--: var(--font-size-lg);
97
+ --color-success--: var(--color-success);
98
+ --color-danger--: var(--color-danger);
99
+ --link-color--: var(--link-color);
100
+
101
+ display: flex;
102
+ flex-direction: column;
103
+ align-items: center;
104
+ justify-content: center;
105
+ }
106
+
107
+ .input-section {
108
+ display: flex;
109
+ flex-direction: row;
110
+ align-items: center;
111
+ justify-content: center;
112
+ gap: 5px;
113
+ }
114
+
115
+ ia-status-indicator {
116
+ --icon-width: calc(var(--font-size-lg--) * 1.33);
117
+ }
118
+
119
+ .error-msg {
120
+ margin-top: 10px;
121
+ font-size: var(--font-size-standard--);
122
+ color: var(--color-danger--);
123
+ margin-bottom: -10px;
124
+ }
125
+
126
+ .new-code-msg {
127
+ margin-top: 10px;
128
+ font-size: var(--font-size-standard--);
129
+ color: var(--link-color--);
130
+ display: flex;
131
+ flex-direction: column;
132
+ justify-content: center;
133
+ }
134
+ `,
135
+ ];
136
+ }
137
+ };
138
+ __decorate([
139
+ property({ type: String })
140
+ ], IAOTPForm.prototype, "validationStatus", void 0);
141
+ __decorate([
142
+ property({ type: Boolean })
143
+ ], IAOTPForm.prototype, "newCodeSending", void 0);
144
+ __decorate([
145
+ property({ type: Number })
146
+ ], IAOTPForm.prototype, "numPasscodeChars", void 0);
147
+ __decorate([
148
+ property({ type: Boolean })
149
+ ], IAOTPForm.prototype, "numericOnly", void 0);
150
+ __decorate([
151
+ query('ia-otp-input')
152
+ ], IAOTPForm.prototype, "OTPInput", void 0);
153
+ IAOTPForm = __decorate([
154
+ customElement('ia-otp-form')
155
+ ], IAOTPForm);
156
+ export { IAOTPForm };
157
+ //# sourceMappingURL=ia-otp-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-otp-form.js","sourceRoot":"","sources":["../../../../src/elements/ia-otp-form/ia-otp-form.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EAGV,GAAG,EACH,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAKnD,OAAO,uDAAuD,CAAC;AAC/D,OAAO,yCAAyC,CAAC;AACjD,OAAO,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,GAAG;IACb,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,eAAe,EAAE,+BAA+B;CAChE,CAAC;AAEF;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACL,yCAAyC;QAEzC,qBAAgB,GAAkB,OAAO,CAAC;QAE1C,uEAAuE;QAEvE,mBAAc,GAAY,KAAK,CAAC;QAEhC,qDAAqD;QAErD,qBAAgB,GAAW,CAAC,CAAC;QAE7B,qDAAqD;QAErD,gBAAW,GAAY,IAAI,CAAC;IAwH9B,CAAC;IAnHC,MAAM;QACJ,OAAO,IAAI,CAAA;;;sBAGO,IAAI,CAAC,gBAAgB;yBAClB,IAAI,CAAC,WAAW;sBACnB,IAAI,CAAC,gBAA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AAG,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AApIC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACe;AAI1C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACI;AAIhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACE;AAI7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACA;AAGpB;IADP,KAAK,CAAC,cAAc,CAAC;2CACQ;AAlBnB,SAAS;IADrB,aAAa,CAAC,aAAa,CAAC;GAChB,SAAS,CAuIrB","sourcesContent":["import {\n html,\n LitElement,\n TemplateResult,\n CSSResultGroup,\n css,\n nothing,\n PropertyValues,\n} from 'lit';\nimport { msg } from '@lit/localize';\nimport { property, customElement, query } from 'lit/decorators.js';\n\nimport themeStyles from '@src/themes/theme-styles';\n\nimport type { IAOTPInput } from '@src/elements/ia-otp-input/ia-otp-input';\nimport type { LoadingStatus } from '@src/elements/ia-status-indicator/ia-status-indicator';\n\nimport '@src/elements/ia-status-indicator/ia-status-indicator';\nimport '@src/elements/ia-otp-input/ia-otp-input';\nimport '@src/elements/ia-button/ia-button';\n\n/**\n * Custom events fired by the component\n */\nconst Events = {\n NewCodeRequested: 'newCodeRequested',\n CodeSubmitted: 'codeSubmitted', // Bubbles up from ia-otp-input\n};\n\n/**\n * Form for entering OTP codes, including success/loading/error states and a request new code button\n */\n@customElement('ia-otp-form')\nexport class IAOTPForm extends LitElement {\n /* The state of the validation process */\n @property({ type: String })\n validationStatus: LoadingStatus = 'ready';\n\n /* Whether to display a loading indicator instead of the button text */\n @property({ type: Boolean })\n newCodeSending: boolean = false;\n\n /* Number of characters to expect for the passcode */\n @property({ type: Number })\n numPasscodeChars: number = 6;\n\n /* Whether to restrict entry to numeric characters */\n @property({ type: Boolean })\n numericOnly: boolean = true;\n\n @query('ia-otp-input')\n private OTPInput!: IAOTPInput;\n\n render(): TemplateResult {\n return html`\n <div class=\"input-section\">\n <ia-otp-input\n .numChars=${this.numPasscodeChars}\n ?numericOnly=${this.numericOnly}\n ?disabled=${this.validationStatus === 'loading' ||\n this.validationStatus === 'success'}\n ></ia-otp-input>\n <ia-status-indicator\n part=\"status-indicator\"\n .mode=${this.validationStatus}\n ></ia-status-indicator>\n </div>\n ${this.validationStatus === 'error'\n ? html`<p class=\"error-msg\">\n ${msg('The code entered is invalid or expired')}\n </p>`\n : nothing}\n ${this.resendCodeButtonTemplate}\n `;\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (\n changed.has('validationStatus') &&\n this.OTPInput &&\n this.validationStatus === 'error'\n ) {\n this.OTPInput.prefillValue = '';\n }\n\n if (changed.has('newCodeSending') && this.newCodeSending && this.OTPInput) {\n this.OTPInput.prefillValue = '';\n }\n }\n\n /* The button to display to send a new code */\n private get resendCodeButtonTemplate(): TemplateResult {\n return this.newCodeSending\n ? html`<span part=\"new-code-message\" class=\"new-code-msg\"\n >${msg('Emailing...')}</span\n >`\n : html`\n <ia-button\n mode=\"link\"\n class=\"new-code-btn\"\n part=\"new-code-button\"\n .disabled=${this.validationStatus === 'loading' ||\n this.validationStatus === 'success'}\n @click=${this.handleNewCodeRequested}\n >\n ${msg('Email me another code')}\n </ia-button>\n `;\n }\n\n /* Emits an event to request the new code */\n private async handleNewCodeRequested(): Promise<void> {\n this.dispatchEvent(\n new CustomEvent(Events.NewCodeRequested, {\n bubbles: true,\n composed: true,\n }),\n );\n this.OTPInput.prefillValue = '';\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --font-size-standard--: var(--font-size-standard);\n --font-size-lg--: var(--font-size-lg);\n --color-success--: var(--color-success);\n --color-danger--: var(--color-danger);\n --link-color--: var(--link-color);\n\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .input-section {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n gap: 5px;\n }\n\n ia-status-indicator {\n --icon-width: calc(var(--font-size-lg--) * 1.33);\n }\n\n .error-msg {\n margin-top: 10px;\n font-size: var(--font-size-standard--);\n color: var(--color-danger--);\n margin-bottom: -10px;\n }\n\n .new-code-msg {\n margin-top: 10px;\n font-size: var(--font-size-standard--);\n color: var(--link-color--);\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n `,\n ];\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { LitElement, TemplateResult, CSSResultGroup, PropertyValues } from 'lit';
2
+ /**
3
+ * Renders an input for OTP entry, which combines a series of separate
4
+ * inputs into one, shifting focus as needed and handling paste and backspace
5
+ * events.
6
+ */
7
+ export declare class IAOTPInput extends LitElement {
8
+ prefillValue?: string;
9
+ disabled: boolean;
10
+ numChars: number;
11
+ numericOnly: boolean;
12
+ private allowedChars;
13
+ private inputs;
14
+ render(): TemplateResult;
15
+ protected firstUpdated(): void;
16
+ protected willUpdate(changed: PropertyValues): void;
17
+ private handleInput;
18
+ private handleKeydown;
19
+ /**
20
+ * Transmits pasted data to the input-filling function
21
+ */
22
+ private handlePaste;
23
+ /**
24
+ * Fills as many inputs as possible with the specified value, starting from the beginning.
25
+ * Submits the result if enough characters are filled.
26
+ */
27
+ private fillInputs;
28
+ /** Clears all inputs and returns focus to first input */
29
+ private clearInputs;
30
+ /** Checks whether all inputs are filled and submits if so */
31
+ private submitIfInputsFilled;
32
+ private triggerSubmit;
33
+ static get styles(): CSSResultGroup;
34
+ }
35
+ //# sourceMappingURL=ia-otp-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-otp-input.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-otp-input/ia-otp-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACd,cAAc,EAEd,cAAc,EACf,MAAM,KAAK,CAAC;AAcb;;;;GAIG;AACH,qBACa,UAAW,SAAQ,UAAU;IAGxC,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,QAAQ,EAAE,OAAO,CAAS;IAI1B,QAAQ,EAAE,MAAM,CAAK;IAIrB,WAAW,EAAE,OAAO,CAAQ;IAI5B,OAAO,CAAC,YAAY,CAAyB;IAI7C,OAAO,CAAC,MAAM,CAAgC;IAE9C,MAAM,IAAI,cAAc;IAmBxB,SAAS,CAAC,YAAY,IAAI,IAAI;IAI9B,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAYnD,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,aAAa;IAmCrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAOnB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAuBlB,yDAAyD;IACzD,OAAO,CAAC,WAAW;IAKnB,6DAA6D;IAC7D,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,aAAa;IAUrB,MAAM,KAAK,MAAM,IAAI,cAAc,CA4BlC;CACF"}
@@ -0,0 +1,217 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, css, } from 'lit';
3
+ import { property, customElement, queryAll } from 'lit/decorators.js';
4
+ import themeStyles from '../../themes/theme-styles.js';
5
+ /**
6
+ * Custom event options for the component
7
+ */
8
+ const Events = {
9
+ CodeSubmitted: 'codeSubmitted',
10
+ };
11
+ const NUMERIC_REGEX = /^[0-9]+$/;
12
+ const ALPHANUMERIC_REGEX = /^[a-zA-Z0-9]+$/;
13
+ /**
14
+ * Renders an input for OTP entry, which combines a series of separate
15
+ * inputs into one, shifting focus as needed and handling paste and backspace
16
+ * events.
17
+ */
18
+ let IAOTPInput = class IAOTPInput extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ /* Whether to disable all inputs */
22
+ this.disabled = false;
23
+ /* Number of characters to expect for the passcode */
24
+ this.numChars = 6;
25
+ /* Whether to restrict entry to numeric characters */
26
+ this.numericOnly = true;
27
+ /* Regex for allowed characters. Updates based on numeric only */
28
+ this.allowedChars = NUMERIC_REGEX;
29
+ }
30
+ render() {
31
+ return html `
32
+ ${[...Array(this.numChars).keys()].map((i) => html `<input
33
+ id="OTP-input-${i}"
34
+ part="input"
35
+ type="text"
36
+ autocomplete=${i === 0 ? 'one-time-code' : 'off'}
37
+ inputmode=${this.numericOnly ? 'numeric' : 'text'}
38
+ ?disabled=${this.disabled}
39
+ @beforeinput=${this.handleInput}
40
+ @paste=${this.handlePaste}
41
+ @keydown=${this.handleKeydown}
42
+ />`)}
43
+ `;
44
+ }
45
+ firstUpdated() {
46
+ this.inputs[0].focus();
47
+ }
48
+ willUpdate(changed) {
49
+ if (changed.has('numericOnly')) {
50
+ this.allowedChars = this.numericOnly ? NUMERIC_REGEX : ALPHANUMERIC_REGEX;
51
+ }
52
+ if (changed.has('prefillValue') && this.prefillValue !== undefined) {
53
+ this.fillInputs(this.prefillValue);
54
+ this.prefillValue = undefined;
55
+ }
56
+ }
57
+ /* Shifts forward on input */
58
+ handleInput(e) {
59
+ e.preventDefault();
60
+ const input = e.target;
61
+ const addedValue = e.data;
62
+ if (!addedValue)
63
+ return;
64
+ if (addedValue.length > 1) {
65
+ this.fillInputs(addedValue);
66
+ return;
67
+ }
68
+ if (!this.allowedChars.test(addedValue))
69
+ return;
70
+ input.value = addedValue;
71
+ const next = input.nextElementSibling;
72
+ if (next)
73
+ next.focus();
74
+ this.submitIfInputsFilled();
75
+ }
76
+ /* Performs special actions associated with some keys */
77
+ handleKeydown(e) {
78
+ const input = e.target;
79
+ const key = e.key;
80
+ const prev = input.previousElementSibling;
81
+ const next = input.nextElementSibling;
82
+ switch (key) {
83
+ case 'Backspace':
84
+ case 'Delete':
85
+ e.preventDefault();
86
+ if (prev)
87
+ prev.focus();
88
+ if (input.value === '') {
89
+ prev.value = '';
90
+ break;
91
+ }
92
+ input.value = '';
93
+ break;
94
+ case 'Tab':
95
+ input.select();
96
+ break;
97
+ case 'ArrowRight':
98
+ case 'Right':
99
+ e.preventDefault();
100
+ if (next)
101
+ next.focus();
102
+ break;
103
+ case 'ArrowLeft':
104
+ case 'Left':
105
+ e.preventDefault();
106
+ if (prev)
107
+ prev.focus();
108
+ break;
109
+ }
110
+ }
111
+ /**
112
+ * Transmits pasted data to the input-filling function
113
+ */
114
+ handlePaste(e) {
115
+ e.preventDefault();
116
+ const pastedText = e.clipboardData?.getData('text');
117
+ if (pastedText)
118
+ this.fillInputs(pastedText);
119
+ }
120
+ /**
121
+ * Fills as many inputs as possible with the specified value, starting from the beginning.
122
+ * Submits the result if enough characters are filled.
123
+ */
124
+ fillInputs(value) {
125
+ if (value === '')
126
+ this.clearInputs();
127
+ const charsToFill = value
128
+ .split('')
129
+ .filter((char) => this.allowedChars.test(char))
130
+ .slice(0, this.numChars);
131
+ if (!charsToFill || charsToFill.length === 0)
132
+ return;
133
+ charsToFill.forEach((char, i) => (this.inputs[i].value = char));
134
+ if (charsToFill.length === this.numChars) {
135
+ this.triggerSubmit(charsToFill.join(''));
136
+ this.inputs[this.numChars - 1].focus();
137
+ return;
138
+ }
139
+ const next = this.inputs[charsToFill.length];
140
+ next.focus();
141
+ }
142
+ /** Clears all inputs and returns focus to first input */
143
+ clearInputs() {
144
+ this.inputs.forEach((input) => (input.value = ''));
145
+ this.inputs[0].focus();
146
+ }
147
+ /** Checks whether all inputs are filled and submits if so */
148
+ submitIfInputsFilled() {
149
+ const code = [];
150
+ this.inputs.forEach((input) => {
151
+ if (input.value)
152
+ code.push(input.value);
153
+ });
154
+ if (code.length === this.numChars)
155
+ this.triggerSubmit(code.join(''));
156
+ }
157
+ /* Submits code */
158
+ triggerSubmit(code) {
159
+ this.dispatchEvent(new CustomEvent(Events.CodeSubmitted, {
160
+ detail: this.numericOnly ? code : code.toUpperCase(),
161
+ bubbles: true,
162
+ composed: true,
163
+ }));
164
+ }
165
+ static get styles() {
166
+ return [
167
+ themeStyles,
168
+ css `
169
+ :host {
170
+ --primary-text-color--: var(--primary-text-color);
171
+ --font-size-lg--: var(--font-size-lg);
172
+ }
173
+
174
+ :host {
175
+ display: flex;
176
+ flex-direction: row;
177
+ flex-wrap: nowrap;
178
+ gap: 5px;
179
+ }
180
+
181
+ input {
182
+ color: var(--primary-text-color--);
183
+ font-size: var(--font-size-lg--);
184
+ width: var(--font-size-lg--);
185
+ font-weight: bold;
186
+ height: calc(var(--font-size-lg--) + 1.25rem);
187
+ text-align: center;
188
+ text-transform: uppercase;
189
+ padding: 0;
190
+ }
191
+ `,
192
+ ];
193
+ }
194
+ };
195
+ __decorate([
196
+ property({ type: String })
197
+ ], IAOTPInput.prototype, "prefillValue", void 0);
198
+ __decorate([
199
+ property({ type: Boolean })
200
+ ], IAOTPInput.prototype, "disabled", void 0);
201
+ __decorate([
202
+ property({ type: Number })
203
+ ], IAOTPInput.prototype, "numChars", void 0);
204
+ __decorate([
205
+ property({ type: Boolean })
206
+ ], IAOTPInput.prototype, "numericOnly", void 0);
207
+ __decorate([
208
+ property({ type: Object })
209
+ ], IAOTPInput.prototype, "allowedChars", void 0);
210
+ __decorate([
211
+ queryAll('input')
212
+ ], IAOTPInput.prototype, "inputs", void 0);
213
+ IAOTPInput = __decorate([
214
+ customElement('ia-otp-input')
215
+ ], IAOTPInput);
216
+ export { IAOTPInput };
217
+ //# sourceMappingURL=ia-otp-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-otp-input.js","sourceRoot":"","sources":["../../../../src/elements/ia-otp-input/ia-otp-input.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EAGV,GAAG,GAEJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,GAAG;IACb,aAAa,EAAE,eA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,IAAI,CAAC,WAAW,EAAE;YACpD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;OAuBF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7MC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACL;AAItB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CACF;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACN;AAIrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACA;AAIpB;IADP,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACkB;AAIrC;IADP,QAAQ,CAAC,OAAO,CAAC;0CAC4B;AAvBnC,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAgNtB","sourcesContent":["import {\n html,\n LitElement,\n TemplateResult,\n CSSResultGroup,\n css,\n PropertyValues,\n} from 'lit';\nimport { property, customElement, queryAll } from 'lit/decorators.js';\nimport themeStyles from '@src/themes/theme-styles';\n\n/**\n * Custom event options for the component\n */\nconst Events = {\n CodeSubmitted: 'codeSubmitted',\n};\n\nconst NUMERIC_REGEX = /^[0-9]+$/;\nconst ALPHANUMERIC_REGEX = /^[a-zA-Z0-9]+$/;\n\n/**\n * Renders an input for OTP entry, which combines a series of separate\n * inputs into one, shifting focus as needed and handling paste and backspace\n * events.\n */\n@customElement('ia-otp-input')\nexport class IAOTPInput extends LitElement {\n /* An optional value to prefill the inputs with */\n @property({ type: String })\n prefillValue?: string;\n\n /* Whether to disable all inputs */\n @property({ type: Boolean })\n disabled: boolean = false;\n\n /* Number of characters to expect for the passcode */\n @property({ type: Number })\n numChars: number = 6;\n\n /* Whether to restrict entry to numeric characters */\n @property({ type: Boolean })\n numericOnly: boolean = true;\n\n /* Regex for allowed characters. Updates based on numeric only */\n @property({ type: Object })\n private allowedChars: RegExp = NUMERIC_REGEX;\n\n /* Array of OTP inputs */\n @queryAll('input')\n private inputs!: NodeListOf<HTMLInputElement>;\n\n render(): TemplateResult {\n return html`\n ${[...Array(this.numChars).keys()].map(\n (i) =>\n html`<input\n id=\"OTP-input-${i}\"\n part=\"input\"\n type=\"text\"\n autocomplete=${i === 0 ? 'one-time-code' : 'off'}\n inputmode=${this.numericOnly ? 'numeric' : 'text'}\n ?disabled=${this.disabled}\n @beforeinput=${this.handleInput}\n @paste=${this.handlePaste}\n @keydown=${this.handleKeydown}\n />`,\n )}\n `;\n }\n\n protected firstUpdated(): void {\n this.inputs[0].focus();\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (changed.has('numericOnly')) {\n this.allowedChars = this.numericOnly ? NUMERIC_REGEX : ALPHANUMERIC_REGEX;\n }\n\n if (changed.has('prefillValue') && this.prefillValue !== undefined) {\n this.fillInputs(this.prefillValue);\n this.prefillValue = undefined;\n }\n }\n\n /* Shifts forward on input */\n private handleInput(e: InputEvent): void {\n e.preventDefault();\n const input = e.target as HTMLInputElement;\n const addedValue = e.data;\n\n if (!addedValue) return;\n if (addedValue.length > 1) {\n this.fillInputs(addedValue);\n return;\n }\n if (!this.allowedChars.test(addedValue)) return;\n\n input.value = addedValue;\n const next = input.nextElementSibling as HTMLInputElement;\n if (next) next.focus();\n\n this.submitIfInputsFilled();\n }\n\n /* Performs special actions associated with some keys */\n private handleKeydown(e: KeyboardEvent): void {\n const input = e.target as HTMLInputElement;\n const key = e.key;\n const prev = input.previousElementSibling as HTMLInputElement;\n const next = input.nextElementSibling as HTMLInputElement;\n\n switch (key) {\n case 'Backspace':\n case 'Delete':\n e.preventDefault();\n if (prev) prev.focus();\n\n if (input.value === '') {\n prev.value = '';\n break;\n }\n\n input.value = '';\n break;\n case 'Tab':\n input.select();\n break;\n case 'ArrowRight':\n case 'Right':\n e.preventDefault();\n if (next) next.focus();\n break;\n case 'ArrowLeft':\n case 'Left':\n e.preventDefault();\n if (prev) prev.focus();\n break;\n }\n }\n\n /**\n * Transmits pasted data to the input-filling function\n */\n private handlePaste(e: ClipboardEvent): void {\n e.preventDefault();\n\n const pastedText = e.clipboardData?.getData('text');\n if (pastedText) this.fillInputs(pastedText);\n }\n\n /**\n * Fills as many inputs as possible with the specified value, starting from the beginning.\n * Submits the result if enough characters are filled.\n */\n private fillInputs(value: string) {\n if (value === '') this.clearInputs();\n\n const charsToFill = value\n .split('')\n .filter((char) => this.allowedChars.test(char))\n .slice(0, this.numChars);\n\n if (!charsToFill || charsToFill.length === 0) return;\n charsToFill.forEach(\n (char, i) => ((this.inputs[i] as HTMLInputElement).value = char),\n );\n\n if (charsToFill.length === this.numChars) {\n this.triggerSubmit(charsToFill.join(''));\n this.inputs[this.numChars - 1].focus();\n return;\n }\n\n const next = this.inputs[charsToFill.length];\n next.focus();\n }\n\n /** Clears all inputs and returns focus to first input */\n private clearInputs(): void {\n this.inputs.forEach((input) => (input.value = ''));\n this.inputs[0].focus();\n }\n\n /** Checks whether all inputs are filled and submits if so */\n private submitIfInputsFilled(): void {\n const code: string[] = [];\n this.inputs.forEach((input) => {\n if (input.value) code.push(input.value);\n });\n\n if (code.length === this.numChars) this.triggerSubmit(code.join(''));\n }\n\n /* Submits code */\n private triggerSubmit(code: string): void {\n this.dispatchEvent(\n new CustomEvent(Events.CodeSubmitted, {\n detail: this.numericOnly ? code : code.toUpperCase(),\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --primary-text-color--: var(--primary-text-color);\n --font-size-lg--: var(--font-size-lg);\n }\n\n :host {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n gap: 5px;\n }\n\n input {\n color: var(--primary-text-color--);\n font-size: var(--font-size-lg--);\n width: var(--font-size-lg--);\n font-weight: bold;\n height: calc(var(--font-size-lg--) + 1.25rem);\n text-align: center;\n text-transform: uppercase;\n padding: 0;\n }\n `,\n ];\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { CSSResultGroup, LitElement, TemplateResult } from 'lit';
2
+ /**
3
+ * Wraps any slotted elements in a `span` element that hides them visually but keeps them available for screen readers.
4
+ * Useful for rendering any additional explanatory text that is only necessary for screen readers.
5
+ */
6
+ export declare class IASrOnlyText extends LitElement {
7
+ render(): TemplateResult;
8
+ static get styles(): CSSResultGroup;
9
+ }
10
+ //# sourceMappingURL=ia-sr-only-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-sr-only-text.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-sr-only-text/ia-sr-only-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK5E;;;GAGG;AACH,qBACa,YAAa,SAAQ,UAAU;IAC1C,MAAM,IAAI,cAAc;IAQxB,MAAM,KAAK,MAAM,IAAI,cAAc,CAoBlC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import themeStyles from '../../themes/theme-styles.js';
5
+ /**
6
+ * Wraps any slotted elements in a `span` element that hides them visually but keeps them available for screen readers.
7
+ * Useful for rendering any additional explanatory text that is only necessary for screen readers.
8
+ */
9
+ let IASrOnlyText = class IASrOnlyText extends LitElement {
10
+ render() {
11
+ return html `
12
+ <span class="sr-only">
13
+ <slot></slot>
14
+ </span>
15
+ `;
16
+ }
17
+ static get styles() {
18
+ return [
19
+ themeStyles,
20
+ css `
21
+ .sr-only {
22
+ position: absolute !important;
23
+ width: 1px !important;
24
+ height: 1px !important;
25
+ margin: -1px !important;
26
+ padding: 0 !important;
27
+ border: 0 !important;
28
+ overflow: hidden !important;
29
+ white-space: nowrap !important;
30
+ clip: rect(1px, 1px, 1px, 1px) !important;
31
+ -webkit-clip-path: inset(50%) !important;
32
+ clip-path: inset(50%) !important;
33
+ user-select: none !important;
34
+ }
35
+ `,
36
+ ];
37
+ }
38
+ };
39
+ IASrOnlyText = __decorate([
40
+ customElement('ia-sr-only-text')
41
+ ], IASrOnlyText);
42
+ export { IASrOnlyText };
43
+ //# sourceMappingURL=ia-sr-only-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-sr-only-text.js","sourceRoot":"","sources":["../../../../src/elements/ia-sr-only-text/ia-sr-only-text.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD;;;GAGG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAC1C,MAAM;QACJ,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;OAeF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA9BY,YAAY;IADxB,aAAa,CAAC,iBAAiB,CAAC;GACpB,YAAY,CA8BxB","sourcesContent":["import { css, CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/**\n * Wraps any slotted elements in a `span` element that hides them visually but keeps them available for screen readers.\n * Useful for rendering any additional explanatory text that is only necessary for screen readers.\n */\n@customElement('ia-sr-only-text')\nexport class IASrOnlyText extends LitElement {\n render(): TemplateResult {\n return html`\n <span class=\"sr-only\">\n <slot></slot>\n </span>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n .sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: -1px !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n white-space: nowrap !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n -webkit-clip-path: inset(50%) !important;\n clip-path: inset(50%) !important;\n user-select: none !important;\n }\n `,\n ];\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import { CSSResultGroup, LitElement, TemplateResult } from 'lit';
2
+ export type LoadingStatus = 'ready' | 'loading' | 'success' | 'error';
3
+ /**
4
+ * Renders an SVG indicator, which defualts to an animated circular indicator
5
+ */
6
+ export declare class IAStatusIndicator extends LitElement {
7
+ loadingTitle: string;
8
+ successTitle: string;
9
+ errorTitle: string;
10
+ loadingStyle: 'ring' | 'ring-dots';
11
+ mode: LoadingStatus;
12
+ render(): TemplateResult;
13
+ /** A placeholder to render before loading begins, if desired */
14
+ private get placeholderTemplate();
15
+ /** A circular loading indicator to render when processing */
16
+ private get loadingIndicatorTemplate();
17
+ /** A check mark to render on success */
18
+ private get successIndicatorTemplate();
19
+ /** An "!" to render on error */
20
+ private get errorIndicatorTemplate();
21
+ private get shouldShowLoadingDots();
22
+ static get styles(): CSSResultGroup;
23
+ }
24
+ //# sourceMappingURL=ia-status-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-status-indicator.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-status-indicator/ia-status-indicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAO5E,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtE;;GAEG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAEnB,YAAY,SAAqB;IAGjC,YAAY,SAAkB;IAG9B,UAAU,SAAgB;IAG1B,YAAY,EAAE,MAAM,GAAG,WAAW,CAAe;IAGjD,IAAI,EAAE,aAAa,CAAa;IAE5D,MAAM,IAAI,cAAc;IASxB,gEAAgE;IAChE,OAAO,KAAK,mBAAmB,GAE9B;IAED,6DAA6D;IAC7D,OAAO,KAAK,wBAAwB,GA4BnC;IAED,wCAAwC;IACxC,OAAO,KAAK,wBAAwB,GAyBnC;IAED,gCAAgC;IAChC,OAAO,KAAK,sBAAsB,GAkBjC;IAGD,OAAO,KAAK,qBAAqB,GAIhC;IAED,MAAM,KAAK,MAAM,IAAI,cAAc,CAyFlC;CACF"}