@vygruppen/spor-react 12.24.16 → 13.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 -10
- package/.turbo/turbo-postinstall.log +4 -3
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +2753 -2646
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +887 -601
- package/dist/index.d.ts +887 -601
- package/dist/index.mjs +2712 -2605
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/accordion/Accordion.tsx +34 -29
- package/src/accordion/Expandable.tsx +20 -21
- package/src/alert/Alert.tsx +7 -5
- package/src/alert/AlertIcon.tsx +19 -20
- package/src/alert/ExpandableAlert.tsx +65 -64
- package/src/alert/ServiceAlert.tsx +78 -78
- package/src/breadcrumb/Breadcrumb.tsx +37 -34
- package/src/button/Button.tsx +64 -57
- package/src/button/ButtonGroup.tsx +12 -10
- package/src/button/Clipboard.tsx +21 -18
- package/src/button/CloseButton.tsx +19 -17
- package/src/button/FloatingActionButton.tsx +41 -47
- package/src/button/IconButton.tsx +20 -18
- package/src/calendar/CalendarContext.tsx +1 -1
- package/src/color-mode/color-mode.tsx +7 -5
- package/src/datepicker/CalendarTriggerButton.tsx +11 -7
- package/src/datepicker/DateField.tsx +53 -51
- package/src/datepicker/DatePicker.tsx +127 -134
- package/src/datepicker/DateTimeSegment.tsx +44 -40
- package/src/datepicker/StyledField.tsx +39 -36
- package/src/dialog/Dialog.tsx +14 -11
- package/src/dialog/Drawer.tsx +74 -67
- package/src/input/AttachedInputs.tsx +35 -41
- package/src/input/Autocomplete.tsx +118 -129
- package/src/input/CardSelect.tsx +67 -65
- package/src/input/Checkbox.tsx +19 -17
- package/src/input/CheckboxGroup.tsx +0 -2
- package/src/input/ChoiceChip.tsx +42 -38
- package/src/input/Combobox.tsx +4 -4
- package/src/input/CountryCodeSelect.tsx +8 -8
- package/src/input/Field.tsx +78 -75
- package/src/input/FloatingLabel.tsx +6 -8
- package/src/input/Input.tsx +87 -92
- package/src/input/ListBox.tsx +3 -4
- package/src/input/Menu.tsx +149 -142
- package/src/input/NativeSelect.tsx +7 -5
- package/src/input/NumericStepper.tsx +15 -12
- package/src/input/PasswordInput.tsx +65 -61
- package/src/input/PhoneNumberInput.tsx +7 -7
- package/src/input/Popover.tsx +52 -55
- package/src/input/Radio.tsx +16 -11
- package/src/input/SearchInput.tsx +32 -31
- package/src/input/Select.tsx +106 -96
- package/src/input/Switch.tsx +43 -41
- package/src/input/Textarea.tsx +68 -66
- package/src/layout/PressableCard.tsx +11 -10
- package/src/layout/RadioCard.tsx +57 -53
- package/src/layout/Separator.tsx +8 -7
- package/src/layout/StaticCard.tsx +11 -10
- package/src/linjetag/LineIcon.tsx +48 -54
- package/src/linjetag/TravelTag.tsx +57 -59
- package/src/link/TextLink.tsx +50 -40
- package/src/loader/ProgressBar.tsx +41 -46
- package/src/loader/ProgressLoader.tsx +83 -86
- package/src/loader/Skeleton.tsx +56 -48
- package/src/logo/CargonetLogo.tsx +88 -87
- package/src/logo/VyLogo.tsx +80 -77
- package/src/logo/VyLogoPride.tsx +137 -135
- package/src/media-controller/JumpButton.tsx +30 -28
- package/src/media-controller/PlayPauseButton.tsx +8 -7
- package/src/media-controller/SkipButton.tsx +28 -26
- package/src/nudge/Nudge.tsx +66 -70
- package/src/pagination/Pagination.tsx +52 -46
- package/src/popover/index.tsx +46 -41
- package/src/progress-indicator/ProgressIndicator.tsx +10 -7
- package/src/stepper/Stepper.tsx +84 -81
- package/src/tab/Tabs.tsx +8 -4
- package/src/table/Table.tsx +89 -109
- package/src/tooltip.tsx +26 -22
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Code.tsx +8 -5
- package/src/typography/Heading.tsx +22 -23
- package/src/typography/Text.tsx +11 -9
- package/tsconfig.json +1 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
NextMediaControllerFill30Icon,
|
|
5
5
|
PreviousMediaControllerFill30Icon,
|
|
6
6
|
} from "@vygruppen/spor-icon-react";
|
|
7
|
-
import {
|
|
7
|
+
import { PropsWithChildren } from "react";
|
|
8
8
|
|
|
9
9
|
import { createTexts, MediaControllerVariantProps, useTranslation } from "..";
|
|
10
10
|
|
|
@@ -27,34 +27,36 @@ type SkipButtonProps = BoxProps &
|
|
|
27
27
|
* <SkipButton direction="forward" onClick={onNextChapter} />
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export const SkipButton =
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export const SkipButton = ({
|
|
31
|
+
ref,
|
|
32
|
+
...props
|
|
33
|
+
}: SkipButtonProps & {
|
|
34
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
35
|
+
}) => {
|
|
36
|
+
const { direction, disabled, size = "sm" } = props;
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
const { t } = useTranslation();
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
const recipe = useSlotRecipe({ key: "mediaControllerButton" });
|
|
41
|
+
const styles = recipe({ variant: "jumpSkip", size });
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
SkipButton.displayName = "SkipButton";
|
|
43
|
+
return (
|
|
44
|
+
<Center
|
|
45
|
+
ref={ref}
|
|
46
|
+
as="button"
|
|
47
|
+
css={styles.root}
|
|
48
|
+
aria-label={direction === "forward" ? t(texts.next) : t(texts.previous)}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{direction === "forward" ? (
|
|
53
|
+
<NextMediaControllerFill30Icon css={styles.icon} />
|
|
54
|
+
) : (
|
|
55
|
+
<PreviousMediaControllerFill30Icon css={styles.icon} />
|
|
56
|
+
)}
|
|
57
|
+
</Center>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
58
60
|
|
|
59
61
|
const texts = createTexts({
|
|
60
62
|
next: {
|
package/src/nudge/Nudge.tsx
CHANGED
|
@@ -9,12 +9,7 @@ import {
|
|
|
9
9
|
usePopoverContext,
|
|
10
10
|
} from "@chakra-ui/react";
|
|
11
11
|
import { ArrowRightFill18Icon } from "@vygruppen/spor-icon-react";
|
|
12
|
-
import React, {
|
|
13
|
-
forwardRef,
|
|
14
|
-
PropsWithChildren,
|
|
15
|
-
useEffect,
|
|
16
|
-
useState,
|
|
17
|
-
} from "react";
|
|
12
|
+
import React, { PropsWithChildren, useEffect, useState } from "react";
|
|
18
13
|
|
|
19
14
|
import {
|
|
20
15
|
Button,
|
|
@@ -71,71 +66,72 @@ export const Nudge = (props: NudgeProps) => {
|
|
|
71
66
|
);
|
|
72
67
|
};
|
|
73
68
|
|
|
74
|
-
export const NudgeTrigger =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
export const NudgeTrigger = ({
|
|
70
|
+
ref,
|
|
71
|
+
...props
|
|
72
|
+
}: ChakraPopover.TriggerProps & {
|
|
73
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
74
|
+
}) => {
|
|
78
75
|
return <PopoverTrigger {...props} ref={ref} />;
|
|
79
|
-
}
|
|
80
|
-
NudgeTrigger.displayName = "NudgeTrigger";
|
|
81
|
-
|
|
82
|
-
export const NudgeContent = forwardRef<HTMLDivElement, PopoverProps>(
|
|
83
|
-
({ showCloseButton = true, children, ...props }, ref) => {
|
|
84
|
-
const [currentStep, setCurrentStep] = useState(1);
|
|
85
|
-
const childrenArray = React.Children.toArray(children); // Convert children to an array
|
|
86
|
-
|
|
87
|
-
const { open } = usePopoverContext();
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
91
|
-
setCurrentStep(1);
|
|
92
|
-
}, [children, open]);
|
|
93
|
-
|
|
94
|
-
const wizardPages = childrenArray.filter(
|
|
95
|
-
(child) =>
|
|
96
|
-
React.isValidElement(child) &&
|
|
97
|
-
(child.type as React.ComponentType).displayName === "NudgeWizardStep",
|
|
98
|
-
);
|
|
76
|
+
};
|
|
99
77
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
78
|
+
export const NudgeContent = ({
|
|
79
|
+
ref,
|
|
80
|
+
showCloseButton = true,
|
|
81
|
+
children,
|
|
82
|
+
...props
|
|
83
|
+
}: PopoverProps & {
|
|
84
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
85
|
+
}) => {
|
|
86
|
+
const [currentStep, setCurrentStep] = useState(1);
|
|
87
|
+
const childrenArray = React.Children.toArray(children); // Convert children to an array
|
|
88
|
+
|
|
89
|
+
const { open } = usePopoverContext();
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
93
|
+
setCurrentStep(1);
|
|
94
|
+
}, [children, open]);
|
|
95
|
+
|
|
96
|
+
const wizardPages = childrenArray.filter(
|
|
97
|
+
(child) => React.isValidElement(child) && child.type === NudgeWizardStep,
|
|
98
|
+
);
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
const restChildren = childrenArray.filter(
|
|
101
|
+
(child) => !React.isValidElement(child) || child.type !== NudgeWizardStep,
|
|
102
|
+
);
|
|
108
103
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<PopoverContent showCloseButton={showCloseButton} {...props} ref={ref}>
|
|
112
|
-
{children}
|
|
113
|
-
</PopoverContent>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
104
|
+
const totalSteps = wizardPages.length;
|
|
105
|
+
const isLastStep = totalSteps === currentStep;
|
|
116
106
|
|
|
107
|
+
if (wizardPages.length === 0) {
|
|
117
108
|
return (
|
|
118
109
|
<PopoverContent showCloseButton={showCloseButton} {...props} ref={ref}>
|
|
119
|
-
{
|
|
120
|
-
{wizardPages[currentStep - 1] as React.ReactElement}
|
|
121
|
-
<NudgeActions gap="18px">
|
|
122
|
-
<ProgressIndicator
|
|
123
|
-
activeStep={currentStep}
|
|
124
|
-
numberOfSteps={totalSteps}
|
|
125
|
-
/>
|
|
126
|
-
|
|
127
|
-
<NextButton
|
|
128
|
-
isLastStep={isLastStep}
|
|
129
|
-
onNext={() => {
|
|
130
|
-
setCurrentStep((previous) => previous + 1);
|
|
131
|
-
}}
|
|
132
|
-
/>
|
|
133
|
-
</NudgeActions>
|
|
110
|
+
{children}
|
|
134
111
|
</PopoverContent>
|
|
135
112
|
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<PopoverContent showCloseButton={showCloseButton} {...props} ref={ref}>
|
|
117
|
+
{restChildren}
|
|
118
|
+
{wizardPages[currentStep - 1] as React.ReactElement}
|
|
119
|
+
<NudgeActions gap="18px">
|
|
120
|
+
<ProgressIndicator
|
|
121
|
+
activeStep={currentStep}
|
|
122
|
+
numberOfSteps={totalSteps}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<NextButton
|
|
126
|
+
isLastStep={isLastStep}
|
|
127
|
+
onNext={() => {
|
|
128
|
+
setCurrentStep((previous) => previous + 1);
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
</NudgeActions>
|
|
132
|
+
</PopoverContent>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
139
135
|
|
|
140
136
|
export const NudgeActions = ({ ...props }: BoxProps) => {
|
|
141
137
|
const { colorMode } = useColorMode();
|
|
@@ -205,12 +201,13 @@ export const NudgeWizardStep = ({ children }: PropsWithChildren) => {
|
|
|
205
201
|
);
|
|
206
202
|
};
|
|
207
203
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
204
|
+
export const NudgeCloseTrigger = ({
|
|
205
|
+
ref,
|
|
206
|
+
children,
|
|
207
|
+
...props
|
|
208
|
+
}: ChakraPopover.TriggerProps & {
|
|
209
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
210
|
+
}) => {
|
|
214
211
|
const isStringChild = typeof children === "string";
|
|
215
212
|
|
|
216
213
|
return (
|
|
@@ -218,5 +215,4 @@ export const NudgeCloseTrigger = forwardRef<
|
|
|
218
215
|
{children}
|
|
219
216
|
</ChakraPopover.CloseTrigger>
|
|
220
217
|
);
|
|
221
|
-
}
|
|
222
|
-
NudgeCloseTrigger.displayName = "NudgeCloseTrigger";
|
|
218
|
+
};
|
|
@@ -37,35 +37,39 @@ const [RootPropsProvider, useRootProps] = createContext<ButtonVariantContext>({
|
|
|
37
37
|
name: "RootPropsProvider",
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
export const Pagination =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
export const Pagination = ({
|
|
41
|
+
ref,
|
|
42
|
+
...props
|
|
43
|
+
}: PaginationRootProps & {
|
|
44
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
45
|
+
}) => {
|
|
46
|
+
const { getHref, children, ...rest } = props;
|
|
47
|
+
const recipe = useSlotRecipe({ key: "pagination" });
|
|
48
|
+
const styles = recipe();
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
return (
|
|
51
|
+
<RootPropsProvider
|
|
52
|
+
value={{
|
|
53
|
+
getHref,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<ChakraPagination.Root
|
|
57
|
+
ref={ref}
|
|
58
|
+
type={getHref ? "link" : "button"}
|
|
59
|
+
{...rest}
|
|
51
60
|
>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<List css={styles.list}>{children}</List>
|
|
58
|
-
</ChakraPagination.Root>
|
|
59
|
-
</RootPropsProvider>
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
);
|
|
63
|
-
Pagination.displayName = "Pagination";
|
|
61
|
+
<List css={styles.list}>{children}</List>
|
|
62
|
+
</ChakraPagination.Root>
|
|
63
|
+
</RootPropsProvider>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
64
66
|
|
|
65
|
-
export const PaginationEllipsis =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
export const PaginationEllipsis = ({
|
|
68
|
+
ref,
|
|
69
|
+
...props
|
|
70
|
+
}: ChakraPagination.EllipsisProps & {
|
|
71
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
72
|
+
}) => {
|
|
69
73
|
return (
|
|
70
74
|
<ListItem>
|
|
71
75
|
<ChakraPagination.Ellipsis ref={ref} {...props} asChild>
|
|
@@ -73,13 +77,14 @@ export const PaginationEllipsis = React.forwardRef<
|
|
|
73
77
|
</ChakraPagination.Ellipsis>
|
|
74
78
|
</ListItem>
|
|
75
79
|
);
|
|
76
|
-
}
|
|
77
|
-
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
80
|
+
};
|
|
78
81
|
|
|
79
|
-
export const PaginationItem =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
export const PaginationItem = ({
|
|
83
|
+
ref,
|
|
84
|
+
...props
|
|
85
|
+
}: ChakraPagination.ItemProps & {
|
|
86
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
87
|
+
}) => {
|
|
83
88
|
const rootProps = useRootProps();
|
|
84
89
|
const { t } = useTranslation();
|
|
85
90
|
const { page, totalPages } = usePaginationContext();
|
|
@@ -116,14 +121,15 @@ export const PaginationItem = React.forwardRef<
|
|
|
116
121
|
</ChakraPagination.Item>
|
|
117
122
|
</ListItem>
|
|
118
123
|
);
|
|
119
|
-
}
|
|
120
|
-
PaginationItem.displayName = "PaginationItem";
|
|
124
|
+
};
|
|
121
125
|
|
|
122
126
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
123
|
-
export const PaginationPrevTrigger =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
export const PaginationPrevTrigger = ({
|
|
128
|
+
ref,
|
|
129
|
+
...props
|
|
130
|
+
}: ChakraPagination.PrevTriggerProps & {
|
|
131
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
132
|
+
}) => {
|
|
127
133
|
const { page } = usePaginationContext();
|
|
128
134
|
const recipe = useSlotRecipe({ key: "pagination" });
|
|
129
135
|
const styles = recipe();
|
|
@@ -166,13 +172,14 @@ export const PaginationPrevTrigger = React.forwardRef<
|
|
|
166
172
|
</ChakraPagination.PrevTrigger>
|
|
167
173
|
</ListItem>
|
|
168
174
|
);
|
|
169
|
-
}
|
|
170
|
-
PaginationPrevTrigger.displayName = "PaginationPrevTrigger";
|
|
175
|
+
};
|
|
171
176
|
|
|
172
|
-
export const PaginationNextTrigger =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
export const PaginationNextTrigger = ({
|
|
178
|
+
ref,
|
|
179
|
+
...props
|
|
180
|
+
}: ChakraPagination.NextTriggerProps & {
|
|
181
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
182
|
+
}) => {
|
|
176
183
|
const { page, totalPages } = usePaginationContext();
|
|
177
184
|
const recipe = useSlotRecipe({ key: "pagination" });
|
|
178
185
|
const styles = recipe();
|
|
@@ -212,8 +219,7 @@ export const PaginationNextTrigger = React.forwardRef<
|
|
|
212
219
|
</ChakraPagination.NextTrigger>
|
|
213
220
|
</ListItem>
|
|
214
221
|
);
|
|
215
|
-
}
|
|
216
|
-
PaginationNextTrigger.displayName = "PaginationNextTrigger";
|
|
222
|
+
};
|
|
217
223
|
|
|
218
224
|
export const PaginationItems = (
|
|
219
225
|
props: React.HTMLAttributes<HTMLElement> & {},
|
package/src/popover/index.tsx
CHANGED
|
@@ -5,17 +5,20 @@ import {
|
|
|
5
5
|
Portal,
|
|
6
6
|
usePopoverContext,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
|
-
import React, {
|
|
8
|
+
import React, { useEffect } from "react";
|
|
9
9
|
|
|
10
10
|
import { CloseButton } from "@/button";
|
|
11
11
|
import { useColorMode } from "@/color-mode";
|
|
12
12
|
|
|
13
13
|
export const Popover = ChakraPopover.Root;
|
|
14
14
|
|
|
15
|
-
export const PopoverTrigger =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export const PopoverTrigger = ({
|
|
16
|
+
ref,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: ChakraPopover.TriggerProps & {
|
|
20
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
21
|
+
}) => {
|
|
19
22
|
const isStringChild = typeof children === "string";
|
|
20
23
|
|
|
21
24
|
return (
|
|
@@ -23,49 +26,51 @@ export const PopoverTrigger = forwardRef<
|
|
|
23
26
|
{children}
|
|
24
27
|
</ChakraPopover.Trigger>
|
|
25
28
|
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
PopoverTrigger.displayName = "PopoverTrigger";
|
|
29
|
+
};
|
|
29
30
|
|
|
30
31
|
export type PopoverProps = ChakraPopover.ContentProps &
|
|
31
32
|
React.RefAttributes<HTMLDivElement> & {
|
|
32
33
|
showCloseButton?: boolean;
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
export const PopoverContent =
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
export const PopoverContent = ({
|
|
37
|
+
ref,
|
|
38
|
+
children,
|
|
39
|
+
showCloseButton = false,
|
|
40
|
+
...props
|
|
41
|
+
}: PopoverProps & {
|
|
42
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
43
|
+
}) => {
|
|
44
|
+
const { colorMode } = useColorMode();
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
const closeButtonRef = React.useRef<HTMLButtonElement>(null);
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
const { open } = usePopoverContext();
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (showCloseButton && open && closeButtonRef.current) {
|
|
52
|
+
closeButtonRef.current.focus();
|
|
53
|
+
}
|
|
54
|
+
}, [showCloseButton, open]);
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
PopoverContent.displayName = "PopoverContent";
|
|
56
|
+
return (
|
|
57
|
+
<Portal>
|
|
58
|
+
<ChakraPopover.Positioner>
|
|
59
|
+
<ChakraPopover.Content ref={ref} {...props}>
|
|
60
|
+
<ChakraPopover.Arrow />
|
|
61
|
+
{showCloseButton && (
|
|
62
|
+
<div>
|
|
63
|
+
<ChakraPopover.CloseTrigger asChild>
|
|
64
|
+
<CloseButton
|
|
65
|
+
className={colorMode === "dark" ? "light" : "dark"}
|
|
66
|
+
ref={closeButtonRef}
|
|
67
|
+
/>
|
|
68
|
+
</ChakraPopover.CloseTrigger>
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
<ChakraPopover.Body {...props}>{children}</ChakraPopover.Body>
|
|
72
|
+
</ChakraPopover.Content>
|
|
73
|
+
</ChakraPopover.Positioner>
|
|
74
|
+
</Portal>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
SystemStyleObject,
|
|
6
6
|
useSlotRecipe,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
|
-
import React, {
|
|
8
|
+
import React, { PropsWithChildren } from "react";
|
|
9
9
|
|
|
10
10
|
import { Box, createTexts, useTranslation } from "..";
|
|
11
11
|
import { progressIndicatorRecipe } from "../theme/slot-recipes/progress-indicator";
|
|
@@ -38,10 +38,14 @@ export type ProgressIndicatorProps = BoxProps &
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
export const ProgressIndicator =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
export const ProgressIndicator = ({
|
|
42
|
+
ref,
|
|
43
|
+
numberOfSteps,
|
|
44
|
+
activeStep,
|
|
45
|
+
css,
|
|
46
|
+
}: ProgressIndicatorProps & {
|
|
47
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
48
|
+
}) => {
|
|
45
49
|
const { t } = useTranslation();
|
|
46
50
|
const recipe = useSlotRecipe({
|
|
47
51
|
key: "progressIndicator",
|
|
@@ -74,8 +78,7 @@ export const ProgressIndicator = forwardRef<
|
|
|
74
78
|
</Box>
|
|
75
79
|
</Box>
|
|
76
80
|
);
|
|
77
|
-
}
|
|
78
|
-
ProgressIndicator.displayName = "ProgressIndicator";
|
|
81
|
+
};
|
|
79
82
|
|
|
80
83
|
const texts = createTexts({
|
|
81
84
|
stepsOf: (activeStep, numberOfSteps) => ({
|