@biblioteksentralen/react 4.0.0-beta.1 → 4.0.0-beta.3
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/index.d.mts +106 -15
- package/dist/index.d.ts +106 -15
- package/dist/index.js +739 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +646 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -12
- package/dist/ButtonStyles-CRAk2YIJ.d.mts +0 -3
- package/dist/ButtonStyles-CRAk2YIJ.d.ts +0 -3
- package/dist/chunk-2KZDHLEJ.mjs +0 -9
- package/dist/chunk-2KZDHLEJ.mjs.map +0 -1
- package/dist/chunk-3IJ454KG.mjs +0 -185
- package/dist/chunk-3IJ454KG.mjs.map +0 -1
- package/dist/chunk-5GJBW3WE.mjs +0 -270
- package/dist/chunk-5GJBW3WE.mjs.map +0 -1
- package/dist/chunk-7MKFY66H.mjs +0 -65
- package/dist/chunk-7MKFY66H.mjs.map +0 -1
- package/dist/chunk-BCT5QU5W.js +0 -142
- package/dist/chunk-BCT5QU5W.js.map +0 -1
- package/dist/chunk-BN5W6FVN.mjs +0 -50
- package/dist/chunk-BN5W6FVN.mjs.map +0 -1
- package/dist/chunk-BRFRPPOW.js +0 -10
- package/dist/chunk-BRFRPPOW.js.map +0 -1
- package/dist/chunk-BZS3AX26.mjs +0 -6
- package/dist/chunk-BZS3AX26.mjs.map +0 -1
- package/dist/chunk-CGCBID7S.mjs +0 -41
- package/dist/chunk-CGCBID7S.mjs.map +0 -1
- package/dist/chunk-J5IF7WUN.js +0 -10
- package/dist/chunk-J5IF7WUN.js.map +0 -1
- package/dist/chunk-NSYSPEHR.js +0 -86
- package/dist/chunk-NSYSPEHR.js.map +0 -1
- package/dist/chunk-NYKSRUWF.js +0 -51
- package/dist/chunk-NYKSRUWF.js.map +0 -1
- package/dist/chunk-O4EXBCND.js +0 -19
- package/dist/chunk-O4EXBCND.js.map +0 -1
- package/dist/chunk-PLWK7HEC.js +0 -75
- package/dist/chunk-PLWK7HEC.js.map +0 -1
- package/dist/chunk-PQLTQYZ3.mjs +0 -41
- package/dist/chunk-PQLTQYZ3.mjs.map +0 -1
- package/dist/chunk-QAW4IRLI.js +0 -55
- package/dist/chunk-QAW4IRLI.js.map +0 -1
- package/dist/chunk-QBXCCJ24.js +0 -344
- package/dist/chunk-QBXCCJ24.js.map +0 -1
- package/dist/chunk-QX75QJ7F.mjs +0 -132
- package/dist/chunk-QX75QJ7F.mjs.map +0 -1
- package/dist/chunk-RZUGRIUF.mjs +0 -76
- package/dist/chunk-RZUGRIUF.mjs.map +0 -1
- package/dist/chunk-UFIMO32F.js +0 -275
- package/dist/chunk-UFIMO32F.js.map +0 -1
- package/dist/chunk-VSICUYFB.js +0 -51
- package/dist/chunk-VSICUYFB.js.map +0 -1
- package/dist/chunk-WYQNSPEX.mjs +0 -6
- package/dist/chunk-WYQNSPEX.mjs.map +0 -1
- package/dist/components/AlertBS.d.mts +0 -18
- package/dist/components/AlertBS.d.ts +0 -18
- package/dist/components/AlertBS.js +0 -9
- package/dist/components/AlertBS.js.map +0 -1
- package/dist/components/AlertBS.mjs +0 -5
- package/dist/components/AlertBS.mjs.map +0 -1
- package/dist/components/BiblioteksentralenProvider.d.mts +0 -10
- package/dist/components/BiblioteksentralenProvider.d.ts +0 -10
- package/dist/components/BiblioteksentralenProvider.js +0 -10
- package/dist/components/BiblioteksentralenProvider.js.map +0 -1
- package/dist/components/BiblioteksentralenProvider.mjs +0 -6
- package/dist/components/BiblioteksentralenProvider.mjs.map +0 -1
- package/dist/components/ButtonBS.d.mts +0 -16
- package/dist/components/ButtonBS.d.ts +0 -16
- package/dist/components/ButtonBS.js +0 -8
- package/dist/components/ButtonBS.js.map +0 -1
- package/dist/components/ButtonBS.mjs +0 -4
- package/dist/components/ButtonBS.mjs.map +0 -1
- package/dist/components/ConditionalWrapperBS.d.mts +0 -15
- package/dist/components/ConditionalWrapperBS.d.ts +0 -15
- package/dist/components/ConditionalWrapperBS.js +0 -8
- package/dist/components/ConditionalWrapperBS.js.map +0 -1
- package/dist/components/ConditionalWrapperBS.mjs +0 -4
- package/dist/components/ConditionalWrapperBS.mjs.map +0 -1
- package/dist/components/ErrorBoundaryBS.d.mts +0 -21
- package/dist/components/ErrorBoundaryBS.d.ts +0 -21
- package/dist/components/ErrorBoundaryBS.js +0 -10
- package/dist/components/ErrorBoundaryBS.js.map +0 -1
- package/dist/components/ErrorBoundaryBS.mjs +0 -6
- package/dist/components/ErrorBoundaryBS.mjs.map +0 -1
- package/dist/components/HashLinkTargetBS.d.mts +0 -16
- package/dist/components/HashLinkTargetBS.d.ts +0 -16
- package/dist/components/HashLinkTargetBS.js +0 -10
- package/dist/components/HashLinkTargetBS.js.map +0 -1
- package/dist/components/HashLinkTargetBS.mjs +0 -6
- package/dist/components/HashLinkTargetBS.mjs.map +0 -1
- package/dist/components/IconButtonBS.d.mts +0 -16
- package/dist/components/IconButtonBS.d.ts +0 -16
- package/dist/components/IconButtonBS.js +0 -8
- package/dist/components/IconButtonBS.js.map +0 -1
- package/dist/components/IconButtonBS.mjs +0 -4
- package/dist/components/IconButtonBS.mjs.map +0 -1
- package/dist/components/InputBS.d.mts +0 -18
- package/dist/components/InputBS.d.ts +0 -18
- package/dist/components/InputBS.js +0 -8
- package/dist/components/InputBS.js.map +0 -1
- package/dist/components/InputBS.mjs +0 -4
- package/dist/components/InputBS.mjs.map +0 -1
- package/dist/components/withErrorBoundaryBS.d.mts +0 -5
- package/dist/components/withErrorBoundaryBS.d.ts +0 -5
- package/dist/components/withErrorBoundaryBS.js +0 -11
- package/dist/components/withErrorBoundaryBS.js.map +0 -1
- package/dist/components/withErrorBoundaryBS.mjs +0 -7
- package/dist/components/withErrorBoundaryBS.mjs.map +0 -1
- /package/{dist/LICENSE → LICENSE} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,648 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 _object_without_properties(source, excluded) {
|
|
75
|
+
if (source == null) return {};
|
|
76
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
77
|
+
var key, i;
|
|
78
|
+
if (Object.getOwnPropertySymbols) {
|
|
79
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
80
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
81
|
+
key = sourceSymbolKeys[i];
|
|
82
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
83
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
84
|
+
target[key] = source[key];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
function _object_without_properties_loose(source, excluded) {
|
|
90
|
+
if (source == null) return {};
|
|
91
|
+
var target = {};
|
|
92
|
+
var sourceKeys = Object.keys(source);
|
|
93
|
+
var key, i;
|
|
94
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
95
|
+
key = sourceKeys[i];
|
|
96
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
97
|
+
target[key] = source[key];
|
|
98
|
+
}
|
|
99
|
+
return target;
|
|
100
|
+
}
|
|
101
|
+
function _possible_constructor_return(self, call) {
|
|
102
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
103
|
+
return call;
|
|
104
|
+
}
|
|
105
|
+
return _assert_this_initialized(self);
|
|
106
|
+
}
|
|
107
|
+
function _set_prototype_of(o, p) {
|
|
108
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
109
|
+
o.__proto__ = p;
|
|
110
|
+
return o;
|
|
111
|
+
};
|
|
112
|
+
return _set_prototype_of(o, p);
|
|
113
|
+
}
|
|
114
|
+
function _type_of(obj) {
|
|
115
|
+
"@swc/helpers - typeof";
|
|
116
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
117
|
+
}
|
|
118
|
+
function _is_native_reflect_construct() {
|
|
119
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
120
|
+
if (Reflect.construct.sham) return false;
|
|
121
|
+
if (typeof Proxy === "function") return true;
|
|
122
|
+
try {
|
|
123
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
124
|
+
return true;
|
|
125
|
+
} catch (e) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function _create_super(Derived) {
|
|
130
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
131
|
+
return function _createSuperInternal() {
|
|
132
|
+
var Super = _get_prototype_of(Derived), result;
|
|
133
|
+
if (hasNativeReflectConstruct) {
|
|
134
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
135
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
136
|
+
} else {
|
|
137
|
+
result = Super.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
return _possible_constructor_return(this, result);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
var _defaultConfig_theme_recipes_button_variants, _defaultConfig_theme_recipes_button, _defaultConfig_theme_recipes, _defaultConfig_theme;
|
|
143
|
+
// ../utils/dist/index.mjs
|
|
144
|
+
import { format } from "date-fns/format";
|
|
145
|
+
import { nb } from "date-fns/locale/nb";
|
|
146
|
+
var colors = {
|
|
147
|
+
black: "#000000",
|
|
148
|
+
grey90: "#181818",
|
|
149
|
+
grey80: "#333333",
|
|
150
|
+
grey60: "#585858",
|
|
151
|
+
grey45: "#8c8c8c",
|
|
152
|
+
grey30: "#b2b2b2",
|
|
153
|
+
grey15: "#d9d9d9",
|
|
154
|
+
grey10: "#e5e5e5",
|
|
155
|
+
grey05: "#f2f2f2",
|
|
156
|
+
white: "#ffffff",
|
|
157
|
+
bsRødDark: "#870010",
|
|
158
|
+
bsRødMedium: "#d53d40",
|
|
159
|
+
accentPurple: "#331433",
|
|
160
|
+
accentPeach: "#ffba99",
|
|
161
|
+
accentGreen: "#003b29",
|
|
162
|
+
accentBlueDark: "#001740",
|
|
163
|
+
accentBlueMedium: "#5996de",
|
|
164
|
+
accentYellow: "#ffc970",
|
|
165
|
+
lightBlue: "#dbe8ef",
|
|
166
|
+
lightGreen: "#dbe0db",
|
|
167
|
+
lightPeach: "#f4e7de",
|
|
168
|
+
lightPurple: "#ece8f3",
|
|
169
|
+
statusRed: "#ad313c",
|
|
170
|
+
statusYellow: "#bc5600",
|
|
171
|
+
statusGreen: "#24845b",
|
|
172
|
+
statusGreenLight: "#edf4f1",
|
|
173
|
+
statusRedLight: "#f8efef",
|
|
174
|
+
statusYellowLight: "#fff6e4",
|
|
175
|
+
neptune: {
|
|
176
|
+
"100": "#CFE6E8",
|
|
177
|
+
"200": "#9FCDD2",
|
|
178
|
+
"300": "#6FB5BB",
|
|
179
|
+
"400": "#3F9CA5",
|
|
180
|
+
"500": "#0F838E",
|
|
181
|
+
"600": "#0C6972",
|
|
182
|
+
"700": "#094F55",
|
|
183
|
+
"800": "#063439",
|
|
184
|
+
"900": "#031A1C"
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
function isDevelopment() {
|
|
188
|
+
return process.env.NODE_ENV === "development";
|
|
189
|
+
}
|
|
190
|
+
// src/components/AlertBS.tsx
|
|
191
|
+
import { Alert as ChakraAlert } from "@chakra-ui/react";
|
|
192
|
+
import React from "react";
|
|
193
|
+
import { AlertCircle, CheckCircle, Info, XCircle } from "react-feather";
|
|
194
|
+
var colorLookup = {
|
|
195
|
+
info: {
|
|
196
|
+
bg: colors.lightBlue,
|
|
197
|
+
color: colors.accentBlueMedium
|
|
198
|
+
},
|
|
199
|
+
warning: {
|
|
200
|
+
bg: colors.statusYellowLight,
|
|
201
|
+
color: colors.statusYellow
|
|
202
|
+
},
|
|
203
|
+
success: {
|
|
204
|
+
bg: colors.statusGreenLight,
|
|
205
|
+
color: colors.statusGreen
|
|
206
|
+
},
|
|
207
|
+
error: {
|
|
208
|
+
bg: colors.statusRedLight,
|
|
209
|
+
color: colors.statusRed
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
var iconLookup = {
|
|
213
|
+
info: /* @__PURE__ */ React.createElement(Info, {
|
|
214
|
+
strokeWidth: 1.75,
|
|
215
|
+
role: "img",
|
|
216
|
+
"aria-label": "Informasjon"
|
|
217
|
+
}),
|
|
218
|
+
warning: /* @__PURE__ */ React.createElement(AlertCircle, {
|
|
219
|
+
strokeWidth: 1.75,
|
|
220
|
+
role: "img",
|
|
221
|
+
"aria-label": "Advarsel"
|
|
222
|
+
}),
|
|
223
|
+
success: /* @__PURE__ */ React.createElement(CheckCircle, {
|
|
224
|
+
strokeWidth: 1.75,
|
|
225
|
+
role: "img",
|
|
226
|
+
"aria-label": "Suksess"
|
|
227
|
+
}),
|
|
228
|
+
error: /* @__PURE__ */ React.createElement(XCircle, {
|
|
229
|
+
strokeWidth: 1.75,
|
|
230
|
+
role: "img",
|
|
231
|
+
"aria-label": "Feil"
|
|
232
|
+
})
|
|
233
|
+
};
|
|
234
|
+
var variantStyles = {
|
|
235
|
+
inline: {
|
|
236
|
+
borderColor: "transparent",
|
|
237
|
+
backgroundColor: "transparent",
|
|
238
|
+
padding: "0"
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
function AlertBS(_param) {
|
|
242
|
+
var status = _param.status, children = _param.children, variant = _param.variant, header = _param.header, rest = _object_without_properties(_param, [
|
|
243
|
+
"status",
|
|
244
|
+
"children",
|
|
245
|
+
"variant",
|
|
246
|
+
"header"
|
|
247
|
+
]);
|
|
248
|
+
var colors2 = colorLookup[status];
|
|
249
|
+
return /* @__PURE__ */ React.createElement(ChakraAlert.Root, _object_spread({
|
|
250
|
+
status: status,
|
|
251
|
+
fontSize: "md",
|
|
252
|
+
border: "0.1rem solid",
|
|
253
|
+
borderColor: colors2.color,
|
|
254
|
+
backgroundColor: colors2.bg,
|
|
255
|
+
display: "flex",
|
|
256
|
+
flexWrap: "wrap"
|
|
257
|
+
}, variant === "inline" ? variantStyles[variant] : {}, rest), /* @__PURE__ */ React.createElement(ChakraAlert.Indicator, {
|
|
258
|
+
marginX: "auto"
|
|
259
|
+
}, iconLookup[status]), /* @__PURE__ */ React.createElement(ChakraAlert.Content, {
|
|
260
|
+
color: "black"
|
|
261
|
+
}, header && /* @__PURE__ */ React.createElement(ChakraAlert.Title, null, header), /* @__PURE__ */ React.createElement(ChakraAlert.Description, null, children)));
|
|
262
|
+
}
|
|
263
|
+
// src/components/ButtonBS.tsx
|
|
264
|
+
import { Button as ChakraButton } from "@chakra-ui/react";
|
|
265
|
+
var ButtonBS = ChakraButton;
|
|
266
|
+
// src/components/IconButtonBS.tsx
|
|
267
|
+
import { IconButton as ChakraIconButton } from "@chakra-ui/react";
|
|
268
|
+
var IconButtonBS = ChakraIconButton;
|
|
269
|
+
// src/components/InputBS.tsx
|
|
270
|
+
import { Input as ChakraInput, Field, VisuallyHidden } from "@chakra-ui/react";
|
|
271
|
+
import React2 from "react";
|
|
272
|
+
var InputBS = function(props) {
|
|
273
|
+
var labelProps = props.labelProps, label = props.label, helperText = props.helperText, errorMessage = props.errorMessage, hideLabel = props.hideLabel, inputProps = _object_without_properties(props, [
|
|
274
|
+
"labelProps",
|
|
275
|
+
"label",
|
|
276
|
+
"helperText",
|
|
277
|
+
"errorMessage",
|
|
278
|
+
"hideLabel"
|
|
279
|
+
]);
|
|
280
|
+
var formLabel = /* @__PURE__ */ React2.createElement(Field.Label, _object_spread({}, labelProps), label);
|
|
281
|
+
return /* @__PURE__ */ React2.createElement(Field.Root, {
|
|
282
|
+
invalid: !!errorMessage
|
|
283
|
+
}, hideLabel ? /* @__PURE__ */ React2.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ React2.createElement(FieldHelperText, null, helperText), /* @__PURE__ */ React2.createElement(ChakraInput, _object_spread({}, inputProps)), errorMessage && /* @__PURE__ */ React2.createElement(FieldErrorText, null, errorMessage));
|
|
284
|
+
};
|
|
285
|
+
// src/components/ConditionalWrapperBS.tsx
|
|
286
|
+
import React3 from "react";
|
|
287
|
+
var ConditionalWrapperBS = function(param) {
|
|
288
|
+
var condition = param.condition, children = param.children, Wrapper = param.wrapper;
|
|
289
|
+
return condition ? /* @__PURE__ */ React3.createElement(Wrapper, null, children) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
290
|
+
};
|
|
291
|
+
// src/components/ErrorBoundaryBS.tsx
|
|
292
|
+
import { Box } from "@chakra-ui/react";
|
|
293
|
+
import React4 from "react";
|
|
294
|
+
var StyledPre = function(props) {
|
|
295
|
+
return /* @__PURE__ */ React4.createElement(Box, _object_spread({
|
|
296
|
+
as: "pre",
|
|
297
|
+
paddingTop: "0.5rem",
|
|
298
|
+
wordBreak: "break-all",
|
|
299
|
+
whiteSpace: "pre-wrap",
|
|
300
|
+
fontSize: "0.8rem"
|
|
301
|
+
}, props));
|
|
302
|
+
};
|
|
303
|
+
var ErrorBoundaryBS = /*#__PURE__*/ function(_React4_Component) {
|
|
304
|
+
"use strict";
|
|
305
|
+
_inherits(ErrorBoundaryBS, _React4_Component);
|
|
306
|
+
var _super = _create_super(ErrorBoundaryBS);
|
|
307
|
+
function ErrorBoundaryBS(props) {
|
|
308
|
+
_class_call_check(this, ErrorBoundaryBS);
|
|
309
|
+
var _this;
|
|
310
|
+
_this = _super.call(this, props);
|
|
311
|
+
_this.state = {
|
|
312
|
+
hasError: false
|
|
313
|
+
};
|
|
314
|
+
return _this;
|
|
315
|
+
}
|
|
316
|
+
_create_class(ErrorBoundaryBS, [
|
|
317
|
+
{
|
|
318
|
+
key: "componentDidCatch",
|
|
319
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
320
|
+
this.setState({
|
|
321
|
+
hasError: true,
|
|
322
|
+
error: error,
|
|
323
|
+
errorInfo: errorInfo
|
|
324
|
+
});
|
|
325
|
+
console.error(error, {
|
|
326
|
+
errorInfo: errorInfo,
|
|
327
|
+
boundaryName: this.props.boundaryName
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
key: "render",
|
|
333
|
+
value: function render() {
|
|
334
|
+
if (this.state.hasError) {
|
|
335
|
+
var _this_state_errorInfo, _this_state_error;
|
|
336
|
+
var stackTrace = (_this_state_errorInfo = this.state.errorInfo) === null || _this_state_errorInfo === void 0 ? void 0 : _this_state_errorInfo.componentStack;
|
|
337
|
+
var errormsg = (_this_state_error = this.state.error) === null || _this_state_error === void 0 ? void 0 : _this_state_error.message;
|
|
338
|
+
var info = this.props.boundaryName;
|
|
339
|
+
return /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(AlertBS, {
|
|
340
|
+
status: "error"
|
|
341
|
+
}, /* @__PURE__ */ React4.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React4.createElement("div", null, /* @__PURE__ */ React4.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ React4.createElement(StyledPre, null, info || ""), /* @__PURE__ */ React4.createElement(StyledPre, null, stackTrace || ""))));
|
|
342
|
+
}
|
|
343
|
+
return this.props.children;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
], [
|
|
347
|
+
{
|
|
348
|
+
key: "getDerivedStateFromError",
|
|
349
|
+
value: function getDerivedStateFromError(error) {
|
|
350
|
+
return {
|
|
351
|
+
hasError: true
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
]);
|
|
356
|
+
return ErrorBoundaryBS;
|
|
357
|
+
}(React4.Component);
|
|
358
|
+
// src/components/HashLinkTargetBS.tsx
|
|
359
|
+
import { Box as Box2 } from "@chakra-ui/react";
|
|
360
|
+
import React5 from "react";
|
|
361
|
+
// src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
|
|
362
|
+
import { defineConfig, defineTokens } from "@chakra-ui/react";
|
|
363
|
+
// src/styles/chakraTheme/ButtonStyles.ts
|
|
364
|
+
import { defaultConfig, defineRecipe } from "@chakra-ui/react";
|
|
365
|
+
var variants = _object_spread({
|
|
366
|
+
primary: {
|
|
367
|
+
backgroundColor: colors.black,
|
|
368
|
+
color: "white",
|
|
369
|
+
_hover: {
|
|
370
|
+
backgroundColor: "hsla(0deg, 0%, 70%, 1)",
|
|
371
|
+
color: "black"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
secondary: {
|
|
375
|
+
borderColor: "currentColor",
|
|
376
|
+
color: "currentColor",
|
|
377
|
+
backgroundColor: "transparent",
|
|
378
|
+
_hover: {
|
|
379
|
+
backgroundColor: "currentColor/7"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
tertiary: {
|
|
383
|
+
color: "currentColor",
|
|
384
|
+
backgroundColor: "transparent",
|
|
385
|
+
_hover: {
|
|
386
|
+
backgroundColor: "currentColor/7"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}, (_defaultConfig_theme = defaultConfig.theme) === null || _defaultConfig_theme === void 0 ? void 0 : (_defaultConfig_theme_recipes = _defaultConfig_theme.recipes) === null || _defaultConfig_theme_recipes === void 0 ? void 0 : (_defaultConfig_theme_recipes_button = _defaultConfig_theme_recipes.button) === null || _defaultConfig_theme_recipes_button === void 0 ? void 0 : (_defaultConfig_theme_recipes_button_variants = _defaultConfig_theme_recipes_button.variants) === null || _defaultConfig_theme_recipes_button_variants === void 0 ? void 0 : _defaultConfig_theme_recipes_button_variants.variant);
|
|
390
|
+
var ButtonStyles = defineRecipe({
|
|
391
|
+
base: {
|
|
392
|
+
borderColor: "transparent",
|
|
393
|
+
borderWidth: "0.1em",
|
|
394
|
+
fontWeight: 600,
|
|
395
|
+
_disabled: {
|
|
396
|
+
backgroundColor: "".concat(colors.grey45),
|
|
397
|
+
color: "white",
|
|
398
|
+
opacity: 1
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
variants: {
|
|
402
|
+
variant: variants,
|
|
403
|
+
size: {
|
|
404
|
+
sm: {
|
|
405
|
+
h: "8",
|
|
406
|
+
px: "2",
|
|
407
|
+
textStyle: "md"
|
|
408
|
+
},
|
|
409
|
+
md: {
|
|
410
|
+
textStyle: "md"
|
|
411
|
+
},
|
|
412
|
+
lg: {
|
|
413
|
+
h: "12",
|
|
414
|
+
textStyle: "lg"
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
defaultVariants: {
|
|
419
|
+
variant: "primary",
|
|
420
|
+
size: "md"
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
// src/styles/chakraTheme/ContainerStyles.ts
|
|
424
|
+
import { defineRecipe as defineRecipe2 } from "@chakra-ui/react";
|
|
425
|
+
var ContainerStyles = defineRecipe2({
|
|
426
|
+
base: {
|
|
427
|
+
px: ".75rem"
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
// src/styles/chakraTheme/HeadingStyles.ts
|
|
431
|
+
import { defineRecipe as defineRecipe3 } from "@chakra-ui/react";
|
|
432
|
+
var HeadingStyles = defineRecipe3({
|
|
433
|
+
base: {
|
|
434
|
+
fontWeight: "600"
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
// src/styles/chakraTheme/InputStyles.ts
|
|
438
|
+
import { defineRecipe as defineRecipe4 } from "@chakra-ui/react";
|
|
439
|
+
var variants2 = {
|
|
440
|
+
subtle: {
|
|
441
|
+
backgroundColor: {
|
|
442
|
+
_light: "gray.200",
|
|
443
|
+
_dark: "whiteAlpha.100"
|
|
444
|
+
},
|
|
445
|
+
_hover: {
|
|
446
|
+
bg: {
|
|
447
|
+
_light: "gray.300",
|
|
448
|
+
_dark: "whiteAlpha.200"
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
outline: {
|
|
453
|
+
borderColor: {
|
|
454
|
+
_light: "gray.300",
|
|
455
|
+
_dark: "whiteAlpha.300"
|
|
456
|
+
},
|
|
457
|
+
_hover: {
|
|
458
|
+
borderColor: {
|
|
459
|
+
_light: "gray.400",
|
|
460
|
+
_dark: "whiteAlpha.400"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
flushed: {
|
|
465
|
+
borderColor: {
|
|
466
|
+
_light: "gray.300",
|
|
467
|
+
_dark: "whiteAlpha.300"
|
|
468
|
+
},
|
|
469
|
+
_hover: {
|
|
470
|
+
borderColor: {
|
|
471
|
+
_light: "gray.400",
|
|
472
|
+
_dark: "whiteAlpha.400"
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var InputStyles = defineRecipe4({
|
|
478
|
+
base: {
|
|
479
|
+
_placeholder: {
|
|
480
|
+
color: {
|
|
481
|
+
_light: "gray.500",
|
|
482
|
+
_dark: "whiteAlpha.500"
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
variants: {
|
|
487
|
+
variant: variants2
|
|
488
|
+
},
|
|
489
|
+
defaultVariants: {
|
|
490
|
+
variant: "subtle"
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
// src/styles/chakraTheme/SpinnerStyles.ts
|
|
494
|
+
import { defineRecipe as defineRecipe5 } from "@chakra-ui/react";
|
|
495
|
+
var SpinnerStyles = defineRecipe5({
|
|
496
|
+
base: {
|
|
497
|
+
animationDuration: ".8s",
|
|
498
|
+
color: colors.accentBlueMedium,
|
|
499
|
+
// Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color
|
|
500
|
+
borderWidth: ".175em"
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
// src/styles/chakraTheme/sizes.ts
|
|
504
|
+
var container = {
|
|
505
|
+
sm: {
|
|
506
|
+
value: "40rem"
|
|
507
|
+
},
|
|
508
|
+
md: {
|
|
509
|
+
value: "48rem"
|
|
510
|
+
},
|
|
511
|
+
lg: {
|
|
512
|
+
value: "56rem"
|
|
513
|
+
},
|
|
514
|
+
// Forsøker 56rem som standardbredde etter testing med Katrine
|
|
515
|
+
xl: {
|
|
516
|
+
value: "80rem"
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
var sizes = {
|
|
520
|
+
container: container
|
|
521
|
+
};
|
|
522
|
+
// src/styles/chakraTheme/LinkStyles.ts
|
|
523
|
+
import { defineRecipe as defineRecipe6 } from "@chakra-ui/react";
|
|
524
|
+
var variants3 = {
|
|
525
|
+
plain: {
|
|
526
|
+
color: "currentColor",
|
|
527
|
+
textDecoration: "none",
|
|
528
|
+
textDecorationColor: "currentColor",
|
|
529
|
+
_hover: {
|
|
530
|
+
textDecorationColor: "currentColor",
|
|
531
|
+
textDecoration: "underline"
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
underline: {
|
|
535
|
+
color: "currentColor",
|
|
536
|
+
textDecoration: "underline",
|
|
537
|
+
textDecorationColor: "currentColor",
|
|
538
|
+
_hover: {
|
|
539
|
+
textDecoration: "none"
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
var LinkStyles = defineRecipe6({
|
|
544
|
+
base: {
|
|
545
|
+
_focus: {
|
|
546
|
+
outline: "none"
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
variants: {
|
|
550
|
+
variant: variants3
|
|
551
|
+
},
|
|
552
|
+
defaultVariants: {
|
|
553
|
+
variant: "underline"
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
// src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
|
|
557
|
+
var tokens = defineTokens({
|
|
558
|
+
sizes: sizes
|
|
559
|
+
});
|
|
560
|
+
var globalHyphens = {
|
|
561
|
+
hyphens: "auto",
|
|
562
|
+
hyphenateLimitChars: "8 5 3"
|
|
563
|
+
};
|
|
564
|
+
var focusStyle = {
|
|
565
|
+
outline: "none !important",
|
|
566
|
+
boxShadow: "0 0 0 .05rem ".concat(colors.white, ", 0 0 0 .25rem ").concat(colors.accentBlueMedium, ", 0 0 0 .3rem ").concat(colors.white, " !important"),
|
|
567
|
+
transition: "box-shadow 0.1s ease-out"
|
|
568
|
+
};
|
|
569
|
+
var biblioteksentralenChakraTheme = defineConfig({
|
|
570
|
+
theme: {
|
|
571
|
+
tokens: tokens,
|
|
572
|
+
recipes: {
|
|
573
|
+
heading: HeadingStyles,
|
|
574
|
+
button: ButtonStyles,
|
|
575
|
+
input: InputStyles,
|
|
576
|
+
link: LinkStyles,
|
|
577
|
+
container: ContainerStyles,
|
|
578
|
+
spinner: SpinnerStyles
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
globalCss: {
|
|
582
|
+
html: {
|
|
583
|
+
fontSize: {
|
|
584
|
+
base: "112.5%",
|
|
585
|
+
md: "120%"
|
|
586
|
+
},
|
|
587
|
+
// Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
|
|
588
|
+
// men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
|
|
589
|
+
"&:focus-within": {
|
|
590
|
+
scrollBehavior: "smooth !important"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
body: _object_spread({}, globalHyphens),
|
|
594
|
+
// Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus
|
|
595
|
+
"*:focus-visible": focusStyle
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
// src/components/HashLinkTargetBS.tsx
|
|
599
|
+
var focusOnRelativeParentStyle = {
|
|
600
|
+
_focusWithin: {
|
|
601
|
+
position: "static",
|
|
602
|
+
boxShadow: "none",
|
|
603
|
+
"&::after": _object_spread({
|
|
604
|
+
content: '""',
|
|
605
|
+
position: "absolute",
|
|
606
|
+
top: 0,
|
|
607
|
+
left: 0,
|
|
608
|
+
height: "100%",
|
|
609
|
+
width: "100%",
|
|
610
|
+
pointerEvents: "none",
|
|
611
|
+
borderRadius: "0.25rem"
|
|
612
|
+
}, focusStyle)
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
function HashLinkTargetBS(props) {
|
|
616
|
+
return /* @__PURE__ */ React5.createElement(Box2, {
|
|
617
|
+
position: "relative",
|
|
618
|
+
css: props.focusOnParent ? focusOnRelativeParentStyle : void 0
|
|
619
|
+
}, /* @__PURE__ */ React5.createElement(Box2, {
|
|
620
|
+
id: props.id,
|
|
621
|
+
tabIndex: props.focusOnParent ? -1 : void 0,
|
|
622
|
+
position: "absolute",
|
|
623
|
+
top: "-".concat(props.spaceAbove || "2.5rem"),
|
|
624
|
+
_focus: {
|
|
625
|
+
boxShadow: "none !important"
|
|
626
|
+
}
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
// src/components/withErrorBoundaryBS.tsx
|
|
630
|
+
import React6 from "react";
|
|
631
|
+
var withErrorBoundaryBS = function(Component, boundaryName) {
|
|
632
|
+
return function(props) {
|
|
633
|
+
return /* @__PURE__ */ React6.createElement(ErrorBoundaryBS, {
|
|
634
|
+
boundaryName: boundaryName
|
|
635
|
+
}, /* @__PURE__ */ React6.createElement(Component, _object_spread({}, props)));
|
|
636
|
+
};
|
|
637
|
+
};
|
|
638
|
+
// src/components/BiblioteksentralenProvider.tsx
|
|
639
|
+
import React7 from "react";
|
|
640
|
+
import { ChakraProvider, createSystem, defaultConfig as defaultConfig2 } from "@chakra-ui/react";
|
|
641
|
+
import { ColorModeProvider } from "@chakra-ui/system";
|
|
642
|
+
var BiblioteksentralenProvider = function(props) {
|
|
643
|
+
return /* @__PURE__ */ React7.createElement(ChakraProvider, {
|
|
644
|
+
value: createSystem(defaultConfig2, biblioteksentralenChakraTheme, props.customTheme || {})
|
|
645
|
+
}, /* @__PURE__ */ React7.createElement(ColorModeProvider, _object_spread({}, props)));
|
|
646
|
+
};
|
|
647
|
+
export { AlertBS, BiblioteksentralenProvider, ButtonBS, ConditionalWrapperBS, ErrorBoundaryBS, HashLinkTargetBS, IconButtonBS, InputBS, withErrorBoundaryBS };
|
|
16
648
|
//# sourceMappingURL=index.mjs.map
|