@biblioteksentralen/react 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -55,7 +55,7 @@ import React50 from "react";
55
55
  import React51 from "react";
56
56
  import React52 from "react";
57
57
  import React53 from "react";
58
- import React54 from "react";
58
+ import * as React54 from "react";
59
59
  import React55 from "react";
60
60
  import React56 from "react";
61
61
  import React57 from "react";
@@ -70,8 +70,8 @@ import React65 from "react";
70
70
  import React66 from "react";
71
71
  import React67 from "react";
72
72
  import React68 from "react";
73
- import * as React69 from "react";
74
- import React70 from "react";
73
+ import React69 from "react";
74
+ import * as React70 from "react";
75
75
  import React71 from "react";
76
76
  import React72 from "react";
77
77
  import React73 from "react";
@@ -81,8 +81,8 @@ import React76 from "react";
81
81
  import React77 from "react";
82
82
  import React78 from "react";
83
83
  import React79 from "react";
84
- import * as React80 from "react";
85
- import React81 from "react";
84
+ import React80 from "react";
85
+ import * as React81 from "react";
86
86
  import React82 from "react";
87
87
  import React83 from "react";
88
88
  import React84 from "react";
@@ -95,10 +95,11 @@ import React90 from "react";
95
95
  import React91 from "react";
96
96
  import React92 from "react";
97
97
  import React93 from "react";
98
+ import React94 from "react";
98
99
  var BsCheckCircle = (props) => /* @__PURE__ */ React16.createElement("svg", { fill: "currentColor", viewBox: "0 0 16 16", height: "1em", width: "1em", ...props }, /* @__PURE__ */ React16.createElement("path", { d: "M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" }), /* @__PURE__ */ React16.createElement("path", { d: "M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" }));
99
100
  var BsExclamationCircle = (props) => /* @__PURE__ */ React21.createElement("svg", { fill: "currentColor", viewBox: "0 0 16 16", height: "1em", width: "1em", ...props }, /* @__PURE__ */ React21.createElement("path", { d: "M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" }), /* @__PURE__ */ React21.createElement("path", { d: "M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z" }));
100
101
  var BsXCircle = (props) => /* @__PURE__ */ React31.createElement("svg", { fill: "currentColor", viewBox: "0 0 16 16", height: "1em", width: "1em", ...props }, /* @__PURE__ */ React31.createElement("path", { d: "M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" }), /* @__PURE__ */ React31.createElement("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }));
101
- var InformationIcon = (props) => /* @__PURE__ */ React69.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", ...props, viewBox: "2 2 20 20" }, /* @__PURE__ */ React69.createElement(
102
+ var InformationIcon = (props) => /* @__PURE__ */ React70.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", ...props, viewBox: "2 2 20 20" }, /* @__PURE__ */ React70.createElement(
102
103
  "path",
103
104
  {
104
105
  d: "M12 2.25c5.385 0 9.75 4.365 9.75 9.75s-4.365 9.75-9.75 9.75c-5.384 0-9.75-4.365-9.75-9.75S6.616 2.25 12 2.25zm0 1.5a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5zm0 6.5a.75.75 0 0 1 .75.75v4.971l-.007.102a.75.75 0 0 1-1.493-.102V11l.007-.102A.75.75 0 0 1 12 10.25zm0-2.75A.75.75 0 1 1 12 9a.75.75 0 0 1 0-1.5z",
@@ -107,8 +108,8 @@ var InformationIcon = (props) => /* @__PURE__ */ React69.createElement("svg", {
107
108
  ));
108
109
 
109
110
  // ../utils/dist/index.mjs
110
- import { format } from "date-fns";
111
- import { nb } from "date-fns/locale";
111
+ import { format } from "date-fns/format";
112
+ import { nb } from "date-fns/locale/nb";
112
113
  var colors = {
113
114
  black: "#000000",
114
115
  grey90: "#181818",
@@ -156,7 +157,7 @@ function isDevelopment() {
156
157
 
157
158
  // src/components/Alert.tsx
158
159
  import { Box, Flex } from "@chakra-ui/react";
159
- import React94 from "react";
160
+ import React95 from "react";
160
161
  var colorLookup = {
161
162
  info: { bg: colors.lightBlue, color: colors.accentBlueMedium },
162
163
  warning: { bg: colors.alertYellow, color: colors.statusYellow },
@@ -164,10 +165,10 @@ var colorLookup = {
164
165
  error: { bg: colors.alertRed, color: colors.statusRed }
165
166
  };
166
167
  var iconLookup = {
167
- info: /* @__PURE__ */ React94.createElement(InformationIcon, { role: "img", "aria-label": "Informasjon" }),
168
- warning: /* @__PURE__ */ React94.createElement(BsExclamationCircle, { role: "img", "aria-label": "Advarsel" }),
169
- success: /* @__PURE__ */ React94.createElement(BsCheckCircle, { role: "img", "aria-label": "Suksess" }),
170
- error: /* @__PURE__ */ React94.createElement(BsXCircle, { role: "img", "aria-label": "Feil" })
168
+ info: /* @__PURE__ */ React95.createElement(InformationIcon, { role: "img", "aria-label": "Informasjon" }),
169
+ warning: /* @__PURE__ */ React95.createElement(BsExclamationCircle, { role: "img", "aria-label": "Advarsel" }),
170
+ success: /* @__PURE__ */ React95.createElement(BsCheckCircle, { role: "img", "aria-label": "Suksess" }),
171
+ error: /* @__PURE__ */ React95.createElement(BsXCircle, { role: "img", "aria-label": "Feil" })
171
172
  };
172
173
  var variantStyles = {
173
174
  inline: {
@@ -178,7 +179,7 @@ var variantStyles = {
178
179
  };
179
180
  function Alert({ status, children, variant, ...rest }) {
180
181
  const colors2 = colorLookup[status];
181
- return /* @__PURE__ */ React94.createElement(
182
+ return /* @__PURE__ */ React95.createElement(
182
183
  Flex,
183
184
  {
184
185
  role: "alert",
@@ -194,8 +195,8 @@ function Alert({ status, children, variant, ...rest }) {
194
195
  ...variant ? variantStyles[variant] : {},
195
196
  ...rest
196
197
  },
197
- /* @__PURE__ */ React94.createElement(Box, { color: colors2.color, flex: "0 0", marginLeft: "auto", marginRight: "auto", lineHeight: "1", fontSize: "1.5em" }, iconLookup[status]),
198
- /* @__PURE__ */ React94.createElement(Box, { flex: "1" }, children)
198
+ /* @__PURE__ */ React95.createElement(Box, { color: colors2.color, flex: "0 0", marginLeft: "auto", marginRight: "auto", lineHeight: "1", fontSize: "1.5em" }, iconLookup[status]),
199
+ /* @__PURE__ */ React95.createElement(Box, { flex: "1" }, children)
199
200
  );
200
201
  }
201
202
 
@@ -204,18 +205,18 @@ import { Button as ChakraButton } from "@chakra-ui/react";
204
205
  var Button = ChakraButton;
205
206
 
206
207
  // src/components/ConditionalWrapper.tsx
207
- import React95 from "react";
208
- var ConditionalWrapper = ({ condition, children, wrapper: Wrapper }) => condition ? /* @__PURE__ */ React95.createElement(Wrapper, null, children) : /* @__PURE__ */ React95.createElement(React95.Fragment, null, children);
208
+ import React96 from "react";
209
+ var ConditionalWrapper = ({ condition, children, wrapper: Wrapper }) => condition ? /* @__PURE__ */ React96.createElement(Wrapper, null, children) : /* @__PURE__ */ React96.createElement(React96.Fragment, null, children);
209
210
 
210
211
  // src/components/HideWithCSS.tsx
211
212
  import { Box as Box2 } from "@chakra-ui/react";
212
- import React96 from "react";
213
+ import React97 from "react";
213
214
  var HideWithCSS = ({ children, above, below, ...chakraProps }) => {
214
215
  const display = {
215
216
  ...!!below ? { base: "none", [below]: "block" } : {},
216
217
  ...!!above ? { [above]: "none" } : {}
217
218
  };
218
- return /* @__PURE__ */ React96.createElement(Box2, { ...chakraProps, display }, children);
219
+ return /* @__PURE__ */ React97.createElement(Box2, { ...chakraProps, display }, children);
219
220
  };
220
221
 
221
222
  // src/components/Input.tsx
@@ -226,13 +227,13 @@ import {
226
227
  FormLabel,
227
228
  Input as ChakraInput
228
229
  } from "@chakra-ui/react";
229
- import React98, { forwardRef } from "react";
230
+ import React99, { forwardRef } from "react";
230
231
 
231
232
  // src/components/VisuallyHidden.tsx
232
- import React97, { useEffect } from "react";
233
+ import React98, { useEffect } from "react";
233
234
  import { VisuallyHidden as ChakraVisuallyHidden } from "@chakra-ui/react";
234
235
  function VisuallyHidden({ children, ...rest }) {
235
- const [forceShow, setForceShow] = React97.useState(false);
236
+ const [forceShow, setForceShow] = React98.useState(false);
236
237
  useEffect(() => {
237
238
  if (isDevelopment()) {
238
239
  const handleKeyDown = (ev) => {
@@ -253,13 +254,13 @@ function VisuallyHidden({ children, ...rest }) {
253
254
  };
254
255
  }
255
256
  }, []);
256
- return forceShow ? /* @__PURE__ */ React97.createElement("span", null, children) : /* @__PURE__ */ React97.createElement(ChakraVisuallyHidden, { position: "fixed" }, children);
257
+ return forceShow ? /* @__PURE__ */ React98.createElement("span", null, children) : /* @__PURE__ */ React98.createElement(ChakraVisuallyHidden, { position: "fixed" }, children);
257
258
  }
258
259
 
259
260
  // src/components/Input.tsx
260
261
  var Input = forwardRef((props, ref) => {
261
262
  const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;
262
- return /* @__PURE__ */ React98.createElement(FormControl, { isInvalid: !!errorMessage }, /* @__PURE__ */ React98.createElement(FormLabel, { marginBottom: ".25em", ...labelProps }, hideLabel ? /* @__PURE__ */ React98.createElement(VisuallyHidden, null, label) : label), /* @__PURE__ */ React98.createElement(ChakraInput, { ref, ...inputProps }), errorMessage && /* @__PURE__ */ React98.createElement(FormErrorMessage, null, errorMessage), helperText && /* @__PURE__ */ React98.createElement(FormHelperText, null, helperText));
263
+ return /* @__PURE__ */ React99.createElement(FormControl, { isInvalid: !!errorMessage }, /* @__PURE__ */ React99.createElement(FormLabel, { marginBottom: ".25em", ...labelProps }, hideLabel ? /* @__PURE__ */ React99.createElement(VisuallyHidden, null, label) : label), /* @__PURE__ */ React99.createElement(ChakraInput, { ref, ...inputProps }), errorMessage && /* @__PURE__ */ React99.createElement(FormErrorMessage, null, errorMessage), helperText && /* @__PURE__ */ React99.createElement(FormHelperText, null, helperText));
263
264
  });
264
265
 
265
266
  // src/components/Link.tsx
@@ -268,7 +269,7 @@ var Link = ChakraLink;
268
269
 
269
270
  // src/BiblioteksentralenProvider.tsx
270
271
  import { ChakraProvider, extendTheme } from "@chakra-ui/react";
271
- import React99 from "react";
272
+ import React100 from "react";
272
273
 
273
274
  // src/styles/chakraTheme/ButtonStyles.ts
274
275
  var variants = {
@@ -471,13 +472,13 @@ var biblioteksentralenChakraTheme = {
471
472
 
472
473
  // src/BiblioteksentralenProvider.tsx
473
474
  var emptyTheme = {};
474
- var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React99.createElement(ChakraProvider, { theme: extendTheme(biblioteksentralenChakraTheme, props.customTheme ?? emptyTheme) }, props.children);
475
+ var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React100.createElement(ChakraProvider, { theme: extendTheme(biblioteksentralenChakraTheme, props.customTheme ?? emptyTheme) }, props.children);
475
476
 
476
477
  // src/components/ErrorBoundary.tsx
477
478
  import { Box as Box3 } from "@chakra-ui/react";
478
- import React100 from "react";
479
- var StyledPre = (props) => /* @__PURE__ */ React100.createElement(Box3, { as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem", ...props });
480
- var ErrorBoundary = class extends React100.Component {
479
+ import React101 from "react";
480
+ var StyledPre = (props) => /* @__PURE__ */ React101.createElement(Box3, { as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem", ...props });
481
+ var ErrorBoundary = class extends React101.Component {
481
482
  constructor(props) {
482
483
  super(props);
483
484
  this.state = { hasError: false };
@@ -494,7 +495,7 @@ var ErrorBoundary = class extends React100.Component {
494
495
  const stackTrace = this.state.errorInfo?.componentStack;
495
496
  const errormsg = this.state.error?.message;
496
497
  const info = this.props.boundaryName;
497
- return /* @__PURE__ */ React100.createElement("div", null, /* @__PURE__ */ React100.createElement(Alert, { status: "error" }, /* @__PURE__ */ React100.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React100.createElement("div", null, /* @__PURE__ */ React100.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ React100.createElement(StyledPre, null, info || ""), /* @__PURE__ */ React100.createElement(StyledPre, null, stackTrace || ""))));
498
+ return /* @__PURE__ */ React101.createElement("div", null, /* @__PURE__ */ React101.createElement(Alert, { status: "error" }, /* @__PURE__ */ React101.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ React101.createElement("div", null, /* @__PURE__ */ React101.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ React101.createElement(StyledPre, null, info || ""), /* @__PURE__ */ React101.createElement(StyledPre, null, stackTrace || ""))));
498
499
  }
499
500
  return this.props.children;
500
501
  }
@@ -502,7 +503,7 @@ var ErrorBoundary = class extends React100.Component {
502
503
 
503
504
  // src/components/HashLinkTarget.tsx
504
505
  import { Box as Box4 } from "@chakra-ui/react";
505
- import React101 from "react";
506
+ import React102 from "react";
506
507
  var focusOnRelativeParentStyle = {
507
508
  "&:focus-within": {
508
509
  position: "static",
@@ -521,7 +522,7 @@ var focusOnRelativeParentStyle = {
521
522
  }
522
523
  };
523
524
  function HashLinkTarget(props) {
524
- return /* @__PURE__ */ React101.createElement(Box4, { position: "relative", sx: props.focusOnParent ? focusOnRelativeParentStyle : void 0 }, /* @__PURE__ */ React101.createElement(
525
+ return /* @__PURE__ */ React102.createElement(Box4, { position: "relative", sx: props.focusOnParent ? focusOnRelativeParentStyle : void 0 }, /* @__PURE__ */ React102.createElement(
525
526
  Box4,
526
527
  {
527
528
  id: props.id,
@@ -536,9 +537,9 @@ function HashLinkTarget(props) {
536
537
  }
537
538
 
538
539
  // src/components/withErrorBoundary.tsx
539
- import React102 from "react";
540
+ import React103 from "react";
540
541
  var withErrorBoundary = (Component, boundaryName) => {
541
- return React102.forwardRef((props, ref) => /* @__PURE__ */ React102.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React102.createElement(Component, { ...props, ref })));
542
+ return React103.forwardRef((props, ref) => /* @__PURE__ */ React103.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React103.createElement(Component, { ...props, ref })));
542
543
  };
543
544
  export {
544
545
  Alert,