@randstad-uca/design-system 1.0.93 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SocialMediaInput.d.ts +125 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +230 -54
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/stories/SocialMediaInput.stories.d.ts +31 -0
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { BaseControl } from '../helpers/BaseControl';
|
|
3
|
+
/**
|
|
4
|
+
* LinkedIn input component with fixed prefix and editable username
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Fixed prefix "linkedin.com/in/" (non-editable)
|
|
8
|
+
* - Editable input for username
|
|
9
|
+
* - Character restrictions: only letters, numbers, and hyphens
|
|
10
|
+
* - Minimum 3 characters validation
|
|
11
|
+
* - Maximum 100 characters validation
|
|
12
|
+
* - Auto-extract username from full LinkedIn URL on paste
|
|
13
|
+
* - Validates pasted content for invalid formats
|
|
14
|
+
* - Angular Reactive Forms Support via ControlValueAccessor
|
|
15
|
+
*/
|
|
16
|
+
export declare class RandstadSocialMediaInput extends BaseControl {
|
|
17
|
+
/** Tipo de plataforma: linkedin, facebook o google */
|
|
18
|
+
platform: 'linkedin' | 'facebook' | 'google';
|
|
19
|
+
size: 'sm' | 'md' | 'lg';
|
|
20
|
+
maxLength: number;
|
|
21
|
+
isPasswordVisible: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Patrón de expresiones regulares personalizado para la desinfección de caracteres.
|
|
24
|
+
* Si no se proporciona, utiliza el valor predeterminado: /[^a-zA-Z0-9-]/g
|
|
25
|
+
* Ejemplo: /[^a-zA-Z0-9-_]/g para permitir guiones bajos */
|
|
26
|
+
customSanitizeRegex: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Patrón de expresiones regulares personalizado para validación de URL por plataforma.
|
|
29
|
+
* Si no se proporciona, utiliza valores por defecto:
|
|
30
|
+
* - linkedin: /^(https?:\/\/)?(www\.)?linkedin\.com\/in\/([a-zA-Z0-9-]+)\/?.*$/i
|
|
31
|
+
* - facebook: /^(https?:\/\/)?(www\.)?facebook\.com\/([azA-Z0-9.]+)\/?.*$/i
|
|
32
|
+
*/
|
|
33
|
+
customUrlValidationRegex: string | undefined;
|
|
34
|
+
value: string;
|
|
35
|
+
private _inputValue;
|
|
36
|
+
private _showFormatError;
|
|
37
|
+
private _onChangeFn;
|
|
38
|
+
private _onTouchedFn;
|
|
39
|
+
static styles: (import("lit").CSSResult | CSSStyleSheet)[];
|
|
40
|
+
/**
|
|
41
|
+
* Prefijo fijo según la plataforma
|
|
42
|
+
*/
|
|
43
|
+
private get _fixedPrefix();
|
|
44
|
+
/**
|
|
45
|
+
* Comprueba si se debe mostrar el sufijo después de la entrada (para Google)
|
|
46
|
+
*/
|
|
47
|
+
private get _isSuffix();
|
|
48
|
+
/**
|
|
49
|
+
* Comprueba si se debe mostrar el prefijo para (linkedin o facebook)
|
|
50
|
+
*/
|
|
51
|
+
private get _isPrefix();
|
|
52
|
+
/**
|
|
53
|
+
* Placeholder text
|
|
54
|
+
*/
|
|
55
|
+
private get _placeholder();
|
|
56
|
+
/**
|
|
57
|
+
* Sanitization Regex (default)
|
|
58
|
+
*/
|
|
59
|
+
private get _sanitizeRegex();
|
|
60
|
+
/**
|
|
61
|
+
* Regex URL para la plataforma actual
|
|
62
|
+
*/
|
|
63
|
+
private get _urlValidationRegex();
|
|
64
|
+
/**
|
|
65
|
+
* Handle input event from the editable field
|
|
66
|
+
*/
|
|
67
|
+
private _handleInput;
|
|
68
|
+
/**
|
|
69
|
+
* Handle paste event - extract username from LinkedIn/Facebook URL or validate pasted content
|
|
70
|
+
*/
|
|
71
|
+
private _handlePaste;
|
|
72
|
+
/**
|
|
73
|
+
* Validation error
|
|
74
|
+
*/
|
|
75
|
+
private get _hasMinLengthError();
|
|
76
|
+
/**
|
|
77
|
+
* Get the error message to display
|
|
78
|
+
*/
|
|
79
|
+
private get _errorMessageToDisplay();
|
|
80
|
+
/**
|
|
81
|
+
* Check if there's any error state
|
|
82
|
+
*/
|
|
83
|
+
private get _hasError();
|
|
84
|
+
/**
|
|
85
|
+
* Construye el valor final completo basado en la plataforma actual
|
|
86
|
+
*/
|
|
87
|
+
private _getFullValue;
|
|
88
|
+
/**
|
|
89
|
+
* Extrae el usuario de una URL completa según la plataforma
|
|
90
|
+
*/
|
|
91
|
+
private _extractUsernameFromValue;
|
|
92
|
+
/**
|
|
93
|
+
* Sincroniza el valor externo (value) con el valor interno (_inputValue)
|
|
94
|
+
*/
|
|
95
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
96
|
+
/**
|
|
97
|
+
* Render the component
|
|
98
|
+
*/
|
|
99
|
+
render(): TemplateResult<1>;
|
|
100
|
+
/**
|
|
101
|
+
* Override renderHelper to use custom helper text
|
|
102
|
+
*/
|
|
103
|
+
renderHelper(): TemplateResult<1>;
|
|
104
|
+
/**
|
|
105
|
+
* Angular: Escribe el valor en el componente
|
|
106
|
+
*/
|
|
107
|
+
writeValue(value: unknown): void;
|
|
108
|
+
/**
|
|
109
|
+
* Angular: Registra el callback para cambios
|
|
110
|
+
*/
|
|
111
|
+
registerOnChange(fn: (value: any) => void): void;
|
|
112
|
+
/**
|
|
113
|
+
* Angular: Registra el callback para blur (touched)
|
|
114
|
+
*/
|
|
115
|
+
registerOnTouched(fn: () => void): void;
|
|
116
|
+
/**
|
|
117
|
+
* Angular: Configura el estado disabled del componente
|
|
118
|
+
*/
|
|
119
|
+
setDisabledState(isDisabled: boolean): void;
|
|
120
|
+
}
|
|
121
|
+
declare global {
|
|
122
|
+
interface HTMLElementTagNameMap {
|
|
123
|
+
'randstad-social-input': RandstadSocialMediaInput;
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './components/Checkbox';
|
|
|
10
10
|
export * from './components/Form';
|
|
11
11
|
export * from './components/FormGroup';
|
|
12
12
|
export * from './components/Icon';
|
|
13
|
+
export * from './components/SocialMediaInput';
|
|
13
14
|
export * from './components/Modal';
|
|
14
15
|
export * from './components/Notice';
|
|
15
16
|
export * from './components/Popup';
|