@vygruppen/spor-react 9.11.3 → 9.12.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 +12 -0
- package/dist/{CountryCodeSelect-KU4HQMG3.mjs → CountryCodeSelect-Q33DXFQF.mjs} +1 -1
- package/dist/{chunk-PA6EOPOZ.mjs → chunk-D4Z4Q4GJ.mjs} +497 -493
- package/dist/index.d.mts +124 -144
- package/dist/index.d.ts +124 -144
- package/dist/index.js +971 -967
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/datepicker/CalendarCell.tsx +1 -21
- package/src/datepicker/CalendarHeader.tsx +4 -6
- package/src/datepicker/CalendarTriggerButton.tsx +1 -1
- package/src/datepicker/DateTimeSegment.tsx +0 -4
- package/src/input/Radio.tsx +0 -1
- package/src/layout/RadioCard.tsx +64 -60
- package/src/layout/RadioCardGroup.tsx +59 -103
- package/src/theme/components/breadcrumb.ts +4 -42
- package/src/theme/components/button.ts +4 -4
- package/src/theme/components/choice-chip.ts +11 -14
- package/src/theme/components/close-button.ts +6 -5
- package/src/theme/components/datepicker.ts +21 -0
- package/src/theme/components/info-select.ts +1 -1
- package/src/theme/components/input.ts +2 -2
- package/src/theme/components/pressable-card.ts +2 -1
- package/src/theme/components/progress-bar.ts +4 -1
- package/src/theme/components/radio-card.ts +21 -10
- package/src/theme/components/radio.ts +5 -2
- package/src/theme/components/select.ts +4 -4
- package/src/theme/components/static-card.ts +0 -1
- package/src/theme/components/tabs.ts +5 -31
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, PrideProvider, 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, TogglePride, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, VyLogoDefault, VyLogoPride, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, usePride, 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, PrideProvider, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioCardGroupContext, 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, TogglePride, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, VyLogoDefault, VyLogoPride, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, usePride, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-D4Z4Q4GJ.mjs';
|
package/package.json
CHANGED
@@ -64,27 +64,7 @@ export function CalendarCell({
|
|
64
64
|
}, []);
|
65
65
|
|
66
66
|
return (
|
67
|
-
<Box
|
68
|
-
as="td"
|
69
|
-
{...cellProps}
|
70
|
-
textAlign="center"
|
71
|
-
sx={{
|
72
|
-
'&[aria-selected="true"] + [aria-selected="true"] > button': {
|
73
|
-
"&::before": {
|
74
|
-
content: '""',
|
75
|
-
display: "block",
|
76
|
-
width: "100%",
|
77
|
-
height: "100%",
|
78
|
-
backgroundColor: "darkTeal",
|
79
|
-
position: "absolute",
|
80
|
-
left: "-50%",
|
81
|
-
top: 0,
|
82
|
-
bottom: 0,
|
83
|
-
zIndex: -1,
|
84
|
-
},
|
85
|
-
},
|
86
|
-
}}
|
87
|
-
>
|
67
|
+
<Box as="td" {...cellProps} textAlign="center" sx={styles.cell}>
|
88
68
|
<Box
|
89
69
|
as="button"
|
90
70
|
type="button"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Flex } from "@chakra-ui/react";
|
1
|
+
import { Box, Flex } from "@chakra-ui/react";
|
2
2
|
import { getLocalTimeZone } from "@internationalized/date";
|
3
3
|
import {
|
4
4
|
ArrowLeftOutline24Icon,
|
@@ -7,7 +7,6 @@ import {
|
|
7
7
|
import React from "react";
|
8
8
|
import { CalendarState, RangeCalendarState } from "react-stately";
|
9
9
|
import { createTexts, useTranslation } from "../i18n";
|
10
|
-
import { Heading } from "../typography";
|
11
10
|
import { CalendarNavigationButton } from "./CalendarNavigationButton";
|
12
11
|
import { useCurrentLocale } from "./utils";
|
13
12
|
|
@@ -105,16 +104,15 @@ export const CalendarNavigator = ({
|
|
105
104
|
icon={<ArrowLeftOutline24Icon />}
|
106
105
|
aria-label={`${t(texts.previous)} ${t(texts[unit])}`}
|
107
106
|
/>
|
108
|
-
<
|
109
|
-
as="div"
|
107
|
+
<Box
|
110
108
|
role="heading"
|
111
|
-
|
109
|
+
fontSize="sm"
|
112
110
|
fontWeight="bold"
|
113
111
|
flex="1"
|
114
112
|
textAlign="center"
|
115
113
|
>
|
116
114
|
{capitalize(title)}
|
117
|
-
</
|
115
|
+
</Box>
|
118
116
|
<CalendarNavigationButton
|
119
117
|
onPress={onNext}
|
120
118
|
isDisabled={isNextDisabled}
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
ResponsiveValue,
|
8
8
|
} from "@chakra-ui/react";
|
9
9
|
import { CalendarOutline24Icon } from "@vygruppen/spor-icon-react";
|
10
|
-
import React
|
10
|
+
import React from "react";
|
11
11
|
import { AriaButtonProps } from "react-aria";
|
12
12
|
import { createTexts, useTranslation } from "..";
|
13
13
|
|
@@ -42,10 +42,6 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
|
|
42
42
|
borderRadius="xs"
|
43
43
|
fontSize={["mobile.sm", "desktop.sm"]}
|
44
44
|
sx={styles.dateTimeSegment}
|
45
|
-
_focus={{
|
46
|
-
backgroundColor: "darkTeal",
|
47
|
-
color: "white",
|
48
|
-
}}
|
49
45
|
>
|
50
46
|
{isPaddable(segment.type)
|
51
47
|
? segment.text.padStart(2, "0")
|
package/src/input/Radio.tsx
CHANGED
package/src/layout/RadioCard.tsx
CHANGED
@@ -1,34 +1,19 @@
|
|
1
1
|
import {
|
2
2
|
Box,
|
3
3
|
BoxProps,
|
4
|
-
UseRadioProps,
|
5
4
|
chakra,
|
6
5
|
forwardRef,
|
7
6
|
useMultiStyleConfig,
|
8
7
|
} from "@chakra-ui/react";
|
9
|
-
import React, { useId } from "react";
|
8
|
+
import React, { useContext, useEffect, useId } from "react";
|
9
|
+
import { RadioCardGroupContext } from "./RadioCardGroup";
|
10
10
|
|
11
11
|
/**
|
12
12
|
* Radio cards are used to present a set of options where only one option can be selected.
|
13
13
|
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
* ```tsx
|
17
|
-
* <RadioCard>
|
18
|
-
* Content
|
19
|
-
* </RadioCard>
|
20
|
-
* ```
|
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
|
-
* In order to use RadioCard, you typically want to place these components in a group with several other RadioCards.
|
14
|
+
* RadioCard components must be wrapped in a RadioCardGroup component.
|
31
15
|
*
|
16
|
+
* @example
|
32
17
|
* ```tsx
|
33
18
|
* <RadioCardGroup name="ticket">
|
34
19
|
* <RadioCard value="economy">Economy</RadioCard>
|
@@ -37,65 +22,84 @@ import React, { useId } from "react";
|
|
37
22
|
* </RadioCardGroup>
|
38
23
|
* ```
|
39
24
|
*
|
40
|
-
*
|
41
|
-
* Group styling overrides single styling if both are present.
|
25
|
+
* RadioCard inherits props from Box.
|
42
26
|
*
|
43
|
-
*
|
44
|
-
*
|
45
|
-
* ```tsx
|
46
|
-
* <RadioCardGroup name="ticket" variant="floating" padding={3}>
|
47
|
-
* <RadioCard value="economy">Economy</RadioCard>
|
48
|
-
* <RadioCard value="business">Business</RadioCard>
|
49
|
-
* <RadioCard value="first-class">First Class</RadioCard>
|
50
|
-
* </RadioCardGroup>
|
51
|
-
* ```
|
27
|
+
* Be advised to not use the `name` prop on the RadioCard component.
|
52
28
|
*
|
53
|
-
*
|
29
|
+
* Changing the semantics may also cause the component to not work as expected.
|
54
30
|
*
|
55
|
-
*
|
56
|
-
* <RadioCard variant="floating" padding={3}>
|
57
|
-
* Economy
|
58
|
-
* </RadioCard>
|
59
|
-
* ```
|
31
|
+
* @see Docs https://spor.vy.no/components/radiocard
|
60
32
|
*/
|
61
33
|
|
62
|
-
export type RadioCardProps =
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
34
|
+
export type RadioCardProps = BoxProps & {
|
35
|
+
value: string;
|
36
|
+
children: React.ReactNode;
|
37
|
+
isDisabled?: boolean;
|
38
|
+
};
|
39
|
+
|
40
|
+
export const RadioCard = forwardRef(
|
41
|
+
({ children, value = "base", isDisabled, ...props }: RadioCardProps, ref) => {
|
42
|
+
const context = useContext(RadioCardGroupContext);
|
43
|
+
|
44
|
+
if (!context) {
|
45
|
+
throw new Error(
|
46
|
+
"RadioCard components must be wrapped in a RadioCardGroup component",
|
47
|
+
);
|
48
|
+
}
|
49
|
+
|
50
|
+
const { name, selectedValue, onChange, variant } = context;
|
72
51
|
|
73
|
-
export const RadioCard = forwardRef<RadioCardProps, "div">(
|
74
|
-
({ children, variant = "base", isChecked, onChange, ...props }, ref) => {
|
75
52
|
const styles = useMultiStyleConfig("RadioCard", { variant });
|
76
53
|
|
77
|
-
const
|
54
|
+
const isChecked = selectedValue === value;
|
55
|
+
|
56
|
+
const radioCardId = `radio-card-${useId()}`;
|
78
57
|
|
79
|
-
|
80
|
-
|
58
|
+
useEffect(() => {
|
59
|
+
if (isChecked && typeof ref !== "function" && ref?.current) {
|
60
|
+
ref.current.focus();
|
61
|
+
}
|
62
|
+
}, [isChecked]);
|
63
|
+
|
64
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
65
|
+
if (event.key === "Enter" || event.key === " ") {
|
66
|
+
onChange(value);
|
67
|
+
}
|
68
|
+
if (
|
69
|
+
event.key === "ArrowRight" ||
|
70
|
+
event.key === "ArrowDown" ||
|
71
|
+
event.key === "ArrowLeft" ||
|
72
|
+
event.key === "ArrowUp"
|
73
|
+
) {
|
74
|
+
const nextRadioCard = event.currentTarget
|
75
|
+
.nextElementSibling as HTMLElement;
|
76
|
+
nextRadioCard.focus();
|
77
|
+
}
|
81
78
|
};
|
82
79
|
|
83
80
|
return (
|
84
|
-
<Box as="label"
|
81
|
+
<Box as="label" aria-label={String(children)} onKeyDown={handleKeyDown}>
|
85
82
|
<chakra.input
|
86
83
|
type="radio"
|
87
|
-
id={
|
84
|
+
id={radioCardId}
|
85
|
+
ref={ref}
|
86
|
+
value={value}
|
87
|
+
name={name}
|
88
88
|
checked={isChecked}
|
89
|
-
onChange={
|
90
|
-
{
|
91
|
-
|
89
|
+
onChange={() => onChange(value)}
|
90
|
+
disabled={isDisabled}
|
91
|
+
__css={styles.radioInput}
|
92
92
|
/>
|
93
93
|
<Box
|
94
94
|
{...props}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
95
|
+
tabIndex={0}
|
96
|
+
ref={ref}
|
97
|
+
role="radio"
|
98
|
+
aria-checked={isChecked}
|
99
|
+
aria-labelledby={radioCardId}
|
100
|
+
__css={{ ...styles.container, ...(isChecked && styles.checked) }}
|
101
|
+
data-checked={isChecked}
|
102
|
+
data-disabled={isDisabled}
|
99
103
|
>
|
100
104
|
{children}
|
101
105
|
</Box>
|
@@ -1,120 +1,76 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Stack,
|
6
|
-
} from "@chakra-ui/react";
|
7
|
-
import React from "react";
|
8
|
-
import { RadioCard, RadioCardProps } from "./RadioCard";
|
9
|
-
|
10
|
-
type RadioCardGroupProps = RadioGroupProps & {
|
11
|
-
children: React.ReactNode;
|
12
|
-
props?: RadioGroupProps;
|
13
|
-
/** Defaults to "row" */
|
14
|
-
direction?: StackDirection;
|
15
|
-
/** Defaults to "base" */
|
16
|
-
variant?: string;
|
17
|
-
/** The name of the radio group */
|
18
|
-
name?: string;
|
19
|
-
/** The default value of the radio group */
|
20
|
-
defaultValue?: string;
|
21
|
-
/** The callback function to be called when the radio group value changes */
|
22
|
-
onChange?: (value: string) => void;
|
23
|
-
};
|
1
|
+
import { BoxProps, Stack } from "@chakra-ui/react";
|
2
|
+
import React, { useState } from "react";
|
3
|
+
import { FormLabel } from "../input";
|
4
|
+
import { RadioCard } from "./RadioCard";
|
24
5
|
|
25
6
|
/**
|
26
|
-
*
|
27
|
-
*
|
28
|
-
* You can and should pass the common `name` prop to the `RadioGroup`, instead of to each `Radio` component.
|
29
|
-
*
|
30
|
-
* ```tsx
|
31
|
-
* <RadioCardGroup name="ticket">
|
32
|
-
* <RadioCard>Economy</RadioCard>
|
33
|
-
* <RadioCard>Business</RadioCard>
|
34
|
-
* <RadioCard>First Class</RadioCard>
|
35
|
-
* </RadioCardGroup>
|
36
|
-
* ```
|
7
|
+
* RadioCardGroupContext is used to pass down the state and handlers to the RadioCard components.
|
37
8
|
*
|
38
|
-
* By default, radio cards show up horizontally. If you want them to show up vertically, please specify the `direction="column"` prop.
|
39
|
-
*
|
40
|
-
* ```tsx
|
41
|
-
* <RadioCardGroup name="ticket" direction="column">
|
42
|
-
* <RadioCard>Economy</RadioCard>
|
43
|
-
* <RadioCard>Business</RadioCard>
|
44
|
-
* <RadioCard>First Class</RadioCard>
|
45
|
-
* </RadioCardGroup>
|
46
|
-
* ```
|
47
|
-
*
|
48
|
-
* You can also specify the `defaultValue` prop to set the default value of the radio group.
|
49
|
-
*
|
50
|
-
* ```tsx
|
51
|
-
* <RadioCardGroup name="ticket" defaultValue="Economy">
|
52
|
-
* <RadioCard>Economy</RadioCard>
|
53
|
-
* <RadioCard>Business</RadioCard>
|
54
|
-
* <RadioCard>First Class</RadioCard>
|
55
|
-
* </RadioCardGroup>
|
56
|
-
* ```
|
57
|
-
*
|
58
|
-
* Check out RadioCard for more information on how to style the radio cards.
|
59
9
|
* @see RadioCard
|
60
10
|
*/
|
61
11
|
|
62
|
-
|
12
|
+
type RadioGroupContextProps = {
|
13
|
+
name: string;
|
14
|
+
selectedValue: string;
|
15
|
+
onChange: (value: string) => void;
|
16
|
+
variant?: "base" | "floating";
|
17
|
+
defaultValue?: string;
|
18
|
+
};
|
19
|
+
|
20
|
+
export const RadioCardGroupContext =
|
21
|
+
React.createContext<RadioGroupContextProps | null>(null);
|
22
|
+
|
23
|
+
type RadioCardGroupProps = BoxProps & {
|
24
|
+
name: string;
|
25
|
+
children: React.ReactNode;
|
26
|
+
variant?: "base" | "floating";
|
27
|
+
direction?: "row" | "column";
|
28
|
+
groupLabel?: string;
|
29
|
+
defaultValue?: string;
|
30
|
+
};
|
31
|
+
|
32
|
+
export const RadioCardGroup: React.FC<RadioCardGroupProps> = ({
|
63
33
|
children,
|
64
34
|
name,
|
35
|
+
variant = "base",
|
65
36
|
direction = "row",
|
66
|
-
|
37
|
+
groupLabel,
|
67
38
|
defaultValue,
|
68
|
-
variant = "base",
|
69
39
|
...props
|
70
40
|
}: RadioCardGroupProps) => {
|
71
|
-
const
|
72
|
-
defaultValue
|
73
|
-
|
74
|
-
onChange: onChange,
|
75
|
-
...props,
|
76
|
-
});
|
41
|
+
const [selectedValue, setSelectedValue] = useState<string>(
|
42
|
+
defaultValue || "",
|
43
|
+
);
|
77
44
|
|
78
|
-
const
|
45
|
+
const handleChange = (value: string) => {
|
46
|
+
setSelectedValue(value);
|
47
|
+
};
|
79
48
|
|
80
49
|
return (
|
81
|
-
<
|
82
|
-
{
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
50
|
+
<RadioCardGroupContext.Provider
|
51
|
+
value={{
|
52
|
+
name,
|
53
|
+
selectedValue,
|
54
|
+
onChange: handleChange,
|
55
|
+
variant,
|
56
|
+
defaultValue: defaultValue || "",
|
57
|
+
}}
|
58
|
+
>
|
59
|
+
<Stack
|
60
|
+
as="fieldset"
|
61
|
+
direction={direction}
|
62
|
+
aria-labelledby={groupLabel || name}
|
63
|
+
role="radiogroup"
|
64
|
+
tabIndex={0}
|
65
|
+
{...props}
|
66
|
+
>
|
67
|
+
{groupLabel && (
|
68
|
+
<FormLabel as="legend" id={groupLabel}>
|
69
|
+
{groupLabel}
|
70
|
+
</FormLabel>
|
71
|
+
)}
|
72
|
+
{children}
|
73
|
+
</Stack>
|
74
|
+
</RadioCardGroupContext.Provider>
|
98
75
|
);
|
99
76
|
};
|
100
|
-
|
101
|
-
function recursiveMap(
|
102
|
-
children: React.ReactNode,
|
103
|
-
fn: (child: React.ReactElement) => React.ReactElement,
|
104
|
-
): React.ReactNode {
|
105
|
-
return React.Children.map(children, (child) => {
|
106
|
-
// If this child is a React element and has children, recurse
|
107
|
-
if (React.isValidElement(child) && child.props.children) {
|
108
|
-
child = React.cloneElement(child as React.ReactElement<any>, {
|
109
|
-
children: recursiveMap(child.props.children, fn),
|
110
|
-
});
|
111
|
-
}
|
112
|
-
|
113
|
-
// Apply the function to the child (if it's a React element)
|
114
|
-
if (React.isValidElement(child)) {
|
115
|
-
return fn(child);
|
116
|
-
}
|
117
|
-
|
118
|
-
return child;
|
119
|
-
});
|
120
|
-
}
|
@@ -1,44 +1,12 @@
|
|
1
1
|
import { breadcrumbAnatomy as parts } from "@chakra-ui/anatomy";
|
2
|
-
import {
|
3
|
-
createMultiStyleConfigHelpers,
|
4
|
-
defineStyle,
|
5
|
-
} from "@chakra-ui/styled-system";
|
6
|
-
import { mode } from "@chakra-ui/theme-tools";
|
2
|
+
import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-system";
|
7
3
|
import { baseBackground, baseBorder } from "../utils/base-utils";
|
8
4
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
5
|
+
import { ghostBackground } from "../utils/ghost-utils";
|
9
6
|
|
10
7
|
const { defineMultiStyleConfig, definePartsStyle } =
|
11
8
|
createMultiStyleConfigHelpers(parts.keys);
|
12
9
|
|
13
|
-
const baseStyleLink = defineStyle((props) => ({
|
14
|
-
transitionProperty: "common",
|
15
|
-
transitionDuration: "fast",
|
16
|
-
transitionTimingFunction: "ease-out",
|
17
|
-
color: "inherit",
|
18
|
-
textDecoration: "none",
|
19
|
-
textStyle: "xs",
|
20
|
-
paddingX: 0.5,
|
21
|
-
borderRadius: "xs",
|
22
|
-
"&:not([aria-current=page])": {
|
23
|
-
cursor: "pointer",
|
24
|
-
_hover: {
|
25
|
-
...baseBackground("hover", props),
|
26
|
-
},
|
27
|
-
_active: {
|
28
|
-
...baseBackground("active", props),
|
29
|
-
},
|
30
|
-
...focusVisibleStyles(props),
|
31
|
-
},
|
32
|
-
}));
|
33
|
-
|
34
|
-
const baseStyle = definePartsStyle((props) => ({
|
35
|
-
link: baseStyleLink(props),
|
36
|
-
list: {
|
37
|
-
flexWrap: "wrap",
|
38
|
-
alignItems: "flex-start",
|
39
|
-
},
|
40
|
-
}));
|
41
|
-
|
42
10
|
export default defineMultiStyleConfig({
|
43
11
|
baseStyle: definePartsStyle((props) => ({
|
44
12
|
link: {
|
@@ -77,16 +45,10 @@ export default defineMultiStyleConfig({
|
|
77
45
|
link: {
|
78
46
|
"&:not([aria-current=page])": {
|
79
47
|
_hover: {
|
80
|
-
|
81
|
-
"ghost.surface.hover.light",
|
82
|
-
"ghost.surface.hover.dark",
|
83
|
-
)(props),
|
48
|
+
...ghostBackground("hover", props),
|
84
49
|
},
|
85
50
|
_active: {
|
86
|
-
|
87
|
-
"ghost.surface.active.light",
|
88
|
-
"ghost.surface.active.dark",
|
89
|
-
)(props),
|
51
|
+
...ghostBackground("active", props),
|
90
52
|
},
|
91
53
|
},
|
92
54
|
},
|
@@ -93,26 +93,26 @@ const config = defineStyleConfig({
|
|
93
93
|
lg: {
|
94
94
|
minHeight: 8,
|
95
95
|
minWidth: 8,
|
96
|
-
fontSize: "
|
96
|
+
fontSize: "sm",
|
97
97
|
fontWeight: "bold",
|
98
98
|
},
|
99
99
|
md: {
|
100
100
|
minHeight: 7,
|
101
101
|
minWidth: 7,
|
102
|
-
fontSize: "
|
102
|
+
fontSize: "sm",
|
103
103
|
fontWeight: "bold",
|
104
104
|
},
|
105
105
|
sm: {
|
106
106
|
minHeight: 6,
|
107
107
|
minWidth: 6,
|
108
|
-
fontSize: "
|
108
|
+
fontSize: "xs",
|
109
109
|
fontWeight: "normal",
|
110
110
|
},
|
111
111
|
xs: {
|
112
112
|
minHeight: 5,
|
113
113
|
minWidth: 5,
|
114
114
|
paddingY: 0.5,
|
115
|
-
fontSize: "
|
115
|
+
fontSize: "xs",
|
116
116
|
fontWeight: "normal",
|
117
117
|
},
|
118
118
|
},
|
@@ -15,9 +15,10 @@ const config = helpers.defineMultiStyleConfig({
|
|
15
15
|
container: {
|
16
16
|
display: "inline-flex",
|
17
17
|
alignItems: "center",
|
18
|
-
fontSize: "
|
18
|
+
fontSize: "xs",
|
19
19
|
cursor: "pointer",
|
20
20
|
transitionProperty: "all",
|
21
|
+
borderRadius: "xl",
|
21
22
|
transitionDuration: "fast",
|
22
23
|
_checked: {
|
23
24
|
outlineColor: "transparent",
|
@@ -117,42 +118,38 @@ const config = helpers.defineMultiStyleConfig({
|
|
117
118
|
sizes: {
|
118
119
|
xs: {
|
119
120
|
container: {
|
120
|
-
borderRadius: "30px",
|
121
121
|
_checked: {
|
122
|
-
borderRadius: "
|
122
|
+
borderRadius: "0.563rem",
|
123
123
|
},
|
124
|
-
height:
|
124
|
+
height: 5,
|
125
125
|
paddingX: 1.5,
|
126
126
|
},
|
127
127
|
},
|
128
128
|
sm: {
|
129
129
|
container: {
|
130
|
-
borderRadius: "30px",
|
131
130
|
_checked: {
|
132
|
-
borderRadius: "
|
131
|
+
borderRadius: "sm",
|
133
132
|
},
|
134
|
-
height:
|
133
|
+
height: 6,
|
135
134
|
paddingX: 2,
|
136
135
|
},
|
137
136
|
},
|
138
137
|
md: {
|
139
138
|
container: {
|
140
|
-
borderRadius: "30px",
|
141
139
|
_checked: {
|
142
|
-
borderRadius: "
|
140
|
+
borderRadius: "sm",
|
143
141
|
},
|
144
|
-
height:
|
142
|
+
height: 7,
|
145
143
|
paddingX: 2,
|
146
144
|
},
|
147
145
|
},
|
148
146
|
lg: {
|
149
147
|
container: {
|
150
|
-
borderRadius: "30px",
|
151
148
|
_checked: {
|
152
|
-
borderRadius: "
|
149
|
+
borderRadius: "md",
|
153
150
|
},
|
154
|
-
height:
|
155
|
-
|
151
|
+
height: 8,
|
152
|
+
paddingX: 3,
|
156
153
|
},
|
157
154
|
},
|
158
155
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { defineStyleConfig } from "@chakra-ui/react";
|
2
2
|
import { cssVar, mode } from "@chakra-ui/theme-tools";
|
3
3
|
import { focusVisibleStyles } from "../utils/focus-utils";
|
4
|
+
import { ghostBackground } from "../utils/ghost-utils";
|
4
5
|
|
5
6
|
const $size = cssVar("close-button-size");
|
6
7
|
|
@@ -16,27 +17,27 @@ const config = defineStyleConfig({
|
|
16
17
|
fontWeight: "normal",
|
17
18
|
...focusVisibleStyles(props),
|
18
19
|
_hover: {
|
19
|
-
|
20
|
+
...ghostBackground("hover", props),
|
20
21
|
_disabled: {
|
21
22
|
color: "dimGrey",
|
22
23
|
},
|
23
24
|
},
|
24
25
|
_active: {
|
25
|
-
|
26
|
+
...ghostBackground("active", props),
|
26
27
|
},
|
27
28
|
}),
|
28
29
|
sizes: {
|
29
30
|
lg: {
|
30
31
|
[$size.variable]: "40px",
|
31
|
-
fontSize: "
|
32
|
+
fontSize: "xs",
|
32
33
|
},
|
33
34
|
md: {
|
34
35
|
[$size.variable]: "32px",
|
35
|
-
fontSize: "
|
36
|
+
fontSize: "0.75rem",
|
36
37
|
},
|
37
38
|
sm: {
|
38
39
|
[$size.variable]: "24px",
|
39
|
-
fontSize: "
|
40
|
+
fontSize: "0.625rem",
|
40
41
|
},
|
41
42
|
},
|
42
43
|
defaultProps: {
|