@oslokommune/punkt-react 18.3.1 → 18.4.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 +17 -0
- package/dist/components/button/Button.d.ts +2 -15
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +5 -5
- package/dist/shared-types/button.d.ts +45 -0
- package/dist/shared-types/index.d.ts +2 -0
- package/package.json +3 -3
- package/src/components/button/Button.tsx +5 -27
package/dist/punkt-react.js
CHANGED
|
@@ -62,7 +62,7 @@ var M = /* @__PURE__ */ O((/* @__PURE__ */ E(((e, t) => {
|
|
|
62
62
|
return n;
|
|
63
63
|
}) : window.classNames = n;
|
|
64
64
|
})();
|
|
65
|
-
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.
|
|
65
|
+
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.4/icons/";
|
|
66
66
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || N);
|
|
67
67
|
var P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ee = {}, te = 2, ne = 1500, F = typeof Storage < "u" && typeof sessionStorage < "u", re = typeof window < "u" ? d : c, ie = (e, t) => !e || !F ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", ae = (e) => window.pktFetch(e).then((t) => {
|
|
68
68
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -527,7 +527,7 @@ var ge = {
|
|
|
527
527
|
};
|
|
528
528
|
//#endregion
|
|
529
529
|
//#region src/components/button/Button.tsx
|
|
530
|
-
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.
|
|
530
|
+
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.4/animations/");
|
|
531
531
|
var Y = i(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ...y }, b) => {
|
|
532
532
|
let x = [
|
|
533
533
|
t,
|
|
@@ -7075,7 +7075,7 @@ var co = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7075
7075
|
co.displayName = "PktSearchInput";
|
|
7076
7076
|
//#endregion
|
|
7077
7077
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7078
|
-
var lo = "https://punkt-cdn.oslo.kommune.no/18.
|
|
7078
|
+
var lo = "https://punkt-cdn.oslo.kommune.no/18.4/logos/";
|
|
7079
7079
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || lo);
|
|
7080
7080
|
var uo = "pkt-header-global-menu", fo = "pkt-header-global-menu-toggle", po = "pkt-header-global-search-panel", mo = "pkt-header-global-search-toggle", ho = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = ga, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : lo, showSearch: u = !0, searchPlaceholder: h, onSearch: y, showContact: b = !0, user: x, userMenu: S, representing: C, canChangeRepresentation: w = !1, changeRepresentation: T, logOutButtonPlacement: E = "none", logOut: D, position: O = "fixed", scrollBehavior: k = "hide", mobileBreakpoint: A = 768, tabletBreakpoint: j = 1024, onDataLoaded: N, onDataError: P, strings: ee }, te) => {
|
|
7081
7081
|
let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), I = p(N), R = p(P);
|
|
@@ -7432,7 +7432,7 @@ var go = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7432
7432
|
go.displayName = "PktTextinput";
|
|
7433
7433
|
//#endregion
|
|
7434
7434
|
//#region src/components/header/HeaderService.tsx
|
|
7435
|
-
var _o = "https://punkt-cdn.oslo.kommune.no/18.
|
|
7435
|
+
var _o = "https://punkt-cdn.oslo.kommune.no/18.4/logos/";
|
|
7436
7436
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || _o);
|
|
7437
7437
|
var vo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n, className: r, compact: i = !1, "data-mode": a, logOutButtonPlacement: s = "none", logOut: l, openedMenu: u, showSearch: d = !1, onSearch: h, onSearchChange: y, searchValue: b, searchPlaceholder: x, representing: S, serviceLink: C, serviceClick: w, serviceName: T, user: E, userMenu: D, userMenuFooter: O, userOptions: k, canChangeRepresentation: A = !1, changeRepresentation: j, hideLogo: N = !1, logoLink: P = ga, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : _o, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie = "Meny", strings: ae }, oe) => {
|
|
7438
7438
|
let se = F === "hide";
|
|
@@ -7783,7 +7783,7 @@ var wo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
7783
7783
|
};
|
|
7784
7784
|
//#endregion
|
|
7785
7785
|
//#region src/components/loader/Loader.tsx
|
|
7786
|
-
wo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.
|
|
7786
|
+
wo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.4/animations/");
|
|
7787
7787
|
var To = (e) => {
|
|
7788
7788
|
switch (e) {
|
|
7789
7789
|
case "blue": return "spinner-blue";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* button.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-button.
|
|
5
|
+
* Used by React, Elements, and typed component specs.
|
|
6
|
+
*/
|
|
7
|
+
import type { THTMLButtonType } from './form';
|
|
8
|
+
/** Button size variants — shared runtime source for types, specs, and Preview. */
|
|
9
|
+
export declare const BUTTON_SIZES: readonly ['xsmall', 'small', 'medium', 'large'];
|
|
10
|
+
export type TPktButtonSize = (typeof BUTTON_SIZES)[number];
|
|
11
|
+
/** Button skin variants — shared runtime source for types, specs, and Preview. */
|
|
12
|
+
export declare const BUTTON_SKINS: readonly ['primary', 'secondary', 'tertiary'];
|
|
13
|
+
export type TPktButtonSkin = (typeof BUTTON_SKINS)[number];
|
|
14
|
+
/** Button color overrides — shared runtime source for types, specs, and Preview. */
|
|
15
|
+
export declare const BUTTON_COLORS: readonly ['beige-dark-outline', 'beige-light', 'blue-outline', 'blue', 'green-dark-outline', 'green-dark', 'green-outline', 'green', 'red-outline', 'red', 'yellow-outline', 'yellow'];
|
|
16
|
+
export type TPktButtonColor = (typeof BUTTON_COLORS)[number];
|
|
17
|
+
/** Button content variants — shared runtime source for types, specs, and Preview. */
|
|
18
|
+
export declare const BUTTON_VARIANTS: readonly ['label-only', 'icon-left', 'icon-right', 'icon-only', 'icons-right-and-left'];
|
|
19
|
+
export type TPktButtonVariant = (typeof BUTTON_VARIANTS)[number];
|
|
20
|
+
/** Button preview states (docs only) — shared runtime source for types, specs, and Preview. */
|
|
21
|
+
export declare const BUTTON_STATES: readonly ['normal', 'focus', 'hover', 'active'];
|
|
22
|
+
export type TPktButtonState = (typeof BUTTON_STATES)[number];
|
|
23
|
+
/** Button props shared by React and Elements. */
|
|
24
|
+
export interface IPktButtonBase {
|
|
25
|
+
iconName?: string;
|
|
26
|
+
secondIconName?: string;
|
|
27
|
+
iconPath?: string;
|
|
28
|
+
secondIconPath?: string;
|
|
29
|
+
size?: TPktButtonSize;
|
|
30
|
+
fullWidth?: boolean;
|
|
31
|
+
fullWidthOnMobile?: boolean;
|
|
32
|
+
color?: TPktButtonColor;
|
|
33
|
+
skin?: TPktButtonSkin;
|
|
34
|
+
variant?: TPktButtonVariant;
|
|
35
|
+
state?: TPktButtonState;
|
|
36
|
+
type?: THTMLButtonType;
|
|
37
|
+
isLoading?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
loadingAnimationPath?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Documented Button props (subset of `IPktButtonBase`).
|
|
43
|
+
* Used for typed component specs in documentation.
|
|
44
|
+
*/
|
|
45
|
+
export type IButtonSpecProps = Pick<IPktButtonBase, 'size' | 'fullWidth' | 'fullWidthOnMobile' | 'skin' | 'type' | 'color' | 'state' | 'variant' | 'iconName' | 'secondIconName' | 'iconPath' | 'secondIconPath' | 'isLoading' | 'disabled'>;
|
|
@@ -14,6 +14,8 @@ export type { THTMLButtonType, TSelectionMode } from './form';
|
|
|
14
14
|
export type { TPktInputSize, TSize3, TSize5, TSize7 } from './size';
|
|
15
15
|
export { ACCORDION_SKINS } from './accordion';
|
|
16
16
|
export type { TAccordionSkin, IPktAccordionBase, IPktAccordionItemBase, IAccordionSpecProps, IAccordionItemSpecProps, IAccordionVisualProps, } from './accordion';
|
|
17
|
+
export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES } from './button';
|
|
18
|
+
export type { TPktButtonSize, TPktButtonSkin, TPktButtonColor, TPktButtonVariant, TPktButtonState, IPktButtonBase, IButtonSpecProps, } from './button';
|
|
17
19
|
export type { IPktBackLinkBase, IBacklinkSpecProps } from './backlink';
|
|
18
20
|
export { LINKCARD_SKINS } from './linkcard';
|
|
19
21
|
export type { TLinkCardSkin, IPktLinkCardBase, ILinkcardSpecProps } from './linkcard';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.4.0",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@eslint/eslintrc": "^3.3.5",
|
|
46
46
|
"@eslint/js": "^10.0.1",
|
|
47
47
|
"@oslokommune/punkt-assets": "^18.0.0",
|
|
48
|
-
"@oslokommune/punkt-css": "^18.3.
|
|
48
|
+
"@oslokommune/punkt-css": "^18.3.2",
|
|
49
49
|
"@testing-library/jest-dom": "^6.9.1",
|
|
50
50
|
"@testing-library/react": "^16.3.2",
|
|
51
51
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
103
103
|
},
|
|
104
104
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "8d8d40b4df4f0cfb7859b308dfde96a01784d08a"
|
|
106
106
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { type ButtonHTMLAttributes, ForwardedRef, forwardRef } from 'react'
|
|
3
|
+
import type { IPktButtonBase } from 'shared-types'
|
|
3
4
|
|
|
4
5
|
import { PktIcon } from '../icon/Icon'
|
|
5
6
|
declare global {
|
|
@@ -13,33 +14,10 @@ if (typeof window !== 'undefined') {
|
|
|
13
14
|
window.pktAnimationPath || 'https://punkt-cdn.oslo.kommune.no/latest/animations/'
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
secondIconPath?: string
|
|
21
|
-
mode?: 'light' | 'dark'
|
|
22
|
-
size?: 'xsmall' | 'small' | 'medium' | 'large'
|
|
23
|
-
fullWidth?: boolean
|
|
24
|
-
fullWidthOnMobile?: boolean
|
|
25
|
-
color?:
|
|
26
|
-
| 'blue'
|
|
27
|
-
| 'blue-outline'
|
|
28
|
-
| 'green'
|
|
29
|
-
| 'green-outline'
|
|
30
|
-
| 'green-dark'
|
|
31
|
-
| 'green-dark-outline'
|
|
32
|
-
| 'beige-light'
|
|
33
|
-
| 'beige-dark-outline'
|
|
34
|
-
| 'yellow'
|
|
35
|
-
| 'yellow-outline'
|
|
36
|
-
| 'red'
|
|
37
|
-
| 'red-outline'
|
|
38
|
-
skin?: 'primary' | 'secondary' | 'tertiary'
|
|
39
|
-
variant?: 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left'
|
|
40
|
-
state?: 'normal' | 'focus' | 'hover' | 'active'
|
|
41
|
-
type?: 'button' | 'submit' | 'reset'
|
|
42
|
-
isLoading?: boolean
|
|
17
|
+
|
|
18
|
+
export interface IPktButton
|
|
19
|
+
extends IPktButtonBase,
|
|
20
|
+
Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'disabled' | 'color'> {
|
|
43
21
|
loadingAnimationPath?: string
|
|
44
22
|
}
|
|
45
23
|
|