@vygruppen/spor-react 10.9.2 → 11.0.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 +9 -9
- package/CHANGELOG.md +20 -0
- package/dist/{CountryCodeSelect-ATLJUIQ5.mjs → CountryCodeSelect-46H2DYJ5.mjs} +1 -1
- package/dist/{chunk-5GZRUD7N.mjs → chunk-ROHXFJX2.mjs} +380 -325
- package/dist/index.d.mts +31 -19
- package/dist/index.d.ts +31 -19
- package/dist/index.js +695 -641
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/button/Button.tsx +7 -3
- package/src/input/CardSelect.tsx +5 -3
- package/src/input/SearchInput.tsx +22 -2
- package/src/loader/Skeleton.tsx +7 -1
- package/src/modal/FullScreenDrawer.tsx +0 -2
- package/src/theme/components/alert-expandable.ts +21 -1
- package/src/theme/components/alert-service.ts +6 -2
- package/src/theme/components/card-select.ts +9 -7
- package/src/theme/components/divider.ts +34 -29
- package/src/theme/foundations/sizes.ts +6 -4
- package/src/theme/utils/ghost-utils.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, CardSelect, CargonetLogo, 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, RadioCardGroupContext, RadioGroup, ScaleFade, SearchInput, Section, ServiceAlert, 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, VyLogoPride, 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, CardSelect, CargonetLogo, 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, RadioCardGroupContext, RadioGroup, ScaleFade, SearchInput, Section, ServiceAlert, 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, VyLogoPride, 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-ROHXFJX2.mjs';
|
package/package.json
CHANGED
package/src/button/Button.tsx
CHANGED
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
ButtonProps as ChakraButtonProps,
|
5
5
|
Flex,
|
6
6
|
forwardRef,
|
7
|
+
SpaceProps,
|
7
8
|
useButtonGroup,
|
8
9
|
useStyleConfig,
|
9
10
|
} from "@chakra-ui/react";
|
@@ -11,9 +12,12 @@ import React from "react";
|
|
11
12
|
import { createTexts, useTranslation } from "../i18n";
|
12
13
|
import { ColorInlineLoader } from "../loader";
|
13
14
|
|
14
|
-
export type ButtonProps =
|
15
|
-
|
16
|
-
|
15
|
+
export type ButtonProps = Omit<
|
16
|
+
Exclude<
|
17
|
+
ChakraButtonProps,
|
18
|
+
"colorScheme" | "loadingText" | "size" | "variant"
|
19
|
+
>,
|
20
|
+
keyof SpaceProps
|
17
21
|
> & {
|
18
22
|
/**
|
19
23
|
* The size of the button.
|
package/src/input/CardSelect.tsx
CHANGED
@@ -122,7 +122,6 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
|
|
122
122
|
<chakra.button
|
123
123
|
type="button"
|
124
124
|
ref={triggerRef}
|
125
|
-
fontWeight="bold"
|
126
125
|
sx={styles.trigger}
|
127
126
|
aria-label={label}
|
128
127
|
{...buttonProps}
|
@@ -148,14 +147,17 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
|
|
148
147
|
offset={size === "sm" ? 6 : 12}
|
149
148
|
crossOffset={crossOffset}
|
150
149
|
placement={placement}
|
150
|
+
containerPadding={0}
|
151
151
|
>
|
152
152
|
<StaticCard
|
153
153
|
colorScheme="white"
|
154
|
-
size="
|
154
|
+
size="md"
|
155
|
+
fontSize={"xs"}
|
155
156
|
border={"sm"}
|
156
|
-
borderColor={"
|
157
|
+
borderColor={"silver"}
|
157
158
|
sx={styles.card}
|
158
159
|
{...overlayProps}
|
160
|
+
maxWidth={(triggerRef.current?.clientWidth ?? 1) * 2}
|
159
161
|
>
|
160
162
|
<Dialog aria-label={label}>{children}</Dialog>
|
161
163
|
</StaticCard>
|
@@ -2,6 +2,7 @@ import {
|
|
2
2
|
Input as ChakraInput,
|
3
3
|
InputProps as ChakraInputProps,
|
4
4
|
IconButton,
|
5
|
+
LayoutProps,
|
5
6
|
forwardRef,
|
6
7
|
useFormControlContext,
|
7
8
|
} from "@chakra-ui/react";
|
@@ -33,15 +34,18 @@ export const SearchInput = forwardRef<SearchInputProps, "input">(
|
|
33
34
|
const formControlProps = useFormControlContext();
|
34
35
|
const autoGeneratedId = useId();
|
35
36
|
const inputId = props.id ?? formControlProps?.id ?? autoGeneratedId;
|
37
|
+
|
38
|
+
const { outerProps, innerProps } = getOuterProps(props);
|
39
|
+
|
36
40
|
return (
|
37
|
-
<InputGroup position="relative">
|
41
|
+
<InputGroup position="relative" {...outerProps}>
|
38
42
|
<InputLeftElement>
|
39
43
|
<SearchOutline24Icon />
|
40
44
|
</InputLeftElement>
|
41
45
|
<ChakraInput
|
42
46
|
paddingLeft={7}
|
43
47
|
paddingRight={7}
|
44
|
-
{...
|
48
|
+
{...innerProps}
|
45
49
|
id={inputId}
|
46
50
|
type="search"
|
47
51
|
css={{
|
@@ -74,6 +78,22 @@ export const SearchInput = forwardRef<SearchInputProps, "input">(
|
|
74
78
|
},
|
75
79
|
);
|
76
80
|
|
81
|
+
const getOuterProps = (props: Record<string, any>) => {
|
82
|
+
const layoutKeys = new Set(["w, width, maxW, minW, maxWidth, minWidth"]); // add more keys here if neccessary
|
83
|
+
const outerProps: LayoutProps = {};
|
84
|
+
const innerProps: Record<string, any> = {};
|
85
|
+
|
86
|
+
for (const key in props) {
|
87
|
+
if (layoutKeys.has(key)) {
|
88
|
+
(outerProps as any)[key] = props[key];
|
89
|
+
} else {
|
90
|
+
(innerProps as any)[key] = props[key];
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
return { outerProps, innerProps };
|
95
|
+
};
|
96
|
+
|
77
97
|
const texts = createTexts({
|
78
98
|
label: {
|
79
99
|
nb: "Søk",
|
package/src/loader/Skeleton.tsx
CHANGED
@@ -12,5 +12,11 @@ export type SkeletonProps = BoxProps & {
|
|
12
12
|
* Skeleton renders a loading animation for a given box. It works great as a placeholder to avoid layout shifts.
|
13
13
|
*/
|
14
14
|
export const Skeleton = forwardRef<SkeletonProps, "div">((props, ref) => (
|
15
|
-
<ChakraSkeleton
|
15
|
+
<ChakraSkeleton
|
16
|
+
{...props}
|
17
|
+
ref={ref}
|
18
|
+
aria-busy="true"
|
19
|
+
aria-hidden="true"
|
20
|
+
role="alert"
|
21
|
+
/>
|
16
22
|
));
|
@@ -163,7 +163,6 @@ const DrawerCloseButton = () => {
|
|
163
163
|
onClick={onClose}
|
164
164
|
aria-label={t(texts.close)}
|
165
165
|
width="fit-content"
|
166
|
-
marginLeft="auto"
|
167
166
|
>
|
168
167
|
{t(texts.close)}
|
169
168
|
</Button>
|
@@ -196,7 +195,6 @@ const DrawerBackButton = () => {
|
|
196
195
|
onClick={onClose}
|
197
196
|
aria-label={t(texts.backAriaLabel)}
|
198
197
|
width="fit-content"
|
199
|
-
marginLeft="auto"
|
200
198
|
>
|
201
199
|
{t(texts.back)}
|
202
200
|
</Button>
|
@@ -27,11 +27,15 @@ const config = helpers.defineMultiStyleConfig({
|
|
27
27
|
},
|
28
28
|
container: {
|
29
29
|
_hover: {
|
30
|
+
backgroundColor: "cloudy",
|
30
31
|
outlineColor: "sky",
|
31
32
|
},
|
32
33
|
_active: {
|
33
34
|
backgroundColor: "icyBlue",
|
34
35
|
},
|
36
|
+
_focus: {
|
37
|
+
outlineColor: "greenHaze",
|
38
|
+
},
|
35
39
|
},
|
36
40
|
},
|
37
41
|
success: {
|
@@ -40,11 +44,15 @@ const config = helpers.defineMultiStyleConfig({
|
|
40
44
|
},
|
41
45
|
container: {
|
42
46
|
_hover: {
|
47
|
+
backgroundColor: "coralGreen",
|
43
48
|
outlineColor: "blueGreen",
|
44
49
|
},
|
45
50
|
_active: {
|
46
51
|
backgroundColor: "mint",
|
47
52
|
},
|
53
|
+
_focus: {
|
54
|
+
outlineColor: "greenHaze",
|
55
|
+
},
|
48
56
|
},
|
49
57
|
},
|
50
58
|
warning: {
|
@@ -53,7 +61,11 @@ const config = helpers.defineMultiStyleConfig({
|
|
53
61
|
},
|
54
62
|
container: {
|
55
63
|
_hover: {
|
56
|
-
|
64
|
+
backgroundColor: "primrose",
|
65
|
+
outlineColor: "banana",
|
66
|
+
},
|
67
|
+
_focus: {
|
68
|
+
outlineColor: "greenHaze",
|
57
69
|
},
|
58
70
|
_active: {
|
59
71
|
backgroundColor: "cornSilk",
|
@@ -66,8 +78,12 @@ const config = helpers.defineMultiStyleConfig({
|
|
66
78
|
},
|
67
79
|
container: {
|
68
80
|
_hover: {
|
81
|
+
backgroundColor: "burntYellow",
|
69
82
|
outlineColor: "golden",
|
70
83
|
},
|
84
|
+
_focus: {
|
85
|
+
outlineColor: "greenHaze",
|
86
|
+
},
|
71
87
|
_active: {
|
72
88
|
backgroundColor: "sunshine",
|
73
89
|
},
|
@@ -79,11 +95,15 @@ const config = helpers.defineMultiStyleConfig({
|
|
79
95
|
},
|
80
96
|
container: {
|
81
97
|
_hover: {
|
98
|
+
backgroundColor: "salmon",
|
82
99
|
outlineColor: "apricot",
|
83
100
|
},
|
84
101
|
_active: {
|
85
102
|
backgroundColor: "pink",
|
86
103
|
},
|
104
|
+
_focus: {
|
105
|
+
outlineColor: "greenHaze",
|
106
|
+
},
|
87
107
|
},
|
88
108
|
},
|
89
109
|
service: {
|
@@ -65,10 +65,14 @@ const config = helpers.defineMultiStyleConfig({
|
|
65
65
|
service: {
|
66
66
|
container: {
|
67
67
|
_hover: {
|
68
|
-
|
68
|
+
backgroundColor: "teal.600",
|
69
|
+
outlineColor: "teal.600",
|
70
|
+
},
|
71
|
+
_focus: {
|
72
|
+
outlineColor: "green.500",
|
69
73
|
},
|
70
74
|
_active: {
|
71
|
-
backgroundColor: "
|
75
|
+
backgroundColor: "teal.400",
|
72
76
|
outlineColor: "pine",
|
73
77
|
},
|
74
78
|
color: "white",
|
@@ -5,6 +5,7 @@ import { baseBackground, baseBorder, baseText } from "../utils/base-utils";
|
|
5
5
|
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
6
6
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
7
7
|
import { ghostBackground, ghostText } from "../utils/ghost-utils";
|
8
|
+
import { fontWeights } from "../foundations";
|
8
9
|
|
9
10
|
const parts = anatomy("card-select").parts("trigger", "card");
|
10
11
|
|
@@ -22,8 +23,8 @@ const config = helpers.defineMultiStyleConfig({
|
|
22
23
|
},
|
23
24
|
card: {
|
24
25
|
borderRadius: "sm",
|
25
|
-
boxShadow: "
|
26
|
-
padding:
|
26
|
+
boxShadow: "xs",
|
27
|
+
padding: 2,
|
27
28
|
...baseText("default", props),
|
28
29
|
backgroundColor: mode(
|
29
30
|
"white",
|
@@ -56,7 +57,8 @@ const config = helpers.defineMultiStyleConfig({
|
|
56
57
|
...ghostBackground("active", props),
|
57
58
|
},
|
58
59
|
_expanded: {
|
59
|
-
...ghostBackground("
|
60
|
+
...ghostBackground("active", props),
|
61
|
+
fontWeight: fontWeights.bold,
|
60
62
|
},
|
61
63
|
},
|
62
64
|
}),
|
@@ -88,7 +90,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
88
90
|
paddingY: 1,
|
89
91
|
minHeight: "1.25rem",
|
90
92
|
fontSize: "xs",
|
91
|
-
borderRadius: "
|
93
|
+
borderRadius: "lg",
|
92
94
|
},
|
93
95
|
},
|
94
96
|
md: {
|
@@ -96,8 +98,8 @@ const config = helpers.defineMultiStyleConfig({
|
|
96
98
|
paddingX: 2,
|
97
99
|
paddingY: 1.5,
|
98
100
|
minHeight: "2.625rem",
|
99
|
-
fontSize: "
|
100
|
-
borderRadius: "
|
101
|
+
fontSize: "xs",
|
102
|
+
borderRadius: "lg",
|
101
103
|
},
|
102
104
|
},
|
103
105
|
lg: {
|
@@ -106,7 +108,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
106
108
|
paddingY: 2,
|
107
109
|
minHeight: "3.375rem",
|
108
110
|
fontSize: "sm",
|
109
|
-
borderRadius: "
|
111
|
+
borderRadius: "lg",
|
110
112
|
},
|
111
113
|
},
|
112
114
|
},
|
@@ -1,42 +1,47 @@
|
|
1
1
|
import { defineStyleConfig } from "@chakra-ui/styled-system";
|
2
|
-
import { mode
|
2
|
+
import { mode } from "@chakra-ui/theme-tools";
|
3
3
|
|
4
|
-
const
|
5
|
-
|
4
|
+
const borderColor = mode("blackAlpha.300", "whiteAlpha.300");
|
5
|
+
|
6
|
+
function getSizes(size: string) {
|
7
|
+
const sizes: Record<string, { height: string; dash: string; gap: string }> = {
|
8
|
+
sm: {
|
9
|
+
height: "1px",
|
10
|
+
dash: "1px",
|
11
|
+
gap: "4px",
|
12
|
+
},
|
13
|
+
md: {
|
14
|
+
height: "2px",
|
15
|
+
dash: "3px",
|
16
|
+
gap: "6px",
|
17
|
+
},
|
18
|
+
lg: {
|
19
|
+
height: "3px",
|
20
|
+
dash: "3px",
|
21
|
+
gap: "9px",
|
22
|
+
},
|
23
|
+
};
|
24
|
+
return sizes[size] || sizes["md"];
|
25
|
+
}
|
6
26
|
|
7
27
|
export default defineStyleConfig({
|
8
28
|
baseStyle: (props) => ({
|
9
|
-
borderColor:
|
29
|
+
borderColor: borderColor(props),
|
10
30
|
}),
|
11
31
|
variants: {
|
12
32
|
solid: {
|
13
33
|
borderStyle: "solid",
|
14
34
|
},
|
15
|
-
dashed: (props) =>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
sm: (props) => ({
|
26
|
-
borderWidth: isSolid(props) ? "1px" : undefined,
|
27
|
-
borderRadius: isSolid(props) ? "0.5px" : undefined,
|
28
|
-
height: isDashed(props) ? "1px" : undefined,
|
29
|
-
}),
|
30
|
-
md: (props) => ({
|
31
|
-
borderWidth: isSolid(props) ? "2px" : undefined,
|
32
|
-
borderRadius: isSolid(props) ? "1px" : "10px",
|
33
|
-
height: isDashed(props) ? "2px" : undefined,
|
34
|
-
}),
|
35
|
-
lg: (props) => ({
|
36
|
-
borderWidth: isSolid(props) ? "3px" : undefined,
|
37
|
-
borderRadius: isSolid(props) ? "1.5px" : undefined,
|
38
|
-
height: isDashed(props) ? "3px" : undefined,
|
39
|
-
}),
|
35
|
+
dashed: (props) => {
|
36
|
+
const { height, dash, gap } = getSizes(props.size);
|
37
|
+
return {
|
38
|
+
height: height,
|
39
|
+
backgroundImage: `linear-gradient(90deg, ${borderColor(props)}, ${borderColor(props)} ${dash}, transparent ${dash}, transparent ${gap})`,
|
40
|
+
backgroundPosition: "left bottom",
|
41
|
+
backgroundRepeat: "repeat-x",
|
42
|
+
backgroundSize: `${gap} ${height}`,
|
43
|
+
};
|
44
|
+
},
|
40
45
|
},
|
41
46
|
defaultProps: {
|
42
47
|
variant: "solid",
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import tokens from "@vygruppen/spor-design-tokens";
|
1
2
|
import { spacing } from "./spacing";
|
2
3
|
|
3
4
|
const largeSizes = {
|
@@ -21,10 +22,11 @@ const largeSizes = {
|
|
21
22
|
};
|
22
23
|
|
23
24
|
const container = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
base: "0px",
|
26
|
+
sm: tokens.size.breakpoint.sm,
|
27
|
+
md: tokens.size.breakpoint.md,
|
28
|
+
lg: tokens.size.breakpoint.lg,
|
29
|
+
xl: tokens.size.breakpoint.xl,
|
28
30
|
};
|
29
31
|
|
30
32
|
export const sizes = {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { mode, StyleFunctionProps } from "@chakra-ui/theme-tools";
|
2
2
|
import { State, Subset } from "./types";
|
3
|
+
import { fontWeights } from "../foundations";
|
3
4
|
|
4
5
|
type GhostBackgroundState = Subset<
|
5
6
|
State,
|
@@ -30,8 +31,8 @@ export function ghostBackground(
|
|
30
31
|
case "selected": {
|
31
32
|
return {
|
32
33
|
backgroundColor: mode(
|
33
|
-
"ghost.surface.
|
34
|
-
"ghost.surface.
|
34
|
+
"ghost.surface.hover.light",
|
35
|
+
"ghost.surface.hover.dark",
|
35
36
|
)(props),
|
36
37
|
};
|
37
38
|
}
|