@noya-app/noya-designsystem 0.1.64 → 0.1.65

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 (115) hide show
  1. package/.turbo/turbo-build.log +13 -10
  2. package/CHANGELOG.md +12 -0
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.mts +501 -228
  5. package/dist/index.d.ts +501 -228
  6. package/dist/index.js +6738 -2571
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +6697 -2499
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +6 -6
  11. package/src/components/ActivityIndicator.tsx +9 -4
  12. package/src/components/ActivityLog.tsx +197 -0
  13. package/src/components/AnimatePresence.tsx +37 -22
  14. package/src/components/Avatar.tsx +42 -25
  15. package/src/components/Banner.tsx +57 -11
  16. package/src/components/BaseToolbar.tsx +29 -7
  17. package/src/components/Breadcrumbs.tsx +2 -2
  18. package/src/components/Button.tsx +23 -24
  19. package/src/components/Checkbox.tsx +6 -35
  20. package/src/components/Chip.tsx +45 -33
  21. package/src/components/Collection.tsx +16 -11
  22. package/src/components/ColorSwatch.tsx +3 -3
  23. package/src/components/ColorSwatchControl.tsx +2 -2
  24. package/src/components/Combobox.tsx +6 -6
  25. package/src/components/ComboboxMenu.tsx +6 -5
  26. package/src/components/CommandPalette.tsx +1 -1
  27. package/src/components/Dialog.tsx +6 -12
  28. package/src/components/Divider.tsx +8 -8
  29. package/src/components/DraggableMenuButton.tsx +9 -5
  30. package/src/components/Drawer.tsx +5 -5
  31. package/src/components/DropdownMenu.tsx +1 -1
  32. package/src/components/EditableText.tsx +2 -2
  33. package/src/components/Fade.tsx +13 -13
  34. package/src/components/FileUploadIndicator.tsx +11 -11
  35. package/src/components/FloatingWindow.tsx +2 -2
  36. package/src/components/Grid.tsx +18 -11
  37. package/src/components/GridView.tsx +32 -25
  38. package/src/components/IVirtualizedList.tsx +5 -0
  39. package/src/components/Icons.tsx +24 -4
  40. package/src/components/InputField.tsx +19 -19
  41. package/src/components/InspectorContainer.tsx +2 -2
  42. package/src/components/InspectorPrimitives.tsx +15 -9
  43. package/src/components/Label.tsx +4 -3
  44. package/src/components/LabeledElementView.tsx +3 -3
  45. package/src/components/LabeledField.tsx +6 -6
  46. package/src/components/List.tsx +103 -45
  47. package/src/components/ListMenu.tsx +91 -0
  48. package/src/components/ListNavigator.tsx +106 -0
  49. package/src/components/ListView.tsx +20 -1158
  50. package/src/components/MediaThumbnail.tsx +56 -15
  51. package/src/components/Message.tsx +5 -5
  52. package/src/components/Navigator.tsx +461 -0
  53. package/src/components/NoyaLogo.tsx +1 -1
  54. package/src/components/Popover.tsx +9 -5
  55. package/src/components/Progress.tsx +19 -9
  56. package/src/components/ResizableContainer.tsx +187 -0
  57. package/src/components/RingProgress.tsx +128 -0
  58. package/src/components/ScrollArea.tsx +4 -4
  59. package/src/components/ScrollableSidebar.tsx +10 -0
  60. package/src/components/SearchCompletionMenu.tsx +3 -3
  61. package/src/components/Section.tsx +107 -57
  62. package/src/components/SegmentedControl.tsx +29 -29
  63. package/src/components/SelectMenu.tsx +13 -20
  64. package/src/components/SelectionToolbar.tsx +4 -3
  65. package/src/components/Slider.tsx +9 -9
  66. package/src/components/Spacer.tsx +2 -2
  67. package/src/components/StackNavigator.tsx +378 -0
  68. package/src/components/Stepper.tsx +88 -0
  69. package/src/components/Switch.tsx +4 -4
  70. package/src/components/Tabs.tsx +3 -3
  71. package/src/components/Text.tsx +23 -13
  72. package/src/components/TextArea.tsx +3 -3
  73. package/src/components/Toast.tsx +4 -4
  74. package/src/components/Toolbar.tsx +50 -9
  75. package/src/components/ToolbarDrawer.tsx +2 -2
  76. package/src/components/Tooltip.tsx +1 -1
  77. package/src/components/TreeView.tsx +11 -4
  78. package/src/components/UserPointer.tsx +4 -4
  79. package/src/components/ai-assistant/AIAssistantLayout.tsx +8 -8
  80. package/src/components/blocks/ImageBlockComponent.tsx +13 -7
  81. package/src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx +4 -4
  82. package/src/components/file-explorer/FileExplorerLayout.tsx +20 -8
  83. package/src/components/internal/Checkmark.tsx +1 -1
  84. package/src/components/internal/Menu.tsx +22 -18
  85. package/src/components/internal/MenuViewport.tsx +13 -6
  86. package/src/components/internal/SelectItem.tsx +3 -3
  87. package/src/components/internal/TextInput.tsx +5 -1
  88. package/src/components/listView/ListViewContexts.tsx +68 -0
  89. package/src/components/listView/ListViewEditableRowTitle.tsx +55 -0
  90. package/src/components/listView/ListViewRoot.tsx +521 -0
  91. package/src/components/listView/ListViewRow.tsx +475 -0
  92. package/src/components/listView/ListViewRowTitle.tsx +21 -0
  93. package/src/components/listView/types.ts +11 -0
  94. package/src/components/pipeline/PipelineResultLayout.tsx +6 -6
  95. package/src/components/sorting/DragRegistration.tsx +2 -1
  96. package/src/components/sorting/SharedDragProvider.tsx +91 -9
  97. package/src/components/sorting/Sortable.tsx +71 -17
  98. package/src/components/workspace/DrawerWorkspaceLayout.tsx +5 -5
  99. package/src/components/workspace/PanelWorkspaceLayout.tsx +65 -49
  100. package/src/components/workspace/VerticalTabMenu.tsx +25 -15
  101. package/src/components/workspace/WorkspaceLayout.tsx +30 -21
  102. package/src/contexts/DialogContext.tsx +17 -5
  103. package/src/hooks/useIndent.ts +3 -8
  104. package/src/index.css +24 -10
  105. package/src/index.tsx +10 -5
  106. package/src/utils/classNames.ts +52 -6
  107. package/src/utils/editableBlockStyles.ts +2 -2
  108. package/src/utils/formatByteSize.ts +1 -0
  109. package/src/utils/inputs.ts +8 -6
  110. package/src/utils/sketchColor.ts +0 -34
  111. package/tailwind.config.ts +1 -0
  112. package/src/components/FillInputField.tsx +0 -37
  113. package/src/components/FillPreviewBackground.tsx +0 -134
  114. package/src/components/GradientPicker.tsx +0 -90
  115. package/src/utils/getGradientBackground.tsx +0 -31
@@ -1,90 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- Alpha,
5
- ColorModel,
6
- Gradient,
7
- Hue,
8
- ColorPicker as NoyaColorPicker,
9
- RgbaColor,
10
- Saturation,
11
- equalColorObjects,
12
- hsvaToRgba,
13
- rgbaToHsva,
14
- } from "@noya-app/noya-colorpicker";
15
- import type { Sketch } from "@noya-app/noya-file-format";
16
- import * as React from "react";
17
- import { Spacer } from "../components/Spacer";
18
- import { rgbaToSketchColor, sketchColorToRgba } from "../utils/sketchColor";
19
-
20
- interface Props {
21
- value: Sketch.GradientStop[];
22
- selectedStop: number;
23
- onChangeColor: (color: Sketch.Color) => void;
24
- onChangePosition: (position: number) => void;
25
- onAdd: (color: Sketch.Color, position: number) => void;
26
- onDelete: () => void;
27
- onSelectStop: (index: number) => void;
28
- }
29
-
30
- export const GradientPicker = React.memo(function GradientPicker({
31
- value,
32
- selectedStop,
33
- onChangeColor,
34
- onChangePosition,
35
- onAdd,
36
- onDelete,
37
- onSelectStop,
38
- }: Props) {
39
- const colorModel: ColorModel<RgbaColor> = React.useMemo(
40
- () => ({
41
- defaultColor: { r: 0, g: 0, b: 0, a: 1 },
42
- toHsva: rgbaToHsva,
43
- fromHsva: hsvaToRgba,
44
- equal: equalColorObjects,
45
- }),
46
- []
47
- );
48
-
49
- const rgbaColor = React.useMemo(
50
- () => sketchColorToRgba(value[selectedStop].color),
51
- [value, selectedStop]
52
- );
53
-
54
- const handleChangeColor = React.useCallback(
55
- (value: RgbaColor) => {
56
- onChangeColor(rgbaToSketchColor(value));
57
- },
58
- [onChangeColor]
59
- );
60
-
61
- const handleAddGradientStop = React.useCallback(
62
- (value: RgbaColor, position: number) => {
63
- onAdd(rgbaToSketchColor(value), position);
64
- },
65
- [onAdd]
66
- );
67
-
68
- return (
69
- <NoyaColorPicker
70
- onChange={handleChangeColor}
71
- colorModel={colorModel}
72
- color={rgbaColor}
73
- >
74
- <Gradient
75
- gradients={value}
76
- selectedStop={selectedStop}
77
- onSelectStop={onSelectStop}
78
- onChangePosition={onChangePosition}
79
- onAdd={handleAddGradientStop}
80
- onDelete={onDelete}
81
- />
82
- <Spacer.Vertical size={10} />
83
- <Saturation />
84
- <Spacer.Vertical size={12} />
85
- <Hue />
86
- <Spacer.Vertical size={5} />
87
- <Alpha />
88
- </NoyaColorPicker>
89
- );
90
- });
@@ -1,31 +0,0 @@
1
- import { Sketch } from "@noya-app/noya-file-format";
2
- import { sketchColorToRgbaString } from "./sketchColor";
3
-
4
- const getRGBAColor = (value: Sketch.GradientStop[], num: 100 | 360) =>
5
- [...value]
6
- .sort((a, b) => a.position - b.position)
7
- .map(
8
- (g) =>
9
- `${sketchColorToRgbaString(g.color)} ${g.position * num}${
10
- num === 100 ? "%" : "deg"
11
- }`
12
- )
13
- .join(", \n");
14
-
15
- export function getGradientBackground(
16
- value: Sketch.GradientStop[],
17
- type: Sketch.GradientType,
18
- direction?: number
19
- ) {
20
- if (type === Sketch.GradientType.Angular) {
21
- return `conic-gradient(${getRGBAColor(value, 360)})`;
22
- }
23
-
24
- const color = getRGBAColor(value, 100);
25
- const position =
26
- type === Sketch.GradientType.Radial
27
- ? "radial-gradient(circle"
28
- : `linear-gradient(${direction !== undefined ? direction : 180}deg`;
29
-
30
- return `${position}, ${color})`;
31
- }