@noya-app/noya-designsystem 0.1.25 → 0.1.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noya-app/noya-designsystem",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "@dnd-kit/core": "3.1.1",
14
14
  "@dnd-kit/modifiers": "3.0.0",
15
15
  "@dnd-kit/sortable": "4.0.0",
16
- "@noya-app/noya-colorpicker": "0.1.10",
16
+ "@noya-app/noya-colorpicker": "0.1.11",
17
17
  "@noya-app/noya-utils": "0.1.2",
18
18
  "@noya-app/noya-geometry": "0.1.4",
19
19
  "@noya-app/noya-icons": "0.1.4",
@@ -137,6 +137,12 @@ export const ButtonElement = styled.button<{
137
137
  boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
138
138
  fontSize: "12px",
139
139
  padding: "0px 4px",
140
+ "&:hover": {
141
+ opacity: 0.8,
142
+ },
143
+ "&:active": {
144
+ opacity: 0.9,
145
+ },
140
146
  }),
141
147
  display: "flex",
142
148
  alignItems: "center",
@@ -186,6 +192,7 @@ export interface ButtonRootProps {
186
192
  contentStyle?: CSSProperties;
187
193
  defaultBackground?: string;
188
194
  as?: React.ElementType;
195
+ htmlFor?: string;
189
196
  href?: string;
190
197
  target?: string;
191
198
  rel?: string;
@@ -24,9 +24,9 @@ const ChipElement = styled.span<{
24
24
 
25
25
  const backgroundColor =
26
26
  $colorScheme === "primary"
27
- ? "rgb(238, 229, 255)"
27
+ ? theme.colors.primaryPastel
28
28
  : $colorScheme === "secondary"
29
- ? "rgb(205, 238, 231)"
29
+ ? theme.colors.secondaryPastel
30
30
  : $colorScheme === "error"
31
31
  ? "rgb(255, 219, 219)"
32
32
  : theme.colors.inputBackground;
@@ -370,40 +370,46 @@ const InputFieldInput = forwardRef(function InputFieldInput(
370
370
  );
371
371
  });
372
372
 
373
- const InputFieldTypeahead = (props: { value: string }) => {
373
+ const InputFieldTypeahead = (props: { prefix: string; value: string }) => {
374
374
  const {
375
375
  labelPosition,
376
376
  labelSize,
377
377
  hasDropdown,
378
378
  hasLabel,
379
379
  size,
380
- onFocusChange,
380
+ // onFocusChange,
381
381
  } = useContext(InputFieldContext);
382
382
 
383
383
  return (
384
384
  <InputElement
385
+ as="span"
385
386
  $labelPosition={labelPosition}
386
387
  $labelSize={labelSize}
387
388
  $hasLabel={hasLabel}
388
389
  $hasDropdown={hasDropdown}
389
390
  $size={size}
390
- onFocusChange={onFocusChange}
391
- readOnly
392
- placeholder={props.value}
391
+ // onFocusChange={onFocusChange}
392
+ // readOnly
393
+ // placeholder={props.value}
393
394
  value=""
394
395
  style={{
395
396
  position: "absolute",
396
- top: -1,
397
+ top: 0,
397
398
  left: 0,
398
399
  right: 0,
399
- bottom: -1,
400
+ bottom: 0,
400
401
  width: "100%",
401
402
  height: "100%",
402
403
  pointerEvents: "none",
403
404
  background: "transparent",
404
405
  boxShadow: "none",
405
406
  }}
406
- />
407
+ >
408
+ <span style={{ opacity: 0 }}>{props.prefix}</span>
409
+ <span style={{ opacity: 0.5 }}>
410
+ {props.value.slice(props.prefix.length)}
411
+ </span>
412
+ </InputElement>
407
413
  );
408
414
  };
409
415
 
@@ -468,9 +468,11 @@ export const InputFieldWithCompletions = memo(
468
468
  aria-expanded={isFocused && display !== "none"}
469
469
  aria-controls="component-listbox"
470
470
  />
471
- {filter && typeaheadValue && typeaheadValue.startsWith(filter) && (
472
- <InputField.Typeahead value={typeaheadValue} />
473
- )}
471
+ {filter &&
472
+ typeaheadValue &&
473
+ typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && (
474
+ <InputField.Typeahead value={typeaheadValue} prefix={filter} />
475
+ )}
474
476
  {(!isFocused || !hideChildrenWhenFocused) && children}
475
477
  {loading && isFocused && (
476
478
  <InputField.Label>
@@ -31,7 +31,7 @@ export const Title = styled.div<{
31
31
  }
32
32
  : {
33
33
  ...theme.textStyles.label,
34
- color: theme.colors.textSubtle,
34
+ color: theme.colors.textMuted,
35
35
  fontWeight: "bold",
36
36
  }),
37
37
  }));
@@ -335,6 +335,7 @@ interface ListViewRowProps<MenuItemType extends string = string> {
335
335
  onMenuOpenChange?: (isOpen: boolean) => void;
336
336
  onKeyDown?: (event: React.KeyboardEvent) => void;
337
337
  style?: CSSProperties;
338
+ className?: string;
338
339
  dragIndicatorStyle?:
339
340
  | CSSProperties
340
341
  | ((props: {
@@ -369,6 +370,7 @@ const ListViewRow = forwardRef(function ListViewRow<
369
370
  onKeyDown,
370
371
  style,
371
372
  dragIndicatorStyle,
373
+ className,
372
374
  }: ListViewRowProps<MenuItemType>,
373
375
  forwardedRef: ForwardedRef<HTMLElement>
374
376
  ) {
@@ -465,6 +467,7 @@ const ListViewRow = forwardRef(function ListViewRow<
465
467
  { [pressEventName]: handlePress }
466
468
  )}
467
469
  tabIndex={tabIndex}
470
+ className={className}
468
471
  >
469
472
  {relativeDropPosition && (
470
473
  <ListViewDragIndicatorElement
@@ -24,6 +24,10 @@ const readOnlyStyle: CSSProperties = {
24
24
  textAlign: "left",
25
25
  };
26
26
 
27
+ const flexStyle: CSSProperties = {
28
+ flex: 1,
29
+ };
30
+
27
31
  export const SelectMenu = memo(function SelectMenu<T extends string = string>({
28
32
  id,
29
33
  style,
@@ -53,10 +57,10 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
53
57
  {icon && (
54
58
  <>
55
59
  {renderIcon(icon)}
56
- <Spacer.Horizontal size={8} />
60
+ <Spacer.Horizontal inline size={6} />
57
61
  </>
58
62
  )}
59
- {selectedItem?.title ?? value}
63
+ <span style={flexStyle}>{selectedItem?.title ?? value}</span>
60
64
  </Button>
61
65
  );
62
66
  }
@@ -68,11 +72,13 @@ export const SelectMenu = memo(function SelectMenu<T extends string = string>({
68
72
  {icon && (
69
73
  <>
70
74
  {renderIcon(icon)}
71
- <Spacer.Horizontal size={8} />
75
+ <Spacer.Horizontal inline size={6} />
72
76
  </>
73
77
  )}
74
- <Select.Value placeholder={placeholder} />
75
- <Spacer.Horizontal />
78
+ <span style={flexStyle}>
79
+ <Select.Value placeholder={placeholder} />
80
+ </span>
81
+ <Spacer.Horizontal inline size={6} />
76
82
  <DropdownChevronIcon />
77
83
  </Button>
78
84
  </Select.SelectTrigger>
@@ -55,6 +55,7 @@ interface Props extends StyleProps {
55
55
  as?: keyof ReactHTML;
56
56
  href?: string;
57
57
  className?: string;
58
+ style?: React.CSSProperties;
58
59
  variant: keyof Theme["textStyles"];
59
60
  breakpoints?: BreakpointCollection<StyleProps> | null | false;
60
61
  color?: ThemeColorName;
@@ -89,6 +90,7 @@ export const Text = forwardRef(function Text(
89
90
  tabIndex,
90
91
  onClick,
91
92
  onKeyDown,
93
+ style,
92
94
  ...rest
93
95
  }: Props,
94
96
  forwardedRef: ForwardedRef<HTMLElement>
@@ -100,6 +102,7 @@ export const Text = forwardRef(function Text(
100
102
  ref={forwardedRef}
101
103
  as={element}
102
104
  className={className}
105
+ style={style}
103
106
  tabIndex={tabIndex}
104
107
  $variant={variant}
105
108
  $breakpoints={breakpoints}
@@ -0,0 +1,82 @@
1
+ import { assignRef } from "@noya-app/react-utils";
2
+ import React, { forwardRef, memo, useCallback, useEffect, useRef } from "react";
3
+ import styled from "styled-components";
4
+
5
+ const TextAreaElement = styled.textarea(({ theme }) => ({
6
+ ...theme.textStyles.small,
7
+ color: theme.colors.text,
8
+ background: theme.colors.inputBackground,
9
+ width: "0px",
10
+ flex: "1 1 auto",
11
+ padding: "4px 6px",
12
+ border: "none",
13
+ outline: "none",
14
+ height: 100,
15
+ borderRadius: "4px",
16
+ "&::placeholder": {
17
+ color: theme.colors.textDisabled,
18
+ },
19
+ "&:focus": {
20
+ boxShadow: `0 0 0 2px ${theme.colors.primary}`,
21
+ },
22
+ // readonly
23
+ "&:read-only": {
24
+ color: theme.colors.textDisabled,
25
+ },
26
+ resize: "none",
27
+ }));
28
+
29
+ export const useAutoResize = (value: string) => {
30
+ const textareaRef = useRef<HTMLTextAreaElement | null>(null);
31
+
32
+ useEffect(() => {
33
+ if (!textareaRef.current) return;
34
+
35
+ textareaRef.current.style.height = "auto"; // Reset the height
36
+ textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
37
+ }, [value]);
38
+
39
+ return textareaRef;
40
+ };
41
+
42
+ export const AutoResizingTextArea = memo(
43
+ forwardRef(function AutoResizingTextArea(
44
+ {
45
+ value,
46
+ onChangeText,
47
+ ...rest
48
+ }: Omit<
49
+ React.ComponentProps<typeof TextAreaElement>,
50
+ "onChange" | "value"
51
+ > & {
52
+ onChangeText: (value: string) => void;
53
+ value?: string;
54
+ },
55
+ forwardedRef: React.ForwardedRef<HTMLTextAreaElement>
56
+ ) {
57
+ const ref = useAutoResize(value || rest.placeholder || "");
58
+
59
+ const handleChange = useCallback(
60
+ (event: React.ChangeEvent<HTMLTextAreaElement>) =>
61
+ onChangeText(event.target.value),
62
+ [onChangeText]
63
+ );
64
+
65
+ const handleRef = useCallback(
66
+ (value: HTMLTextAreaElement | null) => {
67
+ ref.current = value;
68
+ assignRef(forwardedRef, value);
69
+ },
70
+ [ref, forwardedRef]
71
+ );
72
+
73
+ return (
74
+ <TextAreaElement
75
+ ref={handleRef}
76
+ {...rest}
77
+ onChange={handleChange}
78
+ value={value}
79
+ />
80
+ );
81
+ })
82
+ );
package/src/index.tsx CHANGED
@@ -30,6 +30,7 @@ export * from "./components/GradientPicker";
30
30
  export * from "./components/Grid";
31
31
  export * from "./components/GridView";
32
32
  export * from "./components/IconButton";
33
+ export * from "./components/Icons";
33
34
  export * from "./components/InputField";
34
35
  export * from "./components/InputFieldWithCompletions";
35
36
  export * from "./components/InspectorContainer";
@@ -49,6 +50,7 @@ export * from "./components/Spacer";
49
50
  export * from "./components/Stack";
50
51
  export * from "./components/Switch";
51
52
  export * from "./components/Text";
53
+ export * from "./components/TextArea";
52
54
  export * from "./components/Toast";
53
55
  export * from "./components/Tooltip";
54
56
  export * from "./components/TreeView";
@@ -5,26 +5,29 @@ export const name: string = "light";
5
5
 
6
6
  export const colors = {
7
7
  logo: {
8
- fill: "rgb(175,175,175)",
9
- highlight: "rgb(175,175,175)",
8
+ fill: "rgb(150, 152, 172)",
9
+ highlight: "rgb(150, 152, 172)",
10
10
  },
11
+ background: "rgb(255,255,255)",
11
12
  text: "rgb(38, 48, 83)",
12
- textMuted: "rgb(85, 85, 85)",
13
- textSubtle: "rgb(121, 121, 121)",
14
- textDisabled: "rgb(160, 160, 160)",
13
+ textMuted: "rgb(107, 113, 136)",
14
+ textSubtle: "rgb(117, 121, 129)",
15
+ textDisabled: "rgb(150, 152, 172)",
15
16
  textDecorativeLight: "rgb(168, 185, 212)",
16
- dividerSubtle: "rgba(0, 0, 0, 0.04)",
17
- divider: "rgba(0, 0, 0, 0.07)",
18
- dividerStrong: "rgba(0, 0, 0, 0.09)",
19
- primary: "rgb(132, 63, 255)",
17
+ dividerSubtle: "rgba(30, 50, 100, 0.04)",
18
+ divider: "rgba(30, 50, 100, 0.07)",
19
+ dividerStrong: "rgba(30, 50, 100, 0.09)",
20
+ primary: "rgb(103, 70, 255)",
20
21
  primaryLight: "rgb(147, 86, 255)",
22
+ primaryPastel: "rgba(234, 230, 255)",
21
23
  secondary: "rgb(0, 151, 117)",
22
24
  secondaryLight: "rgb(0, 160, 129)",
25
+ secondaryPastel: "rgb(205, 238, 231)",
23
26
  secondaryBright: "#0ab557",
24
27
  warning: "rgb(251, 211, 0)",
25
28
  neutralBackground: "rgb(222,223,232)",
26
- inputBackground: "rgb(240, 240, 242)",
27
- inputBackgroundLight: "rgb(243, 243, 245)",
29
+ inputBackground: "rgb(240, 242, 246)",
30
+ inputBackgroundLight: "rgb(243, 245, 249)",
28
31
  codeBackground: "rgb(250, 250, 250)",
29
32
  codeBackgroundLight: "rgb(250, 250, 250)",
30
33
  get codeBackgroundDark() {
@@ -52,6 +55,7 @@ export const colors = {
52
55
  editingBackground: "#fff",
53
56
  },
54
57
  canvas: {
58
+ // background: "white",
55
59
  background: "rgb(249,249,249)",
56
60
  get selectionStroke() {
57
61
  return colors.primary;
@@ -62,8 +66,8 @@ export const colors = {
62
66
  grid: "rgba(0,0,0,0.05)",
63
67
  },
64
68
  sidebar: {
65
- background: "rgb(252,252,252)",
66
- backgroundTransparent: "rgba(252,252,252,0.85)",
69
+ background: "rgb(255,255,255)",
70
+ backgroundTransparent: "rgba(255,255,255,0.85)",
67
71
  },
68
72
  popover: {
69
73
  background: "rgb(252,252,252)",
@@ -76,7 +80,7 @@ export const colors = {
76
80
  radioGroup: {
77
81
  background: "white",
78
82
  },
79
- icon: "rgb(139, 139, 139)",
83
+ icon: "rgb(129, 131, 165)",
80
84
  iconSelected: "rgb(220, 220, 220)",
81
85
  mask: "rgb(12,193,67)",
82
86
  imageOverlay:
@@ -87,6 +91,12 @@ export const colors = {
87
91
  selection: "rgb(179,215,254)",
88
92
  thumbnailBackground: "#f0efff",
89
93
  thumbnailShadow: "#D3CEED66",
94
+ inlineCode: {
95
+ text: "rgb(103, 70, 255)",
96
+ background: "rgb(240, 242, 246)",
97
+ },
98
+ textLink: "rgb(103, 70, 255)",
99
+ textLinkFocused: "rgb(147, 86, 255)",
90
100
  };
91
101
 
92
102
  export const fonts = {
@@ -122,41 +132,41 @@ export const textStyles = {
122
132
  heading1: {
123
133
  fontFamily: fonts.normal,
124
134
  fontSize: `${typeScale[2]}rem`,
125
- fontWeight: 500,
126
- lineHeight: "1.75",
135
+ fontWeight: 600,
136
+ lineHeight: "1.6",
127
137
  letterSpacing: "-0.025em",
128
138
  } as CSSObject,
129
139
  heading2: {
130
140
  fontFamily: fonts.normal,
131
141
  fontSize: `${typeScale[3]}rem`,
132
142
  fontWeight: 500,
133
- lineHeight: "1.75",
143
+ lineHeight: "1.5",
134
144
  letterSpacing: "-0.025em",
135
145
  } as CSSObject,
136
146
  heading3: {
137
147
  fontFamily: fonts.normal,
138
148
  fontSize: `${typeScale[4]}rem`,
139
- fontWeight: 500,
140
- lineHeight: "1.75",
149
+ fontWeight: 400,
150
+ lineHeight: "1.4",
141
151
  letterSpacing: "-0.025em",
142
152
  } as CSSObject,
143
153
  heading4: {
144
154
  fontFamily: fonts.normal,
145
155
  fontSize: `${typeScale[5]}rem`,
146
156
  fontWeight: 500,
147
- lineHeight: "1.75",
157
+ lineHeight: "1.4",
148
158
  } as CSSObject,
149
159
  heading5: {
150
160
  fontFamily: fonts.normal,
151
161
  fontSize: `${typeScale[6]}rem`,
152
162
  fontWeight: 500,
153
- lineHeight: "1.75",
163
+ lineHeight: "1.4",
154
164
  } as CSSObject,
155
165
  body: {
156
166
  fontFamily: fonts.normal,
157
167
  fontSize: `${typeScale[5]}rem`,
158
168
  fontWeight: 400,
159
- lineHeight: "1.75",
169
+ lineHeight: "1.4",
160
170
  } as CSSObject,
161
171
  small: {
162
172
  fontFamily: fonts.normal,
@@ -189,6 +199,9 @@ export const textStyles = {
189
199
  };
190
200
 
191
201
  export const sizes = {
202
+ inset: {
203
+ top: 46,
204
+ },
192
205
  sidebarWidth: 260,
193
206
  toolbar: {
194
207
  height: 46,