@rebasepro/ui 0.17.3 → 0.18.0

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 (127) hide show
  1. package/README.md +4 -0
  2. package/dist/components/MultiSelect.d.ts +10 -0
  3. package/dist/index.es.js +2 -1
  4. package/dist/index.es.js.map +1 -1
  5. package/package.json +32 -23
  6. package/src/components/Alert.tsx +0 -118
  7. package/src/components/Autocomplete.tsx +0 -93
  8. package/src/components/Avatar.tsx +0 -73
  9. package/src/components/Badge.tsx +0 -44
  10. package/src/components/BooleanSwitch.tsx +0 -116
  11. package/src/components/BooleanSwitchWithLabel.tsx +0 -120
  12. package/src/components/Button.tsx +0 -110
  13. package/src/components/Card.tsx +0 -43
  14. package/src/components/CenteredView.tsx +0 -35
  15. package/src/components/Checkbox.tsx +0 -129
  16. package/src/components/Chip.tsx +0 -131
  17. package/src/components/CircularProgress.tsx +0 -53
  18. package/src/components/CircularProgressCenter.tsx +0 -27
  19. package/src/components/Collapse.tsx +0 -66
  20. package/src/components/ColorPicker.tsx +0 -140
  21. package/src/components/Container.tsx +0 -51
  22. package/src/components/DateTimeField.tsx +0 -363
  23. package/src/components/DebouncedTextField.tsx +0 -76
  24. package/src/components/Dialog.tsx +0 -159
  25. package/src/components/DialogActions.tsx +0 -29
  26. package/src/components/DialogContent.tsx +0 -27
  27. package/src/components/DialogTitle.tsx +0 -41
  28. package/src/components/ErrorBoundary.tsx +0 -236
  29. package/src/components/ExpandablePanel.tsx +0 -130
  30. package/src/components/FileUpload.tsx +0 -103
  31. package/src/components/FilterChip.tsx +0 -89
  32. package/src/components/IconButton.tsx +0 -101
  33. package/src/components/InfoLabel.tsx +0 -23
  34. package/src/components/InputLabel.tsx +0 -40
  35. package/src/components/Label.tsx +0 -32
  36. package/src/components/LoadingButton.tsx +0 -32
  37. package/src/components/Markdown.tsx +0 -55
  38. package/src/components/Menu.tsx +0 -114
  39. package/src/components/Menubar.tsx +0 -355
  40. package/src/components/MultiSelect.tsx +0 -433
  41. package/src/components/Paper.tsx +0 -23
  42. package/src/components/Popover.tsx +0 -162
  43. package/src/components/RadioGroup.tsx +0 -74
  44. package/src/components/ResizablePanels.tsx +0 -189
  45. package/src/components/SearchBar.tsx +0 -136
  46. package/src/components/Select.tsx +0 -326
  47. package/src/components/Separator.tsx +0 -28
  48. package/src/components/Sheet.tsx +0 -135
  49. package/src/components/Skeleton.tsx +0 -54
  50. package/src/components/Slider.tsx +0 -110
  51. package/src/components/Table.tsx +0 -178
  52. package/src/components/Tabs.tsx +0 -185
  53. package/src/components/TextField.tsx +0 -270
  54. package/src/components/TextareaAutosize.tsx +0 -368
  55. package/src/components/ToggleButtonGroup.tsx +0 -69
  56. package/src/components/Tooltip.tsx +0 -153
  57. package/src/components/Typography.tsx +0 -132
  58. package/src/components/VirtualTable/VirtualTable.performance.test.tsx +0 -90
  59. package/src/components/VirtualTable/VirtualTable.tsx +0 -700
  60. package/src/components/VirtualTable/VirtualTableCell.tsx +0 -59
  61. package/src/components/VirtualTable/VirtualTableHeader.tsx +0 -327
  62. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +0 -250
  63. package/src/components/VirtualTable/VirtualTableProps.tsx +0 -339
  64. package/src/components/VirtualTable/VirtualTableRow.tsx +0 -51
  65. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +0 -44
  66. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -89
  67. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +0 -71
  68. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +0 -107
  69. package/src/components/VirtualTable/fields/VirtualTableSwitch.tsx +0 -28
  70. package/src/components/VirtualTable/index.tsx +0 -10
  71. package/src/components/VirtualTable/selection/SelectionContext.tsx +0 -36
  72. package/src/components/VirtualTable/selection/SelectionStore.ts +0 -54
  73. package/src/components/VirtualTable/types.tsx +0 -47
  74. package/src/components/common/SelectInputLabel.tsx +0 -23
  75. package/src/components/index.tsx +0 -62
  76. package/src/hooks/PortalContainerContext.tsx +0 -50
  77. package/src/hooks/index.ts +0 -7
  78. package/src/hooks/useDebounceCallback.tsx +0 -21
  79. package/src/hooks/useDebounceValue.tsx +0 -20
  80. package/src/hooks/useDebouncedCallback.ts +0 -39
  81. package/src/hooks/useInjectStyles.tsx +0 -31
  82. package/src/hooks/useOutsideAlerter.tsx +0 -46
  83. package/src/icons/GitHubIcon.tsx +0 -21
  84. package/src/icons/HandleIcon.tsx +0 -23
  85. package/src/icons/Icon.tsx +0 -33
  86. package/src/icons/LucideIconByName.tsx +0 -117
  87. package/src/icons/cool_icon_keys.ts +0 -12
  88. package/src/icons/icon_keys.ts +0 -1936
  89. package/src/icons/index.ts +0 -179
  90. package/src/index.css +0 -169
  91. package/src/index.ts +0 -47
  92. package/src/scripts/fixIconSizes.cjs +0 -92
  93. package/src/scripts/fixIconSizesToConst.cjs +0 -106
  94. package/src/scripts/generateIconKeys.ts +0 -41
  95. package/src/scripts/generateIcons.ts +0 -4
  96. package/src/scripts/saveIconFiles.ts +0 -89
  97. package/src/styles.ts +0 -141
  98. package/src/theme.css +0 -168
  99. package/src/util/chip_colors.ts +0 -242
  100. package/src/util/cls.ts +0 -8
  101. package/src/util/debounce.ts +0 -28
  102. package/src/util/hash.ts +0 -11
  103. package/src/util/index.ts +0 -4
  104. package/src/util/key_to_icon_component.ts +0 -11
  105. package/src/util/lazy_chunk.ts +0 -101
  106. package/src/views/CardView.tsx +0 -281
  107. package/src/views/CollectionView/CollectionCardView.tsx +0 -265
  108. package/src/views/CollectionView/CollectionKanbanView.tsx +0 -246
  109. package/src/views/CollectionView/CollectionListView.tsx +0 -240
  110. package/src/views/CollectionView/CollectionTableView.tsx +0 -229
  111. package/src/views/CollectionView/CollectionView.tsx +0 -450
  112. package/src/views/CollectionView/CollectionViewToolbar.tsx +0 -242
  113. package/src/views/CollectionView/CollectionViewTypes.ts +0 -181
  114. package/src/views/CollectionView/DefaultCellRenderer.tsx +0 -404
  115. package/src/views/CollectionView/index.ts +0 -39
  116. package/src/views/CollectionView/resolveTitleProperty.ts +0 -52
  117. package/src/views/CollectionView/utils.ts +0 -14
  118. package/src/views/Kanban/Board.tsx +0 -384
  119. package/src/views/Kanban/BoardColumn.tsx +0 -138
  120. package/src/views/Kanban/BoardColumnTitle.tsx +0 -47
  121. package/src/views/Kanban/BoardSortableList.tsx +0 -182
  122. package/src/views/Kanban/board_types.ts +0 -80
  123. package/src/views/Kanban/index.tsx +0 -5
  124. package/src/views/Kanban/placement.ts +0 -62
  125. package/src/views/KanbanView.tsx +0 -32
  126. package/src/views/ListView.tsx +0 -296
  127. package/src/views/index.ts +0 -5
@@ -1,117 +0,0 @@
1
- "use client";
2
-
3
- import React from "react";
4
- import type { LucideIcon } from "lucide-react";
5
-
6
- /**
7
- * Rendering a Lucide icon chosen at runtime, without shipping all 1,600 of them
8
- * on the login screen.
9
- *
10
- * `@rebasepro/ui` used to re-export lucide's whole `icons` map:
11
- *
12
- * export { icons as lucideIcons } from "lucide-react";
13
- *
14
- * That map is an object literal holding a reference to every icon component in
15
- * the library, so a tree-shaker cannot drop a single one — reaching the map
16
- * reaches all of them. Two callers reached it, both by name lookup: `getIcon`
17
- * in `@rebasepro/app` (a collection's `icon: "ShoppingCart"`) and the admin's
18
- * icon picker. That put 822 kB of SVG components into the entry chunk's static
19
- * graph, `modulepreload`ed before authentication.
20
- *
21
- * The ~130 icons the product's own chrome uses are still plain named imports
22
- * from `lucide-react`, which tree-shake to just those. Only the by-name lookup
23
- * goes through here, and it pays for the map once, asynchronously, the first
24
- * time a runtime-chosen icon is rendered.
25
- */
26
-
27
- type IconsMap = Record<string, LucideIcon | undefined>;
28
-
29
- let loaded: IconsMap | undefined;
30
- let pending: Promise<IconsMap> | undefined;
31
-
32
- /**
33
- * The full lucide icon map, fetched on first use and cached for the session.
34
- *
35
- * Prefer {@link LucideIconByName}. This is here for callers that need to know
36
- * whether a name resolves, such as the icon picker's grid.
37
- */
38
- export function loadLucideIcons(): Promise<IconsMap> {
39
- if (loaded) return Promise.resolve(loaded);
40
- pending ??= import("lucide-react").then(({ icons }) => {
41
- loaded = icons as unknown as IconsMap;
42
- return loaded;
43
- });
44
- return pending;
45
- }
46
-
47
- /** The map if it has already been fetched, otherwise `undefined`. Never fetches. */
48
- export function getLoadedLucideIcons(): IconsMap | undefined {
49
- return loaded;
50
- }
51
-
52
- /**
53
- * Subscribe to the icon map.
54
- *
55
- * Returns it synchronously once loaded — including on the very first render of
56
- * every icon after the first one anywhere, which is what stops a page full of
57
- * icons from each flashing its placeholder.
58
- */
59
- export function useLucideIcons(): IconsMap | undefined {
60
- const [map, setMap] = React.useState<IconsMap | undefined>(loaded);
61
- React.useEffect(() => {
62
- if (map) return;
63
- let cancelled = false;
64
- loadLucideIcons()
65
- .then(resolved => { if (!cancelled) setMap(resolved); })
66
- .catch(error => console.error("[rebase] could not load the icon set", error));
67
- return () => { cancelled = true; };
68
- }, [map]);
69
- return map;
70
- }
71
-
72
- function toPascalCase(str: string): string {
73
- return str.split(/[-_]/).map(word => word.charAt(0).toUpperCase() + word.slice(1)).join("");
74
- }
75
-
76
- /**
77
- * The same resolution order the two call sites used against the eager map:
78
- * exact name, then PascalCase, then `CircleAlert` as the visible "unknown icon".
79
- */
80
- export function resolveLucideIcon(icons: IconsMap, name: string): LucideIcon | undefined {
81
- return icons[name] ?? icons[toPascalCase(name)] ?? icons.CircleAlert;
82
- }
83
-
84
- export type LucideIconByNameProps = {
85
- /**
86
- * A PascalCase lucide icon name, e.g. `"ShoppingCart"`. Whether a name
87
- * exists can be answered ahead of the fetch with `iconKeys`, which is a
88
- * plain string array and costs nothing.
89
- */
90
- name: string;
91
- size?: number;
92
- className?: string;
93
- /** Rendered while the icon set is in flight. Defaults to a blank box of `size`. */
94
- fallback?: React.ReactNode;
95
- };
96
-
97
- /**
98
- * An icon named at runtime. Renders `fallback` until the icon set arrives.
99
- */
100
- export const LucideIconByName = React.memo(
101
- function LucideIconByName({ name, size, className, fallback }: LucideIconByNameProps) {
102
- const icons = useLucideIcons();
103
- const Icon = icons ? resolveLucideIcon(icons, name) : undefined;
104
-
105
- if (!Icon) {
106
- if (fallback !== undefined) return <>{fallback}</>;
107
- // A box of the right size, so the layout does not jump when the
108
- // icon lands.
109
- return <span aria-hidden={true}
110
- className={"inline-block shrink-0"}
111
- style={{ width: size, height: size }}/>;
112
- }
113
-
114
- return <Icon size={size}
115
- className={className}/>;
116
- }
117
- );
@@ -1,12 +0,0 @@
1
- export const coolIconKeys: string[] = [
2
- "Rows4", "Video",
3
- "Plane", "LayoutDashboard", "LayoutGrid", "Square", "Snowflake",
4
- "CircleDashed", "AlignCenterHorizontal", "Disc", "Infinity",
5
- "Maximize", "Play", "Sparkles", "Music",
6
- "Wallet", "Layout", "Zap", "Circle", "Coffee",
7
- "ImageOff", "Sun", "Cable", "CalendarDays",
8
- "Dices", "Shapes", "Cloud", "Palette",
9
- "CreditCard", "Headphones", "Egg", "Disc3", "Flag",
10
- "Bandage", "Thermometer", "Hexagon", "Network", "Library", "Pizza",
11
- "Cpu", "Plug", "Files", "Globe", "SignalZero",
12
- "Gamepad2", "CloudLightning", "ListTree", "Command"];