@noya-app/noya-designsystem 0.1.47 → 0.1.49

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 (55) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +18 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.mts +389 -241
  5. package/dist/index.d.ts +389 -241
  6. package/dist/index.js +4802 -3990
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +4715 -3915
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +7 -7
  11. package/src/__tests__/validateDropIndicator.test.ts +263 -0
  12. package/src/components/ActionMenu.tsx +51 -0
  13. package/src/components/ActivityIndicator.tsx +7 -1
  14. package/src/components/BaseToolbar.tsx +2 -2
  15. package/src/components/Checkbox.tsx +2 -2
  16. package/src/components/Chip.tsx +7 -6
  17. package/src/components/Collection.tsx +30 -2
  18. package/src/components/Combobox.tsx +27 -15
  19. package/src/components/ComboboxMenu.tsx +15 -6
  20. package/src/components/Dialog.tsx +17 -12
  21. package/src/components/DimensionInput.tsx +14 -12
  22. package/src/components/Drawer.tsx +98 -0
  23. package/src/components/EditableText.tsx +3 -1
  24. package/src/components/FillInputField.tsx +2 -2
  25. package/src/components/Grid.tsx +161 -111
  26. package/src/components/GridView.tsx +73 -41
  27. package/src/components/InputField.tsx +148 -208
  28. package/src/components/Label.tsx +4 -68
  29. package/src/components/LabeledField.tsx +7 -1
  30. package/src/components/List.tsx +135 -50
  31. package/src/components/ListView.tsx +63 -43
  32. package/src/components/MediaThumbnail.tsx +117 -0
  33. package/src/components/Message.tsx +8 -8
  34. package/src/components/NoyaLogo.tsx +41 -0
  35. package/src/components/SearchCompletionMenu.tsx +30 -16
  36. package/src/components/SegmentedControl.tsx +1 -1
  37. package/src/components/SelectMenu.tsx +28 -21
  38. package/src/components/Slider.tsx +16 -7
  39. package/src/components/Sortable.tsx +125 -62
  40. package/src/components/internal/Menu.tsx +45 -25
  41. package/src/components/internal/MenuViewport.tsx +7 -1
  42. package/src/components/internal/SelectItem.tsx +53 -28
  43. package/src/components/internal/__tests__/Menu.test.tsx +12 -0
  44. package/src/components/workspace/DrawerWorkspaceLayout.tsx +86 -0
  45. package/src/components/workspace/PanelWorkspaceLayout.tsx +102 -0
  46. package/src/components/{WorkspaceLayout.tsx → workspace/WorkspaceLayout.tsx} +109 -106
  47. package/src/components/workspace/types.ts +31 -0
  48. package/src/contexts/DialogContext.tsx +49 -34
  49. package/src/hooks/usePreservePanelSize.tsx +1 -5
  50. package/src/index.css +8 -1
  51. package/src/index.tsx +6 -1
  52. package/src/theme/index.ts +2 -0
  53. package/src/utils/classNames.ts +51 -3
  54. package/src/utils/inputs.ts +21 -0
  55. package/tailwind.config.ts +8 -0
package/src/index.css CHANGED
@@ -21,7 +21,6 @@
21
21
  --secondary-light: rgb(0, 160, 129);
22
22
  --secondary-pastel: rgb(205, 238, 231);
23
23
  --secondary-bright: #0ab557;
24
- --input-background: rgb(240, 242, 246);
25
24
  --input-background-light: rgb(243, 245, 249);
26
25
  --code-background: rgb(250, 250, 250);
27
26
  --code-background-dark: #435080;
@@ -37,6 +36,9 @@
37
36
  --popover-divider: transparent;
38
37
  --listview-raised-background: rgba(0, 0, 0, 0.03);
39
38
  --listview-editing-background: #fff;
39
+ --input-background: rgb(240, 242, 246);
40
+ --list-view-hover-background: rgb(244, 246, 250);
41
+ --list-view-thumbnail-background: var(--input-background);
40
42
  --slider-thumb-background: white;
41
43
  --slider-border: #9698ac;
42
44
  --mask: rgb(12, 193, 67);
@@ -58,6 +60,7 @@
58
60
  --inspector-h-separator: 8px;
59
61
  --inspector-v-separator: 10px;
60
62
  --dialog-padding: 16px;
63
+ --input-height: 27px;
61
64
  --icon: rgb(129, 131, 165);
62
65
  --icon-selected: rgb(220, 220, 220);
63
66
  --warning: rgb(251, 211, 0);
@@ -77,6 +80,8 @@
77
80
  --chip-error-shadow: rgb(255, 219, 219);
78
81
  --chip-default-shadow: rgb(0, 0, 0);
79
82
  --floating-button: rgb(248, 248, 250);
83
+ --block-border: rgb(184, 201, 218);
84
+ --block-highlight: rgb(255, 165, 0);
80
85
  }
81
86
 
82
87
  [data-theme="dark"] {
@@ -104,6 +109,8 @@
104
109
  --popover-divider: rgba(255, 255, 255, 0.08);
105
110
  --listview-raised-background: rgba(181, 178, 255, 0.1);
106
111
  --listview-editing-background: #000;
112
+ --list-view-hover-background: var(--input-background-light);
113
+ --list-view-thumbnail-background: var(--input-background);
107
114
  --slider-thumb-background: var(--input-background-light);
108
115
  --slider-border: var(--divider);
109
116
  --mask: rgb(102, 187, 106);
package/src/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  // Components
2
+ export * from "./components/ActionMenu";
2
3
  export * from "./components/ActivityIndicator";
3
4
  export * from "./components/AnimatePresence";
4
5
  export * from "./components/Avatar";
@@ -14,6 +15,7 @@ export * from "./components/ContextMenu";
14
15
  export * from "./components/Dialog";
15
16
  export * from "./components/Divider";
16
17
  export * from "./components/DraggableMenuButton";
18
+ export * from "./components/Drawer";
17
19
  export * from "./components/DropdownMenu";
18
20
  export * from "./components/EditableText";
19
21
  export * from "./components/Fade";
@@ -39,7 +41,9 @@ export * from "./components/LabeledElementView";
39
41
  export * from "./components/LabeledField";
40
42
  export * from "./components/List";
41
43
  export * from "./components/ListView";
44
+ export * from "./components/MediaThumbnail";
42
45
  export * from "./components/Message";
46
+ export * from "./components/NoyaLogo";
43
47
  export * from "./components/Popover";
44
48
  export * from "./components/Progress";
45
49
  export * from "./components/ScrollArea";
@@ -57,7 +61,8 @@ export * from "./components/Toast";
57
61
  export * from "./components/Tooltip";
58
62
  export * from "./components/TreeView";
59
63
  export * from "./components/UserPointer";
60
- export * from "./components/WorkspaceLayout";
64
+ export * from "./components/workspace/types";
65
+ export * from "./components/workspace/WorkspaceLayout";
61
66
  // Contexts
62
67
  export * from "./contexts/DesignSystemConfiguration";
63
68
  export * from "./contexts/DialogContext";
@@ -6,3 +6,5 @@ export type Theme = (typeof tailwindConfig.theme)["extend"];
6
6
  export type ThemeColor = keyof Theme["colors"];
7
7
 
8
8
  export const cssVars = convertKebabToCamelCase(tailwindConfig.theme.extend);
9
+
10
+ export const INPUT_HEIGHT = 27;
@@ -1,5 +1,53 @@
1
- export function cx(
2
- ...args: Array<string | number | boolean | null | undefined>
3
- ): string {
1
+ import tailwindConfig from "../../tailwind.config";
2
+
3
+ type ClassNameItem = string | number | BigInt | boolean | null | undefined;
4
+ type Category = "text" | "flex";
5
+ type Options = {
6
+ categories?: Category[];
7
+ };
8
+
9
+ const textKeys = Object.keys(tailwindConfig.theme.extend.fontSize).map(
10
+ (key) => `text-${key}`
11
+ );
12
+ const textKeysSet = new Set(textKeys);
13
+ const keyMap: Record<Category, Set<string>> = {
14
+ text: textKeysSet,
15
+ flex: new Set(["flex-auto", "flex-none", "flex-[0_0_auto]", "flex-1"]),
16
+ };
17
+
18
+ export function cx(...args: ClassNameItem[]): string {
4
19
  return args.filter(Boolean).join(" ").trim();
5
20
  }
21
+
22
+ const filterLastClassNameInCategory = ({
23
+ classNames,
24
+ categoryKeys,
25
+ }: {
26
+ classNames: string[];
27
+ categoryKeys: Set<string>;
28
+ }) => {
29
+ const lastClassInGroup = classNames.findLast((key) => categoryKeys.has(key));
30
+ return classNames.flatMap((className) => {
31
+ if (categoryKeys.has(className)) {
32
+ return lastClassInGroup === className ? [className] : [];
33
+ }
34
+ return [className];
35
+ });
36
+ };
37
+
38
+ export function mergeConflictingClassNames(
39
+ classNames: ClassNameItem | ClassNameItem[],
40
+ options?: Options
41
+ ): string {
42
+ const classes = Array.isArray(classNames)
43
+ ? cx(...classNames)
44
+ : cx(classNames);
45
+ let classNamesList = classes.split(/\s+/);
46
+ options?.categories?.forEach((category) => {
47
+ classNamesList = filterLastClassNameInCategory({
48
+ classNames: classNamesList,
49
+ categoryKeys: keyMap[category],
50
+ });
51
+ });
52
+ return classNamesList.join(" ");
53
+ }
@@ -0,0 +1,21 @@
1
+ import { cx } from "./classNames";
2
+
3
+ export type InputSize = "small" | "medium" | "large";
4
+
5
+ const insetEndBaseStyles = "absolute inset-y-0 flex items-center z-label";
6
+
7
+ export const getInsetEndStyles = (size: InputSize = "medium") => {
8
+ return cx(
9
+ insetEndBaseStyles,
10
+ size === "large"
11
+ ? "right-2"
12
+ : size === "medium"
13
+ ? "right-1.5"
14
+ : size === "small"
15
+ ? "right-0.5"
16
+ : "",
17
+ size === "small" ? "min-h-[19px]" : "min-h-input-height"
18
+ );
19
+ };
20
+
21
+ export const startBaseStyles = "absolute left-1.5 inset-y-0 flex items-center";
@@ -1,3 +1,4 @@
1
+ import containerQueries from "@tailwindcss/container-queries";
1
2
  import type { Config } from "tailwindcss";
2
3
 
3
4
  const config = {
@@ -29,6 +30,9 @@ const config = {
29
30
  "secondary-bright": "var(--secondary-bright)",
30
31
  "input-background": "var(--input-background)",
31
32
  "input-background-light": "var(--input-background-light)",
33
+ "list-view-hover-background": "var(--list-view-hover-background)",
34
+ "list-view-thumbnail-background":
35
+ "var(--list-view-thumbnail-background)",
32
36
  "code-background": "var(--code-background)",
33
37
  "code-background-dark": "var(--code-background-dark)",
34
38
  "selected-background": "var(--selected-background)",
@@ -74,6 +78,8 @@ const config = {
74
78
  "chip-error-shadow": "var(--chip-error-shadow)",
75
79
  "chip-default-shadow": "var(--chip-default-shadow)",
76
80
  "floating-button": "var(--floating-button)",
81
+ "block-border": "var(--block-border)",
82
+ "block-highlight": "var(--block-highlight)",
77
83
  },
78
84
  fontFamily: {
79
85
  sans: [
@@ -189,6 +195,7 @@ const config = {
189
195
  "inspector-h-separator": "var(--inspector-h-separator)",
190
196
  "inspector-v-separator": "var(--inspector-v-separator)",
191
197
  "dialog-padding": "var(--dialog-padding)",
198
+ "input-height": "var(--input-height)",
192
199
  },
193
200
  keyframes: {
194
201
  spin: {
@@ -234,6 +241,7 @@ const config = {
234
241
  "gap-toolbar-separator",
235
242
  "-mr-1",
236
243
  ],
244
+ plugins: [containerQueries],
237
245
  } satisfies Config;
238
246
 
239
247
  export default config;