@oslokommune/punkt-elements 13.5.3 → 13.5.5
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/CHANGELOG.md +34 -0
- package/dist/{loader-CHPxY9c6.cjs → loader-DNidjwH-.cjs} +6 -1
- package/dist/{loader-Da4IOk_T.js → loader-h3d-3D7s.js} +6 -1
- package/dist/{messagebox-DwGdcdm7.js → messagebox-C8KQgCl_.js} +14 -13
- package/dist/{messagebox-CqUBJs_D.cjs → messagebox-CjPtPPrW.cjs} +1 -0
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/{select-Dkl0KhGW.cjs → select-CD6Zn8YH.cjs} +12 -12
- package/dist/{select-CJS_CIKv.js → select-dcaJHvmR.js} +20 -20
- package/package.json +2 -2
- package/src/components/listbox/listbox.test.ts +225 -0
- package/src/components/loader/loader.test.ts +257 -0
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.test.ts +241 -0
- package/src/components/messagebox/messagebox.ts +1 -0
- package/src/components/progressbar/progressbar.test.ts +195 -0
- package/src/components/radiobutton/radiobutton.test.ts +272 -0
- package/src/components/select/select.test.ts +227 -0
- package/src/components/select/select.ts +23 -12
|
@@ -150,6 +150,16 @@ export class PktSelect extends PktInputElement implements IPktSelect {
|
|
|
150
150
|
|
|
151
151
|
update(changedProperties: PropertyValues) {
|
|
152
152
|
super.update(changedProperties)
|
|
153
|
+
if (changedProperties.has('options')) {
|
|
154
|
+
this._options = this.options
|
|
155
|
+
this.requestUpdate('_options')
|
|
156
|
+
|
|
157
|
+
// If no value is set and we have options, set to first option
|
|
158
|
+
if (!this.value && this._options.length > 0) {
|
|
159
|
+
this.value = this._options[0].value
|
|
160
|
+
this.selectedIndex = 0
|
|
161
|
+
}
|
|
162
|
+
}
|
|
153
163
|
if (changedProperties.has('value') && this.value !== changedProperties.get('value')) {
|
|
154
164
|
this.selectedIndex = this.touched
|
|
155
165
|
? this.returnNumberOrNull(this.inputRef.value?.selectedIndex)
|
|
@@ -230,18 +240,19 @@ export class PktSelect extends PktInputElement implements IPktSelect {
|
|
|
230
240
|
}}
|
|
231
241
|
${ref(this.inputRef)}
|
|
232
242
|
>
|
|
233
|
-
${this._options.length > 0
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
${this._options.length > 0
|
|
244
|
+
? this._options.map(
|
|
245
|
+
(option) =>
|
|
246
|
+
html`<option
|
|
247
|
+
value=${option.value}
|
|
248
|
+
?selected=${this.value == option.value || option.selected}
|
|
249
|
+
?disabled=${option.disabled}
|
|
250
|
+
?hidden=${option.hidden}
|
|
251
|
+
>
|
|
252
|
+
${option.label}
|
|
253
|
+
</option>`,
|
|
254
|
+
)
|
|
255
|
+
: ''}
|
|
245
256
|
</select>
|
|
246
257
|
<div class="pkt-contents" ${ref(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
247
258
|
</pkt-input-wrapper>
|