@biblioteksentralen/react 1.0.0-beta.3 → 1.0.0-beta.5

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.
@@ -1,4 +1,8 @@
1
1
 
2
- > @biblioteksentralen/react@1.0.0-beta.3 build /Users/jorgenfulsebakke/repos/js-utils/packages/react
3
- > rm -rf dist && tsc
2
+ > @biblioteksentralen/react@1.0.0-beta.4 build /Users/jorgenfulsebakke/repos/js-utils/packages/react
3
+ > pnpm run clean && tsc
4
+
5
+
6
+ > @biblioteksentralen/react@1.0.0-beta.4 clean /Users/jorgenfulsebakke/repos/js-utils/packages/react
7
+ > rm -rf dist
4
8
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @biblioteksentralen/react@1.0.0-beta.3 test /Users/jorgenfulsebakke/repos/js-utils/packages/react
2
+ > @biblioteksentralen/react@1.0.0-beta.4 test /Users/jorgenfulsebakke/repos/js-utils/packages/react
3
3
  > vitest --watch=false
4
4
 
5
5
  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
@@ -1,8 +1,15 @@
1
- import { ChakraProvider, extendTheme } from "@chakra-ui/react";
2
- import React from "react";
3
- import { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BiblioteksentralenProvider = void 0;
7
+ var react_1 = require("@chakra-ui/react");
8
+ var react_2 = __importDefault(require("react"));
9
+ var biblioteksentralenChakraTheme_1 = require("./styles/chakraTheme/biblioteksentralenChakraTheme");
4
10
  var emptyTheme = {};
5
- export var BiblioteksentralenProvider = function (props) {
11
+ var BiblioteksentralenProvider = function (props) {
6
12
  var _a;
7
- return (React.createElement(ChakraProvider, { theme: extendTheme(biblioteksentralenChakraTheme, (_a = props.customTheme) !== null && _a !== void 0 ? _a : emptyTheme) }, props.children));
13
+ return (react_2.default.createElement(react_1.ChakraProvider, { theme: (0, react_1.extendTheme)(biblioteksentralenChakraTheme_1.biblioteksentralenChakraTheme, (_a = props.customTheme) !== null && _a !== void 0 ? _a : emptyTheme) }, props.children));
8
14
  };
15
+ exports.BiblioteksentralenProvider = BiblioteksentralenProvider;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -20,21 +21,26 @@ var __rest = (this && this.__rest) || function (s, e) {
20
21
  }
21
22
  return t;
22
23
  };
23
- import { BsCheckCircle, BsExclamationCircle, BsXCircle, InformationIcon } from "@biblioteksentralen/icons";
24
- import { colors } from "@biblioteksentralen/utils";
25
- import { Box, Flex } from "@chakra-ui/react";
26
- import React from "react";
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Alert = void 0;
29
+ var icons_1 = require("@biblioteksentralen/icons");
30
+ var utils_1 = require("@biblioteksentralen/utils");
31
+ var react_1 = require("@chakra-ui/react");
32
+ var react_2 = __importDefault(require("react"));
27
33
  var colorLookup = {
28
- info: { bg: colors.lightBlue, color: colors.accentBlueMedium },
29
- warning: { bg: colors.alertYellow, color: colors.statusYellow },
34
+ info: { bg: utils_1.colors.lightBlue, color: utils_1.colors.accentBlueMedium },
35
+ warning: { bg: utils_1.colors.alertYellow, color: utils_1.colors.statusYellow },
30
36
  success: { bg: "green.100", color: "green.600" },
31
- error: { bg: colors.alertRed, color: colors.statusRed },
37
+ error: { bg: utils_1.colors.alertRed, color: utils_1.colors.statusRed },
32
38
  };
33
39
  var iconLookup = {
34
- info: React.createElement(InformationIcon, { role: "img", "aria-label": "Informasjon" }),
35
- warning: React.createElement(BsExclamationCircle, { role: "img", "aria-label": "Advarsel" }),
36
- success: React.createElement(BsCheckCircle, { role: "img", "aria-label": "Suksess" }),
37
- error: React.createElement(BsXCircle, { role: "img", "aria-label": "Feil" }),
40
+ info: react_2.default.createElement(icons_1.InformationIcon, { role: "img", "aria-label": "Informasjon" }),
41
+ warning: react_2.default.createElement(icons_1.BsExclamationCircle, { role: "img", "aria-label": "Advarsel" }),
42
+ success: react_2.default.createElement(icons_1.BsCheckCircle, { role: "img", "aria-label": "Suksess" }),
43
+ error: react_2.default.createElement(icons_1.BsXCircle, { role: "img", "aria-label": "Feil" }),
38
44
  };
39
45
  var variantStyles = {
40
46
  inline: {
@@ -43,10 +49,11 @@ var variantStyles = {
43
49
  padding: "0",
44
50
  },
45
51
  };
46
- export function Alert(_a) {
52
+ function Alert(_a) {
47
53
  var status = _a.status, children = _a.children, variant = _a.variant, rest = __rest(_a, ["status", "children", "variant"]);
48
54
  var colors = colorLookup[status];
49
- return (React.createElement(Flex, __assign({ role: "alert", flexWrap: "wrap", alignItems: "center", gridGap: "0.5rem 1rem", background: "white", border: "0.1rem solid", borderColor: colors.color, backgroundColor: colors.bg, padding: "0.75rem", borderRadius: "0.3rem" }, (variant ? variantStyles[variant] : {}), rest),
50
- React.createElement(Box, { color: colors.color, flex: "0 0", marginLeft: "auto", marginRight: "auto", lineHeight: "1", fontSize: "1.5em" }, iconLookup[status]),
51
- React.createElement(Box, { flex: "1" }, children)));
55
+ return (react_2.default.createElement(react_1.Flex, __assign({ role: "alert", flexWrap: "wrap", alignItems: "center", gridGap: "0.5rem 1rem", background: "white", border: "0.1rem solid", borderColor: colors.color, backgroundColor: colors.bg, padding: "0.75rem", borderRadius: "0.3rem" }, (variant ? variantStyles[variant] : {}), rest),
56
+ react_2.default.createElement(react_1.Box, { color: colors.color, flex: "0 0", marginLeft: "auto", marginRight: "auto", lineHeight: "1", fontSize: "1.5em" }, iconLookup[status]),
57
+ react_2.default.createElement(react_1.Box, { flex: "1" }, children)));
52
58
  }
59
+ exports.Alert = Alert;
@@ -1,2 +1,5 @@
1
- import { Button as ChakraButton } from "@chakra-ui/react";
2
- export var Button = ChakraButton;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = void 0;
4
+ var react_1 = require("@chakra-ui/react");
5
+ exports.Button = react_1.Button;
@@ -1,8 +1,15 @@
1
- import React from "react";
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ConditionalWrapper = void 0;
7
+ var react_1 = __importDefault(require("react"));
2
8
  /**
3
9
  * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
4
10
  */
5
- export var ConditionalWrapper = function (_a) {
11
+ var ConditionalWrapper = function (_a) {
6
12
  var condition = _a.condition, children = _a.children, Wrapper = _a.wrapper;
7
- return condition ? React.createElement(Wrapper, null, children) : React.createElement(React.Fragment, null, children);
13
+ return condition ? react_1.default.createElement(Wrapper, null, children) : react_1.default.createElement(react_1.default.Fragment, null, children);
8
14
  };
15
+ exports.ConditionalWrapper = ConditionalWrapper;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __extends = (this && this.__extends) || (function () {
2
3
  var extendStatics = function (d, b) {
3
4
  extendStatics = Object.setPrototypeOf ||
@@ -24,11 +25,16 @@ var __assign = (this && this.__assign) || function () {
24
25
  };
25
26
  return __assign.apply(this, arguments);
26
27
  };
27
- import { isDevelopment } from "@biblioteksentralen/utils";
28
- import { Box } from "@chakra-ui/react";
29
- import React from "react";
30
- import { Alert } from "./Alert";
31
- var StyledPre = function (props) { return (React.createElement(Box, __assign({ as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem" }, props))); };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.ErrorBoundary = void 0;
33
+ var utils_1 = require("@biblioteksentralen/utils");
34
+ var react_1 = require("@chakra-ui/react");
35
+ var react_2 = __importDefault(require("react"));
36
+ var Alert_1 = require("./Alert");
37
+ var StyledPre = function (props) { return (react_2.default.createElement(react_1.Box, __assign({ as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem" }, props))); };
32
38
  var ErrorBoundary = /** @class */ (function (_super) {
33
39
  __extends(ErrorBoundary, _super);
34
40
  function ErrorBoundary(props) {
@@ -49,16 +55,16 @@ var ErrorBoundary = /** @class */ (function (_super) {
49
55
  var stackTrace = (_a = this.state.errorInfo) === null || _a === void 0 ? void 0 : _a.componentStack;
50
56
  var errormsg = (_b = this.state.error) === null || _b === void 0 ? void 0 : _b.message;
51
57
  var info = this.props.boundaryName;
52
- return (React.createElement("div", null,
53
- React.createElement(Alert, { status: "error" },
54
- React.createElement("p", null, "Beklager, det skjedde en teknisk feil."),
55
- isDevelopment() && (stackTrace || errormsg) && (React.createElement("div", null,
56
- React.createElement(StyledPre, null, errormsg || ""),
57
- React.createElement(StyledPre, null, info || ""),
58
- React.createElement(StyledPre, null, stackTrace || ""))))));
58
+ return (react_2.default.createElement("div", null,
59
+ react_2.default.createElement(Alert_1.Alert, { status: "error" },
60
+ react_2.default.createElement("p", null, "Beklager, det skjedde en teknisk feil."),
61
+ (0, utils_1.isDevelopment)() && (stackTrace || errormsg) && (react_2.default.createElement("div", null,
62
+ react_2.default.createElement(StyledPre, null, errormsg || ""),
63
+ react_2.default.createElement(StyledPre, null, info || ""),
64
+ react_2.default.createElement(StyledPre, null, stackTrace || ""))))));
59
65
  }
60
66
  return this.props.children;
61
67
  };
62
68
  return ErrorBoundary;
63
- }(React.Component));
64
- export { ErrorBoundary };
69
+ }(react_2.default.Component));
70
+ exports.ErrorBoundary = ErrorBoundary;
@@ -1,5 +1,11 @@
1
- import { Box } from "@chakra-ui/react";
2
- import React from "react";
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HashLinkTarget = void 0;
7
+ var react_1 = require("@chakra-ui/react");
8
+ var react_2 = __importDefault(require("react"));
3
9
  var focusOnRelativeParentStyle = {
4
10
  "&:focus-within": {
5
11
  position: "static",
@@ -20,9 +26,10 @@ var focusOnRelativeParentStyle = {
20
26
  /*
21
27
  * Komponent som sørger for luft over anchors (elementer man kan lenke til med hash-lenker feks <a href="#min-overskrift">Ta meg til overskrift</a>)
22
28
  */
23
- export function HashLinkTarget(props) {
24
- return (React.createElement(Box, { position: "relative", sx: props.focusOnParent ? focusOnRelativeParentStyle : undefined },
25
- React.createElement(Box, { id: props.id, tabIndex: props.focusOnParent ? -1 : undefined, position: "absolute", top: "-".concat(props.spaceAbove || "2.5rem"), _focus: {
29
+ function HashLinkTarget(props) {
30
+ return (react_2.default.createElement(react_1.Box, { position: "relative", sx: props.focusOnParent ? focusOnRelativeParentStyle : undefined },
31
+ react_2.default.createElement(react_1.Box, { id: props.id, tabIndex: props.focusOnParent ? -1 : undefined, position: "absolute", top: "-".concat(props.spaceAbove || "2.5rem"), _focus: {
26
32
  boxShadow: "none !important",
27
33
  } })));
28
34
  }
35
+ exports.HashLinkTarget = HashLinkTarget;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -20,12 +21,18 @@ var __rest = (this && this.__rest) || function (s, e) {
20
21
  }
21
22
  return t;
22
23
  };
23
- import { Box } from "@chakra-ui/react";
24
- import React from "react";
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.HideWithCSS = void 0;
29
+ var react_1 = require("@chakra-ui/react");
30
+ var react_2 = __importDefault(require("react"));
25
31
  /** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */
26
- export var HideWithCSS = function (_a) {
32
+ var HideWithCSS = function (_a) {
27
33
  var _b, _c;
28
34
  var children = _a.children, above = _a.above, below = _a.below, chakraProps = __rest(_a, ["children", "above", "below"]);
29
35
  var display = __assign(__assign({}, (!!below ? (_b = { base: "none" }, _b[below] = "block", _b) : {})), (!!above ? (_c = {}, _c[above] = "none", _c) : {}));
30
- return (React.createElement(Box, __assign({}, chakraProps, { display: display }), children));
36
+ return (react_2.default.createElement(react_1.Box, __assign({}, chakraProps, { display: display }), children));
31
37
  };
38
+ exports.HideWithCSS = HideWithCSS;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
12
36
  var __rest = (this && this.__rest) || function (s, e) {
13
37
  var t = {};
14
38
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -20,18 +44,20 @@ var __rest = (this && this.__rest) || function (s, e) {
20
44
  }
21
45
  return t;
22
46
  };
23
- import { FormControl, FormErrorMessage, FormHelperText, FormLabel, Input as ChakraInput, } from "@chakra-ui/react";
24
- import React, { forwardRef } from "react";
25
- import { VisuallyHidden } from "./VisuallyHidden";
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Input = void 0;
49
+ var react_1 = require("@chakra-ui/react");
50
+ var react_2 = __importStar(require("react"));
51
+ var VisuallyHidden_1 = require("./VisuallyHidden");
26
52
  /**
27
53
  * Creating custom input-component to make sure label is always set (for accessibility)
28
54
  * Also handles some common needs (helper text and error message. For more advanced input-components we leave it to the consumers to compose custom input-components based on Chakra
29
55
  */
30
- export var Input = forwardRef(function (props, ref) {
56
+ exports.Input = (0, react_2.forwardRef)(function (props, ref) {
31
57
  var labelProps = props.labelProps, label = props.label, helperText = props.helperText, errorMessage = props.errorMessage, hideLabel = props.hideLabel, inputProps = __rest(props, ["labelProps", "label", "helperText", "errorMessage", "hideLabel"]);
32
- return (React.createElement(FormControl, { isInvalid: !!errorMessage },
33
- React.createElement(FormLabel, __assign({ marginBottom: ".25em" }, labelProps), hideLabel ? React.createElement(VisuallyHidden, null, label) : label),
34
- React.createElement(ChakraInput, __assign({ ref: ref }, inputProps)),
35
- errorMessage && React.createElement(FormErrorMessage, null, errorMessage),
36
- helperText && React.createElement(FormHelperText, null, helperText)));
58
+ return (react_2.default.createElement(react_1.FormControl, { isInvalid: !!errorMessage },
59
+ react_2.default.createElement(react_1.FormLabel, __assign({ marginBottom: ".25em" }, labelProps), hideLabel ? react_2.default.createElement(VisuallyHidden_1.VisuallyHidden, null, label) : label),
60
+ react_2.default.createElement(react_1.Input, __assign({ ref: ref }, inputProps)),
61
+ errorMessage && react_2.default.createElement(react_1.FormErrorMessage, null, errorMessage),
62
+ helperText && react_2.default.createElement(react_1.FormHelperText, null, helperText)));
37
63
  });
@@ -1,2 +1,5 @@
1
- import { Link as ChakraLink } from "@chakra-ui/react";
2
- export var Link = ChakraLink;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Link = void 0;
4
+ var react_1 = require("@chakra-ui/react");
5
+ exports.Link = react_1.Link;
@@ -1,3 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
1
25
  var __rest = (this && this.__rest) || function (s, e) {
2
26
  var t = {};
3
27
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,15 +33,17 @@ var __rest = (this && this.__rest) || function (s, e) {
9
33
  }
10
34
  return t;
11
35
  };
12
- import React, { useEffect } from "react";
13
- import { VisuallyHidden as ChakraVisuallyHidden } from "@chakra-ui/react";
14
- import { isDevelopment } from "@biblioteksentralen/utils";
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.VisuallyHidden = void 0;
38
+ var react_1 = __importStar(require("react"));
39
+ var react_2 = require("@chakra-ui/react");
40
+ var utils_1 = require("@biblioteksentralen/utils");
15
41
  // https://www.joshwcomeau.com/snippets/react-components/visually-hidden/
16
- export function VisuallyHidden(_a) {
42
+ function VisuallyHidden(_a) {
17
43
  var children = _a.children, rest = __rest(_a, ["children"]);
18
- var _b = React.useState(false), forceShow = _b[0], setForceShow = _b[1];
19
- useEffect(function () {
20
- if (isDevelopment()) {
44
+ var _b = react_1.default.useState(false), forceShow = _b[0], setForceShow = _b[1];
45
+ (0, react_1.useEffect)(function () {
46
+ if ((0, utils_1.isDevelopment)()) {
21
47
  var handleKeyDown_1 = function (ev) {
22
48
  if (ev.key === "Alt") {
23
49
  setForceShow(true);
@@ -37,5 +63,6 @@ export function VisuallyHidden(_a) {
37
63
  }
38
64
  }, []);
39
65
  // position="fixed" løser bug der visually hidden ikke hindret tekst fra å ta plass i bredden
40
- return forceShow ? React.createElement("span", null, children) : React.createElement(ChakraVisuallyHidden, { position: "fixed" }, children);
66
+ return forceShow ? react_1.default.createElement("span", null, children) : react_1.default.createElement(react_2.VisuallyHidden, { position: "fixed" }, children);
41
67
  }
68
+ exports.VisuallyHidden = VisuallyHidden;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,9 +10,15 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import React from "react";
13
- import { ErrorBoundary } from "./ErrorBoundary";
14
- export var withErrorBoundary = function (Component, boundaryName) {
15
- return React.forwardRef(function (props, ref) { return (React.createElement(ErrorBoundary, { boundaryName: boundaryName },
16
- React.createElement(Component, __assign({}, props, { ref: ref })))); });
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
15
  };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.withErrorBoundary = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var ErrorBoundary_1 = require("./ErrorBoundary");
20
+ var withErrorBoundary = function (Component, boundaryName) {
21
+ return react_1.default.forwardRef(function (props, ref) { return (react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { boundaryName: boundaryName },
22
+ react_1.default.createElement(Component, __assign({}, props, { ref: ref })))); });
23
+ };
24
+ exports.withErrorBoundary = withErrorBoundary;
package/dist/index.d.ts CHANGED
@@ -6,8 +6,9 @@ export { HideWithCSS } from "./components/HideWithCSS";
6
6
  export { Input } from "./components/Input";
7
7
  export { Link } from "./components/Link";
8
8
  export { VisuallyHidden } from "./components/VisuallyHidden";
9
+ export { BiblioteksentralenProvider } from "./BiblioteksentralenProvider";
9
10
  export { ErrorBoundary } from "./components/ErrorBoundary";
10
11
  export { HashLinkTarget } from "./components/HashLinkTarget";
11
12
  export { withErrorBoundary } from "./components/withErrorBoundary";
12
- export { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";
13
13
  export { colors } from "@biblioteksentralen/utils";
14
+ export { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";
package/dist/index.js CHANGED
@@ -1,13 +1,44 @@
1
- export * from "@chakra-ui/react"; // Exports Chakra components first to override some components later
2
- export { Alert } from "./components/Alert"; // Overrides Chakras Alert
3
- export { Button } from "./components/Button"; // Overrides Chakras Button
4
- export { ConditionalWrapper } from "./components/ConditionalWrapper"; // Overrides Chakras Input
5
- export { HideWithCSS } from "./components/HideWithCSS"; // Overrides Chakras HideWithCSS
6
- export { Input } from "./components/Input"; // Overrides Chakras Input
7
- export { Link } from "./components/Link"; // Overrides Chakras Link
8
- export { VisuallyHidden } from "./components/VisuallyHidden"; // Overrides Chakras VisuallyHidden
9
- export { ErrorBoundary } from "./components/ErrorBoundary";
10
- export { HashLinkTarget } from "./components/HashLinkTarget";
11
- export { withErrorBoundary } from "./components/withErrorBoundary";
12
- export { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";
13
- export { colors } from "@biblioteksentralen/utils"; // Re-export colors for convenience
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.biblioteksentralenChakraTheme = exports.colors = exports.withErrorBoundary = exports.HashLinkTarget = exports.ErrorBoundary = exports.BiblioteksentralenProvider = exports.VisuallyHidden = exports.Link = exports.Input = exports.HideWithCSS = exports.ConditionalWrapper = exports.Button = exports.Alert = void 0;
18
+ __exportStar(require("@chakra-ui/react"), exports); // Exports Chakra components first to override some components later
19
+ var Alert_1 = require("./components/Alert"); // Overrides Chakras Alert
20
+ Object.defineProperty(exports, "Alert", { enumerable: true, get: function () { return Alert_1.Alert; } });
21
+ var Button_1 = require("./components/Button"); // Overrides Chakras Button
22
+ Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
23
+ var ConditionalWrapper_1 = require("./components/ConditionalWrapper"); // Overrides Chakras Input
24
+ Object.defineProperty(exports, "ConditionalWrapper", { enumerable: true, get: function () { return ConditionalWrapper_1.ConditionalWrapper; } });
25
+ var HideWithCSS_1 = require("./components/HideWithCSS"); // Overrides Chakras HideWithCSS
26
+ Object.defineProperty(exports, "HideWithCSS", { enumerable: true, get: function () { return HideWithCSS_1.HideWithCSS; } });
27
+ var Input_1 = require("./components/Input"); // Overrides Chakras Input
28
+ Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });
29
+ var Link_1 = require("./components/Link"); // Overrides Chakras Link
30
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
31
+ var VisuallyHidden_1 = require("./components/VisuallyHidden"); // Overrides Chakras VisuallyHidden
32
+ Object.defineProperty(exports, "VisuallyHidden", { enumerable: true, get: function () { return VisuallyHidden_1.VisuallyHidden; } });
33
+ var BiblioteksentralenProvider_1 = require("./BiblioteksentralenProvider");
34
+ Object.defineProperty(exports, "BiblioteksentralenProvider", { enumerable: true, get: function () { return BiblioteksentralenProvider_1.BiblioteksentralenProvider; } });
35
+ var ErrorBoundary_1 = require("./components/ErrorBoundary");
36
+ Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
37
+ var HashLinkTarget_1 = require("./components/HashLinkTarget");
38
+ Object.defineProperty(exports, "HashLinkTarget", { enumerable: true, get: function () { return HashLinkTarget_1.HashLinkTarget; } });
39
+ var withErrorBoundary_1 = require("./components/withErrorBoundary");
40
+ Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return withErrorBoundary_1.withErrorBoundary; } });
41
+ var utils_1 = require("@biblioteksentralen/utils"); // Re-export colors for convenience
42
+ Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return utils_1.colors; } });
43
+ var biblioteksentralenChakraTheme_1 = require("./styles/chakraTheme/biblioteksentralenChakraTheme");
44
+ Object.defineProperty(exports, "biblioteksentralenChakraTheme", { enumerable: true, get: function () { return biblioteksentralenChakraTheme_1.biblioteksentralenChakraTheme; } });
@@ -1,7 +1,10 @@
1
- import { colors } from "@biblioteksentralen/utils";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonStyles = void 0;
4
+ var utils_1 = require("@biblioteksentralen/utils");
2
5
  var variants = {
3
6
  primary: {
4
- backgroundColor: colors.black,
7
+ backgroundColor: utils_1.colors.black,
5
8
  color: "white",
6
9
  _hover: {
7
10
  backgroundColor: "hsla(0deg, 0%, 70%, 1)",
@@ -25,13 +28,13 @@ var variants = {
25
28
  },
26
29
  },
27
30
  };
28
- export var ButtonStyles = {
31
+ exports.ButtonStyles = {
29
32
  baseStyle: {
30
33
  border: "transparent 0.1em solid",
31
34
  borderRadius: "0.35em",
32
35
  fontWeight: 600,
33
36
  _disabled: {
34
- backgroundColor: "".concat(colors.grey45, " !important"),
37
+ backgroundColor: "".concat(utils_1.colors.grey45, " !important"),
35
38
  color: "white !important",
36
39
  opacity: 1,
37
40
  },
@@ -1,6 +1,9 @@
1
- import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
2
- import { checkboxAnatomy } from "@chakra-ui/anatomy";
3
- var _a = createMultiStyleConfigHelpers(checkboxAnatomy.keys), definePartsStyle = _a.definePartsStyle, defineMultiStyleConfigWithTypeIssue = _a.defineMultiStyleConfig;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckboxStyles = void 0;
4
+ var react_1 = require("@chakra-ui/react");
5
+ var anatomy_1 = require("@chakra-ui/anatomy");
6
+ var _a = (0, react_1.createMultiStyleConfigHelpers)(anatomy_1.checkboxAnatomy.keys), definePartsStyle = _a.definePartsStyle, defineMultiStyleConfigWithTypeIssue = _a.defineMultiStyleConfig;
4
7
  // https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437
5
8
  var defineMultiStyleConfig = defineMultiStyleConfigWithTypeIssue;
6
9
  var baseStyle = definePartsStyle({
@@ -9,4 +12,4 @@ var baseStyle = definePartsStyle({
9
12
  },
10
13
  });
11
14
  // https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437
12
- export var CheckboxStyles = defineMultiStyleConfig({ baseStyle: baseStyle });
15
+ exports.CheckboxStyles = defineMultiStyleConfig({ baseStyle: baseStyle });
@@ -1,4 +1,7 @@
1
- export var ContainerStyles = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainerStyles = void 0;
4
+ exports.ContainerStyles = {
2
5
  baseStyle: {
3
6
  px: ".75rem", // Padding left/right
4
7
  },
@@ -1,4 +1,7 @@
1
- export var HeadingStyles = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeadingStyles = void 0;
4
+ exports.HeadingStyles = {
2
5
  baseStyle: {
3
6
  fontWeight: "600",
4
7
  },
@@ -1,34 +1,37 @@
1
- import { mode } from "@chakra-ui/theme-tools";
2
- export var InputStyles = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InputStyles = void 0;
4
+ var theme_tools_1 = require("@chakra-ui/theme-tools");
5
+ exports.InputStyles = {
3
6
  baseStyle: function (props) { return ({
4
7
  field: {
5
8
  _placeholder: {
6
- color: mode("gray.500", "whiteAlpha.500")(props),
9
+ color: (0, theme_tools_1.mode)("gray.500", "whiteAlpha.500")(props),
7
10
  },
8
11
  },
9
12
  }); },
10
13
  variants: {
11
14
  filled: function (props) { return ({
12
15
  field: {
13
- bg: mode("gray.200", "whiteAlpha.100")(props),
16
+ bg: (0, theme_tools_1.mode)("gray.200", "whiteAlpha.100")(props),
14
17
  _hover: {
15
- bg: mode("gray.300", "whiteAlpha.200")(props),
18
+ bg: (0, theme_tools_1.mode)("gray.300", "whiteAlpha.200")(props),
16
19
  },
17
20
  },
18
21
  }); },
19
22
  outline: function (props) { return ({
20
23
  field: {
21
- borderColor: mode("gray.300", "whiteAlpha.300")(props),
24
+ borderColor: (0, theme_tools_1.mode)("gray.300", "whiteAlpha.300")(props),
22
25
  _hover: {
23
- borderColor: mode("gray.400", "whiteAlpha.400")(props),
26
+ borderColor: (0, theme_tools_1.mode)("gray.400", "whiteAlpha.400")(props),
24
27
  },
25
28
  },
26
29
  }); },
27
30
  flushed: function (props) { return ({
28
31
  field: {
29
- borderColor: mode("gray.300", "whiteAlpha.300")(props),
32
+ borderColor: (0, theme_tools_1.mode)("gray.300", "whiteAlpha.300")(props),
30
33
  _hover: {
31
- borderColor: mode("gray.400", "whiteAlpha.400")(props),
34
+ borderColor: (0, theme_tools_1.mode)("gray.400", "whiteAlpha.400")(props),
32
35
  },
33
36
  },
34
37
  }); },
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkStyles = void 0;
1
4
  var variants = {
2
5
  plain: {
3
6
  textDecoration: "none",
@@ -6,7 +9,7 @@ var variants = {
6
9
  },
7
10
  },
8
11
  };
9
- export var LinkStyles = {
12
+ exports.LinkStyles = {
10
13
  baseStyle: {
11
14
  textDecoration: "underline",
12
15
  _hover: {
@@ -1,4 +1,7 @@
1
- export var ModalStyles = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModalStyles = void 0;
4
+ exports.ModalStyles = {
2
5
  baseStyle: {
3
6
  // Fix for modal height on Safari iOS:
4
7
  // https://github.com/chakra-ui/chakra-ui/issues/4680#issuecomment-1301640929
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,7 +10,9 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import { colors } from "@biblioteksentralen/utils";
13
- import { Spinner } from "@chakra-ui/react";
14
- export var SpinnerStyles = {};
15
- Spinner.defaultProps = __assign(__assign({}, Spinner.defaultProps), { speed: ".8s", color: colors.accentBlueMedium, emptyColor: "rgba(0,0,0,.2)", thickness: ".175em" });
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.SpinnerStyles = void 0;
15
+ var utils_1 = require("@biblioteksentralen/utils");
16
+ var react_1 = require("@chakra-ui/react");
17
+ exports.SpinnerStyles = {};
18
+ react_1.Spinner.defaultProps = __assign(__assign({}, react_1.Spinner.defaultProps), { speed: ".8s", color: utils_1.colors.accentBlueMedium, emptyColor: "rgba(0,0,0,.2)", thickness: ".175em" });
@@ -1,13 +1,16 @@
1
- import { ButtonStyles } from "./ButtonStyles";
2
- import { CheckboxStyles } from "./CheckboxStyles";
3
- import { ContainerStyles } from "./ContainerStyles";
4
- import { HeadingStyles } from "./HeadingStyles";
5
- import { InputStyles } from "./InputStyles";
6
- import { LinkStyles } from "./LinkStyles";
7
- import { ModalStyles } from "./ModalStyles";
8
- import { SpinnerStyles } from "./SpinnerStyles";
9
- import { sizes } from "./sizes";
10
- export var biblioteksentralenChakraTheme = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.biblioteksentralenChakraTheme = void 0;
4
+ var ButtonStyles_1 = require("./ButtonStyles");
5
+ var CheckboxStyles_1 = require("./CheckboxStyles");
6
+ var ContainerStyles_1 = require("./ContainerStyles");
7
+ var HeadingStyles_1 = require("./HeadingStyles");
8
+ var InputStyles_1 = require("./InputStyles");
9
+ var LinkStyles_1 = require("./LinkStyles");
10
+ var ModalStyles_1 = require("./ModalStyles");
11
+ var SpinnerStyles_1 = require("./SpinnerStyles");
12
+ var sizes_1 = require("./sizes");
13
+ exports.biblioteksentralenChakraTheme = {
11
14
  styles: {
12
15
  global: {
13
16
  html: {
@@ -19,14 +22,14 @@ export var biblioteksentralenChakraTheme = {
19
22
  },
20
23
  },
21
24
  components: {
22
- Heading: HeadingStyles,
23
- Spinner: SpinnerStyles,
24
- Link: LinkStyles,
25
- Button: ButtonStyles,
26
- Input: InputStyles,
27
- Container: ContainerStyles,
28
- Modal: ModalStyles,
29
- Checkbox: CheckboxStyles,
25
+ Heading: HeadingStyles_1.HeadingStyles,
26
+ Spinner: SpinnerStyles_1.SpinnerStyles,
27
+ Link: LinkStyles_1.LinkStyles,
28
+ Button: ButtonStyles_1.ButtonStyles,
29
+ Input: InputStyles_1.InputStyles,
30
+ Container: ContainerStyles_1.ContainerStyles,
31
+ Modal: ModalStyles_1.ModalStyles,
32
+ Checkbox: CheckboxStyles_1.CheckboxStyles,
30
33
  },
31
- sizes: sizes,
34
+ sizes: sizes_1.sizes,
32
35
  };
@@ -1,9 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sizes = void 0;
1
4
  var container = {
2
5
  sm: "40rem",
3
6
  md: "48rem",
4
7
  lg: "56rem", // Forsøker 56rem som standardbredde etter testing med Katrine
5
8
  xl: "80rem",
6
9
  };
7
- export var sizes = {
10
+ exports.sizes = {
8
11
  container: container,
9
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biblioteksentralen/react",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "React library for reusable code in Biblioteksentralens js-apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,9 +25,9 @@
25
25
  "@types/react": "^18.2.45",
26
26
  "react": "^18.2.0",
27
27
  "react-dom": "^18.2.0",
28
- "@biblioteksentralen/icons": "1.0.0-beta.5",
29
- "@biblioteksentralen/utils": "1.0.0-beta.6",
30
- "@biblioteksentralen/types": "1.0.0-beta.2"
28
+ "@biblioteksentralen/icons": "1.0.0-beta.7",
29
+ "@biblioteksentralen/types": "1.0.0-beta.5",
30
+ "@biblioteksentralen/utils": "1.0.0-beta.7"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^18.2.0",
@@ -36,7 +36,8 @@
36
36
  "scripts": {
37
37
  "test": "vitest --watch=false",
38
38
  "type-check": "tsc --noEmit",
39
- "clean": "rm -rf node_modules",
40
- "build": "rm -rf dist && tsc"
39
+ "clean": "rm -rf dist",
40
+ "build": "pnpm run clean && tsc",
41
+ "build:deploy": "pnpm run build --module commonjs"
41
42
  }
42
43
  }
package/src/index.ts CHANGED
@@ -7,9 +7,10 @@ export { Input } from "./components/Input"; // Overrides Chakras Input
7
7
  export { Link } from "./components/Link"; // Overrides Chakras Link
8
8
  export { VisuallyHidden } from "./components/VisuallyHidden"; // Overrides Chakras VisuallyHidden
9
9
 
10
+ export { BiblioteksentralenProvider } from "./BiblioteksentralenProvider";
10
11
  export { ErrorBoundary } from "./components/ErrorBoundary";
11
12
  export { HashLinkTarget } from "./components/HashLinkTarget";
12
13
  export { withErrorBoundary } from "./components/withErrorBoundary";
13
14
 
14
- export { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";
15
15
  export { colors } from "@biblioteksentralen/utils"; // Re-export colors for convenience
16
+ export { biblioteksentralenChakraTheme } from "./styles/chakraTheme/biblioteksentralenChakraTheme";