@biblioteksentralen/react 1.0.0-beta.5 → 1.0.0-beta.7
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/README.md +11 -0
- package/dist/index.d.ts +118 -14
- package/dist/index.js +999 -43
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +558 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -8
- package/.turbo/turbo-build.log +0 -8
- package/.turbo/turbo-test.log +0 -13
- package/.turbo/turbo-type-check.log +0 -4
- package/dist/BiblioteksentralenProvider.d.ts +0 -8
- package/dist/BiblioteksentralenProvider.js +0 -15
- package/dist/components/Alert.d.ts +0 -11
- package/dist/components/Alert.js +0 -59
- package/dist/components/Button.d.ts +0 -12
- package/dist/components/Button.js +0 -5
- package/dist/components/ConditionalWrapper.d.ts +0 -13
- package/dist/components/ConditionalWrapper.js +0 -15
- package/dist/components/ErrorBoundary.d.ts +0 -19
- package/dist/components/ErrorBoundary.js +0 -70
- package/dist/components/HashLinkTarget.d.ts +0 -14
- package/dist/components/HashLinkTarget.js +0 -35
- package/dist/components/HideWithCSS.d.ts +0 -10
- package/dist/components/HideWithCSS.js +0 -38
- package/dist/components/Input.d.ts +0 -15
- package/dist/components/Input.js +0 -63
- package/dist/components/Link.d.ts +0 -12
- package/dist/components/Link.js +0 -5
- package/dist/components/VisuallyHidden.d.ts +0 -6
- package/dist/components/VisuallyHidden.js +0 -68
- package/dist/components/withErrorBoundary.d.ts +0 -2
- package/dist/components/withErrorBoundary.js +0 -24
- package/dist/styles/chakraTheme/ButtonStyles.d.ts +0 -3
- package/dist/styles/chakraTheme/ButtonStyles.js +0 -52
- package/dist/styles/chakraTheme/CheckboxStyles.d.ts +0 -4
- package/dist/styles/chakraTheme/CheckboxStyles.js +0 -15
- package/dist/styles/chakraTheme/ContainerStyles.d.ts +0 -2
- package/dist/styles/chakraTheme/ContainerStyles.js +0 -8
- package/dist/styles/chakraTheme/HeadingStyles.d.ts +0 -2
- package/dist/styles/chakraTheme/HeadingStyles.js +0 -8
- package/dist/styles/chakraTheme/InputStyles.d.ts +0 -2
- package/dist/styles/chakraTheme/InputStyles.js +0 -42
- package/dist/styles/chakraTheme/LinkStyles.d.ts +0 -3
- package/dist/styles/chakraTheme/LinkStyles.js +0 -20
- package/dist/styles/chakraTheme/ModalStyles.d.ts +0 -2
- package/dist/styles/chakraTheme/ModalStyles.js +0 -13
- package/dist/styles/chakraTheme/SpinnerStyles.d.ts +0 -2
- package/dist/styles/chakraTheme/SpinnerStyles.js +0 -18
- package/dist/styles/chakraTheme/biblioteksentralenChakraTheme.d.ts +0 -2
- package/dist/styles/chakraTheme/biblioteksentralenChakraTheme.js +0 -35
- package/dist/styles/chakraTheme/sizes.d.ts +0 -8
- package/dist/styles/chakraTheme/sizes.js +0 -12
- package/src/BiblioteksentralenProvider.tsx +0 -16
- package/src/components/Alert.tsx +0 -60
- package/src/components/Button.tsx +0 -11
- package/src/components/ConditionalWrapper.tsx +0 -13
- package/src/components/ErrorBoundary.tsx +0 -60
- package/src/components/HashLinkTarget.tsx +0 -51
- package/src/components/HideWithCSS.tsx +0 -22
- package/src/components/Input.tsx +0 -37
- package/src/components/Link.tsx +0 -10
- package/src/components/VisuallyHidden.tsx +0 -36
- package/src/components/withErrorBoundary.tsx +0 -10
- package/src/index.ts +0 -16
- package/src/styles/chakraTheme/ButtonStyles.ts +0 -55
- package/src/styles/chakraTheme/CheckboxStyles.ts +0 -19
- package/src/styles/chakraTheme/ContainerStyles.ts +0 -7
- package/src/styles/chakraTheme/HeadingStyles.ts +0 -7
- package/src/styles/chakraTheme/InputStyles.ts +0 -41
- package/src/styles/chakraTheme/LinkStyles.ts +0 -23
- package/src/styles/chakraTheme/ModalStyles.ts +0 -12
- package/src/styles/chakraTheme/SpinnerStyles.ts +0 -13
- package/src/styles/chakraTheme/biblioteksentralenChakraTheme.ts +0 -34
- package/src/styles/chakraTheme/sizes.ts +0 -10
- package/tsconfig.json +0 -8
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { colors } from "@biblioteksentralen/utils";
|
|
2
|
-
import { ComponentStyleConfig } from "@chakra-ui/theme";
|
|
3
|
-
import { SystemStyleInterpolation } from "@chakra-ui/theme-tools";
|
|
4
|
-
|
|
5
|
-
export type CustomButtonVariants = "primary" | "secondary" | "tertiary";
|
|
6
|
-
|
|
7
|
-
const variants: Record<CustomButtonVariants, SystemStyleInterpolation> = {
|
|
8
|
-
primary: {
|
|
9
|
-
backgroundColor: colors.black,
|
|
10
|
-
color: "white",
|
|
11
|
-
_hover: {
|
|
12
|
-
backgroundColor: "hsla(0deg, 0%, 70%, 1)",
|
|
13
|
-
color: "black",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
secondary: {
|
|
17
|
-
borderColor: "currentColor",
|
|
18
|
-
backgroundColor: "transparent",
|
|
19
|
-
color: "currentColor",
|
|
20
|
-
_hover: {
|
|
21
|
-
backgroundColor: "hsla(0deg, 0%, 50%, 0.15)",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
tertiary: {
|
|
25
|
-
backgroundColor: "transparent",
|
|
26
|
-
color: "currentColor",
|
|
27
|
-
_hover: {
|
|
28
|
-
backgroundColor: "hsla(0deg, 0%, 50%, 0.15)",
|
|
29
|
-
color: "currentColor",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const ButtonStyles: ComponentStyleConfig = {
|
|
35
|
-
baseStyle: {
|
|
36
|
-
border: "transparent 0.1em solid",
|
|
37
|
-
borderRadius: "0.35em",
|
|
38
|
-
fontWeight: 600,
|
|
39
|
-
_disabled: {
|
|
40
|
-
backgroundColor: `${colors.grey45} !important`,
|
|
41
|
-
color: "white !important",
|
|
42
|
-
opacity: 1,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
sizes: {
|
|
46
|
-
sm: {
|
|
47
|
-
padding: "0.2em 0.5em",
|
|
48
|
-
fontSize: "1rem",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
variants: variants,
|
|
52
|
-
defaultProps: {
|
|
53
|
-
variant: "primary",
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
|
|
2
|
-
import { checkboxAnatomy } from "@chakra-ui/anatomy";
|
|
3
|
-
|
|
4
|
-
const { definePartsStyle, defineMultiStyleConfig: defineMultiStyleConfigWithTypeIssue } = createMultiStyleConfigHelpers(
|
|
5
|
-
checkboxAnatomy.keys
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
// https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437
|
|
9
|
-
const defineMultiStyleConfig: ReturnType<typeof createMultiStyleConfigHelpers>["defineMultiStyleConfig"] =
|
|
10
|
-
defineMultiStyleConfigWithTypeIssue;
|
|
11
|
-
|
|
12
|
-
const baseStyle = definePartsStyle({
|
|
13
|
-
control: {
|
|
14
|
-
background: "white",
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// https://github.com/pnpm/pnpm/issues/6089#issuecomment-1433207437
|
|
19
|
-
export const CheckboxStyles: ReturnType<typeof defineMultiStyleConfig> = defineMultiStyleConfig({ baseStyle });
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ComponentStyleConfig } from "@chakra-ui/theme";
|
|
2
|
-
import { mode } from "@chakra-ui/theme-tools";
|
|
3
|
-
|
|
4
|
-
export const InputStyles: ComponentStyleConfig = {
|
|
5
|
-
baseStyle: (props) => ({
|
|
6
|
-
field: {
|
|
7
|
-
_placeholder: {
|
|
8
|
-
color: mode("gray.500", "whiteAlpha.500")(props),
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
}),
|
|
12
|
-
variants: {
|
|
13
|
-
filled: (props) => ({
|
|
14
|
-
field: {
|
|
15
|
-
bg: mode("gray.200", "whiteAlpha.100")(props),
|
|
16
|
-
_hover: {
|
|
17
|
-
bg: mode("gray.300", "whiteAlpha.200")(props),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
outline: (props) => ({
|
|
22
|
-
field: {
|
|
23
|
-
borderColor: mode("gray.300", "whiteAlpha.300")(props),
|
|
24
|
-
_hover: {
|
|
25
|
-
borderColor: mode("gray.400", "whiteAlpha.400")(props),
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
flushed: (props) => ({
|
|
30
|
-
field: {
|
|
31
|
-
borderColor: mode("gray.300", "whiteAlpha.300")(props),
|
|
32
|
-
_hover: {
|
|
33
|
-
borderColor: mode("gray.400", "whiteAlpha.400")(props),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
defaultProps: {
|
|
39
|
-
variant: "filled",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentStyleConfig } from "@chakra-ui/theme";
|
|
2
|
-
import { SystemStyleInterpolation } from "@chakra-ui/theme-tools";
|
|
3
|
-
|
|
4
|
-
export type CustomLinkVariants = "plain";
|
|
5
|
-
|
|
6
|
-
const variants: Record<CustomLinkVariants, SystemStyleInterpolation> = {
|
|
7
|
-
plain: {
|
|
8
|
-
textDecoration: "none",
|
|
9
|
-
_hover: {
|
|
10
|
-
textDecoration: "underline",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const LinkStyles: ComponentStyleConfig = {
|
|
16
|
-
baseStyle: {
|
|
17
|
-
textDecoration: "underline",
|
|
18
|
-
_hover: {
|
|
19
|
-
textDecoration: "none",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
variants: variants,
|
|
23
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ComponentStyleConfig } from "@chakra-ui/theme";
|
|
2
|
-
|
|
3
|
-
export const ModalStyles: ComponentStyleConfig = {
|
|
4
|
-
baseStyle: {
|
|
5
|
-
// Fix for modal height on Safari iOS:
|
|
6
|
-
// https://github.com/chakra-ui/chakra-ui/issues/4680#issuecomment-1301640929
|
|
7
|
-
dialogContainer: {
|
|
8
|
-
"@supports(height: -webkit-fill-available)": {},
|
|
9
|
-
height: "100%",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { colors } from "@biblioteksentralen/utils";
|
|
2
|
-
import { Spinner } from "@chakra-ui/react";
|
|
3
|
-
import { ComponentStyleConfig } from "@chakra-ui/theme";
|
|
4
|
-
|
|
5
|
-
export const SpinnerStyles: ComponentStyleConfig = {};
|
|
6
|
-
|
|
7
|
-
Spinner.defaultProps = {
|
|
8
|
-
...Spinner.defaultProps,
|
|
9
|
-
speed: ".8s",
|
|
10
|
-
color: colors.accentBlueMedium,
|
|
11
|
-
emptyColor: "rgba(0,0,0,.2)",
|
|
12
|
-
thickness: ".175em",
|
|
13
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ChakraTheme } from "@chakra-ui/theme";
|
|
2
|
-
import { ButtonStyles } from "./ButtonStyles";
|
|
3
|
-
import { CheckboxStyles } from "./CheckboxStyles";
|
|
4
|
-
import { ContainerStyles } from "./ContainerStyles";
|
|
5
|
-
import { HeadingStyles } from "./HeadingStyles";
|
|
6
|
-
import { InputStyles } from "./InputStyles";
|
|
7
|
-
import { LinkStyles } from "./LinkStyles";
|
|
8
|
-
import { ModalStyles } from "./ModalStyles";
|
|
9
|
-
import { SpinnerStyles } from "./SpinnerStyles";
|
|
10
|
-
import { sizes } from "./sizes";
|
|
11
|
-
|
|
12
|
-
export const biblioteksentralenChakraTheme: Partial<ChakraTheme> = {
|
|
13
|
-
styles: {
|
|
14
|
-
global: {
|
|
15
|
-
html: {
|
|
16
|
-
fontSize: { base: "112.5%", md: "120%" },
|
|
17
|
-
// Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
|
|
18
|
-
// men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
|
|
19
|
-
"&:focus-within": { scrollBehavior: "smooth !important" },
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
components: {
|
|
24
|
-
Heading: HeadingStyles,
|
|
25
|
-
Spinner: SpinnerStyles,
|
|
26
|
-
Link: LinkStyles,
|
|
27
|
-
Button: ButtonStyles,
|
|
28
|
-
Input: InputStyles,
|
|
29
|
-
Container: ContainerStyles,
|
|
30
|
-
Modal: ModalStyles,
|
|
31
|
-
Checkbox: CheckboxStyles,
|
|
32
|
-
},
|
|
33
|
-
sizes,
|
|
34
|
-
};
|