@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
@@ -1,149 +1,113 @@
1
1
  import { Cross1Icon, PlusIcon } from "@noya-app/noya-icons";
2
2
  import React, { forwardRef, memo } from "react";
3
- import styled from "styled-components";
4
- import { useDesignSystemTheme } from "../contexts/DesignSystemConfiguration";
5
3
  import { useHover } from "../hooks/useHover";
6
4
 
7
5
  type ChipColorScheme = "primary" | "secondary" | "error";
8
6
  type ChipSize = "small" | "medium" | "large";
9
7
  type ChipVariant = "solid" | "outlined" | "ghost";
10
8
 
11
- const ChipElement = styled.span<{
9
+ function getChipStyles({
10
+ $colorScheme,
11
+ $size,
12
+ $variant,
13
+ $monospace,
14
+ $isInteractive,
15
+ }: {
12
16
  $colorScheme?: ChipColorScheme;
13
17
  $size: ChipSize;
14
- $monospace: boolean;
15
18
  $variant: ChipVariant;
19
+ $monospace: boolean;
16
20
  $isInteractive: boolean;
17
- }>(({ theme, $colorScheme, $size, $variant, $monospace, $isInteractive }) => {
18
- const color =
19
- $colorScheme === "primary"
20
- ? theme.colors.primary
21
- : $colorScheme === "secondary"
22
- ? theme.colors.secondary
23
- : theme.colors.text;
24
-
25
- const backgroundColor =
26
- $colorScheme === "primary"
27
- ? theme.colors.primaryPastel
28
- : $colorScheme === "secondary"
29
- ? theme.colors.secondaryPastel
30
- : $colorScheme === "error"
31
- ? "rgb(255, 219, 219)"
32
- : theme.colors.inputBackground;
33
-
34
- const subtleColor =
35
- $colorScheme === "primary"
36
- ? "rgba(238, 229, 255, 0.2)"
37
- : $colorScheme === "secondary"
38
- ? "rgba(205, 238, 231, 0.2)"
39
- : $colorScheme === "error"
40
- ? "rgba(255, 219, 219, 0.2)"
41
- : "rgba(0, 0, 0, 0.1)";
42
-
43
- return {
44
- textTransform: "initial",
45
- borderRadius: 4,
46
- userSelect: "none",
47
- display: "inline-flex",
48
- alignItems: "center",
49
- // lineHeight: "1.4",
50
- lineHeight: "15px",
51
- whiteSpace: "pre",
52
- ...($size === "large"
53
- ? {
54
- fontSize: "11px",
55
- padding: "4px 8px",
56
- }
57
- : $size === "medium"
58
- ? {
59
- fontSize: "10px",
60
- padding: "2px 6px",
61
- }
62
- : {
63
- fontSize: "9px",
64
- padding: "0px 4px",
65
- }),
66
- ...($monospace && {
67
- fontFamily: theme.fonts.monospace,
68
- }),
69
- ...($variant === "solid"
70
- ? {
71
- color,
72
- backgroundColor,
73
- }
74
- : $variant === "outlined"
75
- ? {
76
- color,
77
- backgroundColor: "transparent",
78
- boxShadow: `0 0 0 1px ${subtleColor} inset`,
79
- }
80
- : {}),
81
- "&:hover": {
82
- ...($variant === "outlined" && {
83
- backgroundColor: subtleColor,
84
- boxShadow: "none",
85
- }),
86
- },
87
- ...($isInteractive && {
88
- cursor: "pointer",
89
- "&:hover": {
90
- opacity: 0.85,
21
+ }) {
22
+ // Base styles
23
+ const baseStyles = `
24
+ inline-flex items-center
25
+ whitespace-pre rounded
26
+ select-none
27
+ leading-[15px]
28
+ `;
29
+
30
+ // Size styles
31
+ const sizeStyles = {
32
+ large: "text-[11px] p-[4px_8px]",
33
+ medium: "text-[10px] p-[2px_6px]",
34
+ small: "text-[9px] p-[0px_4px]",
35
+ }[$size];
36
+
37
+ // Font family
38
+ const fontStyles = $monospace ? "font-mono" : "";
39
+
40
+ // Color and background based on scheme and variant
41
+ const variantStyles = (() => {
42
+ const colors = {
43
+ primary: {
44
+ text: "text-primary",
45
+ bg: "bg-primary-pastel",
46
+ subtle: "bg-[rgba(238,229,255,0.2)]",
47
+ },
48
+ secondary: {
49
+ text: "text-secondary",
50
+ bg: "bg-secondary-pastel",
51
+ subtle: "bg-[rgba(205,238,231,0.2)]",
52
+ },
53
+ error: {
54
+ text: "text-text",
55
+ bg: "bg-[rgb(255,219,219)]",
56
+ subtle: "bg-[rgba(255,219,219,0.2)]",
57
+ },
58
+ default: {
59
+ text: "text-text",
60
+ bg: "bg-input-background",
61
+ subtle: "bg-[rgba(0,0,0,0.1)]",
91
62
  },
92
- }),
93
- };
94
- });
95
-
96
- const DeleteElement = styled(Cross1Icon)<{
97
- size: ChipSize;
98
- }>(({ size }) => ({
99
- position: "relative",
100
- marginRight: "-2px",
101
- cursor: "pointer",
102
- opacity: 0.5,
103
-
104
- ...(size === "large"
105
- ? {
106
- marginLeft: "2px",
107
- // top: '-1px',
108
- transform: "scale(0.75)",
109
- }
110
- : {
111
- transform: "scale(0.6)",
112
- }),
113
-
114
- "&:hover": {
115
- opacity: 0.85,
116
- },
117
- }));
118
-
119
- const ignoredProps = new Set(["size", "isOnlyChild"]);
120
-
121
- const AddElement = styled(PlusIcon).withConfig({
122
- shouldForwardProp: (prop) => !ignoredProps.has(prop),
123
- })<{
124
- size: ChipSize;
125
- isOnlyChild: boolean;
126
- }>(({ size, isOnlyChild }) => ({
127
- position: "relative",
128
- marginLeft: "-2px",
129
- cursor: "pointer",
130
- opacity: 0.5,
131
-
132
- ...(size === "large"
133
- ? {
134
- marginRight: "2px",
135
- top: "-1px",
136
- transform: "scale(0.75)",
137
- }
138
- : {
139
- marginRight: "-2px",
140
- transform: "scale(0.6)",
141
- }),
142
-
143
- "&:hover": {
144
- opacity: 0.85,
145
- },
146
- }));
63
+ }[$colorScheme ?? "default"];
64
+
65
+ if ($variant === "solid") {
66
+ return `${colors.text} ${colors.bg}`;
67
+ }
68
+ if ($variant === "outlined") {
69
+ return `
70
+ ${colors.text} bg-transparent
71
+ shadow-[0_0_0_1px_${colors.subtle.slice(3, -1)}_inset]
72
+ hover:${colors.subtle} hover:shadow-none
73
+ `;
74
+ }
75
+ return "";
76
+ })();
77
+
78
+ // Interactive states
79
+ const interactiveStyles = $isInteractive
80
+ ? "cursor-pointer hover:opacity-85"
81
+ : "";
82
+
83
+ return `
84
+ ${baseStyles}
85
+ ${sizeStyles}
86
+ ${fontStyles}
87
+ ${variantStyles}
88
+ ${interactiveStyles}
89
+ `
90
+ .replace(/\s+/g, " ")
91
+ .trim();
92
+ }
93
+
94
+ function getIconStyles(size: ChipSize, isAdd: boolean) {
95
+ const baseStyles = "relative opacity-50 cursor-pointer hover:opacity-85";
96
+
97
+ if (size === "large") {
98
+ return `
99
+ ${baseStyles}
100
+ ${isAdd ? "ml-[-2px] mr-[2px] -top-[1px]" : "mr-[-2px] ml-[2px]"}
101
+ scale-75
102
+ `;
103
+ }
104
+
105
+ return `
106
+ ${baseStyles}
107
+ ${isAdd ? "ml-[-2px] mr-[-2px]" : "mr-[-2px]"}
108
+ scale-60
109
+ `;
110
+ }
147
111
 
148
112
  export interface ChipProps {
149
113
  id?: string;
@@ -181,12 +145,11 @@ export const Chip = memo(
181
145
  onClick,
182
146
  onAdd,
183
147
  onHoverDeleteChange,
148
+ className,
184
149
  ...rest
185
150
  }: ChipProps,
186
151
  forwardedRef: React.ForwardedRef<HTMLSpanElement>
187
152
  ) {
188
- const theme = useDesignSystemTheme();
189
-
190
153
  const { hoverProps: hoverDeleteProps } = useHover({
191
154
  onHoverChange: onHoverDeleteChange,
192
155
  });
@@ -195,28 +158,32 @@ export const Chip = memo(
195
158
 
196
159
  const color =
197
160
  colorScheme === "primary"
198
- ? theme.colors.primary
161
+ ? "var(--primary)"
199
162
  : colorScheme === "secondary"
200
- ? theme.colors.secondary
201
- : theme.colors.text;
163
+ ? "var(--secondary)"
164
+ : "var(--text)";
202
165
 
203
166
  return (
204
- <ChipElement
167
+ <span
205
168
  ref={forwardedRef}
206
- $variant={variant}
207
- $colorScheme={colorScheme}
169
+ className={`
170
+ ${getChipStyles({
171
+ $colorScheme: colorScheme,
172
+ $size: size,
173
+ $variant: variant,
174
+ $monospace: monospace,
175
+ $isInteractive: !!handleClick || clickable === true,
176
+ })}
177
+ ${className ?? ""}
178
+ `}
208
179
  style={style}
209
180
  onClick={handleClick}
210
- $size={size}
211
- $monospace={monospace}
212
- $isInteractive={!!handleClick || clickable === true}
213
181
  tabIndex={tabIndex}
214
182
  {...rest}
215
183
  >
216
184
  {addable && (
217
- <AddElement
218
- size={size}
219
- isOnlyChild={!children && !deletable}
185
+ <PlusIcon
186
+ className={getIconStyles(size, true)}
220
187
  onClick={
221
188
  onAdd
222
189
  ? (event) => {
@@ -230,8 +197,8 @@ export const Chip = memo(
230
197
  )}
231
198
  {children}
232
199
  {deletable && (
233
- <DeleteElement
234
- size={size}
200
+ <Cross1Icon
201
+ className={getIconStyles(size, false)}
235
202
  {...(hoverDeleteProps as any)}
236
203
  onClick={
237
204
  onDelete
@@ -244,7 +211,7 @@ export const Chip = memo(
244
211
  color={color}
245
212
  />
246
213
  )}
247
- </ChipElement>
214
+ </span>
248
215
  );
249
216
  })
250
217
  );
@@ -2,7 +2,6 @@ import { CheckIcon, ChevronRightIcon } from "@noya-app/noya-icons";
2
2
  import { useKeyboardShortcuts } from "@noya-app/noya-keymap";
3
3
  import * as RadixContextMenu from "@radix-ui/react-context-menu";
4
4
  import React, { ReactNode, memo, useCallback, useMemo } from "react";
5
- import styled from "styled-components";
6
5
  import { renderIcon } from "./Icons";
7
6
  import { Spacer } from "./Spacer";
8
7
  import {
@@ -15,28 +14,6 @@ import {
15
14
  styles,
16
15
  } from "./internal/Menu";
17
16
 
18
- /* ----------------------------------------------------------------------------
19
- * Separator
20
- * ------------------------------------------------------------------------- */
21
-
22
- const SeparatorElement = styled(RadixContextMenu.Separator)(
23
- styles.separatorStyle
24
- );
25
-
26
- /* ----------------------------------------------------------------------------
27
- * Item
28
- * ------------------------------------------------------------------------- */
29
-
30
- const ItemElement = styled(RadixContextMenu.Item)(styles.itemStyle);
31
-
32
- const CheckboxItemElement = styled(RadixContextMenu.CheckboxItem)(
33
- styles.itemStyle
34
- );
35
-
36
- const StyledItemIndicator = styled(RadixContextMenu.ItemIndicator)(
37
- styles.itemIndicatorStyle
38
- );
39
-
40
17
  export interface MenuItemProps<T extends string> {
41
18
  value?: T;
42
19
  children: ReactNode;
@@ -75,21 +52,23 @@ const ContextMenuItem = memo(function ContextMenuItem<T extends string>({
75
52
 
76
53
  if (checked) {
77
54
  return (
78
- <CheckboxItemElement
55
+ <RadixContextMenu.CheckboxItem
79
56
  checked={checked}
80
57
  disabled={disabled}
81
58
  onSelect={handleSelectItem}
59
+ className={styles.itemStyle({ disabled })}
82
60
  >
83
- <StyledItemIndicator>
61
+ <RadixContextMenu.ItemIndicator className={styles.itemIndicatorStyle}>
84
62
  <CheckIcon />
85
- </StyledItemIndicator>
63
+ </RadixContextMenu.ItemIndicator>
86
64
  {children}
87
- </CheckboxItemElement>
65
+ </RadixContextMenu.CheckboxItem>
88
66
  );
89
67
  }
90
68
 
91
69
  const element = (
92
- <ItemElement
70
+ <RadixContextMenu.Item
71
+ className={styles.itemStyle({ disabled })}
93
72
  disabled={disabled}
94
73
  onSelect={handleSelectItem}
95
74
  onPointerDown={handlePointerDown}
@@ -118,7 +97,7 @@ const ContextMenuItem = memo(function ContextMenuItem<T extends string>({
118
97
  <ChevronRightIcon />
119
98
  </>
120
99
  )}
121
- </ItemElement>
100
+ </RadixContextMenu.Item>
122
101
  );
123
102
 
124
103
  if (items && items.length > 0) {
@@ -136,9 +115,6 @@ const ContextMenuItem = memo(function ContextMenuItem<T extends string>({
136
115
  * Root
137
116
  * ------------------------------------------------------------------------- */
138
117
 
139
- const Content = styled(RadixContextMenu.Content)(styles.contentStyle);
140
- const SubContent = styled(RadixContextMenu.SubContent)(styles.contentStyle);
141
-
142
118
  export interface MenuProps<T extends string> {
143
119
  children: ReactNode;
144
120
  items: MenuItem<T>[];
@@ -182,7 +158,9 @@ function ContextMenuRoot<T extends string>({
182
158
  const TriggerComponent = isNested
183
159
  ? RadixContextMenu.SubTrigger
184
160
  : RadixContextMenu.Trigger;
185
- const ContentComponent: typeof Content = isNested ? SubContent : Content;
161
+ const ContentComponent: typeof RadixContextMenu.Content = isNested
162
+ ? RadixContextMenu.SubContent
163
+ : RadixContextMenu.Content;
186
164
 
187
165
  return (
188
166
  <RootComponent onOpenChange={onOpenChange}>
@@ -190,10 +168,10 @@ function ContextMenuRoot<T extends string>({
190
168
  {children}
191
169
  </TriggerComponent>
192
170
  <RadixContextMenu.Portal>
193
- <ContentComponent>
171
+ <ContentComponent className={styles.contentStyle}>
194
172
  {items.map((item, index) =>
195
173
  item === SEPARATOR_ITEM ? (
196
- <SeparatorElement key={index} />
174
+ <RadixContextMenu.Separator key={index} className={styles.separatorStyle} />
197
175
  ) : (
198
176
  <ContextMenuItem
199
177
  key={item.value ?? index}
@@ -7,60 +7,77 @@ import React, {
7
7
  useImperativeHandle,
8
8
  useRef,
9
9
  } from "react";
10
- import styled from "styled-components";
11
10
  import { IconButton } from "./IconButton";
12
11
  import { Spacer } from "./Spacer";
12
+ import { cn } from "../utils/tailwind";
13
13
 
14
- const StyledOverlay = styled(DialogPrimitive.Overlay)({
15
- backgroundColor: "rgba(0,0,0,0.5)",
16
- position: "fixed",
17
- inset: 0,
18
- });
14
+ const StyledOverlay = forwardRef<
15
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
16
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
17
+ >(({ className, ...props }, ref) => (
18
+ <DialogPrimitive.Overlay
19
+ ref={ref}
20
+ className={cn("fixed inset-0 bg-[rgba(0,0,0,0.5)]", className)}
21
+ {...props}
22
+ />
23
+ ));
19
24
 
20
- const StyledContent = styled(DialogPrimitive.Content)(({ theme }) => ({
21
- boxShadow:
22
- "hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
23
- position: "fixed",
24
- top: "50%",
25
- left: "50%",
26
- transform: "translate(-50%, -50%)",
27
- width: "90vw",
28
- maxWidth: "450px",
29
- maxHeight: "85vh",
30
- padding: theme.sizes.dialog.padding,
31
- borderRadius: 2,
32
- ...theme.textStyles.small,
33
- backgroundColor: theme.colors.popover.background,
34
- overflowY: "auto",
35
- color: theme.colors.textMuted,
36
- "&:focus": { outline: "none" },
37
- pointerEvents: "all",
38
- zIndex: 1000,
39
- }));
25
+ const StyledContent = forwardRef<
26
+ React.ElementRef<typeof DialogPrimitive.Content>,
27
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
28
+ >(({ className, ...props }, ref) => (
29
+ <DialogPrimitive.Content
30
+ ref={ref}
31
+ className={`
32
+ fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
33
+ w-[90vw] max-w-[450px] max-h-[85vh] p-dialog-padding rounded-[2px]
34
+ font-sans text-heading5 font-normal leading-[19px] text-text-muted
35
+ bg-popover-background overflow-y-auto pointer-events-all z-[1000] focus:outline-none
36
+ shadow-[0_10px_38px_-10px_hsla(206,22%,7%,.35),0_10px_20px_-15px_hsla(206,22%,7%,.2)]
37
+ ${className}
38
+ `}
39
+ {...props}
40
+ />
41
+ ));
40
42
 
41
- const StyledTitle = styled(DialogPrimitive.Title)(({ theme }) => ({
42
- margin: 0,
43
- ...theme.textStyles.body,
44
- color: theme.colors.text,
45
- }));
43
+ const StyledTitle = forwardRef<
44
+ React.ElementRef<typeof DialogPrimitive.Title>,
45
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
46
+ >(({ className, ...props }, ref) => (
47
+ <DialogPrimitive.Title
48
+ ref={ref}
49
+ className={cn(
50
+ "m-0 font-sans text-base font-normal leading-[1.4] text-text",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ ));
46
56
 
47
- const StyledDescription = styled(DialogPrimitive.Description)(({ theme }) => ({
48
- margin: 0,
49
- ...theme.textStyles.small,
50
- color: theme.colors.textMuted,
51
- }));
57
+ const StyledDescription = forwardRef<
58
+ React.ElementRef<typeof DialogPrimitive.Description>,
59
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
60
+ >(({ className, ...props }, ref) => (
61
+ <DialogPrimitive.Description
62
+ ref={ref}
63
+ className={cn(
64
+ "m-0 font-sans text-heading5 font-normal leading-[19px] text-text-muted",
65
+ className
66
+ )}
67
+ {...props}
68
+ />
69
+ ));
52
70
 
53
- export const CloseButtonContainer = styled.div(({ theme }) => ({
54
- position: "absolute",
55
- top: theme.sizes.dialog.padding,
56
- right: theme.sizes.dialog.padding,
57
- zIndex: 1,
58
- backgroundColor: theme.colors.popover.background,
59
- padding: "4px 6px",
60
- borderRadius: "2px",
61
- // boxShadow: `0 0 2px rgba(0, 0, 0, 0.2)`,
62
- border: `1px solid rgba(128,128,128,0.2)`,
63
- }));
71
+ const CloseButtonContainer = forwardRef<
72
+ HTMLDivElement,
73
+ React.HTMLAttributes<HTMLDivElement>
74
+ >(({ className, ...props }, ref) => (
75
+ <div
76
+ ref={ref}
77
+ className={`absolute top-dialog-padding right-dialog-padding z-[1] bg-popover-background p-[4px_6px] rounded-[2px] border border-[rgba(128,128,128,0.2)] ${className}`}
78
+ {...props}
79
+ />
80
+ ));
64
81
 
65
82
  export interface IDialog {
66
83
  containsElement: (element: HTMLElement) => boolean;
@@ -97,7 +114,6 @@ export const Dialog = forwardRef(function Dialog(
97
114
  useImperativeHandle(forwardedRef, () => ({
98
115
  containsElement(element) {
99
116
  if (!contentRef.current) return false;
100
-
101
117
  return contentRef.current.contains(element);
102
118
  },
103
119
  }));
@@ -110,12 +126,8 @@ export const Dialog = forwardRef(function Dialog(
110
126
  onOpenAutoFocus={onOpenAutoFocus}
111
127
  style={style}
112
128
  {...(closeOnInteractOutside === false && {
113
- onPointerDownOutside: (event) => {
114
- event.preventDefault();
115
- },
116
- onInteractOutside: (event) => {
117
- event.preventDefault();
118
- },
129
+ onPointerDownOutside: (event) => event.preventDefault(),
130
+ onInteractOutside: (event) => event.preventDefault(),
119
131
  })}
120
132
  >
121
133
  <CloseButtonContainer>
@@ -1,64 +1,54 @@
1
1
  import React, { memo } from "react";
2
- import styled from "styled-components";
3
2
 
4
- /* ----------------------------------------------------------------------------
5
- * Divider
6
- * ------------------------------------------------------------------------- */
7
-
8
- type DividerVariant = "normal" | "strong" | "subtle";
9
-
10
- const DividerContainer = styled.div<
11
- DividerProps_ & {
12
- $orientation: "horizontal" | "vertical";
13
- }
14
- >(({ theme, $variant = "normal", $orientation, $overflow = 0 }) => ({
15
- ...($orientation === "horizontal"
16
- ? { height: "1px", minHeight: "1px", margin: `0px -${$overflow}px` }
17
- : { width: "1px", minWidth: "1px", margin: `-${$overflow}px 0px` }),
18
- background:
19
- $variant === "strong"
20
- ? theme.colors.dividerStrong
21
- : $variant === "subtle"
22
- ? theme.colors.dividerSubtle
23
- : theme.colors.divider,
24
- alignSelf: "stretch",
25
- }));
26
-
27
- interface DividerProps_ {
28
- $variant?: DividerVariant;
29
- $overflow?: number;
30
- }
3
+ type DividerVariant = "normal" | "subtle" | "strong";
31
4
 
32
5
  interface DividerProps {
33
6
  variant?: DividerVariant;
34
- overflow?: number;
7
+ overflow?: number | string;
8
+ className?: string;
9
+ style?: React.CSSProperties;
35
10
  }
36
11
 
37
12
  export const Divider = memo(function Divider({
38
- variant,
39
- overflow,
13
+ variant = "normal",
14
+ overflow = 0,
15
+ className,
16
+ style,
40
17
  ...props
41
18
  }: DividerProps) {
42
19
  return (
43
- <DividerContainer
44
- $orientation="horizontal"
45
- $variant={variant}
46
- $overflow={overflow}
20
+ <div
21
+ className={`
22
+ h-px min-h-px
23
+ ${variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider"}
24
+ self-stretch
25
+ ${className ?? ""}
26
+ `}
27
+ style={{
28
+ marginLeft: `-${overflow}px`,
29
+ marginRight: `-${overflow}px`,
30
+ ...style,
31
+ }}
47
32
  {...props}
48
33
  />
49
34
  );
50
35
  });
51
36
 
52
37
  export const DividerVertical = memo(function DividerVertical({
53
- variant,
54
- overflow,
38
+ variant = "normal",
39
+ overflow = 0,
40
+ className,
55
41
  ...props
56
42
  }: DividerProps) {
57
43
  return (
58
- <DividerContainer
59
- $orientation="vertical"
60
- $variant={variant}
61
- $overflow={overflow}
44
+ <div
45
+ className={`
46
+ w-px min-w-px
47
+ my-[-${overflow}px]
48
+ ${variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider"}
49
+ self-stretch
50
+ ${className ?? ""}
51
+ `}
62
52
  {...props}
63
53
  />
64
54
  );