@biblioteksentralen/react 3.1.0 → 4.0.0-beta.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/dist/ButtonStyles-7ASDoOwZ.d.mts +3 -0
- package/dist/ButtonStyles-7ASDoOwZ.d.ts +3 -0
- package/dist/chunk-2KZDHLEJ.mjs +10 -0
- package/dist/chunk-2KZDHLEJ.mjs.map +1 -0
- package/dist/chunk-3IJ454KG.mjs +39 -0
- package/dist/chunk-3IJ454KG.mjs.map +1 -0
- package/dist/chunk-5GJBW3WE.mjs +229 -0
- package/dist/chunk-5GJBW3WE.mjs.map +1 -0
- package/dist/chunk-7MKFY66H.mjs +44 -0
- package/dist/chunk-7MKFY66H.mjs.map +1 -0
- package/dist/chunk-BCT5QU5W.js +142 -0
- package/dist/chunk-BCT5QU5W.js.map +1 -0
- package/dist/chunk-BN5W6FVN.mjs +55 -0
- package/dist/chunk-BN5W6FVN.mjs.map +1 -0
- package/dist/chunk-BRFRPPOW.js +10 -0
- package/dist/chunk-BRFRPPOW.js.map +1 -0
- package/dist/chunk-BZS3AX26.mjs +10 -0
- package/dist/chunk-BZS3AX26.mjs.map +1 -0
- package/dist/chunk-CGCBID7S.mjs +15 -0
- package/dist/chunk-CGCBID7S.mjs.map +1 -0
- package/dist/chunk-J5IF7WUN.js +10 -0
- package/dist/chunk-J5IF7WUN.js.map +1 -0
- package/dist/chunk-NSYSPEHR.js +86 -0
- package/dist/chunk-NSYSPEHR.js.map +1 -0
- package/dist/chunk-NYKSRUWF.js +51 -0
- package/dist/chunk-NYKSRUWF.js.map +1 -0
- package/dist/chunk-O4EXBCND.js +19 -0
- package/dist/chunk-O4EXBCND.js.map +1 -0
- package/dist/chunk-PLWK7HEC.js +75 -0
- package/dist/chunk-PLWK7HEC.js.map +1 -0
- package/dist/chunk-PQLTQYZ3.mjs +15 -0
- package/dist/chunk-PQLTQYZ3.mjs.map +1 -0
- package/dist/chunk-QAW4IRLI.js +55 -0
- package/dist/chunk-QAW4IRLI.js.map +1 -0
- package/dist/chunk-QBXCCJ24.js +344 -0
- package/dist/chunk-QBXCCJ24.js.map +1 -0
- package/dist/chunk-QX75QJ7F.mjs +52 -0
- package/dist/chunk-QX75QJ7F.mjs.map +1 -0
- package/dist/chunk-RZUGRIUF.mjs +17 -0
- package/dist/chunk-RZUGRIUF.mjs.map +1 -0
- package/dist/chunk-UFIMO32F.js +275 -0
- package/dist/chunk-UFIMO32F.js.map +1 -0
- package/dist/chunk-VSICUYFB.js +51 -0
- package/dist/chunk-VSICUYFB.js.map +1 -0
- package/dist/chunk-WYQNSPEX.mjs +10 -0
- package/dist/chunk-WYQNSPEX.mjs.map +1 -0
- package/dist/components/AlertBS.d.mts +18 -0
- package/dist/components/AlertBS.d.ts +18 -0
- package/dist/components/AlertBS.js +9 -0
- package/dist/components/AlertBS.js.map +1 -0
- package/dist/components/AlertBS.mjs +9 -0
- package/dist/components/AlertBS.mjs.map +1 -0
- package/dist/components/BiblioteksentralenProvider.d.mts +10 -0
- package/dist/components/BiblioteksentralenProvider.d.ts +10 -0
- package/dist/components/BiblioteksentralenProvider.js +10 -0
- package/dist/components/BiblioteksentralenProvider.js.map +1 -0
- package/dist/components/BiblioteksentralenProvider.mjs +10 -0
- package/dist/components/BiblioteksentralenProvider.mjs.map +1 -0
- package/dist/components/ButtonBS.d.mts +16 -0
- package/dist/components/ButtonBS.d.ts +16 -0
- package/dist/components/ButtonBS.js +8 -0
- package/dist/components/ButtonBS.js.map +1 -0
- package/dist/components/ButtonBS.mjs +8 -0
- package/dist/components/ButtonBS.mjs.map +1 -0
- package/dist/components/ConditionalWrapperBS.d.mts +15 -0
- package/dist/components/ConditionalWrapperBS.d.ts +15 -0
- package/dist/components/ConditionalWrapperBS.js +8 -0
- package/dist/components/ConditionalWrapperBS.js.map +1 -0
- package/dist/components/ConditionalWrapperBS.mjs +8 -0
- package/dist/components/ConditionalWrapperBS.mjs.map +1 -0
- package/dist/components/ErrorBoundaryBS.d.mts +21 -0
- package/dist/components/ErrorBoundaryBS.d.ts +21 -0
- package/dist/components/ErrorBoundaryBS.js +10 -0
- package/dist/components/ErrorBoundaryBS.js.map +1 -0
- package/dist/components/ErrorBoundaryBS.mjs +10 -0
- package/dist/components/ErrorBoundaryBS.mjs.map +1 -0
- package/dist/components/HashLinkTargetBS.d.mts +16 -0
- package/dist/components/HashLinkTargetBS.d.ts +16 -0
- package/dist/components/HashLinkTargetBS.js +10 -0
- package/dist/components/HashLinkTargetBS.js.map +1 -0
- package/dist/components/HashLinkTargetBS.mjs +10 -0
- package/dist/components/HashLinkTargetBS.mjs.map +1 -0
- package/dist/components/IconButtonBS.d.mts +16 -0
- package/dist/components/IconButtonBS.d.ts +16 -0
- package/dist/components/IconButtonBS.js +8 -0
- package/dist/components/IconButtonBS.js.map +1 -0
- package/dist/components/IconButtonBS.mjs +8 -0
- package/dist/components/IconButtonBS.mjs.map +1 -0
- package/dist/components/InputBS.d.mts +18 -0
- package/dist/components/InputBS.d.ts +18 -0
- package/dist/components/InputBS.js +8 -0
- package/dist/components/InputBS.js.map +1 -0
- package/dist/components/InputBS.mjs +8 -0
- package/dist/components/InputBS.mjs.map +1 -0
- package/dist/components/withErrorBoundaryBS.d.mts +5 -0
- package/dist/components/withErrorBoundaryBS.d.ts +5 -0
- package/dist/components/withErrorBoundaryBS.js +11 -0
- package/dist/components/withErrorBoundaryBS.js.map +1 -0
- package/dist/components/withErrorBoundaryBS.mjs +11 -0
- package/dist/components/withErrorBoundaryBS.mjs.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +13 -106
- package/dist/index.js +38 -748
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -407
- package/dist/index.mjs.map +1 -1
- package/package.json +27 -11
- /package/{LICENSE → dist/LICENSE} +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_without_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9
|
+
}
|
|
10
|
+
function _assert_this_initialized(self) {
|
|
11
|
+
if (self === void 0) {
|
|
12
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
13
|
+
}
|
|
14
|
+
return self;
|
|
15
|
+
}
|
|
16
|
+
function _class_call_check(instance, Constructor) {
|
|
17
|
+
if (!(instance instanceof Constructor)) {
|
|
18
|
+
throw new TypeError("Cannot call a class as a function");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function _defineProperties(target, props) {
|
|
22
|
+
for(var i = 0; i < props.length; i++){
|
|
23
|
+
var descriptor = props[i];
|
|
24
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
25
|
+
descriptor.configurable = true;
|
|
26
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
27
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
31
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
32
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
33
|
+
return Constructor;
|
|
34
|
+
}
|
|
35
|
+
function _define_property(obj, key, value) {
|
|
36
|
+
if (key in obj) {
|
|
37
|
+
Object.defineProperty(obj, key, {
|
|
38
|
+
value: value,
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
obj[key] = value;
|
|
45
|
+
}
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
function _get_prototype_of(o) {
|
|
49
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
50
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
51
|
+
};
|
|
52
|
+
return _get_prototype_of(o);
|
|
53
|
+
}
|
|
54
|
+
function _inherits(subClass, superClass) {
|
|
55
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
56
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
57
|
+
}
|
|
58
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
59
|
+
constructor: {
|
|
60
|
+
value: subClass,
|
|
61
|
+
writable: true,
|
|
62
|
+
configurable: true
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
66
|
+
}
|
|
67
|
+
function _iterable_to_array(iter) {
|
|
68
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
69
|
+
}
|
|
70
|
+
function _non_iterable_spread() {
|
|
71
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
72
|
+
}
|
|
73
|
+
function _object_spread(target) {
|
|
74
|
+
for(var i = 1; i < arguments.length; i++){
|
|
75
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
76
|
+
var ownKeys = Object.keys(source);
|
|
77
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
78
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
79
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
ownKeys.forEach(function(key) {
|
|
83
|
+
_define_property(target, key, source[key]);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return target;
|
|
87
|
+
}
|
|
88
|
+
function _possible_constructor_return(self, call) {
|
|
89
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
90
|
+
return call;
|
|
91
|
+
}
|
|
92
|
+
return _assert_this_initialized(self);
|
|
93
|
+
}
|
|
94
|
+
function _set_prototype_of(o, p) {
|
|
95
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
96
|
+
o.__proto__ = p;
|
|
97
|
+
return o;
|
|
98
|
+
};
|
|
99
|
+
return _set_prototype_of(o, p);
|
|
100
|
+
}
|
|
101
|
+
function _to_consumable_array(arr) {
|
|
102
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
103
|
+
}
|
|
104
|
+
function _type_of(obj) {
|
|
105
|
+
"@swc/helpers - typeof";
|
|
106
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
107
|
+
}
|
|
108
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
109
|
+
if (!o) return;
|
|
110
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
111
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
112
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
113
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
114
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
115
|
+
}
|
|
116
|
+
function _is_native_reflect_construct() {
|
|
117
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
118
|
+
if (Reflect.construct.sham) return false;
|
|
119
|
+
if (typeof Proxy === "function") return true;
|
|
120
|
+
try {
|
|
121
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
122
|
+
return true;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function _create_super(Derived) {
|
|
128
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
129
|
+
return function _createSuperInternal() {
|
|
130
|
+
var Super = _get_prototype_of(Derived), result;
|
|
131
|
+
if (hasNativeReflectConstruct) {
|
|
132
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
133
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
134
|
+
} else {
|
|
135
|
+
result = Super.apply(this, arguments);
|
|
136
|
+
}
|
|
137
|
+
return _possible_constructor_return(this, result);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
Object.defineProperty(exports, "__esModule", {
|
|
141
|
+
value: true
|
|
142
|
+
});
|
|
143
|
+
function _interopRequireDefault(obj) {
|
|
144
|
+
return obj && obj.__esModule ? obj : {
|
|
145
|
+
default: obj
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function _optionalChain(ops) {
|
|
149
|
+
var lastAccessLHS = undefined;
|
|
150
|
+
var value = ops[0];
|
|
151
|
+
var i = 1;
|
|
152
|
+
while(i < ops.length){
|
|
153
|
+
var op = ops[i];
|
|
154
|
+
var fn = ops[i + 1];
|
|
155
|
+
i += 2;
|
|
156
|
+
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
if (op === "access" || op === "optionalAccess") {
|
|
160
|
+
lastAccessLHS = value;
|
|
161
|
+
value = fn(value);
|
|
162
|
+
} else if (op === "call" || op === "optionalCall") {
|
|
163
|
+
var _value;
|
|
164
|
+
value = fn(function() {
|
|
165
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
166
|
+
args[_key] = arguments[_key];
|
|
167
|
+
}
|
|
168
|
+
return (_value = value).call.apply(_value, [
|
|
169
|
+
lastAccessLHS
|
|
170
|
+
].concat(_to_consumable_array(args)));
|
|
171
|
+
});
|
|
172
|
+
lastAccessLHS = undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
"use client";
|
|
178
|
+
var _chunkBCT5QU5Wjs = require("./chunk-BCT5QU5W.js");
|
|
179
|
+
var _chunkQAW4IRLIjs = require("./chunk-QAW4IRLI.js");
|
|
180
|
+
// src/components/ErrorBoundaryBS.tsx
|
|
181
|
+
var _react = require("@chakra-ui/react");
|
|
182
|
+
var _react3 = require("react");
|
|
183
|
+
var _react4 = _interopRequireDefault(_react3);
|
|
184
|
+
var StyledPre = function(props) {
|
|
185
|
+
return /* @__PURE__ */ _react4.default.createElement(_react.Box, _object_spread({
|
|
186
|
+
as: "pre",
|
|
187
|
+
paddingTop: "0.5rem",
|
|
188
|
+
wordBreak: "break-all",
|
|
189
|
+
whiteSpace: "pre-wrap",
|
|
190
|
+
fontSize: "0.8rem"
|
|
191
|
+
}, props));
|
|
192
|
+
};
|
|
193
|
+
var ErrorBoundaryBS = /*#__PURE__*/ function(_react4_default_Component) {
|
|
194
|
+
_inherits(ErrorBoundaryBS, _react4_default_Component);
|
|
195
|
+
var _super = _create_super(ErrorBoundaryBS);
|
|
196
|
+
function ErrorBoundaryBS(props) {
|
|
197
|
+
_class_call_check(this, ErrorBoundaryBS);
|
|
198
|
+
var _this;
|
|
199
|
+
_this = _super.call(this, props);
|
|
200
|
+
_this.state = {
|
|
201
|
+
hasError: false
|
|
202
|
+
};
|
|
203
|
+
return _this;
|
|
204
|
+
}
|
|
205
|
+
_create_class(ErrorBoundaryBS, [
|
|
206
|
+
{
|
|
207
|
+
key: "componentDidCatch",
|
|
208
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
209
|
+
this.setState({
|
|
210
|
+
hasError: true,
|
|
211
|
+
error: error,
|
|
212
|
+
errorInfo: errorInfo
|
|
213
|
+
});
|
|
214
|
+
console.error(error, {
|
|
215
|
+
errorInfo: errorInfo,
|
|
216
|
+
boundaryName: this.props.boundaryName
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
key: "render",
|
|
222
|
+
value: function render() {
|
|
223
|
+
if (this.state.hasError) {
|
|
224
|
+
var stackTrace = _optionalChain([
|
|
225
|
+
this,
|
|
226
|
+
"access",
|
|
227
|
+
function(_) {
|
|
228
|
+
return _.state;
|
|
229
|
+
},
|
|
230
|
+
"access",
|
|
231
|
+
function(_2) {
|
|
232
|
+
return _2.errorInfo;
|
|
233
|
+
},
|
|
234
|
+
"optionalAccess",
|
|
235
|
+
function(_3) {
|
|
236
|
+
return _3.componentStack;
|
|
237
|
+
}
|
|
238
|
+
]);
|
|
239
|
+
var errormsg = _optionalChain([
|
|
240
|
+
this,
|
|
241
|
+
"access",
|
|
242
|
+
function(_4) {
|
|
243
|
+
return _4.state;
|
|
244
|
+
},
|
|
245
|
+
"access",
|
|
246
|
+
function(_5) {
|
|
247
|
+
return _5.error;
|
|
248
|
+
},
|
|
249
|
+
"optionalAccess",
|
|
250
|
+
function(_6) {
|
|
251
|
+
return _6.message;
|
|
252
|
+
}
|
|
253
|
+
]);
|
|
254
|
+
var info = this.props.boundaryName;
|
|
255
|
+
return /* @__PURE__ */ _react4.default.createElement("div", null, /* @__PURE__ */ _react4.default.createElement(_chunkBCT5QU5Wjs.AlertBS, {
|
|
256
|
+
status: "error"
|
|
257
|
+
}, /* @__PURE__ */ _react4.default.createElement("p", null, "Beklager, det skjedde en teknisk feil."), _chunkQAW4IRLIjs.isDevelopment.call(void 0) && (stackTrace || errormsg) && /* @__PURE__ */ _react4.default.createElement("div", null, /* @__PURE__ */ _react4.default.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ _react4.default.createElement(StyledPre, null, info || ""), /* @__PURE__ */ _react4.default.createElement(StyledPre, null, stackTrace || ""))));
|
|
258
|
+
}
|
|
259
|
+
return this.props.children;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
], [
|
|
263
|
+
{
|
|
264
|
+
key: "getDerivedStateFromError",
|
|
265
|
+
value: function getDerivedStateFromError(error) {
|
|
266
|
+
return {
|
|
267
|
+
hasError: true
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
]);
|
|
272
|
+
return ErrorBoundaryBS;
|
|
273
|
+
}(_react4.default.Component);
|
|
274
|
+
exports.ErrorBoundaryBS = ErrorBoundaryBS;
|
|
275
|
+
//# sourceMappingURL=chunk-UFIMO32F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ErrorBoundaryBS.tsx"],"names":[],"mappings":";;;;;;;;;AACA,SAAS,WAAqB;AAC9B,OAAO,WAAqC;AAc5C,IAAM,YAAY,CAAC,UACjB,oCAAC,OAAI,IAAG,OAAM,YAAW,UAAS,WAAU,aAAY,YAAW,YAAW,UAAS,UAAU,GAAG,OAAO;AAGtG,IAAM,kBAAN,cAA8B,MAAM,UAAwB;AAAA,EACjE,YAAY,OAAY;AACtB,UAAM,KAAK;AACX,SAAK,QAAQ,EAAE,UAAU,MAAM;AAAA,EACjC;AAAA,EAEA,OAAO,yBAAyB,OAAY;AAC1C,WAAO,EAAE,UAAU,KAAK;AAAA,EAC1B;AAAA,EAEA,kBAAkB,OAAY,WAAgB;AAC5C,SAAK,SAAS,EAAE,UAAU,MAAM,OAAO,UAAU,CAAC;AAClD,YAAQ,MAAM,OAAO,EAAE,WAAW,cAAc,KAAK,MAAM,aAAa,CAAC;AAAA,EAC3E;AAAA,EAEA,SAAS;AACP,QAAI,KAAK,MAAM,UAAU;AACvB,YAAM,aAAa,KAAK,MAAM,WAAW;AACzC,YAAM,WAAW,KAAK,MAAM,OAAO;AACnC,YAAM,OAAO,KAAK,MAAM;AAExB,aACE,oCAAC,aACC,oCAAC,WAAQ,QAAO,WACd,oCAAC,WAAE,wCAAsC,GACxC,cAAc,MAAM,cAAc,aACjC,oCAAC,aACC,oCAAC,iBAAW,YAAY,EAAG,GAC3B,oCAAC,iBAAW,QAAQ,EAAG,GACvB,oCAAC,iBAAW,cAAc,EAAG,CAC/B,CAEJ,CACF;AAAA,IAEJ;AAEA,WAAO,KAAK,MAAM;AAAA,EACpB;AACF","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"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
Object.defineProperty(exports, "__esModule", {
|
|
31
|
+
value: true
|
|
32
|
+
});
|
|
33
|
+
function _interopRequireDefault(obj) {
|
|
34
|
+
return obj && obj.__esModule ? obj : {
|
|
35
|
+
default: obj
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
"use client";
|
|
39
|
+
var _chunkUFIMO32Fjs = require("./chunk-UFIMO32F.js");
|
|
40
|
+
// src/components/withErrorBoundaryBS.tsx
|
|
41
|
+
var _react = require("react");
|
|
42
|
+
var _react2 = _interopRequireDefault(_react);
|
|
43
|
+
var withErrorBoundaryBS = function(Component, boundaryName) {
|
|
44
|
+
return function(props) {
|
|
45
|
+
return /* @__PURE__ */ _react2.default.createElement(_chunkUFIMO32Fjs.ErrorBoundaryBS, {
|
|
46
|
+
boundaryName: boundaryName
|
|
47
|
+
}, /* @__PURE__ */ _react2.default.createElement(Component, _object_spread({}, props)));
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.withErrorBoundaryBS = withErrorBoundaryBS;
|
|
51
|
+
//# sourceMappingURL=chunk-VSICUYFB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/withErrorBoundaryBS.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,WAAW;AAGX,IAAM,sBAAsB,CAAS,WAAuC,iBAAyB;AAC1G,SAAO,CAAC,UACN,oCAAC,mBAAgB,gBACf,oCAAC,aAAW,GAAG,OAAO,CACxB;AAEJ","sourcesContent":["import React from \"react\";\nimport { ErrorBoundaryBS } from \"./ErrorBoundaryBS\";\n\nexport const withErrorBoundaryBS = <Props,>(Component: React.ComponentType<Props>, boundaryName: string) => {\n return (props: Props & React.JSX.IntrinsicAttributes) => (\n <ErrorBoundaryBS boundaryName={boundaryName}>\n <Component {...props} />\n </ErrorBoundaryBS>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ButtonBS.tsx"],"sourcesContent":["import { Modify } from \"@biblioteksentralen/types\";\nimport { Button as ChakraButton, ButtonProps as NativeButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras Button with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype ButtonVariants = NativeButtonProps[\"variant\"] | CustomButtonVariants;\nexport type ButtonBSProps = Modify<NativeButtonProps, { variant?: ButtonVariants }>;\nexport const ButtonBS = ChakraButton as ComponentWithAs<\"button\", ButtonBSProps>;\n"],"mappings":";;;AACA,SAAS,UAAU,oBAAsD;AAUlE,IAAM,WAAW;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Modify } from '@biblioteksentralen/types';
|
|
2
|
+
import { AlertRootProps } from '@chakra-ui/react';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type Status = "info" | "warning" | "success" | "error";
|
|
6
|
+
type CustomVariants = "inline";
|
|
7
|
+
type Variants = AlertRootProps["variant"] | CustomVariants;
|
|
8
|
+
interface Props extends Modify<AlertRootProps, {
|
|
9
|
+
variant?: Variants;
|
|
10
|
+
}> {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
header?: ReactNode;
|
|
13
|
+
status: Status;
|
|
14
|
+
variant?: Variants;
|
|
15
|
+
}
|
|
16
|
+
declare function AlertBS({ status, children, variant, header, ...rest }: Props): React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { AlertBS };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Modify } from '@biblioteksentralen/types';
|
|
2
|
+
import { AlertRootProps } from '@chakra-ui/react';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type Status = "info" | "warning" | "success" | "error";
|
|
6
|
+
type CustomVariants = "inline";
|
|
7
|
+
type Variants = AlertRootProps["variant"] | CustomVariants;
|
|
8
|
+
interface Props extends Modify<AlertRootProps, {
|
|
9
|
+
variant?: Variants;
|
|
10
|
+
}> {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
header?: ReactNode;
|
|
13
|
+
status: Status;
|
|
14
|
+
variant?: Variants;
|
|
15
|
+
}
|
|
16
|
+
declare function AlertBS({ status, children, variant, header, ...rest }: Props): React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { AlertBS };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
"use client";
|
|
6
|
+
var _chunkBCT5QU5Wjs = require("../chunk-BCT5QU5W.js");
|
|
7
|
+
require("../chunk-QAW4IRLI.js");
|
|
8
|
+
exports.AlertBS = _chunkBCT5QU5Wjs.AlertBS;
|
|
9
|
+
//# sourceMappingURL=AlertBS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { SystemConfig } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
customTheme?: SystemConfig;
|
|
7
|
+
}
|
|
8
|
+
declare const BiblioteksentralenProvider: (props: Props) => React.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { BiblioteksentralenProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { SystemConfig } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
customTheme?: SystemConfig;
|
|
7
|
+
}
|
|
8
|
+
declare const BiblioteksentralenProvider: (props: Props) => React.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { BiblioteksentralenProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
"use client";
|
|
6
|
+
var _chunkNYKSRUWFjs = require("../chunk-NYKSRUWF.js");
|
|
7
|
+
require("../chunk-QBXCCJ24.js");
|
|
8
|
+
require("../chunk-QAW4IRLI.js");
|
|
9
|
+
exports.BiblioteksentralenProvider = _chunkNYKSRUWFjs.BiblioteksentralenProvider;
|
|
10
|
+
//# sourceMappingURL=BiblioteksentralenProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Modify } from '@biblioteksentralen/types';
|
|
2
|
+
import { ButtonProps } from '@chakra-ui/react';
|
|
3
|
+
import { ComponentWithAs } from '@chakra-ui/system';
|
|
4
|
+
import { C as CustomButtonVariants } from '../ButtonStyles-7ASDoOwZ.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Re-exporting chackras Button with a customised types
|
|
8
|
+
* This causes both chakras native variants and our home-made variants to show up in auto-complete
|
|
9
|
+
*/
|
|
10
|
+
type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
|
|
11
|
+
type ButtonBSProps = Modify<ButtonProps, {
|
|
12
|
+
variant?: ButtonVariants;
|
|
13
|
+
}>;
|
|
14
|
+
declare const ButtonBS: ComponentWithAs<"button", ButtonBSProps>;
|
|
15
|
+
|
|
16
|
+
export { ButtonBS, type ButtonBSProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Modify } from '@biblioteksentralen/types';
|
|
2
|
+
import { ButtonProps } from '@chakra-ui/react';
|
|
3
|
+
import { ComponentWithAs } from '@chakra-ui/system';
|
|
4
|
+
import { C as CustomButtonVariants } from '../ButtonStyles-7ASDoOwZ.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Re-exporting chackras Button with a customised types
|
|
8
|
+
* This causes both chakras native variants and our home-made variants to show up in auto-complete
|
|
9
|
+
*/
|
|
10
|
+
type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
|
|
11
|
+
type ButtonBSProps = Modify<ButtonProps, {
|
|
12
|
+
variant?: ButtonVariants;
|
|
13
|
+
}>;
|
|
14
|
+
declare const ButtonBS: ComponentWithAs<"button", ButtonBSProps>;
|
|
15
|
+
|
|
16
|
+
export { ButtonBS, type ButtonBSProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
wrapper: FunctionComponent<{
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
condition: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
|
|
12
|
+
*/
|
|
13
|
+
declare const ConditionalWrapperBS: FunctionComponent<Props>;
|
|
14
|
+
|
|
15
|
+
export { ConditionalWrapperBS };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
wrapper: FunctionComponent<{
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
condition: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
|
|
12
|
+
*/
|
|
13
|
+
declare const ConditionalWrapperBS: FunctionComponent<Props>;
|
|
14
|
+
|
|
15
|
+
export { ConditionalWrapperBS };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
"use client";
|
|
6
|
+
var _chunkO4EXBCNDjs = require("../chunk-O4EXBCND.js");
|
|
7
|
+
exports.ConditionalWrapperBS = _chunkO4EXBCNDjs.ConditionalWrapperBS;
|
|
8
|
+
//# sourceMappingURL=ConditionalWrapperBS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
boundaryName?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface State {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error?: Error;
|
|
10
|
+
errorInfo?: ErrorInfo;
|
|
11
|
+
}
|
|
12
|
+
declare class ErrorBoundaryBS extends React.Component<Props, State> {
|
|
13
|
+
constructor(props: any);
|
|
14
|
+
static getDerivedStateFromError(error: any): {
|
|
15
|
+
hasError: boolean;
|
|
16
|
+
};
|
|
17
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
18
|
+
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ErrorBoundaryBS };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
boundaryName?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface State {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error?: Error;
|
|
10
|
+
errorInfo?: ErrorInfo;
|
|
11
|
+
}
|
|
12
|
+
declare class ErrorBoundaryBS extends React.Component<Props, State> {
|
|
13
|
+
constructor(props: any);
|
|
14
|
+
static getDerivedStateFromError(error: any): {
|
|
15
|
+
hasError: boolean;
|
|
16
|
+
};
|
|
17
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
18
|
+
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ErrorBoundaryBS };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
"use client";
|
|
6
|
+
var _chunkUFIMO32Fjs = require("../chunk-UFIMO32F.js");
|
|
7
|
+
require("../chunk-BCT5QU5W.js");
|
|
8
|
+
require("../chunk-QAW4IRLI.js");
|
|
9
|
+
exports.ErrorBoundaryBS = _chunkUFIMO32Fjs.ErrorBoundaryBS;
|
|
10
|
+
//# sourceMappingURL=ErrorBoundaryBS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|