@biblioteksentralen/react 3.0.0-beta.1 → 3.0.0-beta.10

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.ts CHANGED
@@ -1,9 +1,9 @@
1
- import * as _chakra_ui_react from '@chakra-ui/react';
2
- import { AlertRootProps, ButtonProps, BoxProps, InputProps, FieldLabelProps, LinkProps } from '@chakra-ui/react';
1
+ import { AlertRootProps, ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1, BoxProps, InputProps, FieldLabelProps, LinkProps, SystemConfig, ToastRootProps } from '@chakra-ui/react';
3
2
  export * from '@chakra-ui/react';
3
+ import { ComponentWithAs, ThemeTypings } from '@chakra-ui/system';
4
+ export { ResponsiveObject, StyleProps } from '@chakra-ui/system';
4
5
  import { Modify } from '@biblioteksentralen/types';
5
6
  import React, { ReactNode, FunctionComponent, HTMLAttributes, ErrorInfo } from 'react';
6
- import { ComponentWithAs, ThemeTypings } from '@chakra-ui/system';
7
7
  export { colors } from '@biblioteksentralen/utils';
8
8
 
9
9
  type Status = "info" | "warning" | "success" | "error";
@@ -25,10 +25,21 @@ type CustomButtonVariants = "primary" | "secondary" | "tertiary";
25
25
  * Re-exporting chackras Button with a customised types
26
26
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
27
27
  */
28
- type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
29
- declare const Button: ComponentWithAs<"button", Modify<ButtonProps, {
28
+ type ButtonVariants = ButtonProps$1["variant"] | CustomButtonVariants;
29
+ type ButtonProps = Modify<ButtonProps$1, {
30
30
  variant?: ButtonVariants;
31
- }>>;
31
+ }>;
32
+ declare const Button: ComponentWithAs<"button", ButtonProps>;
33
+
34
+ /**
35
+ * Re-exporting chackras IconButton with a customised types
36
+ * This causes both chakras native variants and our home-made variants to show up in auto-complete
37
+ */
38
+ type IconButtonVariants = IconButtonProps$1["variant"] | CustomButtonVariants;
39
+ type IconButtonProps = Modify<IconButtonProps$1, {
40
+ variant?: IconButtonVariants;
41
+ }>;
42
+ declare const IconButton: ComponentWithAs<"button", IconButtonProps>;
32
43
 
33
44
  type Props$6 = {
34
45
  children: ReactNode;
@@ -81,6 +92,7 @@ declare function VisuallyHidden({ children, ...rest }: Props$3): React.JSX.Eleme
81
92
 
82
93
  interface Props$2 {
83
94
  children: ReactNode;
95
+ customTheme?: SystemConfig;
84
96
  }
85
97
  declare const BiblioteksentralenProvider: (props: Props$2) => React.JSX.Element;
86
98
 
@@ -117,6 +129,7 @@ declare function HashLinkTarget(props: Props): React.JSX.Element;
117
129
 
118
130
  declare const withErrorBoundary: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
119
131
 
120
- declare const biblioteksentralenChakraTheme: _chakra_ui_react.SystemContext;
132
+ declare const toaster: ToastRootProps;
133
+ declare const Toaster: () => React.JSX.Element;
121
134
 
122
- export { Alert, BiblioteksentralenProvider, Button, ConditionalWrapper, ErrorBoundary, HashLinkTarget, HideWithCSS, Input, Link, VisuallyHidden, biblioteksentralenChakraTheme, withErrorBoundary };
135
+ export { Alert, BiblioteksentralenProvider, Button, type ButtonProps, ConditionalWrapper, ErrorBoundary, HashLinkTarget, HideWithCSS, IconButton, type IconButtonProps, Input, Link, Toaster, VisuallyHidden, toaster, withErrorBoundary };
package/dist/index.js CHANGED
@@ -209,6 +209,7 @@ function _create_super(Derived) {
209
209
  return _possible_constructor_return(this, result);
210
210
  };
211
211
  }
212
+ var _import_react13_defaultConfig_theme_recipes_button_variants, _import_react13_defaultConfig_theme_recipes_button, _import_react13_defaultConfig_theme_recipes, _import_react13_defaultConfig_theme;
212
213
  var __create = Object.create;
213
214
  var __defProp = Object.defineProperty;
214
215
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -294,21 +295,27 @@ __export(src_exports, {
294
295
  HideWithCSS: function() {
295
296
  return HideWithCSS;
296
297
  },
298
+ IconButton: function() {
299
+ return IconButton;
300
+ },
297
301
  Input: function() {
298
302
  return Input;
299
303
  },
300
304
  Link: function() {
301
305
  return Link;
302
306
  },
307
+ Toaster: function() {
308
+ return Toaster;
309
+ },
303
310
  VisuallyHidden: function() {
304
311
  return VisuallyHidden;
305
312
  },
306
- biblioteksentralenChakraTheme: function() {
307
- return biblioteksentralenChakraTheme;
308
- },
309
313
  colors: function() {
310
314
  return colors;
311
315
  },
316
+ toaster: function() {
317
+ return toaster;
318
+ },
312
319
  withErrorBoundary: function() {
313
320
  return withErrorBoundary;
314
321
  }
@@ -423,25 +430,33 @@ function Alert(_param) {
423
430
  var colors2 = colorLookup[status];
424
431
  return /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Root, _object_spread({
425
432
  status: status,
433
+ fontSize: "md",
426
434
  border: "0.1rem solid",
427
435
  borderColor: colors2.color,
428
- backgroundColor: colors2.bg
429
- }, variant === "inline" ? variantStyles[variant] : {}, rest), /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Indicator, null, iconLookup[status]), /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Content, {
436
+ backgroundColor: colors2.bg,
437
+ display: "flex",
438
+ flexWrap: "wrap"
439
+ }, variant === "inline" ? variantStyles[variant] : {}, rest), /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Indicator, {
440
+ marginX: "auto"
441
+ }, iconLookup[status]), /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Content, {
430
442
  color: "black"
431
443
  }, header && /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Title, null, header), /* @__PURE__ */ import_react2.default.createElement(import_react.Alert.Description, null, children)));
432
444
  }
433
445
  // src/components/Button.tsx
434
446
  var import_react3 = require("@chakra-ui/react");
435
447
  var Button = import_react3.Button;
448
+ // src/components/IconButton.tsx
449
+ var import_react4 = require("@chakra-ui/react");
450
+ var IconButton = import_react4.IconButton;
436
451
  // src/components/ConditionalWrapper.tsx
437
- var import_react4 = __toESM(require("react"));
452
+ var import_react5 = __toESM(require("react"));
438
453
  var ConditionalWrapper = function(param) {
439
454
  var condition = param.condition, children = param.children, Wrapper = param.wrapper;
440
- return condition ? /* @__PURE__ */ import_react4.default.createElement(Wrapper, null, children) : /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, children);
455
+ return condition ? /* @__PURE__ */ import_react5.default.createElement(Wrapper, null, children) : /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, children);
441
456
  };
442
457
  // src/components/HideWithCSS.tsx
443
- var import_react5 = require("@chakra-ui/react");
444
- var import_react6 = __toESM(require("react"));
458
+ var import_react6 = require("@chakra-ui/react");
459
+ var import_react7 = __toESM(require("react"));
445
460
  var HideWithCSS = function(_param) {
446
461
  var children = _param.children, above = _param.above, below = _param.below, chakraProps = _object_without_properties(_param, [
447
462
  "children",
@@ -451,22 +466,22 @@ var HideWithCSS = function(_param) {
451
466
  var display = _object_spread({}, !!below ? _define_property({
452
467
  base: "none"
453
468
  }, below, "block") : {}, !!above ? _define_property({}, above, "none") : {});
454
- return /* @__PURE__ */ import_react6.default.createElement(import_react5.Box, _object_spread_props(_object_spread({}, chakraProps), {
469
+ return /* @__PURE__ */ import_react7.default.createElement(import_react6.Box, _object_spread_props(_object_spread({}, chakraProps), {
455
470
  display: display
456
471
  }), children);
457
472
  };
458
473
  // src/components/Input.tsx
459
- var import_react9 = require("@chakra-ui/react");
460
- var import_react10 = __toESM(require("react"));
474
+ var import_react10 = require("@chakra-ui/react");
475
+ var import_react11 = __toESM(require("react"));
461
476
  // src/components/VisuallyHidden.tsx
462
- var import_react7 = __toESM(require("react"));
463
- var import_react8 = require("@chakra-ui/react");
477
+ var import_react8 = __toESM(require("react"));
478
+ var import_react9 = require("@chakra-ui/react");
464
479
  function VisuallyHidden(_param) {
465
480
  var children = _param.children, rest = _object_without_properties(_param, [
466
481
  "children"
467
482
  ]);
468
- var _import_react7_default_useState = _sliced_to_array(import_react7.default.useState(false), 2), forceShow = _import_react7_default_useState[0], setForceShow = _import_react7_default_useState[1];
469
- (0, import_react7.useEffect)(function() {
483
+ var _import_react8_default_useState = _sliced_to_array(import_react8.default.useState(false), 2), forceShow = _import_react8_default_useState[0], setForceShow = _import_react8_default_useState[1];
484
+ (0, import_react8.useEffect)(function() {
470
485
  if (isDevelopment()) {
471
486
  var handleKeyDown = function(ev) {
472
487
  if (ev.key === "Alt") {
@@ -486,7 +501,7 @@ function VisuallyHidden(_param) {
486
501
  };
487
502
  }
488
503
  }, []);
489
- return forceShow ? /* @__PURE__ */ import_react7.default.createElement("span", null, children) : /* @__PURE__ */ import_react7.default.createElement(import_react8.VisuallyHidden, {
504
+ return forceShow ? /* @__PURE__ */ import_react8.default.createElement("span", null, children) : /* @__PURE__ */ import_react8.default.createElement(import_react9.VisuallyHidden, {
490
505
  position: "fixed"
491
506
  }, children);
492
507
  }
@@ -499,20 +514,22 @@ var Input = function(props) {
499
514
  "errorMessage",
500
515
  "hideLabel"
501
516
  ]);
502
- var formLabel = /* @__PURE__ */ import_react10.default.createElement(import_react9.Field.Label, _object_spread({}, labelProps), label);
503
- return /* @__PURE__ */ import_react10.default.createElement(import_react9.Field.Root, {
517
+ var formLabel = /* @__PURE__ */ import_react11.default.createElement(import_react10.Field.Label, _object_spread({}, labelProps), label);
518
+ return /* @__PURE__ */ import_react11.default.createElement(import_react10.Field.Root, {
504
519
  invalid: !!errorMessage
505
- }, hideLabel ? /* @__PURE__ */ import_react10.default.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ import_react10.default.createElement(import_react9.Field.HelperText, null, helperText), /* @__PURE__ */ import_react10.default.createElement(import_react9.Input, _object_spread({}, inputProps)), errorMessage && /* @__PURE__ */ import_react10.default.createElement(import_react9.Field.ErrorText, null, errorMessage));
520
+ }, hideLabel ? /* @__PURE__ */ import_react11.default.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ import_react11.default.createElement(import_react10.Field.HelperText, null, helperText), /* @__PURE__ */ import_react11.default.createElement(import_react10.Input, _object_spread({}, inputProps)), errorMessage && /* @__PURE__ */ import_react11.default.createElement(import_react10.Field.ErrorText, null, errorMessage));
506
521
  };
507
522
  // src/components/Link.tsx
508
- var import_react11 = require("@chakra-ui/react");
509
- var Link = import_react11.Link;
523
+ var import_react12 = require("@chakra-ui/react");
524
+ var Link = import_react12.Link;
510
525
  // src/BiblioteksentralenProvider.tsx
511
- var import_react19 = __toESM(require("react"));
512
- var import_react20 = require("@chakra-ui/react");
526
+ var import_react20 = __toESM(require("react"));
527
+ var import_react21 = require("@chakra-ui/react");
528
+ // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
529
+ var import_react19 = require("@chakra-ui/react");
513
530
  // src/styles/chakraTheme/ButtonStyles.ts
514
- var import_react12 = require("@chakra-ui/react");
515
- var variants = {
531
+ var import_react13 = require("@chakra-ui/react");
532
+ var variants = _object_spread({
516
533
  primary: {
517
534
  backgroundColor: colors.black,
518
535
  color: "white",
@@ -522,62 +539,64 @@ var variants = {
522
539
  }
523
540
  },
524
541
  secondary: {
525
- borderColor: "currentColor !important",
526
- backgroundColor: "transparent",
527
- color: "currentColor",
528
- _hover: {
529
- backgroundColor: "hsla(0deg, 0%, 50%, 0.15)"
530
- }
542
+ borderColor: "currentColor"
531
543
  },
532
- tertiary: {
533
- backgroundColor: "transparent",
534
- color: "currentColor",
535
- _hover: {
536
- backgroundColor: "hsla(0deg, 0%, 50%, 0.15)",
537
- color: "currentColor"
538
- }
539
- }
540
- };
541
- var ButtonStyles = (0, import_react12.defineRecipe)({
544
+ tertiary: {}
545
+ }, (_import_react13_defaultConfig_theme = import_react13.defaultConfig.theme) === null || _import_react13_defaultConfig_theme === void 0 ? void 0 : (_import_react13_defaultConfig_theme_recipes = _import_react13_defaultConfig_theme.recipes) === null || _import_react13_defaultConfig_theme_recipes === void 0 ? void 0 : (_import_react13_defaultConfig_theme_recipes_button = _import_react13_defaultConfig_theme_recipes.button) === null || _import_react13_defaultConfig_theme_recipes_button === void 0 ? void 0 : (_import_react13_defaultConfig_theme_recipes_button_variants = _import_react13_defaultConfig_theme_recipes_button.variants) === null || _import_react13_defaultConfig_theme_recipes_button_variants === void 0 ? void 0 : _import_react13_defaultConfig_theme_recipes_button_variants.variant);
546
+ var ButtonStyles = (0, import_react13.defineRecipe)({
542
547
  base: {
543
- border: "transparent 0.1em solid",
544
- borderRadius: "0.35em",
548
+ borderColor: "transparent",
549
+ borderWidth: "0.1em",
545
550
  fontWeight: 600,
551
+ color: "currentColor",
552
+ backgroundColor: "transparent",
553
+ _hover: {
554
+ backgroundColor: "currentColor/7"
555
+ },
546
556
  _disabled: {
547
- backgroundColor: "".concat(colors.grey45, " !important"),
548
- color: "white !important",
557
+ backgroundColor: "".concat(colors.grey45),
558
+ color: "white",
549
559
  opacity: 1
550
560
  }
551
561
  },
552
562
  variants: {
553
- variant: _object_spread({}, variants),
554
- sizes: {
563
+ variant: variants,
564
+ size: {
555
565
  sm: {
556
- padding: "0.2em 0.5em",
557
- fontSize: "1rem"
566
+ h: "8",
567
+ px: "2",
568
+ textStyle: "md"
569
+ },
570
+ md: {
571
+ textStyle: "md"
572
+ },
573
+ lg: {
574
+ h: "12",
575
+ textStyle: "lg"
558
576
  }
559
577
  }
560
578
  },
561
579
  defaultVariants: {
562
- variant: "primary"
580
+ variant: "primary",
581
+ size: "md"
563
582
  }
564
583
  });
565
584
  // src/styles/chakraTheme/ContainerStyles.ts
566
- var import_react13 = require("@chakra-ui/react");
567
- var ContainerStyles = (0, import_react13.defineRecipe)({
585
+ var import_react14 = require("@chakra-ui/react");
586
+ var ContainerStyles = (0, import_react14.defineRecipe)({
568
587
  base: {
569
588
  px: ".75rem"
570
589
  }
571
590
  });
572
591
  // src/styles/chakraTheme/HeadingStyles.ts
573
- var import_react14 = require("@chakra-ui/react");
574
- var HeadingStyles = (0, import_react14.defineRecipe)({
592
+ var import_react15 = require("@chakra-ui/react");
593
+ var HeadingStyles = (0, import_react15.defineRecipe)({
575
594
  base: {
576
595
  fontWeight: "600"
577
596
  }
578
597
  });
579
598
  // src/styles/chakraTheme/InputStyles.ts
580
- var import_react15 = require("@chakra-ui/react");
599
+ var import_react16 = require("@chakra-ui/react");
581
600
  var variants2 = {
582
601
  subtle: {
583
602
  backgroundColor: {
@@ -616,7 +635,7 @@ var variants2 = {
616
635
  }
617
636
  }
618
637
  };
619
- var InputStyles = (0, import_react15.defineRecipe)({
638
+ var InputStyles = (0, import_react16.defineRecipe)({
620
639
  base: {
621
640
  _placeholder: {
622
641
  color: {
@@ -626,39 +645,43 @@ var InputStyles = (0, import_react15.defineRecipe)({
626
645
  }
627
646
  },
628
647
  variants: {
629
- variant: _object_spread({}, variants2)
648
+ variant: variants2
630
649
  },
631
650
  defaultVariants: {
632
651
  variant: "subtle"
633
652
  }
634
653
  });
635
654
  // src/styles/chakraTheme/LinkStyles.ts
636
- var import_react16 = require("@chakra-ui/react");
655
+ var import_react17 = require("@chakra-ui/react");
637
656
  var variants3 = {
638
657
  plain: {
658
+ color: "currentColor",
639
659
  textDecoration: "none",
660
+ textDecorationColor: "currentColor/30",
640
661
  _hover: {
641
662
  textDecoration: "underline"
642
663
  }
643
664
  },
644
665
  underline: {
666
+ color: "currentColor",
645
667
  textDecoration: "underline",
668
+ textDecorationColor: "currentColor/30",
646
669
  _hover: {
647
670
  textDecoration: "none"
648
671
  }
649
672
  }
650
673
  };
651
- var LinkStyles = (0, import_react16.defineRecipe)({
674
+ var LinkStyles = (0, import_react17.defineRecipe)({
652
675
  variants: {
653
- variant: _object_spread({}, variants3)
676
+ variant: variants3
654
677
  },
655
678
  defaultVariants: {
656
679
  variant: "underline"
657
680
  }
658
681
  });
659
682
  // src/styles/chakraTheme/SpinnerStyles.ts
660
- var import_react17 = require("@chakra-ui/react");
661
- var SpinnerStyles = (0, import_react17.defineRecipe)({
683
+ var import_react18 = require("@chakra-ui/react");
684
+ var SpinnerStyles = (0, import_react18.defineRecipe)({
662
685
  base: {
663
686
  animationDuration: ".8s",
664
687
  color: colors.accentBlueMedium,
@@ -686,12 +709,21 @@ var sizes = {
686
709
  container: container
687
710
  };
688
711
  // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
689
- var import_react18 = require("@chakra-ui/react");
690
- var biblioteksentralenChakraTheme = (0, import_react18.createSystem)(import_react18.defaultConfig, {
712
+ var tokens = (0, import_react19.defineTokens)({
713
+ sizes: sizes
714
+ });
715
+ var globalHyphens = {
716
+ hyphens: "auto",
717
+ hyphenateLimitChars: "8 5 3"
718
+ };
719
+ var focusStyle = {
720
+ outline: "none !important",
721
+ boxShadow: "0 0 0 .1rem white, 0 0 0 .2rem black, 0 0 0 .3rem white !important",
722
+ transition: "box-shadow 0.1s ease-out"
723
+ };
724
+ var biblioteksentralenChakraTheme = (0, import_react19.defineConfig)({
691
725
  theme: {
692
- tokens: {
693
- sizes: sizes
694
- },
726
+ tokens: tokens,
695
727
  recipes: {
696
728
  heading: HeadingStyles,
697
729
  button: ButtonStyles,
@@ -712,21 +744,24 @@ var biblioteksentralenChakraTheme = (0, import_react18.createSystem)(import_reac
712
744
  "&:focus-within": {
713
745
  scrollBehavior: "smooth !important"
714
746
  }
715
- }
747
+ },
748
+ body: _object_spread({}, globalHyphens),
749
+ // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus
750
+ "*:focus-visible": focusStyle
716
751
  }
717
752
  });
718
753
  // src/BiblioteksentralenProvider.tsx
719
754
  var import_system = require("@chakra-ui/system");
720
755
  var BiblioteksentralenProvider = function(props) {
721
- return /* @__PURE__ */ import_react19.default.createElement(import_react20.ChakraProvider, {
722
- value: biblioteksentralenChakraTheme
723
- }, /* @__PURE__ */ import_react19.default.createElement(import_system.ColorModeProvider, _object_spread({}, props)));
756
+ return /* @__PURE__ */ import_react20.default.createElement(import_react21.ChakraProvider, {
757
+ value: (0, import_react21.createSystem)(import_react21.defaultConfig, biblioteksentralenChakraTheme, props.customTheme || {})
758
+ }, /* @__PURE__ */ import_react20.default.createElement(import_system.ColorModeProvider, _object_spread({}, props)));
724
759
  };
725
760
  // src/components/ErrorBoundary.tsx
726
- var import_react21 = require("@chakra-ui/react");
727
- var import_react22 = __toESM(require("react"));
761
+ var import_react22 = require("@chakra-ui/react");
762
+ var import_react23 = __toESM(require("react"));
728
763
  var StyledPre = function(props) {
729
- return /* @__PURE__ */ import_react22.default.createElement(import_react21.Box, _object_spread({
764
+ return /* @__PURE__ */ import_react23.default.createElement(import_react22.Box, _object_spread({
730
765
  as: "pre",
731
766
  paddingTop: "0.5rem",
732
767
  wordBreak: "break-all",
@@ -734,8 +769,8 @@ var StyledPre = function(props) {
734
769
  fontSize: "0.8rem"
735
770
  }, props));
736
771
  };
737
- var ErrorBoundary = /*#__PURE__*/ function(_import_react22_default_Component) {
738
- _inherits(ErrorBoundary, _import_react22_default_Component);
772
+ var ErrorBoundary = /*#__PURE__*/ function(_import_react23_default_Component) {
773
+ _inherits(ErrorBoundary, _import_react23_default_Component);
739
774
  var _super = _create_super(ErrorBoundary);
740
775
  function ErrorBoundary(props) {
741
776
  _class_call_check(this, ErrorBoundary);
@@ -769,9 +804,9 @@ var ErrorBoundary = /*#__PURE__*/ function(_import_react22_default_Component) {
769
804
  var stackTrace = (_this_state_errorInfo = this.state.errorInfo) === null || _this_state_errorInfo === void 0 ? void 0 : _this_state_errorInfo.componentStack;
770
805
  var errormsg = (_this_state_error = this.state.error) === null || _this_state_error === void 0 ? void 0 : _this_state_error.message;
771
806
  var info = this.props.boundaryName;
772
- return /* @__PURE__ */ import_react22.default.createElement("div", null, /* @__PURE__ */ import_react22.default.createElement(Alert, {
807
+ return /* @__PURE__ */ import_react23.default.createElement("div", null, /* @__PURE__ */ import_react23.default.createElement(Alert, {
773
808
  status: "error"
774
- }, /* @__PURE__ */ import_react22.default.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ import_react22.default.createElement("div", null, /* @__PURE__ */ import_react22.default.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ import_react22.default.createElement(StyledPre, null, info || ""), /* @__PURE__ */ import_react22.default.createElement(StyledPre, null, stackTrace || ""))));
809
+ }, /* @__PURE__ */ import_react23.default.createElement("p", null, "Beklager, det skjedde en teknisk feil."), isDevelopment() && (stackTrace || errormsg) && /* @__PURE__ */ import_react23.default.createElement("div", null, /* @__PURE__ */ import_react23.default.createElement(StyledPre, null, errormsg || ""), /* @__PURE__ */ import_react23.default.createElement(StyledPre, null, info || ""), /* @__PURE__ */ import_react23.default.createElement(StyledPre, null, stackTrace || ""))));
775
810
  }
776
811
  return this.props.children;
777
812
  }
@@ -787,15 +822,15 @@ var ErrorBoundary = /*#__PURE__*/ function(_import_react22_default_Component) {
787
822
  }
788
823
  ]);
789
824
  return ErrorBoundary;
790
- }(import_react22.default.Component);
825
+ }(import_react23.default.Component);
791
826
  // src/components/HashLinkTarget.tsx
792
- var import_react23 = require("@chakra-ui/react");
793
- var import_react24 = __toESM(require("react"));
827
+ var import_react24 = require("@chakra-ui/react");
828
+ var import_react25 = __toESM(require("react"));
794
829
  var focusOnRelativeParentStyle = {
795
830
  _focusWithin: {
796
831
  position: "static",
797
832
  boxShadow: "none",
798
- "&::after": {
833
+ "&::after": _object_spread({
799
834
  content: '""',
800
835
  position: "absolute",
801
836
  top: 0,
@@ -803,16 +838,15 @@ var focusOnRelativeParentStyle = {
803
838
  height: "100%",
804
839
  width: "100%",
805
840
  pointerEvents: "none",
806
- borderRadius: "0.25rem",
807
- boxShadow: "var(--chakra-shadows-outline)"
808
- }
841
+ borderRadius: "0.25rem"
842
+ }, focusStyle)
809
843
  }
810
844
  };
811
845
  function HashLinkTarget(props) {
812
- return /* @__PURE__ */ import_react24.default.createElement(import_react23.Box, {
846
+ return /* @__PURE__ */ import_react25.default.createElement(import_react24.Box, {
813
847
  position: "relative",
814
848
  css: props.focusOnParent ? focusOnRelativeParentStyle : void 0
815
- }, /* @__PURE__ */ import_react24.default.createElement(import_react23.Box, {
849
+ }, /* @__PURE__ */ import_react25.default.createElement(import_react24.Box, {
816
850
  id: props.id,
817
851
  tabIndex: props.focusOnParent ? -1 : void 0,
818
852
  position: "absolute",
@@ -823,14 +857,50 @@ function HashLinkTarget(props) {
823
857
  }));
824
858
  }
825
859
  // src/components/withErrorBoundary.tsx
826
- var import_react25 = __toESM(require("react"));
860
+ var import_react26 = __toESM(require("react"));
827
861
  var withErrorBoundary = function(Component, boundaryName) {
828
862
  return function(props) {
829
- return /* @__PURE__ */ import_react25.default.createElement(ErrorBoundary, {
863
+ return /* @__PURE__ */ import_react26.default.createElement(ErrorBoundary, {
830
864
  boundaryName: boundaryName
831
- }, /* @__PURE__ */ import_react25.default.createElement(Component, _object_spread({}, props)));
865
+ }, /* @__PURE__ */ import_react26.default.createElement(Component, _object_spread({}, props)));
832
866
  };
833
867
  };
868
+ // src/components/ui/toaster.tsx
869
+ var import_react27 = require("@chakra-ui/react");
870
+ var import_react28 = __toESM(require("react"));
871
+ var toaster = (0, import_react27.createToaster)({
872
+ pauseOnPageIdle: true,
873
+ offsets: {
874
+ left: "50%",
875
+ top: "50%",
876
+ right: "50%",
877
+ bottom: "50%"
878
+ }
879
+ });
880
+ var Toaster = function() {
881
+ return /* @__PURE__ */ import_react28.default.createElement(import_react27.Portal, null, /* @__PURE__ */ import_react28.default.createElement(import_react27.Toaster, {
882
+ toaster: toaster,
883
+ insetInline: {
884
+ mdDown: "4"
885
+ }
886
+ }, function(toast) {
887
+ if (typeof toast.render === "function") {
888
+ return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, toast.render());
889
+ }
890
+ return /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.Root, {
891
+ width: {
892
+ md: "sm"
893
+ }
894
+ }, toast.type === "loading" ? /* @__PURE__ */ import_react28.default.createElement(import_react27.Spinner, {
895
+ size: "sm",
896
+ color: "blue.solid"
897
+ }) : /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.Indicator, null), /* @__PURE__ */ import_react28.default.createElement(import_react27.Stack, {
898
+ gap: "1",
899
+ flex: "1",
900
+ maxWidth: "100%"
901
+ }, toast.title && /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.Title, null, toast.title), toast.description && /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.Description, null, toast.description)), toast.action && /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.ActionTrigger, null, toast.action.label), toast.closable && /* @__PURE__ */ import_react28.default.createElement(import_react27.Toast.CloseTrigger, null));
902
+ }));
903
+ };
834
904
  // Annotate the CommonJS export names for ESM import in node:
835
905
  0 && (module.exports = _object_spread({
836
906
  Alert: Alert,
@@ -840,11 +910,13 @@ var withErrorBoundary = function(Component, boundaryName) {
840
910
  ErrorBoundary: ErrorBoundary,
841
911
  HashLinkTarget: HashLinkTarget,
842
912
  HideWithCSS: HideWithCSS,
913
+ IconButton: IconButton,
843
914
  Input: Input,
844
915
  Link: Link,
916
+ Toaster: Toaster,
845
917
  VisuallyHidden: VisuallyHidden,
846
- biblioteksentralenChakraTheme: biblioteksentralenChakraTheme,
847
918
  colors: colors,
919
+ toaster: toaster,
848
920
  withErrorBoundary: withErrorBoundary
849
921
  }, require("@chakra-ui/react")));
850
922
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../../utils/src/date.ts","../../utils/src/colors.ts","../../utils/src/environment.ts","../src/components/Alert.tsx","../src/components/Button.tsx","../src/components/ConditionalWrapper.tsx","../src/components/HideWithCSS.tsx","../src/components/Input.tsx","../src/components/VisuallyHidden.tsx","../src/components/Link.tsx","../src/BiblioteksentralenProvider.tsx","../src/styles/chakraTheme/ButtonStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/LinkStyles.ts","../src/styles/chakraTheme/SpinnerStyles.ts","../src/styles/chakraTheme/sizes.ts","../src/styles/chakraTheme/biblioteksentralenChakraTheme.ts","../src/components/ErrorBoundary.tsx","../src/components/HashLinkTarget.tsx","../src/components/withErrorBoundary.tsx"],"names":["import_react","React","colors","ChakraAlert","ChakraButton","ChakraVisuallyHidden","ChakraInput","ChakraLink","variants"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAc,6BAAd;;;ACAA,oBAAuB;AACvB,gBAAmB;ACDZ,IAAM,SAAS;EACpB,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,gBAAW;EACX,kBAAa;EACb,cAAc;EACd,aAAa;EACb,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,cAAc;EACd,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,WAAW;EACX,cAAc;EACd,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;EACnB,SAAS;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;EACT;AACF;ACxCO,SAAS,gBAAyB;AACvC,SAAO,QAAQ,IAAI,aAAa;AAClC;;;ACAA,mBAAwE;AACxE,IAAAA,gBAAiC;AACjC,2BAAwD;AAMxD,IAAM,cAA6D;AAAA,EACjE,MAAM,EAAE,IAAI,OAAO,WAAW,OAAO,OAAO,iBAAiB;AAAA,EAC7D,SAAS,EAAE,IAAI,OAAO,mBAAmB,OAAO,OAAO,aAAa;AAAA,EACpE,SAAS,EAAE,IAAI,OAAO,kBAAkB,OAAO,OAAO,YAAY;AAAA,EAClE,OAAO,EAAE,IAAI,OAAO,gBAAgB,OAAO,OAAO,UAAU;AAC9D;AAEA,IAAM,aAAiD;AAAA,EACrD,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ACpB;AACF;;;AC3DA,IAAAD,iBAAoB;AACpB,IAAAA,iBAAkB;AAclB,IAAM,6BAA6B;AAAA,EACjC,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,eAAe;AAAA,MACf,cAAc;AAAA,MACd,WAAW;AAAA,IACb;AAAA,EACF;AACF;AAKO,SAAS,eAAe,OAAc;AAC3C,SACE,+BAAAC,QAAA,cAAC,sBAAI,UAAS,YAAW,KAAK,MAAM,gBAAgB,6BAA6B,UAC/E,+BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,UAAU,MAAM,gBAAgB,KAAK;AAAA,MACrC,UAAS;AAAA,MACT,KAAK,IAAI,MAAM,cAAc,QAAQ;AAAA,MACrC,QAAQ;AAAA,QACN,WAAW;AAAA,MACb;AAAA;AAAA,EACF,CACF;AAEJ;;;AClDA,IAAAD,iBAAkB;AAGX,IAAM,oBAAoB,CAAS,WAAuC,iBAAyB;AACxG,SAAO,CAAC,UACN,+BAAAC,QAAA,cAAC,iBAAc,gBACb,+BAAAA,QAAA,cAAC,aAAW,GAAG,OAAO,CACxB;AAEJ","sourcesContent":["export * from \"@chakra-ui/react\"; // Exports Chakra components first to override some components later\nexport { Alert } from \"./components/Alert\"; // Overrides Chakras Alert\nexport { Button } from \"./components/Button\"; // Overrides Chakras Button\nexport { ConditionalWrapper } from \"./components/ConditionalWrapper\"; // Overrides Chakras Input\nexport { HideWithCSS } from \"./components/HideWithCSS\"; // Overrides Chakras HideWithCSS\nexport { Input } from \"./components/Input\"; // Overrides Chakras Input\nexport { Link } from \"./components/Link\"; // Overrides Chakras Link\nexport { VisuallyHidden } from \"./components/VisuallyHidden\"; // Overrides Chakras VisuallyHidden\n\nexport { BiblioteksentralenProvider } from \"./BiblioteksentralenProvider\";\nexport { ErrorBoundary } from \"./components/ErrorBoundary\";\nexport { HashLinkTarget } from \"./components/HashLinkTarget\";\nexport { withErrorBoundary } from \"./components/withErrorBoundary\";\n\nexport { colors } from \"@biblioteksentralen/utils\"; // Re-export colors for convenience\nexport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\n","import { format } from \"date-fns/format\";\nimport { nb } from \"date-fns/locale/nb\";\n\nexport function formaterDato(dato?: string, dateFnsformat = \"Pp\") {\n if (typeof dato !== \"string\") return \"Ukjent dato\";\n\n try {\n return format(new Date(dato), dateFnsformat, { locale: nb });\n } catch (e) {\n console.error(\"Kunne ikke formattere dato:\" + dato, e);\n return dato;\n }\n}\n","export const colors = {\n black: \"#000000\",\n grey90: \"#181818\",\n grey80: \"#333333\",\n grey60: \"#585858\",\n grey45: \"#8c8c8c\",\n grey30: \"#b2b2b2\",\n grey15: \"#d9d9d9\",\n grey10: \"#e5e5e5\",\n grey05: \"#f2f2f2\",\n white: \"#ffffff\",\n bsRødDark: \"#870010\",\n bsRødMedium: \"#d53d40\",\n accentPurple: \"#331433\",\n accentPeach: \"#ffba99\",\n accentGreen: \"#003b29\",\n accentBlueDark: \"#001740\",\n accentBlueMedium: \"#5996de\",\n accentYellow: \"#ffc970\",\n lightBlue: \"#dbe8ef\",\n lightGreen: \"#dbe0db\",\n lightPeach: \"#f4e7de\",\n lightPurple: \"#ece8f3\",\n statusRed: \"#ad313c\",\n statusYellow: \"#bc5600\",\n statusGreen: \"#24845b\",\n statusGreenLight: \"#edf4f1\",\n statusRedLight: \"#f8efef\",\n statusYellowLight: \"#fff6e4\",\n neptune: {\n \"100\": \"#CFE6E8\",\n \"200\": \"#9FCDD2\",\n \"300\": \"#6FB5BB\",\n \"400\": \"#3F9CA5\",\n \"500\": \"#0F838E\",\n \"600\": \"#0C6972\",\n \"700\": \"#094F55\",\n \"800\": \"#063439\",\n \"900\": \"#031A1C\",\n },\n};\n","export function isDevelopment(): boolean {\n return process.env.NODE_ENV === \"development\";\n}\n\nexport function isClient(): boolean {\n return typeof window !== \"undefined\";\n}\n\nexport function isServer(): boolean {\n return !isClient();\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { colors } from \"@biblioteksentralen/utils\";\nimport { AlertRootProps, Alert as ChakraAlert, SystemStyleObject } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = \"info\" | \"warning\" | \"success\" | \"error\";\ntype CustomVariants = \"inline\";\ntype Variants = AlertRootProps[\"variant\"] | CustomVariants;\n\nconst colorLookup: Record<Status, { bg: string; color: string }> = {\n info: { bg: colors.lightBlue, color: colors.accentBlueMedium },\n warning: { bg: colors.statusYellowLight, color: colors.statusYellow },\n success: { bg: colors.statusGreenLight, color: colors.statusGreen },\n error: { bg: colors.statusRedLight, color: colors.statusRed },\n};\n\nconst iconLookup: Record<Status, React.ReactElement> = {\n info: <Info strokeWidth={1.75} role=\"img\" aria-label=\"Informasjon\" />,\n warning: <AlertCircle strokeWidth={1.75} role=\"img\" aria-label=\"Advarsel\" />,\n success: <CheckCircle strokeWidth={1.75} role=\"img\" aria-label=\"Suksess\" />,\n error: <XCircle strokeWidth={1.75} role=\"img\" aria-label=\"Feil\" />,\n};\n\ninterface Props extends Modify<AlertRootProps, { variant?: Variants }> {\n children: ReactNode;\n header?: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<CustomVariants, SystemStyleObject> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function Alert({ status, children, variant, header, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <ChakraAlert.Root\n status={status}\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n {...(variant === \"inline\" ? variantStyles[variant] : {})}\n {...rest}\n >\n <ChakraAlert.Indicator>{iconLookup[status]}</ChakraAlert.Indicator>\n <ChakraAlert.Content color=\"black\">\n {header && <ChakraAlert.Title>{header}</ChakraAlert.Title>}\n <ChakraAlert.Description>{children}</ChakraAlert.Description>\n </ChakraAlert.Content>\n </ChakraAlert.Root>\n );\n}\n","import React from \"react\";\nimport { Button as ChakraButton, ButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { Modify } from \"@biblioteksentralen/types\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras Button with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype ButtonVariants = ButtonProps[\"variant\"] | CustomButtonVariants;\nexport const Button = ChakraButton as ComponentWithAs<\"button\", Modify<ButtonProps, { variant?: ButtonVariants }>>;\n","import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapper: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n","import { Box, BoxProps } from \"@chakra-ui/react\";\nimport { ThemeTypings } from \"@chakra-ui/system\";\nimport React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n above?: ThemeTypings[\"breakpoints\"];\n below?: ThemeTypings[\"breakpoints\"];\n} & Omit<BoxProps, \"display\">;\n\n/** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */\nexport const HideWithCSS: FunctionComponent<Props> = ({ children, above, below, ...chakraProps }) => {\n const display: BoxProps[\"display\"] = {\n ...(!!below ? { base: \"none\", [below]: \"block\" } : {}),\n ...(!!above ? { [above]: \"none\" } : {}),\n };\n\n return (\n <Box {...chakraProps} display={display}>\n {children}\n </Box>\n );\n};\n","import { Field, Input as ChakraInput, InputProps, FieldLabelProps } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FieldLabelProps;\n helperText?: string;\n errorMessage?: string;\n}\n\n/**\n * Creating custom input-component to make sure label is always set (for accessibility)\n * 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\n */\nexport const Input = (props: Props) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <Field.Label {...labelProps}>{label}</Field.Label>;\n\n return (\n <Field.Root invalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && <Field.HelperText>{helperText}</Field.HelperText>}\n <ChakraInput {...inputProps} />\n {errorMessage && <Field.ErrorText>{errorMessage}</Field.ErrorText>}\n </Field.Root>\n );\n};\n","import React, { HTMLAttributes, ReactNode, useEffect } from \"react\";\nimport { VisuallyHidden as ChakraVisuallyHidden } from \"@chakra-ui/react\";\nimport { isDevelopment } from \"@biblioteksentralen/utils\";\n\ninterface Props extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode;\n}\n\n// https://www.joshwcomeau.com/snippets/react-components/visually-hidden/\nexport function VisuallyHidden({ children, ...rest }: Props) {\n const [forceShow, setForceShow] = React.useState(false);\n\n useEffect(() => {\n if (isDevelopment()) {\n const handleKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(true);\n }\n };\n const handleKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(false);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n window.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n window.removeEventListener(\"keyup\", handleKeyUp);\n };\n }\n }, []);\n\n // position=\"fixed\" løser bug der visually hidden ikke hindret tekst fra å ta plass i bredden\n return forceShow ? <span>{children}</span> : <ChakraVisuallyHidden position=\"fixed\">{children}</ChakraVisuallyHidden>;\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Link as ChakraLink, LinkProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomLinkVariants } from \"../styles/chakraTheme/LinkStyles\";\n\n/**\n * Re-exporting chackras Link with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype LinkVariants = LinkProps[\"variant\"] | CustomLinkVariants;\nexport const Link = ChakraLink as ComponentWithAs<\"a\", Modify<LinkProps, { variant?: LinkVariants }>>;\n","import React, { ReactNode } from \"react\";\nimport { ChakraProvider } from \"@chakra-ui/react\";\nimport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\nimport { ColorModeProvider } from \"@chakra-ui/system\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport const BiblioteksentralenProvider = (props: Props) => (\n <ChakraProvider value={biblioteksentralenChakraTheme}>\n <ColorModeProvider {...props} />\n </ChakraProvider>\n);\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleObject> = {\n primary: {\n backgroundColor: colors.black,\n color: \"white\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 70%, 1)\",\n color: \"black\",\n },\n },\n secondary: {\n borderColor: \"currentColor !important\",\n backgroundColor: \"transparent\",\n color: \"currentColor\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 50%, 0.15)\",\n },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: \"currentColor\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 50%, 0.15)\",\n color: \"currentColor\",\n },\n },\n};\n\nexport const ButtonStyles = defineRecipe({\n base: {\n border: \"transparent 0.1em solid\",\n borderRadius: \"0.35em\",\n fontWeight: 600,\n _disabled: {\n backgroundColor: `${colors.grey45} !important`,\n color: \"white !important\",\n opacity: 1,\n },\n },\n variants: {\n variant: {\n ...variants,\n },\n sizes: {\n sm: {\n padding: \"0.2em 0.5em\",\n fontSize: \"1rem\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const ContainerStyles = defineRecipe({\n base: {\n px: \".75rem\", // Padding left/right\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const HeadingStyles = defineRecipe({\n base: {\n fontWeight: \"600\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nconst variants: Record<string, SystemStyleObject> = {\n subtle: {\n backgroundColor: { _light: \"gray.200\", _dark: \"whiteAlpha.100\" },\n _hover: {\n bg: { _light: \"gray.300\", _dark: \"whiteAlpha.200\" },\n },\n },\n outline: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n flushed: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n};\n\nexport const InputStyles = defineRecipe({\n base: {\n _placeholder: {\n color: { _light: \"gray.500\", _dark: \"whiteAlpha.500\" },\n },\n },\n variants: {\n variant: { ...variants },\n },\n defaultVariants: {\n variant: \"subtle\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomLinkVariants = \"plain\" | \"underline\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleObject> = {\n plain: {\n textDecoration: \"none\",\n _hover: {\n textDecoration: \"underline\",\n },\n },\n underline: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n};\n\nexport const LinkStyles = defineRecipe({\n variants: {\n variant: { ...variants },\n },\n defaultVariants: {\n variant: \"underline\",\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe } from \"@chakra-ui/react\";\n\nexport const SpinnerStyles = defineRecipe({\n base: {\n animationDuration: \".8s\",\n color: colors.accentBlueMedium,\n // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color\n borderWidth: \".175em\",\n },\n});\n","const container = {\n sm: { value: \"40rem\" },\n md: { value: \"48rem\" },\n lg: { value: \"56rem\" }, // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: { value: \"80rem\" },\n};\n\nexport const sizes = {\n container,\n};\n","import { ButtonStyles } from \"./ButtonStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\nimport { createSystem, defaultConfig } from \"@chakra-ui/react\";\n\nexport const biblioteksentralenChakraTheme = createSystem(defaultConfig, {\n theme: {\n tokens: {\n sizes,\n },\n recipes: {\n heading: HeadingStyles,\n button: ButtonStyles,\n input: InputStyles,\n link: LinkStyles,\n container: ContainerStyles,\n spinner: SpinnerStyles,\n },\n },\n globalCss: {\n html: {\n fontSize: { base: \"112.5%\", md: \"120%\" },\n // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,\n // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)\n \"&:focus-within\": { scrollBehavior: \"smooth !important\" },\n },\n },\n});\n","import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { Alert } from \"./Alert\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundary extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <Alert status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </Alert>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n","import { Box } from \"@chakra-ui/react\";\nimport React from \"react\";\n\ninterface Props {\n id: string;\n /**\n * angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'\n */\n spaceAbove?: string;\n /**\n * angir om du vil ha fokusramme rundt komponenten som mounter HashLinkTarget. Da må komponenten du wrapper med ha position: relative | absolute el\n */\n focusOnParent?: boolean;\n}\n\nconst focusOnRelativeParentStyle = {\n _focusWithin: {\n position: \"static\",\n boxShadow: \"none\",\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n width: \"100%\",\n pointerEvents: \"none\",\n borderRadius: \"0.25rem\",\n boxShadow: \"var(--chakra-shadows-outline)\",\n },\n },\n};\n\n/*\n * 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>)\n */\nexport function HashLinkTarget(props: Props) {\n return (\n <Box position=\"relative\" css={props.focusOnParent ? focusOnRelativeParentStyle : undefined}>\n <Box\n id={props.id}\n tabIndex={props.focusOnParent ? -1 : undefined}\n position=\"absolute\"\n top={`-${props.spaceAbove || \"2.5rem\"}`}\n _focus={{\n boxShadow: \"none !important\",\n }}\n />\n </Box>\n );\n}\n","import React from \"react\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\n\nexport const withErrorBoundary = <Props,>(Component: React.ComponentType<Props>, boundaryName: string) => {\n return (props: Props & React.JSX.IntrinsicAttributes) => (\n <ErrorBoundary boundaryName={boundaryName}>\n <Component {...props} />\n </ErrorBoundary>\n );\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts","../../utils/src/date.ts","../../utils/src/colors.ts","../../utils/src/environment.ts","../src/components/Alert.tsx","../src/components/Button.tsx","../src/components/IconButton.tsx","../src/components/ConditionalWrapper.tsx","../src/components/HideWithCSS.tsx","../src/components/Input.tsx","../src/components/VisuallyHidden.tsx","../src/components/Link.tsx","../src/BiblioteksentralenProvider.tsx","../src/styles/chakraTheme/biblioteksentralenChakraTheme.ts","../src/styles/chakraTheme/ButtonStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/LinkStyles.ts","../src/styles/chakraTheme/SpinnerStyles.ts","../src/styles/chakraTheme/sizes.ts","../src/components/ErrorBoundary.tsx","../src/components/HashLinkTarget.tsx","../src/components/withErrorBoundary.tsx","../src/components/ui/toaster.tsx"],"names":["import_react","React","colors","ChakraAlert","ChakraButton","ChakraIconButton","ChakraVisuallyHidden","ChakraInput","ChakraLink","variants","ChakraToaster"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,w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U,MAAM;AAC3B,SACE,+BAAAC,QAAA,cAAC,6BACC,+BAAAA,QAAA,cAAC,eAAAS,SAAA,EAAc,SAAkB,aAAa,EAAE,QAAQ,IAAI,KACzD,CAAC,UAA0B;AAC1B,QAAI,OAAO,MAAM,WAAW,YAAY;AACtC,aAAO,+BAAAT,QAAA,6BAAAA,QAAA,gBAAG,MAAM,OAAO,CAAE;AAAA,IAC3B;AACA,WACE,+BAAAA,QAAA,cAAC,qBAAM,MAAN,EAAW,OAAO,EAAE,IAAI,KAAK,KAC3B,MAAM,SAAS,YAAY,+BAAAA,QAAA,cAAC,0BAAQ,MAAK,MAAK,OAAM,cAAa,IAAK,+BAAAA,QAAA,cAAC,qBAAM,WAAN,IAAgB,GACxF,+BAAAA,QAAA,cAAC,wBAAM,KAAI,KAAI,MAAK,KAAI,UAAS,UAC9B,MAAM,SAAS,+BAAAA,QAAA,cAAC,qBAAM,OAAN,MAAa,MAAM,KAAM,GACzC,MAAM,eAAe,+BAAAA,QAAA,cAAC,qBAAM,aAAN,MAAmB,MAAM,WAAY,CAC9D,GACC,MAAM,UAAU,+BAAAA,QAAA,cAAC,qBAAM,eAAN,MAAqB,MAAM,OAAO,KAAM,GACzD,MAAM,YAAY,+BAAAA,QAAA,cAAC,qBAAM,cAAN,IAAmB,CACzC;AAAA,EAEJ,CACF,CACF;AAEJ","sourcesContent":["export * from \"@chakra-ui/react\"; // Exports Chakra components first to override some components later\nexport type { StyleProps, ResponsiveObject } from \"@chakra-ui/system\"; // Exports Chakra system types\nexport { Alert } from \"./components/Alert\"; // Overrides Chakras Alert\nexport { Button, type ButtonProps } from \"./components/Button\"; // Overrides Chakras Button\nexport { IconButton, type IconButtonProps } from \"./components/IconButton\"; // Overrides Chakras IconButton\nexport { ConditionalWrapper } from \"./components/ConditionalWrapper\"; // Overrides Chakras Input\nexport { HideWithCSS } from \"./components/HideWithCSS\"; // Overrides Chakras HideWithCSS\nexport { Input } from \"./components/Input\"; // Overrides Chakras Input\nexport { Link } from \"./components/Link\"; // Overrides Chakras Link\nexport { VisuallyHidden } from \"./components/VisuallyHidden\"; // Overrides Chakras VisuallyHidden\n\nexport { BiblioteksentralenProvider } from \"./BiblioteksentralenProvider\";\nexport { ErrorBoundary } from \"./components/ErrorBoundary\";\nexport { HashLinkTarget } from \"./components/HashLinkTarget\";\nexport { withErrorBoundary } from \"./components/withErrorBoundary\";\n\nexport { colors } from \"@biblioteksentralen/utils\"; // Re-export colors for convenience\n\n// Generated from cli: npmx @chakra-ui/cli snippet add\nexport { Toaster, toaster } from \"./components/ui/toaster\"; // Exports the Toaster component\n","import { format } from \"date-fns/format\";\nimport { nb } from \"date-fns/locale/nb\";\n\nexport function formaterDato(dato?: string, dateFnsformat = \"Pp\") {\n if (typeof dato !== \"string\") return \"Ukjent dato\";\n\n try {\n return format(new Date(dato), dateFnsformat, { locale: nb });\n } catch (e) {\n console.error(\"Kunne ikke formattere dato:\" + dato, e);\n return dato;\n }\n}\n","export const colors = {\n black: \"#000000\",\n grey90: \"#181818\",\n grey80: \"#333333\",\n grey60: \"#585858\",\n grey45: \"#8c8c8c\",\n grey30: \"#b2b2b2\",\n grey15: \"#d9d9d9\",\n grey10: \"#e5e5e5\",\n grey05: \"#f2f2f2\",\n white: \"#ffffff\",\n bsRødDark: \"#870010\",\n bsRødMedium: \"#d53d40\",\n accentPurple: \"#331433\",\n accentPeach: \"#ffba99\",\n accentGreen: \"#003b29\",\n accentBlueDark: \"#001740\",\n accentBlueMedium: \"#5996de\",\n accentYellow: \"#ffc970\",\n lightBlue: \"#dbe8ef\",\n lightGreen: \"#dbe0db\",\n lightPeach: \"#f4e7de\",\n lightPurple: \"#ece8f3\",\n statusRed: \"#ad313c\",\n statusYellow: \"#bc5600\",\n statusGreen: \"#24845b\",\n statusGreenLight: \"#edf4f1\",\n statusRedLight: \"#f8efef\",\n statusYellowLight: \"#fff6e4\",\n neptune: {\n \"100\": \"#CFE6E8\",\n \"200\": \"#9FCDD2\",\n \"300\": \"#6FB5BB\",\n \"400\": \"#3F9CA5\",\n \"500\": \"#0F838E\",\n \"600\": \"#0C6972\",\n \"700\": \"#094F55\",\n \"800\": \"#063439\",\n \"900\": \"#031A1C\",\n },\n};\n","export function isDevelopment(): boolean {\n return process.env.NODE_ENV === \"development\";\n}\n\nexport function isClient(): boolean {\n return typeof window !== \"undefined\";\n}\n\nexport function isServer(): boolean {\n return !isClient();\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { colors } from \"@biblioteksentralen/utils\";\nimport { AlertRootProps, Alert as ChakraAlert, SystemStyleObject } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = \"info\" | \"warning\" | \"success\" | \"error\";\ntype CustomVariants = \"inline\";\ntype Variants = AlertRootProps[\"variant\"] | CustomVariants;\n\nconst colorLookup: Record<Status, { bg: string; color: string }> = {\n info: { bg: colors.lightBlue, color: colors.accentBlueMedium },\n warning: { bg: colors.statusYellowLight, color: colors.statusYellow },\n success: { bg: colors.statusGreenLight, color: colors.statusGreen },\n error: { bg: colors.statusRedLight, color: colors.statusRed },\n};\n\nconst iconLookup: Record<Status, React.ReactElement> = {\n info: <Info strokeWidth={1.75} role=\"img\" aria-label=\"Informasjon\" />,\n warning: <AlertCircle strokeWidth={1.75} role=\"img\" aria-label=\"Advarsel\" />,\n success: <CheckCircle strokeWidth={1.75} role=\"img\" aria-label=\"Suksess\" />,\n error: <XCircle strokeWidth={1.75} role=\"img\" aria-label=\"Feil\" />,\n};\n\ninterface Props extends Modify<AlertRootProps, { variant?: Variants }> {\n children: ReactNode;\n header?: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<CustomVariants, SystemStyleObject> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function Alert({ status, children, variant, header, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <ChakraAlert.Root\n status={status}\n fontSize=\"md\"\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n display=\"flex\"\n flexWrap=\"wrap\"\n {...(variant === \"inline\" ? variantStyles[variant] : {})}\n {...rest}\n >\n <ChakraAlert.Indicator marginX=\"auto\">{iconLookup[status]}</ChakraAlert.Indicator>\n <ChakraAlert.Content color=\"black\">\n {header && <ChakraAlert.Title>{header}</ChakraAlert.Title>}\n <ChakraAlert.Description>{children}</ChakraAlert.Description>\n </ChakraAlert.Content>\n </ChakraAlert.Root>\n );\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Button as ChakraButton, ButtonProps as NativeButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras Button with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype ButtonVariants = NativeButtonProps[\"variant\"] | CustomButtonVariants;\nexport type ButtonProps = Modify<NativeButtonProps, { variant?: ButtonVariants }>;\nexport const Button = ChakraButton as ComponentWithAs<\"button\", ButtonProps>;\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { IconButton as ChakraIconButton, IconButtonProps as ChakraIconButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras IconButton with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype IconButtonVariants = ChakraIconButtonProps[\"variant\"] | CustomButtonVariants;\nexport type IconButtonProps = Modify<ChakraIconButtonProps, { variant?: IconButtonVariants }>;\nexport const IconButton = ChakraIconButton as ComponentWithAs<\"button\", IconButtonProps>;\n","import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapper: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n","import { Box, BoxProps } from \"@chakra-ui/react\";\nimport { ThemeTypings } from \"@chakra-ui/system\";\nimport React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n above?: ThemeTypings[\"breakpoints\"];\n below?: ThemeTypings[\"breakpoints\"];\n} & Omit<BoxProps, \"display\">;\n\n/** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */\nexport const HideWithCSS: FunctionComponent<Props> = ({ children, above, below, ...chakraProps }) => {\n const display: BoxProps[\"display\"] = {\n ...(!!below ? { base: \"none\", [below]: \"block\" } : {}),\n ...(!!above ? { [above]: \"none\" } : {}),\n };\n\n return (\n <Box {...chakraProps} display={display}>\n {children}\n </Box>\n );\n};\n","import { Field, Input as ChakraInput, InputProps, FieldLabelProps } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FieldLabelProps;\n helperText?: string;\n errorMessage?: string;\n}\n\n/**\n * Creating custom input-component to make sure label is always set (for accessibility)\n * 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\n */\nexport const Input = (props: Props) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <Field.Label {...labelProps}>{label}</Field.Label>;\n\n return (\n <Field.Root invalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && <Field.HelperText>{helperText}</Field.HelperText>}\n <ChakraInput {...inputProps} />\n {errorMessage && <Field.ErrorText>{errorMessage}</Field.ErrorText>}\n </Field.Root>\n );\n};\n","import React, { HTMLAttributes, ReactNode, useEffect } from \"react\";\nimport { VisuallyHidden as ChakraVisuallyHidden } from \"@chakra-ui/react\";\nimport { isDevelopment } from \"@biblioteksentralen/utils\";\n\ninterface Props extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode;\n}\n\n// https://www.joshwcomeau.com/snippets/react-components/visually-hidden/\nexport function VisuallyHidden({ children, ...rest }: Props) {\n const [forceShow, setForceShow] = React.useState(false);\n\n useEffect(() => {\n if (isDevelopment()) {\n const handleKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(true);\n }\n };\n const handleKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(false);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n window.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n window.removeEventListener(\"keyup\", handleKeyUp);\n };\n }\n }, []);\n\n // position=\"fixed\" løser bug der visually hidden ikke hindret tekst fra å ta plass i bredden\n return forceShow ? <span>{children}</span> : <ChakraVisuallyHidden position=\"fixed\">{children}</ChakraVisuallyHidden>;\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Link as ChakraLink, LinkProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomLinkVariants } from \"../styles/chakraTheme/LinkStyles\";\n\n/**\n * Re-exporting chackras Link with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype LinkVariants = LinkProps[\"variant\"] | CustomLinkVariants;\nexport const Link = ChakraLink as ComponentWithAs<\"a\", Modify<LinkProps, { variant?: LinkVariants }>>;\n","import React, { ReactNode } from \"react\";\nimport { ChakraProvider, createSystem, defaultConfig, SystemConfig } from \"@chakra-ui/react\";\nimport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\nimport { ColorModeProvider } from \"@chakra-ui/system\";\n\ninterface Props {\n children: ReactNode;\n customTheme?: SystemConfig;\n}\n\nexport const BiblioteksentralenProvider = (props: Props) => (\n <ChakraProvider value={createSystem(defaultConfig, biblioteksentralenChakraTheme, props.customTheme || {})}>\n <ColorModeProvider {...props} />\n </ChakraProvider>\n);\n","import { defineConfig, defineTokens } from \"@chakra-ui/react\";\nimport { ButtonStyles } from \"./ButtonStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\n\nconst tokens = defineTokens({\n sizes,\n});\n\n// https://blog.logrocket.com/guide-css-word-wrap-overflow-wrap-word-break/\n// https://medium.com/clear-left-thinking/all-you-need-to-know-about-hyphenation-in-css-2baee2d89179\n// Skrur på hyphens auto som default fordi vi har masse mikrotekster og små elementer der layout knekker uten dette, og vi lager stadig nye og glemmer å ta hensyn til dette.\n// Så kan man optionaly sette hyphens: none de stedene man ikke ønsker det, men har ikke sett noe som knekker/blir rart pga dette enda\nconst globalHyphens = {\n hyphens: \"auto\",\n hyphenateLimitChars: \"8 5 3\", // minimum word-length / min letters first line / min letters second line\n};\n\nexport const focusStyle = {\n outline: \"none !important\",\n boxShadow: `0 0 0 .1rem white, 0 0 0 .2rem black, 0 0 0 .3rem white !important`,\n transition: \"box-shadow 0.1s ease-out\",\n};\n\nexport const biblioteksentralenChakraTheme = defineConfig({\n theme: {\n tokens,\n recipes: {\n heading: HeadingStyles,\n button: ButtonStyles,\n input: InputStyles,\n link: LinkStyles,\n container: ContainerStyles,\n spinner: SpinnerStyles,\n },\n },\n globalCss: {\n html: {\n fontSize: { base: \"112.5%\", md: \"120%\" },\n // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,\n // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)\n \"&:focus-within\": { scrollBehavior: \"smooth !important\" },\n },\n body: {\n ...globalHyphens,\n },\n // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus\n \"*:focus-visible\": focusStyle,\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defaultConfig, defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleObject> = {\n primary: {\n backgroundColor: colors.black,\n color: \"white\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 70%, 1)\",\n color: \"black\",\n },\n },\n secondary: {\n borderColor: \"currentColor\",\n },\n tertiary: {},\n // Inherit variants from Chakra's default config. Seems like they are overridden by our custom variants by default.\n ...defaultConfig.theme?.recipes?.button?.variants?.variant,\n};\n\nexport const ButtonStyles = defineRecipe({\n base: {\n borderColor: \"transparent\",\n borderWidth: \"0.1em\",\n fontWeight: 600,\n color: \"currentColor\",\n backgroundColor: \"transparent\",\n _hover: {\n backgroundColor: \"currentColor/7\",\n },\n _disabled: {\n backgroundColor: `${colors.grey45}`,\n color: \"white\",\n opacity: 1,\n },\n },\n variants: {\n variant: variants,\n size: {\n sm: {\n h: \"8\",\n px: \"2\",\n textStyle: \"md\",\n },\n md: {\n textStyle: \"md\",\n },\n lg: {\n h: \"12\",\n textStyle: \"lg\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const ContainerStyles = defineRecipe({\n base: {\n px: \".75rem\", // Padding left/right\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const HeadingStyles = defineRecipe({\n base: {\n fontWeight: \"600\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nconst variants: Record<string, SystemStyleObject> = {\n subtle: {\n backgroundColor: { _light: \"gray.200\", _dark: \"whiteAlpha.100\" },\n _hover: {\n bg: { _light: \"gray.300\", _dark: \"whiteAlpha.200\" },\n },\n },\n outline: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n flushed: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n};\n\nexport const InputStyles = defineRecipe({\n base: {\n _placeholder: {\n color: { _light: \"gray.500\", _dark: \"whiteAlpha.500\" },\n },\n },\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"subtle\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomLinkVariants = \"plain\" | \"underline\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleObject> = {\n plain: {\n color: \"currentColor\",\n textDecoration: \"none\",\n textDecorationColor: \"currentColor/30\",\n _hover: {\n textDecoration: \"underline\",\n },\n },\n underline: {\n color: \"currentColor\",\n textDecoration: \"underline\",\n textDecorationColor: \"currentColor/30\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n};\n\nexport const LinkStyles = defineRecipe({\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"underline\",\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe } from \"@chakra-ui/react\";\n\nexport const SpinnerStyles = defineRecipe({\n base: {\n animationDuration: \".8s\",\n color: colors.accentBlueMedium,\n // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color\n borderWidth: \".175em\",\n },\n});\n","const container = {\n sm: { value: \"40rem\" },\n md: { value: \"48rem\" },\n lg: { value: \"56rem\" }, // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: { value: \"80rem\" },\n};\n\nexport const sizes = {\n container,\n};\n","import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { Alert } from \"./Alert\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundary extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <Alert status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </Alert>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n","import { Box } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { focusStyle } from \"../styles/chakraTheme/biblioteksentralenChakraTheme\";\n\ninterface Props {\n id: string;\n /**\n * angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'\n */\n spaceAbove?: string;\n /**\n * angir om du vil ha fokusramme rundt komponenten som mounter HashLinkTarget. Da må komponenten du wrapper med ha position: relative | absolute el\n */\n focusOnParent?: boolean;\n}\n\nconst focusOnRelativeParentStyle = {\n _focusWithin: {\n position: \"static\",\n boxShadow: \"none\",\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n width: \"100%\",\n pointerEvents: \"none\",\n borderRadius: \"0.25rem\",\n ...focusStyle,\n },\n },\n};\n\n/*\n * 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>)\n */\nexport function HashLinkTarget(props: Props) {\n return (\n <Box position=\"relative\" css={props.focusOnParent ? focusOnRelativeParentStyle : undefined}>\n <Box\n id={props.id}\n tabIndex={props.focusOnParent ? -1 : undefined}\n position=\"absolute\"\n top={`-${props.spaceAbove || \"2.5rem\"}`}\n _focus={{\n boxShadow: \"none !important\",\n }}\n />\n </Box>\n );\n}\n","import React from \"react\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\n\nexport const withErrorBoundary = <Props,>(Component: React.ComponentType<Props>, boundaryName: string) => {\n return (props: Props & React.JSX.IntrinsicAttributes) => (\n <ErrorBoundary boundaryName={boundaryName}>\n <Component {...props} />\n </ErrorBoundary>\n );\n};\n","\"use client\";\n\nimport {\n Toaster as ChakraToaster,\n Portal,\n Spinner,\n Stack,\n Toast,\n ToastRootProps,\n createToaster,\n} from \"@chakra-ui/react\";\nimport React from \"react\";\n\nexport const toaster: ToastRootProps = createToaster({\n pauseOnPageIdle: true,\n offsets: { left: \"50%\", top: \"50%\", right: \"50%\", bottom: \"50%\" },\n});\n\nexport const Toaster = () => {\n return (\n <Portal>\n <ChakraToaster toaster={toaster} insetInline={{ mdDown: \"4\" }}>\n {(toast: ToastRootProps) => {\n if (typeof toast.render === \"function\") {\n return <>{toast.render()}</>;\n }\n return (\n <Toast.Root width={{ md: \"sm\" }}>\n {toast.type === \"loading\" ? <Spinner size=\"sm\" color=\"blue.solid\" /> : <Toast.Indicator />}\n <Stack gap=\"1\" flex=\"1\" maxWidth=\"100%\">\n {toast.title && <Toast.Title>{toast.title}</Toast.Title>}\n {toast.description && <Toast.Description>{toast.description}</Toast.Description>}\n </Stack>\n {toast.action && <Toast.ActionTrigger>{toast.action.label}</Toast.ActionTrigger>}\n {toast.closable && <Toast.CloseTrigger />}\n </Toast.Root>\n );\n }}\n </ChakraToaster>\n </Portal>\n );\n};\n"]}
package/dist/index.mjs CHANGED
@@ -78,13 +78,16 @@ function Alert({ status, children, variant, header, ...rest }) {
78
78
  ChakraAlert.Root,
79
79
  {
80
80
  status,
81
+ fontSize: "md",
81
82
  border: `0.1rem solid`,
82
83
  borderColor: colors2.color,
83
84
  backgroundColor: colors2.bg,
85
+ display: "flex",
86
+ flexWrap: "wrap",
84
87
  ...variant === "inline" ? variantStyles[variant] : {},
85
88
  ...rest
86
89
  },
87
- /* @__PURE__ */ React.createElement(ChakraAlert.Indicator, null, iconLookup[status]),
90
+ /* @__PURE__ */ React.createElement(ChakraAlert.Indicator, { marginX: "auto" }, iconLookup[status]),
88
91
  /* @__PURE__ */ React.createElement(ChakraAlert.Content, { color: "black" }, header && /* @__PURE__ */ React.createElement(ChakraAlert.Title, null, header), /* @__PURE__ */ React.createElement(ChakraAlert.Description, null, children))
89
92
  );
90
93
  }
@@ -93,6 +96,10 @@ function Alert({ status, children, variant, header, ...rest }) {
93
96
  import { Button as ChakraButton } from "@chakra-ui/react";
94
97
  var Button = ChakraButton;
95
98
 
99
+ // src/components/IconButton.tsx
100
+ import { IconButton as ChakraIconButton } from "@chakra-ui/react";
101
+ var IconButton = ChakraIconButton;
102
+
96
103
  // src/components/ConditionalWrapper.tsx
97
104
  import React2 from "react";
98
105
  var ConditionalWrapper = ({ condition, children, wrapper: Wrapper }) => condition ? /* @__PURE__ */ React2.createElement(Wrapper, null, children) : /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
@@ -153,10 +160,13 @@ var Link = ChakraLink;
153
160
 
154
161
  // src/BiblioteksentralenProvider.tsx
155
162
  import React6 from "react";
156
- import { ChakraProvider } from "@chakra-ui/react";
163
+ import { ChakraProvider, createSystem, defaultConfig as defaultConfig2 } from "@chakra-ui/react";
164
+
165
+ // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
166
+ import { defineConfig, defineTokens } from "@chakra-ui/react";
157
167
 
158
168
  // src/styles/chakraTheme/ButtonStyles.ts
159
- import { defineRecipe } from "@chakra-ui/react";
169
+ import { defaultConfig, defineRecipe } from "@chakra-ui/react";
160
170
  var variants = {
161
171
  primary: {
162
172
  backgroundColor: colors.black,
@@ -167,46 +177,48 @@ var variants = {
167
177
  }
168
178
  },
169
179
  secondary: {
170
- borderColor: "currentColor !important",
171
- backgroundColor: "transparent",
172
- color: "currentColor",
173
- _hover: {
174
- backgroundColor: "hsla(0deg, 0%, 50%, 0.15)"
175
- }
180
+ borderColor: "currentColor"
176
181
  },
177
- tertiary: {
178
- backgroundColor: "transparent",
179
- color: "currentColor",
180
- _hover: {
181
- backgroundColor: "hsla(0deg, 0%, 50%, 0.15)",
182
- color: "currentColor"
183
- }
184
- }
182
+ tertiary: {},
183
+ // Inherit variants from Chakra's default config. Seems like they are overridden by our custom variants by default.
184
+ ...defaultConfig.theme?.recipes?.button?.variants?.variant
185
185
  };
186
186
  var ButtonStyles = defineRecipe({
187
187
  base: {
188
- border: "transparent 0.1em solid",
189
- borderRadius: "0.35em",
188
+ borderColor: "transparent",
189
+ borderWidth: "0.1em",
190
190
  fontWeight: 600,
191
+ color: "currentColor",
192
+ backgroundColor: "transparent",
193
+ _hover: {
194
+ backgroundColor: "currentColor/7"
195
+ },
191
196
  _disabled: {
192
- backgroundColor: `${colors.grey45} !important`,
193
- color: "white !important",
197
+ backgroundColor: `${colors.grey45}`,
198
+ color: "white",
194
199
  opacity: 1
195
200
  }
196
201
  },
197
202
  variants: {
198
- variant: {
199
- ...variants
200
- },
201
- sizes: {
203
+ variant: variants,
204
+ size: {
202
205
  sm: {
203
- padding: "0.2em 0.5em",
204
- fontSize: "1rem"
206
+ h: "8",
207
+ px: "2",
208
+ textStyle: "md"
209
+ },
210
+ md: {
211
+ textStyle: "md"
212
+ },
213
+ lg: {
214
+ h: "12",
215
+ textStyle: "lg"
205
216
  }
206
217
  }
207
218
  },
208
219
  defaultVariants: {
209
- variant: "primary"
220
+ variant: "primary",
221
+ size: "md"
210
222
  }
211
223
  });
212
224
 
@@ -256,7 +268,7 @@ var InputStyles = defineRecipe4({
256
268
  }
257
269
  },
258
270
  variants: {
259
- variant: { ...variants2 }
271
+ variant: variants2
260
272
  },
261
273
  defaultVariants: {
262
274
  variant: "subtle"
@@ -267,13 +279,17 @@ var InputStyles = defineRecipe4({
267
279
  import { defineRecipe as defineRecipe5 } from "@chakra-ui/react";
268
280
  var variants3 = {
269
281
  plain: {
282
+ color: "currentColor",
270
283
  textDecoration: "none",
284
+ textDecorationColor: "currentColor/30",
271
285
  _hover: {
272
286
  textDecoration: "underline"
273
287
  }
274
288
  },
275
289
  underline: {
290
+ color: "currentColor",
276
291
  textDecoration: "underline",
292
+ textDecorationColor: "currentColor/30",
277
293
  _hover: {
278
294
  textDecoration: "none"
279
295
  }
@@ -281,7 +297,7 @@ var variants3 = {
281
297
  };
282
298
  var LinkStyles = defineRecipe5({
283
299
  variants: {
284
- variant: { ...variants3 }
300
+ variant: variants3
285
301
  },
286
302
  defaultVariants: {
287
303
  variant: "underline"
@@ -312,12 +328,22 @@ var sizes = {
312
328
  };
313
329
 
314
330
  // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
315
- import { createSystem, defaultConfig } from "@chakra-ui/react";
316
- var biblioteksentralenChakraTheme = createSystem(defaultConfig, {
331
+ var tokens = defineTokens({
332
+ sizes
333
+ });
334
+ var globalHyphens = {
335
+ hyphens: "auto",
336
+ hyphenateLimitChars: "8 5 3"
337
+ // minimum word-length / min letters first line / min letters second line
338
+ };
339
+ var focusStyle = {
340
+ outline: "none !important",
341
+ boxShadow: `0 0 0 .1rem white, 0 0 0 .2rem black, 0 0 0 .3rem white !important`,
342
+ transition: "box-shadow 0.1s ease-out"
343
+ };
344
+ var biblioteksentralenChakraTheme = defineConfig({
317
345
  theme: {
318
- tokens: {
319
- sizes
320
- },
346
+ tokens,
321
347
  recipes: {
322
348
  heading: HeadingStyles,
323
349
  button: ButtonStyles,
@@ -333,13 +359,18 @@ var biblioteksentralenChakraTheme = createSystem(defaultConfig, {
333
359
  // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
334
360
  // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
335
361
  "&:focus-within": { scrollBehavior: "smooth !important" }
336
- }
362
+ },
363
+ body: {
364
+ ...globalHyphens
365
+ },
366
+ // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus
367
+ "*:focus-visible": focusStyle
337
368
  }
338
369
  });
339
370
 
340
371
  // src/BiblioteksentralenProvider.tsx
341
372
  import { ColorModeProvider } from "@chakra-ui/system";
342
- var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, { value: biblioteksentralenChakraTheme }, /* @__PURE__ */ React6.createElement(ColorModeProvider, { ...props }));
373
+ var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, { value: createSystem(defaultConfig2, biblioteksentralenChakraTheme, props.customTheme || {}) }, /* @__PURE__ */ React6.createElement(ColorModeProvider, { ...props }));
343
374
 
344
375
  // src/components/ErrorBoundary.tsx
345
376
  import { Box as Box2 } from "@chakra-ui/react";
@@ -384,7 +415,7 @@ var focusOnRelativeParentStyle = {
384
415
  width: "100%",
385
416
  pointerEvents: "none",
386
417
  borderRadius: "0.25rem",
387
- boxShadow: "var(--chakra-shadows-outline)"
418
+ ...focusStyle
388
419
  }
389
420
  }
390
421
  };
@@ -408,6 +439,29 @@ import React9 from "react";
408
439
  var withErrorBoundary = (Component, boundaryName) => {
409
440
  return (props) => /* @__PURE__ */ React9.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React9.createElement(Component, { ...props }));
410
441
  };
442
+
443
+ // src/components/ui/toaster.tsx
444
+ import {
445
+ Toaster as ChakraToaster,
446
+ Portal,
447
+ Spinner,
448
+ Stack,
449
+ Toast,
450
+ createToaster
451
+ } from "@chakra-ui/react";
452
+ import React10 from "react";
453
+ var toaster = createToaster({
454
+ pauseOnPageIdle: true,
455
+ offsets: { left: "50%", top: "50%", right: "50%", bottom: "50%" }
456
+ });
457
+ var Toaster = () => {
458
+ return /* @__PURE__ */ React10.createElement(Portal, null, /* @__PURE__ */ React10.createElement(ChakraToaster, { toaster, insetInline: { mdDown: "4" } }, (toast) => {
459
+ if (typeof toast.render === "function") {
460
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, toast.render());
461
+ }
462
+ return /* @__PURE__ */ React10.createElement(Toast.Root, { width: { md: "sm" } }, toast.type === "loading" ? /* @__PURE__ */ React10.createElement(Spinner, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ React10.createElement(Toast.Indicator, null), /* @__PURE__ */ React10.createElement(Stack, { gap: "1", flex: "1", maxWidth: "100%" }, toast.title && /* @__PURE__ */ React10.createElement(Toast.Title, null, toast.title), toast.description && /* @__PURE__ */ React10.createElement(Toast.Description, null, toast.description)), toast.action && /* @__PURE__ */ React10.createElement(Toast.ActionTrigger, null, toast.action.label), toast.closable && /* @__PURE__ */ React10.createElement(Toast.CloseTrigger, null));
463
+ }));
464
+ };
411
465
  export {
412
466
  Alert,
413
467
  BiblioteksentralenProvider,
@@ -416,11 +470,13 @@ export {
416
470
  ErrorBoundary,
417
471
  HashLinkTarget,
418
472
  HideWithCSS,
473
+ IconButton,
419
474
  Input,
420
475
  Link,
476
+ Toaster,
421
477
  VisuallyHidden,
422
- biblioteksentralenChakraTheme,
423
478
  colors,
479
+ toaster,
424
480
  withErrorBoundary
425
481
  };
426
482
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../../utils/src/colors.ts","../../utils/src/date.ts","../../utils/src/environment.ts","../../utils/src/random.ts","../../utils/src/slugifyString.ts","../../utils/src/sort/common.ts","../../utils/src/sort/sortAlphabetical.ts","../../utils/src/sort/sortArrayInGroups.ts","../../utils/src/sort/sortByMultiple.ts","../src/components/Alert.tsx","../src/components/Button.tsx","../src/components/ConditionalWrapper.tsx","../src/components/HideWithCSS.tsx","../src/components/Input.tsx","../src/components/VisuallyHidden.tsx","../src/components/Link.tsx","../src/BiblioteksentralenProvider.tsx","../src/styles/chakraTheme/ButtonStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/LinkStyles.ts","../src/styles/chakraTheme/SpinnerStyles.ts","../src/styles/chakraTheme/sizes.ts","../src/styles/chakraTheme/biblioteksentralenChakraTheme.ts","../src/components/ErrorBoundary.tsx","../src/components/HashLinkTarget.tsx","../src/components/withErrorBoundary.tsx"],"sourcesContent":["export * from \"@chakra-ui/react\"; // Exports Chakra components first to override some components later\nexport { Alert } from \"./components/Alert\"; // Overrides Chakras Alert\nexport { Button } from \"./components/Button\"; // Overrides Chakras Button\nexport { ConditionalWrapper } from \"./components/ConditionalWrapper\"; // Overrides Chakras Input\nexport { HideWithCSS } from \"./components/HideWithCSS\"; // Overrides Chakras HideWithCSS\nexport { Input } from \"./components/Input\"; // Overrides Chakras Input\nexport { Link } from \"./components/Link\"; // Overrides Chakras Link\nexport { VisuallyHidden } from \"./components/VisuallyHidden\"; // Overrides Chakras VisuallyHidden\n\nexport { BiblioteksentralenProvider } from \"./BiblioteksentralenProvider\";\nexport { ErrorBoundary } from \"./components/ErrorBoundary\";\nexport { HashLinkTarget } from \"./components/HashLinkTarget\";\nexport { withErrorBoundary } from \"./components/withErrorBoundary\";\n\nexport { colors } from \"@biblioteksentralen/utils\"; // Re-export colors for convenience\nexport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\n","export const colors = {\n black: \"#000000\",\n grey90: \"#181818\",\n grey80: \"#333333\",\n grey60: \"#585858\",\n grey45: \"#8c8c8c\",\n grey30: \"#b2b2b2\",\n grey15: \"#d9d9d9\",\n grey10: \"#e5e5e5\",\n grey05: \"#f2f2f2\",\n white: \"#ffffff\",\n bsRødDark: \"#870010\",\n bsRødMedium: \"#d53d40\",\n accentPurple: \"#331433\",\n accentPeach: \"#ffba99\",\n accentGreen: \"#003b29\",\n accentBlueDark: \"#001740\",\n accentBlueMedium: \"#5996de\",\n accentYellow: \"#ffc970\",\n lightBlue: \"#dbe8ef\",\n lightGreen: \"#dbe0db\",\n lightPeach: \"#f4e7de\",\n lightPurple: \"#ece8f3\",\n statusRed: \"#ad313c\",\n statusYellow: \"#bc5600\",\n statusGreen: \"#24845b\",\n statusGreenLight: \"#edf4f1\",\n statusRedLight: \"#f8efef\",\n statusYellowLight: \"#fff6e4\",\n neptune: {\n \"100\": \"#CFE6E8\",\n \"200\": \"#9FCDD2\",\n \"300\": \"#6FB5BB\",\n \"400\": \"#3F9CA5\",\n \"500\": \"#0F838E\",\n \"600\": \"#0C6972\",\n \"700\": \"#094F55\",\n \"800\": \"#063439\",\n \"900\": \"#031A1C\",\n },\n};\n","import { format } from \"date-fns/format\";\nimport { nb } from \"date-fns/locale/nb\";\n\nexport function formaterDato(dato?: string, dateFnsformat = \"Pp\") {\n if (typeof dato !== \"string\") return \"Ukjent dato\";\n\n try {\n return format(new Date(dato), dateFnsformat, { locale: nb });\n } catch (e) {\n console.error(\"Kunne ikke formattere dato:\" + dato, e);\n return dato;\n }\n}\n","export function isDevelopment(): boolean {\n return process.env.NODE_ENV === \"development\";\n}\n\nexport function isClient(): boolean {\n return typeof window !== \"undefined\";\n}\n\nexport function isServer(): boolean {\n return !isClient();\n}\n","export function randomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)];\n}\n\nexport function seededRandomFromArray<T>(array: T[], seed: string): T {\n return array[Math.floor(seededRandom(seed) * array.length)];\n}\n\n// Returns a pseudo-random floating-point number in the range [0.0 -> 1.0] from a string seed\n// TODO, ser ikke ut til å gi helt jevn fordeling mellom 0 og 1, trenger kanskje litt kjærlighet\nexport function seededRandom(seed: string) {\n // Oversetter ikke-numeriske tegn til tall så de kan brukes som seed\n const numericSeed = Number(seed.replace(/\\D/g, (match) => `${match.charCodeAt(0)}`));\n const x = Math.sin(numericSeed) * 3333;\n return x - Math.floor(x);\n}\n","export const slugifyString = (value = \"\") =>\n value\n .trim()\n .toLowerCase()\n // Bytter ut typisk norske bokstaver æøå\n .replace(/æ/g, \"ae\")\n .replace(/å/g, \"a\")\n .replace(/ø/g, \"o\")\n // Bytter alle tegn som ikke er et regex-word med '-'\n .replace(/\\W/g, \"-\")\n // Bytter ut flere streker med enkelt strek \"----\" => \"-\"\n .replace(/-+/g, \"-\")\n .slice(0, 30);\n","export type GetSortIndex<T> = (element: T) => number | string;\n\nconst compareAlphabetically = (left: string, right: string) => left.localeCompare(right, [\"no-NO\"]);\n\nexport const compare = <T>(left: T, right: T, indexFunction?: GetSortIndex<T>) => {\n const leftIndex = indexFunction ? indexFunction(left) : left;\n const rightIndex = indexFunction ? indexFunction(right) : right;\n\n if (typeof leftIndex == \"number\" && typeof rightIndex == \"number\") return leftIndex - rightIndex;\n\n if (typeof leftIndex == \"string\" && typeof rightIndex == \"string\") {\n return compareAlphabetically(leftIndex, rightIndex);\n }\n\n throw new Error(\"Sort index function gives inconsistent index types\");\n};\n","import { GetSortIndex, compare } from \"./common\";\n\n/**\n * Alphabetical sorting restricted to Norwegian locale, for consistent sorting on server and client\n * (radash's `alphabetical()` is inconsistent between these two)\n */\nexport const sortAlphabetical = <T>(array: T[], indexFunction?: GetSortIndex<T>): T[] =>\n array.slice().sort((left, right) => compare(left, right, indexFunction));\n","export interface Group<T> {\n label: string;\n items: T[];\n}\n\nexport interface GroupedArray<T> extends Array<Group<T>> {}\n\n/* Tar et array og putter ting i grupper basert på gruppekategorier\n *\n * Feks\n *\n * const myArray = ['Apple', 'Aubergine', 'Lemon'];\n *\n * const inGroups = groupArray(myArray, item => item[0]);\n *\n * console.log(inGroups);\n *\n * // [{groupLabel: 'A', groupItems: ['Apple', 'Aubergine']}, {groupLabel: 'L', groupItems: ['Lemon']}]\n *\n * */\nexport function sortArrayInGroups<T>(\n items: T[],\n getGroupLabel: (element: T) => string,\n options?: { sortAlphabetically?: boolean }\n): GroupedArray<T> {\n const groups = items.reduce((acc: GroupedArray<T>, arrayEntry) => {\n const currentCategory = getGroupLabel(arrayEntry);\n const categoryIndex = acc.findIndex((group) => group.label === currentCategory);\n if (categoryIndex >= 0) {\n acc[categoryIndex].items.push(arrayEntry);\n } else {\n acc.push({\n label: currentCategory,\n items: [arrayEntry],\n });\n }\n return acc;\n }, []);\n\n return options?.sortAlphabetically ? groups.sort(sortByLabel) : groups;\n}\n\nfunction sortByLabel<T>(a: Group<T>, b: Group<T>) {\n if (a.label.toLowerCase() > b.label.toLowerCase()) return 1;\n if (a.label.toLowerCase() < b.label.toLowerCase()) return -1;\n return 0;\n}\n","import { AtLeastOne } from \"@biblioteksentralen/types\";\nimport { GetSortIndex, compare } from \"./common\";\n\n/**\n * Corresponds to lodash's sortBy called with several comparison functions (no equivalent in radash)\n */\nexport const sortByMultiple = <T>(array: T[], ...indexFunctions: AtLeastOne<GetSortIndex<T>>): T[] =>\n array.slice().sort((left, right) =>\n indexFunctions.slice(1).reduce(\n // If the previous comparison is 0, it means left and right are equal according to the previous\n // comparison function. That's also the only way it'll be falsy, therefore we can\n // use the or operator || to then apply the next comparison function.\n (previous, indexFunction) => previous || compare(left, right, indexFunction),\n compare(left, right, indexFunctions[0]) // Initial comparison\n )\n );\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { colors } from \"@biblioteksentralen/utils\";\nimport { AlertRootProps, Alert as ChakraAlert, SystemStyleObject } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = \"info\" | \"warning\" | \"success\" | \"error\";\ntype CustomVariants = \"inline\";\ntype Variants = AlertRootProps[\"variant\"] | CustomVariants;\n\nconst colorLookup: Record<Status, { bg: string; color: string }> = {\n info: { bg: colors.lightBlue, color: colors.accentBlueMedium },\n warning: { bg: colors.statusYellowLight, color: colors.statusYellow },\n success: { bg: colors.statusGreenLight, color: colors.statusGreen },\n error: { bg: colors.statusRedLight, color: colors.statusRed },\n};\n\nconst iconLookup: Record<Status, React.ReactElement> = {\n info: <Info strokeWidth={1.75} role=\"img\" aria-label=\"Informasjon\" />,\n warning: <AlertCircle strokeWidth={1.75} role=\"img\" aria-label=\"Advarsel\" />,\n success: <CheckCircle strokeWidth={1.75} role=\"img\" aria-label=\"Suksess\" />,\n error: <XCircle strokeWidth={1.75} role=\"img\" aria-label=\"Feil\" />,\n};\n\ninterface Props extends Modify<AlertRootProps, { variant?: Variants }> {\n children: ReactNode;\n header?: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<CustomVariants, SystemStyleObject> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function Alert({ status, children, variant, header, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <ChakraAlert.Root\n status={status}\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n {...(variant === \"inline\" ? variantStyles[variant] : {})}\n {...rest}\n >\n <ChakraAlert.Indicator>{iconLookup[status]}</ChakraAlert.Indicator>\n <ChakraAlert.Content color=\"black\">\n {header && <ChakraAlert.Title>{header}</ChakraAlert.Title>}\n <ChakraAlert.Description>{children}</ChakraAlert.Description>\n </ChakraAlert.Content>\n </ChakraAlert.Root>\n );\n}\n","import React from \"react\";\nimport { Button as ChakraButton, ButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { Modify } from \"@biblioteksentralen/types\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras Button with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype ButtonVariants = ButtonProps[\"variant\"] | CustomButtonVariants;\nexport const Button = ChakraButton as ComponentWithAs<\"button\", Modify<ButtonProps, { variant?: ButtonVariants }>>;\n","import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapper: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n","import { Box, BoxProps } from \"@chakra-ui/react\";\nimport { ThemeTypings } from \"@chakra-ui/system\";\nimport React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n above?: ThemeTypings[\"breakpoints\"];\n below?: ThemeTypings[\"breakpoints\"];\n} & Omit<BoxProps, \"display\">;\n\n/** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */\nexport const HideWithCSS: FunctionComponent<Props> = ({ children, above, below, ...chakraProps }) => {\n const display: BoxProps[\"display\"] = {\n ...(!!below ? { base: \"none\", [below]: \"block\" } : {}),\n ...(!!above ? { [above]: \"none\" } : {}),\n };\n\n return (\n <Box {...chakraProps} display={display}>\n {children}\n </Box>\n );\n};\n","import { Field, Input as ChakraInput, InputProps, FieldLabelProps } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FieldLabelProps;\n helperText?: string;\n errorMessage?: string;\n}\n\n/**\n * Creating custom input-component to make sure label is always set (for accessibility)\n * 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\n */\nexport const Input = (props: Props) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <Field.Label {...labelProps}>{label}</Field.Label>;\n\n return (\n <Field.Root invalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && <Field.HelperText>{helperText}</Field.HelperText>}\n <ChakraInput {...inputProps} />\n {errorMessage && <Field.ErrorText>{errorMessage}</Field.ErrorText>}\n </Field.Root>\n );\n};\n","import React, { HTMLAttributes, ReactNode, useEffect } from \"react\";\nimport { VisuallyHidden as ChakraVisuallyHidden } from \"@chakra-ui/react\";\nimport { isDevelopment } from \"@biblioteksentralen/utils\";\n\ninterface Props extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode;\n}\n\n// https://www.joshwcomeau.com/snippets/react-components/visually-hidden/\nexport function VisuallyHidden({ children, ...rest }: Props) {\n const [forceShow, setForceShow] = React.useState(false);\n\n useEffect(() => {\n if (isDevelopment()) {\n const handleKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(true);\n }\n };\n const handleKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(false);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n window.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n window.removeEventListener(\"keyup\", handleKeyUp);\n };\n }\n }, []);\n\n // position=\"fixed\" løser bug der visually hidden ikke hindret tekst fra å ta plass i bredden\n return forceShow ? <span>{children}</span> : <ChakraVisuallyHidden position=\"fixed\">{children}</ChakraVisuallyHidden>;\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Link as ChakraLink, LinkProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomLinkVariants } from \"../styles/chakraTheme/LinkStyles\";\n\n/**\n * Re-exporting chackras Link with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype LinkVariants = LinkProps[\"variant\"] | CustomLinkVariants;\nexport const Link = ChakraLink as ComponentWithAs<\"a\", Modify<LinkProps, { variant?: LinkVariants }>>;\n","import React, { ReactNode } from \"react\";\nimport { ChakraProvider } from \"@chakra-ui/react\";\nimport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\nimport { ColorModeProvider } from \"@chakra-ui/system\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport const BiblioteksentralenProvider = (props: Props) => (\n <ChakraProvider value={biblioteksentralenChakraTheme}>\n <ColorModeProvider {...props} />\n </ChakraProvider>\n);\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleObject> = {\n primary: {\n backgroundColor: colors.black,\n color: \"white\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 70%, 1)\",\n color: \"black\",\n },\n },\n secondary: {\n borderColor: \"currentColor !important\",\n backgroundColor: \"transparent\",\n color: \"currentColor\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 50%, 0.15)\",\n },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: \"currentColor\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 50%, 0.15)\",\n color: \"currentColor\",\n },\n },\n};\n\nexport const ButtonStyles = defineRecipe({\n base: {\n border: \"transparent 0.1em solid\",\n borderRadius: \"0.35em\",\n fontWeight: 600,\n _disabled: {\n backgroundColor: `${colors.grey45} !important`,\n color: \"white !important\",\n opacity: 1,\n },\n },\n variants: {\n variant: {\n ...variants,\n },\n sizes: {\n sm: {\n padding: \"0.2em 0.5em\",\n fontSize: \"1rem\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const ContainerStyles = defineRecipe({\n base: {\n px: \".75rem\", // Padding left/right\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const HeadingStyles = defineRecipe({\n base: {\n fontWeight: \"600\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nconst variants: Record<string, SystemStyleObject> = {\n subtle: {\n backgroundColor: { _light: \"gray.200\", _dark: \"whiteAlpha.100\" },\n _hover: {\n bg: { _light: \"gray.300\", _dark: \"whiteAlpha.200\" },\n },\n },\n outline: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n flushed: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n};\n\nexport const InputStyles = defineRecipe({\n base: {\n _placeholder: {\n color: { _light: \"gray.500\", _dark: \"whiteAlpha.500\" },\n },\n },\n variants: {\n variant: { ...variants },\n },\n defaultVariants: {\n variant: \"subtle\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomLinkVariants = \"plain\" | \"underline\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleObject> = {\n plain: {\n textDecoration: \"none\",\n _hover: {\n textDecoration: \"underline\",\n },\n },\n underline: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n};\n\nexport const LinkStyles = defineRecipe({\n variants: {\n variant: { ...variants },\n },\n defaultVariants: {\n variant: \"underline\",\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe } from \"@chakra-ui/react\";\n\nexport const SpinnerStyles = defineRecipe({\n base: {\n animationDuration: \".8s\",\n color: colors.accentBlueMedium,\n // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color\n borderWidth: \".175em\",\n },\n});\n","const container = {\n sm: { value: \"40rem\" },\n md: { value: \"48rem\" },\n lg: { value: \"56rem\" }, // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: { value: \"80rem\" },\n};\n\nexport const sizes = {\n container,\n};\n","import { ButtonStyles } from \"./ButtonStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\nimport { createSystem, defaultConfig } from \"@chakra-ui/react\";\n\nexport const biblioteksentralenChakraTheme = createSystem(defaultConfig, {\n theme: {\n tokens: {\n sizes,\n },\n recipes: {\n heading: HeadingStyles,\n button: ButtonStyles,\n input: InputStyles,\n link: LinkStyles,\n container: ContainerStyles,\n spinner: SpinnerStyles,\n },\n },\n globalCss: {\n html: {\n fontSize: { base: \"112.5%\", md: \"120%\" },\n // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,\n // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)\n \"&:focus-within\": { scrollBehavior: \"smooth !important\" },\n },\n },\n});\n","import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { Alert } from \"./Alert\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundary extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <Alert status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </Alert>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n","import { Box } from \"@chakra-ui/react\";\nimport React from \"react\";\n\ninterface Props {\n id: string;\n /**\n * angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'\n */\n spaceAbove?: string;\n /**\n * angir om du vil ha fokusramme rundt komponenten som mounter HashLinkTarget. Da må komponenten du wrapper med ha position: relative | absolute el\n */\n focusOnParent?: boolean;\n}\n\nconst focusOnRelativeParentStyle = {\n _focusWithin: {\n position: \"static\",\n boxShadow: \"none\",\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n width: \"100%\",\n pointerEvents: \"none\",\n borderRadius: \"0.25rem\",\n boxShadow: \"var(--chakra-shadows-outline)\",\n },\n },\n};\n\n/*\n * 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>)\n */\nexport function HashLinkTarget(props: Props) {\n return (\n <Box position=\"relative\" css={props.focusOnParent ? focusOnRelativeParentStyle : undefined}>\n <Box\n id={props.id}\n tabIndex={props.focusOnParent ? -1 : undefined}\n position=\"absolute\"\n top={`-${props.spaceAbove || \"2.5rem\"}`}\n _focus={{\n boxShadow: \"none !important\",\n }}\n />\n </Box>\n );\n}\n","import React from \"react\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\n\nexport const withErrorBoundary = <Props,>(Component: React.ComponentType<Props>, boundaryName: string) => {\n return (props: Props & React.JSX.IntrinsicAttributes) => (\n <ErrorBoundary boundaryName={boundaryName}>\n <Component {...props} />\n </ErrorBoundary>\n );\n};\n"],"mappings":";AAAA,cAAc;;;AEAd,SAAS,cAAc;AACvB,SAAS,UAAU;ADDZ,IAAM,SAAS;EACpB,OAAO;EACP,QAA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,MAAM;AAAA,MACV,UAAU,MAAM,gBAAgB,KAAK;AAAA,MACrC,UAAS;AAAA,MACT,KAAK,IAAI,MAAM,cAAc,QAAQ;AAAA,MACrC,QAAQ;AAAA,QACN,WAAW;AAAA,MACb;AAAA;AAAA,EACF,CACF;AAEJ;;;AClDA,OAAOE,YAAW;AAGX,IAAM,oBAAoB,CAAS,WAAuC,iBAAyB;AACxG,SAAO,CAAC,UACN,gBAAAC,OAAA,cAAC,iBAAc,gBACb,gBAAAA,OAAA,cAAC,aAAW,GAAG,OAAO,CACxB;AAEJ;","names":["colors","React","React","React","React","React","React","React","defineRecipe","defineRecipe","defineRecipe","variants","defineRecipe","variants","defineRecipe","React","Box","React","React","Box","Box","React","React","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../../utils/src/colors.ts","../../utils/src/date.ts","../../utils/src/environment.ts","../../utils/src/random.ts","../../utils/src/slugifyString.ts","../../utils/src/sort/common.ts","../../utils/src/sort/sortAlphabetical.ts","../../utils/src/sort/sortArrayInGroups.ts","../../utils/src/sort/sortByMultiple.ts","../src/components/Alert.tsx","../src/components/Button.tsx","../src/components/IconButton.tsx","../src/components/ConditionalWrapper.tsx","../src/components/HideWithCSS.tsx","../src/components/Input.tsx","../src/components/VisuallyHidden.tsx","../src/components/Link.tsx","../src/BiblioteksentralenProvider.tsx","../src/styles/chakraTheme/biblioteksentralenChakraTheme.ts","../src/styles/chakraTheme/ButtonStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/LinkStyles.ts","../src/styles/chakraTheme/SpinnerStyles.ts","../src/styles/chakraTheme/sizes.ts","../src/components/ErrorBoundary.tsx","../src/components/HashLinkTarget.tsx","../src/components/withErrorBoundary.tsx","../src/components/ui/toaster.tsx"],"sourcesContent":["export * from \"@chakra-ui/react\"; // Exports Chakra components first to override some components later\nexport type { StyleProps, ResponsiveObject } from \"@chakra-ui/system\"; // Exports Chakra system types\nexport { Alert } from \"./components/Alert\"; // Overrides Chakras Alert\nexport { Button, type ButtonProps } from \"./components/Button\"; // Overrides Chakras Button\nexport { IconButton, type IconButtonProps } from \"./components/IconButton\"; // Overrides Chakras IconButton\nexport { ConditionalWrapper } from \"./components/ConditionalWrapper\"; // Overrides Chakras Input\nexport { HideWithCSS } from \"./components/HideWithCSS\"; // Overrides Chakras HideWithCSS\nexport { Input } from \"./components/Input\"; // Overrides Chakras Input\nexport { Link } from \"./components/Link\"; // Overrides Chakras Link\nexport { VisuallyHidden } from \"./components/VisuallyHidden\"; // Overrides Chakras VisuallyHidden\n\nexport { BiblioteksentralenProvider } from \"./BiblioteksentralenProvider\";\nexport { ErrorBoundary } from \"./components/ErrorBoundary\";\nexport { HashLinkTarget } from \"./components/HashLinkTarget\";\nexport { withErrorBoundary } from \"./components/withErrorBoundary\";\n\nexport { colors } from \"@biblioteksentralen/utils\"; // Re-export colors for convenience\n\n// Generated from cli: npmx @chakra-ui/cli snippet add\nexport { Toaster, toaster } from \"./components/ui/toaster\"; // Exports the Toaster component\n","export const colors = {\n black: \"#000000\",\n grey90: \"#181818\",\n grey80: \"#333333\",\n grey60: \"#585858\",\n grey45: \"#8c8c8c\",\n grey30: \"#b2b2b2\",\n grey15: \"#d9d9d9\",\n grey10: \"#e5e5e5\",\n grey05: \"#f2f2f2\",\n white: \"#ffffff\",\n bsRødDark: \"#870010\",\n bsRødMedium: \"#d53d40\",\n accentPurple: \"#331433\",\n accentPeach: \"#ffba99\",\n accentGreen: \"#003b29\",\n accentBlueDark: \"#001740\",\n accentBlueMedium: \"#5996de\",\n accentYellow: \"#ffc970\",\n lightBlue: \"#dbe8ef\",\n lightGreen: \"#dbe0db\",\n lightPeach: \"#f4e7de\",\n lightPurple: \"#ece8f3\",\n statusRed: \"#ad313c\",\n statusYellow: \"#bc5600\",\n statusGreen: \"#24845b\",\n statusGreenLight: \"#edf4f1\",\n statusRedLight: \"#f8efef\",\n statusYellowLight: \"#fff6e4\",\n neptune: {\n \"100\": \"#CFE6E8\",\n \"200\": \"#9FCDD2\",\n \"300\": \"#6FB5BB\",\n \"400\": \"#3F9CA5\",\n \"500\": \"#0F838E\",\n \"600\": \"#0C6972\",\n \"700\": \"#094F55\",\n \"800\": \"#063439\",\n \"900\": \"#031A1C\",\n },\n};\n","import { format } from \"date-fns/format\";\nimport { nb } from \"date-fns/locale/nb\";\n\nexport function formaterDato(dato?: string, dateFnsformat = \"Pp\") {\n if (typeof dato !== \"string\") return \"Ukjent dato\";\n\n try {\n return format(new Date(dato), dateFnsformat, { locale: nb });\n } catch (e) {\n console.error(\"Kunne ikke formattere dato:\" + dato, e);\n return dato;\n }\n}\n","export function isDevelopment(): boolean {\n return process.env.NODE_ENV === \"development\";\n}\n\nexport function isClient(): boolean {\n return typeof window !== \"undefined\";\n}\n\nexport function isServer(): boolean {\n return !isClient();\n}\n","export function randomFromArray<T>(array: T[]): T {\n return array[Math.floor(Math.random() * array.length)];\n}\n\nexport function seededRandomFromArray<T>(array: T[], seed: string): T {\n return array[Math.floor(seededRandom(seed) * array.length)];\n}\n\n// Returns a pseudo-random floating-point number in the range [0.0 -> 1.0] from a string seed\n// TODO, ser ikke ut til å gi helt jevn fordeling mellom 0 og 1, trenger kanskje litt kjærlighet\nexport function seededRandom(seed: string) {\n // Oversetter ikke-numeriske tegn til tall så de kan brukes som seed\n const numericSeed = Number(seed.replace(/\\D/g, (match) => `${match.charCodeAt(0)}`));\n const x = Math.sin(numericSeed) * 3333;\n return x - Math.floor(x);\n}\n","export const slugifyString = (value = \"\") =>\n value\n .trim()\n .toLowerCase()\n // Bytter ut typisk norske bokstaver æøå\n .replace(/æ/g, \"ae\")\n .replace(/å/g, \"a\")\n .replace(/ø/g, \"o\")\n // Bytter alle tegn som ikke er et regex-word med '-'\n .replace(/\\W/g, \"-\")\n // Bytter ut flere streker med enkelt strek \"----\" => \"-\"\n .replace(/-+/g, \"-\")\n .slice(0, 30);\n","export type GetSortIndex<T> = (element: T) => number | string;\n\nconst compareAlphabetically = (left: string, right: string) => left.localeCompare(right, [\"no-NO\"]);\n\nexport const compare = <T>(left: T, right: T, indexFunction?: GetSortIndex<T>) => {\n const leftIndex = indexFunction ? indexFunction(left) : left;\n const rightIndex = indexFunction ? indexFunction(right) : right;\n\n if (typeof leftIndex == \"number\" && typeof rightIndex == \"number\") return leftIndex - rightIndex;\n\n if (typeof leftIndex == \"string\" && typeof rightIndex == \"string\") {\n return compareAlphabetically(leftIndex, rightIndex);\n }\n\n throw new Error(\"Sort index function gives inconsistent index types\");\n};\n","import { GetSortIndex, compare } from \"./common\";\n\n/**\n * Alphabetical sorting restricted to Norwegian locale, for consistent sorting on server and client\n * (radash's `alphabetical()` is inconsistent between these two)\n */\nexport const sortAlphabetical = <T>(array: T[], indexFunction?: GetSortIndex<T>): T[] =>\n array.slice().sort((left, right) => compare(left, right, indexFunction));\n","export interface Group<T> {\n label: string;\n items: T[];\n}\n\nexport interface GroupedArray<T> extends Array<Group<T>> {}\n\n/* Tar et array og putter ting i grupper basert på gruppekategorier\n *\n * Feks\n *\n * const myArray = ['Apple', 'Aubergine', 'Lemon'];\n *\n * const inGroups = groupArray(myArray, item => item[0]);\n *\n * console.log(inGroups);\n *\n * // [{groupLabel: 'A', groupItems: ['Apple', 'Aubergine']}, {groupLabel: 'L', groupItems: ['Lemon']}]\n *\n * */\nexport function sortArrayInGroups<T>(\n items: T[],\n getGroupLabel: (element: T) => string,\n options?: { sortAlphabetically?: boolean }\n): GroupedArray<T> {\n const groups = items.reduce((acc: GroupedArray<T>, arrayEntry) => {\n const currentCategory = getGroupLabel(arrayEntry);\n const categoryIndex = acc.findIndex((group) => group.label === currentCategory);\n if (categoryIndex >= 0) {\n acc[categoryIndex].items.push(arrayEntry);\n } else {\n acc.push({\n label: currentCategory,\n items: [arrayEntry],\n });\n }\n return acc;\n }, []);\n\n return options?.sortAlphabetically ? groups.sort(sortByLabel) : groups;\n}\n\nfunction sortByLabel<T>(a: Group<T>, b: Group<T>) {\n if (a.label.toLowerCase() > b.label.toLowerCase()) return 1;\n if (a.label.toLowerCase() < b.label.toLowerCase()) return -1;\n return 0;\n}\n","import { AtLeastOne } from \"@biblioteksentralen/types\";\nimport { GetSortIndex, compare } from \"./common\";\n\n/**\n * Corresponds to lodash's sortBy called with several comparison functions (no equivalent in radash)\n */\nexport const sortByMultiple = <T>(array: T[], ...indexFunctions: AtLeastOne<GetSortIndex<T>>): T[] =>\n array.slice().sort((left, right) =>\n indexFunctions.slice(1).reduce(\n // If the previous comparison is 0, it means left and right are equal according to the previous\n // comparison function. That's also the only way it'll be falsy, therefore we can\n // use the or operator || to then apply the next comparison function.\n (previous, indexFunction) => previous || compare(left, right, indexFunction),\n compare(left, right, indexFunctions[0]) // Initial comparison\n )\n );\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { colors } from \"@biblioteksentralen/utils\";\nimport { AlertRootProps, Alert as ChakraAlert, SystemStyleObject } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = \"info\" | \"warning\" | \"success\" | \"error\";\ntype CustomVariants = \"inline\";\ntype Variants = AlertRootProps[\"variant\"] | CustomVariants;\n\nconst colorLookup: Record<Status, { bg: string; color: string }> = {\n info: { bg: colors.lightBlue, color: colors.accentBlueMedium },\n warning: { bg: colors.statusYellowLight, color: colors.statusYellow },\n success: { bg: colors.statusGreenLight, color: colors.statusGreen },\n error: { bg: colors.statusRedLight, color: colors.statusRed },\n};\n\nconst iconLookup: Record<Status, React.ReactElement> = {\n info: <Info strokeWidth={1.75} role=\"img\" aria-label=\"Informasjon\" />,\n warning: <AlertCircle strokeWidth={1.75} role=\"img\" aria-label=\"Advarsel\" />,\n success: <CheckCircle strokeWidth={1.75} role=\"img\" aria-label=\"Suksess\" />,\n error: <XCircle strokeWidth={1.75} role=\"img\" aria-label=\"Feil\" />,\n};\n\ninterface Props extends Modify<AlertRootProps, { variant?: Variants }> {\n children: ReactNode;\n header?: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<CustomVariants, SystemStyleObject> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function Alert({ status, children, variant, header, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <ChakraAlert.Root\n status={status}\n fontSize=\"md\"\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n display=\"flex\"\n flexWrap=\"wrap\"\n {...(variant === \"inline\" ? variantStyles[variant] : {})}\n {...rest}\n >\n <ChakraAlert.Indicator marginX=\"auto\">{iconLookup[status]}</ChakraAlert.Indicator>\n <ChakraAlert.Content color=\"black\">\n {header && <ChakraAlert.Title>{header}</ChakraAlert.Title>}\n <ChakraAlert.Description>{children}</ChakraAlert.Description>\n </ChakraAlert.Content>\n </ChakraAlert.Root>\n );\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Button as ChakraButton, ButtonProps as NativeButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras Button with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype ButtonVariants = NativeButtonProps[\"variant\"] | CustomButtonVariants;\nexport type ButtonProps = Modify<NativeButtonProps, { variant?: ButtonVariants }>;\nexport const Button = ChakraButton as ComponentWithAs<\"button\", ButtonProps>;\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { IconButton as ChakraIconButton, IconButtonProps as ChakraIconButtonProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomButtonVariants } from \"../styles/chakraTheme/ButtonStyles\";\n\n/**\n * Re-exporting chackras IconButton with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype IconButtonVariants = ChakraIconButtonProps[\"variant\"] | CustomButtonVariants;\nexport type IconButtonProps = Modify<ChakraIconButtonProps, { variant?: IconButtonVariants }>;\nexport const IconButton = ChakraIconButton as ComponentWithAs<\"button\", IconButtonProps>;\n","import React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n wrapper: FunctionComponent<{ children: ReactNode }>;\n condition: boolean;\n};\n\n/**\n * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.\n */\nexport const ConditionalWrapper: FunctionComponent<Props> = ({ condition, children, wrapper: Wrapper }) =>\n condition ? <Wrapper>{children}</Wrapper> : <>{children}</>;\n","import { Box, BoxProps } from \"@chakra-ui/react\";\nimport { ThemeTypings } from \"@chakra-ui/system\";\nimport React, { FunctionComponent, ReactNode } from \"react\";\n\ntype Props = {\n children: ReactNode;\n above?: ThemeTypings[\"breakpoints\"];\n below?: ThemeTypings[\"breakpoints\"];\n} & Omit<BoxProps, \"display\">;\n\n/** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */\nexport const HideWithCSS: FunctionComponent<Props> = ({ children, above, below, ...chakraProps }) => {\n const display: BoxProps[\"display\"] = {\n ...(!!below ? { base: \"none\", [below]: \"block\" } : {}),\n ...(!!above ? { [above]: \"none\" } : {}),\n };\n\n return (\n <Box {...chakraProps} display={display}>\n {children}\n </Box>\n );\n};\n","import { Field, Input as ChakraInput, InputProps, FieldLabelProps } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FieldLabelProps;\n helperText?: string;\n errorMessage?: string;\n}\n\n/**\n * Creating custom input-component to make sure label is always set (for accessibility)\n * 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\n */\nexport const Input = (props: Props) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <Field.Label {...labelProps}>{label}</Field.Label>;\n\n return (\n <Field.Root invalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && <Field.HelperText>{helperText}</Field.HelperText>}\n <ChakraInput {...inputProps} />\n {errorMessage && <Field.ErrorText>{errorMessage}</Field.ErrorText>}\n </Field.Root>\n );\n};\n","import React, { HTMLAttributes, ReactNode, useEffect } from \"react\";\nimport { VisuallyHidden as ChakraVisuallyHidden } from \"@chakra-ui/react\";\nimport { isDevelopment } from \"@biblioteksentralen/utils\";\n\ninterface Props extends HTMLAttributes<HTMLSpanElement> {\n children: ReactNode;\n}\n\n// https://www.joshwcomeau.com/snippets/react-components/visually-hidden/\nexport function VisuallyHidden({ children, ...rest }: Props) {\n const [forceShow, setForceShow] = React.useState(false);\n\n useEffect(() => {\n if (isDevelopment()) {\n const handleKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(true);\n }\n };\n const handleKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === \"Alt\") {\n setForceShow(false);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n window.addEventListener(\"keyup\", handleKeyUp);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n window.removeEventListener(\"keyup\", handleKeyUp);\n };\n }\n }, []);\n\n // position=\"fixed\" løser bug der visually hidden ikke hindret tekst fra å ta plass i bredden\n return forceShow ? <span>{children}</span> : <ChakraVisuallyHidden position=\"fixed\">{children}</ChakraVisuallyHidden>;\n}\n","import { Modify } from \"@biblioteksentralen/types\";\nimport { Link as ChakraLink, LinkProps } from \"@chakra-ui/react\";\nimport { ComponentWithAs } from \"@chakra-ui/system\";\nimport { CustomLinkVariants } from \"../styles/chakraTheme/LinkStyles\";\n\n/**\n * Re-exporting chackras Link with a customised types\n * This causes both chakras native variants and our home-made variants to show up in auto-complete\n */\ntype LinkVariants = LinkProps[\"variant\"] | CustomLinkVariants;\nexport const Link = ChakraLink as ComponentWithAs<\"a\", Modify<LinkProps, { variant?: LinkVariants }>>;\n","import React, { ReactNode } from \"react\";\nimport { ChakraProvider, createSystem, defaultConfig, SystemConfig } from \"@chakra-ui/react\";\nimport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\nimport { ColorModeProvider } from \"@chakra-ui/system\";\n\ninterface Props {\n children: ReactNode;\n customTheme?: SystemConfig;\n}\n\nexport const BiblioteksentralenProvider = (props: Props) => (\n <ChakraProvider value={createSystem(defaultConfig, biblioteksentralenChakraTheme, props.customTheme || {})}>\n <ColorModeProvider {...props} />\n </ChakraProvider>\n);\n","import { defineConfig, defineTokens } from \"@chakra-ui/react\";\nimport { ButtonStyles } from \"./ButtonStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\n\nconst tokens = defineTokens({\n sizes,\n});\n\n// https://blog.logrocket.com/guide-css-word-wrap-overflow-wrap-word-break/\n// https://medium.com/clear-left-thinking/all-you-need-to-know-about-hyphenation-in-css-2baee2d89179\n// Skrur på hyphens auto som default fordi vi har masse mikrotekster og små elementer der layout knekker uten dette, og vi lager stadig nye og glemmer å ta hensyn til dette.\n// Så kan man optionaly sette hyphens: none de stedene man ikke ønsker det, men har ikke sett noe som knekker/blir rart pga dette enda\nconst globalHyphens = {\n hyphens: \"auto\",\n hyphenateLimitChars: \"8 5 3\", // minimum word-length / min letters first line / min letters second line\n};\n\nexport const focusStyle = {\n outline: \"none !important\",\n boxShadow: `0 0 0 .1rem white, 0 0 0 .2rem black, 0 0 0 .3rem white !important`,\n transition: \"box-shadow 0.1s ease-out\",\n};\n\nexport const biblioteksentralenChakraTheme = defineConfig({\n theme: {\n tokens,\n recipes: {\n heading: HeadingStyles,\n button: ButtonStyles,\n input: InputStyles,\n link: LinkStyles,\n container: ContainerStyles,\n spinner: SpinnerStyles,\n },\n },\n globalCss: {\n html: {\n fontSize: { base: \"112.5%\", md: \"120%\" },\n // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,\n // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)\n \"&:focus-within\": { scrollBehavior: \"smooth !important\" },\n },\n body: {\n ...globalHyphens,\n },\n // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus\n \"*:focus-visible\": focusStyle,\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defaultConfig, defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleObject> = {\n primary: {\n backgroundColor: colors.black,\n color: \"white\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 70%, 1)\",\n color: \"black\",\n },\n },\n secondary: {\n borderColor: \"currentColor\",\n },\n tertiary: {},\n // Inherit variants from Chakra's default config. Seems like they are overridden by our custom variants by default.\n ...defaultConfig.theme?.recipes?.button?.variants?.variant,\n};\n\nexport const ButtonStyles = defineRecipe({\n base: {\n borderColor: \"transparent\",\n borderWidth: \"0.1em\",\n fontWeight: 600,\n color: \"currentColor\",\n backgroundColor: \"transparent\",\n _hover: {\n backgroundColor: \"currentColor/7\",\n },\n _disabled: {\n backgroundColor: `${colors.grey45}`,\n color: \"white\",\n opacity: 1,\n },\n },\n variants: {\n variant: variants,\n size: {\n sm: {\n h: \"8\",\n px: \"2\",\n textStyle: \"md\",\n },\n md: {\n textStyle: \"md\",\n },\n lg: {\n h: \"12\",\n textStyle: \"lg\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const ContainerStyles = defineRecipe({\n base: {\n px: \".75rem\", // Padding left/right\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const HeadingStyles = defineRecipe({\n base: {\n fontWeight: \"600\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nconst variants: Record<string, SystemStyleObject> = {\n subtle: {\n backgroundColor: { _light: \"gray.200\", _dark: \"whiteAlpha.100\" },\n _hover: {\n bg: { _light: \"gray.300\", _dark: \"whiteAlpha.200\" },\n },\n },\n outline: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n flushed: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n};\n\nexport const InputStyles = defineRecipe({\n base: {\n _placeholder: {\n color: { _light: \"gray.500\", _dark: \"whiteAlpha.500\" },\n },\n },\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"subtle\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomLinkVariants = \"plain\" | \"underline\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleObject> = {\n plain: {\n color: \"currentColor\",\n textDecoration: \"none\",\n textDecorationColor: \"currentColor/30\",\n _hover: {\n textDecoration: \"underline\",\n },\n },\n underline: {\n color: \"currentColor\",\n textDecoration: \"underline\",\n textDecorationColor: \"currentColor/30\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n};\n\nexport const LinkStyles = defineRecipe({\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"underline\",\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe } from \"@chakra-ui/react\";\n\nexport const SpinnerStyles = defineRecipe({\n base: {\n animationDuration: \".8s\",\n color: colors.accentBlueMedium,\n // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color\n borderWidth: \".175em\",\n },\n});\n","const container = {\n sm: { value: \"40rem\" },\n md: { value: \"48rem\" },\n lg: { value: \"56rem\" }, // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: { value: \"80rem\" },\n};\n\nexport const sizes = {\n container,\n};\n","import { isDevelopment } from \"@biblioteksentralen/utils\";\nimport { Box, BoxProps } from \"@chakra-ui/react\";\nimport React, { ErrorInfo, ReactNode } from \"react\";\nimport { Alert } from \"./Alert\";\n\ninterface Props {\n boundaryName?: string;\n children: ReactNode;\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n errorInfo?: ErrorInfo;\n}\n\nconst StyledPre = (props: BoxProps) => (\n <Box as=\"pre\" paddingTop=\"0.5rem\" wordBreak=\"break-all\" whiteSpace=\"pre-wrap\" fontSize=\"0.8rem\" {...props} />\n);\n\nexport class ErrorBoundary extends React.Component<Props, State> {\n constructor(props: any) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: any) {\n return { hasError: true };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n this.setState({ hasError: true, error, errorInfo });\n console.error(error, { errorInfo, boundaryName: this.props.boundaryName });\n }\n\n render() {\n if (this.state.hasError) {\n const stackTrace = this.state.errorInfo?.componentStack;\n const errormsg = this.state.error?.message;\n const info = this.props.boundaryName;\n\n return (\n <div>\n <Alert status=\"error\">\n <p>Beklager, det skjedde en teknisk feil.</p>\n {isDevelopment() && (stackTrace || errormsg) && (\n <div>\n <StyledPre>{errormsg || \"\"}</StyledPre>\n <StyledPre>{info || \"\"}</StyledPre>\n <StyledPre>{stackTrace || \"\"}</StyledPre>\n </div>\n )}\n </Alert>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n","import { Box } from \"@chakra-ui/react\";\nimport React from \"react\";\nimport { focusStyle } from \"../styles/chakraTheme/biblioteksentralenChakraTheme\";\n\ninterface Props {\n id: string;\n /**\n * angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'\n */\n spaceAbove?: string;\n /**\n * angir om du vil ha fokusramme rundt komponenten som mounter HashLinkTarget. Da må komponenten du wrapper med ha position: relative | absolute el\n */\n focusOnParent?: boolean;\n}\n\nconst focusOnRelativeParentStyle = {\n _focusWithin: {\n position: \"static\",\n boxShadow: \"none\",\n \"&::after\": {\n content: '\"\"',\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n width: \"100%\",\n pointerEvents: \"none\",\n borderRadius: \"0.25rem\",\n ...focusStyle,\n },\n },\n};\n\n/*\n * 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>)\n */\nexport function HashLinkTarget(props: Props) {\n return (\n <Box position=\"relative\" css={props.focusOnParent ? focusOnRelativeParentStyle : undefined}>\n <Box\n id={props.id}\n tabIndex={props.focusOnParent ? -1 : undefined}\n position=\"absolute\"\n top={`-${props.spaceAbove || \"2.5rem\"}`}\n _focus={{\n boxShadow: \"none !important\",\n }}\n />\n </Box>\n );\n}\n","import React from \"react\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\n\nexport const withErrorBoundary = <Props,>(Component: React.ComponentType<Props>, boundaryName: string) => {\n return (props: Props & React.JSX.IntrinsicAttributes) => (\n <ErrorBoundary boundaryName={boundaryName}>\n <Component {...props} />\n </ErrorBoundary>\n );\n};\n","\"use client\";\n\nimport {\n Toaster as ChakraToaster,\n Portal,\n Spinner,\n Stack,\n Toast,\n ToastRootProps,\n createToaster,\n} from \"@chakra-ui/react\";\nimport React from \"react\";\n\nexport const toaster: ToastRootProps = createToaster({\n pauseOnPageIdle: true,\n offsets: { left: \"50%\", top: \"50%\", right: \"50%\", bottom: \"50%\" },\n});\n\nexport const Toaster = () => {\n return (\n <Portal>\n <ChakraToaster toaster={toaster} insetInline={{ mdDown: \"4\" }}>\n {(toast: ToastRootProps) => {\n if (typeof toast.render === \"function\") {\n return <>{toast.render()}</>;\n }\n return (\n <Toast.Root width={{ md: \"sm\" }}>\n {toast.type === \"loading\" ? <Spinner size=\"sm\" color=\"blue.solid\" /> : <Toast.Indicator />}\n <Stack gap=\"1\" flex=\"1\" maxWidth=\"100%\">\n {toast.title && <Toast.Title>{toast.title}</Toast.Title>}\n {toast.description && <Toast.Description>{toast.description}</Toast.Description>}\n </Stack>\n {toast.action && <Toast.ActionTrigger>{toast.action.label}</Toast.ActionTrigger>}\n {toast.closable && <Toast.CloseTrigger />}\n </Toast.Root>\n );\n }}\n </ChakraToaster>\n </Portal>\n );\n};\n"],"mappings":";AAAA,cAAc;;;AEAd,SAAS,cAAc;AACvB,SAAS,UAAU;ADDZ,IAAM,SAAS;EACpB,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,gBAAW;EACX,kBAAa;EACb,cAAc;EACd,aAAa;EACb,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,cAAc;EACd,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,WAAW;EACX,cAAc;EACd,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;EACnB,SAAS;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;EACT;AACF;AExCO,SAAS,gBAAyB;AACvC,SAAO,QAAQ,IAAI,aAAa;AAClC;;;AOAA,SAAyB,SAAS,mBAAsC;AACxE,OAAO,WAA0B;AACjC,SAAS,aAAa,aAAa,MAAM,eAAe;AAMxD,IAAM,cAA6D;AAAA,EACjE,MAAM,EAAE,IAAI,OAAO,WAAW,OAAO,OAAO,iBAAiB;AAAA,EAC7D,SAAS,EAAE,IAAI,OAAO,mBAAmB,OAAO,OAAO,aAAa;AAAA,EACpE,SAAS,EAAE,IAAI,OAAO,kBAAkB,OAAO,OAAO,YAAY;AAAA,EAClE,OAAO,EAAE,IAAI,OAAO,gBAAgB,OAAO,OAAO,UAA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AAG,OAAO,CACxB;AAEJ;;;ACPA;AAAA,EACE,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP,OAAOC,aAAW;AAEX,IAAM,UAA0B,cAAc;AAAA,EACnD,iBAAiB;AAAA,EACjB,SAAS,EAAE,MAAM,OAAO,KAAK,OAAO,OAAO,OAAO,QAAQ,MAAM;AAClE,CAAC;AAEM,IAAM,UAAU,MAAM;AAC3B,SACE,gBAAAA,QAAA,cAAC,cACC,gBAAAA,QAAA,cAAC,iBAAc,SAAkB,aAAa,EAAE,QAAQ,IAAI,KACzD,CAAC,UAA0B;AAC1B,QAAI,OAAO,MAAM,WAAW,YAAY;AACtC,aAAO,gBAAAA,QAAA,cAAAA,QAAA,gBAAG,MAAM,OAAO,CAAE;AAAA,IAC3B;AACA,WACE,gBAAAA,QAAA,cAAC,MAAM,MAAN,EAAW,OAAO,EAAE,IAAI,KAAK,KAC3B,MAAM,SAAS,YAAY,gBAAAA,QAAA,cAAC,WAAQ,MAAK,MAAK,OAAM,cAAa,IAAK,gBAAAA,QAAA,cAAC,MAAM,WAAN,IAAgB,GACxF,gBAAAA,QAAA,cAAC,SAAM,KAAI,KAAI,MAAK,KAAI,UAAS,UAC9B,MAAM,SAAS,gBAAAA,QAAA,cAAC,MAAM,OAAN,MAAa,MAAM,KAAM,GACzC,MAAM,eAAe,gBAAAA,QAAA,cAAC,MAAM,aAAN,MAAmB,MAAM,WAAY,CAC9D,GACC,MAAM,UAAU,gBAAAA,QAAA,cAAC,MAAM,eAAN,MAAqB,MAAM,OAAO,KAAM,GACzD,MAAM,YAAY,gBAAAA,QAAA,cAAC,MAAM,cAAN,IAAmB,CACzC;AAAA,EAEJ,CACF,CACF;AAEJ;","names":["colors","React","React","React","React","React","React","React","defaultConfig","defineRecipe","defineRecipe","defineRecipe","variants","defineRecipe","variants","defineRecipe","React","defaultConfig","Box","React","React","Box","Box","React","React","Box","React","React","React"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biblioteksentralen/react",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "React library for reusable code in Biblioteksentralens js-apps",
5
5
  "keywords": [],
6
6
  "author": "Biblioteksentralen",