@vygruppen/spor-react 8.2.1 → 9.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 +10 -12
- package/CHANGELOG.md +34 -0
- package/dist/{CountryCodeSelect-NEASN3EC.mjs → CountryCodeSelect-LFDBAHV7.mjs} +1 -1
- package/dist/{chunk-AKOJGLTQ.mjs → chunk-BWLVKMWU.mjs} +1262 -1785
- package/dist/index.d.mts +1664 -813
- package/dist/index.d.ts +1664 -813
- package/dist/index.js +1551 -2011
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/accordion/Expandable.tsx +22 -2
- package/src/breadcrumb/Breadcrumb.tsx +4 -2
- package/src/datepicker/DateRangePicker.tsx +1 -0
- package/src/input/ChoiceChip.tsx +3 -3
- package/src/input/NumericStepper.tsx +7 -49
- package/src/input/PasswordInput.tsx +2 -0
- package/src/input/PhoneNumberInput.tsx +1 -1
- package/src/input/Switch.tsx +4 -7
- package/src/loader/ProgressBar.tsx +7 -24
- package/src/tab/Tabs.tsx +4 -5
- package/src/theme/components/accordion.ts +12 -16
- package/src/theme/components/alert-expandable.ts +10 -21
- package/src/theme/components/breadcrumb.ts +60 -5
- package/src/theme/components/button.ts +40 -75
- package/src/theme/components/card-select.ts +14 -56
- package/src/theme/components/card.ts +56 -63
- package/src/theme/components/checkbox.ts +20 -20
- package/src/theme/components/choice-chip.ts +28 -43
- package/src/theme/components/close-button.ts +1 -1
- package/src/theme/components/datepicker.ts +48 -166
- package/src/theme/components/drawer.ts +6 -4
- package/src/theme/components/fab.ts +35 -62
- package/src/theme/components/index.ts +3 -1
- package/src/theme/components/info-select.ts +5 -9
- package/src/theme/components/input.ts +17 -32
- package/src/theme/components/link.ts +8 -8
- package/src/theme/components/listbox.ts +5 -7
- package/src/theme/components/media-controller-button.ts +20 -25
- package/src/theme/components/modal.ts +8 -6
- package/src/theme/components/numeric-stepper.ts +65 -0
- package/src/theme/components/popover.ts +7 -8
- package/src/theme/components/progress-bar.ts +43 -0
- package/src/theme/components/progress-indicator.ts +5 -2
- package/src/theme/components/radio.ts +15 -12
- package/src/theme/components/select.ts +2 -2
- package/src/theme/components/stepper.ts +10 -7
- package/src/theme/components/switch.ts +35 -82
- package/src/theme/components/table.ts +10 -12
- package/src/theme/components/tabs.ts +55 -261
- package/src/theme/components/travel-tag.ts +3 -6
- package/src/theme/foundations/colors.ts +3 -1
- package/src/theme/foundations/fonts.ts +2 -2
- package/src/theme/index.ts +9 -6
- package/src/theme/utils/accent-utils.ts +54 -0
- package/src/theme/utils/base-utils.ts +94 -0
- package/src/theme/utils/bg-utils.ts +19 -0
- package/src/theme/utils/brand-utils.ts +42 -0
- package/src/theme/utils/floating-utils.ts +64 -0
- package/src/theme/utils/{focus-util.ts → focus-utils.ts} +1 -1
- package/src/theme/utils/ghost-utils.ts +40 -0
- package/src/theme/utils/surface-utils.ts +35 -0
- package/src/tooltip/Tooltip.tsx +17 -20
- package/src/typography/Heading.tsx +7 -2
- package/src/util/externals.tsx +0 -1
- package/src/theme/utils/background-utils.ts +0 -179
- package/src/theme/utils/border-utils.ts +0 -176
- package/src/theme/utils/box-shadow-utils.ts +0 -44
- package/src/theme/utils/text-utils.ts +0 -60
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, 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, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, 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, 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, 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, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, 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, 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-BWLVKMWU.mjs';
|
package/package.json
CHANGED
@@ -12,7 +12,10 @@ 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 = Omit<
|
15
|
+
type ExpandableProps = Omit<
|
16
|
+
AccordionProps,
|
17
|
+
"title" | "index" | "defaultIndex" | "onChange"
|
18
|
+
> & {
|
16
19
|
/** The hidden content */
|
17
20
|
children: React.ReactNode;
|
18
21
|
/** The title that's shown inside the toggle button */
|
@@ -28,6 +31,13 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
|
|
28
31
|
* If the size is set to `lg`, the icon should be 30px.
|
29
32
|
*/
|
30
33
|
leftIcon?: React.ReactNode;
|
34
|
+
|
35
|
+
/** Controlled value of whether the accordion is open or not */
|
36
|
+
isOpen?: boolean;
|
37
|
+
/** Default value of when the accordion is open or not */
|
38
|
+
defaultOpen?: boolean;
|
39
|
+
/** Callback for when the expandable opens or closes */
|
40
|
+
onChange?: (isOpen: boolean) => void;
|
31
41
|
};
|
32
42
|
/**
|
33
43
|
* A standalone expandable component.
|
@@ -47,10 +57,20 @@ export const Expandable = ({
|
|
47
57
|
title,
|
48
58
|
leftIcon,
|
49
59
|
size = "md",
|
60
|
+
defaultOpen,
|
61
|
+
isOpen,
|
62
|
+
onChange = () => {},
|
50
63
|
...rest
|
51
64
|
}: ExpandableProps) => {
|
52
65
|
return (
|
53
|
-
<Accordion
|
66
|
+
<Accordion
|
67
|
+
{...rest}
|
68
|
+
index={isOpen ? 0 : undefined}
|
69
|
+
defaultIndex={defaultOpen ? 0 : undefined}
|
70
|
+
allowMultiple={true}
|
71
|
+
size={size}
|
72
|
+
onChange={(expandedIndex) => onChange(expandedIndex === 0)}
|
73
|
+
>
|
54
74
|
<ExpandableItem
|
55
75
|
headingLevel={headingLevel}
|
56
76
|
title={title}
|
@@ -3,12 +3,14 @@ import {
|
|
3
3
|
BreadcrumbItem as ChakraBreadcrumbItem,
|
4
4
|
BreadcrumbLink as ChakraBreadcrumbLink,
|
5
5
|
BreadcrumbProps as ChakraBreadcrumbProps,
|
6
|
+
useColorModeValue,
|
6
7
|
} from "@chakra-ui/react";
|
7
8
|
import { DropdownRightFill18Icon } from "@vygruppen/spor-icon-react";
|
8
9
|
import React from "react";
|
9
|
-
import { useColorModeValue } from "@chakra-ui/react";
|
10
10
|
|
11
|
-
type BreadcrumbProps = ChakraBreadcrumbProps
|
11
|
+
type BreadcrumbProps = Omit<ChakraBreadcrumbProps, "variant"> & {
|
12
|
+
variant?: "base" | "ghost";
|
13
|
+
};
|
12
14
|
/**
|
13
15
|
* A breadcrumb component.
|
14
16
|
*
|
package/src/input/ChoiceChip.tsx
CHANGED
@@ -19,14 +19,14 @@ export type ChoiceChipProps = {
|
|
19
19
|
default: React.ReactNode;
|
20
20
|
checked: React.ReactNode;
|
21
21
|
};
|
22
|
-
size?: "
|
22
|
+
size?: "xs" | "sm" | "md" | "lg";
|
23
23
|
chipType?: "icon" | "choice" | "filter";
|
24
24
|
variant?: "base" | "accent" | "floating";
|
25
25
|
};
|
26
26
|
/**
|
27
27
|
* Choice chips are checkboxes that look like selectable buttons.
|
28
28
|
*
|
29
|
-
* Choice chips are available in four different sizes - `
|
29
|
+
* Choice chips are available in four different sizes - `xs`, `sm`, `md` and `lg`.
|
30
30
|
*
|
31
31
|
* ```tsx
|
32
32
|
* <Stack flexDirection="row">
|
@@ -59,7 +59,7 @@ export const ChoiceChip = forwardRef((props: ChoiceChipProps, ref) => {
|
|
59
59
|
children,
|
60
60
|
icon,
|
61
61
|
isDisabled,
|
62
|
-
size = "
|
62
|
+
size = "sm",
|
63
63
|
chipType = "choice",
|
64
64
|
variant = "base",
|
65
65
|
} = props;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import {
|
2
2
|
chakra,
|
3
|
-
useColorModeValue,
|
4
3
|
useControllableState,
|
5
4
|
useFormControl,
|
5
|
+
useMultiStyleConfig,
|
6
6
|
} from "@chakra-ui/react";
|
7
7
|
import React from "react";
|
8
8
|
import {
|
@@ -13,7 +13,6 @@ import {
|
|
13
13
|
createTexts,
|
14
14
|
useTranslation,
|
15
15
|
} from "..";
|
16
|
-
import { getBoxShadowString } from "../theme/utils/box-shadow-utils";
|
17
16
|
|
18
17
|
type NumericStepperProps = {
|
19
18
|
/** The name of the input field */
|
@@ -76,19 +75,17 @@ export function NumericStepper({
|
|
76
75
|
...boxProps
|
77
76
|
}: NumericStepperProps) {
|
78
77
|
const { t } = useTranslation();
|
78
|
+
const styles = useMultiStyleConfig("NumericStepper", {});
|
79
79
|
const [value, onChange] = useControllableState<number>({
|
80
80
|
value: valueProp,
|
81
81
|
onChange: onChangeProp,
|
82
82
|
defaultValue,
|
83
83
|
});
|
84
84
|
const formControlProps = useFormControl({ id: idProp, isDisabled });
|
85
|
-
const textColor = useColorModeValue("darkGrey", "white");
|
86
|
-
const backgroundColor = useColorModeValue("white", "darkGrey");
|
87
|
-
const focusColor = useColorModeValue("greenHaze", "azure");
|
88
85
|
const clampedStepSize = Math.max(Math.min(stepSize, 10), 1);
|
89
86
|
|
90
87
|
return (
|
91
|
-
<Flex
|
88
|
+
<Flex __css={styles.container} {...boxProps}>
|
92
89
|
<VerySmallButton
|
93
90
|
icon={<SubtractIcon stepLabel={clampedStepSize} />}
|
94
91
|
aria-label={t(texts.decrementButtonAriaLabel(clampedStepSize))}
|
@@ -106,38 +103,11 @@ export function NumericStepper({
|
|
106
103
|
value={value}
|
107
104
|
{...formControlProps}
|
108
105
|
id={!showZero && value === 0 ? undefined : formControlProps.id}
|
109
|
-
|
110
|
-
fontWeight="bold"
|
106
|
+
sx={styles.input}
|
111
107
|
width={`${Math.max(value.toString().length + 1, 3)}ch`}
|
112
|
-
marginX={1}
|
113
|
-
paddingX={1}
|
114
|
-
borderRadius="xs"
|
115
|
-
textAlign="center"
|
116
|
-
backgroundColor={backgroundColor}
|
117
|
-
color={textColor}
|
118
|
-
transition="box-shadow .1s ease-out"
|
119
108
|
visibility={!showZero && value === 0 ? "hidden" : "visible"}
|
120
109
|
aria-live="assertive"
|
121
110
|
aria-label={value.toString()}
|
122
|
-
_hover={{
|
123
|
-
boxShadow: getBoxShadowString({
|
124
|
-
borderColor: "currentColor",
|
125
|
-
borderWidth: 1,
|
126
|
-
}),
|
127
|
-
_disabled: {
|
128
|
-
boxShadow: "none",
|
129
|
-
},
|
130
|
-
}}
|
131
|
-
_disabled={{
|
132
|
-
opacity: 0.5,
|
133
|
-
}}
|
134
|
-
_focus={{
|
135
|
-
outline: "none",
|
136
|
-
boxShadow: getBoxShadowString({
|
137
|
-
borderColor: focusColor,
|
138
|
-
borderWidth: 1,
|
139
|
-
}),
|
140
|
-
}}
|
141
111
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
142
112
|
const numericInput = Number(e.target.value);
|
143
113
|
if (Number.isNaN(numericInput)) {
|
@@ -148,14 +118,7 @@ export function NumericStepper({
|
|
148
118
|
/>
|
149
119
|
) : (
|
150
120
|
<chakra.text
|
151
|
-
|
152
|
-
fontWeight="bold"
|
153
|
-
width="4ch"
|
154
|
-
marginX={1}
|
155
|
-
paddingX={1}
|
156
|
-
textAlign="center"
|
157
|
-
color={textColor}
|
158
|
-
transition="box-shadow .1s ease-out"
|
121
|
+
sx={styles.text}
|
159
122
|
visibility={!showZero && value === 0 ? "hidden" : "visible"}
|
160
123
|
aria-label={value.toString()}
|
161
124
|
>
|
@@ -190,14 +153,9 @@ type VerySmallButtonProps = {
|
|
190
153
|
};
|
191
154
|
/** Internal override for extra small icon buttons */
|
192
155
|
const VerySmallButton = (props: VerySmallButtonProps) => {
|
156
|
+
const styles = useMultiStyleConfig("NumericStepper", {});
|
193
157
|
return (
|
194
|
-
<IconButton
|
195
|
-
variant="primary"
|
196
|
-
size="xs"
|
197
|
-
minWidth="24px"
|
198
|
-
minHeight="24px"
|
199
|
-
{...props}
|
200
|
-
/>
|
158
|
+
<IconButton variant="primary" size="xs" sx={styles.button} {...props} />
|
201
159
|
);
|
202
160
|
};
|
203
161
|
|
package/src/input/Switch.tsx
CHANGED
@@ -5,10 +5,7 @@ import {
|
|
5
5
|
} from "@chakra-ui/react";
|
6
6
|
import React from "react";
|
7
7
|
|
8
|
-
export type SwitchProps =
|
9
|
-
ChakraSwitchProps,
|
10
|
-
"colorScheme" | "variant"
|
11
|
-
> & {
|
8
|
+
export type SwitchProps = Omit<ChakraSwitchProps, "colorScheme" | "variant"> & {
|
12
9
|
size?: "sm" | "md" | "lg";
|
13
10
|
};
|
14
11
|
|
@@ -24,17 +21,17 @@ export type SwitchProps = Exclude<
|
|
24
21
|
* </FormControl>
|
25
22
|
* ```
|
26
23
|
*
|
27
|
-
* Switches are available in three different sizes - `sm`, `md` and `lg`.
|
24
|
+
* Switches are available in three different sizes - `sm`, `md` and `lg`.
|
28
25
|
*
|
29
26
|
* ```tsx
|
30
27
|
* <FormControl>
|
31
28
|
* <FormLabel>Enable alerts?</FormLabel>
|
32
|
-
* <Switch
|
29
|
+
* <Switch size="sm" />
|
33
30
|
* </FormControl>
|
34
31
|
* ```
|
35
32
|
*/
|
36
33
|
export const Switch = forwardRef<SwitchProps, "input">(
|
37
34
|
({ size = "md", ...props }: SwitchProps, ref) => {
|
38
|
-
return <ChakraSwitch
|
35
|
+
return <ChakraSwitch size={size} {...props} ref={ref} />;
|
39
36
|
},
|
40
37
|
);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Box, BoxProps,
|
1
|
+
import { Box, BoxProps, Text, useMultiStyleConfig } from "@chakra-ui/react";
|
2
2
|
import React from "react";
|
3
3
|
import { useProgressBar } from "react-aria";
|
4
4
|
import { createTexts, useTranslation } from "..";
|
@@ -79,37 +79,20 @@ export const ProgressBar = ({
|
|
79
79
|
value,
|
80
80
|
"aria-label": ariaLabel || t(texts.label(value)),
|
81
81
|
});
|
82
|
+
const styles = useMultiStyleConfig("ProgressBar", {});
|
82
83
|
return (
|
83
84
|
<>
|
84
85
|
<Box
|
85
86
|
{...progressBarProps}
|
86
87
|
title={t(texts.label(value))}
|
87
|
-
|
88
|
+
__css={styles.container}
|
88
89
|
{...rest}
|
89
90
|
>
|
90
|
-
<
|
91
|
-
|
92
|
-
|
93
|
-
width={width}
|
94
|
-
justifyContent="flex-start"
|
95
|
-
marginX="auto"
|
96
|
-
>
|
97
|
-
<Box
|
98
|
-
backgroundColor="greenHaze"
|
99
|
-
borderRadius="sm"
|
100
|
-
height={height}
|
101
|
-
width={`${value}%`}
|
102
|
-
maxWidth="100%"
|
103
|
-
transition="width .2s ease-out"
|
104
|
-
/>
|
105
|
-
</Flex>
|
91
|
+
<Box width={width} __css={styles.background}>
|
92
|
+
<Box __css={styles.progress} height={height} width={`${value}%`} />
|
93
|
+
</Box>
|
106
94
|
{currentLoadingText && (
|
107
|
-
<Text
|
108
|
-
textAlign="center"
|
109
|
-
marginTop={2}
|
110
|
-
fontWeight="bold"
|
111
|
-
{...labelProps}
|
112
|
-
>
|
95
|
+
<Text sx={styles.description} {...labelProps}>
|
113
96
|
{currentLoadingText}
|
114
97
|
</Text>
|
115
98
|
)}
|
package/src/tab/Tabs.tsx
CHANGED
@@ -9,11 +9,10 @@ export type TabsProps = Exclude<
|
|
9
9
|
ChakraTabsProps,
|
10
10
|
"colorScheme" | "variant" | "orientation" | "size"
|
11
11
|
> & {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
variant?: "square" | "round";
|
12
|
+
/** Defaults to `base` */
|
13
|
+
variant: "base" | "accent";
|
14
|
+
/** Defaults to `sm` */
|
15
|
+
size?: "xs" | "sm" | "md" | "lg";
|
17
16
|
};
|
18
17
|
export const Tabs = forwardRef<TabsProps, "div">((props, ref) => {
|
19
18
|
return <ChakraTabs {...props} ref={ref} />;
|
@@ -1,38 +1,32 @@
|
|
1
1
|
import { accordionAnatomy as parts } from "@chakra-ui/anatomy";
|
2
2
|
import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-system";
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
} from "../utils/background-utils";
|
8
|
-
import { baseBorder, floatingBorder } from "../utils/border-utils";
|
9
|
-
import { focusVisibleStyles } from "../utils/focus-util";
|
10
|
-
import { baseText } from "../utils/text-utils";
|
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 { ghostBackground } from "../utils/ghost-utils";
|
11
7
|
|
12
8
|
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
13
9
|
const config = helpers.defineMultiStyleConfig({
|
14
10
|
baseStyle: (props) => ({
|
15
11
|
container: {
|
16
|
-
border: "none",
|
17
12
|
borderRadius: "sm",
|
18
13
|
},
|
19
14
|
button: {
|
20
15
|
transitionProperty:
|
21
16
|
"background-color, color, border-radius, box-shadow, opacity",
|
22
|
-
transitionDuration: "
|
23
|
-
border: "none",
|
17
|
+
transitionDuration: "fast",
|
24
18
|
borderRadius: "sm",
|
25
|
-
borderColor: "osloGrey",
|
26
19
|
display: "flex",
|
27
20
|
justifyContent: "space-between",
|
28
21
|
...baseText("default", props),
|
29
22
|
textAlign: "left",
|
30
23
|
fontFamily: "body",
|
31
24
|
fontWeight: "bold",
|
25
|
+
outlineOffset: "-2px",
|
32
26
|
...focusVisibleStyles(props),
|
33
27
|
_disabled: {
|
28
|
+
pointerEvents: "none",
|
34
29
|
opacity: 0.4,
|
35
|
-
cursor: "not-allowed",
|
36
30
|
},
|
37
31
|
},
|
38
32
|
panel: {
|
@@ -46,7 +40,6 @@ const config = helpers.defineMultiStyleConfig({
|
|
46
40
|
variants: {
|
47
41
|
ghost: (props) => ({
|
48
42
|
button: {
|
49
|
-
boxShadow: "none",
|
50
43
|
_hover: {
|
51
44
|
...ghostBackground("hover", props),
|
52
45
|
},
|
@@ -65,6 +58,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
65
58
|
},
|
66
59
|
_hover: {
|
67
60
|
...baseBorder("hover", props),
|
61
|
+
outlineOffset: 0,
|
68
62
|
},
|
69
63
|
_active: {
|
70
64
|
...baseBackground("active", props),
|
@@ -76,14 +70,16 @@ const config = helpers.defineMultiStyleConfig({
|
|
76
70
|
container: {
|
77
71
|
...floatingBackground("default", props),
|
78
72
|
...floatingBorder("default", props),
|
73
|
+
boxShadow: "sm",
|
79
74
|
},
|
80
75
|
button: {
|
81
76
|
_expanded: {
|
82
77
|
borderBottomRadius: "none",
|
83
78
|
},
|
84
79
|
_hover: {
|
85
|
-
...
|
86
|
-
...floatingBorder("
|
80
|
+
...floatingBackground("hover", props),
|
81
|
+
...floatingBorder("hover", props),
|
82
|
+
outlineOffset: 1,
|
87
83
|
},
|
88
84
|
_active: {
|
89
85
|
...ghostBackground("active", props),
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { anatomy } from "@chakra-ui/anatomy";
|
2
2
|
import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-system";
|
3
|
-
import { getBoxShadowString } from "../utils/box-shadow-utils";
|
4
3
|
|
5
4
|
const parts = anatomy("alertExpandable").parts("container");
|
6
5
|
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
@@ -11,19 +10,21 @@ const config = helpers.defineMultiStyleConfig({
|
|
11
10
|
paddingX: 3,
|
12
11
|
paddingY: 2,
|
13
12
|
fontSize: "inherit",
|
13
|
+
transitionProperty: "outline, border-radius",
|
14
|
+
transitionDuration: "fast",
|
14
15
|
_expanded: {
|
15
16
|
borderBottomRadius: "none",
|
16
17
|
},
|
18
|
+
_hover: {
|
19
|
+
outline: "2px solid",
|
20
|
+
},
|
17
21
|
},
|
18
22
|
},
|
19
23
|
variants: {
|
20
24
|
info: {
|
21
25
|
container: {
|
22
26
|
_hover: {
|
23
|
-
|
24
|
-
borderColor: "sky",
|
25
|
-
borderWidth: 2,
|
26
|
-
}),
|
27
|
+
outlineColor: "sky",
|
27
28
|
},
|
28
29
|
_active: {
|
29
30
|
backgroundColor: "icyBlue",
|
@@ -33,10 +34,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
33
34
|
success: {
|
34
35
|
container: {
|
35
36
|
_hover: {
|
36
|
-
|
37
|
-
borderColor: "blueGreen",
|
38
|
-
borderWidth: 2,
|
39
|
-
}),
|
37
|
+
outlineColor: "blueGreen",
|
40
38
|
},
|
41
39
|
_active: {
|
42
40
|
backgroundColor: "mint",
|
@@ -46,10 +44,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
46
44
|
warning: {
|
47
45
|
container: {
|
48
46
|
_hover: {
|
49
|
-
|
50
|
-
borderColor: "sunshine",
|
51
|
-
borderWidth: 2,
|
52
|
-
}),
|
47
|
+
outlineColor: "sunshine",
|
53
48
|
},
|
54
49
|
_active: {
|
55
50
|
backgroundColor: "cornSilk",
|
@@ -59,10 +54,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
59
54
|
"alt-transport": {
|
60
55
|
container: {
|
61
56
|
_hover: {
|
62
|
-
|
63
|
-
borderColor: "golden",
|
64
|
-
borderWidth: 2,
|
65
|
-
}),
|
57
|
+
outlineColor: "golden",
|
66
58
|
},
|
67
59
|
_active: {
|
68
60
|
backgroundColor: "sunshine",
|
@@ -72,10 +64,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
72
64
|
error: {
|
73
65
|
container: {
|
74
66
|
_hover: {
|
75
|
-
|
76
|
-
borderColor: "apricot",
|
77
|
-
borderWidth: 2,
|
78
|
-
}),
|
67
|
+
outlineColor: "apricot",
|
79
68
|
},
|
80
69
|
_active: {
|
81
70
|
backgroundColor: "pink",
|
@@ -4,7 +4,8 @@ import {
|
|
4
4
|
defineStyle,
|
5
5
|
} from "@chakra-ui/styled-system";
|
6
6
|
import { mode } from "@chakra-ui/theme-tools";
|
7
|
-
import {
|
7
|
+
import { baseBackground, baseBorder } from "../utils/base-utils";
|
8
|
+
import { focusVisibleStyles } from "../utils/focus-utils";
|
8
9
|
|
9
10
|
const { defineMultiStyleConfig, definePartsStyle } =
|
10
11
|
createMultiStyleConfigHelpers(parts.keys);
|
@@ -21,12 +22,12 @@ const baseStyleLink = defineStyle((props) => ({
|
|
21
22
|
"&:not([aria-current=page])": {
|
22
23
|
cursor: "pointer",
|
23
24
|
_hover: {
|
24
|
-
|
25
|
+
...baseBackground("hover", props),
|
25
26
|
},
|
26
|
-
...focusVisibleStyles(props),
|
27
27
|
_active: {
|
28
|
-
|
28
|
+
...baseBackground("active", props),
|
29
29
|
},
|
30
|
+
...focusVisibleStyles(props),
|
30
31
|
},
|
31
32
|
}));
|
32
33
|
|
@@ -39,5 +40,59 @@ const baseStyle = definePartsStyle((props) => ({
|
|
39
40
|
}));
|
40
41
|
|
41
42
|
export default defineMultiStyleConfig({
|
42
|
-
baseStyle
|
43
|
+
baseStyle: definePartsStyle((props) => ({
|
44
|
+
link: {
|
45
|
+
transitionProperty: "common",
|
46
|
+
transitionDuration: "fast",
|
47
|
+
transitionTimingFunction: "ease-out",
|
48
|
+
color: "inherit",
|
49
|
+
textDecoration: "none",
|
50
|
+
textStyle: "xs",
|
51
|
+
paddingX: 0.5,
|
52
|
+
borderRadius: "xs",
|
53
|
+
"&:not([aria-current=page])": {
|
54
|
+
cursor: "pointer",
|
55
|
+
...focusVisibleStyles(props),
|
56
|
+
},
|
57
|
+
},
|
58
|
+
list: {
|
59
|
+
flexWrap: "wrap",
|
60
|
+
alignItems: "flex-start",
|
61
|
+
},
|
62
|
+
})),
|
63
|
+
variants: {
|
64
|
+
base: (props) => ({
|
65
|
+
link: {
|
66
|
+
"&:not([aria-current=page])": {
|
67
|
+
_hover: {
|
68
|
+
...baseBorder("default", props),
|
69
|
+
},
|
70
|
+
_active: {
|
71
|
+
...baseBackground("active", props),
|
72
|
+
},
|
73
|
+
},
|
74
|
+
},
|
75
|
+
}),
|
76
|
+
ghost: (props) => ({
|
77
|
+
link: {
|
78
|
+
"&:not([aria-current=page])": {
|
79
|
+
_hover: {
|
80
|
+
backgroundColor: mode(
|
81
|
+
"ghost.surface.hover.light",
|
82
|
+
"ghost.surface.hover.dark",
|
83
|
+
)(props),
|
84
|
+
},
|
85
|
+
_active: {
|
86
|
+
backgroundColor: mode(
|
87
|
+
"ghost.surface.active.light",
|
88
|
+
"ghost.surface.active.dark",
|
89
|
+
)(props),
|
90
|
+
},
|
91
|
+
},
|
92
|
+
},
|
93
|
+
}),
|
94
|
+
},
|
95
|
+
defaultProps: {
|
96
|
+
variant: "base",
|
97
|
+
},
|
43
98
|
});
|