@vygruppen/spor-react 9.5.0 → 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 +6 -0
- package/dist/{CountryCodeSelect-2KOFVXIQ.mjs → CountryCodeSelect-EZTV452W.mjs} +1 -1
- package/dist/{chunk-XXA3IGVH.mjs → chunk-7VZBL2PP.mjs} +479 -309
- package/dist/index.d.mts +694 -1
- package/dist/index.d.ts +694 -1
- package/dist/index.js +548 -362
- 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/theme/components/index.ts +1 -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, Pagination, 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
@@ -40,4 +40,5 @@ export { default as Tabs } from "./tabs";
|
|
40
40
|
export { default as Textarea } from "./textarea";
|
41
41
|
export { default as Toast } from "./toast";
|
42
42
|
export { default as StaticCard } from "./static-card";
|
43
|
+
export { default as PressableCard } from "./pressable-card";
|
43
44
|
export { default as TravelTag } from "./travel-tag";
|
@@ -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
|
};
|