@vygruppen/spor-react 9.9.0 → 9.10.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 +9 -9
- package/CHANGELOG.md +18 -0
- package/dist/{CountryCodeSelect-U25NF65N.mjs → CountryCodeSelect-CO6P2KH4.mjs} +1 -1
- package/dist/{chunk-TEDOVPXZ.mjs → chunk-QOPSLFKS.mjs} +178 -180
- package/dist/index.d.mts +165 -74
- package/dist/index.d.ts +165 -74
- package/dist/index.js +2598 -2604
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/layout/RadioCard.tsx +44 -35
- package/src/layout/RadioCardGroup.tsx +9 -5
- package/src/media-controller/JumpButton.tsx +6 -3
- package/src/media-controller/PlayPauseButton.tsx +6 -3
- package/src/media-controller/SkipButton.tsx +6 -3
- package/src/theme/components/media-controller-button.ts +20 -11
- package/src/theme/components/pressable-card.ts +4 -1
- package/src/theme/components/radio-card.ts +79 -40
- package/src/theme/components/static-card.ts +4 -2
- package/src/theme/utils/base-utils.ts +5 -2
- package/src/theme/utils/outline-utils.ts +26 -0
- package/src/theme/utils/types.ts +3 -1
- package/src/media-controller/icons.tsx +0 -80
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, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, 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, RadioCard, RadioCardGroup, 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-QOPSLFKS.mjs';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.10.1",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"@emotion/react": "^11.10.4",
|
23
23
|
"@emotion/styled": "^11.10.4",
|
24
24
|
"@internationalized/date": "^3.0.1",
|
25
|
-
"@vygruppen/spor-design-tokens": ">3.
|
25
|
+
"@vygruppen/spor-design-tokens": ">3.6.0",
|
26
26
|
"@vygruppen/spor-icon-react": ">3.6.0",
|
27
27
|
"@vygruppen/spor-loader": ">0.3.1",
|
28
28
|
"awesome-phonenumber": "^5.10.0",
|
package/src/layout/RadioCard.tsx
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
import {
|
2
|
+
Box,
|
2
3
|
BoxProps,
|
3
4
|
UseRadioProps,
|
4
5
|
chakra,
|
5
6
|
forwardRef,
|
6
|
-
|
7
|
-
useStyleConfig,
|
7
|
+
useMultiStyleConfig,
|
8
8
|
} from "@chakra-ui/react";
|
9
|
-
import { dataAttr } from "@chakra-ui/utils";
|
10
9
|
import React, { useId } from "react";
|
11
10
|
|
12
|
-
export type RadioCardProps = UseRadioProps &
|
13
|
-
BoxProps & {
|
14
|
-
children: React.ReactNode;
|
15
|
-
/** Defaults to "base" */
|
16
|
-
variant: "floating" | "base";
|
17
|
-
};
|
18
|
-
|
19
11
|
/**
|
20
|
-
*
|
12
|
+
* Radio cards are used to present a set of options where only one option can be selected.
|
21
13
|
*
|
22
14
|
* The most basic version looks like this:
|
23
15
|
*
|
@@ -27,6 +19,14 @@ export type RadioCardProps = UseRadioProps &
|
|
27
19
|
* </RadioCard>
|
28
20
|
* ```
|
29
21
|
*
|
22
|
+
* In order to use RadioCard outside a RadioCardGroup, you need to pass the `isChecked` and `onChange` props.
|
23
|
+
*
|
24
|
+
* ```tsx
|
25
|
+
* <RadioCard isChecked={true} onChange={(e) => console.log(e.target.value)}>
|
26
|
+
* Content
|
27
|
+
* </RadioCard>
|
28
|
+
* ```
|
29
|
+
*
|
30
30
|
* In order to use RadioCard, you typically want to place these components in a group with several other RadioCards.
|
31
31
|
*
|
32
32
|
* ```tsx
|
@@ -59,38 +59,47 @@ export type RadioCardProps = UseRadioProps &
|
|
59
59
|
* ```
|
60
60
|
*/
|
61
61
|
|
62
|
-
export
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
export type RadioCardProps = UseRadioProps &
|
63
|
+
BoxProps & {
|
64
|
+
children: React.ReactNode;
|
65
|
+
/** Defaults to "base" */
|
66
|
+
variant?: "floating" | "base";
|
67
|
+
/** Needs to be defined if RadioCard is used outside RadioCardGroup */
|
68
|
+
isChecked?: boolean;
|
69
|
+
/** Needs to be defined if RadioCard is used outside RadioCardGroup */
|
70
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
71
|
+
};
|
68
72
|
|
69
|
-
|
70
|
-
|
73
|
+
export const RadioCard = forwardRef<RadioCardProps, "div">(
|
74
|
+
({ children, variant = "base", isChecked, onChange, ...props }, ref) => {
|
75
|
+
const styles = useMultiStyleConfig("RadioCard", { variant });
|
71
76
|
|
72
77
|
const id = `radio-card-${useId()}`;
|
73
78
|
|
79
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
80
|
+
onChange && onChange(event);
|
81
|
+
};
|
82
|
+
|
74
83
|
return (
|
75
|
-
<
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
data-hover={dataAttr(state.isHovered)}
|
86
|
-
data-focus={dataAttr(state.isFocused)}
|
87
|
-
data-active={dataAttr(state.isActive)}
|
88
|
-
data-disabled={dataAttr(state.isDisabled)}
|
84
|
+
<Box as="label" htmlFor={id} aria-label={String(children)} ref={ref}>
|
85
|
+
<chakra.input
|
86
|
+
type="radio"
|
87
|
+
id={id}
|
88
|
+
checked={isChecked}
|
89
|
+
onChange={handleChange}
|
90
|
+
{...props}
|
91
|
+
sx={styles.radioInput}
|
92
|
+
/>
|
93
|
+
<Box
|
89
94
|
{...props}
|
95
|
+
__css={{
|
96
|
+
...styles.container,
|
97
|
+
...(isChecked && styles.checked),
|
98
|
+
}}
|
90
99
|
>
|
91
100
|
{children}
|
92
|
-
</
|
93
|
-
</
|
101
|
+
</Box>
|
102
|
+
</Box>
|
94
103
|
);
|
95
104
|
},
|
96
105
|
);
|
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
StackDirection,
|
5
5
|
Stack,
|
6
6
|
} from "@chakra-ui/react";
|
7
|
-
import React
|
7
|
+
import React from "react";
|
8
8
|
import { RadioCard, RadioCardProps } from "./RadioCard";
|
9
9
|
|
10
10
|
type RadioCardGroupProps = RadioGroupProps & {
|
@@ -75,17 +75,21 @@ export const RadioCardGroup = ({
|
|
75
75
|
...props,
|
76
76
|
});
|
77
77
|
|
78
|
-
const
|
78
|
+
const rootProps = getRootProps();
|
79
79
|
|
80
80
|
return (
|
81
|
-
<Stack direction={direction} {...
|
81
|
+
<Stack direction={direction} {...rootProps}>
|
82
82
|
{recursiveMap(children, (child: React.ReactElement) => {
|
83
83
|
if (child.type === RadioCard) {
|
84
|
-
const
|
84
|
+
const radioProps = getRadioProps({ value: child.props.value });
|
85
85
|
const variantValue = variant as "base" | "floating" | undefined;
|
86
86
|
return React.cloneElement(
|
87
87
|
child as React.ReactElement<RadioCardProps>,
|
88
|
-
{
|
88
|
+
{
|
89
|
+
...radioProps,
|
90
|
+
variant: variantValue,
|
91
|
+
...props,
|
92
|
+
},
|
89
93
|
);
|
90
94
|
}
|
91
95
|
return child;
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { BoxProps, Center, useMultiStyleConfig } from "@chakra-ui/react";
|
2
2
|
import React from "react";
|
3
3
|
import { createTexts, useTranslation } from "..";
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
Backward15MediaControllerFill30Icon,
|
6
|
+
Forward15MediaControllerFill30Icon,
|
7
|
+
} from "@vygruppen/spor-icon-react";
|
5
8
|
|
6
9
|
type JumpButtonProps = BoxProps & {
|
7
10
|
onClick: () => void;
|
@@ -45,9 +48,9 @@ export const JumpButton = ({
|
|
45
48
|
{...props}
|
46
49
|
>
|
47
50
|
{direction === "forward" ? (
|
48
|
-
<
|
51
|
+
<Forward15MediaControllerFill30Icon sx={styles.icon} />
|
49
52
|
) : (
|
50
|
-
<
|
53
|
+
<Backward15MediaControllerFill30Icon sx={styles.icon} />
|
51
54
|
)}
|
52
55
|
</Center>
|
53
56
|
);
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { BoxProps, Center, useMultiStyleConfig } from "@chakra-ui/react";
|
2
2
|
import React from "react";
|
3
3
|
import { createTexts, useTranslation } from "..";
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
PauseMediaControllerFill24Icon,
|
6
|
+
PlayMediaControllerFill24Icon,
|
7
|
+
} from "@vygruppen/spor-icon-react";
|
5
8
|
|
6
9
|
type PlayPauseButtonProps = BoxProps & {
|
7
10
|
onClick: () => void;
|
@@ -43,9 +46,9 @@ export const PlayPauseButton = ({
|
|
43
46
|
{...props}
|
44
47
|
>
|
45
48
|
{isPlaying ? (
|
46
|
-
<
|
49
|
+
<PauseMediaControllerFill24Icon sx={styles.icon} />
|
47
50
|
) : (
|
48
|
-
<
|
51
|
+
<PlayMediaControllerFill24Icon sx={styles.icon} />
|
49
52
|
)}
|
50
53
|
</Center>
|
51
54
|
);
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { BoxProps, Center, useMultiStyleConfig } from "@chakra-ui/react";
|
2
2
|
import React from "react";
|
3
3
|
import { createTexts, useTranslation } from "..";
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
NextMediaControllerFill30Icon,
|
6
|
+
PreviousMediaControllerFill30Icon,
|
7
|
+
} from "@vygruppen/spor-icon-react";
|
5
8
|
|
6
9
|
type SkipButtonProps = BoxProps & {
|
7
10
|
onClick: () => void;
|
@@ -42,9 +45,9 @@ export const SkipButton = ({
|
|
42
45
|
{...props}
|
43
46
|
>
|
44
47
|
{direction === "forward" ? (
|
45
|
-
<
|
48
|
+
<NextMediaControllerFill30Icon sx={styles.icon} />
|
46
49
|
) : (
|
47
|
-
<
|
50
|
+
<PreviousMediaControllerFill30Icon sx={styles.icon} />
|
48
51
|
)}
|
49
52
|
</Center>
|
50
53
|
);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
|
2
|
-
import { anatomy } from "@chakra-ui/theme-tools";
|
2
|
+
import { anatomy, mode } from "@chakra-ui/theme-tools";
|
3
3
|
import { baseText } from "../utils/base-utils";
|
4
|
-
import { brandBackground } from "../utils/brand-utils";
|
4
|
+
import { brandBackground, brandText } from "../utils/brand-utils";
|
5
5
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
6
6
|
import { ghostBackground } from "../utils/ghost-utils";
|
7
7
|
import { surface } from "../utils/surface-utils";
|
@@ -38,16 +38,21 @@ const config = helpers.defineMultiStyleConfig({
|
|
38
38
|
play: (props) => ({
|
39
39
|
container: {
|
40
40
|
padding: 0,
|
41
|
+
...brandText("default", props),
|
42
|
+
...brandBackground("default", props),
|
41
43
|
_hover: {
|
42
|
-
|
44
|
+
...brandText("default", props),
|
45
|
+
...brandBackground("hover", props),
|
43
46
|
},
|
44
47
|
_active: {
|
45
|
-
|
48
|
+
...brandText("default", props),
|
49
|
+
...brandBackground("active", props),
|
46
50
|
},
|
47
51
|
|
48
52
|
_disabled: {
|
49
53
|
pointerEvents: "none",
|
50
|
-
color:
|
54
|
+
color: mode("icon.disabled.light", "icon.disabled.dark")(props),
|
55
|
+
...surface("disabled", props),
|
51
56
|
},
|
52
57
|
},
|
53
58
|
}),
|
@@ -72,16 +77,20 @@ const config = helpers.defineMultiStyleConfig({
|
|
72
77
|
}),
|
73
78
|
},
|
74
79
|
sizes: {
|
75
|
-
sm: {
|
80
|
+
sm: (props) => ({
|
76
81
|
container: {
|
77
|
-
fontSize: 42,
|
82
|
+
fontSize: props.variant === "play" ? 24 : 42,
|
83
|
+
width: props.variant === "play" ? "2.625rem" : undefined,
|
84
|
+
height: props.variant === "play" ? "2.625rem" : undefined,
|
78
85
|
},
|
79
|
-
},
|
80
|
-
lg: {
|
86
|
+
}),
|
87
|
+
lg: (props) => ({
|
81
88
|
container: {
|
82
|
-
fontSize: 60,
|
89
|
+
fontSize: props.variant === "play" ? 38 : 60,
|
90
|
+
width: props.variant === "play" ? "3.75rem" : undefined,
|
91
|
+
height: props.variant === "play" ? "3.75rem" : undefined,
|
83
92
|
},
|
84
|
-
},
|
93
|
+
}),
|
85
94
|
},
|
86
95
|
});
|
87
96
|
|
@@ -28,6 +28,7 @@ const config = defineStyleConfig({
|
|
28
28
|
}),
|
29
29
|
variants: {
|
30
30
|
base: (props) => ({
|
31
|
+
cursor: "pointer",
|
31
32
|
...baseBorder("default", props),
|
32
33
|
_hover: {
|
33
34
|
...baseBorder("hover", props),
|
@@ -42,7 +43,7 @@ const config = defineStyleConfig({
|
|
42
43
|
boxShadow: "sm",
|
43
44
|
_hover: {
|
44
45
|
...accentBackground("hover", props),
|
45
|
-
boxShadow: "
|
46
|
+
boxShadow: "md",
|
46
47
|
},
|
47
48
|
_active: {
|
48
49
|
...accentBackground("active", props),
|
@@ -51,6 +52,7 @@ const config = defineStyleConfig({
|
|
51
52
|
}),
|
52
53
|
floating: (props) => ({
|
53
54
|
...floatingBackground("default", props),
|
55
|
+
...floatingBorder("default", props),
|
54
56
|
boxShadow: "sm",
|
55
57
|
_hover: {
|
56
58
|
...floatingBackground("hover", props),
|
@@ -58,6 +60,7 @@ const config = defineStyleConfig({
|
|
58
60
|
boxShadow: "md",
|
59
61
|
},
|
60
62
|
_active: {
|
63
|
+
...floatingBorder("default", props),
|
61
64
|
...floatingBackground("active", props),
|
62
65
|
boxShadow: "none",
|
63
66
|
},
|
@@ -1,60 +1,99 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
createMultiStyleConfigHelpers,
|
3
|
+
defineStyleConfig,
|
4
|
+
} from "@chakra-ui/react";
|
2
5
|
import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
|
3
6
|
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
4
7
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
8
|
+
import { anatomy } from "@chakra-ui/theme-tools";
|
9
|
+
import { outlineBorder } from "../utils/outline-utils";
|
5
10
|
|
6
|
-
const
|
11
|
+
const parts = anatomy("radio-card").parts("container", "checked", "radioInput");
|
12
|
+
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
13
|
+
|
14
|
+
const config = helpers.defineMultiStyleConfig({
|
7
15
|
baseStyle: (props: any) => ({
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
container: {
|
17
|
+
appearance: "none",
|
18
|
+
border: "none",
|
19
|
+
overflow: "hidden",
|
20
|
+
fontSize: "inherit",
|
21
|
+
display: "block",
|
22
|
+
cursor: "pointer",
|
23
|
+
borderRadius: "sm",
|
24
|
+
...focusVisibleStyles(props),
|
25
|
+
transitionProperty: "common",
|
26
|
+
transitionDuration: "fast",
|
27
|
+
_disabled: {
|
28
|
+
pointerEvents: "none",
|
29
|
+
...baseBackground("disabled", props),
|
30
|
+
...baseBorder("disabled", props),
|
31
|
+
...baseText("disabled", props),
|
21
32
|
},
|
22
33
|
},
|
23
|
-
|
24
|
-
|
25
|
-
...
|
26
|
-
...
|
27
|
-
|
34
|
+
checked: {
|
35
|
+
outline: "2px solid",
|
36
|
+
...outlineBorder("focus", props),
|
37
|
+
...floatingBackground("active", props),
|
38
|
+
},
|
39
|
+
radioInput: {
|
40
|
+
appearance: "none",
|
41
|
+
position: "absolute",
|
42
|
+
opacity: 0,
|
43
|
+
zIndex: -1,
|
28
44
|
},
|
29
45
|
}),
|
30
46
|
variants: {
|
31
47
|
base: (props) => ({
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
...
|
36
|
-
|
48
|
+
container: {
|
49
|
+
...baseText("default", props),
|
50
|
+
...baseBackground("default", props),
|
51
|
+
...baseBorder("default", props),
|
52
|
+
_hover: {
|
53
|
+
...baseBackground("hover", props),
|
54
|
+
...baseBorder("hover", props),
|
55
|
+
},
|
56
|
+
_active: {
|
57
|
+
...baseBackground("active", props),
|
58
|
+
...baseBorder("active", props),
|
59
|
+
},
|
37
60
|
},
|
38
|
-
|
39
|
-
|
61
|
+
checked: {
|
62
|
+
_hover: {
|
63
|
+
...baseBorder("hover", props),
|
64
|
+
},
|
65
|
+
_active: {
|
66
|
+
...baseBackground("active", props),
|
67
|
+
...baseBorder("active", props),
|
68
|
+
},
|
40
69
|
},
|
41
70
|
}),
|
42
71
|
floating: (props) => ({
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
...floatingBackground("
|
47
|
-
...floatingBorder("
|
48
|
-
boxShadow: "
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
72
|
+
container: {
|
73
|
+
...baseText("default", props),
|
74
|
+
...baseBackground("default", props),
|
75
|
+
...floatingBackground("default", props),
|
76
|
+
...floatingBorder("default", props),
|
77
|
+
boxShadow: "sm",
|
78
|
+
_hover: {
|
79
|
+
...floatingBackground("hover", props),
|
80
|
+
...floatingBorder("hover", props),
|
81
|
+
boxShadow: "md",
|
82
|
+
},
|
83
|
+
_active: {
|
84
|
+
...floatingBackground("active", props),
|
85
|
+
...floatingBorder("active", props),
|
86
|
+
},
|
53
87
|
},
|
54
|
-
|
88
|
+
checked: {
|
89
|
+
cursor: "normal",
|
90
|
+
|
55
91
|
_hover: {
|
56
|
-
|
57
|
-
|
92
|
+
...floatingBorder("hover", props),
|
93
|
+
},
|
94
|
+
_active: {
|
95
|
+
...floatingBackground("active", props),
|
96
|
+
...floatingBorder("active", props),
|
58
97
|
},
|
59
98
|
},
|
60
99
|
}),
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineStyleConfig } from "@chakra-ui/react";
|
1
|
+
import { Theme, defineStyleConfig } from "@chakra-ui/react";
|
2
2
|
import { colors } from "../foundations";
|
3
3
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
4
4
|
import { bg } from "../utils/bg-utils";
|
@@ -33,9 +33,11 @@ type CardThemeProps = {
|
|
33
33
|
| "darkBlue"
|
34
34
|
| "darkGreen"
|
35
35
|
| "darkYellow";
|
36
|
+
theme: Theme;
|
37
|
+
colorMode: "light" | "dark";
|
36
38
|
};
|
37
39
|
|
38
|
-
const getColorSchemeBaseProps = (props:
|
40
|
+
const getColorSchemeBaseProps = (props: CardThemeProps) => {
|
39
41
|
switch (props.colorScheme) {
|
40
42
|
case "white":
|
41
43
|
return {
|
@@ -60,8 +60,11 @@ export function baseBorder(state: BorderState, props: StyleFunctionProps) {
|
|
60
60
|
}
|
61
61
|
case "active": {
|
62
62
|
return {
|
63
|
-
outline: "
|
64
|
-
outlineColor: mode(
|
63
|
+
outline: "1px solid",
|
64
|
+
outlineColor: mode(
|
65
|
+
"base.outline.default.light",
|
66
|
+
"base.outline.default.dark",
|
67
|
+
)(props),
|
65
68
|
};
|
66
69
|
}
|
67
70
|
case "invalid": {
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { mode, StyleFunctionProps } from "@chakra-ui/theme-tools";
|
2
|
+
import { State, Subset } from "./types";
|
3
|
+
|
4
|
+
type OutlineBorderState = Subset<State, "default" | "error" | "focus">;
|
5
|
+
export function outlineBorder(
|
6
|
+
state: OutlineBorderState,
|
7
|
+
props: StyleFunctionProps,
|
8
|
+
) {
|
9
|
+
switch (state) {
|
10
|
+
case "error":
|
11
|
+
return {
|
12
|
+
outlineColor: mode("outline.error.light", "outline.error.dark")(props),
|
13
|
+
};
|
14
|
+
case "focus":
|
15
|
+
return {
|
16
|
+
outlineColor: mode("outline.focus.light", "outline.focus.dark")(props),
|
17
|
+
};
|
18
|
+
default:
|
19
|
+
return {
|
20
|
+
outlineColor: mode(
|
21
|
+
"outline.default.light",
|
22
|
+
"outline.default.dark",
|
23
|
+
)(props),
|
24
|
+
};
|
25
|
+
}
|
26
|
+
}
|
package/src/theme/utils/types.ts
CHANGED
@@ -1,80 +0,0 @@
|
|
1
|
-
import { Box, BoxProps } from "@chakra-ui/react";
|
2
|
-
import * as React from "react";
|
3
|
-
|
4
|
-
export const JumpForwardIcon = (props: BoxProps) => (
|
5
|
-
<Box as="svg" {...props} viewBox="0 0 32 30" fill="none">
|
6
|
-
<path
|
7
|
-
fillRule="evenodd"
|
8
|
-
clipRule="evenodd"
|
9
|
-
d="M22.388 7.5C20.567 5.967 18.251 5 15.75 5 9.951 5 5.25 9.701 5.25 15.5S9.951 26 15.75 26s10.5-4.701 10.5-10.5a1 1 0 1 1 2 0c0 6.904-5.596 12.5-12.5 12.5s-12.5-5.596-12.5-12.5S8.846 3 15.75 3c3.206 0 6.11 1.31 8.304 3.3l.206-1.441a1 1 0 0 1 1.98.282L25.617 9.5H21.25a1 1 0 1 1 0-2h1.138Z"
|
10
|
-
fill="currentColor"
|
11
|
-
/>
|
12
|
-
<path
|
13
|
-
fillRule="evenodd"
|
14
|
-
clipRule="evenodd"
|
15
|
-
d="M19.465 14.568c-.4-.232-.863-.348-1.392-.348-.655 0-1.195.172-1.62.516l.18-2.172h2.989c.256 0 .436-.016.54-.048.111-.032.168-.112.168-.24v-1.02h-.012c-.04.04-.117.064-.229.072a7.65 7.65 0 0 1-.515.012H15.42l-.36 4.464 1.273.12c.175-.16.384-.284.623-.372a2.11 2.11 0 0 1 .768-.144c.48 0 .856.136 1.128.408.28.264.42.624.42 1.08 0 .456-.155.832-.468 1.128-.311.296-.703.444-1.175.444a3.04 3.04 0 0 1-.936-.132 3.802 3.802 0 0 1-.756-.348c-.289-.176-.48-.34-.577-.492l-.636.888a.233.233 0 0 0-.047.12c0 .08.043.16.131.24.089.072.225.168.409.288.712.448 1.547.672 2.508.672.576 0 1.091-.124 1.547-.372a2.743 2.743 0 0 0 1.08-1.056 2.97 2.97 0 0 0 .384-1.5c0-.472-.111-.9-.335-1.284a2.314 2.314 0 0 0-.937-.924ZM13.338 19.224a2.954 2.954 0 0 1-.036-.552V11.34h-1.116a2.07 2.07 0 0 1-.576.768c-.248.208-.576.312-.984.312h-.144c-.136 0-.224-.016-.264-.048v.792c0 .128.052.208.156.24.112.032.296.048.552.048h.912v5.364c0 .248.028.424.084.528.056.104.172.156.348.156h1.248v-.012a.478.478 0 0 1-.18-.264Z"
|
16
|
-
fill="currentColor"
|
17
|
-
/>
|
18
|
-
</Box>
|
19
|
-
);
|
20
|
-
|
21
|
-
export const JumpBackwardIcon = (props: BoxProps) => (
|
22
|
-
<Box as="svg" {...props} viewBox="0 0 32 30" fill="none">
|
23
|
-
<path
|
24
|
-
fillRule="evenodd"
|
25
|
-
clipRule="evenodd"
|
26
|
-
d="M9.612 7.5C11.433 5.967 13.749 5 16.25 5c5.799 0 10.5 4.701 10.5 10.5S22.049 26 16.25 26s-10.5-4.701-10.5-10.5a1 1 0 1 0-2 0c0 6.904 5.596 12.5 12.5 12.5s12.5-5.596 12.5-12.5S23.154 3 16.25 3c-3.206 0-6.11 1.31-8.304 3.3L7.74 4.86a1 1 0 0 0-1.98.282L6.383 9.5h4.367a1 1 0 1 0 0-2H9.612Z"
|
27
|
-
fill="currentColor"
|
28
|
-
/>
|
29
|
-
<path
|
30
|
-
fillRule="evenodd"
|
31
|
-
clipRule="evenodd"
|
32
|
-
d="M19.965 14.568c-.4-.232-.863-.348-1.392-.348-.655 0-1.195.172-1.62.516l.18-2.172h2.989c.256 0 .436-.016.54-.048.111-.032.168-.112.168-.24v-1.02h-.012c-.04.04-.117.064-.229.072a7.65 7.65 0 0 1-.515.012H15.92l-.36 4.464 1.273.12c.175-.16.384-.284.623-.372a2.11 2.11 0 0 1 .768-.144c.48 0 .856.136 1.128.408.28.264.42.624.42 1.08 0 .456-.155.832-.468 1.128-.311.296-.703.444-1.175.444a3.04 3.04 0 0 1-.936-.132 3.802 3.802 0 0 1-.756-.348c-.288-.176-.48-.34-.576-.492l-.636.888a.233.233 0 0 0-.049.12c0 .08.045.16.133.24.088.072.223.168.407.288.713.448 1.548.672 2.508.672.576 0 1.092-.124 1.548-.372a2.743 2.743 0 0 0 1.08-1.056 2.97 2.97 0 0 0 .384-1.5c0-.472-.111-.9-.335-1.284a2.314 2.314 0 0 0-.937-.924ZM13.838 19.224a2.954 2.954 0 0 1-.036-.552V11.34h-1.116a2.07 2.07 0 0 1-.576.768c-.248.208-.576.312-.984.312h-.144c-.136 0-.224-.016-.264-.048v.792c0 .128.052.208.156.24.112.032.296.048.552.048h.912v5.364c0 .248.028.424.084.528.056.104.172.156.348.156h1.248v-.012a.478.478 0 0 1-.18-.264Z"
|
33
|
-
fill="currentColor"
|
34
|
-
/>
|
35
|
-
</Box>
|
36
|
-
);
|
37
|
-
|
38
|
-
export const PlayIcon = (props: BoxProps) => (
|
39
|
-
<Box as="svg" {...props} fill="none" viewBox="0 0 60 60">
|
40
|
-
<path
|
41
|
-
fillRule="evenodd"
|
42
|
-
clipRule="evenodd"
|
43
|
-
d="M30 60c16.569 0 30-13.431 30-30C60 13.431 46.569 0 30 0 13.431 0 0 13.431 0 30c0 16.569 13.431 30 30 30Zm-4.25-45.325c-1.97-1.533-4.84-.128-4.84 2.368v25.914c0 2.496 2.87 3.9 4.84 2.368l16.66-12.957a3 3 0 0 0 0-4.736L25.75 14.675Z"
|
44
|
-
fill="currentColor"
|
45
|
-
/>
|
46
|
-
</Box>
|
47
|
-
);
|
48
|
-
|
49
|
-
export const PauseIcon = (props: BoxProps) => (
|
50
|
-
<Box as="svg" {...props} viewBox="0 0 60 60" fill="none">
|
51
|
-
<path
|
52
|
-
fillRule="evenodd"
|
53
|
-
clipRule="evenodd"
|
54
|
-
d="M60 30c0 16.569-13.431 30-30 30C13.431 60 0 46.569 0 30 0 13.431 13.431 0 30 0c16.569 0 30 13.431 30 30Zm-25.5-9.75a2.25 2.25 0 0 1 4.5 0v19.5a2.25 2.25 0 0 1-4.5 0v-19.5ZM23.25 18A2.25 2.25 0 0 0 21 20.25v19.5a2.25 2.25 0 0 0 4.5 0v-19.5A2.25 2.25 0 0 0 23.25 18Z"
|
55
|
-
fill="currentColor"
|
56
|
-
/>
|
57
|
-
</Box>
|
58
|
-
);
|
59
|
-
|
60
|
-
export const SkipNextIcon = (props: BoxProps) => (
|
61
|
-
<Box as="svg" {...props} viewBox="0 0 30 30" fill="none">
|
62
|
-
<path
|
63
|
-
fillRule="evenodd"
|
64
|
-
clipRule="evenodd"
|
65
|
-
d="M6.453 4.18A1.695 1.695 0 0 0 4 5.696v18.608c0 1.26 1.326 2.08 2.453 1.516L24 17.047V25a1 1 0 1 0 2 0V5a1 1 0 1 0-2 0v7.952L6.453 4.18ZM23.623 15 6 23.81V6.19l17.623 8.81Z"
|
66
|
-
fill="currentColor"
|
67
|
-
/>
|
68
|
-
</Box>
|
69
|
-
);
|
70
|
-
|
71
|
-
export const SkipPreviousIcon = (props: BoxProps) => (
|
72
|
-
<Box as="svg" {...props} viewBox="0 0 30 30" fill="none">
|
73
|
-
<path
|
74
|
-
fillRule="evenodd"
|
75
|
-
clipRule="evenodd"
|
76
|
-
d="M23.547 4.18A1.695 1.695 0 0 1 26 5.696v18.608c0 1.26-1.326 2.08-2.453 1.516L6 17.047V25a1 1 0 1 1-2 0V5a1 1 0 1 1 2 0v7.952L23.547 4.18ZM6.377 15 24 23.81V6.19l-17.623 8.81Z"
|
77
|
-
fill="currentColor"
|
78
|
-
/>
|
79
|
-
</Box>
|
80
|
-
);
|