@biblioteksentralen/react 1.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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-test.log +13 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/LICENSE +21 -0
- package/dist/BiblioteksentralenProvider.d.ts +8 -0
- package/dist/BiblioteksentralenProvider.js +8 -0
- package/dist/components/Alert.d.ts +11 -0
- package/dist/components/Alert.js +52 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/Button.js +2 -0
- package/dist/components/ConditionalWrapper.d.ts +13 -0
- package/dist/components/ConditionalWrapper.js +8 -0
- package/dist/components/ErrorBoundary.d.ts +19 -0
- package/dist/components/ErrorBoundary.js +64 -0
- package/dist/components/HashLinkTarget.d.ts +14 -0
- package/dist/components/HashLinkTarget.js +28 -0
- package/dist/components/HideWithCSS.d.ts +10 -0
- package/dist/components/HideWithCSS.js +31 -0
- package/dist/components/Input.d.ts +15 -0
- package/dist/components/Input.js +37 -0
- package/dist/components/Link.d.ts +12 -0
- package/dist/components/Link.js +2 -0
- package/dist/components/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden.js +41 -0
- package/dist/components/withErrorBoundary.d.ts +2 -0
- package/dist/components/withErrorBoundary.js +17 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/styles/chakraTheme/ButtonStyles.d.ts +3 -0
- package/dist/styles/chakraTheme/ButtonStyles.js +49 -0
- package/dist/styles/chakraTheme/CheckboxStyles.d.ts +4 -0
- package/dist/styles/chakraTheme/CheckboxStyles.js +12 -0
- package/dist/styles/chakraTheme/ContainerStyles.d.ts +2 -0
- package/dist/styles/chakraTheme/ContainerStyles.js +5 -0
- package/dist/styles/chakraTheme/HeadingStyles.d.ts +2 -0
- package/dist/styles/chakraTheme/HeadingStyles.js +5 -0
- package/dist/styles/chakraTheme/InputStyles.d.ts +2 -0
- package/dist/styles/chakraTheme/InputStyles.js +39 -0
- package/dist/styles/chakraTheme/LinkStyles.d.ts +3 -0
- package/dist/styles/chakraTheme/LinkStyles.js +17 -0
- package/dist/styles/chakraTheme/ModalStyles.d.ts +2 -0
- package/dist/styles/chakraTheme/ModalStyles.js +10 -0
- package/dist/styles/chakraTheme/SpinnerStyles.d.ts +2 -0
- package/dist/styles/chakraTheme/SpinnerStyles.js +15 -0
- package/dist/styles/chakraTheme/biblioteksentralenChakraTheme.d.ts +2 -0
- package/dist/styles/chakraTheme/biblioteksentralenChakraTheme.js +32 -0
- package/dist/styles/chakraTheme/sizes.d.ts +8 -0
- package/dist/styles/chakraTheme/sizes.js +9 -0
- package/package.json +42 -0
- package/src/BiblioteksentralenProvider.tsx +16 -0
- package/src/components/Alert.tsx +60 -0
- package/src/components/Button.tsx +11 -0
- package/src/components/ConditionalWrapper.tsx +13 -0
- package/src/components/ErrorBoundary.tsx +60 -0
- package/src/components/HashLinkTarget.tsx +51 -0
- package/src/components/HideWithCSS.tsx +22 -0
- package/src/components/Input.tsx +37 -0
- package/src/components/Link.tsx +10 -0
- package/src/components/VisuallyHidden.tsx +36 -0
- package/src/components/withErrorBoundary.tsx +10 -0
- package/src/index.ts +14 -0
- package/src/styles/chakraTheme/ButtonStyles.ts +55 -0
- package/src/styles/chakraTheme/CheckboxStyles.ts +19 -0
- package/src/styles/chakraTheme/ContainerStyles.ts +7 -0
- package/src/styles/chakraTheme/HeadingStyles.ts +7 -0
- package/src/styles/chakraTheme/InputStyles.ts +41 -0
- package/src/styles/chakraTheme/LinkStyles.ts +23 -0
- package/src/styles/chakraTheme/ModalStyles.ts +12 -0
- package/src/styles/chakraTheme/SpinnerStyles.ts +13 -0
- package/src/styles/chakraTheme/biblioteksentralenChakraTheme.ts +34 -0
- package/src/styles/chakraTheme/sizes.ts +10 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
};
|