@randstad-uca/design-system 1.0.7 → 1.0.8

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.
@@ -3,10 +3,9 @@ export declare class IconComponent extends LitElement {
3
3
  name: string;
4
4
  size: string;
5
5
  color: string;
6
+ key: string;
6
7
  static styles: import("lit").CSSResult;
7
- constructor();
8
- connectedCallback(): void;
9
8
  updated(changedProperties: Map<string, unknown>): void;
10
9
  loadIcon(): Promise<void>;
11
- render(): null;
10
+ render(): symbol;
12
11
  }
package/dist/index.js CHANGED
@@ -41,11 +41,6 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
41
41
  display: inline-block;
42
42
  }
43
43
 
44
- :host([disabled]) {
45
- pointer-events: none;
46
- cursor: not-allowed;
47
- }
48
-
49
44
  .button {
50
45
  display: flex;
51
46
  align-items: center;
@@ -61,95 +56,99 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
61
56
  width: 100%;
62
57
  }
63
58
 
64
- .button[disabled] {
65
- cursor: not-allowed;
66
- }
67
-
68
59
  .button-lg {
69
60
  font-size: 18px;
70
61
  line-height: 30px;
71
- min-width: 48px;
72
- min-height: 62px; /* padding (16px * 2) + line-height (30px) */
62
+ min-height: 62px;
73
63
  }
74
64
 
75
65
  .button-md {
76
66
  font-size: 14px;
77
67
  line-height: 25px;
78
- min-height: 57px; /* padding (16px * 2) + line-height (25px) */
68
+ min-height: 57px;
79
69
  }
80
70
 
71
+ /* Primary */
81
72
  .button-primary {
82
73
  background-color: var(--primary-color);
83
74
  color: var(--white);
84
75
  }
85
76
 
86
- :host(:hover) .button-primary:not([disabled]) {
77
+ .button-primary:not([disabled]):hover {
87
78
  background-color: var(--primary-button-hover);
88
79
  }
89
80
 
90
- :host(:active) .button-primary:not([disabled]) {
81
+ .button-primary:not([disabled]):active {
91
82
  background-color: var(--primary-button-active);
92
83
  }
93
84
 
94
- :host(:focus-within) .button-primary:not([disabled]) {
95
- background-color: var(--primary-button-focus);
85
+ .button-primary:not([disabled]):focus-visible {
86
+ outline: 2px solid var(--primary-button-focus);
87
+ outline-offset: 2px;
96
88
  }
97
89
 
98
90
  .button-primary[disabled] {
99
91
  color: var(--secondary-color-60);
100
92
  background-color: var(--secondary-color-20);
93
+ cursor: not-allowed;
101
94
  }
102
95
 
96
+ /* Secondary */
103
97
  .button-secondary {
104
98
  background: none;
105
99
  color: var(--primary-color);
106
100
  border: 1px solid var(--primary-color);
107
101
  }
108
102
 
109
- :host(:hover) .button-secondary:not([disabled]) {
103
+ .button-secondary:not([disabled]):hover {
110
104
  color: #175197;
111
- border: 1px solid #175197;
105
+ border-color: #175197;
112
106
  }
113
107
 
114
- :host(:active) .button-secondary:not([disabled]) {
108
+ .button-secondary:not([disabled]):active {
115
109
  color: var(--secondary-color-80);
116
- border: 1px solid var(--secondary-color-80);
110
+ border-color: var(--secondary-color-80);
117
111
  }
118
112
 
119
- :host(:focus-within) .button-secondary:not([disabled]) {
120
- color: var(--primary-color);
121
- border: 1px solid var(--primary-color);
113
+ .button-secondary:not([disabled]):focus-visible {
114
+ outline: 2px solid var(--primary-color);
115
+ outline-offset: 2px;
122
116
  }
123
117
 
124
118
  .button-secondary[disabled] {
125
119
  color: var(--secondary-color-60);
126
- border: 1px solid var(--secondary-color-60);
120
+ border-color: var(--secondary-color-60);
121
+ cursor: not-allowed;
127
122
  }
128
123
 
124
+ /* Tertiary */
129
125
  .button-tertiary {
130
126
  background: none;
131
127
  border: none;
132
128
  color: var(--primary-color);
133
129
  }
134
130
 
135
- :host(:hover) .button-tertiary:not([disabled]) {
131
+ .button-tertiary:not([disabled]):hover {
136
132
  background: #2175D90D;
137
133
  }
138
134
 
139
- :host(:active) .button-tertiary:not([disabled]) {
135
+ .button-tertiary:not([disabled]):active {
140
136
  background-color: #2175D91A;
141
137
  }
142
138
 
143
- :host(:focus-within) .button-tertiary:not([disabled]) {
144
- border: 1px solid var(--primary-color);
139
+ .button-tertiary:not([disabled]):focus-visible {
140
+ outline: 2px solid var(--primary-color);
141
+ outline-offset: 2px;
145
142
  }
146
143
 
147
144
  .button-tertiary[disabled] {
148
145
  color: #6F758D;
146
+ cursor: not-allowed;
149
147
  }
150
148
 
149
+ /* Round */
151
150
  .button-round {
152
- width: 48px !important;
151
+ width: 48px;
153
152
  height: 48px;
154
153
  border-radius: 50%;
155
154
  background-color: var(--white);
@@ -157,16 +156,22 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
157
156
  padding: 0;
158
157
  }
159
158
 
160
- :host(:hover) .button-round:not([disabled]) {
159
+ .button-round:not([disabled]):hover {
161
160
  background-color: #E8F1FB;
162
161
  }
163
162
 
164
- :host(:active) .button-round:not([disabled]) {
163
+ .button-round:not([disabled]):active {
165
164
  background-color: #A6C8F0;
166
165
  }
167
166
 
167
+ .button-round:not([disabled]):focus-visible {
168
+ outline: 2px solid var(--primary-color);
169
+ outline-offset: 2px;
170
+ }
171
+
168
172
  .button-round[disabled] {
169
173
  background-color: var(--secondary-color-20);
174
+ cursor: not-allowed;
170
175
  }
171
176
 
172
177
  .button-round img.button-icon {
@@ -174,13 +179,14 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
174
179
  height: 24px;
175
180
  }
176
181
 
182
+ /* Loader */
177
183
  .loader {
178
184
  display: flex;
179
185
  gap: 8px;
180
186
  justify-content: center;
181
187
  align-items: center;
182
188
  width: 100%;
183
- height: 100%; /* Ocupa toda la altura del botón */
189
+ height: 100%;
184
190
  }
185
191
 
186
192
  .dot {
@@ -237,7 +243,7 @@ function N(t,e){return(e,o,i)=>((t,e,o)=>(o.configurable=!0,o.enumerable=!0,Refl
237
243
  `:o`
238
244
  ${this.iconSrc&&"button-round"===this.variant?o`<img src=${this.iconSrc} alt="icon" class="button-icon" />`:""}
239
245
  ${this.iconName&&"button-round"!==this.variant&&"left"===this.iconPosition?o`<randstad-icon name=${this.iconName} size="24px"></randstad-icon>`:""}
240
- <slot>${this.label}</slot>
246
+ ${this.label?o`<span>${this.label}</span>`:o`<slot></slot>`}
241
247
  ${this.iconName&&"button-round"!==this.variant&&"right"===this.iconPosition?o`<randstad-icon name=${this.iconName} size="24px"></randstad-icon>`:""}
242
248
  `}
243
249
  </button>
@@ -4222,11 +4228,10 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4222
4228
  />
4223
4229
  ${"password"===this.type?o`
4224
4230
  <button type="button" class="toggle-password" @click=${this.togglePassword}>
4225
- <randstad-icon
4226
- name=${this.isPasswordVisible?"eye_crossed":"eye"}
4227
- size="24px"
4228
- color="#2175D9"
4229
- ></randstad-icon>
4231
+ <button type="button" class="toggle-password" @click=${this.togglePassword}>
4232
+ ${this.isPasswordVisible?o`<randstad-icon name="eye_crossed" size="24px" color="#2175D9" key="visible"></randstad-icon>`:o`<randstad-icon name="eye" size="24px" color="#2175D9" key="hidden"></randstad-icon>`}
4233
+ </button>
4234
+
4230
4235
  </button>
4231
4236
  `:r}
4232
4237
  `}
@@ -4248,7 +4253,7 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4248
4253
 
4249
4254
  ${this.helper?o`<p class="helper-description">${this.helper}</p>`:r}
4250
4255
  </div>
4251
- `}};n([I({type:String}),a("design:type",String)],xs.prototype,"placeholder",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"labelColor",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"value",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"size",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"icon",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"helper",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"error",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"errorMessage",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"success",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"disabled",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"typing",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"type",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"tooltipMessage",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkText",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkRoute",void 0),n([I({type:Boolean,reflect:!0}),a("design:type",Object)],xs.prototype,"isPasswordVisible",void 0),xs=n([l("randstad-form")],xs);class Cs extends t{static{this.styles=e`
4256
+ `}};n([I({type:String}),a("design:type",String)],xs.prototype,"placeholder",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"label",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"labelColor",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"value",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"size",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"icon",void 0),n([I({type:String}),a("design:type",Object)],xs.prototype,"helper",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"error",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"errorMessage",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"success",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"disabled",void 0),n([I({type:Boolean}),a("design:type",Boolean)],xs.prototype,"typing",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"type",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"tooltipMessage",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkText",void 0),n([I({type:String}),a("design:type",String)],xs.prototype,"linkRoute",void 0),n([I({type:Boolean,reflect:!0}),a("design:type",Object)],xs.prototype,"isPasswordVisible",void 0),xs=n([l("randstad-form")],xs);class Cs extends t{constructor(){super(...arguments),this.name="",this.size="24px",this.color="",this.key=""}static{this.styles=e`
4252
4257
  :host {
4253
4258
  display: inline-flex;
4254
4259
  width: var(--icon-size, 24px);
@@ -4256,12 +4261,13 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4256
4261
  align-items: center;
4257
4262
  justify-content: center;
4258
4263
  }
4264
+
4259
4265
  svg {
4260
- width: var(--icon-size, 24px); /* Tamaño fijo basado en size */
4261
- height: var(--icon-size, 24px); /* Tamaño fijo basado en size */
4266
+ width: var(--icon-size, 24px);
4267
+ height: var(--icon-size, 24px);
4262
4268
  fill: var(--icon-color, currentColor);
4263
4269
  }
4264
- `}constructor(){super(),this.name="",this.size="24px",this.color=""}connectedCallback(){super.connectedCallback(),this.name&&this.loadIcon()}updated(t){t.has("name")&&this.name&&this.loadIcon(),t.has("size")&&this.style.setProperty("--icon-size",this.size),t.has("color")&&this.style.setProperty("--icon-color",this.color)}async loadIcon(){if(this.name)try{const t=await fetch(`/assets/icons/${this.name}.svg`);if(!t.ok)throw new Error("Icon not found");const e=await t.text(),o=new DOMParser,i=o.parseFromString(e,"image/svg+xml").querySelector("svg");if(!i)throw new Error("No se encontró un elemento SVG válido");i.removeAttribute("fill"),i.setAttribute("width",this.size||"24px"),i.setAttribute("height",this.size||"24px"),this.renderRoot.innerHTML="",this.renderRoot.appendChild(i)}catch(t){console.error(`❌ Error cargando icono ${this.name}:`,t),this.renderRoot.innerHTML="<span>⚠️</span>"}else this.renderRoot.innerHTML=""}render(){return null}}n([I({type:String}),a("design:type",String)],Cs.prototype,"name",void 0),n([I({type:String}),a("design:type",String)],Cs.prototype,"size",void 0),n([I({type:String}),a("design:type",String)],Cs.prototype,"color",void 0),customElements.define("randstad-icon",Cs);let ks=class extends t{constructor(){super(...arguments),this.open=!1,this.title="Título del modal"}static{this.styles=e`
4270
+ `}updated(t){(t.has("name")||t.has("key"))&&this.loadIcon(),t.has("size")&&this.style.setProperty("--icon-size",this.size),t.has("color")&&this.style.setProperty("--icon-color",this.color)}async loadIcon(){if(this.name)try{const t=await fetch(`/assets/icons/${this.name}.svg`);if(!t.ok)throw new Error("Icon not found");const e=await t.text(),o=new DOMParser,i=o.parseFromString(e,"image/svg+xml").querySelector("svg");if(!i)throw new Error("No se encontró un SVG válido");i.removeAttribute("fill"),i.setAttribute("width",this.size),i.setAttribute("height",this.size),this.renderRoot.innerHTML="",this.renderRoot.appendChild(i)}catch(t){console.error(`❌ Error cargando icono ${this.name}:`,t),this.renderRoot.innerHTML="<span>⚠️</span>"}else this.renderRoot.innerHTML=""}render(){return r}}n([I({type:String}),a("design:type",String)],Cs.prototype,"name",void 0),n([I({type:String}),a("design:type",String)],Cs.prototype,"size",void 0),n([I({type:String}),a("design:type",String)],Cs.prototype,"color",void 0),n([I({type:String}),a("design:type",String)],Cs.prototype,"key",void 0),customElements.define("randstad-icon",Cs);let ks=class extends t{constructor(){super(...arguments),this.open=!1,this.title="Título del modal"}static{this.styles=e`
4265
4271
  :host {
4266
4272
  display: none;
4267
4273
  position: fixed;
@@ -4460,13 +4466,17 @@ console.warn('WARNING: Since Vaadin 23.2, "@vaadin/vaadin-date-picker" is deprec
4460
4466
  `}closePopup(t){this.dispatchEvent(new CustomEvent("popup-close",{detail:t})),this.open=!1}render(){return o`
4461
4467
  <div class="popup" style="width: ${this.width};">
4462
4468
  ${"default"===this.type?o`
4463
- <div><img src="assets/img/icon_${this.icon}.svg"></div>
4469
+ <div>
4470
+ <randstad-icon name="${this.icon}" size="56px"></randstad-icon>
4471
+ </div>
4464
4472
  <p>${this.description}</p>
4465
4473
  <div class="buttons">
4466
4474
  <button class="primary" @click=${()=>this.closePopup(!0)}>${this.buttonText}</button>
4467
4475
  </div>
4468
4476
  `:o`
4469
- <div><img src="assets/img/icon_${this.icon}.svg"></div>
4477
+ <div>
4478
+ <randstad-icon name="${this.icon}" size="56px"></randstad-icon>
4479
+ </div>
4470
4480
  <h2>${this.title}</h2>
4471
4481
  <p>${this.description}</p>
4472
4482
  <div class="buttons">
@@ -4963,7 +4973,7 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4963
4973
  .hidden {
4964
4974
  display: none;
4965
4975
  }
4966
- `}constructor(){super(),this.options=[],this.placeholder="Filtrar opciones...",this.defaultValue="",this.disabled=!1,this.label="",this.labelColor="",this.filterable=!0,this.filteredOptions=[],this.filterValue="",this.isOpen=!1,this.debounceTimeout=null,this.defaultValue&&this.options.includes(this.defaultValue)&&(this.filterValue=this.defaultValue)}willUpdate(t){t.has("options")&&(this.filteredOptions=[...this.options]),t.has("defaultValue")&&this.options.includes(this.defaultValue)&&(this.filterValue=this.defaultValue)}connectedCallback(){super.connectedCallback(),this.filteredOptions=[...this.options],document.addEventListener("click",this.handleClickOutside.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside.bind(this))}handleInputClick(t){this.disabled||t.target!==this.shadowRoot.querySelector(".filter-input")||(this.isOpen=!this.isOpen,this.requestUpdate())}handleInput(t){const e=t.target.value.toLowerCase();this.filterValue=e,this.filteredOptions=this.options.filter((t=>("string"==typeof t?t:t.label).toLowerCase().includes(this.filterValue.toLowerCase()))),this.isOpen=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout((()=>{this.filterValue.length>2&&this.dispatchEvent(new CustomEvent("filter-location",{detail:{value:this.filterValue},bubbles:!0,composed:!0}))}),300),this.requestUpdate()}handleSelect(t){const e="string"==typeof t?t:t.value;this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:e},bubbles:!0,composed:!0})),this.filterValue="string"==typeof t?t:t.label,this.isOpen=!1,this.requestUpdate()}handleIconClick(){this.disabled||(this.isOpen||this.filterValue?(this.isOpen=!1,this.filterValue="",this.filteredOptions=[...this.options],this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:""},bubbles:!0,composed:!0}))):this.isOpen=!0,this.requestUpdate())}handleClickOutside(t){this.contains(t.target)||(this.isOpen=!1,this.requestUpdate())}render(){const t=this.isOpen||this.filterValue?"close":"arrow_down";return o`
4976
+ `}constructor(){super(),this.options=[],this.placeholder="Filtrar opciones...",this.defaultValue="",this.disabled=!1,this.label="",this.labelColor="",this.filterable=!0,this.filteredOptions=[],this.filterValue="",this.isOpen=!1,this.debounceTimeout=null,this.defaultValue&&this.options.includes(this.defaultValue)&&(this.filterValue=this.defaultValue)}willUpdate(t){t.has("options")&&(this.filteredOptions=[...this.options]),t.has("defaultValue")&&this.options.includes(this.defaultValue)&&(this.filterValue=this.defaultValue)}connectedCallback(){super.connectedCallback(),this.filteredOptions=[...this.options],document.addEventListener("click",this.handleClickOutside.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClickOutside.bind(this))}handleInputClick(t){this.disabled||t.target!==this.shadowRoot.querySelector(".filter-input")||(this.isOpen=!this.isOpen,this.requestUpdate())}handleInput(t){const e=t.target.value.toLowerCase();this.filterValue=e,this.filteredOptions=this.options.filter((t=>("string"==typeof t?t:t.label).toLowerCase().includes(this.filterValue.toLowerCase()))),this.isOpen=!0,this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=window.setTimeout((()=>{this.filterValue.length>2&&this.dispatchEvent(new CustomEvent("filter-location",{detail:{value:this.filterValue},bubbles:!0,composed:!0}))}),300),this.requestUpdate()}handleSelect(t){const e="string"==typeof t?t:t.value;this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:e},bubbles:!0,composed:!0})),this.filterValue="string"==typeof t?t:t.label,this.isOpen=!1,this.requestUpdate()}handleIconClick(){this.disabled||(this.isOpen||this.filterValue?(this.isOpen=!1,this.filterValue="",this.filteredOptions=[...this.options],this.dispatchEvent(new CustomEvent("option-selected",{detail:{value:""},bubbles:!0,composed:!0}))):this.isOpen=!0,this.requestUpdate())}handleClickOutside(t){this.contains(t.target)||(this.isOpen=!1,this.requestUpdate())}render(){return o`
4967
4977
  <div class="select-container" style="${this.labelColor?` --label-color: ${this.labelColor}`:""}">
4968
4978
  ${this.label?o`
4969
4979
  <div class="label-container">
@@ -4986,7 +4996,7 @@ const ha=e`@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20p
4986
4996
  @click="${this.handleIconClick}"
4987
4997
  ?disabled="${this.disabled}"
4988
4998
  >
4989
- <randstad-icon name="${t}" size="24px" color="#2175D9"></randstad-icon>
4999
+ ${this.isOpen||this.filterValue?o`<randstad-icon name="close" size="24px" color="#2175D9" key="visible"></randstad-icon>`:o`<randstad-icon name="arrow_down" size="24px" color="#2175D9" key="hidden"></randstad-icon>`}
4990
5000
  </button>
4991
5001
  </div>
4992
5002
  <ul class="options-list ${this.isOpen&&this.filteredOptions.length>0?"":"hidden"}">