@vygruppen/spor-react 12.14.1 → 12.14.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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +41 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +42 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/button/ResponsiveButton.tsx +27 -0
- package/src/dialog/Drawer.tsx +18 -24
- package/src/input/Switch.tsx +1 -1
- package/src/theme/slot-recipes/drawer.ts +2 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "12.14.
|
4
|
+
"version": "12.14.2",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -47,8 +47,8 @@
|
|
47
47
|
"react-swipeable": "^7.0.1",
|
48
48
|
"usehooks-ts": "^3.1.0",
|
49
49
|
"@vygruppen/spor-design-tokens": "4.2.0",
|
50
|
-
"@vygruppen/spor-
|
51
|
-
"@vygruppen/spor-
|
50
|
+
"@vygruppen/spor-icon-react": "4.2.1",
|
51
|
+
"@vygruppen/spor-loader": "0.7.0"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|
54
54
|
"@react-types/datepicker": "^3.10.0",
|
@@ -68,8 +68,8 @@
|
|
68
68
|
"vitest": "^0.26.3",
|
69
69
|
"vitest-axe": "^0.1.0",
|
70
70
|
"vitest-canvas-mock": "^0.2.2",
|
71
|
-
"@vygruppen/
|
72
|
-
"@vygruppen/
|
71
|
+
"@vygruppen/tsconfig": "0.1.1",
|
72
|
+
"@vygruppen/eslint-config": "1.2.3"
|
73
73
|
},
|
74
74
|
"peerDependencies": {
|
75
75
|
"react": ">=18.0.0 <19.0.0",
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { Button, ButtonProps } from "./Button";
|
2
|
+
import { IconButton, IconButtonProps } from "./IconButton";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* For internal use
|
6
|
+
*/
|
7
|
+
|
8
|
+
type Props = IconButtonProps &
|
9
|
+
Omit<ButtonProps, "leftIcon" | "rightIcon"> & {
|
10
|
+
label: string;
|
11
|
+
};
|
12
|
+
|
13
|
+
export const ResponsiveButton = ({ label, icon, ...props }: Props) => {
|
14
|
+
return (
|
15
|
+
<>
|
16
|
+
<Button display={["none", "flex"]} leftIcon={icon} {...props}>
|
17
|
+
{label}
|
18
|
+
</Button>
|
19
|
+
<IconButton
|
20
|
+
display={["flex", "none"]}
|
21
|
+
aria-label={label}
|
22
|
+
icon={icon}
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
</>
|
26
|
+
);
|
27
|
+
};
|
package/src/dialog/Drawer.tsx
CHANGED
@@ -4,8 +4,6 @@ import {
|
|
4
4
|
Box,
|
5
5
|
createContext,
|
6
6
|
Drawer as ChakraDrawer,
|
7
|
-
Grid,
|
8
|
-
GridItem,
|
9
7
|
Portal,
|
10
8
|
useDialogContext,
|
11
9
|
} from "@chakra-ui/react";
|
@@ -16,7 +14,9 @@ import {
|
|
16
14
|
import { forwardRef } from "react";
|
17
15
|
import { useSwipeable } from "react-swipeable";
|
18
16
|
|
19
|
-
import {
|
17
|
+
import { ResponsiveButton } from "@/button/ResponsiveButton";
|
18
|
+
|
19
|
+
import { CloseButton } from "../button";
|
20
20
|
import { createTexts, useTranslation } from "../i18n";
|
21
21
|
import {
|
22
22
|
DrawerContentProps,
|
@@ -116,9 +116,11 @@ export const DrawerCloseTrigger = forwardRef<
|
|
116
116
|
return (
|
117
117
|
<ChakraDrawer.CloseTrigger ref={ref} {...props} asChild>
|
118
118
|
{size === "full" ? (
|
119
|
-
<
|
120
|
-
|
121
|
-
|
119
|
+
<ResponsiveButton
|
120
|
+
variant="ghost"
|
121
|
+
icon={<CloseFill24Icon />}
|
122
|
+
label={t(texts.close)}
|
123
|
+
/>
|
122
124
|
) : (
|
123
125
|
<CloseButton size="md" />
|
124
126
|
)}
|
@@ -132,10 +134,12 @@ export const DrawerBackTrigger = forwardRef<
|
|
132
134
|
>((props, ref) => {
|
133
135
|
const { t } = useTranslation();
|
134
136
|
return (
|
135
|
-
<ChakraDrawer.CloseTrigger asChild {...props} ref={ref}
|
136
|
-
<
|
137
|
-
|
138
|
-
|
137
|
+
<ChakraDrawer.CloseTrigger asChild {...props} ref={ref}>
|
138
|
+
<ResponsiveButton
|
139
|
+
variant="ghost"
|
140
|
+
icon={<ArrowLeftFill24Icon />}
|
141
|
+
label={t(texts.back)}
|
142
|
+
/>
|
139
143
|
</ChakraDrawer.CloseTrigger>
|
140
144
|
);
|
141
145
|
});
|
@@ -147,20 +151,10 @@ export const DrawerFullScreenHeader = forwardRef<
|
|
147
151
|
>((props, ref) => {
|
148
152
|
const { backTrigger = true, closeTrigger = true, children } = props;
|
149
153
|
return (
|
150
|
-
<ChakraDrawer.Header {...props} ref={ref}
|
151
|
-
<
|
152
|
-
|
153
|
-
|
154
|
-
</GridItem>
|
155
|
-
<GridItem width="full" alignSelf="end" asChild>
|
156
|
-
{children && <DrawerTitle>{children}</DrawerTitle>}
|
157
|
-
</GridItem>
|
158
|
-
{closeTrigger && (
|
159
|
-
<GridItem width="full" alignSelf="end">
|
160
|
-
<DrawerCloseTrigger justifySelf="end" top="0" />
|
161
|
-
</GridItem>
|
162
|
-
)}
|
163
|
-
</Grid>
|
154
|
+
<ChakraDrawer.Header {...props} ref={ref}>
|
155
|
+
<Box>{backTrigger && <DrawerBackTrigger />}</Box>
|
156
|
+
{<DrawerTitle>{children}</DrawerTitle>}
|
157
|
+
<Box> {closeTrigger && <DrawerCloseTrigger />}</Box>
|
164
158
|
</ChakraDrawer.Header>
|
165
159
|
);
|
166
160
|
});
|
package/src/input/Switch.tsx
CHANGED
@@ -78,7 +78,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
78
78
|
<ChakraSwitch.Control css={styles.control}>
|
79
79
|
<ChakraSwitch.Thumb />
|
80
80
|
</ChakraSwitch.Control>
|
81
|
-
<ChakraSwitch.Label>{label}</ChakraSwitch.Label>
|
81
|
+
{label && <ChakraSwitch.Label>{label}</ChakraSwitch.Label>}
|
82
82
|
</ChakraSwitch.Root>
|
83
83
|
</Field>
|
84
84
|
);
|
@@ -59,7 +59,8 @@ export const drawerSlotRecipe = defineSlotRecipe({
|
|
59
59
|
display: "flex",
|
60
60
|
alignItems: "center",
|
61
61
|
justifyContent: "space-between",
|
62
|
-
paddingX: ["
|
62
|
+
paddingX: ["2", null, null, "5"],
|
63
|
+
gap: "1",
|
63
64
|
paddingBottom: "1",
|
64
65
|
},
|
65
66
|
body: {
|