@vygruppen/spor-react 13.1.3 → 13.2.0

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.
@@ -0,0 +1,197 @@
1
+ import { defineSlotRecipe } from "@chakra-ui/react";
2
+
3
+ import { checkboxCardAnatomy } from "./anatomy";
4
+
5
+ export const filterChipSlotRecipe = defineSlotRecipe({
6
+ slots: checkboxCardAnatomy.keys(),
7
+ className: "chakra-checkbox-card",
8
+ base: {
9
+ root: {
10
+ display: "inline-flex",
11
+ alignItems: "center",
12
+ boxAlign: "center",
13
+ cursor: "pointer",
14
+ transitionProperty: "all",
15
+ borderRadius: "xl",
16
+ transitionDuration: "fast",
17
+ paddingInlineStart: "2",
18
+ paddingInlineEnd: "2",
19
+
20
+ outline: "1px solid",
21
+ outlineColor: "outline.core",
22
+ _checked: {
23
+ backgroundColor: "surface.brand",
24
+ borderRadius: "sm",
25
+ outline: "none",
26
+ color: "text.brand",
27
+ _hover: {
28
+ outline: "none",
29
+ backgroundColor: "surface.brand.hover",
30
+ _active: {
31
+ backgroundColor: "surface.brand.active",
32
+ },
33
+ },
34
+ },
35
+
36
+ _focusVisible: {
37
+ outline: "2px solid",
38
+ outlineColor: "outline.focus",
39
+ outlineOffset: "1px",
40
+ },
41
+
42
+ _disabled: {
43
+ pointerEvents: "none",
44
+ boxShadow: "none",
45
+ backgroundColor: "surface.disabled",
46
+ color: "text.disabled",
47
+ outline: "none",
48
+
49
+ _hover: {
50
+ backgroundColor: "surface.disabled",
51
+ boxShadow: "none",
52
+ color: "text.disabled",
53
+ },
54
+ _checked: {
55
+ cursor: "not-allowed",
56
+ boxShadow: "none",
57
+ color: "text.disabled",
58
+ backgroundColor: "surface.disabled",
59
+ _hover: {
60
+ backgroundColor: "surface.disabled",
61
+ boxShadow: "none",
62
+ color: "text.disabled",
63
+ },
64
+ },
65
+ },
66
+ },
67
+
68
+ label: {
69
+ display: "flex",
70
+ alignItems: "center",
71
+ gap: "1",
72
+ },
73
+ },
74
+
75
+ variants: {
76
+ size: {
77
+ xs: {
78
+ root: {
79
+ _checked: {
80
+ borderRadius: "0.563rem",
81
+ },
82
+ height: 5,
83
+ paddingX: 1.5,
84
+ },
85
+ label: {
86
+ fontSize: { base: "mobile.sm", sm: "desktop.sm" },
87
+ fontWeight: "medium",
88
+ },
89
+ },
90
+ sm: {
91
+ root: {
92
+ _checked: {
93
+ borderRadius: "sm",
94
+ },
95
+ height: 6,
96
+ paddingX: 2,
97
+ },
98
+ label: {
99
+ fontSize: { base: "mobile.sm", sm: "desktop.sm" },
100
+ fontWeight: "bold",
101
+ },
102
+ },
103
+ md: {
104
+ root: {
105
+ _checked: {
106
+ borderRadius: "sm",
107
+ },
108
+ height: 7,
109
+ paddingX: 2,
110
+ },
111
+ label: {
112
+ fontSize: { base: "mobile.md", sm: "desktop.md" },
113
+ fontWeight: "bold",
114
+ },
115
+ },
116
+ lg: {
117
+ root: {
118
+ _checked: {
119
+ borderRadius: "md",
120
+ },
121
+ height: 8,
122
+ paddingX: 3,
123
+ },
124
+ label: {
125
+ fontSize: { base: "mobile.md", sm: "desktop.md" },
126
+ fontWeight: "bold",
127
+ },
128
+ },
129
+ },
130
+
131
+ variant: {
132
+ core: {
133
+ root: {
134
+ color: "text.core",
135
+ outlineColor: "outline.core",
136
+
137
+ _hover: {
138
+ outline: "2px solid",
139
+ outlineColor: "outline.core.hover",
140
+ _active: {
141
+ outline: "1px solid",
142
+ outlineColor: "outline.core",
143
+ backgroundColor: "surface.core.active",
144
+ },
145
+ },
146
+ },
147
+ },
148
+ accent: {
149
+ root: {
150
+ backgroundColor: "surface.accent",
151
+ color: "text.accent",
152
+ outline: "none",
153
+
154
+ _hover: {
155
+ backgroundColor: "surface.accent.hover",
156
+
157
+ _active: {
158
+ backgroundColor: "surface.accent.active",
159
+ },
160
+ },
161
+ },
162
+ },
163
+ floating: {
164
+ root: {
165
+ backgroundColor: "surface.floating",
166
+ outline: "1px solid",
167
+ outlineColor: "outline.floating",
168
+ color: "text.floating",
169
+
170
+ boxShadow: "sm",
171
+ _hover: {
172
+ backgroundColor: "surface.floating.hover",
173
+ outline: "1px solid",
174
+ outlineColor: "outline.floating.hover",
175
+
176
+ _active: {
177
+ backgroundColor: "surface.floating.active",
178
+ outline: "1px solid",
179
+ outlineColor: "outline.floating",
180
+ },
181
+ },
182
+ },
183
+ },
184
+ },
185
+ chipType: {
186
+ icon: {},
187
+ choice: {},
188
+ filter: {},
189
+ },
190
+ },
191
+
192
+ defaultVariants: {
193
+ size: "sm",
194
+ variant: "core",
195
+ chipType: "choice",
196
+ },
197
+ });
@@ -11,6 +11,7 @@ import { datePickerSlotRecipe } from "./datepicker";
11
11
  import { dialogSlotRecipe } from "./dialog";
12
12
  import { drawerSlotRecipe } from "./drawer";
13
13
  import { fieldSlotRecipe } from "./field";
14
+ import { filterChipSlotRecipe } from "./filter-chip";
14
15
  import { floatingActionButtonSlotRecipe } from "./floating-action-button";
15
16
  import { infoTagSlotRecipe } from "./info-tag";
16
17
  import { inputChipSlotRecipe } from "./input-chip";
@@ -68,9 +69,10 @@ export const slotRecipes = {
68
69
  tabs: tabsSlotRecipe,
69
70
  travelTag: travelTagSlotRecipe,
70
71
  toast: toastSlotRecipe,
71
- checkboxCard: choiceChipSlotRecipe,
72
+ checkboxCard: filterChipSlotRecipe,
72
73
  collapsible: collapsibleSlotRecipe,
73
74
  tooltip: popoverSlotRecipe,
74
75
  tag: inputChipSlotRecipe,
75
76
  menu: menuSlotRecipe,
77
+ choiceChip: choiceChipSlotRecipe,
76
78
  };
@@ -36,6 +36,7 @@ export const menuSlotRecipe = defineSlotRecipe({
36
36
  display: "flex",
37
37
  justifyContent: "space-between",
38
38
  gap: 1.5,
39
+ cursor: "pointer",
39
40
 
40
41
  _hover: {
41
42
  backgroundColor: "surface.accent.hover",
@@ -68,18 +69,21 @@ export const menuSlotRecipe = defineSlotRecipe({
68
69
  display: "flex",
69
70
  justifyContent: "space-between",
70
71
  gap: 2,
72
+ cursor: "pointer",
71
73
  },
72
74
  triggerItem: {
73
75
  display: "flex",
74
76
  justifyContent: "space-between",
75
77
  gap: 1.5,
76
78
  alignItems: "center",
79
+ cursor: "pointer",
77
80
  },
78
81
  checkboxItem: {
79
82
  display: "flex",
80
83
  gap: 2,
81
84
  alignItems: "center",
82
85
  width: "full",
86
+ cursor: "pointer",
83
87
  },
84
88
  },
85
89
  variants: {
@@ -9,7 +9,7 @@ export const popoverSlotRecipe = defineSlotRecipe({
9
9
  content: {
10
10
  position: "relative",
11
11
  display: "flex",
12
- flexDirection: "row-reverse",
12
+ flexDirection: "row",
13
13
  color: "text.brand",
14
14
 
15
15
  gap: "0.625rem",
@@ -35,7 +35,6 @@ export const popoverSlotRecipe = defineSlotRecipe({
35
35
  },
36
36
  body: {
37
37
  color: "text.brand",
38
-
39
38
  alignItems: "center",
40
39
  borderRadius: "sm",
41
40
  zIndex: "inherit",
@@ -34,7 +34,6 @@ export const tableSlotRecipe = defineSlotRecipe({
34
34
  ...numericStyles,
35
35
  paddingX: 1.5,
36
36
  paddingY: 1,
37
- width: "100%",
38
37
  },
39
38
  footer: {
40
39
  fontWeight: "medium",
package/src/tooltip.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Portal, Tooltip as ChakraTooltip } from "@chakra-ui/react";
3
+ import { Box, Portal, Tooltip as ChakraTooltip } from "@chakra-ui/react";
4
4
 
5
5
  export const Tooltip = ChakraTooltip.Root;
6
6
 
@@ -14,17 +14,20 @@ export const TooltipTrigger = ({
14
14
  const isStringChild = typeof children === "string";
15
15
 
16
16
  return (
17
- <ChakraTooltip.Trigger {...props} ref={ref} asChild={!isStringChild}>
18
- {children}
17
+ <ChakraTooltip.Trigger ref={ref} asChild={!isStringChild} {...props}>
18
+ {isStringChild ? children : <Box width="fit-content">{children}</Box>}
19
19
  </ChakraTooltip.Trigger>
20
20
  );
21
21
  };
22
22
 
23
- export type TooltipProps = ChakraTooltip.ContentProps;
23
+ export type TooltipProps = ChakraTooltip.ContentProps & {
24
+ showArrow?: boolean;
25
+ };
24
26
 
25
27
  export const TooltipContent = ({
26
28
  ref,
27
29
  children,
30
+ showArrow = false,
28
31
  ...props
29
32
  }: TooltipProps & {
30
33
  ref?: React.Ref<HTMLDivElement>;
@@ -33,8 +36,12 @@ export const TooltipContent = ({
33
36
  <Portal>
34
37
  <ChakraTooltip.Positioner>
35
38
  <ChakraTooltip.Content ref={ref} {...props}>
36
- <ChakraTooltip.Arrow />
37
- <ChakraTooltip.Content {...props}>{children}</ChakraTooltip.Content>
39
+ {showArrow && (
40
+ <ChakraTooltip.Arrow>
41
+ <ChakraTooltip.ArrowTip />
42
+ </ChakraTooltip.Arrow>
43
+ )}
44
+ {children}
38
45
  </ChakraTooltip.Content>
39
46
  </ChakraTooltip.Positioner>
40
47
  </Portal>