@oslokommune/punkt-elements 12.27.7 → 12.27.9

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/dist/index.d.ts CHANGED
@@ -7,6 +7,13 @@ import { Ref } from 'lit/directives/ref.js';
7
7
  import { TemplateResult } from 'lit-html';
8
8
  import { TZDate } from '@date-fns/tz';
9
9
 
10
+ /**
11
+ * We define all props as optional. Native HTML attributes are optional by default,
12
+ * but the TS definition require either null or value. This way we can support showing a value as optional
13
+ * and define a default value on the element itself
14
+ */
15
+ declare type ElementProps<Element, PropKeys extends keyof Element> = Partial<Pick<Element, PropKeys>>;
16
+
10
17
  declare interface IPktLinkCard {
11
18
  title?: string;
12
19
  href?: string;
@@ -618,15 +625,15 @@ export declare class PktTextinput extends PktInputElement<Props_5> {
618
625
  render(): TemplateResult<1>;
619
626
  }
620
627
 
621
- declare type Props = Pick<PktElement, 'strings' | 'role'>;
628
+ declare type Props = ElementProps<PktElement, 'strings' | 'role'>;
622
629
 
623
- declare type Props_2 = Pick<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedBy' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'dataTestid'>;
630
+ declare type Props_2 = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedBy' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'dataTestid'>;
624
631
 
625
- declare type Props_3 = Pick<PktIcon, 'path' | 'name'>;
632
+ declare type Props_3 = ElementProps<PktIcon, 'path' | 'name'>;
626
633
 
627
- declare type Props_4 = Pick<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
634
+ declare type Props_4 = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
628
635
 
629
- declare type Props_5 = Pick<PktTextinput, 'value' | 'type' | 'size' | 'autocomplete' | 'iconNameRight' | 'prefix' | 'suffix' | 'omitSearchIcon'>;
636
+ declare type Props_5 = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'autocomplete' | 'iconNameRight' | 'prefix' | 'suffix' | 'omitSearchIcon'>;
630
637
 
631
638
  declare type TAlertSkin = 'error' | 'success' | 'warning' | 'info';
632
639
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.27.7",
3
+ "version": "12.27.9",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -57,5 +57,5 @@
57
57
  "url": "https://github.com/oslokommune/punkt/issues"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "8462afda718ac2c8045708ae881430f12fabc8d8"
60
+ "gitHead": "bc51587318b0ccff1df2340b84d6c2f87c6bd7b8"
61
61
  }
@@ -1,4 +1,5 @@
1
1
  import { PktElement } from '@/base-elements/element'
2
+ import { ElementProps } from '@/types/typeUtils'
2
3
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
3
4
  import { html, PropertyValues } from 'lit'
4
5
  import { customElement, property } from 'lit/decorators.js'
@@ -50,7 +51,7 @@ const downloadIconOrGetFromCache = async (
50
51
  return Promise.resolve(errorSvg)
51
52
  }
52
53
 
53
- type Props = Pick<PktIcon, 'path' | 'name'>
54
+ type Props = ElementProps<PktIcon, 'path' | 'name'>
54
55
 
55
56
  @customElement('pkt-icon')
56
57
  export class PktIcon extends PktElement<Props> {
@@ -5,12 +5,13 @@ import { html, nothing, PropertyValues } from 'lit'
5
5
  import { unsafeHTML } from 'lit/directives/unsafe-html.js'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import { customElement, property, state } from 'lit/decorators.js'
8
+ import { ElementProps } from '@/types/typeUtils'
8
9
  import { uuidish } from '@/utils/stringutils'
9
10
  import specs from 'componentSpecs/input-wrapper.json'
10
11
  import '@/components/helptext'
11
12
  import '@/components/icon'
12
13
 
13
- type Props = Pick<
14
+ type Props = ElementProps<
14
15
  PktInputWrapper,
15
16
  | 'forId'
16
17
  | 'label'
@@ -1,6 +1,7 @@
1
1
  import { html, nothing, PropertyValues } from 'lit'
2
2
  import { customElement, property, state } from 'lit/decorators.js'
3
3
  import { Ref, createRef, ref } from 'lit/directives/ref.js'
4
+ import { ElementProps } from '@/types/typeUtils'
4
5
  import { classMap } from 'lit/directives/class-map.js'
5
6
  import { PktInputElement } from '@/base-elements/input-element'
6
7
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
@@ -8,7 +9,7 @@ import { PktSlotController } from '@/controllers/pkt-slot-controller'
8
9
  import '@/components/input-wrapper'
9
10
  import '@/components/icon'
10
11
 
11
- type Props = Pick<
12
+ type Props = ElementProps<
12
13
  PktTextinput,
13
14
  | 'value'
14
15
  | 'type'