@biblioteksentralen/react 4.0.0-beta.0 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2KZDHLEJ.mjs +4 -5
- package/dist/chunk-2KZDHLEJ.mjs.map +1 -1
- package/dist/chunk-3IJ454KG.mjs +179 -33
- package/dist/chunk-3IJ454KG.mjs.map +1 -1
- package/dist/chunk-5GJBW3WE.mjs +217 -176
- package/dist/chunk-5GJBW3WE.mjs.map +1 -1
- package/dist/chunk-7MKFY66H.mjs +55 -34
- package/dist/chunk-7MKFY66H.mjs.map +1 -1
- package/dist/chunk-BCT5QU5W.js.map +1 -1
- package/dist/chunk-BN5W6FVN.mjs +41 -46
- package/dist/chunk-BN5W6FVN.mjs.map +1 -1
- package/dist/chunk-BRFRPPOW.js.map +1 -1
- package/dist/chunk-BZS3AX26.mjs +1 -5
- package/dist/chunk-BZS3AX26.mjs.map +1 -1
- package/dist/chunk-CGCBID7S.mjs +36 -10
- package/dist/chunk-CGCBID7S.mjs.map +1 -1
- package/dist/chunk-J5IF7WUN.js.map +1 -1
- package/dist/chunk-NSYSPEHR.js.map +1 -1
- package/dist/chunk-NYKSRUWF.js.map +1 -1
- package/dist/chunk-O4EXBCND.js.map +1 -1
- package/dist/chunk-PLWK7HEC.js.map +1 -1
- package/dist/chunk-PQLTQYZ3.mjs +34 -8
- package/dist/chunk-PQLTQYZ3.mjs.map +1 -1
- package/dist/chunk-QAW4IRLI.js.map +1 -1
- package/dist/chunk-QBXCCJ24.js.map +1 -1
- package/dist/chunk-QX75QJ7F.mjs +119 -39
- package/dist/chunk-QX75QJ7F.mjs.map +1 -1
- package/dist/chunk-RZUGRIUF.mjs +68 -9
- package/dist/chunk-RZUGRIUF.mjs.map +1 -1
- package/dist/chunk-UFIMO32F.js.map +1 -1
- package/dist/chunk-VSICUYFB.js.map +1 -1
- package/dist/chunk-WYQNSPEX.mjs +1 -5
- package/dist/chunk-WYQNSPEX.mjs.map +1 -1
- package/dist/components/AlertBS.js.map +1 -1
- package/dist/components/AlertBS.mjs +2 -6
- package/dist/components/AlertBS.mjs.map +1 -1
- package/dist/components/BiblioteksentralenProvider.js.map +1 -1
- package/dist/components/BiblioteksentralenProvider.mjs +2 -6
- package/dist/components/BiblioteksentralenProvider.mjs.map +1 -1
- package/dist/components/ButtonBS.d.mts +1 -1
- package/dist/components/ButtonBS.d.ts +1 -1
- package/dist/components/ButtonBS.js.map +1 -1
- package/dist/components/ButtonBS.mjs +2 -6
- package/dist/components/ButtonBS.mjs.map +1 -1
- package/dist/components/ConditionalWrapperBS.js.map +1 -1
- package/dist/components/ConditionalWrapperBS.mjs +2 -6
- package/dist/components/ConditionalWrapperBS.mjs.map +1 -1
- package/dist/components/ErrorBoundaryBS.js.map +1 -1
- package/dist/components/ErrorBoundaryBS.mjs +2 -6
- package/dist/components/ErrorBoundaryBS.mjs.map +1 -1
- package/dist/components/HashLinkTargetBS.js.map +1 -1
- package/dist/components/HashLinkTargetBS.mjs +2 -6
- package/dist/components/HashLinkTargetBS.mjs.map +1 -1
- package/dist/components/IconButtonBS.d.mts +1 -1
- package/dist/components/IconButtonBS.d.ts +1 -1
- package/dist/components/IconButtonBS.js.map +1 -1
- package/dist/components/IconButtonBS.mjs +2 -6
- package/dist/components/IconButtonBS.mjs.map +1 -1
- package/dist/components/InputBS.js.map +1 -1
- package/dist/components/InputBS.mjs +2 -6
- package/dist/components/InputBS.mjs.map +1 -1
- package/dist/components/withErrorBoundaryBS.js.map +1 -1
- package/dist/components/withErrorBoundaryBS.mjs +2 -6
- package/dist/components/withErrorBoundaryBS.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- /package/dist/{ButtonStyles-7ASDoOwZ.d.mts → ButtonStyles-CRAk2YIJ.d.mts} +0 -0
- /package/dist/{ButtonStyles-7ASDoOwZ.d.ts → ButtonStyles-CRAk2YIJ.d.ts} +0 -0
package/dist/chunk-2KZDHLEJ.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
2
|
// src/components/ConditionalWrapperBS.tsx
|
|
4
3
|
import React from "react";
|
|
5
|
-
var ConditionalWrapperBS = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ConditionalWrapperBS
|
|
4
|
+
var ConditionalWrapperBS = function(param) {
|
|
5
|
+
var condition = param.condition, children = param.children, Wrapper = param.wrapper;
|
|
6
|
+
return condition ? /* @__PURE__ */ React.createElement(Wrapper, null, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
9
7
|
};
|
|
8
|
+
export { ConditionalWrapperBS };
|
|
10
9
|
//# sourceMappingURL=chunk-2KZDHLEJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ConditionalWrapperBS.tsx"],"sourcesContent":["import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapperBS: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n"]
|
|
1
|
+
{"version":3,"sources":["/Users/danielwinsvold/Code/js-utils/packages/react/dist/chunk-2KZDHLEJ.mjs","../src/components/ConditionalWrapperBS.tsx"],"names":["React","ConditionalWrapperBS","condition","children","wrapper","Wrapper","createElement","Fragment"],"mappings":"AAAA;AAEA,0CAA0C;ACF1C,OAAOA,WAA6C,QAAA;AAW7C,IAAMC,uBAAiD;QAAGC,kBAAAA,WAAWC,iBAAAA,UAAUC,AAASC,gBAATD;WACpFF,YAAY,aAAA,GAAAF,MAAAM,aAAA,CAACD,SAAA,MAASF,YAAsB,aAAA,GAAAH,MAAAM,aAAA,CAAAN,MAAAO,QAAA,EAAA,MAAGJ;;ADNjD,SACEF,oBAAoB,GACpB","sourcesContent":["\"use client\";\n\n// src/components/ConditionalWrapperBS.tsx\nimport React from \"react\";\nvar ConditionalWrapperBS = ({ condition, children, wrapper: Wrapper }) => condition ? /* @__PURE__ */ React.createElement(Wrapper, null, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);\n\nexport {\n ConditionalWrapperBS\n};\n","import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapperBS: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n"]}
|
package/dist/chunk-3IJ454KG.mjs
CHANGED
|
@@ -1,39 +1,185 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
2
|
+
function _assert_this_initialized(self) {
|
|
3
|
+
if (self === void 0) {
|
|
4
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5
|
+
}
|
|
6
|
+
return self;
|
|
7
|
+
}
|
|
8
|
+
function _class_call_check(instance, Constructor) {
|
|
9
|
+
if (!(instance instanceof Constructor)) {
|
|
10
|
+
throw new TypeError("Cannot call a class as a function");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function _defineProperties(target, props) {
|
|
14
|
+
for(var i = 0; i < props.length; i++){
|
|
15
|
+
var descriptor = props[i];
|
|
16
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
17
|
+
descriptor.configurable = true;
|
|
18
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
19
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
23
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
24
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
25
|
+
return Constructor;
|
|
26
|
+
}
|
|
27
|
+
function _define_property(obj, key, value) {
|
|
28
|
+
if (key in obj) {
|
|
29
|
+
Object.defineProperty(obj, key, {
|
|
30
|
+
value: value,
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
obj[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
function _get_prototype_of(o) {
|
|
41
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
42
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
43
|
+
};
|
|
44
|
+
return _get_prototype_of(o);
|
|
45
|
+
}
|
|
46
|
+
function _inherits(subClass, superClass) {
|
|
47
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
48
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
49
|
+
}
|
|
50
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
51
|
+
constructor: {
|
|
52
|
+
value: subClass,
|
|
53
|
+
writable: true,
|
|
54
|
+
configurable: true
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
58
|
+
}
|
|
59
|
+
function _object_spread(target) {
|
|
60
|
+
for(var i = 1; i < arguments.length; i++){
|
|
61
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
62
|
+
var ownKeys = Object.keys(source);
|
|
63
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
64
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
ownKeys.forEach(function(key) {
|
|
69
|
+
_define_property(target, key, source[key]);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
function _possible_constructor_return(self, call) {
|
|
75
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
76
|
+
return call;
|
|
77
|
+
}
|
|
78
|
+
return _assert_this_initialized(self);
|
|
79
|
+
}
|
|
80
|
+
function _set_prototype_of(o, p) {
|
|
81
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
82
|
+
o.__proto__ = p;
|
|
83
|
+
return o;
|
|
84
|
+
};
|
|
85
|
+
return _set_prototype_of(o, p);
|
|
86
|
+
}
|
|
87
|
+
function _type_of(obj) {
|
|
88
|
+
"@swc/helpers - typeof";
|
|
89
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
90
|
+
}
|
|
91
|
+
function _is_native_reflect_construct() {
|
|
92
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
93
|
+
if (Reflect.construct.sham) return false;
|
|
94
|
+
if (typeof Proxy === "function") return true;
|
|
95
|
+
try {
|
|
96
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
97
|
+
return true;
|
|
98
|
+
} catch (e) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function _create_super(Derived) {
|
|
103
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
104
|
+
return function _createSuperInternal() {
|
|
105
|
+
var Super = _get_prototype_of(Derived), result;
|
|
106
|
+
if (hasNativeReflectConstruct) {
|
|
107
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
108
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
109
|
+
} else {
|
|
110
|
+
result = Super.apply(this, arguments);
|
|
111
|
+
}
|
|
112
|
+
return _possible_constructor_return(this, result);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
import { AlertBS } from "./chunk-QX75QJ7F.mjs";
|
|
116
|
+
import { isDevelopment } from "./chunk-BN5W6FVN.mjs";
|
|
9
117
|
// src/components/ErrorBoundaryBS.tsx
|
|
10
118
|
import { Box } from "@chakra-ui/react";
|
|
11
119
|
import React from "react";
|
|
12
|
-
var StyledPre = (props)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
componentDidCatch(error, errorInfo) {
|
|
22
|
-
this.setState({ hasError: true, error, errorInfo });
|
|
23
|
-
console.error(error, { errorInfo, boundaryName: this.props.boundaryName });
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
if (this.state.hasError) {
|
|
27
|
-
const stackTrace = this.state.errorInfo?.componentStack;
|
|
28
|
-
const errormsg = this.state.error?.message;
|
|
29
|
-
const info = this.props.boundaryName;
|
|
30
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(AlertBS, { status: "error" }, /* @__PURE__ */ React.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ React.createElement(StyledPre, null, info || ""), /* @__PURE__ */ React.createElement(StyledPre, null, stackTrace || ""))));
|
|
31
|
-
}
|
|
32
|
-
return this.props.children;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
ErrorBoundaryBS
|
|
120
|
+
var StyledPre = function(props) {
|
|
121
|
+
return /* @__PURE__ */ React.createElement(Box, _object_spread({
|
|
122
|
+
as: "pre",
|
|
123
|
+
paddingTop: "0.5rem",
|
|
124
|
+
wordBreak: "break-all",
|
|
125
|
+
whiteSpace: "pre-wrap",
|
|
126
|
+
fontSize: "0.8rem"
|
|
127
|
+
}, props));
|
|
38
128
|
};
|
|
129
|
+
var ErrorBoundaryBS = /*#__PURE__*/ function(_React_Component) {
|
|
130
|
+
"use strict";
|
|
131
|
+
_inherits(ErrorBoundaryBS, _React_Component);
|
|
132
|
+
var _super = _create_super(ErrorBoundaryBS);
|
|
133
|
+
function ErrorBoundaryBS(props) {
|
|
134
|
+
_class_call_check(this, ErrorBoundaryBS);
|
|
135
|
+
var _this;
|
|
136
|
+
_this = _super.call(this, props);
|
|
137
|
+
_this.state = {
|
|
138
|
+
hasError: false
|
|
139
|
+
};
|
|
140
|
+
return _this;
|
|
141
|
+
}
|
|
142
|
+
_create_class(ErrorBoundaryBS, [
|
|
143
|
+
{
|
|
144
|
+
key: "componentDidCatch",
|
|
145
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
146
|
+
this.setState({
|
|
147
|
+
hasError: true,
|
|
148
|
+
error: error,
|
|
149
|
+
errorInfo: errorInfo
|
|
150
|
+
});
|
|
151
|
+
console.error(error, {
|
|
152
|
+
errorInfo: errorInfo,
|
|
153
|
+
boundaryName: this.props.boundaryName
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: "render",
|
|
159
|
+
value: function render() {
|
|
160
|
+
if (this.state.hasError) {
|
|
161
|
+
var _this_state_errorInfo, _this_state_error;
|
|
162
|
+
var stackTrace = (_this_state_errorInfo = this.state.errorInfo) === null || _this_state_errorInfo === void 0 ? void 0 : _this_state_errorInfo.componentStack;
|
|
163
|
+
var errormsg = (_this_state_error = this.state.error) === null || _this_state_error === void 0 ? void 0 : _this_state_error.message;
|
|
164
|
+
var info = this.props.boundaryName;
|
|
165
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(AlertBS, {
|
|
166
|
+
status: "error"
|
|
167
|
+
}, /* @__PURE__ */ React.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ React.createElement(StyledPre, null, info || ""), /* @__PURE__ */ React.createElement(StyledPre, null, stackTrace || ""))));
|
|
168
|
+
}
|
|
169
|
+
return this.props.children;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
], [
|
|
173
|
+
{
|
|
174
|
+
key: "getDerivedStateFromError",
|
|
175
|
+
value: function getDerivedStateFromError(error) {
|
|
176
|
+
return {
|
|
177
|
+
hasError: true
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]);
|
|
182
|
+
return ErrorBoundaryBS;
|
|
183
|
+
}(React.Component);
|
|
184
|
+
export { ErrorBoundaryBS };
|
|
39
185
|
//# sourceMappingURL=chunk-3IJ454KG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ErrorBoundaryBS.tsx"],"sourcesContent":["import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { AlertBS } from \"./AlertBS\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundaryBS extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <AlertBS status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </AlertBS>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"]
|
|
1
|
+
{"version":3,"sources":["/Users/danielwinsvold/Code/js-utils/packages/react/dist/chunk-3IJ454KG.mjs","../src/components/ErrorBoundaryBS.tsx"],"names":["AlertBS","isDevelopment","Box","React","StyledPre","props","createElement","as","paddingTop","wordBreak","whiteSpace","fontSize","ErrorBoundaryBS","state","hasError","componentDidCatch","error","errorInfo","setState","console","boundaryName","render","stackTrace","componentStack","errormsg","message","info","status","children","getDerivedStateFromError","Component"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SACEA,OAAO,QACF,uBAAuB;AAC9B,SACEC,aAAa,QACR,uBAAuB;AAE9B,qCAAqC;ACPrC,SAASC,GAAA,QAAqB,mBAAA;AAC9B,OAAOC,WAAqC,QAAA;AAc5C,IAAMC,YAAY,SAACC;WACjB,aAAA,GAAAF,MAAAG,aAAA,CAACJ,KAAA;QAAIK,IAAG;QAAMC,YAAW;QAASC,WAAU;QAAYC,YAAW;QAAWC,UAAS;OAAaN;;AAG/F,IAAMO,gCAAN;;;;aAAMA,gBACCP,KAAA;;;kCACJA;QACN,MAAKQ,KAAA,GAAQ;YAAEC,UAAU;QAAM;;;;;YAOjCC,KAAAA;mBAAAA,SAAAA,kBAAkBC,KAAA,EAAYC,SAAA;gBAC5B,IAAA,CAAKC,QAAA,CAAS;oBAAEJ,UAAU;oBAAME,OAAAA;oBAAOC,WAAAA;gBAAU;gBACjDE,QAAQH,KAAA,CAAMA,OAAO;oBAAEC,WAAAA;oBAAWG,cAAc,IAAA,CAAKf,KAAA,CAAMe,YAAA;gBAAa;YAC1E;;;YAEAC,KAAAA;mBAAAA,SAAAA;gBACE,IAAI,IAAA,CAAKR,KAAA,CAAMC,QAAA,EAAU;wBACJ,uBACF;oBADjB,IAAMQ,cAAa,wBAAA,IAAA,CAAKT,KAAA,CAAMI,SAAA,cAAX,4CAAA,sBAAsBM,cAAA;oBACzC,IAAMC,YAAW,oBAAA,IAAA,CAAKX,KAAA,CAAMG,KAAA,cAAX,wCAAA,kBAAkBS,OAAA;oBACnC,IAAMC,OAAO,IAAA,CAAKrB,KAAA,CAAMe,YAAA;oBAExB,OACE,aAAA,GAAAjB,MAAAG,aAAA,CAAC,OAAA,MACC,aAAA,GAAAH,MAAAG,aAAA,CAACN,SAAA;wBAAQ2B,QAAO;oBAAA,GACd,aAAA,GAAAxB,MAAAG,aAAA,CAAC,KAAA,MAAE,2CACFL,mBAAoBqB,CAAAA,cAAcE,QAAA,KACjC,aAAA,GAAArB,MAAAG,aAAA,CAAC,OAAA,MACC,aAAA,GAAAH,MAAAG,aAAA,CAACF,WAAA,MAAWoB,YAAY,KACxB,aAAA,GAAArB,MAAAG,aAAA,CAACF,WAAA,MAAWsB,QAAQ,KACpB,aAAA,GAAAvB,MAAAG,aAAA,CAACF,WAAA,MAAWkB,cAAc;gBAMtC;gBAEA,OAAO,IAAA,CAAKjB,KAAA,CAAMuB,QAAA;YACpB;;;;YAhCOC,KAAAA;mBAAP,SAAOA,yBAAyBb,KAAA;gBAC9B,OAAO;oBAAEF,UAAU;gBAAK;YAC1B;;;;EARmCX,MAAM2B,SAAA;ADe3C,SACElB,eAAe,GACf","sourcesContent":["\"use client\";\nimport {\n AlertBS\n} from \"./chunk-QX75QJ7F.mjs\";\nimport {\n isDevelopment\n} from \"./chunk-BN5W6FVN.mjs\";\n\n// src/components/ErrorBoundaryBS.tsx\nimport { Box } from \"@chakra-ui/react\";\nimport React from \"react\";\nvar StyledPre = (props) => /* @__PURE__ */ React.createElement(Box, { as: \"pre\", paddingTop: \"0.5rem\", wordBreak: \"break-all\", whiteSpace: \"pre-wrap\", fontSize: \"0.8rem\", ...props });\nvar ErrorBoundaryBS = class extends React.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError(error) {\n return { hasError: true };\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n return /* @__PURE__ */ React.createElement(\"div\", null, /* @__PURE__ */ React.createElement(AlertBS, { status: \"error\" }, /* @__PURE__ */ React.createElement(\"p\", null, \"Beklager, det skjedde en teknisk feil.\"), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React.createElement(\"div\", null, /* @__PURE__ */ React.createElement(StyledPre, null, errormsg || \"\"), /* @__PURE__ */ React.createElement(StyledPre, null, info || \"\"), /* @__PURE__ */ React.createElement(StyledPre, null, stackTrace || \"\"))));\n }\n return this.props.children;\n }\n};\n\nexport {\n ErrorBoundaryBS\n};\n","import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { AlertBS } from \"./AlertBS\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundaryBS extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <AlertBS status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </AlertBS>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"]}
|