@vygruppen/spor-react 9.13.1 → 9.13.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.
@@ -15,6 +15,7 @@ import React, { useEffect, useState } from "react";
15
15
  import { Button, IconButton } from "../button";
16
16
  import { createTexts, useTranslation } from "../i18n";
17
17
  import { Drawer } from "./Drawer";
18
+ import { DrawerBodyProps } from "./SimpleDrawer";
18
19
 
19
20
  type DrawerPlacement = "top" | "right" | "bottom" | "left";
20
21
 
@@ -33,6 +34,8 @@ type FullScreenDrawerProps = {
33
34
  isOpen: boolean;
34
35
  /** Function that will be called when the drawer closes */
35
36
  onClose: () => void;
37
+ /** Props for drawer body */
38
+ body?: DrawerBodyProps;
36
39
  };
37
40
 
38
41
  export const FullScreenDrawer = ({
@@ -43,6 +46,7 @@ export const FullScreenDrawer = ({
43
46
  rightButton = <DrawerCloseButton />,
44
47
  isOpen,
45
48
  onClose,
49
+ body,
46
50
  }: FullScreenDrawerProps) => {
47
51
  const [isContentBoxScrolled, setContentBoxScrolled] = useState(false);
48
52
 
@@ -75,7 +79,7 @@ export const FullScreenDrawer = ({
75
79
  leftButton={leftButton}
76
80
  rightButton={rightButton}
77
81
  />
78
- <DrawerBody overflow="auto" onScroll={onContentScroll}>
82
+ <DrawerBody overflow="auto" onScroll={onContentScroll} {...body}>
79
83
  {children}
80
84
  </DrawerBody>
81
85
  </DrawerContent>
@@ -8,12 +8,18 @@ import {
8
8
  DrawerOverlay,
9
9
  } from "./Drawer";
10
10
 
11
+ export type DrawerBodyProps = {
12
+ id?: string;
13
+ };
14
+
11
15
  export type SimpleDrawerProps = {
12
16
  children: React.ReactNode;
13
17
  title?: React.ReactNode;
14
18
  placement: "top" | "right" | "bottom" | "left";
15
19
  isOpen: boolean;
16
20
  onClose: () => void;
21
+ /** Props for drawer body */
22
+ body?: DrawerBodyProps;
17
23
  };
18
24
  /** A very basic drawer component that's easy to use
19
25
  *
@@ -29,6 +35,7 @@ export const SimpleDrawer = ({
29
35
  placement,
30
36
  children,
31
37
  title,
38
+ body,
32
39
  ...props
33
40
  }: SimpleDrawerProps) => {
34
41
  return (
@@ -37,7 +44,7 @@ export const SimpleDrawer = ({
37
44
  <DrawerContent>
38
45
  <DrawerCloseButton />
39
46
  {title && <DrawerHeader>{title}</DrawerHeader>}
40
- <DrawerBody>{children}</DrawerBody>
47
+ <DrawerBody {...body}>{children}</DrawerBody>
41
48
  </DrawerContent>
42
49
  </Drawer>
43
50
  );
@@ -1,25 +1,29 @@
1
1
  import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
2
2
  import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
3
3
  import { floatingBackground, floatingBorder } from "../utils/floating-utils";
4
- import { focusVisibleStyles } from "../utils/focus-utils";
5
- import { anatomy, mode } from "@chakra-ui/theme-tools";
4
+ import { anatomy } from "@chakra-ui/theme-tools";
6
5
  import { outlineBorder } from "../utils/outline-utils";
7
6
 
8
- const parts = anatomy("radio-card").parts("container", "checked", "radioInput");
7
+ const parts = anatomy("radio-card").parts(
8
+ "container",
9
+ "checked",
10
+ "radioInput",
11
+ "focused",
12
+ "focusedChecked",
13
+ );
9
14
  const helpers = createMultiStyleConfigHelpers(parts.keys);
10
15
 
11
16
  const config = helpers.defineMultiStyleConfig({
12
17
  baseStyle: (props: any) => ({
13
18
  container: {
14
- border: "none",
15
19
  overflow: "hidden",
16
20
  fontSize: "inherit",
17
21
  display: "block",
18
22
  cursor: "pointer",
19
23
  borderRadius: "sm",
20
- ...focusVisibleStyles(props),
21
24
  transitionProperty: "common",
22
25
  transitionDuration: "fast",
26
+
23
27
  _disabled: {
24
28
  pointerEvents: "none",
25
29
  ...baseBackground("disabled", props),
@@ -53,9 +57,6 @@ const config = helpers.defineMultiStyleConfig({
53
57
  ...baseBackground("active", props),
54
58
  ...baseBorder("active", props),
55
59
  },
56
- _focus: {
57
- ...outlineBorder("focus", props),
58
- },
59
60
  },
60
61
  checked: {
61
62
  _hover: {
@@ -65,11 +66,22 @@ const config = helpers.defineMultiStyleConfig({
65
66
  ...baseBackground("active", props),
66
67
  ...baseBorder("active", props),
67
68
  },
68
- _focus: {
69
- outline: "4px solid",
70
- outlineStyle: "double",
71
- ...outlineBorder("focus", props),
72
- outlineOffset: "-1px",
69
+ },
70
+ focusedChecked: {
71
+ outline: "4px solid",
72
+ outlineStyle: "double",
73
+ ...outlineBorder("focus", props),
74
+ outlineOffset: "-1px",
75
+ },
76
+ focused: {
77
+ outline: "2px solid",
78
+ ...outlineBorder("focus", props),
79
+ outlineOffset: "1px",
80
+ boxShadow: `inset 0 0 0 1px rgba(0, 0, 0, 0.40)`,
81
+ _hover: {
82
+ ...baseBorder("hover", props),
83
+ boxShadow: "none",
84
+ outlineOffset: "0px",
73
85
  },
74
86
  },
75
87
  }),
@@ -87,9 +99,6 @@ const config = helpers.defineMultiStyleConfig({
87
99
  ...floatingBackground("active", props),
88
100
  ...floatingBorder("active", props),
89
101
  },
90
- _focus: {
91
- ...outlineBorder("focus", props),
92
- },
93
102
  },
94
103
  checked: {
95
104
  _hover: {
@@ -100,11 +109,22 @@ const config = helpers.defineMultiStyleConfig({
100
109
  ...floatingBackground("active", props),
101
110
  ...floatingBorder("active", props),
102
111
  },
103
- _focus: {
104
- outline: "4px solid",
105
- outlineStyle: "double",
106
- ...outlineBorder("focus", props),
107
- outlineOffset: "-1px",
112
+ },
113
+ focusedChecked: {
114
+ outline: "4px solid",
115
+ outlineStyle: "double",
116
+ ...outlineBorder("focus", props),
117
+ outlineOffset: "-1px",
118
+ },
119
+ focused: {
120
+ outline: "2px solid",
121
+ ...outlineBorder("focus", props),
122
+ outlineOffset: "1px",
123
+ boxShadow: `inset 0 0 0 1px rgba(0, 0, 0, 0.10)`,
124
+ _hover: {
125
+ ...floatingBorder("hover", props),
126
+ boxShadow: "md",
127
+ outlineOffset: "0px",
108
128
  },
109
129
  },
110
130
  }),