@vygruppen/spor-react 12.1.2 → 12.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +31 -12
- package/.turbo/turbo-typegen.log +19 -1
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +189 -243
- package/dist/index.d.ts +189 -243
- package/dist/index.js +2485 -2072
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2376 -1972
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +2 -1
- package/src/accordion/Expandable.tsx +3 -1
- package/src/accordion/helpers.ts +2 -1
- package/src/alert/Alert.tsx +3 -1
- package/src/alert/AlertIcon.tsx +17 -10
- package/src/alert/ExpandableAlert.tsx +3 -2
- package/src/alert/ServiceAlert.tsx +2 -1
- package/src/breadcrumb/Breadcrumb.tsx +9 -8
- package/src/button/Button.tsx +2 -1
- package/src/button/ButtonGroup.tsx +2 -1
- package/src/button/Clipboard.tsx +3 -0
- package/src/button/CloseButton.tsx +8 -4
- package/src/button/FloatingActionButton.tsx +5 -5
- package/src/button/IconButton.tsx +1 -0
- package/src/color-mode/color-mode.tsx +2 -2
- package/src/datepicker/Calendar.tsx +0 -1
- package/src/datepicker/CalendarCell.tsx +5 -5
- package/src/datepicker/CalendarGrid.tsx +3 -2
- package/src/datepicker/CalendarHeader.tsx +1 -4
- package/src/datepicker/CalendarTriggerButton.tsx +3 -4
- package/src/datepicker/DateField.tsx +13 -6
- package/src/datepicker/DatePicker.tsx +2 -1
- package/src/datepicker/DateRangePicker.tsx +1 -1
- package/src/datepicker/DateTimeSegment.tsx +2 -1
- package/src/datepicker/RangeCalendar.tsx +1 -1
- package/src/datepicker/StyledField.tsx +1 -1
- package/src/datepicker/TimeField.tsx +3 -3
- package/src/datepicker/TimePicker.tsx +4 -2
- package/src/datepicker/utils.ts +10 -5
- package/src/dialog/Dialog.tsx +1 -0
- package/src/dialog/Drawer.tsx +28 -26
- package/src/i18n/index.tsx +1 -0
- package/src/input/AttachedInputs.tsx +6 -3
- package/src/input/CardSelect.tsx +3 -1
- package/src/input/Checkbox.tsx +1 -0
- package/src/input/CheckboxGroup.tsx +3 -1
- package/src/input/ChoiceChip.tsx +39 -66
- package/src/input/Combobox.tsx +6 -4
- package/src/input/CountryCodeSelect.tsx +10 -4
- package/src/input/Field.tsx +2 -0
- package/src/input/Input.tsx +2 -3
- package/src/input/InputGroup.tsx +1 -1
- package/src/input/ListBox.tsx +9 -8
- package/src/input/NativeSelect.tsx +1 -2
- package/src/input/NumericStepper.tsx +22 -23
- package/src/input/PasswordInput.tsx +2 -1
- package/src/input/PhoneNumberInput.tsx +6 -2
- package/src/input/Popover.tsx +2 -0
- package/src/input/Radio.tsx +2 -0
- package/src/input/SearchInput.tsx +2 -1
- package/src/input/Select.tsx +8 -2
- package/src/input/Switch.tsx +22 -34
- package/src/input/Textarea.tsx +6 -4
- package/src/input/index.ts +1 -1
- package/src/layout/PressableCard.tsx +5 -2
- package/src/layout/RadioCard.tsx +3 -1
- package/src/layout/Separator.tsx +2 -1
- package/src/layout/StaticCard.tsx +6 -3
- package/src/linjetag/InfoTag.tsx +3 -2
- package/src/linjetag/LineIcon.tsx +5 -4
- package/src/linjetag/TravelTag.tsx +12 -8
- package/src/link/TextLink.tsx +1 -1
- package/src/loader/ColorInlineLoader.tsx +0 -1
- package/src/loader/ColorSpinner.tsx +0 -1
- package/src/loader/ContentLoader.tsx +0 -1
- package/src/loader/DarkFullScreenLoader.tsx +0 -1
- package/src/loader/DarkInlineLoader.tsx +0 -1
- package/src/loader/DarkSpinner.tsx +0 -1
- package/src/loader/LightFullScreenLoader.tsx +0 -1
- package/src/loader/LightInlineLoader.tsx +0 -1
- package/src/loader/LightSpinner.tsx +0 -1
- package/src/loader/Lottie.tsx +1 -2
- package/src/loader/ProgressBar.tsx +1 -2
- package/src/loader/ProgressLoader.tsx +2 -7
- package/src/logo/CargonetLogo.tsx +2 -1
- package/src/logo/VyLogo.tsx +3 -4
- package/src/logo/VyLogoPride.tsx +4 -1
- package/src/media-controller/JumpButton.tsx +2 -1
- package/src/media-controller/PlayPauseButton.tsx +2 -1
- package/src/media-controller/SkipButton.tsx +2 -1
- package/src/nudge/Nudge.tsx +7 -14
- package/src/pagination/Pagination.tsx +5 -0
- package/src/popover/index.tsx +2 -0
- package/src/progress-indicator/ProgressDot.tsx +1 -1
- package/src/progress-indicator/ProgressIndicator.tsx +4 -2
- package/src/provider/SporProvider.tsx +0 -1
- package/src/stepper/Stepper.tsx +1 -1
- package/src/tab/Tabs.tsx +1 -1
- package/src/table/Table.tsx +2 -1
- package/src/theme/slot-recipes/alert-expandable.ts +0 -4
- package/src/theme/slot-recipes/anatomy.ts +10 -0
- package/src/theme/slot-recipes/choice-chip.ts +183 -0
- package/src/theme/slot-recipes/index.ts +2 -0
- package/src/theme/slot-recipes/info-tag.ts +0 -1
- package/src/theme/slot-recipes/popover.ts +0 -1
- package/src/theme/slot-recipes/radio-card.ts +0 -3
- package/src/theme/utils/accent-utils.ts +12 -6
- package/src/theme/utils/bg-utils.ts +6 -3
- package/src/theme/utils/brand-utils.ts +7 -7
- package/src/theme/utils/core-utils.ts +23 -13
- package/src/theme/utils/floating-utils.ts +16 -8
- package/src/theme/utils/ghost-utils.ts +8 -4
- package/src/theme/utils/input-utils.ts +7 -4
- package/src/theme/utils/outline-utils.ts +6 -3
- package/src/theme/utils/surface-utils.ts +8 -4
- package/src/toast/toast.tsx +0 -1
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Heading.tsx +1 -1
- package/src/typography/Text.tsx +1 -1
- package/src/util/slugify.tsx +8 -8
- package/tsconfig.json +1 -0
- package/src/theme/recipes/choice-chip.ts +0 -144
package/src/nudge/Nudge.tsx
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import {
|
3
|
-
PopoverCloseTrigger,
|
4
|
-
usePopover,
|
5
|
-
usePopoverContext,
|
6
|
-
} from "@ark-ui/react";
|
2
|
+
import { PopoverCloseTrigger, usePopoverContext } from "@ark-ui/react";
|
7
3
|
import {
|
8
4
|
Box,
|
9
5
|
BoxProps,
|
@@ -16,7 +12,6 @@ import React, {
|
|
16
12
|
forwardRef,
|
17
13
|
PropsWithChildren,
|
18
14
|
useEffect,
|
19
|
-
useRef,
|
20
15
|
useState,
|
21
16
|
} from "react";
|
22
17
|
|
@@ -56,12 +51,7 @@ export type NudgeProps = {
|
|
56
51
|
} & PopoverRootProps;
|
57
52
|
|
58
53
|
export const Nudge = (props: NudgeProps) => {
|
59
|
-
const {
|
60
|
-
introducedDate,
|
61
|
-
defaultOpen = props.open === undefined ? true : undefined, // defaultOpen defaults to true if open is undefined
|
62
|
-
size = "md",
|
63
|
-
...rest
|
64
|
-
} = props;
|
54
|
+
const { introducedDate, size = "md", ...rest } = props;
|
65
55
|
|
66
56
|
if (isNudgeExpired(introducedDate)) {
|
67
57
|
logExpirationWarning();
|
@@ -77,6 +67,7 @@ export const NudgeTrigger = forwardRef<
|
|
77
67
|
>(({ ...props }, ref) => {
|
78
68
|
return <PopoverTrigger {...props} ref={ref} />;
|
79
69
|
});
|
70
|
+
NudgeTrigger.displayName = "NudgeTrigger";
|
80
71
|
|
81
72
|
export const NudgeContent = forwardRef<HTMLDivElement, PopoverProps>(
|
82
73
|
({ showCloseButton = true, children, ...props }, ref) => {
|
@@ -104,7 +95,7 @@ export const NudgeContent = forwardRef<HTMLDivElement, PopoverProps>(
|
|
104
95
|
const totalSteps = wizardPages.length;
|
105
96
|
const isLastStep = totalSteps === currentStep;
|
106
97
|
|
107
|
-
if (
|
98
|
+
if (wizardPages.length === 0) {
|
108
99
|
return (
|
109
100
|
<PopoverContent showCloseButton={showCloseButton} {...props} ref={ref}>
|
110
101
|
{children}
|
@@ -133,8 +124,9 @@ export const NudgeContent = forwardRef<HTMLDivElement, PopoverProps>(
|
|
133
124
|
);
|
134
125
|
},
|
135
126
|
);
|
127
|
+
NudgeContent.displayName = "NudgeContent";
|
136
128
|
|
137
|
-
export const NudgeActions = ({
|
129
|
+
export const NudgeActions = ({ ...props }: BoxProps) => {
|
138
130
|
const { colorMode } = useColorMode();
|
139
131
|
|
140
132
|
return (
|
@@ -216,3 +208,4 @@ export const NudgeCloseTrigger = forwardRef<
|
|
216
208
|
</ChakraPopover.CloseTrigger>
|
217
209
|
);
|
218
210
|
});
|
211
|
+
NudgeCloseTrigger.displayName = "NudgeCloseTrigger";
|
@@ -60,6 +60,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationRootProps>(
|
|
60
60
|
);
|
61
61
|
},
|
62
62
|
);
|
63
|
+
Pagination.displayName = "Pagination";
|
63
64
|
|
64
65
|
export const PaginationEllipsis = React.forwardRef<
|
65
66
|
HTMLDivElement,
|
@@ -73,6 +74,7 @@ export const PaginationEllipsis = React.forwardRef<
|
|
73
74
|
</ListItem>
|
74
75
|
);
|
75
76
|
});
|
77
|
+
PaginationEllipsis.displayName = "PaginationEllipsis";
|
76
78
|
|
77
79
|
export const PaginationItem = React.forwardRef<
|
78
80
|
HTMLButtonElement,
|
@@ -115,6 +117,7 @@ export const PaginationItem = React.forwardRef<
|
|
115
117
|
</ListItem>
|
116
118
|
);
|
117
119
|
});
|
120
|
+
PaginationItem.displayName = "PaginationItem";
|
118
121
|
|
119
122
|
export const PaginationPrevTrigger = React.forwardRef<
|
120
123
|
HTMLButtonElement,
|
@@ -163,6 +166,7 @@ export const PaginationPrevTrigger = React.forwardRef<
|
|
163
166
|
</ListItem>
|
164
167
|
);
|
165
168
|
});
|
169
|
+
PaginationPrevTrigger.displayName = "PaginationPrevTrigger";
|
166
170
|
|
167
171
|
export const PaginationNextTrigger = React.forwardRef<
|
168
172
|
HTMLButtonElement,
|
@@ -208,6 +212,7 @@ export const PaginationNextTrigger = React.forwardRef<
|
|
208
212
|
</ListItem>
|
209
213
|
);
|
210
214
|
});
|
215
|
+
PaginationNextTrigger.displayName = "PaginationNextTrigger";
|
211
216
|
|
212
217
|
export const PaginationItems = (
|
213
218
|
props: React.HTMLAttributes<HTMLElement> & {},
|
package/src/popover/index.tsx
CHANGED
@@ -24,6 +24,7 @@ export const PopoverTrigger = forwardRef<
|
|
24
24
|
</ChakraPopover.Trigger>
|
25
25
|
);
|
26
26
|
});
|
27
|
+
PopoverTrigger.displayName = "PopoverTrigger";
|
27
28
|
|
28
29
|
export type PopoverProps = ChakraPopover.ContentProps &
|
29
30
|
React.RefAttributes<HTMLDivElement> & {
|
@@ -66,3 +67,4 @@ export const PopoverContent = forwardRef<HTMLDivElement, PopoverProps>(
|
|
66
67
|
);
|
67
68
|
},
|
68
69
|
);
|
70
|
+
PopoverContent.displayName = "PopoverContent";
|
@@ -35,7 +35,7 @@ export type ProgressIndicatorProps = BoxProps &
|
|
35
35
|
export const ProgressIndicator = forwardRef<
|
36
36
|
HTMLDivElement,
|
37
37
|
ProgressIndicatorProps
|
38
|
-
>(({ numberOfSteps, activeStep
|
38
|
+
>(({ numberOfSteps, activeStep }) => {
|
39
39
|
const { t } = useTranslation();
|
40
40
|
const recipe = useSlotRecipe({
|
41
41
|
key: "progressIndicator",
|
@@ -56,7 +56,7 @@ export const ProgressIndicator = forwardRef<
|
|
56
56
|
{Array.from({ length: numberOfSteps }, (_, i) => (
|
57
57
|
<ProgressDot
|
58
58
|
key={i}
|
59
|
-
aria-
|
59
|
+
aria-valuenow={i + 1}
|
60
60
|
isActive={activeStep === i + 1}
|
61
61
|
/>
|
62
62
|
))}
|
@@ -64,6 +64,8 @@ export const ProgressIndicator = forwardRef<
|
|
64
64
|
</Box>
|
65
65
|
);
|
66
66
|
});
|
67
|
+
ProgressIndicator.displayName = "ProgressIndicator";
|
68
|
+
|
67
69
|
const texts = createTexts({
|
68
70
|
stepsOf: (activeStep, numberOfSteps) => ({
|
69
71
|
nb: `Steg ${activeStep} av ${numberOfSteps}`,
|
package/src/stepper/Stepper.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { Flex, RecipeVariantProps, useSlotRecipe } from "@chakra-ui/react";
|
3
3
|
import { ArrowLeftFill24Icon } from "@vygruppen/spor-icon-react";
|
4
|
-
import
|
4
|
+
import { forwardRef, PropsWithChildren } from "react";
|
5
5
|
|
6
6
|
import { Box, createTexts, IconButton, Text, useTranslation } from "..";
|
7
7
|
import { stepperSlotRecipe } from "../theme/slot-recipes/stepper";
|
package/src/tab/Tabs.tsx
CHANGED
@@ -4,7 +4,6 @@ import {
|
|
4
4
|
Tabs as ChakraTabs,
|
5
5
|
TabsRootProps as ChakraTabsRootProps,
|
6
6
|
} from "@chakra-ui/react";
|
7
|
-
import * as React from "react";
|
8
7
|
import { forwardRef, PropsWithChildren } from "react";
|
9
8
|
|
10
9
|
import { tabsSlotRecipe } from "../theme/slot-recipes/tabs";
|
@@ -63,6 +62,7 @@ export const Tabs = forwardRef<HTMLDivElement, TabsProps>((props, ref) => {
|
|
63
62
|
const { variant = "core", size = "sm" } = props;
|
64
63
|
return <ChakraTabs.Root {...props} ref={ref} variant={variant} size={size} />;
|
65
64
|
});
|
65
|
+
Tabs.displayName = "Tabs";
|
66
66
|
|
67
67
|
export const TabsList = ChakraTabs.List;
|
68
68
|
export const TabsTrigger = ChakraTabs.Trigger;
|
package/src/table/Table.tsx
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
TableRootProps as ChakraTableProps,
|
7
7
|
useSlotRecipe,
|
8
8
|
} from "@chakra-ui/react";
|
9
|
-
import
|
9
|
+
import { forwardRef, PropsWithChildren } from "react";
|
10
10
|
|
11
11
|
import { tableSlotRecipe } from "../theme/slot-recipes/table";
|
12
12
|
|
@@ -52,6 +52,7 @@ export const Table = forwardRef<HTMLTableElement, TableProps>((props, ref) => {
|
|
52
52
|
</Box>
|
53
53
|
);
|
54
54
|
});
|
55
|
+
Table.displayName = "Table";
|
55
56
|
|
56
57
|
function getStyleProps(props: TableProps) {
|
57
58
|
return props.variant === "core"
|
@@ -1,9 +1,5 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
|
3
|
-
import tokens from "@vygruppen/spor-design-tokens";
|
4
|
-
|
5
|
-
import { alertSlotRecipe } from "./alert";
|
6
|
-
|
7
3
|
import { alertExpandableAnatomy } from "./anatomy";
|
8
4
|
|
9
5
|
export const alertExpandableSlotRecipe = defineSlotRecipe({
|
@@ -267,3 +267,13 @@ export const datepickerAnatomy = createAnatomy("datepicker").parts(
|
|
267
267
|
"box",
|
268
268
|
"rangeCalendarPopover",
|
269
269
|
);
|
270
|
+
|
271
|
+
export const checkboxCardAnatomy = createAnatomy("checkbox-card", [
|
272
|
+
"root",
|
273
|
+
"control",
|
274
|
+
"label",
|
275
|
+
"description",
|
276
|
+
"addon",
|
277
|
+
"indicator",
|
278
|
+
"content",
|
279
|
+
]);
|
@@ -0,0 +1,183 @@
|
|
1
|
+
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
|
+
|
3
|
+
import { checkboxCardAnatomy } from "./anatomy";
|
4
|
+
|
5
|
+
export const choiceChipSlotRecipe = defineSlotRecipe({
|
6
|
+
slots: checkboxCardAnatomy.keys(),
|
7
|
+
className: "chakra-checkbox-card",
|
8
|
+
base: {
|
9
|
+
root: {
|
10
|
+
display: "inline-flex",
|
11
|
+
alignItems: "center",
|
12
|
+
boxAlign: "center",
|
13
|
+
fontSize: "xs",
|
14
|
+
cursor: "pointer",
|
15
|
+
transitionProperty: "all",
|
16
|
+
borderRadius: "xl",
|
17
|
+
transitionDuration: "fast",
|
18
|
+
paddingInlineStart: "2",
|
19
|
+
paddingInlineEnd: "2",
|
20
|
+
|
21
|
+
outline: "1px solid",
|
22
|
+
outlineColor: "base.outline",
|
23
|
+
_checked: {
|
24
|
+
backgroundColor: "brand.surface",
|
25
|
+
borderRadius: "sm",
|
26
|
+
outline: "none",
|
27
|
+
color: "brand.text",
|
28
|
+
_hover: {
|
29
|
+
backgroundColor: "brand.surface.hover",
|
30
|
+
_active: {
|
31
|
+
backgroundColor: "brand.surface.active",
|
32
|
+
},
|
33
|
+
},
|
34
|
+
},
|
35
|
+
|
36
|
+
_focusVisible: {
|
37
|
+
outline: "2px solid",
|
38
|
+
outlineColor: "outline.focus",
|
39
|
+
outlineOffset: "1px",
|
40
|
+
},
|
41
|
+
|
42
|
+
_disabled: {
|
43
|
+
pointerEvents: "none",
|
44
|
+
boxShadow: "none",
|
45
|
+
backgroundColor: "surface.disabled",
|
46
|
+
color: "text.disabled",
|
47
|
+
outline: "none",
|
48
|
+
|
49
|
+
_hover: {
|
50
|
+
backgroundColor: "core.surface.disabled",
|
51
|
+
boxShadow: "none",
|
52
|
+
color: "core.text.disabled",
|
53
|
+
},
|
54
|
+
_checked: {
|
55
|
+
cursor: "not-allowed",
|
56
|
+
boxShadow: "none",
|
57
|
+
color: "core.text.disabled",
|
58
|
+
backgroundColor: "core.surface.disabled",
|
59
|
+
_hover: {
|
60
|
+
backgroundColor: "core.surface.disabled",
|
61
|
+
boxShadow: "none",
|
62
|
+
color: "core.text.disabled",
|
63
|
+
},
|
64
|
+
},
|
65
|
+
},
|
66
|
+
},
|
67
|
+
|
68
|
+
label: {
|
69
|
+
display: "flex",
|
70
|
+
alignItems: "center",
|
71
|
+
|
72
|
+
fontSize: "xs",
|
73
|
+
},
|
74
|
+
},
|
75
|
+
|
76
|
+
variants: {
|
77
|
+
size: {
|
78
|
+
xs: {
|
79
|
+
root: {
|
80
|
+
_checked: {
|
81
|
+
borderRadius: "0.563rem",
|
82
|
+
},
|
83
|
+
height: 5,
|
84
|
+
paddingX: 1.5,
|
85
|
+
},
|
86
|
+
},
|
87
|
+
sm: {
|
88
|
+
root: {
|
89
|
+
_checked: {
|
90
|
+
borderRadius: "sm",
|
91
|
+
},
|
92
|
+
height: 6,
|
93
|
+
paddingX: 2,
|
94
|
+
},
|
95
|
+
},
|
96
|
+
md: {
|
97
|
+
root: {
|
98
|
+
_checked: {
|
99
|
+
borderRadius: "sm",
|
100
|
+
},
|
101
|
+
height: 7,
|
102
|
+
paddingX: 2,
|
103
|
+
},
|
104
|
+
},
|
105
|
+
lg: {
|
106
|
+
root: {
|
107
|
+
_checked: {
|
108
|
+
borderRadius: "md",
|
109
|
+
},
|
110
|
+
height: 8,
|
111
|
+
paddingX: 3,
|
112
|
+
},
|
113
|
+
},
|
114
|
+
},
|
115
|
+
|
116
|
+
variant: {
|
117
|
+
core: {
|
118
|
+
root: {
|
119
|
+
color: "core.text",
|
120
|
+
outlineColor: "core.outline",
|
121
|
+
|
122
|
+
_hover: {
|
123
|
+
outline: "2px solid",
|
124
|
+
outlineColor: "core.outline.hover",
|
125
|
+
|
126
|
+
_active: {
|
127
|
+
outline: "1px solid",
|
128
|
+
outlineColor: "core.outline",
|
129
|
+
backgroundColor: "core.surface.active",
|
130
|
+
},
|
131
|
+
},
|
132
|
+
},
|
133
|
+
},
|
134
|
+
accent: {
|
135
|
+
root: {
|
136
|
+
backgroundColor: "accent.surface",
|
137
|
+
color: "accent.text",
|
138
|
+
outline: "none",
|
139
|
+
|
140
|
+
_hover: {
|
141
|
+
backgroundColor: "accent.surface.hover",
|
142
|
+
|
143
|
+
_active: {
|
144
|
+
backgroundColor: "accent.surface.active",
|
145
|
+
},
|
146
|
+
},
|
147
|
+
},
|
148
|
+
},
|
149
|
+
floating: {
|
150
|
+
root: {
|
151
|
+
backgroundColor: "floating.surface",
|
152
|
+
outline: "1px solid",
|
153
|
+
outlineColor: "floating.outline",
|
154
|
+
color: "floating.text",
|
155
|
+
|
156
|
+
boxShadow: "sm",
|
157
|
+
_hover: {
|
158
|
+
backgroundColor: "floating.surface.hover",
|
159
|
+
outline: "1px solid",
|
160
|
+
outlineColor: "floating.outline.hover",
|
161
|
+
|
162
|
+
_active: {
|
163
|
+
backgroundColor: "floating.surface.active",
|
164
|
+
outline: "1px solid",
|
165
|
+
outlineColor: "floating.outline",
|
166
|
+
},
|
167
|
+
},
|
168
|
+
},
|
169
|
+
},
|
170
|
+
},
|
171
|
+
chipType: {
|
172
|
+
icon: {},
|
173
|
+
choice: {},
|
174
|
+
filter: {},
|
175
|
+
},
|
176
|
+
},
|
177
|
+
|
178
|
+
defaultVariants: {
|
179
|
+
size: "md",
|
180
|
+
variant: "core",
|
181
|
+
chipType: "choice",
|
182
|
+
},
|
183
|
+
});
|
@@ -4,6 +4,7 @@ import { alertExpandableSlotRecipe } from "./alert-expandable";
|
|
4
4
|
import { alertServiceSlotRecipe } from "./alert-service";
|
5
5
|
import { breadcrumbSlotRecipe } from "./breadcrumb";
|
6
6
|
import { checkboxSlotRecipe } from "./checkbox";
|
7
|
+
import { choiceChipSlotRecipe } from "./choice-chip";
|
7
8
|
import { datePickerSlotRecipe } from "./datepicker";
|
8
9
|
import { dialogSlotRecipe } from "./dialog";
|
9
10
|
import { drawerSlotRecipe } from "./drawer";
|
@@ -62,4 +63,5 @@ export const slotRecipes = {
|
|
62
63
|
tabs: tabsSlotRecipe,
|
63
64
|
travelTag: travelTagSlotRecipe,
|
64
65
|
toast: toastSlotRecipe,
|
66
|
+
checkboxCard: choiceChipSlotRecipe,
|
65
67
|
};
|
@@ -1,9 +1,6 @@
|
|
1
1
|
import { defineSlotRecipe } from "@chakra-ui/react";
|
2
2
|
import tokens from "@vygruppen/spor-design-tokens";
|
3
3
|
|
4
|
-
import { coreBackground, coreBorder, coreText } from "../utils/core-utils";
|
5
|
-
import { floatingBackground, floatingBorder } from "../utils/floating-utils";
|
6
|
-
import { outlineBorder } from "../utils/outline-utils";
|
7
4
|
import { radioCardAnatomy } from "./anatomy";
|
8
5
|
|
9
6
|
export const radioCardSlotRecipe = defineSlotRecipe({
|
@@ -8,20 +8,24 @@ type AccentBackgroundState = Subset<
|
|
8
8
|
|
9
9
|
export function accentBackground(state: AccentBackgroundState) {
|
10
10
|
switch (state) {
|
11
|
-
case "selected":
|
11
|
+
case "selected": {
|
12
12
|
return brandBackground("default");
|
13
|
-
|
13
|
+
}
|
14
|
+
case "active": {
|
14
15
|
return {
|
15
16
|
backgroundColor: "accent.surface.active",
|
16
17
|
};
|
17
|
-
|
18
|
+
}
|
19
|
+
case "hover": {
|
18
20
|
return {
|
19
21
|
backgroundColor: "accent.surface.hover",
|
20
22
|
};
|
21
|
-
|
23
|
+
}
|
24
|
+
default: {
|
22
25
|
return {
|
23
26
|
backgroundColor: "accent.surface",
|
24
27
|
};
|
28
|
+
}
|
25
29
|
}
|
26
30
|
}
|
27
31
|
|
@@ -29,13 +33,15 @@ type AccentTextState = Subset<State, "default" | "selected">;
|
|
29
33
|
|
30
34
|
export function accentText(state: AccentTextState) {
|
31
35
|
switch (state) {
|
32
|
-
case "selected":
|
36
|
+
case "selected": {
|
33
37
|
return {
|
34
38
|
color: "brand.text",
|
35
39
|
};
|
36
|
-
|
40
|
+
}
|
41
|
+
default: {
|
37
42
|
return {
|
38
43
|
color: "accent.text",
|
39
44
|
};
|
45
|
+
}
|
40
46
|
}
|
41
47
|
}
|
@@ -1,17 +1,20 @@
|
|
1
1
|
type Bg = "default" | "secondary" | "tertiary";
|
2
2
|
export const bg = (bg: Bg) => {
|
3
3
|
switch (bg) {
|
4
|
-
case "default":
|
4
|
+
case "default": {
|
5
5
|
return {
|
6
6
|
backgroundColor: "bg",
|
7
7
|
};
|
8
|
-
|
8
|
+
}
|
9
|
+
case "secondary": {
|
9
10
|
return {
|
10
11
|
backgroundColor: "bg.secondary",
|
11
12
|
};
|
12
|
-
|
13
|
+
}
|
14
|
+
case "tertiary": {
|
13
15
|
return {
|
14
16
|
backgroundColor: "bg.tertiary",
|
15
17
|
};
|
18
|
+
}
|
16
19
|
}
|
17
20
|
};
|
@@ -4,25 +4,25 @@ type BrandBackgroundState = Subset<State, "default" | "hover" | "active">;
|
|
4
4
|
|
5
5
|
export function brandBackground(state: BrandBackgroundState) {
|
6
6
|
switch (state) {
|
7
|
-
case "active":
|
7
|
+
case "active": {
|
8
8
|
return {
|
9
9
|
backgroundColor: "brand.surface.active",
|
10
10
|
};
|
11
|
-
|
11
|
+
}
|
12
|
+
case "hover": {
|
12
13
|
return {
|
13
14
|
backgroundColor: "brand.surface.hover",
|
14
15
|
};
|
15
|
-
|
16
|
-
default:
|
16
|
+
}
|
17
|
+
default: {
|
17
18
|
return {
|
18
19
|
backgroundColor: "brand.surface",
|
19
20
|
};
|
21
|
+
}
|
20
22
|
}
|
21
23
|
}
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
export function brandText(state: BrandTextState) {
|
25
|
+
export function brandText() {
|
26
26
|
return {
|
27
27
|
color: "brand.text",
|
28
28
|
};
|
@@ -8,16 +8,20 @@ type coreBackgroundState = Subset<
|
|
8
8
|
>;
|
9
9
|
export function coreBackground(state: coreBackgroundState) {
|
10
10
|
switch (state) {
|
11
|
-
case "active":
|
11
|
+
case "active": {
|
12
12
|
return brandBackground("active");
|
13
|
-
|
13
|
+
}
|
14
|
+
case "selected": {
|
14
15
|
return brandBackground("default");
|
16
|
+
}
|
15
17
|
|
16
|
-
case "disabled":
|
18
|
+
case "disabled": {
|
17
19
|
return surface("disabled");
|
18
|
-
|
19
|
-
|
20
|
+
}
|
21
|
+
|
22
|
+
default: {
|
20
23
|
return { backgroundColor: "transparent" };
|
24
|
+
}
|
21
25
|
}
|
22
26
|
}
|
23
27
|
|
@@ -28,11 +32,12 @@ type BorderState = Subset<
|
|
28
32
|
|
29
33
|
export function coreBorder(state: BorderState) {
|
30
34
|
switch (state) {
|
31
|
-
case "hover":
|
35
|
+
case "hover": {
|
32
36
|
return {
|
33
37
|
outline: "2px solid",
|
34
38
|
outlineColor: "core.outline",
|
35
39
|
};
|
40
|
+
}
|
36
41
|
|
37
42
|
case "disabled": {
|
38
43
|
return {
|
@@ -52,12 +57,12 @@ export function coreBorder(state: BorderState) {
|
|
52
57
|
outlineColor: "outline.error",
|
53
58
|
};
|
54
59
|
}
|
55
|
-
|
56
|
-
default:
|
60
|
+
default: {
|
57
61
|
return {
|
58
62
|
outline: "1px solid",
|
59
63
|
outlineColor: "core.outline",
|
60
64
|
};
|
65
|
+
}
|
61
66
|
}
|
62
67
|
}
|
63
68
|
|
@@ -67,25 +72,30 @@ type coreTextState = Subset<
|
|
67
72
|
>;
|
68
73
|
export function coreText(state: coreTextState) {
|
69
74
|
switch (state) {
|
70
|
-
case "selected":
|
75
|
+
case "selected": {
|
71
76
|
return {
|
72
77
|
color: "brand.text",
|
73
78
|
};
|
74
|
-
|
79
|
+
}
|
80
|
+
case "active": {
|
75
81
|
return {
|
76
82
|
color: "brand.text",
|
77
83
|
};
|
78
|
-
|
84
|
+
}
|
85
|
+
case "highlight": {
|
79
86
|
return {
|
80
87
|
color: "text.highlight",
|
81
88
|
};
|
82
|
-
|
89
|
+
}
|
90
|
+
case "disabled": {
|
83
91
|
return {
|
84
92
|
color: "text.disabled",
|
85
93
|
};
|
86
|
-
|
94
|
+
}
|
95
|
+
default: {
|
87
96
|
return {
|
88
97
|
color: "core.text",
|
89
98
|
};
|
99
|
+
}
|
90
100
|
}
|
91
101
|
}
|