@vygruppen/spor-react 11.3.10 → 12.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 +32 -11
- package/.turbo/turbo-typegen.log +23 -0
- package/CHANGELOG.md +239 -0
- package/dist/index.d.mts +2552 -8319
- package/dist/index.d.ts +2552 -8319
- package/dist/index.js +9609 -8608
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9487 -8455
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -13
- package/src/accordion/Accordion.tsx +96 -45
- package/src/accordion/Expandable.tsx +54 -127
- package/src/accordion/helpers.ts +31 -0
- package/src/accordion/types.ts +60 -0
- package/src/alert/Alert.tsx +101 -0
- package/src/alert/AlertIcon.tsx +63 -45
- package/src/alert/ExpandableAlert.tsx +96 -64
- package/src/alert/ServiceAlert.tsx +127 -125
- package/src/alert/{index.tsx → index.ts} +1 -2
- package/src/breadcrumb/Breadcrumb.tsx +39 -24
- package/src/button/Button.tsx +86 -105
- package/src/button/ButtonGroup.tsx +45 -20
- package/src/button/Clipboard.tsx +82 -0
- package/src/button/CloseButton.tsx +4 -3
- package/src/button/FloatingActionButton.tsx +35 -41
- package/src/button/IconButton.tsx +34 -30
- package/src/button/index.tsx +1 -0
- package/src/color-mode/color-mode.tsx +75 -0
- package/src/color-mode/index.ts +1 -0
- package/src/datepicker/Calendar.tsx +17 -8
- package/src/datepicker/CalendarCell.tsx +20 -13
- package/src/datepicker/CalendarGrid.tsx +18 -10
- package/src/datepicker/CalendarHeader.tsx +2 -0
- package/src/datepicker/CalendarNavigationButton.tsx +1 -0
- package/src/datepicker/CalendarTriggerButton.tsx +43 -45
- package/src/datepicker/DateField.tsx +21 -12
- package/src/datepicker/DatePicker.tsx +61 -58
- package/src/datepicker/DateRangePicker.tsx +52 -58
- package/src/datepicker/DateTimeSegment.tsx +13 -5
- package/src/datepicker/RangeCalendar.tsx +13 -7
- package/src/datepicker/StyledField.tsx +25 -17
- package/src/datepicker/TimeField.tsx +10 -8
- package/src/datepicker/TimePicker.tsx +48 -45
- package/src/datepicker/types.ts +5 -0
- package/src/dialog/Dialog.tsx +56 -0
- package/src/dialog/Drawer.tsx +187 -0
- package/src/dialog/index.ts +2 -0
- package/src/dialog/types.ts +26 -0
- package/src/image/index.tsx +2 -2
- package/src/index.tsx +5 -3
- package/src/input/AttachedInputs.tsx +17 -42
- package/src/input/CardSelect.tsx +75 -162
- package/src/input/Checkbox.tsx +30 -6
- package/src/input/CheckboxGroup.tsx +25 -16
- package/src/input/ChoiceChip.tsx +58 -77
- package/src/input/Combobox.tsx +172 -172
- package/src/input/CountryCodeSelect.tsx +42 -28
- package/src/input/Dialog.tsx +1 -0
- package/src/input/Field.tsx +71 -0
- package/src/input/Fieldset.tsx +7 -0
- package/src/input/Input.tsx +68 -73
- package/src/input/InputGroup.tsx +66 -0
- package/src/input/ListBox.tsx +83 -70
- package/src/input/NativeSelect.tsx +68 -33
- package/src/input/NumericStepper.tsx +173 -171
- package/src/input/PasswordInput.tsx +99 -52
- package/src/input/PhoneNumberInput.tsx +69 -72
- package/src/input/Popover.tsx +1 -0
- package/src/input/Radio.tsx +37 -17
- package/src/input/SearchInput.tsx +24 -86
- package/src/input/Select.tsx +237 -0
- package/src/input/Switch.tsx +60 -18
- package/src/input/Textarea.tsx +53 -101
- package/src/input/{index.tsx → index.ts} +2 -8
- package/src/layout/PressableCard.tsx +12 -21
- package/src/layout/RadioCard.tsx +68 -101
- package/src/layout/Separator.tsx +32 -0
- package/src/layout/StaticCard.tsx +13 -33
- package/src/layout/index.tsx +3 -7
- package/src/linjetag/InfoTag.tsx +16 -9
- package/src/linjetag/LineIcon.tsx +74 -28
- package/src/linjetag/TravelTag.tsx +38 -27
- package/src/link/TextLink.tsx +25 -16
- package/src/list/index.tsx +24 -2
- package/src/loader/ClientOnly.tsx +8 -7
- package/src/loader/ColorInlineLoader.tsx +4 -3
- package/src/loader/ColorSpinner.tsx +5 -4
- package/src/loader/ContentLoader.tsx +6 -4
- package/src/loader/DarkFullScreenLoader.tsx +11 -3
- package/src/loader/DarkInlineLoader.tsx +5 -3
- package/src/loader/DarkSpinner.tsx +7 -3
- package/src/loader/LightFullScreenLoader.tsx +11 -3
- package/src/loader/LightInlineLoader.tsx +11 -3
- package/src/loader/LightSpinner.tsx +5 -3
- package/src/loader/Lottie.tsx +3 -3
- package/src/loader/ProgressBar.tsx +83 -84
- package/src/loader/ProgressLoader.tsx +120 -75
- package/src/loader/Skeleton.tsx +94 -19
- package/src/loader/index.tsx +0 -2
- package/src/loader/useHydrated.tsx +1 -0
- package/src/loader/useRotatingLabel.tsx +2 -1
- package/src/logo/CargonetLogo.tsx +89 -89
- package/src/logo/VyLogo.tsx +61 -42
- package/src/logo/VyLogoPride.tsx +137 -139
- package/src/media-controller/JumpButton.tsx +48 -38
- package/src/media-controller/PlayPauseButton.tsx +31 -29
- package/src/media-controller/SkipButton.tsx +38 -37
- package/src/nudge/Nudge.tsx +195 -123
- package/src/nudge/index.tsx +0 -1
- package/src/pagination/Pagination.tsx +221 -118
- package/src/pagination/types.ts +23 -0
- package/src/popover/index.tsx +67 -0
- package/src/progress-indicator/ProgressDot.tsx +11 -10
- package/src/progress-indicator/ProgressIndicator.tsx +28 -15
- package/src/provider/SporProvider.tsx +17 -14
- package/src/stepper/Stepper.tsx +88 -85
- package/src/stepper/StepperContext.tsx +2 -1
- package/src/stepper/StepperStep.tsx +28 -21
- package/src/tab/Tabs.tsx +62 -12
- package/src/tab/index.tsx +1 -9
- package/src/table/Table.tsx +35 -30
- package/src/table/index.tsx +11 -7
- package/src/theme/brand.ts +7 -0
- package/src/theme/index.ts +45 -37
- package/src/theme/recipes/attached-inputs.ts +43 -0
- package/src/theme/recipes/badge.ts +104 -0
- package/src/theme/recipes/button.ts +124 -0
- package/src/theme/recipes/choice-chip.ts +144 -0
- package/src/theme/recipes/close-button.ts +41 -0
- package/src/theme/recipes/code.ts +14 -0
- package/src/theme/recipes/group.ts +19 -0
- package/src/theme/recipes/index.ts +29 -0
- package/src/theme/recipes/input.ts +89 -0
- package/src/theme/recipes/link.ts +64 -0
- package/src/theme/recipes/nudge.ts +12 -0
- package/src/theme/recipes/pressable-card.ts +83 -0
- package/src/theme/recipes/progress-loader.ts +14 -0
- package/src/theme/recipes/separator.ts +85 -0
- package/src/theme/recipes/skeleton.ts +57 -0
- package/src/theme/recipes/static-card.ts +39 -0
- package/src/theme/recipes/textarea.ts +27 -0
- package/src/theme/semantic-tokens/colors.ts +22 -0
- package/src/theme/semantic-tokens/index.ts +24 -0
- package/src/theme/semantic-tokens/radii.ts +14 -0
- package/src/theme/semantic-tokens/shadows.ts +17 -0
- package/src/theme/slot-recipes/accordion.ts +131 -0
- package/src/theme/slot-recipes/alert-expandable.ts +133 -0
- package/src/theme/slot-recipes/alert-service.ts +66 -0
- package/src/theme/slot-recipes/alert.ts +72 -0
- package/src/theme/slot-recipes/anatomy.ts +269 -0
- package/src/theme/slot-recipes/breadcrumb.ts +61 -0
- package/src/theme/slot-recipes/checkbox.ts +89 -0
- package/src/theme/slot-recipes/datepicker.ts +214 -0
- package/src/theme/slot-recipes/dialog.ts +221 -0
- package/src/theme/slot-recipes/drawer.ts +205 -0
- package/src/theme/slot-recipes/field.ts +79 -0
- package/src/theme/slot-recipes/floating-action-button.ts +131 -0
- package/src/theme/slot-recipes/index.ts +65 -0
- package/src/theme/slot-recipes/info-tag.ts +62 -0
- package/src/theme/slot-recipes/line-icon.ts +140 -0
- package/src/theme/slot-recipes/list.ts +45 -0
- package/src/theme/slot-recipes/listbox.ts +72 -0
- package/src/theme/slot-recipes/media-controller-button.ts +131 -0
- package/src/theme/slot-recipes/native-select.ts +54 -0
- package/src/theme/slot-recipes/numeric-stepper.ts +65 -0
- package/src/theme/slot-recipes/pagination.ts +41 -0
- package/src/theme/slot-recipes/popover.ts +78 -0
- package/src/theme/slot-recipes/progress-bar.ts +39 -0
- package/src/theme/slot-recipes/progress-indicator.ts +22 -0
- package/src/theme/slot-recipes/radio-card.ts +112 -0
- package/src/theme/slot-recipes/radio.ts +80 -0
- package/src/theme/slot-recipes/select.ts +243 -0
- package/src/theme/slot-recipes/stepper.ts +92 -0
- package/src/theme/slot-recipes/switch.ts +147 -0
- package/src/theme/slot-recipes/table.ts +200 -0
- package/src/theme/slot-recipes/tabs.ts +169 -0
- package/src/theme/slot-recipes/toast.ts +56 -0
- package/src/theme/slot-recipes/travel-tag.ts +192 -0
- package/src/theme/tokens/animation-styles.ts +50 -0
- package/src/theme/tokens/animations.ts +22 -0
- package/src/theme/tokens/aspect-ratios.ts +22 -0
- package/src/theme/tokens/blurs.ts +28 -0
- package/src/theme/tokens/borders.ts +26 -0
- package/src/theme/{foundations → tokens}/breakpoints.ts +0 -1
- package/src/theme/tokens/colors.ts +10 -0
- package/src/theme/tokens/config.ts +10 -0
- package/src/theme/tokens/cursor.ts +28 -0
- package/src/theme/tokens/durations.ts +25 -0
- package/src/theme/tokens/easings.ts +16 -0
- package/src/theme/tokens/font-sizes.ts +30 -0
- package/src/theme/tokens/font-weights.ts +31 -0
- package/src/theme/tokens/fonts.ts +8 -0
- package/src/theme/tokens/global-css.ts +18 -0
- package/src/theme/tokens/index.ts +37 -0
- package/src/theme/tokens/keyframes.ts +255 -0
- package/src/theme/tokens/letter-spacings.ts +19 -0
- package/src/theme/tokens/line-heights.ts +19 -0
- package/src/theme/tokens/radii.ts +13 -0
- package/src/theme/tokens/sizes.ts +51 -0
- package/src/theme/tokens/spacing.ts +20 -0
- package/src/theme/tokens/text-styles.ts +89 -0
- package/src/theme/tokens/z-index.ts +17 -0
- package/src/theme/utils/accent-utils.ts +8 -21
- package/src/theme/utils/bg-utils.ts +4 -6
- package/src/theme/utils/brand-utils.ts +6 -19
- package/src/theme/utils/core-utils.ts +91 -0
- package/src/theme/utils/floating-utils.ts +20 -39
- package/src/theme/utils/ghost-utils.ts +7 -21
- package/src/theme/utils/input-utils.ts +32 -37
- package/src/theme/utils/outline-utils.ts +4 -11
- package/src/theme/utils/surface-utils.ts +5 -19
- package/src/theme/utils/types.ts +1 -0
- package/src/toast/index.tsx +1 -1
- package/src/toast/toast.tsx +105 -0
- package/src/transition/index.ts +2 -8
- package/src/typography/Badge.tsx +15 -61
- package/src/typography/Code.tsx +16 -28
- package/src/typography/Heading.tsx +34 -19
- package/src/typography/Text.tsx +9 -6
- package/src/typography/{index.tsx → index.ts} +1 -0
- package/src/util/externals.tsx +13 -27
- package/tsconfig.json +5 -1
- package/src/accordion/Accordion.test.tsx +0 -20
- package/src/alert/BaseAlert.test.tsx +0 -37
- package/src/alert/BaseAlert.tsx +0 -34
- package/src/alert/ClosableAlert.test.tsx +0 -37
- package/src/alert/ClosableAlert.tsx +0 -85
- package/src/alert/ExpandableAlert.test.tsx +0 -84
- package/src/alert/StaticAlert.tsx +0 -33
- package/src/button/Button.test.tsx +0 -23
- package/src/datepicker/TimePicker.test.tsx +0 -74
- package/src/input/FormControl.tsx +0 -2
- package/src/input/FormErrorMessage.tsx +0 -95
- package/src/input/FormLabel.tsx +0 -11
- package/src/input/InfoSelect.tsx +0 -274
- package/src/input/InputElement.tsx +0 -44
- package/src/input/RadioGroup.tsx +0 -47
- package/src/layout/Divider.tsx +0 -27
- package/src/layout/RadioCardGroup.tsx +0 -79
- package/src/layout/Stack.tsx +0 -42
- package/src/loader/SkeletonCircle.tsx +0 -13
- package/src/loader/SkeletonText.tsx +0 -14
- package/src/media-controller/index.test.tsx +0 -59
- package/src/modal/Drawer.tsx +0 -120
- package/src/modal/FullScreenDrawer.tsx +0 -239
- package/src/modal/Modal.tsx +0 -15
- package/src/modal/ModalHeader.tsx +0 -31
- package/src/modal/SimpleDrawer.tsx +0 -51
- package/src/modal/index.tsx +0 -5
- package/src/nudge/WizardNudge.tsx +0 -107
- package/src/theme/components/accordion.ts +0 -102
- package/src/theme/components/alert-expandable.ts +0 -125
- package/src/theme/components/alert-service.ts +0 -98
- package/src/theme/components/alert.ts +0 -71
- package/src/theme/components/badge.ts +0 -109
- package/src/theme/components/breadcrumb.ts +0 -60
- package/src/theme/components/button.ts +0 -125
- package/src/theme/components/card-select.ts +0 -117
- package/src/theme/components/checkbox.ts +0 -88
- package/src/theme/components/choice-chip.ts +0 -161
- package/src/theme/components/close-button.ts +0 -48
- package/src/theme/components/code.ts +0 -17
- package/src/theme/components/datepicker.ts +0 -198
- package/src/theme/components/divider.ts +0 -50
- package/src/theme/components/drawer.ts +0 -95
- package/src/theme/components/fab.ts +0 -109
- package/src/theme/components/form-label.ts +0 -17
- package/src/theme/components/form.ts +0 -27
- package/src/theme/components/index.ts +0 -45
- package/src/theme/components/info-select.ts +0 -85
- package/src/theme/components/info-tag.ts +0 -63
- package/src/theme/components/input.ts +0 -28
- package/src/theme/components/line-icon.ts +0 -129
- package/src/theme/components/link.ts +0 -78
- package/src/theme/components/list.ts +0 -23
- package/src/theme/components/listbox.ts +0 -77
- package/src/theme/components/media-controller-button.ts +0 -97
- package/src/theme/components/modal.ts +0 -96
- package/src/theme/components/numeric-stepper.ts +0 -65
- package/src/theme/components/pagination.ts +0 -74
- package/src/theme/components/popover.ts +0 -68
- package/src/theme/components/pressable-card.ts +0 -72
- package/src/theme/components/progress-bar.ts +0 -47
- package/src/theme/components/progress-indicator.ts +0 -44
- package/src/theme/components/radio-card.ts +0 -134
- package/src/theme/components/radio.ts +0 -68
- package/src/theme/components/select.ts +0 -74
- package/src/theme/components/skeleton.ts +0 -40
- package/src/theme/components/static-card.ts +0 -82
- package/src/theme/components/stepper.ts +0 -100
- package/src/theme/components/switch.ts +0 -112
- package/src/theme/components/table.ts +0 -161
- package/src/theme/components/tabs.ts +0 -135
- package/src/theme/components/textarea.ts +0 -33
- package/src/theme/components/toast.ts +0 -28
- package/src/theme/components/travel-tag.ts +0 -256
- package/src/theme/foundations/borders.ts +0 -11
- package/src/theme/foundations/colors.ts +0 -12
- package/src/theme/foundations/config.ts +0 -5
- package/src/theme/foundations/fontSizes.ts +0 -29
- package/src/theme/foundations/fontWeights.ts +0 -5
- package/src/theme/foundations/fonts.ts +0 -7
- package/src/theme/foundations/index.ts +0 -15
- package/src/theme/foundations/lineHeights.ts +0 -6
- package/src/theme/foundations/radii.ts +0 -12
- package/src/theme/foundations/shadows.ts +0 -8
- package/src/theme/foundations/sizes.ts +0 -36
- package/src/theme/foundations/spacing.ts +0 -31
- package/src/theme/foundations/styles.ts +0 -12
- package/src/theme/foundations/textStyles.ts +0 -74
- package/src/theme/foundations/zIndices.ts +0 -17
- package/src/theme/utils/base-utils.ts +0 -104
- package/src/theme/utils/focus-utils.ts +0 -10
- package/src/toast/ActionToast.test.tsx +0 -22
- package/src/toast/ActionToast.tsx +0 -28
- package/src/toast/BaseToast.test.tsx +0 -27
- package/src/toast/BaseToast.tsx +0 -75
- package/src/toast/ClosableToast.test.tsx +0 -17
- package/src/toast/ClosableToast.tsx +0 -40
- package/src/toast/useToast.tsx +0 -121
- package/src/tooltip/Tooltip.tsx +0 -70
- package/src/tooltip/index.tsx +0 -1
package/src/layout/index.tsx
CHANGED
@@ -5,12 +5,12 @@ export {
|
|
5
5
|
Flex,
|
6
6
|
Grid,
|
7
7
|
GridItem,
|
8
|
+
Stack,
|
8
9
|
HStack,
|
9
10
|
SimpleGrid,
|
10
11
|
Spacer,
|
11
12
|
VStack,
|
12
|
-
|
13
|
-
WrapItem,
|
13
|
+
Span,
|
14
14
|
} from "@chakra-ui/react";
|
15
15
|
export type {
|
16
16
|
BoxProps,
|
@@ -21,12 +21,8 @@ export type {
|
|
21
21
|
GridProps,
|
22
22
|
SimpleGridProps,
|
23
23
|
SpacerProps,
|
24
|
-
WrapItemProps,
|
25
|
-
WrapProps,
|
26
24
|
} from "@chakra-ui/react";
|
27
|
-
export * from "./
|
28
|
-
export * from "./Stack";
|
25
|
+
export * from "./Separator";
|
29
26
|
export * from "./RadioCard";
|
30
|
-
export * from "./RadioCardGroup";
|
31
27
|
export * from "./StaticCard";
|
32
28
|
export * from "./PressableCard";
|
package/src/linjetag/InfoTag.tsx
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
import
|
1
|
+
"use client";
|
2
|
+
import { Box, RecipeVariantProps, useSlotRecipe } from "@chakra-ui/react";
|
3
|
+
import React, { PropsWithChildren } from "react";
|
3
4
|
import { LineIcon } from "./LineIcon";
|
4
5
|
import type { TagProps } from "./types";
|
6
|
+
import { infoTagSlotRecipe } from "../theme/slot-recipes/info-tag";
|
5
7
|
|
6
|
-
|
8
|
+
type InfoTagVariantProps = RecipeVariantProps<typeof infoTagSlotRecipe>;
|
9
|
+
|
10
|
+
export type InfoTagProps = TagProps & PropsWithChildren<InfoTagVariantProps>;
|
7
11
|
|
8
12
|
/**
|
9
13
|
* An info tag component.
|
@@ -44,28 +48,31 @@ export const InfoTag = ({
|
|
44
48
|
description,
|
45
49
|
...customProps
|
46
50
|
}: InfoTagProps) => {
|
47
|
-
const
|
51
|
+
const recipe = useSlotRecipe({ key: "infoTag" });
|
52
|
+
|
53
|
+
const styles = recipe({
|
48
54
|
variant,
|
49
55
|
size,
|
50
56
|
...customProps,
|
51
57
|
});
|
58
|
+
|
52
59
|
return (
|
53
|
-
<Box
|
60
|
+
<Box css={styles.container}>
|
54
61
|
<LineIcon
|
55
62
|
variant={variant}
|
56
63
|
size={size}
|
57
|
-
|
64
|
+
aria-label={title}
|
58
65
|
{...(customProps as any)} // TODO: Fix this
|
59
66
|
/>
|
60
|
-
<Box
|
67
|
+
<Box css={styles.textContainer}>
|
61
68
|
{title && (
|
62
|
-
<Box as="span"
|
69
|
+
<Box as="span" css={styles.title}>
|
63
70
|
{title}
|
64
71
|
</Box>
|
65
72
|
)}
|
66
73
|
{title && description && " "}
|
67
74
|
{description && (
|
68
|
-
<Box as="span"
|
75
|
+
<Box as="span" css={styles.description}>
|
69
76
|
{description}
|
70
77
|
</Box>
|
71
78
|
)}
|
@@ -1,8 +1,17 @@
|
|
1
|
-
|
2
|
-
import
|
1
|
+
"use client";
|
2
|
+
import {
|
3
|
+
Box,
|
4
|
+
BoxProps,
|
5
|
+
RecipeVariantProps,
|
6
|
+
useSlotRecipe,
|
7
|
+
} from "@chakra-ui/react";
|
8
|
+
import React, { forwardRef, PropsWithChildren } from "react";
|
9
|
+
import { lineIconSlotRecipe } from "../theme/slot-recipes/line-icon";
|
3
10
|
import { getCorrectIcon } from "./icons";
|
4
11
|
import { CustomVariantProps, TagProps } from "./types";
|
5
12
|
|
13
|
+
type LineIconVariantProps = RecipeVariantProps<typeof lineIconSlotRecipe>;
|
14
|
+
|
6
15
|
type DefaultVariants = Exclude<TagProps["variant"], "custom">;
|
7
16
|
|
8
17
|
type DefaultVariantProps = {
|
@@ -12,8 +21,14 @@ type DefaultVariantProps = {
|
|
12
21
|
type VariantProps = DefaultVariantProps | CustomVariantProps;
|
13
22
|
|
14
23
|
export type LineIconProps = Exclude<BoxProps, "variant"> &
|
15
|
-
VariantProps &
|
24
|
+
VariantProps &
|
25
|
+
PropsWithChildren<LineIconVariantProps> & {
|
16
26
|
size: TagProps["size"];
|
27
|
+
foregroundColor?: string;
|
28
|
+
backgroundColor?: string;
|
29
|
+
disabled?: boolean;
|
30
|
+
target?: string;
|
31
|
+
label: string;
|
17
32
|
};
|
18
33
|
|
19
34
|
/**
|
@@ -45,28 +60,59 @@ export type LineIconProps = Exclude<BoxProps, "variant"> &
|
|
45
60
|
*
|
46
61
|
* @see https://spor.vy.no/components/line-tags
|
47
62
|
*/
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
size,
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
|
64
|
+
export const LineIcon = forwardRef<HTMLDivElement, LineIconProps>(
|
65
|
+
function LineIcon({
|
66
|
+
variant,
|
67
|
+
size = "md",
|
68
|
+
foregroundColor,
|
69
|
+
backgroundColor,
|
70
|
+
disabled,
|
71
|
+
style,
|
72
|
+
target = "lineIcon",
|
73
|
+
label,
|
74
|
+
...rest
|
75
|
+
}) {
|
76
|
+
const recipe = useSlotRecipe({ key: "lineIcon" });
|
77
|
+
const styles = recipe({ variant, size, ...rest });
|
78
|
+
|
79
|
+
const targetPadding = () => {
|
80
|
+
return target === "travelTag" ? 0.5 : 1;
|
81
|
+
};
|
82
|
+
|
83
|
+
const borderContainer = () => {
|
84
|
+
return variant === "walk" && target === "travelTag" ? 0 : 0.5;
|
85
|
+
};
|
86
|
+
|
87
|
+
const Icon: any = getCorrectIcon({
|
88
|
+
variant:
|
89
|
+
variant === "custom" && "customIconVariant" in rest
|
90
|
+
? rest.customIconVariant
|
91
|
+
: variant === "custom"
|
92
|
+
? "local-train"
|
93
|
+
: variant,
|
94
|
+
size,
|
95
|
+
});
|
96
|
+
if (!Icon) {
|
97
|
+
return null;
|
98
|
+
}
|
99
|
+
|
100
|
+
if (foregroundColor) {
|
101
|
+
styles.iconContainer.backgroundColor = disabled
|
102
|
+
? "surface.disabled"
|
103
|
+
: foregroundColor;
|
104
|
+
}
|
105
|
+
|
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
|
+
>
|
114
|
+
<Icon css={styles.icon} />
|
115
|
+
</Box>
|
116
|
+
);
|
117
|
+
},
|
118
|
+
);
|
@@ -1,8 +1,9 @@
|
|
1
|
+
"use client";
|
1
2
|
import {
|
2
3
|
Box,
|
3
4
|
BoxProps,
|
4
|
-
|
5
|
-
|
5
|
+
RecipeVariantProps,
|
6
|
+
useSlotRecipe,
|
6
7
|
} from "@chakra-ui/react";
|
7
8
|
import {
|
8
9
|
ErrorFill18Icon,
|
@@ -12,22 +13,20 @@ import {
|
|
12
13
|
WarningFill18Icon,
|
13
14
|
WarningFill24Icon,
|
14
15
|
} from "@vygruppen/spor-icon-react";
|
15
|
-
import React from "react";
|
16
|
+
import React, { forwardRef, PropsWithChildren } from "react";
|
16
17
|
import { LineIcon } from "./LineIcon";
|
17
18
|
import type { TagProps } from "./types";
|
18
|
-
import {
|
19
|
+
import { travelTagSlotRecipe } from "../theme/slot-recipes/travel-tag";
|
20
|
+
|
21
|
+
type TravelTagVariantProps = RecipeVariantProps<typeof travelTagSlotRecipe>;
|
22
|
+
|
23
|
+
type DeviationLevels = "critical" | "major" | "minor" | "info" | "none";
|
19
24
|
|
20
25
|
export type TravelTagProps = TagProps &
|
21
|
-
BoxProps &
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
*/
|
26
|
-
deviationLevel?: "critical" | "major" | "minor" | "info" | "none";
|
27
|
-
isDisabled?: boolean;
|
28
|
-
/**
|
29
|
-
* Needs to be defined if variant is custom
|
30
|
-
*/
|
26
|
+
BoxProps &
|
27
|
+
PropsWithChildren<TravelTagVariantProps> & {
|
28
|
+
deviationLevel?: DeviationLevels;
|
29
|
+
disabled?: boolean;
|
31
30
|
foregroundColor?: string;
|
32
31
|
/**
|
33
32
|
* Needs to be defined if variant is custom
|
@@ -52,6 +51,8 @@ export type TravelTagProps = TagProps &
|
|
52
51
|
*
|
53
52
|
* You can also render them with a deviation level to indicate an extra focus:
|
54
53
|
*
|
54
|
+
* You can add a "disabled" prop to the tag to make it look disabled (grey)
|
55
|
+
*
|
55
56
|
* ```tsx
|
56
57
|
* <TravelTag
|
57
58
|
* variant="subway"
|
@@ -89,57 +90,66 @@ export type TravelTagProps = TagProps &
|
|
89
90
|
*
|
90
91
|
* @see https://spor.vy.no/components/line-tags
|
91
92
|
*/
|
92
|
-
|
93
|
-
|
93
|
+
|
94
|
+
export const TravelTag = forwardRef<HTMLDivElement, TravelTagProps>(
|
95
|
+
function TravelTag(
|
94
96
|
{
|
95
97
|
variant,
|
96
98
|
size = "md",
|
97
99
|
deviationLevel = "none",
|
98
100
|
title,
|
99
101
|
description,
|
100
|
-
|
102
|
+
disabled,
|
101
103
|
foregroundColor,
|
102
104
|
backgroundColor,
|
103
105
|
customIconVariant,
|
104
106
|
...rest
|
105
107
|
},
|
106
108
|
ref,
|
107
|
-
)
|
108
|
-
const
|
109
|
+
) {
|
110
|
+
const recipie = useSlotRecipe({ key: "travelTag" });
|
111
|
+
const styles = recipie({
|
109
112
|
variant,
|
110
113
|
size,
|
111
114
|
deviationLevel,
|
112
|
-
foregroundColor: variant === "custom" ? foregroundColor : undefined,
|
113
|
-
backgroundColor: variant === "custom" ? backgroundColor : undefined,
|
114
115
|
});
|
115
116
|
|
116
117
|
const DeviationLevelIcon = getDeviationLevelIcon({ deviationLevel, size });
|
117
118
|
|
118
119
|
return (
|
119
|
-
<Box
|
120
|
+
<Box
|
121
|
+
css={styles.container}
|
122
|
+
aria-disabled={disabled}
|
123
|
+
ref={ref}
|
124
|
+
{...rest}
|
125
|
+
backgroundColor={disabled ? "surface.disabled" : backgroundColor}
|
126
|
+
>
|
120
127
|
<LineIcon
|
121
128
|
variant={variant}
|
122
129
|
size={size}
|
123
|
-
sx={styles.iconContainer}
|
124
130
|
foregroundColor={foregroundColor}
|
125
131
|
backgroundColor={backgroundColor}
|
126
132
|
customIconVariant={customIconVariant}
|
133
|
+
disabled={disabled}
|
134
|
+
target="travelTag"
|
127
135
|
{...(rest as any)}
|
128
136
|
/>
|
129
|
-
<Box
|
137
|
+
<Box css={styles.textContainer}>
|
130
138
|
{title && (
|
131
|
-
<Box as="span"
|
139
|
+
<Box as="span" css={styles.title}>
|
132
140
|
{title}
|
133
141
|
</Box>
|
134
142
|
)}
|
135
143
|
{title && description && " "}
|
136
144
|
{description && (
|
137
|
-
<Box as="span"
|
145
|
+
<Box as="span" css={styles.description}>
|
138
146
|
{description}
|
139
147
|
</Box>
|
140
148
|
)}
|
141
149
|
</Box>
|
142
|
-
{DeviationLevelIcon &&
|
150
|
+
{DeviationLevelIcon && (
|
151
|
+
<DeviationLevelIcon css={styles.deviationIcon} />
|
152
|
+
)}
|
143
153
|
</Box>
|
144
154
|
);
|
145
155
|
},
|
@@ -157,6 +167,7 @@ const getDeviationLevelIcon = ({
|
|
157
167
|
return size === "lg" ? WarningFill24Icon : WarningFill18Icon;
|
158
168
|
case "info":
|
159
169
|
return size === "lg" ? InformationFill24Icon : InformationFill18Icon;
|
170
|
+
case "none":
|
160
171
|
default:
|
161
172
|
return null;
|
162
173
|
}
|
package/src/link/TextLink.tsx
CHANGED
@@ -1,35 +1,44 @@
|
|
1
|
+
"use client";
|
1
2
|
import {
|
2
3
|
Link as ChakraLink,
|
3
4
|
LinkProps as ChakraLinkProps,
|
4
|
-
|
5
|
+
RecipeVariantProps,
|
5
6
|
} from "@chakra-ui/react";
|
6
7
|
import { LinkOutOutline24Icon } from "@vygruppen/spor-icon-react";
|
7
|
-
import React from "react";
|
8
|
+
import React, { forwardRef, PropsWithChildren } from "react";
|
8
9
|
import { createTexts, useTranslation } from "..";
|
10
|
+
import { linkRecipe } from "../theme/recipes/link";
|
11
|
+
|
12
|
+
type linkVariantProps = RecipeVariantProps<typeof linkRecipe>;
|
13
|
+
|
14
|
+
export type LinkProps = Exclude<ChakraLinkProps, "variant"> &
|
15
|
+
PropsWithChildren<linkVariantProps> & {
|
16
|
+
/** Defaults to primary */
|
17
|
+
variant?: "primary" | "secondary";
|
18
|
+
/** Define if the link shows an icon on the right that indicate it is an external link */
|
19
|
+
external?: boolean;
|
20
|
+
};
|
9
21
|
|
10
|
-
type LinkProps = Omit<ChakraLinkProps, "variant"> & {
|
11
|
-
variant?: "primary" | "secondary";
|
12
|
-
};
|
13
22
|
/** Link to different sites or parts of site
|
14
23
|
*
|
15
24
|
* You can specify the `variant` prop to get different link designs.
|
25
|
+
* * ```tsx
|
26
|
+
* <TextLink href="/url-to-page" variant="primary" size="md">
|
27
|
+
* text that is linked
|
28
|
+
* </TextLink>
|
29
|
+
* ```
|
16
30
|
*/
|
17
|
-
export const TextLink = forwardRef<
|
31
|
+
export const TextLink = forwardRef<HTMLAnchorElement, LinkProps>(
|
18
32
|
({ children, ...props }, ref) => {
|
19
33
|
const { t } = useTranslation();
|
20
|
-
const
|
21
|
-
props.
|
22
|
-
? props.
|
34
|
+
const external =
|
35
|
+
props.external !== undefined
|
36
|
+
? props.external
|
23
37
|
: Boolean(props.href?.match(/^https?:\/\//));
|
24
38
|
return (
|
25
|
-
<ChakraLink {...props} ref={ref}
|
39
|
+
<ChakraLink {...props} ref={ref}>
|
26
40
|
{children}
|
27
|
-
{
|
28
|
-
<LinkOutOutline24Icon
|
29
|
-
marginLeft={0.5}
|
30
|
-
aria-label={t(texts.externalLink)}
|
31
|
-
/>
|
32
|
-
)}
|
41
|
+
{external && <LinkOutOutline24Icon aria-hidden />}
|
33
42
|
</ChakraLink>
|
34
43
|
);
|
35
44
|
},
|
package/src/list/index.tsx
CHANGED
@@ -1,2 +1,24 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { List as ChakraList } from "@chakra-ui/react";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Use this component to display a list of items.
|
5
|
+
*
|
6
|
+
* props:
|
7
|
+
* - "chidren" (default: none) required: The items in the list.
|
8
|
+
* - "as" (default: "ul") not required: Rendrer as an ordered or unordered list.
|
9
|
+
* - "ul": Unordered list
|
10
|
+
* - "ol": Ordered list
|
11
|
+
* - "variant" (default: "marker") not required: The style of the list.
|
12
|
+
* - "marker": A list with markers
|
13
|
+
* - "plain": A plain list without markers
|
14
|
+
*
|
15
|
+
* ```tsx
|
16
|
+
* <List>
|
17
|
+
* <ListItem>Item 1</ListItem>
|
18
|
+
* <ListItem>Item 2</ListItem>
|
19
|
+
* </List>
|
20
|
+
*/
|
21
|
+
|
22
|
+
export const List = ChakraList.Root; // <ul> or <ol> HTMLElement
|
23
|
+
export const ListItem = ChakraList.Item; // <li> HTMLElement
|
24
|
+
export const ListIndicator = ChakraList.Indicator;
|
@@ -1,12 +1,11 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import React, { PropsWithChildren } from "react";
|
2
3
|
import { useHydrated } from "./useHydrated";
|
3
4
|
|
4
|
-
type ClientOnlyProps = {
|
5
|
-
/** A function that renders the client-side only component */
|
6
|
-
children: () => React.ReactNode;
|
5
|
+
type ClientOnlyProps = PropsWithChildren<{
|
7
6
|
/** An optional fallback to render in place on the server */
|
8
7
|
fallback?: React.ReactNode;
|
9
|
-
}
|
8
|
+
}>;
|
10
9
|
|
11
10
|
/**
|
12
11
|
* Render the children only after the JS has loaded client-side. Use an optional
|
@@ -18,12 +17,14 @@ type ClientOnlyProps = {
|
|
18
17
|
* ```tsx
|
19
18
|
* return (
|
20
19
|
* <ClientOnly fallback={<FakeChart />}>
|
21
|
-
*
|
20
|
+
* <Chart />
|
22
21
|
* </ClientOnly>
|
23
22
|
* );
|
24
23
|
* ```
|
25
24
|
*/
|
26
25
|
export const ClientOnly = ({ children, fallback = null }: ClientOnlyProps) => {
|
27
26
|
const isHydrated = useHydrated();
|
28
|
-
|
27
|
+
|
28
|
+
if (!isHydrated) return fallback;
|
29
|
+
return children;
|
29
30
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Box, BoxProps, Center } from "@chakra-ui/react";
|
1
|
+
import { Box, BoxProps, Center, VisuallyHidden } from "@chakra-ui/react";
|
2
2
|
import { inlineLoaderColorData } from "@vygruppen/spor-loader";
|
3
3
|
import React from "react";
|
4
4
|
import { ClientOnly } from "./ClientOnly";
|
@@ -16,12 +16,13 @@ export const ColorInlineLoader = ({
|
|
16
16
|
...props
|
17
17
|
}: ColorInlineLoaderProps) => {
|
18
18
|
return (
|
19
|
-
<Center {...props}>
|
19
|
+
<Center role="status" aria-live="polite" {...props}>
|
20
20
|
<Box width={width} maxWidth={maxWidth}>
|
21
21
|
<ClientOnly>
|
22
|
-
|
22
|
+
<Lottie animationData={inlineLoaderColorData} />
|
23
23
|
</ClientOnly>
|
24
24
|
</Box>
|
25
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
25
26
|
</Center>
|
26
27
|
);
|
27
28
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import { Box, BoxProps, Center, VisuallyHidden } from "@chakra-ui/react";
|
2
3
|
import { spinnerColorData } from "@vygruppen/spor-loader";
|
3
4
|
import React from "react";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
@@ -25,16 +26,16 @@ export const ColorSpinner = ({
|
|
25
26
|
children,
|
26
27
|
width,
|
27
28
|
maxWidth,
|
28
|
-
|
29
29
|
...props
|
30
30
|
}: SpinnerProps) => {
|
31
31
|
return (
|
32
|
-
<Center flexDirection="column" {...props}>
|
32
|
+
<Center flexDirection="column" role="status" aria-live="polite" {...props}>
|
33
33
|
<Box width={width} maxWidth={maxWidth}>
|
34
34
|
<ClientOnly>
|
35
|
-
|
35
|
+
<Lottie animationData={spinnerColorData} />
|
36
36
|
</ClientOnly>
|
37
37
|
</Box>
|
38
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
38
39
|
{children && (
|
39
40
|
<Box marginTop={3} fontWeight="bold">
|
40
41
|
{children}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import { Box, BoxProps, VisuallyHidden } from "@chakra-ui/react";
|
2
3
|
import { contentLoaderData } from "@vygruppen/spor-loader";
|
3
4
|
import React from "react";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
@@ -7,16 +8,17 @@ import Lottie from "./Lottie";
|
|
7
8
|
export type ContentLoaderProps = BoxProps;
|
8
9
|
/**
|
9
10
|
* ContentLoader is a component that renders a loading animation.
|
10
|
-
* It should mostly be used for
|
11
|
+
* It should mostly be used for loading content that is not yet available.
|
11
12
|
*/
|
12
13
|
export const ContentLoader = ({ children, ...props }: ContentLoaderProps) => {
|
13
14
|
return (
|
14
|
-
<Box {...props}>
|
15
|
+
<Box role="status" aria-live="polite" {...props}>
|
15
16
|
<Box maxWidth="140px" marginX="auto">
|
16
17
|
<ClientOnly>
|
17
|
-
|
18
|
+
<Lottie animationData={contentLoaderData} />
|
18
19
|
</ClientOnly>
|
19
20
|
</Box>
|
21
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
20
22
|
{children && (
|
21
23
|
<Box textAlign="center" fontWeight="bold">
|
22
24
|
{children}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import { Box, BoxProps, Center, VisuallyHidden } from "@chakra-ui/react";
|
2
3
|
import { fullScreenLoaderWhiteData } from "@vygruppen/spor-loader";
|
3
4
|
import React from "react";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
@@ -12,12 +13,19 @@ export const DarkFullScreenLoader = ({
|
|
12
13
|
...props
|
13
14
|
}: DarkFullScreenLoaderProps) => {
|
14
15
|
return (
|
15
|
-
<Center
|
16
|
+
<Center
|
17
|
+
height="100%"
|
18
|
+
background="darkTeal"
|
19
|
+
role="status"
|
20
|
+
aria-live="polite"
|
21
|
+
{...props}
|
22
|
+
>
|
16
23
|
<Box width={width} maxWidth={maxWidth}>
|
17
24
|
<ClientOnly>
|
18
|
-
|
25
|
+
<Lottie animationData={fullScreenLoaderWhiteData} />
|
19
26
|
</ClientOnly>
|
20
27
|
</Box>
|
28
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
21
29
|
</Center>
|
22
30
|
);
|
23
31
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import { Box, BoxProps, Center, VisuallyHidden } from "@chakra-ui/react";
|
2
3
|
import { inlineLoaderDarkData } from "@vygruppen/spor-loader";
|
3
4
|
import React from "react";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
@@ -14,12 +15,13 @@ export const DarkInlineLoader = ({
|
|
14
15
|
...props
|
15
16
|
}: DarkInlineLoaderProps) => {
|
16
17
|
return (
|
17
|
-
<Center {...props}>
|
18
|
+
<Center role="status" aria-live="polite" {...props}>
|
18
19
|
<Box width={width} maxWidth={maxWidth}>
|
19
20
|
<ClientOnly>
|
20
|
-
|
21
|
+
<Lottie animationData={inlineLoaderDarkData} />
|
21
22
|
</ClientOnly>
|
22
23
|
</Box>
|
24
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
23
25
|
</Center>
|
24
26
|
);
|
25
27
|
};
|
@@ -1,6 +1,7 @@
|
|
1
|
+
"use client";
|
1
2
|
import { spinnerDarkData, spinnerLightData } from "@vygruppen/spor-loader";
|
2
3
|
import React from "react";
|
3
|
-
import { Box, BoxProps, Center, useColorMode } from "..";
|
4
|
+
import { Box, BoxProps, Center, useColorMode, VisuallyHidden } from "..";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
5
6
|
import Lottie from "./Lottie";
|
6
7
|
|
@@ -29,10 +30,13 @@ export const DarkSpinner = ({
|
|
29
30
|
const { colorMode } = useColorMode();
|
30
31
|
const spinnerData = colorMode === "dark" ? spinnerLightData : spinnerDarkData;
|
31
32
|
return (
|
32
|
-
<Center flexDirection="column" {...props}>
|
33
|
+
<Center flexDirection="column" role="status" aria-live="polite" {...props}>
|
33
34
|
<Box width={width} maxWidth={maxWidth}>
|
34
|
-
<ClientOnly>
|
35
|
+
<ClientOnly>
|
36
|
+
<Lottie animationData={spinnerData} />
|
37
|
+
</ClientOnly>
|
35
38
|
</Box>
|
39
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
36
40
|
{children && (
|
37
41
|
<Box marginTop={3} fontWeight="bold">
|
38
42
|
{children}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
"use client";
|
2
|
+
import { Box, BoxProps, Center, VisuallyHidden } from "@chakra-ui/react";
|
2
3
|
import { fullScreenLoaderBlackData } from "@vygruppen/spor-loader";
|
3
4
|
import React from "react";
|
4
5
|
import { ClientOnly } from "./ClientOnly";
|
@@ -12,12 +13,19 @@ export const LightFullScreenLoader = ({
|
|
12
13
|
...props
|
13
14
|
}: LightFullScreenLoaderProps) => {
|
14
15
|
return (
|
15
|
-
<Center
|
16
|
+
<Center
|
17
|
+
height="100%"
|
18
|
+
background="white"
|
19
|
+
role="status"
|
20
|
+
aria-live="polite"
|
21
|
+
{...props}
|
22
|
+
>
|
16
23
|
<Box width={width} maxWidth={maxWidth}>
|
17
24
|
<ClientOnly>
|
18
|
-
|
25
|
+
<Lottie animationData={fullScreenLoaderBlackData} />
|
19
26
|
</ClientOnly>
|
20
27
|
</Box>
|
28
|
+
<VisuallyHidden>Loading...</VisuallyHidden>
|
21
29
|
</Center>
|
22
30
|
);
|
23
31
|
};
|