@noya-app/noya-designsystem 0.1.49 → 0.1.51

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 (49) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +19 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.mts +169 -205
  5. package/dist/index.d.ts +169 -205
  6. package/dist/index.js +5092 -13463
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +3501 -11912
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +9 -9
  11. package/src/components/ActionMenu.tsx +4 -2
  12. package/src/components/Avatar.tsx +2 -2
  13. package/src/components/Banner.tsx +29 -0
  14. package/src/components/Button.tsx +2 -2
  15. package/src/components/Chip.tsx +8 -8
  16. package/src/components/Collection.tsx +18 -4
  17. package/src/components/ComboboxMenu.tsx +10 -1
  18. package/src/components/Dialog.tsx +2 -2
  19. package/src/components/FillInputField.tsx +1 -1
  20. package/src/components/Grid.tsx +12 -11
  21. package/src/components/Label.tsx +11 -6
  22. package/src/components/LabeledField.tsx +6 -1
  23. package/src/components/List.tsx +30 -24
  24. package/src/components/ListView.tsx +10 -5
  25. package/src/components/MediaThumbnail.tsx +31 -9
  26. package/src/components/Popover.tsx +9 -6
  27. package/src/components/SearchCompletionMenu.tsx +12 -12
  28. package/src/components/Section.tsx +172 -0
  29. package/src/components/SegmentedControl.tsx +1 -1
  30. package/src/components/SelectMenu.tsx +1 -1
  31. package/src/components/Slider.tsx +1 -1
  32. package/src/components/Sortable.tsx +124 -22
  33. package/src/components/Toolbar.tsx +22 -10
  34. package/src/components/UserPointer.tsx +1 -1
  35. package/src/components/ai-assistant/AIAssistantLayout.tsx +102 -0
  36. package/src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx +71 -0
  37. package/src/components/file-explorer/FileExplorerLayout.tsx +81 -0
  38. package/src/components/internal/Menu.tsx +12 -7
  39. package/src/components/internal/TextInput.tsx +7 -2
  40. package/src/components/pipeline/PipelineResultLayout.tsx +32 -0
  41. package/src/index.css +125 -118
  42. package/src/index.tsx +7 -0
  43. package/src/theme/index.ts +1 -1
  44. package/src/utils/classNames.ts +28 -3
  45. package/src/utils/combobox.ts +18 -13
  46. package/src/utils/moveTreeItem.ts +99 -0
  47. package/tailwind.config.ts +2 -239
  48. package/tailwind.d.ts +1 -1
  49. package/tsup.config.ts +0 -3
@@ -0,0 +1,99 @@
1
+ import { isDeepEqual } from "@noya-app/noya-utils";
2
+ import {
3
+ defaultAcceptsDrop,
4
+ RelativeDropPosition,
5
+ } from "../components/Sortable";
6
+
7
+ type MoveOptions = {
8
+ indexPaths: number[][];
9
+ to: number[];
10
+ };
11
+
12
+ export type MoveTreeItemOptions<T> = {
13
+ root: T;
14
+ move: (root: T, options: MoveOptions) => T;
15
+ position: RelativeDropPosition;
16
+ sourceIndexPath: number[];
17
+ targetIndexPath: number[];
18
+ };
19
+
20
+ export function moveTreeItem<T>({
21
+ root,
22
+ move,
23
+ position,
24
+ sourceIndexPath,
25
+ targetIndexPath,
26
+ }: MoveTreeItemOptions<T>): T {
27
+ switch (position) {
28
+ case "above": {
29
+ return move(root, {
30
+ indexPaths: [sourceIndexPath],
31
+ to: targetIndexPath,
32
+ });
33
+ }
34
+ case "below": {
35
+ return move(root, {
36
+ indexPaths: [sourceIndexPath],
37
+ to: [...targetIndexPath.slice(0, -1), targetIndexPath.at(-1)! + 1],
38
+ });
39
+ }
40
+ case "inside": {
41
+ return move(root, {
42
+ indexPaths: [sourceIndexPath],
43
+ to: [...targetIndexPath, 1000],
44
+ });
45
+ }
46
+ }
47
+ }
48
+
49
+ export type AcceptsDropOptions = {
50
+ sourceIndexPath: number[];
51
+ targetIndexPath: number[];
52
+ position: RelativeDropPosition;
53
+
54
+ /**
55
+ * Whether to allow dropping the source item within the same parent as the target item.
56
+ */
57
+ allowSiblings: boolean;
58
+
59
+ /**
60
+ * Whether to allow dropping the source item within itself or one of its descendants.
61
+ */
62
+ allowRecursion: boolean;
63
+ };
64
+
65
+ export function acceptsDrop({
66
+ sourceIndexPath,
67
+ targetIndexPath,
68
+ position,
69
+ allowSiblings,
70
+ allowRecursion,
71
+ }: AcceptsDropOptions): boolean {
72
+ if (!allowRecursion) {
73
+ const targetIsDescendantOfSource = isDeepEqual(
74
+ sourceIndexPath,
75
+ targetIndexPath.slice(0, sourceIndexPath.length)
76
+ );
77
+
78
+ if (targetIsDescendantOfSource) return false;
79
+ }
80
+
81
+ const areSiblings = isDeepEqual(
82
+ sourceIndexPath.slice(0, -1),
83
+ targetIndexPath.slice(0, -1)
84
+ );
85
+
86
+ if (areSiblings && position !== "inside") {
87
+ if (!allowSiblings) {
88
+ return false;
89
+ }
90
+
91
+ return defaultAcceptsDrop(
92
+ sourceIndexPath.at(-1)!,
93
+ targetIndexPath.at(-1)!,
94
+ position
95
+ );
96
+ }
97
+
98
+ return true;
99
+ }
@@ -1,246 +1,9 @@
1
+ import noyaConfig from "@noya-app/noya-tailwind-config";
1
2
  import containerQueries from "@tailwindcss/container-queries";
2
3
  import type { Config } from "tailwindcss";
3
4
 
4
5
  const config = {
5
- content: ["./src/**/*.{ts,tsx}"],
6
- corePlugins: {
7
- // disables @tailwind base global styles
8
- preflight: false,
9
- },
10
- theme: {
11
- extend: {
12
- colors: {
13
- "logo-fill": "var(--logo-fill)",
14
- "logo-highlight": "var(--logo-highlight)",
15
- background: "var(--background)",
16
- text: "var(--text)",
17
- "text-muted": "var(--text-muted)",
18
- "text-subtle": "var(--text-subtle)",
19
- "text-disabled": "var(--text-disabled)",
20
- "text-decorative-light": "var(--text-decorative-light)",
21
- "divider-subtle": "var(--divider-subtle)",
22
- divider: "var(--divider)",
23
- "divider-strong": "var(--divider-strong)",
24
- primary: "var(--primary)",
25
- "primary-light": "var(--primary-light)",
26
- "primary-pastel": "var(--primary-pastel)",
27
- secondary: "var(--secondary)",
28
- "secondary-light": "var(--secondary-light)",
29
- "secondary-pastel": "var(--secondary-pastel)",
30
- "secondary-bright": "var(--secondary-bright)",
31
- "input-background": "var(--input-background)",
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)",
36
- "code-background": "var(--code-background)",
37
- "code-background-dark": "var(--code-background-dark)",
38
- "selected-background": "var(--selected-background)",
39
- "breadcrumb-text": "var(--breadcrumb-text)",
40
- "breadcrumb-text-hover": "var(--breadcrumb-text-hover)",
41
- "breadcrumb-icon": "var(--breadcrumb-icon)",
42
- "canvas-background": "var(--canvas-background)",
43
- "canvas-grid": "var(--canvas-grid)",
44
- "sidebar-background": "var(--sidebar-background)",
45
- "sidebar-background-transparent":
46
- "var(--sidebar-background-transparent)",
47
- "popover-background": "var(--popover-background)",
48
- "popover-divider": "var(--popover-divider)",
49
- "listview-raised-background": "var(--listview-raised-background)",
50
- "listview-editing-background": "var(--listview-editing-background)",
51
- "slider-thumb-background": "var(--slider-thumb-background)",
52
- "slider-border": "var(--slider-border)",
53
- "segmented-control-item": "var(--segmented-control-item)",
54
- mask: "var(--mask)",
55
- "transparent-checker": "var(--transparent-checker)",
56
- scrollbar: "var(--scrollbar)",
57
- "placeholder-dots": "var(--placeholder-dots)",
58
- "drag-outline": "var(--drag-outline)",
59
- "active-background": "var(--active-background)",
60
- "thumbnail-background": "var(--thumbnail-background)",
61
- "thumbnail-shadow": "var(--thumbnail-shadow)",
62
- "inline-code-text": "var(--inline-code-text)",
63
- "inline-code-background": "var(--inline-code-background)",
64
- "text-link": "var(--text-link)",
65
- "text-link-focused": "var(--text-link-focused)",
66
- icon: "var(--icon)",
67
- "icon-selected": "var(--icon-selected)",
68
- warning: "var(--warning)",
69
- dot: "var(--dot)",
70
- "row-highlight": "var(--row-highlight)",
71
- "table-row-background": "var(--table-row-background)",
72
- "chip-primary-bg": "var(--chip-primary-bg)",
73
- "chip-secondary-bg": "var(--chip-secondary-bg)",
74
- "chip-error-bg": "var(--chip-error-bg)",
75
- "chip-default-bg": "var(--chip-default-bg)",
76
- "chip-primary-shadow": "var(--chip-primary-shadow)",
77
- "chip-secondary-shadow": "var(--chip-secondary-shadow)",
78
- "chip-error-shadow": "var(--chip-error-shadow)",
79
- "chip-default-shadow": "var(--chip-default-shadow)",
80
- "floating-button": "var(--floating-button)",
81
- "block-border": "var(--block-border)",
82
- "block-highlight": "var(--block-highlight)",
83
- },
84
- fontFamily: {
85
- sans: [
86
- "__Inter_6b0edc",
87
- "__Inter_Fallback_6b0edc",
88
- "-apple-system",
89
- "BlinkMacSystemFont",
90
- "Helvetica Neue",
91
- "Segoe UI",
92
- "Roboto",
93
- "Helvetica",
94
- "Arial",
95
- "sans-serif",
96
- ],
97
- mono: ["Menlo", "Monaco", "Consolas", "Courier New", "monospace"],
98
- },
99
- // Type scale
100
- // The last one, 0.85, I just eyeballed
101
- // old: typeScale = [3.052, 2.441, 1.953, 1.563, 1.25, 1, 0.85]; // Major third
102
- fontSize: {
103
- title: [
104
- "3.052rem", // 48.83px
105
- {
106
- lineHeight: "1.4",
107
- letterSpacing: "-0.05em",
108
- },
109
- ],
110
- subtitle: [
111
- "1.563rem", // 25px
112
- {
113
- lineHeight: "1.75",
114
- letterSpacing: "-0.05em",
115
- },
116
- ],
117
- heading1: [
118
- "1.953rem", // 31.25px
119
- {
120
- lineHeight: "1.6",
121
- letterSpacing: "-0.025em",
122
- },
123
- ],
124
- heading2: [
125
- "1.563rem", // 25px
126
- {
127
- lineHeight: "1.5",
128
- letterSpacing: "-0.025em",
129
- },
130
- ],
131
- heading3: [
132
- "1.25rem", // 20px
133
- {
134
- lineHeight: "1.4",
135
- letterSpacing: "-0.025em",
136
- },
137
- ],
138
- heading4: [
139
- "1rem", // 16px
140
- {
141
- lineHeight: "1.4",
142
- },
143
- ],
144
- heading5: [
145
- "0.85rem", // 13.6px
146
- {
147
- lineHeight: "1.4",
148
- },
149
- ],
150
- body: [
151
- "1", // 16px (1 = 1rem)
152
- {
153
- lineHeight: "1.4",
154
- },
155
- ],
156
- small: [
157
- "1", // 16px (1 = 1rem)
158
- {
159
- lineHeight: "19px",
160
- },
161
- ],
162
- code: [
163
- "90%", // 14.4px
164
- {
165
- lineHeight: "1.5",
166
- },
167
- ],
168
- button: [
169
- "0.8rem", // 12.8px
170
- {
171
- lineHeight: "1.4",
172
- letterSpacing: "-0.2px",
173
- },
174
- ],
175
- label: [
176
- "0.62rem", // 9.92px
177
- {
178
- lineHeight: "19px",
179
- letterSpacing: "-0.3px",
180
- },
181
- ],
182
- },
183
- spacing: {
184
- nano: "2px",
185
- micro: "4px",
186
- small: "8px",
187
- medium: "16px",
188
- large: "32px",
189
- xlarge: "64px",
190
- xxlarge: "128px",
191
- "inset-top": "var(--inset-top)",
192
- "sidebar-width": "var(--sidebar-width)",
193
- "toolbar-height": "var(--toolbar-height)",
194
- "toolbar-separator": "var(--toolbar-separator)",
195
- "inspector-h-separator": "var(--inspector-h-separator)",
196
- "inspector-v-separator": "var(--inspector-v-separator)",
197
- "dialog-padding": "var(--dialog-padding)",
198
- "input-height": "var(--input-height)",
199
- },
200
- keyframes: {
201
- spin: {
202
- "0%": { transform: "rotate(0deg)" },
203
- "100%": { transform: "rotate(360deg)" },
204
- },
205
- shimmer: {
206
- "0%": {
207
- backgroundPosition: "-200% 0",
208
- },
209
- "100%": {
210
- backgroundPosition: "200% 0",
211
- },
212
- },
213
- },
214
- animation: {
215
- spin: "spin 1s linear infinite",
216
- shimmer: "shimmer 6s infinite linear",
217
- },
218
- zIndex: {
219
- interactable: "var(--interactable-z-index)",
220
- label: "var(--label-z-index)",
221
- menu: "var(--menu-z-index)",
222
- },
223
- },
224
- },
225
- safelist: [
226
- "group",
227
- "group-hover:flex",
228
- "bg-row-highlight",
229
- "left-5",
230
- "right-6",
231
- "m-[0_-24px_0_-20px]",
232
- "p-[0_24px_0_20px]",
233
- "left-0",
234
- "border-divider-strong",
235
- "decoration-text-decorative-light",
236
- "underline",
237
- "-left-2.5",
238
- "-mr-2",
239
- "border-gray-200",
240
- "gap-1.5",
241
- "gap-toolbar-separator",
242
- "-mr-1",
243
- ],
6
+ ...noyaConfig,
244
7
  plugins: [containerQueries],
245
8
  } satisfies Config;
246
9
 
package/tailwind.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Get the config from your actual config file
2
- import tailwindConfig from "./tailwind.config";
2
+ import tailwindConfig from "@noya-app/noya-tailwind-config";
3
3
 
4
4
  type ExtractThemeTypes<T> = T extends { theme: { extend: infer E } }
5
5
  ? E
package/tsup.config.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { exec } from "child_process";
2
- import fixReactVirtualized from "esbuild-plugin-react-virtualized";
3
2
  import { defineConfig } from "tsup";
4
3
  import { promisify } from "util";
5
4
 
@@ -11,8 +10,6 @@ export default defineConfig({
11
10
  format: ["cjs", "esm"],
12
11
  dts: true,
13
12
  sourcemap: true,
14
- noExternal: ["react-virtualized"],
15
- esbuildPlugins: [fixReactVirtualized],
16
13
  async onSuccess() {
17
14
  // Build Tailwind CSS after successful tsup build
18
15
  try {