@vygruppen/spor-react 9.4.1 → 9.6.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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/{CountryCodeSelect-5QKP6VFT.mjs → CountryCodeSelect-EZTV452W.mjs} +1 -1
- package/dist/{chunk-JRXSGTL2.mjs → chunk-7VZBL2PP.mjs} +696 -358
- package/dist/index.d.mts +800 -9
- package/dist/index.d.ts +800 -9
- package/dist/index.js +803 -427
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/card/PressableCard.tsx +52 -0
- package/src/card/index.tsx +1 -0
- package/src/index.tsx +1 -0
- package/src/pagination/Pagination.tsx +156 -0
- package/src/pagination/index.tsx +1 -0
- package/src/theme/components/datepicker.ts +2 -2
- package/src/theme/components/index.ts +2 -0
- package/src/theme/components/pagination.ts +74 -0
- package/src/theme/components/pressable-card.ts +179 -0
- package/src/theme/components/static-card.ts +3 -2
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, FullScreenDrawer, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-
|
1
|
+
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, FullScreenDrawer, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-7VZBL2PP.mjs';
|
package/package.json
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Box, BoxProps, Card, useStyleConfig } from "@chakra-ui/react";
|
3
|
+
|
4
|
+
type PressableCardProps = Omit<BoxProps, "as"> & {
|
5
|
+
variant: "floating" | "accent" | "base";
|
6
|
+
size?: "sm" | "lg";
|
7
|
+
as: "button" | "a" | "label" | React.ComponentType;
|
8
|
+
};
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Renders a Pressable card.
|
12
|
+
*
|
13
|
+
* The most basic version looks like this:
|
14
|
+
*
|
15
|
+
* ```tsx
|
16
|
+
* <PressableCard>
|
17
|
+
* Content
|
18
|
+
* </PressableCard>
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* There are lots of color schemes available. You can also set the size as either `sm` or `lg`. The default is `sm`.
|
22
|
+
*
|
23
|
+
* ```tsx
|
24
|
+
* <PressableCard colorScheme="orange" size="lg">
|
25
|
+
* A smaller card
|
26
|
+
* </PressableCard>
|
27
|
+
* ```
|
28
|
+
*
|
29
|
+
* Pressable cards can also be rendered as button, link or label – like a li (list item) or an article.
|
30
|
+
* You do this by specifying the `as` prop. If no `as` is specified, button is chosen as default:
|
31
|
+
*
|
32
|
+
*
|
33
|
+
* ```tsx
|
34
|
+
* <PressableCard colorScheme="green" as="section">
|
35
|
+
* This is now a <section /> element
|
36
|
+
* </PressableCard>
|
37
|
+
* ```
|
38
|
+
*/
|
39
|
+
export const PressableCard = ({
|
40
|
+
children,
|
41
|
+
as = "button",
|
42
|
+
size = "sm",
|
43
|
+
variant = "base",
|
44
|
+
...props
|
45
|
+
}: PressableCardProps) => {
|
46
|
+
const styles = useStyleConfig("PressableCard", { variant, size });
|
47
|
+
return (
|
48
|
+
<Box as={as} __css={styles} {...props}>
|
49
|
+
{children}
|
50
|
+
</Box>
|
51
|
+
);
|
52
|
+
};
|
package/src/card/index.tsx
CHANGED
package/src/index.tsx
CHANGED
@@ -0,0 +1,156 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Center, createTexts, useTranslation, Flex, TextLink } from "..";
|
3
|
+
import {
|
4
|
+
ListItem,
|
5
|
+
UnorderedList,
|
6
|
+
useMultiStyleConfig,
|
7
|
+
Link,
|
8
|
+
} from "@chakra-ui/react";
|
9
|
+
import {
|
10
|
+
DropdownLeftFill18Icon,
|
11
|
+
DropdownRightFill18Icon,
|
12
|
+
} from "@vygruppen/spor-icon-react";
|
13
|
+
|
14
|
+
type PaginationProps = {
|
15
|
+
/** Specify the total amount of pages */
|
16
|
+
totalPages: number;
|
17
|
+
/** Specify the currently selected page */
|
18
|
+
selectedPage: number;
|
19
|
+
/** Callback for when a page is clicked */
|
20
|
+
onPageChange: (selected: number) => void;
|
21
|
+
};
|
22
|
+
|
23
|
+
/**
|
24
|
+
* A pagination component is used to navigate between multiple pages.
|
25
|
+
*
|
26
|
+
* You specify the total amount of pages and the currently selected page.
|
27
|
+
*
|
28
|
+
* ```tsx
|
29
|
+
* <Pagination
|
30
|
+
* totalPages={10}
|
31
|
+
* selectedPage={3}
|
32
|
+
* onPageChange={handlePageChange}
|
33
|
+
* />
|
34
|
+
* ```
|
35
|
+
**/
|
36
|
+
|
37
|
+
export const Pagination = ({
|
38
|
+
totalPages,
|
39
|
+
selectedPage,
|
40
|
+
onPageChange,
|
41
|
+
}: PaginationProps) => {
|
42
|
+
const { t } = useTranslation();
|
43
|
+
|
44
|
+
const style = useMultiStyleConfig("Pagination", { selectedPage });
|
45
|
+
|
46
|
+
const hasPreviousPage = selectedPage > 1;
|
47
|
+
const hasNextPage = selectedPage < totalPages;
|
48
|
+
|
49
|
+
const renderPaginationButtons = () => {
|
50
|
+
const displayPageNumbers = [];
|
51
|
+
const maxVisiblePages = 8;
|
52
|
+
if (totalPages <= maxVisiblePages) {
|
53
|
+
displayPageNumbers.push(
|
54
|
+
...Array.from({ length: totalPages }, (_, i) => i + 1),
|
55
|
+
);
|
56
|
+
} else {
|
57
|
+
if (selectedPage <= Math.floor(maxVisiblePages / 2) + 1) {
|
58
|
+
// If selectedPage is near the beginning, display the first pages.
|
59
|
+
displayPageNumbers.push(
|
60
|
+
...Array.from({ length: maxVisiblePages - 1 }, (_, i) => i + 1),
|
61
|
+
);
|
62
|
+
displayPageNumbers.push("...");
|
63
|
+
displayPageNumbers.push(totalPages);
|
64
|
+
} else if (selectedPage >= totalPages - Math.floor(maxVisiblePages / 2)) {
|
65
|
+
// If selectedPage is near the end, display the last pages.
|
66
|
+
displayPageNumbers.push(1);
|
67
|
+
displayPageNumbers.push("...");
|
68
|
+
displayPageNumbers.push(
|
69
|
+
...Array.from(
|
70
|
+
{ length: maxVisiblePages - 1 },
|
71
|
+
(_, i) => totalPages - maxVisiblePages + 2 + i,
|
72
|
+
),
|
73
|
+
);
|
74
|
+
} else {
|
75
|
+
// Display pages with "..." in the middle.
|
76
|
+
displayPageNumbers.push(1);
|
77
|
+
displayPageNumbers.push("...");
|
78
|
+
for (
|
79
|
+
let i = selectedPage - Math.floor((maxVisiblePages - 3) / 2);
|
80
|
+
i <= selectedPage + Math.floor((maxVisiblePages - 3) / 2);
|
81
|
+
i++
|
82
|
+
) {
|
83
|
+
displayPageNumbers.push(i);
|
84
|
+
}
|
85
|
+
displayPageNumbers.push("...");
|
86
|
+
displayPageNumbers.push(totalPages);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return displayPageNumbers.map((pageNumber, index) =>
|
90
|
+
pageNumber === "..." ? (
|
91
|
+
<ListItem key={index} sx={style.listItem}>
|
92
|
+
<Center>...</Center>
|
93
|
+
</ListItem>
|
94
|
+
) : (
|
95
|
+
<Link
|
96
|
+
key={index}
|
97
|
+
as={ListItem}
|
98
|
+
onClick={() => {
|
99
|
+
if (pageNumber !== "...") {
|
100
|
+
onPageChange(+pageNumber);
|
101
|
+
}
|
102
|
+
}}
|
103
|
+
padding={pageNumber === "..." ? 0 : undefined}
|
104
|
+
sx={pageNumber === selectedPage ? style.activeButton : style.link}
|
105
|
+
>
|
106
|
+
{pageNumber}
|
107
|
+
</Link>
|
108
|
+
),
|
109
|
+
);
|
110
|
+
};
|
111
|
+
|
112
|
+
return (
|
113
|
+
<Flex as="nav" aria-label="pagination">
|
114
|
+
<UnorderedList
|
115
|
+
display="flex"
|
116
|
+
listStyleType="none"
|
117
|
+
gap={[0, 1]}
|
118
|
+
padding={0}
|
119
|
+
margin={0}
|
120
|
+
>
|
121
|
+
<ListItem aria-label={t(texts.previousPage)}>
|
122
|
+
<TextLink
|
123
|
+
onClick={() => onPageChange(selectedPage - 1)}
|
124
|
+
sx={hasPreviousPage ? style.link : style.disabled}
|
125
|
+
>
|
126
|
+
<DropdownLeftFill18Icon sx={style.icon} />
|
127
|
+
</TextLink>
|
128
|
+
</ListItem>
|
129
|
+
{renderPaginationButtons()}
|
130
|
+
<ListItem aria-label={t(texts.nextPage)}>
|
131
|
+
<TextLink
|
132
|
+
onClick={() => onPageChange(selectedPage + 1)}
|
133
|
+
sx={hasNextPage ? style.link : style.disabled}
|
134
|
+
>
|
135
|
+
<DropdownRightFill18Icon sx={style.icon} />
|
136
|
+
</TextLink>
|
137
|
+
</ListItem>
|
138
|
+
</UnorderedList>
|
139
|
+
</Flex>
|
140
|
+
);
|
141
|
+
};
|
142
|
+
|
143
|
+
const texts = createTexts({
|
144
|
+
previousPage: {
|
145
|
+
nb: "Forrige side",
|
146
|
+
nn: "Førre side",
|
147
|
+
en: "Previous page",
|
148
|
+
sv: "Föregående sida",
|
149
|
+
},
|
150
|
+
nextPage: {
|
151
|
+
nb: "Neste side",
|
152
|
+
nn: "Neste side",
|
153
|
+
en: "Next page",
|
154
|
+
sv: "Nästa sida",
|
155
|
+
},
|
156
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Pagination";
|
@@ -87,9 +87,9 @@ const config = helpers.defineMultiStyleConfig({
|
|
87
87
|
[$arrowBackground.variable]: surface("default", props).backgroundColor,
|
88
88
|
},
|
89
89
|
calendarPopover: {
|
90
|
-
...
|
90
|
+
...floatingBackground("default", props),
|
91
91
|
...baseText("default", props),
|
92
|
-
...
|
92
|
+
...floatingBorder("default", props),
|
93
93
|
boxShadow: "md",
|
94
94
|
},
|
95
95
|
weekdays: {
|
@@ -26,6 +26,7 @@ export { default as ListBox } from "./listbox";
|
|
26
26
|
export { default as MediaControllerButton } from "./media-controller-button";
|
27
27
|
export { default as Modal } from "./modal";
|
28
28
|
export { default as NumericStepper } from "./numeric-stepper";
|
29
|
+
export { default as Pagination } from "./pagination";
|
29
30
|
export { default as Popover } from "./popover";
|
30
31
|
export { default as ProgressBar } from "./progress-bar";
|
31
32
|
export { default as ProgressIndicator } from "./progress-indicator";
|
@@ -39,4 +40,5 @@ export { default as Tabs } from "./tabs";
|
|
39
40
|
export { default as Textarea } from "./textarea";
|
40
41
|
export { default as Toast } from "./toast";
|
41
42
|
export { default as StaticCard } from "./static-card";
|
43
|
+
export { default as PressableCard } from "./pressable-card";
|
42
44
|
export { default as TravelTag } from "./travel-tag";
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
|
2
|
+
import { anatomy } from "@chakra-ui/theme-tools";
|
3
|
+
import { ghostBackground } from "../utils/ghost-utils";
|
4
|
+
import { baseText } from "../utils/base-utils";
|
5
|
+
|
6
|
+
const parts = anatomy("Pagination").parts(
|
7
|
+
"listItem",
|
8
|
+
"link",
|
9
|
+
"activeButton",
|
10
|
+
"disabled",
|
11
|
+
"icon",
|
12
|
+
);
|
13
|
+
|
14
|
+
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
15
|
+
|
16
|
+
const config = helpers.defineMultiStyleConfig({
|
17
|
+
baseStyle: (props: any) => ({
|
18
|
+
activeButton: {
|
19
|
+
fontWeight: "bold",
|
20
|
+
...commonStyles,
|
21
|
+
...ghostBackground("active", props),
|
22
|
+
_hover: {
|
23
|
+
...ghostBackground("hover", props),
|
24
|
+
borderRadius: 50,
|
25
|
+
},
|
26
|
+
_active: {
|
27
|
+
borderRadius: 50,
|
28
|
+
...ghostBackground("active", props),
|
29
|
+
},
|
30
|
+
},
|
31
|
+
disabled: {
|
32
|
+
...commonStyles,
|
33
|
+
cursor: "not-allowed",
|
34
|
+
pointerEvents: "none",
|
35
|
+
boxShadow: "none",
|
36
|
+
...baseText("disabled", props),
|
37
|
+
},
|
38
|
+
listItem: {
|
39
|
+
display: "flex",
|
40
|
+
},
|
41
|
+
link: {
|
42
|
+
...commonStyles,
|
43
|
+
...ghostBackground("default", props),
|
44
|
+
...baseText("default", props),
|
45
|
+
_hover: {
|
46
|
+
...ghostBackground("hover", props),
|
47
|
+
borderRadius: 50,
|
48
|
+
_disabled: {
|
49
|
+
...baseText("disabled", props),
|
50
|
+
},
|
51
|
+
},
|
52
|
+
_active: {
|
53
|
+
borderRadius: 50,
|
54
|
+
...ghostBackground("active", props),
|
55
|
+
},
|
56
|
+
},
|
57
|
+
icon: {
|
58
|
+
bottom: "-0.03em !important",
|
59
|
+
},
|
60
|
+
}),
|
61
|
+
});
|
62
|
+
|
63
|
+
const commonStyles = {
|
64
|
+
display: "flex",
|
65
|
+
alignItems: "center",
|
66
|
+
justifyContent: "center",
|
67
|
+
width: 5,
|
68
|
+
height: 5,
|
69
|
+
backgroundImage: "none",
|
70
|
+
borderRadius: 50,
|
71
|
+
fontSize: "xs",
|
72
|
+
};
|
73
|
+
|
74
|
+
export default config;
|
@@ -0,0 +1,179 @@
|
|
1
|
+
import { defineStyleConfig } from "@chakra-ui/react";
|
2
|
+
import { mode } from "@chakra-ui/theme-tools";
|
3
|
+
import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
|
4
|
+
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
5
|
+
import { focusVisibleStyles } from "../utils/focus-utils";
|
6
|
+
import { accentBackground, accentText } from "../utils/accent-utils";
|
7
|
+
|
8
|
+
const config = defineStyleConfig({
|
9
|
+
baseStyle: (props: any) => ({
|
10
|
+
appearance: "none",
|
11
|
+
border: "none",
|
12
|
+
overflow: "hidden",
|
13
|
+
fontSize: "inherit",
|
14
|
+
display: "block",
|
15
|
+
borderRadius: "md",
|
16
|
+
...getColorSchemeBaseProps(props),
|
17
|
+
...getColorSchemeClickableProps(props),
|
18
|
+
...focusVisibleStyles(props),
|
19
|
+
...getColorSchemeActiveProps(props),
|
20
|
+
_hover: getColorSchemeHoverProps(props),
|
21
|
+
_disabled: {
|
22
|
+
...baseBackground("disabled", props),
|
23
|
+
...baseBorder("disabled", props),
|
24
|
+
...baseText("disabled", props),
|
25
|
+
pointerEvents: "none",
|
26
|
+
},
|
27
|
+
}),
|
28
|
+
variants: {
|
29
|
+
base: (props) => ({
|
30
|
+
...baseBackground("default", props),
|
31
|
+
_hover: {
|
32
|
+
...baseBackground("hover", props),
|
33
|
+
},
|
34
|
+
_active: {
|
35
|
+
...baseBackground("active", props),
|
36
|
+
},
|
37
|
+
}),
|
38
|
+
accent: (props) => ({
|
39
|
+
...accentBackground("default", props),
|
40
|
+
_hover: {
|
41
|
+
...accentBackground("hover", props),
|
42
|
+
},
|
43
|
+
_active: {
|
44
|
+
...accentBackground("active", props),
|
45
|
+
},
|
46
|
+
}),
|
47
|
+
floating: (props) => ({
|
48
|
+
...floatingBackground("default", props),
|
49
|
+
_hover: {
|
50
|
+
...floatingBackground("hover", props),
|
51
|
+
},
|
52
|
+
_active: {
|
53
|
+
...floatingBackground("active", props),
|
54
|
+
},
|
55
|
+
}),
|
56
|
+
},
|
57
|
+
sizes: {
|
58
|
+
sm: {
|
59
|
+
boxShadow: "sm",
|
60
|
+
|
61
|
+
_hover: {
|
62
|
+
boxShadow: "md",
|
63
|
+
},
|
64
|
+
|
65
|
+
_active: {
|
66
|
+
boxShadow: "none",
|
67
|
+
},
|
68
|
+
},
|
69
|
+
lg: {
|
70
|
+
boxShadow: "md",
|
71
|
+
|
72
|
+
_hover: {
|
73
|
+
boxShadow: "lg",
|
74
|
+
},
|
75
|
+
|
76
|
+
_active: {
|
77
|
+
boxShadow: "sm",
|
78
|
+
},
|
79
|
+
},
|
80
|
+
},
|
81
|
+
});
|
82
|
+
|
83
|
+
export default config;
|
84
|
+
|
85
|
+
type CardThemeProps = {
|
86
|
+
colorScheme: "accent" | "default";
|
87
|
+
theme: any;
|
88
|
+
colorMode: "light" | "dark";
|
89
|
+
};
|
90
|
+
|
91
|
+
const getColorSchemeBaseProps = (props: CardThemeProps) => {
|
92
|
+
switch (props.colorScheme) {
|
93
|
+
case "default":
|
94
|
+
return {
|
95
|
+
...baseBorder("default", props),
|
96
|
+
backgroundColor: mode(
|
97
|
+
"white",
|
98
|
+
`color-mix(in srgb, white 10%, var(--spor-colors-bg-default-dark))`,
|
99
|
+
)(props),
|
100
|
+
color: "inherit",
|
101
|
+
};
|
102
|
+
case "accent":
|
103
|
+
return {
|
104
|
+
...accentBackground("default", props),
|
105
|
+
...accentText("default", props),
|
106
|
+
_hover: {
|
107
|
+
...accentBackground("hover", props),
|
108
|
+
},
|
109
|
+
_active: {
|
110
|
+
...accentBackground("active", props),
|
111
|
+
},
|
112
|
+
};
|
113
|
+
}
|
114
|
+
};
|
115
|
+
|
116
|
+
function getColorSchemeClickableProps(props: CardThemeProps) {
|
117
|
+
switch (props.colorScheme) {
|
118
|
+
case "default":
|
119
|
+
return {
|
120
|
+
...floatingBorder("default", props),
|
121
|
+
};
|
122
|
+
case "accent":
|
123
|
+
return {
|
124
|
+
...accentBackground("default", props),
|
125
|
+
...accentText("default", props),
|
126
|
+
_hover: {
|
127
|
+
...accentBackground("hover", props),
|
128
|
+
},
|
129
|
+
_active: {
|
130
|
+
...accentBackground("active", props),
|
131
|
+
},
|
132
|
+
};
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
const getColorSchemeHoverProps = (props: CardThemeProps) => {
|
137
|
+
switch (props.colorScheme) {
|
138
|
+
case "default":
|
139
|
+
return {
|
140
|
+
backgroundColor: mode(
|
141
|
+
"white",
|
142
|
+
`color-mix(in srgb, white 20%, var(--spor-colors-bg-default-dark))`,
|
143
|
+
)(props),
|
144
|
+
...floatingBorder("hover", props),
|
145
|
+
};
|
146
|
+
case "accent":
|
147
|
+
return {
|
148
|
+
...accentBackground("default", props),
|
149
|
+
...accentText("default", props),
|
150
|
+
_hover: {
|
151
|
+
...accentBackground("hover", props),
|
152
|
+
},
|
153
|
+
_active: {
|
154
|
+
...accentBackground("active", props),
|
155
|
+
},
|
156
|
+
};
|
157
|
+
}
|
158
|
+
};
|
159
|
+
const getColorSchemeActiveProps = (props: CardThemeProps) => {
|
160
|
+
const { colorScheme } = props;
|
161
|
+
switch (colorScheme) {
|
162
|
+
case "default":
|
163
|
+
return {
|
164
|
+
backgroundColor: mode("bg.tertiary.light", `bg.default.dark`)(props),
|
165
|
+
...floatingBorder("active", props),
|
166
|
+
};
|
167
|
+
case "accent":
|
168
|
+
return {
|
169
|
+
...accentBackground("default", props),
|
170
|
+
...accentText("default", props),
|
171
|
+
_hover: {
|
172
|
+
...accentBackground("hover", props),
|
173
|
+
},
|
174
|
+
_active: {
|
175
|
+
...accentBackground("active", props),
|
176
|
+
},
|
177
|
+
};
|
178
|
+
}
|
179
|
+
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { defineStyleConfig } from "@chakra-ui/react";
|
2
2
|
import { mode } from "@chakra-ui/theme-tools";
|
3
3
|
import { colors } from "../foundations";
|
4
|
-
import { baseBorder } from "../utils/base-utils";
|
4
|
+
import { baseBorder, baseText } from "../utils/base-utils";
|
5
5
|
|
6
6
|
const config = defineStyleConfig({
|
7
7
|
baseStyle: (props: any) => ({
|
@@ -60,7 +60,8 @@ const getColorSchemeBaseProps = (props: CardThemeProps) => {
|
|
60
60
|
}
|
61
61
|
default:
|
62
62
|
return {
|
63
|
-
backgroundColor: colors[props.colorScheme]?.[100] ?? "
|
63
|
+
backgroundColor: colors[props.colorScheme]?.[100] ?? "default",
|
64
|
+
...baseText("default", props),
|
64
65
|
};
|
65
66
|
}
|
66
67
|
};
|