@vygruppen/spor-react 12.7.0 → 12.7.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 +10 -10
- package/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +321 -301
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -2
- package/dist/index.d.ts +99 -2
- package/dist/index.mjs +322 -302
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/button/ButtonGroup.tsx +5 -15
- package/src/dialog/Dialog.tsx +1 -1
- package/src/input/AttachedInputs.tsx +6 -4
- package/src/input/Input.tsx +9 -8
- package/src/layout/PressableCard.tsx +12 -5
- package/src/layout/StaticCard.tsx +6 -4
- package/src/theme/recipes/index.ts +2 -0
- package/src/theme/slot-recipes/anatomy.ts +2 -0
- package/src/theme/slot-recipes/collapsible.ts +21 -0
- package/src/theme/slot-recipes/index.ts +2 -0
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
"use client";
|
2
2
|
|
3
3
|
import {
|
4
|
-
chakra,
|
5
4
|
Group as ChakraGroup,
|
6
5
|
type GroupProps as ChakraGroupProps,
|
7
6
|
type RecipeVariantProps,
|
7
|
+
useRecipe,
|
8
8
|
} from "@chakra-ui/react";
|
9
9
|
import { forwardRef, PropsWithChildren } from "react";
|
10
10
|
|
@@ -48,23 +48,13 @@ export type ButtonGroupProps = ChakraGroupProps &
|
|
48
48
|
* </ButtonGroup>
|
49
49
|
*/
|
50
50
|
|
51
|
-
const Group = chakra(ChakraGroup, groupRecipe);
|
52
|
-
|
53
51
|
export const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(
|
54
52
|
(props, ref) => {
|
55
|
-
const
|
53
|
+
const recipe = useRecipe({ key: "buttonGroup" });
|
54
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
55
|
+
const styles = recipe(recipeProps);
|
56
56
|
|
57
|
-
return
|
58
|
-
<Group
|
59
|
-
{...rest}
|
60
|
-
ref={ref}
|
61
|
-
attached={attached}
|
62
|
-
grow={grow}
|
63
|
-
disabled={disabled}
|
64
|
-
>
|
65
|
-
{children}
|
66
|
-
</Group>
|
67
|
-
);
|
57
|
+
return <ChakraGroup {...restProps} ref={ref} css={styles} />;
|
68
58
|
},
|
69
59
|
);
|
70
60
|
ButtonGroup.displayName = "ButtonGroup";
|
package/src/dialog/Dialog.tsx
CHANGED
@@ -41,7 +41,7 @@ export const DialogCloseTrigger = React.forwardRef<
|
|
41
41
|
ChakraDialog.CloseTriggerProps
|
42
42
|
>(function DialogCloseTrigger(props, ref) {
|
43
43
|
return (
|
44
|
-
<ChakraDialog.CloseTrigger ref={ref} {...props} asChild>
|
44
|
+
<ChakraDialog.CloseTrigger ref={ref} position="absolute" {...props} asChild>
|
45
45
|
<CloseButton size="md" />
|
46
46
|
</ChakraDialog.CloseTrigger>
|
47
47
|
);
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use client";
|
2
2
|
|
3
3
|
import {
|
4
|
-
chakra,
|
5
4
|
Group,
|
6
5
|
GroupProps,
|
7
6
|
RecipeVariantProps,
|
7
|
+
useRecipe,
|
8
8
|
} from "@chakra-ui/react";
|
9
9
|
import { forwardRef } from "react";
|
10
10
|
|
@@ -28,11 +28,13 @@ export type AttachedInputsProps = RecipeVariantProps<
|
|
28
28
|
> &
|
29
29
|
GroupProps;
|
30
30
|
|
31
|
-
const StyledGroup = chakra(Group, attachedInputsRecipe);
|
32
|
-
|
33
31
|
export const AttachedInputs = forwardRef<HTMLDivElement, AttachedInputsProps>(
|
34
32
|
(props, ref) => {
|
35
|
-
|
33
|
+
const recipe = useRecipe({ key: "attachedInputs" });
|
34
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
35
|
+
const styles = recipe(recipeProps);
|
36
|
+
|
37
|
+
return <Group ref={ref} css={styles} attached {...restProps} />;
|
36
38
|
},
|
37
39
|
);
|
38
40
|
AttachedInputs.displayName = "AttachedInputs";
|
package/src/input/Input.tsx
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
|
3
3
|
import {
|
4
4
|
Box,
|
5
|
-
chakra,
|
6
5
|
Flex,
|
7
6
|
Input as ChakraInput,
|
8
7
|
InputElement,
|
8
|
+
useRecipe,
|
9
9
|
} from "@chakra-ui/react";
|
10
10
|
import React, { ComponentProps, forwardRef, ReactNode } from "react";
|
11
11
|
|
12
12
|
type ChakraInputProps = ComponentProps<typeof ChakraInput>;
|
13
13
|
|
14
|
-
import { inputRecipe } from "@/theme/recipes/input";
|
15
|
-
|
16
14
|
import { Field, FieldProps } from "./Field";
|
17
15
|
|
18
16
|
export type InputProps = FieldProps &
|
@@ -21,7 +19,7 @@ export type InputProps = FieldProps &
|
|
21
19
|
"size" | "label" | "colorPalette" | "placeholder"
|
22
20
|
> & {
|
23
21
|
/** The input's label */
|
24
|
-
label
|
22
|
+
label?: ReactNode;
|
25
23
|
/** Element that shows up to the left */
|
26
24
|
startElement?: React.ReactNode;
|
27
25
|
/** Element that shows up to the right */
|
@@ -57,8 +55,6 @@ export type InputProps = FieldProps &
|
|
57
55
|
* @see https://spor.vy.no/components/input
|
58
56
|
*/
|
59
57
|
|
60
|
-
const StyledInput = chakra(ChakraInput, inputRecipe);
|
61
|
-
|
62
58
|
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
63
59
|
(
|
64
60
|
{
|
@@ -72,6 +68,10 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
72
68
|
},
|
73
69
|
ref,
|
74
70
|
) => {
|
71
|
+
const recipe = useRecipe({ key: "input" });
|
72
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
73
|
+
const styles = recipe(recipeProps);
|
74
|
+
|
75
75
|
return (
|
76
76
|
<Field
|
77
77
|
invalid={invalid}
|
@@ -91,16 +91,17 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
91
91
|
{startElement}
|
92
92
|
</InputElement>
|
93
93
|
)}
|
94
|
-
<
|
94
|
+
<ChakraInput
|
95
95
|
data-attachable
|
96
96
|
ref={ref}
|
97
97
|
focusVisibleRing="outside"
|
98
98
|
overflow="hidden"
|
99
99
|
paddingLeft={startElement ? "2.6rem" : undefined}
|
100
100
|
paddingRight={endElement ? "2.6rem" : undefined}
|
101
|
-
{...
|
101
|
+
{...restProps}
|
102
102
|
className={`peer ${props.className}`}
|
103
103
|
placeholder=""
|
104
|
+
css={styles}
|
104
105
|
/>
|
105
106
|
{endElement && (
|
106
107
|
<InputElement placement="end" paddingX={2}>
|
@@ -1,5 +1,10 @@
|
|
1
1
|
"use client";
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
ButtonProps,
|
4
|
+
chakra,
|
5
|
+
RecipeVariantProps,
|
6
|
+
useRecipe,
|
7
|
+
} from "@chakra-ui/react";
|
3
8
|
import { forwardRef } from "react";
|
4
9
|
|
5
10
|
import { pressableCardRecipe } from "../theme/recipes/pressable-card";
|
@@ -34,14 +39,16 @@ import { pressableCardRecipe } from "../theme/recipes/pressable-card";
|
|
34
39
|
* @see StaticCard
|
35
40
|
*/
|
36
41
|
|
37
|
-
const PressableCardButton = chakra("button", pressableCardRecipe);
|
38
|
-
|
39
42
|
type PressableCardProps = RecipeVariantProps<typeof pressableCardRecipe> &
|
40
43
|
ButtonProps;
|
41
44
|
|
42
|
-
export const PressableCard = forwardRef<
|
45
|
+
export const PressableCard = forwardRef<HTMLButtonElement, PressableCardProps>(
|
43
46
|
(props, ref) => {
|
44
|
-
|
47
|
+
const recipe = useRecipe({ key: "pressableCard" });
|
48
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
49
|
+
const styles = recipe(recipeProps);
|
50
|
+
|
51
|
+
return <chakra.button {...restProps} css={styles} ref={ref} />;
|
45
52
|
},
|
46
53
|
);
|
47
54
|
PressableCard.displayName = "PressableCard";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import {
|
2
|
+
import { Box, BoxProps, RecipeVariantProps, useRecipe } from "@chakra-ui/react";
|
3
3
|
import { forwardRef } from "react";
|
4
4
|
|
5
5
|
import { staticCardRecipe } from "../theme/recipes/static-card";
|
@@ -41,14 +41,16 @@ import { staticCardRecipe } from "../theme/recipes/static-card";
|
|
41
41
|
* @see PressableCard
|
42
42
|
*/
|
43
43
|
|
44
|
-
const StyledCardBox = chakra("div", staticCardRecipe);
|
45
|
-
|
46
44
|
export type StaticCardProps = RecipeVariantProps<typeof staticCardRecipe> &
|
47
45
|
BoxProps;
|
48
46
|
|
49
47
|
export const StaticCard = forwardRef<HTMLDivElement, StaticCardProps>(
|
50
48
|
(props, ref) => {
|
51
|
-
|
49
|
+
const recipe = useRecipe({ key: "staticCard" });
|
50
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
51
|
+
const styles = recipe(recipeProps);
|
52
|
+
|
53
|
+
return <Box css={styles} {...restProps} ref={ref}></Box>;
|
52
54
|
},
|
53
55
|
);
|
54
56
|
StaticCard.displayName = "StaticCard";
|
@@ -3,6 +3,7 @@ import { badgeRecipie } from "./badge";
|
|
3
3
|
import { buttonRecipe } from "./button";
|
4
4
|
import { closeButtonRecipe } from "./close-button";
|
5
5
|
import { codeRecipie } from "./code";
|
6
|
+
import { groupRecipe } from "./group";
|
6
7
|
import { inputRecipe } from "./input";
|
7
8
|
import { linkRecipe } from "./link";
|
8
9
|
import { pressableCardRecipe } from "./pressable-card";
|
@@ -16,6 +17,7 @@ export const recipes = {
|
|
16
17
|
attachedInputs: attachedInputsRecipe,
|
17
18
|
badge: badgeRecipie,
|
18
19
|
button: buttonRecipe,
|
20
|
+
buttonGroup: groupRecipe,
|
19
21
|
closeButton: closeButtonRecipe,
|
20
22
|
code: codeRecipie,
|
21
23
|
input: inputRecipe,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
|
+
|
3
|
+
import { collapsibleAnatomy } from "./anatomy";
|
4
|
+
|
5
|
+
export const collapsibleSlotRecipe = defineSlotRecipe({
|
6
|
+
slots: collapsibleAnatomy.keys(),
|
7
|
+
className: "chakra-collapsible",
|
8
|
+
base: {
|
9
|
+
content: {
|
10
|
+
overflow: "hidden",
|
11
|
+
_open: {
|
12
|
+
animationName: "expand-height, fade-in",
|
13
|
+
animationDuration: "moderate",
|
14
|
+
},
|
15
|
+
_closed: {
|
16
|
+
animationName: "collapse-height, fade-out",
|
17
|
+
animationDuration: "moderate",
|
18
|
+
},
|
19
|
+
},
|
20
|
+
},
|
21
|
+
});
|
@@ -5,6 +5,7 @@ import { alertServiceSlotRecipe } from "./alert-service";
|
|
5
5
|
import { breadcrumbSlotRecipe } from "./breadcrumb";
|
6
6
|
import { checkboxSlotRecipe } from "./checkbox";
|
7
7
|
import { choiceChipSlotRecipe } from "./choice-chip";
|
8
|
+
import { collapsibleSlotRecipe } from "./collapsible";
|
8
9
|
import { datePickerSlotRecipe } from "./datepicker";
|
9
10
|
import { dialogSlotRecipe } from "./dialog";
|
10
11
|
import { drawerSlotRecipe } from "./drawer";
|
@@ -64,4 +65,5 @@ export const slotRecipes = {
|
|
64
65
|
travelTag: travelTagSlotRecipe,
|
65
66
|
toast: toastSlotRecipe,
|
66
67
|
checkboxCard: choiceChipSlotRecipe,
|
68
|
+
collapsible: collapsibleSlotRecipe,
|
67
69
|
};
|