@internetarchive/elements 0.2.2 → 0.2.3-alpha-webdev8378.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 +661 -661
- package/README.md +320 -213
- package/dist/src/elements/ia-combo-box/caret-closed.svg +8 -8
- package/dist/src/elements/ia-combo-box/caret-open.svg +8 -8
- package/dist/src/elements/ia-combo-box/clear.svg +8 -8
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts +75 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js +391 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.d.ts +16 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.d.ts.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.js +2 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.js.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/search.svg +10 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts +35 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts.map +1 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.js +217 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.js.map +1 -0
- package/dist/src/labs/ia-snow/flake.svg +1 -1
- package/dist/src/themes/theme-styles.d.ts.map +1 -1
- package/dist/src/themes/theme-styles.js +12 -0
- package/dist/src/themes/theme-styles.js.map +1 -1
- package/package.json +120 -118
|
@@ -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,eAAe;CAC/B,CAAC;AAEF,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C;;;;GAIG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAKL,mCAAmC;QAEnC,aAAQ,GAAY,KAAK,CAAC;QAE1B,qDAAqD;QAErD,aAAQ,GAAW,CAAC,CAAC;QAErB,qDAAqD;QAErD,gBAAW,GAAY,IAAI,CAAC;QAE5B,iEAAiE;QAEzD,iBAAY,GAAW,aAAa,CAAC;IA6L/C,CAAC;IAvLC,MAAM;QACJ,OAAO,IAAI,CAAA;QACP,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CACpC,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,CAAA;4BACc,CAAC;;;2BAGF,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kB;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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="36.283" height="36.283"><path d="M35.531 17.391h-3.09l.845-1.464a.748.748 0 1 0-1.297-.75l-1.276 2.214H28.61l2.515-4.354a.751.751 0 0 0-.272-1.024.75.75 0 0 0-1.024.274l-2.948 5.104h-2.023a6.751 6.751 0 0 0-2.713-4.684l1.019-1.76 5.896-.002a.75.75 0 0 0 0-1.5l-5.029.002 1.051-1.82 2.557.002a.75.75 0 0 0 0-1.5l-1.689-.002 1.545-2.676a.75.75 0 1 0-1.302-.75l-1.547 2.676-.844-1.463a.749.749 0 1 0-1.297.75l1.278 2.213-1.051 1.818-2.514-4.354a.75.75 0 0 0-1.298.75l2.946 5.104-1.016 1.758a6.692 6.692 0 0 0-2.706-.57 6.74 6.74 0 0 0-2.707.568l-1.013-1.754 2.946-5.105a.75.75 0 0 0-1.298-.75L13.56 8.697l-1.05-1.818 1.278-2.217a.749.749 0 0 0-1.298-.75l-.845 1.465-1.551-2.678a.75.75 0 0 0-1.024-.273.748.748 0 0 0-.274 1.023l1.545 2.678H8.652a.75.75 0 0 0 0 1.5h2.556l1.05 1.818H7.231a.75.75 0 0 0 0 1.5h5.894l1.017 1.762a6.755 6.755 0 0 0-2.712 4.684H9.406l-2.95-5.104a.75.75 0 1 0-1.299.75l2.516 4.354H5.569l-1.277-2.213a.75.75 0 0 0-1.298.75l.845 1.463H.75a.75.75 0 0 0 0 1.5h3.09l-.845 1.465a.747.747 0 0 0 .275 1.022.75.75 0 0 0 .374.103.75.75 0 0 0 .65-.375l1.277-2.215h2.103l-2.516 4.354a.75.75 0 0 0 1.299.75l2.949-5.104h2.024a6.761 6.761 0 0 0 2.712 4.685l-1.017 1.762H7.232a.75.75 0 0 0 0 1.5h5.026l-1.05 1.818H8.651a.75.75 0 0 0 0 1.5h1.69l-1.545 2.676a.75.75 0 0 0 1.299.75l1.546-2.676.846 1.465a.755.755 0 0 0 .65.375.737.737 0 0 0 .375-.103.747.747 0 0 0 .274-1.022l-1.279-2.215 1.05-1.82 2.515 4.354a.75.75 0 0 0 1.299-.75l-2.947-5.104 1.013-1.756a6.72 6.72 0 0 0 5.415 0l1.014 1.756-2.947 5.104a.75.75 0 0 0 1.298.75l2.515-4.354 1.053 1.82-1.277 2.213a.75.75 0 0 0 1.298.75l.844-1.463 1.545 2.678c.141.24.393.375.65.375a.75.75 0 0 0 .649-1.125l-1.548-2.678h1.689a.75.75 0 0 0 0-1.5h-2.557l-1.051-1.82 5.029.002a.75.75 0 0 0 0-1.5l-5.896-.002-1.019-1.76a6.75 6.75 0 0 0 2.711-4.685h2.023l2.947 5.104a.753.753 0 0 0 1.025.273.749.749 0 0 0 .272-1.023l-2.515-4.354h2.104l1.279 2.215a.75.75 0 0 0 .649.375c.127 0 .256-.03.375-.103a.748.748 0 0 0 .273-1.022l-.848-1.465h3.092a.75.75 0 0 0 .003-1.5zm-12.136.75c0 .257-.041.502-.076.75a5.223 5.223 0 0 1-1.943 3.358 5.242 5.242 0 0 1-1.291.766 5.224 5.224 0 0 1-1.949.384 5.157 5.157 0 0 1-3.239-1.15 5.22 5.22 0 0 1-1.943-3.358c-.036-.247-.076-.493-.076-.75s.04-.503.076-.75a5.22 5.22 0 0 1 1.944-3.359c.393-.312.82-.576 1.291-.765a5.219 5.219 0 0 1 1.948-.384c.69 0 1.344.142 1.948.384.471.188.898.454 1.291.765a5.222 5.222 0 0 1 1.943 3.359c.035.247.076.493.076.75z" fill=":color:"/></svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36.283" height="36.283"><path d="M35.531 17.391h-3.09l.845-1.464a.748.748 0 1 0-1.297-.75l-1.276 2.214H28.61l2.515-4.354a.751.751 0 0 0-.272-1.024.75.75 0 0 0-1.024.274l-2.948 5.104h-2.023a6.751 6.751 0 0 0-2.713-4.684l1.019-1.76 5.896-.002a.75.75 0 0 0 0-1.5l-5.029.002 1.051-1.82 2.557.002a.75.75 0 0 0 0-1.5l-1.689-.002 1.545-2.676a.75.75 0 1 0-1.302-.75l-1.547 2.676-.844-1.463a.749.749 0 1 0-1.297.75l1.278 2.213-1.051 1.818-2.514-4.354a.75.75 0 0 0-1.298.75l2.946 5.104-1.016 1.758a6.692 6.692 0 0 0-2.706-.57 6.74 6.74 0 0 0-2.707.568l-1.013-1.754 2.946-5.105a.75.75 0 0 0-1.298-.75L13.56 8.697l-1.05-1.818 1.278-2.217a.749.749 0 0 0-1.298-.75l-.845 1.465-1.551-2.678a.75.75 0 0 0-1.024-.273.748.748 0 0 0-.274 1.023l1.545 2.678H8.652a.75.75 0 0 0 0 1.5h2.556l1.05 1.818H7.231a.75.75 0 0 0 0 1.5h5.894l1.017 1.762a6.755 6.755 0 0 0-2.712 4.684H9.406l-2.95-5.104a.75.75 0 1 0-1.299.75l2.516 4.354H5.569l-1.277-2.213a.75.75 0 0 0-1.298.75l.845 1.463H.75a.75.75 0 0 0 0 1.5h3.09l-.845 1.465a.747.747 0 0 0 .275 1.022.75.75 0 0 0 .374.103.75.75 0 0 0 .65-.375l1.277-2.215h2.103l-2.516 4.354a.75.75 0 0 0 1.299.75l2.949-5.104h2.024a6.761 6.761 0 0 0 2.712 4.685l-1.017 1.762H7.232a.75.75 0 0 0 0 1.5h5.026l-1.05 1.818H8.651a.75.75 0 0 0 0 1.5h1.69l-1.545 2.676a.75.75 0 0 0 1.299.75l1.546-2.676.846 1.465a.755.755 0 0 0 .65.375.737.737 0 0 0 .375-.103.747.747 0 0 0 .274-1.022l-1.279-2.215 1.05-1.82 2.515 4.354a.75.75 0 0 0 1.299-.75l-2.947-5.104 1.013-1.756a6.72 6.72 0 0 0 5.415 0l1.014 1.756-2.947 5.104a.75.75 0 0 0 1.298.75l2.515-4.354 1.053 1.82-1.277 2.213a.75.75 0 0 0 1.298.75l.844-1.463 1.545 2.678c.141.24.393.375.65.375a.75.75 0 0 0 .649-1.125l-1.548-2.678h1.689a.75.75 0 0 0 0-1.5h-2.557l-1.051-1.82 5.029.002a.75.75 0 0 0 0-1.5l-5.896-.002-1.019-1.76a6.75 6.75 0 0 0 2.711-4.685h2.023l2.947 5.104a.753.753 0 0 0 1.025.273.749.749 0 0 0 .272-1.023l-2.515-4.354h2.104l1.279 2.215a.75.75 0 0 0 .649.375c.127 0 .256-.03.375-.103a.748.748 0 0 0 .273-1.022l-.848-1.465h3.092a.75.75 0 0 0 .003-1.5zm-12.136.75c0 .257-.041.502-.076.75a5.223 5.223 0 0 1-1.943 3.358 5.242 5.242 0 0 1-1.291.766 5.224 5.224 0 0 1-1.949.384 5.157 5.157 0 0 1-3.239-1.15 5.22 5.22 0 0 1-1.943-3.358c-.036-.247-.076-.493-.076-.75s.04-.503.076-.75a5.22 5.22 0 0 1 1.944-3.359c.393-.312.82-.576 1.291-.765a5.219 5.219 0 0 1 1.948-.384c.69 0 1.344.142 1.948.384.471.188.898.454 1.291.765a5.222 5.222 0 0 1 1.943 3.359c.035.247.076.493.076.75z" fill=":color:"/></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-styles.d.ts","sourceRoot":"","sources":["../../../src/themes/theme-styles.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"theme-styles.d.ts","sourceRoot":"","sources":["../../../src/themes/theme-styles.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,yBAkFhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -14,6 +14,9 @@ const themeStyles = css `
|
|
|
14
14
|
--default-icon-width: 1.25rem;
|
|
15
15
|
--default-padding-sm: 5px;
|
|
16
16
|
--default-combo-box-width: auto;
|
|
17
|
+
--default-search-bar-height: 30px;
|
|
18
|
+
--default-search-bar-width: auto;
|
|
19
|
+
--default-font-size-lg: 2.25rem;
|
|
17
20
|
|
|
18
21
|
/* Colors */
|
|
19
22
|
--true-white: #fff;
|
|
@@ -45,10 +48,19 @@ const themeStyles = css `
|
|
|
45
48
|
/* Sizing */
|
|
46
49
|
--icon-width: var(--ia-theme-icon-width, var(--default-icon-width));
|
|
47
50
|
--padding-sm: var(--ia-theme-padding-sm, var(--default-padding-sm));
|
|
51
|
+
--search-bar-height: var(
|
|
52
|
+
--ia-theme-search-bar-height,
|
|
53
|
+
var(--default-search-bar-height)
|
|
54
|
+
);
|
|
55
|
+
--search-bar-width: var(
|
|
56
|
+
--ia-theme-search-bar-width,
|
|
57
|
+
var(--default-search-bar-width)
|
|
58
|
+
);
|
|
48
59
|
--combo-box-width: var(
|
|
49
60
|
--ia-theme-combo-box-width,
|
|
50
61
|
var(--default-combo-box-width)
|
|
51
62
|
);
|
|
63
|
+
--font-size-lg: var(--ia-theme-font-size-lg, var(--default-font-size-lg));
|
|
52
64
|
|
|
53
65
|
/* Backgrounds and fills */
|
|
54
66
|
--primary-background-color: var(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-styles.js","sourceRoot":"","sources":["../../../src/themes/theme-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,WAAW,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"theme-styles.js","sourceRoot":"","sources":["../../../src/themes/theme-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFtB,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { css } from 'lit';\n\nconst themeStyles = css`\n :host {\n /*\n BASE STYLES\n Default fallback values for theme styles. Assumes 16px root font size.\n To adjust values, use theme styles below.\n */\n\n /* Typography */\n --default-font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n\n /* Sizing */\n --default-icon-width: 1.25rem;\n --default-padding-sm: 5px;\n --default-combo-box-width: auto;\n --default-search-bar-height: 30px;\n --default-search-bar-width: auto;\n --default-font-size-lg: 2.25rem;\n\n /* Colors */\n --true-white: #fff;\n --off-white: #fbfbfd;\n --dark-gray: #2c2c2c;\n --light-gray: #666;\n --classic-red: #e51c23;\n --mint-green: #31a481;\n --navy-blue: #194880;\n --bright-blue: #4b64ff;\n\n /*\n ADJUSTABLE STYLES\n To be adjusted by setting i.e. --ia-theme-link-color at the :root or component level.\n */\n\n /* Text */\n --base-font-family: var(\n --ia-theme-base-font-family,\n var(--default-font-family)\n );\n --primary-text-color: var(--ia-theme-primary-text-color, var(--dark-gray));\n --secondary-text-color: var(\n --ia-theme-secondary-text-color,\n var(--light-gray)\n );\n --link-color: var(--ia-theme-link-color, var(--bright-blue));\n\n /* Sizing */\n --icon-width: var(--ia-theme-icon-width, var(--default-icon-width));\n --padding-sm: var(--ia-theme-padding-sm, var(--default-padding-sm));\n --search-bar-height: var(\n --ia-theme-search-bar-height,\n var(--default-search-bar-height)\n );\n --search-bar-width: var(\n --ia-theme-search-bar-width,\n var(--default-search-bar-width)\n );\n --combo-box-width: var(\n --ia-theme-combo-box-width,\n var(--default-combo-box-width)\n );\n --font-size-lg: var(--ia-theme-font-size-lg, var(--default-font-size-lg));\n\n /* Backgrounds and fills */\n --primary-background-color: var(\n --ia-theme-primary-background-color,\n var(--off-white)\n );\n --secondary-background-color: var(\n --ia-theme-secondary-background-color,\n var(--true-white)\n );\n\n /* State colors */\n --primary-cta-fill: var(--ia-theme-primary-cta-fill, var(--navy-blue));\n --primary-cta-text-color: var(\n --ia-theme-primary-cta-text-color,\n var(--true-white)\n );\n --color-success: var(--ia-theme-color-success, var(--mint-green));\n --color-danger: var(--ia-theme-color-danger, var(--classic-red));\n }\n`;\n\nexport default themeStyles;\n"]}
|
package/package.json
CHANGED
|
@@ -1,118 +1,120 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@internetarchive/elements",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "A web component library from the Internet Archive.",
|
|
5
|
-
"license": "AGPL-3.0-only",
|
|
6
|
-
"types": "./dist/src/elements/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/internetarchive/elements.git"
|
|
14
|
-
},
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/internetarchive/elements/issues"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"dev": "wireit",
|
|
20
|
-
"build": "wireit",
|
|
21
|
-
"clean": "wireit",
|
|
22
|
-
"lint": "wireit",
|
|
23
|
-
"format": "wireit",
|
|
24
|
-
"circular": "wireit",
|
|
25
|
-
"prepare": "wireit",
|
|
26
|
-
"test": "wireit",
|
|
27
|
-
"ghpages:build": "wireit"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@lit/localize": "^0.12.2",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@vitest/
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"eslint
|
|
44
|
-
"eslint-
|
|
45
|
-
"eslint-plugin-
|
|
46
|
-
"eslint-plugin-
|
|
47
|
-
"eslint-plugin-
|
|
48
|
-
"eslint-plugin-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"!dist
|
|
71
|
-
"!dist
|
|
72
|
-
"!dist
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@internetarchive/elements",
|
|
3
|
+
"version": "0.2.3-alpha-webdev8378.1",
|
|
4
|
+
"description": "A web component library from the Internet Archive.",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"types": "./dist/src/elements/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/internetarchive/elements.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/internetarchive/elements/issues"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "wireit",
|
|
20
|
+
"build": "wireit",
|
|
21
|
+
"clean": "wireit",
|
|
22
|
+
"lint": "wireit",
|
|
23
|
+
"format": "wireit",
|
|
24
|
+
"circular": "wireit",
|
|
25
|
+
"prepare": "wireit",
|
|
26
|
+
"test": "wireit",
|
|
27
|
+
"ghpages:build": "wireit"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@lit/localize": "^0.12.2",
|
|
31
|
+
"@internetarchive/ia-clearable-text-input": "^1.1.1",
|
|
32
|
+
"@internetarchive/ia-dropdown": "^2.1.0",
|
|
33
|
+
"lit": "^2.8.0 || ^3.3.2",
|
|
34
|
+
"magic-snowflakes": "^7.0.2",
|
|
35
|
+
"tslib": "^2.8.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@open-wc/testing-helpers": "^3.0.1",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
40
|
+
"@vitest/browser": "^4.0.8",
|
|
41
|
+
"@vitest/browser-playwright": "^4.0.8",
|
|
42
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
43
|
+
"eslint": "^9.39.1",
|
|
44
|
+
"eslint-config-prettier": "^10.1.8",
|
|
45
|
+
"eslint-plugin-html": "^8.1.3",
|
|
46
|
+
"eslint-plugin-import": "^2.32.0",
|
|
47
|
+
"eslint-plugin-lit": "^1.15.0",
|
|
48
|
+
"eslint-plugin-lit-a11y": "^4.1.4",
|
|
49
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
50
|
+
"eslint-plugin-wc": "^2.2.1",
|
|
51
|
+
"highlight.js": "^11.11.1",
|
|
52
|
+
"madge": "^8.0.0",
|
|
53
|
+
"playwright": "^1.56.1",
|
|
54
|
+
"prettier": "^3.6.2",
|
|
55
|
+
"ts-lit-plugin": "^2.0.2",
|
|
56
|
+
"tsc-alias": "^1.8.16",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vite": "^7.2.2",
|
|
59
|
+
"vitest": "^4.0.8",
|
|
60
|
+
"wireit": "^0.14.12"
|
|
61
|
+
},
|
|
62
|
+
"exports": {
|
|
63
|
+
".": "./dist/src/index.js",
|
|
64
|
+
"./*": "./dist/src/elements/*.js",
|
|
65
|
+
"./labs/*": "./dist/src/labs/*.js"
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"README.md",
|
|
69
|
+
"dist",
|
|
70
|
+
"!dist/**/*.test*",
|
|
71
|
+
"!dist/**/*-story*",
|
|
72
|
+
"!dist/demo",
|
|
73
|
+
"!dist/src/internal",
|
|
74
|
+
"!dist/*.tsbuildinfo"
|
|
75
|
+
],
|
|
76
|
+
"wireit": {
|
|
77
|
+
"build": {
|
|
78
|
+
"command": "tsc --build --pretty && tsc-alias && rsync -zarvm --prune-empty-dirs --include \"*/\" --include \"*.svg\" --exclude=\"*\" src dist",
|
|
79
|
+
"dependencies": [
|
|
80
|
+
"circular"
|
|
81
|
+
],
|
|
82
|
+
"files": [
|
|
83
|
+
"src/**/*.ts",
|
|
84
|
+
"tsconfig.json"
|
|
85
|
+
],
|
|
86
|
+
"output": [
|
|
87
|
+
"dist/**"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"circular": {
|
|
91
|
+
"command": "madge --circular --extensions ts ."
|
|
92
|
+
},
|
|
93
|
+
"clean": {
|
|
94
|
+
"command": "rm -rf dist"
|
|
95
|
+
},
|
|
96
|
+
"dev": {
|
|
97
|
+
"command": "vite"
|
|
98
|
+
},
|
|
99
|
+
"lint": {
|
|
100
|
+
"command": "eslint . && prettier \"**/*.ts\" --check"
|
|
101
|
+
},
|
|
102
|
+
"format": {
|
|
103
|
+
"command": "eslint . --fix && prettier \"**/*.ts\" --write"
|
|
104
|
+
},
|
|
105
|
+
"prepare": {
|
|
106
|
+
"dependencies": [
|
|
107
|
+
"build"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"test": {
|
|
111
|
+
"command": "vitest",
|
|
112
|
+
"dependencies": [
|
|
113
|
+
"circular"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"ghpages:build": {
|
|
117
|
+
"command": "vite build --config vite.config.ghpages.ts && touch ./ghpages/.nojekyll"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|