@vygruppen/spor-react 4.0.3 → 4.1.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 +20 -0
- package/dist/{CountryCodeSelect-RUH47EQH.mjs → CountryCodeSelect-FBKDO5JS.mjs} +1 -1
- package/dist/{chunk-XT6QVKN5.mjs → chunk-FPWAXD72.mjs} +144 -217
- package/dist/index.d.mts +17 -93
- package/dist/index.d.ts +17 -93
- package/dist/index.js +145 -218
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.test.tsx +1 -1
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionContext.tsx +1 -1
- package/src/accordion/Expandable.tsx +6 -6
- package/src/alert/BaseAlert.test.tsx +5 -5
- package/src/alert/BaseAlert.tsx +5 -1
- package/src/alert/ClosableAlert.test.tsx +3 -3
- package/src/alert/ExpandableAlert.test.tsx +5 -5
- package/src/button/Button.test.tsx +1 -1
- package/src/button/Button.tsx +1 -1
- package/src/button/CloseButton.tsx +1 -1
- package/src/button/FloatingActionButton.tsx +5 -5
- package/src/button/IconButton.tsx +1 -1
- package/src/card/Card.tsx +3 -2
- package/src/card/index.tsx +1 -1
- package/src/datepicker/Calendar.tsx +6 -6
- package/src/datepicker/CalendarCell.tsx +9 -8
- package/src/datepicker/CalendarGrid.tsx +9 -9
- package/src/datepicker/CalendarHeader.tsx +2 -2
- package/src/datepicker/CalendarTriggerButton.tsx +5 -10
- package/src/datepicker/DateField.tsx +2 -2
- package/src/datepicker/DatePicker.tsx +3 -3
- package/src/datepicker/DateTimeSegment.tsx +2 -2
- package/src/datepicker/RangeCalendar.tsx +5 -2
- package/src/datepicker/StyledField.tsx +2 -6
- package/src/datepicker/TimePicker.test.tsx +4 -4
- package/src/datepicker/TimePicker.tsx +5 -5
- package/src/index.tsx +0 -1
- package/src/input/CardSelect.tsx +3 -3
- package/src/input/Combobox.tsx +1 -1
- package/src/input/CountryCodeSelect.tsx +1 -1
- package/src/input/FormErrorMessage.tsx +1 -1
- package/src/input/InfoSelect.tsx +1 -1
- package/src/input/Input.tsx +1 -1
- package/src/input/InputElement.tsx +2 -2
- package/src/input/ListBox.tsx +3 -3
- package/src/input/NativeSelect.tsx +1 -1
- package/src/input/PasswordInput.tsx +1 -1
- package/src/input/PhoneNumberInput.tsx +13 -4
- package/src/input/Popover.tsx +4 -4
- package/src/input/RadioGroup.tsx +1 -1
- package/src/input/SearchInput.tsx +1 -1
- package/src/input/Switch.tsx +1 -1
- package/src/layout/Stack.tsx +1 -1
- package/src/linjetag/TravelTag.tsx +2 -2
- package/src/link/TextLink.tsx +1 -1
- package/src/list/index.tsx +0 -1
- package/src/loader/DarkSpinner.tsx +2 -4
- package/src/loader/SkeletonText.tsx +6 -3
- package/src/loader/useRotatingLabel.tsx +2 -2
- package/src/media-controller/index.test.tsx +6 -6
- package/src/modal/Drawer.tsx +2 -4
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/provider/index.tsx +1 -1
- package/src/stepper/Stepper.tsx +10 -6
- package/src/stepper/StepperContext.tsx +7 -7
- package/src/stepper/StepperStep.tsx +56 -16
- package/src/theme/components/button.ts +25 -44
- package/src/theme/components/card.ts +7 -1
- package/src/theme/components/close-button.ts +3 -1
- package/src/theme/components/datepicker.ts +2 -2
- package/src/theme/components/divider.ts +17 -17
- package/src/theme/components/fab.ts +16 -13
- package/src/theme/components/info-tag.ts +7 -8
- package/src/theme/components/input.ts +4 -2
- package/src/theme/components/line-icon.ts +1 -2
- package/src/theme/components/media-controller-button.ts +1 -1
- package/src/theme/components/popover.ts +1 -2
- package/src/theme/components/select.ts +4 -4
- package/src/theme/components/stepper.ts +8 -155
- package/src/theme/components/switch.ts +9 -9
- package/src/theme/components/table.ts +3 -3
- package/src/theme/components/tabs.ts +24 -18
- package/src/theme/components/textarea.ts +1 -1
- package/src/theme/components/travel-tag.ts +2 -2
- package/src/theme/foundations/spacing.ts +1 -1
- package/src/theme/foundations/styles.ts +10 -10
- package/src/theme/utils/box-shadow-utils.ts +2 -2
- package/src/toast/ActionToast.test.tsx +1 -1
- package/src/toast/BaseToast.test.tsx +3 -3
- package/src/toast/ClosableToast.test.tsx +1 -1
- package/src/toast/index.tsx +1 -1
- package/src/toast/useToast.tsx +3 -3
- package/src/typography/Badge.tsx +1 -1
- package/src/typography/Text.tsx +1 -1
- package/tsconfig.json +1 -1
@@ -131,8 +131,8 @@ const warnAboutMismatchingIcon = ({ icon, size }: WarnAboutMismatchingIcon) => {
|
|
131
131
|
console.warn(
|
132
132
|
`You passed a filled icon. This component requires outlined icons. You passed ${displayName}, replace it with ${displayName.replace(
|
133
133
|
"Fill",
|
134
|
-
"Outline"
|
135
|
-
)}
|
134
|
+
"Outline",
|
135
|
+
)}.`,
|
136
136
|
);
|
137
137
|
return;
|
138
138
|
}
|
@@ -140,8 +140,8 @@ const warnAboutMismatchingIcon = ({ icon, size }: WarnAboutMismatchingIcon) => {
|
|
140
140
|
console.warn(
|
141
141
|
`The icon you passed was of the wrong size for the lg size. You passed ${displayName}, replace it with ${displayName.replace(
|
142
142
|
/(\d{2})Icon/,
|
143
|
-
"30Icon"
|
144
|
-
)}
|
143
|
+
"30Icon",
|
144
|
+
)}.`,
|
145
145
|
);
|
146
146
|
return;
|
147
147
|
}
|
@@ -149,8 +149,8 @@ const warnAboutMismatchingIcon = ({ icon, size }: WarnAboutMismatchingIcon) => {
|
|
149
149
|
console.warn(
|
150
150
|
`The icon you passed was of the wrong size for the ${size} size. You passed ${displayName}, replace it with ${displayName.replace(
|
151
151
|
/(\d{2})Icon/,
|
152
|
-
"24Icon"
|
153
|
-
)}
|
152
|
+
"24Icon",
|
153
|
+
)}.`,
|
154
154
|
);
|
155
155
|
}
|
156
156
|
}
|
@@ -6,31 +6,31 @@ import { BaseAlert } from "./BaseAlert";
|
|
6
6
|
describe("<BaseAlert />", () => {
|
7
7
|
it("is accessible as variant='success'", async () => {
|
8
8
|
const { container } = render(
|
9
|
-
<BaseAlert variant="success">Test text</BaseAlert
|
9
|
+
<BaseAlert variant="success">Test text</BaseAlert>,
|
10
10
|
);
|
11
11
|
expect(await axe(container)).toHaveNoViolations();
|
12
12
|
});
|
13
13
|
it("is accessible as variant='info'", async () => {
|
14
14
|
const { container } = render(
|
15
|
-
<BaseAlert variant="info">Test text</BaseAlert
|
15
|
+
<BaseAlert variant="info">Test text</BaseAlert>,
|
16
16
|
);
|
17
17
|
expect(await axe(container)).toHaveNoViolations();
|
18
18
|
});
|
19
19
|
it("is accessible as variant='warning'", async () => {
|
20
20
|
const { container } = render(
|
21
|
-
<BaseAlert variant="warning">Test text</BaseAlert
|
21
|
+
<BaseAlert variant="warning">Test text</BaseAlert>,
|
22
22
|
);
|
23
23
|
expect(await axe(container)).toHaveNoViolations();
|
24
24
|
});
|
25
25
|
it("is accessible as variant='error'", async () => {
|
26
26
|
const { container } = render(
|
27
|
-
<BaseAlert variant="error">Test text</BaseAlert
|
27
|
+
<BaseAlert variant="error">Test text</BaseAlert>,
|
28
28
|
);
|
29
29
|
expect(await axe(container)).toHaveNoViolations();
|
30
30
|
});
|
31
31
|
it("is accessible as variant='alt-transport'", async () => {
|
32
32
|
const { container } = render(
|
33
|
-
<BaseAlert variant="alt-transport">Test text</BaseAlert
|
33
|
+
<BaseAlert variant="alt-transport">Test text</BaseAlert>,
|
34
34
|
);
|
35
35
|
expect(await axe(container)).toHaveNoViolations();
|
36
36
|
});
|
package/src/alert/BaseAlert.tsx
CHANGED
@@ -11,7 +11,11 @@ export type BaseAlertProps = BoxProps & {
|
|
11
11
|
/**
|
12
12
|
* A base alert box component. Should only be composed by other alert components.
|
13
13
|
*/
|
14
|
-
export const BaseAlert = ({
|
14
|
+
export const BaseAlert = ({
|
15
|
+
variant,
|
16
|
+
children,
|
17
|
+
...boxProps
|
18
|
+
}: BaseAlertProps) => {
|
15
19
|
const styles = useMultiStyleConfig("Alert", { variant });
|
16
20
|
return (
|
17
21
|
<Box __css={styles.container} {...boxProps}>
|
@@ -7,7 +7,7 @@ import { ClosableAlert } from ".";
|
|
7
7
|
describe("<ClosableAlert />", () => {
|
8
8
|
it("closes when you click the close button", async () => {
|
9
9
|
const { getByRole, queryByRole } = render(
|
10
|
-
<ClosableAlert variant="info">Test text</ClosableAlert
|
10
|
+
<ClosableAlert variant="info">Test text</ClosableAlert>,
|
11
11
|
);
|
12
12
|
act(() => {
|
13
13
|
getByRole("button").click();
|
@@ -20,7 +20,7 @@ describe("<ClosableAlert />", () => {
|
|
20
20
|
const { getByRole } = render(
|
21
21
|
<ClosableAlert variant="info" onClose={handleClick}>
|
22
22
|
Test text
|
23
|
-
</ClosableAlert
|
23
|
+
</ClosableAlert>,
|
24
24
|
);
|
25
25
|
act(() => {
|
26
26
|
getByRole("button").click();
|
@@ -30,7 +30,7 @@ describe("<ClosableAlert />", () => {
|
|
30
30
|
|
31
31
|
it("is accessible", async () => {
|
32
32
|
const { container } = render(
|
33
|
-
<ClosableAlert variant="info">Test text</ClosableAlert
|
33
|
+
<ClosableAlert variant="info">Test text</ClosableAlert>,
|
34
34
|
);
|
35
35
|
expect(await axe(container)).toHaveNoViolations();
|
36
36
|
});
|
@@ -9,7 +9,7 @@ describe("<ExpandableAlert />", () => {
|
|
9
9
|
const { getByRole, getByText } = render(
|
10
10
|
<ExpandableAlert variant="info" title="Title">
|
11
11
|
Test text
|
12
|
-
</ExpandableAlert
|
12
|
+
</ExpandableAlert>,
|
13
13
|
);
|
14
14
|
await waitFor(() => expect(getByText("Test text")).not.toBeVisible());
|
15
15
|
act(() => {
|
@@ -27,7 +27,7 @@ describe("<ExpandableAlert />", () => {
|
|
27
27
|
const { getByRole } = render(
|
28
28
|
<ExpandableAlert variant="info" title="Title" onToggle={handleClick}>
|
29
29
|
Test text
|
30
|
-
</ExpandableAlert
|
30
|
+
</ExpandableAlert>,
|
31
31
|
);
|
32
32
|
|
33
33
|
act(() => {
|
@@ -47,13 +47,13 @@ describe("<ExpandableAlert />", () => {
|
|
47
47
|
const { queryByRole, rerender } = render(
|
48
48
|
<ExpandableAlert variant="info" title="Title" headingLevel="h2">
|
49
49
|
Test text
|
50
|
-
</ExpandableAlert
|
50
|
+
</ExpandableAlert>,
|
51
51
|
);
|
52
52
|
expect(queryByRole("heading", { level: 2 })).toBeInTheDocument();
|
53
53
|
rerender(
|
54
54
|
<ExpandableAlert variant="info" title="Title" headingLevel="h3">
|
55
55
|
Test text
|
56
|
-
</ExpandableAlert
|
56
|
+
</ExpandableAlert>,
|
57
57
|
);
|
58
58
|
expect(queryByRole("heading", { level: 2 })).not.toBeInTheDocument();
|
59
59
|
expect(queryByRole("heading", { level: 3 })).toBeInTheDocument();
|
@@ -63,7 +63,7 @@ describe("<ExpandableAlert />", () => {
|
|
63
63
|
const { container, getByRole } = render(
|
64
64
|
<ExpandableAlert variant="info" title="Title">
|
65
65
|
Test text
|
66
|
-
</ExpandableAlert
|
66
|
+
</ExpandableAlert>,
|
67
67
|
);
|
68
68
|
await act(async () => {
|
69
69
|
expect(await axe(container)).toHaveNoViolations();
|
package/src/button/Button.tsx
CHANGED
@@ -44,10 +44,10 @@ export const FloatingActionButton = forwardRef<
|
|
44
44
|
placement = "bottom right",
|
45
45
|
...props
|
46
46
|
},
|
47
|
-
ref
|
47
|
+
ref,
|
48
48
|
) => {
|
49
49
|
const [isTextVisible, setIsTextVisible] = React.useState(
|
50
|
-
externalIsTextVisible !== undefined ? externalIsTextVisible : false
|
50
|
+
externalIsTextVisible !== undefined ? externalIsTextVisible : false,
|
51
51
|
);
|
52
52
|
const scrollDirection = useScrollDirection();
|
53
53
|
useEffect(() => {
|
@@ -56,7 +56,7 @@ export const FloatingActionButton = forwardRef<
|
|
56
56
|
}
|
57
57
|
const id = window.setTimeout(
|
58
58
|
() => setIsTextVisible(scrollDirection !== "down"),
|
59
|
-
1000
|
59
|
+
1000,
|
60
60
|
);
|
61
61
|
return () => window.clearTimeout(id);
|
62
62
|
}, [scrollDirection, externalIsTextVisible]);
|
@@ -99,7 +99,7 @@ export const FloatingActionButton = forwardRef<
|
|
99
99
|
</MotionBox>
|
100
100
|
</MotionBox>
|
101
101
|
);
|
102
|
-
}
|
102
|
+
},
|
103
103
|
);
|
104
104
|
|
105
105
|
type ScrollDirection = "up" | "down" | null;
|
@@ -107,7 +107,7 @@ const useScrollDirection = () => {
|
|
107
107
|
const [scrollDirection, setScrollDirection] =
|
108
108
|
React.useState<ScrollDirection>(null);
|
109
109
|
const lastScrollPosition = React.useRef(
|
110
|
-
typeof window !== "undefined" ? window.scrollY : 0
|
110
|
+
typeof window !== "undefined" ? window.scrollY : 0,
|
111
111
|
);
|
112
112
|
React.useEffect(() => {
|
113
113
|
const onScroll = () => {
|
package/src/card/Card.tsx
CHANGED
@@ -12,7 +12,8 @@ export type CardProps = Exclude<BoxProps, "size"> & {
|
|
12
12
|
| "green"
|
13
13
|
| "teal"
|
14
14
|
| "yellow"
|
15
|
-
| "orange"
|
15
|
+
| "orange"
|
16
|
+
| "red";
|
16
17
|
};
|
17
18
|
/**
|
18
19
|
* Renders a card.
|
@@ -55,5 +56,5 @@ export const Card = forwardRef<CardProps, As>(
|
|
55
56
|
{children}
|
56
57
|
</Box>
|
57
58
|
);
|
58
|
-
}
|
59
|
+
},
|
59
60
|
);
|
package/src/card/index.tsx
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from "./Card";
|
1
|
+
export * from "./Card";
|
@@ -13,13 +13,13 @@ import { createTexts, useTranslation } from "../i18n";
|
|
13
13
|
|
14
14
|
type CalendarProps = ReactAriaCalendarProps<DateValue> & {
|
15
15
|
showYearNavigation?: boolean;
|
16
|
-
variant: ResponsiveValue<
|
17
|
-
"base"
|
18
|
-
| "floating"
|
19
|
-
| "ghost"
|
20
|
-
>;
|
16
|
+
variant: ResponsiveValue<"base" | "floating" | "ghost">;
|
21
17
|
};
|
22
|
-
export function Calendar({
|
18
|
+
export function Calendar({
|
19
|
+
showYearNavigation,
|
20
|
+
variant,
|
21
|
+
...props
|
22
|
+
}: CalendarProps) {
|
23
23
|
const { t } = useTranslation();
|
24
24
|
const locale = useCurrentLocale();
|
25
25
|
const state = useCalendarState({
|
@@ -10,16 +10,17 @@ import { useCalendarCell } from "react-aria";
|
|
10
10
|
import { CalendarState, RangeCalendarState } from "react-stately";
|
11
11
|
|
12
12
|
type CalendarCellProps = {
|
13
|
-
variant: ResponsiveValue<
|
14
|
-
"base"
|
15
|
-
| "floating"
|
16
|
-
| "ghost"
|
17
|
-
>;
|
13
|
+
variant: ResponsiveValue<"base" | "floating" | "ghost">;
|
18
14
|
state: CalendarState | RangeCalendarState;
|
19
15
|
date: CalendarDate;
|
20
16
|
currentMonth: DateValue;
|
21
17
|
};
|
22
|
-
export function CalendarCell({
|
18
|
+
export function CalendarCell({
|
19
|
+
state,
|
20
|
+
date,
|
21
|
+
currentMonth,
|
22
|
+
variant,
|
23
|
+
}: CalendarCellProps) {
|
23
24
|
const ref = useRef(null);
|
24
25
|
const {
|
25
26
|
cellProps,
|
@@ -31,7 +32,7 @@ export function CalendarCell({ state, date, currentMonth, variant }: CalendarCel
|
|
31
32
|
} = useCalendarCell({ date }, state, ref);
|
32
33
|
|
33
34
|
const isOutsideMonth = !isSameMonth(currentMonth, date);
|
34
|
-
const styles = useMultiStyleConfig("Datepicker", {variant});
|
35
|
+
const styles = useMultiStyleConfig("Datepicker", { variant });
|
35
36
|
|
36
37
|
const stateProps: Record<string, any> = {};
|
37
38
|
if (isSelected) {
|
@@ -58,7 +59,7 @@ export function CalendarCell({ state, date, currentMonth, variant }: CalendarCel
|
|
58
59
|
(event: TouchEvent) => {
|
59
60
|
event.preventDefault();
|
60
61
|
},
|
61
|
-
{ passive: false, once: true }
|
62
|
+
{ passive: false, once: true },
|
62
63
|
);
|
63
64
|
}, []);
|
64
65
|
|
@@ -16,15 +16,15 @@ const weekDays: Record<Language, string[]> = {
|
|
16
16
|
};
|
17
17
|
|
18
18
|
type CalendarGridProps = AriaCalendarGridProps & {
|
19
|
-
variant: ResponsiveValue<
|
20
|
-
"base"
|
21
|
-
| "floating"
|
22
|
-
| "ghost"
|
23
|
-
>;
|
19
|
+
variant: ResponsiveValue<"base" | "floating" | "ghost">;
|
24
20
|
state: CalendarState | RangeCalendarState;
|
25
21
|
offset?: { months?: number };
|
26
22
|
};
|
27
|
-
export function CalendarGrid({
|
23
|
+
export function CalendarGrid({
|
24
|
+
state,
|
25
|
+
variant,
|
26
|
+
offset = {},
|
27
|
+
}: CalendarGridProps) {
|
28
28
|
const { language } = useTranslation();
|
29
29
|
const locale = useCurrentLocale();
|
30
30
|
const startDate = state.visibleRange.start.add(offset);
|
@@ -34,13 +34,13 @@ export function CalendarGrid({ state, variant ,offset = {} }: CalendarGridProps)
|
|
34
34
|
startDate,
|
35
35
|
endDate,
|
36
36
|
},
|
37
|
-
state
|
37
|
+
state,
|
38
38
|
);
|
39
39
|
|
40
40
|
// Get the number of weeks in the month so we can render the proper number of rows.
|
41
41
|
const weeksInMonth = getWeeksInMonth(state.visibleRange.start, locale);
|
42
42
|
const weeksInMonthRange = new Array(weeksInMonth).fill(0).map((_, i) => i);
|
43
|
-
const styles = useMultiStyleConfig("Datepicker", {variant});
|
43
|
+
const styles = useMultiStyleConfig("Datepicker", { variant });
|
44
44
|
|
45
45
|
return (
|
46
46
|
<table {...gridProps}>
|
@@ -76,7 +76,7 @@ export function CalendarGrid({ state, variant ,offset = {} }: CalendarGridProps)
|
|
76
76
|
/>
|
77
77
|
) : (
|
78
78
|
<td key={dayIndex} />
|
79
|
-
)
|
79
|
+
),
|
80
80
|
)}
|
81
81
|
</tr>
|
82
82
|
))}
|
@@ -31,10 +31,10 @@ export function CalendarHeader({
|
|
31
31
|
const monthAndYearTitle = `${monthTitle} ${state.focusedDate.year}`;
|
32
32
|
|
33
33
|
const isPreviousYearDisabled = state.isInvalid(
|
34
|
-
state.visibleRange.start.subtract({ years: 1 })
|
34
|
+
state.visibleRange.start.subtract({ years: 1 }),
|
35
35
|
);
|
36
36
|
const isNextYearDisabled = state.isInvalid(
|
37
|
-
state.visibleRange.start.add({ years: 1 })
|
37
|
+
state.visibleRange.start.add({ years: 1 }),
|
38
38
|
);
|
39
39
|
const areAllOtherYearsDisabled = isPreviousYearDisabled && isNextYearDisabled;
|
40
40
|
const isYearPickerVisible = showYearNavigation && !areAllOtherYearsDisabled;
|
@@ -12,25 +12,20 @@ import { AriaButtonProps } from "react-aria";
|
|
12
12
|
import { createTexts, useTranslation } from "..";
|
13
13
|
|
14
14
|
type CalendarTriggerButtonProps = AriaButtonProps<"button"> & {
|
15
|
-
variant: ResponsiveValue<
|
16
|
-
"base"
|
17
|
-
| "floating"
|
18
|
-
| "ghost"
|
19
|
-
>;
|
15
|
+
variant: ResponsiveValue<"base" | "floating" | "ghost">;
|
20
16
|
};
|
21
17
|
export const CalendarTriggerButton = forwardRef<CalendarTriggerButtonProps, As>(
|
22
18
|
({ variant, ...buttonProps }, ref) => {
|
23
19
|
const { t } = useTranslation();
|
24
|
-
const styles = useMultiStyleConfig("Datepicker", {variant});
|
20
|
+
const styles = useMultiStyleConfig("Datepicker", { variant });
|
25
21
|
|
26
22
|
const { onPress, ...filteredButtonProps } = buttonProps;
|
27
23
|
|
28
24
|
const handleOnPress = (event: KeyboardEvent) => {
|
29
25
|
if (onPress) {
|
30
|
-
if (event.key == "Enter" || event.key == " ")
|
31
|
-
onPress(event as any)
|
26
|
+
if (event.key == "Enter" || event.key == " ") onPress(event as any);
|
32
27
|
}
|
33
|
-
}
|
28
|
+
};
|
34
29
|
|
35
30
|
return (
|
36
31
|
<PopoverAnchor>
|
@@ -47,7 +42,7 @@ export const CalendarTriggerButton = forwardRef<CalendarTriggerButtonProps, As>(
|
|
47
42
|
</Box>
|
48
43
|
</PopoverAnchor>
|
49
44
|
);
|
50
|
-
}
|
45
|
+
},
|
51
46
|
);
|
52
47
|
|
53
48
|
const texts = createTexts({
|
@@ -36,7 +36,7 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
36
36
|
const { fieldProps, labelProps } = useDateField(
|
37
37
|
props,
|
38
38
|
state,
|
39
|
-
ref as RefObject<HTMLDivElement
|
39
|
+
ref as RefObject<HTMLDivElement>,
|
40
40
|
);
|
41
41
|
|
42
42
|
return (
|
@@ -69,5 +69,5 @@ export const DateField = forwardRef<HTMLDivElement, DateFieldProps>(
|
|
69
69
|
/>
|
70
70
|
</Box>
|
71
71
|
);
|
72
|
-
}
|
72
|
+
},
|
73
73
|
);
|
@@ -54,7 +54,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
54
54
|
width = "auto",
|
55
55
|
...props
|
56
56
|
},
|
57
|
-
externalRef
|
57
|
+
externalRef,
|
58
58
|
) => {
|
59
59
|
const formControlProps = useFormControlContext();
|
60
60
|
const state = useDatePickerState({
|
@@ -77,7 +77,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
77
77
|
} = useDatePicker(
|
78
78
|
props,
|
79
79
|
state,
|
80
|
-
ref as React.MutableRefObject<HTMLDivElement
|
80
|
+
ref as React.MutableRefObject<HTMLDivElement>,
|
81
81
|
);
|
82
82
|
|
83
83
|
const styles = useMultiStyleConfig("Datepicker", { variant });
|
@@ -151,5 +151,5 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
151
151
|
</Box>
|
152
152
|
</I18nProvider>
|
153
153
|
);
|
154
|
-
}
|
154
|
+
},
|
155
155
|
);
|
@@ -22,7 +22,7 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
|
|
22
22
|
const { segmentProps } = useDateSegment(
|
23
23
|
segment,
|
24
24
|
state,
|
25
|
-
ref as RefObject<HTMLDivElement
|
25
|
+
ref as RefObject<HTMLDivElement>,
|
26
26
|
);
|
27
27
|
|
28
28
|
const styles = useMultiStyleConfig("Datepicker", {
|
@@ -52,7 +52,7 @@ export const DateTimeSegment = forwardRef<HTMLDivElement, DateTimeSegmentProps>(
|
|
52
52
|
: segment.text}
|
53
53
|
</Box>
|
54
54
|
);
|
55
|
-
}
|
55
|
+
},
|
56
56
|
);
|
57
57
|
|
58
58
|
const isPaddable = (segmentType: DateSegment["type"]) =>
|
@@ -26,13 +26,16 @@ export function RangeCalendar(props: RangeCalendarProps) {
|
|
26
26
|
const ref = useRef(null);
|
27
27
|
const { calendarProps, title } = useRangeCalendar(props, state, ref);
|
28
28
|
|
29
|
-
|
30
29
|
return (
|
31
30
|
<Box {...calendarProps} ref={ref}>
|
32
31
|
<CalendarHeader state={state} title={title} />
|
33
32
|
<Box display="flex" gap="8">
|
34
33
|
<CalendarGrid variant={props.variant} state={state} />
|
35
|
-
<CalendarGrid
|
34
|
+
<CalendarGrid
|
35
|
+
variant={props.variant}
|
36
|
+
state={state}
|
37
|
+
offset={{ months: 1 }}
|
38
|
+
/>
|
36
39
|
</Box>
|
37
40
|
</Box>
|
38
41
|
);
|
@@ -10,11 +10,7 @@ import {
|
|
10
10
|
import React from "react";
|
11
11
|
|
12
12
|
type StyledFieldProps = BoxProps & {
|
13
|
-
variant: ResponsiveValue<
|
14
|
-
"base"
|
15
|
-
| "floating"
|
16
|
-
| "ghost"
|
17
|
-
>;
|
13
|
+
variant: ResponsiveValue<"base" | "floating" | "ghost">;
|
18
14
|
};
|
19
15
|
export const StyledField = forwardRef<StyledFieldProps, As>(
|
20
16
|
({ children, variant, ...otherProps }, ref) => {
|
@@ -32,5 +28,5 @@ export const StyledField = forwardRef<StyledFieldProps, As>(
|
|
32
28
|
{children}
|
33
29
|
</Box>
|
34
30
|
);
|
35
|
-
}
|
31
|
+
},
|
36
32
|
);
|
@@ -12,7 +12,7 @@ describe("<TimePicker />", () => {
|
|
12
12
|
|
13
13
|
it("jumps backwards as expected", async () => {
|
14
14
|
const { getByLabelText, getByRole } = render(
|
15
|
-
<TimePicker defaultValue={new Time(13, 3)}
|
15
|
+
<TimePicker defaultValue={new Time(13, 3)} />,
|
16
16
|
);
|
17
17
|
const backwardsButton = getByLabelText("Bakover 30 minutter");
|
18
18
|
expect(getByRole("group")).toHaveTextContent("13:03");
|
@@ -27,7 +27,7 @@ describe("<TimePicker />", () => {
|
|
27
27
|
});
|
28
28
|
it("jumps forwards as expected", async () => {
|
29
29
|
const { getByLabelText, getByRole } = render(
|
30
|
-
<TimePicker defaultValue={new Time(13, 53)}
|
30
|
+
<TimePicker defaultValue={new Time(13, 53)} />,
|
31
31
|
);
|
32
32
|
const forwardsButton = getByLabelText("Fremover 30 minutter");
|
33
33
|
expect(getByRole("group")).toHaveTextContent("13:53");
|
@@ -42,7 +42,7 @@ describe("<TimePicker />", () => {
|
|
42
42
|
});
|
43
43
|
it("jumps backwards as expected when minuteInterval is set", async () => {
|
44
44
|
const { getByLabelText, getByRole } = render(
|
45
|
-
<TimePicker defaultValue={new Time(13, 3)} minuteInterval={15}
|
45
|
+
<TimePicker defaultValue={new Time(13, 3)} minuteInterval={15} />,
|
46
46
|
);
|
47
47
|
const backwardsButton = getByLabelText("Bakover 15 minutter");
|
48
48
|
expect(getByRole("group")).toHaveTextContent("13:03");
|
@@ -57,7 +57,7 @@ describe("<TimePicker />", () => {
|
|
57
57
|
});
|
58
58
|
it("jumps forwards as expected when minuteInterval is set", async () => {
|
59
59
|
const { getByLabelText, getByRole } = render(
|
60
|
-
<TimePicker defaultValue={new Time(13, 49)} minuteInterval={15}
|
60
|
+
<TimePicker defaultValue={new Time(13, 49)} minuteInterval={15} />,
|
61
61
|
);
|
62
62
|
|
63
63
|
const forwardsButton = getByLabelText("Fremover 15 minutter");
|
@@ -96,7 +96,7 @@ export const TimePicker = ({
|
|
96
96
|
state.setValue(
|
97
97
|
state.value.subtract({
|
98
98
|
minutes: minutesToSubtract,
|
99
|
-
})
|
99
|
+
}),
|
100
100
|
);
|
101
101
|
};
|
102
102
|
const handleForwardClick = () => {
|
@@ -108,18 +108,18 @@ export const TimePicker = ({
|
|
108
108
|
state.setValue(
|
109
109
|
state.value.add({
|
110
110
|
minutes: minutesToAdd,
|
111
|
-
})
|
111
|
+
}),
|
112
112
|
);
|
113
113
|
};
|
114
114
|
const backwardsLabel = `${t(texts.backwards)} ${minuteInterval} ${t(
|
115
|
-
texts.minutes
|
115
|
+
texts.minutes,
|
116
116
|
)}`;
|
117
117
|
const forwardsLabel = `${t(texts.forwards)} ${minuteInterval} ${t(
|
118
|
-
texts.minutes
|
118
|
+
texts.minutes,
|
119
119
|
)}`;
|
120
120
|
const inputLabel = label ?? t(texts.time);
|
121
121
|
const ariaLabel = `${inputLabel} – ${t(
|
122
|
-
texts.selectedTimeIs(`${dateTime?.hour ?? 0} ${dateTime?.minute ?? 0}`)
|
122
|
+
texts.selectedTimeIs(`${dateTime?.hour ?? 0} ${dateTime?.minute ?? 0}`),
|
123
123
|
)}`;
|
124
124
|
return (
|
125
125
|
<StyledField
|
package/src/index.tsx
CHANGED
package/src/input/CardSelect.tsx
CHANGED
@@ -77,7 +77,7 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
|
|
77
77
|
withChevron = true,
|
78
78
|
...props
|
79
79
|
},
|
80
|
-
externalRef
|
80
|
+
externalRef,
|
81
81
|
) => {
|
82
82
|
const internalRef = useRef<HTMLButtonElement>(null);
|
83
83
|
const triggerRef = (externalRef ??
|
@@ -91,7 +91,7 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
|
|
91
91
|
const { triggerProps, overlayProps } = useOverlayTrigger(
|
92
92
|
{ type: "dialog" },
|
93
93
|
state,
|
94
|
-
triggerRef
|
94
|
+
triggerRef,
|
95
95
|
);
|
96
96
|
|
97
97
|
const { buttonProps } = useButton(triggerProps, triggerRef);
|
@@ -142,7 +142,7 @@ export const CardSelect = forwardRef<CardSelectProps, "button">(
|
|
142
142
|
)}
|
143
143
|
</Box>
|
144
144
|
);
|
145
|
-
}
|
145
|
+
},
|
146
146
|
);
|
147
147
|
|
148
148
|
/**
|
package/src/input/Combobox.tsx
CHANGED
@@ -16,7 +16,7 @@ const sortedCallingCodes = getSupportedCallingCodes()
|
|
16
16
|
value: `+${code}`,
|
17
17
|
}))
|
18
18
|
.filter(
|
19
|
-
(code) => !prioritizedCountryCodes.some((pCode) => pCode.key === code.key)
|
19
|
+
(code) => !prioritizedCountryCodes.some((pCode) => pCode.key === code.key),
|
20
20
|
);
|
21
21
|
const callingCodes = [...prioritizedCountryCodes, ...sortedCallingCodes];
|
22
22
|
|
@@ -39,7 +39,7 @@ export const FormErrorMessage = ({
|
|
39
39
|
const formControlContext = useFormControlContext();
|
40
40
|
if (!formControlContext) {
|
41
41
|
throw new Error(
|
42
|
-
"FormErrorMessage must be used within a FormControl component"
|
42
|
+
"FormErrorMessage must be used within a FormControl component",
|
43
43
|
);
|
44
44
|
}
|
45
45
|
if (!formControlContext.isInvalid) {
|
package/src/input/InfoSelect.tsx
CHANGED