@spectric/ui 0.0.18 → 0.0.19
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/dist/components/Button.d.ts +2 -1
- package/dist/components/Panel.d.ts +6 -3
- package/dist/components/calendar/calendar.d.ts +58 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/color_picker/ColorPicker.d.ts +7 -6
- package/dist/components/index.d.ts +1 -0
- package/dist/components/input.d.ts +24 -20
- package/dist/components/query_bar/QueryBar.d.ts +2 -1
- package/dist/components/table/table.d.ts +3 -0
- package/dist/components/tooltip/popover.d.ts +32 -2
- package/dist/components/tooltip/tooltip.d.ts +1 -32
- package/dist/custom-elements.json +59 -14
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +2842 -2564
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +298 -178
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Button.ts +14 -13
- package/src/components/Panel.ts +25 -18
- package/src/components/button.css.ts +13 -0
- package/src/components/calendar/calendar.css +50 -0
- package/src/components/calendar/calendar.ts +281 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/color_picker/ColorPicker.css +36 -3
- package/src/components/color_picker/ColorPicker.ts +46 -15
- package/src/components/index.ts +2 -1
- package/src/components/input.css +1 -1
- package/src/components/input.ts +203 -142
- package/src/components/panel.css.ts +7 -5
- package/src/components/query_bar/QueryBar.css +6 -2
- package/src/components/query_bar/QueryBar.ts +25 -13
- package/src/components/table/table.ts +43 -35
- package/src/components/table/virtualBody.ts +3 -2
- package/src/components/tooltip/popover.ts +70 -30
- package/src/components/tooltip/tooltip.css +7 -2
- package/src/components/tooltip/tooltip.ts +3 -37
- package/src/stories/Calendar.stories.ts +70 -0
- package/src/stories/fixtures/ExampleContent.ts +1 -1
- package/src/stories/tooltip.stories.ts +9 -2
package/src/components/input.ts
CHANGED
|
@@ -1,69 +1,75 @@
|
|
|
1
|
-
import { html, LitElement, PropertyValues, TemplateResult } from
|
|
2
|
-
import "./input.css"
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
|
2
|
+
import "./input.css";
|
|
3
|
+
import {
|
|
4
|
+
customElement,
|
|
5
|
+
eventOptions,
|
|
6
|
+
property,
|
|
7
|
+
query,
|
|
8
|
+
} from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import { ReactElementWithPropsAndEvents } from "./types";
|
|
11
|
+
import { ButtonSizesTypes } from "./Button";
|
|
12
|
+
import { DomEvent } from "./table";
|
|
13
|
+
import { SpectricColorPicker } from "./color_picker/ColorPicker";
|
|
14
|
+
import { PopoverElement } from "./tooltip/popover";
|
|
9
15
|
|
|
10
16
|
export enum InputVariants {
|
|
11
|
-
Text =
|
|
12
|
-
TextArea =
|
|
13
|
-
number =
|
|
17
|
+
Text = "text",
|
|
18
|
+
TextArea = "text-area",
|
|
19
|
+
number = "number",
|
|
14
20
|
//checkbox = "checkbox",
|
|
15
21
|
color = "color",
|
|
16
|
-
date = "date"
|
|
17
|
-
|
|
22
|
+
date = "date", //replace default eventually with custom
|
|
23
|
+
datePopup = "popup-date",
|
|
24
|
+
datetime = "datetime-local", //replace default eventually with custom
|
|
18
25
|
email = "email",
|
|
19
|
-
file = "file"
|
|
20
|
-
hidden = "hidden"
|
|
26
|
+
file = "file", //display drop area
|
|
27
|
+
hidden = "hidden", //display drop area
|
|
21
28
|
password = "password",
|
|
22
29
|
checkbox = "checkbox",
|
|
23
|
-
range = "range"
|
|
24
|
-
|
|
30
|
+
range = "range",
|
|
25
31
|
}
|
|
26
|
-
type InputVariantsTypes = `${InputVariants}
|
|
32
|
+
type InputVariantsTypes = `${InputVariants}`;
|
|
27
33
|
export interface InputProps {
|
|
28
34
|
/** Input type */
|
|
29
35
|
variant?: InputVariantsTypes;
|
|
30
36
|
/**Label to display above the input */
|
|
31
|
-
label?: string
|
|
37
|
+
label?: string;
|
|
32
38
|
/**placeholder text to display*/
|
|
33
|
-
placeholder?: string
|
|
39
|
+
placeholder?: string;
|
|
34
40
|
/* should be disabled?*/
|
|
35
|
-
disabled?: boolean
|
|
41
|
+
disabled?: boolean;
|
|
36
42
|
/* should be readonly*/
|
|
37
|
-
readonly?: boolean
|
|
43
|
+
readonly?: boolean;
|
|
38
44
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
* The helper text.
|
|
46
|
+
*/
|
|
41
47
|
|
|
42
|
-
helperText?: string
|
|
48
|
+
helperText?: string;
|
|
43
49
|
/**
|
|
44
50
|
* Specify if the currently value is invalid.
|
|
45
51
|
*/
|
|
46
|
-
invalid?: boolean
|
|
52
|
+
invalid?: boolean;
|
|
47
53
|
/**
|
|
48
54
|
* Message which is displayed if the value is invalid.
|
|
49
55
|
*/
|
|
50
|
-
invalidText?: string | TemplateResult<1
|
|
56
|
+
invalidText?: string | TemplateResult<1>;
|
|
51
57
|
/**
|
|
52
58
|
* Max character count allowed for input. This is needed in order for enableCounter to display
|
|
53
59
|
*/
|
|
54
|
-
maxCount?: number
|
|
60
|
+
maxCount?: number;
|
|
55
61
|
/**
|
|
56
|
-
* Boolean property to set the required status
|
|
57
|
-
*/
|
|
58
|
-
required?: boolean
|
|
62
|
+
* Boolean property to set the required status
|
|
63
|
+
*/
|
|
64
|
+
required?: boolean;
|
|
59
65
|
/**
|
|
60
|
-
* Shows a button to display the password
|
|
61
|
-
*/
|
|
66
|
+
* Shows a button to display the password
|
|
67
|
+
*/
|
|
62
68
|
showPasswordVisibilityToggle?: boolean;
|
|
63
69
|
|
|
64
70
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
* Name for the input used for form data events //TODO make sure this works
|
|
72
|
+
*/
|
|
67
73
|
name?: string;
|
|
68
74
|
|
|
69
75
|
/**
|
|
@@ -74,16 +80,17 @@ export interface InputProps {
|
|
|
74
80
|
/**
|
|
75
81
|
* The sets the autocomplete for the input.
|
|
76
82
|
*/
|
|
77
|
-
autocomplete?: HTMLInputElement[
|
|
83
|
+
autocomplete?: HTMLInputElement["autocomplete"];
|
|
78
84
|
}
|
|
79
|
-
@customElement(
|
|
85
|
+
@customElement("spectric-input")
|
|
80
86
|
export class SpectricInput extends LitElement implements InputProps {
|
|
81
87
|
@property({ type: Boolean, reflect: true })
|
|
82
88
|
checked?: boolean;
|
|
83
89
|
size?: ButtonSizesTypes;
|
|
90
|
+
files: FileList | null = null;
|
|
84
91
|
//static styles?: CSSResultGroup | undefined = style;
|
|
85
92
|
protected createRenderRoot(): HTMLElement | DocumentFragment {
|
|
86
|
-
return this
|
|
93
|
+
return this;
|
|
87
94
|
}
|
|
88
95
|
@property({ type: String, reflect: true })
|
|
89
96
|
placeholder: string = "";
|
|
@@ -97,16 +104,16 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
97
104
|
label: string = "";
|
|
98
105
|
|
|
99
106
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
* "Hide password" tooltip text on password visibility toggle
|
|
108
|
+
*/
|
|
102
109
|
@property()
|
|
103
|
-
hidePasswordLabel =
|
|
110
|
+
hidePasswordLabel = "Hide";
|
|
104
111
|
|
|
105
112
|
/**
|
|
106
113
|
* "Show password" tooltip text on password visibility toggle
|
|
107
114
|
*/
|
|
108
115
|
@property()
|
|
109
|
-
showPasswordLabel =
|
|
116
|
+
showPasswordLabel = "Show";
|
|
110
117
|
|
|
111
118
|
/**
|
|
112
119
|
* Boolean property to render password visibility toggle
|
|
@@ -121,7 +128,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
121
128
|
* The helper text.
|
|
122
129
|
*/
|
|
123
130
|
@property({ type: String, reflect: true })
|
|
124
|
-
helperText =
|
|
131
|
+
helperText = "";
|
|
125
132
|
|
|
126
133
|
/**
|
|
127
134
|
* Specify if the currently value is invalid.
|
|
@@ -138,35 +145,35 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
138
145
|
* Message which is displayed if the value is invalid.
|
|
139
146
|
*/
|
|
140
147
|
@property({ type: String, reflect: true })
|
|
141
|
-
invalidText: InputProps["invalidText"] =
|
|
148
|
+
invalidText: InputProps["invalidText"] = "";
|
|
142
149
|
/**
|
|
143
150
|
* Name for the input used for form data events //TODO make sure this works
|
|
144
151
|
*/
|
|
145
152
|
@property()
|
|
146
|
-
name =
|
|
153
|
+
name = "";
|
|
147
154
|
|
|
148
155
|
/**
|
|
149
156
|
* Pattern to validate the input against for HTML validity checking
|
|
150
157
|
*/
|
|
151
158
|
@property()
|
|
152
|
-
pattern =
|
|
159
|
+
pattern = "";
|
|
153
160
|
@property({ type: Number, reflect: true })
|
|
154
161
|
maxCount: number = 0;
|
|
155
162
|
/**
|
|
156
|
-
* The internal value.
|
|
157
|
-
*/
|
|
158
|
-
protected _value: string | boolean | number =
|
|
163
|
+
* The internal value.
|
|
164
|
+
*/
|
|
165
|
+
protected _value: string | boolean | number = "";
|
|
159
166
|
private _showPassword: boolean = false;
|
|
160
167
|
/**
|
|
161
168
|
* The sets the autocomplete for the input.
|
|
162
169
|
*/
|
|
163
170
|
@property({ reflect: true })
|
|
164
|
-
autocomplete: HTMLInputElement[
|
|
171
|
+
autocomplete: HTMLInputElement["autocomplete"] = "off";
|
|
165
172
|
get selectionStart() {
|
|
166
173
|
if (!this._input) {
|
|
167
|
-
return null
|
|
174
|
+
return null;
|
|
168
175
|
}
|
|
169
|
-
return this._input.selectionStart
|
|
176
|
+
return this._input.selectionStart;
|
|
170
177
|
}
|
|
171
178
|
/**
|
|
172
179
|
* The value of the input.
|
|
@@ -176,7 +183,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
176
183
|
//pull directly from the input
|
|
177
184
|
if (this._input) {
|
|
178
185
|
if (this.variant == InputVariants.number) {
|
|
179
|
-
return parseFloat(this._input.value)
|
|
186
|
+
return parseFloat(this._input.value);
|
|
180
187
|
}
|
|
181
188
|
return this._input.value;
|
|
182
189
|
}
|
|
@@ -187,7 +194,7 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
187
194
|
set value(value) {
|
|
188
195
|
const oldValue = this._value;
|
|
189
196
|
this._value = value;
|
|
190
|
-
this.requestUpdate(
|
|
197
|
+
this.requestUpdate("value", oldValue);
|
|
191
198
|
// we set the value directly on the input (when available)
|
|
192
199
|
// so that programatic manipulation updates the UI correctly
|
|
193
200
|
if (this._input) {
|
|
@@ -196,51 +203,72 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
196
203
|
}
|
|
197
204
|
blur(): void {
|
|
198
205
|
if (this._input) {
|
|
199
|
-
this._input.blur()
|
|
206
|
+
this._input.blur();
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
focus(options?: FocusOptions): void {
|
|
203
210
|
if (this._input) {
|
|
204
211
|
//Sometimes the input will get auto focused after a modal closes but the cursor isn't set. we need to blur then refocus to get the cursor
|
|
205
|
-
this._input.blur()
|
|
206
|
-
this._input.focus(options)
|
|
212
|
+
this._input.blur();
|
|
213
|
+
this._input.focus(options);
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
|
-
setSelectionRange(
|
|
216
|
+
setSelectionRange(
|
|
217
|
+
start: number,
|
|
218
|
+
end: number,
|
|
219
|
+
direction: "forward" | "backward" | "none" = "none"
|
|
220
|
+
) {
|
|
210
221
|
if (!this._input) {
|
|
211
|
-
return
|
|
222
|
+
return;
|
|
212
223
|
}
|
|
213
|
-
this._input.setSelectionRange(start, end, direction)
|
|
224
|
+
this._input.setSelectionRange(start, end, direction);
|
|
214
225
|
}
|
|
215
226
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
protected _handleInput = ({ target }:
|
|
219
|
-
const input =
|
|
220
|
-
this.
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
* Handles `oninput` event on the `<input>`.
|
|
228
|
+
*/
|
|
229
|
+
protected _handleInput = ({ target }: DomEvent<HTMLInputElement>) => {
|
|
230
|
+
const input = target;
|
|
231
|
+
if (this.variant == InputVariants.file) {
|
|
232
|
+
this.files = input.files;
|
|
233
|
+
} else {
|
|
234
|
+
this.value = input.value;
|
|
235
|
+
}
|
|
236
|
+
this.invalid = !input.validity.valid;
|
|
237
|
+
};
|
|
223
238
|
/**
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
@query(
|
|
239
|
+
* The underlying input element
|
|
240
|
+
*/
|
|
241
|
+
@query("input")
|
|
227
242
|
protected _input?: HTMLInputElement;
|
|
228
243
|
|
|
229
244
|
private handleTogglePasswordVisibility = () => {
|
|
230
245
|
this._showPassword = !this._showPassword;
|
|
231
|
-
this.requestUpdate()
|
|
232
|
-
}
|
|
246
|
+
this.requestUpdate();
|
|
247
|
+
};
|
|
233
248
|
protected updated(changedProperties: PropertyValues): void {
|
|
234
249
|
if (changedProperties.has("checked")) {
|
|
235
|
-
this.dispatchEvent(new Event("change", { bubbles: true }))
|
|
250
|
+
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
236
251
|
}
|
|
237
252
|
}
|
|
238
253
|
@eventOptions({ capture: true })
|
|
239
|
-
_handleChange(e:
|
|
240
|
-
e.stopPropagation()
|
|
241
|
-
this.
|
|
254
|
+
_handleChange(e: DomEvent<HTMLInputElement | SpectricColorPicker>) {
|
|
255
|
+
e.stopPropagation();
|
|
256
|
+
if (this.variant === InputVariants.file) {
|
|
257
|
+
this.files = (e.target as HTMLInputElement).files;
|
|
258
|
+
} else {
|
|
259
|
+
this.value = e.target.value;
|
|
260
|
+
}
|
|
261
|
+
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
242
262
|
}
|
|
243
263
|
protected render(): unknown {
|
|
264
|
+
const calendar = html`<spectric-calendar
|
|
265
|
+
.popup=${this.variant === InputVariants.datePopup}
|
|
266
|
+
@select=${(e: CustomEvent<Date>) => {
|
|
267
|
+
this.value = e.detail.toISOString();
|
|
268
|
+
this.querySelector<PopoverElement>("spectric-popover")?.hidePopover()
|
|
269
|
+
}
|
|
270
|
+
}>
|
|
271
|
+
</spectric-calendar>`
|
|
244
272
|
switch (this.variant) {
|
|
245
273
|
case InputVariants.Text:
|
|
246
274
|
case InputVariants.password:
|
|
@@ -248,88 +276,118 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
248
276
|
//case InputVariants.checkbox:
|
|
249
277
|
case InputVariants.email:
|
|
250
278
|
//cases below should be replaces with a custom input for uniformity across browsers
|
|
251
|
-
case InputVariants.date
|
|
252
|
-
case InputVariants.
|
|
253
|
-
case InputVariants.
|
|
279
|
+
case InputVariants.date: //replace with custom date picker
|
|
280
|
+
case InputVariants.datePopup: //replace with custom date picker
|
|
281
|
+
case InputVariants.datetime: //replace with custom date picker
|
|
282
|
+
case InputVariants.file: //replace with drag and drop location and custom select file button
|
|
254
283
|
case InputVariants.range:
|
|
255
284
|
return html`
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
<div class="inputWrapper">
|
|
286
|
+
<div class="text-input__label-helper-wrapper">
|
|
287
|
+
<div class="--text-input__label-wrapper">
|
|
288
|
+
${this.label}
|
|
289
|
+
${this.maxCount > 0 && this._value
|
|
290
|
+
? `${(this._value as String).length}/${this.maxCount}`
|
|
291
|
+
: null}
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
<div class="fieldwrapper">
|
|
295
|
+
<div ?data-invalid="${this.invalid}" class="inputContainer">
|
|
296
|
+
${this.variant === "date" ? calendar : null}
|
|
297
|
+
<input
|
|
298
|
+
?data-invalid="${this.invalid}"
|
|
299
|
+
?disabled="${this.disabled}"
|
|
300
|
+
aria-describedby="helper-text"
|
|
301
|
+
id="input"
|
|
302
|
+
name="${ifNonEmpty(this.name)}"
|
|
303
|
+
pattern="${ifNonEmpty(this.pattern)}"
|
|
304
|
+
placeholder="${ifNonEmpty(this.placeholder)}"
|
|
305
|
+
autocomplete="${ifNonEmpty(this.autocomplete)}"
|
|
306
|
+
?readonly="${this.readonly}"
|
|
307
|
+
?required="${this.required}"
|
|
308
|
+
type="${ifNonEmpty(
|
|
309
|
+
this.variant !== InputVariants.password
|
|
310
|
+
? this.variant !== InputVariants.date ? this.variant : InputVariants.Text
|
|
311
|
+
: this._showPassword
|
|
312
|
+
? InputVariants.Text
|
|
313
|
+
: InputVariants.password
|
|
314
|
+
)}"
|
|
315
|
+
.value="${this._value as string}"
|
|
316
|
+
maxlength="${ifNonEmpty(
|
|
317
|
+
this.maxCount > 0 ? this.maxCount : undefined
|
|
318
|
+
)}"
|
|
319
|
+
@input="${this._handleInput}"
|
|
320
|
+
@change=${this._handleChange}
|
|
321
|
+
/>
|
|
322
|
+
|
|
323
|
+
${this.variant === String(InputVariants.datePopup) ? calendar : null}
|
|
324
|
+
${this.variant === String(InputVariants.password) &&
|
|
325
|
+
this.showPasswordVisibilityToggle
|
|
286
326
|
? html`
|
|
287
|
-
|
|
327
|
+
<spectric-button
|
|
328
|
+
icon
|
|
329
|
+
class="input-button-right"
|
|
288
330
|
size="small"
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
331
|
+
type="button"
|
|
332
|
+
?disabled="${this.disabled}"
|
|
333
|
+
@click=${this.handleTogglePasswordVisibility}
|
|
334
|
+
>
|
|
335
|
+
${this._showPassword
|
|
336
|
+
? this.hidePasswordLabel
|
|
337
|
+
: this.showPasswordLabel}
|
|
338
|
+
</spectric-button>
|
|
339
|
+
`
|
|
295
340
|
: null}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
341
|
+
</div>
|
|
342
|
+
<div
|
|
343
|
+
id="helper-text"
|
|
344
|
+
class="${this.helperText || this.invalid ? "" : "hidden"}"
|
|
345
|
+
>
|
|
346
|
+
<slot name="helper-text">
|
|
347
|
+
${this.invalid ? this.invalidText : this.helperText}
|
|
348
|
+
</slot>
|
|
304
349
|
</div>
|
|
305
350
|
</div>
|
|
306
|
-
|
|
351
|
+
</div>
|
|
352
|
+
`;
|
|
307
353
|
|
|
308
354
|
case InputVariants.color: //replace with custom color picker
|
|
309
355
|
return html`<div class="inputWrapper">
|
|
310
356
|
<div class="text-input__label-helper-wrapper">
|
|
311
357
|
<div class="--text-input__label-wrapper">
|
|
312
|
-
${this.label} ${this.maxCount > 0 && this._value
|
|
358
|
+
${this.label} ${this.maxCount > 0 && this._value
|
|
359
|
+
? `${(this._value as String).length}/${this.maxCount}`
|
|
360
|
+
: null
|
|
361
|
+
}
|
|
313
362
|
</div>
|
|
314
363
|
</div>
|
|
315
364
|
<div class="fieldwrapper">
|
|
316
365
|
<div ?data-invalid="${this.invalid}" class="inputContainer">
|
|
317
|
-
<
|
|
366
|
+
<input type="hidden" .value=${String(this.value)} > </input>
|
|
367
|
+
<spectric-colorpicker
|
|
368
|
+
@cancel=${(e: DomEvent<SpectricColorPicker>) => {
|
|
369
|
+
this.value = e.target.value;
|
|
370
|
+
}}
|
|
371
|
+
@change=${(e: DomEvent<SpectricColorPicker>) => {
|
|
372
|
+
e.stopPropagation();
|
|
373
|
+
this.value = e.target.value;
|
|
374
|
+
this._handleChange(e);
|
|
375
|
+
}} .value=${String(this.value)}></spectric-colorpicker>
|
|
318
376
|
</div>
|
|
319
377
|
<div
|
|
320
378
|
id="helper-text"
|
|
321
379
|
class="${this.helperText || this.invalid ? "" : "hidden"}"
|
|
322
380
|
>
|
|
323
|
-
<slot name="helper-text"> ${this.invalid ? this.invalidText : this.helperText
|
|
381
|
+
<slot name="helper-text"> ${this.invalid ? this.invalidText : this.helperText
|
|
382
|
+
} </slot>
|
|
324
383
|
</div>
|
|
325
384
|
|
|
326
385
|
</div>
|
|
327
|
-
</div
|
|
386
|
+
</div>`;
|
|
328
387
|
case InputVariants.hidden:
|
|
329
|
-
return html`<input type="hidden"
|
|
388
|
+
return html`<input type="hidden" />`;
|
|
330
389
|
|
|
331
390
|
case InputVariants.checkbox:
|
|
332
|
-
|
|
333
391
|
return html`
|
|
334
392
|
<div class="checkbox">
|
|
335
393
|
<spectric-button
|
|
@@ -337,32 +395,33 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
337
395
|
@click=${() => {
|
|
338
396
|
this.checked = !this.checked;
|
|
339
397
|
this.value = Boolean(this.checked);
|
|
340
|
-
}} icon size=${this.size || "xxsmall"} variant=${this.checked ? "primary" : "secondary"
|
|
398
|
+
}} icon size=${this.size || "xxsmall"} variant=${this.checked ? "primary" : "secondary"
|
|
399
|
+
}>${this.checked ? "✓" : "\u00A0"}</spectric-button>
|
|
341
400
|
|
|
342
401
|
${this.label}
|
|
343
402
|
</div>
|
|
344
403
|
</label>
|
|
345
|
-
|
|
404
|
+
`;
|
|
346
405
|
default:
|
|
347
406
|
break;
|
|
348
407
|
}
|
|
349
|
-
return `Not yet implemented ${this.variant}
|
|
408
|
+
return `Not yet implemented ${this.variant}`;
|
|
350
409
|
}
|
|
351
410
|
}
|
|
352
411
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
412
|
declare global {
|
|
357
413
|
interface HTMLElementTagNameMap {
|
|
358
|
-
"spectric-input": SpectricInput
|
|
414
|
+
"spectric-input": SpectricInput;
|
|
359
415
|
}
|
|
360
416
|
namespace JSX {
|
|
361
417
|
interface IntrinsicElements {
|
|
362
418
|
/**
|
|
363
419
|
* {@link SpectricInput}
|
|
364
420
|
*/
|
|
365
|
-
"spectric-input": ReactElementWithPropsAndEvents<
|
|
421
|
+
"spectric-input": ReactElementWithPropsAndEvents<
|
|
422
|
+
SpectricInput,
|
|
423
|
+
InputProps
|
|
424
|
+
>;
|
|
366
425
|
}
|
|
367
426
|
}
|
|
368
427
|
namespace React {
|
|
@@ -371,12 +430,14 @@ declare global {
|
|
|
371
430
|
/**
|
|
372
431
|
* {@link SpectricInput}
|
|
373
432
|
*/
|
|
374
|
-
"spectric-input": ReactElementWithPropsAndEvents<
|
|
433
|
+
"spectric-input": ReactElementWithPropsAndEvents<
|
|
434
|
+
SpectricInput,
|
|
435
|
+
InputProps
|
|
436
|
+
>;
|
|
375
437
|
}
|
|
376
438
|
}
|
|
377
439
|
}
|
|
378
440
|
}
|
|
379
441
|
|
|
380
|
-
|
|
381
442
|
const ifNonEmpty = (value: any) =>
|
|
382
|
-
ifDefined(value ===
|
|
443
|
+
ifDefined(value === "" ? undefined : value ?? undefined);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
|
|
3
3
|
const even = css`
|
|
4
|
+
--panel-color: var(--spectric-background,#f4f4f4);
|
|
5
|
+
--panel-color-inverse: var(--spectric-background-inverse,#ffffff);
|
|
4
6
|
border-color: color-mix(in hsl, var(--panel-color, #0b0b0b), var(--spectric-input-color, #000000) 3%);
|
|
5
7
|
background-color: var(--panel-color,#0b0b0b);
|
|
6
|
-
--spectric-input-color: var(--
|
|
8
|
+
--spectric-input-color: var(--panel-color-inverse);
|
|
7
9
|
color:var(--text-secondary,#3c4c5b);
|
|
8
|
-
--spectric-text-primary:var(--text-primary);
|
|
9
|
-
--spectric-text-secondary:var(--text-secondary);
|
|
10
|
+
--spectric-text-primary:var(--text-primary,#161616);
|
|
11
|
+
--spectric-text-secondary:var(--text-secondary,#525252);
|
|
10
12
|
filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-secondary, #3c4c5b), transparent 50%));
|
|
11
13
|
`
|
|
12
14
|
const odd = css`
|
|
@@ -14,8 +16,8 @@ const odd = css`
|
|
|
14
16
|
background-color: var(--panel-color-inverse,#0b0b0b);
|
|
15
17
|
color:var(--text-primary,#3c4c5b);
|
|
16
18
|
--spectric-input-color: var(--panel-color);
|
|
17
|
-
--spectric-text-primary:var(--text-secondary);
|
|
18
|
-
--spectric-text-secondary:var(--text-primary);
|
|
19
|
+
--spectric-text-primary:var(--text-secondary,#525252);
|
|
20
|
+
--spectric-text-secondary:var(--text-primary,#161616);
|
|
19
21
|
filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-primary, #3c4c5b), transparent 70%));
|
|
20
22
|
`
|
|
21
23
|
export default css`
|
|
@@ -12,14 +12,18 @@ spectric-query .autocomplete {
|
|
|
12
12
|
max-height: 300px;
|
|
13
13
|
border-top: 0px;
|
|
14
14
|
margin: 0px;
|
|
15
|
-
margin-top: -18px;
|
|
16
15
|
/*Input helper text is 18px we can cover that with the popover*/
|
|
17
16
|
position: fixed;
|
|
18
17
|
top: anchor(bottom);
|
|
19
18
|
justify-self: anchor-center;
|
|
20
19
|
text-align: center;
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
spectric-query .autocomplete [popover]{
|
|
22
|
+
overflow: visible;
|
|
23
|
+
}
|
|
24
|
+
spectric-query .autocomplete .tooltip-content{
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
23
27
|
spectric-query .autocomplete .optiontype {
|
|
24
28
|
float: left;
|
|
25
29
|
max-width: 10px;
|