@oslokommune/punkt-react 20.0.5 → 20.1.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.
@@ -43,3 +43,16 @@ export interface IPktButtonBase {
43
43
  * Used for typed component specs in documentation.
44
44
  */
45
45
  export type IButtonSpecProps = Pick<IPktButtonBase, 'size' | 'fullWidth' | 'fullWidthOnMobile' | 'skin' | 'type' | 'color' | 'state' | 'variant' | 'iconName' | 'secondIconName' | 'iconPath' | 'secondIconPath' | 'isLoading' | 'disabled'>;
46
+ /** Default values for pkt-button. Single source of truth for both frameworks */
47
+ export declare const BUTTON_DEFAULTS: {
48
+ readonly iconName: 'user';
49
+ readonly secondIconName: 'user';
50
+ readonly size: 'medium';
51
+ readonly fullWidth: false;
52
+ readonly fullWidthOnMobile: false;
53
+ readonly skin: 'primary';
54
+ readonly type: 'button';
55
+ readonly variant: 'label-only';
56
+ readonly isLoading: false;
57
+ readonly disabled: false;
58
+ };
@@ -0,0 +1,14 @@
1
+ // ../../shared-types/button.ts
2
+ var e = {
3
+ iconName: "user",
4
+ secondIconName: "user",
5
+ size: "medium",
6
+ fullWidth: !1,
7
+ fullWidthOnMobile: !1,
8
+ skin: "primary",
9
+ type: "button",
10
+ variant: "label-only",
11
+ isLoading: !1,
12
+ disabled: !1
13
+ };
14
+ export { e as BUTTON_DEFAULTS };
@@ -30,7 +30,7 @@ export type { TLayout, TVerticalPosition, THorizontalPosition, TPosition, TPosit
30
30
  export type { THTMLButtonType, TSelectionMode } from './form';
31
31
  export { ACCORDION_LIGHT_ONLY_SKINS, ACCORDION_SKINS } from './accordion';
32
32
  export type { TAccordionSkin, IPktAccordionBase, IPktAccordionItemBase, IAccordionSpecProps, IAccordionItemSpecProps, IAccordionVisualProps, } from './accordion';
33
- export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES } from './button';
33
+ export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES, BUTTON_DEFAULTS, } from './button';
34
34
  export type { TPktButtonSize, TPktButtonSkin, TPktButtonColor, TPktButtonVariant, TPktButtonState, IPktButtonBase, IButtonSpecProps, } from './button';
35
35
  export type { IPktBackLinkBase, IBacklinkSpecProps } from './backlink';
36
36
  export { LINKCARD_SKINS, LINKCARD_LIGHT_ONLY_SKINS } from './linkcard';
@@ -9,15 +9,16 @@ import { CONSENT_DEFAULTS as l } from "./consent.js";
9
9
  import { ANIMATION_DEFAULT_PATH as u, ICON_DEFAULTS as d } from "./icon.js";
10
10
  import { LOADER_DEFAULTS as f } from "./loader.js";
11
11
  import { ACCORDION_LIGHT_ONLY_SKINS as p } from "./accordion.js";
12
- import { LINKCARD_LIGHT_ONLY_SKINS as m } from "./linkcard.js";
13
- import { INPUT_WRAPPER_DEFAULTS as h } from "./input-wrapper.js";
14
- import { TEXTAREA_DEFAULTS as g } from "./textarea.js";
15
- import { TEXTINPUT_DEFAULTS as _ } from "./textinput.js";
16
- import { TAG_DEFAULTS as v } from "./tag.js";
17
- import { MESSAGEBOX_DEFAULTS as y, MESSAGEBOX_LIGHT_ONLY_SKINS as b } from "./messagebox.js";
12
+ import { BUTTON_DEFAULTS as m } from "./button.js";
13
+ import { LINKCARD_LIGHT_ONLY_SKINS as h } from "./linkcard.js";
14
+ import { INPUT_WRAPPER_DEFAULTS as g } from "./input-wrapper.js";
15
+ import { TEXTAREA_DEFAULTS as _ } from "./textarea.js";
16
+ import { TEXTINPUT_DEFAULTS as v } from "./textinput.js";
17
+ import { TAG_DEFAULTS as y } from "./tag.js";
18
+ import { MESSAGEBOX_DEFAULTS as b, MESSAGEBOX_LIGHT_ONLY_SKINS as x } from "./messagebox.js";
18
19
  import "./calendar.js";
19
- import { PROGRESSBAR_DEFAULTS as x } from "./progressbar.js";
20
+ import { PROGRESSBAR_DEFAULTS as S } from "./progressbar.js";
20
21
  import "./combobox.js";
21
- import { SELECT_DEFAULTS as S } from "./select.js";
22
- import { TABLE_DEFAULTS as C } from "./table.js";
23
- export { p as ACCORDION_LIGHT_ONLY_SKINS, u as ANIMATION_DEFAULT_PATH, i as CARD_DEFAULTS, a as CARD_LIGHT_ONLY_SKINS, o as CHECKBOX_DEFAULTS, l as CONSENT_DEFAULTS, n as DEFAULT_FOOTER_PERSONVERN_URL, r as DEFAULT_FOOTER_TILGJENGELIGHET_URL, e as DEFAULT_HEADER_FOOTER_URL, t as DEFAULT_HEADER_LOGO_LINK, d as ICON_DEFAULTS, h as INPUT_WRAPPER_DEFAULTS, m as LINKCARD_LIGHT_ONLY_SKINS, f as LOADER_DEFAULTS, y as MESSAGEBOX_DEFAULTS, b as MESSAGEBOX_LIGHT_ONLY_SKINS, c as OPTION_GROUP_DEFAULTS, x as PROGRESSBAR_DEFAULTS, s as RADIOBUTTON_DEFAULTS, S as SELECT_DEFAULTS, C as TABLE_DEFAULTS, v as TAG_DEFAULTS, g as TEXTAREA_DEFAULTS, _ as TEXTINPUT_DEFAULTS };
22
+ import { SELECT_DEFAULTS as C } from "./select.js";
23
+ import { TABLE_DEFAULTS as w } from "./table.js";
24
+ export { p as ACCORDION_LIGHT_ONLY_SKINS, u as ANIMATION_DEFAULT_PATH, m as BUTTON_DEFAULTS, i as CARD_DEFAULTS, a as CARD_LIGHT_ONLY_SKINS, o as CHECKBOX_DEFAULTS, l as CONSENT_DEFAULTS, n as DEFAULT_FOOTER_PERSONVERN_URL, r as DEFAULT_FOOTER_TILGJENGELIGHET_URL, e as DEFAULT_HEADER_FOOTER_URL, t as DEFAULT_HEADER_LOGO_LINK, d as ICON_DEFAULTS, g as INPUT_WRAPPER_DEFAULTS, h as LINKCARD_LIGHT_ONLY_SKINS, f as LOADER_DEFAULTS, b as MESSAGEBOX_DEFAULTS, x as MESSAGEBOX_LIGHT_ONLY_SKINS, c as OPTION_GROUP_DEFAULTS, S as PROGRESSBAR_DEFAULTS, s as RADIOBUTTON_DEFAULTS, C as SELECT_DEFAULTS, w as TABLE_DEFAULTS, y as TAG_DEFAULTS, _ as TEXTAREA_DEFAULTS, v as TEXTINPUT_DEFAULTS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "20.0.5",
3
+ "version": "20.1.1",
4
4
  "description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo kommune",
@@ -42,7 +42,7 @@
42
42
  "@eslint/eslintrc": "^3.3.5",
43
43
  "@eslint/js": "^10.0.1",
44
44
  "@oslokommune/punkt-assets": "^20.0.5",
45
- "@oslokommune/punkt-css": "^20.0.5",
45
+ "@oslokommune/punkt-css": "^20.1.1",
46
46
  "@testing-library/jest-dom": "^7.0.1",
47
47
  "@testing-library/react": "^16.3.3",
48
48
  "@testing-library/user-event": "^14.6.8",
@@ -102,5 +102,5 @@
102
102
  "url": "https://github.com/oslokommune/punkt/issues"
103
103
  },
104
104
  "license": "MIT",
105
- "gitHead": "ba7d3d4b984bc47db1fe14e1b90938b865d7b264"
105
+ "gitHead": "16b8d7faae1ef12d518f3b8acd96dab7dc4862fd"
106
106
  }
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { type ButtonHTMLAttributes, ForwardedRef, forwardRef } from 'react'
3
- import { ANIMATION_DEFAULT_PATH, type IPktButtonBase } from 'shared-types'
3
+ import { ANIMATION_DEFAULT_PATH, BUTTON_DEFAULTS, type IPktButtonBase } from 'shared-types'
4
4
 
5
5
  import { PktIcon } from '../icon/Icon'
6
6
  declare global {
@@ -23,20 +23,20 @@ export const PktButton = forwardRef(
23
23
  {
24
24
  children,
25
25
  className,
26
- iconName = 'user',
27
- secondIconName = 'user',
26
+ iconName = BUTTON_DEFAULTS.iconName,
27
+ secondIconName = BUTTON_DEFAULTS.secondIconName,
28
28
  iconPath,
29
29
  secondIconPath,
30
- size = 'medium',
31
- fullWidth = false,
32
- fullWidthOnMobile = false,
33
- skin = 'primary',
34
- type = 'button',
35
- variant = 'label-only',
30
+ size = BUTTON_DEFAULTS.size,
31
+ fullWidth = BUTTON_DEFAULTS.fullWidth,
32
+ fullWidthOnMobile = BUTTON_DEFAULTS.fullWidthOnMobile,
33
+ skin = BUTTON_DEFAULTS.skin,
34
+ type = BUTTON_DEFAULTS.type,
35
+ variant = BUTTON_DEFAULTS.variant,
36
36
  state,
37
37
  color,
38
- isLoading = undefined,
39
- disabled = undefined,
38
+ isLoading = BUTTON_DEFAULTS.isLoading,
39
+ disabled = BUTTON_DEFAULTS.disabled,
40
40
  loadingAnimationPath = typeof window !== 'undefined' ? window.pktAnimationPath : ANIMATION_DEFAULT_PATH,
41
41
  ...props
42
42
  }: IPktButton,