@oslokommune/punkt-elements 13.0.0 → 13.1.2

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/checkbox-CTRbpbye.js +120 -0
  3. package/dist/checkbox-wJ26voZd.cjs +30 -0
  4. package/dist/{combobox-DWYPzXj-.cjs → combobox-CijGa9Fr.cjs} +3 -2
  5. package/dist/{combobox-BREXxMeO.js → combobox-Cwg9Rkmz.js} +3 -2
  6. package/dist/{datepicker-SYeGnXRZ.cjs → datepicker-BhrUneAP.cjs} +2 -1
  7. package/dist/{datepicker-DH4ZFMxD.js → datepicker-CEfh3TTA.js} +3 -2
  8. package/dist/index.d.ts +14 -1
  9. package/dist/{input-element-CHjLWeKt.cjs → input-element-C4xJoM-X.cjs} +1 -1
  10. package/dist/{input-element-Cco4PA2M.js → input-element-NnrDmp4r.js} +14 -11
  11. package/dist/{input-wrapper-BND8tUg_.cjs → input-wrapper-CZ-a00V7.cjs} +16 -14
  12. package/dist/input-wrapper-Dr__Sxql.js +189 -0
  13. package/dist/pkt-checkbox.cjs +1 -1
  14. package/dist/pkt-checkbox.js +1 -1
  15. package/dist/pkt-combobox.cjs +1 -1
  16. package/dist/pkt-combobox.js +1 -1
  17. package/dist/pkt-datepicker.cjs +1 -1
  18. package/dist/pkt-datepicker.js +1 -1
  19. package/dist/pkt-index.cjs +1 -1
  20. package/dist/pkt-index.js +8 -8
  21. package/dist/pkt-input-wrapper.cjs +1 -1
  22. package/dist/pkt-input-wrapper.js +1 -1
  23. package/dist/pkt-radiobutton.cjs +1 -1
  24. package/dist/pkt-radiobutton.js +1 -1
  25. package/dist/pkt-select.cjs +1 -1
  26. package/dist/pkt-select.js +1 -1
  27. package/dist/pkt-textarea.cjs +1 -1
  28. package/dist/pkt-textarea.js +1 -1
  29. package/dist/pkt-textinput.cjs +1 -1
  30. package/dist/pkt-textinput.js +1 -1
  31. package/dist/radiobutton-CWxiIVfA.js +111 -0
  32. package/dist/radiobutton-CdT6v1oq.cjs +31 -0
  33. package/dist/{select-DGHoBmbb.js → select-CsgDatCa.js} +14 -13
  34. package/dist/{select-BwwF5Gki.cjs → select-DUeTm8ac.cjs} +11 -10
  35. package/dist/{textarea-BrW98O-a.js → textarea-BZL8Mkm0.js} +5 -4
  36. package/dist/{textarea-PHo1w92l.cjs → textarea-CPXsMFUq.cjs} +2 -1
  37. package/dist/{textinput-BrBGjHZc.js → textinput-DjPhmmkB.js} +3 -2
  38. package/dist/{textinput-CS0OHykQ.cjs → textinput-aNI5kibM.cjs} +2 -1
  39. package/package.json +3 -3
  40. package/src/components/checkbox/checkbox.ts +22 -1
  41. package/src/components/combobox/combobox.ts +2 -0
  42. package/src/components/datepicker/datepicker.ts +1 -0
  43. package/src/components/input-wrapper/input-wrapper.ts +14 -18
  44. package/src/components/radiobutton/radiobutton.ts +22 -1
  45. package/src/components/select/select.ts +1 -0
  46. package/src/components/textarea/textarea.ts +1 -0
  47. package/src/components/textinput/textinput.ts +1 -0
  48. package/dist/checkbox-CJ4tK9RC.cjs +0 -26
  49. package/dist/checkbox-cD_5LDzV.js +0 -101
  50. package/dist/input-wrapper-_Lk9HzHU.js +0 -190
  51. package/dist/radiobutton-0vVqu-GU.cjs +0 -27
  52. package/dist/radiobutton-BcFRJFvI.js +0 -92
@@ -1,190 +0,0 @@
1
- import { P as m, E as l, x as i, n as o, a as k } from "./element-CgEWt74-.js";
2
- import { P as w } from "./pkt-slot-controller-BPGj-LC5.js";
3
- import { e as f, n as b } from "./ref-BBYSqgeW.js";
4
- import { o as v } from "./if-defined-CmuO4Vz9.js";
5
- import { o as T } from "./icon-CC1js8eR.js";
6
- import { e as g } from "./class-map-BpTj9gtz.js";
7
- import { u as E } from "./stringutils-DJjRa8dG.js";
8
- import { s as p } from "./input-wrapper-8iKEzDRZ.js";
9
- import "./helptext-B7eI0iBQ.js";
10
- var _ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, e = (r, h, a, n) => {
11
- for (var s = n > 1 ? void 0 : n ? S(h, a) : h, d = r.length - 1, u; d >= 0; d--)
12
- (u = r[d]) && (s = (n ? u(h, a, s) : u(s)) || s);
13
- return n && s && _(h, a, s), s;
14
- };
15
- const D = {
16
- fromAttribute(r) {
17
- return r == null ? !1 : r === "" || r === "true" || r === !0 ? !0 : r === "false" || r === !1 ? !1 : !!r;
18
- },
19
- toAttribute(r) {
20
- return r ? "true" : "false";
21
- }
22
- };
23
- let t = class extends m {
24
- constructor() {
25
- super(), this.defaultSlot = f(), this.helptextSlot = f(), this.forId = E(), this.label = "", this.helptext = null, this.helptextDropdown = null, this.helptextDropdownButton = null, this.counter = p.props.counter.default, this.counterCurrent = 0, this.counterMaxLength = 0, this.counterError = null, this.counterPosition = "bottom", this.optionalTag = p.props.optionalTag.default, this.optionalText = p.props.optionalText.default, this.requiredTag = p.props.requiredTag.default, this.requiredText = p.props.requiredText.default, this.hasError = p.props.hasError.default, this.errorMessage = "", this.disabled = p.props.disabled.default, this.inline = p.props.inline.default, this.ariaDescribedby = void 0, this.hasFieldset = p.props.hasFieldset.default, this.role = "group", this.useWrapper = p.props.useWrapper.default, this.slotController = new w(this, this.defaultSlot, this.helptextSlot);
26
- }
27
- updated(r) {
28
- super.updated(r);
29
- }
30
- render() {
31
- const r = {
32
- "pkt-inputwrapper": !0,
33
- "pkt-inputwrapper--error": this.hasError,
34
- "pkt-inputwrapper--disabled": this.disabled,
35
- "pkt-inputwrapper--inline": this.inline
36
- }, h = {
37
- "pkt-tag": !0,
38
- "pkt-tag--small": !0,
39
- "pkt-tag--thin-text": !0,
40
- "pkt-tag--blue-light": this.optionalTag,
41
- "pkt-tag--beige": !this.optionalTag && this.requiredTag
42
- }, a = this.ariaDescribedby ? this.ariaDescribedby : this.helptext ? `${this.forId}-helptext` : l, n = () => this.optionalTag || this.requiredTag ? i`<span class=${g(h)}
43
- >${this.optionalTag ? this.optionalText : this.requiredTag ? this.requiredText : l}</span
44
- >` : l, s = () => this.useWrapper ? this.hasFieldset ? i`<legend
45
- class="pkt-inputwrapper__legend"
46
- id="${this.forId}-label"
47
- @click=${this.handleLabelClick}
48
- >
49
- ${this.label} ${n()}
50
- </legend>` : i`<label
51
- class="pkt-inputwrapper__label"
52
- for="${this.forId}"
53
- aria-describedby="${a}"
54
- id="${this.forId}-label"
55
- @click=${this.handleLabelClick}
56
- >${this.label}${n()}</label
57
- >` : i`<label
58
- for="${this.forId}"
59
- class="pkt-sr-only"
60
- aria-describedby="${a}"
61
- id="${this.forId}-label"
62
- >
63
- ${this.label}
64
- </label>`, d = () => i`
65
- <pkt-helptext
66
- class="${v(this.useWrapper ? void 0 : "pkt-hide")}"
67
- .forId=${this.forId}
68
- .helptext=${this.helptext}
69
- .helptextDropdown=${this.helptextDropdown}
70
- .helptextDropdownButton=${this.helptextDropdownButton || p.props.helptextDropdownButton.default}
71
- @toggleHelpText=${(x) => {
72
- this.toggleDropdown(x);
73
- }}
74
- ${b(this.helptextSlot)}
75
- name="helptext"
76
- ></pkt-helptext>
77
- `, u = () => this.counter ? i`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
78
- ${this.counterError ? this.counterError : l} ${this.counterCurrent || 0}
79
- ${this.counterMaxLength ? `/${this.counterMaxLength}` : l}
80
- </div>` : l, y = () => this.hasError && this.errorMessage ? i`<div
81
- role="alert"
82
- class="pkt-alert pkt-alert--error pkt-alert--compact"
83
- aria-live="assertive"
84
- aria-atomic="true"
85
- id="${this.forId}-error"
86
- >
87
- <pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
88
- <div class="pkt-alert__text">${T(this.errorMessage)}</div>
89
- </div>` : l, c = () => i`
90
- ${s()}
91
- ${d()}
92
- ${this.counterPosition === "top" ? u() : l}
93
- <div class="pkt-contents" ${b(this.defaultSlot)}></div>
94
- ${this.counterPosition === "bottom" ? u() : l}
95
- ${y()}
96
- `, $ = () => this.hasFieldset ? i`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${a}">
97
- ${c()}
98
- </fieldset>` : i`<div class="pkt-inputwrapper__fieldset">${c()}</div>`;
99
- return i`<div class=${g(r)}>${$()}</div> `;
100
- }
101
- toggleDropdown(r) {
102
- this.dispatchEvent(
103
- new CustomEvent("toggleHelpText", {
104
- bubbles: !1,
105
- detail: { isOpen: r.detail.isOpen }
106
- })
107
- );
108
- }
109
- handleLabelClick(r) {
110
- this.disabled && (r.preventDefault(), r.stopImmediatePropagation()), this.dispatchEvent(
111
- new CustomEvent("labelClick", {
112
- bubbles: !0,
113
- composed: !0,
114
- detail: "label clicked"
115
- })
116
- );
117
- }
118
- };
119
- e([
120
- o({ type: String })
121
- ], t.prototype, "forId", 2);
122
- e([
123
- o({ type: String })
124
- ], t.prototype, "label", 2);
125
- e([
126
- o({ type: String })
127
- ], t.prototype, "helptext", 2);
128
- e([
129
- o({ type: String })
130
- ], t.prototype, "helptextDropdown", 2);
131
- e([
132
- o({ type: String })
133
- ], t.prototype, "helptextDropdownButton", 2);
134
- e([
135
- o({ type: Boolean })
136
- ], t.prototype, "counter", 2);
137
- e([
138
- o({ type: Number })
139
- ], t.prototype, "counterCurrent", 2);
140
- e([
141
- o({ type: Number })
142
- ], t.prototype, "counterMaxLength", 2);
143
- e([
144
- o({ type: String })
145
- ], t.prototype, "counterError", 2);
146
- e([
147
- o({ type: String, reflect: !1 })
148
- ], t.prototype, "counterPosition", 2);
149
- e([
150
- o({ type: Boolean })
151
- ], t.prototype, "optionalTag", 2);
152
- e([
153
- o({ type: String })
154
- ], t.prototype, "optionalText", 2);
155
- e([
156
- o({ type: Boolean })
157
- ], t.prototype, "requiredTag", 2);
158
- e([
159
- o({ type: String })
160
- ], t.prototype, "requiredText", 2);
161
- e([
162
- o({ type: Boolean })
163
- ], t.prototype, "hasError", 2);
164
- e([
165
- o({ type: String })
166
- ], t.prototype, "errorMessage", 2);
167
- e([
168
- o({ type: Boolean })
169
- ], t.prototype, "disabled", 2);
170
- e([
171
- o({ type: Boolean })
172
- ], t.prototype, "inline", 2);
173
- e([
174
- o({ type: String })
175
- ], t.prototype, "ariaDescribedby", 2);
176
- e([
177
- o({ type: Boolean })
178
- ], t.prototype, "hasFieldset", 2);
179
- e([
180
- o({ type: String, reflect: !0 })
181
- ], t.prototype, "role", 2);
182
- e([
183
- o({ type: Boolean, reflect: !0, converter: D })
184
- ], t.prototype, "useWrapper", 2);
185
- t = e([
186
- k("pkt-input-wrapper")
187
- ], t);
188
- export {
189
- t as P
190
- };
@@ -1,27 +0,0 @@
1
- "use strict";const e=require("./element-6DBpyGQm.cjs"),p=require("./state-DPobt-Yz.cjs"),r=require("./input-element-CHjLWeKt.cjs"),o=require("./ref-iJtiv3o2.cjs"),u=require("./class-map-BBG2gMX4.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,s=(l,t,n,c)=>{for(var i=c>1?void 0:c?k(t,n):t,h=l.length-1,a;h>=0;h--)(a=l[h])&&(i=(c?a(t,n,i):a(i))||i);return c&&i&&d(t,n,i),i};exports.PktRadioButton=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,n,c){t==="defaultChecked"&&(this._checked=this.defaultChecked),t==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,n,c)}render(){const t=u.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=u.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),c=u.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),i=()=>e.x`
2
- <label class=${c} for=${this.id+"-internal"}>
3
- ${this.label}
4
- ${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
5
- </label>
6
- `;return e.x`
7
- <div class="pkt-input-check">
8
- <div class=${t}>
9
- <input
10
- id=${this.id+"-internal"}
11
- class=${n}
12
- type="radio"
13
- role="radio"
14
- ?disabled=${this.disabled}
15
- form=""
16
- name=${this.name+"-internal"}
17
- ${o.n(this.inputRef)}
18
- @change=${this.toggleChecked}
19
- @input=${this.onInput}
20
- @blur=${this.onBlur}
21
- @focus=${this.onFocus}
22
- ?checked=${this.checked}
23
- />
24
- ${i()}
25
- </div>
26
- </div>
27
- `}toggleChecked(t=null){t&&t.preventDefault(),t&&t.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(":checked"),this.valueChecked(this._checked))}};s([e.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"value",2);s([e.n({type:String})],exports.PktRadioButton.prototype,"checkHelptext",2);s([e.n({type:Boolean})],exports.PktRadioButton.prototype,"defaultChecked",2);s([e.n({type:Boolean})],exports.PktRadioButton.prototype,"hasTile",2);s([e.n({type:Boolean,reflect:!0})],exports.PktRadioButton.prototype,"checked",2);s([e.n({type:String,reflect:!0})],exports.PktRadioButton.prototype,"type",2);s([p.r()],exports.PktRadioButton.prototype,"_checked",2);exports.PktRadioButton=s([e.t("pkt-radiobutton")],exports.PktRadioButton);
@@ -1,92 +0,0 @@
1
- import { x as n, E as u, n as p, a as d } from "./element-CgEWt74-.js";
2
- import { r as k } from "./state-Bo2bck5_.js";
3
- import { P as f } from "./input-element-Cco4PA2M.js";
4
- import { e as _, n as b } from "./ref-BBYSqgeW.js";
5
- import { e as o } from "./class-map-BpTj9gtz.js";
6
- var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, c = (e, i, s, l) => {
7
- for (var h = l > 1 ? void 0 : l ? v(i, s) : i, r = e.length - 1, a; r >= 0; r--)
8
- (a = e[r]) && (h = (l ? a(i, s, h) : a(h)) || h);
9
- return l && h && $(i, s, h), h;
10
- };
11
- let t = class extends f {
12
- constructor() {
13
- super(...arguments), this.inputRef = _(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = null, this.type = "radio", this._checked = !1;
14
- }
15
- connectedCallback() {
16
- super.connectedCallback();
17
- }
18
- attributeChangedCallback(e, i, s) {
19
- e === "defaultChecked" && (this._checked = this.defaultChecked), e === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(e, i, s);
20
- }
21
- render() {
22
- const e = o({
23
- "pkt-input-check__input": !0,
24
- "pkt-input-check__input--tile": this.hasTile,
25
- "pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
26
- }), i = o({
27
- "pkt-input-check__input-checkbox": !0,
28
- "pkt-input-check__input-checkbox--error": this.hasError
29
- }), s = o({
30
- "pkt-input-check__input-label": !0,
31
- "pkt-input-check__input-label--disabled": this.disabled,
32
- "pkt-sr-only": this.hideLabel
33
- }), l = () => n`
34
- <label class=${s} for=${this.id + "-internal"}>
35
- ${this.label}
36
- ${this.checkHelptext ? n`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : u}
37
- </label>
38
- `;
39
- return n`
40
- <div class="pkt-input-check">
41
- <div class=${e}>
42
- <input
43
- id=${this.id + "-internal"}
44
- class=${i}
45
- type="radio"
46
- role="radio"
47
- ?disabled=${this.disabled}
48
- form=""
49
- name=${this.name + "-internal"}
50
- ${b(this.inputRef)}
51
- @change=${this.toggleChecked}
52
- @input=${this.onInput}
53
- @blur=${this.onBlur}
54
- @focus=${this.onFocus}
55
- ?checked=${this.checked}
56
- />
57
- ${l()}
58
- </div>
59
- </div>
60
- `;
61
- }
62
- toggleChecked(e = null) {
63
- e && e.preventDefault(), e && e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
64
- }
65
- };
66
- c([
67
- p({ type: String, reflect: !0 })
68
- ], t.prototype, "value", 2);
69
- c([
70
- p({ type: String })
71
- ], t.prototype, "checkHelptext", 2);
72
- c([
73
- p({ type: Boolean })
74
- ], t.prototype, "defaultChecked", 2);
75
- c([
76
- p({ type: Boolean })
77
- ], t.prototype, "hasTile", 2);
78
- c([
79
- p({ type: Boolean, reflect: !0 })
80
- ], t.prototype, "checked", 2);
81
- c([
82
- p({ type: String, reflect: !0 })
83
- ], t.prototype, "type", 2);
84
- c([
85
- k()
86
- ], t.prototype, "_checked", 2);
87
- t = c([
88
- d("pkt-radiobutton")
89
- ], t);
90
- export {
91
- t as P
92
- };