@vygruppen/spor-react 7.2.2 → 8.0.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 +12 -12
- package/CHANGELOG.md +56 -0
- package/dist/{CountryCodeSelect-K45HQCJC.mjs → CountryCodeSelect-SCMCRKY4.mjs} +1 -1
- package/dist/{chunk-PPXTF3R3.mjs → chunk-5VZ5S46A.mjs} +749 -493
- package/dist/index.d.mts +302 -191
- package/dist/index.d.ts +302 -191
- package/dist/index.js +713 -474
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.tsx +6 -6
- package/src/accordion/Expandable.tsx +2 -2
- package/src/datepicker/DatePicker.tsx +1 -0
- package/src/index.tsx +2 -1
- package/src/input/ChoiceChip.tsx +23 -12
- package/src/nudge/Nudge.tsx +146 -0
- package/src/nudge/WizardNudge.tsx +107 -0
- package/src/nudge/index.tsx +2 -0
- package/src/progress-indicator/ProgressIndicator.tsx +5 -1
- package/src/theme/components/accordion.ts +24 -40
- package/src/theme/components/button.ts +1 -1
- package/src/theme/components/choice-chip.ts +125 -27
- package/src/theme/components/datepicker.ts +0 -4
- package/src/theme/components/popover.ts +8 -9
- package/src/theme/utils/background-utils.ts +68 -2
- package/src/theme/utils/border-utils.ts +86 -0
- package/src/theme/utils/text-utils.ts +40 -0
- package/src/{popover/SimplePopover.tsx → tooltip/Tooltip.tsx} +17 -19
- package/src/tooltip/index.tsx +1 -0
- package/src/popover/PopoverWizardBody.tsx +0 -91
- package/src/popover/WizardPopover.tsx +0 -61
- package/src/popover/index.tsx +0 -23
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, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton,
|
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-5VZ5S46A.mjs';
|
package/package.json
CHANGED
@@ -22,20 +22,20 @@ export type AccordionProps = Omit<ChakraAccordionProps, "variant" | "size"> & {
|
|
22
22
|
/**
|
23
23
|
* The display variant of the accordion items.
|
24
24
|
*
|
25
|
-
* - `
|
26
|
-
* - `
|
27
|
-
* - `
|
25
|
+
* - `ghost` renders a pretty unstyled expandable list without any borders
|
26
|
+
* - `base` renders an outlined version
|
27
|
+
* - `floating` renders a version with a drop shadow
|
28
28
|
*/
|
29
|
-
variant?: "
|
29
|
+
variant?: "ghost" | "base" | "floating";
|
30
30
|
size?: "sm" | "md" | "lg";
|
31
31
|
/** The margin between accordion items */
|
32
32
|
spacing?: StackProps["spacing"];
|
33
33
|
};
|
34
|
-
|
34
|
+
/*
|
35
35
|
* Wraps a set of ExpandableItem or AccordionItem components.
|
36
36
|
*
|
37
37
|
* ```tsx
|
38
|
-
* <Accordion variant="
|
38
|
+
* <Accordion variant="ghost" size="md">
|
39
39
|
* <ExpandableItem title="Is Spor easy?" headingLevel="h3">
|
40
40
|
* Yes
|
41
41
|
* </ExpandableItem>
|
@@ -36,7 +36,7 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
|
|
36
36
|
* If you want several expandables in a row, use the `Accordion` and `ExpandableItem` components instead.
|
37
37
|
*
|
38
38
|
* ```tsx
|
39
|
-
* <Expandable title="Click for more" variant="
|
39
|
+
* <Expandable title="Click for more" variant="base" size="lg">
|
40
40
|
* <Text>MORE! 🎉</Text>
|
41
41
|
* </Expandable>
|
42
42
|
* ```
|
@@ -80,7 +80,7 @@ export type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
|
|
80
80
|
* An item in a set of Expandables. Must be wrapped in an `<Accordion>` component.
|
81
81
|
*
|
82
82
|
* ```tsx
|
83
|
-
* <Accordion variant="
|
83
|
+
* <Accordion variant="ghost" size="md">
|
84
84
|
* <ExpandableItem title="Is Spor easy?" headingLevel="h3">
|
85
85
|
* Yes
|
86
86
|
* </ExpandableItem>
|
package/src/index.tsx
CHANGED
@@ -16,7 +16,7 @@ export * from "./loader";
|
|
16
16
|
export * from "./logo";
|
17
17
|
export * from "./media-controller";
|
18
18
|
export * from "./modal";
|
19
|
-
export * from "./
|
19
|
+
export * from "./nudge";
|
20
20
|
export * from "./progress-indicator";
|
21
21
|
export * from "./provider";
|
22
22
|
export * from "./stepper";
|
@@ -24,6 +24,7 @@ export * from "./tab";
|
|
24
24
|
export * from "./table";
|
25
25
|
export * from "./theme";
|
26
26
|
export * from "./toast";
|
27
|
+
export * from "./tooltip";
|
27
28
|
export * from "./transition";
|
28
29
|
export * from "./typography";
|
29
30
|
export * from "./util";
|
package/src/input/ChoiceChip.tsx
CHANGED
@@ -11,6 +11,7 @@ import React, { ChangeEvent, useId } from "react";
|
|
11
11
|
export type ChoiceChipProps = {
|
12
12
|
onChange?: (value: ChangeEvent<HTMLInputElement>) => void;
|
13
13
|
isChecked?: boolean;
|
14
|
+
isDisabled?: boolean;
|
14
15
|
defaultChecked?: boolean;
|
15
16
|
/** The button text */
|
16
17
|
children: React.ReactNode;
|
@@ -19,7 +20,8 @@ export type ChoiceChipProps = {
|
|
19
20
|
checked: React.ReactNode;
|
20
21
|
};
|
21
22
|
size?: "sm" | "md" | "lg" | "xl";
|
22
|
-
|
23
|
+
chipType?: "icon" | "choice" | "filter";
|
24
|
+
variant?: "base" | "accent" | "floating";
|
23
25
|
};
|
24
26
|
/**
|
25
27
|
* Choice chips are checkboxes that look like selectable buttons.
|
@@ -33,26 +35,34 @@ export type ChoiceChipProps = {
|
|
33
35
|
* </Stack>
|
34
36
|
* ```
|
35
37
|
*
|
36
|
-
* There are also three different
|
38
|
+
* There are also three different chipType - `icon`, `choice` and `filter`.
|
37
39
|
*
|
38
40
|
* ```tsx
|
39
41
|
* <Stack flexDirection="row">
|
40
|
-
* <ChoiceChip
|
41
|
-
* <ChoiceChip
|
42
|
-
* <ChoiceChip
|
42
|
+
* <ChoiceChip chipType="icon" icon={<Bus24Icon />}>Bus</ChoiceChip>
|
43
|
+
* <ChoiceChip chipType="choice" icon={<Bus24Icon />}>Bus</ChoiceChip>
|
44
|
+
* <ChoiceChip chipType="filter" icon={<Bus24Icon />}>Bus</ChoiceChip>
|
43
45
|
* </Stack>
|
44
46
|
*
|
45
|
-
*
|
47
|
+
* There are also three different variants - `base`, `accent` and `floating`.
|
46
48
|
*
|
47
49
|
* ```tsx
|
48
50
|
* <Stack flexDirection="row">
|
49
|
-
* <ChoiceChip
|
50
|
-
* <ChoiceChip
|
51
|
+
* <ChoiceChip variant="base">Bus</ChoiceChip>
|
52
|
+
* <ChoiceChip variant="accent">Boat</ChoiceChip>
|
53
|
+
* <ChoiceChip variant="floating">Train</ChoiceChip>
|
51
54
|
* </Stack>
|
52
55
|
* ```
|
53
56
|
*/
|
54
57
|
export const ChoiceChip = forwardRef((props: ChoiceChipProps, ref) => {
|
55
|
-
const {
|
58
|
+
const {
|
59
|
+
children,
|
60
|
+
icon,
|
61
|
+
isDisabled,
|
62
|
+
size = "md",
|
63
|
+
chipType = "choice",
|
64
|
+
variant = "base",
|
65
|
+
} = props;
|
56
66
|
|
57
67
|
const {
|
58
68
|
state,
|
@@ -63,6 +73,7 @@ export const ChoiceChip = forwardRef((props: ChoiceChipProps, ref) => {
|
|
63
73
|
} = useCheckbox(props);
|
64
74
|
const styles = useMultiStyleConfig("ChoiceChip", {
|
65
75
|
size,
|
76
|
+
chipType,
|
66
77
|
variant,
|
67
78
|
icon,
|
68
79
|
hasLabel: Boolean(children),
|
@@ -76,7 +87,7 @@ export const ChoiceChip = forwardRef((props: ChoiceChipProps, ref) => {
|
|
76
87
|
{...getRootProps()}
|
77
88
|
aria-label={String(children)}
|
78
89
|
>
|
79
|
-
<chakra.input {...getInputProps({}, ref)} id={id} />
|
90
|
+
<chakra.input {...getInputProps({}, ref)} id={id} disabled={isDisabled} />
|
80
91
|
<chakra.div
|
81
92
|
{...getLabelProps()}
|
82
93
|
__css={styles.container}
|
@@ -93,9 +104,9 @@ export const ChoiceChip = forwardRef((props: ChoiceChipProps, ref) => {
|
|
93
104
|
)}
|
94
105
|
|
95
106
|
<chakra.span __css={styles.label} {...getCheckboxProps()}>
|
96
|
-
{
|
107
|
+
{chipType !== "icon" && children}
|
97
108
|
</chakra.span>
|
98
|
-
{
|
109
|
+
{chipType === "filter" && state.isChecked && (
|
99
110
|
<CloseOutline24Icon marginLeft={1.5} />
|
100
111
|
)}
|
101
112
|
</chakra.div>
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import {
|
2
|
+
Box,
|
3
|
+
DarkMode,
|
4
|
+
Popover,
|
5
|
+
PopoverAnchor,
|
6
|
+
PopoverArrow,
|
7
|
+
PopoverBody,
|
8
|
+
PopoverCloseButton,
|
9
|
+
PopoverContent,
|
10
|
+
} from "@chakra-ui/react";
|
11
|
+
import React from "react";
|
12
|
+
import { Button, ButtonGroup, createTexts, useTranslation } from "..";
|
13
|
+
import { TooltipProps } from "../tooltip";
|
14
|
+
|
15
|
+
export type NudgeProps = {
|
16
|
+
/**
|
17
|
+
* The ISO-formatted date of when the Nudge was introduced.
|
18
|
+
*
|
19
|
+
* After this date has been surpassed by 30 days, the nudge will no longer be shown,
|
20
|
+
* and an error will be logged in development mode.
|
21
|
+
*
|
22
|
+
* ```tsx
|
23
|
+
* <Nudge introducedDate="2024-02-19" {...otherProps} />
|
24
|
+
* ```
|
25
|
+
**/
|
26
|
+
introducedDate: string;
|
27
|
+
/**
|
28
|
+
* The name of the nudge.
|
29
|
+
* This will be used to check whether or not the nudge has been viewed.
|
30
|
+
**/
|
31
|
+
name: string;
|
32
|
+
/**
|
33
|
+
* The anchor of the nudge.
|
34
|
+
*
|
35
|
+
* The element that should be nudged toward.
|
36
|
+
*
|
37
|
+
* ```tsx
|
38
|
+
* <Nudge content="This is a great new feature! Try it out.">
|
39
|
+
* <MyFeature />
|
40
|
+
* </Nudge>
|
41
|
+
* ```
|
42
|
+
* */
|
43
|
+
children: React.ReactNode;
|
44
|
+
/**
|
45
|
+
* The content of the nudge.
|
46
|
+
*/
|
47
|
+
content: React.ReactNode;
|
48
|
+
/**
|
49
|
+
* Any actions you want to provide. Defaults to a close button and a "Show me" button.
|
50
|
+
*/
|
51
|
+
actions?: React.ReactNode;
|
52
|
+
} & Omit<
|
53
|
+
TooltipProps,
|
54
|
+
| "name"
|
55
|
+
| "triggerElement"
|
56
|
+
| "children"
|
57
|
+
| "withCloseButton"
|
58
|
+
| "defaultIsOpen"
|
59
|
+
| "size"
|
60
|
+
| "borderRadius"
|
61
|
+
>;
|
62
|
+
|
63
|
+
const EXPIRATION_DELAY = 1000 * 60 * 60 * 24 * 30; // 30 days
|
64
|
+
|
65
|
+
/** A nudge.
|
66
|
+
*
|
67
|
+
* A nudge is a way to hint of a new feature.
|
68
|
+
*
|
69
|
+
* You're required to set an `introducedDate` to the nudge, which is the timestamp of when the nudge was introduced. After 30 days, the nudge will no longer be shown, and an error will be logged in development mode.
|
70
|
+
*
|
71
|
+
* ```tsx
|
72
|
+
* <Nudge
|
73
|
+
* introducedDate="2024-02-19"
|
74
|
+
* name="my-nudge"
|
75
|
+
* content="Check out this enormous new feature!"
|
76
|
+
* >
|
77
|
+
* <Card variant="base" padding={2} width="fit-content">My new feature</Card>
|
78
|
+
* </Nudge>
|
79
|
+
* ```
|
80
|
+
*/
|
81
|
+
export const Nudge = ({
|
82
|
+
introducedDate,
|
83
|
+
name,
|
84
|
+
children,
|
85
|
+
content,
|
86
|
+
actions,
|
87
|
+
...props
|
88
|
+
}: NudgeProps) => {
|
89
|
+
const { t } = useTranslation();
|
90
|
+
if (new Date(introducedDate).getTime() + EXPIRATION_DELAY < Date.now()) {
|
91
|
+
if (process.env.NODE_ENV === "development") {
|
92
|
+
console.warn(
|
93
|
+
`The nudge ${name} has been used for longer than 30 days. Please remove it from the codebase.
|
94
|
+
|
95
|
+
This is a development only warning, and will not be shown in production.`,
|
96
|
+
);
|
97
|
+
}
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
return (
|
101
|
+
<Popover
|
102
|
+
arrowSize={12}
|
103
|
+
arrowShadowColor="none"
|
104
|
+
defaultIsOpen={true}
|
105
|
+
{...props}
|
106
|
+
>
|
107
|
+
<PopoverAnchor>{children}</PopoverAnchor>
|
108
|
+
<PopoverContent borderRadius="sm">
|
109
|
+
<DarkMode>
|
110
|
+
<PopoverArrow />
|
111
|
+
<PopoverCloseButton />
|
112
|
+
<PopoverBody margin={1}>
|
113
|
+
<Box marginRight={4}>{content}</Box>
|
114
|
+
<Box marginTop={1.5}>
|
115
|
+
{actions ?? (
|
116
|
+
<ButtonGroup>
|
117
|
+
<Button variant="tertiary" size="xs">
|
118
|
+
{t(texts.close)}
|
119
|
+
</Button>
|
120
|
+
<Button variant="secondary" size="xs" fontWeight="bold">
|
121
|
+
{t(texts.showMe)}
|
122
|
+
</Button>
|
123
|
+
</ButtonGroup>
|
124
|
+
)}
|
125
|
+
</Box>
|
126
|
+
</PopoverBody>
|
127
|
+
</DarkMode>
|
128
|
+
</PopoverContent>
|
129
|
+
</Popover>
|
130
|
+
);
|
131
|
+
};
|
132
|
+
|
133
|
+
const texts = createTexts({
|
134
|
+
close: {
|
135
|
+
nb: "Lukk",
|
136
|
+
nn: "Lukk",
|
137
|
+
sv: "Stäng",
|
138
|
+
en: "Close",
|
139
|
+
},
|
140
|
+
showMe: {
|
141
|
+
nb: "Vis meg",
|
142
|
+
nn: "Vis meg",
|
143
|
+
sv: "Visa mig",
|
144
|
+
en: "Show me",
|
145
|
+
},
|
146
|
+
});
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { Box, usePopoverContext } from "@chakra-ui/react";
|
2
|
+
import { ArrowRightFill18Icon } from "@vygruppen/spor-icon-react";
|
3
|
+
import React, { useState } from "react";
|
4
|
+
import {
|
5
|
+
Button,
|
6
|
+
Flex,
|
7
|
+
Nudge,
|
8
|
+
NudgeProps,
|
9
|
+
ProgressIndicator,
|
10
|
+
createTexts,
|
11
|
+
useTranslation,
|
12
|
+
} from "..";
|
13
|
+
|
14
|
+
export type WizardNudgeProps = Omit<NudgeProps, "actions" | "content"> & {
|
15
|
+
/** Steps in the wizard. Each item is its own step. Should only be Step components */
|
16
|
+
content: React.ReactNode[];
|
17
|
+
/**
|
18
|
+
* Where the nudge should be placed by default.
|
19
|
+
*
|
20
|
+
* Note - this is a suggestion, and may be overridden by space concerns.
|
21
|
+
*/
|
22
|
+
placement?: "top" | "bottom" | "left" | "right";
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* A nudge that displays its children one at a time, with a step indicator.
|
26
|
+
*
|
27
|
+
* ```tsx
|
28
|
+
* <WizardNudge
|
29
|
+
* content={["First step", "Second step"]}
|
30
|
+
* name="my-wizard-nudge"
|
31
|
+
* introducedDate="2024-02-19"
|
32
|
+
* >
|
33
|
+
* <Card width="fit-content" padding={2}>
|
34
|
+
* My new feature
|
35
|
+
* </Card>
|
36
|
+
* </WizardNudge>
|
37
|
+
* ```
|
38
|
+
*/
|
39
|
+
export const WizardNudge = ({
|
40
|
+
children,
|
41
|
+
name,
|
42
|
+
onClose,
|
43
|
+
content,
|
44
|
+
...props
|
45
|
+
}: WizardNudgeProps) => {
|
46
|
+
const [currentStep, setCurrentStep] = useState(1);
|
47
|
+
const totalSteps = content.length;
|
48
|
+
const isLastStep = totalSteps === currentStep;
|
49
|
+
const onNext = () => setCurrentStep((prev) => prev + 1);
|
50
|
+
|
51
|
+
return (
|
52
|
+
<Nudge
|
53
|
+
onClose={onClose}
|
54
|
+
name={name}
|
55
|
+
content={content[currentStep - 1]}
|
56
|
+
actions={
|
57
|
+
<Flex gap={3} alignItems="center">
|
58
|
+
<ProgressIndicator
|
59
|
+
activeStep={currentStep}
|
60
|
+
numberOfSteps={totalSteps}
|
61
|
+
/>
|
62
|
+
<Box>
|
63
|
+
<NextOrCloseButton isLastStep={isLastStep} onNext={onNext} />
|
64
|
+
</Box>
|
65
|
+
</Flex>
|
66
|
+
}
|
67
|
+
{...props}
|
68
|
+
>
|
69
|
+
{children}
|
70
|
+
</Nudge>
|
71
|
+
);
|
72
|
+
};
|
73
|
+
|
74
|
+
type NextOrCloseButtonProps = {
|
75
|
+
isLastStep: boolean;
|
76
|
+
onNext: () => void;
|
77
|
+
};
|
78
|
+
const NextOrCloseButton = ({ isLastStep, onNext }: NextOrCloseButtonProps) => {
|
79
|
+
const { onClose } = usePopoverContext();
|
80
|
+
const { t } = useTranslation();
|
81
|
+
return (
|
82
|
+
<Button
|
83
|
+
variant="tertiary"
|
84
|
+
size="xs"
|
85
|
+
leftIcon={isLastStep ? undefined : <ArrowRightFill18Icon />}
|
86
|
+
onClick={isLastStep ? onClose : onNext}
|
87
|
+
width="fit-content"
|
88
|
+
>
|
89
|
+
{t(isLastStep ? texts.finish : texts.nextStep)}
|
90
|
+
</Button>
|
91
|
+
);
|
92
|
+
};
|
93
|
+
|
94
|
+
const texts = createTexts({
|
95
|
+
nextStep: {
|
96
|
+
nb: "Neste",
|
97
|
+
nn: "Neste",
|
98
|
+
sv: "Nästa",
|
99
|
+
en: "Next",
|
100
|
+
},
|
101
|
+
finish: {
|
102
|
+
nb: "Fullfør",
|
103
|
+
nn: "Fullfør",
|
104
|
+
sv: "Fullför",
|
105
|
+
en: "Finish",
|
106
|
+
},
|
107
|
+
});
|
@@ -39,7 +39,11 @@ export const ProgressIndicator = ({
|
|
39
39
|
>
|
40
40
|
<Box __css={style.container}>
|
41
41
|
{Array.from({ length: numberOfSteps }, (_, i) => (
|
42
|
-
<ProgressDot
|
42
|
+
<ProgressDot
|
43
|
+
key={i}
|
44
|
+
aria-value={i + 1}
|
45
|
+
isActive={activeStep === i + 1}
|
46
|
+
/>
|
43
47
|
))}
|
44
48
|
</Box>
|
45
49
|
</Box>
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import { accordionAnatomy as parts } from "@chakra-ui/anatomy";
|
2
2
|
import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-system";
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
3
|
+
import {
|
4
|
+
baseBackground,
|
5
|
+
floatingBackground,
|
6
|
+
ghostBackground,
|
7
|
+
} from "../utils/background-utils";
|
8
|
+
import { baseBorder, floatingBorder } from "../utils/border-utils";
|
6
9
|
import { focusVisibleStyles } from "../utils/focus-util";
|
10
|
+
import { baseText } from "../utils/text-utils";
|
7
11
|
|
8
12
|
const helpers = createMultiStyleConfigHelpers(parts.keys);
|
9
13
|
const config = helpers.defineMultiStyleConfig({
|
@@ -21,7 +25,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
21
25
|
borderColor: "osloGrey",
|
22
26
|
display: "flex",
|
23
27
|
justifyContent: "space-between",
|
24
|
-
|
28
|
+
...baseText("default", props),
|
25
29
|
textAlign: "left",
|
26
30
|
fontFamily: "body",
|
27
31
|
fontWeight: "bold",
|
@@ -40,70 +44,50 @@ const config = helpers.defineMultiStyleConfig({
|
|
40
44
|
},
|
41
45
|
}),
|
42
46
|
variants: {
|
43
|
-
|
47
|
+
ghost: (props) => ({
|
44
48
|
button: {
|
45
49
|
boxShadow: "none",
|
46
50
|
_hover: {
|
47
|
-
|
51
|
+
...ghostBackground("hover", props),
|
48
52
|
},
|
49
53
|
_active: {
|
50
|
-
|
54
|
+
...ghostBackground("active", props),
|
51
55
|
},
|
52
56
|
},
|
53
57
|
}),
|
54
|
-
|
58
|
+
base: (props) => ({
|
55
59
|
container: {
|
56
|
-
|
57
|
-
borderColor: mode(
|
58
|
-
colors.blackAlpha["400"],
|
59
|
-
colors.whiteAlpha["400"],
|
60
|
-
)(props),
|
61
|
-
}),
|
60
|
+
...baseBorder("default", props),
|
62
61
|
},
|
63
62
|
button: {
|
64
63
|
_expanded: {
|
65
64
|
borderBottomRadius: "none",
|
66
65
|
},
|
67
66
|
_hover: {
|
68
|
-
|
69
|
-
borderColor: mode("darkGrey", "white")(props),
|
70
|
-
borderWidth: 2,
|
71
|
-
}),
|
67
|
+
...baseBorder("hover", props),
|
72
68
|
},
|
73
69
|
_active: {
|
74
|
-
|
75
|
-
|
76
|
-
borderColor: mode("darkGrey", colors.whiteAlpha[400])(props),
|
77
|
-
}),
|
70
|
+
...baseBackground("active", props),
|
71
|
+
...baseBorder("default", props),
|
78
72
|
},
|
79
73
|
},
|
80
74
|
}),
|
81
|
-
|
75
|
+
floating: (props) => ({
|
82
76
|
container: {
|
83
|
-
|
84
|
-
|
85
|
-
baseShadow: mode<keyof typeof shadows>("sm", "none")(props),
|
86
|
-
borderColor: mode("silver", "whiteAlpha.400")(props),
|
87
|
-
}),
|
77
|
+
...floatingBackground("default", props),
|
78
|
+
...floatingBorder("default", props),
|
88
79
|
},
|
89
80
|
button: {
|
90
81
|
_expanded: {
|
91
82
|
borderBottomRadius: "none",
|
92
83
|
},
|
93
84
|
_hover: {
|
94
|
-
|
95
|
-
|
96
|
-
borderColor: mode("darkGrey", "white")(props),
|
97
|
-
borderWidth: 1,
|
98
|
-
}),
|
85
|
+
...ghostBackground("hover", props),
|
86
|
+
...floatingBorder("default", props),
|
99
87
|
},
|
100
88
|
_active: {
|
101
|
-
|
102
|
-
|
103
|
-
baseShadow: "none",
|
104
|
-
borderWidth: 1,
|
105
|
-
borderColor: mode("darkGrey", "whiteAlpha.400")(props),
|
106
|
-
}),
|
89
|
+
...ghostBackground("active", props),
|
90
|
+
...floatingBorder("default", props),
|
107
91
|
},
|
108
92
|
},
|
109
93
|
}),
|
@@ -147,7 +131,7 @@ const config = helpers.defineMultiStyleConfig({
|
|
147
131
|
},
|
148
132
|
},
|
149
133
|
defaultProps: {
|
150
|
-
variant: "
|
134
|
+
variant: "ghost",
|
151
135
|
size: "sm",
|
152
136
|
},
|
153
137
|
});
|