@biblioteksentralen/react 2.0.1 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/CheckboxStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/LinkStyles.ts","../src/styles/chakraTheme/ModalStyles.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","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,WAA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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,eAAAC,QAAM,WAAW,CAAC,OAAc,QACrC,+BAAAA,QAAA,cAAC,iBAAc,gBACb,+BAAAA,QAAA,cAAC,aAAW,GAAG,OAAO,KAAU,CAClC,CACD;AACH","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 { colors } from \"@biblioteksentralen/utils\";\nimport { AlertProps, Box, Flex, FlexProps } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = Exclude<AlertProps[\"status\"], undefined | \"loading\">;\ntype Variants = \"inline\";\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 FlexProps {\n children: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<Variants, FlexProps> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function Alert({ status, children, variant, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <Flex\n role=\"alert\"\n flexWrap=\"wrap\"\n alignItems=\"center\"\n gridGap=\"0.5em 0.6em\"\n background=\"white\"\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n padding=\"0.75rem\"\n borderRadius=\"0.3rem\"\n {...(variant ? variantStyles[variant] : {})}\n {...rest}\n >\n <Box color={colors.color} flex=\"0 0\" marginLeft=\"auto\" marginRight=\"auto\" lineHeight=\"1\" fontSize=\"1.5em\">\n {iconLookup[status]}\n </Box>\n <Box flex=\"1\">{children}</Box>\n </Flex>\n );\n}\n","import React from \"react\";\nimport { Button as ChakraButton, ButtonProps, ComponentWithAs } from \"@chakra-ui/react\";\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, ThemeTypings } from \"@chakra-ui/react\";\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 {\n FormControl,\n FormErrorMessage,\n FormHelperText,\n FormLabel,\n FormLabelProps,\n Input as ChakraInput,\n InputProps,\n} from \"@chakra-ui/react\";\nimport React, { forwardRef } from \"react\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FormLabelProps;\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 = forwardRef((props: Props, ref) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <FormLabel {...labelProps}>{label}</FormLabel>;\n\n return (\n <FormControl isInvalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && (\n <FormHelperText marginTop=\"-0.25em\" marginBottom=\"0.25em\">\n {helperText}\n </FormHelperText>\n )}\n <ChakraInput ref={ref} {...inputProps} />\n {errorMessage && (\n <FormErrorMessage color={colors.statusRed} fontWeight={600}>\n {errorMessage}\n </FormErrorMessage>\n )}\n </FormControl>\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, ComponentWithAs, LinkProps } from \"@chakra-ui/react\";\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 { ChakraProvider, ChakraTheme, extendTheme } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { biblioteksentralenChakraTheme } from \"./styles/chakraTheme/biblioteksentralenChakraTheme\";\n\ninterface Props {\n children: ReactNode;\n customTheme?: Partial<ChakraTheme>;\n}\n\nconst emptyTheme = {};\n\nexport const BiblioteksentralenProvider = (props: Props) => (\n <ChakraProvider theme={extendTheme(biblioteksentralenChakraTheme, props.customTheme ?? emptyTheme)}>\n {props.children}\n </ChakraProvider>\n);\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { ComponentStyleConfig } from \"@chakra-ui/theme\";\nimport { SystemStyleInterpolation } from \"@chakra-ui/theme-tools\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleInterpolation> = {\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 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: ComponentStyleConfig = {\n baseStyle: {\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 sizes: {\n sm: {\n padding: \"0.2em 0.5em\",\n fontSize: \"1rem\",\n },\n },\n variants: variants,\n defaultProps: {\n variant: \"primary\",\n },\n};\n","import { createMultiStyleConfigHelpers } from \"@chakra-ui/react\";\nimport { checkboxAnatomy } from \"@chakra-ui/anatomy\";\n\nconst { definePartsStyle, defineMultiStyleConfig: defineMultiStyleConfigWithTypeIssue } = createMultiStyleConfigHelpers(\n checkboxAnatomy.keys\n);\n\n// https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437\nconst defineMultiStyleConfig: ReturnType<typeof createMultiStyleConfigHelpers>[\"defineMultiStyleConfig\"] =\n defineMultiStyleConfigWithTypeIssue;\n\nconst baseStyle = definePartsStyle({\n control: {\n background: \"white\",\n },\n});\n\n// https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437\nexport const CheckboxStyles: ReturnType<typeof defineMultiStyleConfig> = defineMultiStyleConfig({ baseStyle });\n","import { ComponentStyleConfig } from \"@chakra-ui/theme\";\n\nexport const ContainerStyles: ComponentStyleConfig = {\n baseStyle: {\n px: \".75rem\", // Padding left/right\n },\n};\n","import { ComponentStyleConfig } from \"@chakra-ui/theme\";\n\nexport const HeadingStyles: ComponentStyleConfig = {\n baseStyle: {\n fontWeight: \"600\",\n },\n};\n","import { ComponentStyleConfig } from \"@chakra-ui/theme\";\nimport { mode } from \"@chakra-ui/theme-tools\";\n\nexport const InputStyles: ComponentStyleConfig = {\n baseStyle: (props) => ({\n field: {\n _placeholder: {\n color: mode(\"gray.500\", \"whiteAlpha.500\")(props),\n },\n },\n }),\n variants: {\n filled: (props) => ({\n field: {\n bg: mode(\"gray.200\", \"whiteAlpha.100\")(props),\n _hover: {\n bg: mode(\"gray.300\", \"whiteAlpha.200\")(props),\n },\n },\n }),\n outline: (props) => ({\n field: {\n borderColor: mode(\"gray.300\", \"whiteAlpha.300\")(props),\n _hover: {\n borderColor: mode(\"gray.400\", \"whiteAlpha.400\")(props),\n },\n },\n }),\n flushed: (props) => ({\n field: {\n borderColor: mode(\"gray.300\", \"whiteAlpha.300\")(props),\n _hover: {\n borderColor: mode(\"gray.400\", \"whiteAlpha.400\")(props),\n },\n },\n }),\n },\n defaultProps: {\n variant: \"filled\",\n },\n};\n","import { ComponentStyleConfig } from \"@chakra-ui/theme\";\nimport { SystemStyleInterpolation } from \"@chakra-ui/theme-tools\";\n\nexport type CustomLinkVariants = \"plain\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleInterpolation> = {\n plain: {\n textDecoration: \"none\",\n _hover: {\n textDecoration: \"underline\",\n },\n },\n};\n\nexport const LinkStyles: ComponentStyleConfig = {\n baseStyle: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n variants: variants,\n};\n","import { ComponentStyleConfig } from \"@chakra-ui/theme\";\n\nexport const ModalStyles: ComponentStyleConfig = {\n baseStyle: {\n // Fix for modal height on Safari iOS:\n // https://github.com/chakra-ui/chakra-ui/issues/4680#issuecomment-1301640929\n dialogContainer: {\n \"@supports(height: -webkit-fill-available)\": {},\n height: \"100%\",\n },\n },\n};\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { Spinner } from \"@chakra-ui/react\";\nimport { ComponentStyleConfig } from \"@chakra-ui/theme\";\n\nexport const SpinnerStyles: ComponentStyleConfig = {};\n\nSpinner.defaultProps = {\n ...Spinner.defaultProps,\n speed: \".8s\",\n color: colors.accentBlueMedium,\n emptyColor: \"rgba(0,0,0,.2)\",\n thickness: \".175em\",\n};\n","const container = {\n sm: \"40rem\",\n md: \"48rem\",\n lg: \"56rem\", // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: \"80rem\",\n};\n\nexport const sizes = {\n container,\n};\n","import { ChakraTheme } from \"@chakra-ui/theme\";\nimport { ButtonStyles } from \"./ButtonStyles\";\nimport { CheckboxStyles } from \"./CheckboxStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { ModalStyles } from \"./ModalStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\n\nexport const biblioteksentralenChakraTheme: Partial<ChakraTheme> = {\n styles: {\n global: {\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 components: {\n Heading: HeadingStyles,\n Spinner: SpinnerStyles,\n Link: LinkStyles,\n Button: ButtonStyles,\n Input: InputStyles,\n Container: ContainerStyles,\n Modal: ModalStyles,\n Checkbox: CheckboxStyles,\n },\n sizes,\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 \"&:focus-within\": {\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\" sx={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 React.forwardRef((props: Props, ref) => (\n <ErrorBoundary boundaryName={boundaryName}>\n <Component {...props} ref={ref} />\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/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","../src/components/ui/toaster.tsx"],"names":["import_react","React","colors","ChakraAlert","ChakraButton","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,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,OAA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C,eAAAQ,SAAA,EAAc,SAAkB,aAAa,EAAE,QAAQ,IAAI,KACzD,CAAC,UACA,+BAAAR,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,CAEJ,CACF;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\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 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","\"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 = createToaster({\n placement: \"bottom-end\",\n pauseOnPageIdle: true,\n});\n\nexport const Toaster = () => {\n return (\n <Portal>\n <ChakraToaster toaster={toaster} insetInline={{ mdDown: \"4\" }}>\n {(toast: ToastRootProps) => (\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 </ChakraToaster>\n </Portal>\n );\n};\n"]}
package/dist/index.mjs CHANGED
@@ -50,7 +50,7 @@ function isDevelopment() {
50
50
  }
51
51
 
52
52
  // src/components/Alert.tsx
53
- import { Box, Flex } from "@chakra-ui/react";
53
+ import { Alert as ChakraAlert } from "@chakra-ui/react";
54
54
  import React from "react";
55
55
  import { AlertCircle, CheckCircle, Info, XCircle } from "react-feather";
56
56
  var colorLookup = {
@@ -72,26 +72,20 @@ var variantStyles = {
72
72
  padding: "0"
73
73
  }
74
74
  };
75
- function Alert({ status, children, variant, ...rest }) {
75
+ function Alert({ status, children, variant, header, ...rest }) {
76
76
  const colors2 = colorLookup[status];
77
77
  return /* @__PURE__ */ React.createElement(
78
- Flex,
78
+ ChakraAlert.Root,
79
79
  {
80
- role: "alert",
81
- flexWrap: "wrap",
82
- alignItems: "center",
83
- gridGap: "0.5em 0.6em",
84
- background: "white",
80
+ status,
85
81
  border: `0.1rem solid`,
86
82
  borderColor: colors2.color,
87
83
  backgroundColor: colors2.bg,
88
- padding: "0.75rem",
89
- borderRadius: "0.3rem",
90
- ...variant ? variantStyles[variant] : {},
84
+ ...variant === "inline" ? variantStyles[variant] : {},
91
85
  ...rest
92
86
  },
93
- /* @__PURE__ */ React.createElement(Box, { color: colors2.color, flex: "0 0", marginLeft: "auto", marginRight: "auto", lineHeight: "1", fontSize: "1.5em" }, iconLookup[status]),
94
- /* @__PURE__ */ React.createElement(Box, { flex: "1" }, children)
87
+ /* @__PURE__ */ React.createElement(ChakraAlert.Indicator, null, iconLookup[status]),
88
+ /* @__PURE__ */ React.createElement(ChakraAlert.Content, { color: "black" }, header && /* @__PURE__ */ React.createElement(ChakraAlert.Title, null, header), /* @__PURE__ */ React.createElement(ChakraAlert.Description, null, children))
95
89
  );
96
90
  }
97
91
 
@@ -104,25 +98,19 @@ import React2 from "react";
104
98
  var ConditionalWrapper = ({ condition, children, wrapper: Wrapper }) => condition ? /* @__PURE__ */ React2.createElement(Wrapper, null, children) : /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
105
99
 
106
100
  // src/components/HideWithCSS.tsx
107
- import { Box as Box2 } from "@chakra-ui/react";
101
+ import { Box } from "@chakra-ui/react";
108
102
  import React3 from "react";
109
103
  var HideWithCSS = ({ children, above, below, ...chakraProps }) => {
110
104
  const display = {
111
105
  ...!!below ? { base: "none", [below]: "block" } : {},
112
106
  ...!!above ? { [above]: "none" } : {}
113
107
  };
114
- return /* @__PURE__ */ React3.createElement(Box2, { ...chakraProps, display }, children);
108
+ return /* @__PURE__ */ React3.createElement(Box, { ...chakraProps, display }, children);
115
109
  };
116
110
 
117
111
  // src/components/Input.tsx
118
- import {
119
- FormControl,
120
- FormErrorMessage,
121
- FormHelperText,
122
- FormLabel,
123
- Input as ChakraInput
124
- } from "@chakra-ui/react";
125
- import React5, { forwardRef } from "react";
112
+ import { Field, Input as ChakraInput } from "@chakra-ui/react";
113
+ import React5 from "react";
126
114
 
127
115
  // src/components/VisuallyHidden.tsx
128
116
  import React4, { useEffect } from "react";
@@ -153,21 +141,22 @@ function VisuallyHidden({ children, ...rest }) {
153
141
  }
154
142
 
155
143
  // src/components/Input.tsx
156
- var Input = forwardRef((props, ref) => {
144
+ var Input = (props) => {
157
145
  const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;
158
- const formLabel = /* @__PURE__ */ React5.createElement(FormLabel, { ...labelProps }, label);
159
- return /* @__PURE__ */ React5.createElement(FormControl, { isInvalid: !!errorMessage }, hideLabel ? /* @__PURE__ */ React5.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ React5.createElement(FormHelperText, { marginTop: "-0.25em", marginBottom: "0.25em" }, helperText), /* @__PURE__ */ React5.createElement(ChakraInput, { ref, ...inputProps }), errorMessage && /* @__PURE__ */ React5.createElement(FormErrorMessage, { color: colors.statusRed, fontWeight: 600 }, errorMessage));
160
- });
146
+ const formLabel = /* @__PURE__ */ React5.createElement(Field.Label, { ...labelProps }, label);
147
+ return /* @__PURE__ */ React5.createElement(Field.Root, { invalid: !!errorMessage }, hideLabel ? /* @__PURE__ */ React5.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ React5.createElement(Field.HelperText, null, helperText), /* @__PURE__ */ React5.createElement(ChakraInput, { ...inputProps }), errorMessage && /* @__PURE__ */ React5.createElement(Field.ErrorText, null, errorMessage));
148
+ };
161
149
 
162
150
  // src/components/Link.tsx
163
151
  import { Link as ChakraLink } from "@chakra-ui/react";
164
152
  var Link = ChakraLink;
165
153
 
166
154
  // src/BiblioteksentralenProvider.tsx
167
- import { ChakraProvider, extendTheme } from "@chakra-ui/react";
168
155
  import React6 from "react";
156
+ import { ChakraProvider } from "@chakra-ui/react";
169
157
 
170
158
  // src/styles/chakraTheme/ButtonStyles.ts
159
+ import { defineRecipe } from "@chakra-ui/react";
171
160
  var variants = {
172
161
  primary: {
173
162
  backgroundColor: colors.black,
@@ -178,7 +167,7 @@ var variants = {
178
167
  }
179
168
  },
180
169
  secondary: {
181
- borderColor: "currentColor",
170
+ borderColor: "currentColor !important",
182
171
  backgroundColor: "transparent",
183
172
  color: "currentColor",
184
173
  _hover: {
@@ -194,8 +183,8 @@ var variants = {
194
183
  }
195
184
  }
196
185
  };
197
- var ButtonStyles = {
198
- baseStyle: {
186
+ var ButtonStyles = defineRecipe({
187
+ base: {
199
188
  border: "transparent 0.1em solid",
200
189
  borderRadius: "0.35em",
201
190
  fontWeight: 600,
@@ -205,175 +194,157 @@ var ButtonStyles = {
205
194
  opacity: 1
206
195
  }
207
196
  },
208
- sizes: {
209
- sm: {
210
- padding: "0.2em 0.5em",
211
- fontSize: "1rem"
197
+ variants: {
198
+ variant: {
199
+ ...variants
200
+ },
201
+ sizes: {
202
+ sm: {
203
+ padding: "0.2em 0.5em",
204
+ fontSize: "1rem"
205
+ }
212
206
  }
213
207
  },
214
- variants,
215
- defaultProps: {
208
+ defaultVariants: {
216
209
  variant: "primary"
217
210
  }
218
- };
219
-
220
- // src/styles/chakraTheme/CheckboxStyles.ts
221
- import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
222
- import { checkboxAnatomy } from "@chakra-ui/anatomy";
223
- var { definePartsStyle, defineMultiStyleConfig: defineMultiStyleConfigWithTypeIssue } = createMultiStyleConfigHelpers(
224
- checkboxAnatomy.keys
225
- );
226
- var defineMultiStyleConfig = defineMultiStyleConfigWithTypeIssue;
227
- var baseStyle = definePartsStyle({
228
- control: {
229
- background: "white"
230
- }
231
211
  });
232
- var CheckboxStyles = defineMultiStyleConfig({ baseStyle });
233
212
 
234
213
  // src/styles/chakraTheme/ContainerStyles.ts
235
- var ContainerStyles = {
236
- baseStyle: {
214
+ import { defineRecipe as defineRecipe2 } from "@chakra-ui/react";
215
+ var ContainerStyles = defineRecipe2({
216
+ base: {
237
217
  px: ".75rem"
238
218
  // Padding left/right
239
219
  }
240
- };
220
+ });
241
221
 
242
222
  // src/styles/chakraTheme/HeadingStyles.ts
243
- var HeadingStyles = {
244
- baseStyle: {
223
+ import { defineRecipe as defineRecipe3 } from "@chakra-ui/react";
224
+ var HeadingStyles = defineRecipe3({
225
+ base: {
245
226
  fontWeight: "600"
246
227
  }
247
- };
228
+ });
248
229
 
249
230
  // src/styles/chakraTheme/InputStyles.ts
250
- import { mode } from "@chakra-ui/theme-tools";
251
- var InputStyles = {
252
- baseStyle: (props) => ({
253
- field: {
254
- _placeholder: {
255
- color: mode("gray.500", "whiteAlpha.500")(props)
256
- }
231
+ import { defineRecipe as defineRecipe4 } from "@chakra-ui/react";
232
+ var variants2 = {
233
+ subtle: {
234
+ backgroundColor: { _light: "gray.200", _dark: "whiteAlpha.100" },
235
+ _hover: {
236
+ bg: { _light: "gray.300", _dark: "whiteAlpha.200" }
257
237
  }
258
- }),
259
- variants: {
260
- filled: (props) => ({
261
- field: {
262
- bg: mode("gray.200", "whiteAlpha.100")(props),
263
- _hover: {
264
- bg: mode("gray.300", "whiteAlpha.200")(props)
265
- }
266
- }
267
- }),
268
- outline: (props) => ({
269
- field: {
270
- borderColor: mode("gray.300", "whiteAlpha.300")(props),
271
- _hover: {
272
- borderColor: mode("gray.400", "whiteAlpha.400")(props)
273
- }
274
- }
275
- }),
276
- flushed: (props) => ({
277
- field: {
278
- borderColor: mode("gray.300", "whiteAlpha.300")(props),
279
- _hover: {
280
- borderColor: mode("gray.400", "whiteAlpha.400")(props)
281
- }
282
- }
283
- })
284
238
  },
285
- defaultProps: {
286
- variant: "filled"
239
+ outline: {
240
+ borderColor: { _light: "gray.300", _dark: "whiteAlpha.300" },
241
+ _hover: {
242
+ borderColor: { _light: "gray.400", _dark: "whiteAlpha.400" }
243
+ }
244
+ },
245
+ flushed: {
246
+ borderColor: { _light: "gray.300", _dark: "whiteAlpha.300" },
247
+ _hover: {
248
+ borderColor: { _light: "gray.400", _dark: "whiteAlpha.400" }
249
+ }
287
250
  }
288
251
  };
252
+ var InputStyles = defineRecipe4({
253
+ base: {
254
+ _placeholder: {
255
+ color: { _light: "gray.500", _dark: "whiteAlpha.500" }
256
+ }
257
+ },
258
+ variants: {
259
+ variant: { ...variants2 }
260
+ },
261
+ defaultVariants: {
262
+ variant: "subtle"
263
+ }
264
+ });
289
265
 
290
266
  // src/styles/chakraTheme/LinkStyles.ts
291
- var variants2 = {
267
+ import { defineRecipe as defineRecipe5 } from "@chakra-ui/react";
268
+ var variants3 = {
292
269
  plain: {
293
270
  textDecoration: "none",
294
271
  _hover: {
295
272
  textDecoration: "underline"
296
273
  }
297
- }
298
- };
299
- var LinkStyles = {
300
- baseStyle: {
274
+ },
275
+ underline: {
301
276
  textDecoration: "underline",
302
277
  _hover: {
303
278
  textDecoration: "none"
304
279
  }
305
- },
306
- variants: variants2
307
- };
308
-
309
- // src/styles/chakraTheme/ModalStyles.ts
310
- var ModalStyles = {
311
- baseStyle: {
312
- // Fix for modal height on Safari iOS:
313
- // https://github.com/chakra-ui/chakra-ui/issues/4680#issuecomment-1301640929
314
- dialogContainer: {
315
- "@supports(height: -webkit-fill-available)": {},
316
- height: "100%"
317
- }
318
280
  }
319
281
  };
282
+ var LinkStyles = defineRecipe5({
283
+ variants: {
284
+ variant: { ...variants3 }
285
+ },
286
+ defaultVariants: {
287
+ variant: "underline"
288
+ }
289
+ });
320
290
 
321
291
  // src/styles/chakraTheme/SpinnerStyles.ts
322
- import { Spinner } from "@chakra-ui/react";
323
- var SpinnerStyles = {};
324
- Spinner.defaultProps = {
325
- ...Spinner.defaultProps,
326
- speed: ".8s",
327
- color: colors.accentBlueMedium,
328
- emptyColor: "rgba(0,0,0,.2)",
329
- thickness: ".175em"
330
- };
292
+ import { defineRecipe as defineRecipe6 } from "@chakra-ui/react";
293
+ var SpinnerStyles = defineRecipe6({
294
+ base: {
295
+ animationDuration: ".8s",
296
+ color: colors.accentBlueMedium,
297
+ // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color
298
+ borderWidth: ".175em"
299
+ }
300
+ });
331
301
 
332
302
  // src/styles/chakraTheme/sizes.ts
333
303
  var container = {
334
- sm: "40rem",
335
- md: "48rem",
336
- lg: "56rem",
304
+ sm: { value: "40rem" },
305
+ md: { value: "48rem" },
306
+ lg: { value: "56rem" },
337
307
  // Forsøker 56rem som standardbredde etter testing med Katrine
338
- xl: "80rem"
308
+ xl: { value: "80rem" }
339
309
  };
340
310
  var sizes = {
341
311
  container
342
312
  };
343
313
 
344
314
  // src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
345
- var biblioteksentralenChakraTheme = {
346
- styles: {
347
- global: {
348
- html: {
349
- fontSize: { base: "112.5%", md: "120%" },
350
- // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
351
- // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
352
- "&:focus-within": { scrollBehavior: "smooth !important" }
353
- }
315
+ import { createSystem, defaultConfig } from "@chakra-ui/react";
316
+ var biblioteksentralenChakraTheme = createSystem(defaultConfig, {
317
+ theme: {
318
+ tokens: {
319
+ sizes
320
+ },
321
+ recipes: {
322
+ heading: HeadingStyles,
323
+ button: ButtonStyles,
324
+ input: InputStyles,
325
+ link: LinkStyles,
326
+ container: ContainerStyles,
327
+ spinner: SpinnerStyles
354
328
  }
355
329
  },
356
- components: {
357
- Heading: HeadingStyles,
358
- Spinner: SpinnerStyles,
359
- Link: LinkStyles,
360
- Button: ButtonStyles,
361
- Input: InputStyles,
362
- Container: ContainerStyles,
363
- Modal: ModalStyles,
364
- Checkbox: CheckboxStyles
365
- },
366
- sizes
367
- };
330
+ globalCss: {
331
+ html: {
332
+ fontSize: { base: "112.5%", md: "120%" },
333
+ // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
334
+ // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
335
+ "&:focus-within": { scrollBehavior: "smooth !important" }
336
+ }
337
+ }
338
+ });
368
339
 
369
340
  // src/BiblioteksentralenProvider.tsx
370
- var emptyTheme = {};
371
- var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, { theme: extendTheme(biblioteksentralenChakraTheme, props.customTheme ?? emptyTheme) }, props.children);
341
+ import { ColorModeProvider } from "@chakra-ui/system";
342
+ var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, { value: biblioteksentralenChakraTheme }, /* @__PURE__ */ React6.createElement(ColorModeProvider, { ...props }));
372
343
 
373
344
  // src/components/ErrorBoundary.tsx
374
- import { Box as Box3 } from "@chakra-ui/react";
345
+ import { Box as Box2 } from "@chakra-ui/react";
375
346
  import React7 from "react";
376
- var StyledPre = (props) => /* @__PURE__ */ React7.createElement(Box3, { as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem", ...props });
347
+ var StyledPre = (props) => /* @__PURE__ */ React7.createElement(Box2, { as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem", ...props });
377
348
  var ErrorBoundary = class extends React7.Component {
378
349
  constructor(props) {
379
350
  super(props);
@@ -398,10 +369,10 @@ var ErrorBoundary = class extends React7.Component {
398
369
  };
399
370
 
400
371
  // src/components/HashLinkTarget.tsx
401
- import { Box as Box4 } from "@chakra-ui/react";
372
+ import { Box as Box3 } from "@chakra-ui/react";
402
373
  import React8 from "react";
403
374
  var focusOnRelativeParentStyle = {
404
- "&:focus-within": {
375
+ _focusWithin: {
405
376
  position: "static",
406
377
  boxShadow: "none",
407
378
  "&::after": {
@@ -418,8 +389,8 @@ var focusOnRelativeParentStyle = {
418
389
  }
419
390
  };
420
391
  function HashLinkTarget(props) {
421
- return /* @__PURE__ */ React8.createElement(Box4, { position: "relative", sx: props.focusOnParent ? focusOnRelativeParentStyle : void 0 }, /* @__PURE__ */ React8.createElement(
422
- Box4,
392
+ return /* @__PURE__ */ React8.createElement(Box3, { position: "relative", css: props.focusOnParent ? focusOnRelativeParentStyle : void 0 }, /* @__PURE__ */ React8.createElement(
393
+ Box3,
423
394
  {
424
395
  id: props.id,
425
396
  tabIndex: props.focusOnParent ? -1 : void 0,
@@ -435,7 +406,25 @@ function HashLinkTarget(props) {
435
406
  // src/components/withErrorBoundary.tsx
436
407
  import React9 from "react";
437
408
  var withErrorBoundary = (Component, boundaryName) => {
438
- return React9.forwardRef((props, ref) => /* @__PURE__ */ React9.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React9.createElement(Component, { ...props, ref })));
409
+ return (props) => /* @__PURE__ */ React9.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React9.createElement(Component, { ...props }));
410
+ };
411
+
412
+ // src/components/ui/toaster.tsx
413
+ import {
414
+ Toaster as ChakraToaster,
415
+ Portal,
416
+ Spinner,
417
+ Stack,
418
+ Toast,
419
+ createToaster
420
+ } from "@chakra-ui/react";
421
+ import React10 from "react";
422
+ var toaster = createToaster({
423
+ placement: "bottom-end",
424
+ pauseOnPageIdle: true
425
+ });
426
+ var Toaster = () => {
427
+ return /* @__PURE__ */ React10.createElement(Portal, null, /* @__PURE__ */ React10.createElement(ChakraToaster, { toaster, insetInline: { mdDown: "4" } }, (toast) => /* @__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))));
439
428
  };
440
429
  export {
441
430
  Alert,
@@ -447,9 +436,11 @@ export {
447
436
  HideWithCSS,
448
437
  Input,
449
438
  Link,
439
+ Toaster,
450
440
  VisuallyHidden,
451
441
  biblioteksentralenChakraTheme,
452
442
  colors,
443
+ toaster,
453
444
  withErrorBoundary
454
445
  };
455
446
  //# sourceMappingURL=index.mjs.map