@noya-app/noya-designsystem 0.1.37 → 0.1.38
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 +10 -10
- package/CHANGELOG.md +6 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +343 -23
- package/dist/index.d.ts +343 -23
- package/dist/index.js +396 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +400 -129
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Checkbox.tsx +2 -0
- package/src/components/Chip.tsx +15 -8
- package/src/components/DraggableMenuButton.tsx +3 -2
- package/src/components/FillPreviewBackground.tsx +10 -9
- package/src/components/FloatingWindow.tsx +5 -6
- package/src/components/IconButton.tsx +5 -1
- package/src/components/InputField.tsx +95 -68
- package/src/components/InspectorContainer.tsx +2 -2
- package/src/components/InspectorPrimitives.tsx +19 -9
- package/src/components/Label.tsx +1 -1
- package/src/components/ListView.tsx +19 -32
- package/src/components/RadioGroup.tsx +1 -1
- package/src/components/SelectMenu.tsx +3 -3
- package/src/components/Switch.tsx +1 -1
- package/src/components/Text.tsx +20 -7
- package/src/components/TextArea.tsx +1 -1
- package/src/components/Tooltip.tsx +1 -1
- package/src/components/WorkspaceLayout.tsx +4 -3
- package/src/components/internal/TextInput.tsx +1 -0
- package/src/index.css +12 -2
- package/src/index.tsx +0 -1
- package/src/theme/index.ts +6 -3
- package/src/theme/themeUtils.ts +72 -0
- package/src/utils/tailwind.ts +4 -12
- package/tailwind.config.ts +16 -3
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@ export const Button = forwardRef(function Button(
|
|
|
85
85
|
<Component
|
|
86
86
|
ref={forwardedRef}
|
|
87
87
|
id={id}
|
|
88
|
-
className={`no-underline leading-[1] relative border-0 outline-none select-none text-left rounded flex items-center justify-center [&>*]:pointer-events-none [-webkit-app-region:no-drag] focus:ring-2 focus:ring-primary focus:
|
|
88
|
+
className={`no-underline leading-[1] relative border-0 outline-none select-none text-left rounded flex items-center justify-center [&>*]:pointer-events-none [-webkit-app-region:no-drag] focus:ring-2 focus:ring-primary focus:shadow-[0_0_0_1px_var(--popover-background)_inset] ${disabled ? "opacity-25" : ""} ${!className?.includes("flex") ? "flex-none" : ""} ${
|
|
89
89
|
active
|
|
90
90
|
? "bg-primary text-white hover:bg-primary-light active:bg-primary"
|
|
91
91
|
: variantStyles[variant]
|
|
@@ -38,6 +38,7 @@ export const Checkbox = memo(
|
|
|
38
38
|
focus:ring-2
|
|
39
39
|
focus:ring-primary
|
|
40
40
|
focus:ring-offset-1
|
|
41
|
+
focus:z-interactable
|
|
41
42
|
`}
|
|
42
43
|
style={{
|
|
43
44
|
width: "27px",
|
|
@@ -55,6 +56,7 @@ export const Checkbox = memo(
|
|
|
55
56
|
stroke-white
|
|
56
57
|
opacity-0
|
|
57
58
|
peer-checked:opacity-100
|
|
59
|
+
z-label
|
|
58
60
|
`}
|
|
59
61
|
style={{
|
|
60
62
|
strokeWidth: "1.3",
|
package/src/components/Chip.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Cross1Icon, PlusIcon } from "@noya-app/noya-icons";
|
|
2
2
|
import React, { forwardRef, memo } from "react";
|
|
3
3
|
import { useHover } from "../hooks/useHover";
|
|
4
|
+
import { cssVars } from "../theme";
|
|
4
5
|
|
|
5
6
|
type ChipColorScheme = "primary" | "secondary" | "error";
|
|
6
7
|
type ChipSize = "small" | "medium" | "large";
|
|
@@ -36,6 +37,12 @@ function getChipStyles({
|
|
|
36
37
|
|
|
37
38
|
// Font family
|
|
38
39
|
const fontStyles = $monospace ? "font-mono" : "";
|
|
40
|
+
const shadowStyles = {
|
|
41
|
+
primary: "shadow-[0_0_0_1px_var(--chip-primary-shadow)_inset]",
|
|
42
|
+
secondary: "shadow-[0_0_0_1px_var(--chip-secondary-shadow)_inset]",
|
|
43
|
+
error: "shadow-[0_0_0_1px_var(--chip-error-shadow)_inset]",
|
|
44
|
+
default: "shadow-[0_0_0_1px_var(--chip-default-shadow)_inset]",
|
|
45
|
+
};
|
|
39
46
|
|
|
40
47
|
// Color and background based on scheme and variant
|
|
41
48
|
const variantStyles = (() => {
|
|
@@ -43,22 +50,22 @@ function getChipStyles({
|
|
|
43
50
|
primary: {
|
|
44
51
|
text: "text-primary",
|
|
45
52
|
bg: "bg-primary-pastel",
|
|
46
|
-
subtle: "bg-[
|
|
53
|
+
subtle: "bg-[var(--chip-primary-bg)]",
|
|
47
54
|
},
|
|
48
55
|
secondary: {
|
|
49
56
|
text: "text-secondary",
|
|
50
57
|
bg: "bg-secondary-pastel",
|
|
51
|
-
subtle: "bg-[
|
|
58
|
+
subtle: "bg-[var(--chip-secondary-bg)]",
|
|
52
59
|
},
|
|
53
60
|
error: {
|
|
54
61
|
text: "text-text",
|
|
55
62
|
bg: "bg-[rgb(255,219,219)]",
|
|
56
|
-
subtle: "bg-[
|
|
63
|
+
subtle: "bg-[var(--chip-error-bg)]",
|
|
57
64
|
},
|
|
58
65
|
default: {
|
|
59
66
|
text: "text-text",
|
|
60
67
|
bg: "bg-input-background",
|
|
61
|
-
subtle: "bg-[
|
|
68
|
+
subtle: "bg-[var(--chip-default-bg)]",
|
|
62
69
|
},
|
|
63
70
|
}[$colorScheme ?? "default"];
|
|
64
71
|
|
|
@@ -68,7 +75,7 @@ function getChipStyles({
|
|
|
68
75
|
if ($variant === "outlined") {
|
|
69
76
|
return `
|
|
70
77
|
${colors.text} bg-transparent
|
|
71
|
-
|
|
78
|
+
${shadowStyles[$colorScheme ?? "default"]}
|
|
72
79
|
hover:${colors.subtle} hover:shadow-none
|
|
73
80
|
`;
|
|
74
81
|
}
|
|
@@ -158,10 +165,10 @@ export const Chip = memo(
|
|
|
158
165
|
|
|
159
166
|
const color =
|
|
160
167
|
colorScheme === "primary"
|
|
161
|
-
?
|
|
168
|
+
? cssVars.colors.primary
|
|
162
169
|
: colorScheme === "secondary"
|
|
163
|
-
?
|
|
164
|
-
:
|
|
170
|
+
? cssVars.colors.secondary
|
|
171
|
+
: cssVars.colors.text;
|
|
165
172
|
|
|
166
173
|
return (
|
|
167
174
|
<span
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DragHandleDots2Icon } from "@noya-app/noya-icons";
|
|
2
2
|
import React, { forwardRef, memo, useCallback, useState } from "react";
|
|
3
|
+
import { cssVars } from "../theme";
|
|
3
4
|
import { cn } from "../utils/tailwind";
|
|
4
5
|
import { DropdownMenu } from "./DropdownMenu";
|
|
5
6
|
import { MenuItem } from "./internal/Menu";
|
|
@@ -107,13 +108,13 @@ export const DraggableMenuButton = memo(function DraggableMenuButton<
|
|
|
107
108
|
>
|
|
108
109
|
<Trigger>
|
|
109
110
|
<DragHandleDots2Icon
|
|
110
|
-
color={isVisible || open ?
|
|
111
|
+
color={isVisible || open ? cssVars.colors.icon : "transparent"}
|
|
111
112
|
/>
|
|
112
113
|
</Trigger>
|
|
113
114
|
</DropdownMenu>
|
|
114
115
|
) : (
|
|
115
116
|
<DragHandleDots2Icon
|
|
116
|
-
color={isVisible || open ?
|
|
117
|
+
color={isVisible || open ? cssVars.colors.icon : "transparent"}
|
|
117
118
|
/>
|
|
118
119
|
)}
|
|
119
120
|
</DotButton>
|
|
@@ -3,6 +3,7 @@ import { Sketch } from "@noya-app/noya-file-format";
|
|
|
3
3
|
import React, { memo, useMemo } from "react";
|
|
4
4
|
import { useImageData } from "../contexts/ImageDataContext";
|
|
5
5
|
import { useObjectURL } from "../hooks/useObjectURL";
|
|
6
|
+
import { cssVars } from "../theme";
|
|
6
7
|
import { getGradientBackground } from "../utils/getGradientBackground";
|
|
7
8
|
import { sketchColorToRgbaString } from "../utils/sketchColor";
|
|
8
9
|
import { SketchPattern } from "../utils/sketchPattern";
|
|
@@ -14,7 +15,11 @@ const dotsHorizontalSvg = (fillColor: string) => `
|
|
|
14
15
|
</svg>
|
|
15
16
|
`;
|
|
16
17
|
|
|
17
|
-
const Background = memo(function Background({
|
|
18
|
+
const Background = memo(function Background({
|
|
19
|
+
background,
|
|
20
|
+
}: {
|
|
21
|
+
background?: string;
|
|
22
|
+
}) {
|
|
18
23
|
return (
|
|
19
24
|
<span
|
|
20
25
|
className={cn(
|
|
@@ -97,17 +102,13 @@ interface Props {
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
const background = `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
cssVars.colors.placeholderDots
|
|
106
|
+
)}") no-repeat`;
|
|
107
|
+
|
|
103
108
|
export const FillPreviewBackground = memo(function FillPreviewBackground({
|
|
104
109
|
value,
|
|
105
110
|
}: Props) {
|
|
106
|
-
if (!value) return
|
|
107
|
-
<Background
|
|
108
|
-
background={background}
|
|
109
|
-
/>
|
|
110
|
-
);
|
|
111
|
+
if (!value) return <Background background={background} />;
|
|
111
112
|
|
|
112
113
|
switch (value._class) {
|
|
113
114
|
case "color":
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
cssVars,
|
|
2
3
|
Divider,
|
|
3
4
|
IconButton,
|
|
4
5
|
Small,
|
|
@@ -124,9 +125,7 @@ function defaultRenderToolbar({
|
|
|
124
125
|
}) {
|
|
125
126
|
return (
|
|
126
127
|
<>
|
|
127
|
-
<Small className="flex-1 font-medium text-text">
|
|
128
|
-
{title}
|
|
129
|
-
</Small>
|
|
128
|
+
<Small className="flex-1 font-medium text-text">{title}</Small>
|
|
130
129
|
{toolbarContent}
|
|
131
130
|
<IconButton
|
|
132
131
|
iconName="Cross3Icon"
|
|
@@ -285,14 +284,14 @@ export const FloatingWindow: React.FC<FloatingWindowProps> = ({
|
|
|
285
284
|
left: position.x,
|
|
286
285
|
width: size.width,
|
|
287
286
|
height: size.height,
|
|
288
|
-
outline: `1px solid
|
|
289
|
-
backgroundColor:
|
|
287
|
+
outline: `1px solid ${cssVars.colors.divider}`,
|
|
288
|
+
backgroundColor: cssVars.colors.canvasBackground,
|
|
290
289
|
}}
|
|
291
290
|
>
|
|
292
291
|
<div
|
|
293
292
|
style={{
|
|
294
293
|
...styles.toolbar,
|
|
295
|
-
backgroundColor:
|
|
294
|
+
backgroundColor: cssVars.colors.sidebarBackground,
|
|
296
295
|
}}
|
|
297
296
|
onMouseDown={handleMouseDown}
|
|
298
297
|
>
|
|
@@ -5,6 +5,7 @@ import React, {
|
|
|
5
5
|
memo,
|
|
6
6
|
useMemo,
|
|
7
7
|
} from "react";
|
|
8
|
+
import { cssVars } from "../theme";
|
|
8
9
|
import { Button, ButtonRootProps } from "./Button";
|
|
9
10
|
import { IconName, Icons } from "./Icons";
|
|
10
11
|
|
|
@@ -35,7 +36,10 @@ export const IconButton = memo(
|
|
|
35
36
|
return (
|
|
36
37
|
<Button ref={forwardedRef} {...props} variant="none" contentStyle={style}>
|
|
37
38
|
<Icon
|
|
38
|
-
color={
|
|
39
|
+
color={
|
|
40
|
+
color ??
|
|
41
|
+
(selected ? cssVars.colors.iconSelected : cssVars.colors.icon)
|
|
42
|
+
}
|
|
39
43
|
{...(size && { width: size, height: size })}
|
|
40
44
|
/>
|
|
41
45
|
</Button>
|
|
@@ -7,11 +7,13 @@ import React, {
|
|
|
7
7
|
ForwardedRef,
|
|
8
8
|
forwardRef,
|
|
9
9
|
isValidElement,
|
|
10
|
+
LabelHTMLAttributes,
|
|
10
11
|
memo,
|
|
11
12
|
ReactNode,
|
|
12
13
|
useCallback,
|
|
13
14
|
useContext,
|
|
14
15
|
useEffect,
|
|
16
|
+
useId,
|
|
15
17
|
useLayoutEffect,
|
|
16
18
|
useMemo,
|
|
17
19
|
useRef,
|
|
@@ -41,6 +43,7 @@ type InputFieldContextValue = {
|
|
|
41
43
|
setInputRef?: (ref: ForwardedRef<HTMLInputElement>) => void;
|
|
42
44
|
setLabelWidth?: (width: number) => void;
|
|
43
45
|
setButtonWidth?: (width: number) => void;
|
|
46
|
+
id?: string;
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
const InputFieldContext = createContext<InputFieldContextValue>({
|
|
@@ -57,63 +60,77 @@ const InputFieldContext = createContext<InputFieldContextValue>({
|
|
|
57
60
|
* Label
|
|
58
61
|
* ------------------------------------------------------------------------- */
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
$labelPosition: LabelPosition;
|
|
65
|
-
$hasDropdown: boolean;
|
|
66
|
-
$size: InputFieldSize;
|
|
67
|
-
className?: string;
|
|
68
|
-
children?: React.ReactNode;
|
|
69
|
-
style?: React.CSSProperties;
|
|
70
|
-
}
|
|
71
|
-
>(
|
|
72
|
-
(
|
|
73
|
-
{ pointerEvents, $labelPosition, $hasDropdown, $size, className, style, ...props },
|
|
74
|
-
ref
|
|
75
|
-
) => {
|
|
76
|
-
const memoizedStyles = useMemo(() => ({
|
|
77
|
-
left: $labelPosition === "start" ? $size === "large" ? "6px" : $size === "medium" ? "2px" : "0px" : "",
|
|
78
|
-
right: $labelPosition === "end" ? $size === "large" ? "6px" : $size === "medium" ? "2px" : "0px" : "",
|
|
79
|
-
}), [$labelPosition, $size])
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<label
|
|
83
|
-
ref={ref}
|
|
84
|
-
className={`absolute top-0 bottom-0 flex items-center font-sans text-label font-bold uppercase text-text-disabled select-none ${
|
|
85
|
-
$labelPosition === "start"
|
|
86
|
-
? `justify-start pl-[6px]`
|
|
87
|
-
: $labelPosition === "end"
|
|
88
|
-
? `justify-end ${$hasDropdown ? "pr-[16px]" : "pr-[6px]"}`
|
|
89
|
-
: ""
|
|
90
|
-
} ${pointerEvents === "none" ? "pointer-events-none" : ""} ${className ?? ""}`}
|
|
91
|
-
style={{...memoizedStyles, ...style}}
|
|
92
|
-
{...props}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
interface InputFieldLabelProps {
|
|
99
|
-
children?: ReactNode;
|
|
100
|
-
pointerEvents?: Property.PointerEvents;
|
|
101
|
-
style?: React.CSSProperties;
|
|
63
|
+
interface LabelContainerProps {
|
|
64
|
+
labelPosition: LabelPosition;
|
|
65
|
+
hasDropdown: boolean;
|
|
66
|
+
size: InputFieldSize;
|
|
102
67
|
className?: string;
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
htmlFor?: string;
|
|
103
71
|
}
|
|
104
72
|
|
|
105
|
-
|
|
73
|
+
const LabelContainer = forwardRef(function LabelContainer(
|
|
74
|
+
{
|
|
75
|
+
labelPosition: $labelPosition,
|
|
76
|
+
hasDropdown: $hasDropdown,
|
|
77
|
+
size: $size,
|
|
78
|
+
className,
|
|
79
|
+
style,
|
|
80
|
+
...props
|
|
81
|
+
}: LabelContainerProps,
|
|
82
|
+
ref: ForwardedRef<HTMLLabelElement>
|
|
83
|
+
) {
|
|
84
|
+
const memoizedStyles = useMemo(
|
|
85
|
+
() => ({
|
|
86
|
+
left:
|
|
87
|
+
$labelPosition === "start"
|
|
88
|
+
? $size === "large"
|
|
89
|
+
? "6px"
|
|
90
|
+
: $size === "medium"
|
|
91
|
+
? "2px"
|
|
92
|
+
: "0px"
|
|
93
|
+
: "",
|
|
94
|
+
right:
|
|
95
|
+
$labelPosition === "end"
|
|
96
|
+
? $size === "large"
|
|
97
|
+
? "6px"
|
|
98
|
+
: $size === "medium"
|
|
99
|
+
? "2px"
|
|
100
|
+
: "0px"
|
|
101
|
+
: "",
|
|
102
|
+
...style,
|
|
103
|
+
}),
|
|
104
|
+
[$labelPosition, $size, style]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<label
|
|
109
|
+
ref={ref}
|
|
110
|
+
className={`absolute top-0 bottom-0 flex items-center font-sans text-label font-bold uppercase text-text-disabled select-none z-label pointer-events-none ${
|
|
111
|
+
$labelPosition === "start"
|
|
112
|
+
? `justify-start pl-[6px]`
|
|
113
|
+
: $labelPosition === "end"
|
|
114
|
+
? `justify-end ${$hasDropdown ? "pr-[16px]" : "pr-[6px]"}`
|
|
115
|
+
: ""
|
|
116
|
+
} ${className ?? ""}`}
|
|
117
|
+
style={memoizedStyles}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Inserts a Label at the start or end of the input given a `labelPosition`on InputField.Root.
|
|
125
|
+
*
|
|
126
|
+
* Should not be used with an InputField.Button.
|
|
127
|
+
*/
|
|
106
128
|
const InputFieldLabel = memo(
|
|
107
129
|
forwardRef(function InputFieldLabel(
|
|
108
|
-
|
|
109
|
-
children = false,
|
|
110
|
-
pointerEvents = "none",
|
|
111
|
-
style,
|
|
112
|
-
className,
|
|
113
|
-
}: InputFieldLabelProps,
|
|
130
|
+
props: LabelHTMLAttributes<HTMLLabelElement>,
|
|
114
131
|
forwardedRef: ForwardedRef<HTMLLabelElement>
|
|
115
132
|
) {
|
|
116
|
-
const { labelPosition, hasDropdown, setLabelWidth, size } =
|
|
133
|
+
const { labelPosition, hasDropdown, setLabelWidth, size, id } =
|
|
117
134
|
useContext(InputFieldContext);
|
|
118
135
|
|
|
119
136
|
const ref = useRef<HTMLLabelElement | null>(null);
|
|
@@ -130,19 +147,16 @@ const InputFieldLabel = memo(
|
|
|
130
147
|
|
|
131
148
|
return (
|
|
132
149
|
<LabelContainer
|
|
133
|
-
$size={size}
|
|
134
150
|
ref={(element) => {
|
|
135
151
|
ref.current = element;
|
|
136
152
|
assignRef(forwardedRef, element);
|
|
137
153
|
}}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{children}
|
|
145
|
-
</LabelContainer>
|
|
154
|
+
size={size}
|
|
155
|
+
labelPosition={labelPosition}
|
|
156
|
+
hasDropdown={hasDropdown}
|
|
157
|
+
htmlFor={id}
|
|
158
|
+
{...props}
|
|
159
|
+
/>
|
|
146
160
|
);
|
|
147
161
|
})
|
|
148
162
|
);
|
|
@@ -210,9 +224,15 @@ const ButtonContainer = forwardRef<
|
|
|
210
224
|
>(({ $size, className, ...props }, ref) => (
|
|
211
225
|
<span
|
|
212
226
|
ref={ref}
|
|
213
|
-
className={`absolute ${
|
|
214
|
-
$size === "
|
|
215
|
-
|
|
227
|
+
className={`absolute ${
|
|
228
|
+
$size === "large"
|
|
229
|
+
? "right-[9px] top-[10px]"
|
|
230
|
+
: $size === "medium"
|
|
231
|
+
? "right-[4px] top-[4px]"
|
|
232
|
+
: $size === "small"
|
|
233
|
+
? "right-[2px] top-[2px]"
|
|
234
|
+
: ""
|
|
235
|
+
} ${className ?? ""}`}
|
|
216
236
|
{...props}
|
|
217
237
|
/>
|
|
218
238
|
));
|
|
@@ -337,17 +357,20 @@ const InputElement = forwardRef(
|
|
|
337
357
|
($labelSize && $labelPosition === "end" ? 6 + $labelSize : 0) +
|
|
338
358
|
($hasDropdown ? 11 : 0);
|
|
339
359
|
|
|
340
|
-
|
|
360
|
+
const memoizedStyles = useMemo(
|
|
361
|
+
() => ({
|
|
341
362
|
paddingLeft: `${paddingLeft}px`,
|
|
342
363
|
paddingRight: `${paddingRight}px`,
|
|
343
|
-
}),
|
|
364
|
+
}),
|
|
365
|
+
[paddingLeft, paddingRight]
|
|
366
|
+
);
|
|
344
367
|
|
|
345
368
|
return (
|
|
346
369
|
<TextInput
|
|
347
370
|
value={value ?? ""}
|
|
348
371
|
onSubmit={onSubmit ?? (() => {})}
|
|
349
372
|
ref={ref}
|
|
350
|
-
className={`flex w-0 flex-[1_1_0px] relative border-0 outline-none min-w-0 self-stretch rounded bg-input-background focus:ring-2 focus:ring-primary
|
|
373
|
+
className={`flex w-0 flex-[1_1_0px] relative border-0 outline-none min-w-0 self-stretch rounded bg-input-background focus:ring-2 focus:ring-primary placeholder:text-text-disabled ${readOnly ? "text-text-muted" : disabled ? "text-text-disabled" : "text-text"} font-sans font-normal ${$textAlign && `text-${$textAlign}`} ${
|
|
351
374
|
$size === "small"
|
|
352
375
|
? "text-[11px] leading-[19px] py-[1px]"
|
|
353
376
|
: $size === "large"
|
|
@@ -382,6 +405,7 @@ const InputFieldInput = forwardRef(function InputFieldInput(
|
|
|
382
405
|
size,
|
|
383
406
|
onFocusChange,
|
|
384
407
|
setInputRef,
|
|
408
|
+
id,
|
|
385
409
|
} = useContext(InputFieldContext);
|
|
386
410
|
|
|
387
411
|
const handleFocusChange = useCallback(
|
|
@@ -405,6 +429,7 @@ const InputFieldInput = forwardRef(function InputFieldInput(
|
|
|
405
429
|
$variant={variant}
|
|
406
430
|
$textAlign={textAlign}
|
|
407
431
|
onFocusChange={handleFocusChange}
|
|
432
|
+
id={id}
|
|
408
433
|
{...rest}
|
|
409
434
|
/>
|
|
410
435
|
);
|
|
@@ -562,7 +587,6 @@ const RootContainer = forwardRef<
|
|
|
562
587
|
$flex?: string;
|
|
563
588
|
className?: string;
|
|
564
589
|
children?: React.ReactNode;
|
|
565
|
-
id?: string;
|
|
566
590
|
style?: React.CSSProperties;
|
|
567
591
|
}
|
|
568
592
|
>(({ $width, $flex, className, ...props }, ref) => (
|
|
@@ -604,6 +628,7 @@ function InputFieldRoot({
|
|
|
604
628
|
className,
|
|
605
629
|
}: InputFieldRootProps) {
|
|
606
630
|
const childrenArray = Children.toArray(children);
|
|
631
|
+
const randomId = useId();
|
|
607
632
|
|
|
608
633
|
const hasDropdown = childrenArray.some(
|
|
609
634
|
(child) => isValidElement(child) && child.type === InputFieldDropdownMenu
|
|
@@ -648,6 +673,7 @@ function InputFieldRoot({
|
|
|
648
673
|
setInputRef,
|
|
649
674
|
setLabelWidth: setMeasuredLabelSize,
|
|
650
675
|
setButtonWidth: setMeasuredButtonSize,
|
|
676
|
+
id: id ?? randomId,
|
|
651
677
|
}),
|
|
652
678
|
[
|
|
653
679
|
labelPosition,
|
|
@@ -659,12 +685,13 @@ function InputFieldRoot({
|
|
|
659
685
|
isFocused,
|
|
660
686
|
handleFocusChange,
|
|
661
687
|
inputRef,
|
|
688
|
+
id,
|
|
689
|
+
randomId,
|
|
662
690
|
]
|
|
663
691
|
);
|
|
664
692
|
|
|
665
693
|
const rootElement = (
|
|
666
694
|
<RootContainer
|
|
667
|
-
id={id}
|
|
668
695
|
$width={width}
|
|
669
696
|
$flex={flex}
|
|
670
697
|
style={style}
|
|
@@ -717,7 +744,7 @@ const PrimitiveInputField = ({
|
|
|
717
744
|
HTMLInputElement
|
|
718
745
|
>) => (
|
|
719
746
|
<input
|
|
720
|
-
className={`flex w-0 flex-1 relative border-none outline-none min-w-0 self-stretch rounded py-1 px-1.5 bg-input-background select-all pointer-events-[all] focus:ring-2 focus:ring-primary
|
|
747
|
+
className={`flex w-0 flex-1 relative border-none outline-none min-w-0 self-stretch rounded py-1 px-1.5 bg-input-background select-all pointer-events-[all] focus:ring-2 focus:ring-primary font-sans font-normal text-heading5 placeholder:text-text-disabled focus:z-interactable ${
|
|
721
748
|
readOnly
|
|
722
749
|
? "text-text-muted"
|
|
723
750
|
: disabled
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
cssVars,
|
|
2
3
|
Divider,
|
|
3
4
|
ScrollArea,
|
|
4
5
|
withSeparatorElements,
|
|
@@ -26,7 +27,6 @@ export const InspectorContainer = memo(
|
|
|
26
27
|
},
|
|
27
28
|
forwardedRef: React.ForwardedRef<HTMLDivElement>
|
|
28
29
|
) {
|
|
29
|
-
|
|
30
30
|
return (
|
|
31
31
|
<div
|
|
32
32
|
ref={forwardedRef}
|
|
@@ -36,7 +36,7 @@ export const InspectorContainer = memo(
|
|
|
36
36
|
display: "flex",
|
|
37
37
|
flexDirection: "column",
|
|
38
38
|
position: "relative",
|
|
39
|
-
background:
|
|
39
|
+
background: cssVars.colors.sidebarBackground,
|
|
40
40
|
...style,
|
|
41
41
|
}}
|
|
42
42
|
>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ForwardedRef,
|
|
3
|
+
forwardRef,
|
|
4
|
+
LabelHTMLAttributes,
|
|
5
|
+
memo,
|
|
6
|
+
ReactNode,
|
|
7
|
+
} from "react";
|
|
2
8
|
import { cn } from "../utils/tailwind";
|
|
3
9
|
import { Spacer } from "./Spacer";
|
|
4
10
|
import { textStyles } from "./Text";
|
|
@@ -65,7 +71,7 @@ export const Checkbox = forwardRef<
|
|
|
65
71
|
<input
|
|
66
72
|
ref={ref}
|
|
67
73
|
type="checkbox"
|
|
68
|
-
className={cn("m-0", className)}
|
|
74
|
+
className={cn("m-0 focus:z-interactable", className)}
|
|
69
75
|
{...props}
|
|
70
76
|
/>
|
|
71
77
|
));
|
|
@@ -100,16 +106,20 @@ export const HorizontalSeparator = () => (
|
|
|
100
106
|
// />
|
|
101
107
|
// ));
|
|
102
108
|
|
|
103
|
-
export const RowLabel = forwardRef
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
export const RowLabel = forwardRef(function RowLabel(
|
|
110
|
+
{
|
|
111
|
+
className,
|
|
112
|
+
$textStyle,
|
|
113
|
+
...props
|
|
114
|
+
}: LabelHTMLAttributes<HTMLLabelElement> & {
|
|
106
115
|
$textStyle?: TitleTextStyle | "label";
|
|
107
|
-
}
|
|
108
|
-
|
|
116
|
+
},
|
|
117
|
+
ref: ForwardedRef<HTMLLabelElement>
|
|
118
|
+
) {
|
|
109
119
|
return (
|
|
110
|
-
<
|
|
120
|
+
<label
|
|
111
121
|
ref={ref}
|
|
112
|
-
className={`font-sans text-label uppercase flex items-center leading-[19px] font-bold text-text-subtle ${$textStyle
|
|
122
|
+
className={`font-sans text-label uppercase flex items-center leading-[19px] font-bold text-text-subtle z-label ${$textStyle ? textStyles[$textStyle] : ""} ${className ?? ""}`}
|
|
113
123
|
{...props}
|
|
114
124
|
/>
|
|
115
125
|
);
|
package/src/components/Label.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export const Label = memo(
|
|
|
10
10
|
return (
|
|
11
11
|
<label
|
|
12
12
|
ref={ref}
|
|
13
|
-
className={`font-sans text-label uppercase flex items-center leading-[19px] select-none font-bold text-text-muted ${className ?? ""}`}
|
|
13
|
+
className={`font-sans text-label uppercase flex items-center leading-[19px] select-none font-bold text-text-muted z-label ${className ?? ""}`}
|
|
14
14
|
{...props}
|
|
15
15
|
/>
|
|
16
16
|
);
|