@oslokommune/punkt-react 3.4.1 → 3.4.2
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 +18 -0
- package/dist/alert/Alert.d.ts +1 -1
- package/dist/punkt-react.es.js +106 -104
- package/dist/punkt-react.umd.js +7 -7
- package/package.json +3 -2
- package/src/components/alert/Alert.test.tsx +38 -0
- package/src/components/alert/Alert.tsx +6 -4
- package/src/components/button/Button.test.tsx +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [3.4.2](https://github.com/oslokommune/punkt/compare/3.4.1...3.4.2) (2023-05-04)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
* [825](https://github.com/oslokommune/punkt/issues/825) Ref og tester i button og alert.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [3.4.1](https://github.com/oslokommune/punkt/compare/3.4.0...3.4.1) (2023-05-04)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/alert/Alert.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export interface IPktAlert extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
date?: string;
|
|
8
8
|
ariaLive?: 'off' | 'polite' | 'assertive';
|
|
9
9
|
}
|
|
10
|
-
export declare const PktAlert: React.
|
|
10
|
+
export declare const PktAlert: React.ForwardRefExoticComponent<IPktAlert & React.RefAttributes<HTMLDivElement>>;
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import te, { forwardRef as G, useState as dr } from "react";
|
|
2
|
+
var L = {}, pr = {
|
|
3
3
|
get exports() {
|
|
4
|
-
return
|
|
4
|
+
return L;
|
|
5
5
|
},
|
|
6
6
|
set exports(i) {
|
|
7
|
-
|
|
7
|
+
L = i;
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, W = {};
|
|
10
10
|
/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-jsx-runtime.production.min.js
|
|
@@ -19,22 +19,22 @@ var Y = {}, pr = {
|
|
|
19
19
|
var we;
|
|
20
20
|
function vr() {
|
|
21
21
|
if (we)
|
|
22
|
-
return
|
|
22
|
+
return W;
|
|
23
23
|
we = 1;
|
|
24
|
-
var i =
|
|
24
|
+
var i = te, c = Symbol.for("react.element"), s = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, p = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
25
25
|
function _(k, m, x) {
|
|
26
|
-
var g, P = {}, w = null,
|
|
27
|
-
x !== void 0 && (w = "" + x), m.key !== void 0 && (w = "" + m.key), m.ref !== void 0 && (
|
|
26
|
+
var g, P = {}, w = null, j = null;
|
|
27
|
+
x !== void 0 && (w = "" + x), m.key !== void 0 && (w = "" + m.key), m.ref !== void 0 && (j = m.ref);
|
|
28
28
|
for (g in m)
|
|
29
29
|
l.call(m, g) && !f.hasOwnProperty(g) && (P[g] = m[g]);
|
|
30
30
|
if (k && k.defaultProps)
|
|
31
31
|
for (g in m = k.defaultProps, m)
|
|
32
32
|
P[g] === void 0 && (P[g] = m[g]);
|
|
33
|
-
return { $$typeof: c, type: k, key: w, ref:
|
|
33
|
+
return { $$typeof: c, type: k, key: w, ref: j, props: P, _owner: p.current };
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return W.Fragment = s, W.jsx = _, W.jsxs = _, W;
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var Y = {};
|
|
38
38
|
/**
|
|
39
39
|
* @license React
|
|
40
40
|
* react-jsx-runtime.development.js
|
|
@@ -47,14 +47,14 @@ var W = {};
|
|
|
47
47
|
var Oe;
|
|
48
48
|
function mr() {
|
|
49
49
|
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
50
|
-
var i =
|
|
50
|
+
var i = te, c = Symbol.for("react.element"), s = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), k = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), P = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), ae = Symbol.iterator, Ce = "@@iterator";
|
|
51
51
|
function je(e) {
|
|
52
52
|
if (e === null || typeof e != "object")
|
|
53
53
|
return null;
|
|
54
54
|
var r = ae && e[ae] || e[Ce];
|
|
55
55
|
return typeof r == "function" ? r : null;
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var F = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
58
58
|
function E(e) {
|
|
59
59
|
{
|
|
60
60
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
|
|
@@ -64,7 +64,7 @@ function mr() {
|
|
|
64
64
|
}
|
|
65
65
|
function Fe(e, r, t) {
|
|
66
66
|
{
|
|
67
|
-
var a =
|
|
67
|
+
var a = F.ReactDebugCurrentFrame, d = a.getStackAddendum();
|
|
68
68
|
d !== "" && (r += "%s", t = t.concat([d]));
|
|
69
69
|
var v = t.map(function(u) {
|
|
70
70
|
return String(u);
|
|
@@ -75,7 +75,7 @@ function mr() {
|
|
|
75
75
|
var De = !1, Ae = !1, $e = !1, Ie = !1, We = !1, ne;
|
|
76
76
|
ne = Symbol.for("react.module.reference");
|
|
77
77
|
function Ye(e) {
|
|
78
|
-
return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || We || e === p || e === x || e === g || Ie || e ===
|
|
78
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || We || e === p || e === x || e === g || Ie || e === j || De || Ae || $e || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === P || e.$$typeof === _ || e.$$typeof === k || e.$$typeof === m || // This needs to include all possible module reference object
|
|
79
79
|
// types supported by any Flight configuration anywhere since
|
|
80
80
|
// we don't know which Flight build this will end up being used
|
|
81
81
|
// with.
|
|
@@ -136,13 +136,13 @@ function mr() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var C = Object.assign,
|
|
139
|
+
var C = Object.assign, $ = 0, oe, se, le, ce, ue, fe, de;
|
|
140
140
|
function pe() {
|
|
141
141
|
}
|
|
142
142
|
pe.__reactDisabledLog = !0;
|
|
143
143
|
function Be() {
|
|
144
144
|
{
|
|
145
|
-
if (
|
|
145
|
+
if ($ === 0) {
|
|
146
146
|
oe = console.log, se = console.info, le = console.warn, ce = console.error, ue = console.group, fe = console.groupCollapsed, de = console.groupEnd;
|
|
147
147
|
var e = {
|
|
148
148
|
configurable: !0,
|
|
@@ -160,12 +160,12 @@ function mr() {
|
|
|
160
160
|
groupEnd: e
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
$++;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
function Me() {
|
|
167
167
|
{
|
|
168
|
-
if (
|
|
168
|
+
if ($--, $ === 0) {
|
|
169
169
|
var e = {
|
|
170
170
|
configurable: !0,
|
|
171
171
|
enumerable: !0,
|
|
@@ -195,30 +195,30 @@ function mr() {
|
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
$ < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var J = F.ReactCurrentDispatcher, z;
|
|
202
202
|
function B(e, r, t) {
|
|
203
203
|
{
|
|
204
|
-
if (
|
|
204
|
+
if (z === void 0)
|
|
205
205
|
try {
|
|
206
206
|
throw Error();
|
|
207
207
|
} catch (d) {
|
|
208
208
|
var a = d.stack.trim().match(/\n( *(at )?)/);
|
|
209
|
-
|
|
209
|
+
z = a && a[1] || "";
|
|
210
210
|
}
|
|
211
211
|
return `
|
|
212
|
-
` +
|
|
212
|
+
` + z + e;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
var
|
|
215
|
+
var H = !1, M;
|
|
216
216
|
{
|
|
217
217
|
var Ve = typeof WeakMap == "function" ? WeakMap : Map;
|
|
218
218
|
M = new Ve();
|
|
219
219
|
}
|
|
220
220
|
function ve(e, r) {
|
|
221
|
-
if (!e ||
|
|
221
|
+
if (!e || H)
|
|
222
222
|
return "";
|
|
223
223
|
{
|
|
224
224
|
var t = M.get(e);
|
|
@@ -226,11 +226,11 @@ function mr() {
|
|
|
226
226
|
return t;
|
|
227
227
|
}
|
|
228
228
|
var a;
|
|
229
|
-
|
|
229
|
+
H = !0;
|
|
230
230
|
var d = Error.prepareStackTrace;
|
|
231
231
|
Error.prepareStackTrace = void 0;
|
|
232
232
|
var v;
|
|
233
|
-
v =
|
|
233
|
+
v = J.current, J.current = null, Be();
|
|
234
234
|
try {
|
|
235
235
|
if (r) {
|
|
236
236
|
var u = function() {
|
|
@@ -283,9 +283,9 @@ function mr() {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
|
|
286
|
+
H = !1, J.current = v, Me(), Error.prepareStackTrace = d;
|
|
287
287
|
}
|
|
288
|
-
var
|
|
288
|
+
var A = e ? e.displayName || e.name : "", Te = A ? B(A) : "";
|
|
289
289
|
return typeof e == "function" && M.set(e, Te), Te;
|
|
290
290
|
}
|
|
291
291
|
function Ue(e, r, t) {
|
|
@@ -324,7 +324,7 @@ function mr() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var U = Object.prototype.hasOwnProperty, me = {}, he =
|
|
327
|
+
var U = Object.prototype.hasOwnProperty, me = {}, he = F.ReactDebugCurrentFrame;
|
|
328
328
|
function q(e) {
|
|
329
329
|
if (e) {
|
|
330
330
|
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
@@ -352,7 +352,7 @@ function mr() {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
var Je = Array.isArray;
|
|
355
|
-
function
|
|
355
|
+
function K(e) {
|
|
356
356
|
return Je(e);
|
|
357
357
|
}
|
|
358
358
|
function ze(e) {
|
|
@@ -375,13 +375,13 @@ function mr() {
|
|
|
375
375
|
if (He(e))
|
|
376
376
|
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(e)), be(e);
|
|
377
377
|
}
|
|
378
|
-
var
|
|
378
|
+
var I = F.ReactCurrentOwner, Ke = {
|
|
379
379
|
key: !0,
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
382
382
|
__source: !0
|
|
383
|
-
}, ke, ge,
|
|
384
|
-
|
|
383
|
+
}, ke, ge, X;
|
|
384
|
+
X = {};
|
|
385
385
|
function Xe(e) {
|
|
386
386
|
if (U.call(e, "ref")) {
|
|
387
387
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
@@ -399,9 +399,9 @@ function mr() {
|
|
|
399
399
|
return e.key !== void 0;
|
|
400
400
|
}
|
|
401
401
|
function Qe(e, r) {
|
|
402
|
-
if (typeof e.ref == "string" &&
|
|
403
|
-
var t = O(
|
|
404
|
-
|
|
402
|
+
if (typeof e.ref == "string" && I.current && r && I.current.stateNode !== r) {
|
|
403
|
+
var t = O(I.current.type);
|
|
404
|
+
X[t] || (E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', O(I.current.type), e.ref), X[t] = !0);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
function er(e, r) {
|
|
@@ -470,26 +470,26 @@ function mr() {
|
|
|
470
470
|
var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
471
471
|
o && er(u, b), R && rr(u, b);
|
|
472
472
|
}
|
|
473
|
-
return tr(e, o, R, d, a,
|
|
473
|
+
return tr(e, o, R, d, a, I.current, u);
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
var
|
|
477
|
-
function
|
|
476
|
+
var Z = F.ReactCurrentOwner, ye = F.ReactDebugCurrentFrame;
|
|
477
|
+
function D(e) {
|
|
478
478
|
if (e) {
|
|
479
479
|
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
480
480
|
ye.setExtraStackFrame(t);
|
|
481
481
|
} else
|
|
482
482
|
ye.setExtraStackFrame(null);
|
|
483
483
|
}
|
|
484
|
-
var
|
|
485
|
-
|
|
486
|
-
function
|
|
484
|
+
var Q;
|
|
485
|
+
Q = !1;
|
|
486
|
+
function ee(e) {
|
|
487
487
|
return typeof e == "object" && e !== null && e.$$typeof === c;
|
|
488
488
|
}
|
|
489
489
|
function Ee() {
|
|
490
490
|
{
|
|
491
|
-
if (
|
|
492
|
-
var e = O(
|
|
491
|
+
if (Z.current) {
|
|
492
|
+
var e = O(Z.current.type);
|
|
493
493
|
if (e)
|
|
494
494
|
return `
|
|
495
495
|
|
|
@@ -532,25 +532,25 @@ Check the top-level render call using <` + t + ">.");
|
|
|
532
532
|
return;
|
|
533
533
|
Re[t] = !0;
|
|
534
534
|
var a = "";
|
|
535
|
-
e && e._owner && e._owner !==
|
|
535
|
+
e && e._owner && e._owner !== Z.current && (a = " It was passed a child from " + O(e._owner.type) + "."), D(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), D(null);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
function Ne(e, r) {
|
|
539
539
|
{
|
|
540
540
|
if (typeof e != "object")
|
|
541
541
|
return;
|
|
542
|
-
if (
|
|
542
|
+
if (K(e))
|
|
543
543
|
for (var t = 0; t < e.length; t++) {
|
|
544
544
|
var a = e[t];
|
|
545
|
-
|
|
545
|
+
ee(a) && xe(a, r);
|
|
546
546
|
}
|
|
547
|
-
else if (
|
|
547
|
+
else if (ee(e))
|
|
548
548
|
e._store && (e._store.validated = !0);
|
|
549
549
|
else if (e) {
|
|
550
550
|
var d = je(e);
|
|
551
551
|
if (typeof d == "function" && d !== e.entries)
|
|
552
552
|
for (var v = d.call(e), u; !(u = v.next()).done; )
|
|
553
|
-
|
|
553
|
+
ee(u.value) && xe(u.value, r);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -571,8 +571,8 @@ Check the top-level render call using <` + t + ">.");
|
|
|
571
571
|
if (t) {
|
|
572
572
|
var a = O(r);
|
|
573
573
|
Ge(t, e.props, "prop", a, e);
|
|
574
|
-
} else if (r.PropTypes !== void 0 && !
|
|
575
|
-
|
|
574
|
+
} else if (r.PropTypes !== void 0 && !Q) {
|
|
575
|
+
Q = !0;
|
|
576
576
|
var d = O(r);
|
|
577
577
|
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
|
|
578
578
|
}
|
|
@@ -584,11 +584,11 @@ Check the top-level render call using <` + t + ">.");
|
|
|
584
584
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
585
585
|
var a = r[t];
|
|
586
586
|
if (a !== "children" && a !== "key") {
|
|
587
|
-
|
|
587
|
+
D(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), D(null);
|
|
588
588
|
break;
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
e.ref !== null && (
|
|
591
|
+
e.ref !== null && (D(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
function Pe(e, r, t, a, d, v) {
|
|
@@ -600,7 +600,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
600
600
|
var R = nr(d);
|
|
601
601
|
R ? o += R : o += Ee();
|
|
602
602
|
var h;
|
|
603
|
-
e === null ? h = "null" :
|
|
603
|
+
e === null ? h = "null" : K(e) ? h = "array" : e !== void 0 && e.$$typeof === c ? (h = "<" + (O(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : h = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", h, o);
|
|
604
604
|
}
|
|
605
605
|
var b = ar(e, r, t, d, v);
|
|
606
606
|
if (b == null)
|
|
@@ -609,9 +609,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
609
609
|
var N = r.children;
|
|
610
610
|
if (N !== void 0)
|
|
611
611
|
if (a)
|
|
612
|
-
if (
|
|
613
|
-
for (var
|
|
614
|
-
Ne(N[
|
|
612
|
+
if (K(N)) {
|
|
613
|
+
for (var A = 0; A < N.length; A++)
|
|
614
|
+
Ne(N[A], e);
|
|
615
615
|
Object.freeze && Object.freeze(N);
|
|
616
616
|
} else
|
|
617
617
|
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -628,13 +628,13 @@ Check the top-level render call using <` + t + ">.");
|
|
|
628
628
|
return Pe(e, r, t, !1);
|
|
629
629
|
}
|
|
630
630
|
var ur = cr, fr = lr;
|
|
631
|
-
|
|
632
|
-
}()),
|
|
631
|
+
Y.Fragment = l, Y.jsx = ur, Y.jsxs = fr;
|
|
632
|
+
}()), Y;
|
|
633
633
|
}
|
|
634
634
|
(function(i) {
|
|
635
635
|
process.env.NODE_ENV === "production" ? i.exports = vr() : i.exports = mr();
|
|
636
636
|
})(pr);
|
|
637
|
-
const Se =
|
|
637
|
+
const Se = L.Fragment, n = L.jsx, y = L.jsxs, T = ({
|
|
638
638
|
className: i,
|
|
639
639
|
name: c,
|
|
640
640
|
viewBox: s = "0 0 32 32",
|
|
@@ -642,40 +642,42 @@ const Se = Y.Fragment, n = Y.jsx, y = Y.jsxs, T = ({
|
|
|
642
642
|
}) => {
|
|
643
643
|
const p = [i].filter(Boolean).join(" ");
|
|
644
644
|
return /* @__PURE__ */ n("svg", { ...l, className: p, viewBox: s, children: /* @__PURE__ */ n("use", { href: `#${c}` }) });
|
|
645
|
-
}, xr = (
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
P(!
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
/* @__PURE__ */
|
|
661
|
-
|
|
662
|
-
"
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
"
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}
|
|
645
|
+
}, xr = G(
|
|
646
|
+
({
|
|
647
|
+
children: i,
|
|
648
|
+
className: c,
|
|
649
|
+
skin: s = "info",
|
|
650
|
+
closeAlert: l = !1,
|
|
651
|
+
onClose: p,
|
|
652
|
+
title: f,
|
|
653
|
+
date: _,
|
|
654
|
+
ariaLive: k = "polite",
|
|
655
|
+
...m
|
|
656
|
+
}, x) => {
|
|
657
|
+
const g = [c, "pkt-alert", s && `pkt-alert--${s}`].filter(Boolean).join(" "), [P, w] = dr(!0), j = () => {
|
|
658
|
+
w(!1), p && p();
|
|
659
|
+
};
|
|
660
|
+
return P ? /* @__PURE__ */ y("div", { ...m, className: g, "aria-live": k, ref: x, children: [
|
|
661
|
+
/* @__PURE__ */ n("div", { className: "pkt-alert__icon", children: /* @__PURE__ */ n(T, { name: s === "info" ? "alert-information" : `alert-${s}` }) }),
|
|
662
|
+
l && /* @__PURE__ */ n("div", { className: "pkt-alert__close", children: /* @__PURE__ */ n(
|
|
663
|
+
"button",
|
|
664
|
+
{
|
|
665
|
+
className: "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",
|
|
666
|
+
tabIndex: 0,
|
|
667
|
+
"aria-label": "close",
|
|
668
|
+
onClick: j,
|
|
669
|
+
children: /* @__PURE__ */ n(T, { name: "close", className: "pkt-btn__icon", "aria-hidden": "true" })
|
|
670
|
+
}
|
|
671
|
+
) }),
|
|
672
|
+
f && /* @__PURE__ */ n("div", { className: "pkt-alert__title", children: f }),
|
|
673
|
+
/* @__PURE__ */ n("div", { className: "pkt-alert__text", children: i }),
|
|
674
|
+
_ && /* @__PURE__ */ y("div", { className: "pkt-alert__date", children: [
|
|
675
|
+
"Sist oppdatert: ",
|
|
676
|
+
_
|
|
677
|
+
] })
|
|
678
|
+
] }) : null;
|
|
679
|
+
}
|
|
680
|
+
), hr = G(
|
|
679
681
|
({
|
|
680
682
|
children: i,
|
|
681
683
|
className: c,
|
|
@@ -769,7 +771,7 @@ const Nr = ({
|
|
|
769
771
|
)
|
|
770
772
|
] })
|
|
771
773
|
] });
|
|
772
|
-
}, br =
|
|
774
|
+
}, br = te.forwardRef(
|
|
773
775
|
({ label: i, id: c, children: s, ...l }, p) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
774
776
|
/* @__PURE__ */ n("label", { htmlFor: c, className: "pkt-form-label", children: i }),
|
|
775
777
|
/* @__PURE__ */ n("input", { className: "pkt-form-input", id: c, ...l, ref: p }),
|
|
@@ -804,7 +806,7 @@ const Pr = ({
|
|
|
804
806
|
/* @__PURE__ */ n("div", { className: "pkt-messagebox__title", children: s }),
|
|
805
807
|
/* @__PURE__ */ n("div", { className: "pkt-messagebox__text", children: i })
|
|
806
808
|
] });
|
|
807
|
-
}, _r =
|
|
809
|
+
}, _r = G(
|
|
808
810
|
({ id: i, name: c, label: s, value: l, ...p }, f) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
809
811
|
/* @__PURE__ */ n("input", { type: "radio", className: "pkt-form-check-input", id: i, name: c, value: l, ref: f, ...p }),
|
|
810
812
|
/* @__PURE__ */ n("label", { className: "pkt-form-label", htmlFor: i, children: s })
|
|
@@ -815,12 +817,12 @@ const wr = ({ label: i, children: c }) => /* @__PURE__ */ y(Se, { children: [
|
|
|
815
817
|
/* @__PURE__ */ n("p", { children: i }),
|
|
816
818
|
/* @__PURE__ */ n("div", { className: "pkt-form-group", children: c })
|
|
817
819
|
] });
|
|
818
|
-
var
|
|
820
|
+
var re = {}, kr = {
|
|
819
821
|
get exports() {
|
|
820
|
-
return
|
|
822
|
+
return re;
|
|
821
823
|
},
|
|
822
824
|
set exports(i) {
|
|
823
|
-
|
|
825
|
+
re = i;
|
|
824
826
|
}
|
|
825
827
|
};
|
|
826
828
|
/*!
|
|
@@ -858,7 +860,7 @@ var ee = {}, kr = {
|
|
|
858
860
|
i.exports ? (s.default = s, i.exports = s) : window.classNames = s;
|
|
859
861
|
})();
|
|
860
862
|
})(kr);
|
|
861
|
-
const gr =
|
|
863
|
+
const gr = re, yr = ({ isResponsive: i, children: c }) => i ? /* @__PURE__ */ n("div", { className: "pkt-table-container", children: c }) : /* @__PURE__ */ n(Se, { children: c }), Or = ({
|
|
862
864
|
isResponsive: i,
|
|
863
865
|
modifiers: { info: c = !1, success: s = !1, strong: l = !1, shadow: p = !1 } = {},
|
|
864
866
|
children: f
|
|
@@ -873,7 +875,7 @@ const gr = ee, yr = ({ isResponsive: i, children: c }) => i ? /* @__PURE__ */ n(
|
|
|
873
875
|
}),
|
|
874
876
|
children: f
|
|
875
877
|
}
|
|
876
|
-
) }), Sr = ({ children: i }) => /* @__PURE__ */ n("td", { className: "pkt-table__th", children: i }), Cr = ({ children: i }) => /* @__PURE__ */ n("th", { className: "pkt-table__th", children: i }), Er =
|
|
878
|
+
) }), Sr = ({ children: i }) => /* @__PURE__ */ n("td", { className: "pkt-table__th", children: i }), Cr = ({ children: i }) => /* @__PURE__ */ n("th", { className: "pkt-table__th", children: i }), Er = G(
|
|
877
879
|
({ id: i, label: c, ...s }, l) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
878
880
|
/* @__PURE__ */ n("label", { htmlFor: i, className: "pkt-form-label", children: c }),
|
|
879
881
|
/* @__PURE__ */ n("textarea", { className: "pkt-form-textarea", id: i, ref: l, ...s })
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(_,
|
|
1
|
+
(function(_,T){typeof exports=="object"&&typeof module<"u"?T(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],T):(_=typeof globalThis<"u"?globalThis:_||self,T(_["punkt-react"]={},_.React))})(this,function(_,T){"use strict";var Y={},Ae={get exports(){return Y},set exports(i){Y=i}},L={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ae;function Ie(){if(ae)return
|
|
9
|
+
*/var ae;function Ie(){if(ae)return L;ae=1;var i=T,c=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,p=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function k(g,m,N){var y,x={},O=null,F=null;N!==void 0&&(O=""+N),m.key!==void 0&&(O=""+m.key),m.ref!==void 0&&(F=m.ref);for(y in m)l.call(m,y)&&!f.hasOwnProperty(y)&&(x[y]=m[y]);if(g&&g.defaultProps)for(y in m=g.defaultProps,m)x[y]===void 0&&(x[y]=m[y]);return{$$typeof:c,type:g,key:O,ref:F,props:x,_owner:p.current}}return L.Fragment=s,L.jsx=k,L.jsxs=k,L}var B={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ne;function We(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var i=
|
|
17
|
+
*/var ne;function We(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var i=T,c=Symbol.for("react.element"),s=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),g=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),F=Symbol.for("react.offscreen"),ue=Symbol.iterator,Ke="@@iterator";function Xe(e){if(e===null||typeof e!="object")return null;var r=ue&&e[ue]||e[Ke];return typeof r=="function"?r:null}var A=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];qe("error",e,t)}}function qe(e,r,t){{var n=A.ReactDebugCurrentFrame,d=n.getStackAddendum();d!==""&&(r+="%s",t=t.concat([d]));var v=t.map(function(u){return String(u)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var Ze=!1,Qe=!1,er=!1,rr=!1,tr=!1,fe;fe=Symbol.for("react.module.reference");function ar(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===f||tr||e===p||e===N||e===y||rr||e===F||Ze||Qe||er||typeof e=="object"&&e!==null&&(e.$$typeof===O||e.$$typeof===x||e.$$typeof===k||e.$$typeof===g||e.$$typeof===m||e.$$typeof===fe||e.getModuleId!==void 0))}function nr(e,r,t){var n=e.displayName;if(n)return n;var d=r.displayName||r.name||"";return d!==""?t+"("+d+")":t}function de(e){return e.displayName||"Context"}function C(e){if(e==null)return null;if(typeof e.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case l:return"Fragment";case s:return"Portal";case f:return"Profiler";case p:return"StrictMode";case N:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case g:var r=e;return de(r)+".Consumer";case k:var t=e;return de(t._context)+".Provider";case m:return nr(e,e.render,"ForwardRef");case x:var n=e.displayName||null;return n!==null?n:C(e.type)||"Memo";case O:{var d=e,v=d._payload,u=d._init;try{return C(u(v))}catch{return null}}}return null}var D=Object.assign,M=0,pe,ve,me,he,be,_e,ke;function ge(){}ge.__reactDisabledLog=!0;function ir(){{if(M===0){pe=console.log,ve=console.info,me=console.warn,he=console.error,be=console.group,_e=console.groupCollapsed,ke=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ge,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function or(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:pe}),info:D({},e,{value:ve}),warn:D({},e,{value:me}),error:D({},e,{value:he}),group:D({},e,{value:be}),groupCollapsed:D({},e,{value:_e}),groupEnd:D({},e,{value:ke})})}M<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,X;function V(e,r,t){{if(X===void 0)try{throw Error()}catch(d){var n=d.stack.trim().match(/\n( *(at )?)/);X=n&&n[1]||""}return`
|
|
18
18
|
`+X+e}}var q=!1,U;{var sr=typeof WeakMap=="function"?WeakMap:Map;U=new sr}function ye(e,r){if(!e||q)return"";{var t=U.get(e);if(t!==void 0)return t}var n;q=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=K.current,K.current=null,ir();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(j){n=j}Reflect.construct(e,[],u)}else{try{u.call()}catch(j){n=j}e.call(u.prototype)}}else{try{throw Error()}catch(j){n=j}e()}}catch(j){if(j&&n&&typeof j.stack=="string"){for(var o=j.stack.split(`
|
|
19
19
|
`),P=n.stack.split(`
|
|
20
|
-
`),h=o.length-1,b=P.length-1;h>=1&&b>=0&&o[h]!==P[b];)b--;for(;h>=1&&b>=0;h--,b--)if(o[h]!==P[b]){if(h!==1||b!==1)do if(h--,b--,b<0||o[h]!==P[b]){var
|
|
21
|
-
`+o[h].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),h=o.length-1,b=P.length-1;h>=1&&b>=0&&o[h]!==P[b];)b--;for(;h>=1&&b>=0;h--,b--)if(o[h]!==P[b]){if(h!==1||b!==1)do if(h--,b--,b<0||o[h]!==P[b]){var w=`
|
|
21
|
+
`+o[h].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,w),w}while(h>=1&&b>=0);break}}}finally{q=!1,K.current=v,or(),Error.prepareStackTrace=d}var W=e?e.displayName||e.name:"",Fe=W?V(W):"";return typeof e=="function"&&U.set(e,Fe),Fe}function lr(e,r,t){return ye(e,!1)}function cr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function G(e,r,t){if(e==null)return"";if(typeof e=="function")return ye(e,cr(e));if(typeof e=="string")return V(e);switch(e){case N:return V("Suspense");case y:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case m:return lr(e.render);case x:return G(e.type,r,t);case O:{var n=e,d=n._payload,v=n._init;try{return G(v(d),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Re={},Ee=A.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}function ur(e,r,t,n,d){{var v=Function.call.bind(H);for(var u in e)if(v(e,u)){var o=void 0;try{if(typeof e[u]!="function"){var P=Error((n||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}o=e[u](r,u,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){o=h}o&&!(o instanceof Error)&&(J(d),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,u,typeof o),J(null)),o instanceof Error&&!(o.message in Re)&&(Re[o.message]=!0,J(d),E("Failed %s type: %s",t,o.message),J(null))}}}var fr=Array.isArray;function Z(e){return fr(e)}function dr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function pr(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function Te(e){if(pr(e))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",dr(e)),Pe(e)}var $=A.ReactCurrentOwner,vr={key:!0,ref:!0,__self:!0,__source:!0},Ne,we,Q;Q={};function mr(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function hr(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function br(e,r){if(typeof e.ref=="string"&&$.current&&r&&$.current.stateNode!==r){var t=C($.current.type);Q[t]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',C($.current.type),e.ref),Q[t]=!0)}}function _r(e,r){{var t=function(){Ne||(Ne=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function kr(e,r){{var t=function(){we||(we=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var gr=function(e,r,t,n,d,v,u){var o={$$typeof:c,type:e,key:r,ref:t,props:u,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function yr(e,r,t,n,d){{var v,u={},o=null,P=null;t!==void 0&&(Te(t),o=""+t),hr(r)&&(Te(r.key),o=""+r.key),mr(r)&&(P=r.ref,br(r,d));for(v in r)H.call(r,v)&&!vr.hasOwnProperty(v)&&(u[v]=r[v]);if(e&&e.defaultProps){var h=e.defaultProps;for(v in h)u[v]===void 0&&(u[v]=h[v])}if(o||P){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&_r(u,b),P&&kr(u,b)}return gr(e,o,P,d,n,$.current,u)}}var ee=A.ReactCurrentOwner,xe=A.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}var re;re=!1;function te(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function Se(){{if(ee.current){var e=C(ee.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function Rr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+r+":"+t+"."}return""}}var Oe={};function Er(e){{var r=Se();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+t+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Er(r);if(Oe[t])return;Oe[t]=!0;var n="";e&&e._owner&&e._owner!==ee.current&&(n=" It was passed a child from "+C(e._owner.type)+"."),
|
|
27
|
+
Check the top-level render call using <`+t+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=Er(r);if(Oe[t])return;Oe[t]=!0;var n="";e&&e._owner&&e._owner!==ee.current&&(n=" It was passed a child from "+C(e._owner.type)+"."),I(e),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function je(e,r){{if(typeof e!="object")return;if(Z(e))for(var t=0;t<e.length;t++){var n=e[t];te(n)&&Ce(n,r)}else if(te(e))e._store&&(e._store.validated=!0);else if(e){var d=Xe(e);if(typeof d=="function"&&d!==e.entries)for(var v=d.call(e),u;!(u=v.next()).done;)te(u.value)&&Ce(u.value,r)}}}function Pr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===x))t=r.propTypes;else return;if(t){var n=C(r);ur(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!re){re=!0;var d=C(r);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function De(e,r,t,n,d,v){{var u=ar(e);if(!u){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=Rr(d);P?o+=P:o+=Se();var h;e===null?h="null":Z(e)?h="array":e!==void 0&&e.$$typeof===c?(h="<"+(C(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,o)}var b=yr(e,r,t,d,v);if(b==null)return b;if(u){var w=r.children;if(w!==void 0)if(n)if(Z(w)){for(var W=0;W<w.length;W++)je(w[W],e);Object.freeze&&Object.freeze(w)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else je(w,e)}return e===l?Tr(b):Pr(b),b}}function Nr(e,r,t){return De(e,r,t,!0)}function wr(e,r,t){return De(e,r,t,!1)}var xr=wr,Sr=Nr;B.Fragment=l,B.jsx=xr,B.jsxs=Sr}()),B}(function(i){process.env.NODE_ENV==="production"?i.exports=Ie():i.exports=We()})(Ae);const ie=Y.Fragment,a=Y.jsx,R=Y.jsxs,S=({className:i,name:c,viewBox:s="0 0 32 32",...l})=>{const p=[i].filter(Boolean).join(" ");return a("svg",{...l,className:p,viewBox:s,children:a("use",{href:`#${c}`})})},Ye=T.forwardRef(({children:i,className:c,skin:s="info",closeAlert:l=!1,onClose:p,title:f,date:k,ariaLive:g="polite",...m},N)=>{const y=[c,"pkt-alert",s&&`pkt-alert--${s}`].filter(Boolean).join(" "),[x,O]=T.useState(!0),F=()=>{O(!1),p&&p()};return x?R("div",{...m,className:y,"aria-live":g,ref:N,children:[a("div",{className:"pkt-alert__icon",children:a(S,{name:s==="info"?"alert-information":`alert-${s}`})}),l&&a("div",{className:"pkt-alert__close",children:a("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",tabIndex:0,"aria-label":"close",onClick:F,children:a(S,{name:"close",className:"pkt-btn__icon","aria-hidden":"true"})})}),f&&a("div",{className:"pkt-alert__title",children:f}),a("div",{className:"pkt-alert__text",children:i}),k&&R("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",k]})]}):null}),oe=T.forwardRef(({children:i,className:c,iconName:s="user",secondIconName:l="user",size:p="medium",skin:f="primary",type:k="button",variant:g="label-only",...m},N)=>{const y=[c,"pkt-btn",p&&`pkt-btn--${p}`,f&&`pkt-btn--${f}`,g&&`pkt-btn--${g}`].filter(Boolean).join(" ");return R("button",{...m,className:y,type:k,ref:N,children:[a(S,{className:"pkt-btn__icon",name:s}),a("span",{className:"pkt-btn__text",children:i}),g==="icons-right-and-left"&&a(S,{className:"pkt-btn__icon",name:l})]})});oe.displayName="PktButton";const Le=({className:i,logoLink:c="https://www.oslo.kommune.no/",isLoggedIn:s=!1,representing:l="",canChangeRepresentation:p=!1,showLogInButton:f=!0,onLogIn:k,onLogOut:g,onChangeRepresentation:m})=>{const N=[i,"pkt-header"].filter(Boolean).join(" ");return R("header",{id:"pkt-header",className:N,"aria-label":"Topp",children:[a("div",{className:"pkt-header__logo",children:a("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:c,children:a(S,{name:"oslologo",className:"pkt-header__logo-svg",viewBox:"0 0 60 31","aria-hidden":"true"})})}),R("div",{className:"pkt-header__actions",children:[s&&p&&R("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${l}`,onClick:m,children:[a(S,{name:"user",className:"pkt-btn__icon pkt-show-tablet-up"}),a("span",{className:"pkt-header__action-change pkt-hide pkt-show-tablet-up ml-size-15",children:"Endre"}),a("span",{className:"pkt-btn__text pkt-hide-tablet-up",children:"Endre"}),a("span",{className:"pkt-btn__text--representing pkt-hide pkt-show-tablet-up",children:l})]}),s&&!p&&R("div",{className:"pkt-header__action",children:[a("span",{className:"pkt-header__action-text",children:a("span",{className:"pkt-btn__text pkt-header__action-textrow text-row-inline pkt-truncate-text",children:l})}),a("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:a(S,{name:"user"})})]}),f&&s&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:g,children:[a(S,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),a("span",{className:"pkt-btn__text",children:"Logg ut"})]}),f&&!s&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:k,children:[a(S,{className:"pkt-btn__icon",name:"user"}),a("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},se=T.forwardRef(({label:i,id:c,children:s,...l},p)=>R("div",{className:"pkt-form-group",children:[a("label",{htmlFor:c,className:"pkt-form-label",children:i}),a("input",{className:"pkt-form-input",id:c,...l,ref:p}),s]}));se.displayName="PktInput";const Be=({children:i,className:c,iconName:s="user",skin:l="",href:p="#",title:f})=>{const k=[c,"pkt-linkcard",l&&`pkt-linkcard--${l}`].filter(Boolean).join(" ");return R("a",{href:p,className:`pkt-linkcard pkt-link ${k}`,children:[a(S,{className:"pkt-link__icon",name:s}),R("div",{className:"pkt-linkcard__content",children:[a("div",{className:"pkt-linkcard__title",children:f}),a("div",{className:"pkt-linkcard__text",children:i})]})]})},Me=({children:i,skin:c="beige",title:s,...l})=>{const p=["pkt-messagebox",c&&`pkt-messagebox--${c}`].filter(Boolean).join(" ");return R("div",{...l,className:p,children:[a("div",{className:"pkt-messagebox__title",children:s}),a("div",{className:"pkt-messagebox__text",children:i})]})},le=T.forwardRef(({id:i,name:c,label:s,value:l,...p},f)=>R("div",{className:"pkt-form-group",children:[a("input",{type:"radio",className:"pkt-form-check-input",id:i,name:c,value:l,ref:f,...p}),a("label",{className:"pkt-form-label",htmlFor:i,children:s})]}));le.displayName="PktRadio";const $e=({label:i,children:c})=>R(ie,{children:[a("p",{children:i}),a("div",{className:"pkt-form-group",children:c})]});var z={},Ve={get exports(){return z},set exports(i){z=i}};/*!
|
|
28
28
|
Copyright (c) 2018 Jed Watson.
|
|
29
29
|
Licensed under the MIT License (MIT), see
|
|
30
30
|
http://jedwatson.github.io/classnames
|
|
31
|
-
*/(function(i){(function(){var c={}.hasOwnProperty;function s(){for(var l=[],p=0;p<arguments.length;p++){var f=arguments[p];if(f){var k=typeof f;if(k==="string"||k==="number")l.push(f);else if(Array.isArray(f)){if(f.length){var g=s.apply(null,f);g&&l.push(g)}}else if(k==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){l.push(f.toString());continue}for(var m in f)c.call(f,m)&&f[m]&&l.push(m)}}}return l.join(" ")}i.exports?(s.default=s,i.exports=s):window.classNames=s})()})(Ve);const Ue=z,Ge=({isResponsive:i,children:c})=>i?a("div",{className:"pkt-table-container",children:c}):a(ie,{children:c}),He=({isResponsive:i,modifiers:{info:c=!1,success:s=!1,strong:l=!1,shadow:p=!1}={},children:f})=>a(Ge,{isResponsive:i,children:a("table",{className:Ue("pkt-table",{"pkt-table--info":c,"pkt-table--success":s,"pkt-table--strong":l,"pkt-table--shadow":p}),children:f})}),Je=({children:i})=>a("td",{className:"pkt-table__th",children:i}),ze=({children:i})=>a("th",{className:"pkt-table__th",children:i}),ce=
|
|
31
|
+
*/(function(i){(function(){var c={}.hasOwnProperty;function s(){for(var l=[],p=0;p<arguments.length;p++){var f=arguments[p];if(f){var k=typeof f;if(k==="string"||k==="number")l.push(f);else if(Array.isArray(f)){if(f.length){var g=s.apply(null,f);g&&l.push(g)}}else if(k==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){l.push(f.toString());continue}for(var m in f)c.call(f,m)&&f[m]&&l.push(m)}}}return l.join(" ")}i.exports?(s.default=s,i.exports=s):window.classNames=s})()})(Ve);const Ue=z,Ge=({isResponsive:i,children:c})=>i?a("div",{className:"pkt-table-container",children:c}):a(ie,{children:c}),He=({isResponsive:i,modifiers:{info:c=!1,success:s=!1,strong:l=!1,shadow:p=!1}={},children:f})=>a(Ge,{isResponsive:i,children:a("table",{className:Ue("pkt-table",{"pkt-table--info":c,"pkt-table--success":s,"pkt-table--strong":l,"pkt-table--shadow":p}),children:f})}),Je=({children:i})=>a("td",{className:"pkt-table__th",children:i}),ze=({children:i})=>a("th",{className:"pkt-table__th",children:i}),ce=T.forwardRef(({id:i,label:c,...s},l)=>R("div",{className:"pkt-form-group",children:[a("label",{htmlFor:i,className:"pkt-form-label",children:c}),a("textarea",{className:"pkt-form-textarea",id:i,ref:l,...s})]}));ce.displayName="PktTextarea",_.PktAlert=Ye,_.PktButton=oe,_.PktHeader=Le,_.PktInput=se,_.PktLinkCard=Be,_.PktMessagebox=Me,_.PktRadio=le,_.PktRadioGroup=$e,_.PktTable=He,_.PktTableData=Je,_.PktTableHeader=ze,_.PktTextarea=ce,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
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",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@oslokommune/punkt-css": "^3.3.1",
|
|
36
36
|
"@testing-library/jest-dom": "^5.16.5",
|
|
37
37
|
"@testing-library/react": "^14.0.0",
|
|
38
|
+
"@testing-library/user-event": "^14.4.3",
|
|
38
39
|
"@types/jest": "^29.4.0",
|
|
39
40
|
"@types/jest-axe": "^3.5.5",
|
|
40
41
|
"@types/node": "^18.14.1",
|
|
@@ -89,5 +90,5 @@
|
|
|
89
90
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
90
91
|
},
|
|
91
92
|
"license": "MIT",
|
|
92
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "9652f37c67dcd894d3874ed44f9c266c0454be21"
|
|
93
94
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
|
+
import React, { createRef } from 'react';
|
|
5
|
+
|
|
6
|
+
import { PktAlert } from './Alert';
|
|
7
|
+
|
|
8
|
+
expect.extend(toHaveNoViolations)
|
|
9
|
+
|
|
10
|
+
describe('PktAlert', () => {
|
|
11
|
+
|
|
12
|
+
test('ref works correctly', () => {
|
|
13
|
+
const ref = createRef<HTMLDivElement>();
|
|
14
|
+
const { unmount } = render(<PktAlert ref={ref}>Alert text</PktAlert>);
|
|
15
|
+
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
|
16
|
+
|
|
17
|
+
unmount();
|
|
18
|
+
expect(ref.current).toBe(null);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('calls onClose when close button is clicked', () => {
|
|
22
|
+
const onClose = jest.fn();
|
|
23
|
+
const { getByLabelText } = render(<PktAlert closeAlert={true} onClose={onClose}>Hello World</PktAlert>);
|
|
24
|
+
fireEvent.click(getByLabelText('close'));
|
|
25
|
+
expect(onClose).toHaveBeenCalledTimes(1);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('accessibility', () => {
|
|
29
|
+
it('renders with no wcag errors with axe', async () => {
|
|
30
|
+
const { container } = render(<PktAlert title="Error" skin="error"></PktAlert>)
|
|
31
|
+
const results = await axe(container)
|
|
32
|
+
|
|
33
|
+
expect(results).toHaveNoViolations()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { ForwardedRef, forwardRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { PktIcon } from '../icon/Icon'
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ export interface IPktAlert extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
ariaLive?: 'off' | 'polite' | 'assertive'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const PktAlert
|
|
14
|
+
export const PktAlert = forwardRef(({
|
|
15
15
|
children,
|
|
16
16
|
className,
|
|
17
17
|
skin = 'info',
|
|
@@ -21,7 +21,7 @@ export const PktAlert: React.FC<IPktAlert> = ({
|
|
|
21
21
|
date,
|
|
22
22
|
ariaLive = 'polite',
|
|
23
23
|
...props
|
|
24
|
-
}) => {
|
|
24
|
+
}: IPktAlert, ref: ForwardedRef<HTMLDivElement>) => {
|
|
25
25
|
const classes = [className, 'pkt-alert', skin && `pkt-alert--${skin}`].filter(Boolean).join(' ')
|
|
26
26
|
|
|
27
27
|
const [isDisplayed, setIsDisplayed] = useState(true)
|
|
@@ -34,7 +34,7 @@ export const PktAlert: React.FC<IPktAlert> = ({
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return isDisplayed ? (
|
|
37
|
-
<div {...props} className={classes} aria-live={ariaLive}>
|
|
37
|
+
<div {...props} className={classes} aria-live={ariaLive} ref={ref}>
|
|
38
38
|
<div className="pkt-alert__icon">
|
|
39
39
|
<PktIcon name={skin === 'info' ? 'alert-information' : `alert-${skin}`} />
|
|
40
40
|
</div>
|
|
@@ -42,6 +42,7 @@ export const PktAlert: React.FC<IPktAlert> = ({
|
|
|
42
42
|
{closeAlert && (
|
|
43
43
|
<div className="pkt-alert__close">
|
|
44
44
|
<button
|
|
45
|
+
|
|
45
46
|
className="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
46
47
|
tabIndex={0}
|
|
47
48
|
aria-label="close"
|
|
@@ -60,3 +61,4 @@ export const PktAlert: React.FC<IPktAlert> = ({
|
|
|
60
61
|
</div>
|
|
61
62
|
) : null
|
|
62
63
|
}
|
|
64
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
|
+
import React, { createRef } from 'react';
|
|
5
|
+
|
|
6
|
+
import { PktButton } from './Button';
|
|
7
|
+
|
|
8
|
+
expect.extend(toHaveNoViolations)
|
|
9
|
+
|
|
10
|
+
test('forwardRef works correctly', () => {
|
|
11
|
+
const ref = createRef<HTMLButtonElement>();
|
|
12
|
+
render(<PktButton ref={ref}>Click me</PktButton>);
|
|
13
|
+
|
|
14
|
+
// Simulate a click on the button
|
|
15
|
+
userEvent.click(screen.getByText('Click me'));
|
|
16
|
+
|
|
17
|
+
// Check that the ref actually points to the button element
|
|
18
|
+
expect(ref.current).toBe(screen.getByRole('button'));
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('accessibility', () => {
|
|
22
|
+
it('renders with no wcag errors with axe', async () => {
|
|
23
|
+
const { container } = render(<PktButton title="Normal" skin="primary"></PktButton>)
|
|
24
|
+
const results = await axe(container)
|
|
25
|
+
|
|
26
|
+
expect(results).toHaveNoViolations()
|
|
27
|
+
})
|
|
28
|
+
})
|