@oslokommune/punkt-react 3.3.0 → 3.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 +19 -0
- package/dist/button/Button.d.ts +1 -1
- package/dist/punkt-react.es.js +106 -102
- package/dist/punkt-react.umd.js +9 -9
- package/package.json +5 -3
- package/src/components/button/Button.tsx +35 -30
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [3.4.0](https://github.com/oslokommune/punkt/compare/3.3.1...3.4.0) (2023-05-04)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* [825](https://github.com/oslokommune/punkt/issues/825) Legg til forward ref på React-knapp. Legger til forward ref på React-knapp for bedre tilgjengelighet og funksjonalitet
|
|
15
|
+
Installerer og konfigurerer to nye biblioteker for linting for å forbedre kodekvaliteten og vedlikeholdet
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
Ingen
|
|
20
|
+
|
|
21
|
+
### Chores
|
|
22
|
+
Ingen
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
|
|
8
27
|
## [3.2.1](https://github.com/oslokommune/punkt/compare/3.2.0...3.2.1) (2023-04-20)
|
|
9
28
|
|
|
10
29
|
### ⚠ BREAKING CHANGES
|
package/dist/button/Button.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
9
9
|
state?: 'normal' | 'focus' | 'hover' | 'active';
|
|
10
10
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
11
|
}
|
|
12
|
-
export declare const PktButton: React.
|
|
12
|
+
export declare const PktButton: React.ForwardRefExoticComponent<IPktButton & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import re, { useState as dr, forwardRef as
|
|
1
|
+
import re, { useState as dr, forwardRef as te } from "react";
|
|
2
2
|
var Y = {}, pr = {
|
|
3
3
|
get exports() {
|
|
4
4
|
return Y;
|
|
@@ -16,11 +16,11 @@ var Y = {}, pr = {
|
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
|
-
var
|
|
19
|
+
var we;
|
|
20
20
|
function vr() {
|
|
21
|
-
if (
|
|
21
|
+
if (we)
|
|
22
22
|
return I;
|
|
23
|
-
|
|
23
|
+
we = 1;
|
|
24
24
|
var i = re, l = Symbol.for("react.element"), u = Symbol.for("react.fragment"), o = 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, N) {
|
|
26
26
|
var g, x = {}, w = null, L = null;
|
|
@@ -44,14 +44,14 @@ var W = {};
|
|
|
44
44
|
* This source code is licensed under the MIT license found in the
|
|
45
45
|
* LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
|
-
var
|
|
47
|
+
var Oe;
|
|
48
48
|
function mr() {
|
|
49
|
-
return
|
|
50
|
-
var i = re, l = Symbol.for("react.element"), u = Symbol.for("react.portal"), o = 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"), N = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), L = Symbol.for("react.offscreen"),
|
|
49
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
50
|
+
var i = re, l = Symbol.for("react.element"), u = Symbol.for("react.portal"), o = 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"), N = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), L = 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
|
-
var r =
|
|
54
|
+
var r = ae && e[ae] || e[Ce];
|
|
55
55
|
return typeof r == "function" ? r : null;
|
|
56
56
|
}
|
|
57
57
|
var j = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -72,14 +72,14 @@ function mr() {
|
|
|
72
72
|
v.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, v);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
var De = !1, Ae = !1, $e = !1, Ie = !1, We = !1,
|
|
76
|
-
|
|
75
|
+
var De = !1, Ae = !1, $e = !1, Ie = !1, We = !1, ne;
|
|
76
|
+
ne = Symbol.for("react.module.reference");
|
|
77
77
|
function Ye(e) {
|
|
78
78
|
return !!(typeof e == "string" || typeof e == "function" || e === o || e === f || We || e === p || e === N || e === g || Ie || e === L || De || Ae || $e || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === x || 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.
|
|
82
|
-
e.$$typeof ===
|
|
82
|
+
e.$$typeof === ne || e.getModuleId !== void 0));
|
|
83
83
|
}
|
|
84
84
|
function Le(e, r, t) {
|
|
85
85
|
var a = e.displayName;
|
|
@@ -88,7 +88,7 @@ function mr() {
|
|
|
88
88
|
var d = r.displayName || r.name || "";
|
|
89
89
|
return d !== "" ? t + "(" + d + ")" : t;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ie(e) {
|
|
92
92
|
return e.displayName || "Context";
|
|
93
93
|
}
|
|
94
94
|
function O(e) {
|
|
@@ -116,10 +116,10 @@ function mr() {
|
|
|
116
116
|
switch (e.$$typeof) {
|
|
117
117
|
case k:
|
|
118
118
|
var r = e;
|
|
119
|
-
return
|
|
119
|
+
return ie(r) + ".Consumer";
|
|
120
120
|
case _:
|
|
121
121
|
var t = e;
|
|
122
|
-
return
|
|
122
|
+
return ie(t._context) + ".Provider";
|
|
123
123
|
case m:
|
|
124
124
|
return Le(e, e.render, "ForwardRef");
|
|
125
125
|
case x:
|
|
@@ -136,18 +136,18 @@ function mr() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var C = Object.assign, A = 0,
|
|
140
|
-
function
|
|
139
|
+
var C = Object.assign, A = 0, oe, se, le, ce, ue, fe, de;
|
|
140
|
+
function pe() {
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
pe.__reactDisabledLog = !0;
|
|
143
143
|
function Be() {
|
|
144
144
|
{
|
|
145
145
|
if (A === 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,
|
|
149
149
|
enumerable: !0,
|
|
150
|
-
value:
|
|
150
|
+
value: pe,
|
|
151
151
|
writable: !0
|
|
152
152
|
};
|
|
153
153
|
Object.defineProperties(console, {
|
|
@@ -173,25 +173,25 @@ function mr() {
|
|
|
173
173
|
};
|
|
174
174
|
Object.defineProperties(console, {
|
|
175
175
|
log: C({}, e, {
|
|
176
|
-
value:
|
|
176
|
+
value: oe
|
|
177
177
|
}),
|
|
178
178
|
info: C({}, e, {
|
|
179
|
-
value:
|
|
179
|
+
value: se
|
|
180
180
|
}),
|
|
181
181
|
warn: C({}, e, {
|
|
182
|
-
value:
|
|
182
|
+
value: le
|
|
183
183
|
}),
|
|
184
184
|
error: C({}, e, {
|
|
185
|
-
value:
|
|
185
|
+
value: ce
|
|
186
186
|
}),
|
|
187
187
|
group: C({}, e, {
|
|
188
|
-
value:
|
|
188
|
+
value: ue
|
|
189
189
|
}),
|
|
190
190
|
groupCollapsed: C({}, e, {
|
|
191
|
-
value:
|
|
191
|
+
value: fe
|
|
192
192
|
}),
|
|
193
193
|
groupEnd: C({}, e, {
|
|
194
|
-
value:
|
|
194
|
+
value: de
|
|
195
195
|
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -217,7 +217,7 @@ function mr() {
|
|
|
217
217
|
var Ve = typeof WeakMap == "function" ? WeakMap : Map;
|
|
218
218
|
M = new Ve();
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function ve(e, r) {
|
|
221
221
|
if (!e || z)
|
|
222
222
|
return "";
|
|
223
223
|
{
|
|
@@ -285,11 +285,11 @@ function mr() {
|
|
|
285
285
|
} finally {
|
|
286
286
|
z = !1, G.current = v, Me(), Error.prepareStackTrace = d;
|
|
287
287
|
}
|
|
288
|
-
var D = e ? e.displayName || e.name : "",
|
|
289
|
-
return typeof e == "function" && M.set(e,
|
|
288
|
+
var D = e ? e.displayName || e.name : "", Te = D ? B(D) : "";
|
|
289
|
+
return typeof e == "function" && M.set(e, Te), Te;
|
|
290
290
|
}
|
|
291
291
|
function Ue(e, r, t) {
|
|
292
|
-
return
|
|
292
|
+
return ve(e, !1);
|
|
293
293
|
}
|
|
294
294
|
function qe(e) {
|
|
295
295
|
var r = e.prototype;
|
|
@@ -299,7 +299,7 @@ function mr() {
|
|
|
299
299
|
if (e == null)
|
|
300
300
|
return "";
|
|
301
301
|
if (typeof e == "function")
|
|
302
|
-
return
|
|
302
|
+
return ve(e, qe(e));
|
|
303
303
|
if (typeof e == "string")
|
|
304
304
|
return B(e);
|
|
305
305
|
switch (e) {
|
|
@@ -324,13 +324,13 @@ function mr() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var U = Object.prototype.hasOwnProperty,
|
|
327
|
+
var U = Object.prototype.hasOwnProperty, me = {}, he = j.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);
|
|
331
|
-
|
|
331
|
+
he.setExtraStackFrame(t);
|
|
332
332
|
} else
|
|
333
|
-
|
|
333
|
+
he.setExtraStackFrame(null);
|
|
334
334
|
}
|
|
335
335
|
function Ge(e, r, t, a, d) {
|
|
336
336
|
{
|
|
@@ -347,7 +347,7 @@ function mr() {
|
|
|
347
347
|
} catch (h) {
|
|
348
348
|
s = h;
|
|
349
349
|
}
|
|
350
|
-
s && !(s instanceof Error) && (q(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).", a || "React class", t, c, typeof s), q(null)), s instanceof Error && !(s.message in
|
|
350
|
+
s && !(s instanceof Error) && (q(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).", a || "React class", t, c, typeof s), q(null)), s instanceof Error && !(s.message in me) && (me[s.message] = !0, q(d), E("Failed %s type: %s", t, s.message), q(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -363,24 +363,24 @@ function mr() {
|
|
|
363
363
|
}
|
|
364
364
|
function He(e) {
|
|
365
365
|
try {
|
|
366
|
-
return
|
|
366
|
+
return be(e), !1;
|
|
367
367
|
} catch {
|
|
368
368
|
return !0;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function be(e) {
|
|
372
372
|
return "" + e;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function _e(e) {
|
|
375
375
|
if (He(e))
|
|
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)),
|
|
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
378
|
var $ = j.ReactCurrentOwner, Ke = {
|
|
379
379
|
key: !0,
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
382
382
|
__source: !0
|
|
383
|
-
},
|
|
383
|
+
}, ke, ge, K;
|
|
384
384
|
K = {};
|
|
385
385
|
function Xe(e) {
|
|
386
386
|
if (U.call(e, "ref")) {
|
|
@@ -407,7 +407,7 @@ function mr() {
|
|
|
407
407
|
function er(e, r) {
|
|
408
408
|
{
|
|
409
409
|
var t = function() {
|
|
410
|
-
|
|
410
|
+
ke || (ke = !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));
|
|
411
411
|
};
|
|
412
412
|
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
413
413
|
get: t,
|
|
@@ -418,7 +418,7 @@ function mr() {
|
|
|
418
418
|
function rr(e, r) {
|
|
419
419
|
{
|
|
420
420
|
var t = function() {
|
|
421
|
-
|
|
421
|
+
ge || (ge = !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));
|
|
422
422
|
};
|
|
423
423
|
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
424
424
|
get: t,
|
|
@@ -458,7 +458,7 @@ function mr() {
|
|
|
458
458
|
function ar(e, r, t, a, d) {
|
|
459
459
|
{
|
|
460
460
|
var v, c = {}, s = null, R = null;
|
|
461
|
-
t !== void 0 && (
|
|
461
|
+
t !== void 0 && (_e(t), s = "" + t), Ze(r) && (_e(r.key), s = "" + r.key), Xe(r) && (R = r.ref, Qe(r, d));
|
|
462
462
|
for (v in r)
|
|
463
463
|
U.call(r, v) && !Ke.hasOwnProperty(v) && (c[v] = r[v]);
|
|
464
464
|
if (e && e.defaultProps) {
|
|
@@ -473,20 +473,20 @@ function mr() {
|
|
|
473
473
|
return tr(e, s, R, d, a, $.current, c);
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
var X = j.ReactCurrentOwner,
|
|
476
|
+
var X = j.ReactCurrentOwner, ye = j.ReactDebugCurrentFrame;
|
|
477
477
|
function F(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
484
|
var Z;
|
|
485
485
|
Z = !1;
|
|
486
486
|
function Q(e) {
|
|
487
487
|
return typeof e == "object" && e !== null && e.$$typeof === l;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Ee() {
|
|
490
490
|
{
|
|
491
491
|
if (X.current) {
|
|
492
492
|
var e = O(X.current.type);
|
|
@@ -509,10 +509,10 @@ Check your code at ` + r + ":" + t + ".";
|
|
|
509
509
|
return "";
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
var
|
|
512
|
+
var Re = {};
|
|
513
513
|
function ir(e) {
|
|
514
514
|
{
|
|
515
|
-
var r =
|
|
515
|
+
var r = Ee();
|
|
516
516
|
if (!r) {
|
|
517
517
|
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
518
518
|
t && (r = `
|
|
@@ -522,27 +522,27 @@ Check the top-level render call using <` + t + ">.");
|
|
|
522
522
|
return r;
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function xe(e, r) {
|
|
526
526
|
{
|
|
527
527
|
if (!e._store || e._store.validated || e.key != null)
|
|
528
528
|
return;
|
|
529
529
|
e._store.validated = !0;
|
|
530
530
|
var t = ir(r);
|
|
531
|
-
if (
|
|
531
|
+
if (Re[t])
|
|
532
532
|
return;
|
|
533
|
-
|
|
533
|
+
Re[t] = !0;
|
|
534
534
|
var a = "";
|
|
535
535
|
e && e._owner && e._owner !== X.current && (a = " It was passed a child from " + O(e._owner.type) + "."), F(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), F(null);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function Ne(e, r) {
|
|
539
539
|
{
|
|
540
540
|
if (typeof e != "object")
|
|
541
541
|
return;
|
|
542
542
|
if (H(e))
|
|
543
543
|
for (var t = 0; t < e.length; t++) {
|
|
544
544
|
var a = e[t];
|
|
545
|
-
Q(a) &&
|
|
545
|
+
Q(a) && xe(a, r);
|
|
546
546
|
}
|
|
547
547
|
else if (Q(e))
|
|
548
548
|
e._store && (e._store.validated = !0);
|
|
@@ -550,7 +550,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
550
550
|
var d = je(e);
|
|
551
551
|
if (typeof d == "function" && d !== e.entries)
|
|
552
552
|
for (var v = d.call(e), c; !(c = v.next()).done; )
|
|
553
|
-
Q(c.value) &&
|
|
553
|
+
Q(c.value) && xe(c.value, r);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -591,14 +591,14 @@ Check the top-level render call using <` + t + ">.");
|
|
|
591
591
|
e.ref !== null && (F(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Pe(e, r, t, a, d, v) {
|
|
595
595
|
{
|
|
596
596
|
var c = Ye(e);
|
|
597
597
|
if (!c) {
|
|
598
598
|
var s = "";
|
|
599
599
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
600
600
|
var R = nr(d);
|
|
601
|
-
R ? s += R : s +=
|
|
601
|
+
R ? s += R : s += Ee();
|
|
602
602
|
var h;
|
|
603
603
|
e === null ? h = "null" : H(e) ? h = "array" : e !== void 0 && e.$$typeof === l ? (h = "<" + (O(e.type) || "Unknown") + " />", s = " 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, s);
|
|
604
604
|
}
|
|
@@ -611,21 +611,21 @@ Check the top-level render call using <` + t + ">.");
|
|
|
611
611
|
if (a)
|
|
612
612
|
if (H(P)) {
|
|
613
613
|
for (var D = 0; D < P.length; D++)
|
|
614
|
-
|
|
614
|
+
Ne(P[D], e);
|
|
615
615
|
Object.freeze && Object.freeze(P);
|
|
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.");
|
|
618
618
|
else
|
|
619
|
-
|
|
619
|
+
Ne(P, e);
|
|
620
620
|
}
|
|
621
621
|
return e === o ? sr(b) : or(b), b;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
function lr(e, r, t) {
|
|
625
|
-
return
|
|
625
|
+
return Pe(e, r, t, !0);
|
|
626
626
|
}
|
|
627
627
|
function cr(e, r, t) {
|
|
628
|
-
return
|
|
628
|
+
return Pe(e, r, t, !1);
|
|
629
629
|
}
|
|
630
630
|
var ur = cr, fr = lr;
|
|
631
631
|
W.Fragment = o, W.jsx = ur, W.jsxs = fr;
|
|
@@ -642,7 +642,7 @@ 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", { ...o, className: p, viewBox: u, children: /* @__PURE__ */ n("use", { href: `#${l}` }) });
|
|
645
|
-
},
|
|
645
|
+
}, xr = ({
|
|
646
646
|
children: i,
|
|
647
647
|
className: l,
|
|
648
648
|
skin: u = "info",
|
|
@@ -675,30 +675,34 @@ const Se = Y.Fragment, n = Y.jsx, y = Y.jsxs, T = ({
|
|
|
675
675
|
_
|
|
676
676
|
] })
|
|
677
677
|
] }) : null;
|
|
678
|
-
},
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
678
|
+
}, hr = te(
|
|
679
|
+
({
|
|
680
|
+
children: i,
|
|
681
|
+
className: l,
|
|
682
|
+
iconName: u = "user",
|
|
683
|
+
secondIconName: o = "user",
|
|
684
|
+
size: p = "medium",
|
|
685
|
+
skin: f = "primary",
|
|
686
|
+
type: _ = "button",
|
|
687
|
+
variant: k = "label-only",
|
|
688
|
+
...m
|
|
689
|
+
}, N) => {
|
|
690
|
+
const g = [
|
|
691
|
+
l,
|
|
692
|
+
"pkt-btn",
|
|
693
|
+
p && `pkt-btn--${p}`,
|
|
694
|
+
f && `pkt-btn--${f}`,
|
|
695
|
+
k && `pkt-btn--${k}`
|
|
696
|
+
].filter(Boolean).join(" ");
|
|
697
|
+
return /* @__PURE__ */ y("button", { ...m, className: g, type: _, ref: N, children: [
|
|
698
|
+
/* @__PURE__ */ n(T, { className: "pkt-btn__icon", name: u }),
|
|
699
|
+
/* @__PURE__ */ n("span", { className: "pkt-btn__text", children: i }),
|
|
700
|
+
k === "icons-right-and-left" && /* @__PURE__ */ n(T, { className: "pkt-btn__icon", name: o })
|
|
701
|
+
] });
|
|
702
|
+
}
|
|
703
|
+
);
|
|
704
|
+
hr.displayName = "PktButton";
|
|
705
|
+
const Nr = ({
|
|
702
706
|
children: i,
|
|
703
707
|
className: l,
|
|
704
708
|
logoLink: u = "https://www.oslo.kommune.no/",
|
|
@@ -767,14 +771,14 @@ const Se = Y.Fragment, n = Y.jsx, y = Y.jsxs, T = ({
|
|
|
767
771
|
)
|
|
768
772
|
] })
|
|
769
773
|
] });
|
|
770
|
-
},
|
|
774
|
+
}, br = re.forwardRef(
|
|
771
775
|
({ label: i, id: l, children: u, ...o }, p) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
772
776
|
/* @__PURE__ */ n("label", { htmlFor: l, className: "pkt-form-label", children: i }),
|
|
773
777
|
/* @__PURE__ */ n("input", { className: "pkt-form-input", id: l, ...o, ref: p }),
|
|
774
778
|
u
|
|
775
779
|
] })
|
|
776
780
|
);
|
|
777
|
-
|
|
781
|
+
br.displayName = "PktInput";
|
|
778
782
|
const Pr = ({
|
|
779
783
|
children: i,
|
|
780
784
|
className: l,
|
|
@@ -802,25 +806,25 @@ const Pr = ({
|
|
|
802
806
|
/* @__PURE__ */ n("div", { className: "pkt-messagebox__title", children: u }),
|
|
803
807
|
/* @__PURE__ */ n("div", { className: "pkt-messagebox__text", children: i })
|
|
804
808
|
] });
|
|
805
|
-
},
|
|
809
|
+
}, _r = te(
|
|
806
810
|
({ id: i, label: l, ...u }, o) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
807
811
|
/* @__PURE__ */ n("label", { htmlFor: i, className: "pkt-form-label", children: l }),
|
|
808
812
|
/* @__PURE__ */ n("textarea", { className: "pkt-form-textarea", id: i, ref: o, ...u })
|
|
809
813
|
] })
|
|
810
814
|
);
|
|
811
|
-
|
|
812
|
-
const
|
|
815
|
+
_r.displayName = "PktTextarea";
|
|
816
|
+
const kr = te(
|
|
813
817
|
({ id: i, name: l, label: u, value: o, ...p }, f) => /* @__PURE__ */ y("div", { className: "pkt-form-group", children: [
|
|
814
818
|
/* @__PURE__ */ n("input", { type: "radio", className: "pkt-form-check-input", id: i, name: l, value: o, ref: f, ...p }),
|
|
815
819
|
/* @__PURE__ */ n("label", { className: "pkt-form-label", htmlFor: i, children: u })
|
|
816
820
|
] })
|
|
817
821
|
);
|
|
818
|
-
|
|
822
|
+
kr.displayName = "PktRadio";
|
|
819
823
|
const wr = ({ label: i, children: l }) => /* @__PURE__ */ y(Se, { children: [
|
|
820
824
|
/* @__PURE__ */ n("p", { children: i }),
|
|
821
825
|
/* @__PURE__ */ n("div", { className: "pkt-form-group", children: l })
|
|
822
826
|
] });
|
|
823
|
-
var ee = {},
|
|
827
|
+
var ee = {}, gr = {
|
|
824
828
|
get exports() {
|
|
825
829
|
return ee;
|
|
826
830
|
},
|
|
@@ -862,15 +866,15 @@ var ee = {}, kr = {
|
|
|
862
866
|
}
|
|
863
867
|
i.exports ? (u.default = u, i.exports = u) : window.classNames = u;
|
|
864
868
|
})();
|
|
865
|
-
})(
|
|
866
|
-
const
|
|
869
|
+
})(gr);
|
|
870
|
+
const yr = ee, Er = ({ isResponsive: i, children: l }) => i ? /* @__PURE__ */ n("div", { className: "pkt-table-container", children: l }) : /* @__PURE__ */ n(Se, { children: l }), Or = ({
|
|
867
871
|
isResponsive: i,
|
|
868
872
|
modifiers: { info: l = !1, success: u = !1, strong: o = !1, shadow: p = !1 } = {},
|
|
869
873
|
children: f
|
|
870
|
-
}) => /* @__PURE__ */ n(
|
|
874
|
+
}) => /* @__PURE__ */ n(Er, { isResponsive: i, children: /* @__PURE__ */ n(
|
|
871
875
|
"table",
|
|
872
876
|
{
|
|
873
|
-
className:
|
|
877
|
+
className: yr("pkt-table", {
|
|
874
878
|
"pkt-table--info": l,
|
|
875
879
|
"pkt-table--success": u,
|
|
876
880
|
"pkt-table--strong": o,
|
|
@@ -880,16 +884,16 @@ const gr = ee, yr = ({ isResponsive: i, children: l }) => i ? /* @__PURE__ */ n(
|
|
|
880
884
|
}
|
|
881
885
|
) }), Sr = ({ children: i }) => /* @__PURE__ */ n("td", { className: "pkt-table__th", children: i }), Cr = ({ children: i }) => /* @__PURE__ */ n("th", { className: "pkt-table__th", children: i });
|
|
882
886
|
export {
|
|
883
|
-
|
|
884
|
-
|
|
887
|
+
xr as PktAlert,
|
|
888
|
+
hr as PktButton,
|
|
885
889
|
Nr as PktHeader,
|
|
886
|
-
|
|
890
|
+
br as PktInput,
|
|
887
891
|
Pr as PktLinkCard,
|
|
888
892
|
Tr as PktMessagebox,
|
|
889
|
-
|
|
893
|
+
kr as PktRadio,
|
|
890
894
|
wr as PktRadioGroup,
|
|
891
895
|
Or as PktTable,
|
|
892
896
|
Sr as PktTableData,
|
|
893
897
|
Cr as PktTableHeader,
|
|
894
|
-
|
|
898
|
+
_r as PktTextarea
|
|
895
899
|
};
|
package/dist/punkt-react.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(k,
|
|
1
|
+
(function(k,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],x):(k=typeof globalThis<"u"?globalThis:k||self,x(k["punkt-react"]={},k.React))})(this,function(k,x){"use strict";var W={},Ae={get exports(){return W},set exports(i){W=i}},Y={};/**
|
|
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
|
|
9
|
+
*/var ae;function Ie(){if(ae)return Y;ae=1;var i=x,l=Symbol.for("react.element"),u=Symbol.for("react.fragment"),o=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 _(g,m,N){var y,T={},O=null,M=null;N!==void 0&&(O=""+N),m.key!==void 0&&(O=""+m.key),m.ref!==void 0&&(M=m.ref);for(y in m)o.call(m,y)&&!f.hasOwnProperty(y)&&(T[y]=m[y]);if(g&&g.defaultProps)for(y in m=g.defaultProps,m)T[y]===void 0&&(T[y]=m[y]);return{$$typeof:l,type:g,key:O,ref:M,props:T,_owner:p.current}}return Y.Fragment=u,Y.jsx=_,Y.jsxs=_,Y}var $={};/**
|
|
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
|
|
18
|
-
`+
|
|
17
|
+
*/var ne;function We(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&function(){var i=x,l=Symbol.for("react.element"),u=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),_=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"),T=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),M=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 F=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=F.ReactDebugCurrentFrame,d=n.getStackAddendum();d!==""&&(r+="%s",t=t.concat([d]));var v=t.map(function(c){return String(c)});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===o||e===f||tr||e===p||e===N||e===y||rr||e===M||Ze||Qe||er||typeof e=="object"&&e!==null&&(e.$$typeof===O||e.$$typeof===T||e.$$typeof===_||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 o:return"Fragment";case u: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 _:var t=e;return de(t._context)+".Provider";case m:return nr(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:C(e.type)||"Memo";case O:{var d=e,v=d._payload,c=d._init;try{return C(c(v))}catch{return null}}}return null}var D=Object.assign,L=0,pe,ve,me,he,be,_e,ke;function ge(){}ge.__reactDisabledLog=!0;function ir(){{if(L===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})}L++}}function or(){{if(L--,L===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})})}L<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=F.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
|
+
`+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 c=function(){throw Error()};if(Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(j){n=j}Reflect.construct(e,[],c)}else{try{c.call()}catch(j){n=j}e.call(c.prototype)}}else{try{throw Error()}catch(j){n=j}e()}}catch(j){if(j&&n&&typeof j.stack=="string"){for(var s=j.stack.split(`
|
|
19
19
|
`),P=n.stack.split(`
|
|
20
|
-
`),h=s.length-1,b=P.length-1;h>=1&&b>=0&&s[h]!==P[b];)b--;for(;h>=1&&b>=0;h--,b--)if(s[h]!==P[b]){if(h!==1||b!==1)do if(h--,b--,b<0||s[h]!==P[b]){var
|
|
21
|
-
`+s[h].replace(" at new "," at ");return e.displayName&&
|
|
20
|
+
`),h=s.length-1,b=P.length-1;h>=1&&b>=0&&s[h]!==P[b];)b--;for(;h>=1&&b>=0;h--,b--)if(s[h]!==P[b]){if(h!==1||b!==1)do if(h--,b--,b<0||s[h]!==P[b]){var w=`
|
|
21
|
+
`+s[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 I=e?e.displayName||e.name:"",Fe=I?V(I):"";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 T: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=F.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 c in e)if(v(e,c)){var s=void 0;try{if(typeof e[c]!="function"){var P=Error((n||"React class")+": "+t+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}s=e[c](r,c,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){s=h}s&&!(s 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,c,typeof s),J(null)),s instanceof Error&&!(s.message in Re)&&(Re[s.message]=!0,J(d),E("Failed %s type: %s",t,s.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 B=F.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"&&B.current&&r&&B.current.stateNode!==r){var t=C(B.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(B.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,c){var s={$$typeof:l,type:e,key:r,ref:t,props:c,_owner:v};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function yr(e,r,t,n,d){{var v,c={},s=null,P=null;t!==void 0&&(Te(t),s=""+t),hr(r)&&(Te(r.key),s=""+r.key),mr(r)&&(P=r.ref,br(r,d));for(v in r)H.call(r,v)&&!vr.hasOwnProperty(v)&&(c[v]=r[v]);if(e&&e.defaultProps){var h=e.defaultProps;for(v in h)c[v]===void 0&&(c[v]=h[v])}if(s||P){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&_r(c,b),P&&kr(c,b)}return gr(e,s,P,d,n,B.current,c)}}var ee=F.ReactCurrentOwner,xe=F.ReactDebugCurrentFrame;function A(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===l}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
|
-
Check your code at `+r+":"+t+"."}return""}}var
|
|
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
|
|
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)+"."),A(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),A(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),c;!(c=v.next()).done;)te(c.value)&&Ce(c.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===T))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"){A(e),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),A(null);break}}e.ref!==null&&(A(e),E("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function De(e,r,t,n,d,v){{var c=ar(e);if(!c){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" 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?s+=P:s+=Se();var h;e===null?h="null":Z(e)?h="array":e!==void 0&&e.$$typeof===l?(h="<"+(C(e.type)||"Unknown")+" />",s=" 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,s)}var b=yr(e,r,t,d,v);if(b==null)return b;if(c){var w=r.children;if(w!==void 0)if(n)if(Z(w)){for(var I=0;I<w.length;I++)je(w[I],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===o?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;$.Fragment=o,$.jsx=xr,$.jsxs=Sr}()),$}(function(i){process.env.NODE_ENV==="production"?i.exports=Ie():i.exports=We()})(Ae);const ie=W.Fragment,a=W.jsx,R=W.jsxs,S=({className:i,name:l,viewBox:u="0 0 32 32",...o})=>{const p=[i].filter(Boolean).join(" ");return a("svg",{...o,className:p,viewBox:u,children:a("use",{href:`#${l}`})})},Ye=({children:i,className:l,skin:u="info",closeAlert:o=!1,onClose:p,title:f,date:_,ariaLive:g="polite",...m})=>{const N=[l,"pkt-alert",u&&`pkt-alert--${u}`].filter(Boolean).join(" "),[y,T]=x.useState(!0),O=()=>{T(!1),p&&p()};return y?R("div",{...m,className:N,"aria-live":g,children:[a("div",{className:"pkt-alert__icon",children:a(S,{name:u==="info"?"alert-information":`alert-${u}`})}),o&&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:O,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}),_&&R("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",_]})]}):null},oe=x.forwardRef(({children:i,className:l,iconName:u="user",secondIconName:o="user",size:p="medium",skin:f="primary",type:_="button",variant:g="label-only",...m},N)=>{const y=[l,"pkt-btn",p&&`pkt-btn--${p}`,f&&`pkt-btn--${f}`,g&&`pkt-btn--${g}`].filter(Boolean).join(" ");return R("button",{...m,className:y,type:_,ref:N,children:[a(S,{className:"pkt-btn__icon",name:u}),a("span",{className:"pkt-btn__text",children:i}),g==="icons-right-and-left"&&a(S,{className:"pkt-btn__icon",name:o})]})});oe.displayName="PktButton";const $e=({children:i,className:l,logoLink:u="https://www.oslo.kommune.no/",isLoggedIn:o=!1,representing:p="",canChangeRepresentation:f=!1,showLogInButton:_=!0,onLogIn:g,onLogOut:m,onChangeRepresentation:N,...y})=>{const T=[l,"pkt-header"].filter(Boolean).join(" ");return R("header",{id:"pkt-header",className:T,"aria-label":"Topp",children:[a("div",{className:"pkt-header__logo",children:a("a",{"aria-label":"Tilbake til forside",className:"pkt-header__logo-link",href:u,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:[o&&f&&R("button",{className:"pkt-btn pkt-btn--secondary pkt-btn--icon-right","aria-label":`Bytt bruker fra ${p}`,onClick:N,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:p})]}),o&&!f&&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:p})}),a("span",{className:"pkt-header__action-icon pkt-show-phablet-up",children:a(S,{name:"user"})})]}),_&&o&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg ut",onClick:m,children:[a(S,{className:"pkt-btn__icon pkt-show-tablet-up",name:"exit"}),a("span",{className:"pkt-btn__text",children:"Logg ut"})]}),_&&!o&&R("button",{className:"pkt-btn pkt-btn--tertiary pkt-btn--icon-right","aria-label":"Logg inn",onClick:g,children:[a(S,{className:"pkt-btn__icon",name:"user"}),a("span",{className:"pkt-btn__text",children:"Logg inn"})]})]})]})},se=x.forwardRef(({label:i,id:l,children:u,...o},p)=>R("div",{className:"pkt-form-group",children:[a("label",{htmlFor:l,className:"pkt-form-label",children:i}),a("input",{className:"pkt-form-input",id:l,...o,ref:p}),u]}));se.displayName="PktInput";const Le=({children:i,className:l,iconName:u="user",skin:o="",href:p="#",title:f})=>{const _=[l,"pkt-linkcard",o&&`pkt-linkcard--${o}`].filter(Boolean).join(" ");return R("a",{href:p,className:`pkt-linkcard pkt-link ${_}`,children:[a(S,{className:"pkt-link__icon",name:u}),R("div",{className:"pkt-linkcard__content",children:[a("div",{className:"pkt-linkcard__title",children:f}),a("div",{className:"pkt-linkcard__text",children:i})]})]})},Be=({children:i,skin:l="beige",title:u,...o})=>{const p=["pkt-messagebox",l&&`pkt-messagebox--${l}`].filter(Boolean).join(" ");return R("div",{...o,className:p,children:[a("div",{className:"pkt-messagebox__title",children:u}),a("div",{className:"pkt-messagebox__text",children:i})]})},le=x.forwardRef(({id:i,label:l,...u},o)=>R("div",{className:"pkt-form-group",children:[a("label",{htmlFor:i,className:"pkt-form-label",children:l}),a("textarea",{className:"pkt-form-textarea",id:i,ref:o,...u})]}));le.displayName="PktTextarea";const ce=x.forwardRef(({id:i,name:l,label:u,value:o,...p},f)=>R("div",{className:"pkt-form-group",children:[a("input",{type:"radio",className:"pkt-form-check-input",id:i,name:l,value:o,ref:f,...p}),a("label",{className:"pkt-form-label",htmlFor:i,children:u})]}));ce.displayName="PktRadio";const Me=({label:i,children:l})=>R(ie,{children:[a("p",{children:i}),a("div",{className:"pkt-form-group",children:l})]});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 l={}.hasOwnProperty;function u(){for(var o=[],p=0;p<arguments.length;p++){var f=arguments[p];if(f){var _=typeof f;if(_==="string"||_==="number")o.push(f);else if(Array.isArray(f)){if(f.length){var g=u.apply(null,f);g&&o.push(g)}}else if(_==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){o.push(f.toString());continue}for(var m in f)l.call(f,m)&&f[m]&&o.push(m)}}}return o.join(" ")}i.exports?(u.default=u,i.exports=u):window.classNames=u})()})(Ve);const Ue=z,Ge=({isResponsive:i,children:l})=>i?a("div",{className:"pkt-table-container",children:l}):a(ie,{children:l}),He=({isResponsive:i,modifiers:{info:l=!1,success:u=!1,strong:o=!1,shadow:p=!1}={},children:f})=>a(Ge,{isResponsive:i,children:a("table",{className:Ue("pkt-table",{"pkt-table--info":l,"pkt-table--success":u,"pkt-table--strong":o,"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});k.PktAlert=
|
|
31
|
+
*/(function(i){(function(){var l={}.hasOwnProperty;function u(){for(var o=[],p=0;p<arguments.length;p++){var f=arguments[p];if(f){var _=typeof f;if(_==="string"||_==="number")o.push(f);else if(Array.isArray(f)){if(f.length){var g=u.apply(null,f);g&&o.push(g)}}else if(_==="object"){if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]")){o.push(f.toString());continue}for(var m in f)l.call(f,m)&&f[m]&&o.push(m)}}}return o.join(" ")}i.exports?(u.default=u,i.exports=u):window.classNames=u})()})(Ve);const Ue=z,Ge=({isResponsive:i,children:l})=>i?a("div",{className:"pkt-table-container",children:l}):a(ie,{children:l}),He=({isResponsive:i,modifiers:{info:l=!1,success:u=!1,strong:o=!1,shadow:p=!1}={},children:f})=>a(Ge,{isResponsive:i,children:a("table",{className:Ue("pkt-table",{"pkt-table--info":l,"pkt-table--success":u,"pkt-table--strong":o,"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});k.PktAlert=Ye,k.PktButton=oe,k.PktHeader=$e,k.PktInput=se,k.PktLinkCard=Le,k.PktMessagebox=Be,k.PktRadio=ce,k.PktRadioGroup=Me,k.PktTable=He,k.PktTableData=Je,k.PktTableHeader=ze,k.PktTextarea=le,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@oslokommune/punkt-assets": "^3.1.2",
|
|
35
|
-
"@oslokommune/punkt-css": "^3.3.
|
|
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
38
|
"@types/jest": "^29.4.0",
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"@vitejs/plugin-react": "^3.1.0",
|
|
44
44
|
"classnames": "^2.3.2",
|
|
45
45
|
"eslint": "^8.34.0",
|
|
46
|
+
"eslint-config-prettier": "^8.8.0",
|
|
47
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
46
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
47
49
|
"jest": "^29.5.0",
|
|
48
50
|
"jest-axe": "^7.0.1",
|
|
@@ -87,5 +89,5 @@
|
|
|
87
89
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
88
90
|
},
|
|
89
91
|
"license": "MIT",
|
|
90
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "5e6489b75d034b72fe83a8284b524c4bfb21038d"
|
|
91
93
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from 'react'
|
|
2
|
+
|
|
2
3
|
import { PktIcon } from '../icon/Icon'
|
|
3
4
|
|
|
4
5
|
export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -12,34 +13,38 @@ export interface IPktButton extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
|
12
13
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export const PktButton
|
|
16
|
-
|
|
17
|
-
className,
|
|
18
|
-
iconName = 'user',
|
|
19
|
-
secondIconName = 'user',
|
|
20
|
-
size = 'medium',
|
|
21
|
-
skin = 'primary',
|
|
22
|
-
type = 'button',
|
|
23
|
-
variant = 'label-only',
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const classes = [
|
|
16
|
+
export const PktButton = forwardRef(({
|
|
17
|
+
children,
|
|
27
18
|
className,
|
|
28
|
-
'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
iconName = 'user',
|
|
20
|
+
secondIconName = 'user',
|
|
21
|
+
size = 'medium',
|
|
22
|
+
skin = 'primary',
|
|
23
|
+
type = 'button',
|
|
24
|
+
variant = 'label-only',
|
|
25
|
+
...props
|
|
26
|
+
}: IPktButton, ref: ForwardedRef<HTMLButtonElement>) => {
|
|
27
|
+
const classes = [
|
|
28
|
+
className,
|
|
29
|
+
'pkt-btn',
|
|
30
|
+
size && `pkt-btn--${size}`,
|
|
31
|
+
skin && `pkt-btn--${skin}`,
|
|
32
|
+
variant && `pkt-btn--${variant}`,
|
|
33
|
+
]
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.join(' ')
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<button {...props} className={classes} type={type} ref={ref}>
|
|
39
|
+
<PktIcon className="pkt-btn__icon" name={iconName}></PktIcon>
|
|
40
|
+
<span className="pkt-btn__text">{children}</span>
|
|
41
|
+
{variant === 'icons-right-and-left' && (
|
|
42
|
+
<PktIcon className="pkt-btn__icon" name={secondIconName}></PktIcon>
|
|
43
|
+
)}
|
|
44
|
+
</button>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
PktButton.displayName = 'PktButton';
|
|
35
50
|
|
|
36
|
-
return (
|
|
37
|
-
<button {...props} className={classes} type={type}>
|
|
38
|
-
<PktIcon className="pkt-btn__icon" name={iconName}></PktIcon>
|
|
39
|
-
<span className="pkt-btn__text">{children}</span>
|
|
40
|
-
{variant === 'icons-right-and-left' && (
|
|
41
|
-
<PktIcon className="pkt-btn__icon" name={secondIconName}></PktIcon>
|
|
42
|
-
)}
|
|
43
|
-
</button>
|
|
44
|
-
)
|
|
45
|
-
}
|