@rebasepro/ui 0.17.3 → 0.18.1
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.
- package/README.md +4 -0
- package/dist/components/MultiSelect.d.ts +10 -0
- package/dist/index.es.js +2 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +32 -23
- package/src/components/Alert.tsx +0 -118
- package/src/components/Autocomplete.tsx +0 -93
- package/src/components/Avatar.tsx +0 -73
- package/src/components/Badge.tsx +0 -44
- package/src/components/BooleanSwitch.tsx +0 -116
- package/src/components/BooleanSwitchWithLabel.tsx +0 -120
- package/src/components/Button.tsx +0 -110
- package/src/components/Card.tsx +0 -43
- package/src/components/CenteredView.tsx +0 -35
- package/src/components/Checkbox.tsx +0 -129
- package/src/components/Chip.tsx +0 -131
- package/src/components/CircularProgress.tsx +0 -53
- package/src/components/CircularProgressCenter.tsx +0 -27
- package/src/components/Collapse.tsx +0 -66
- package/src/components/ColorPicker.tsx +0 -140
- package/src/components/Container.tsx +0 -51
- package/src/components/DateTimeField.tsx +0 -363
- package/src/components/DebouncedTextField.tsx +0 -76
- package/src/components/Dialog.tsx +0 -159
- package/src/components/DialogActions.tsx +0 -29
- package/src/components/DialogContent.tsx +0 -27
- package/src/components/DialogTitle.tsx +0 -41
- package/src/components/ErrorBoundary.tsx +0 -236
- package/src/components/ExpandablePanel.tsx +0 -130
- package/src/components/FileUpload.tsx +0 -103
- package/src/components/FilterChip.tsx +0 -89
- package/src/components/IconButton.tsx +0 -101
- package/src/components/InfoLabel.tsx +0 -23
- package/src/components/InputLabel.tsx +0 -40
- package/src/components/Label.tsx +0 -32
- package/src/components/LoadingButton.tsx +0 -32
- package/src/components/Markdown.tsx +0 -55
- package/src/components/Menu.tsx +0 -114
- package/src/components/Menubar.tsx +0 -355
- package/src/components/MultiSelect.tsx +0 -433
- package/src/components/Paper.tsx +0 -23
- package/src/components/Popover.tsx +0 -162
- package/src/components/RadioGroup.tsx +0 -74
- package/src/components/ResizablePanels.tsx +0 -189
- package/src/components/SearchBar.tsx +0 -136
- package/src/components/Select.tsx +0 -326
- package/src/components/Separator.tsx +0 -28
- package/src/components/Sheet.tsx +0 -135
- package/src/components/Skeleton.tsx +0 -54
- package/src/components/Slider.tsx +0 -110
- package/src/components/Table.tsx +0 -178
- package/src/components/Tabs.tsx +0 -185
- package/src/components/TextField.tsx +0 -270
- package/src/components/TextareaAutosize.tsx +0 -368
- package/src/components/ToggleButtonGroup.tsx +0 -69
- package/src/components/Tooltip.tsx +0 -153
- package/src/components/Typography.tsx +0 -132
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +0 -90
- package/src/components/VirtualTable/VirtualTable.tsx +0 -700
- package/src/components/VirtualTable/VirtualTableCell.tsx +0 -59
- package/src/components/VirtualTable/VirtualTableHeader.tsx +0 -327
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +0 -250
- package/src/components/VirtualTable/VirtualTableProps.tsx +0 -339
- package/src/components/VirtualTable/VirtualTableRow.tsx +0 -51
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +0 -44
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -89
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +0 -71
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +0 -107
- package/src/components/VirtualTable/fields/VirtualTableSwitch.tsx +0 -28
- package/src/components/VirtualTable/index.tsx +0 -10
- package/src/components/VirtualTable/selection/SelectionContext.tsx +0 -36
- package/src/components/VirtualTable/selection/SelectionStore.ts +0 -54
- package/src/components/VirtualTable/types.tsx +0 -47
- package/src/components/common/SelectInputLabel.tsx +0 -23
- package/src/components/index.tsx +0 -62
- package/src/hooks/PortalContainerContext.tsx +0 -50
- package/src/hooks/index.ts +0 -7
- package/src/hooks/useDebounceCallback.tsx +0 -21
- package/src/hooks/useDebounceValue.tsx +0 -20
- package/src/hooks/useDebouncedCallback.ts +0 -39
- package/src/hooks/useInjectStyles.tsx +0 -31
- package/src/hooks/useOutsideAlerter.tsx +0 -46
- package/src/icons/GitHubIcon.tsx +0 -21
- package/src/icons/HandleIcon.tsx +0 -23
- package/src/icons/Icon.tsx +0 -33
- package/src/icons/LucideIconByName.tsx +0 -117
- package/src/icons/cool_icon_keys.ts +0 -12
- package/src/icons/icon_keys.ts +0 -1936
- package/src/icons/index.ts +0 -179
- package/src/index.css +0 -169
- package/src/index.ts +0 -47
- package/src/scripts/fixIconSizes.cjs +0 -92
- package/src/scripts/fixIconSizesToConst.cjs +0 -106
- package/src/scripts/generateIconKeys.ts +0 -41
- package/src/scripts/generateIcons.ts +0 -4
- package/src/scripts/saveIconFiles.ts +0 -89
- package/src/styles.ts +0 -141
- package/src/theme.css +0 -168
- package/src/util/chip_colors.ts +0 -242
- package/src/util/cls.ts +0 -8
- package/src/util/debounce.ts +0 -28
- package/src/util/hash.ts +0 -11
- package/src/util/index.ts +0 -4
- package/src/util/key_to_icon_component.ts +0 -11
- package/src/util/lazy_chunk.ts +0 -101
- package/src/views/CardView.tsx +0 -281
- package/src/views/CollectionView/CollectionCardView.tsx +0 -265
- package/src/views/CollectionView/CollectionKanbanView.tsx +0 -246
- package/src/views/CollectionView/CollectionListView.tsx +0 -240
- package/src/views/CollectionView/CollectionTableView.tsx +0 -229
- package/src/views/CollectionView/CollectionView.tsx +0 -450
- package/src/views/CollectionView/CollectionViewToolbar.tsx +0 -242
- package/src/views/CollectionView/CollectionViewTypes.ts +0 -181
- package/src/views/CollectionView/DefaultCellRenderer.tsx +0 -404
- package/src/views/CollectionView/index.ts +0 -39
- package/src/views/CollectionView/resolveTitleProperty.ts +0 -52
- package/src/views/CollectionView/utils.ts +0 -14
- package/src/views/Kanban/Board.tsx +0 -384
- package/src/views/Kanban/BoardColumn.tsx +0 -138
- package/src/views/Kanban/BoardColumnTitle.tsx +0 -47
- package/src/views/Kanban/BoardSortableList.tsx +0 -182
- package/src/views/Kanban/board_types.ts +0 -80
- package/src/views/Kanban/index.tsx +0 -5
- package/src/views/Kanban/placement.ts +0 -62
- package/src/views/KanbanView.tsx +0 -32
- package/src/views/ListView.tsx +0 -296
- 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"];
|