@nuralyui/input 0.0.6 → 0.0.7
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/input.component.d.ts +48 -1
- package/input.component.d.ts.map +1 -1
- package/input.component.js +233 -5
- package/input.component.js.map +1 -1
- package/input.style.d.ts.map +1 -1
- package/input.style.js +128 -11
- package/input.style.js.map +1 -1
- package/input.style.variable.d.ts.map +1 -1
- package/input.style.variable.js +53 -0
- package/input.style.variable.js.map +1 -1
- package/input.types.d.ts +20 -0
- package/input.types.d.ts.map +1 -1
- package/input.types.js.map +1 -1
- package/package.json +1 -1
- package/utils/input-renderers.d.ts +4 -0
- package/utils/input-renderers.d.ts.map +1 -1
- package/utils/input-renderers.js +17 -0
- package/utils/input-renderers.js.map +1 -1
package/input.component.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
import { LitElement, PropertyValues } from 'lit';
|
|
7
|
-
import { INPUT_TYPE, INPUT_STATE, INPUT_SIZE } from './input.types.js';
|
|
7
|
+
import { INPUT_TYPE, INPUT_STATE, INPUT_SIZE, INPUT_VARIANT, FocusOptions, BlurOptions } from './input.types.js';
|
|
8
8
|
import '../icon/icon.component.js';
|
|
9
9
|
declare const NrInputElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & typeof LitElement;
|
|
10
10
|
export declare class NrInputElement extends NrInputElement_base {
|
|
@@ -13,6 +13,7 @@ export declare class NrInputElement extends NrInputElement_base {
|
|
|
13
13
|
state: INPUT_STATE;
|
|
14
14
|
value: string;
|
|
15
15
|
size: INPUT_SIZE;
|
|
16
|
+
variant: INPUT_VARIANT;
|
|
16
17
|
type: INPUT_TYPE;
|
|
17
18
|
step?: string;
|
|
18
19
|
min?: string;
|
|
@@ -20,10 +21,22 @@ export declare class NrInputElement extends NrInputElement_base {
|
|
|
20
21
|
placeholder: string;
|
|
21
22
|
autocomplete: string;
|
|
22
23
|
withCopy: boolean;
|
|
24
|
+
allowClear: boolean;
|
|
25
|
+
showCount: boolean;
|
|
26
|
+
maxLength?: number;
|
|
23
27
|
inputType: string;
|
|
24
28
|
hasAddonBefore: boolean;
|
|
25
29
|
hasAddonAfter: boolean;
|
|
30
|
+
focused: boolean;
|
|
26
31
|
input: HTMLInputElement;
|
|
32
|
+
/**
|
|
33
|
+
* Get the character count display text
|
|
34
|
+
*/
|
|
35
|
+
get characterCountDisplay(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Check if character count is over the limit
|
|
38
|
+
*/
|
|
39
|
+
get isOverCharacterLimit(): boolean;
|
|
27
40
|
/**
|
|
28
41
|
* Required components that must be registered for this component to work properly
|
|
29
42
|
*/
|
|
@@ -43,6 +56,38 @@ export declare class NrInputElement extends NrInputElement_base {
|
|
|
43
56
|
* Handle slot changes to determine addon visibility
|
|
44
57
|
*/
|
|
45
58
|
private _handleSlotChange;
|
|
59
|
+
/**
|
|
60
|
+
* Focus the input with advanced options
|
|
61
|
+
*/
|
|
62
|
+
focus(options?: FocusOptions): void;
|
|
63
|
+
/**
|
|
64
|
+
* Blur the input with advanced options
|
|
65
|
+
*/
|
|
66
|
+
blur(options?: BlurOptions): void;
|
|
67
|
+
/**
|
|
68
|
+
* Select all text in the input
|
|
69
|
+
*/
|
|
70
|
+
selectAll(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Select a range of text in the input
|
|
73
|
+
*/
|
|
74
|
+
selectRange(start: number, end: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get the current cursor position
|
|
77
|
+
*/
|
|
78
|
+
getCursorPosition(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Set the cursor position
|
|
81
|
+
*/
|
|
82
|
+
setCursorPosition(position: number | 'start' | 'end' | 'all'): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get the currently selected text
|
|
85
|
+
*/
|
|
86
|
+
getSelectedText(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Check if the input is currently focused
|
|
89
|
+
*/
|
|
90
|
+
isFocused(): boolean;
|
|
46
91
|
/**
|
|
47
92
|
* Centralized event dispatcher to ensure consistent event structure
|
|
48
93
|
*/
|
|
@@ -50,8 +95,10 @@ export declare class NrInputElement extends NrInputElement_base {
|
|
|
50
95
|
private _handleKeyDown;
|
|
51
96
|
private _valueChange;
|
|
52
97
|
private _focusEvent;
|
|
98
|
+
private _blurEvent;
|
|
53
99
|
private _handleIconKeydown;
|
|
54
100
|
private _onCopy;
|
|
101
|
+
private _onClear;
|
|
55
102
|
private _increment;
|
|
56
103
|
private _decrement;
|
|
57
104
|
private _togglePasswordIcon;
|
package/input.component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.component.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"input.component.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.component.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAgB,YAAY,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAC;AAIjJ,OAAO,2BAA2B,CAAC;;AAEnC,qBACa,cAAe,SAAQ,mBAA6B;IAG/D,QAAQ,UAAS;IAGjB,QAAQ,UAAS;IAGjB,KAAK,cAAuB;IAG5B,KAAK,SAAgB;IAGrB,IAAI,aAAqB;IAGzB,OAAO,gBAA4B;IAGnC,IAAI,aAAmB;IAGvB,IAAI,C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B,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,YAAY;IA6CpB,OAAO,CAAC,WAAW;IA0BnB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,kBAAkB;YAqBZ,OAAO;IAYrB,OAAO,CAAC,QAAQ;IA8BhB,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,mBAAmB;IAelB,MAAM;IAqEf,OAAgB,MAAM,4BAAU;CACjC"}
|
package/input.component.js
CHANGED
|
@@ -35,18 +35,38 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
35
35
|
this.state = "default" /* INPUT_STATE.Default */;
|
|
36
36
|
this.value = EMPTY_STRING;
|
|
37
37
|
this.size = "medium" /* INPUT_SIZE.Medium */;
|
|
38
|
+
this.variant = "underlined" /* INPUT_VARIANT.Underlined */;
|
|
38
39
|
this.type = "text" /* INPUT_TYPE.TEXT */;
|
|
39
40
|
this.placeholder = EMPTY_STRING;
|
|
40
41
|
this.autocomplete = 'off';
|
|
41
42
|
this.withCopy = false;
|
|
43
|
+
this.allowClear = false;
|
|
44
|
+
this.showCount = false;
|
|
42
45
|
this.inputType = EMPTY_STRING;
|
|
43
46
|
this.hasAddonBefore = false;
|
|
44
47
|
this.hasAddonAfter = false;
|
|
48
|
+
this.focused = false;
|
|
45
49
|
/**
|
|
46
50
|
* Required components that must be registered for this component to work properly
|
|
47
51
|
*/
|
|
48
52
|
this.requiredComponents = ['hy-icon'];
|
|
49
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the character count display text
|
|
56
|
+
*/
|
|
57
|
+
get characterCountDisplay() {
|
|
58
|
+
const currentLength = this.value.length;
|
|
59
|
+
if (this.maxLength) {
|
|
60
|
+
return `${currentLength}/${this.maxLength}`;
|
|
61
|
+
}
|
|
62
|
+
return `${currentLength}`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if character count is over the limit
|
|
66
|
+
*/
|
|
67
|
+
get isOverCharacterLimit() {
|
|
68
|
+
return this.maxLength ? this.value.length > this.maxLength : false;
|
|
69
|
+
}
|
|
50
70
|
/**
|
|
51
71
|
* Check for required dependencies when component is connected to DOM
|
|
52
72
|
*/
|
|
@@ -70,7 +90,7 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
70
90
|
}
|
|
71
91
|
}
|
|
72
92
|
updated(_changedProperties) {
|
|
73
|
-
if (_changedProperties.has('step') || _changedProperties.has('min') || _changedProperties.has('max')) {
|
|
93
|
+
if (_changedProperties.has('step') || _changedProperties.has('min') || _changedProperties.has('max') || _changedProperties.has('maxLength')) {
|
|
74
94
|
const input = this.input;
|
|
75
95
|
if (input) {
|
|
76
96
|
if (this.step)
|
|
@@ -85,6 +105,10 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
85
105
|
input.setAttribute('max', this.max);
|
|
86
106
|
else
|
|
87
107
|
input.removeAttribute('max');
|
|
108
|
+
if (this.maxLength)
|
|
109
|
+
input.setAttribute('maxlength', this.maxLength.toString());
|
|
110
|
+
else
|
|
111
|
+
input.removeAttribute('maxlength');
|
|
88
112
|
}
|
|
89
113
|
}
|
|
90
114
|
}
|
|
@@ -116,6 +140,133 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
116
140
|
}
|
|
117
141
|
}
|
|
118
142
|
// ========================================
|
|
143
|
+
// FOCUS MANAGEMENT METHODS
|
|
144
|
+
// ========================================
|
|
145
|
+
/**
|
|
146
|
+
* Focus the input with advanced options
|
|
147
|
+
*/
|
|
148
|
+
focus(options) {
|
|
149
|
+
if (!this.input)
|
|
150
|
+
return;
|
|
151
|
+
const focusOptions = Object.assign({ preventScroll: false }, options);
|
|
152
|
+
// Focus the input element
|
|
153
|
+
this.input.focus({ preventScroll: focusOptions.preventScroll });
|
|
154
|
+
// Handle cursor positioning
|
|
155
|
+
if (focusOptions.cursor !== undefined) {
|
|
156
|
+
this.setCursorPosition(focusOptions.cursor);
|
|
157
|
+
}
|
|
158
|
+
// Handle text selection
|
|
159
|
+
if (focusOptions.select) {
|
|
160
|
+
this.selectAll();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Blur the input with advanced options
|
|
165
|
+
*/
|
|
166
|
+
blur(options) {
|
|
167
|
+
if (!this.input)
|
|
168
|
+
return;
|
|
169
|
+
const currentPosition = this.getCursorPosition();
|
|
170
|
+
this.input.blur();
|
|
171
|
+
// Restore cursor position if requested
|
|
172
|
+
if ((options === null || options === void 0 ? void 0 : options.restoreCursor) && currentPosition !== -1) {
|
|
173
|
+
// We'll restore it on next focus
|
|
174
|
+
this.input.dataset.restoreCursor = currentPosition.toString();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Select all text in the input
|
|
179
|
+
*/
|
|
180
|
+
selectAll() {
|
|
181
|
+
if (!this.input)
|
|
182
|
+
return;
|
|
183
|
+
// Ensure the input is focused first
|
|
184
|
+
if (document.activeElement !== this.input) {
|
|
185
|
+
this.input.focus();
|
|
186
|
+
}
|
|
187
|
+
// Wait for next frame to ensure focus is complete
|
|
188
|
+
requestAnimationFrame(() => {
|
|
189
|
+
if (!this.input)
|
|
190
|
+
return;
|
|
191
|
+
this.input.select();
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Select a range of text in the input
|
|
196
|
+
*/
|
|
197
|
+
selectRange(start, end) {
|
|
198
|
+
if (!this.input)
|
|
199
|
+
return;
|
|
200
|
+
// Ensure the input is focused first
|
|
201
|
+
if (document.activeElement !== this.input) {
|
|
202
|
+
this.input.focus();
|
|
203
|
+
}
|
|
204
|
+
// Wait for next frame to ensure focus is complete
|
|
205
|
+
requestAnimationFrame(() => {
|
|
206
|
+
if (!this.input)
|
|
207
|
+
return;
|
|
208
|
+
const maxLength = this.input.value.length;
|
|
209
|
+
const validStart = Math.max(0, Math.min(start, maxLength));
|
|
210
|
+
const validEnd = Math.max(validStart, Math.min(end, maxLength));
|
|
211
|
+
this.input.setSelectionRange(validStart, validEnd);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the current cursor position
|
|
216
|
+
*/
|
|
217
|
+
getCursorPosition() {
|
|
218
|
+
if (!this.input)
|
|
219
|
+
return -1;
|
|
220
|
+
return this.input.selectionStart || 0;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Set the cursor position
|
|
224
|
+
*/
|
|
225
|
+
setCursorPosition(position) {
|
|
226
|
+
if (!this.input)
|
|
227
|
+
return;
|
|
228
|
+
// Ensure the input is focused first
|
|
229
|
+
if (document.activeElement !== this.input) {
|
|
230
|
+
this.input.focus();
|
|
231
|
+
}
|
|
232
|
+
requestAnimationFrame(() => {
|
|
233
|
+
if (!this.input)
|
|
234
|
+
return;
|
|
235
|
+
let pos;
|
|
236
|
+
const valueLength = this.value.length;
|
|
237
|
+
switch (position) {
|
|
238
|
+
case 'start':
|
|
239
|
+
pos = 0;
|
|
240
|
+
break;
|
|
241
|
+
case 'end':
|
|
242
|
+
pos = valueLength;
|
|
243
|
+
break;
|
|
244
|
+
case 'all':
|
|
245
|
+
this.selectAll();
|
|
246
|
+
return;
|
|
247
|
+
default:
|
|
248
|
+
pos = typeof position === 'number' ? Math.min(Math.max(0, position), valueLength) : 0;
|
|
249
|
+
}
|
|
250
|
+
this.input.setSelectionRange(pos, pos);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get the currently selected text
|
|
255
|
+
*/
|
|
256
|
+
getSelectedText() {
|
|
257
|
+
if (!this.input)
|
|
258
|
+
return '';
|
|
259
|
+
const start = this.input.selectionStart || 0;
|
|
260
|
+
const end = this.input.selectionEnd || 0;
|
|
261
|
+
return this.value.substring(start, end);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Check if the input is currently focused
|
|
265
|
+
*/
|
|
266
|
+
isFocused() {
|
|
267
|
+
return this.focused && document.activeElement === this.input;
|
|
268
|
+
}
|
|
269
|
+
// ========================================
|
|
119
270
|
// EVENT HANDLING METHODS
|
|
120
271
|
// ========================================
|
|
121
272
|
/**
|
|
@@ -174,6 +325,16 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
174
325
|
}
|
|
175
326
|
const target = e.target;
|
|
176
327
|
const newValue = target.value;
|
|
328
|
+
// Check character limit
|
|
329
|
+
if (this.maxLength && newValue.length > this.maxLength) {
|
|
330
|
+
this._dispatchInputEvent('nr-character-limit-exceeded', {
|
|
331
|
+
value: newValue,
|
|
332
|
+
target: target,
|
|
333
|
+
limit: this.maxLength,
|
|
334
|
+
originalEvent: e
|
|
335
|
+
});
|
|
336
|
+
// Note: HTML maxlength attribute usually prevents this, but we dispatch event for awareness
|
|
337
|
+
}
|
|
177
338
|
if (this.type === "number" /* INPUT_TYPE.NUMBER */ && newValue) {
|
|
178
339
|
const validation = InputValidationUtils.validateNumericValue(newValue, this.min, this.max);
|
|
179
340
|
if (!validation.isValid) {
|
|
@@ -196,10 +357,31 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
196
357
|
});
|
|
197
358
|
}
|
|
198
359
|
_focusEvent(e) {
|
|
199
|
-
this.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
360
|
+
this.focused = true;
|
|
361
|
+
// Handle cursor restoration if requested
|
|
362
|
+
const input = e.target;
|
|
363
|
+
if (input.dataset.restoreCursor) {
|
|
364
|
+
const position = parseInt(input.dataset.restoreCursor, 10);
|
|
365
|
+
this.setCursorPosition(position);
|
|
366
|
+
delete input.dataset.restoreCursor;
|
|
367
|
+
}
|
|
368
|
+
const focusDetail = {
|
|
369
|
+
focused: true,
|
|
370
|
+
cursorPosition: this.getCursorPosition(),
|
|
371
|
+
selectedText: this.getSelectedText()
|
|
372
|
+
};
|
|
373
|
+
this._dispatchInputEvent('nr-focus', Object.assign({ target: e.target, value: this.value }, focusDetail));
|
|
374
|
+
this._dispatchInputEvent('nr-focus-change', focusDetail);
|
|
375
|
+
}
|
|
376
|
+
_blurEvent(e) {
|
|
377
|
+
this.focused = false;
|
|
378
|
+
const focusDetail = {
|
|
379
|
+
focused: false,
|
|
380
|
+
cursorPosition: this.getCursorPosition(),
|
|
381
|
+
selectedText: this.getSelectedText()
|
|
382
|
+
};
|
|
383
|
+
this._dispatchInputEvent('nr-blur', Object.assign({ target: e.target, value: this.value }, focusDetail));
|
|
384
|
+
this._dispatchInputEvent('nr-focus-change', focusDetail);
|
|
203
385
|
}
|
|
204
386
|
_handleIconKeydown(keyDownEvent) {
|
|
205
387
|
if (keyDownEvent.key === 'Enter' || keyDownEvent.key === ' ') {
|
|
@@ -208,6 +390,9 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
208
390
|
if (target.id === 'copy-icon') {
|
|
209
391
|
this._onCopy();
|
|
210
392
|
}
|
|
393
|
+
else if (target.id === 'clear-icon') {
|
|
394
|
+
this._onClear();
|
|
395
|
+
}
|
|
211
396
|
else if (target.id === 'password-icon') {
|
|
212
397
|
this._togglePasswordIcon();
|
|
213
398
|
}
|
|
@@ -234,6 +419,27 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
234
419
|
}
|
|
235
420
|
});
|
|
236
421
|
}
|
|
422
|
+
_onClear() {
|
|
423
|
+
if (this.disabled || this.readonly) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const previousValue = this.value;
|
|
427
|
+
this.value = EMPTY_STRING;
|
|
428
|
+
// Update the input element value
|
|
429
|
+
if (this.input) {
|
|
430
|
+
this.input.value = EMPTY_STRING;
|
|
431
|
+
}
|
|
432
|
+
this._dispatchInputEvent('nr-clear', {
|
|
433
|
+
previousValue,
|
|
434
|
+
target: this.input
|
|
435
|
+
});
|
|
436
|
+
// Also dispatch input event for consistency
|
|
437
|
+
this._dispatchInputEvent('nr-input', {
|
|
438
|
+
value: this.value,
|
|
439
|
+
target: this.input,
|
|
440
|
+
action: 'clear'
|
|
441
|
+
});
|
|
442
|
+
}
|
|
237
443
|
// ========================================
|
|
238
444
|
// OPERATION METHODS
|
|
239
445
|
// ========================================
|
|
@@ -314,10 +520,12 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
314
520
|
aria-describedby=${this._getAriaDescribedBy()}
|
|
315
521
|
@input=${this._valueChange}
|
|
316
522
|
@focus=${this._focusEvent}
|
|
523
|
+
@blur=${this._blurEvent}
|
|
317
524
|
@keydown=${this._handleKeyDown}
|
|
318
525
|
/>
|
|
319
526
|
${InputRenderUtils.renderSuffix()}
|
|
320
527
|
${InputRenderUtils.renderCopyIcon(this.withCopy, this.disabled, this.readonly, () => this._onCopy(), (e) => this._handleIconKeydown(e))}
|
|
528
|
+
${InputRenderUtils.renderClearIcon(this.allowClear, this.value, this.disabled, this.readonly, () => this._onClear(), (e) => this._handleIconKeydown(e))}
|
|
321
529
|
${InputRenderUtils.renderStateIcon(this.state)}
|
|
322
530
|
${InputRenderUtils.renderCalendarIcon(this.state, this.type)}
|
|
323
531
|
${InputRenderUtils.renderPasswordIcon(this.type, this.inputType, this.disabled, this.readonly, () => this._togglePasswordIcon(), (e) => this._handleIconKeydown(e))}
|
|
@@ -326,6 +534,11 @@ let NrInputElement = class NrInputElement extends NuralyUIBaseMixin(LitElement)
|
|
|
326
534
|
${InputRenderUtils.renderAddonAfter(this.hasAddonAfter, (e) => this._handleSlotChange(e))}
|
|
327
535
|
</div>
|
|
328
536
|
<slot name="helper-text"></slot>
|
|
537
|
+
${this.showCount ? html `
|
|
538
|
+
<div class="character-count" ?data-over-limit=${this.isOverCharacterLimit}>
|
|
539
|
+
${this.characterCountDisplay}
|
|
540
|
+
</div>
|
|
541
|
+
` : ''}
|
|
329
542
|
`;
|
|
330
543
|
}
|
|
331
544
|
};
|
|
@@ -345,6 +558,9 @@ __decorate([
|
|
|
345
558
|
__decorate([
|
|
346
559
|
property({ type: String })
|
|
347
560
|
], NrInputElement.prototype, "size", void 0);
|
|
561
|
+
__decorate([
|
|
562
|
+
property({ type: String, reflect: true })
|
|
563
|
+
], NrInputElement.prototype, "variant", void 0);
|
|
348
564
|
__decorate([
|
|
349
565
|
property({ reflect: true })
|
|
350
566
|
], NrInputElement.prototype, "type", void 0);
|
|
@@ -366,6 +582,15 @@ __decorate([
|
|
|
366
582
|
__decorate([
|
|
367
583
|
property({ type: Boolean, reflect: true })
|
|
368
584
|
], NrInputElement.prototype, "withCopy", void 0);
|
|
585
|
+
__decorate([
|
|
586
|
+
property({ type: Boolean, reflect: true })
|
|
587
|
+
], NrInputElement.prototype, "allowClear", void 0);
|
|
588
|
+
__decorate([
|
|
589
|
+
property({ type: Boolean, reflect: true })
|
|
590
|
+
], NrInputElement.prototype, "showCount", void 0);
|
|
591
|
+
__decorate([
|
|
592
|
+
property({ type: Number })
|
|
593
|
+
], NrInputElement.prototype, "maxLength", void 0);
|
|
369
594
|
__decorate([
|
|
370
595
|
state()
|
|
371
596
|
], NrInputElement.prototype, "inputType", void 0);
|
|
@@ -375,6 +600,9 @@ __decorate([
|
|
|
375
600
|
__decorate([
|
|
376
601
|
state()
|
|
377
602
|
], NrInputElement.prototype, "hasAddonAfter", void 0);
|
|
603
|
+
__decorate([
|
|
604
|
+
state()
|
|
605
|
+
], NrInputElement.prototype, "focused", void 0);
|
|
378
606
|
__decorate([
|
|
379
607
|
query('#input')
|
|
380
608
|
], NrInputElement.prototype, "input", void 0);
|
package/input.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.component.js","sourceRoot":"","sources":["../../../src/components/input/input.component.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;GAIG;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;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C,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;4CACH;AAGvB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACX;AAGd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACZ;AAGb;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACZ;AAGb;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACE;AAG3B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oDACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;gDACxB;AAGjB;IADC,KAAK,EAAE;iDACiB;AAGzB;IADC,KAAK,EAAE;sDACe;AAGvB;IADC,KAAK,EAAE;qDACc;AAGtB;IADC,KAAK,CAAC,QAAQ,CAAC;6CACS;AAhDd,cAAc;IAD1B,aAAa,CAAC,UAAU,CAAC;GACb,cAAc,CA8X1B;SA9XY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, PropertyValues, html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { styles } from './input.style.js';\nimport { INPUT_TYPE, INPUT_STATE, INPUT_SIZE, EMPTY_STRING } from './input.types.js';\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\nimport { InputValidationUtils } from './utils/input-validation.utils.js';\nimport { InputRenderUtils } from './utils/input-renderers.js';\nimport '../icon/icon.component.js';\n\n@customElement('nr-input')\nexport class NrInputElement extends NuralyUIBaseMixin(LitElement) {\n\n @property({type: Boolean, reflect: true})\n disabled = false;\n\n @property({type: Boolean, reflect: true})\n readonly = false;\n\n @property({type: String, reflect: true})\n state = INPUT_STATE.Default;\n\n @property({type: String})\n value = EMPTY_STRING;\n\n @property({type: String})\n size = INPUT_SIZE.Medium;\n\n @property({reflect: true})\n type = INPUT_TYPE.TEXT;\n\n @property({type: String})\n step?: string;\n\n @property({type: String})\n min?: string;\n\n @property({type: String})\n max?: string;\n\n @property({type: String})\n placeholder = EMPTY_STRING;\n\n @property({type: String})\n autocomplete = 'off';\n\n @property({type: Boolean, reflect: true})\n withCopy = false;\n\n @state()\n inputType = EMPTY_STRING;\n\n @state()\n hasAddonBefore = false;\n\n @state()\n hasAddonAfter = false;\n\n @query('#input')\n input!: HTMLInputElement;\n\n /**\n * Required components that must be registered for this component to work properly\n */\n override requiredComponents = ['hy-icon'];\n\n /**\n * Check for required dependencies when component is connected to DOM\n */\n override connectedCallback() {\n super.connectedCallback();\n this.validateDependencies();\n }\n\n override willUpdate(_changedProperties: PropertyValues): void {\n if (_changedProperties.has('type')) {\n this.inputType = this.type;\n if (this.inputType === INPUT_TYPE.NUMBER && this.min && !this.value) {\n this.value = this.min;\n }\n }\n \n // Validate numeric properties when they change\n if (_changedProperties.has('type') || \n _changedProperties.has('min') || \n _changedProperties.has('max') || \n _changedProperties.has('step')) {\n InputValidationUtils.validateNumericProperties(this.type, this.min, this.max, this.step);\n }\n }\n\n override updated(_changedProperties: PropertyValues): void {\n if (_changedProperties.has('step') || _changedProperties.has('min') || _changedProperties.has('max')) {\n const input = this.input;\n if (input) {\n if (this.step) input.setAttribute('step', this.step);\n else input.removeAttribute('step');\n \n if (this.min) input.setAttribute('min', this.min);\n else input.removeAttribute('min');\n \n if (this.max) input.setAttribute('max', this.max);\n else input.removeAttribute('max');\n }\n }\n }\n\n override firstUpdated(): void {\n this._checkInitialSlotContent();\n }\n\n /**\n * Check initial slot content on first render\n */\n private _checkInitialSlotContent(): void {\n // Check for addon-before content\n const addonBeforeElements = this.querySelectorAll('[slot=\"addon-before\"]');\n this.hasAddonBefore = addonBeforeElements.length > 0;\n\n // Check for addon-after content \n const addonAfterElements = this.querySelectorAll('[slot=\"addon-after\"]');\n this.hasAddonAfter = addonAfterElements.length > 0;\n }\n\n /**\n * Handle slot changes to determine addon visibility\n */\n private _handleSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement;\n const slotName = slot.name;\n \n if (slotName === 'addon-before') {\n this.hasAddonBefore = slot.assignedElements().length > 0;\n } else if (slotName === 'addon-after') {\n this.hasAddonAfter = slot.assignedElements().length > 0;\n }\n }\n\n // ========================================\n // EVENT HANDLING METHODS\n // ========================================\n\n /**\n * Centralized event dispatcher to ensure consistent event structure\n */\n private _dispatchInputEvent(eventName: string, detail: any): void {\n this.dispatchEvent(\n new CustomEvent(eventName, {\n detail,\n bubbles: true\n })\n );\n }\n\n private _handleKeyDown(keyDownEvent: KeyboardEvent) {\n // Prevent all key input when readonly\n if (this.readonly) {\n const allowedReadonlyKeys = [\n 'Tab', 'Escape', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown',\n 'Home', 'End', 'PageUp', 'PageDown'\n ];\n \n if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) {\n const allowedCombinations = ['KeyA', 'KeyC'];\n if (allowedCombinations.includes(keyDownEvent.code)) {\n return;\n }\n }\n \n if (!allowedReadonlyKeys.includes(keyDownEvent.key)) {\n keyDownEvent.preventDefault();\n return;\n }\n }\n\n // Handle Enter key\n if (keyDownEvent.key === 'Enter') {\n this._dispatchInputEvent('nr-enter', {\n target: keyDownEvent.target,\n value: this.value,\n originalEvent: keyDownEvent\n });\n return;\n }\n\n // Prevent non-numeric input for number type\n if (this.type === INPUT_TYPE.NUMBER) {\n InputValidationUtils.preventNonNumericInput(keyDownEvent, this.min);\n \n if (keyDownEvent.defaultPrevented) {\n this._dispatchInputEvent('nr-invalid-key', {\n key: keyDownEvent.key,\n target: keyDownEvent.target,\n value: this.value,\n originalEvent: keyDownEvent\n });\n }\n }\n }\n\n private _valueChange(e: Event) {\n if (this.readonly) {\n e.preventDefault();\n return;\n }\n\n const target = e.target as HTMLInputElement;\n const newValue = target.value;\n \n if (this.type === INPUT_TYPE.NUMBER && newValue) {\n const validation = InputValidationUtils.validateNumericValue(newValue, this.min, this.max);\n \n if (!validation.isValid) {\n console.warn(validation.warnings[0]);\n this._dispatchInputEvent('nr-validation-error', {\n value: newValue,\n target: target,\n error: validation.warnings[0],\n originalEvent: e\n });\n return;\n }\n \n validation.warnings.forEach(warning => console.warn(warning));\n }\n \n this.value = newValue;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: target,\n originalEvent: e \n });\n }\n\n private _focusEvent(e: Event) {\n this._dispatchInputEvent('nr-focus', {\n target: e.target,\n value: this.value\n });\n }\n\n private _handleIconKeydown(keyDownEvent: KeyboardEvent) {\n if (keyDownEvent.key === 'Enter' || keyDownEvent.key === ' ') {\n keyDownEvent.preventDefault();\n const target = keyDownEvent.target as HTMLElement;\n \n if (target.id === 'copy-icon') {\n this._onCopy();\n } else if (target.id === 'password-icon') {\n this._togglePasswordIcon();\n } else if (target.closest('#number-icons')) {\n if (target.getAttribute('name') === 'plus') {\n this._increment();\n } else if (target.getAttribute('name') === 'minus') {\n this._decrement();\n }\n }\n }\n }\n\n private async _onCopy() {\n try {\n const input = this.shadowRoot!.getElementById('input')! as HTMLInputElement;\n input.select();\n await navigator.clipboard.writeText(input.value);\n \n this._dispatchInputEvent('nr-copy-success', { value: input.value });\n } catch (error) {\n this._dispatchInputEvent('nr-copy-error', { error });\n }\n }\n\n // ========================================\n // OPERATION METHODS\n // ========================================\n\n private _increment() {\n try {\n this.input.stepUp();\n this.value = this.input.value;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: this.input,\n action: 'increment'\n });\n } catch (error) {\n console.warn('Failed to increment value:', error);\n this._dispatchInputEvent('nr-increment-error', {\n error,\n value: this.value,\n target: this.input\n });\n }\n }\n\n private _decrement() {\n try {\n this.input.stepDown();\n this.value = this.input.value;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: this.input,\n action: 'decrement'\n });\n } catch (error) {\n console.warn('Failed to decrement value:', error);\n this._dispatchInputEvent('nr-decrement-error', {\n error,\n value: this.value,\n target: this.input\n });\n }\n }\n\n private _togglePasswordIcon() {\n if (this.inputType === INPUT_TYPE.PASSWORD) {\n this.inputType = INPUT_TYPE.TEXT;\n } else if (this.inputType === INPUT_TYPE.TEXT && this.type === INPUT_TYPE.PASSWORD) {\n this.inputType = INPUT_TYPE.PASSWORD;\n }\n }\n\n private _getAriaDescribedBy(): string {\n const describedBy: string[] = [];\n \n const helperSlot = this.shadowRoot?.querySelector('slot[name=\"helper-text\"]');\n if (helperSlot && (helperSlot as HTMLSlotElement).assignedNodes().length > 0) {\n describedBy.push('helper-text');\n }\n \n return describedBy.join(' ') || '';\n }\n\n // ========================================\n // RENDER METHODS\n // ========================================\n\n override render() {\n return html`\n <slot name=\"label\"></slot>\n <div class=\"input-wrapper\" data-theme=\"${this.currentTheme}\">\n ${InputRenderUtils.renderAddonBefore(this.hasAddonBefore, (e: Event) => this._handleSlotChange(e))}\n <div data-size=${this.size} id=\"input-container\">\n ${InputRenderUtils.renderPrefix()}\n <input\n id=\"input\"\n .disabled=${this.disabled}\n .readOnly=${this.readonly}\n .value=${this.value}\n .placeholder=${this.placeholder}\n .type=\"${this.inputType}\"\n .autocomplete=${this.autocomplete}\n aria-invalid=${this.state === INPUT_STATE.Error ? 'true' : 'false'}\n aria-describedby=${this._getAriaDescribedBy()}\n @input=${this._valueChange}\n @focus=${this._focusEvent}\n @keydown=${this._handleKeyDown}\n />\n ${InputRenderUtils.renderSuffix()}\n ${InputRenderUtils.renderCopyIcon(\n this.withCopy,\n this.disabled,\n this.readonly,\n () => this._onCopy(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n ${InputRenderUtils.renderStateIcon(this.state)}\n ${InputRenderUtils.renderCalendarIcon(this.state, this.type)}\n ${InputRenderUtils.renderPasswordIcon(\n this.type,\n this.inputType,\n this.disabled,\n this.readonly,\n () => this._togglePasswordIcon(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n ${InputRenderUtils.renderNumberIcons(\n this.type,\n this.state,\n this.disabled,\n this.readonly,\n () => this._increment(),\n () => this._decrement(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n </div>\n ${InputRenderUtils.renderAddonAfter(this.hasAddonAfter, (e: Event) => this._handleSlotChange(e))}\n </div>\n <slot name=\"helper-text\"></slot>\n `;\n }\n\n static override styles = styles;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"input.component.js","sourceRoot":"","sources":["../../../src/components/input/input.component.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;GAIG;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAsD,YAAY,EAA+C,MAAM,kBAAkB,CAAC;AACjJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,2BAA2B,CAAC;AAGnC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAAjE;;QAGE,aAAQ,GAAG,KAAK,CAAC;QAGjB,aAAQ,GAAG,KAAK,CAAC;QAGjB,UAAK,uCAAuB;QAG5B,UAAK,GAAG,YAAY,CAAC;QAGrB,SAAI,oCAAqB;QAGzB,YAAO,+CAA4B;QAGnC,SAAI,gCAAmB;QAYvB,gBAAW,GAAG,YAAY,CAAC;QAG3B,iBAAY,GAAG,KAAK,CAAC;QAGrB,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,GAAG,KAAK,CAAC;QAGn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,EAAC,CAAC;4CACX;AAGd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACZ;AAGb;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACZ;AAGb;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACE;AAG3B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oDACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;gDACxB;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;kDACtB;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;iDACvB;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDACN;AAGnB;IADC,KAAK,EAAE;iDACiB;AAGzB;IADC,KAAK,EAAE;sDACe;AAGvB;IADC,KAAK,EAAE;qDACc;AAGtB;IADC,KAAK,EAAE;+CACQ;AAGhB;IADC,KAAK,CAAC,QAAQ,CAAC;6CACS;AA/Dd,cAAc;IAD1B,aAAa,CAAC,UAAU,CAAC;GACb,cAAc,CA4oB1B;SA5oBY,cAAc","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, PropertyValues, html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { styles } from './input.style.js';\nimport { INPUT_TYPE, INPUT_STATE, INPUT_SIZE, INPUT_VARIANT, EMPTY_STRING, FocusOptions, BlurOptions, FocusChangeEvent } from './input.types.js';\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\nimport { InputValidationUtils } from './utils/input-validation.utils.js';\nimport { InputRenderUtils } from './utils/input-renderers.js';\nimport '../icon/icon.component.js';\n\n@customElement('nr-input')\nexport class NrInputElement extends NuralyUIBaseMixin(LitElement) {\n\n @property({type: Boolean, reflect: true})\n disabled = false;\n\n @property({type: Boolean, reflect: true})\n readonly = false;\n\n @property({type: String, reflect: true})\n state = INPUT_STATE.Default;\n\n @property({type: String})\n value = EMPTY_STRING;\n\n @property({type: String})\n size = INPUT_SIZE.Medium;\n\n @property({type: String, reflect: true})\n variant = INPUT_VARIANT.Underlined;\n\n @property({reflect: true})\n type = INPUT_TYPE.TEXT;\n\n @property({type: String})\n step?: string;\n\n @property({type: String})\n min?: string;\n\n @property({type: String})\n max?: string;\n\n @property({type: String})\n placeholder = EMPTY_STRING;\n\n @property({type: String})\n autocomplete = 'off';\n\n @property({type: Boolean, reflect: true})\n withCopy = false;\n\n @property({type: Boolean, reflect: true})\n allowClear = false;\n\n @property({type: Boolean, reflect: true})\n showCount = false;\n\n @property({type: Number})\n maxLength?: number;\n\n @state()\n inputType = EMPTY_STRING;\n\n @state()\n hasAddonBefore = false;\n\n @state()\n hasAddonAfter = false;\n\n @state()\n focused = false;\n\n @query('#input')\n input!: HTMLInputElement;\n\n /**\n * Get the character count display text\n */\n get characterCountDisplay(): string {\n const currentLength = this.value.length;\n if (this.maxLength) {\n return `${currentLength}/${this.maxLength}`;\n }\n return `${currentLength}`;\n }\n\n /**\n * Check if character count is over the limit\n */\n get isOverCharacterLimit(): boolean {\n return this.maxLength ? this.value.length > this.maxLength : false;\n }\n\n /**\n * Required components that must be registered for this component to work properly\n */\n override requiredComponents = ['hy-icon'];\n\n /**\n * Check for required dependencies when component is connected to DOM\n */\n override connectedCallback() {\n super.connectedCallback();\n this.validateDependencies();\n }\n\n override willUpdate(_changedProperties: PropertyValues): void {\n if (_changedProperties.has('type')) {\n this.inputType = this.type;\n if (this.inputType === INPUT_TYPE.NUMBER && this.min && !this.value) {\n this.value = this.min;\n }\n }\n \n // Validate numeric properties when they change\n if (_changedProperties.has('type') || \n _changedProperties.has('min') || \n _changedProperties.has('max') || \n _changedProperties.has('step')) {\n InputValidationUtils.validateNumericProperties(this.type, this.min, this.max, this.step);\n }\n }\n\n override updated(_changedProperties: PropertyValues): void {\n if (_changedProperties.has('step') || _changedProperties.has('min') || _changedProperties.has('max') || _changedProperties.has('maxLength')) {\n const input = this.input;\n if (input) {\n if (this.step) input.setAttribute('step', this.step);\n else input.removeAttribute('step');\n \n if (this.min) input.setAttribute('min', this.min);\n else input.removeAttribute('min');\n \n if (this.max) input.setAttribute('max', this.max);\n else input.removeAttribute('max');\n\n if (this.maxLength) input.setAttribute('maxlength', this.maxLength.toString());\n else input.removeAttribute('maxlength');\n }\n }\n }\n\n override firstUpdated(): void {\n this._checkInitialSlotContent();\n }\n\n /**\n * Check initial slot content on first render\n */\n private _checkInitialSlotContent(): void {\n // Check for addon-before content\n const addonBeforeElements = this.querySelectorAll('[slot=\"addon-before\"]');\n this.hasAddonBefore = addonBeforeElements.length > 0;\n\n // Check for addon-after content \n const addonAfterElements = this.querySelectorAll('[slot=\"addon-after\"]');\n this.hasAddonAfter = addonAfterElements.length > 0;\n }\n\n /**\n * Handle slot changes to determine addon visibility\n */\n private _handleSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement;\n const slotName = slot.name;\n \n if (slotName === 'addon-before') {\n this.hasAddonBefore = slot.assignedElements().length > 0;\n } else if (slotName === 'addon-after') {\n this.hasAddonAfter = slot.assignedElements().length > 0;\n }\n }\n\n // ========================================\n // FOCUS MANAGEMENT METHODS\n // ========================================\n\n /**\n * Focus the input with advanced options\n */\n override focus(options?: FocusOptions): void {\n if (!this.input) return;\n\n const focusOptions: FocusOptions = { preventScroll: false, ...options };\n \n // Focus the input element\n this.input.focus({ preventScroll: focusOptions.preventScroll });\n\n // Handle cursor positioning\n if (focusOptions.cursor !== undefined) {\n this.setCursorPosition(focusOptions.cursor);\n }\n\n // Handle text selection\n if (focusOptions.select) {\n this.selectAll();\n }\n }\n\n /**\n * Blur the input with advanced options\n */\n override blur(options?: BlurOptions): void {\n if (!this.input) return;\n\n const currentPosition = this.getCursorPosition();\n \n this.input.blur();\n\n // Restore cursor position if requested\n if (options?.restoreCursor && currentPosition !== -1) {\n // We'll restore it on next focus\n this.input.dataset.restoreCursor = currentPosition.toString();\n }\n }\n\n /**\n * Select all text in the input\n */\n selectAll(): void {\n if (!this.input) return;\n \n // Ensure the input is focused first\n if (document.activeElement !== this.input) {\n this.input.focus();\n }\n \n // Wait for next frame to ensure focus is complete\n requestAnimationFrame(() => {\n if (!this.input) return;\n this.input.select();\n });\n }\n\n /**\n * Select a range of text in the input\n */\n selectRange(start: number, end: number): void {\n if (!this.input) return;\n \n // Ensure the input is focused first\n if (document.activeElement !== this.input) {\n this.input.focus();\n }\n \n // Wait for next frame to ensure focus is complete\n requestAnimationFrame(() => {\n if (!this.input) return;\n \n const maxLength = this.input.value.length;\n const validStart = Math.max(0, Math.min(start, maxLength));\n const validEnd = Math.max(validStart, Math.min(end, maxLength));\n \n this.input.setSelectionRange(validStart, validEnd);\n });\n }\n\n /**\n * Get the current cursor position\n */\n getCursorPosition(): number {\n if (!this.input) return -1;\n return this.input.selectionStart || 0;\n }\n\n /**\n * Set the cursor position\n */\n setCursorPosition(position: number | 'start' | 'end' | 'all'): void {\n if (!this.input) return;\n \n // Ensure the input is focused first\n if (document.activeElement !== this.input) {\n this.input.focus();\n }\n \n requestAnimationFrame(() => {\n if (!this.input) return;\n\n let pos: number;\n const valueLength = this.value.length;\n\n switch (position) {\n case 'start':\n pos = 0;\n break;\n case 'end':\n pos = valueLength;\n break;\n case 'all':\n this.selectAll();\n return;\n default:\n pos = typeof position === 'number' ? Math.min(Math.max(0, position), valueLength) : 0;\n }\n\n this.input.setSelectionRange(pos, pos);\n });\n }\n\n /**\n * Get the currently selected text\n */\n getSelectedText(): string {\n if (!this.input) return '';\n const start = this.input.selectionStart || 0;\n const end = this.input.selectionEnd || 0;\n return this.value.substring(start, end);\n }\n\n /**\n * Check if the input is currently focused\n */\n isFocused(): boolean {\n return this.focused && document.activeElement === this.input;\n }\n\n // ========================================\n // EVENT HANDLING METHODS\n // ========================================\n\n /**\n * Centralized event dispatcher to ensure consistent event structure\n */\n private _dispatchInputEvent(eventName: string, detail: any): void {\n this.dispatchEvent(\n new CustomEvent(eventName, {\n detail,\n bubbles: true\n })\n );\n }\n\n private _handleKeyDown(keyDownEvent: KeyboardEvent) {\n // Prevent all key input when readonly\n if (this.readonly) {\n const allowedReadonlyKeys = [\n 'Tab', 'Escape', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown',\n 'Home', 'End', 'PageUp', 'PageDown'\n ];\n \n if (keyDownEvent.ctrlKey || keyDownEvent.metaKey) {\n const allowedCombinations = ['KeyA', 'KeyC'];\n if (allowedCombinations.includes(keyDownEvent.code)) {\n return;\n }\n }\n \n if (!allowedReadonlyKeys.includes(keyDownEvent.key)) {\n keyDownEvent.preventDefault();\n return;\n }\n }\n\n // Handle Enter key\n if (keyDownEvent.key === 'Enter') {\n this._dispatchInputEvent('nr-enter', {\n target: keyDownEvent.target,\n value: this.value,\n originalEvent: keyDownEvent\n });\n return;\n }\n\n // Prevent non-numeric input for number type\n if (this.type === INPUT_TYPE.NUMBER) {\n InputValidationUtils.preventNonNumericInput(keyDownEvent, this.min);\n \n if (keyDownEvent.defaultPrevented) {\n this._dispatchInputEvent('nr-invalid-key', {\n key: keyDownEvent.key,\n target: keyDownEvent.target,\n value: this.value,\n originalEvent: keyDownEvent\n });\n }\n }\n }\n\n private _valueChange(e: Event) {\n if (this.readonly) {\n e.preventDefault();\n return;\n }\n\n const target = e.target as HTMLInputElement;\n const newValue = target.value;\n \n // Check character limit\n if (this.maxLength && newValue.length > this.maxLength) {\n this._dispatchInputEvent('nr-character-limit-exceeded', {\n value: newValue,\n target: target,\n limit: this.maxLength,\n originalEvent: e\n });\n // Note: HTML maxlength attribute usually prevents this, but we dispatch event for awareness\n }\n \n if (this.type === INPUT_TYPE.NUMBER && newValue) {\n const validation = InputValidationUtils.validateNumericValue(newValue, this.min, this.max);\n \n if (!validation.isValid) {\n console.warn(validation.warnings[0]);\n this._dispatchInputEvent('nr-validation-error', {\n value: newValue,\n target: target,\n error: validation.warnings[0],\n originalEvent: e\n });\n return;\n }\n \n validation.warnings.forEach(warning => console.warn(warning));\n }\n \n this.value = newValue;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: target,\n originalEvent: e \n });\n }\n\n private _focusEvent(e: Event) {\n this.focused = true;\n \n // Handle cursor restoration if requested\n const input = e.target as HTMLInputElement;\n if (input.dataset.restoreCursor) {\n const position = parseInt(input.dataset.restoreCursor, 10);\n this.setCursorPosition(position);\n delete input.dataset.restoreCursor;\n }\n \n const focusDetail: FocusChangeEvent = {\n focused: true,\n cursorPosition: this.getCursorPosition(),\n selectedText: this.getSelectedText()\n };\n \n this._dispatchInputEvent('nr-focus', {\n target: e.target,\n value: this.value,\n ...focusDetail\n });\n \n this._dispatchInputEvent('nr-focus-change', focusDetail);\n }\n\n private _blurEvent(e: Event) {\n this.focused = false;\n \n const focusDetail: FocusChangeEvent = {\n focused: false,\n cursorPosition: this.getCursorPosition(),\n selectedText: this.getSelectedText()\n };\n \n this._dispatchInputEvent('nr-blur', {\n target: e.target,\n value: this.value,\n ...focusDetail\n });\n \n this._dispatchInputEvent('nr-focus-change', focusDetail);\n }\n\n private _handleIconKeydown(keyDownEvent: KeyboardEvent) {\n if (keyDownEvent.key === 'Enter' || keyDownEvent.key === ' ') {\n keyDownEvent.preventDefault();\n const target = keyDownEvent.target as HTMLElement;\n \n if (target.id === 'copy-icon') {\n this._onCopy();\n } else if (target.id === 'clear-icon') {\n this._onClear();\n } else if (target.id === 'password-icon') {\n this._togglePasswordIcon();\n } else if (target.closest('#number-icons')) {\n if (target.getAttribute('name') === 'plus') {\n this._increment();\n } else if (target.getAttribute('name') === 'minus') {\n this._decrement();\n }\n }\n }\n }\n\n private async _onCopy() {\n try {\n const input = this.shadowRoot!.getElementById('input')! as HTMLInputElement;\n input.select();\n await navigator.clipboard.writeText(input.value);\n \n this._dispatchInputEvent('nr-copy-success', { value: input.value });\n } catch (error) {\n this._dispatchInputEvent('nr-copy-error', { error });\n }\n }\n\n private _onClear() {\n if (this.disabled || this.readonly) {\n return;\n }\n\n const previousValue = this.value;\n this.value = EMPTY_STRING;\n \n // Update the input element value\n if (this.input) {\n this.input.value = EMPTY_STRING;\n }\n\n this._dispatchInputEvent('nr-clear', {\n previousValue,\n target: this.input\n });\n\n // Also dispatch input event for consistency\n this._dispatchInputEvent('nr-input', {\n value: this.value,\n target: this.input,\n action: 'clear'\n });\n }\n\n // ========================================\n // OPERATION METHODS\n // ========================================\n\n private _increment() {\n try {\n this.input.stepUp();\n this.value = this.input.value;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: this.input,\n action: 'increment'\n });\n } catch (error) {\n console.warn('Failed to increment value:', error);\n this._dispatchInputEvent('nr-increment-error', {\n error,\n value: this.value,\n target: this.input\n });\n }\n }\n\n private _decrement() {\n try {\n this.input.stepDown();\n this.value = this.input.value;\n this._dispatchInputEvent('nr-input', {\n value: this.value, \n target: this.input,\n action: 'decrement'\n });\n } catch (error) {\n console.warn('Failed to decrement value:', error);\n this._dispatchInputEvent('nr-decrement-error', {\n error,\n value: this.value,\n target: this.input\n });\n }\n }\n\n private _togglePasswordIcon() {\n if (this.inputType === INPUT_TYPE.PASSWORD) {\n this.inputType = INPUT_TYPE.TEXT;\n } else if (this.inputType === INPUT_TYPE.TEXT && this.type === INPUT_TYPE.PASSWORD) {\n this.inputType = INPUT_TYPE.PASSWORD;\n }\n }\n\n private _getAriaDescribedBy(): string {\n const describedBy: string[] = [];\n \n const helperSlot = this.shadowRoot?.querySelector('slot[name=\"helper-text\"]');\n if (helperSlot && (helperSlot as HTMLSlotElement).assignedNodes().length > 0) {\n describedBy.push('helper-text');\n }\n \n return describedBy.join(' ') || '';\n }\n\n // ========================================\n // RENDER METHODS\n // ========================================\n\n override render() {\n return html`\n <slot name=\"label\"></slot>\n <div class=\"input-wrapper\" data-theme=\"${this.currentTheme}\">\n ${InputRenderUtils.renderAddonBefore(this.hasAddonBefore, (e: Event) => this._handleSlotChange(e))}\n <div data-size=${this.size} id=\"input-container\">\n ${InputRenderUtils.renderPrefix()}\n <input\n id=\"input\"\n .disabled=${this.disabled}\n .readOnly=${this.readonly}\n .value=${this.value}\n .placeholder=${this.placeholder}\n .type=\"${this.inputType}\"\n .autocomplete=${this.autocomplete}\n aria-invalid=${this.state === INPUT_STATE.Error ? 'true' : 'false'}\n aria-describedby=${this._getAriaDescribedBy()}\n @input=${this._valueChange}\n @focus=${this._focusEvent}\n @blur=${this._blurEvent}\n @keydown=${this._handleKeyDown}\n />\n ${InputRenderUtils.renderSuffix()}\n ${InputRenderUtils.renderCopyIcon(\n this.withCopy,\n this.disabled,\n this.readonly,\n () => this._onCopy(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n ${InputRenderUtils.renderClearIcon(\n this.allowClear,\n this.value,\n this.disabled,\n this.readonly,\n () => this._onClear(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n ${InputRenderUtils.renderStateIcon(this.state)}\n ${InputRenderUtils.renderCalendarIcon(this.state, this.type)}\n ${InputRenderUtils.renderPasswordIcon(\n this.type,\n this.inputType,\n this.disabled,\n this.readonly,\n () => this._togglePasswordIcon(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n ${InputRenderUtils.renderNumberIcons(\n this.type,\n this.state,\n this.disabled,\n this.readonly,\n () => this._increment(),\n () => this._decrement(),\n (e: KeyboardEvent) => this._handleIconKeydown(e)\n )}\n </div>\n ${InputRenderUtils.renderAddonAfter(this.hasAddonAfter, (e: Event) => this._handleSlotChange(e))}\n </div>\n <slot name=\"helper-text\"></slot>\n ${this.showCount ? html`\n <div class=\"character-count\" ?data-over-limit=${this.isOverCharacterLimit}>\n ${this.characterCountDisplay}\n </div>\n ` : ''}\n `;\n }\n\n static override styles = styles;\n}\n\n"]}
|
package/input.style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.style.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.style.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.style.ts"],"names":[],"mappings":"AA8jBA,eAAO,MAAM,MAAM,2BAA+C,CAAC"}
|
package/input.style.js
CHANGED
|
@@ -114,6 +114,13 @@ const inputStyle = css `
|
|
|
114
114
|
cursor: pointer;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/* Clear functionality icon */
|
|
118
|
+
#clear-icon {
|
|
119
|
+
padding-right: var(--hybrid-input-clear-icon-padding-right, var(--hybrid-input-local-clear-icon-padding-right));
|
|
120
|
+
--hybrid-icon-color: var(--hybrid-input-clear-icon-color, var(--hybrid-input-local-clear-icon-color));
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
}
|
|
123
|
+
|
|
117
124
|
/*
|
|
118
125
|
* Number input increment/decrement icons container
|
|
119
126
|
* Positioned absolutely for overlay on input
|
|
@@ -157,14 +164,16 @@ const inputStyle = css `
|
|
|
157
164
|
:host([disabled]) #warning-icon,
|
|
158
165
|
:host([disabled]) #number-icons,
|
|
159
166
|
:host([disabled]) #calendar-icon,
|
|
160
|
-
:host([disabled]) #copy-icon
|
|
167
|
+
:host([disabled]) #copy-icon,
|
|
168
|
+
:host([disabled]) #clear-icon {
|
|
161
169
|
opacity: var(--hybrid-input-disabled-icon-opacity, var(--hybrid-input-local-disabled-icon-opacity));
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
/* Disabled icons cursor override */
|
|
165
173
|
:host([disabled]) #password-icon,
|
|
166
174
|
:host([disabled]) #number-icons,
|
|
167
|
-
:host([disabled]) #copy-icon
|
|
175
|
+
:host([disabled]) #copy-icon,
|
|
176
|
+
:host([disabled]) #clear-icon {
|
|
168
177
|
cursor: not-allowed;
|
|
169
178
|
}
|
|
170
179
|
|
|
@@ -275,6 +284,90 @@ const inputStyle = css `
|
|
|
275
284
|
opacity: 0.6;
|
|
276
285
|
}
|
|
277
286
|
|
|
287
|
+
/* ========================================
|
|
288
|
+
* INPUT VARIANT STYLES
|
|
289
|
+
* ======================================== */
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
* Outlined variant - full border around input
|
|
293
|
+
* Default: light border, focus: blue border
|
|
294
|
+
*/
|
|
295
|
+
:host([variant='outlined']) #input-container {
|
|
296
|
+
border: var(--hybrid-input-outlined-border, var(--hybrid-input-local-outlined-border));
|
|
297
|
+
border-radius: var(--hybrid-input-outlined-border-radius, var(--hybrid-input-local-outlined-border-radius));
|
|
298
|
+
background-color: var(--hybrid-input-outlined-background, var(--hybrid-input-local-outlined-background));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
:host([variant='outlined']) .input-wrapper {
|
|
302
|
+
background-color: transparent;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
:host([variant='outlined']:not([state='error'])) #input-container:focus-within {
|
|
306
|
+
border: var(--hybrid-input-outlined-focus-border, var(--hybrid-input-local-outlined-focus-border));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/*
|
|
310
|
+
* Filled variant - background with bottom border only
|
|
311
|
+
* Subtle background with bottom border indication
|
|
312
|
+
*/
|
|
313
|
+
:host([variant='filled']) #input-container {
|
|
314
|
+
background-color: var(--hybrid-input-filled-background, var(--hybrid-input-local-filled-background));
|
|
315
|
+
border-radius: var(--hybrid-input-filled-border-radius, var(--hybrid-input-local-filled-border-radius));
|
|
316
|
+
border-bottom: var(--hybrid-input-filled-border-bottom, var(--hybrid-input-local-filled-border-bottom));
|
|
317
|
+
border-top: none;
|
|
318
|
+
border-left: none;
|
|
319
|
+
border-right: none;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:host([variant='filled']) .input-wrapper {
|
|
323
|
+
background-color: transparent;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
:host([variant='filled']:not([state='error'])) #input-container:focus-within {
|
|
327
|
+
border-bottom: var(--hybrid-input-filled-focus-border-bottom, var(--hybrid-input-local-filled-focus-border-bottom));
|
|
328
|
+
border-top: none;
|
|
329
|
+
border-left: none;
|
|
330
|
+
border-right: none;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/*
|
|
334
|
+
* Borderless variant - no borders, focus with outline
|
|
335
|
+
* Clean appearance with focus indication via outline
|
|
336
|
+
*/
|
|
337
|
+
:host([variant='borderless']) #input-container {
|
|
338
|
+
background-color: var(--hybrid-input-borderless-background, var(--hybrid-input-local-borderless-background));
|
|
339
|
+
border: none;
|
|
340
|
+
border-radius: var(--hybrid-input-borderless-border-radius, var(--hybrid-input-local-borderless-border-radius));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
:host([variant='borderless']) .input-wrapper {
|
|
344
|
+
background-color: transparent;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
:host([variant='borderless']:not([state='error'])) #input-container:focus-within {
|
|
348
|
+
outline: var(--hybrid-input-borderless-focus-outline, var(--hybrid-input-local-borderless-focus-outline));
|
|
349
|
+
border: none;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/*
|
|
353
|
+
* Underlined variant - bottom border only (default/current behavior)
|
|
354
|
+
* Maintains existing behavior as default
|
|
355
|
+
*/
|
|
356
|
+
:host([variant='underlined']) #input-container {
|
|
357
|
+
border-bottom: var(--hybrid-input-underlined-border-bottom, var(--hybrid-input-local-underlined-border-bottom));
|
|
358
|
+
border-top: none;
|
|
359
|
+
border-left: none;
|
|
360
|
+
border-right: none;
|
|
361
|
+
border-radius: 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
:host([variant='underlined']:not([state='error'])) #input-container:focus-within {
|
|
365
|
+
border-bottom: var(--hybrid-input-underlined-focus-border-bottom, var(--hybrid-input-local-underlined-focus-border-bottom));
|
|
366
|
+
border-top: none;
|
|
367
|
+
border-left: none;
|
|
368
|
+
border-right: none;
|
|
369
|
+
}
|
|
370
|
+
|
|
278
371
|
/* ========================================
|
|
279
372
|
* INPUT ELEMENT STYLES
|
|
280
373
|
* ======================================== */
|
|
@@ -309,19 +402,26 @@ const inputStyle = css `
|
|
|
309
402
|
* ======================================== */
|
|
310
403
|
|
|
311
404
|
/*
|
|
312
|
-
* Error state styling
|
|
405
|
+
* Error state styling - works with all variants
|
|
313
406
|
* Applied when state='error' and not disabled
|
|
314
407
|
*/
|
|
315
|
-
:host(:not([disabled])[state='error'])
|
|
316
|
-
border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border));
|
|
408
|
+
:host(:not([disabled])[state='error']) #input-container {
|
|
409
|
+
border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;
|
|
410
|
+
outline: none !important;
|
|
317
411
|
}
|
|
318
412
|
|
|
319
|
-
/*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
413
|
+
/* Override variant-specific error state styling */
|
|
414
|
+
:host([variant='borderless'][state='error']) #input-container {
|
|
415
|
+
border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;
|
|
416
|
+
outline: none !important;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
:host([variant='underlined'][state='error']) #input-container,
|
|
420
|
+
:host([variant='filled'][state='error']) #input-container {
|
|
421
|
+
border-top: none !important;
|
|
422
|
+
border-left: none !important;
|
|
423
|
+
border-right: none !important;
|
|
424
|
+
border-bottom: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;
|
|
325
425
|
}
|
|
326
426
|
|
|
327
427
|
/*
|
|
@@ -450,6 +550,23 @@ const sizeInputStyle = css `
|
|
|
450
550
|
padding-left: var(--hybrid-input-small-padding-left, var(--hybrid-input-local-small-padding-left));
|
|
451
551
|
padding-right: var(--hybrid-input-small-padding-right, var(--hybrid-input-local-small-padding-right));
|
|
452
552
|
}
|
|
553
|
+
|
|
554
|
+
/*
|
|
555
|
+
* Character count display
|
|
556
|
+
* Shows character count and limit information
|
|
557
|
+
*/
|
|
558
|
+
.character-count {
|
|
559
|
+
font-size: var(--hybrid-input-character-count-font-size, var(--hybrid-input-local-character-count-font-size));
|
|
560
|
+
color: var(--hybrid-input-character-count-color, var(--hybrid-input-local-character-count-color));
|
|
561
|
+
text-align: right;
|
|
562
|
+
margin-top: var(--hybrid-input-character-count-margin-top, var(--hybrid-input-local-character-count-margin-top));
|
|
563
|
+
font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/* Character count over limit styling */
|
|
567
|
+
.character-count[data-over-limit] {
|
|
568
|
+
color: var(--hybrid-input-character-count-over-limit-color, var(--hybrid-input-local-character-count-over-limit-color));
|
|
569
|
+
}
|
|
453
570
|
`;
|
|
454
571
|
export const styles = [inputStyle, sizeInputStyle, styleVariables];
|
|
455
572
|
//# sourceMappingURL=input.style.js.map
|
package/input.style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.style.js","sourceRoot":"","sources":["../../../src/components/input/input.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkZrB,CAAC;AAEF;;;GAGG;AACH,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzB,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { styleVariables } from './input.style.variable.js';\n\n/**\n * Input component styles for the Hybrid UI Library\n * \n * This file contains all the styling for the nr-input component, including:\n * - Base input styles with CSS custom properties for theming\n * - Multiple input states (default, warning, error)\n * - Size variations (small, medium, large)\n * - Different input types (text, password, number, calendar)\n * - Icon positioning and styling\n * - Focus, disabled, and validation states\n * - Dark theme support\n * \n * The styling system uses CSS custom properties with fallbacks to allow\n * for both global and local customization of input appearance.\n */\n\nconst inputStyle = css`\n /* \n * Host element base styles\n * Container for the input component with flexible layout\n */\n :host {\n display: flex;\n flex-direction: column;\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n }\n\n /* \n * Base input wrapper and input element styles\n * Background applied to wrapper to cover entire container including addons\n * Uses CSS custom properties with fallbacks for comprehensive theming support\n * Properties follow the pattern: --hybrid-input-{property}, --hybrid-input-local-{property}\n */\n .input-wrapper {\n background-color: var(--hybrid-input-background-color, var(--hybrid-input-local-background-color));\n }\n\n #input-container > input {\n background-color: transparent;\n }\n\n /* \n * Disabled state styles for wrapper and input\n * Applied when input is disabled - removes interactivity and applies muted colors\n */\n :host([disabled]) .input-wrapper {\n background-color: var(--hybrid-input-disabled-background-color, var(--hybrid-input-local-disabled-background-color));\n }\n\n :host([disabled]) #input-container > input {\n background-color: transparent;\n cursor: not-allowed;\n }\n\n /* \n * Icon base styles\n * Common styling for all icons within the input component\n */\n hy-icon {\n display: flex;\n align-items: center;\n }\n\n /* \n * Placeholder styling\n * Customizable placeholder text appearance\n */\n ::placeholder {\n color: var(--hybrid-input-placeholder-color, var(--hybrid-input-local-placeholder-color));\n font-size: var(--hybrid-input-placeholder-font-size, var(--hybrid-input-local-placeholder-font-size));\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n }\n\n /* \n * Disabled placeholder styling\n * Applied when input is disabled\n */\n :host([disabled]) ::placeholder {\n color: var(--hybrid-input-disabled-placeholder-color, var(--hybrid-input-local-disabled-placeholder-color));\n }\n\n /* ========================================\n * ICON VARIANTS AND STATES\n * ======================================== */\n\n /* Warning state icon */\n #warning-icon {\n --hybrid-icon-color: var(--hybrid-input-warning-icon-color, var(--hybrid-input-local-warning-icon-color));\n }\n\n /* Error state icon */\n #error-icon {\n --hybrid-icon-color: var(--hybrid-input-error-icon-color, var(--hybrid-input-local-error-icon-color));\n }\n\n /* Calendar input type icon */\n #calendar-icon {\n --hybrid-icon-color: var(--hybrid-input-calendar-icon-color, var(--hybrid-input-local-calendar-icon-color));\n }\n\n /* Password toggle icon */\n #password-icon {\n padding-left: var(--hybrid-input-password-icon-padding-left, var(--hybrid-input-local-password-icon-padding-left));\n padding-right: var(--hybrid-input-password-icon-padding-right, var(--hybrid-input-local-password-icon-padding-right));\n cursor: pointer;\n --hybrid-icon-color: var(--hybrid-input-password-icon-color, var(--hybrid-input-local-password-icon-color));\n }\n\n /* Copy functionality icon */\n #copy-icon {\n padding-right: var(--hybrid-input-copy-icon-padding-right, var(--hybrid-input-local-copy-icon-padding-right));\n --hybrid-icon-color: var(--hybrid-input-copy-icon-color, var(--hybrid-input-local-copy-icon-color));\n cursor: pointer;\n }\n\n /* \n * Number input increment/decrement icons container\n * Positioned absolutely for overlay on input\n */\n #number-icons {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 0;\n height: 100%;\n width: var(--hybrid-input-number-icons-container-width, var(--hybrid-input-local-number-icons-container-width));\n padding-right: var(--hybrid-input-number-icons-container-padding-right, var(--hybrid-input-local-number-icons-container-padding-right));\n }\n\n /* Individual number icons styling */\n #number-icons hy-icon {\n --hybrid-icon-color: var(--hybrid-input-number-icons-color, var(--hybrid-input-local-number-icons-color));\n padding-left: var(--hybrid-input-number-icons-padding-left, var(--hybrid-input-local-number-icons-padding-left));\n padding-right: var(--hybrid-input-number-icons-padding-right, var(--hybrid-input-local-number-icons-padding-right));\n width: var(--hybrid-input-number-icons-width, var(--hybrid-input-local-number-icons-width));\n height: var(--hybrid-input-number-icons-height, var(--hybrid-input-local-number-icons-height));\n }\n\n /* Number icons separator styling */\n #icons-separator {\n color: var(--hybrid-input-number-icons-separator-color, var(--hybrid-input-local-number-icons-separator-color));\n padding-bottom: var(--hybrid-input-number-icons-separator-padding-bottom, var(--hybrid-input-local-number-icons-separator-padding-bottom));\n padding-left: var(--hybrid-input-number-icons-separator-padding-left, var(--hybrid-input-local-number-icons-separator-padding-left));\n padding-right: var(--hybrid-input-number-icons-separator-padding-right, var(--hybrid-input-local-number-icons-separator-padding-right));\n }\n\n /* \n * Disabled state for all icons\n * Applied when input is disabled - reduces opacity and disables interaction\n */\n :host([disabled]) #password-icon,\n :host([disabled]) #error-icon,\n :host([disabled]) #warning-icon,\n :host([disabled]) #number-icons,\n :host([disabled]) #calendar-icon,\n :host([disabled]) #copy-icon {\n opacity: var(--hybrid-input-disabled-icon-opacity, var(--hybrid-input-local-disabled-icon-opacity));\n }\n\n /* Disabled icons cursor override */\n :host([disabled]) #password-icon,\n :host([disabled]) #number-icons,\n :host([disabled]) #copy-icon {\n cursor: not-allowed;\n }\n\n /* ========================================\n * INPUT CONTAINER STYLES\n * ======================================== */\n\n /* \n * Input wrapper - contains addons and input container\n * Provides horizontal layout for addon before/after elements\n */\n .input-wrapper {\n display: flex;\n align-items: stretch;\n width: 100%;\n }\n\n /* \n * Addon before element - content before input (outside borders)\n * Styled to visually connect with input\n */\n .input-addon-before {\n background-color: var(--hybrid-input-addon-background-color, var(--hybrid-input-local-addon-background-color));\n border: var(--hybrid-input-border, var(--hybrid-input-local-border));\n border-right: none;\n border-top-left-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n border-bottom-left-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n padding: var(--hybrid-input-addon-padding, var(--hybrid-input-local-addon-padding));\n display: flex;\n align-items: center;\n color: var(--hybrid-input-addon-color, var(--hybrid-input-local-addon-color));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n white-space: nowrap;\n min-width: 0; /* Allow shrinking */\n flex-shrink: 0; /* Prevent shrinking */\n }\n\n /* \n * Addon after element - content after input (outside borders)\n * Styled to visually connect with input\n */\n .input-addon-after {\n background-color: var(--hybrid-input-addon-background-color, var(--hybrid-input-local-addon-background-color));\n border: var(--hybrid-input-border, var(--hybrid-input-local-border));\n border-left: none;\n border-top-right-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n border-bottom-right-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n padding: var(--hybrid-input-addon-padding, var(--hybrid-input-local-addon-padding));\n display: flex;\n align-items: center;\n color: var(--hybrid-input-addon-color, var(--hybrid-input-local-addon-color));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n white-space: nowrap;\n min-width: 0; /* Allow shrinking */\n flex-shrink: 0; /* Prevent shrinking */\n }\n\n /* \n * Input container border radius adjustments when addons are present\n * Removes border radius on sides where addons are attached\n */\n .input-wrapper:has(.input-addon-before) #input-container {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left: none;\n }\n\n .input-wrapper:has(.input-addon-after) #input-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: none;\n }\n\n /* \n * Main input container element\n * Uses CSS custom properties for comprehensive border and layout control\n */\n #input-container {\n /* Border properties - individual sides for granular control */\n border-bottom: var(--hybrid-input-border-bottom, var(--hybrid-input-local-border-bottom));\n border-top: var(--hybrid-input-border-top, var(--hybrid-input-local-border-top));\n border-left: var(--hybrid-input-border-left, var(--hybrid-input-local-border-left));\n border-right: var(--hybrid-input-border-right, var(--hybrid-input-local-border-right));\n \n /* Border radius - individual corners for design flexibility */\n border-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius)); \n border-top-left-radius: var(--hybrid-input-border-top-left-radius, var(--hybrid-input-local-border-top-left-radius));\n border-top-right-radius: var(--hybrid-input-border-top-right-radius, var(--hybrid-input-local-border-top-right-radius));\n border-bottom-left-radius: var(--hybrid-input-border-bottom-left-radius, var(--hybrid-input-local-border-bottom-left-radius));\n border-bottom-right-radius: var(--hybrid-input-border-bottom-right-radius, var(--hybrid-input-local-border-bottom-right-radius));\n \n /* Layout */\n display: flex;\n position: relative;\n flex: 1; /* Take available space in wrapper */\n min-width: 0; /* Allow shrinking below content size */\n }\n\n /* \n * Disabled container border styles\n * Applied when input is disabled\n */\n :host([disabled]) #input-container {\n border-bottom: var(--hybrid-input-disabled-border-bottom, var(--hybrid-input-local-disabled-border-bottom));\n border-top: var(--hybrid-input-disabled-border-top, var(--hybrid-input-local-disabled-border-top));\n border-left: var(--hybrid-input-disabled-border-left, var(--hybrid-input-local-disabled-border-left));\n border-right: var(--hybrid-input-disabled-border-right, var(--hybrid-input-local-disabled-border-right));\n opacity: 0.6;\n }\n\n /* ========================================\n * INPUT ELEMENT STYLES\n * ======================================== */\n\n /* \n * Base input element styling\n * Full width with no default borders, using container for styling\n */\n input {\n width: 100%;\n border: none;\n outline: none;\n color: var(--hybrid-input-text-color, var(--hybrid-input-local-text-color));\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n }\n\n /* Remove default number input spinners */\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n \n /* Firefox */\n input[type='number'] {\n -moz-appearance: textfield;\n }\n\n /* ========================================\n * STATE STYLES\n * ======================================== */\n\n /* \n * Error state styling\n * Applied when state='error' and not disabled\n */\n :host(:not([disabled])[state='error']) > #input-container {\n border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border));\n }\n\n /* \n * Focus state styling\n * Applied when input receives focus and not in error state\n */\n :host(:not([state='error'])) > #input-container:focus-within {\n border: var(--hybrid-input-focus-border, var(--hybrid-input-local-focus-border));\n }\n\n /* \n * Number input icon positioning adjustments for error/warning states\n * When validation states are present, adjust icon positioning\n */\n :host([state='error']) input[type='number'] ~ #number-icons,\n :host([state='warning']) input[type='number'] ~ #number-icons {\n position: static;\n padding-left: var(--hybrid-input-number-icons-container-padding-left, var(--hybrid-input-local-number-icons-container-padding-left));\n }\n\n /* ========================================\n * SLOTTED CONTENT STYLES\n * ======================================== */\n\n /* \n * Label slot styling\n * Applied to slotted label elements\n */\n ::slotted([slot='label']) {\n color: var(--hybrid-input-label-color, var(--hybrid-input-local-label-color));\n font-size: var(--hybrid-input-label-font-size, var(--hybrid-input-local-label-font-size));\n padding-bottom: var(--hybrid-input-label-padding-bottom, var(--hybrid-input-local-label-padding-bottom));\n }\n\n /* \n * Helper text slot styling\n * Applied to slotted helper text elements\n */\n ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-helper-text-color, var(--hybrid-input-local-helper-text-color));\n font-size: var(--hybrid-input-helper-text-font-size, var(--hybrid-input-local-helper-text-font-size));\n padding-top: var(--hybrid-input-helper-text-padding-top, var(--hybrid-input-local-helper-text-padding-top));\n }\n\n /* \n * State-specific helper text colors\n * Override helper text color based on validation state\n */\n :host([state='error']) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-error-helper-text-color, var(--hybrid-input-local-error-helper-text-color));\n }\n\n :host([state='warning']) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-warning-helper-text-color, var(--hybrid-input-local-warning-helper-text-color));\n }\n\n /* \n * Disabled state for slotted content\n * Applied when input is disabled\n */\n :host([disabled]) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-disabled-helper-text-color, var(--hybrid-input-local-disabled-helper-text-color));\n }\n\n :host([disabled]) ::slotted([slot='label']) {\n color: var(--hybrid-input-disabled-label-color, var(--hybrid-input-local-disabled-label-color));\n }\n\n /* \n * Prefix slot styling\n * Applied to slotted prefix content (icons, text, etc.)\n */\n ::slotted([slot='prefix']) {\n display: flex;\n align-items: center;\n padding-right: var(--hybrid-input-prefix-padding-right, var(--hybrid-input-local-prefix-padding-right));\n color: var(--hybrid-input-prefix-color, var(--hybrid-input-local-prefix-color));\n font-size: var(--hybrid-input-prefix-font-size, var(--hybrid-input-local-prefix-font-size));\n flex-shrink: 0;\n }\n\n /* \n * Suffix slot styling\n * Applied to slotted suffix content (icons, text, etc.)\n */\n ::slotted([slot='suffix']) {\n display: flex;\n align-items: center;\n padding-left: var(--hybrid-input-suffix-padding-left, var(--hybrid-input-local-suffix-padding-left));\n color: var(--hybrid-input-suffix-color, var(--hybrid-input-local-suffix-color));\n font-size: var(--hybrid-input-suffix-font-size, var(--hybrid-input-local-suffix-font-size));\n flex-shrink: 0;\n }\n\n /* \n * Disabled state for prefix and suffix slots\n * Applied when input is disabled\n */\n :host([disabled]) ::slotted([slot='prefix']),\n :host([disabled]) ::slotted([slot='suffix']) {\n opacity: var(--hybrid-input-disabled-icon-opacity, var(--hybrid-input-local-disabled-icon-opacity));\n color: var(--hybrid-input-disabled-prefix-suffix-color, var(--hybrid-input-local-disabled-prefix-suffix-color));\n }\n`;\n\n/**\n * Size variation styles for the input component\n * Defines padding and spacing for different input sizes\n */\nconst sizeInputStyle = css`\n /* ========================================\n * SIZE VARIATIONS\n * ======================================== */\n\n /* Large input size variant */\n div[data-size='large'] {\n padding-top: var(--hybrid-input-large-padding-top, var(--hybrid-input-local-large-padding-top));\n padding-bottom: var(--hybrid-input-large-padding-bottom, var(--hybrid-input-local-large-padding-bottom));\n padding-left: var(--hybrid-input-large-padding-left, var(--hybrid-input-local-large-padding-left));\n padding-right: var(--hybrid-input-large-padding-right, var(--hybrid-input-local-large-padding-right));\n }\n\n /* Medium input size variant (default) */\n div[data-size='medium'] {\n padding-top: var(--hybrid-input-medium-padding-top, var(--hybrid-input-local-medium-padding-top));\n padding-bottom: var(--hybrid-input-medium-padding-bottom, var(--hybrid-input-local-medium-padding-bottom));\n padding-left: var(--hybrid-input-medium-padding-left, var(--hybrid-input-local-medium-padding-left));\n padding-right: var(--hybrid-input-medium-padding-right, var(--hybrid-input-local-medium-padding-right));\n }\n\n /* Small input size variant */\n div[data-size='small'] {\n padding-top: var(--hybrid-input-small-padding-top, var(--hybrid-input-local-small-padding-top));\n padding-bottom: var(--hybrid-input-small-padding-bottom, var(--hybrid-input-local-small-padding-bottom));\n padding-left: var(--hybrid-input-small-padding-left, var(--hybrid-input-local-small-padding-left));\n padding-right: var(--hybrid-input-small-padding-right, var(--hybrid-input-local-small-padding-right));\n }\n`;\n\nexport const styles = [inputStyle, sizeInputStyle, styleVariables];\n"]}
|
|
1
|
+
{"version":3,"file":"input.style.js","sourceRoot":"","sources":["../../../src/components/input/input.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsfrB,CAAC;AAEF;;;GAGG;AACH,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CzB,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { styleVariables } from './input.style.variable.js';\n\n/**\n * Input component styles for the Hybrid UI Library\n * \n * This file contains all the styling for the nr-input component, including:\n * - Base input styles with CSS custom properties for theming\n * - Multiple input states (default, warning, error)\n * - Size variations (small, medium, large)\n * - Different input types (text, password, number, calendar)\n * - Icon positioning and styling\n * - Focus, disabled, and validation states\n * - Dark theme support\n * \n * The styling system uses CSS custom properties with fallbacks to allow\n * for both global and local customization of input appearance.\n */\n\nconst inputStyle = css`\n /* \n * Host element base styles\n * Container for the input component with flexible layout\n */\n :host {\n display: flex;\n flex-direction: column;\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n }\n\n /* \n * Base input wrapper and input element styles\n * Background applied to wrapper to cover entire container including addons\n * Uses CSS custom properties with fallbacks for comprehensive theming support\n * Properties follow the pattern: --hybrid-input-{property}, --hybrid-input-local-{property}\n */\n .input-wrapper {\n background-color: var(--hybrid-input-background-color, var(--hybrid-input-local-background-color));\n }\n\n #input-container > input {\n background-color: transparent;\n }\n\n /* \n * Disabled state styles for wrapper and input\n * Applied when input is disabled - removes interactivity and applies muted colors\n */\n :host([disabled]) .input-wrapper {\n background-color: var(--hybrid-input-disabled-background-color, var(--hybrid-input-local-disabled-background-color));\n }\n\n :host([disabled]) #input-container > input {\n background-color: transparent;\n cursor: not-allowed;\n }\n\n /* \n * Icon base styles\n * Common styling for all icons within the input component\n */\n hy-icon {\n display: flex;\n align-items: center;\n }\n\n /* \n * Placeholder styling\n * Customizable placeholder text appearance\n */\n ::placeholder {\n color: var(--hybrid-input-placeholder-color, var(--hybrid-input-local-placeholder-color));\n font-size: var(--hybrid-input-placeholder-font-size, var(--hybrid-input-local-placeholder-font-size));\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n }\n\n /* \n * Disabled placeholder styling\n * Applied when input is disabled\n */\n :host([disabled]) ::placeholder {\n color: var(--hybrid-input-disabled-placeholder-color, var(--hybrid-input-local-disabled-placeholder-color));\n }\n\n /* ========================================\n * ICON VARIANTS AND STATES\n * ======================================== */\n\n /* Warning state icon */\n #warning-icon {\n --hybrid-icon-color: var(--hybrid-input-warning-icon-color, var(--hybrid-input-local-warning-icon-color));\n }\n\n /* Error state icon */\n #error-icon {\n --hybrid-icon-color: var(--hybrid-input-error-icon-color, var(--hybrid-input-local-error-icon-color));\n }\n\n /* Calendar input type icon */\n #calendar-icon {\n --hybrid-icon-color: var(--hybrid-input-calendar-icon-color, var(--hybrid-input-local-calendar-icon-color));\n }\n\n /* Password toggle icon */\n #password-icon {\n padding-left: var(--hybrid-input-password-icon-padding-left, var(--hybrid-input-local-password-icon-padding-left));\n padding-right: var(--hybrid-input-password-icon-padding-right, var(--hybrid-input-local-password-icon-padding-right));\n cursor: pointer;\n --hybrid-icon-color: var(--hybrid-input-password-icon-color, var(--hybrid-input-local-password-icon-color));\n }\n\n /* Copy functionality icon */\n #copy-icon {\n padding-right: var(--hybrid-input-copy-icon-padding-right, var(--hybrid-input-local-copy-icon-padding-right));\n --hybrid-icon-color: var(--hybrid-input-copy-icon-color, var(--hybrid-input-local-copy-icon-color));\n cursor: pointer;\n }\n\n /* Clear functionality icon */\n #clear-icon {\n padding-right: var(--hybrid-input-clear-icon-padding-right, var(--hybrid-input-local-clear-icon-padding-right));\n --hybrid-icon-color: var(--hybrid-input-clear-icon-color, var(--hybrid-input-local-clear-icon-color));\n cursor: pointer;\n }\n\n /* \n * Number input increment/decrement icons container\n * Positioned absolutely for overlay on input\n */\n #number-icons {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n position: absolute;\n right: 0;\n top: 0;\n height: 100%;\n width: var(--hybrid-input-number-icons-container-width, var(--hybrid-input-local-number-icons-container-width));\n padding-right: var(--hybrid-input-number-icons-container-padding-right, var(--hybrid-input-local-number-icons-container-padding-right));\n }\n\n /* Individual number icons styling */\n #number-icons hy-icon {\n --hybrid-icon-color: var(--hybrid-input-number-icons-color, var(--hybrid-input-local-number-icons-color));\n padding-left: var(--hybrid-input-number-icons-padding-left, var(--hybrid-input-local-number-icons-padding-left));\n padding-right: var(--hybrid-input-number-icons-padding-right, var(--hybrid-input-local-number-icons-padding-right));\n width: var(--hybrid-input-number-icons-width, var(--hybrid-input-local-number-icons-width));\n height: var(--hybrid-input-number-icons-height, var(--hybrid-input-local-number-icons-height));\n }\n\n /* Number icons separator styling */\n #icons-separator {\n color: var(--hybrid-input-number-icons-separator-color, var(--hybrid-input-local-number-icons-separator-color));\n padding-bottom: var(--hybrid-input-number-icons-separator-padding-bottom, var(--hybrid-input-local-number-icons-separator-padding-bottom));\n padding-left: var(--hybrid-input-number-icons-separator-padding-left, var(--hybrid-input-local-number-icons-separator-padding-left));\n padding-right: var(--hybrid-input-number-icons-separator-padding-right, var(--hybrid-input-local-number-icons-separator-padding-right));\n }\n\n /* \n * Disabled state for all icons\n * Applied when input is disabled - reduces opacity and disables interaction\n */\n :host([disabled]) #password-icon,\n :host([disabled]) #error-icon,\n :host([disabled]) #warning-icon,\n :host([disabled]) #number-icons,\n :host([disabled]) #calendar-icon,\n :host([disabled]) #copy-icon,\n :host([disabled]) #clear-icon {\n opacity: var(--hybrid-input-disabled-icon-opacity, var(--hybrid-input-local-disabled-icon-opacity));\n }\n\n /* Disabled icons cursor override */\n :host([disabled]) #password-icon,\n :host([disabled]) #number-icons,\n :host([disabled]) #copy-icon,\n :host([disabled]) #clear-icon {\n cursor: not-allowed;\n }\n\n /* ========================================\n * INPUT CONTAINER STYLES\n * ======================================== */\n\n /* \n * Input wrapper - contains addons and input container\n * Provides horizontal layout for addon before/after elements\n */\n .input-wrapper {\n display: flex;\n align-items: stretch;\n width: 100%;\n }\n\n /* \n * Addon before element - content before input (outside borders)\n * Styled to visually connect with input\n */\n .input-addon-before {\n background-color: var(--hybrid-input-addon-background-color, var(--hybrid-input-local-addon-background-color));\n border: var(--hybrid-input-border, var(--hybrid-input-local-border));\n border-right: none;\n border-top-left-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n border-bottom-left-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n padding: var(--hybrid-input-addon-padding, var(--hybrid-input-local-addon-padding));\n display: flex;\n align-items: center;\n color: var(--hybrid-input-addon-color, var(--hybrid-input-local-addon-color));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n white-space: nowrap;\n min-width: 0; /* Allow shrinking */\n flex-shrink: 0; /* Prevent shrinking */\n }\n\n /* \n * Addon after element - content after input (outside borders)\n * Styled to visually connect with input\n */\n .input-addon-after {\n background-color: var(--hybrid-input-addon-background-color, var(--hybrid-input-local-addon-background-color));\n border: var(--hybrid-input-border, var(--hybrid-input-local-border));\n border-left: none;\n border-top-right-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n border-bottom-right-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius));\n padding: var(--hybrid-input-addon-padding, var(--hybrid-input-local-addon-padding));\n display: flex;\n align-items: center;\n color: var(--hybrid-input-addon-color, var(--hybrid-input-local-addon-color));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n white-space: nowrap;\n min-width: 0; /* Allow shrinking */\n flex-shrink: 0; /* Prevent shrinking */\n }\n\n /* \n * Input container border radius adjustments when addons are present\n * Removes border radius on sides where addons are attached\n */\n .input-wrapper:has(.input-addon-before) #input-container {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left: none;\n }\n\n .input-wrapper:has(.input-addon-after) #input-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: none;\n }\n\n /* \n * Main input container element\n * Uses CSS custom properties for comprehensive border and layout control\n */\n #input-container {\n /* Border properties - individual sides for granular control */\n border-bottom: var(--hybrid-input-border-bottom, var(--hybrid-input-local-border-bottom));\n border-top: var(--hybrid-input-border-top, var(--hybrid-input-local-border-top));\n border-left: var(--hybrid-input-border-left, var(--hybrid-input-local-border-left));\n border-right: var(--hybrid-input-border-right, var(--hybrid-input-local-border-right));\n \n /* Border radius - individual corners for design flexibility */\n border-radius: var(--hybrid-input-border-radius, var(--hybrid-input-local-border-radius)); \n border-top-left-radius: var(--hybrid-input-border-top-left-radius, var(--hybrid-input-local-border-top-left-radius));\n border-top-right-radius: var(--hybrid-input-border-top-right-radius, var(--hybrid-input-local-border-top-right-radius));\n border-bottom-left-radius: var(--hybrid-input-border-bottom-left-radius, var(--hybrid-input-local-border-bottom-left-radius));\n border-bottom-right-radius: var(--hybrid-input-border-bottom-right-radius, var(--hybrid-input-local-border-bottom-right-radius));\n \n /* Layout */\n display: flex;\n position: relative;\n flex: 1; /* Take available space in wrapper */\n min-width: 0; /* Allow shrinking below content size */\n }\n\n /* \n * Disabled container border styles\n * Applied when input is disabled\n */\n :host([disabled]) #input-container {\n border-bottom: var(--hybrid-input-disabled-border-bottom, var(--hybrid-input-local-disabled-border-bottom));\n border-top: var(--hybrid-input-disabled-border-top, var(--hybrid-input-local-disabled-border-top));\n border-left: var(--hybrid-input-disabled-border-left, var(--hybrid-input-local-disabled-border-left));\n border-right: var(--hybrid-input-disabled-border-right, var(--hybrid-input-local-disabled-border-right));\n opacity: 0.6;\n }\n\n /* ========================================\n * INPUT VARIANT STYLES\n * ======================================== */\n\n /* \n * Outlined variant - full border around input\n * Default: light border, focus: blue border\n */\n :host([variant='outlined']) #input-container {\n border: var(--hybrid-input-outlined-border, var(--hybrid-input-local-outlined-border));\n border-radius: var(--hybrid-input-outlined-border-radius, var(--hybrid-input-local-outlined-border-radius));\n background-color: var(--hybrid-input-outlined-background, var(--hybrid-input-local-outlined-background));\n }\n\n :host([variant='outlined']) .input-wrapper {\n background-color: transparent;\n }\n\n :host([variant='outlined']:not([state='error'])) #input-container:focus-within {\n border: var(--hybrid-input-outlined-focus-border, var(--hybrid-input-local-outlined-focus-border));\n }\n\n /* \n * Filled variant - background with bottom border only\n * Subtle background with bottom border indication\n */\n :host([variant='filled']) #input-container {\n background-color: var(--hybrid-input-filled-background, var(--hybrid-input-local-filled-background));\n border-radius: var(--hybrid-input-filled-border-radius, var(--hybrid-input-local-filled-border-radius));\n border-bottom: var(--hybrid-input-filled-border-bottom, var(--hybrid-input-local-filled-border-bottom));\n border-top: none;\n border-left: none;\n border-right: none;\n }\n\n :host([variant='filled']) .input-wrapper {\n background-color: transparent;\n }\n\n :host([variant='filled']:not([state='error'])) #input-container:focus-within {\n border-bottom: var(--hybrid-input-filled-focus-border-bottom, var(--hybrid-input-local-filled-focus-border-bottom));\n border-top: none;\n border-left: none;\n border-right: none;\n }\n\n /* \n * Borderless variant - no borders, focus with outline\n * Clean appearance with focus indication via outline\n */\n :host([variant='borderless']) #input-container {\n background-color: var(--hybrid-input-borderless-background, var(--hybrid-input-local-borderless-background));\n border: none;\n border-radius: var(--hybrid-input-borderless-border-radius, var(--hybrid-input-local-borderless-border-radius));\n }\n\n :host([variant='borderless']) .input-wrapper {\n background-color: transparent;\n }\n\n :host([variant='borderless']:not([state='error'])) #input-container:focus-within {\n outline: var(--hybrid-input-borderless-focus-outline, var(--hybrid-input-local-borderless-focus-outline));\n border: none;\n }\n\n /* \n * Underlined variant - bottom border only (default/current behavior)\n * Maintains existing behavior as default\n */\n :host([variant='underlined']) #input-container {\n border-bottom: var(--hybrid-input-underlined-border-bottom, var(--hybrid-input-local-underlined-border-bottom));\n border-top: none;\n border-left: none;\n border-right: none;\n border-radius: 0;\n }\n\n :host([variant='underlined']:not([state='error'])) #input-container:focus-within {\n border-bottom: var(--hybrid-input-underlined-focus-border-bottom, var(--hybrid-input-local-underlined-focus-border-bottom));\n border-top: none;\n border-left: none;\n border-right: none;\n }\n\n /* ========================================\n * INPUT ELEMENT STYLES\n * ======================================== */\n\n /* \n * Base input element styling\n * Full width with no default borders, using container for styling\n */\n input {\n width: 100%;\n border: none;\n outline: none;\n color: var(--hybrid-input-text-color, var(--hybrid-input-local-text-color));\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n font-size: var(--hybrid-input-font-size, var(--hybrid-input-local-font-size));\n }\n\n /* Remove default number input spinners */\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }\n \n /* Firefox */\n input[type='number'] {\n -moz-appearance: textfield;\n }\n\n /* ========================================\n * STATE STYLES\n * ======================================== */\n\n /* \n * Error state styling - works with all variants\n * Applied when state='error' and not disabled\n */\n :host(:not([disabled])[state='error']) #input-container {\n border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;\n outline: none !important;\n }\n\n /* Override variant-specific error state styling */\n :host([variant='borderless'][state='error']) #input-container {\n border: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;\n outline: none !important;\n }\n\n :host([variant='underlined'][state='error']) #input-container,\n :host([variant='filled'][state='error']) #input-container {\n border-top: none !important;\n border-left: none !important;\n border-right: none !important;\n border-bottom: var(--hybrid-input-error-border, var(--hybrid-input-local-error-border)) !important;\n }\n\n /* \n * Number input icon positioning adjustments for error/warning states\n * When validation states are present, adjust icon positioning\n */\n :host([state='error']) input[type='number'] ~ #number-icons,\n :host([state='warning']) input[type='number'] ~ #number-icons {\n position: static;\n padding-left: var(--hybrid-input-number-icons-container-padding-left, var(--hybrid-input-local-number-icons-container-padding-left));\n }\n\n /* ========================================\n * SLOTTED CONTENT STYLES\n * ======================================== */\n\n /* \n * Label slot styling\n * Applied to slotted label elements\n */\n ::slotted([slot='label']) {\n color: var(--hybrid-input-label-color, var(--hybrid-input-local-label-color));\n font-size: var(--hybrid-input-label-font-size, var(--hybrid-input-local-label-font-size));\n padding-bottom: var(--hybrid-input-label-padding-bottom, var(--hybrid-input-local-label-padding-bottom));\n }\n\n /* \n * Helper text slot styling\n * Applied to slotted helper text elements\n */\n ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-helper-text-color, var(--hybrid-input-local-helper-text-color));\n font-size: var(--hybrid-input-helper-text-font-size, var(--hybrid-input-local-helper-text-font-size));\n padding-top: var(--hybrid-input-helper-text-padding-top, var(--hybrid-input-local-helper-text-padding-top));\n }\n\n /* \n * State-specific helper text colors\n * Override helper text color based on validation state\n */\n :host([state='error']) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-error-helper-text-color, var(--hybrid-input-local-error-helper-text-color));\n }\n\n :host([state='warning']) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-warning-helper-text-color, var(--hybrid-input-local-warning-helper-text-color));\n }\n\n /* \n * Disabled state for slotted content\n * Applied when input is disabled\n */\n :host([disabled]) ::slotted([slot='helper-text']) {\n color: var(--hybrid-input-disabled-helper-text-color, var(--hybrid-input-local-disabled-helper-text-color));\n }\n\n :host([disabled]) ::slotted([slot='label']) {\n color: var(--hybrid-input-disabled-label-color, var(--hybrid-input-local-disabled-label-color));\n }\n\n /* \n * Prefix slot styling\n * Applied to slotted prefix content (icons, text, etc.)\n */\n ::slotted([slot='prefix']) {\n display: flex;\n align-items: center;\n padding-right: var(--hybrid-input-prefix-padding-right, var(--hybrid-input-local-prefix-padding-right));\n color: var(--hybrid-input-prefix-color, var(--hybrid-input-local-prefix-color));\n font-size: var(--hybrid-input-prefix-font-size, var(--hybrid-input-local-prefix-font-size));\n flex-shrink: 0;\n }\n\n /* \n * Suffix slot styling\n * Applied to slotted suffix content (icons, text, etc.)\n */\n ::slotted([slot='suffix']) {\n display: flex;\n align-items: center;\n padding-left: var(--hybrid-input-suffix-padding-left, var(--hybrid-input-local-suffix-padding-left));\n color: var(--hybrid-input-suffix-color, var(--hybrid-input-local-suffix-color));\n font-size: var(--hybrid-input-suffix-font-size, var(--hybrid-input-local-suffix-font-size));\n flex-shrink: 0;\n }\n\n /* \n * Disabled state for prefix and suffix slots\n * Applied when input is disabled\n */\n :host([disabled]) ::slotted([slot='prefix']),\n :host([disabled]) ::slotted([slot='suffix']) {\n opacity: var(--hybrid-input-disabled-icon-opacity, var(--hybrid-input-local-disabled-icon-opacity));\n color: var(--hybrid-input-disabled-prefix-suffix-color, var(--hybrid-input-local-disabled-prefix-suffix-color));\n }\n`;\n\n/**\n * Size variation styles for the input component\n * Defines padding and spacing for different input sizes\n */\nconst sizeInputStyle = css`\n /* ========================================\n * SIZE VARIATIONS\n * ======================================== */\n\n /* Large input size variant */\n div[data-size='large'] {\n padding-top: var(--hybrid-input-large-padding-top, var(--hybrid-input-local-large-padding-top));\n padding-bottom: var(--hybrid-input-large-padding-bottom, var(--hybrid-input-local-large-padding-bottom));\n padding-left: var(--hybrid-input-large-padding-left, var(--hybrid-input-local-large-padding-left));\n padding-right: var(--hybrid-input-large-padding-right, var(--hybrid-input-local-large-padding-right));\n }\n\n /* Medium input size variant (default) */\n div[data-size='medium'] {\n padding-top: var(--hybrid-input-medium-padding-top, var(--hybrid-input-local-medium-padding-top));\n padding-bottom: var(--hybrid-input-medium-padding-bottom, var(--hybrid-input-local-medium-padding-bottom));\n padding-left: var(--hybrid-input-medium-padding-left, var(--hybrid-input-local-medium-padding-left));\n padding-right: var(--hybrid-input-medium-padding-right, var(--hybrid-input-local-medium-padding-right));\n }\n\n /* Small input size variant */\n div[data-size='small'] {\n padding-top: var(--hybrid-input-small-padding-top, var(--hybrid-input-local-small-padding-top));\n padding-bottom: var(--hybrid-input-small-padding-bottom, var(--hybrid-input-local-small-padding-bottom));\n padding-left: var(--hybrid-input-small-padding-left, var(--hybrid-input-local-small-padding-left));\n padding-right: var(--hybrid-input-small-padding-right, var(--hybrid-input-local-small-padding-right));\n }\n\n /* \n * Character count display\n * Shows character count and limit information\n */\n .character-count {\n font-size: var(--hybrid-input-character-count-font-size, var(--hybrid-input-local-character-count-font-size));\n color: var(--hybrid-input-character-count-color, var(--hybrid-input-local-character-count-color));\n text-align: right;\n margin-top: var(--hybrid-input-character-count-margin-top, var(--hybrid-input-local-character-count-margin-top));\n font-family: var(--hybrid-input-font-family, var(--hybrid-input-local-font-family));\n }\n\n /* Character count over limit styling */\n .character-count[data-over-limit] {\n color: var(--hybrid-input-character-count-over-limit-color, var(--hybrid-input-local-character-count-over-limit-color));\n }\n`;\n\nexport const styles = [inputStyle, sizeInputStyle, styleVariables];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.style.variable.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.style.variable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"input.style.variable.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.style.variable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,yBA2K1B,CAAC"}
|
package/input.style.variable.js
CHANGED
|
@@ -35,6 +35,9 @@ export const styleVariables = css `
|
|
|
35
35
|
--hybrid-input-local-password-icon-color: #000000;
|
|
36
36
|
--hybrid-input-local-calendar-icon-color: #000000;
|
|
37
37
|
--hybrid-input-local-copy-icon-color: #000000;
|
|
38
|
+
--hybrid-input-local-copy-icon-padding-right:5px;
|
|
39
|
+
--hybrid-input-local-clear-icon-color: #000000;
|
|
40
|
+
--hybrid-input-local-clear-icon-padding-right: 5px;
|
|
38
41
|
--hybrid-input-local-disabled-icon-opacity: 0.4;
|
|
39
42
|
--hybrid-input-local-number-icons-color: #000000;
|
|
40
43
|
--hybrid-input-local-password-icon-padding-left: 8px;
|
|
@@ -82,6 +85,34 @@ export const styleVariables = css `
|
|
|
82
85
|
--hybrid-input-local-addon-background-color: #e8e8e8;
|
|
83
86
|
--hybrid-input-local-addon-color: #525252;
|
|
84
87
|
--hybrid-input-local-addon-padding: 8px 12px;
|
|
88
|
+
|
|
89
|
+
/* Character count styling variables */
|
|
90
|
+
--hybrid-input-local-character-count-font-size: 12px;
|
|
91
|
+
--hybrid-input-local-character-count-color: #8c8c8c;
|
|
92
|
+
--hybrid-input-local-character-count-margin-top: 4px;
|
|
93
|
+
--hybrid-input-local-character-count-over-limit-color: #da1e28;
|
|
94
|
+
|
|
95
|
+
/* Input Variant Variables */
|
|
96
|
+
/* Outlined variant - full border */
|
|
97
|
+
--hybrid-input-local-outlined-border: 1px solid #d0d0d0;
|
|
98
|
+
--hybrid-input-local-outlined-border-radius: 6px;
|
|
99
|
+
--hybrid-input-local-outlined-focus-border: 2px solid #0f62fe;
|
|
100
|
+
--hybrid-input-local-outlined-background: #ffffff;
|
|
101
|
+
|
|
102
|
+
/* Filled variant - background with subtle border */
|
|
103
|
+
--hybrid-input-local-filled-background: #f4f4f4;
|
|
104
|
+
--hybrid-input-local-filled-border-bottom: 2px solid transparent;
|
|
105
|
+
--hybrid-input-local-filled-focus-border-bottom: 2px solid #0f62fe;
|
|
106
|
+
--hybrid-input-local-filled-border-radius: 6px 6px 0 0;
|
|
107
|
+
|
|
108
|
+
/* Borderless variant - no borders */
|
|
109
|
+
--hybrid-input-local-borderless-background: transparent;
|
|
110
|
+
--hybrid-input-local-borderless-focus-outline: 2px solid #0f62fe;
|
|
111
|
+
--hybrid-input-local-borderless-border-radius: 6px;
|
|
112
|
+
|
|
113
|
+
/* Underlined variant - bottom border only (current default) */
|
|
114
|
+
--hybrid-input-local-underlined-border-bottom: 2px solid #a8a8a8;
|
|
115
|
+
--hybrid-input-local-underlined-focus-border-bottom: 2px solid #0f62fe;
|
|
85
116
|
}
|
|
86
117
|
|
|
87
118
|
/*
|
|
@@ -107,6 +138,7 @@ export const styleVariables = css `
|
|
|
107
138
|
--hybrid-input-local-number-icons-separator-color: #525252;
|
|
108
139
|
--hybrid-input-local-calendar-icon-color: #ffffff;
|
|
109
140
|
--hybrid-input-local-copy-icon-color: #ffffff;
|
|
141
|
+
--hybrid-input-local-clear-icon-color: #ffffff;
|
|
110
142
|
|
|
111
143
|
/* Dark theme prefix and suffix colors */
|
|
112
144
|
--hybrid-input-local-prefix-color: #c6c6c6;
|
|
@@ -116,6 +148,27 @@ export const styleVariables = css `
|
|
|
116
148
|
/* Dark theme addon colors */
|
|
117
149
|
--hybrid-input-local-addon-background-color: #525252;
|
|
118
150
|
--hybrid-input-local-addon-color: #c6c6c6;
|
|
151
|
+
|
|
152
|
+
/* Dark theme character count colors */
|
|
153
|
+
--hybrid-input-local-character-count-color: #8c8c8c;
|
|
154
|
+
--hybrid-input-local-character-count-over-limit-color: #fa4d56;
|
|
155
|
+
|
|
156
|
+
/* Dark theme input variant variables */
|
|
157
|
+
/* Outlined variant - dark theme */
|
|
158
|
+
--hybrid-input-local-outlined-border: 1px solid #525252;
|
|
159
|
+
--hybrid-input-local-outlined-focus-border: 2px solid #ffffff;
|
|
160
|
+
--hybrid-input-local-outlined-background: #393939;
|
|
161
|
+
|
|
162
|
+
/* Filled variant - dark theme */
|
|
163
|
+
--hybrid-input-local-filled-background: #525252;
|
|
164
|
+
--hybrid-input-local-filled-focus-border-bottom: 2px solid #ffffff;
|
|
165
|
+
|
|
166
|
+
/* Borderless variant - dark theme */
|
|
167
|
+
--hybrid-input-local-borderless-background: transparent;
|
|
168
|
+
--hybrid-input-local-borderless-focus-outline: 2px solid #ffffff;
|
|
169
|
+
|
|
170
|
+
/* Underlined variant - dark theme */
|
|
171
|
+
--hybrid-input-local-underlined-focus-border-bottom: 2px solid #ffffff;
|
|
119
172
|
}
|
|
120
173
|
`;
|
|
121
174
|
//# sourceMappingURL=input.style.variable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.style.variable.js","sourceRoot":"","sources":["../../../src/components/input/input.style.variable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"input.style.variable.js","sourceRoot":"","sources":["../../../src/components/input/input.style.variable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2KhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styleVariables = css`\n :host {\n --hybrid-input-local-background-color: #f4f4f4;\n --hybrid-input-local-text-color: #000000;\n --hybrid-input-local-font-family: Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif, \"system-ui\", \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, SFProLocalRange;\n --hybrid-input-local-font-size:13px;\n --hybrid-input-local-label-color: #525252;\n --hybrid-input-local-placeholder-color: #a8a8a8;\n --hybrid-input-local-border-bottom: 2px solid #a8a8a8;\n --hybrid-input-local-border-top: 2px solid transparent;\n --hybrid-input-local-border-left: 2px solid transparent;\n --hybrid-input-local-border-right: 2px solid transparent;\n --hybrid-input-local-disabled-border-bottom: none;\n --hybrid-input-local-disabled-border-top: none;\n --hybrid-input-local-disabled-border-left: none;\n --hybrid-input-local-disabled-border-right: none;\n --hybrid-input-local-focus-border: 2px solid #0f62fe;\n --hybrid-input-local-border-radius: 0px;\n --hybrid-input-local-label-font-size: 13px;\n --hybrid-input-local-helper-text-color: #525252;\n --hybrid-input-local-helper-text-font-size: 13px;\n --hybrid-input-local-placeholder-font-size: 13px;\n --hybrid-input-label-padding-bottom: 5px;\n --hybrid-input-local-helper-text-padding-top: 5px;\n --hybrid-input-local-disabled-background-color: #f4f4f4;\n --hybrid-input-local-disabled-placeholder-color: #c6c6c6;\n --hybrid-input-local-error-helper-text-color: #da1e28;\n --hybrid-input-local-error-border: 2px solid #da1e28;\n --hybrid-input-local-warning-helper-text-color: #161616;\n --hybrid-input-local-disabled-helper-text-color: #c6c6c6;\n --hybrid-input-local-disabled-label-color: #c6c6c6;\n --hybrid-input-local-warning-icon-color: #f0c300;\n --hybrid-input-local-error-icon-color: #da1e28;\n --hybrid-input-local-password-icon-color: #000000;\n --hybrid-input-local-calendar-icon-color: #000000;\n --hybrid-input-local-copy-icon-color: #000000;\n --hybrid-input-local-copy-icon-padding-right:5px;\n --hybrid-input-local-clear-icon-color: #000000;\n --hybrid-input-local-clear-icon-padding-right: 5px;\n --hybrid-input-local-disabled-icon-opacity: 0.4;\n --hybrid-input-local-number-icons-color: #000000;\n --hybrid-input-local-password-icon-padding-left: 8px;\n --hybrid-input-local-password-icon-padding-right: 8px;\n --hybrid-input-local-number-icons-separator-color: #e0e0e0;\n --hybrid-input-local-number-icons-separator-padding-bottom: 4px;\n --hybrid-input-local-number-icons-separator-padding-left: 5px;\n --hybrid-input-local-number-icons-separator-padding-right: 5px;\n --hybrid-input-local-copy-icon-padding-right:5px;\n\n --hybrid-input-local-number-icons-container-width: 70px;\n --hybrid-input-local-number-icons-container-padding-left: 5px;\n --hybrid-input-local-number-icons-container-padding-right: 5px;\n --hybrid-input-local-number-icons-width: 12px;\n --hybrid-input-local-number-icons-height: 12px;\n\n --hybrid-input-local-number-icons-padding-left: 4px;\n --hybrid-input-local-number-icons-padding-right: 4px;\n\n --hybrid-input-local-large-padding-top: 10px;\n --hybrid-input-local-large-padding-bottom: 10px;\n --hybrid-input-local-large-padding-left: 9px;\n --hybrid-input-local-large-padding-right: 4px;\n\n --hybrid-input-local-medium-padding-top: 7px;\n --hybrid-input-local-medium-padding-bottom: 7px;\n --hybrid-input-local-medium-padding-left: 9px;\n --hybrid-input-local-medium-padding-right: 4px;\n\n --hybrid-input-local-small-padding-top: 4px;\n --hybrid-input-local-small-padding-bottom: 4px;\n --hybrid-input-local-small-padding-left: 9px;\n --hybrid-input-local-small-padding-right: 4px;\n\n /* Prefix and Suffix styling variables */\n --hybrid-input-local-prefix-color: #525252;\n --hybrid-input-local-prefix-font-size: 13px;\n --hybrid-input-local-prefix-padding-right: 8px;\n --hybrid-input-local-suffix-color: #525252;\n --hybrid-input-local-suffix-font-size: 13px;\n --hybrid-input-local-suffix-padding-left: 8px;\n --hybrid-input-local-disabled-prefix-suffix-color: #c6c6c6;\n\n /* Addon Before/After styling variables */\n --hybrid-input-local-addon-background-color: #e8e8e8;\n --hybrid-input-local-addon-color: #525252;\n --hybrid-input-local-addon-padding: 8px 12px;\n\n /* Character count styling variables */\n --hybrid-input-local-character-count-font-size: 12px;\n --hybrid-input-local-character-count-color: #8c8c8c;\n --hybrid-input-local-character-count-margin-top: 4px;\n --hybrid-input-local-character-count-over-limit-color: #da1e28;\n\n /* Input Variant Variables */\n /* Outlined variant - full border */\n --hybrid-input-local-outlined-border: 1px solid #d0d0d0;\n --hybrid-input-local-outlined-border-radius: 6px;\n --hybrid-input-local-outlined-focus-border: 2px solid #0f62fe;\n --hybrid-input-local-outlined-background: #ffffff;\n\n /* Filled variant - background with subtle border */\n --hybrid-input-local-filled-background: #f4f4f4;\n --hybrid-input-local-filled-border-bottom: 2px solid transparent;\n --hybrid-input-local-filled-focus-border-bottom: 2px solid #0f62fe;\n --hybrid-input-local-filled-border-radius: 6px 6px 0 0;\n\n /* Borderless variant - no borders */\n --hybrid-input-local-borderless-background: transparent;\n --hybrid-input-local-borderless-focus-outline: 2px solid #0f62fe;\n --hybrid-input-local-borderless-border-radius: 6px;\n\n /* Underlined variant - bottom border only (current default) */\n --hybrid-input-local-underlined-border-bottom: 2px solid #a8a8a8;\n --hybrid-input-local-underlined-focus-border-bottom: 2px solid #0f62fe;\n }\n\n /* \n * These override the light theme defaults when data-theme=\"dark\" is applied\n * This provides explicit theme control via JavaScript or HTML attributes\n */\n .input-wrapper[data-theme=\"dark\"] {\n --hybrid-input-local-background-color: #393939;\n --hybrid-input-local-focus-border: 2px solid #ffffff;\n --hybrid-input-local-text-color: #ffffff;\n --hybrid-input-local-error-border: 2px solid #fa4d56;\n --hybrid-input-local-error-helper-text-color: #ffb3b8;\n --hybrid-input-local-disabled-background-color: #393939;\n --hybrid-input-local-disabled-placeholder-color: #6f6f6f;\n --hybrid-input-local-disabled-helper-text-color: #6f6f6f;\n --hybrid-input-local-disabled-label-color: #6f6f6f;\n --hybrid-input-local-warning-icon-color: #f0c300;\n --hybrid-input-local-error-icon-color: #da1e28;\n --hybrid-input-local-password-icon-color: #ffffff;\n --hybrid-input-local-number-icons-color: #ffffff;\n --hybrid-input-local-label-color: #c6c6c6;\n --hybrid-input-local-helper-text-color: #c6c6c6;\n --hybrid-input-local-number-icons-separator-color: #525252;\n --hybrid-input-local-calendar-icon-color: #ffffff;\n --hybrid-input-local-copy-icon-color: #ffffff;\n --hybrid-input-local-clear-icon-color: #ffffff;\n \n /* Dark theme prefix and suffix colors */\n --hybrid-input-local-prefix-color: #c6c6c6;\n --hybrid-input-local-suffix-color: #c6c6c6;\n --hybrid-input-local-disabled-prefix-suffix-color: #6f6f6f;\n\n /* Dark theme addon colors */\n --hybrid-input-local-addon-background-color: #525252;\n --hybrid-input-local-addon-color: #c6c6c6;\n\n /* Dark theme character count colors */\n --hybrid-input-local-character-count-color: #8c8c8c;\n --hybrid-input-local-character-count-over-limit-color: #fa4d56;\n\n /* Dark theme input variant variables */\n /* Outlined variant - dark theme */\n --hybrid-input-local-outlined-border: 1px solid #525252;\n --hybrid-input-local-outlined-focus-border: 2px solid #ffffff;\n --hybrid-input-local-outlined-background: #393939;\n\n /* Filled variant - dark theme */\n --hybrid-input-local-filled-background: #525252;\n --hybrid-input-local-filled-focus-border-bottom: 2px solid #ffffff;\n\n /* Borderless variant - dark theme */\n --hybrid-input-local-borderless-background: transparent;\n --hybrid-input-local-borderless-focus-outline: 2px solid #ffffff;\n\n /* Underlined variant - dark theme */\n --hybrid-input-local-underlined-focus-border-bottom: 2px solid #ffffff;\n }\n`;\n"]}
|
package/input.types.d.ts
CHANGED
|
@@ -8,11 +8,31 @@ export declare const enum INPUT_SIZE {
|
|
|
8
8
|
Medium = "medium",
|
|
9
9
|
Small = "small"
|
|
10
10
|
}
|
|
11
|
+
export declare const enum INPUT_VARIANT {
|
|
12
|
+
Outlined = "outlined",
|
|
13
|
+
Filled = "filled",
|
|
14
|
+
Borderless = "borderless",
|
|
15
|
+
Underlined = "underlined"
|
|
16
|
+
}
|
|
11
17
|
export declare const enum INPUT_TYPE {
|
|
12
18
|
PASSWORD = "password",
|
|
13
19
|
TEXT = "text",
|
|
14
20
|
NUMBER = "number",
|
|
15
21
|
CALENDAR = "calendar"
|
|
16
22
|
}
|
|
23
|
+
export interface FocusOptions {
|
|
24
|
+
preventScroll?: boolean;
|
|
25
|
+
cursor?: 'start' | 'end' | 'all' | number;
|
|
26
|
+
select?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BlurOptions {
|
|
29
|
+
preventScroll?: boolean;
|
|
30
|
+
restoreCursor?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface FocusChangeEvent {
|
|
33
|
+
focused: boolean;
|
|
34
|
+
cursorPosition?: number;
|
|
35
|
+
selectedText?: string;
|
|
36
|
+
}
|
|
17
37
|
export declare const EMPTY_STRING = "";
|
|
18
38
|
//# sourceMappingURL=input.types.d.ts.map
|
package/input.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.types.ts"],"names":[],"mappings":"AAAA,0BAAkB,WAAW;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,0BAAkB,UAAU;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,0BAAkB,UAAU;IAC1B,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,eAAO,MAAM,YAAY,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"input.types.d.ts","sourceRoot":"","sources":["../../../src/components/input/input.types.ts"],"names":[],"mappings":"AAAA,0BAAkB,WAAW;IAC3B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,0BAAkB,UAAU;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,0BAAkB,aAAa;IAC7B,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B;AAED,0BAAkB,UAAU;IAC1B,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,KAAK,CAAC"}
|
package/input.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.types.js","sourceRoot":"","sources":["../../../src/components/input/input.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.types.js","sourceRoot":"","sources":["../../../src/components/input/input.types.ts"],"names":[],"mappings":"AA2CA,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["export const enum INPUT_STATE {\n Default = 'default',\n Error = 'error',\n Warning = 'warning',\n}\n\nexport const enum INPUT_SIZE {\n Large = 'large',\n Medium = 'medium',\n Small = 'small',\n}\n\nexport const enum INPUT_VARIANT {\n Outlined = 'outlined',\n Filled = 'filled',\n Borderless = 'borderless',\n Underlined = 'underlined',\n}\n\nexport const enum INPUT_TYPE {\n PASSWORD = 'password',\n TEXT = 'text',\n NUMBER = 'number',\n CALENDAR = 'calendar',\n}\n\nexport interface FocusOptions {\n preventScroll?: boolean;\n cursor?: 'start' | 'end' | 'all' | number;\n select?: boolean;\n}\n\nexport interface BlurOptions {\n preventScroll?: boolean;\n restoreCursor?: boolean;\n}\n\nexport interface FocusChangeEvent {\n focused: boolean;\n cursorPosition?: number;\n selectedText?: string;\n}\n\nexport const EMPTY_STRING = '';\n"]}
|
package/package.json
CHANGED
|
@@ -30,6 +30,10 @@ export declare class InputRenderUtils {
|
|
|
30
30
|
* Renders the copy icon when withCopy is enabled
|
|
31
31
|
*/
|
|
32
32
|
static renderCopyIcon(withCopy: boolean, disabled: boolean, readonly: boolean, onCopy: () => void, onKeydown: (e: KeyboardEvent) => void): TemplateResult | typeof nothing;
|
|
33
|
+
/**
|
|
34
|
+
* Renders the clear icon when allowClear is enabled and there's content
|
|
35
|
+
*/
|
|
36
|
+
static renderClearIcon(allowClear: boolean, value: string, disabled: boolean, readonly: boolean, onClear: () => void, onKeydown: (e: KeyboardEvent) => void): TemplateResult | typeof nothing;
|
|
33
37
|
/**
|
|
34
38
|
* Renders state-based icons (warning, error)
|
|
35
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-renderers.d.ts","sourceRoot":"","sources":["../../../../src/components/input/utils/input-renderers.ts"],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AM,CAAC,iBAAiB,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,IAAI,EACvB,WAAW,EAAE,MAAM,IAAI,EACvB,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC,cAAc,GAAG,OAAO,OAAO;CA0BnC"}
|
|
1
|
+
{"version":3,"file":"input-renderers.d.ts","sourceRoot":"","sources":["../../../../src/components/input/utils/input-renderers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,cAAc,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGpD;;GAEG;AACH,qBAAa,gBAAgB;IAE3B;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,cAAc;IAQrC;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,cAAc;IAQrC;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,cAAc,GAAG,OAAO,OAAO;IAUpH;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,cAAc,GAAG,OAAO,OAAO;IAUlH;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,IAAI,EAClB,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC,cAAc,GAAG,OAAO,OAAO;IAelC;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,MAAM,IAAI,EACnB,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC,cAAc,GAAG,OAAO,OAAO;IAelC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,OAAO;IAWtE;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,cAAc,GAAG,OAAO,OAAO;IAQlC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CACvB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC,cAAc,GAAG,OAAO,OAAO;IA4BlC;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,IAAI,EACvB,WAAW,EAAE,MAAM,IAAI,EACvB,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC,cAAc,GAAG,OAAO,OAAO;CA0BnC"}
|
package/utils/input-renderers.js
CHANGED
|
@@ -71,6 +71,23 @@ export class InputRenderUtils {
|
|
|
71
71
|
@keydown=${onKeydown}
|
|
72
72
|
></hy-icon>`;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Renders the clear icon when allowClear is enabled and there's content
|
|
76
|
+
*/
|
|
77
|
+
static renderClearIcon(allowClear, value, disabled, readonly, onClear, onKeydown) {
|
|
78
|
+
if (!allowClear || !value || disabled || readonly)
|
|
79
|
+
return nothing;
|
|
80
|
+
return html `<hy-icon
|
|
81
|
+
name="times-circle"
|
|
82
|
+
type="regular"
|
|
83
|
+
id="clear-icon"
|
|
84
|
+
role="button"
|
|
85
|
+
aria-label="Clear input value"
|
|
86
|
+
tabindex="0"
|
|
87
|
+
@click=${onClear}
|
|
88
|
+
@keydown=${onKeydown}
|
|
89
|
+
></hy-icon>`;
|
|
90
|
+
}
|
|
74
91
|
/**
|
|
75
92
|
* Renders state-based icons (warning, error)
|
|
76
93
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-renderers.js","sourceRoot":"","sources":["../../../../src/components/input/utils/input-renderers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAE3B;;OAEG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,cAAuB,EAAE,YAAgC;QAChF,IAAI,CAAC,cAAc;YAAE,OAAO,OAAO,CAAC;QAEpC,OAAO,IAAI,CAAA;;gDAEiC,YAAY;;KAEvD,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAsB,EAAE,YAAgC;QAC9E,IAAI,CAAC,aAAa;YAAE,OAAO,OAAO,CAAC;QAEnC,OAAO,IAAI,CAAA;;+CAEgC,YAAY;;KAEtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,MAAkB,EAClB,SAAqC;QAErC,IAAI,CAAC,QAAQ;YAAE,OAAO,OAAO,CAAC;QAE9B,OAAO,IAAI,CAAA;;;;;;;eAOA,CAAC,QAAQ,IAAI,CA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AwB,CAAC,CAAC,CAAC,IAAI,CAAA,qCAAqC,CAAC,CAAC,CAAC,OAAO;;;;;;mBAM1E,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;qBAC5C,SAAS;;;;;;;;mBAQX,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;qBAC5C,SAAS;;;KAGzB,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { html, TemplateResult, nothing } from 'lit';\nimport { INPUT_TYPE, INPUT_STATE } from '../input.types.js';\n\n/**\n * Rendering utilities for input component icons and elements\n */\nexport class InputRenderUtils {\n\n /**\n * Renders prefix slot content\n */\n static renderPrefix(): TemplateResult {\n return html`\n <div class=\"input-prefix\">\n <slot name=\"prefix\"></slot>\n </div>\n `;\n }\n\n /**\n * Renders suffix slot content \n */\n static renderSuffix(): TemplateResult {\n return html`\n <div class=\"input-suffix\">\n <slot name=\"suffix\"></slot>\n </div>\n `;\n }\n\n /**\n * Renders addon before slot content (outside input borders)\n * Only renders if hasAddonBefore is true\n */\n static renderAddonBefore(hasAddonBefore: boolean, onSlotChange: (e: Event) => void): TemplateResult | typeof nothing {\n if (!hasAddonBefore) return nothing;\n \n return html`\n <div class=\"input-addon-before\">\n <slot name=\"addon-before\" @slotchange=${onSlotChange}></slot>\n </div>\n `;\n }\n\n /**\n * Renders addon after slot content (outside input borders) \n * Only renders if hasAddonAfter is true\n */\n static renderAddonAfter(hasAddonAfter: boolean, onSlotChange: (e: Event) => void): TemplateResult | typeof nothing {\n if (!hasAddonAfter) return nothing;\n \n return html`\n <div class=\"input-addon-after\">\n <slot name=\"addon-after\" @slotchange=${onSlotChange}></slot>\n </div>\n `;\n }\n\n /**\n * Renders the copy icon when withCopy is enabled\n */\n static renderCopyIcon(\n withCopy: boolean,\n disabled: boolean,\n readonly: boolean,\n onCopy: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (!withCopy) return nothing;\n \n return html`<hy-icon\n name=\"copy\"\n type=\"regular\"\n id=\"copy-icon\"\n role=\"button\"\n aria-label=\"Copy input value\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onCopy : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n }\n\n /**\n * Renders state-based icons (warning, error)\n */\n static renderStateIcon(state: string): TemplateResult | typeof nothing {\n switch (state) {\n case INPUT_STATE.Warning:\n return html`<hy-icon name=\"warning\" id=\"warning-icon\"></hy-icon>`;\n case INPUT_STATE.Error:\n return html`<hy-icon name=\"exclamation-circle\" id=\"error-icon\"></hy-icon>`;\n default:\n return nothing;\n }\n }\n\n /**\n * Renders the calendar icon for calendar input type\n */\n static renderCalendarIcon(\n state: string,\n type: string\n ): TemplateResult | typeof nothing {\n if (state !== INPUT_STATE.Default || type !== INPUT_TYPE.CALENDAR) {\n return nothing;\n }\n \n return html`<hy-icon name=\"calendar\" type=\"regular\" id=\"calendar-icon\"></hy-icon>`;\n }\n\n /**\n * Renders password toggle icon\n */\n static renderPasswordIcon(\n type: string,\n inputType: string,\n disabled: boolean,\n readonly: boolean,\n onToggle: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (type !== INPUT_TYPE.PASSWORD) return nothing;\n \n if (inputType === INPUT_TYPE.TEXT) {\n return html`<hy-icon\n name=\"eye-slash\"\n type=\"regular\"\n id=\"password-icon\"\n role=\"button\"\n aria-label=\"Hide password\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onToggle : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n } else {\n return html`<hy-icon\n name=\"eye\"\n type=\"regular\"\n id=\"password-icon\"\n role=\"button\"\n aria-label=\"Show password\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onToggle : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n }\n }\n\n /**\n * Renders number input increment/decrement icons\n */\n static renderNumberIcons(\n type: string,\n state: string,\n disabled: boolean,\n readonly: boolean,\n onIncrement: () => void,\n onDecrement: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (type !== INPUT_TYPE.NUMBER) return nothing;\n \n return html`\n <div id=\"number-icons\">\n ${state !== INPUT_STATE.Default ? html`<span id=\"icons-separator\">|</span>` : nothing}\n <hy-icon \n name=\"minus\" \n aria-label=\"Decrease value\"\n role=\"button\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onDecrement : nothing}\n @keydown=${onKeydown}\n ></hy-icon>\n <span id=\"icons-separator\">|</span>\n <hy-icon \n name=\"plus\" \n aria-label=\"Increase value\"\n role=\"button\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onIncrement : nothing}\n @keydown=${onKeydown}\n ></hy-icon>\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input-renderers.js","sourceRoot":"","sources":["../../../../src/components/input/utils/input-renderers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAE3B;;OAEG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,cAAuB,EAAE,YAAgC;QAChF,IAAI,CAAC,cAAc;YAAE,OAAO,OAAO,CAAC;QAEpC,OAAO,IAAI,CAAA;;gDAEiC,YAAY;;KAEvD,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAsB,EAAE,YAAgC;QAC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AAI,yCAAwB;YAAE,OAAO,OAAO,CAAC;QAEjD,IAAI,SAAS,iCAAoB,EAAE;YACjC,OAAO,IAAI,CAAA;;;;;;;iBAOA,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;mBACzC,SAAS;kBACV,CAAC;SACd;aAAM;YACL,OAAO,IAAI,CAAA;;;;;;;iBAOA,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;mBACzC,SAAS;kBACV,CAAC;SACd;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,IAAY,EACZ,KAAa,EACb,QAAiB,EACjB,QAAiB,EACjB,WAAuB,EACvB,WAAuB,EACvB,SAAqC;QAErC,IAAI,IAAI,qCAAsB;YAAE,OAAO,OAAO,CAAC;QAE/C,OAAO,IAAI,CAAA;;UAEL,KAAK,wCAAwB,CAAC,CAAC,CAAC,IAAI,CAAA,qCAAqC,CAAC,CAAC,CAAC,OAAO;;;;;;mBAM1E,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;qBAC5C,SAAS;;;;;;;;mBAQX,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;qBAC5C,SAAS;;;KAGzB,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { html, TemplateResult, nothing } from 'lit';\nimport { INPUT_TYPE, INPUT_STATE } from '../input.types.js';\n\n/**\n * Rendering utilities for input component icons and elements\n */\nexport class InputRenderUtils {\n\n /**\n * Renders prefix slot content\n */\n static renderPrefix(): TemplateResult {\n return html`\n <div class=\"input-prefix\">\n <slot name=\"prefix\"></slot>\n </div>\n `;\n }\n\n /**\n * Renders suffix slot content \n */\n static renderSuffix(): TemplateResult {\n return html`\n <div class=\"input-suffix\">\n <slot name=\"suffix\"></slot>\n </div>\n `;\n }\n\n /**\n * Renders addon before slot content (outside input borders)\n * Only renders if hasAddonBefore is true\n */\n static renderAddonBefore(hasAddonBefore: boolean, onSlotChange: (e: Event) => void): TemplateResult | typeof nothing {\n if (!hasAddonBefore) return nothing;\n \n return html`\n <div class=\"input-addon-before\">\n <slot name=\"addon-before\" @slotchange=${onSlotChange}></slot>\n </div>\n `;\n }\n\n /**\n * Renders addon after slot content (outside input borders) \n * Only renders if hasAddonAfter is true\n */\n static renderAddonAfter(hasAddonAfter: boolean, onSlotChange: (e: Event) => void): TemplateResult | typeof nothing {\n if (!hasAddonAfter) return nothing;\n \n return html`\n <div class=\"input-addon-after\">\n <slot name=\"addon-after\" @slotchange=${onSlotChange}></slot>\n </div>\n `;\n }\n\n /**\n * Renders the copy icon when withCopy is enabled\n */\n static renderCopyIcon(\n withCopy: boolean,\n disabled: boolean,\n readonly: boolean,\n onCopy: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (!withCopy) return nothing;\n \n return html`<hy-icon\n name=\"copy\"\n type=\"regular\"\n id=\"copy-icon\"\n role=\"button\"\n aria-label=\"Copy input value\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onCopy : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n }\n\n /**\n * Renders the clear icon when allowClear is enabled and there's content\n */\n static renderClearIcon(\n allowClear: boolean,\n value: string,\n disabled: boolean,\n readonly: boolean,\n onClear: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (!allowClear || !value || disabled || readonly) return nothing;\n \n return html`<hy-icon\n name=\"times-circle\"\n type=\"regular\"\n id=\"clear-icon\"\n role=\"button\"\n aria-label=\"Clear input value\"\n tabindex=\"0\"\n @click=${onClear}\n @keydown=${onKeydown}\n ></hy-icon>`;\n }\n\n /**\n * Renders state-based icons (warning, error)\n */\n static renderStateIcon(state: string): TemplateResult | typeof nothing {\n switch (state) {\n case INPUT_STATE.Warning:\n return html`<hy-icon name=\"warning\" id=\"warning-icon\"></hy-icon>`;\n case INPUT_STATE.Error:\n return html`<hy-icon name=\"exclamation-circle\" id=\"error-icon\"></hy-icon>`;\n default:\n return nothing;\n }\n }\n\n /**\n * Renders the calendar icon for calendar input type\n */\n static renderCalendarIcon(\n state: string,\n type: string\n ): TemplateResult | typeof nothing {\n if (state !== INPUT_STATE.Default || type !== INPUT_TYPE.CALENDAR) {\n return nothing;\n }\n \n return html`<hy-icon name=\"calendar\" type=\"regular\" id=\"calendar-icon\"></hy-icon>`;\n }\n\n /**\n * Renders password toggle icon\n */\n static renderPasswordIcon(\n type: string,\n inputType: string,\n disabled: boolean,\n readonly: boolean,\n onToggle: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (type !== INPUT_TYPE.PASSWORD) return nothing;\n \n if (inputType === INPUT_TYPE.TEXT) {\n return html`<hy-icon\n name=\"eye-slash\"\n type=\"regular\"\n id=\"password-icon\"\n role=\"button\"\n aria-label=\"Hide password\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onToggle : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n } else {\n return html`<hy-icon\n name=\"eye\"\n type=\"regular\"\n id=\"password-icon\"\n role=\"button\"\n aria-label=\"Show password\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onToggle : nothing}\n @keydown=${onKeydown}\n ></hy-icon>`;\n }\n }\n\n /**\n * Renders number input increment/decrement icons\n */\n static renderNumberIcons(\n type: string,\n state: string,\n disabled: boolean,\n readonly: boolean,\n onIncrement: () => void,\n onDecrement: () => void,\n onKeydown: (e: KeyboardEvent) => void\n ): TemplateResult | typeof nothing {\n if (type !== INPUT_TYPE.NUMBER) return nothing;\n \n return html`\n <div id=\"number-icons\">\n ${state !== INPUT_STATE.Default ? html`<span id=\"icons-separator\">|</span>` : nothing}\n <hy-icon \n name=\"minus\" \n aria-label=\"Decrease value\"\n role=\"button\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onDecrement : nothing}\n @keydown=${onKeydown}\n ></hy-icon>\n <span id=\"icons-separator\">|</span>\n <hy-icon \n name=\"plus\" \n aria-label=\"Increase value\"\n role=\"button\"\n tabindex=\"0\"\n @click=${!disabled && !readonly ? onIncrement : nothing}\n @keydown=${onKeydown}\n ></hy-icon>\n </div>\n `;\n }\n}\n"]}
|