@oslokommune/punkt-elements 19.9.0 → 19.10.0

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 CHANGED
@@ -5,6 +5,14 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [19.10.0](https://github.com/oslokommune/punkt/compare/19.9.1...19.10.0) (2026-10-07)
9
+
10
+ ### Features
11
+ * migrate radioButton (#3698).
12
+
13
+ ---
14
+
15
+
8
16
  ## [19.9.0](https://github.com/oslokommune/punkt/compare/19.8.0...19.9.0) (2026-10-05)
9
17
 
10
18
  ### Features
@@ -26,6 +26,7 @@ export { PktMessagebox } from './messagebox';
26
26
  export { PktModal } from './modal';
27
27
  export { PktProgressbar } from './progressbar';
28
28
  export { PktRadioButton } from './radiobutton';
29
+ export type { IPktRadioButton } from './radiobutton';
29
30
  export { PktRadioGroup } from './radio-group';
30
31
  export { PktRadioButton as PktRadiobutton } from './radiobutton';
31
32
  export { PktTag } from './tag';
@@ -1,3 +1,4 @@
1
1
  import { PktRadioButton } from './radiobutton';
2
2
  export { PktRadioButton };
3
+ export type { IPktRadioButton } from './radiobutton';
3
4
  export default PktRadioButton;
@@ -1,9 +1,14 @@
1
1
  import { PktInputElement } from '../../base-elements/input-element';
2
2
  import { Ref } from 'lit/directives/ref.js';
3
3
  import { ElementProps } from '../../types/typeUtils';
4
- import { TPktInputSize } from '../../shared-types';
4
+ import { IPktRadioButtonBase, TPktInputSize } from '../../shared-types';
5
5
  type Props = ElementProps<PktRadioButton, 'checkHelptext' | 'defaultChecked' | 'hasTile' | 'tagText' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText'>;
6
- export declare class PktRadioButton extends PktInputElement<Props> {
6
+ export interface IPktRadioButton extends Omit<IPktRadioButtonBase, 'form' | 'label' | 'checkHelptext' | 'checked'> {
7
+ label?: string | null;
8
+ checkHelptext?: string | null;
9
+ checked?: boolean | string | null;
10
+ }
11
+ export declare class PktRadioButton extends PktInputElement<Props> implements IPktRadioButton {
7
12
  inputRef: Ref<HTMLInputElement>;
8
13
  value: string;
9
14
  checkHelptext: string | null;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DimzcQxt.cjs"),n=require("./alert-QfloIr-o.cjs"),r=require("./header-Drj3lTrv.cjs"),i=require("./card--NuWdTbG.cjs"),a=require("./checkbox-QIcdn09A.cjs"),o=require("./icon-jPhyZD1z.cjs"),s=require("./messagebox-C19L2Duq.cjs"),c=require("./calendar-C5QwPrbk.cjs"),l=require("./combobox-ClXhKwR9.cjs"),u=require("./button-Dh97H-58.cjs"),d=require("./accordion-CMCCpxtz.cjs"),f=require("./backlink-CsFeerTH.cjs"),p=require("./breadcrumbs-D03id_ha.cjs"),m=require("./tag-DyVZrqOQ.cjs"),h=require("./input-wrapper-BT6B3Kco.cjs"),g=require("./helptext-C7cyihnu.cjs"),_=require("./checkbox-group-nLazAkcg.cjs"),v=require("./fileupload-2uTFjd81.cjs"),y=require("./modal-CoEPzt4p.cjs"),b=require("./progressbar-CnX4fFfR.cjs"),x=require("./datepicker-usIF9WY7.cjs"),S=require("./footer-CyxRYvT-.cjs"),C=require("./link-CEP7w1et.cjs"),w=require("./textinput-CQknclmV.cjs"),T=require("./searchinput-Mdc9Ihld.cjs"),E=require("./header-menu-B_5hCNUl.cjs"),D=require("./heading-DUYOvlxs.cjs"),O=require("./linkcard-D8vitdrQ.cjs"),k=require("./loader-B0hFoBtF.cjs"),A=require("./radiobutton-BgHCcDJv.cjs"),j=require("./radio-group-kOzlGn8T.cjs"),M=require("./tabs-Dm8xcPRs.cjs"),N=require("./textarea-DoH3Il8v.cjs"),P=require("./select-BowvpCNa.cjs"),F=require("./timepicker-DB3gor6g.cjs");exports.PktAccordion=d.r,exports.PktAccordionItem=d.n,exports.PktAlert=n.n,exports.PktBackLink=f.n,exports.PktBreadcrumbs=p.t,exports.PktButton=u.n,exports.PktCalendar=c.n,exports.PktCard=i.n,exports.PktCheckbox=a.n,exports.PktCheckboxGroup=_.n,exports.PktCombobox=l.n,exports.PktConsent=t.n,exports.PktDateTags=x.a,exports.PktDatepicker=x.t,Object.defineProperty(exports,"PktFileUpload",{enumerable:!0,get:function(){return v.n}}),exports.PktFooter=S.n,exports.PktFooterSimple=S.t,exports.PktHeader=r.t,exports.PktHeaderGlobal=r.n,exports.PktHeaderMenu=E.n,exports.PktHeaderService=r.r,exports.PktHeaderUserMenu=r.i,exports.PktHeading=D.n,exports.PktHelptext=g.n,exports.PktIcon=o.n,exports.PktInputWrapper=h.n,exports.PktLink=C.n,exports.PktLinkCard=O.n,exports.PktLoader=k.n,exports.PktMessagebox=s.n,exports.PktModal=y.n,exports.PktProgressbar=b.n,exports.PktRadioButton=A.n,exports.PktRadiobutton=A.n,exports.PktRadioGroup=j.n,exports.PktSearchInput=T.n,exports.PktSelect=P.n,exports.PktTabItem=M.n,exports.PktTabs=M.r,exports.PktTag=m.n,exports.PktTextarea=N.n,exports.PktTextinput=w.n,exports.PktTimepicker=F.t,exports.getPktStrings=e.r,exports.pktStringsNb=e.s,exports.resetPktStrings=e.i,exports.setPktStrings=e.a,exports.subscribePktStrings=e.o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DimzcQxt.cjs"),n=require("./alert-QfloIr-o.cjs"),r=require("./header-Drj3lTrv.cjs"),i=require("./card--NuWdTbG.cjs"),a=require("./checkbox-QIcdn09A.cjs"),o=require("./radiobutton-_089zFBB.cjs"),s=require("./icon-jPhyZD1z.cjs"),c=require("./messagebox-C19L2Duq.cjs"),l=require("./calendar-C5QwPrbk.cjs"),u=require("./combobox-ClXhKwR9.cjs"),d=require("./button-Dh97H-58.cjs"),f=require("./accordion-CMCCpxtz.cjs"),p=require("./backlink-CsFeerTH.cjs"),m=require("./breadcrumbs-D03id_ha.cjs"),h=require("./tag-DyVZrqOQ.cjs"),g=require("./input-wrapper-BT6B3Kco.cjs"),_=require("./helptext-C7cyihnu.cjs"),v=require("./checkbox-group-nLazAkcg.cjs"),y=require("./fileupload-2uTFjd81.cjs"),b=require("./modal-CoEPzt4p.cjs"),x=require("./progressbar-CnX4fFfR.cjs"),S=require("./datepicker-usIF9WY7.cjs"),C=require("./footer-CyxRYvT-.cjs"),w=require("./link-CEP7w1et.cjs"),T=require("./textinput-CQknclmV.cjs"),E=require("./searchinput-Mdc9Ihld.cjs"),D=require("./header-menu-B_5hCNUl.cjs"),O=require("./heading-DUYOvlxs.cjs"),k=require("./linkcard-D8vitdrQ.cjs"),A=require("./loader-B0hFoBtF.cjs"),j=require("./radio-group-C-8C0-Py.cjs"),M=require("./tabs-Dm8xcPRs.cjs"),N=require("./textarea-DoH3Il8v.cjs"),P=require("./select-BowvpCNa.cjs"),F=require("./timepicker-DB3gor6g.cjs");exports.PktAccordion=f.r,exports.PktAccordionItem=f.n,exports.PktAlert=n.n,exports.PktBackLink=p.n,exports.PktBreadcrumbs=m.t,exports.PktButton=d.n,exports.PktCalendar=l.n,exports.PktCard=i.n,exports.PktCheckbox=a.n,exports.PktCheckboxGroup=v.n,exports.PktCombobox=u.n,exports.PktConsent=t.n,exports.PktDateTags=S.a,exports.PktDatepicker=S.t,Object.defineProperty(exports,"PktFileUpload",{enumerable:!0,get:function(){return y.n}}),exports.PktFooter=C.n,exports.PktFooterSimple=C.t,exports.PktHeader=r.t,exports.PktHeaderGlobal=r.n,exports.PktHeaderMenu=D.n,exports.PktHeaderService=r.r,exports.PktHeaderUserMenu=r.i,exports.PktHeading=O.n,exports.PktHelptext=_.n,exports.PktIcon=s.n,exports.PktInputWrapper=g.n,exports.PktLink=w.n,exports.PktLinkCard=k.n,exports.PktLoader=A.n,exports.PktMessagebox=c.n,exports.PktModal=b.n,exports.PktProgressbar=x.n,exports.PktRadioButton=o.n,exports.PktRadiobutton=o.n,exports.PktRadioGroup=j.n,exports.PktSearchInput=E.n,exports.PktSelect=P.n,exports.PktTabItem=M.n,exports.PktTabs=M.r,exports.PktTag=h.n,exports.PktTextarea=N.n,exports.PktTextinput=T.n,exports.PktTimepicker=F.t,exports.getPktStrings=e.r,exports.pktStringsNb=e.s,exports.resetPktStrings=e.i,exports.setPktStrings=e.a,exports.subscribePktStrings=e.o;
package/dist/pkt-index.js CHANGED
@@ -4,34 +4,34 @@ import { n as o } from "./alert-CAPiwi4F.js";
4
4
  import { i as s, n as c, r as l, t as u } from "./header-BKeSkfB7.js";
5
5
  import { n as d } from "./card-_PlgXmgZ.js";
6
6
  import { n as f } from "./checkbox-G8k3vg85.js";
7
- import { n as p } from "./icon-Bao96Zb8.js";
8
- import { n as m } from "./messagebox-6_iNN5F3.js";
9
- import { n as h } from "./calendar-D9w8M99G.js";
10
- import { n as g } from "./combobox-Cz_rq7Mm.js";
11
- import { n as _ } from "./button-CeRr7oIn.js";
12
- import { n as v, r as y } from "./accordion-Cp2o6wTY.js";
13
- import { n as b } from "./backlink-ogvv493Y.js";
14
- import { t as x } from "./breadcrumbs-53QVnTFP.js";
15
- import { n as S } from "./tag-C33BPIOm.js";
16
- import { n as C } from "./input-wrapper-DrSCuw6U.js";
17
- import { n as w } from "./helptext-DadLkcoO.js";
18
- import { n as T } from "./checkbox-group-DoueGGi5.js";
19
- import { n as E } from "./fileupload-BR9H6fET.js";
20
- import { n as D } from "./modal-D7MolBXb.js";
21
- import { n as O } from "./progressbar-DZHiq7B0.js";
22
- import { a as k, t as A } from "./datepicker-C7ABsx7H.js";
23
- import { n as j, t as M } from "./footer-B3DMvo8-.js";
24
- import { n as N } from "./link-CVnIn74-.js";
25
- import { n as P } from "./textinput-B6G4dVuL.js";
26
- import { n as F } from "./searchinput-Bkcr3Fby.js";
27
- import { n as I } from "./header-menu-buYE90FU.js";
28
- import { n as L } from "./heading-WBB5MO9i.js";
29
- import { n as R } from "./linkcard-IWiVvRKy.js";
30
- import { n as z } from "./loader-CAsUPHjl.js";
31
- import { n as B } from "./radiobutton-CFd8TgV9.js";
32
- import { n as V } from "./radio-group-lhymYEZX.js";
7
+ import { n as p } from "./radiobutton-bkTAD5PV.js";
8
+ import { n as m } from "./icon-Bao96Zb8.js";
9
+ import { n as h } from "./messagebox-6_iNN5F3.js";
10
+ import { n as g } from "./calendar-D9w8M99G.js";
11
+ import { n as _ } from "./combobox-Cz_rq7Mm.js";
12
+ import { n as v } from "./button-CeRr7oIn.js";
13
+ import { n as y, r as b } from "./accordion-Cp2o6wTY.js";
14
+ import { n as x } from "./backlink-ogvv493Y.js";
15
+ import { t as S } from "./breadcrumbs-53QVnTFP.js";
16
+ import { n as C } from "./tag-C33BPIOm.js";
17
+ import { n as w } from "./input-wrapper-DrSCuw6U.js";
18
+ import { n as T } from "./helptext-DadLkcoO.js";
19
+ import { n as E } from "./checkbox-group-DoueGGi5.js";
20
+ import { n as D } from "./fileupload-BR9H6fET.js";
21
+ import { n as O } from "./modal-D7MolBXb.js";
22
+ import { n as k } from "./progressbar-DZHiq7B0.js";
23
+ import { a as A, t as j } from "./datepicker-C7ABsx7H.js";
24
+ import { n as M, t as N } from "./footer-B3DMvo8-.js";
25
+ import { n as P } from "./link-CVnIn74-.js";
26
+ import { n as F } from "./textinput-B6G4dVuL.js";
27
+ import { n as I } from "./searchinput-Bkcr3Fby.js";
28
+ import { n as L } from "./header-menu-buYE90FU.js";
29
+ import { n as R } from "./heading-WBB5MO9i.js";
30
+ import { n as z } from "./linkcard-IWiVvRKy.js";
31
+ import { n as B } from "./loader-CAsUPHjl.js";
32
+ import { n as V } from "./radio-group-BzV_JhgJ.js";
33
33
  import { n as H, r as U } from "./tabs-DZvtVA0y.js";
34
34
  import { n as W } from "./textarea-hW0kV5gj.js";
35
35
  import { n as G } from "./select-B6CN2Ymq.js";
36
36
  import { t as K } from "./timepicker-Cd2QI6ua.js";
37
- export { y as PktAccordion, v as PktAccordionItem, o as PktAlert, b as PktBackLink, x as PktBreadcrumbs, _ as PktButton, h as PktCalendar, d as PktCard, f as PktCheckbox, T as PktCheckboxGroup, g as PktCombobox, a as PktConsent, k as PktDateTags, A as PktDatepicker, E as PktFileUpload, j as PktFooter, M as PktFooterSimple, u as PktHeader, c as PktHeaderGlobal, I as PktHeaderMenu, l as PktHeaderService, s as PktHeaderUserMenu, L as PktHeading, w as PktHelptext, p as PktIcon, C as PktInputWrapper, N as PktLink, R as PktLinkCard, z as PktLoader, m as PktMessagebox, D as PktModal, O as PktProgressbar, B as PktRadioButton, B as PktRadiobutton, V as PktRadioGroup, F as PktSearchInput, G as PktSelect, H as PktTabItem, U as PktTabs, S as PktTag, W as PktTextarea, P as PktTextinput, K as PktTimepicker, r as getPktStrings, i as pktStringsNb, t as resetPktStrings, e as setPktStrings, n as subscribePktStrings };
37
+ export { b as PktAccordion, y as PktAccordionItem, o as PktAlert, x as PktBackLink, S as PktBreadcrumbs, v as PktButton, g as PktCalendar, d as PktCard, f as PktCheckbox, E as PktCheckboxGroup, _ as PktCombobox, a as PktConsent, A as PktDateTags, j as PktDatepicker, D as PktFileUpload, M as PktFooter, N as PktFooterSimple, u as PktHeader, c as PktHeaderGlobal, L as PktHeaderMenu, l as PktHeaderService, s as PktHeaderUserMenu, R as PktHeading, T as PktHelptext, m as PktIcon, w as PktInputWrapper, P as PktLink, z as PktLinkCard, B as PktLoader, h as PktMessagebox, O as PktModal, k as PktProgressbar, p as PktRadioButton, p as PktRadiobutton, V as PktRadioGroup, I as PktSearchInput, G as PktSelect, H as PktTabItem, U as PktTabs, C as PktTag, W as PktTextarea, F as PktTextinput, K as PktTimepicker, r as getPktStrings, i as pktStringsNb, t as resetPktStrings, e as setPktStrings, n as subscribePktStrings };
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radio-group-kOzlGn8T.cjs");exports.PktRadioGroup=e.n,exports.default=e.t;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radio-group-C-8C0-Py.cjs");exports.PktRadioGroup=e.n,exports.default=e.t;
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./radio-group-lhymYEZX.js";
1
+ import { n as e, t } from "./radio-group-BzV_JhgJ.js";
2
2
  export { e as PktRadioGroup, t as default };
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radiobutton-BgHCcDJv.cjs");exports.PktRadioButton=e.n,exports.default=e.t;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./radiobutton-_089zFBB.cjs");exports.PktRadioButton=e.n,exports.default=e.t;
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./radiobutton-CFd8TgV9.js";
1
+ import { n as e, t } from "./radiobutton-bkTAD5PV.js";
2
2
  export { e as PktRadioButton, t as default };
@@ -1,9 +1,9 @@
1
1
  import { d as e, l as t, n, u as r } from "./element-DBugHPKM.js";
2
- import { i, n as a, t as o } from "./option-group-element-BIuotbRu.js";
3
- import { t as s } from "./provide-_MnlMGnw.js";
4
- import { r as c } from "./radiobutton-CFd8TgV9.js";
2
+ import { r as i } from "./radiobutton-bkTAD5PV.js";
3
+ import { i as a, n as o, t as s } from "./option-group-element-BIuotbRu.js";
4
+ import { t as c } from "./provide-_MnlMGnw.js";
5
5
  //#region src/components/radio-group/radio-group.ts
6
- var l = class extends o {
6
+ var l = class extends s {
7
7
  constructor(...e) {
8
8
  super(...e), this.optionSelector = "pkt-radiobutton", this.groupContext = {
9
9
  name: "",
@@ -13,8 +13,8 @@ var l = class extends o {
13
13
  }, this.storedValue = null;
14
14
  }
15
15
  get value() {
16
- let e = this.options().find(a);
17
- return e ? i(e) : "";
16
+ let e = this.options().find(o);
17
+ return e ? a(e) : "";
18
18
  }
19
19
  set value(e) {
20
20
  let t = this.value;
@@ -28,8 +28,8 @@ var l = class extends o {
28
28
  }
29
29
  applyStoredValue(e) {
30
30
  e.forEach((e) => {
31
- let t = this.storedValue !== "" && i(e) === this.storedValue;
32
- a(e) !== t && (e.checked = t);
31
+ let t = this.storedValue !== "" && a(e) === this.storedValue;
32
+ o(e) !== t && (e.checked = t);
33
33
  });
34
34
  }
35
35
  createGroupContext() {
@@ -39,7 +39,7 @@ var l = class extends o {
39
39
  };
40
40
  }
41
41
  };
42
- n([s({ context: c }), t()], l.prototype, "groupContext", void 0), n([r({ type: String })], l.prototype, "value", null);
42
+ n([c({ context: i }), t()], l.prototype, "groupContext", void 0), n([r({ type: String })], l.prototype, "value", null);
43
43
  try {
44
44
  e("pkt-radio-group")(l);
45
45
  } catch {
@@ -1 +1 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./option-group-element-BYS7s-is.cjs"),n=require("./provide-Cz18sYug.cjs"),r=require("./radiobutton-BgHCcDJv.cjs");var i=class extends t.t{constructor(...e){super(...e),this.optionSelector=`pkt-radiobutton`,this.groupContext={name:``,hasTile:!1,hasError:!1,required:!1},this.storedValue=null}get value(){let e=this.options().find(t.n);return e?t.i(e):``}set value(e){let t=this.value;this.storedValue=e??``,this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let n=this.storedValue!==``&&t.i(e)===this.storedValue;t.n(e)!==n&&(e.checked=n)})}createGroupContext(){return{...super.createGroupContext(),required:this.required}}};e.n([n.t({context:r.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-radio-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-radio-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./radiobutton-_089zFBB.cjs"),n=require("./option-group-element-BYS7s-is.cjs"),r=require("./provide-Cz18sYug.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-radiobutton`,this.groupContext={name:``,hasTile:!1,hasError:!1,required:!1},this.storedValue=null}get value(){let e=this.options().find(n.n);return e?n.i(e):``}set value(e){let t=this.value;this.storedValue=e??``,this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=this.storedValue!==``&&n.i(e)===this.storedValue;n.n(e)!==t&&(e.checked=t)})}createGroupContext(){return{...super.createGroupContext(),required:this.required}}};e.n([r.t({context:t.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-radio-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-radio-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -0,0 +1,38 @@
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-C4SelHLD.cjs");var a={defaultChecked:!1,hasTile:!1,disabled:!1,hasError:!1,requiredTag:!1,optionalTag:!1},o=n.n(Symbol(`pkt-radio-group-context`)),s=class extends i.t{constructor(...e){super(...e),this.inputRef=r.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=a.defaultChecked,this.hasTile=a.hasTile,this.checked=null,this.type=`radio`,this.inputSize=void 0,this.tagText=null,this.optionalTag=a.optionalTag,this.requiredTag=a.requiredTag,this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let n=this.hasTile||!!this.groupContext?.hasTile,i=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":n,"pkt-input-check__input--tile-disabled":this.isDisabled&&n}),a=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError||!!this.groupContext?.hasError}),o=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-sr-only":this.hideLabel}),s=`pkt-tag pkt-tag--small pkt-tag--thin-text`,c=this.pktStrings.get(`forms`),l=()=>e._`
2
+ ${this.tagText?e._`<span class=${s+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
3
+ ${this.optionalTag?e._`<span class=${s+` pkt-tag--blue-light`}
4
+ >${this.optionalText??c.optional}</span
5
+ >`:e.h}
6
+ ${this.requiredTag?e._`<span class=${s+` pkt-tag--beige`}
7
+ >${this.requiredText??c.required}</span
8
+ >`:e.h}
9
+ `,u=this.id+`-check-label`,d=this.id+`-check-helptext`;return e._`
10
+ <div class="pkt-input-check${this.inputSize?` pkt-input-check--${this.inputSize}`:``}">
11
+ <div class=${i}>
12
+ <input
13
+ id=${this.id+`-internal`}
14
+ class=${a}
15
+ type="radio"
16
+ ?disabled=${this.isDisabled}
17
+ form=""
18
+ name=${this.internalName}
19
+ ${r.n(this.inputRef)}
20
+ @change=${this.toggleChecked}
21
+ @input=${this.handleInput}
22
+ @blur=${this.onBlur}
23
+ @focus=${this.onFocus}
24
+ ?checked=${this.checked}
25
+ aria-labelledby=${this.label?u:e.h}
26
+ aria-describedby=${this.checkHelptext?d:e.h}
27
+ />
28
+ ${e._`
29
+ <label class=${o} for=${this.id+`-internal`}>
30
+ <span id=${u}>${this.label} ${l()}</span>
31
+ ${this.checkHelptext?e._`<div id=${d} class="pkt-input-check__input-helptext">
32
+ ${this.checkHelptext}
33
+ </div>`:e.h}
34
+ </label>
35
+ `}
36
+ </div>
37
+ </div>
38
+ `}handleInput(e){e.stopImmediatePropagation()}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this._checked))}};e.n([e.u({type:String,reflect:!0})],s.prototype,`value`,void 0),e.n([e.u({type:String})],s.prototype,`checkHelptext`,void 0),e.n([e.u({type:Boolean})],s.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],s.prototype,`hasTile`,void 0),e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`checked`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`type`,void 0),e.n([e.u({type:String,attribute:`input-size`})],s.prototype,`inputSize`,void 0),e.n([e.u({type:String})],s.prototype,`tagText`,void 0),e.n([e.u({type:Boolean})],s.prototype,`optionalTag`,void 0),e.n([e.u({type:String})],s.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean})],s.prototype,`requiredTag`,void 0),e.n([e.u({type:String})],s.prototype,`requiredText`,void 0),e.n([e.l()],s.prototype,`_checked`,void 0),e.n([n.t({context:o,subscribe:!0}),e.l()],s.prototype,`groupContext`,void 0);try{e.d(`pkt-radiobutton`)(s)}catch{console.warn(`Forsøker å definere <pkt-radiobutton>, men den er allerede definert`)}var c=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -3,10 +3,17 @@ import { t as o } from "./class-map-Bf-QzUpN.js";
3
3
  import { n as s, t as c } from "./consume-Bp12si68.js";
4
4
  import { n as l, t as u } from "./ref-y_5qv9vU.js";
5
5
  import { t as d } from "./input-element-BBygBEei.js";
6
- //#region src/components/radio-group/radio-group-context.ts
7
- var f = s(Symbol("pkt-radio-group-context")), p = class extends d {
6
+ //#region ../../shared-types/radiobutton.ts
7
+ var f = {
8
+ defaultChecked: !1,
9
+ hasTile: !1,
10
+ disabled: !1,
11
+ hasError: !1,
12
+ requiredTag: !1,
13
+ optionalTag: !1
14
+ }, p = s(Symbol("pkt-radio-group-context")), m = class extends d {
8
15
  constructor(...e) {
9
- super(...e), this.inputRef = u(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = null, this.type = "radio", this.inputSize = void 0, this.tagText = null, this.optionalTag = !1, this.requiredTag = !1, this._checked = !1;
16
+ super(...e), this.inputRef = u(), this.value = "", this.checkHelptext = null, this.defaultChecked = f.defaultChecked, this.hasTile = f.hasTile, this.checked = null, this.type = "radio", this.inputSize = void 0, this.tagText = null, this.optionalTag = f.optionalTag, this.requiredTag = f.requiredTag, this._checked = !1;
10
17
  }
11
18
  connectedCallback() {
12
19
  super.connectedCallback();
@@ -76,26 +83,26 @@ var f = s(Symbol("pkt-radio-group-context")), p = class extends d {
76
83
  i([a({
77
84
  type: String,
78
85
  reflect: !0
79
- })], p.prototype, "value", void 0), i([a({ type: String })], p.prototype, "checkHelptext", void 0), i([a({ type: Boolean })], p.prototype, "defaultChecked", void 0), i([a({ type: Boolean })], p.prototype, "hasTile", void 0), i([a({
86
+ })], m.prototype, "value", void 0), i([a({ type: String })], m.prototype, "checkHelptext", void 0), i([a({ type: Boolean })], m.prototype, "defaultChecked", void 0), i([a({ type: Boolean })], m.prototype, "hasTile", void 0), i([a({
80
87
  type: Boolean,
81
88
  reflect: !0
82
- })], p.prototype, "checked", void 0), i([a({
89
+ })], m.prototype, "checked", void 0), i([a({
83
90
  type: String,
84
91
  reflect: !0
85
- })], p.prototype, "type", void 0), i([a({
92
+ })], m.prototype, "type", void 0), i([a({
86
93
  type: String,
87
94
  attribute: "input-size"
88
- })], p.prototype, "inputSize", void 0), i([a({ type: String })], p.prototype, "tagText", void 0), i([a({ type: Boolean })], p.prototype, "optionalTag", void 0), i([a({ type: String })], p.prototype, "optionalText", void 0), i([a({ type: Boolean })], p.prototype, "requiredTag", void 0), i([a({ type: String })], p.prototype, "requiredText", void 0), i([r()], p.prototype, "_checked", void 0), i([c({
89
- context: f,
95
+ })], m.prototype, "inputSize", void 0), i([a({ type: String })], m.prototype, "tagText", void 0), i([a({ type: Boolean })], m.prototype, "optionalTag", void 0), i([a({ type: String })], m.prototype, "optionalText", void 0), i([a({ type: Boolean })], m.prototype, "requiredTag", void 0), i([a({ type: String })], m.prototype, "requiredText", void 0), i([r()], m.prototype, "_checked", void 0), i([c({
96
+ context: p,
90
97
  subscribe: !0
91
- }), r()], p.prototype, "groupContext", void 0);
98
+ }), r()], m.prototype, "groupContext", void 0);
92
99
  try {
93
- t("pkt-radiobutton")(p);
100
+ t("pkt-radiobutton")(m);
94
101
  } catch {
95
102
  console.warn("Forsøker å definere <pkt-radiobutton>, men den er allerede definert");
96
103
  }
97
104
  //#endregion
98
105
  //#region src/components/radiobutton/index.ts
99
- var m = p;
106
+ var h = m;
100
107
  //#endregion
101
- export { p as n, f as r, m as t };
108
+ export { m as n, p as r, h as t };
@@ -13,6 +13,8 @@ export { CARD_SKINS, CARD_PADDINGS, CARD_IMAGE_SHAPES, CARD_IMAGE_ASPECTS, CARD_
13
13
  export type { TCardSkin, TCardPadding, TCardImageShape, TCardImageAspect, TCardTagPosition, ICardTag, ICardImage, IPktCardBase, ICardSpecProps, } from './card';
14
14
  export { CHECKBOX_LABEL_POSITIONS, CHECKBOX_DEFAULTS } from './checkbox';
15
15
  export type { TCheckboxLabelPosition, IPktCheckboxBase, ICheckboxSpecProps } from './checkbox';
16
+ export { RADIOBUTTON_DEFAULTS } from './radiobutton';
17
+ export type { IPktRadioButtonBase, IRadioButtonSpecProps } from './radiobutton';
16
18
  export { OPTION_GROUP_DEFAULTS } from './option-group';
17
19
  export type { IPktOptionGroupBase, IPktRadioGroupBase, IPktCheckboxGroupBase, IRadioGroupSpecProps, ICheckboxGroupSpecProps, } from './option-group';
18
20
  export { CONSENT_TRIGGER_TYPES, CONSENT_TRIGGER_TYPE_OPTIONS, CONSENT_DEFAULTS } from './consent';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * radiobutton.ts
3
+ *
4
+ * Type definitions for pkt-radiobutton.
5
+ * Used by React, Elements, and typed component specs.
6
+ */
7
+ import type { IPktStringsProps } from '../shared-strings';
8
+ import type { IFormFieldErrorProps, IFormFieldLabelProps, ITagOptionalRequiredProps } from './form-field';
9
+ import type { TPktInputSize } from './size';
10
+ /**
11
+ * Radio button props shared by React and Elements.
12
+ *
13
+ * @remarks React requires `id`, `name` and `label`, and widens `checkHelptext` to `ReactNode`.
14
+ * Elements widens `label` and `checkHelptext` to `| null` (Lit uses `null` for an unset
15
+ * attribute), accepts booleanish strings for `checked`, and omits `form`, which is a getter
16
+ * returning the associated `HTMLFormElement`, not the form id.
17
+ */
18
+ export interface IPktRadioButtonBase extends IFormFieldLabelProps, Pick<IFormFieldErrorProps, 'disabled' | 'hasError'>, ITagOptionalRequiredProps, IPktStringsProps<'forms'> {
19
+ id?: string;
20
+ name?: string;
21
+ form?: string;
22
+ value?: string;
23
+ checkHelptext?: string;
24
+ defaultChecked?: boolean;
25
+ checked?: boolean;
26
+ hasTile?: boolean;
27
+ inputSize?: TPktInputSize;
28
+ }
29
+ /**
30
+ * Documented RadioButton props (subset of `IPktRadioButtonBase`).
31
+ * Used for typed component specs in documentation.
32
+ */
33
+ export type IRadioButtonSpecProps = Pick<IPktRadioButtonBase, 'id' | 'name' | 'form' | 'label' | 'checked' | 'defaultChecked' | 'hasTile' | 'inputSize' | 'disabled' | 'checkHelptext' | 'value' | 'hasError' | 'requiredTag' | 'requiredText' | 'optionalTag' | 'optionalText' | 'tagText'>;
34
+ /**
35
+ * Default values for pkt-radiobutton. Single source of truth for both frameworks.
36
+ * `checked` is intentionally absent — React must keep it `undefined` to stay uncontrolled.
37
+ * `inputSize` is intentionally absent — unset inherits the size from the surrounding input-wrapper.
38
+ */
39
+ export declare const RADIOBUTTON_DEFAULTS: {
40
+ readonly defaultChecked: false;
41
+ readonly hasTile: false;
42
+ readonly disabled: false;
43
+ readonly hasError: false;
44
+ readonly requiredTag: false;
45
+ readonly optionalTag: false;
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "19.9.0",
3
+ "version": "19.10.0",
4
4
  "description": "Komponentbiblioteket til Punkt, designsystem for Oslo kommune",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo kommune",
@@ -84,5 +84,5 @@
84
84
  "engines": {
85
85
  "node": "^22.19.0 || ^24.0.0 || ^26.0.0"
86
86
  },
87
- "gitHead": "05ac805ebef2f57e49cb492cd78370264b0fe496"
87
+ "gitHead": "e7b45bcbcce849fbbb59cc06934a1cb57ae7473a"
88
88
  }
@@ -32,6 +32,7 @@ export { PktMessagebox } from '@/components/messagebox'
32
32
  export { PktModal } from '@/components/modal'
33
33
  export { PktProgressbar } from '@/components/progressbar'
34
34
  export { PktRadioButton } from '@/components/radiobutton'
35
+ export type { IPktRadioButton } from '@/components/radiobutton'
35
36
  export { PktRadioGroup } from '@/components/radio-group'
36
37
  // TODO: Avklar om RadioButton kan eksporteres som *kun* PktRadiobutton
37
38
  export { PktRadioButton as PktRadiobutton } from '@/components/radiobutton'
@@ -1,4 +1,5 @@
1
1
  import { PktRadioButton } from './radiobutton'
2
2
 
3
3
  export { PktRadioButton }
4
+ export type { IPktRadioButton } from './radiobutton'
4
5
  export default PktRadioButton
@@ -7,7 +7,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
7
7
  import { html, nothing } from 'lit'
8
8
  import { classMap } from 'lit/directives/class-map.js'
9
9
  import { ElementProps } from '@/types/typeUtils'
10
- import type { TPktInputSize } from 'shared-types'
10
+ import { RADIOBUTTON_DEFAULTS, type IPktRadioButtonBase, type TPktInputSize } from 'shared-types'
11
11
 
12
12
  type Props = ElementProps<
13
13
  PktRadioButton,
@@ -21,21 +21,30 @@ type Props = ElementProps<
21
21
  | 'requiredText'
22
22
  >
23
23
 
24
- export class PktRadioButton extends PktInputElement<Props> {
24
+ export interface IPktRadioButton extends Omit<
25
+ IPktRadioButtonBase,
26
+ 'form' | 'label' | 'checkHelptext' | 'checked'
27
+ > {
28
+ label?: string | null
29
+ checkHelptext?: string | null
30
+ checked?: boolean | string | null
31
+ }
32
+
33
+ export class PktRadioButton extends PktInputElement<Props> implements IPktRadioButton {
25
34
  inputRef: Ref<HTMLInputElement> = createRef()
26
35
 
27
36
  @property({ type: String, reflect: true }) value: string = ''
28
37
  @property({ type: String }) checkHelptext: string | null = null
29
- @property({ type: Boolean }) defaultChecked: boolean = false
30
- @property({ type: Boolean }) hasTile: boolean = false
38
+ @property({ type: Boolean }) defaultChecked: boolean = RADIOBUTTON_DEFAULTS.defaultChecked
39
+ @property({ type: Boolean }) hasTile: boolean = RADIOBUTTON_DEFAULTS.hasTile
31
40
  @property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
32
41
  @property({ type: String, reflect: true }) type: string = 'radio'
33
42
  @property({ type: String, attribute: 'input-size' }) inputSize: TPktInputSize | undefined = undefined
34
43
  @property({ type: String }) tagText: string | null = null
35
- @property({ type: Boolean }) optionalTag: boolean = false
44
+ @property({ type: Boolean }) optionalTag: boolean = RADIOBUTTON_DEFAULTS.optionalTag
36
45
  /** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
37
46
  @property({ type: String }) optionalText?: string
38
- @property({ type: Boolean }) requiredTag: boolean = false
47
+ @property({ type: Boolean }) requiredTag: boolean = RADIOBUTTON_DEFAULTS.requiredTag
39
48
  /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
40
49
  @property({ type: String }) requiredText?: string
41
50
 
@@ -1,38 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./consume-kEjgTrAp.cjs"),r=require("./ref-CB7e9nMY.cjs"),i=require("./input-element-C4SelHLD.cjs");var a=n.n(Symbol(`pkt-radio-group-context`)),o=class extends i.t{constructor(...e){super(...e),this.inputRef=r.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type=`radio`,this.inputSize=void 0,this.tagText=null,this.optionalTag=!1,this.requiredTag=!1,this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let n=this.hasTile||!!this.groupContext?.hasTile,i=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":n,"pkt-input-check__input--tile-disabled":this.isDisabled&&n}),a=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError||!!this.groupContext?.hasError}),o=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-sr-only":this.hideLabel}),s=`pkt-tag pkt-tag--small pkt-tag--thin-text`,c=this.pktStrings.get(`forms`),l=()=>e._`
2
- ${this.tagText?e._`<span class=${s+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
3
- ${this.optionalTag?e._`<span class=${s+` pkt-tag--blue-light`}
4
- >${this.optionalText??c.optional}</span
5
- >`:e.h}
6
- ${this.requiredTag?e._`<span class=${s+` pkt-tag--beige`}
7
- >${this.requiredText??c.required}</span
8
- >`:e.h}
9
- `,u=this.id+`-check-label`,d=this.id+`-check-helptext`;return e._`
10
- <div class="pkt-input-check${this.inputSize?` pkt-input-check--${this.inputSize}`:``}">
11
- <div class=${i}>
12
- <input
13
- id=${this.id+`-internal`}
14
- class=${a}
15
- type="radio"
16
- ?disabled=${this.isDisabled}
17
- form=""
18
- name=${this.internalName}
19
- ${r.n(this.inputRef)}
20
- @change=${this.toggleChecked}
21
- @input=${this.handleInput}
22
- @blur=${this.onBlur}
23
- @focus=${this.onFocus}
24
- ?checked=${this.checked}
25
- aria-labelledby=${this.label?u:e.h}
26
- aria-describedby=${this.checkHelptext?d:e.h}
27
- />
28
- ${e._`
29
- <label class=${o} for=${this.id+`-internal`}>
30
- <span id=${u}>${this.label} ${l()}</span>
31
- ${this.checkHelptext?e._`<div id=${d} class="pkt-input-check__input-helptext">
32
- ${this.checkHelptext}
33
- </div>`:e.h}
34
- </label>
35
- `}
36
- </div>
37
- </div>
38
- `}handleInput(e){e.stopImmediatePropagation()}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this._checked))}};e.n([e.u({type:String,reflect:!0})],o.prototype,`value`,void 0),e.n([e.u({type:String})],o.prototype,`checkHelptext`,void 0),e.n([e.u({type:Boolean})],o.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],o.prototype,`hasTile`,void 0),e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`checked`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`type`,void 0),e.n([e.u({type:String,attribute:`input-size`})],o.prototype,`inputSize`,void 0),e.n([e.u({type:String})],o.prototype,`tagText`,void 0),e.n([e.u({type:Boolean})],o.prototype,`optionalTag`,void 0),e.n([e.u({type:String})],o.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean})],o.prototype,`requiredTag`,void 0),e.n([e.u({type:String})],o.prototype,`requiredText`,void 0),e.n([e.l()],o.prototype,`_checked`,void 0),e.n([n.t({context:a,subscribe:!0}),e.l()],o.prototype,`groupContext`,void 0);try{e.d(`pkt-radiobutton`)(o)}catch{console.warn(`Forsøker å definere <pkt-radiobutton>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});