@vygruppen/spor-react 3.0.4 → 3.1.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 +10 -10
- package/CHANGELOG.md +21 -0
- package/dist/{CountryCodeSelect-PXKYFQHM.mjs → CountryCodeSelect-PU2FEIUH.mjs} +308 -423
- package/dist/{chunk-ETCK74GR.mjs → chunk-GIRK7GTN.mjs} +473 -497
- package/dist/index.d.ts +114 -107
- package/dist/index.js +1378 -1413
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/accordion/Expandable.tsx +2 -2
- package/src/alert/ExpandableAlert.tsx +2 -1
- package/src/datepicker/DateField.tsx +3 -1
- package/src/datepicker/DateTimeSegment.tsx +2 -1
- package/src/datepicker/TimeField.tsx +3 -1
- package/src/datepicker/TimePicker.tsx +4 -4
- package/src/input/Combobox.tsx +3 -7
- package/src/input/Popover.tsx +17 -9
- package/src/input/Textarea.tsx +12 -6
- package/src/loader/SkeletonText.tsx +3 -2
- package/src/theme/components/textarea.ts +9 -1
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, 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, 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, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-
|
1
|
+
export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, 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, 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, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-GIRK7GTN.mjs';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vygruppen/spor-react",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.1.1",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@vygruppen/spor-loader": "*",
|
28
28
|
"framer-motion": ">6.0.0",
|
29
29
|
"lottie-react": "^2.3.1",
|
30
|
-
"react-aria": "^3.
|
30
|
+
"react-aria": "^3.27.0",
|
31
31
|
"react-stately": "^3.20.0",
|
32
32
|
"react-swipeable": "^7.0.0"
|
33
33
|
},
|
@@ -12,7 +12,7 @@ import { Accordion, AccordionProps } from "./Accordion";
|
|
12
12
|
import { useAccordionContext } from "./AccordionContext";
|
13
13
|
|
14
14
|
type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
|
15
|
-
type ExpandableProps = AccordionProps & {
|
15
|
+
type ExpandableProps = Omit<AccordionProps, "title"> & {
|
16
16
|
/** The hidden content */
|
17
17
|
children: React.ReactNode;
|
18
18
|
/** The title that's shown inside the toggle button */
|
@@ -62,7 +62,7 @@ export const Expandable = ({
|
|
62
62
|
);
|
63
63
|
};
|
64
64
|
|
65
|
-
export type ExpandableItemProps = AccordionItemProps & {
|
65
|
+
export type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
|
66
66
|
/** The hidden content */
|
67
67
|
children: React.ReactNode;
|
68
68
|
/** The title that's shown inside the toggle button */
|
@@ -42,9 +42,10 @@ export const ExpandableAlert = ({
|
|
42
42
|
headingLevel = "h3",
|
43
43
|
defaultOpen = false,
|
44
44
|
onToggle = () => {},
|
45
|
+
...boxProps
|
45
46
|
}: ExpandableAlertProps) => {
|
46
47
|
return (
|
47
|
-
<BaseAlert variant={variant} paddingX={0} paddingY={0} padding={0}>
|
48
|
+
<BaseAlert variant={variant} paddingX={0} paddingY={0} padding={0} {...boxProps}>
|
48
49
|
<Accordion
|
49
50
|
onChange={(expandedIndex) => onToggle(expandedIndex === 0)}
|
50
51
|
defaultIndex={defaultOpen ? 0 : -1}
|
@@ -46,11 +46,13 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
46
46
|
{...props.labelProps}
|
47
47
|
{...labelProps}
|
48
48
|
sx={styles.inputLabel}
|
49
|
+
position="absolute"
|
50
|
+
paddingTop="2px"
|
49
51
|
>
|
50
52
|
{props.label}
|
51
53
|
</FormLabel>
|
52
54
|
)}
|
53
|
-
<Flex {...fieldProps}>
|
55
|
+
<Flex {...fieldProps} paddingTop="3" paddingBottom="0.5">
|
54
56
|
{state.segments.map((segment, i) => (
|
55
57
|
<DateTimeSegment
|
56
58
|
ref={i === 0 ? ref : undefined}
|
@@ -2,6 +2,7 @@ import { Box, useMultiStyleConfig } from "@chakra-ui/react";
|
|
2
2
|
import React, { RefObject, forwardRef, useRef } from "react";
|
3
3
|
import { useDateSegment } from "react-aria";
|
4
4
|
import { DateFieldState, DateSegment } from "react-stately";
|
5
|
+
import { colors } from "../theme/foundations";
|
5
6
|
|
6
7
|
type DateTimeSegmentProps = {
|
7
8
|
segment: DateSegment;
|
@@ -29,7 +30,6 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
|
|
29
30
|
isPlaceholder: segment.isPlaceholder,
|
30
31
|
isEditable: segment.isEditable,
|
31
32
|
});
|
32
|
-
|
33
33
|
return (
|
34
34
|
<Box
|
35
35
|
{...segmentProps}
|
@@ -38,6 +38,7 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
|
|
38
38
|
...segmentProps.style,
|
39
39
|
fontVariantNumeric: "tabular-nums",
|
40
40
|
boxSizing: "content-box",
|
41
|
+
color: colors.darkGrey,
|
41
42
|
}}
|
42
43
|
paddingX="1px"
|
43
44
|
textAlign="end"
|
@@ -29,10 +29,12 @@ export const TimeField = ({ state, ...props }: TimeFieldProps) => {
|
|
29
29
|
marginBottom={0}
|
30
30
|
fontSize="mobile.xs"
|
31
31
|
cursor="text"
|
32
|
+
position="absolute"
|
33
|
+
paddingTop="2px"
|
32
34
|
>
|
33
35
|
{props.label}
|
34
36
|
</FormLabel>
|
35
|
-
<Flex {...fieldProps} ref={ref}>
|
37
|
+
<Flex {...fieldProps} ref={ref} paddingTop="3" paddingBottom="0.5">
|
36
38
|
{state.segments.map((segment) => (
|
37
39
|
<DateTimeSegment key={segment.type} segment={segment} state={state} />
|
38
40
|
))}
|
@@ -2,8 +2,8 @@ import { BoxProps, useFormControlContext } from "@chakra-ui/react";
|
|
2
2
|
import { CalendarDateTime } from "@internationalized/date";
|
3
3
|
import { TimeValue } from "@react-types/datepicker";
|
4
4
|
import {
|
5
|
-
|
6
|
-
|
5
|
+
DropdownLeftFill18Icon,
|
6
|
+
DropdownRightFill18Icon,
|
7
7
|
} from "@vygruppen/spor-icon-react";
|
8
8
|
import React from "react";
|
9
9
|
import { useTimeFieldState } from "react-stately";
|
@@ -140,7 +140,7 @@ export const TimePicker = ({
|
|
140
140
|
borderRadius="xs"
|
141
141
|
aria-label={backwardsLabel}
|
142
142
|
title={backwardsLabel}
|
143
|
-
icon={<
|
143
|
+
icon={<DropdownLeftFill18Icon />}
|
144
144
|
onClick={handleBackwardsClick}
|
145
145
|
isDisabled={isDisabled}
|
146
146
|
style={isDisabled ? { backgroundColor: "transparent" } : {}}
|
@@ -152,7 +152,7 @@ export const TimePicker = ({
|
|
152
152
|
borderRadius="xs"
|
153
153
|
aria-label={forwardsLabel}
|
154
154
|
title={forwardsLabel}
|
155
|
-
icon={<
|
155
|
+
icon={<DropdownRightFill18Icon />}
|
156
156
|
onClick={handleForwardClick}
|
157
157
|
isDisabled={isDisabled}
|
158
158
|
style={isDisabled ? { backgroundColor: "transparent" } : {}}
|
package/src/input/Combobox.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { AriaComboBoxProps, useComboBox, useFilter } from "react-aria";
|
3
3
|
import { useComboBoxState } from "react-stately";
|
4
|
-
import { ColorSpinner, Input, InputProps, ListBox
|
4
|
+
import { ColorSpinner, Input, InputProps, ListBox } from "..";
|
5
5
|
import { Popover } from "./Popover";
|
6
6
|
|
7
7
|
export type ComboboxProps<T> = AriaComboBoxProps<T> & {
|
@@ -96,12 +96,6 @@ export function Combobox<T extends object>({
|
|
96
96
|
label,
|
97
97
|
});
|
98
98
|
|
99
|
-
useOutsideClick({
|
100
|
-
ref: listBoxRef,
|
101
|
-
handler: state.close,
|
102
|
-
enabled: true,
|
103
|
-
});
|
104
|
-
|
105
99
|
const {
|
106
100
|
inputProps: { size, ...inputProps },
|
107
101
|
listBoxProps,
|
@@ -119,6 +113,7 @@ export function Combobox<T extends object>({
|
|
119
113
|
<>
|
120
114
|
<Input
|
121
115
|
{...inputProps}
|
116
|
+
aria-haspopup="listbox"
|
122
117
|
ref={inputRef}
|
123
118
|
label={label}
|
124
119
|
borderBottomLeftRadius={
|
@@ -165,6 +160,7 @@ export function Combobox<T extends object>({
|
|
165
160
|
state={state}
|
166
161
|
triggerRef={inputRef as any}
|
167
162
|
ref={popoverRef}
|
163
|
+
isNonModal
|
168
164
|
placement="bottom start"
|
169
165
|
shouldFlip={false}
|
170
166
|
hasBackdrop={false}
|
package/src/input/Popover.tsx
CHANGED
@@ -81,18 +81,26 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
81
81
|
state
|
82
82
|
);
|
83
83
|
|
84
|
+
const popoverBox = (
|
85
|
+
<Box
|
86
|
+
{...popoverProps}
|
87
|
+
ref={popoverRef}
|
88
|
+
minWidth={triggerRef.current?.clientWidth ?? "auto"}
|
89
|
+
marginLeft={-2}
|
90
|
+
>
|
91
|
+
<DismissButton onDismiss={state.close} />
|
92
|
+
{children}
|
93
|
+
<DismissButton onDismiss={state.close} />
|
94
|
+
</Box>
|
95
|
+
);
|
96
|
+
|
97
|
+
if (isNonModal) {
|
98
|
+
return popoverBox;
|
99
|
+
}
|
84
100
|
return (
|
85
101
|
<Overlay>
|
86
102
|
{hasBackdrop && <Box {...underlayProps} position="fixed" inset="0" />}
|
87
|
-
|
88
|
-
{...popoverProps}
|
89
|
-
ref={popoverRef}
|
90
|
-
minWidth={triggerRef.current?.clientWidth ?? "auto"}
|
91
|
-
>
|
92
|
-
<DismissButton onDismiss={state.close} />
|
93
|
-
{children}
|
94
|
-
<DismissButton onDismiss={state.close} />
|
95
|
-
</Box>
|
103
|
+
{popoverBox}
|
96
104
|
</Overlay>
|
97
105
|
);
|
98
106
|
}
|
package/src/input/Textarea.tsx
CHANGED
@@ -5,16 +5,17 @@ import {
|
|
5
5
|
Textarea as ChakraTextarea,
|
6
6
|
TextareaProps as ChakraTextareaProps,
|
7
7
|
useFormControlContext,
|
8
|
+
InputGroup,
|
8
9
|
} from "@chakra-ui/react";
|
9
10
|
import React, { useId } from "react";
|
10
11
|
|
11
12
|
export type TextareaProps = Exclude<ChakraTextareaProps, "variant" | "size"> & {
|
12
|
-
label
|
13
|
+
label?: string;
|
13
14
|
};
|
14
15
|
/**
|
15
16
|
* Text area that works with the `FormControl` component.
|
16
17
|
*
|
17
|
-
*
|
18
|
+
* Providing a label is optional.
|
18
19
|
*
|
19
20
|
* ```tsx
|
20
21
|
* <FormControl>
|
@@ -30,11 +31,16 @@ export const Textarea = forwardRef<TextareaProps, "textarea">((props, ref) => {
|
|
30
31
|
const formControlProps = useFormControlContext();
|
31
32
|
const fallbackId = `textarea-${useId()}`;
|
32
33
|
const inputId = props.id ?? formControlProps?.id ?? fallbackId;
|
34
|
+
|
33
35
|
return (
|
34
|
-
<
|
35
|
-
<
|
36
|
-
|
37
|
-
|
36
|
+
<InputGroup position="relative" {...spacingProps}>
|
37
|
+
<ChakraTextarea {...rest} id={inputId} ref={ref} placeholder=" " />
|
38
|
+
{label && (
|
39
|
+
<FormLabel htmlFor={inputId} id={`${inputId}-label`}>
|
40
|
+
{label}
|
41
|
+
</FormLabel>
|
42
|
+
)}
|
43
|
+
</InputGroup>
|
38
44
|
);
|
39
45
|
});
|
40
46
|
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { SkeletonText as ChakraSkeletonText, SkeletonTextProps as ChakraSkeletonTextProps } from "@chakra-ui/react";
|
2
2
|
import React from "react";
|
3
3
|
|
4
|
-
export type SkeletonTextProps =
|
4
|
+
export type SkeletonTextProps = ChakraSkeletonTextProps
|
5
|
+
|
5
6
|
/**
|
6
7
|
* SkeletonText renders a loading animation for a given text. It works great as a placeholder to avoid layout shifts.
|
7
8
|
*/
|
@@ -5,9 +5,17 @@ const config = defineStyleConfig({
|
|
5
5
|
baseStyle: (props) => ({
|
6
6
|
...Input.baseStyle!(props).field,
|
7
7
|
minHeight: "5rem",
|
8
|
-
py: 3,
|
9
8
|
verticalAlign: "top",
|
10
9
|
appearance: "none",
|
10
|
+
paddingTop: 2,
|
11
|
+
"&:not(:placeholder-shown)": {
|
12
|
+
"&:has(+ label)": {
|
13
|
+
paddingTop: 4
|
14
|
+
},
|
15
|
+
"& + label": {
|
16
|
+
transform: "scale(0.825) translateY(-10px)",
|
17
|
+
},
|
18
|
+
},
|
11
19
|
}),
|
12
20
|
});
|
13
21
|
|