@digital-realty/ix-email-list 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 ix-email-list
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # \<ix-email-list>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i ix-email-list
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import 'ix-email-list/ix-email-list.js';
16
+ const addresses = [
17
+ {
18
+ address: 'admin@admin.com',
19
+ name: 'Admin',
20
+ isValid: true
21
+ }
22
+ ]
23
+ </script>
24
+
25
+ <ix-email-list .addresses=${addresses}></ix-email-list>
26
+ ```
27
+
28
+ ## Linting and formatting
29
+
30
+ To scan the project for linting and formatting errors, run
31
+
32
+ ```bash
33
+ npm run lint
34
+ ```
35
+
36
+ To automatically fix linting and formatting errors, run
37
+
38
+ ```bash
39
+ npm run format
40
+ ```
41
+
42
+ ## Testing with Web Test Runner
43
+
44
+ To execute a single test run:
45
+
46
+ ```bash
47
+ npm run test
48
+ ```
49
+
50
+ To run the tests in interactive watch mode run:
51
+
52
+ ```bash
53
+ npm run test:watch
54
+ ```
55
+
56
+
57
+ ## Tooling configs
58
+
59
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
60
+
61
+ If you customize the configuration a lot, you can consider moving them to individual files.
62
+
63
+ ## Local Demo with `web-dev-server`
64
+
65
+ ```bash
66
+ npm start
67
+ ```
68
+
69
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,97 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import '@digital-realty/ix-chip/ix-chip-set.js';
3
+ import '@digital-realty/ix-chip/ix-chip.js';
4
+ import '@digital-realty/ix-field/ix-field.js';
5
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
6
+ export interface EmailListItem {
7
+ address: string;
8
+ isValid: boolean;
9
+ name?: string;
10
+ }
11
+ export declare class IxEmailList extends LitElement {
12
+ static get styles(): import("lit").CSSResult[];
13
+ /** @nocollapse */
14
+ static shadowRootOptions: {
15
+ delegatesFocus: boolean;
16
+ mode: ShadowRootMode;
17
+ slotAssignment?: SlotAssignmentMode | undefined;
18
+ customElements?: CustomElementRegistry | undefined;
19
+ registry?: CustomElementRegistry | undefined;
20
+ };
21
+ /** @nocollapse */
22
+ static readonly formAssociated = true;
23
+ private readonly internals;
24
+ emailInput: HTMLInputElement;
25
+ items: string[];
26
+ lookup: (address?: string) => string | undefined;
27
+ label: string;
28
+ value: string;
29
+ errorText: string;
30
+ disabled: boolean;
31
+ /**
32
+ * Gets or sets whether or not the text field is in a visually invalid state.
33
+ *
34
+ * This error state overrides the error state controlled by
35
+ * `reportValidity()`.
36
+ */
37
+ error: boolean;
38
+ required: boolean;
39
+ addresses: EmailListItem[];
40
+ onChanged: any;
41
+ /**
42
+ * The associated form element with which this element's value will submit.
43
+ */
44
+ get form(): HTMLFormElement | null;
45
+ /**
46
+ * The labels this element is associated with.
47
+ */
48
+ get labels(): NodeList;
49
+ /**
50
+ * The HTML name to use in form submission.
51
+ */
52
+ get name(): string;
53
+ set name(name: string);
54
+ private focused;
55
+ private inputValue;
56
+ /**
57
+ * Returns the text field's validation error message.
58
+ *
59
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
60
+ */
61
+ get validationMessage(): string;
62
+ /**
63
+ * Returns a `ValidityState` object that represents the validity states of the
64
+ * text field.
65
+ *
66
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
67
+ */
68
+ get validity(): ValidityState;
69
+ /**
70
+ * Returns whether an element will successfully validate based on forms
71
+ * validation rules and constraints.
72
+ *
73
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
74
+ */
75
+ get willValidate(): boolean;
76
+ checkValidity(): boolean;
77
+ reportValidity(): boolean;
78
+ firstUpdated(): void;
79
+ private chipRemove;
80
+ handleFocusin: () => void;
81
+ handleFocusout: () => void;
82
+ keydown: (e: KeyboardEvent) => void;
83
+ resolveInput: () => void;
84
+ input: (e: InputEvent) => void;
85
+ clear: () => void;
86
+ /** @private */
87
+ formResetCallback(): void;
88
+ /**
89
+ * Reset the text field to its default value.
90
+ */
91
+ reset(): void;
92
+ isValidList: () => void;
93
+ static labelText: (item: EmailListItem) => string;
94
+ protected updated(changedProperties: PropertyValues): void;
95
+ focus(): void;
96
+ render(): import("lit").TemplateResult<1>;
97
+ }
@@ -0,0 +1,294 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, nothing } from 'lit';
3
+ import { property, query, state } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
6
+ import '@digital-realty/ix-chip/ix-chip-set.js';
7
+ import '@digital-realty/ix-chip/ix-chip.js';
8
+ import '@digital-realty/ix-field/ix-field.js';
9
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
10
+ import { IxEmailListStyles } from './ix-email-list-styles.js';
11
+ import { isValidEmail } from './utils/email-validation.js';
12
+ export class IxEmailList extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.internals = this /* needed for closure */
16
+ .attachInternals();
17
+ this.items = [];
18
+ // eslint-disable-next-line class-methods-use-this
19
+ this.lookup = () => undefined;
20
+ this.label = '';
21
+ this.value = '';
22
+ this.errorText = 'Invalid email in list';
23
+ this.disabled = false;
24
+ /**
25
+ * Gets or sets whether or not the text field is in a visually invalid state.
26
+ *
27
+ * This error state overrides the error state controlled by
28
+ * `reportValidity()`.
29
+ */
30
+ this.error = false;
31
+ this.required = false;
32
+ this.addresses = [];
33
+ // eslint-disable-next-line class-methods-use-this
34
+ this.onChanged = () => { };
35
+ this.focused = false;
36
+ this.inputValue = '';
37
+ this.chipRemove = async (id) => {
38
+ const addresses = this.addresses.filter((_item, i) => i !== id);
39
+ this.addresses = [];
40
+ await 0;
41
+ this.addresses = addresses;
42
+ this.isValidList();
43
+ this.onChanged(this.addresses);
44
+ if (!this.addresses.length) {
45
+ this.handleFocusout();
46
+ }
47
+ };
48
+ this.handleFocusin = () => {
49
+ this.focused = true;
50
+ };
51
+ this.handleFocusout = () => {
52
+ if (this.inputValue) {
53
+ this.resolveInput();
54
+ }
55
+ else if (this.value !== '') {
56
+ this.focused = true;
57
+ }
58
+ else {
59
+ this.focused = false;
60
+ }
61
+ };
62
+ this.keydown = (e) => {
63
+ // input completion keys
64
+ const completionKeys = [' ', ',', 'Tab', 'Enter'];
65
+ if (completionKeys.includes(e.key) && this.inputValue.length) {
66
+ e.preventDefault();
67
+ this.resolveInput();
68
+ }
69
+ };
70
+ this.resolveInput = () => {
71
+ const address = this.inputValue.toLowerCase();
72
+ const isValid = isValidEmail(address);
73
+ const name = this.lookup(address);
74
+ this.addresses = [...this.addresses, { address, isValid, name }];
75
+ this.inputValue = '';
76
+ this.isValidList();
77
+ this.onChanged(this.addresses);
78
+ };
79
+ this.input = (e) => {
80
+ const { value } = e.target;
81
+ this.inputValue = value;
82
+ };
83
+ this.clear = () => {
84
+ this.addresses = [];
85
+ this.inputValue = '';
86
+ this.value = '';
87
+ this.error = false;
88
+ this.onChanged(this.addresses);
89
+ this.handleFocusout();
90
+ };
91
+ this.isValidList = () => {
92
+ this.error = this.addresses.some((item) => !item.isValid);
93
+ this.internals.setValidity({
94
+ badInput: this.error,
95
+ }, this.error ? this.errorText : '', this.emailInput);
96
+ };
97
+ }
98
+ static get styles() {
99
+ return [IxEmailListStyles];
100
+ }
101
+ /**
102
+ * The associated form element with which this element's value will submit.
103
+ */
104
+ get form() {
105
+ return this.internals.form;
106
+ }
107
+ /**
108
+ * The labels this element is associated with.
109
+ */
110
+ get labels() {
111
+ return this.internals.labels;
112
+ }
113
+ /**
114
+ * The HTML name to use in form submission.
115
+ */
116
+ get name() {
117
+ var _a;
118
+ return (_a = this.getAttribute('name')) !== null && _a !== void 0 ? _a : '';
119
+ }
120
+ set name(name) {
121
+ this.setAttribute('name', name);
122
+ }
123
+ /**
124
+ * Returns the text field's validation error message.
125
+ *
126
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation
127
+ */
128
+ get validationMessage() {
129
+ return this.internals.validationMessage;
130
+ }
131
+ /**
132
+ * Returns a `ValidityState` object that represents the validity states of the
133
+ * text field.
134
+ *
135
+ * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
136
+ */
137
+ get validity() {
138
+ return this.internals.validity;
139
+ }
140
+ /**
141
+ * Returns whether an element will successfully validate based on forms
142
+ * validation rules and constraints.
143
+ *
144
+ * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
145
+ */
146
+ get willValidate() {
147
+ return this.internals.willValidate;
148
+ }
149
+ checkValidity() {
150
+ return this.internals.checkValidity();
151
+ }
152
+ reportValidity() {
153
+ return this.internals.reportValidity();
154
+ }
155
+ firstUpdated() {
156
+ this.internals.setFormValue(this.value);
157
+ if (this.value !== '') {
158
+ this.addresses = this.value.split(',').map((item) => {
159
+ const address = item.toLowerCase().trim();
160
+ return {
161
+ address,
162
+ isValid: isValidEmail(address),
163
+ };
164
+ });
165
+ }
166
+ this.focused = this.addresses.length > 0;
167
+ this.isValidList();
168
+ }
169
+ /** @private */
170
+ formResetCallback() {
171
+ this.reset();
172
+ }
173
+ /**
174
+ * Reset the text field to its default value.
175
+ */
176
+ reset() {
177
+ var _a;
178
+ this.clear();
179
+ this.value = (_a = this.getAttribute('value')) !== null && _a !== void 0 ? _a : '';
180
+ }
181
+ updated(changedProperties) {
182
+ if (changedProperties.has('addresses')) {
183
+ this.value = this.addresses.map(item => item.address).join(', ');
184
+ }
185
+ this.internals.setFormValue(this.value);
186
+ }
187
+ focus() {
188
+ this.emailInput.focus();
189
+ }
190
+ render() {
191
+ const classes = {
192
+ disabled: this.disabled,
193
+ error: !this.disabled && this.error,
194
+ };
195
+ return html `
196
+ <ix-field
197
+ class="${classMap(classes)}"
198
+ ?focused=${this.focused}
199
+ ?disabled=${this.disabled}
200
+ ?required=${this.required}
201
+ label=${this.label}
202
+ ?error=${this.error}
203
+ error-text=${this.errorText}
204
+ @focusin=${this.handleFocusin}
205
+ @focusout=${this.handleFocusout}
206
+ >
207
+ <ix-chip-set>
208
+ ${this.addresses.map((item, id) => html `<span
209
+ ><ix-chip
210
+ @remove=${() => this.chipRemove(id)}
211
+ label=${IxEmailList.labelText(item)}
212
+ class=${item.isValid ? '' : 'error'}
213
+ appearance="input"
214
+ removable
215
+ remove-only
216
+ ></ix-chip
217
+ ></span>`)}
218
+ <input
219
+ id="email-input"
220
+ @keydown=${this.keydown}
221
+ @input=${this.input}
222
+ .value=${this.inputValue}
223
+ class="flex-fill"
224
+ type="text"
225
+ />
226
+ </ix-chip-set>
227
+ <slot name="end" slot="end">
228
+ ${this.addresses.length
229
+ ? html `<ix-icon-button
230
+ class="clear-icon"
231
+ @click=${this.clear}
232
+ icon="close"
233
+ aria-label="clear"
234
+ ></ix-icon-button>`
235
+ : nothing}
236
+ </slot>
237
+ </ix-field>
238
+ `;
239
+ }
240
+ }
241
+ (() => {
242
+ requestUpdateOnAriaChange(IxEmailList);
243
+ })();
244
+ /** @nocollapse */
245
+ IxEmailList.shadowRootOptions = {
246
+ ...LitElement.shadowRootOptions,
247
+ delegatesFocus: true,
248
+ };
249
+ /** @nocollapse */
250
+ IxEmailList.formAssociated = true;
251
+ IxEmailList.labelText = (item) => {
252
+ const address = item.isValid ? item.address : `${item.address}!`;
253
+ return item.name ? item.name : address;
254
+ };
255
+ __decorate([
256
+ query('#email-input')
257
+ ], IxEmailList.prototype, "emailInput", void 0);
258
+ __decorate([
259
+ property({ type: Array })
260
+ ], IxEmailList.prototype, "items", void 0);
261
+ __decorate([
262
+ property()
263
+ ], IxEmailList.prototype, "lookup", void 0);
264
+ __decorate([
265
+ property({ type: String })
266
+ ], IxEmailList.prototype, "label", void 0);
267
+ __decorate([
268
+ property({ type: String })
269
+ ], IxEmailList.prototype, "value", void 0);
270
+ __decorate([
271
+ property({ type: String, attribute: 'error-text' })
272
+ ], IxEmailList.prototype, "errorText", void 0);
273
+ __decorate([
274
+ property({ type: Boolean, reflect: true })
275
+ ], IxEmailList.prototype, "disabled", void 0);
276
+ __decorate([
277
+ property({ type: Boolean, reflect: true })
278
+ ], IxEmailList.prototype, "error", void 0);
279
+ __decorate([
280
+ property({ type: Boolean, reflect: true })
281
+ ], IxEmailList.prototype, "required", void 0);
282
+ __decorate([
283
+ property({ type: Array })
284
+ ], IxEmailList.prototype, "addresses", void 0);
285
+ __decorate([
286
+ property({ type: Function })
287
+ ], IxEmailList.prototype, "onChanged", void 0);
288
+ __decorate([
289
+ state()
290
+ ], IxEmailList.prototype, "focused", void 0);
291
+ __decorate([
292
+ state()
293
+ ], IxEmailList.prototype, "inputValue", void 0);
294
+ //# sourceMappingURL=IxEmailList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxEmailList.js","sourceRoot":"","sources":["../src/IxEmailList.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,wCAAwC,CAAC;AAChD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAQ3D,MAAM,OAAO,WAAY,SAAQ,UAAU;IAA3C;;QAkBmB,cAAS,GAAI,IAAoB,CAAC,wBAAwB;aACxE,eAAe,EAAE,CAAC;QAIM,UAAK,GAAa,EAAE,CAAC;QAEhD,kDAAkD;QACtC,WAAM,GAA6C,GAAG,EAAE,CAClE,SAAS,CAAC;QAEgB,UAAK,GAAG,EAAE,CAAC;QAEX,UAAK,GAAG,EAAE,CAAC;QAEc,cAAS,GAC5D,uBAAuB,CAAC;QAEkB,aAAQ,GAAG,KAAK,CAAC;QAE7D;;;;;WAKG;QACyC,UAAK,GAAG,KAAK,CAAC;QAEd,aAAQ,GAAG,KAAK,CAAC;QAElC,cAAS,GAAoB,EAAE,CAAC;QAE3D,kDAAkD;QACpB,cAAS,GAAQ,GAAG,EAAE,GAAE,CAAC,CAAC;QA2BvC,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,EAAE,CAAC;QAsDzB,eAAU,GAAG,KAAK,EAAE,EAAU,EAA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;+CAA+B;AAE1B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;0CAAsB;AAGpC;IAAX,QAAQ,EAAE;2CACC;AAEgB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAY;AAEX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAY;AAEc;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8CAC1B;AAEkB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAQjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAEd;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAElC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAAiC;AAG7B;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8CAA2B;AA2B/C;IAAR,KAAK,EAAE;4CAAyB;AAExB;IAAR,KAAK,EAAE;+CAAyB","sourcesContent":["import { html, LitElement, nothing, PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport '@digital-realty/ix-chip/ix-chip-set.js';\nimport '@digital-realty/ix-chip/ix-chip.js';\nimport '@digital-realty/ix-field/ix-field.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport { IxEmailListStyles } from './ix-email-list-styles.js';\nimport { isValidEmail } from './utils/email-validation.js';\n\nexport interface EmailListItem {\n address: string;\n isValid: boolean;\n name?: string;\n}\n\nexport class IxEmailList extends LitElement {\n static {\n requestUpdateOnAriaChange(IxEmailList);\n }\n\n static get styles() {\n return [IxEmailListStyles];\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n private readonly internals = (this as HTMLElement) /* needed for closure */\n .attachInternals();\n\n @query('#email-input') emailInput!: HTMLInputElement;\n\n @property({ type: Array }) items: string[] = [];\n\n // eslint-disable-next-line class-methods-use-this\n @property() lookup: (address?: string) => string | undefined = () =>\n undefined;\n\n @property({ type: String }) label = '';\n\n @property({ type: String }) value = '';\n\n @property({ type: String, attribute: 'error-text' }) errorText =\n 'Invalid email in list';\n\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Gets or sets whether or not the text field is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({ type: Boolean, reflect: true }) error = false;\n\n @property({ type: Boolean, reflect: true }) required = false;\n\n @property({ type: Array }) addresses: EmailListItem[] = [];\n\n // eslint-disable-next-line class-methods-use-this\n @property({ type: Function }) onChanged: any = () => {};\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * The labels this element is associated with.\n */\n get labels() {\n return this.internals.labels;\n }\n\n /**\n * The HTML name to use in form submission.\n */\n get name() {\n return this.getAttribute('name') ?? '';\n }\n\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n @state() private focused = false;\n\n @state() private inputValue = '';\n\n /**\n * Returns the text field's validation error message.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Returns a `ValidityState` object that represents the validity states of the\n * text field.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Returns whether an element will successfully validate based on forms\n * validation rules and constraints.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n checkValidity() {\n return this.internals.checkValidity();\n }\n\n reportValidity() {\n return this.internals.reportValidity();\n }\n\n firstUpdated() {\n this.internals.setFormValue(this.value);\n if (this.value !== '') {\n this.addresses = this.value.split(',').map((item: string) => {\n const address = item.toLowerCase().trim();\n return {\n address,\n isValid: isValidEmail(address),\n };\n });\n }\n this.focused = this.addresses.length > 0;\n this.isValidList();\n }\n\n private chipRemove = async (id: number) => {\n const addresses = this.addresses.filter((_item, i: number) => i !== id);\n this.addresses = [];\n await 0;\n this.addresses = addresses;\n this.isValidList();\n this.onChanged(this.addresses);\n if (!this.addresses.length) {\n this.handleFocusout();\n }\n };\n\n handleFocusin = () => {\n this.focused = true;\n };\n\n handleFocusout = () => {\n if (this.inputValue) {\n this.resolveInput();\n } else if (this.value !== '') {\n this.focused = true;\n } else {\n this.focused = false;\n }\n };\n\n keydown = (e: KeyboardEvent) => {\n // input completion keys\n const completionKeys = [' ', ',', 'Tab', 'Enter'];\n if (completionKeys.includes(e.key) && this.inputValue.length) {\n e.preventDefault();\n this.resolveInput();\n }\n };\n\n resolveInput = () => {\n const address = this.inputValue.toLowerCase();\n const isValid = isValidEmail(address);\n const name = this.lookup(address);\n this.addresses = [...this.addresses, { address, isValid, name }];\n this.inputValue = '';\n this.isValidList();\n this.onChanged(this.addresses);\n };\n\n input = (e: InputEvent) => {\n const { value } = e.target as HTMLInputElement;\n this.inputValue = value;\n };\n\n clear = () => {\n this.addresses = [];\n this.inputValue = '';\n this.value = '';\n this.error = false;\n this.onChanged(this.addresses);\n this.handleFocusout();\n };\n\n /** @private */\n formResetCallback() {\n this.reset();\n }\n\n /**\n * Reset the text field to its default value.\n */\n reset() {\n this.clear();\n this.value = this.getAttribute('value') ?? '';\n }\n\n isValidList = () => {\n this.error = this.addresses.some((item: EmailListItem) => !item.isValid);\n this.internals.setValidity(\n {\n badInput: this.error,\n },\n this.error ? this.errorText : '',\n this.emailInput\n );\n };\n\n static labelText = (item: EmailListItem) => {\n const address = item.isValid ? item.address : `${item.address}!`;\n return item.name ? item.name : address;\n };\n\n protected override updated(changedProperties: PropertyValues) {\n if (changedProperties.has('addresses')) {\n this.value = this.addresses.map(item => item.address).join(', ');\n }\n this.internals.setFormValue(this.value);\n }\n\n override focus() {\n this.emailInput.focus();\n }\n\n render() {\n const classes = {\n disabled: this.disabled,\n error: !this.disabled && this.error,\n };\n\n return html`\n <ix-field\n class=\"${classMap(classes)}\"\n ?focused=${this.focused}\n ?disabled=${this.disabled}\n ?required=${this.required}\n label=${this.label}\n ?error=${this.error}\n error-text=${this.errorText}\n @focusin=${this.handleFocusin}\n @focusout=${this.handleFocusout}\n >\n <ix-chip-set>\n ${this.addresses.map(\n (item, id: number) => html`<span\n ><ix-chip\n @remove=${() => this.chipRemove(id)}\n label=${IxEmailList.labelText(item)}\n class=${item.isValid ? '' : 'error'}\n appearance=\"input\"\n removable\n remove-only\n ></ix-chip\n ></span>`\n )}\n <input\n id=\"email-input\"\n @keydown=${this.keydown}\n @input=${this.input}\n .value=${this.inputValue}\n class=\"flex-fill\"\n type=\"text\"\n />\n </ix-chip-set>\n <slot name=\"end\" slot=\"end\">\n ${this.addresses.length\n ? html`<ix-icon-button\n class=\"clear-icon\"\n @click=${this.clear}\n icon=\"close\"\n aria-label=\"clear\"\n ></ix-icon-button>`\n : nothing}\n </slot>\n </ix-field>\n `;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { IxEmailList } from './IxEmailList.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { IxEmailList } from './IxEmailList.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { IxEmailList } from './IxEmailList.js';\n"]}
@@ -0,0 +1 @@
1
+ export declare const IxEmailListStyles: import("lit").CSSResult;
@@ -0,0 +1,47 @@
1
+ import { css } from 'lit';
2
+ export const IxEmailListStyles = css `
3
+ :host {
4
+ display: block;
5
+ }
6
+ ix-field {
7
+ display: block;
8
+ --md-outlined-field-label-text-color: var(--md-sys-text-color-primary);
9
+ --md-outlined-field-outline-color: var(--md-outlined-field-outline-color);
10
+ }
11
+ ix-field label {
12
+ display: none;
13
+ }
14
+ ix-chip.error {
15
+ --md-input-chip-label-text-color: red;
16
+ --md-input-chip-hover-label-text-color: red;
17
+ }
18
+ .flex-fill {
19
+ flex: 1;
20
+ }
21
+ input {
22
+ border: none;
23
+ background: transparent;
24
+ outline: none;
25
+ min-width: 3rem;
26
+ font-size: var(--md-outlined-text-field-input-text-font, 16px);
27
+ line-height: var(--md-outlined-text-field-input-text-font, 24px);
28
+ }
29
+ ix-chip-set {
30
+ min-height: var(--_content-line-height);
31
+ }
32
+ ix-icon-button {
33
+ --md-icon-button-icon-color: var(--md-sys-text-color-secondary);
34
+ --md-icon-button-hover-icon-color: var(--md-sys-text-color-secondary);
35
+ --md-icon-button-hover-state-layer-color: var(
36
+ --md-sys-text-color-secondary
37
+ );
38
+ --md-icon-button-pressed-icon-color: var(--md-sys-text-color-secondary);
39
+ --md-icon-button-pressed-state-layer-color: var(
40
+ --md-sys-text-color-secondary
41
+ );
42
+ }
43
+ .clear-icon {
44
+ margin-right: 0.5rem;
45
+ }
46
+ `;
47
+ //# sourceMappingURL=ix-email-list-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-email-list-styles.js","sourceRoot":"","sources":["../src/ix-email-list-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CnC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxEmailListStyles = css`\n :host {\n display: block;\n }\n ix-field {\n display: block;\n --md-outlined-field-label-text-color: var(--md-sys-text-color-primary);\n --md-outlined-field-outline-color: var(--md-outlined-field-outline-color);\n }\n ix-field label {\n display: none;\n }\n ix-chip.error {\n --md-input-chip-label-text-color: red;\n --md-input-chip-hover-label-text-color: red;\n }\n .flex-fill {\n flex: 1;\n }\n input {\n border: none;\n background: transparent;\n outline: none;\n min-width: 3rem;\n font-size: var(--md-outlined-text-field-input-text-font, 16px);\n line-height: var(--md-outlined-text-field-input-text-font, 24px);\n }\n ix-chip-set {\n min-height: var(--_content-line-height);\n }\n ix-icon-button {\n --md-icon-button-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-hover-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-hover-state-layer-color: var(\n --md-sys-text-color-secondary\n );\n --md-icon-button-pressed-icon-color: var(--md-sys-text-color-secondary);\n --md-icon-button-pressed-state-layer-color: var(\n --md-sys-text-color-secondary\n );\n }\n .clear-icon {\n margin-right: 0.5rem;\n }\n`;\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { IxEmailList } from './IxEmailList.js';
2
+ window.customElements.define('ix-email-list', IxEmailList);
3
+ //# sourceMappingURL=ix-email-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-email-list.js","sourceRoot":"","sources":["../src/ix-email-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { IxEmailList } from './IxEmailList.js';\n\nwindow.customElements.define('ix-email-list', IxEmailList);\n"]}
@@ -0,0 +1 @@
1
+ export declare const isValidEmail: (email: string) => boolean;
@@ -0,0 +1,10 @@
1
+ // https://fjolt.com/article/javascript-how-to-validate-an-email
2
+ /*
3
+ Email validation regex RFC5322, successor to RFC822 is much shorter and easier to use.
4
+ The function below will validate any email put into it:
5
+ */
6
+ export const isValidEmail = (email) => {
7
+ const regex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
8
+ return regex.test(email);
9
+ };
10
+ //# sourceMappingURL=email-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-validation.js","sourceRoot":"","sources":["../../src/utils/email-validation.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE;;;EAGE;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;IAC5C,MAAM,KAAK,GACT,uJAAuJ,CAAC;IAC1J,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// https://fjolt.com/article/javascript-how-to-validate-an-email\n/*\n Email validation regex RFC5322, successor to RFC822 is much shorter and easier to use. \n The function below will validate any email put into it:\n*/\n\nexport const isValidEmail = (email: string) => {\n const regex =\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regex.test(email);\n};\n"]}
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@digital-realty/ix-email-list",
3
+ "description": "Webcomponent ix-email-list following open-wc recommendations",
4
+ "license": "MIT",
5
+ "author": "Digital Realty",
6
+ "version": "0.0.1",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./ix-email-list.js": "./dist/ix-email-list.js"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "analyze": "cem analyze --litelement",
19
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
20
+ "build": "tsc && npm run analyze -- --exclude dist",
21
+ "prepublish": "tsc && npm run analyze -- --exclude dist",
22
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
23
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
+ "test": "tsc && wtr --coverage",
25
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
26
+ },
27
+ "dependencies": {
28
+ "@digital-realty/ix-chip": "^1.0.4",
29
+ "@digital-realty/ix-field": "^0.0.3",
30
+ "@digital-realty/ix-icon-button": "^1.0.15",
31
+ "@digital-realty/theme": "^1.0.6",
32
+ "@material/web": "^1.0.0",
33
+ "@web/test-runner-commands": "^0.9.0",
34
+ "lit": "^2.0.2"
35
+ },
36
+ "devDependencies": {
37
+ "@custom-elements-manifest/analyzer": "^0.4.17",
38
+ "@open-wc/eslint-config": "^9.2.1",
39
+ "@open-wc/testing": "^3.1.6",
40
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
41
+ "@typescript-eslint/parser": "^5.48.0",
42
+ "@web/dev-server": "^0.1.34",
43
+ "@web/test-runner": "^0.14.0",
44
+ "concurrently": "^5.3.0",
45
+ "eslint": "^8.31.0",
46
+ "eslint-config-prettier": "^8.3.0",
47
+ "husky": "^4.3.8",
48
+ "lint-staged": "^10.5.4",
49
+ "prettier": "^2.4.1",
50
+ "tslib": "^2.3.1",
51
+ "typescript": "^4.5.2"
52
+ },
53
+ "customElements": "custom-elements.json",
54
+ "eslintConfig": {
55
+ "parser": "@typescript-eslint/parser",
56
+ "extends": [
57
+ "@open-wc",
58
+ "prettier"
59
+ ],
60
+ "plugins": [
61
+ "@typescript-eslint"
62
+ ],
63
+ "rules": {
64
+ "no-unused-vars": "off",
65
+ "@typescript-eslint/no-unused-vars": [
66
+ "error"
67
+ ],
68
+ "import/no-unresolved": "off",
69
+ "import/extensions": [
70
+ "error",
71
+ "always",
72
+ {
73
+ "ignorePackages": true
74
+ }
75
+ ]
76
+ }
77
+ },
78
+ "prettier": {
79
+ "singleQuote": true,
80
+ "arrowParens": "avoid"
81
+ },
82
+ "husky": {
83
+ "hooks": {
84
+ "pre-commit": "lint-staged"
85
+ }
86
+ },
87
+ "lint-staged": {
88
+ "*.ts": [
89
+ "eslint --fix",
90
+ "prettier --write"
91
+ ]
92
+ },
93
+ "files": [
94
+ "/dist",
95
+ "!/dist/test",
96
+ "package.json",
97
+ "README.md",
98
+ "LICENSE"
99
+ ],
100
+ "gitHead": "ab9691521eda862a6136ca9c967a09b518dcc516"
101
+ }