@biblioteksentralen/react 4.0.0-beta.0 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/index.d.mts +106 -15
  2. package/dist/index.d.ts +106 -15
  3. package/dist/index.js +739 -37
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +645 -45
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +5 -14
  8. package/dist/ButtonStyles-7ASDoOwZ.d.mts +0 -3
  9. package/dist/ButtonStyles-7ASDoOwZ.d.ts +0 -3
  10. package/dist/chunk-2KZDHLEJ.mjs +0 -10
  11. package/dist/chunk-2KZDHLEJ.mjs.map +0 -1
  12. package/dist/chunk-3IJ454KG.mjs +0 -39
  13. package/dist/chunk-3IJ454KG.mjs.map +0 -1
  14. package/dist/chunk-5GJBW3WE.mjs +0 -229
  15. package/dist/chunk-5GJBW3WE.mjs.map +0 -1
  16. package/dist/chunk-7MKFY66H.mjs +0 -44
  17. package/dist/chunk-7MKFY66H.mjs.map +0 -1
  18. package/dist/chunk-BCT5QU5W.js +0 -142
  19. package/dist/chunk-BCT5QU5W.js.map +0 -1
  20. package/dist/chunk-BN5W6FVN.mjs +0 -55
  21. package/dist/chunk-BN5W6FVN.mjs.map +0 -1
  22. package/dist/chunk-BRFRPPOW.js +0 -10
  23. package/dist/chunk-BRFRPPOW.js.map +0 -1
  24. package/dist/chunk-BZS3AX26.mjs +0 -10
  25. package/dist/chunk-BZS3AX26.mjs.map +0 -1
  26. package/dist/chunk-CGCBID7S.mjs +0 -15
  27. package/dist/chunk-CGCBID7S.mjs.map +0 -1
  28. package/dist/chunk-J5IF7WUN.js +0 -10
  29. package/dist/chunk-J5IF7WUN.js.map +0 -1
  30. package/dist/chunk-NSYSPEHR.js +0 -86
  31. package/dist/chunk-NSYSPEHR.js.map +0 -1
  32. package/dist/chunk-NYKSRUWF.js +0 -51
  33. package/dist/chunk-NYKSRUWF.js.map +0 -1
  34. package/dist/chunk-O4EXBCND.js +0 -19
  35. package/dist/chunk-O4EXBCND.js.map +0 -1
  36. package/dist/chunk-PLWK7HEC.js +0 -75
  37. package/dist/chunk-PLWK7HEC.js.map +0 -1
  38. package/dist/chunk-PQLTQYZ3.mjs +0 -15
  39. package/dist/chunk-PQLTQYZ3.mjs.map +0 -1
  40. package/dist/chunk-QAW4IRLI.js +0 -55
  41. package/dist/chunk-QAW4IRLI.js.map +0 -1
  42. package/dist/chunk-QBXCCJ24.js +0 -344
  43. package/dist/chunk-QBXCCJ24.js.map +0 -1
  44. package/dist/chunk-QX75QJ7F.mjs +0 -52
  45. package/dist/chunk-QX75QJ7F.mjs.map +0 -1
  46. package/dist/chunk-RZUGRIUF.mjs +0 -17
  47. package/dist/chunk-RZUGRIUF.mjs.map +0 -1
  48. package/dist/chunk-UFIMO32F.js +0 -275
  49. package/dist/chunk-UFIMO32F.js.map +0 -1
  50. package/dist/chunk-VSICUYFB.js +0 -51
  51. package/dist/chunk-VSICUYFB.js.map +0 -1
  52. package/dist/chunk-WYQNSPEX.mjs +0 -10
  53. package/dist/chunk-WYQNSPEX.mjs.map +0 -1
  54. package/dist/components/AlertBS.d.mts +0 -18
  55. package/dist/components/AlertBS.d.ts +0 -18
  56. package/dist/components/AlertBS.js +0 -9
  57. package/dist/components/AlertBS.js.map +0 -1
  58. package/dist/components/AlertBS.mjs +0 -9
  59. package/dist/components/AlertBS.mjs.map +0 -1
  60. package/dist/components/BiblioteksentralenProvider.d.mts +0 -10
  61. package/dist/components/BiblioteksentralenProvider.d.ts +0 -10
  62. package/dist/components/BiblioteksentralenProvider.js +0 -10
  63. package/dist/components/BiblioteksentralenProvider.js.map +0 -1
  64. package/dist/components/BiblioteksentralenProvider.mjs +0 -10
  65. package/dist/components/BiblioteksentralenProvider.mjs.map +0 -1
  66. package/dist/components/ButtonBS.d.mts +0 -16
  67. package/dist/components/ButtonBS.d.ts +0 -16
  68. package/dist/components/ButtonBS.js +0 -8
  69. package/dist/components/ButtonBS.js.map +0 -1
  70. package/dist/components/ButtonBS.mjs +0 -8
  71. package/dist/components/ButtonBS.mjs.map +0 -1
  72. package/dist/components/ConditionalWrapperBS.d.mts +0 -15
  73. package/dist/components/ConditionalWrapperBS.d.ts +0 -15
  74. package/dist/components/ConditionalWrapperBS.js +0 -8
  75. package/dist/components/ConditionalWrapperBS.js.map +0 -1
  76. package/dist/components/ConditionalWrapperBS.mjs +0 -8
  77. package/dist/components/ConditionalWrapperBS.mjs.map +0 -1
  78. package/dist/components/ErrorBoundaryBS.d.mts +0 -21
  79. package/dist/components/ErrorBoundaryBS.d.ts +0 -21
  80. package/dist/components/ErrorBoundaryBS.js +0 -10
  81. package/dist/components/ErrorBoundaryBS.js.map +0 -1
  82. package/dist/components/ErrorBoundaryBS.mjs +0 -10
  83. package/dist/components/ErrorBoundaryBS.mjs.map +0 -1
  84. package/dist/components/HashLinkTargetBS.d.mts +0 -16
  85. package/dist/components/HashLinkTargetBS.d.ts +0 -16
  86. package/dist/components/HashLinkTargetBS.js +0 -10
  87. package/dist/components/HashLinkTargetBS.js.map +0 -1
  88. package/dist/components/HashLinkTargetBS.mjs +0 -10
  89. package/dist/components/HashLinkTargetBS.mjs.map +0 -1
  90. package/dist/components/IconButtonBS.d.mts +0 -16
  91. package/dist/components/IconButtonBS.d.ts +0 -16
  92. package/dist/components/IconButtonBS.js +0 -8
  93. package/dist/components/IconButtonBS.js.map +0 -1
  94. package/dist/components/IconButtonBS.mjs +0 -8
  95. package/dist/components/IconButtonBS.mjs.map +0 -1
  96. package/dist/components/InputBS.d.mts +0 -18
  97. package/dist/components/InputBS.d.ts +0 -18
  98. package/dist/components/InputBS.js +0 -8
  99. package/dist/components/InputBS.js.map +0 -1
  100. package/dist/components/InputBS.mjs +0 -8
  101. package/dist/components/InputBS.mjs.map +0 -1
  102. package/dist/components/withErrorBoundaryBS.d.mts +0 -5
  103. package/dist/components/withErrorBoundaryBS.d.ts +0 -5
  104. package/dist/components/withErrorBoundaryBS.js +0 -11
  105. package/dist/components/withErrorBoundaryBS.js.map +0 -1
  106. package/dist/components/withErrorBoundaryBS.mjs +0 -11
  107. package/dist/components/withErrorBoundaryBS.mjs.map +0 -1
  108. /package/{dist/LICENSE → LICENSE} +0 -0
package/dist/index.js CHANGED
@@ -1,46 +1,748 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _createStarExport(obj) {
6
- Object.keys(obj).filter(function(key) {
7
- return key !== "default" && key !== "__esModule";
8
- }).forEach(function(key) {
9
- if (exports.hasOwnProperty(key)) {
10
- return;
11
- }
12
- Object.defineProperty(exports, key, {
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,
13
39
  enumerable: true,
14
40
  configurable: true,
15
- get: function() {
16
- return obj[key];
17
- }
41
+ writable: true
18
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
+ }
19
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 _object_without_properties(source, excluded) {
89
+ if (source == null) return {};
90
+ var target = _object_without_properties_loose(source, excluded);
91
+ var key, i;
92
+ if (Object.getOwnPropertySymbols) {
93
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
94
+ for(i = 0; i < sourceSymbolKeys.length; i++){
95
+ key = sourceSymbolKeys[i];
96
+ if (excluded.indexOf(key) >= 0) continue;
97
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
98
+ target[key] = source[key];
99
+ }
100
+ }
101
+ return target;
102
+ }
103
+ function _object_without_properties_loose(source, excluded) {
104
+ if (source == null) return {};
105
+ var target = {};
106
+ var sourceKeys = Object.keys(source);
107
+ var key, i;
108
+ for(i = 0; i < sourceKeys.length; i++){
109
+ key = sourceKeys[i];
110
+ if (excluded.indexOf(key) >= 0) continue;
111
+ target[key] = source[key];
112
+ }
113
+ return target;
114
+ }
115
+ function _possible_constructor_return(self, call) {
116
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
117
+ return call;
118
+ }
119
+ return _assert_this_initialized(self);
120
+ }
121
+ function _set_prototype_of(o, p) {
122
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
123
+ o.__proto__ = p;
124
+ return o;
125
+ };
126
+ return _set_prototype_of(o, p);
127
+ }
128
+ function _to_consumable_array(arr) {
129
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
130
+ }
131
+ function _type_of(obj) {
132
+ "@swc/helpers - typeof";
133
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
134
+ }
135
+ function _unsupported_iterable_to_array(o, minLen) {
136
+ if (!o) return;
137
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
138
+ var n = Object.prototype.toString.call(o).slice(8, -1);
139
+ if (n === "Object" && o.constructor) n = o.constructor.name;
140
+ if (n === "Map" || n === "Set") return Array.from(n);
141
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
142
+ }
143
+ function _is_native_reflect_construct() {
144
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
145
+ if (Reflect.construct.sham) return false;
146
+ if (typeof Proxy === "function") return true;
147
+ try {
148
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
149
+ return true;
150
+ } catch (e) {
151
+ return false;
152
+ }
153
+ }
154
+ function _create_super(Derived) {
155
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
156
+ return function _createSuperInternal() {
157
+ var Super = _get_prototype_of(Derived), result;
158
+ if (hasNativeReflectConstruct) {
159
+ var NewTarget = _get_prototype_of(this).constructor;
160
+ result = Reflect.construct(Super, arguments, NewTarget);
161
+ } else {
162
+ result = Super.apply(this, arguments);
163
+ }
164
+ return _possible_constructor_return(this, result);
165
+ };
166
+ }
167
+ Object.defineProperty(exports, "__esModule", {
168
+ value: true
169
+ });
170
+ function _interopRequireDefault(obj) {
171
+ return obj && obj.__esModule ? obj : {
172
+ default: obj
173
+ };
174
+ }
175
+ function _optionalChain(ops) {
176
+ var lastAccessLHS = undefined;
177
+ var value = ops[0];
178
+ var i = 1;
179
+ while(i < ops.length){
180
+ var op = ops[i];
181
+ var fn = ops[i + 1];
182
+ i += 2;
183
+ if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
184
+ return undefined;
185
+ }
186
+ if (op === "access" || op === "optionalAccess") {
187
+ lastAccessLHS = value;
188
+ value = fn(value);
189
+ } else if (op === "call" || op === "optionalCall") {
190
+ var _value;
191
+ value = fn(function() {
192
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
193
+ args[_key] = arguments[_key];
194
+ }
195
+ return (_value = value).call.apply(_value, [
196
+ lastAccessLHS
197
+ ].concat(_to_consumable_array(args)));
198
+ });
199
+ lastAccessLHS = undefined;
200
+ }
201
+ }
202
+ return value;
20
203
  }
21
204
  "use client";
22
- var _chunkNSYSPEHRjs = require("./chunk-NSYSPEHR.js");
23
- var _chunkVSICUYFBjs = require("./chunk-VSICUYFB.js");
24
- var _chunkNYKSRUWFjs = require("./chunk-NYKSRUWF.js");
25
- var _chunkBRFRPPOWjs = require("./chunk-BRFRPPOW.js");
26
- var _chunkO4EXBCNDjs = require("./chunk-O4EXBCND.js");
27
- var _chunkUFIMO32Fjs = require("./chunk-UFIMO32F.js");
28
- var _chunkBCT5QU5Wjs = require("./chunk-BCT5QU5W.js");
29
- var _chunkPLWK7HECjs = require("./chunk-PLWK7HEC.js");
30
- require("./chunk-QBXCCJ24.js");
31
- var _chunkQAW4IRLIjs = require("./chunk-QAW4IRLI.js");
32
- var _chunkJ5IF7WUNjs = require("./chunk-J5IF7WUN.js");
33
- // src/index.ts
205
+ // ../utils/dist/index.mjs
206
+ var _format = require("date-fns/format");
207
+ var _nb = require("date-fns/locale/nb");
208
+ var colors = {
209
+ black: "#000000",
210
+ grey90: "#181818",
211
+ grey80: "#333333",
212
+ grey60: "#585858",
213
+ grey45: "#8c8c8c",
214
+ grey30: "#b2b2b2",
215
+ grey15: "#d9d9d9",
216
+ grey10: "#e5e5e5",
217
+ grey05: "#f2f2f2",
218
+ white: "#ffffff",
219
+ bsRødDark: "#870010",
220
+ bsRødMedium: "#d53d40",
221
+ accentPurple: "#331433",
222
+ accentPeach: "#ffba99",
223
+ accentGreen: "#003b29",
224
+ accentBlueDark: "#001740",
225
+ accentBlueMedium: "#5996de",
226
+ accentYellow: "#ffc970",
227
+ lightBlue: "#dbe8ef",
228
+ lightGreen: "#dbe0db",
229
+ lightPeach: "#f4e7de",
230
+ lightPurple: "#ece8f3",
231
+ statusRed: "#ad313c",
232
+ statusYellow: "#bc5600",
233
+ statusGreen: "#24845b",
234
+ statusGreenLight: "#edf4f1",
235
+ statusRedLight: "#f8efef",
236
+ statusYellowLight: "#fff6e4",
237
+ neptune: {
238
+ "100": "#CFE6E8",
239
+ "200": "#9FCDD2",
240
+ "300": "#6FB5BB",
241
+ "400": "#3F9CA5",
242
+ "500": "#0F838E",
243
+ "600": "#0C6972",
244
+ "700": "#094F55",
245
+ "800": "#063439",
246
+ "900": "#031A1C"
247
+ }
248
+ };
249
+ function isDevelopment() {
250
+ return process.env.NODE_ENV === "development";
251
+ }
252
+ // src/components/AlertBS.tsx
34
253
  var _react = require("@chakra-ui/react");
35
- _createStarExport(_react);
36
- exports.AlertBS = _chunkBCT5QU5Wjs.AlertBS;
37
- exports.BiblioteksentralenProvider = _chunkNYKSRUWFjs.BiblioteksentralenProvider;
38
- exports.ButtonBS = _chunkBRFRPPOWjs.ButtonBS;
39
- exports.ConditionalWrapperBS = _chunkO4EXBCNDjs.ConditionalWrapperBS;
40
- exports.ErrorBoundaryBS = _chunkUFIMO32Fjs.ErrorBoundaryBS;
41
- exports.HashLinkTargetBS = _chunkPLWK7HECjs.HashLinkTargetBS;
42
- exports.IconButtonBS = _chunkJ5IF7WUNjs.IconButtonBS;
43
- exports.InputBS = _chunkNSYSPEHRjs.InputBS;
44
- exports.colors = _chunkQAW4IRLIjs.colors;
45
- exports.withErrorBoundaryBS = _chunkVSICUYFBjs.withErrorBoundaryBS;
254
+ var _react3 = require("react");
255
+ var _react4 = _interopRequireDefault(_react3);
256
+ var _reactfeather = require("react-feather");
257
+ var colorLookup = {
258
+ info: {
259
+ bg: colors.lightBlue,
260
+ color: colors.accentBlueMedium
261
+ },
262
+ warning: {
263
+ bg: colors.statusYellowLight,
264
+ color: colors.statusYellow
265
+ },
266
+ success: {
267
+ bg: colors.statusGreenLight,
268
+ color: colors.statusGreen
269
+ },
270
+ error: {
271
+ bg: colors.statusRedLight,
272
+ color: colors.statusRed
273
+ }
274
+ };
275
+ var iconLookup = {
276
+ info: /* @__PURE__ */ _react4.default.createElement(_reactfeather.Info, {
277
+ strokeWidth: 1.75,
278
+ role: "img",
279
+ "aria-label": "Informasjon"
280
+ }),
281
+ warning: /* @__PURE__ */ _react4.default.createElement(_reactfeather.AlertCircle, {
282
+ strokeWidth: 1.75,
283
+ role: "img",
284
+ "aria-label": "Advarsel"
285
+ }),
286
+ success: /* @__PURE__ */ _react4.default.createElement(_reactfeather.CheckCircle, {
287
+ strokeWidth: 1.75,
288
+ role: "img",
289
+ "aria-label": "Suksess"
290
+ }),
291
+ error: /* @__PURE__ */ _react4.default.createElement(_reactfeather.XCircle, {
292
+ strokeWidth: 1.75,
293
+ role: "img",
294
+ "aria-label": "Feil"
295
+ })
296
+ };
297
+ var variantStyles = {
298
+ inline: {
299
+ borderColor: "transparent",
300
+ backgroundColor: "transparent",
301
+ padding: "0"
302
+ }
303
+ };
304
+ function AlertBS(_param) {
305
+ var status = _param.status, children = _param.children, variant = _param.variant, header = _param.header, rest = _object_without_properties(_param, [
306
+ "status",
307
+ "children",
308
+ "variant",
309
+ "header"
310
+ ]);
311
+ var colors2 = colorLookup[status];
312
+ return /* @__PURE__ */ _react4.default.createElement(_react.Alert.Root, _object_spread({
313
+ status: status,
314
+ fontSize: "md",
315
+ border: "0.1rem solid",
316
+ borderColor: colors2.color,
317
+ backgroundColor: colors2.bg,
318
+ display: "flex",
319
+ flexWrap: "wrap"
320
+ }, variant === "inline" ? variantStyles[variant] : {}, rest), /* @__PURE__ */ _react4.default.createElement(_react.Alert.Indicator, {
321
+ marginX: "auto"
322
+ }, iconLookup[status]), /* @__PURE__ */ _react4.default.createElement(_react.Alert.Content, {
323
+ color: "black"
324
+ }, header && /* @__PURE__ */ _react4.default.createElement(_react.Alert.Title, null, header), /* @__PURE__ */ _react4.default.createElement(_react.Alert.Description, null, children)));
325
+ }
326
+ // src/components/ButtonBS.tsx
327
+ var ButtonBS = _react.Button;
328
+ // src/components/IconButtonBS.tsx
329
+ var IconButtonBS = _react.IconButton;
330
+ // src/components/InputBS.tsx
331
+ var InputBS = function(props) {
332
+ var labelProps = props.labelProps, label = props.label, helperText = props.helperText, errorMessage = props.errorMessage, hideLabel = props.hideLabel, inputProps = _object_without_properties(props, [
333
+ "labelProps",
334
+ "label",
335
+ "helperText",
336
+ "errorMessage",
337
+ "hideLabel"
338
+ ]);
339
+ var formLabel = /* @__PURE__ */ _react4.default.createElement(_react.Field.Label, _object_spread({}, labelProps), label);
340
+ return /* @__PURE__ */ _react4.default.createElement(_react.Field.Root, {
341
+ invalid: !!errorMessage
342
+ }, hideLabel ? /* @__PURE__ */ _react4.default.createElement(_react.VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ _react4.default.createElement(FieldHelperText, null, helperText), /* @__PURE__ */ _react4.default.createElement(_react.Input, _object_spread({}, inputProps)), errorMessage && /* @__PURE__ */ _react4.default.createElement(FieldErrorText, null, errorMessage));
343
+ };
344
+ // src/components/ConditionalWrapperBS.tsx
345
+ var ConditionalWrapperBS = function(param) {
346
+ var condition = param.condition, children = param.children, Wrapper = param.wrapper;
347
+ return condition ? /* @__PURE__ */ _react4.default.createElement(Wrapper, null, children) : /* @__PURE__ */ _react4.default.createElement(_react4.default.Fragment, null, children);
348
+ };
349
+ // src/components/ErrorBoundaryBS.tsx
350
+ var StyledPre = function(props) {
351
+ return /* @__PURE__ */ _react4.default.createElement(_react.Box, _object_spread({
352
+ as: "pre",
353
+ paddingTop: "0.5rem",
354
+ wordBreak: "break-all",
355
+ whiteSpace: "pre-wrap",
356
+ fontSize: "0.8rem"
357
+ }, props));
358
+ };
359
+ var ErrorBoundaryBS = /*#__PURE__*/ function(_react4_default_Component) {
360
+ _inherits(ErrorBoundaryBS, _react4_default_Component);
361
+ var _super = _create_super(ErrorBoundaryBS);
362
+ function ErrorBoundaryBS(props) {
363
+ _class_call_check(this, ErrorBoundaryBS);
364
+ var _this;
365
+ _this = _super.call(this, props);
366
+ _this.state = {
367
+ hasError: false
368
+ };
369
+ return _this;
370
+ }
371
+ _create_class(ErrorBoundaryBS, [
372
+ {
373
+ key: "componentDidCatch",
374
+ value: function componentDidCatch(error, errorInfo) {
375
+ this.setState({
376
+ hasError: true,
377
+ error: error,
378
+ errorInfo: errorInfo
379
+ });
380
+ console.error(error, {
381
+ errorInfo: errorInfo,
382
+ boundaryName: this.props.boundaryName
383
+ });
384
+ }
385
+ },
386
+ {
387
+ key: "render",
388
+ value: function render() {
389
+ if (this.state.hasError) {
390
+ var stackTrace = _optionalChain([
391
+ this,
392
+ "access",
393
+ function(_) {
394
+ return _.state;
395
+ },
396
+ "access",
397
+ function(_2) {
398
+ return _2.errorInfo;
399
+ },
400
+ "optionalAccess",
401
+ function(_3) {
402
+ return _3.componentStack;
403
+ }
404
+ ]);
405
+ var errormsg = _optionalChain([
406
+ this,
407
+ "access",
408
+ function(_4) {
409
+ return _4.state;
410
+ },
411
+ "access",
412
+ function(_5) {
413
+ return _5.error;
414
+ },
415
+ "optionalAccess",
416
+ function(_6) {
417
+ return _6.message;
418
+ }
419
+ ]);
420
+ var info = this.props.boundaryName;
421
+ return /* @__PURE__ */ _react4.default.createElement("div", null, /* @__PURE__ */ _react4.default.createElement(AlertBS, {
422
+ status: "error"
423
+ }, /* @__PURE__ */ _react4.default.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (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 || ""))));
424
+ }
425
+ return this.props.children;
426
+ }
427
+ }
428
+ ], [
429
+ {
430
+ key: "getDerivedStateFromError",
431
+ value: function getDerivedStateFromError(error) {
432
+ return {
433
+ hasError: true
434
+ };
435
+ }
436
+ }
437
+ ]);
438
+ return ErrorBoundaryBS;
439
+ }(_react4.default.Component);
440
+ // src/components/HashLinkTargetBS.tsx
441
+ // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
442
+ // src/styles/chakraTheme/ButtonStyles.ts
443
+ var variants = _object_spread({
444
+ primary: {
445
+ backgroundColor: colors.black,
446
+ color: "white",
447
+ _hover: {
448
+ backgroundColor: "hsla(0deg, 0%, 70%, 1)",
449
+ color: "black"
450
+ }
451
+ },
452
+ secondary: {
453
+ borderColor: "currentColor",
454
+ color: "currentColor",
455
+ backgroundColor: "transparent",
456
+ _hover: {
457
+ backgroundColor: "currentColor/7"
458
+ }
459
+ },
460
+ tertiary: {
461
+ color: "currentColor",
462
+ backgroundColor: "transparent",
463
+ _hover: {
464
+ backgroundColor: "currentColor/7"
465
+ }
466
+ }
467
+ }, _optionalChain([
468
+ _react.defaultConfig,
469
+ "access",
470
+ function(_7) {
471
+ return _7.theme;
472
+ },
473
+ "optionalAccess",
474
+ function(_8) {
475
+ return _8.recipes;
476
+ },
477
+ "optionalAccess",
478
+ function(_9) {
479
+ return _9.button;
480
+ },
481
+ "optionalAccess",
482
+ function(_10) {
483
+ return _10.variants;
484
+ },
485
+ "optionalAccess",
486
+ function(_11) {
487
+ return _11.variant;
488
+ }
489
+ ]));
490
+ var ButtonStyles = _react.defineRecipe.call(void 0, {
491
+ base: {
492
+ borderColor: "transparent",
493
+ borderWidth: "0.1em",
494
+ fontWeight: 600,
495
+ _disabled: {
496
+ backgroundColor: "".concat(colors.grey45),
497
+ color: "white",
498
+ opacity: 1
499
+ }
500
+ },
501
+ variants: {
502
+ variant: variants,
503
+ size: {
504
+ sm: {
505
+ h: "8",
506
+ px: "2",
507
+ textStyle: "md"
508
+ },
509
+ md: {
510
+ textStyle: "md"
511
+ },
512
+ lg: {
513
+ h: "12",
514
+ textStyle: "lg"
515
+ }
516
+ }
517
+ },
518
+ defaultVariants: {
519
+ variant: "primary",
520
+ size: "md"
521
+ }
522
+ });
523
+ // src/styles/chakraTheme/ContainerStyles.ts
524
+ var ContainerStyles = _react.defineRecipe.call(void 0, {
525
+ base: {
526
+ px: ".75rem"
527
+ }
528
+ });
529
+ // src/styles/chakraTheme/HeadingStyles.ts
530
+ var HeadingStyles = _react.defineRecipe.call(void 0, {
531
+ base: {
532
+ fontWeight: "600"
533
+ }
534
+ });
535
+ // src/styles/chakraTheme/InputStyles.ts
536
+ var variants2 = {
537
+ subtle: {
538
+ backgroundColor: {
539
+ _light: "gray.200",
540
+ _dark: "whiteAlpha.100"
541
+ },
542
+ _hover: {
543
+ bg: {
544
+ _light: "gray.300",
545
+ _dark: "whiteAlpha.200"
546
+ }
547
+ }
548
+ },
549
+ outline: {
550
+ borderColor: {
551
+ _light: "gray.300",
552
+ _dark: "whiteAlpha.300"
553
+ },
554
+ _hover: {
555
+ borderColor: {
556
+ _light: "gray.400",
557
+ _dark: "whiteAlpha.400"
558
+ }
559
+ }
560
+ },
561
+ flushed: {
562
+ borderColor: {
563
+ _light: "gray.300",
564
+ _dark: "whiteAlpha.300"
565
+ },
566
+ _hover: {
567
+ borderColor: {
568
+ _light: "gray.400",
569
+ _dark: "whiteAlpha.400"
570
+ }
571
+ }
572
+ }
573
+ };
574
+ var InputStyles = _react.defineRecipe.call(void 0, {
575
+ base: {
576
+ _placeholder: {
577
+ color: {
578
+ _light: "gray.500",
579
+ _dark: "whiteAlpha.500"
580
+ }
581
+ }
582
+ },
583
+ variants: {
584
+ variant: variants2
585
+ },
586
+ defaultVariants: {
587
+ variant: "subtle"
588
+ }
589
+ });
590
+ // src/styles/chakraTheme/SpinnerStyles.ts
591
+ var SpinnerStyles = _react.defineRecipe.call(void 0, {
592
+ base: {
593
+ animationDuration: ".8s",
594
+ color: colors.accentBlueMedium,
595
+ // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color
596
+ borderWidth: ".175em"
597
+ }
598
+ });
599
+ // src/styles/chakraTheme/sizes.ts
600
+ var container = {
601
+ sm: {
602
+ value: "40rem"
603
+ },
604
+ md: {
605
+ value: "48rem"
606
+ },
607
+ lg: {
608
+ value: "56rem"
609
+ },
610
+ // Forsøker 56rem som standardbredde etter testing med Katrine
611
+ xl: {
612
+ value: "80rem"
613
+ }
614
+ };
615
+ var sizes = {
616
+ container: container
617
+ };
618
+ // src/styles/chakraTheme/LinkStyles.ts
619
+ var variants3 = {
620
+ plain: {
621
+ color: "currentColor",
622
+ textDecoration: "none",
623
+ textDecorationColor: "currentColor",
624
+ _hover: {
625
+ textDecorationColor: "currentColor",
626
+ textDecoration: "underline"
627
+ }
628
+ },
629
+ underline: {
630
+ color: "currentColor",
631
+ textDecoration: "underline",
632
+ textDecorationColor: "currentColor",
633
+ _hover: {
634
+ textDecoration: "none"
635
+ }
636
+ }
637
+ };
638
+ var LinkStyles = _react.defineRecipe.call(void 0, {
639
+ base: {
640
+ _focus: {
641
+ outline: "none"
642
+ }
643
+ },
644
+ variants: {
645
+ variant: variants3
646
+ },
647
+ defaultVariants: {
648
+ variant: "underline"
649
+ }
650
+ });
651
+ // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
652
+ var tokens = _react.defineTokens.call(void 0, {
653
+ sizes: sizes
654
+ });
655
+ var globalHyphens = {
656
+ hyphens: "auto",
657
+ hyphenateLimitChars: "8 5 3"
658
+ };
659
+ var focusStyle = {
660
+ outline: "none !important",
661
+ boxShadow: "0 0 0 .05rem ".concat(colors.white, ", 0 0 0 .25rem ").concat(colors.accentBlueMedium, ", 0 0 0 .3rem ").concat(colors.white, " !important"),
662
+ transition: "box-shadow 0.1s ease-out"
663
+ };
664
+ var biblioteksentralenChakraTheme = _react.defineConfig.call(void 0, {
665
+ theme: {
666
+ tokens: tokens,
667
+ recipes: {
668
+ heading: HeadingStyles,
669
+ button: ButtonStyles,
670
+ input: InputStyles,
671
+ link: LinkStyles,
672
+ container: ContainerStyles,
673
+ spinner: SpinnerStyles
674
+ }
675
+ },
676
+ globalCss: {
677
+ html: {
678
+ fontSize: {
679
+ base: "112.5%",
680
+ md: "120%"
681
+ },
682
+ // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
683
+ // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
684
+ "&:focus-within": {
685
+ scrollBehavior: "smooth !important"
686
+ }
687
+ },
688
+ body: _object_spread({}, globalHyphens),
689
+ // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus
690
+ "*:focus-visible": focusStyle
691
+ }
692
+ });
693
+ // src/components/HashLinkTargetBS.tsx
694
+ var focusOnRelativeParentStyle = {
695
+ _focusWithin: {
696
+ position: "static",
697
+ boxShadow: "none",
698
+ "&::after": _object_spread({
699
+ content: '""',
700
+ position: "absolute",
701
+ top: 0,
702
+ left: 0,
703
+ height: "100%",
704
+ width: "100%",
705
+ pointerEvents: "none",
706
+ borderRadius: "0.25rem"
707
+ }, focusStyle)
708
+ }
709
+ };
710
+ function HashLinkTargetBS(props) {
711
+ return /* @__PURE__ */ _react4.default.createElement(_react.Box, {
712
+ position: "relative",
713
+ css: props.focusOnParent ? focusOnRelativeParentStyle : void 0
714
+ }, /* @__PURE__ */ _react4.default.createElement(_react.Box, {
715
+ id: props.id,
716
+ tabIndex: props.focusOnParent ? -1 : void 0,
717
+ position: "absolute",
718
+ top: "-".concat(props.spaceAbove || "2.5rem"),
719
+ _focus: {
720
+ boxShadow: "none !important"
721
+ }
722
+ }));
723
+ }
724
+ // src/components/withErrorBoundaryBS.tsx
725
+ var withErrorBoundaryBS = function(Component, boundaryName) {
726
+ return function(props) {
727
+ return /* @__PURE__ */ _react4.default.createElement(ErrorBoundaryBS, {
728
+ boundaryName: boundaryName
729
+ }, /* @__PURE__ */ _react4.default.createElement(Component, _object_spread({}, props)));
730
+ };
731
+ };
732
+ // src/components/BiblioteksentralenProvider.tsx
733
+ var _system = require("@chakra-ui/system");
734
+ var BiblioteksentralenProvider = function(props) {
735
+ return /* @__PURE__ */ _react4.default.createElement(_react.ChakraProvider, {
736
+ value: _react.createSystem.call(void 0, _react.defaultConfig, biblioteksentralenChakraTheme, props.customTheme || {})
737
+ }, /* @__PURE__ */ _react4.default.createElement(_system.ColorModeProvider, _object_spread({}, props)));
738
+ };
739
+ exports.AlertBS = AlertBS;
740
+ exports.BiblioteksentralenProvider = BiblioteksentralenProvider;
741
+ exports.ButtonBS = ButtonBS;
742
+ exports.ConditionalWrapperBS = ConditionalWrapperBS;
743
+ exports.ErrorBoundaryBS = ErrorBoundaryBS;
744
+ exports.HashLinkTargetBS = HashLinkTargetBS;
745
+ exports.IconButtonBS = IconButtonBS;
746
+ exports.InputBS = InputBS;
747
+ exports.withErrorBoundaryBS = withErrorBoundaryBS;
46
748
  //# sourceMappingURL=index.js.map