@biblioteksentralen/react 2.0.0 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -14
- package/dist/index.js +168 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -152
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
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,QA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C3C,SACE,+BAAAC,QAAA,cAAC,sBAAI,UAAS,YAAW,IAAI,MAAM,gBAAgB,6BAA6B,UAC9E,+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,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 return (\n <FormControl isInvalid={!!errorMessage}>\n <FormLabel {...labelProps}>\n {hideLabel ? <VisuallyHidden>{label}</VisuallyHidden> : label}\n </FormLabel>\n {helperText && <FormHelperText marginTop=\"-0.25em\" marginBottom=\"0.25em\">{helperText}</FormHelperText>}\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"],"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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M,cAAc,aACjC,+BAAAA,QAAA,cAAC,aACC,+BAAAA,QAAA,cAAC,iBAAW,YAAY,EAAG,GAC3B,+BAAAA,QAAA,cAAC,iBAAW,QAAQ,EAAG,GACvB,+BAAAA,QAAA,cAAC,iBAAW,cAAc,EAAG,CAC/B,CAEJ,CACF;AAAA,IAEJ;AAEA,WAAO,KAAK,MAAM;AAAA,EACpB;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"]}
|
package/dist/index.mjs
CHANGED
|
@@ -50,7 +50,7 @@ function isDevelopment() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// src/components/Alert.tsx
|
|
53
|
-
import {
|
|
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
|
-
|
|
78
|
+
ChakraAlert.Root,
|
|
79
79
|
{
|
|
80
|
-
|
|
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
|
-
|
|
89
|
-
borderRadius: "0.3rem",
|
|
90
|
-
...variant ? variantStyles[variant] : {},
|
|
84
|
+
...variant === "inline" ? variantStyles[variant] : {},
|
|
91
85
|
...rest
|
|
92
86
|
},
|
|
93
|
-
/* @__PURE__ */ React.createElement(
|
|
94
|
-
/* @__PURE__ */ React.createElement(
|
|
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
|
|
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(
|
|
108
|
+
return /* @__PURE__ */ React3.createElement(Box, { ...chakraProps, display }, children);
|
|
115
109
|
};
|
|
116
110
|
|
|
117
111
|
// src/components/Input.tsx
|
|
118
|
-
import {
|
|
119
|
-
|
|
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,20 +141,22 @@ function VisuallyHidden({ children, ...rest }) {
|
|
|
153
141
|
}
|
|
154
142
|
|
|
155
143
|
// src/components/Input.tsx
|
|
156
|
-
var Input =
|
|
144
|
+
var Input = (props) => {
|
|
157
145
|
const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;
|
|
158
|
-
|
|
159
|
-
});
|
|
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
|
+
};
|
|
160
149
|
|
|
161
150
|
// src/components/Link.tsx
|
|
162
151
|
import { Link as ChakraLink } from "@chakra-ui/react";
|
|
163
152
|
var Link = ChakraLink;
|
|
164
153
|
|
|
165
154
|
// src/BiblioteksentralenProvider.tsx
|
|
166
|
-
import { ChakraProvider, extendTheme } from "@chakra-ui/react";
|
|
167
155
|
import React6 from "react";
|
|
156
|
+
import { ChakraProvider } from "@chakra-ui/react";
|
|
168
157
|
|
|
169
158
|
// src/styles/chakraTheme/ButtonStyles.ts
|
|
159
|
+
import { defineRecipe } from "@chakra-ui/react";
|
|
170
160
|
var variants = {
|
|
171
161
|
primary: {
|
|
172
162
|
backgroundColor: colors.black,
|
|
@@ -177,7 +167,7 @@ var variants = {
|
|
|
177
167
|
}
|
|
178
168
|
},
|
|
179
169
|
secondary: {
|
|
180
|
-
borderColor: "currentColor",
|
|
170
|
+
borderColor: "currentColor !important",
|
|
181
171
|
backgroundColor: "transparent",
|
|
182
172
|
color: "currentColor",
|
|
183
173
|
_hover: {
|
|
@@ -193,8 +183,8 @@ var variants = {
|
|
|
193
183
|
}
|
|
194
184
|
}
|
|
195
185
|
};
|
|
196
|
-
var ButtonStyles = {
|
|
197
|
-
|
|
186
|
+
var ButtonStyles = defineRecipe({
|
|
187
|
+
base: {
|
|
198
188
|
border: "transparent 0.1em solid",
|
|
199
189
|
borderRadius: "0.35em",
|
|
200
190
|
fontWeight: 600,
|
|
@@ -204,175 +194,157 @@ var ButtonStyles = {
|
|
|
204
194
|
opacity: 1
|
|
205
195
|
}
|
|
206
196
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
197
|
+
variants: {
|
|
198
|
+
variant: {
|
|
199
|
+
...variants
|
|
200
|
+
},
|
|
201
|
+
sizes: {
|
|
202
|
+
sm: {
|
|
203
|
+
padding: "0.2em 0.5em",
|
|
204
|
+
fontSize: "1rem"
|
|
205
|
+
}
|
|
211
206
|
}
|
|
212
207
|
},
|
|
213
|
-
|
|
214
|
-
defaultProps: {
|
|
208
|
+
defaultVariants: {
|
|
215
209
|
variant: "primary"
|
|
216
210
|
}
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// src/styles/chakraTheme/CheckboxStyles.ts
|
|
220
|
-
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
|
|
221
|
-
import { checkboxAnatomy } from "@chakra-ui/anatomy";
|
|
222
|
-
var { definePartsStyle, defineMultiStyleConfig: defineMultiStyleConfigWithTypeIssue } = createMultiStyleConfigHelpers(
|
|
223
|
-
checkboxAnatomy.keys
|
|
224
|
-
);
|
|
225
|
-
var defineMultiStyleConfig = defineMultiStyleConfigWithTypeIssue;
|
|
226
|
-
var baseStyle = definePartsStyle({
|
|
227
|
-
control: {
|
|
228
|
-
background: "white"
|
|
229
|
-
}
|
|
230
211
|
});
|
|
231
|
-
var CheckboxStyles = defineMultiStyleConfig({ baseStyle });
|
|
232
212
|
|
|
233
213
|
// src/styles/chakraTheme/ContainerStyles.ts
|
|
234
|
-
|
|
235
|
-
|
|
214
|
+
import { defineRecipe as defineRecipe2 } from "@chakra-ui/react";
|
|
215
|
+
var ContainerStyles = defineRecipe2({
|
|
216
|
+
base: {
|
|
236
217
|
px: ".75rem"
|
|
237
218
|
// Padding left/right
|
|
238
219
|
}
|
|
239
|
-
};
|
|
220
|
+
});
|
|
240
221
|
|
|
241
222
|
// src/styles/chakraTheme/HeadingStyles.ts
|
|
242
|
-
|
|
243
|
-
|
|
223
|
+
import { defineRecipe as defineRecipe3 } from "@chakra-ui/react";
|
|
224
|
+
var HeadingStyles = defineRecipe3({
|
|
225
|
+
base: {
|
|
244
226
|
fontWeight: "600"
|
|
245
227
|
}
|
|
246
|
-
};
|
|
228
|
+
});
|
|
247
229
|
|
|
248
230
|
// src/styles/chakraTheme/InputStyles.ts
|
|
249
|
-
import {
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
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" }
|
|
256
237
|
}
|
|
257
|
-
}),
|
|
258
|
-
variants: {
|
|
259
|
-
filled: (props) => ({
|
|
260
|
-
field: {
|
|
261
|
-
bg: mode("gray.200", "whiteAlpha.100")(props),
|
|
262
|
-
_hover: {
|
|
263
|
-
bg: mode("gray.300", "whiteAlpha.200")(props)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
outline: (props) => ({
|
|
268
|
-
field: {
|
|
269
|
-
borderColor: mode("gray.300", "whiteAlpha.300")(props),
|
|
270
|
-
_hover: {
|
|
271
|
-
borderColor: mode("gray.400", "whiteAlpha.400")(props)
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}),
|
|
275
|
-
flushed: (props) => ({
|
|
276
|
-
field: {
|
|
277
|
-
borderColor: mode("gray.300", "whiteAlpha.300")(props),
|
|
278
|
-
_hover: {
|
|
279
|
-
borderColor: mode("gray.400", "whiteAlpha.400")(props)
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
238
|
},
|
|
284
|
-
|
|
285
|
-
|
|
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
|
+
}
|
|
286
250
|
}
|
|
287
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
|
+
});
|
|
288
265
|
|
|
289
266
|
// src/styles/chakraTheme/LinkStyles.ts
|
|
290
|
-
|
|
267
|
+
import { defineRecipe as defineRecipe5 } from "@chakra-ui/react";
|
|
268
|
+
var variants3 = {
|
|
291
269
|
plain: {
|
|
292
270
|
textDecoration: "none",
|
|
293
271
|
_hover: {
|
|
294
272
|
textDecoration: "underline"
|
|
295
273
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
var LinkStyles = {
|
|
299
|
-
baseStyle: {
|
|
274
|
+
},
|
|
275
|
+
underline: {
|
|
300
276
|
textDecoration: "underline",
|
|
301
277
|
_hover: {
|
|
302
278
|
textDecoration: "none"
|
|
303
279
|
}
|
|
304
|
-
},
|
|
305
|
-
variants: variants2
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
// src/styles/chakraTheme/ModalStyles.ts
|
|
309
|
-
var ModalStyles = {
|
|
310
|
-
baseStyle: {
|
|
311
|
-
// Fix for modal height on Safari iOS:
|
|
312
|
-
// https://github.com/chakra-ui/chakra-ui/issues/4680#issuecomment-1301640929
|
|
313
|
-
dialogContainer: {
|
|
314
|
-
"@supports(height: -webkit-fill-available)": {},
|
|
315
|
-
height: "100%"
|
|
316
|
-
}
|
|
317
280
|
}
|
|
318
281
|
};
|
|
282
|
+
var LinkStyles = defineRecipe5({
|
|
283
|
+
variants: {
|
|
284
|
+
variant: { ...variants3 }
|
|
285
|
+
},
|
|
286
|
+
defaultVariants: {
|
|
287
|
+
variant: "underline"
|
|
288
|
+
}
|
|
289
|
+
});
|
|
319
290
|
|
|
320
291
|
// src/styles/chakraTheme/SpinnerStyles.ts
|
|
321
|
-
import {
|
|
322
|
-
var SpinnerStyles = {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
};
|
|
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
|
+
});
|
|
330
301
|
|
|
331
302
|
// src/styles/chakraTheme/sizes.ts
|
|
332
303
|
var container = {
|
|
333
|
-
sm: "40rem",
|
|
334
|
-
md: "48rem",
|
|
335
|
-
lg: "56rem",
|
|
304
|
+
sm: { value: "40rem" },
|
|
305
|
+
md: { value: "48rem" },
|
|
306
|
+
lg: { value: "56rem" },
|
|
336
307
|
// Forsøker 56rem som standardbredde etter testing med Katrine
|
|
337
|
-
xl: "80rem"
|
|
308
|
+
xl: { value: "80rem" }
|
|
338
309
|
};
|
|
339
310
|
var sizes = {
|
|
340
311
|
container
|
|
341
312
|
};
|
|
342
313
|
|
|
343
314
|
// src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
|
353
328
|
}
|
|
354
329
|
},
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
},
|
|
365
|
-
sizes
|
|
366
|
-
};
|
|
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
|
+
});
|
|
367
339
|
|
|
368
340
|
// src/BiblioteksentralenProvider.tsx
|
|
369
|
-
|
|
370
|
-
var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, {
|
|
341
|
+
import { ColorModeProvider } from "@chakra-ui/system";
|
|
342
|
+
var BiblioteksentralenProvider = (props) => /* @__PURE__ */ React6.createElement(ChakraProvider, { value: biblioteksentralenChakraTheme }, /* @__PURE__ */ React6.createElement(ColorModeProvider, { ...props }));
|
|
371
343
|
|
|
372
344
|
// src/components/ErrorBoundary.tsx
|
|
373
|
-
import { Box as
|
|
345
|
+
import { Box as Box2 } from "@chakra-ui/react";
|
|
374
346
|
import React7 from "react";
|
|
375
|
-
var StyledPre = (props) => /* @__PURE__ */ React7.createElement(
|
|
347
|
+
var StyledPre = (props) => /* @__PURE__ */ React7.createElement(Box2, { as: "pre", paddingTop: "0.5rem", wordBreak: "break-all", whiteSpace: "pre-wrap", fontSize: "0.8rem", ...props });
|
|
376
348
|
var ErrorBoundary = class extends React7.Component {
|
|
377
349
|
constructor(props) {
|
|
378
350
|
super(props);
|
|
@@ -397,10 +369,10 @@ var ErrorBoundary = class extends React7.Component {
|
|
|
397
369
|
};
|
|
398
370
|
|
|
399
371
|
// src/components/HashLinkTarget.tsx
|
|
400
|
-
import { Box as
|
|
372
|
+
import { Box as Box3 } from "@chakra-ui/react";
|
|
401
373
|
import React8 from "react";
|
|
402
374
|
var focusOnRelativeParentStyle = {
|
|
403
|
-
|
|
375
|
+
_focusWithin: {
|
|
404
376
|
position: "static",
|
|
405
377
|
boxShadow: "none",
|
|
406
378
|
"&::after": {
|
|
@@ -417,8 +389,8 @@ var focusOnRelativeParentStyle = {
|
|
|
417
389
|
}
|
|
418
390
|
};
|
|
419
391
|
function HashLinkTarget(props) {
|
|
420
|
-
return /* @__PURE__ */ React8.createElement(
|
|
421
|
-
|
|
392
|
+
return /* @__PURE__ */ React8.createElement(Box3, { position: "relative", css: props.focusOnParent ? focusOnRelativeParentStyle : void 0 }, /* @__PURE__ */ React8.createElement(
|
|
393
|
+
Box3,
|
|
422
394
|
{
|
|
423
395
|
id: props.id,
|
|
424
396
|
tabIndex: props.focusOnParent ? -1 : void 0,
|
|
@@ -434,7 +406,7 @@ function HashLinkTarget(props) {
|
|
|
434
406
|
// src/components/withErrorBoundary.tsx
|
|
435
407
|
import React9 from "react";
|
|
436
408
|
var withErrorBoundary = (Component, boundaryName) => {
|
|
437
|
-
return
|
|
409
|
+
return (props) => /* @__PURE__ */ React9.createElement(ErrorBoundary, { boundaryName }, /* @__PURE__ */ React9.createElement(Component, { ...props }));
|
|
438
410
|
};
|
|
439
411
|
export {
|
|
440
412
|
Alert,
|