@noya-app/noya-designsystem 0.1.31 → 0.1.32

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 (61) hide show
  1. package/.turbo/turbo-build.log +20 -12
  2. package/.turbo/turbo-lint.log +2 -1
  3. package/CHANGELOG.md +7 -0
  4. package/README.md +13 -1
  5. package/dist/index.css +1 -0
  6. package/dist/index.d.ts +132 -509
  7. package/dist/index.js +4167 -2716
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +4097 -2643
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +14 -5
  12. package/src/components/ActivityIndicator.tsx +4 -36
  13. package/src/components/Avatar.tsx +63 -62
  14. package/src/components/Button.tsx +53 -172
  15. package/src/components/Chip.tsx +117 -150
  16. package/src/components/ContextMenu.tsx +13 -35
  17. package/src/components/Dialog.tsx +66 -54
  18. package/src/components/Divider.tsx +31 -41
  19. package/src/components/DraggableMenuButton.tsx +29 -30
  20. package/src/components/DropdownMenu.tsx +30 -40
  21. package/src/components/FillInputField.tsx +16 -26
  22. package/src/components/FillPreviewBackground.tsx +18 -22
  23. package/src/components/FloatingWindow.tsx +4 -7
  24. package/src/components/GridView.tsx +70 -200
  25. package/src/components/IconButton.tsx +1 -5
  26. package/src/components/InputField.tsx +191 -194
  27. package/src/components/InputFieldWithCompletions.tsx +20 -27
  28. package/src/components/InspectorContainer.tsx +4 -9
  29. package/src/components/InspectorPrimitives.tsx +135 -109
  30. package/src/components/Label.tsx +5 -36
  31. package/src/components/LabeledElementView.tsx +5 -26
  32. package/src/components/ListView.tsx +239 -167
  33. package/src/components/Popover.tsx +15 -39
  34. package/src/components/Progress.tsx +21 -44
  35. package/src/components/RadioGroup.tsx +6 -71
  36. package/src/components/ScrollArea.tsx +11 -39
  37. package/src/components/SelectMenu.tsx +31 -48
  38. package/src/components/Slider.tsx +7 -43
  39. package/src/components/Spacer.tsx +6 -18
  40. package/src/components/Switch.tsx +4 -42
  41. package/src/components/Text.tsx +31 -66
  42. package/src/components/TextArea.tsx +5 -31
  43. package/src/components/Toast.tsx +15 -57
  44. package/src/components/Tooltip.tsx +4 -13
  45. package/src/components/WorkspaceLayout.tsx +4 -14
  46. package/src/components/internal/Menu.tsx +37 -83
  47. package/src/contexts/DesignSystemConfiguration.tsx +1 -47
  48. package/src/contexts/DialogContext.tsx +2 -10
  49. package/src/hooks/useDarkMode.ts +14 -0
  50. package/src/index.css +108 -0
  51. package/src/index.tsx +3 -4
  52. package/src/theme/index.ts +4 -16
  53. package/src/utils/tailwind.ts +17 -0
  54. package/tailwind.config.ts +106 -166
  55. package/tsup.config.ts +16 -0
  56. package/dist/index.d.mts +0 -1443
  57. package/src/components/Grid.tsx +0 -54
  58. package/src/components/Stack.tsx +0 -164
  59. package/src/theme/dark.ts +0 -45
  60. package/src/theme/light.ts +0 -226
  61. package/src/utils/breakpoints.ts +0 -45
@@ -8,74 +8,9 @@ import React, {
8
8
  useContext,
9
9
  useMemo,
10
10
  } from "react";
11
- import styled from "styled-components";
12
11
  import { Tooltip } from "./Tooltip";
13
12
 
14
13
  type RadioGroupColorScheme = "primary" | "secondary";
15
-
16
- const ignoredProps = new Set(["colorScheme"]);
17
-
18
- const StyledRoot = styled(ToggleGroupPrimitive.Root).withConfig({
19
- shouldForwardProp: (prop) => !ignoredProps.has(prop),
20
- })<{
21
- colorScheme?: RadioGroupColorScheme;
22
- }>(({ theme, colorScheme }) => ({
23
- appearance: "none",
24
- width: "0px", // Reset intrinsic width
25
- flex: "1 1 0px",
26
- position: "relative",
27
- border: "0",
28
- outline: "none",
29
- minWidth: "0",
30
- textAlign: "left",
31
- alignSelf: "stretch",
32
- borderRadius: "4px",
33
- background: theme.colors.inputBackground,
34
- "&:focus": {
35
- boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${
36
- theme.colors[colorScheme ?? "primary"]
37
- }`,
38
- },
39
- display: "flex",
40
- alignItems: "stretch",
41
- minHeight: "27px",
42
- padding: colorScheme === undefined ? "2px" : 0,
43
- }));
44
-
45
- const StyledItem = styled(ToggleGroupPrimitive.Item).withConfig({
46
- shouldForwardProp: (prop) => !ignoredProps.has(prop),
47
- })<{
48
- colorScheme?: RadioGroupColorScheme;
49
- }>(({ theme, colorScheme }) => ({
50
- ...theme.textStyles.small,
51
- position: "relative",
52
- flex: "1 1 0",
53
- appearance: "none",
54
- border: "none",
55
- background: "none",
56
- color: "rgb(139, 139, 139)",
57
- padding: 0,
58
- margin: 0,
59
- borderRadius: "4px",
60
- display: "inline-flex",
61
- alignItems: "center",
62
- justifyContent: "center",
63
- verticalAlign: "middle",
64
- '&[aria-checked="true"]': {
65
- backgroundColor: colorScheme
66
- ? theme.colors[colorScheme]
67
- : theme.colors.radioGroup.background,
68
- color: colorScheme ? theme.colors.radioGroup.background : theme.colors.text,
69
- boxShadow: colorScheme ? undefined : `0 1px 1px rgba(0,0,0,0.1)`,
70
- },
71
- "&:focus": {
72
- outline: "none",
73
- boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${
74
- theme.colors[colorScheme ?? "primary"]
75
- }`,
76
- },
77
- }));
78
-
79
14
  interface ItemProps {
80
15
  value: string;
81
16
  tooltip?: ReactNode;
@@ -90,14 +25,14 @@ const ToggleGroupItem = forwardRef(function ToggleGroupItem(
90
25
  const { colorScheme } = useContext(RadioGroupContext);
91
26
 
92
27
  const itemElement = (
93
- <StyledItem
28
+ <ToggleGroupPrimitive.Item
94
29
  ref={forwardedRef}
95
30
  value={value}
96
31
  disabled={disabled}
97
- colorScheme={colorScheme}
32
+ className={`font-sans text-heading5 font-normal relative flex-1 appearance-none border-none bg-none text-radio-group-item p-0 m-0 rounded inline-flex items-center justify-center align-middle focus:outline-none focus:shadow-[0_0_0_1px_var(--sidebar-background),0_0_0_3px_${colorScheme === "secondary" ? "var(--secondary)" : "var(--primary)"}] aria-checked:bg-${colorScheme ? colorScheme : "radio-group-background"} aria-checked:text-${colorScheme ? "radio-group-background" : "text"} aria-checked:shadow-${colorScheme ? "none" : "0_1px_1px_rgba(0,0,0,0.1)"}`}
98
33
  >
99
34
  {children}
100
- </StyledItem>
35
+ </ToggleGroupPrimitive.Item>
101
36
  );
102
37
 
103
38
  return tooltip ? (
@@ -146,15 +81,15 @@ function ToggleGroupRoot({
146
81
 
147
82
  return (
148
83
  <RadioGroupContext.Provider value={contextValue}>
149
- <StyledRoot
84
+ <ToggleGroupPrimitive.Root
150
85
  id={id}
151
86
  type="single"
152
87
  value={value}
153
- colorScheme={colorScheme}
154
88
  onValueChange={handleValueChange}
89
+ className={`appearance-none w-0 flex-1 relative border-0 outline-none min-w-0 min-h-[27px] text-left self-stretch rounded bg-input-background items-stretch focus:shadow-[0_0_0_1px_var(--sidebar-background),0_0_0_3px_${colorScheme === "secondary" ? "var(--secondary)" : "var(--primary)"}] ${colorScheme ? "p-0" : "p-0.5"}`}
155
90
  >
156
91
  {children}
157
- </StyledRoot>
92
+ </ToggleGroupPrimitive.Root>
158
93
  </RadioGroupContext.Provider>
159
94
  );
160
95
  }
@@ -1,37 +1,5 @@
1
1
  import * as RadixScrollArea from "@radix-ui/react-scroll-area";
2
2
  import React, { memo, ReactNode, useCallback, useState } from "react";
3
- import styled from "styled-components";
4
-
5
- const SCROLLBAR_SIZE = 10;
6
-
7
- const StyledViewport = styled(RadixScrollArea.Viewport)({
8
- width: "100%",
9
- height: "100%",
10
- // Override the `display: table` in the child, since this allows
11
- // elements to expand beyond the width of the viewport.
12
- "& > div": {
13
- display: "block !important",
14
- },
15
- });
16
-
17
- const StyledScrollbar = styled(RadixScrollArea.Scrollbar)({
18
- display: "flex",
19
- padding: "3px",
20
- '&[data-orientation="vertical"]': {
21
- width: SCROLLBAR_SIZE,
22
- },
23
- });
24
-
25
- const StyledThumb = styled(RadixScrollArea.Thumb)(({ theme }) => ({
26
- flex: 1,
27
- borderRadius: SCROLLBAR_SIZE,
28
- backgroundColor: theme.colors.scrollbar,
29
- }));
30
-
31
- const Container = styled.div({
32
- flex: "1 1 0px",
33
- minHeight: 0,
34
- });
35
3
 
36
4
  interface Props {
37
5
  children?: ReactNode | ((scrollElementRef: HTMLDivElement) => ReactNode);
@@ -42,9 +10,10 @@ export const ScrollArea = memo(function ScrollArea({ children }: Props) {
42
10
  useState<HTMLDivElement | null>(null);
43
11
 
44
12
  return (
45
- <Container>
13
+ <div className="flex-1 min-h-0">
46
14
  <RadixScrollArea.Root style={{ width: "100%", height: "100%" }}>
47
- <StyledViewport
15
+ <RadixScrollArea.Viewport
16
+ className="w-full h-full [&>div]:block"
48
17
  ref={useCallback(
49
18
  (ref: HTMLDivElement | null) => setScrollElementRef(ref),
50
19
  []
@@ -55,11 +24,14 @@ export const ScrollArea = memo(function ScrollArea({ children }: Props) {
55
24
  ? children(scrollElementRef)
56
25
  : null
57
26
  : children}
58
- </StyledViewport>
59
- <StyledScrollbar orientation="vertical" className="scroll-component">
60
- <StyledThumb className="scroll-component" />
61
- </StyledScrollbar>
27
+ </RadixScrollArea.Viewport>
28
+ <RadixScrollArea.Scrollbar
29
+ orientation="vertical"
30
+ className="scroll-component flex p-[3px] data-[orientation=vertical]:w-[10px]"
31
+ >
32
+ <RadixScrollArea.Thumb className="scroll-component flex-1 rounded-[10px] bg-scrollbar" />
33
+ </RadixScrollArea.Scrollbar>
62
34
  </RadixScrollArea.Root>
63
- </Container>
35
+ </div>
64
36
  );
65
37
  });
@@ -2,12 +2,10 @@ import { DropdownChevronIcon } from "@noya-app/noya-icons";
2
2
  import * as Select from "@radix-ui/react-select";
3
3
  import { type SelectProps } from "@radix-ui/react-select";
4
4
  import React, { CSSProperties, memo, useMemo } from "react";
5
- import { styled } from "styled-components";
6
5
  import { Button } from "./Button";
7
6
  import { renderIcon } from "./Icons";
8
7
  import { Spacer } from "./Spacer";
9
8
  import { MenuItem, RegularMenuItem, styles } from "./internal/Menu";
10
- import { Stack } from "./Stack";
11
9
 
12
10
  type Props<T extends string> = {
13
11
  id?: string;
@@ -27,28 +25,11 @@ const readOnlyStyle: CSSProperties = {
27
25
  textAlign: "left",
28
26
  };
29
27
 
30
- const flexStyle: CSSProperties = {
31
- flex: 1,
32
- };
33
-
34
28
  const textStyle: CSSProperties = {
35
29
  fontSize: "0.85rem",
36
30
  };
37
31
 
38
- const SelectLabel = styled.label(({ theme }) => ({
39
- ...theme.textStyles.label,
40
- color: theme.colors.textDisabled,
41
- lineHeight: "19px",
42
- position: "absolute",
43
- inset: "0",
44
- fontWeight: "bold",
45
- fontSize: "60%",
46
- pointerEvents: "none",
47
- display: "flex",
48
- alignItems: "center",
49
- justifyContent: "end",
50
- paddingRight: "24px",
51
- }));
32
+ const labelStyles = `font-sans text-label uppercase text-text-disabled leading-[19px] absolute inset-0 font-bold text-[60%] pointer-events-none flex items-center justify-end pr-6`;
52
33
 
53
34
  export const SelectMenu = memo(function SelectMenu<T extends string = string>({
54
35
  id,
@@ -73,9 +54,9 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
73
54
  () => (
74
55
  <Button
75
56
  id={id}
76
- style={{ ...style, ...flexStyle }}
57
+ style={style}
77
58
  contentStyle={readOnlyStyle}
78
- className={className}
59
+ className={`${className ?? ""} flex-1`}
79
60
  disabled={disabled}
80
61
  >
81
62
  {icon && (
@@ -84,7 +65,7 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
84
65
  <Spacer.Horizontal inline size={6} />
85
66
  </>
86
67
  )}
87
- <span style={{ ...flexStyle, ...textStyle }}>
68
+ <span style={{ ...textStyle }} className="flex flex-1">
88
69
  {selectedItem?.title ?? value}
89
70
  </span>
90
71
  </Button>
@@ -97,8 +78,8 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
97
78
  <Select.SelectTrigger asChild>
98
79
  <Button
99
80
  id={id}
100
- style={{ ...textStyle, ...style, ...flexStyle }}
101
- className={className}
81
+ style={{ ...textStyle, ...style }}
82
+ className={`${className ?? "w-full"} flex-1`}
102
83
  disabled={disabled}
103
84
  >
104
85
  {icon && (
@@ -107,7 +88,7 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
107
88
  <Spacer.Horizontal inline size={6} />
108
89
  </>
109
90
  )}
110
- <span style={flexStyle}>
91
+ <span className="flex flex-1">
111
92
  <Select.Value placeholder={placeholder} />
112
93
  </span>
113
94
  <Spacer.Horizontal inline size={6} />
@@ -120,10 +101,15 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
120
101
 
121
102
  if (readOnly) {
122
103
  return label ? (
123
- <Stack.V position="relative">
104
+ <div className="flex flex-col relative">
124
105
  {readOnlyButton}
125
- <SelectLabel htmlFor={id}>{label}</SelectLabel>
126
- </Stack.V>
106
+ <label
107
+ className={labelStyles}
108
+ htmlFor={id}
109
+ >
110
+ {label}
111
+ </label>
112
+ </div>
127
113
  ) : (
128
114
  readOnlyButton
129
115
  );
@@ -132,19 +118,23 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
132
118
  return (
133
119
  <Select.Root value={value} onValueChange={onSelect} open={open}>
134
120
  {label ? (
135
- <Stack.V position="relative" style={flexStyle}>
121
+ <div className="flex-1 flex-col relative">
136
122
  {trigger}
137
- <SelectLabel htmlFor={id}>{label}</SelectLabel>
138
- </Stack.V>
123
+ {label && (
124
+ <label className={labelStyles} htmlFor={id}>
125
+ {label}
126
+ </label>
127
+ )}
128
+ </div>
139
129
  ) : (
140
130
  trigger
141
131
  )}
142
132
  <Select.Portal>
143
- <SelectContent>
144
- <SelectViewport>
133
+ <Select.Content className={styles.contentStyle}>
134
+ <Select.Viewport>
145
135
  {menuItems.map((menuItem) => {
146
136
  if (typeof menuItem === "string") {
147
- return <StyledSeparator />;
137
+ return <Select.Separator className={styles.separatorStyle} />;
148
138
  }
149
139
 
150
140
  const value = menuItem.value ?? "";
@@ -155,28 +145,24 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
155
145
  </SelectItem>
156
146
  );
157
147
  })}
158
- </SelectViewport>
159
- </SelectContent>
148
+ </Select.Viewport>
149
+ </Select.Content>
160
150
  </Select.Portal>
161
151
  </Select.Root>
162
152
  );
163
153
  });
164
154
 
165
- const SelectContent = styled(Select.Content)(styles.contentStyle);
166
-
167
- const SelectViewport = styled(Select.Viewport)({});
168
-
169
155
  const SelectItem = React.forwardRef(
170
156
  (
171
157
  {
172
158
  children,
173
- icon,
159
+ icon, disabled,
174
160
  ...props
175
161
  }: Select.SelectItemProps & { icon?: React.ReactNode },
176
162
  forwardedRef: React.ForwardedRef<HTMLDivElement>
177
163
  ) => {
178
164
  return (
179
- <StyledItem {...props} ref={forwardedRef}>
165
+ <Select.Item className={styles.itemStyle({disabled})} disabled={disabled} {...props} ref={forwardedRef}>
180
166
  {icon && (
181
167
  <>
182
168
  {renderIcon(icon)}
@@ -184,10 +170,7 @@ const SelectItem = React.forwardRef(
184
170
  </>
185
171
  )}
186
172
  <Select.ItemText style={textStyle}>{children}</Select.ItemText>
187
- </StyledItem>
173
+ </Select.Item>
188
174
  );
189
175
  }
190
- );
191
-
192
- const StyledItem = styled(Select.Item)(styles.itemStyle);
193
- const StyledSeparator = styled(Select.Separator)(styles.separatorStyle);
176
+ );
@@ -1,42 +1,5 @@
1
1
  import * as RadixSlider from '@radix-ui/react-slider';
2
2
  import React, { useCallback, useMemo } from 'react';
3
- import styled from 'styled-components';
4
-
5
- const StyledSlider = styled(RadixSlider.Root)({
6
- flex: '1',
7
- position: 'relative',
8
- display: 'flex',
9
- alignItems: 'center',
10
- userSelect: 'none',
11
- touchAction: 'none',
12
- height: '16px',
13
- });
14
-
15
- const StyledTrack = styled(RadixSlider.Track)(({ theme }) => ({
16
- backgroundColor: theme.colors.divider,
17
- position: 'relative',
18
- flexGrow: 1,
19
- height: '2px',
20
- }));
21
-
22
- const StyledRange = styled(RadixSlider.Range)(({ theme }) => ({
23
- position: 'absolute',
24
- backgroundColor: theme.colors.primary,
25
- borderRadius: '9999px',
26
- height: '100%',
27
- }));
28
-
29
- const StyledThumb = styled(RadixSlider.Thumb)(({ theme }) => ({
30
- display: 'block',
31
- width: '12px',
32
- height: '12px',
33
- backgroundColor: theme.colors.slider.background,
34
- border: `1px solid ${theme.colors.slider.border}`,
35
- borderRadius: '20px',
36
- ':focus': {
37
- outline: 'none',
38
- },
39
- }));
40
3
 
41
4
  interface Props {
42
5
  id?: string;
@@ -66,17 +29,18 @@ export const Slider = function Slider({
66
29
  );
67
30
 
68
31
  return (
69
- <StyledSlider
32
+ <RadixSlider.Root
70
33
  min={min}
71
34
  max={max}
72
35
  id={id}
73
36
  value={arrayValue}
74
37
  onValueChange={handleValueChange}
38
+ className="flex-1 flex relative items-center select-none touch-none h-4"
75
39
  >
76
- <StyledTrack>
77
- <StyledRange />
78
- </StyledTrack>
79
- <StyledThumb />
80
- </StyledSlider>
40
+ <RadixSlider.Track className="bg-divider relative flex-grow h-[2px]">
41
+ <RadixSlider.Range className="absolute bg-primary rounded-full h-full" />
42
+ </RadixSlider.Track>
43
+ <RadixSlider.Thumb className="block w-3 h-3 bg-slider-background border border-solid border-slider-border rounded-[20px] focus:outline-none" />
44
+ </RadixSlider.Root>
81
45
  );
82
46
  };
@@ -1,30 +1,21 @@
1
1
  /* eslint-disable react/jsx-pascal-case */
2
2
  import React, { ForwardedRef, forwardRef } from "react";
3
- import styled from "styled-components";
4
3
 
5
4
  interface Props {
6
5
  size?: number | string;
7
6
  inline?: boolean;
8
7
  }
9
8
 
10
- interface Props_ {
11
- $size?: number | string;
12
- $inline?: boolean;
13
- }
14
-
15
9
  /* ----------------------------------------------------------------------------
16
10
  * Vertical
17
11
  * ------------------------------------------------------------------------- */
18
12
 
19
- const SpacerVertical_ = styled.span<Props_>(({ $size, $inline }) => ({
20
- display: $inline ? "inline-block" : "block",
21
- ...($size === undefined ? { flex: 1 } : { minHeight: $size }),
22
- }));
23
-
24
13
  const SpacerVertical = forwardRef<HTMLSpanElement, Props>(
25
14
  ({ size, inline, ...props }, ref: ForwardedRef<HTMLSpanElement>) => {
26
15
  return (
27
- <SpacerVertical_ $size={size} $inline={inline} {...props} ref={ref} />
16
+ <span className={`${inline ? "inline-block" : "block"} ${size === undefined ? "flex flex-1" : ""}`} style={size ? {
17
+ minHeight: `${size}px`,
18
+ } : undefined} {...props} ref={ref} />
28
19
  );
29
20
  }
30
21
  );
@@ -33,15 +24,12 @@ const SpacerVertical = forwardRef<HTMLSpanElement, Props>(
33
24
  * Horizontal
34
25
  * ------------------------------------------------------------------------- */
35
26
 
36
- const SpacerHorizontal_ = styled.span<Props_>(({ $size, $inline }) => ({
37
- display: $inline ? "inline-block" : "block",
38
- ...($size === undefined ? { flex: 1 } : { minWidth: $size }),
39
- }));
40
-
41
27
  const SpacerHorizontal = forwardRef<HTMLSpanElement, Props>(
42
28
  ({ size, inline, ...props }, ref: ForwardedRef<HTMLSpanElement>) => {
43
29
  return (
44
- <SpacerHorizontal_ $size={size} $inline={inline} {...props} ref={ref} />
30
+ <span className={`${inline ? "inline-block" : "block"} ${size === undefined ? "flex flex-1" : ""}`} style={size ? {
31
+ minWidth: `${size}px`,
32
+ } : undefined} {...props} ref={ref} />
45
33
  );
46
34
  }
47
35
  );
@@ -1,46 +1,8 @@
1
1
  import * as SwitchPrimitive from "@radix-ui/react-switch";
2
2
  import React from "react";
3
- import styled from "styled-components";
4
3
 
5
4
  type SwitchColorScheme = "normal" | "primary" | "secondary";
6
5
 
7
- const SwitchRoot = styled(SwitchPrimitive.Root)<{
8
- $colorScheme: SwitchColorScheme;
9
- }>(({ theme, $colorScheme }) => ({
10
- all: "unset",
11
- width: 32,
12
- height: 19,
13
- backgroundColor: theme.colors.activeBackground,
14
- borderRadius: "9999px",
15
- position: "relative",
16
- WebkitTapHighlightColor: "rgba(0, 0, 0, 0)",
17
- cursor: "pointer",
18
- "&:focus": {
19
- outline: `2px solid ${theme.colors.primary}`,
20
- outlineOffset: "1px",
21
- },
22
- '&[data-state="checked"]': {
23
- backgroundColor:
24
- $colorScheme === "primary"
25
- ? theme.colors.primary
26
- : $colorScheme === "secondary"
27
- ? theme.colors.secondary
28
- : undefined,
29
- },
30
- }));
31
-
32
- const SwitchThumb = styled(SwitchPrimitive.Thumb)({
33
- display: "block",
34
- width: 15,
35
- height: 15,
36
- backgroundColor: "white",
37
- borderRadius: "9999px",
38
- transition: "transform 100ms",
39
- transform: "translateX(2px)",
40
- willChange: "transform",
41
- '&[data-state="checked"]': { transform: "translateX(15px)" },
42
- });
43
-
44
6
  interface Props {
45
7
  value: boolean;
46
8
  onChange: (value: boolean) => void;
@@ -56,15 +18,15 @@ export const Switch = function Switch({
56
18
  disabled,
57
19
  }: Props) {
58
20
  return (
59
- <SwitchRoot
60
- $colorScheme={colorScheme}
21
+ <SwitchPrimitive.Root
61
22
  checked={value}
62
23
  disabled={disabled}
63
24
  onCheckedChange={(newValue) => {
64
25
  onChange(newValue);
65
26
  }}
27
+ className={`all-unset w-8 h-[19px] bg-active-background rounded-full relative cursor-pointer [webkit-tap-highlight-color:rgba(0,0,0,0)] focus:ring-2 focus:outline-primary focus:ring-offset-[1px] data-[state=checked]:bg-primary ${colorScheme === "secondary" && "data-[state=checked]:bg-secondary"}`}
66
28
  >
67
- <SwitchThumb />
68
- </SwitchRoot>
29
+ <SwitchPrimitive.Thumb className="block w-[15px] h-[15px] bg-white rounded-full transition-transform translate-x-[2px] data-[state=checked]:translate-x-[15px]"/>
30
+ </SwitchPrimitive.Root>
69
31
  );
70
32
  };