@rebasepro/ui 0.10.0 → 0.10.1-canary.0a881d4

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 (36) hide show
  1. package/dist/icons/index.d.ts +1 -1
  2. package/dist/index.es.js +4567 -4494
  3. package/dist/index.es.js.map +1 -1
  4. package/dist/styles.d.ts +5 -5
  5. package/dist/views/CollectionView/resolveTitleProperty.d.ts +11 -0
  6. package/package.json +1 -1
  7. package/src/components/Alert.tsx +57 -14
  8. package/src/components/Autocomplete.tsx +1 -1
  9. package/src/components/Avatar.tsx +2 -2
  10. package/src/components/BooleanSwitch.tsx +1 -1
  11. package/src/components/Checkbox.tsx +5 -4
  12. package/src/components/ColorPicker.tsx +3 -3
  13. package/src/components/Container.tsx +1 -1
  14. package/src/components/Dialog.tsx +1 -1
  15. package/src/components/ErrorBoundary.tsx +3 -3
  16. package/src/components/ExpandablePanel.tsx +1 -1
  17. package/src/components/IconButton.tsx +2 -2
  18. package/src/components/InfoLabel.tsx +3 -3
  19. package/src/components/Menu.tsx +1 -1
  20. package/src/components/Menubar.tsx +6 -6
  21. package/src/components/MultiSelect.tsx +5 -5
  22. package/src/components/Popover.tsx +1 -1
  23. package/src/components/RadioGroup.tsx +2 -2
  24. package/src/components/Slider.tsx +1 -1
  25. package/src/components/Table.tsx +2 -2
  26. package/src/components/Tabs.tsx +6 -6
  27. package/src/components/ToggleButtonGroup.tsx +3 -3
  28. package/src/components/Tooltip.tsx +1 -1
  29. package/src/components/common/SelectInputLabel.tsx +2 -2
  30. package/src/icons/index.ts +17 -0
  31. package/src/styles.ts +5 -5
  32. package/src/views/CollectionView/CollectionCardView.tsx +5 -10
  33. package/src/views/CollectionView/CollectionKanbanView.tsx +5 -10
  34. package/src/views/CollectionView/CollectionListView.tsx +5 -10
  35. package/src/views/CollectionView/resolveTitleProperty.ts +52 -0
  36. package/src/views/ListView.tsx +1 -1
@@ -16,15 +16,20 @@ export {
16
16
  AlertTriangleIcon,
17
17
  AlignLeftIcon,
18
18
  AppWindow,
19
+ ArrowDownIcon,
19
20
  ArrowDownToLineIcon,
20
21
  ArrowLeftIcon,
21
22
  ArrowRightFromLineIcon,
22
23
  ArrowRightIcon,
24
+ ArrowRightLeftIcon,
23
25
  ArrowRightToLineIcon,
26
+ ArrowUpDownIcon,
27
+ ArrowUpIcon,
24
28
  ArrowUpToLineIcon,
25
29
  BoldIcon,
26
30
  BookOpenIcon,
27
31
  CalendarIcon,
32
+ CheckCircle2Icon,
28
33
  CheckCircleIcon,
29
34
  CheckIcon,
30
35
  CheckSquareIcon,
@@ -35,12 +40,14 @@ export {
35
40
  ChevronsLeftIcon,
36
41
  ChevronsRightIcon,
37
42
  ChevronsUpDownIcon,
43
+ CircleDotIcon,
38
44
  CircleIcon,
39
45
  CircleUserIcon,
40
46
  CodeIcon,
41
47
  ColumnsIcon,
42
48
  CopyIcon,
43
49
  DatabaseIcon,
50
+ DollarSignIcon,
44
51
  DownloadIcon,
45
52
  ExternalLinkIcon,
46
53
  EyeIcon,
@@ -52,6 +59,7 @@ export {
52
59
  FilterXIcon,
53
60
  FlagIcon,
54
61
  FolderIcon,
62
+ FolderKanbanIcon,
55
63
  FolderPlusIcon,
56
64
  FolderUpIcon,
57
65
  FunctionSquareIcon,
@@ -78,11 +86,14 @@ export {
78
86
  ListIcon,
79
87
  LockIcon,
80
88
  ListOrderedIcon,
89
+ ListPlusIcon,
90
+ ListTodoIcon,
81
91
  LoaderIcon,
82
92
  LogOutIcon,
83
93
  MailIcon,
84
94
  Maximize2Icon,
85
95
  MenuIcon,
96
+ MessageCircleIcon,
86
97
  MinusCircleIcon,
87
98
  MinusIcon,
88
99
  MoonIcon,
@@ -90,8 +101,10 @@ export {
90
101
  Music2Icon,
91
102
  PanelLeftIcon,
92
103
  PauseIcon,
104
+ PenLineIcon,
93
105
  PencilIcon,
94
106
  PhoneIcon,
107
+ PinIcon,
95
108
  PlayIcon,
96
109
  PlusIcon,
97
110
  QuoteIcon,
@@ -108,6 +121,7 @@ export {
108
121
  SlidersHorizontalIcon,
109
122
  SquareIcon,
110
123
  StarIcon,
124
+ StickyNoteIcon,
111
125
  StrikethroughIcon,
112
126
  SunIcon,
113
127
  SunMoonIcon,
@@ -116,6 +130,7 @@ export {
116
130
  TerminalIcon,
117
131
  TextIcon,
118
132
  Trash2Icon,
133
+ TrendingUpIcon,
119
134
  TypeIcon,
120
135
  UnderlineIcon,
121
136
  UndoIcon,
@@ -124,9 +139,11 @@ export {
124
139
  UserCheckIcon,
125
140
  UserIcon,
126
141
  UserPlus,
142
+ UsersIcon,
127
143
  VideoIcon,
128
144
  VoteIcon,
129
145
  Wand2Icon,
146
+ WrenchIcon,
130
147
  XCircleIcon,
131
148
  XIcon
132
149
  } from "lucide-react";
package/src/styles.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export const focusedDisabled = "focus-visible:ring-0 focus-visible:ring-offset-0";
2
- export const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-surface-accent-100 focus:dark:bg-surface-900 focus:dark:bg-opacity-60 focus:bg-surface-accent-100/70 dark:focus:bg-surface-900/60";
2
+ export const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-surface-accent-100 focus:dark:bg-white/[0.07] focus:bg-surface-accent-100/70";
3
3
  export const focusedClasses = "z-30 outline-hidden outline-none ring-2 ring-primary ring-opacity-50 ring-primary/50 ring-offset-0 ring-offset-transparent ";
4
- export const fieldBackgroundMixin = "bg-surface-accent-200/50 dark:bg-black/30";
5
- export const fieldBackgroundInvisibleMixin = "bg-surface-accent-200/0 dark:bg-black/0";
6
- export const fieldBackgroundDisabledMixin = "bg-surface-accent-200/50 dark:bg-black/20";
7
- export const fieldBackgroundHoverMixin = "hover:bg-surface-accent-200/70 hover:dark:bg-black/50";
4
+ export const fieldBackgroundMixin = "bg-surface-accent-200/50 dark:bg-white/[0.055]";
5
+ export const fieldBackgroundInvisibleMixin = "bg-surface-accent-200/0 dark:bg-white/0";
6
+ export const fieldBackgroundDisabledMixin = "bg-surface-accent-200/50 dark:bg-white/[0.03]";
7
+ export const fieldBackgroundHoverMixin = "hover:bg-surface-accent-200/70 hover:dark:bg-white/[0.09]";
8
8
  export const defaultBorderMixin = "border-surface-200 dark:border-surface-700/60 ";
9
9
  export const paperMixin = "bg-white rounded-lg dark:bg-surface-900 border border-surface-200 dark:border-surface-700";
10
10
  export const cardMixin = "bg-white dark:bg-surface-900 rounded-lg border border-surface-200 dark:border-surface-700";
@@ -14,6 +14,7 @@ import type {
14
14
  CollectionViewSize,
15
15
  CollectionSelectionController,
16
16
  } from "./CollectionViewTypes";
17
+ import { resolveTitlePropertyKey } from "./resolveTitleProperty";
17
18
 
18
19
  import { getValueInPath } from "./utils";
19
20
 
@@ -66,16 +67,10 @@ export function CollectionCardView<T extends Record<string, unknown> = Record<st
66
67
  );
67
68
 
68
69
  // ── Resolve title property ───────────────────────────────────────
69
- const titlePropertyKey = useMemo(() => {
70
- if (titleProperty) return titleProperty;
71
- for (const key of order) {
72
- const prop = properties[key];
73
- if (prop && prop.type === "string" && !prop.hideFromCollection && !prop.storage) {
74
- return key;
75
- }
76
- }
77
- return idProperty;
78
- }, [titleProperty, order, properties, idProperty]);
70
+ const titlePropertyKey = useMemo(
71
+ () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),
72
+ [titleProperty, order, properties, idProperty]
73
+ );
79
74
 
80
75
  // ── Resolve image property ───────────────────────────────────────
81
76
  const imageProperty = useMemo(() => {
@@ -14,6 +14,7 @@ import type {
14
14
  CollectionSelectionController,
15
15
  CollectionEnumValueConfig,
16
16
  } from "./CollectionViewTypes";
17
+ import { resolveTitlePropertyKey } from "./resolveTitleProperty";
17
18
 
18
19
  import { getValueInPath } from "./utils";
19
20
 
@@ -107,16 +108,10 @@ export function CollectionKanbanView<T extends Record<string, unknown> = Record<
107
108
  }, [properties, kanbanProperty, columns]);
108
109
 
109
110
  // ── Resolve title property ───────────────────────────────────────
110
- const titlePropertyKey = useMemo(() => {
111
- if (titleProperty) return titleProperty;
112
- for (const key of order) {
113
- const prop = properties[key];
114
- if (prop && prop.type === "string" && !prop.hideFromCollection && !prop.storage) {
115
- return key;
116
- }
117
- }
118
- return idProperty;
119
- }, [titleProperty, order, properties, idProperty]);
111
+ const titlePropertyKey = useMemo(
112
+ () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),
113
+ [titleProperty, order, properties, idProperty]
114
+ );
120
115
 
121
116
  // ── Preview properties (up to 2) ─────────────────────────────────
122
117
  const previewProperties = useMemo(() => {
@@ -12,6 +12,7 @@ import type {
12
12
  CollectionViewSize,
13
13
  CollectionSelectionController,
14
14
  } from "./CollectionViewTypes";
15
+ import { resolveTitlePropertyKey } from "./resolveTitleProperty";
15
16
 
16
17
  import { getValueInPath } from "./utils";
17
18
 
@@ -64,16 +65,10 @@ export function CollectionListView<T extends Record<string, unknown> = Record<st
64
65
  );
65
66
 
66
67
  // ── Resolve title property ───────────────────────────────────────
67
- const titlePropertyKey = useMemo(() => {
68
- if (titleProperty) return titleProperty;
69
- for (const key of order) {
70
- const prop = properties[key];
71
- if (prop && prop.type === "string" && !prop.hideFromCollection && !prop.storage) {
72
- return key;
73
- }
74
- }
75
- return idProperty;
76
- }, [titleProperty, order, properties, idProperty]);
68
+ const titlePropertyKey = useMemo(
69
+ () => resolveTitlePropertyKey(order, properties, idProperty, titleProperty),
70
+ [titleProperty, order, properties, idProperty]
71
+ );
77
72
 
78
73
  // ── Subtitle properties (up to 2) ────────────────────────────────
79
74
  const subtitleProperties = useMemo(() => {
@@ -0,0 +1,52 @@
1
+ import type { CollectionPropertyConfig } from "./CollectionViewTypes";
2
+
3
+ /**
4
+ * Pick the property that acts as a row's title.
5
+ *
6
+ * Headless mirror of the ranking in `@rebasepro/common`: identifiers are kept
7
+ * out of the title slot structurally (the id property, images, hidden fields),
8
+ * and among what is left a plain text field beats a description, an enum or a
9
+ * relation. Falls back to the id property only when a collection has nothing
10
+ * else to show.
11
+ */
12
+ export function resolveTitlePropertyKey(
13
+ order: string[],
14
+ properties: Record<string, CollectionPropertyConfig>,
15
+ idProperty: string,
16
+ titleProperty?: string
17
+ ): string {
18
+ if (titleProperty) return titleProperty;
19
+
20
+ const SCORE = {
21
+ RELATION: 10,
22
+ LONG_TEXT: 20,
23
+ ENUM: 30,
24
+ EMAIL: 45,
25
+ PLAIN_TEXT: 60,
26
+ NAMED: 100
27
+ };
28
+ const titleLikeKeys = new Set(["name", "fullname", "displayname", "title", "label", "heading", "subject", "username", "nickname"]);
29
+
30
+ let best: { key: string; score: number } | undefined;
31
+
32
+ order.forEach(key => {
33
+ const property = properties[key];
34
+ if (!property || property.hideFromCollection) return;
35
+ if (key === idProperty) return;
36
+ if (property.storage || property.url === "image") return;
37
+
38
+ let score: number;
39
+ if (property.type === "relation" || property.type === "reference") score = SCORE.RELATION;
40
+ else if (property.type !== "string") return;
41
+ else if (property.enum) score = SCORE.ENUM;
42
+ else if (property.multiline || property.markdown) score = SCORE.LONG_TEXT;
43
+ else if (property.email) score = SCORE.EMAIL;
44
+ else if (titleLikeKeys.has(key.toLowerCase().replace(/[^a-z0-9]/g, ""))) score = SCORE.NAMED;
45
+ else score = SCORE.PLAIN_TEXT;
46
+
47
+ if (!best || score > best.score) best = { key,
48
+ score };
49
+ });
50
+
51
+ return best?.key ?? idProperty;
52
+ }
@@ -240,7 +240,7 @@ export function ListView<T>({
240
240
  {renderRow({
241
241
  item,
242
242
  index: actualIndex,
243
- style: { height: estimatedRowHeight },
243
+ style: { height: estimatedRowHeight, overflow: "hidden" },
244
244
  className: cls(
245
245
  !isLast && "border-b",
246
246
  !isLast && borderMixinClass