@vygruppen/spor-react 12.1.1 → 12.2.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.
Files changed (119) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/.turbo/turbo-typegen.log +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +151 -190
  5. package/dist/index.d.ts +151 -190
  6. package/dist/index.js +2327 -1915
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +2214 -1811
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +3 -3
  11. package/src/accordion/Accordion.tsx +2 -1
  12. package/src/accordion/Expandable.tsx +3 -1
  13. package/src/accordion/helpers.ts +2 -1
  14. package/src/alert/Alert.tsx +3 -1
  15. package/src/alert/AlertIcon.tsx +17 -10
  16. package/src/alert/ExpandableAlert.tsx +3 -2
  17. package/src/alert/ServiceAlert.tsx +2 -1
  18. package/src/breadcrumb/Breadcrumb.tsx +9 -8
  19. package/src/button/Button.tsx +65 -52
  20. package/src/button/ButtonGroup.tsx +2 -1
  21. package/src/button/Clipboard.tsx +3 -0
  22. package/src/button/CloseButton.tsx +8 -4
  23. package/src/button/FloatingActionButton.tsx +5 -5
  24. package/src/button/IconButton.tsx +1 -0
  25. package/src/color-mode/color-mode.tsx +2 -2
  26. package/src/datepicker/Calendar.tsx +0 -1
  27. package/src/datepicker/CalendarCell.tsx +5 -5
  28. package/src/datepicker/CalendarGrid.tsx +3 -2
  29. package/src/datepicker/CalendarHeader.tsx +1 -4
  30. package/src/datepicker/CalendarTriggerButton.tsx +3 -4
  31. package/src/datepicker/DateField.tsx +13 -6
  32. package/src/datepicker/DatePicker.tsx +2 -1
  33. package/src/datepicker/DateRangePicker.tsx +1 -1
  34. package/src/datepicker/DateTimeSegment.tsx +2 -1
  35. package/src/datepicker/RangeCalendar.tsx +1 -1
  36. package/src/datepicker/StyledField.tsx +1 -1
  37. package/src/datepicker/TimeField.tsx +3 -3
  38. package/src/datepicker/TimePicker.tsx +4 -2
  39. package/src/datepicker/utils.ts +10 -5
  40. package/src/dialog/Dialog.tsx +1 -0
  41. package/src/dialog/Drawer.tsx +28 -26
  42. package/src/i18n/index.tsx +1 -0
  43. package/src/input/AttachedInputs.tsx +6 -3
  44. package/src/input/CardSelect.tsx +3 -1
  45. package/src/input/Checkbox.tsx +1 -0
  46. package/src/input/CheckboxGroup.tsx +3 -1
  47. package/src/input/ChoiceChip.tsx +1 -1
  48. package/src/input/Combobox.tsx +6 -4
  49. package/src/input/CountryCodeSelect.tsx +10 -4
  50. package/src/input/Field.tsx +2 -0
  51. package/src/input/Input.tsx +2 -3
  52. package/src/input/InputGroup.tsx +1 -1
  53. package/src/input/ListBox.tsx +9 -8
  54. package/src/input/NativeSelect.tsx +1 -2
  55. package/src/input/NumericStepper.tsx +22 -23
  56. package/src/input/PasswordInput.tsx +2 -1
  57. package/src/input/PhoneNumberInput.tsx +6 -2
  58. package/src/input/Popover.tsx +2 -0
  59. package/src/input/Radio.tsx +2 -0
  60. package/src/input/SearchInput.tsx +2 -1
  61. package/src/input/Select.tsx +8 -2
  62. package/src/input/Switch.tsx +22 -34
  63. package/src/input/Textarea.tsx +6 -4
  64. package/src/input/index.ts +1 -1
  65. package/src/layout/PressableCard.tsx +5 -2
  66. package/src/layout/RadioCard.tsx +3 -1
  67. package/src/layout/Separator.tsx +2 -1
  68. package/src/layout/StaticCard.tsx +6 -3
  69. package/src/linjetag/InfoTag.tsx +3 -2
  70. package/src/linjetag/LineIcon.tsx +5 -4
  71. package/src/linjetag/TravelTag.tsx +12 -8
  72. package/src/link/TextLink.tsx +44 -9
  73. package/src/loader/ColorInlineLoader.tsx +0 -1
  74. package/src/loader/ColorSpinner.tsx +0 -1
  75. package/src/loader/ContentLoader.tsx +0 -1
  76. package/src/loader/DarkFullScreenLoader.tsx +0 -1
  77. package/src/loader/DarkInlineLoader.tsx +0 -1
  78. package/src/loader/DarkSpinner.tsx +0 -1
  79. package/src/loader/LightFullScreenLoader.tsx +0 -1
  80. package/src/loader/LightInlineLoader.tsx +0 -1
  81. package/src/loader/LightSpinner.tsx +0 -1
  82. package/src/loader/Lottie.tsx +1 -2
  83. package/src/loader/ProgressBar.tsx +1 -2
  84. package/src/loader/ProgressLoader.tsx +2 -7
  85. package/src/logo/CargonetLogo.tsx +2 -1
  86. package/src/logo/VyLogo.tsx +3 -4
  87. package/src/logo/VyLogoPride.tsx +4 -1
  88. package/src/media-controller/JumpButton.tsx +2 -1
  89. package/src/media-controller/PlayPauseButton.tsx +2 -1
  90. package/src/media-controller/SkipButton.tsx +2 -1
  91. package/src/nudge/Nudge.tsx +7 -14
  92. package/src/pagination/Pagination.tsx +5 -0
  93. package/src/popover/index.tsx +2 -0
  94. package/src/progress-indicator/ProgressDot.tsx +1 -1
  95. package/src/progress-indicator/ProgressIndicator.tsx +4 -2
  96. package/src/provider/SporProvider.tsx +0 -1
  97. package/src/stepper/Stepper.tsx +1 -1
  98. package/src/tab/Tabs.tsx +1 -1
  99. package/src/table/Table.tsx +2 -1
  100. package/src/theme/recipes/button.ts +5 -0
  101. package/src/theme/slot-recipes/alert-expandable.ts +0 -4
  102. package/src/theme/slot-recipes/info-tag.ts +0 -1
  103. package/src/theme/slot-recipes/popover.ts +0 -1
  104. package/src/theme/slot-recipes/radio-card.ts +0 -3
  105. package/src/theme/utils/accent-utils.ts +12 -6
  106. package/src/theme/utils/bg-utils.ts +6 -3
  107. package/src/theme/utils/brand-utils.ts +7 -7
  108. package/src/theme/utils/core-utils.ts +23 -13
  109. package/src/theme/utils/floating-utils.ts +16 -8
  110. package/src/theme/utils/ghost-utils.ts +8 -4
  111. package/src/theme/utils/input-utils.ts +7 -4
  112. package/src/theme/utils/outline-utils.ts +6 -3
  113. package/src/theme/utils/surface-utils.ts +8 -4
  114. package/src/toast/toast.tsx +0 -1
  115. package/src/typography/Badge.tsx +8 -5
  116. package/src/typography/Heading.tsx +1 -1
  117. package/src/typography/Text.tsx +1 -1
  118. package/src/util/slugify.tsx +8 -8
  119. package/tsconfig.json +1 -0
@@ -1,5 +1,5 @@
1
1
  import { BoxProps } from "@chakra-ui/react";
2
- import React, { forwardRef, useId } from "react";
2
+ import { forwardRef, useId } from "react";
3
3
 
4
4
  import { SvgBox } from "./VyLogo";
5
5
 
@@ -21,7 +21,9 @@ export const VyLogoPride = forwardRef<SVGSVGElement, VyLogoPrideProps>(
21
21
 
22
22
  const id = useId();
23
23
  return (
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  <SvgBox ref={ref} viewBox="0 0 107 54" {...(props as any)}>
26
+ {/* Find a way to not use any */}
25
27
  <title>Vy logo pride</title>
26
28
  <svg
27
29
  width="108"
@@ -161,3 +163,4 @@ export const VyLogoPride = forwardRef<SVGSVGElement, VyLogoPrideProps>(
161
163
  );
162
164
  },
163
165
  );
166
+ VyLogoPride.displayName = "VyLogoPride";
@@ -9,7 +9,7 @@ import {
9
9
  Backward15MediaControllerFill30Icon,
10
10
  Forward15MediaControllerFill30Icon,
11
11
  } from "@vygruppen/spor-icon-react";
12
- import React, { forwardRef, PropsWithChildren } from "react";
12
+ import { forwardRef, PropsWithChildren } from "react";
13
13
 
14
14
  import { createTexts, useTranslation } from "..";
15
15
  import { mediaControllerSlotRecipe } from "../theme/slot-recipes/media-controller-button";
@@ -66,6 +66,7 @@ export const JumpButton = forwardRef<HTMLButtonElement, JumpButtonProps>(
66
66
  );
67
67
  },
68
68
  );
69
+ JumpButton.displayName = "JumpButton";
69
70
 
70
71
  const texts = createTexts({
71
72
  forward: {
@@ -4,7 +4,7 @@ import {
4
4
  PauseMediaControllerFill24Icon,
5
5
  PlayMediaControllerFill24Icon,
6
6
  } from "@vygruppen/spor-icon-react";
7
- import React, { forwardRef, PropsWithChildren } from "react";
7
+ import { forwardRef, PropsWithChildren } from "react";
8
8
 
9
9
  import { createTexts, MediaControllerVariantProps, useTranslation } from "..";
10
10
 
@@ -56,6 +56,7 @@ export const PlayPauseButton = forwardRef<
56
56
  </Center>
57
57
  );
58
58
  });
59
+ PlayPauseButton.displayName = "PlayPauseButton";
59
60
 
60
61
  const texts = createTexts({
61
62
  pause: {
@@ -4,7 +4,7 @@ import {
4
4
  NextMediaControllerFill30Icon,
5
5
  PreviousMediaControllerFill30Icon,
6
6
  } from "@vygruppen/spor-icon-react";
7
- import React, { forwardRef, PropsWithChildren } from "react";
7
+ import { forwardRef, PropsWithChildren } from "react";
8
8
 
9
9
  import { createTexts, MediaControllerVariantProps, useTranslation } from "..";
10
10
 
@@ -54,6 +54,7 @@ export const SkipButton = forwardRef<HTMLButtonElement, SkipButtonProps>(
54
54
  );
55
55
  },
56
56
  );
57
+ SkipButton.displayName = "SkipButton";
57
58
 
58
59
  const texts = createTexts({
59
60
  next: {
@@ -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 (!wizardPages.length) {
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 = ({ className, ...props }: BoxProps) => {
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> & {},
@@ -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";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { chakra, useSlotRecipe } from "@chakra-ui/react";
3
- import React, { PropsWithChildren } from "react";
3
+ import { PropsWithChildren } from "react";
4
4
 
5
5
  import { ProgressIndicatorVariantProps } from "./ProgressIndicator";
6
6
 
@@ -35,7 +35,7 @@ export type ProgressIndicatorProps = BoxProps &
35
35
  export const ProgressIndicator = forwardRef<
36
36
  HTMLDivElement,
37
37
  ProgressIndicatorProps
38
- >(({ numberOfSteps, activeStep, colorPalette = "brand" }) => {
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-value={i + 1}
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}`,
@@ -5,7 +5,6 @@ import {
5
5
  SystemContext,
6
6
  } from "@chakra-ui/react";
7
7
  import { Global } from "@emotion/react";
8
- import React from "react";
9
8
 
10
9
  import { Language, LanguageProvider, system } from "..";
11
10
  import { ColorModeProvider } from "../color-mode";
@@ -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 React, { forwardRef, PropsWithChildren } from "react";
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;
@@ -6,7 +6,7 @@ import {
6
6
  TableRootProps as ChakraTableProps,
7
7
  useSlotRecipe,
8
8
  } from "@chakra-ui/react";
9
- import React, { forwardRef, PropsWithChildren } from "react";
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"
@@ -14,6 +14,7 @@ export const buttonRecipe = defineRecipe({
14
14
  transitionDuration: "normal",
15
15
  cursor: "pointer",
16
16
  textWrap: "wrap",
17
+ width: "fit-content",
17
18
  paddingX: 3,
18
19
  paddingY: 1,
19
20
  _disabled: {
@@ -121,4 +122,8 @@ export const buttonRecipe = defineRecipe({
121
122
  },
122
123
  },
123
124
  },
125
+ defaultVariants: {
126
+ variant: "primary",
127
+ size: "md",
128
+ },
124
129
  });
@@ -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({
@@ -1,6 +1,5 @@
1
1
  import { defineSlotRecipe } from "@chakra-ui/react";
2
2
 
3
- import { coreBorder } from "../utils/core-utils";
4
3
  import { infoTagAnatomy } from "./anatomy";
5
4
  import { travelTagSlotRecipe } from "./travel-tag";
6
5
 
@@ -1,6 +1,5 @@
1
1
  import { defineSlotRecipe } from "@chakra-ui/react";
2
2
 
3
- import { surface } from "./../utils/surface-utils";
4
3
  import { popoverAnatomy } from "./anatomy";
5
4
 
6
5
  export const popoverSlotRecipe = defineSlotRecipe({
@@ -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
- case "active":
13
+ }
14
+ case "active": {
14
15
  return {
15
16
  backgroundColor: "accent.surface.active",
16
17
  };
17
- case "hover":
18
+ }
19
+ case "hover": {
18
20
  return {
19
21
  backgroundColor: "accent.surface.hover",
20
22
  };
21
- default:
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
- default:
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
- case "secondary":
8
+ }
9
+ case "secondary": {
9
10
  return {
10
11
  backgroundColor: "bg.secondary",
11
12
  };
12
- case "tertiary":
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
- case "hover":
11
+ }
12
+ case "hover": {
12
13
  return {
13
14
  backgroundColor: "brand.surface.hover",
14
15
  };
15
- case "default":
16
- default:
16
+ }
17
+ default: {
17
18
  return {
18
19
  backgroundColor: "brand.surface",
19
20
  };
21
+ }
20
22
  }
21
23
  }
22
24
 
23
- type BrandTextState = Subset<State, "hover" | "active" | "default">;
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
- case "selected":
13
+ }
14
+ case "selected": {
14
15
  return brandBackground("default");
16
+ }
15
17
 
16
- case "disabled":
18
+ case "disabled": {
17
19
  return surface("disabled");
18
- case "hover":
19
- default:
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
- case "default":
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
- case "active":
79
+ }
80
+ case "active": {
75
81
  return {
76
82
  color: "brand.text",
77
83
  };
78
- case "highlight":
84
+ }
85
+ case "highlight": {
79
86
  return {
80
87
  color: "text.highlight",
81
88
  };
82
- case "disabled":
89
+ }
90
+ case "disabled": {
83
91
  return {
84
92
  color: "text.disabled",
85
93
  };
86
- default:
94
+ }
95
+ default: {
87
96
  return {
88
97
  color: "core.text",
89
98
  };
99
+ }
90
100
  }
91
101
  }
@@ -8,26 +8,30 @@ type FloatingBackgroundState = Subset<
8
8
 
9
9
  export function floatingBackground(state: FloatingBackgroundState) {
10
10
  switch (state) {
11
- case "focus":
11
+ case "focus": {
12
12
  return brandBackground("default");
13
- case "active":
13
+ }
14
+ case "active": {
14
15
  return {
15
16
  backgroundColor: "floating.surface.active",
16
17
  };
17
- case "hover":
18
+ }
19
+ case "hover": {
18
20
  return {
19
21
  backgroundColor: {
20
22
  _light: "floating.surface.hover",
21
23
  _dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
22
24
  },
23
25
  };
24
- case "default":
26
+ }
27
+ case "default": {
25
28
  return {
26
29
  backgroundColor: {
27
30
  _light: "bg",
28
31
  _dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`,
29
32
  },
30
33
  };
34
+ }
31
35
  }
32
36
  }
33
37
 
@@ -37,25 +41,29 @@ type FloatingBorderState = Subset<
37
41
  >;
38
42
  export function floatingBorder(state: FloatingBorderState) {
39
43
  switch (state) {
40
- case "hover":
44
+ case "hover": {
41
45
  return {
42
46
  outline: "1px solid",
43
47
  outlineColor: "floating.outline.hover",
44
48
  };
45
- case "focus":
49
+ }
50
+ case "focus": {
46
51
  return {
47
52
  outline: "1px solid",
48
53
  outlineColor: "outline.focus",
49
54
  };
50
- case "active":
55
+ }
56
+ case "active": {
51
57
  return {
52
58
  outline: "1px solid",
53
59
  outlineColor: "floating.outline.active",
54
60
  };
55
- default:
61
+ }
62
+ default: {
56
63
  return {
57
64
  outline: "1px solid",
58
65
  outlineColor: "floating.outline",
59
66
  };
67
+ }
60
68
  }
61
69
  }
@@ -13,19 +13,21 @@ export function ghostBackground(state: GhostBackgroundState) {
13
13
  backgroundColor: "ghost.surface.hover",
14
14
  };
15
15
  }
16
- case "active":
16
+ case "active": {
17
17
  return {
18
18
  backgroundColor: "ghost.surface.active",
19
19
  };
20
+ }
20
21
  case "selected": {
21
22
  return {
22
23
  backgroundColor: "ghost.surface.selected",
23
24
  };
24
25
  }
25
- case "default":
26
+ case "default": {
26
27
  return {
27
28
  backgroundColor: "transparent",
28
29
  };
30
+ }
29
31
  }
30
32
  }
31
33
 
@@ -33,13 +35,15 @@ type GhostTextState = Subset<State, "default" | "selected">;
33
35
 
34
36
  export function ghostText(state: GhostTextState) {
35
37
  switch (state) {
36
- case "selected":
38
+ case "selected": {
37
39
  return {
38
40
  color: "ghost.text",
39
41
  };
40
- default:
42
+ }
43
+ default: {
41
44
  return {
42
45
  color: "ghost.text",
43
46
  };
47
+ }
44
48
  }
45
49
  }
@@ -5,7 +5,7 @@ import { InputState } from "./types";
5
5
 
6
6
  export function inputVariant(state: InputState) {
7
7
  switch (state) {
8
- case "base":
8
+ case "base": {
9
9
  return {
10
10
  ...coreBackground("default"),
11
11
  ...coreBorder("default"),
@@ -21,7 +21,8 @@ export function inputVariant(state: InputState) {
21
21
  ...coreBorder("selected"),
22
22
  },
23
23
  };
24
- case "floating":
24
+ }
25
+ case "floating": {
25
26
  return {
26
27
  boxShadow: "sm",
27
28
  ...floatingBackground("default"),
@@ -40,8 +41,9 @@ export function inputVariant(state: InputState) {
40
41
  borderColor: "floating.border.selected",
41
42
  },
42
43
  };
43
- case "default":
44
- default:
44
+ }
45
+
46
+ default: {
45
47
  return {
46
48
  ...coreBackground("default"),
47
49
  ...coreBorder("default"),
@@ -57,6 +59,7 @@ export function inputVariant(state: InputState) {
57
59
  ...coreBorder("selected"),
58
60
  },
59
61
  };
62
+ }
60
63
  }
61
64
  }
62
65