@solid-design-system/components 1.22.0 → 1.24.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/dist/components/es/carousel.js +3 -3
- package/dist/components/es/checkbox.js +1 -11
- package/dist/components/es/event.js +1 -1
- package/dist/components/es/input.js +1 -0
- package/dist/components/es/interactive.js +1 -0
- package/dist/components/es/live.js +11 -0
- package/dist/components/es/radio-group.js +1 -1
- package/dist/components/es/radio.js +1 -1
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/es/solid-element.js +1 -1
- package/dist/components/es/tooltip.js +4 -0
- package/dist/components/umd/solid-components.js +23 -20
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/icon/library.system.d.ts +9 -1
- package/dist/package/components/icon/library.system.js +52 -9
- package/dist/package/components/input/input.d.ts +76 -0
- package/dist/package/components/input/input.js +390 -0
- package/dist/package/components/radio/radio.js +1 -3
- package/dist/package/components/radio-group/radio-group.js +7 -8
- package/dist/package/components/tooltip/tooltip.d.ts +39 -0
- package/dist/package/components/tooltip/tooltip.js +233 -0
- package/dist/package/internal/animate.js +11 -0
- package/dist/package/solid-components.d.ts +2 -0
- package/dist/package/solid-components.js +22 -18
- package/dist/package/styles/form-control.styles.d.ts +2 -0
- package/dist/package/styles/form-control.styles.js +5 -0
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -11
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/event.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/icon.js +1 -1
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +1 -0
- package/dist/versioned-components/es/interactive.js +1 -0
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/live.js +11 -0
- package/dist/versioned-components/es/navigation-item.js +1 -1
- package/dist/versioned-components/es/popup.js +1 -1
- package/dist/versioned-components/es/radio-group.js +1 -1
- package/dist/versioned-components/es/radio.js +1 -1
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/solid-element.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/tooltip.js +4 -0
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +4 -4
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/divider/divider.d.ts +1 -1
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +6 -6
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/icon/library.system.d.ts +9 -1
- package/dist/versioned-package/components/icon/library.system.js +52 -9
- package/dist/versioned-package/components/include/include.d.ts +1 -1
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +76 -0
- package/dist/versioned-package/components/input/input.js +390 -0
- package/dist/versioned-package/components/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +3 -5
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +20 -21
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +39 -0
- package/dist/versioned-package/components/tooltip/tooltip.js +233 -0
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/animate.js +11 -0
- package/dist/versioned-package/internal/form.js +2 -2
- package/dist/versioned-package/solid-components.d.ts +2 -0
- package/dist/versioned-package/solid-components.js +22 -18
- package/dist/versioned-package/styles/form-control.styles.d.ts +2 -0
- package/dist/versioned-package/styles/form-control.styles.js +5 -0
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +705 -23
- package/dist/web-types.json +772 -1
- package/package.json +5 -5
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import '../icon/icon';
|
|
2
|
+
import { FormControlController } from '../../internal/form';
|
|
3
|
+
import SolidElement from '../../internal/solid-element';
|
|
4
|
+
import type { SolidFormControl } from '../../internal/solid-element';
|
|
5
|
+
export default class SdInput extends SolidElement implements SolidFormControl {
|
|
6
|
+
protected readonly formControlController: FormControlController;
|
|
7
|
+
private readonly hasSlotController;
|
|
8
|
+
private readonly localize;
|
|
9
|
+
input: HTMLInputElement;
|
|
10
|
+
private hasFocus;
|
|
11
|
+
type: 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
|
|
12
|
+
size: 'lg' | 'md' | 'sm';
|
|
13
|
+
inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
14
|
+
value: string;
|
|
15
|
+
defaultValue: string;
|
|
16
|
+
placeholder: string;
|
|
17
|
+
label: string;
|
|
18
|
+
helpText: string;
|
|
19
|
+
clearable: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
readonly: boolean;
|
|
22
|
+
passwordToggle: boolean;
|
|
23
|
+
passwordVisible: boolean;
|
|
24
|
+
noSpinButtons: boolean;
|
|
25
|
+
minlength: number;
|
|
26
|
+
maxlength: number;
|
|
27
|
+
min: number;
|
|
28
|
+
max: number;
|
|
29
|
+
form: string;
|
|
30
|
+
name: string;
|
|
31
|
+
title: string;
|
|
32
|
+
required: boolean;
|
|
33
|
+
pattern: string;
|
|
34
|
+
step: number | 'any';
|
|
35
|
+
autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
36
|
+
autocorrect: 'off' | 'on';
|
|
37
|
+
autocomplete: string;
|
|
38
|
+
autofocus: boolean;
|
|
39
|
+
enterkeyhint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
40
|
+
spellcheck: boolean;
|
|
41
|
+
get valueAsDate(): Date | null;
|
|
42
|
+
set valueAsDate(newValue: Date | null);
|
|
43
|
+
get valueAsNumber(): number;
|
|
44
|
+
set valueAsNumber(newValue: number);
|
|
45
|
+
get validity(): ValidityState;
|
|
46
|
+
firstUpdated(): void;
|
|
47
|
+
private handleBlur;
|
|
48
|
+
private handleChange;
|
|
49
|
+
private handleClearClick;
|
|
50
|
+
private handleFocus;
|
|
51
|
+
private handleInput;
|
|
52
|
+
private handleInvalid;
|
|
53
|
+
private handleKeyDown;
|
|
54
|
+
private handlePasswordToggle;
|
|
55
|
+
handleDisabledChange(): void;
|
|
56
|
+
handleStepChange(): void;
|
|
57
|
+
handleValueChange(): Promise<void>;
|
|
58
|
+
focus(options?: FocusOptions): void;
|
|
59
|
+
blur(): void;
|
|
60
|
+
select(): void;
|
|
61
|
+
setSelectionRange(selectionStart: number, selectionEnd: number, selectionDirection?: 'forward' | 'backward' | 'none'): void;
|
|
62
|
+
setRangeText(replacement: string, start?: number, end?: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void;
|
|
63
|
+
showPicker(): void;
|
|
64
|
+
stepUp(): void;
|
|
65
|
+
stepDown(): void;
|
|
66
|
+
checkValidity(): boolean;
|
|
67
|
+
reportValidity(): boolean;
|
|
68
|
+
setCustomValidity(message: string): void;
|
|
69
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
70
|
+
static styles: import("lit").CSSResultGroup[];
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface HTMLElementTagNameMap {
|
|
74
|
+
'sd-1-24-0-input': SdInput;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import "../icon/icon.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { customElement } from "../../internal/register-custom-element.js";
|
|
5
|
+
import { defaultValue } from "../../internal/default-value.js";
|
|
6
|
+
import { FormControlController } from "../../internal/form.js";
|
|
7
|
+
import { HasSlotController } from "../../internal/slot.js";
|
|
8
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import { live } from "lit/directives/live.js";
|
|
10
|
+
import { LocalizeController } from "../../utilities/localize.js";
|
|
11
|
+
import { query, state, property } from "lit/decorators.js";
|
|
12
|
+
import { watch } from "../../internal/watch.js";
|
|
13
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
14
|
+
import cx from "classix";
|
|
15
|
+
import formControlStyles from "../../styles/form-control.styles.js";
|
|
16
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result)
|
|
25
|
+
__defProp(target, key, result);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
const isChromium = (_a = navigator.userAgentData) == null ? void 0 : _a.brands.some((b) => b.brand.includes("Chromium"));
|
|
29
|
+
const isFirefox = isChromium ? false : navigator.userAgent.includes("Firefox");
|
|
30
|
+
let SdInput = class extends SolidElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.formControlController = new FormControlController(this);
|
|
34
|
+
this.hasSlotController = new HasSlotController(
|
|
35
|
+
this,
|
|
36
|
+
"help-text",
|
|
37
|
+
"label",
|
|
38
|
+
"left",
|
|
39
|
+
"right",
|
|
40
|
+
"message",
|
|
41
|
+
"placeholder"
|
|
42
|
+
);
|
|
43
|
+
this.localize = new LocalizeController(this);
|
|
44
|
+
this.hasFocus = false;
|
|
45
|
+
this.type = "text";
|
|
46
|
+
this.size = "lg";
|
|
47
|
+
this.value = "";
|
|
48
|
+
this.defaultValue = "";
|
|
49
|
+
this.placeholder = "";
|
|
50
|
+
this.label = "";
|
|
51
|
+
this.helpText = "";
|
|
52
|
+
this.clearable = false;
|
|
53
|
+
this.disabled = false;
|
|
54
|
+
this.readonly = false;
|
|
55
|
+
this.passwordToggle = false;
|
|
56
|
+
this.passwordVisible = false;
|
|
57
|
+
this.noSpinButtons = false;
|
|
58
|
+
this.form = "";
|
|
59
|
+
this.name = "";
|
|
60
|
+
this.title = "";
|
|
61
|
+
this.required = false;
|
|
62
|
+
this.spellcheck = true;
|
|
63
|
+
}
|
|
64
|
+
/** Gets or sets the current value as a `Date` object. Returns `null` if the value can't be converted. */
|
|
65
|
+
get valueAsDate() {
|
|
66
|
+
var _a2;
|
|
67
|
+
return ((_a2 = this.input) == null ? void 0 : _a2.valueAsDate) ?? null;
|
|
68
|
+
}
|
|
69
|
+
set valueAsDate(newValue) {
|
|
70
|
+
const input = document.createElement("input");
|
|
71
|
+
input.type = "date";
|
|
72
|
+
input.valueAsDate = newValue;
|
|
73
|
+
this.value = input.value;
|
|
74
|
+
}
|
|
75
|
+
/** Gets or sets the current value as a number. Returns `NaN` if the value can't be converted. */
|
|
76
|
+
get valueAsNumber() {
|
|
77
|
+
var _a2;
|
|
78
|
+
return ((_a2 = this.input) == null ? void 0 : _a2.valueAsNumber) ?? parseFloat(this.value);
|
|
79
|
+
}
|
|
80
|
+
set valueAsNumber(newValue) {
|
|
81
|
+
const input = document.createElement("input");
|
|
82
|
+
input.type = "number";
|
|
83
|
+
input.valueAsNumber = newValue;
|
|
84
|
+
this.value = input.value;
|
|
85
|
+
}
|
|
86
|
+
/** Gets the validity state object */
|
|
87
|
+
get validity() {
|
|
88
|
+
return this.input.validity;
|
|
89
|
+
}
|
|
90
|
+
firstUpdated() {
|
|
91
|
+
this.formControlController.updateValidity();
|
|
92
|
+
}
|
|
93
|
+
handleBlur() {
|
|
94
|
+
this.hasFocus = false;
|
|
95
|
+
this.emit("sd-blur");
|
|
96
|
+
}
|
|
97
|
+
handleChange() {
|
|
98
|
+
this.value = this.input.value;
|
|
99
|
+
this.emit("sd-change");
|
|
100
|
+
}
|
|
101
|
+
handleClearClick(event) {
|
|
102
|
+
this.value = "";
|
|
103
|
+
this.emit("sd-clear");
|
|
104
|
+
this.emit("sd-1-24-0-input");
|
|
105
|
+
this.emit("sd-change");
|
|
106
|
+
this.input.focus();
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
}
|
|
109
|
+
handleFocus() {
|
|
110
|
+
this.hasFocus = true;
|
|
111
|
+
this.emit("sd-focus");
|
|
112
|
+
}
|
|
113
|
+
handleInput() {
|
|
114
|
+
this.value = this.input.value;
|
|
115
|
+
this.formControlController.updateValidity();
|
|
116
|
+
this.emit("sd-1-24-0-input");
|
|
117
|
+
}
|
|
118
|
+
handleInvalid() {
|
|
119
|
+
this.formControlController.setValidity(false);
|
|
120
|
+
}
|
|
121
|
+
handleKeyDown(event) {
|
|
122
|
+
const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
|
123
|
+
if (event.key === "Enter" && !hasModifier) {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
if (!event.defaultPrevented && !event.isComposing) {
|
|
126
|
+
this.formControlController.submit();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
handlePasswordToggle() {
|
|
132
|
+
this.passwordVisible = !this.passwordVisible;
|
|
133
|
+
}
|
|
134
|
+
handleDisabledChange() {
|
|
135
|
+
this.formControlController.setValidity(this.disabled);
|
|
136
|
+
}
|
|
137
|
+
handleStepChange() {
|
|
138
|
+
this.input.step = String(this.step);
|
|
139
|
+
this.formControlController.updateValidity();
|
|
140
|
+
}
|
|
141
|
+
async handleValueChange() {
|
|
142
|
+
await this.updateComplete;
|
|
143
|
+
this.formControlController.updateValidity();
|
|
144
|
+
}
|
|
145
|
+
/** Sets focus on the input. */
|
|
146
|
+
focus(options) {
|
|
147
|
+
this.input.focus(options);
|
|
148
|
+
}
|
|
149
|
+
/** Removes focus from the input. */
|
|
150
|
+
blur() {
|
|
151
|
+
this.input.blur();
|
|
152
|
+
}
|
|
153
|
+
/** Selects all the text in the input. */
|
|
154
|
+
select() {
|
|
155
|
+
this.input.select();
|
|
156
|
+
}
|
|
157
|
+
/** Sets the start and end positions of the text selection (0-based). */
|
|
158
|
+
setSelectionRange(selectionStart, selectionEnd, selectionDirection = "none") {
|
|
159
|
+
this.input.setSelectionRange(selectionStart, selectionEnd, selectionDirection);
|
|
160
|
+
}
|
|
161
|
+
/** Replaces a range of text with a new string. */
|
|
162
|
+
setRangeText(replacement, start, end, selectMode) {
|
|
163
|
+
this.input.setRangeText(replacement, start, end, selectMode);
|
|
164
|
+
if (this.value !== this.input.value) {
|
|
165
|
+
this.value = this.input.value;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
|
|
169
|
+
showPicker() {
|
|
170
|
+
if ("showPicker" in HTMLInputElement.prototype) {
|
|
171
|
+
this.input.showPicker();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/** Increments the value of a numeric input type by the value of the step attribute. */
|
|
175
|
+
stepUp() {
|
|
176
|
+
this.input.stepUp();
|
|
177
|
+
if (this.value !== this.input.value) {
|
|
178
|
+
this.value = this.input.value;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** Decrements the value of a numeric input type by the value of the step attribute. */
|
|
182
|
+
stepDown() {
|
|
183
|
+
this.input.stepDown();
|
|
184
|
+
if (this.value !== this.input.value) {
|
|
185
|
+
this.value = this.input.value;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** Checks for validity but does not show the browser's validation message. */
|
|
189
|
+
checkValidity() {
|
|
190
|
+
var _a2;
|
|
191
|
+
return (_a2 = this.input) == null ? void 0 : _a2.checkValidity();
|
|
192
|
+
}
|
|
193
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
194
|
+
reportValidity() {
|
|
195
|
+
return this.input.reportValidity();
|
|
196
|
+
}
|
|
197
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
198
|
+
setCustomValidity(message) {
|
|
199
|
+
this.input.setCustomValidity(message);
|
|
200
|
+
this.formControlController.updateValidity();
|
|
201
|
+
}
|
|
202
|
+
render() {
|
|
203
|
+
const slots = {
|
|
204
|
+
label: this.hasSlotController.test("label"),
|
|
205
|
+
helpText: this.hasSlotController.test("help-text"),
|
|
206
|
+
description: this.hasSlotController.test("description"),
|
|
207
|
+
left: this.hasSlotController.test("left"),
|
|
208
|
+
right: this.hasSlotController.test("right")
|
|
209
|
+
};
|
|
210
|
+
const hasLabel = this.label ? true : !!slots["label"];
|
|
211
|
+
const hasHelpText = this.helpText ? true : !!slots["helpText"];
|
|
212
|
+
const hasClearIcon = this.clearable && !this.readonly && (typeof this.value === "number" || this.value.length > 0);
|
|
213
|
+
const hasValidationAttr = this.required || !!this.pattern || !!this.minlength || !!this.maxlength;
|
|
214
|
+
const isInvalid = hasValidationAttr && !this.checkValidity();
|
|
215
|
+
const isValid = hasValidationAttr && this.checkValidity();
|
|
216
|
+
const inputState = this.disabled ? "disabled" : this.readonly ? "readonly" : this.hasFocus && isInvalid ? "activeInvalid" : this.hasFocus && isValid ? "activeValid" : this.hasFocus ? "active" : isInvalid ? "invalid" : isValid ? "valid" : "default";
|
|
217
|
+
const textSize = this.size === "sm" ? "text-sm" : "text-base";
|
|
218
|
+
const textColor = {
|
|
219
|
+
disabled: "text-neutral-500",
|
|
220
|
+
readonly: "text-black",
|
|
221
|
+
activeInvalid: "text-error",
|
|
222
|
+
activeValid: "text-success",
|
|
223
|
+
active: "text-black",
|
|
224
|
+
invalid: "text-error",
|
|
225
|
+
valid: "text-success",
|
|
226
|
+
default: "text-black"
|
|
227
|
+
}[inputState];
|
|
228
|
+
const borderColor = {
|
|
229
|
+
disabled: "border-neutral-500",
|
|
230
|
+
readonly: "border-neutral-800",
|
|
231
|
+
activeInvalid: "border-error border-2",
|
|
232
|
+
activeValid: "border-success border-2",
|
|
233
|
+
active: "border-primary border-2",
|
|
234
|
+
invalid: "border-error",
|
|
235
|
+
valid: "border-success",
|
|
236
|
+
default: "border-neutral-800"
|
|
237
|
+
}[inputState];
|
|
238
|
+
const iconColor = this.disabled ? "text-neutral-500" : "text-primary";
|
|
239
|
+
const iconMarginLeft = { sm: "ml-1", md: "ml-2", lg: "ml-2" }[this.size];
|
|
240
|
+
const iconSize = {
|
|
241
|
+
sm: "text-base",
|
|
242
|
+
md: "text-lg",
|
|
243
|
+
lg: "text-xl"
|
|
244
|
+
}[this.size];
|
|
245
|
+
return html`<div part="form-control" class="${cx("form-control", hasLabel && "form-control--has-label", this.disabled && "pointer-events-none")}"><label part="form-control-label" class="${cx("form-control-label mb-2", hasLabel ? "inline-block" : "hidden", textSize)}" for="input" aria-hidden="${hasLabel ? "false" : "true"}"><slot name="label">${this.label}${this.required ? "*" : ""}</slot></label><div part="form-control-input" class="form-control-input relative w-full"><div part="border" class="${cx(
|
|
246
|
+
"absolute w-full h-full pointer-events-none border rounded-default transition-all",
|
|
247
|
+
borderColor
|
|
248
|
+
)}"></div><div part="base" class="${cx(
|
|
249
|
+
"px-4 flex flex-row items-center rounded-default transition-all",
|
|
250
|
+
// Vertical Padding
|
|
251
|
+
this.size === "lg" ? "py-2" : "py-1",
|
|
252
|
+
// States
|
|
253
|
+
!this.disabled && !this.readonly ? "hover:bg-neutral-200" : "",
|
|
254
|
+
this.readonly && "bg-neutral-100",
|
|
255
|
+
isInvalid && "form-control-input--invalid",
|
|
256
|
+
textColor,
|
|
257
|
+
!this.value && "input--empty",
|
|
258
|
+
this.noSpinButtons && "input--no-spin-buttons",
|
|
259
|
+
isFirefox && "input--is-firefox"
|
|
260
|
+
)}">${slots["left"] ? html`<slot name="left" part="left" class="${cx("inline-flex", this.size === "sm" ? "mr-1" : "mr-2", iconColor, iconSize)}"></slot>` : ""} <input part="input" id="input" class="${cx(
|
|
261
|
+
"min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700",
|
|
262
|
+
this.size === "sm" ? "h-6" : "h-8",
|
|
263
|
+
textSize
|
|
264
|
+
)}" type="${this.type === "password" && this.passwordVisible ? "text" : this.type}" title="${this.title}" name="${ifDefined(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" .value="${live(this.value)}" autocapitalize="${ifDefined(this.type === "password" ? "off" : this.autocapitalize)}" autocomplete="${ifDefined(this.type === "password" ? "off" : this.autocomplete)}" autocorrect="${ifDefined(this.type === "password" ? "off" : this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("flex justify-center ", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-1-24-0-icon class="${cx("text-neutral-500", iconSize)}" library="system" name="closing-round"></sd-1-24-0-icon></slot></button>` : ""} ${this.passwordToggle && this.type === "password" ? html`<button aria-label="${this.localize.term(this.passwordVisible ? "hidePassword" : "showPassword")}" part="password-toggle-button" class="flex items-center" type="button" @click="${this.handlePasswordToggle}" tabindex="-1">${this.passwordVisible ? html`<slot name="show-password-icon"><sd-1-24-0-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye"></sd-1-24-0-icon></slot>` : html`<slot name="hide-password-icon"><sd-1-24-0-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye-crossed-out"></sd-1-24-0-icon></slot>`}</button>` : ""} ${(this.type === "date" || this.type === "datetime-local") && !isFirefox ? html`<sd-1-24-0-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="calendar"></sd-1-24-0-icon>` : ""} ${this.type === "time" ? html`<sd-1-24-0-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="clock"></sd-1-24-0-icon>` : ""} ${isInvalid ? html`<sd-1-24-0-icon class="${cx("text-error", iconMarginLeft, iconSize)}" library="system" name="risk"></sd-1-24-0-icon>` : ""} ${isValid ? html`<sd-1-24-0-icon class="${cx("text-success", iconMarginLeft, iconSize)}" library="system" name="confirm"></sd-1-24-0-icon>` : ""} ${slots["right"] ? html`<slot name="right" part="right" class="${cx("inline-flex", iconColor, iconMarginLeft, iconSize)}"></slot>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${hasHelpText ? "false" : "true"}">${this.helpText}</slot></div>`;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
SdInput.styles = [
|
|
268
|
+
componentStyles,
|
|
269
|
+
formControlStyles,
|
|
270
|
+
SolidElement.styles,
|
|
271
|
+
css`:host{box-sizing:border-box;position:relative;display:inline-block;text-align:left;width:100%}:host([vertical]){display:block}details summary::-webkit-details-marker{display:none}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{display:none}input[type=time]::-webkit-calendar-picker-indicator{background:0 0}input[type=date]::-webkit-calendar-picker-indicator{display:none}input[type=datetime-local]::-webkit-calendar-picker-indicator{display:none}`
|
|
272
|
+
];
|
|
273
|
+
__decorateClass([
|
|
274
|
+
query("#input")
|
|
275
|
+
], SdInput.prototype, "input", 2);
|
|
276
|
+
__decorateClass([
|
|
277
|
+
state()
|
|
278
|
+
], SdInput.prototype, "hasFocus", 2);
|
|
279
|
+
__decorateClass([
|
|
280
|
+
property({ reflect: true })
|
|
281
|
+
], SdInput.prototype, "type", 2);
|
|
282
|
+
__decorateClass([
|
|
283
|
+
property({ reflect: true })
|
|
284
|
+
], SdInput.prototype, "size", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property()
|
|
287
|
+
], SdInput.prototype, "inputmode", 2);
|
|
288
|
+
__decorateClass([
|
|
289
|
+
property()
|
|
290
|
+
], SdInput.prototype, "value", 2);
|
|
291
|
+
__decorateClass([
|
|
292
|
+
defaultValue()
|
|
293
|
+
], SdInput.prototype, "defaultValue", 2);
|
|
294
|
+
__decorateClass([
|
|
295
|
+
property()
|
|
296
|
+
], SdInput.prototype, "placeholder", 2);
|
|
297
|
+
__decorateClass([
|
|
298
|
+
property()
|
|
299
|
+
], SdInput.prototype, "label", 2);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
property({ attribute: "help-text" })
|
|
302
|
+
], SdInput.prototype, "helpText", 2);
|
|
303
|
+
__decorateClass([
|
|
304
|
+
property({ type: Boolean })
|
|
305
|
+
], SdInput.prototype, "clearable", 2);
|
|
306
|
+
__decorateClass([
|
|
307
|
+
property({ type: Boolean, reflect: true })
|
|
308
|
+
], SdInput.prototype, "disabled", 2);
|
|
309
|
+
__decorateClass([
|
|
310
|
+
property({ type: Boolean, reflect: true })
|
|
311
|
+
], SdInput.prototype, "readonly", 2);
|
|
312
|
+
__decorateClass([
|
|
313
|
+
property({ attribute: "password-toggle", type: Boolean })
|
|
314
|
+
], SdInput.prototype, "passwordToggle", 2);
|
|
315
|
+
__decorateClass([
|
|
316
|
+
property({ attribute: "password-visible", type: Boolean })
|
|
317
|
+
], SdInput.prototype, "passwordVisible", 2);
|
|
318
|
+
__decorateClass([
|
|
319
|
+
property({ attribute: "no-spin-buttons", type: Boolean })
|
|
320
|
+
], SdInput.prototype, "noSpinButtons", 2);
|
|
321
|
+
__decorateClass([
|
|
322
|
+
property({ type: Number })
|
|
323
|
+
], SdInput.prototype, "minlength", 2);
|
|
324
|
+
__decorateClass([
|
|
325
|
+
property({ type: Number })
|
|
326
|
+
], SdInput.prototype, "maxlength", 2);
|
|
327
|
+
__decorateClass([
|
|
328
|
+
property({ type: Number })
|
|
329
|
+
], SdInput.prototype, "min", 2);
|
|
330
|
+
__decorateClass([
|
|
331
|
+
property({ type: Number })
|
|
332
|
+
], SdInput.prototype, "max", 2);
|
|
333
|
+
__decorateClass([
|
|
334
|
+
property({ reflect: true })
|
|
335
|
+
], SdInput.prototype, "form", 2);
|
|
336
|
+
__decorateClass([
|
|
337
|
+
property()
|
|
338
|
+
], SdInput.prototype, "name", 2);
|
|
339
|
+
__decorateClass([
|
|
340
|
+
property()
|
|
341
|
+
], SdInput.prototype, "title", 2);
|
|
342
|
+
__decorateClass([
|
|
343
|
+
property({ type: Boolean, reflect: true })
|
|
344
|
+
], SdInput.prototype, "required", 2);
|
|
345
|
+
__decorateClass([
|
|
346
|
+
property()
|
|
347
|
+
], SdInput.prototype, "pattern", 2);
|
|
348
|
+
__decorateClass([
|
|
349
|
+
property()
|
|
350
|
+
], SdInput.prototype, "step", 2);
|
|
351
|
+
__decorateClass([
|
|
352
|
+
property()
|
|
353
|
+
], SdInput.prototype, "autocapitalize", 2);
|
|
354
|
+
__decorateClass([
|
|
355
|
+
property()
|
|
356
|
+
], SdInput.prototype, "autocorrect", 2);
|
|
357
|
+
__decorateClass([
|
|
358
|
+
property()
|
|
359
|
+
], SdInput.prototype, "autocomplete", 2);
|
|
360
|
+
__decorateClass([
|
|
361
|
+
property({ type: Boolean })
|
|
362
|
+
], SdInput.prototype, "autofocus", 2);
|
|
363
|
+
__decorateClass([
|
|
364
|
+
property()
|
|
365
|
+
], SdInput.prototype, "enterkeyhint", 2);
|
|
366
|
+
__decorateClass([
|
|
367
|
+
property({
|
|
368
|
+
type: Boolean,
|
|
369
|
+
converter: {
|
|
370
|
+
// Allow "true|false" attribute values but keep the property boolean
|
|
371
|
+
fromAttribute: (value) => !value || value === "false" ? false : true,
|
|
372
|
+
toAttribute: (value) => value ? "true" : "false"
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
], SdInput.prototype, "spellcheck", 2);
|
|
376
|
+
__decorateClass([
|
|
377
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
378
|
+
], SdInput.prototype, "handleDisabledChange", 1);
|
|
379
|
+
__decorateClass([
|
|
380
|
+
watch("step", { waitUntilFirstUpdate: true })
|
|
381
|
+
], SdInput.prototype, "handleStepChange", 1);
|
|
382
|
+
__decorateClass([
|
|
383
|
+
watch("value", { waitUntilFirstUpdate: true })
|
|
384
|
+
], SdInput.prototype, "handleValueChange", 1);
|
|
385
|
+
SdInput = __decorateClass([
|
|
386
|
+
customElement("sd-1-24-0-input")
|
|
387
|
+
], SdInput);
|
|
388
|
+
export {
|
|
389
|
+
SdInput as default
|
|
390
|
+
};
|
|
@@ -77,7 +77,7 @@ let SdLink = class extends SolidElement {
|
|
|
77
77
|
};
|
|
78
78
|
SdLink.styles = [
|
|
79
79
|
SolidElement.styles,
|
|
80
|
-
css`::slotted(sd-1-
|
|
80
|
+
css`::slotted(sd-1-24-0-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-1-24-0-icon){font-size:1rem}:host([size=lg][standalone]) ::slotted(sd-1-24-0-icon){font-size:1.5rem}`
|
|
81
81
|
];
|
|
82
82
|
__decorateClass([
|
|
83
83
|
query("a")
|
|
@@ -101,7 +101,7 @@ __decorateClass([
|
|
|
101
101
|
property()
|
|
102
102
|
], SdLink.prototype, "download", 2);
|
|
103
103
|
SdLink = __decorateClass([
|
|
104
|
-
customElement("sd-1-
|
|
104
|
+
customElement("sd-1-24-0-link")
|
|
105
105
|
], SdLink);
|
|
106
106
|
export {
|
|
107
107
|
SdLink as default
|
|
@@ -105,10 +105,10 @@ let SdNavigationItem = class extends SolidElement {
|
|
|
105
105
|
isAccordion ? "grow" : "w-full",
|
|
106
106
|
slots["description"] ? "pb-1" : horizontalPaddingBottom,
|
|
107
107
|
this.calculatePaddingX()
|
|
108
|
-
)}">${this.divider && this.vertical ? html`<sd-1-
|
|
108
|
+
)}">${this.divider && this.vertical ? html`<sd-1-24-0-divider part="divider" class="${cx("w-full transition-all absolute -top-[1px] left-0", this.calculatePaddingX())}"></sd-1-24-0-divider>` : ""} <span class="inline-flex items-center flex-auto"><slot part="content" class="inline"></slot></span>${(this.chevron || slots["children"]) && this.vertical ? html`<sd-1-24-0-icon name="chevron-down" part="chevron" library="system" color="currentColor" class="${cx(
|
|
109
109
|
"h-6 w-6 ml-2 transition-all",
|
|
110
110
|
isAccordion ? this.open ? "rotate-180" : "rotate-0" : "rotate-[270deg]"
|
|
111
|
-
)}"></sd-1-
|
|
111
|
+
)}"></sd-1-24-0-icon>` : ""} </span>${slots["description"] && this.vertical ? html`<slot name="description" part="description" class="${cx(
|
|
112
112
|
"inline-block text-sm text-left text-black",
|
|
113
113
|
isAccordion ? "grow" : "w-full",
|
|
114
114
|
horizontalPaddingBottom,
|
|
@@ -159,7 +159,7 @@ __decorateClass([
|
|
|
159
159
|
property({ type: Boolean, reflect: true })
|
|
160
160
|
], SdNavigationItem.prototype, "open", 2);
|
|
161
161
|
SdNavigationItem = __decorateClass([
|
|
162
|
-
customElement("sd-1-
|
|
162
|
+
customElement("sd-1-24-0-navigation-item")
|
|
163
163
|
], SdNavigationItem);
|
|
164
164
|
export {
|
|
165
165
|
SdNavigationItem as default
|
|
@@ -312,7 +312,7 @@ __decorateClass([
|
|
|
312
312
|
property({ attribute: "auto-size-padding", type: Number })
|
|
313
313
|
], SdPopup.prototype, "autoSizePadding", 2);
|
|
314
314
|
SdPopup = __decorateClass([
|
|
315
|
-
customElement("sd-1-
|
|
315
|
+
customElement("sd-1-24-0-popup")
|
|
316
316
|
], SdPopup);
|
|
317
317
|
export {
|
|
318
318
|
SdPopup as default
|
|
@@ -73,10 +73,8 @@ let SdRadio = class extends SolidElement {
|
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
75
|
return html`<span part="base" class="${cx(
|
|
76
|
-
"sd-1-
|
|
77
|
-
this.checked && "radio--checked",
|
|
76
|
+
"sd-1-24-0-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",
|
|
78
77
|
this.disabled && "hover:cursor-not-allowed",
|
|
79
|
-
this.hasFocus && "radio--focused",
|
|
80
78
|
{
|
|
81
79
|
/* sizes, fonts */
|
|
82
80
|
sm: "small-size text-sm",
|
|
@@ -89,7 +87,7 @@ let SdRadio = class extends SolidElement {
|
|
|
89
87
|
"rounded-full inline-flex text-white border bg-accent h-2.5 w-2.5",
|
|
90
88
|
this.disabled && "bg-neutral-500" || this.invalid && "bg-error hover:bg-error-400 group-hover:bg-error-400" || this.checked && "bg-accent hover:bg-accent-550 group-hover:bg-accent-550" || "bg-neutral-800"
|
|
91
89
|
)}"></span>` : ""}</span><slot part="label" class="${cx(
|
|
92
|
-
"
|
|
90
|
+
"ml-2 select-none inline-block",
|
|
93
91
|
this.disabled && "text-neutral-500" || this.invalid && "text-error" || "text-black"
|
|
94
92
|
)}"></slot></span>`;
|
|
95
93
|
}
|
|
@@ -123,7 +121,7 @@ __decorateClass([
|
|
|
123
121
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
124
122
|
], SdRadio.prototype, "handleDisabledChange", 1);
|
|
125
123
|
SdRadio = __decorateClass([
|
|
126
|
-
customElement("sd-1-
|
|
124
|
+
customElement("sd-1-24-0-radio")
|
|
127
125
|
], SdRadio);
|
|
128
126
|
export {
|
|
129
127
|
SdRadio as default
|
|
@@ -4,7 +4,7 @@ import SolidElement from '../../internal/solid-element';
|
|
|
4
4
|
import type { SolidFormControl } from '../../internal/solid-element';
|
|
5
5
|
export default class SdRadioGroup extends SolidElement implements SolidFormControl {
|
|
6
6
|
static dependencies: {
|
|
7
|
-
'sd-1-
|
|
7
|
+
'sd-1-24-0-button-group': typeof SdButtonGroup;
|
|
8
8
|
};
|
|
9
9
|
protected readonly formControlController: FormControlController;
|
|
10
10
|
private readonly hasSlotController;
|
|
@@ -47,6 +47,6 @@ export default class SdRadioGroup extends SolidElement implements SolidFormContr
|
|
|
47
47
|
}
|
|
48
48
|
declare global {
|
|
49
49
|
interface HTMLElementTagNameMap {
|
|
50
|
-
'sd-1-
|
|
50
|
+
'sd-1-24-0-radio-group': SdRadioGroup;
|
|
51
51
|
}
|
|
52
52
|
}
|