@vygruppen/spor-react 12.24.15 → 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 +25 -0
- package/dist/index.cjs +2888 -2534
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +921 -572
- package/dist/index.d.ts +921 -572
- package/dist/index.mjs +2860 -2517
- 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 +241 -0
- 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/input/index.ts +1 -0
- 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/theme/slot-recipes/anatomy.ts +14 -0
- package/src/theme/slot-recipes/index.ts +2 -0
- package/src/theme/slot-recipes/menu.ts +111 -0
- 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
package/src/input/Textarea.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useRecipe,
|
|
8
8
|
} from "@chakra-ui/react";
|
|
9
9
|
import React, {
|
|
10
|
-
forwardRef,
|
|
11
10
|
PropsWithChildren,
|
|
12
11
|
ReactNode,
|
|
13
12
|
useId,
|
|
@@ -56,71 +55,74 @@ const useLabelHeight = (label: ReactNode | undefined) => {
|
|
|
56
55
|
}, [label]);
|
|
57
56
|
return { labelRef, labelHeight };
|
|
58
57
|
};
|
|
59
|
-
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
60
|
-
(props, ref) => {
|
|
61
|
-
const {
|
|
62
|
-
label,
|
|
63
|
-
variant = "core",
|
|
64
|
-
invalid,
|
|
65
|
-
required,
|
|
66
|
-
errorText,
|
|
67
|
-
readOnly,
|
|
68
|
-
helperText,
|
|
69
|
-
floatingLabel = true,
|
|
70
|
-
...restProps
|
|
71
|
-
} = props;
|
|
72
|
-
const recipe = useRecipe({ key: "textarea" });
|
|
73
|
-
const styles = recipe({ variant });
|
|
74
|
-
const { labelRef, labelHeight } = useLabelHeight(label);
|
|
75
58
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
59
|
+
export const Textarea = ({
|
|
60
|
+
ref,
|
|
61
|
+
...props
|
|
62
|
+
}: TextareaProps & {
|
|
63
|
+
ref?: React.RefObject<HTMLTextAreaElement>;
|
|
64
|
+
}) => {
|
|
65
|
+
const {
|
|
66
|
+
label,
|
|
67
|
+
variant = "core",
|
|
68
|
+
invalid,
|
|
69
|
+
required,
|
|
70
|
+
errorText,
|
|
71
|
+
readOnly,
|
|
72
|
+
helperText,
|
|
73
|
+
floatingLabel = true,
|
|
74
|
+
...restProps
|
|
75
|
+
} = props;
|
|
76
|
+
const recipe = useRecipe({ key: "textarea" });
|
|
77
|
+
const styles = recipe({ variant });
|
|
87
78
|
|
|
88
|
-
|
|
79
|
+
const { labelRef, labelHeight } = useLabelHeight(label);
|
|
89
80
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
81
|
+
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
82
|
+
useImperativeHandle(ref, () => inputRef.current!, []);
|
|
83
|
+
|
|
84
|
+
const { shouldFloat, handleFocus, handleBlur, handleChange, isControlled } =
|
|
85
|
+
useFloatingInputState<HTMLTextAreaElement>({
|
|
86
|
+
value: props.value,
|
|
87
|
+
defaultValue: props.defaultValue,
|
|
88
|
+
onFocus: props.onFocus,
|
|
89
|
+
onBlur: props.onBlur,
|
|
90
|
+
onChange: props.onChange,
|
|
91
|
+
inputRef: inputRef as React.RefObject<HTMLTextAreaElement>,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const labelId = useId();
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Field
|
|
98
|
+
errorText={errorText}
|
|
99
|
+
helperText={helperText}
|
|
100
|
+
invalid={invalid}
|
|
101
|
+
required={required}
|
|
102
|
+
readOnly={readOnly}
|
|
103
|
+
floatingLabel={floatingLabel}
|
|
104
|
+
shouldFloat={shouldFloat}
|
|
105
|
+
position="relative"
|
|
106
|
+
label={
|
|
107
|
+
<Box id={labelId}>
|
|
108
|
+
<label ref={labelRef}>{label}</label>
|
|
109
|
+
</Box>
|
|
110
|
+
}
|
|
111
|
+
id={restProps.id}
|
|
112
|
+
>
|
|
113
|
+
<ChakraTextarea
|
|
114
|
+
{...restProps}
|
|
115
|
+
css={styles}
|
|
116
|
+
className="peer"
|
|
117
|
+
ref={inputRef}
|
|
118
|
+
value={isControlled ? props.value : undefined}
|
|
119
|
+
onFocus={handleFocus}
|
|
120
|
+
onBlur={handleBlur}
|
|
121
|
+
onChange={handleChange}
|
|
122
|
+
style={{ "--label-height": `${labelHeight}px` } as React.CSSProperties}
|
|
123
|
+
placeholder=" "
|
|
124
|
+
aria-labelledby={labelId}
|
|
125
|
+
/>
|
|
126
|
+
</Field>
|
|
127
|
+
);
|
|
128
|
+
};
|
package/src/input/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
RecipeVariantProps,
|
|
6
6
|
useRecipe,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
|
-
import { forwardRef } from "react";
|
|
9
8
|
|
|
10
9
|
import { pressableCardRecipe } from "../theme/recipes/pressable-card";
|
|
11
10
|
|
|
@@ -42,13 +41,15 @@ import { pressableCardRecipe } from "../theme/recipes/pressable-card";
|
|
|
42
41
|
type PressableCardProps = RecipeVariantProps<typeof pressableCardRecipe> &
|
|
43
42
|
ButtonProps;
|
|
44
43
|
|
|
45
|
-
export const PressableCard =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
export const PressableCard = ({
|
|
45
|
+
ref,
|
|
46
|
+
...props
|
|
47
|
+
}: PressableCardProps & {
|
|
48
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
49
|
+
}) => {
|
|
50
|
+
const recipe = useRecipe({ key: "pressableCard" });
|
|
51
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
|
52
|
+
const styles = recipe(recipeProps);
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
PressableCard.displayName = "PressableCard";
|
|
54
|
+
return <chakra.button {...restProps} css={styles} ref={ref} />;
|
|
55
|
+
};
|
package/src/layout/RadioCard.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
RecipeVariantProps,
|
|
5
5
|
useSlotRecipe,
|
|
6
6
|
} from "@chakra-ui/react";
|
|
7
|
-
import React, {
|
|
7
|
+
import React, { useId } from "react";
|
|
8
8
|
|
|
9
9
|
import { radioCardSlotRecipe } from "../theme/slot-recipes/radio-card";
|
|
10
10
|
|
|
@@ -38,32 +38,34 @@ type RadioCardItemProps = Exclude<
|
|
|
38
38
|
ariaLabel?: string;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
export const RadioCard =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export const RadioCard = ({
|
|
42
|
+
ref,
|
|
43
|
+
...props
|
|
44
|
+
}: RadioCardItemProps & {
|
|
45
|
+
ref?: React.RefObject<HTMLInputElement>;
|
|
46
|
+
}) => {
|
|
47
|
+
const { inputProps, children } = props;
|
|
48
|
+
const uniqueId = useId();
|
|
49
|
+
const itemControlId = `radio-card-item-control-${uniqueId}`;
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
const inputHasAriaLabel =
|
|
52
|
+
inputProps?.["aria-labelledby"] || inputProps?.["aria-label"];
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
RadioCard.displayName = "RadioCard";
|
|
54
|
+
return (
|
|
55
|
+
<ChakraRadioCard.Item {...props}>
|
|
56
|
+
<ChakraRadioCard.ItemHiddenInput
|
|
57
|
+
aria-labelledby={
|
|
58
|
+
inputHasAriaLabel ? inputProps?.["aria-labelledby"] : itemControlId
|
|
59
|
+
}
|
|
60
|
+
ref={ref}
|
|
61
|
+
{...inputProps}
|
|
62
|
+
/>
|
|
63
|
+
<ChakraRadioCard.ItemControl id={itemControlId} aria-hidden>
|
|
64
|
+
{children}
|
|
65
|
+
</ChakraRadioCard.ItemControl>
|
|
66
|
+
</ChakraRadioCard.Item>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
67
69
|
|
|
68
70
|
type RadioCardRootProps = RadioCardVariantProps &
|
|
69
71
|
Exclude<ChakraRadioCard.RootProps, "variant"> & {
|
|
@@ -73,34 +75,36 @@ type RadioCardRootProps = RadioCardVariantProps &
|
|
|
73
75
|
display?: string;
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
export const RadioCardGroup =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
export const RadioCardGroup = ({
|
|
79
|
+
ref,
|
|
80
|
+
...props
|
|
81
|
+
}: RadioCardRootProps & {
|
|
82
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
83
|
+
}) => {
|
|
84
|
+
const {
|
|
85
|
+
children,
|
|
86
|
+
variant,
|
|
87
|
+
gap = 2,
|
|
88
|
+
direction = "column",
|
|
89
|
+
display = "flex",
|
|
90
|
+
...rest
|
|
91
|
+
} = props;
|
|
92
|
+
const recipe = useSlotRecipe({ key: "radio-card" });
|
|
93
|
+
const styles = recipe({ variant });
|
|
88
94
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
104
|
-
RadioCardGroup.displayName = "RadioCardGroup";
|
|
95
|
+
return (
|
|
96
|
+
<ChakraRadioCard.Root
|
|
97
|
+
ref={ref}
|
|
98
|
+
variant={variant}
|
|
99
|
+
css={styles}
|
|
100
|
+
display={display}
|
|
101
|
+
gap={gap}
|
|
102
|
+
flexDirection={direction}
|
|
103
|
+
{...rest}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</ChakraRadioCard.Root>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
105
109
|
|
|
106
110
|
export const RadioCardLabel = ChakraRadioCard.Label;
|
package/src/layout/Separator.tsx
CHANGED
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
Separator as ChakraSeparator,
|
|
5
5
|
SeparatorProps as ChakraSeparatorProps,
|
|
6
6
|
} from "@chakra-ui/react";
|
|
7
|
-
import { forwardRef } from "react";
|
|
8
7
|
|
|
9
|
-
export const Separator =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export const Separator = ({
|
|
9
|
+
ref,
|
|
10
|
+
...props
|
|
11
|
+
}: ChakraSeparatorProps & {
|
|
12
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
13
|
+
}) => {
|
|
14
|
+
return <ChakraSeparator {...props} ref={ref} data- />;
|
|
15
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Box, BoxProps, RecipeVariantProps, useRecipe } from "@chakra-ui/react";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
3
|
|
|
5
4
|
import { staticCardRecipe } from "../theme/recipes/static-card";
|
|
6
5
|
|
|
@@ -44,13 +43,15 @@ import { staticCardRecipe } from "../theme/recipes/static-card";
|
|
|
44
43
|
export type StaticCardProps = RecipeVariantProps<typeof staticCardRecipe> &
|
|
45
44
|
BoxProps;
|
|
46
45
|
|
|
47
|
-
export const StaticCard =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
export const StaticCard = ({
|
|
47
|
+
ref,
|
|
48
|
+
...props
|
|
49
|
+
}: StaticCardProps & {
|
|
50
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
51
|
+
}) => {
|
|
52
|
+
const recipe = useRecipe({ key: "staticCard" });
|
|
53
|
+
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
|
54
|
+
const styles = recipe(recipeProps);
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
56
|
-
StaticCard.displayName = "StaticCard";
|
|
56
|
+
return <Box css={styles} {...restProps} ref={ref}></Box>;
|
|
57
|
+
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useSlotRecipe,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
8
|
import clsx from "clsx";
|
|
9
|
-
import {
|
|
9
|
+
import { PropsWithChildren } from "react";
|
|
10
10
|
|
|
11
11
|
import { lineIconSlotRecipe } from "../theme/slot-recipes/line-icon";
|
|
12
12
|
import { LinjeTagIcon } from "./icons";
|
|
@@ -63,63 +63,57 @@ export type LineIconProps = Exclude<BoxProps, "variant"> &
|
|
|
63
63
|
* @see https://spor.vy.no/components/line-tags
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
-
export const LineIcon =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const styles = recipe({ variant, size, ...rest });
|
|
66
|
+
export const LineIcon = function LineIcon({
|
|
67
|
+
ref,
|
|
68
|
+
variant,
|
|
69
|
+
size = "md",
|
|
70
|
+
foregroundColor,
|
|
71
|
+
disabled,
|
|
72
|
+
style,
|
|
73
|
+
target = "lineIcon",
|
|
74
|
+
label,
|
|
75
|
+
...rest
|
|
76
|
+
}: LineIconProps & {
|
|
77
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
78
|
+
}) {
|
|
79
|
+
const recipe = useSlotRecipe({ key: "lineIcon" });
|
|
80
|
+
const styles = recipe({ variant, size, ...rest });
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
const targetPadding = () => {
|
|
83
|
+
return target === "travelTag" ? 0.5 : 1;
|
|
84
|
+
};
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const borderContainer = () => {
|
|
87
|
+
return variant === "walk" && target === "travelTag" ? 0 : "1px";
|
|
88
|
+
};
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (foregroundColor) {
|
|
91
|
+
styles.iconContainer.backgroundColor = disabled
|
|
92
|
+
? "surface.disabled"
|
|
93
|
+
: foregroundColor;
|
|
94
|
+
}
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
return "local-train";
|
|
96
|
+
function getIconVariant() {
|
|
97
|
+
if (variant === "custom") {
|
|
98
|
+
if ("customIconVariant" in rest) {
|
|
99
|
+
return rest.customIconVariant;
|
|
103
100
|
}
|
|
104
|
-
return
|
|
101
|
+
return "local-train";
|
|
105
102
|
}
|
|
103
|
+
return variant;
|
|
104
|
+
}
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/>
|
|
122
|
-
</Box>
|
|
123
|
-
);
|
|
124
|
-
},
|
|
125
|
-
);
|
|
106
|
+
return (
|
|
107
|
+
<Box
|
|
108
|
+
css={{ ...styles.iconContainer, ...style }}
|
|
109
|
+
padding={targetPadding()}
|
|
110
|
+
borderWidth={borderContainer()}
|
|
111
|
+
borderColor={variant === "walk" ? "core.outline" : "transparent"}
|
|
112
|
+
aria-label={label}
|
|
113
|
+
ref={ref}
|
|
114
|
+
className={clsx("light", rest.className)}
|
|
115
|
+
>
|
|
116
|
+
<LinjeTagIcon size={size} css={styles.icon} variant={getIconVariant()} />
|
|
117
|
+
</Box>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
WarningFill24Icon,
|
|
16
16
|
} from "@vygruppen/spor-icon-react";
|
|
17
17
|
import clsx from "clsx";
|
|
18
|
-
import {
|
|
18
|
+
import { PropsWithChildren } from "react";
|
|
19
19
|
|
|
20
20
|
import { travelTagSlotRecipe } from "../theme/slot-recipes/travel-tag";
|
|
21
21
|
import { LineIcon } from "./LineIcon";
|
|
@@ -128,64 +128,62 @@ function renderDeviationLevelIcon(
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export const TravelTag =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
131
|
+
export const TravelTag = function TravelTag({
|
|
132
|
+
ref,
|
|
133
|
+
variant,
|
|
134
|
+
size = "md",
|
|
135
|
+
deviationLevel = "none",
|
|
136
|
+
title,
|
|
137
|
+
description,
|
|
138
|
+
disabled,
|
|
139
|
+
foregroundColor,
|
|
140
|
+
backgroundColor,
|
|
141
|
+
customIconVariant,
|
|
142
|
+
...rest
|
|
143
|
+
}: TravelTagProps & {
|
|
144
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
145
|
+
}) {
|
|
146
|
+
const recipie = useSlotRecipe({ key: "travelTag" });
|
|
147
|
+
const styles = recipie({
|
|
148
|
+
variant,
|
|
149
|
+
size,
|
|
150
|
+
deviationLevel,
|
|
151
|
+
});
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
return (
|
|
154
|
+
<Box
|
|
155
|
+
css={styles.container}
|
|
156
|
+
aria-disabled={disabled}
|
|
157
|
+
ref={ref}
|
|
158
|
+
className={clsx("light", rest.className)}
|
|
159
|
+
backgroundColor={backgroundColor}
|
|
160
|
+
{...rest}
|
|
161
|
+
>
|
|
162
|
+
<LineIcon
|
|
163
|
+
variant={variant}
|
|
164
|
+
size={size}
|
|
165
|
+
foregroundColor={foregroundColor}
|
|
160
166
|
backgroundColor={backgroundColor}
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)}
|
|
180
|
-
{title && description && " "}
|
|
181
|
-
{description && (
|
|
182
|
-
<Box as="span" css={styles.description}>
|
|
183
|
-
{description}
|
|
184
|
-
</Box>
|
|
185
|
-
)}
|
|
186
|
-
</Box>
|
|
187
|
-
{renderDeviationLevelIcon(deviationLevel, size, styles.deviationIcon)}
|
|
167
|
+
customIconVariant={customIconVariant}
|
|
168
|
+
disabled={disabled}
|
|
169
|
+
target="travelTag"
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
|
+
{...(rest as any)} //Find a way to not use any here
|
|
172
|
+
/>
|
|
173
|
+
<Box css={styles.textContainer}>
|
|
174
|
+
{title && (
|
|
175
|
+
<Box as="span" css={styles.title}>
|
|
176
|
+
{title}
|
|
177
|
+
</Box>
|
|
178
|
+
)}
|
|
179
|
+
{title && description && " "}
|
|
180
|
+
{description && (
|
|
181
|
+
<Box as="span" css={styles.description}>
|
|
182
|
+
{description}
|
|
183
|
+
</Box>
|
|
184
|
+
)}
|
|
188
185
|
</Box>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
);
|
|
186
|
+
{renderDeviationLevelIcon(deviationLevel, size, styles.deviationIcon)}
|
|
187
|
+
</Box>
|
|
188
|
+
);
|
|
189
|
+
};
|