@oslokommune/punkt-elements 19.19.0 → 19.19.1
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 +5 -0
- package/dist/components/textinput/index.d.ts +1 -0
- package/dist/components/textinput/textinput.d.ts +22 -1
- package/dist/{header-Cptdf4fW.js → header-BYNzxXCo.js} +1 -1
- package/dist/{header-Cj08flhl.cjs → header-BqheRQpR.cjs} +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +18 -18
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/textinput.d.ts +82 -0
- package/dist/{textinput-75MKBqas.cjs → textinput-C5KWIB21.cjs} +2 -2
- package/dist/{textinput-D_V3b327.js → textinput-CRlErItw.js} +22 -7
- package/package.json +2 -2
- package/src/components/textinput/index.ts +1 -0
- package/src/components/textinput/textinput.test.ts +1 -1
- package/src/components/textinput/textinput.ts +46 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [19.20.0](https://github.com/oslokommune/punkt/compare/19.19.0...19.20.0) (2026-11-03)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
|
|
8
13
|
## [19.19.0](https://github.com/oslokommune/punkt/compare/19.18.4...19.19.0) (2026-10-22)
|
|
9
14
|
|
|
10
15
|
---
|
|
@@ -2,8 +2,29 @@ import { PropertyValues } from 'lit';
|
|
|
2
2
|
import { Ref } from 'lit/directives/ref.js';
|
|
3
3
|
import { ElementProps } from '../../types/typeUtils';
|
|
4
4
|
import { PktInputElement } from '../../base-elements/input-element';
|
|
5
|
+
import { Booleanish, IPktTextinputBase } from '../../shared-types';
|
|
5
6
|
type Props = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'autocomplete' | 'iconNameRight' | 'prefix' | 'suffix' | 'omitSearchIcon'>;
|
|
6
|
-
export
|
|
7
|
+
export interface IPktTextinput extends Omit<IPktTextinputBase, 'form' | 'label' | 'placeholder' | 'size' | 'prefix' | 'suffix' | 'iconNameRight' | 'min' | 'max' | 'minLength' | 'maxLength' | 'step' | 'readOnly' | 'autoComplete' | 'ariaDescribedby' | 'ariaLabelledby' | 'helptextDropdownButton' | 'useWrapper'> {
|
|
8
|
+
label?: string | null;
|
|
9
|
+
placeholder?: string | null;
|
|
10
|
+
size?: number | null;
|
|
11
|
+
prefix?: string | null;
|
|
12
|
+
suffix?: string | null;
|
|
13
|
+
iconNameRight?: string | null;
|
|
14
|
+
min?: string | number | null;
|
|
15
|
+
max?: string | number | null;
|
|
16
|
+
minlength?: number | null;
|
|
17
|
+
maxlength?: number | null;
|
|
18
|
+
step?: number | null;
|
|
19
|
+
readonly?: boolean;
|
|
20
|
+
autocomplete?: string | null;
|
|
21
|
+
ariaDescribedby?: string | null;
|
|
22
|
+
ariaLabelledby?: string | null;
|
|
23
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
24
|
+
helptextDropdownButton?: string | null;
|
|
25
|
+
useWrapper?: Booleanish;
|
|
26
|
+
}
|
|
27
|
+
export declare class PktTextinput extends PktInputElement<Props> implements IPktTextinput {
|
|
7
28
|
inputRef: Ref<HTMLTextAreaElement>;
|
|
8
29
|
value: string;
|
|
9
30
|
type: string;
|
|
@@ -6,13 +6,13 @@ import { t as d } from "./booleanish-OQJTYSrw.js";
|
|
|
6
6
|
import "./shared-types-A6iGIX-f.js";
|
|
7
7
|
import { n as f, o as p, t as m } from "./fetch-header-footer-data-Pc32etrk.js";
|
|
8
8
|
import "./icon-CUU42bZ0.js";
|
|
9
|
+
import "./textinput-CRlErItw.js";
|
|
9
10
|
import { t as h } from "./if-defined-D18nY_K_.js";
|
|
10
11
|
import "./button-CF9k3ARf.js";
|
|
11
12
|
import { n as g, t as _ } from "./ref-D4OwQYdf.js";
|
|
12
13
|
import { n as v, t as y } from "./focus-trap-DG3pEuyJ.js";
|
|
13
14
|
import { n as b, t as x } from "./scroll-lock-CR-g54ai.js";
|
|
14
15
|
import "./link-BU6t5Tt9.js";
|
|
15
|
-
import "./textinput-D_V3b327.js";
|
|
16
16
|
import "./searchinput-BV2C1VbN.js";
|
|
17
17
|
import "./header-menu-DxOSBiTJ.js";
|
|
18
18
|
//#region ../../shared-types/header.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-B0Vp_OuR.cjs"),i=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-CrG6o7ZE.cjs");const o=require("./if-defined-CiML3MTM.cjs");require("./button-BBFI3FuT.cjs");const s=require("./ref-CB7e9nMY.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-x0VxhKWZ.cjs");require("./link-a1ZK4J1j.cjs"),require("./
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-B0Vp_OuR.cjs"),i=require("./booleanish-BF8l4scU.cjs");require("./shared-types-BvRk9kiK.cjs");const a=require("./fetch-header-footer-data-CUKV0biS.cjs");require("./icon-CrG6o7ZE.cjs"),require("./textinput-C5KWIB21.cjs");const o=require("./if-defined-CiML3MTM.cjs");require("./button-BBFI3FuT.cjs");const s=require("./ref-CB7e9nMY.cjs"),c=require("./focus-trap-DSv4Ifqm.cjs"),l=require("./scroll-lock-x0VxhKWZ.cjs");require("./link-a1ZK4J1j.cjs"),require("./searchinput-DqD_iLxV.cjs"),require("./header-menu-De2DNAXd.cjs");var u=e=>typeof e.target==`string`?{title:e.title,iconName:e.iconName,href:e.target}:{title:e.title,iconName:e.iconName,onClick:e.target},d=e=>u(e),f=e=>{if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!isNaN(t.getTime()))return t.toLocaleDateString(`nb-NO`,{day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})},p=class{constructor(e,t){this.isMobile=!1,this.isTablet=!1,this.isHidden=!1,this.pauseScrollHide=!1,this.componentWidth=typeof window<`u`?window.innerWidth:0,this.lastScrollPosition=0,this.scrollLockToken=l.t(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.initialWidthEstimated=!1,this.handleScroll=()=>{if(this.getOptions().scrollBehavior!==`hide`||this.pauseScrollHide)return;let e=window.pageYOffset||document.documentElement.scrollTop;if(e<0||Math.abs(e-this.lastScrollPosition)<60)return;let t=e>this.lastScrollPosition;this.lastScrollPosition=e,t!==this.isHidden&&(this.isHidden=t,this.host.requestUpdate())},this.host=e,this.getOptions=t,e.addController(this)}hostConnected(){window.addEventListener(`scroll`,this.handleScroll)}hostUpdate(){this.initialWidthEstimated||(this.initialWidthEstimated=!0,this.componentWidth=this.host.offsetWidth,this.applyBreakpoints())}hostDisconnected(){this.resizeObserver?.disconnect(),window.removeEventListener(`scroll`,this.handleScroll),l.n(this.scrollLockToken,!1)}observe(e){e&&(this.componentWidth=e.offsetWidth,this.refreshBreakpoints(),this.resizeObserver=new ResizeObserver(e=>{for(let t of e)this.componentWidth=t.borderBoxSize&&t.borderBoxSize.length>0?t.borderBoxSize[0].inlineSize:t.contentRect.width,this.refreshBreakpoints()}),this.resizeObserver.observe(e))}refreshBreakpoints(){this.applyBreakpoints()&&this.host.requestUpdate()}applyBreakpoints(){let{mobileBreakpoint:e,tabletBreakpoint:t}=this.getOptions(),n=this.componentWidth<e,r=this.componentWidth<t;return n===this.isMobile&&r===this.isTablet?!1:(this.isMobile=n,this.isTablet=r,!0)}setScrollLock(e){l.n(this.scrollLockToken,e)}captureFocus(){this.lastFocusedElement=document.activeElement}flagRestoreFocus(){this.shouldRestoreFocus=!0}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}},m=class extends e.t{constructor(...e){super(...e),this.canChangeRepresentation=!1,this.logoutOnClick=!1}handleChangeRepresentation(){this.dispatchEvent(new CustomEvent(`change-representation`,{bubbles:!0,composed:!0}))}handleLogout(){this.dispatchEvent(new CustomEvent(`log-out`,{bubbles:!0,composed:!0}))}handleMenuItemClick(e){`onClick`in e&&typeof e.onClick==`function`&&e.onClick()}renderLinkOrButton(n,r){let i=`href`in n,a=t.t({"pkt-user-menu__link":!0,"pkt-link-button":!i,"pkt-link":!i,"pkt-link--icon-left":!i,[r||``]:!!r});return i?e._`
|
|
2
2
|
<pkt-link
|
|
3
3
|
iconName=${n.iconName||e.h}
|
|
4
4
|
href=${n.href}
|
package/dist/pkt-header.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./header-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./header-BqheRQpR.cjs");exports.PktHeader=e.t,exports.PktHeaderGlobal=e.n,exports.PktHeaderService=e.r,exports.PktHeaderUserMenu=e.i,exports.formatLastLoggedIn=e.a;
|
package/dist/pkt-header.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as PktHeader, n as PktHeaderGlobal, r as PktHeaderService, i as PktHeaderUserMenu, a as formatLastLoggedIn } from "./header-
|
|
1
|
+
export { t as PktHeader, n as PktHeaderGlobal, r as PktHeaderService, i as PktHeaderUserMenu, a as formatLastLoggedIn } from "./header-BYNzxXCo.js";
|
package/dist/pkt-index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DNHRe0zV.cjs"),n=require("./alert-Dy5N7qK-.cjs"),r=require("./header-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./element-C6WTyJFE.cjs"),t=require("./consent-DNHRe0zV.cjs"),n=require("./alert-Dy5N7qK-.cjs"),r=require("./header-BqheRQpR.cjs"),i=require("./card-mi3VKIoy.cjs"),a=require("./checkbox-B8foyiOW.cjs"),o=require("./radiobutton-IcDc6ze2.cjs"),s=require("./icon-CrG6o7ZE.cjs"),c=require("./loader-DwGMavG7.cjs"),l=require("./accordion-Bg4CMrUM.cjs"),u=require("./input-wrapper-QzdntWJX.cjs"),d=require("./textarea-B5OfR-QI.cjs"),f=require("./textinput-C5KWIB21.cjs"),p=require("./messagebox-DR-s6tyr.cjs"),m=require("./calendar-Dds9KFiE.cjs"),h=require("./combobox-DLDvyuDh.cjs"),g=require("./button-BBFI3FuT.cjs"),_=require("./backlink-BnWruRuj.cjs"),v=require("./breadcrumbs-CyWtnx2B.cjs"),y=require("./tag-DrFK8Wq3.cjs"),b=require("./helptext-BbrFE48Y.cjs"),x=require("./checkbox-group-BlBgrzKG.cjs"),S=require("./fileupload-M66Pd-QJ.cjs"),C=require("./modal-C5AiVm5g.cjs"),w=require("./progressbar-YfHSPmqI.cjs"),T=require("./datepicker-C7F1Yc5N.cjs"),E=require("./footer-HFL2sjAY.cjs"),D=require("./link-a1ZK4J1j.cjs"),O=require("./searchinput-DqD_iLxV.cjs"),k=require("./header-menu-De2DNAXd.cjs"),A=require("./heading--hGRDNX9.cjs"),j=require("./linkcard-Cu4Rh71U.cjs"),M=require("./radio-group-bpIEEMdL.cjs"),N=require("./tabs-BcnYrmjU.cjs"),P=require("./select-CHqM6kI-.cjs"),F=require("./timepicker-RxsG0mCF.cjs");exports.PktAccordion=l.r,exports.PktAccordionItem=l.n,exports.PktAlert=n.n,exports.PktBackLink=_.n,exports.PktBreadcrumbs=v.t,exports.PktButton=g.n,exports.PktCalendar=m.n,exports.PktCard=i.n,exports.PktCheckbox=a.n,exports.PktCheckboxGroup=x.n,exports.PktCombobox=h.n,exports.PktConsent=t.n,exports.PktDateTags=T.a,exports.PktDatepicker=T.t,Object.defineProperty(exports,"PktFileUpload",{enumerable:!0,get:function(){return S.n}}),exports.PktFooter=E.n,exports.PktFooterSimple=E.t,exports.PktHeader=r.t,exports.PktHeaderGlobal=r.n,exports.PktHeaderMenu=k.n,exports.PktHeaderService=r.r,exports.PktHeaderUserMenu=r.i,exports.PktHeading=A.n,exports.PktHelptext=b.n,exports.PktIcon=s.n,exports.PktInputWrapper=u.n,exports.PktLink=D.n,exports.PktLinkCard=j.n,exports.PktLoader=c.n,exports.PktMessagebox=p.n,exports.PktModal=C.n,exports.PktProgressbar=w.n,exports.PktRadioButton=o.n,exports.PktRadiobutton=o.n,exports.PktRadioGroup=M.n,exports.PktSearchInput=O.n,exports.PktSelect=P.n,exports.PktTabItem=N.n,exports.PktTabs=N.r,exports.PktTag=y.n,exports.PktTextarea=d.n,exports.PktTextinput=f.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e, i as t, o as n, r, s as i } from "./element-ckeMVgMz.js";
|
|
2
2
|
import { n as a } from "./consent-BTw6uqFf.js";
|
|
3
3
|
import { n as o } from "./alert-BAaZIR3e.js";
|
|
4
|
-
import { i as s, n as c, r as l, t as u } from "./header-
|
|
4
|
+
import { i as s, n as c, r as l, t as u } from "./header-BYNzxXCo.js";
|
|
5
5
|
import { n as d } from "./card-Ddu0sQ0f.js";
|
|
6
6
|
import { n as f } from "./checkbox-D9-KugOh.js";
|
|
7
7
|
import { n as p } from "./radiobutton-DMvVv81Y.js";
|
|
@@ -10,22 +10,22 @@ import { n as h } from "./loader-Y8V3Q82X.js";
|
|
|
10
10
|
import { n as g, r as _ } from "./accordion-BHVzR-6Z.js";
|
|
11
11
|
import { n as v } from "./input-wrapper-CHwWQgZP.js";
|
|
12
12
|
import { n as y } from "./textarea-Du1Z9JUu.js";
|
|
13
|
-
import { n as b } from "./
|
|
14
|
-
import { n as x } from "./
|
|
15
|
-
import { n as S } from "./
|
|
16
|
-
import { n as C } from "./
|
|
17
|
-
import { n as w } from "./
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { n as D } from "./
|
|
21
|
-
import { n as O } from "./
|
|
22
|
-
import { n as k } from "./
|
|
23
|
-
import { n as A } from "./
|
|
24
|
-
import { n as j } from "./
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { n as I } from "./
|
|
28
|
-
import { n as L } from "./
|
|
13
|
+
import { n as b } from "./textinput-CRlErItw.js";
|
|
14
|
+
import { n as x } from "./messagebox-wJcXW5hI.js";
|
|
15
|
+
import { n as S } from "./calendar-BX3n3vhs.js";
|
|
16
|
+
import { n as C } from "./combobox-BAkblu9M.js";
|
|
17
|
+
import { n as w } from "./button-CF9k3ARf.js";
|
|
18
|
+
import { n as T } from "./backlink-Dlkyj0ns.js";
|
|
19
|
+
import { t as E } from "./breadcrumbs-Bfv8W2CF.js";
|
|
20
|
+
import { n as D } from "./tag-BOTH9kMz.js";
|
|
21
|
+
import { n as O } from "./helptext-BVYv8Lm9.js";
|
|
22
|
+
import { n as k } from "./checkbox-group-Dz1ypmbU.js";
|
|
23
|
+
import { n as A } from "./fileupload-CEwnpxZj.js";
|
|
24
|
+
import { n as j } from "./modal-BafCTC4M.js";
|
|
25
|
+
import { n as M } from "./progressbar-BukfOcRk.js";
|
|
26
|
+
import { a as N, t as P } from "./datepicker-9dmdHweu.js";
|
|
27
|
+
import { n as F, t as I } from "./footer-DZ4aA6fj.js";
|
|
28
|
+
import { n as L } from "./link-BU6t5Tt9.js";
|
|
29
29
|
import { n as R } from "./searchinput-BV2C1VbN.js";
|
|
30
30
|
import { n as z } from "./header-menu-DxOSBiTJ.js";
|
|
31
31
|
import { n as B } from "./heading-B1Ey3XzB.js";
|
|
@@ -34,4 +34,4 @@ import { n as H } from "./radio-group-Bg6ODpT3.js";
|
|
|
34
34
|
import { n as U, r as W } from "./tabs-B2RjklQl.js";
|
|
35
35
|
import { n as G } from "./select-DKBfPgJB.js";
|
|
36
36
|
import { t as K } from "./timepicker-DVqTAxt0.js";
|
|
37
|
-
export { _ as PktAccordion, g as PktAccordionItem, o as PktAlert,
|
|
37
|
+
export { _ as PktAccordion, g as PktAccordionItem, o as PktAlert, T as PktBackLink, E as PktBreadcrumbs, w as PktButton, S as PktCalendar, d as PktCard, f as PktCheckbox, k as PktCheckboxGroup, C as PktCombobox, a as PktConsent, N as PktDateTags, P as PktDatepicker, A as PktFileUpload, F as PktFooter, I as PktFooterSimple, u as PktHeader, c as PktHeaderGlobal, z as PktHeaderMenu, l as PktHeaderService, s as PktHeaderUserMenu, B as PktHeading, O as PktHelptext, m as PktIcon, v as PktInputWrapper, L as PktLink, V as PktLinkCard, h as PktLoader, x as PktMessagebox, j as PktModal, M as PktProgressbar, p as PktRadioButton, p as PktRadiobutton, H as PktRadioGroup, R as PktSearchInput, G as PktSelect, U as PktTabItem, W as PktTabs, D as PktTag, y as PktTextarea, b as PktTextinput, K as PktTimepicker, r as getPktStrings, i as pktStringsNb, t as resetPktStrings, e as setPktStrings, n as subscribePktStrings };
|
package/dist/pkt-textinput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textinput-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./textinput-C5KWIB21.cjs");exports.PktTextinput=e.n,exports.default=e.t;
|
package/dist/pkt-textinput.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as PktTextinput, t as default } from "./textinput-
|
|
1
|
+
export { n as PktTextinput, t as default } from "./textinput-CRlErItw.js";
|
|
@@ -43,6 +43,8 @@ export type { IHelptextProps, ITagOptionalRequiredProps, IFormFieldLabelProps, I
|
|
|
43
43
|
export { COUNTER_POSITIONS, INPUT_WRAPPER_DEFAULTS } from './input-wrapper';
|
|
44
44
|
export { TEXTAREA_DEFAULTS } from './textarea';
|
|
45
45
|
export type { IPktTextareaBase, ITextareaSpecProps } from './textarea';
|
|
46
|
+
export { TEXTINPUT_DEFAULTS, TEXTINPUT_TYPES } from './textinput';
|
|
47
|
+
export type { TPktTextinputType, IPktTextinputBase, ITextinputSpecProps } from './textinput';
|
|
46
48
|
export type { TPktCounterPosition, IPktInputWrapperBase, IInputWrapperSpecProps, } from './input-wrapper';
|
|
47
49
|
export type { TTagSkin } from './skin';
|
|
48
50
|
export { MESSAGEBOX_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* textinput.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-textinput.
|
|
5
|
+
* Used by React, Elements, and typed component specs.
|
|
6
|
+
*/
|
|
7
|
+
import type { IFormFieldCommonProps } from './form-field';
|
|
8
|
+
import type { TPktInputSize } from './size';
|
|
9
|
+
/** `type`-verdier som dokumenteres for pkt-textinput. Komponenten godtar fortsatt en vanlig streng. */
|
|
10
|
+
export declare const TEXTINPUT_TYPES: readonly ['color', 'date', 'datetime-local', 'email', 'file', 'month', 'number', 'password', 'search', 'tel', 'text', 'time', 'url', 'week'];
|
|
11
|
+
export type TPktTextinputType = (typeof TEXTINPUT_TYPES)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Textinput props shared by React, Elements, and typed component specs.
|
|
14
|
+
*
|
|
15
|
+
* @remarks Keys follow the React prop names. Elements uses lowercase properties instead:
|
|
16
|
+
* `autocomplete`, `minlength`, `maxlength` and `readonly`.
|
|
17
|
+
*
|
|
18
|
+
* React requires `id` and `label`, and widens `helptext`, `helptextDropdown` and
|
|
19
|
+
* `errorMessage` to `ReactNode`.
|
|
20
|
+
* Elements widens `label`, `placeholder`, `size`,
|
|
21
|
+
* `prefix`, `suffix`, `iconNameRight`, `ariaDescribedby`, `ariaLabelledby` and
|
|
22
|
+
* `helptextDropdownButton` to `| null`, `useWrapper` to `Booleanish`, and omits
|
|
23
|
+
* `form`. On Elements `form` is a getter that returns the associated
|
|
24
|
+
* `HTMLFormElement`, not the form id.
|
|
25
|
+
*
|
|
26
|
+
* `counter` and `hasFieldset` are tri-state: `null` means the component derives the value.
|
|
27
|
+
*/
|
|
28
|
+
export interface IPktTextinputBase extends IFormFieldCommonProps<'forms' | 'validation'> {
|
|
29
|
+
id?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
form?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
/** Bredde i antall tegn (HTML-attributtet `size`), ikke den visuelle `inputSize`. */
|
|
36
|
+
size?: number;
|
|
37
|
+
omitSearchIcon?: boolean;
|
|
38
|
+
prefix?: string;
|
|
39
|
+
suffix?: string;
|
|
40
|
+
iconNameRight?: string;
|
|
41
|
+
min?: number | string;
|
|
42
|
+
max?: number | string;
|
|
43
|
+
minLength?: number;
|
|
44
|
+
maxLength?: number;
|
|
45
|
+
step?: number | string;
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
autoComplete?: string;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
ariaDescribedby?: string;
|
|
50
|
+
ariaLabelledby?: string;
|
|
51
|
+
inline?: boolean;
|
|
52
|
+
fullwidth?: boolean;
|
|
53
|
+
useWrapper?: boolean;
|
|
54
|
+
counter?: boolean | null;
|
|
55
|
+
counterMaxLength?: number;
|
|
56
|
+
inputSize?: TPktInputSize;
|
|
57
|
+
hasFieldset?: boolean | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Documented Textinput props (subset of `IPktTextinputBase`).
|
|
61
|
+
* Used for typed component specs in documentation.
|
|
62
|
+
*/
|
|
63
|
+
export type ITextinputSpecProps = Pick<IPktTextinputBase, 'label' | 'name' | 'form' | 'placeholder' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'size' | 'type' | 'omitSearchIcon' | 'value' | 'autoComplete' | 'suffix' | 'prefix' | 'iconNameRight' | 'min' | 'max' | 'minLength' | 'maxLength' | 'step' | 'readOnly' | 'ariaLabelledby' | 'ariaDescribedby' | 'required' | 'requiredTag' | 'requiredText' | 'optionalTag' | 'optionalText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'fullwidth' | 'useWrapper' | 'id' | 'counter' | 'counterMaxLength' | 'inputSize' | 'hasFieldset'>;
|
|
64
|
+
/**
|
|
65
|
+
* Default values for pkt-textinput. Single source of truth for both frameworks.
|
|
66
|
+
* `counter` and `hasFieldset` are intentionally absent — `null` lets the component derive them.
|
|
67
|
+
*/
|
|
68
|
+
export declare const TEXTINPUT_DEFAULTS: {
|
|
69
|
+
readonly type: 'text';
|
|
70
|
+
readonly autoComplete: 'off';
|
|
71
|
+
readonly omitSearchIcon: false;
|
|
72
|
+
readonly required: false;
|
|
73
|
+
readonly readOnly: false;
|
|
74
|
+
readonly requiredTag: false;
|
|
75
|
+
readonly optionalTag: false;
|
|
76
|
+
readonly hasError: false;
|
|
77
|
+
readonly disabled: false;
|
|
78
|
+
readonly inline: false;
|
|
79
|
+
readonly fullwidth: false;
|
|
80
|
+
readonly useWrapper: true;
|
|
81
|
+
readonly inputSize: 'medium';
|
|
82
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-B0Vp_OuR.cjs");require("./icon-CrG6o7ZE.cjs");const r=require("./input-wrapper-QzdntWJX.cjs"),i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-D82laWtR.cjs");var s=class extends o.t{constructor(...e){super(...e),this.inputRef=a.t(),this.value=``,this.type
|
|
1
|
+
const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-B0Vp_OuR.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./icon-CrG6o7ZE.cjs");const r=require("./input-wrapper-QzdntWJX.cjs"),i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs"),o=require("./input-element-D82laWtR.cjs");var s={type:`text`,autoComplete:`off`,omitSearchIcon:!1,required:!1,readOnly:!1,requiredTag:!1,optionalTag:!1,hasError:!1,disabled:!1,inline:!1,fullwidth:!1,useWrapper:!0,inputSize:`medium`},c=class extends o.t{constructor(...e){super(...e),this.inputRef=a.t(),this.value=``,this.type=s.type,this.size=null,this.autocomplete=s.autoComplete,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=s.omitSearchIcon,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&typeof this.value!=`string`&&!Array.isArray(this.value)&&(this.value=this.coerceToString(this.value)),e.has(`value`)&&(this.counterCurrent=this.value?.length||0),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`),e.has(`value`)&&this.valueChanged(this.value,e.get(`value`))}render(){let o=this.type===`search`&&!this.iconNameRight&&!this.omitSearchIcon,s=this.effectiveCounter(this.counterMaxLength>0),c=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":s&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
${n.n(this,[`helptext`])}
|
|
4
4
|
.strings=${this.strings}
|
|
@@ -69,4 +69,4 @@ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),
|
|
|
69
69
|
${!this.suffix&&o?e._`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:e.h}
|
|
70
70
|
</div>
|
|
71
71
|
</pkt-input-wrapper>
|
|
72
|
-
`}};e.n([e.u({type:String,reflect:!0})],
|
|
72
|
+
`}};e.n([e.u({type:String,reflect:!0})],c.prototype,`value`,void 0),e.n([e.u({type:String})],c.prototype,`type`,void 0),e.n([e.u({type:Number})],c.prototype,`size`,void 0),e.n([e.u({type:String})],c.prototype,`autocomplete`,void 0),e.n([e.u({type:String})],c.prototype,`iconNameRight`,void 0),e.n([e.u({type:String})],c.prototype,`prefix`,void 0),e.n([e.u({type:String})],c.prototype,`suffix`,void 0),e.n([e.u({type:Boolean})],c.prototype,`omitSearchIcon`,void 0),e.n([e.l()],c.prototype,`counterCurrent`,void 0);try{e.d(`pkt-textinput`)(c)}catch{console.warn(`Forsøker å definere <pkt-textinput>, men den er allerede definert`)}var l=c;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-ckeMVgMz.js";
|
|
2
2
|
import { t as o } from "./class-map-BkEYw5uE.js";
|
|
3
3
|
import { n as s } from "./element-with-slot-Dp2Gzv-Q.js";
|
|
4
|
+
import "./shared-types-A6iGIX-f.js";
|
|
4
5
|
import "./icon-CUU42bZ0.js";
|
|
5
6
|
import { r as c } from "./input-wrapper-CHwWQgZP.js";
|
|
6
7
|
import { t as l } from "./if-defined-D18nY_K_.js";
|
|
7
8
|
import { n as u, t as d } from "./ref-D4OwQYdf.js";
|
|
8
9
|
import { t as f } from "./input-element-DczlJQb1.js";
|
|
9
|
-
//#region
|
|
10
|
-
var p =
|
|
10
|
+
//#region ../../shared-types/textinput.ts
|
|
11
|
+
var p = {
|
|
12
|
+
type: "text",
|
|
13
|
+
autoComplete: "off",
|
|
14
|
+
omitSearchIcon: !1,
|
|
15
|
+
required: !1,
|
|
16
|
+
readOnly: !1,
|
|
17
|
+
requiredTag: !1,
|
|
18
|
+
optionalTag: !1,
|
|
19
|
+
hasError: !1,
|
|
20
|
+
disabled: !1,
|
|
21
|
+
inline: !1,
|
|
22
|
+
fullwidth: !1,
|
|
23
|
+
useWrapper: !0,
|
|
24
|
+
inputSize: "medium"
|
|
25
|
+
}, m = class extends f {
|
|
11
26
|
constructor(...e) {
|
|
12
|
-
super(...e), this.inputRef = d(), this.value = "", this.type =
|
|
27
|
+
super(...e), this.inputRef = d(), this.value = "", this.type = p.type, this.size = null, this.autocomplete = p.autoComplete, this.iconNameRight = null, this.prefix = null, this.suffix = null, this.omitSearchIcon = p.omitSearchIcon, this.counterCurrent = 0;
|
|
13
28
|
}
|
|
14
29
|
attributeChangedCallback(e, t, n) {
|
|
15
30
|
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0), super.attributeChangedCallback(e, t, n);
|
|
@@ -122,14 +137,14 @@ var p = class extends f {
|
|
|
122
137
|
i([a({
|
|
123
138
|
type: String,
|
|
124
139
|
reflect: !0
|
|
125
|
-
})],
|
|
140
|
+
})], m.prototype, "value", void 0), i([a({ type: String })], m.prototype, "type", void 0), i([a({ type: Number })], m.prototype, "size", void 0), i([a({ type: String })], m.prototype, "autocomplete", void 0), i([a({ type: String })], m.prototype, "iconNameRight", void 0), i([a({ type: String })], m.prototype, "prefix", void 0), i([a({ type: String })], m.prototype, "suffix", void 0), i([a({ type: Boolean })], m.prototype, "omitSearchIcon", void 0), i([r()], m.prototype, "counterCurrent", void 0);
|
|
126
141
|
try {
|
|
127
|
-
t("pkt-textinput")(
|
|
142
|
+
t("pkt-textinput")(m);
|
|
128
143
|
} catch {
|
|
129
144
|
console.warn("Forsøker å definere <pkt-textinput>, men den er allerede definert");
|
|
130
145
|
}
|
|
131
146
|
//#endregion
|
|
132
147
|
//#region src/components/textinput/index.ts
|
|
133
|
-
var
|
|
148
|
+
var h = m;
|
|
134
149
|
//#endregion
|
|
135
|
-
export {
|
|
150
|
+
export { m as n, h as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "19.19.
|
|
3
|
+
"version": "19.19.1",
|
|
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",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "8373ea76c93221f22496eb298b2382b41bef53ab"
|
|
82
82
|
}
|
|
@@ -67,7 +67,7 @@ describe('PktTextinput', () => {
|
|
|
67
67
|
const { textinput } = await createTextinputTest()
|
|
68
68
|
expect(textinput.type).toBe('text')
|
|
69
69
|
expect(textinput.value).toBe('')
|
|
70
|
-
expect(textinput.autocomplete).toBe(
|
|
70
|
+
expect(textinput.autocomplete).toBe('off')
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
test('renders input element', async () => {
|
|
@@ -10,6 +10,7 @@ import { forwardSlots } from '@/directives/slot-content'
|
|
|
10
10
|
import '@/components/input-wrapper'
|
|
11
11
|
import '@/components/icon'
|
|
12
12
|
import { describedByIds } from 'shared-utils/forms/described-by'
|
|
13
|
+
import { TEXTINPUT_DEFAULTS, type Booleanish, type IPktTextinputBase } from 'shared-types'
|
|
13
14
|
|
|
14
15
|
type Props = ElementProps<
|
|
15
16
|
PktTextinput,
|
|
@@ -23,17 +24,58 @@ type Props = ElementProps<
|
|
|
23
24
|
| 'omitSearchIcon'
|
|
24
25
|
>
|
|
25
26
|
|
|
26
|
-
export
|
|
27
|
+
export interface IPktTextinput extends Omit<
|
|
28
|
+
IPktTextinputBase,
|
|
29
|
+
| 'form'
|
|
30
|
+
| 'label'
|
|
31
|
+
| 'placeholder'
|
|
32
|
+
| 'size'
|
|
33
|
+
| 'prefix'
|
|
34
|
+
| 'suffix'
|
|
35
|
+
| 'iconNameRight'
|
|
36
|
+
| 'min'
|
|
37
|
+
| 'max'
|
|
38
|
+
| 'minLength'
|
|
39
|
+
| 'maxLength'
|
|
40
|
+
| 'step'
|
|
41
|
+
| 'readOnly'
|
|
42
|
+
| 'autoComplete'
|
|
43
|
+
| 'ariaDescribedby'
|
|
44
|
+
| 'ariaLabelledby'
|
|
45
|
+
| 'helptextDropdownButton'
|
|
46
|
+
| 'useWrapper'
|
|
47
|
+
> {
|
|
48
|
+
label?: string | null
|
|
49
|
+
placeholder?: string | null
|
|
50
|
+
size?: number | null
|
|
51
|
+
prefix?: string | null
|
|
52
|
+
suffix?: string | null
|
|
53
|
+
iconNameRight?: string | null
|
|
54
|
+
min?: string | number | null
|
|
55
|
+
max?: string | number | null
|
|
56
|
+
minlength?: number | null
|
|
57
|
+
maxlength?: number | null
|
|
58
|
+
step?: number | null
|
|
59
|
+
readonly?: boolean
|
|
60
|
+
autocomplete?: string | null
|
|
61
|
+
ariaDescribedby?: string | null
|
|
62
|
+
ariaLabelledby?: string | null
|
|
63
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
64
|
+
helptextDropdownButton?: string | null
|
|
65
|
+
useWrapper?: Booleanish
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class PktTextinput extends PktInputElement<Props> implements IPktTextinput {
|
|
27
69
|
inputRef: Ref<HTMLTextAreaElement> = createRef()
|
|
28
70
|
|
|
29
71
|
@property({ type: String, reflect: true }) value: string = ''
|
|
30
|
-
@property({ type: String }) type: string =
|
|
72
|
+
@property({ type: String }) type: string = TEXTINPUT_DEFAULTS.type
|
|
31
73
|
@property({ type: Number }) size: number | null = null
|
|
32
|
-
@property({ type: String }) autocomplete: string | null =
|
|
74
|
+
@property({ type: String }) autocomplete: string | null = TEXTINPUT_DEFAULTS.autoComplete
|
|
33
75
|
@property({ type: String }) iconNameRight: string | null = null
|
|
34
76
|
@property({ type: String }) prefix: string | null = null
|
|
35
77
|
@property({ type: String }) suffix: string | null = null
|
|
36
|
-
@property({ type: Boolean }) omitSearchIcon: boolean =
|
|
78
|
+
@property({ type: Boolean }) omitSearchIcon: boolean = TEXTINPUT_DEFAULTS.omitSearchIcon
|
|
37
79
|
|
|
38
80
|
@state() counterCurrent = 0
|
|
39
81
|
|