@internetarchive/elements 0.2.0 → 0.2.1-1.webdev-8777.0
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/README.md +208 -30
- package/dist/src/elements/ia-button/ia-button.d.ts +41 -3
- package/dist/src/elements/ia-button/ia-button.d.ts.map +1 -1
- package/dist/src/elements/ia-button/ia-button.js +350 -11
- package/dist/src/elements/ia-button/ia-button.js.map +1 -1
- package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts +4 -4
- package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts.map +1 -1
- package/dist/src/elements/ia-combo-box/ia-combo-box.js +21 -13
- package/dist/src/elements/ia-combo-box/ia-combo-box.js.map +1 -1
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts +68 -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 +328 -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 +17 -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-form/ia-otp-form.d.ts +21 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts.map +1 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.js +157 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.js.map +1 -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/elements/ia-sr-only-text/ia-sr-only-text.d.ts +10 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts.map +1 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js +43 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js.map +1 -0
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts +4 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts.map +1 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +10 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -1
- package/dist/src/elements/index.d.ts +3 -2
- package/dist/src/elements/index.d.ts.map +1 -1
- package/dist/src/elements/index.js +3 -2
- package/dist/src/elements/index.js.map +1 -1
- package/dist/src/labs/ia-snow/ia-snow.js +3 -3
- package/dist/src/themes/theme-styles.d.ts.map +1 -1
- package/dist/src/themes/theme-styles.js +94 -0
- package/dist/src/themes/theme-styles.js.map +1 -1
- package/package.json +5 -3
|
@@ -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":["../../../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AAC,QAAQ;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,kBAAkB;IACV,aAAa,CAAC,IAAY;QAChC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,MAAM,CAAC,aAAa,EAAE;YACpC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,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"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CSSResultGroup, LitElement, TemplateResult } from 'lit';
|
|
2
|
+
export type LoadingStatus = 'ready' | 'loading' | 'success' | 'error';
|
|
2
3
|
/**
|
|
3
4
|
* Renders an SVG indicator, which defualts to an animated circular indicator
|
|
4
5
|
*/
|
|
@@ -7,8 +8,10 @@ export declare class IAStatusIndicator extends LitElement {
|
|
|
7
8
|
successTitle: string;
|
|
8
9
|
errorTitle: string;
|
|
9
10
|
loadingStyle: 'ring' | 'ring-dots';
|
|
10
|
-
mode:
|
|
11
|
+
mode: LoadingStatus;
|
|
11
12
|
render(): TemplateResult;
|
|
13
|
+
/** A placeholder to render before loading begins, if desired */
|
|
14
|
+
private get placeholderTemplate();
|
|
12
15
|
/** A circular loading indicator to render when processing */
|
|
13
16
|
private get loadingIndicatorTemplate();
|
|
14
17
|
/** A check mark to render on success */
|
|
@@ -1 +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;;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,
|
|
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"}
|
|
@@ -3,7 +3,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { msg } from '@lit/localize';
|
|
5
5
|
import { choose } from 'lit/directives/choose.js';
|
|
6
|
-
import themeStyles from '../../themes/theme-styles';
|
|
6
|
+
import themeStyles from '../../themes/theme-styles.js';
|
|
7
7
|
/**
|
|
8
8
|
* Renders an SVG indicator, which defualts to an animated circular indicator
|
|
9
9
|
*/
|
|
@@ -23,11 +23,16 @@ let IAStatusIndicator = class IAStatusIndicator extends LitElement {
|
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
25
|
return html `${choose(this.mode, [
|
|
26
|
+
['ready', () => this.placeholderTemplate],
|
|
26
27
|
['loading', () => this.loadingIndicatorTemplate],
|
|
27
28
|
['success', () => this.successIndicatorTemplate],
|
|
28
29
|
['error', () => this.errorIndicatorTemplate],
|
|
29
30
|
])}`;
|
|
30
31
|
}
|
|
32
|
+
/** A placeholder to render before loading begins, if desired */
|
|
33
|
+
get placeholderTemplate() {
|
|
34
|
+
return html `<div class="placeholder"></div>`;
|
|
35
|
+
}
|
|
31
36
|
/** A circular loading indicator to render when processing */
|
|
32
37
|
get loadingIndicatorTemplate() {
|
|
33
38
|
return html `
|
|
@@ -132,6 +137,10 @@ let IAStatusIndicator = class IAStatusIndicator extends LitElement {
|
|
|
132
137
|
width: var(--indicator-width--);
|
|
133
138
|
}
|
|
134
139
|
|
|
140
|
+
.placeholder {
|
|
141
|
+
height: var(--indicator-width--);
|
|
142
|
+
}
|
|
143
|
+
|
|
135
144
|
.success-icon {
|
|
136
145
|
fill: var(--success-icon-color--);
|
|
137
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-status-indicator.js","sourceRo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;;;KASxE,CAAC;IACJ,CAAC;IAED,wCAAwC;IACxC,IAAY,wBAAwB;QAClC,OAAO,IAAI,CAAA;;;;;;;;;;iBAUE,IAAI,CAAC,YAAY;;;;;;;;;;;;;KAa7B,CAAC;IACJ,CAAC;IAED,gCAAgC;IAChC,IAAY,sBAAsB;QAChC,OAAO,IAAI,CAAA;;;;;;;;;;iBAUE,IAAI,CAAC,UAAU;;;;;;KAM3B,CAAC;IACJ,CAAC;IAED,0DAA0D;IAC1D,IAAY,qBAAqB;QAC/B,IAAI,IAAI,CAAC,YAAY,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAE/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgFF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAnM6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAkC;AAGjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA+B;AAG9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA2B;AAG1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAkD;AAGjD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmD;AAdnE,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAqM7B","sourcesContent":["import { css, CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport { choose } from 'lit/directives/choose.js';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/**\n * Renders an SVG indicator, which defualts to an animated circular indicator\n */\n@customElement('ia-status-indicator')\nexport class IAStatusIndicator extends LitElement {\n /* An optional title to use for the loading state of the indicator. Will be used for screen readers. */\n @property({ type: String }) loadingTitle = msg('Loading...');\n\n /* An optional title to use for the success state of the indicator. Will be used for screen readers. */\n @property({ type: String }) successTitle = msg('Success');\n\n /* An optional title to use for the error state of the indicator. Will be used for screen readers. */\n @property({ type: String }) errorTitle = msg('Error');\n\n /* Which type of loading indicator to display */\n @property({ type: String }) loadingStyle: 'ring' | 'ring-dots' = 'ring-dots';\n\n /* The state of the indicator that should be shown */\n @property({ type: String }) mode: 'loading' | 'success' | 'error' = 'loading';\n\n render(): TemplateResult {\n return html`${choose(this.mode, [\n ['loading', () => this.loadingIndicatorTemplate],\n ['success', () => this.successIndicatorTemplate],\n ['error', () => this.errorIndicatorTemplate],\n ])}`;\n }\n\n /** A circular loading indicator to render when processing */\n private get loadingIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"loading-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.loadingTitle}</title>\n <g stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n class=\"loading-ring\"\n d=\"M60,10 C69.8019971,10 78.9452178,12.8205573 86.6623125,17.6943223 L76.4086287,27.9484118 C71.4880919,25.4243078 65.9103784,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 C96,53.3014663 94.1704984,47.0302355 90.9839104,41.6587228 L101.110332,31.5326452 C106.715332,39.6116982 110,49.4222615 110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <g\n class=\"loading-dots ${!this.shouldShowLoadingDots ? 'hidden' : ''}\"\n transform=\"translate(40.000000, 55.000000)\"\n >\n <circle id=\"left-dot\" cx=\"5\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"middle-dot\" cx=\"20\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"right-dot\" cx=\"35\" cy=\"5\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n `;\n }\n\n /** A check mark to render on success */\n private get successIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"success-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.successTitle}</title>\n <g stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n class=\"success-icon\"\n d=\"M60,10 C70.5816709,10 80.3955961,13.2871104 88.4763646,18.8959201 L78.3502633,29.0214223 C72.9767592,25.8315427 66.7022695,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 L95.995,59.46 L108.327675,47.128668 C109.350926,50.9806166 109.925886,55.015198 109.993301,59.1731586 L110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <polygon\n class=\"success-icon\"\n transform=\"translate(75.000000, 41.500000) rotate(44.000000) translate(-75.000000, -41.500000) \"\n points=\"96 85 54 85 54 65 76 64.999 76 -2 96 -2\"\n ></polygon>\n </g>\n </svg>\n `;\n }\n\n /** An \"!\" to render on error */\n private get errorIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"error-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.errorTitle}</title>\n <path\n class=\"error-icon\"\n d=\"m56.4612493 8.80450354 41.8901185 75.94632926c1.7706782 2.8433173 2.1150372 5.2623412 1.0330766 7.2570716-1.0819604 1.9947304-3.26978 2.9920956-6.5634587 2.9920956h-85.69973905c-3.29367873 0-5.46954894-.9973652-6.52761065-2.9920956-1.0580617-1.9947304-.70175345-4.4137543 1.06892476-7.2570716l41.89011844-75.12308969c1.8184757-2.84331737 3.9693609-4.37738627 6.4526556-4.60220671s4.6341799 1.03483527 6.4526556 3.77896714zm28.5387507 75.19549646-35.037482-62-34.962518 62zm-31-34.7484359v-10.2515641h-8v10.2515641l2.089172 14.7484359h3.8184713zm-8 19.7484359v8h8v-8z\"\n />\n </svg>\n `;\n }\n\n /* Whether to include the dots in the loading indicator */\n private get shouldShowLoadingDots(): boolean {\n if (this.loadingStyle === 'ring') return false;\n\n return true;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --indicator-width--: var(--icon-width);\n\n /* Loading */\n --loading-ring-color--: var(--primary-text-color);\n --loading-dot-color--: var(--primary-text-color);\n\n /* Success */\n --success-icon-color--: var(--color-success);\n\n /* Error */\n --error-icon-color--: var(--color-danger);\n\n display: inline-block;\n width: var(--indicator-width--);\n }\n\n .success-icon {\n fill: var(--success-icon-color--);\n }\n\n .error-icon {\n fill: var(--error-icon-color--);\n }\n\n .loading-ring {\n fill: var(--loading-ring-color--);\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n }\n\n .loading-dots {\n fill: var(--loading-dot-color--);\n transition: opacity 0.25s ease-out;\n }\n\n .loading-dots.hidden {\n display: none;\n }\n\n .loading-dots > * {\n opacity: 0;\n animation: dot 1.3s infinite;\n }\n\n .loading-dots #left-dot {\n animation-delay: 0.2s;\n }\n\n .loading-dots #middle-dot {\n animation-delay: 0.4s;\n }\n\n .loading-dots #right-dot {\n animation-delay: 0.6s;\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n 100% {\n /* This frame is supposed to be inferred, but Safari doesn't rotate it unless we're explicit */\n transform: rotate(0deg);\n }\n }\n\n @keyframes dot {\n 0% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-status-indicator.js","sourceRoot":"","sources":["../../../../src/elements/ia-status-indicator/ia-status-indicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAInD;;GAEG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QACL,uGAAuG;QAC3E,iBAAY,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;QAE7D,uGAAuG;QAC3E,iBAAY,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;QAE1D,qGAAqG;QACzE,eAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;QAEtD,gDAAgD;QACpB,iBAAY,GAAyB,WAAW,CAAC;QAE7E,qDAAqD;QACzB,SAAI,GAAkB,SAAS,CAAC;IAiM9D,CAAC;IA/LC,MAAM;QACJ,OAAO,IAAI,CAAA,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;YAC9B,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC;YACzC,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC;YAChD,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC;YAChD,CAAC,OAAO,EA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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAkD;AAGjD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAiC;AAdjD,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA+M7B","sourcesContent":["import { css, CSSResultGroup, html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport { choose } from 'lit/directives/choose.js';\n\nimport themeStyles from '@src/themes/theme-styles';\n\nexport type LoadingStatus = 'ready' | 'loading' | 'success' | 'error';\n\n/**\n * Renders an SVG indicator, which defualts to an animated circular indicator\n */\n@customElement('ia-status-indicator')\nexport class IAStatusIndicator extends LitElement {\n /* An optional title to use for the loading state of the indicator. Will be used for screen readers. */\n @property({ type: String }) loadingTitle = msg('Loading...');\n\n /* An optional title to use for the success state of the indicator. Will be used for screen readers. */\n @property({ type: String }) successTitle = msg('Success');\n\n /* An optional title to use for the error state of the indicator. Will be used for screen readers. */\n @property({ type: String }) errorTitle = msg('Error');\n\n /* Which type of loading indicator to display */\n @property({ type: String }) loadingStyle: 'ring' | 'ring-dots' = 'ring-dots';\n\n /* The state of the indicator that should be shown */\n @property({ type: String }) mode: LoadingStatus = 'loading';\n\n render(): TemplateResult {\n return html`${choose(this.mode, [\n ['ready', () => this.placeholderTemplate],\n ['loading', () => this.loadingIndicatorTemplate],\n ['success', () => this.successIndicatorTemplate],\n ['error', () => this.errorIndicatorTemplate],\n ])}`;\n }\n\n /** A placeholder to render before loading begins, if desired */\n private get placeholderTemplate(): TemplateResult {\n return html`<div class=\"placeholder\"></div>`;\n }\n\n /** A circular loading indicator to render when processing */\n private get loadingIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"loading-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.loadingTitle}</title>\n <g stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n class=\"loading-ring\"\n d=\"M60,10 C69.8019971,10 78.9452178,12.8205573 86.6623125,17.6943223 L76.4086287,27.9484118 C71.4880919,25.4243078 65.9103784,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 C96,53.3014663 94.1704984,47.0302355 90.9839104,41.6587228 L101.110332,31.5326452 C106.715332,39.6116982 110,49.4222615 110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <g\n class=\"loading-dots ${!this.shouldShowLoadingDots ? 'hidden' : ''}\"\n transform=\"translate(40.000000, 55.000000)\"\n >\n <circle id=\"left-dot\" cx=\"5\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"middle-dot\" cx=\"20\" cy=\"5\" r=\"5\"></circle>\n <circle id=\"right-dot\" cx=\"35\" cy=\"5\" r=\"5\"></circle>\n </g>\n </g>\n </svg>\n `;\n }\n\n /** A check mark to render on success */\n private get successIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"success-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.successTitle}</title>\n <g stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n class=\"success-icon\"\n d=\"M60,10 C70.5816709,10 80.3955961,13.2871104 88.4763646,18.8959201 L78.3502633,29.0214223 C72.9767592,25.8315427 66.7022695,24 60,24 C40.117749,24 24,40.117749 24,60 C24,79.882251 40.117749,96 60,96 C79.882251,96 96,79.882251 96,60 L95.995,59.46 L108.327675,47.128668 C109.350926,50.9806166 109.925886,55.015198 109.993301,59.1731586 L110,60 C110,87.6142375 87.6142375,110 60,110 C32.3857625,110 10,87.6142375 10,60 C10,32.3857625 32.3857625,10 60,10 Z\"\n ></path>\n <polygon\n class=\"success-icon\"\n transform=\"translate(75.000000, 41.500000) rotate(44.000000) translate(-75.000000, -41.500000) \"\n points=\"96 85 54 85 54 65 76 64.999 76 -2 96 -2\"\n ></polygon>\n </g>\n </svg>\n `;\n }\n\n /** An \"!\" to render on error */\n private get errorIndicatorTemplate(): TemplateResult {\n return html`\n <svg\n class=\"error-indicator\"\n viewBox=\"0 0 120 120\"\n preserveAspectRatio=\"none\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n role=\"status\"\n >\n <title>${this.errorTitle}</title>\n <path\n class=\"error-icon\"\n d=\"m56.4612493 8.80450354 41.8901185 75.94632926c1.7706782 2.8433173 2.1150372 5.2623412 1.0330766 7.2570716-1.0819604 1.9947304-3.26978 2.9920956-6.5634587 2.9920956h-85.69973905c-3.29367873 0-5.46954894-.9973652-6.52761065-2.9920956-1.0580617-1.9947304-.70175345-4.4137543 1.06892476-7.2570716l41.89011844-75.12308969c1.8184757-2.84331737 3.9693609-4.37738627 6.4526556-4.60220671s4.6341799 1.03483527 6.4526556 3.77896714zm28.5387507 75.19549646-35.037482-62-34.962518 62zm-31-34.7484359v-10.2515641h-8v10.2515641l2.089172 14.7484359h3.8184713zm-8 19.7484359v8h8v-8z\"\n />\n </svg>\n `;\n }\n\n /* Whether to include the dots in the loading indicator */\n private get shouldShowLoadingDots(): boolean {\n if (this.loadingStyle === 'ring') return false;\n\n return true;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --indicator-width--: var(--icon-width);\n\n /* Loading */\n --loading-ring-color--: var(--primary-text-color);\n --loading-dot-color--: var(--primary-text-color);\n\n /* Success */\n --success-icon-color--: var(--color-success);\n\n /* Error */\n --error-icon-color--: var(--color-danger);\n\n display: inline-block;\n width: var(--indicator-width--);\n }\n\n .placeholder {\n height: var(--indicator-width--);\n }\n\n .success-icon {\n fill: var(--success-icon-color--);\n }\n\n .error-icon {\n fill: var(--error-icon-color--);\n }\n\n .loading-ring {\n fill: var(--loading-ring-color--);\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n }\n\n .loading-dots {\n fill: var(--loading-dot-color--);\n transition: opacity 0.25s ease-out;\n }\n\n .loading-dots.hidden {\n display: none;\n }\n\n .loading-dots > * {\n opacity: 0;\n animation: dot 1.3s infinite;\n }\n\n .loading-dots #left-dot {\n animation-delay: 0.2s;\n }\n\n .loading-dots #middle-dot {\n animation-delay: 0.4s;\n }\n\n .loading-dots #right-dot {\n animation-delay: 0.6s;\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n 100% {\n /* This frame is supposed to be inferred, but Safari doesn't rotate it unless we're explicit */\n transform: rotate(0deg);\n }\n }\n\n @keyframes dot {\n 0% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from './ia-button/ia-button';
|
|
2
|
-
export * from './ia-combo-box/ia-combo-box';
|
|
1
|
+
export * from './ia-button/ia-button.js';
|
|
2
|
+
export * from './ia-combo-box/ia-combo-box.js';
|
|
3
|
+
export * from './ia-dropdown-search-bar/ia-dropdown-search-bar.js';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iDAAiD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from './ia-button/ia-button';
|
|
2
|
-
export * from './ia-combo-box/ia-combo-box';
|
|
1
|
+
export * from './ia-button/ia-button.js';
|
|
2
|
+
export * from './ia-combo-box/ia-combo-box.js';
|
|
3
|
+
export * from './ia-dropdown-search-bar/ia-dropdown-search-bar.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './ia-button/ia-button';\nexport * from './ia-combo-box/ia-combo-box';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iDAAiD,CAAC","sourcesContent":["export * from './ia-button/ia-button';\nexport * from './ia-combo-box/ia-combo-box';\nexport * from './ia-dropdown-search-bar/ia-dropdown-search-bar';\n"]}
|
|
@@ -4,7 +4,7 @@ import { property } from 'lit/decorators.js';
|
|
|
4
4
|
import { customElement } from 'lit/decorators/custom-element.js';
|
|
5
5
|
import { state } from 'lit/decorators/state.js';
|
|
6
6
|
import flakeIcon from './flake.svg';
|
|
7
|
-
import { lazyLoadTemplate, } from '../../util/lazy-load-template';
|
|
7
|
+
import { lazyLoadTemplate, } from '../../util/lazy-load-template.js';
|
|
8
8
|
/**
|
|
9
9
|
* An element that shows snowflakes to demo the elements library
|
|
10
10
|
*/
|
|
@@ -34,7 +34,7 @@ let IASnow = class IASnow extends LitElement {
|
|
|
34
34
|
// example, but it demonstrates the lazy loading pattern.
|
|
35
35
|
get startButtonTemplate() {
|
|
36
36
|
return lazyLoadTemplate(async () => {
|
|
37
|
-
await import('../../elements/ia-button/ia-button');
|
|
37
|
+
await import('../../elements/ia-button/ia-button.js');
|
|
38
38
|
}, () => html `
|
|
39
39
|
<ia-button
|
|
40
40
|
@click=${() => {
|
|
@@ -52,7 +52,7 @@ let IASnow = class IASnow extends LitElement {
|
|
|
52
52
|
}
|
|
53
53
|
get clearButtonTemplate() {
|
|
54
54
|
return lazyLoadTemplate(async () => {
|
|
55
|
-
await import('../../elements/ia-button/ia-button');
|
|
55
|
+
await import('../../elements/ia-button/ia-button.js');
|
|
56
56
|
}, () => html `
|
|
57
57
|
<ia-button
|
|
58
58
|
@click=${() => {
|
|
@@ -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,yBAoKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -14,13 +14,29 @@ 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-width: auto;
|
|
18
|
+
--default-search-bar-height: 30px;
|
|
19
|
+
--default-button-padding: 0 1.875rem; /* 0 30px with 16px root font size */
|
|
20
|
+
--default-button-height: 2.25rem; /* 36px with 16px root font size */
|
|
21
|
+
--default-button-width: fit-content;
|
|
22
|
+
--default-button-border-width: 1px;
|
|
23
|
+
--default-button-border-radius: 0.25rem; /* 4px with 16px root font size */
|
|
24
|
+
--default-font-size-standard: 0.875rem; /* 14px with 16px root font size */
|
|
25
|
+
--default-font-size-lg: 2.25rem; /* 36px with 16px root font size */
|
|
17
26
|
|
|
18
27
|
/* Colors */
|
|
19
28
|
--true-white: #fff;
|
|
20
29
|
--off-white: #fbfbfd;
|
|
21
30
|
--dark-gray: #2c2c2c;
|
|
31
|
+
--mid-gray: #333;
|
|
22
32
|
--light-gray: #666;
|
|
33
|
+
--lighter-gray: #999;
|
|
34
|
+
--lightest-gray: #c5d1df;
|
|
23
35
|
--classic-red: #e51c23;
|
|
36
|
+
--brick: #d43f3a;
|
|
37
|
+
--coral: #d9534f;
|
|
38
|
+
--dark-cantaloupe: #ec7939;
|
|
39
|
+
--cantaloupe: #ee8950;
|
|
24
40
|
--mint-green: #31a481;
|
|
25
41
|
--navy-blue: #194880;
|
|
26
42
|
--bright-blue: #4b64ff;
|
|
@@ -45,10 +61,40 @@ const themeStyles = css `
|
|
|
45
61
|
/* Sizing */
|
|
46
62
|
--icon-width: var(--ia-theme-icon-width, var(--default-icon-width));
|
|
47
63
|
--padding-sm: var(--ia-theme-padding-sm, var(--default-padding-sm));
|
|
64
|
+
--search-bar-height: var(
|
|
65
|
+
--ia-theme-search-bar-height,
|
|
66
|
+
var(--default-search-bar-height)
|
|
67
|
+
);
|
|
68
|
+
--search-bar-width: var(
|
|
69
|
+
--ia-theme-search-bar-width,
|
|
70
|
+
var(--default-search-bar-width)
|
|
71
|
+
);
|
|
48
72
|
--combo-box-width: var(
|
|
49
73
|
--ia-theme-combo-box-width,
|
|
50
74
|
var(--default-combo-box-width)
|
|
51
75
|
);
|
|
76
|
+
--button-padding: var(
|
|
77
|
+
--ia-theme-button-padding,
|
|
78
|
+
var(--default-button-padding)
|
|
79
|
+
);
|
|
80
|
+
--button-height: var(
|
|
81
|
+
--ia-theme-button-height,
|
|
82
|
+
var(--default-button-height)
|
|
83
|
+
);
|
|
84
|
+
--button-width: var(--ia-theme-button-width, var(--default-button-width));
|
|
85
|
+
--button-border-width: var(
|
|
86
|
+
--ia-theme-button-border-width,
|
|
87
|
+
var(--default-button-border-width)
|
|
88
|
+
);
|
|
89
|
+
--button-border-radius: var(
|
|
90
|
+
--ia-theme-button-border-radius,
|
|
91
|
+
var(--default-button-border-radius)
|
|
92
|
+
);
|
|
93
|
+
--font-size-standard: var(
|
|
94
|
+
--ia-theme-font-size-standard,
|
|
95
|
+
var(--default-font-size-standard)
|
|
96
|
+
);
|
|
97
|
+
--font-size-lg: var(--ia-theme-font-size-lg, var(--default-font-size-lg));
|
|
52
98
|
|
|
53
99
|
/* Backgrounds and fills */
|
|
54
100
|
--primary-background-color: var(
|
|
@@ -61,11 +107,59 @@ const themeStyles = css `
|
|
|
61
107
|
);
|
|
62
108
|
|
|
63
109
|
/* State colors */
|
|
110
|
+
/* Primary */
|
|
64
111
|
--primary-cta-fill: var(--ia-theme-primary-cta-fill, var(--navy-blue));
|
|
65
112
|
--primary-cta-text-color: var(
|
|
66
113
|
--ia-theme-primary-cta-text-color,
|
|
67
114
|
var(--true-white)
|
|
68
115
|
);
|
|
116
|
+
--primary-cta-border: var(
|
|
117
|
+
--ia-theme-primary-cta-border,
|
|
118
|
+
var(--lightest-gray)
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
/* Secondary */
|
|
122
|
+
--secondary-cta-text-color: var(
|
|
123
|
+
--ia-theme-secondary-cta-text-color,
|
|
124
|
+
var(--true-white)
|
|
125
|
+
);
|
|
126
|
+
--secondary-cta-fill: var(--ia-theme-secondary-cta-fill, var(--mid-gray));
|
|
127
|
+
--secondary-cta-border: var(
|
|
128
|
+
--ia-theme-secondary-cta-border,
|
|
129
|
+
var(--lighter-gray)
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
/* Danger */
|
|
133
|
+
--danger-cta-text-color: var(
|
|
134
|
+
--ia-theme-danger-cta-text-color,
|
|
135
|
+
var(--true-white)
|
|
136
|
+
);
|
|
137
|
+
--danger-cta-fill: var(--ia-theme-danger-cta-fill, var(--coral));
|
|
138
|
+
--danger-cta-border: var(--ia-theme-danger-cta-border, var(--brick));
|
|
139
|
+
|
|
140
|
+
/* Warning */
|
|
141
|
+
--warning-cta-text-color: var(
|
|
142
|
+
--ia-theme-warning-cta-text-color,
|
|
143
|
+
var(--true-white)
|
|
144
|
+
);
|
|
145
|
+
--warning-cta-fill: var(--ia-theme-warning-cta-fill, var(--cantaloupe));
|
|
146
|
+
--warning-cta-border: var(
|
|
147
|
+
--ia-theme-warning-cta-border,
|
|
148
|
+
var(--dark-cantaloupe)
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
/* Disabled */
|
|
152
|
+
--disabled-cta-text-color: var(
|
|
153
|
+
--ia-theme-disabled-cta-text-color,
|
|
154
|
+
var(--true-white)
|
|
155
|
+
);
|
|
156
|
+
--disabled-cta-fill: var(--ia-theme-disabled-cta-fill, var(--light-gray));
|
|
157
|
+
--disabled-cta-border: var(
|
|
158
|
+
--ia-theme-disabled-cta-border,
|
|
159
|
+
var(--lighter-gray)
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
/* Standalone colors */
|
|
69
163
|
--color-success: var(--ia-theme-color-success, var(--mint-green));
|
|
70
164
|
--color-danger: var(--ia-theme-color-danger, var(--classic-red));
|
|
71
165
|
}
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKtB,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-width: auto;\n --default-search-bar-height: 30px;\n --default-button-padding: 0 1.875rem; /* 0 30px with 16px root font size */\n --default-button-height: 2.25rem; /* 36px with 16px root font size */\n --default-button-width: fit-content;\n --default-button-border-width: 1px;\n --default-button-border-radius: 0.25rem; /* 4px with 16px root font size */\n --default-font-size-standard: 0.875rem; /* 14px with 16px root font size */\n --default-font-size-lg: 2.25rem; /* 36px with 16px root font size */\n\n /* Colors */\n --true-white: #fff;\n --off-white: #fbfbfd;\n --dark-gray: #2c2c2c;\n --mid-gray: #333;\n --light-gray: #666;\n --lighter-gray: #999;\n --lightest-gray: #c5d1df;\n --classic-red: #e51c23;\n --brick: #d43f3a;\n --coral: #d9534f;\n --dark-cantaloupe: #ec7939;\n --cantaloupe: #ee8950;\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 --button-padding: var(\n --ia-theme-button-padding,\n var(--default-button-padding)\n );\n --button-height: var(\n --ia-theme-button-height,\n var(--default-button-height)\n );\n --button-width: var(--ia-theme-button-width, var(--default-button-width));\n --button-border-width: var(\n --ia-theme-button-border-width,\n var(--default-button-border-width)\n );\n --button-border-radius: var(\n --ia-theme-button-border-radius,\n var(--default-button-border-radius)\n );\n --font-size-standard: var(\n --ia-theme-font-size-standard,\n var(--default-font-size-standard)\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 */\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 --primary-cta-border: var(\n --ia-theme-primary-cta-border,\n var(--lightest-gray)\n );\n\n /* Secondary */\n --secondary-cta-text-color: var(\n --ia-theme-secondary-cta-text-color,\n var(--true-white)\n );\n --secondary-cta-fill: var(--ia-theme-secondary-cta-fill, var(--mid-gray));\n --secondary-cta-border: var(\n --ia-theme-secondary-cta-border,\n var(--lighter-gray)\n );\n\n /* Danger */\n --danger-cta-text-color: var(\n --ia-theme-danger-cta-text-color,\n var(--true-white)\n );\n --danger-cta-fill: var(--ia-theme-danger-cta-fill, var(--coral));\n --danger-cta-border: var(--ia-theme-danger-cta-border, var(--brick));\n\n /* Warning */\n --warning-cta-text-color: var(\n --ia-theme-warning-cta-text-color,\n var(--true-white)\n );\n --warning-cta-fill: var(--ia-theme-warning-cta-fill, var(--cantaloupe));\n --warning-cta-border: var(\n --ia-theme-warning-cta-border,\n var(--dark-cantaloupe)\n );\n\n /* Disabled */\n --disabled-cta-text-color: var(\n --ia-theme-disabled-cta-text-color,\n var(--true-white)\n );\n --disabled-cta-fill: var(--ia-theme-disabled-cta-fill, var(--light-gray));\n --disabled-cta-border: var(\n --ia-theme-disabled-cta-border,\n var(--lighter-gray)\n );\n\n /* Standalone colors */\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"]}
|