@lukso/web-components 1.72.0 → 1.74.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/index.cjs +3 -3
- package/dist/components/index.js +3 -3
- package/dist/components/lukso-button/index.cjs +1 -1
- package/dist/components/lukso-button/index.d.ts +2 -2
- package/dist/components/lukso-button/index.d.ts.map +1 -1
- package/dist/components/lukso-button/index.js +1 -1
- package/dist/components/lukso-card/index.cjs +3 -3
- package/dist/components/lukso-card/index.js +3 -3
- package/dist/components/lukso-checkbox/index.cjs +1 -1
- package/dist/components/lukso-checkbox/index.js +1 -1
- package/dist/components/lukso-footer/index.cjs +1 -1
- package/dist/components/lukso-footer/index.js +1 -1
- package/dist/components/lukso-icon/icons/database.d.ts +3 -0
- package/dist/components/lukso-icon/icons/database.d.ts.map +1 -0
- package/dist/components/lukso-icon/icons/empty-outline.d.ts +3 -0
- package/dist/components/lukso-icon/icons/empty-outline.d.ts.map +1 -0
- package/dist/components/lukso-icon/index.cjs +61 -3
- package/dist/components/lukso-icon/index.d.ts.map +1 -1
- package/dist/components/lukso-icon/index.js +61 -3
- package/dist/components/lukso-image/index.cjs +2 -2
- package/dist/components/lukso-image/index.js +2 -2
- package/dist/components/lukso-input/index.cjs +170 -43
- package/dist/components/lukso-input/index.d.ts +11 -6
- package/dist/components/lukso-input/index.d.ts.map +1 -1
- package/dist/components/lukso-input/index.js +170 -43
- package/dist/components/lukso-input/lukso-input.stories.d.ts +5 -1
- package/dist/components/lukso-input/lukso-input.stories.d.ts.map +1 -1
- package/dist/components/lukso-modal/index.cjs +1 -1
- package/dist/components/lukso-modal/index.js +1 -1
- package/dist/components/lukso-navbar/index.cjs +3 -3
- package/dist/components/lukso-navbar/index.js +3 -3
- package/dist/components/lukso-profile/index.cjs +2 -2
- package/dist/components/lukso-profile/index.js +2 -2
- package/dist/components/lukso-progress/index.cjs +2 -2
- package/dist/components/lukso-progress/index.js +2 -2
- package/dist/components/lukso-sanitize/index.cjs +1 -1
- package/dist/components/lukso-sanitize/index.js +1 -1
- package/dist/components/lukso-search/index.cjs +105 -139
- package/dist/components/lukso-search/index.d.ts +6 -12
- package/dist/components/lukso-search/index.d.ts.map +1 -1
- package/dist/components/lukso-search/index.js +101 -135
- package/dist/components/lukso-search/lukso-search.stories.d.ts +2 -0
- package/dist/components/lukso-search/lukso-search.stories.d.ts.map +1 -1
- package/dist/components/lukso-select/index.cjs +234 -45
- package/dist/components/lukso-select/index.d.ts +18 -5
- package/dist/components/lukso-select/index.d.ts.map +1 -1
- package/dist/components/lukso-select/index.js +234 -45
- package/dist/components/lukso-select/lukso-select.stories.d.ts +12 -0
- package/dist/components/lukso-select/lukso-select.stories.d.ts.map +1 -1
- package/dist/components/lukso-share/index.cjs +1 -1
- package/dist/components/lukso-share/index.js +1 -1
- package/dist/components/lukso-switch/index.cjs +2 -2
- package/dist/components/lukso-switch/index.js +2 -2
- package/dist/components/lukso-tag/index.cjs +2 -2
- package/dist/components/lukso-tag/index.js +2 -2
- package/dist/components/lukso-terms/index.cjs +2 -2
- package/dist/components/lukso-terms/index.js +2 -2
- package/dist/components/lukso-test/index.cjs +1 -1
- package/dist/components/lukso-test/index.js +1 -1
- package/dist/components/lukso-tooltip/index.cjs +2 -2
- package/dist/components/lukso-tooltip/index.js +2 -2
- package/dist/components/lukso-username/index.cjs +2 -2
- package/dist/components/lukso-username/index.js +2 -2
- package/dist/components/lukso-wizard/index.cjs +1 -1
- package/dist/components/lukso-wizard/index.js +1 -1
- package/dist/index-09db75ee.js +39 -0
- package/dist/index-9b930f6a.cjs +46 -0
- package/dist/{index-59f199b0.cjs → index-a1e4b7d4.cjs} +1 -1
- package/dist/{index-8c727f4c.js → index-dfdfb6fe.js} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/shared/tailwind-element/index.cjs +1 -1
- package/dist/shared/tailwind-element/index.js +1 -1
- package/dist/shared/types.d.ts +1 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/{style-map-c66282ea.js → style-map-3669b30c.js} +1 -1
- package/dist/{style-map-6337084a.cjs → style-map-ebf3a8d2.cjs} +1 -1
- package/dist/styles/main.css +3 -0
- package/dist/styles/main.css.map +1 -1
- package/package.json +3 -2
- package/tools/sass/typography.scss +4 -0
- package/tools/styles/main.css +3 -0
- package/dist/index-25503efb.cjs +0 -46
- package/dist/index-bf6e0a1d.js +0 -39
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const shared_tailwindElement_index = require('../../index-
|
|
5
|
+
const shared_tailwindElement_index = require('../../index-9b930f6a.cjs');
|
|
6
6
|
const queryAssignedElements = require('../../query-assigned-elements-d5e45650.cjs');
|
|
7
7
|
const state = require('../../state-d9fb972b.cjs');
|
|
8
|
-
const index = require('../../index-
|
|
8
|
+
const index = require('../../index-1d3f4a5a.cjs');
|
|
9
|
+
require('../../tailwind-config.cjs');
|
|
10
|
+
const cn = require('../../cn-5ceac001.cjs');
|
|
11
|
+
require('../lukso-icon/index.cjs');
|
|
12
|
+
require('../../bundle-mjs-d58a83c6.cjs');
|
|
13
|
+
require('../../style-map-ebf3a8d2.cjs');
|
|
9
14
|
require('../../directive-8278ab14.cjs');
|
|
10
15
|
|
|
16
|
+
const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
|
|
17
|
+
|
|
11
18
|
var __defProp = Object.defineProperty;
|
|
12
19
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
20
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -19,7 +26,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
19
26
|
__defProp(target, key, result);
|
|
20
27
|
return result;
|
|
21
28
|
};
|
|
22
|
-
exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.
|
|
29
|
+
exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.TailwindStyledElement(style) {
|
|
23
30
|
constructor() {
|
|
24
31
|
super(...arguments);
|
|
25
32
|
this.value = "";
|
|
@@ -42,49 +49,132 @@ exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.Tailw
|
|
|
42
49
|
this.max = void 0;
|
|
43
50
|
this.min = void 0;
|
|
44
51
|
this.borderless = false;
|
|
52
|
+
this.size = "medium";
|
|
53
|
+
this.rightIcon = "";
|
|
45
54
|
this.hasHocus = false;
|
|
46
55
|
this.hasHighlight = false;
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
this.inputStyles = index.ce({
|
|
57
|
+
slots: {
|
|
58
|
+
wrapper: "group flex",
|
|
59
|
+
input: `bg-neutral-100 border-solid placeholder:text-neutral-70 w-full
|
|
60
|
+
outline-none transition transition-all duration-150 appearance-none`,
|
|
61
|
+
unit: `text-neutral-60 flex items-center relative border-solid transition
|
|
62
|
+
transition-all duration-150 before:bg-neutral-90 before:absolute
|
|
63
|
+
before:left-0 before:w-[1px] whitespace-nowrap cursor-pointer`,
|
|
64
|
+
rightIcon: "absolute top-1/2 transform -translate-y-1/2"
|
|
65
|
+
},
|
|
66
|
+
variants: {
|
|
67
|
+
hasError: {
|
|
68
|
+
true: {
|
|
69
|
+
input: "border-red-85",
|
|
70
|
+
unit: "border-red-85"
|
|
71
|
+
},
|
|
72
|
+
false: {
|
|
73
|
+
input: "border-neutral-90",
|
|
74
|
+
unit: "border-neutral-90"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
hasHighlight: {
|
|
78
|
+
true: {
|
|
79
|
+
input: "border-neutral-35",
|
|
80
|
+
unit: "border-neutral-35"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
hasUnit: {
|
|
84
|
+
true: { input: "!border-r-0 !rounded-r-0" }
|
|
85
|
+
},
|
|
86
|
+
hasRightIcon: {
|
|
87
|
+
true: {}
|
|
88
|
+
},
|
|
89
|
+
borderless: {
|
|
90
|
+
true: { input: "border-0", unit: "border-0" },
|
|
91
|
+
false: { input: "border", unit: "border border-l-0" }
|
|
92
|
+
},
|
|
93
|
+
isReadonly: {
|
|
94
|
+
true: { input: "cursor-not-allowed", rightIcon: "cursor-not-allowed" }
|
|
95
|
+
},
|
|
96
|
+
isDisabled: {
|
|
97
|
+
true: {
|
|
98
|
+
input: "text-neutral-60 cursor-not-allowed",
|
|
99
|
+
rightIcon: "cursor-not-allowed opacity-50"
|
|
100
|
+
},
|
|
101
|
+
false: { input: "text-neutral-20" }
|
|
102
|
+
},
|
|
103
|
+
isFullWidth: {
|
|
104
|
+
true: { wrapper: "w-full" },
|
|
105
|
+
false: { wrapper: "w-[350px]" }
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
small: {
|
|
109
|
+
input: "h-[28px] px-2 py-1 paragraph-inter-12-regular rounded-8",
|
|
110
|
+
unit: "h-[28px] paragraph-inter-10-regular px-2 rounded-r-8 before:top-[calc(50%-6px)] before:h-[12px]",
|
|
111
|
+
rightIcon: "right-2"
|
|
112
|
+
},
|
|
113
|
+
medium: {
|
|
114
|
+
input: "h-[48px] px-4 py-3 paragraph-inter-14-regular rounded-12",
|
|
115
|
+
unit: "h-[48px] paragraph-inter-12-regular px-3.5 rounded-r-12 before:top-[calc(50%-12px)] before:h-[24px]",
|
|
116
|
+
rightIcon: "right-3"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
compoundVariants: [
|
|
121
|
+
{
|
|
122
|
+
isFullWidth: false,
|
|
123
|
+
hasUnit: true,
|
|
124
|
+
class: { wrapper: "w-[300px]" }
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
isFullWidth: false,
|
|
128
|
+
hasUnit: false,
|
|
129
|
+
size: "small",
|
|
130
|
+
class: { wrapper: "w-[190px]" }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
isFullWidth: false,
|
|
134
|
+
hasUnit: true,
|
|
135
|
+
size: "small",
|
|
136
|
+
class: { wrapper: "w-[210px]" }
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
hasHighlight: true,
|
|
140
|
+
hasError: true,
|
|
141
|
+
class: {
|
|
142
|
+
input: "border-red-65",
|
|
143
|
+
unit: "border-red-65"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
hasRightIcon: true,
|
|
148
|
+
size: "medium",
|
|
149
|
+
class: { input: "pr-10" }
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
hasRightIcon: true,
|
|
153
|
+
size: "small",
|
|
154
|
+
class: { input: "pr-7" }
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
});
|
|
54
158
|
}
|
|
55
159
|
// @input works better in vue
|
|
56
|
-
inputTemplate() {
|
|
160
|
+
inputTemplate(styles) {
|
|
57
161
|
return shared_tailwindElement_index.x`
|
|
58
162
|
<input
|
|
59
|
-
name=${this.name}
|
|
163
|
+
name=${this.name ? this.name : shared_tailwindElement_index.A}
|
|
60
164
|
type=${this.type}
|
|
61
165
|
.value=${this.value}
|
|
62
|
-
placeholder=${this.placeholder}
|
|
166
|
+
placeholder=${this.placeholder ? this.placeholder : shared_tailwindElement_index.A}
|
|
63
167
|
?autofocus=${this.autofocus}
|
|
64
|
-
min=${this.min}
|
|
65
|
-
max=${this.max}
|
|
168
|
+
min=${this.min ? this.min : shared_tailwindElement_index.A}
|
|
169
|
+
max=${this.max ? this.max : shared_tailwindElement_index.A}
|
|
66
170
|
autocomplete=${this.autocomplete}
|
|
67
|
-
ref=${this.ref}
|
|
68
|
-
id=${this.id
|
|
171
|
+
ref=${this.ref ? this.ref : shared_tailwindElement_index.A}
|
|
172
|
+
id=${this.id ? this.id : shared_tailwindElement_index.A}
|
|
69
173
|
data-testid=${this.name ? `input-${this.name}` : "input"}
|
|
70
|
-
accept=${this.accept}
|
|
174
|
+
accept=${this.accept ? this.accept : shared_tailwindElement_index.A}
|
|
71
175
|
?readonly=${this.isReadonly ? true : void 0}
|
|
72
176
|
?disabled=${this.isDisabled ? true : void 0}
|
|
73
|
-
class=${
|
|
74
|
-
[this.defaultInputStyles]: true,
|
|
75
|
-
[this.error === "" ? "border-neutral-90" : "border-red-85"]: !this.hasHighlight,
|
|
76
|
-
[this.error === "" ? "border-neutral-35" : "border-red-65"]: this.hasHighlight,
|
|
77
|
-
["rounded-l-12 border-r-0"]: this.unit !== "",
|
|
78
|
-
["rounded-12"]: this.unit === "",
|
|
79
|
-
["w-full"]: this.isFullWidth,
|
|
80
|
-
["w-[350px]"]: !this.isFullWidth && this.unit === "",
|
|
81
|
-
["w-[300px]"]: !this.isFullWidth && this.unit !== "",
|
|
82
|
-
["cursor-not-allowed text-neutral-60"]: this.isDisabled,
|
|
83
|
-
["text-neutral-20"]: !this.isDisabled,
|
|
84
|
-
["cursor-not-allowed"]: this.isReadonly,
|
|
85
|
-
[this.customClass]: !!this.customClass,
|
|
86
|
-
[this.borderless ? "border-0" : "border"]: true
|
|
87
|
-
})}
|
|
177
|
+
class=${cn.cn(styles, this.customClass)}
|
|
88
178
|
@focus=${this.handleFocus}
|
|
89
179
|
@input=${this.handleInput}
|
|
90
180
|
@change=${this.handleChange}
|
|
@@ -94,6 +184,7 @@ exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.Tailw
|
|
|
94
184
|
@keypress=${this.handleKeyPress}
|
|
95
185
|
@mouseenter=${this.handleMouseOver}
|
|
96
186
|
@mouseleave=${this.handleMouseOut}
|
|
187
|
+
@click=${this.handleInputClick}
|
|
97
188
|
/>
|
|
98
189
|
`;
|
|
99
190
|
}
|
|
@@ -118,14 +209,9 @@ exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.Tailw
|
|
|
118
209
|
${this.error}
|
|
119
210
|
</div>`;
|
|
120
211
|
}
|
|
121
|
-
unitTemplate() {
|
|
212
|
+
unitTemplate(styles) {
|
|
122
213
|
return shared_tailwindElement_index.x`<div
|
|
123
|
-
class=${
|
|
124
|
-
[this.defaultUnitStyles]: true,
|
|
125
|
-
[this.error === "" ? "border-neutral-90" : "border-red-85"]: !this.hasHighlight,
|
|
126
|
-
[this.error === "" ? "border-neutral-35" : "border-red-65"]: this.hasHighlight,
|
|
127
|
-
[this.borderless ? "border-0" : "border"]: true
|
|
128
|
-
})}
|
|
214
|
+
class=${styles}
|
|
129
215
|
@mouseenter=${this.handleMouseOver}
|
|
130
216
|
@mouseleave=${this.handleMouseOut}
|
|
131
217
|
@click=${this.handleUnitClick}
|
|
@@ -133,6 +219,13 @@ exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.Tailw
|
|
|
133
219
|
${this.unit}
|
|
134
220
|
</div>`;
|
|
135
221
|
}
|
|
222
|
+
rightIconTemplate(styles) {
|
|
223
|
+
return shared_tailwindElement_index.x`<lukso-icon
|
|
224
|
+
name=${this.rightIcon}
|
|
225
|
+
size=${this.size}
|
|
226
|
+
class=${styles}
|
|
227
|
+
></lukso-icon>`;
|
|
228
|
+
}
|
|
136
229
|
handleFocus() {
|
|
137
230
|
if (!this.isReadonly && !this.isDisabled) {
|
|
138
231
|
this.hasHocus = true;
|
|
@@ -242,13 +335,41 @@ exports.LuksoInput = class LuksoInput extends shared_tailwindElement_index.Tailw
|
|
|
242
335
|
this.dispatchEvent(clickEvent);
|
|
243
336
|
input.focus();
|
|
244
337
|
}
|
|
338
|
+
async handleInputClick(event) {
|
|
339
|
+
await this.updateComplete;
|
|
340
|
+
const target = event.target;
|
|
341
|
+
const clickEvent = new CustomEvent("on-input-click", {
|
|
342
|
+
detail: {
|
|
343
|
+
value: target.value,
|
|
344
|
+
event
|
|
345
|
+
},
|
|
346
|
+
bubbles: false,
|
|
347
|
+
composed: true
|
|
348
|
+
});
|
|
349
|
+
this.dispatchEvent(clickEvent);
|
|
350
|
+
}
|
|
245
351
|
render() {
|
|
352
|
+
const { wrapper, input, unit, rightIcon } = this.inputStyles({
|
|
353
|
+
hasError: this.error !== "",
|
|
354
|
+
hasHighlight: this.hasHighlight,
|
|
355
|
+
borderless: this.borderless,
|
|
356
|
+
isReadonly: this.isReadonly,
|
|
357
|
+
isDisabled: this.isDisabled,
|
|
358
|
+
isFullWidth: this.isFullWidth,
|
|
359
|
+
hasUnit: this.unit !== "",
|
|
360
|
+
size: this.size,
|
|
361
|
+
hasRightIcon: this.rightIcon !== ""
|
|
362
|
+
});
|
|
246
363
|
return shared_tailwindElement_index.x`
|
|
247
|
-
<div>
|
|
364
|
+
<div class="w-[inherit]">
|
|
248
365
|
${this.label ? this.labelTemplate() : shared_tailwindElement_index.A}
|
|
249
366
|
${this.description ? this.descriptionTemplate() : shared_tailwindElement_index.A}
|
|
250
|
-
<div class
|
|
251
|
-
|
|
367
|
+
<div class=${wrapper()}>
|
|
368
|
+
<div class="relative w-[inherit]">
|
|
369
|
+
${this.inputTemplate(input())}
|
|
370
|
+
${this.rightIcon ? this.rightIconTemplate(rightIcon()) : shared_tailwindElement_index.A}
|
|
371
|
+
</div>
|
|
372
|
+
${this.unit ? this.unitTemplate(unit()) : shared_tailwindElement_index.A}
|
|
252
373
|
</div>
|
|
253
374
|
${this.error ? this.errorTemplate() : shared_tailwindElement_index.A}
|
|
254
375
|
</div>
|
|
@@ -315,6 +436,12 @@ __decorateClass([
|
|
|
315
436
|
__decorateClass([
|
|
316
437
|
queryAssignedElements.n({ type: Boolean })
|
|
317
438
|
], exports.LuksoInput.prototype, "borderless", 2);
|
|
439
|
+
__decorateClass([
|
|
440
|
+
queryAssignedElements.n({ type: String })
|
|
441
|
+
], exports.LuksoInput.prototype, "size", 2);
|
|
442
|
+
__decorateClass([
|
|
443
|
+
queryAssignedElements.n({ type: String, attribute: "right-icon" })
|
|
444
|
+
], exports.LuksoInput.prototype, "rightIcon", 2);
|
|
318
445
|
__decorateClass([
|
|
319
446
|
state.t()
|
|
320
447
|
], exports.LuksoInput.prototype, "hasHocus", 2);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { InputSize } from '../../shared/types';
|
|
2
|
+
declare const LuksoInput_base: typeof import("lit").LitElement;
|
|
3
|
+
export declare class LuksoInput extends LuksoInput_base {
|
|
3
4
|
value: string;
|
|
4
5
|
name: string;
|
|
5
6
|
type: string;
|
|
@@ -20,15 +21,17 @@ export declare class LuksoInput extends TailwindElement {
|
|
|
20
21
|
max: number | undefined;
|
|
21
22
|
min: number | undefined;
|
|
22
23
|
borderless: boolean;
|
|
24
|
+
size: InputSize;
|
|
25
|
+
rightIcon: string;
|
|
23
26
|
private hasHocus;
|
|
24
27
|
private hasHighlight;
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
inputTemplate(): import("lit-html").TemplateResult<1>;
|
|
28
|
+
private inputStyles;
|
|
29
|
+
inputTemplate(styles: string): import("lit-html").TemplateResult<1>;
|
|
28
30
|
labelTemplate(): import("lit-html").TemplateResult<1>;
|
|
29
31
|
descriptionTemplate(): import("lit-html").TemplateResult<1>;
|
|
30
32
|
errorTemplate(): import("lit-html").TemplateResult<1>;
|
|
31
|
-
unitTemplate(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
unitTemplate(styles: string): import("lit-html").TemplateResult<1>;
|
|
34
|
+
rightIconTemplate(styles: string): import("lit-html").TemplateResult<1>;
|
|
32
35
|
private handleFocus;
|
|
33
36
|
private handleBlur;
|
|
34
37
|
private handleChange;
|
|
@@ -39,6 +42,7 @@ export declare class LuksoInput extends TailwindElement {
|
|
|
39
42
|
private handleMouseOver;
|
|
40
43
|
private handleMouseOut;
|
|
41
44
|
private handleUnitClick;
|
|
45
|
+
private handleInputClick;
|
|
42
46
|
render(): import("lit-html").TemplateResult<1>;
|
|
43
47
|
}
|
|
44
48
|
declare global {
|
|
@@ -46,4 +50,5 @@ declare global {
|
|
|
46
50
|
'lukso-input': LuksoInput;
|
|
47
51
|
}
|
|
48
52
|
}
|
|
53
|
+
export {};
|
|
49
54
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-input/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-input/index.ts"],"names":[],"mappings":"AAMA,OAAO,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;;AAE/C,qBACa,UAAW,SAAQ,eAA4B;IAE1D,KAAK,SAAK;IAGV,IAAI,SAAK;IAGT,IAAI,SAAS;IAGb,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,YAAY,SAAO;IAGnB,EAAE,SAAK;IAGP,GAAG,EAAE,MAAM,GAAG,SAAS,CAAY;IAGnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAY;IAGtC,WAAW,SAAK;IAGhB,KAAK,SAAK;IAGV,IAAI,SAAK;IAGT,WAAW,SAAK;IAGhB,WAAW,UAAQ;IAGnB,UAAU,UAAQ;IAGlB,UAAU,UAAQ;IAGlB,SAAS,UAAQ;IAGjB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAY;IAGnC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAY;IAGnC,UAAU,UAAQ;IAGlB,IAAI,EAAE,SAAS,CAAW;IAG1B,SAAS,SAAK;IAGd,OAAO,CAAC,QAAQ,CAAQ;IAGxB,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,WAAW,CAqGjB;IAGF,aAAa,CAAC,MAAM,EAAE,MAAM;IAgC5B,aAAa;IAUb,mBAAmB;IAQnB,aAAa;IAMb,YAAY,CAAC,MAAM,EAAE,MAAM;IAW3B,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAQhC,OAAO,CAAC,WAAW;YAOL,UAAU;YAgBV,YAAY;YAcZ,WAAW;YAeX,WAAW;YAcX,aAAa;YAcb,cAAc;IAc5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,eAAe;YAaT,gBAAgB;IAc9B,MAAM;CA4BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAA;KAC1B;CACF"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as TailwindStyledElement, x, A } from '../../index-09db75ee.js';
|
|
2
2
|
import { n, e } from '../../query-assigned-elements-1c8c9e90.js';
|
|
3
3
|
import { t } from '../../state-b9ca4e74.js';
|
|
4
|
-
import { c as
|
|
4
|
+
import { c as ce } from '../../index-ca8e900d.js';
|
|
5
|
+
import '../../tailwind-config.js';
|
|
6
|
+
import { c as cn } from '../../cn-b54dcc61.js';
|
|
7
|
+
import '../lukso-icon/index.js';
|
|
8
|
+
import '../../bundle-mjs-fbc6e2a8.js';
|
|
9
|
+
import '../../style-map-3669b30c.js';
|
|
5
10
|
import '../../directive-2bb7789e.js';
|
|
6
11
|
|
|
12
|
+
const style = ":host {\n\n display: inline-flex\n}\n\n:host([is-full-width]) {\n\n display: flex;\n\n width: 100%\n}";
|
|
13
|
+
|
|
7
14
|
var __defProp = Object.defineProperty;
|
|
8
15
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
16
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -15,7 +22,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
15
22
|
__defProp(target, key, result);
|
|
16
23
|
return result;
|
|
17
24
|
};
|
|
18
|
-
let LuksoInput = class extends
|
|
25
|
+
let LuksoInput = class extends TailwindStyledElement(style) {
|
|
19
26
|
constructor() {
|
|
20
27
|
super(...arguments);
|
|
21
28
|
this.value = "";
|
|
@@ -38,49 +45,132 @@ let LuksoInput = class extends TailwindElement {
|
|
|
38
45
|
this.max = void 0;
|
|
39
46
|
this.min = void 0;
|
|
40
47
|
this.borderless = false;
|
|
48
|
+
this.size = "medium";
|
|
49
|
+
this.rightIcon = "";
|
|
41
50
|
this.hasHocus = false;
|
|
42
51
|
this.hasHighlight = false;
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
this.inputStyles = ce({
|
|
53
|
+
slots: {
|
|
54
|
+
wrapper: "group flex",
|
|
55
|
+
input: `bg-neutral-100 border-solid placeholder:text-neutral-70 w-full
|
|
56
|
+
outline-none transition transition-all duration-150 appearance-none`,
|
|
57
|
+
unit: `text-neutral-60 flex items-center relative border-solid transition
|
|
58
|
+
transition-all duration-150 before:bg-neutral-90 before:absolute
|
|
59
|
+
before:left-0 before:w-[1px] whitespace-nowrap cursor-pointer`,
|
|
60
|
+
rightIcon: "absolute top-1/2 transform -translate-y-1/2"
|
|
61
|
+
},
|
|
62
|
+
variants: {
|
|
63
|
+
hasError: {
|
|
64
|
+
true: {
|
|
65
|
+
input: "border-red-85",
|
|
66
|
+
unit: "border-red-85"
|
|
67
|
+
},
|
|
68
|
+
false: {
|
|
69
|
+
input: "border-neutral-90",
|
|
70
|
+
unit: "border-neutral-90"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
hasHighlight: {
|
|
74
|
+
true: {
|
|
75
|
+
input: "border-neutral-35",
|
|
76
|
+
unit: "border-neutral-35"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
hasUnit: {
|
|
80
|
+
true: { input: "!border-r-0 !rounded-r-0" }
|
|
81
|
+
},
|
|
82
|
+
hasRightIcon: {
|
|
83
|
+
true: {}
|
|
84
|
+
},
|
|
85
|
+
borderless: {
|
|
86
|
+
true: { input: "border-0", unit: "border-0" },
|
|
87
|
+
false: { input: "border", unit: "border border-l-0" }
|
|
88
|
+
},
|
|
89
|
+
isReadonly: {
|
|
90
|
+
true: { input: "cursor-not-allowed", rightIcon: "cursor-not-allowed" }
|
|
91
|
+
},
|
|
92
|
+
isDisabled: {
|
|
93
|
+
true: {
|
|
94
|
+
input: "text-neutral-60 cursor-not-allowed",
|
|
95
|
+
rightIcon: "cursor-not-allowed opacity-50"
|
|
96
|
+
},
|
|
97
|
+
false: { input: "text-neutral-20" }
|
|
98
|
+
},
|
|
99
|
+
isFullWidth: {
|
|
100
|
+
true: { wrapper: "w-full" },
|
|
101
|
+
false: { wrapper: "w-[350px]" }
|
|
102
|
+
},
|
|
103
|
+
size: {
|
|
104
|
+
small: {
|
|
105
|
+
input: "h-[28px] px-2 py-1 paragraph-inter-12-regular rounded-8",
|
|
106
|
+
unit: "h-[28px] paragraph-inter-10-regular px-2 rounded-r-8 before:top-[calc(50%-6px)] before:h-[12px]",
|
|
107
|
+
rightIcon: "right-2"
|
|
108
|
+
},
|
|
109
|
+
medium: {
|
|
110
|
+
input: "h-[48px] px-4 py-3 paragraph-inter-14-regular rounded-12",
|
|
111
|
+
unit: "h-[48px] paragraph-inter-12-regular px-3.5 rounded-r-12 before:top-[calc(50%-12px)] before:h-[24px]",
|
|
112
|
+
rightIcon: "right-3"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
compoundVariants: [
|
|
117
|
+
{
|
|
118
|
+
isFullWidth: false,
|
|
119
|
+
hasUnit: true,
|
|
120
|
+
class: { wrapper: "w-[300px]" }
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
isFullWidth: false,
|
|
124
|
+
hasUnit: false,
|
|
125
|
+
size: "small",
|
|
126
|
+
class: { wrapper: "w-[190px]" }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
isFullWidth: false,
|
|
130
|
+
hasUnit: true,
|
|
131
|
+
size: "small",
|
|
132
|
+
class: { wrapper: "w-[210px]" }
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
hasHighlight: true,
|
|
136
|
+
hasError: true,
|
|
137
|
+
class: {
|
|
138
|
+
input: "border-red-65",
|
|
139
|
+
unit: "border-red-65"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
hasRightIcon: true,
|
|
144
|
+
size: "medium",
|
|
145
|
+
class: { input: "pr-10" }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
hasRightIcon: true,
|
|
149
|
+
size: "small",
|
|
150
|
+
class: { input: "pr-7" }
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
});
|
|
50
154
|
}
|
|
51
155
|
// @input works better in vue
|
|
52
|
-
inputTemplate() {
|
|
156
|
+
inputTemplate(styles) {
|
|
53
157
|
return x`
|
|
54
158
|
<input
|
|
55
|
-
name=${this.name}
|
|
159
|
+
name=${this.name ? this.name : A}
|
|
56
160
|
type=${this.type}
|
|
57
161
|
.value=${this.value}
|
|
58
|
-
placeholder=${this.placeholder}
|
|
162
|
+
placeholder=${this.placeholder ? this.placeholder : A}
|
|
59
163
|
?autofocus=${this.autofocus}
|
|
60
|
-
min=${this.min}
|
|
61
|
-
max=${this.max}
|
|
164
|
+
min=${this.min ? this.min : A}
|
|
165
|
+
max=${this.max ? this.max : A}
|
|
62
166
|
autocomplete=${this.autocomplete}
|
|
63
|
-
ref=${this.ref}
|
|
64
|
-
id=${this.id
|
|
167
|
+
ref=${this.ref ? this.ref : A}
|
|
168
|
+
id=${this.id ? this.id : A}
|
|
65
169
|
data-testid=${this.name ? `input-${this.name}` : "input"}
|
|
66
|
-
accept=${this.accept}
|
|
170
|
+
accept=${this.accept ? this.accept : A}
|
|
67
171
|
?readonly=${this.isReadonly ? true : void 0}
|
|
68
172
|
?disabled=${this.isDisabled ? true : void 0}
|
|
69
|
-
class=${
|
|
70
|
-
[this.defaultInputStyles]: true,
|
|
71
|
-
[this.error === "" ? "border-neutral-90" : "border-red-85"]: !this.hasHighlight,
|
|
72
|
-
[this.error === "" ? "border-neutral-35" : "border-red-65"]: this.hasHighlight,
|
|
73
|
-
["rounded-l-12 border-r-0"]: this.unit !== "",
|
|
74
|
-
["rounded-12"]: this.unit === "",
|
|
75
|
-
["w-full"]: this.isFullWidth,
|
|
76
|
-
["w-[350px]"]: !this.isFullWidth && this.unit === "",
|
|
77
|
-
["w-[300px]"]: !this.isFullWidth && this.unit !== "",
|
|
78
|
-
["cursor-not-allowed text-neutral-60"]: this.isDisabled,
|
|
79
|
-
["text-neutral-20"]: !this.isDisabled,
|
|
80
|
-
["cursor-not-allowed"]: this.isReadonly,
|
|
81
|
-
[this.customClass]: !!this.customClass,
|
|
82
|
-
[this.borderless ? "border-0" : "border"]: true
|
|
83
|
-
})}
|
|
173
|
+
class=${cn(styles, this.customClass)}
|
|
84
174
|
@focus=${this.handleFocus}
|
|
85
175
|
@input=${this.handleInput}
|
|
86
176
|
@change=${this.handleChange}
|
|
@@ -90,6 +180,7 @@ let LuksoInput = class extends TailwindElement {
|
|
|
90
180
|
@keypress=${this.handleKeyPress}
|
|
91
181
|
@mouseenter=${this.handleMouseOver}
|
|
92
182
|
@mouseleave=${this.handleMouseOut}
|
|
183
|
+
@click=${this.handleInputClick}
|
|
93
184
|
/>
|
|
94
185
|
`;
|
|
95
186
|
}
|
|
@@ -114,14 +205,9 @@ let LuksoInput = class extends TailwindElement {
|
|
|
114
205
|
${this.error}
|
|
115
206
|
</div>`;
|
|
116
207
|
}
|
|
117
|
-
unitTemplate() {
|
|
208
|
+
unitTemplate(styles) {
|
|
118
209
|
return x`<div
|
|
119
|
-
class=${
|
|
120
|
-
[this.defaultUnitStyles]: true,
|
|
121
|
-
[this.error === "" ? "border-neutral-90" : "border-red-85"]: !this.hasHighlight,
|
|
122
|
-
[this.error === "" ? "border-neutral-35" : "border-red-65"]: this.hasHighlight,
|
|
123
|
-
[this.borderless ? "border-0" : "border"]: true
|
|
124
|
-
})}
|
|
210
|
+
class=${styles}
|
|
125
211
|
@mouseenter=${this.handleMouseOver}
|
|
126
212
|
@mouseleave=${this.handleMouseOut}
|
|
127
213
|
@click=${this.handleUnitClick}
|
|
@@ -129,6 +215,13 @@ let LuksoInput = class extends TailwindElement {
|
|
|
129
215
|
${this.unit}
|
|
130
216
|
</div>`;
|
|
131
217
|
}
|
|
218
|
+
rightIconTemplate(styles) {
|
|
219
|
+
return x`<lukso-icon
|
|
220
|
+
name=${this.rightIcon}
|
|
221
|
+
size=${this.size}
|
|
222
|
+
class=${styles}
|
|
223
|
+
></lukso-icon>`;
|
|
224
|
+
}
|
|
132
225
|
handleFocus() {
|
|
133
226
|
if (!this.isReadonly && !this.isDisabled) {
|
|
134
227
|
this.hasHocus = true;
|
|
@@ -238,13 +331,41 @@ let LuksoInput = class extends TailwindElement {
|
|
|
238
331
|
this.dispatchEvent(clickEvent);
|
|
239
332
|
input.focus();
|
|
240
333
|
}
|
|
334
|
+
async handleInputClick(event) {
|
|
335
|
+
await this.updateComplete;
|
|
336
|
+
const target = event.target;
|
|
337
|
+
const clickEvent = new CustomEvent("on-input-click", {
|
|
338
|
+
detail: {
|
|
339
|
+
value: target.value,
|
|
340
|
+
event
|
|
341
|
+
},
|
|
342
|
+
bubbles: false,
|
|
343
|
+
composed: true
|
|
344
|
+
});
|
|
345
|
+
this.dispatchEvent(clickEvent);
|
|
346
|
+
}
|
|
241
347
|
render() {
|
|
348
|
+
const { wrapper, input, unit, rightIcon } = this.inputStyles({
|
|
349
|
+
hasError: this.error !== "",
|
|
350
|
+
hasHighlight: this.hasHighlight,
|
|
351
|
+
borderless: this.borderless,
|
|
352
|
+
isReadonly: this.isReadonly,
|
|
353
|
+
isDisabled: this.isDisabled,
|
|
354
|
+
isFullWidth: this.isFullWidth,
|
|
355
|
+
hasUnit: this.unit !== "",
|
|
356
|
+
size: this.size,
|
|
357
|
+
hasRightIcon: this.rightIcon !== ""
|
|
358
|
+
});
|
|
242
359
|
return x`
|
|
243
|
-
<div>
|
|
360
|
+
<div class="w-[inherit]">
|
|
244
361
|
${this.label ? this.labelTemplate() : A}
|
|
245
362
|
${this.description ? this.descriptionTemplate() : A}
|
|
246
|
-
<div class
|
|
247
|
-
|
|
363
|
+
<div class=${wrapper()}>
|
|
364
|
+
<div class="relative w-[inherit]">
|
|
365
|
+
${this.inputTemplate(input())}
|
|
366
|
+
${this.rightIcon ? this.rightIconTemplate(rightIcon()) : A}
|
|
367
|
+
</div>
|
|
368
|
+
${this.unit ? this.unitTemplate(unit()) : A}
|
|
248
369
|
</div>
|
|
249
370
|
${this.error ? this.errorTemplate() : A}
|
|
250
371
|
</div>
|
|
@@ -311,6 +432,12 @@ __decorateClass([
|
|
|
311
432
|
__decorateClass([
|
|
312
433
|
n({ type: Boolean })
|
|
313
434
|
], LuksoInput.prototype, "borderless", 2);
|
|
435
|
+
__decorateClass([
|
|
436
|
+
n({ type: String })
|
|
437
|
+
], LuksoInput.prototype, "size", 2);
|
|
438
|
+
__decorateClass([
|
|
439
|
+
n({ type: String, attribute: "right-icon" })
|
|
440
|
+
], LuksoInput.prototype, "rightIcon", 2);
|
|
314
441
|
__decorateClass([
|
|
315
442
|
t()
|
|
316
443
|
], LuksoInput.prototype, "hasHocus", 2);
|
|
@@ -11,7 +11,7 @@ export declare const Label: any;
|
|
|
11
11
|
/** Example of input with `label` and `description`. */
|
|
12
12
|
export declare const LabelAndDescription: any;
|
|
13
13
|
/** Example of input with `error`. */
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const ErrorInput: any;
|
|
15
15
|
/** Example of input with `unit`. */
|
|
16
16
|
export declare const Unit: any;
|
|
17
17
|
/** If you need input to take full width of the parent element add `is-full-width` property. */
|
|
@@ -22,4 +22,8 @@ export declare const Autofocus: any;
|
|
|
22
22
|
export declare const MinMaxValue: any;
|
|
23
23
|
/** With `borderless` property you can render input without border. */
|
|
24
24
|
export declare const Borderless: any;
|
|
25
|
+
/** Example of `small` size input. */
|
|
26
|
+
export declare const Small: any;
|
|
27
|
+
/** Example of input with icon on right side. */
|
|
28
|
+
export declare const RightIcon: any;
|
|
25
29
|
//# sourceMappingURL=lukso-input.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lukso-input.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-input/lukso-input.stories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,SAAS,CAAA;AAEhB,+DAA+D;AAC/D,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"lukso-input.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-input/lukso-input.stories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,SAAS,CAAA;AAEhB,+DAA+D;AAC/D,QAAA,MAAM,IAAI,EAAE,IA8PX,CAAA;AAED,eAAe,IAAI,CAAA;AA2DnB,8CAA8C;AAC9C,eAAO,MAAM,YAAY,KAAoB,CAAA;AAK7C,gDAAgD;AAChD,eAAO,MAAM,eAAe,KAAoB,CAAA;AAKhD,qCAAqC;AACrC,eAAO,MAAM,KAAK,KAAoB,CAAA;AAKtC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,KAAoB,CAAA;AAMpD,qCAAqC;AACrC,eAAO,MAAM,UAAU,KAAoB,CAAA;AAO3C,oCAAoC;AACpC,eAAO,MAAM,IAAI,KAAoB,CAAA;AAKrC,+FAA+F;AAC/F,eAAO,MAAM,SAAS,KAAoB,CAAA;AAK1C,gEAAgE;AAChE,eAAO,MAAM,SAAS,KAAoB,CAAA;AAK1C,oMAAoM;AACpM,eAAO,MAAM,WAAW,KAAoB,CAAA;AAO5C,sEAAsE;AACtE,eAAO,MAAM,UAAU,KAAoB,CAAA;AAM3C,qCAAqC;AACrC,eAAO,MAAM,KAAK,KAAoB,CAAA;AAKtC,gDAAgD;AAChD,eAAO,MAAM,SAAS,KAAoB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const shared_tailwindElement_index = require('../../index-
|
|
5
|
+
const shared_tailwindElement_index = require('../../index-9b930f6a.cjs');
|
|
6
6
|
const queryAssignedElements = require('../../query-assigned-elements-d5e45650.cjs');
|
|
7
7
|
const index = require('../../index-e9668573.cjs');
|
|
8
8
|
require('../../directive-8278ab14.cjs');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TailwindElement, x } from '../../index-
|
|
1
|
+
import { a as TailwindElement, x } from '../../index-09db75ee.js';
|
|
2
2
|
import { n, e } from '../../query-assigned-elements-1c8c9e90.js';
|
|
3
3
|
import { c as customClassMap } from '../../index-5e194caf.js';
|
|
4
4
|
import '../../directive-2bb7789e.js';
|