@logosphere-ui/core 0.0.0-alpha.22 → 0.0.0-alpha.24

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.
@@ -1,212 +0,0 @@
1
- import { unsafeCSS as y, css as c, LitElement as m, nothing as o, html as u } from "lit";
2
- import { query as b, property as s, state as d, customElement as _ } from "lit/decorators.js";
3
- import { live as f } from "lit/directives/live.js";
4
- import "./formfield-CNh4mBSs.js";
5
- import "./ui-icon-Bys4HYSQ.js";
6
- const g = ".input__field{width:100%;background:transparent;border:none;outline:none;font-size:var(--font-size-sm);font-family:var(--font-family-base);color:var(--color-body-text);box-sizing:border-box;line-height:1.5}.input__field::placeholder{color:var(--color-tertiary)}.input__field:disabled{cursor:not-allowed}.input__field--default{height:16px}.input__field--large{height:24px}.input__clear-btn{border:none;background:transparent;color:var(--color-gray-400);cursor:pointer;padding:0;display:inline-flex;align-items:center;outline:none;flex-shrink:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.input__clear-btn:hover{color:var(--color-gray-600)}";
7
- var v = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (e, r, l, a) => {
8
- for (var n = a > 1 ? void 0 : a ? E(r, l) : r, p = e.length - 1, h; p >= 0; p--)
9
- (h = e[p]) && (n = (a ? h(r, l, n) : h(n)) || n);
10
- return a && n && v(r, l, n), n;
11
- };
12
- let t = class extends m {
13
- constructor() {
14
- super(...arguments), this.value = "", this.type = "text", this.placeholder = "", this.name = "", this.autocomplete = "", this.pattern = "", this.size = "default", this.variant = "default", this.label = "", this.helper = "", this.error = "", this.required = !1, this.disabled = !1, this.readonly = !1, this._internalError = "", this._showPassword = !1, this.handleInput = (e) => {
15
- const r = e.target;
16
- this.value = r.value, this._internalError && (this._internalError = "", this._inputElement.setCustomValidity("")), this.dispatchEvent(new CustomEvent("input", {
17
- bubbles: !0,
18
- composed: !0,
19
- detail: { value: this.value, originalEvent: e }
20
- }));
21
- }, this.handleChange = (e) => {
22
- const r = e.target;
23
- this.value = r.value, r.checkValidity() || (this._internalError = r.validationMessage), this.dispatchEvent(new CustomEvent("change", {
24
- bubbles: !0,
25
- composed: !0,
26
- detail: { value: this.value, originalEvent: e }
27
- }));
28
- }, this.handleKeyDown = (e) => {
29
- this.dispatchEvent(new CustomEvent("keydown", {
30
- bubbles: !0,
31
- composed: !0,
32
- detail: { key: e.key, originalEvent: e }
33
- }));
34
- }, this.handleKeyUp = (e) => {
35
- this.dispatchEvent(new CustomEvent("keyup", {
36
- bubbles: !0,
37
- composed: !0,
38
- detail: { key: e.key, originalEvent: e }
39
- }));
40
- }, this.handleClear = () => {
41
- this.value = "", this._inputElement && (this._inputElement.value = ""), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("input", {
42
- bubbles: !0,
43
- composed: !0,
44
- detail: { value: "", originalEvent: null }
45
- }));
46
- }, this.handlePasswordToggle = () => {
47
- this.disabled || (this._showPassword = !this._showPassword, this._inputElement?.focus());
48
- };
49
- }
50
- get inputElement() {
51
- return this._inputElement;
52
- }
53
- focus() {
54
- this._inputElement?.focus();
55
- }
56
- blur() {
57
- this._inputElement?.blur();
58
- }
59
- select() {
60
- this._inputElement?.select();
61
- }
62
- setSelectionRange(e, r, l) {
63
- this._inputElement?.setSelectionRange(e, r, l);
64
- }
65
- checkValidity() {
66
- return this._inputElement?.checkValidity() ?? !0;
67
- }
68
- reportValidity() {
69
- return this._inputElement?.reportValidity() ?? !0;
70
- }
71
- setCustomValidity(e) {
72
- this._inputElement?.setCustomValidity(e), this._internalError = e, this.requestUpdate();
73
- }
74
- willUpdate(e) {
75
- e.has("type") && this.type !== "password" && this._showPassword && (this._showPassword = !1);
76
- }
77
- render() {
78
- const e = this.error || this._internalError, r = !!this.value && !this.disabled && !this.readonly, l = this.type === "password", a = l && this._showPassword ? "text" : this.type, n = `input__field input__field--${this.size}`;
79
- return u`
80
- <logosphere-formfield
81
- .label=${this.label}
82
- .helper=${this.helper}
83
- .error=${e}
84
- .required=${this.required}
85
- .disabled=${this.disabled}
86
- .readonly=${this.readonly}
87
- .placeholder=${this.placeholder}
88
- .size=${this.size}
89
- .variant=${this.variant}
90
- >
91
- <slot name="prefix" slot="prefix"></slot>
92
- <input
93
- class="${n}"
94
- type=${a}
95
- .value=${f(this.value)}
96
- placeholder=${this.placeholder || o}
97
- name=${this.name || o}
98
- autocomplete=${this.autocomplete || o}
99
- ?required=${this.required}
100
- ?disabled=${this.disabled}
101
- ?readonly=${this.readonly}
102
- minlength=${this.minlength ?? o}
103
- maxlength=${this.maxlength ?? o}
104
- pattern=${this.pattern || o}
105
- min=${this.min ?? o}
106
- max=${this.max ?? o}
107
- step=${this.step ?? o}
108
- @input=${this.handleInput}
109
- @change=${this.handleChange}
110
- @keydown=${this.handleKeyDown}
111
- @keyup=${this.handleKeyUp}
112
- />
113
- ${r ? u`
114
- <button
115
- type="button"
116
- slot="clear"
117
- class="input__clear-btn"
118
- @click=${this.handleClear}
119
- tabindex="-1"
120
- >
121
- <ui-icon name="uil-times" size="14"></ui-icon>
122
- </button>
123
- ` : o}
124
- ${l ? u`
125
- <button
126
- type="button"
127
- slot="suffix"
128
- class="input__clear-btn"
129
- aria-label=${this._showPassword ? "Şifreyi gizle" : "Şifreyi göster"}
130
- @click=${this.handlePasswordToggle}
131
- >
132
- <ui-icon name=${this._showPassword ? "uil-eye-slash" : "uil-eye"} size="16"></ui-icon>
133
- </button>
134
- ` : o}
135
- <slot name="suffix" slot="suffix"></slot>
136
- </logosphere-formfield>
137
- `;
138
- }
139
- };
140
- t.styles = [c`${y(g)}`];
141
- i([
142
- b("input")
143
- ], t.prototype, "_inputElement", 2);
144
- i([
145
- s({ type: String })
146
- ], t.prototype, "value", 2);
147
- i([
148
- s({ type: String })
149
- ], t.prototype, "type", 2);
150
- i([
151
- s({ type: String })
152
- ], t.prototype, "placeholder", 2);
153
- i([
154
- s({ type: String })
155
- ], t.prototype, "name", 2);
156
- i([
157
- s({ type: String })
158
- ], t.prototype, "autocomplete", 2);
159
- i([
160
- s({ type: Number })
161
- ], t.prototype, "minlength", 2);
162
- i([
163
- s({ type: Number })
164
- ], t.prototype, "maxlength", 2);
165
- i([
166
- s({ type: String })
167
- ], t.prototype, "pattern", 2);
168
- i([
169
- s({ type: Number })
170
- ], t.prototype, "min", 2);
171
- i([
172
- s({ type: Number })
173
- ], t.prototype, "max", 2);
174
- i([
175
- s({ type: Number })
176
- ], t.prototype, "step", 2);
177
- i([
178
- s({ type: String })
179
- ], t.prototype, "size", 2);
180
- i([
181
- s({ type: String })
182
- ], t.prototype, "variant", 2);
183
- i([
184
- s({ type: String })
185
- ], t.prototype, "label", 2);
186
- i([
187
- s({ type: String })
188
- ], t.prototype, "helper", 2);
189
- i([
190
- s({ type: String })
191
- ], t.prototype, "error", 2);
192
- i([
193
- s({ type: Boolean })
194
- ], t.prototype, "required", 2);
195
- i([
196
- s({ type: Boolean })
197
- ], t.prototype, "disabled", 2);
198
- i([
199
- s({ type: Boolean })
200
- ], t.prototype, "readonly", 2);
201
- i([
202
- d()
203
- ], t.prototype, "_internalError", 2);
204
- i([
205
- d()
206
- ], t.prototype, "_showPassword", 2);
207
- t = i([
208
- _("logosphere-input")
209
- ], t);
210
- export {
211
- t as L
212
- };