@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,179 +0,0 @@
1
- export * from "./icon_keys";
2
- export * from "./cool_icon_keys";
3
- export * from "./Icon";
4
- export * from "./GitHubIcon";
5
- export * from "./HandleIcon";
6
-
7
- export type { LucideProps, LucideIcon } from "lucide-react";
8
- export * from "./LucideIconByName";
9
-
10
- /**
11
- * lucide's full `icons` map, keyed by PascalCase name.
12
- *
13
- * Read the cost before reaching for it. The map holds a reference to every
14
- * icon in the library, so importing it pulls all ~1,750 into whatever chunk
15
- * you import it from — measured at **822 kB uncompressed**. There is no
16
- * tree-shaking that helps: the object literal names them all.
17
- *
18
- * It used to be reached by this package's own navigation chrome, which put
19
- * that 822 kB in the entry chunk, modulepreloaded on the login screen, for
20
- * every visitor of every Rebase admin panel. Those call sites now use
21
- * {@link LucideIconByName}, so the weight is no longer anybody's by default —
22
- * it is yours only if you import this binding.
23
- *
24
- * Prefer, in order:
25
- *
26
- * - {@link LucideIconByName} — renders by name, fetches the set on first use;
27
- * - {@link iconKeys} — a plain string array, if you only need to know whether
28
- * a name exists (costs nothing);
29
- * - {@link loadLucideIcons} — the same map, `await`ed, so it lands in an async
30
- * chunk instead of your entry;
31
- * - this, when you genuinely need the whole map synchronously at module scope.
32
- *
33
- * @see LucideIconByName
34
- * @see loadLucideIcons
35
- */
36
- export { icons as lucideIcons } from "lucide-react";
37
-
38
- // Re-export individual icon components used across the monorepo.
39
- // Sub-packages import these from @rebasepro/ui instead of declaring a direct
40
- // lucide-react dependency. When a new icon is needed, add it here.
41
- export {
42
- AlertCircleIcon,
43
- AlertTriangleIcon,
44
- AlignLeftIcon,
45
- AppWindow,
46
- ArrowDownIcon,
47
- ArrowDownToLineIcon,
48
- ArrowLeftIcon,
49
- ArrowRightFromLineIcon,
50
- ArrowRightIcon,
51
- ArrowRightLeftIcon,
52
- ArrowRightToLineIcon,
53
- ArrowUpDownIcon,
54
- ArrowUpIcon,
55
- ArrowUpToLineIcon,
56
- BoldIcon,
57
- BookOpenIcon,
58
- CalendarIcon,
59
- CheckCircle2Icon,
60
- CheckCircleIcon,
61
- CheckIcon,
62
- CheckSquareIcon,
63
- ChevronDownIcon,
64
- ChevronLeftIcon,
65
- ChevronRightIcon,
66
- ChevronUpIcon,
67
- ChevronsLeftIcon,
68
- ChevronsRightIcon,
69
- ChevronsUpDownIcon,
70
- CircleDotIcon,
71
- CircleIcon,
72
- CircleUserIcon,
73
- CodeIcon,
74
- ColumnsIcon,
75
- CopyIcon,
76
- DatabaseIcon,
77
- DollarSignIcon,
78
- DownloadIcon,
79
- ExternalLinkIcon,
80
- EyeIcon,
81
- EyeOffIcon,
82
- FileIcon,
83
- FileSearchIcon,
84
- FileTextIcon,
85
- FilterIcon,
86
- FilterXIcon,
87
- FlagIcon,
88
- FolderIcon,
89
- FolderKanbanIcon,
90
- FolderPlusIcon,
91
- FolderUpIcon,
92
- FunctionSquareIcon,
93
- GitBranchIcon,
94
- GlobeIcon,
95
- HashIcon,
96
- Heading1Icon,
97
- Heading2Icon,
98
- Heading3Icon,
99
- HelpCircleIcon,
100
- HistoryIcon,
101
- HomeIcon,
102
- ImageIcon,
103
- ImageOffIcon,
104
- InfoIcon,
105
- ItalicIcon,
106
- KanbanIcon,
107
- KeyIcon,
108
- KeyRoundIcon,
109
- LanguagesIcon,
110
- LayoutGridIcon,
111
- LinkIcon,
112
- Link2Icon,
113
- Unlink2Icon,
114
- ListIcon,
115
- LockIcon,
116
- ListOrderedIcon,
117
- ListPlusIcon,
118
- ListTodoIcon,
119
- LoaderIcon,
120
- LogOutIcon,
121
- MailIcon,
122
- Maximize2Icon,
123
- MenuIcon,
124
- MessageCircleIcon,
125
- MinusCircleIcon,
126
- MinusIcon,
127
- MoonIcon,
128
- MoreVerticalIcon,
129
- Music2Icon,
130
- PanelLeftCloseIcon,
131
- PanelLeftIcon,
132
- PanelLeftOpenIcon,
133
- PauseIcon,
134
- PenLineIcon,
135
- PencilIcon,
136
- PhoneIcon,
137
- PinIcon,
138
- PlayIcon,
139
- PlusIcon,
140
- QuoteIcon,
141
- RefreshCcwIcon,
142
- RefreshCwIcon,
143
- RepeatIcon,
144
- Rows3Icon,
145
- SaveIcon,
146
- SearchIcon,
147
- SendIcon,
148
- SettingsIcon,
149
- ShieldIcon,
150
- ShoppingCartIcon,
151
- SlidersHorizontalIcon,
152
- SquareIcon,
153
- StarIcon,
154
- StickyNoteIcon,
155
- StrikethroughIcon,
156
- SunIcon,
157
- SunMoonIcon,
158
- TableIcon,
159
- TagIcon,
160
- TerminalIcon,
161
- TextIcon,
162
- Trash2Icon,
163
- TrendingUpIcon,
164
- TypeIcon,
165
- UnderlineIcon,
166
- UndoIcon,
167
- UploadCloudIcon,
168
- UploadIcon,
169
- UserCheckIcon,
170
- UserIcon,
171
- UserPlus,
172
- UsersIcon,
173
- VideoIcon,
174
- VoteIcon,
175
- Wand2Icon,
176
- WrenchIcon,
177
- XCircleIcon,
178
- XIcon
179
- } from "lucide-react";
package/src/index.css DELETED
@@ -1,169 +0,0 @@
1
- @import "./theme.css";
2
-
3
- /* Grayscale antialiasing, not macOS's subpixel default.
4
- This is the single largest reason the same typeface can look like a
5
- different one between two pages: subpixel-antialiased text renders visibly
6
- heavier and slightly fuzzier, and the effect is worst for light text on dark
7
- backgrounds — which is most of this product and all of the marketing site.
8
- Design comps that set this and shipped pages that do not will never match,
9
- no matter how carefully the font, size, weight and tracking are aligned. */
10
- html {
11
- -webkit-font-smoothing: antialiased;
12
- -moz-osx-font-smoothing: grayscale;
13
- }
14
-
15
- /* Native UI (scrollbars, form controls) must follow the active theme,
16
- otherwise Chrome renders light scrollbars in dark mode */
17
- html {
18
- color-scheme: light;
19
- }
20
-
21
- html.dark {
22
- color-scheme: dark;
23
- }
24
-
25
- /* Chrome, Safari and Opera */
26
- .no-scrollbar::-webkit-scrollbar {
27
- display: none;
28
- }
29
-
30
- .no-scrollbar {
31
- -ms-overflow-style: none; /* IE and Edge */
32
- scrollbar-width: none; /* Firefox */
33
- }
34
-
35
- /* Optical ladder: weight comes down as size comes down, tracking tightens as
36
- size goes up. Seven consecutive levels of semibold was a Rubik-era setting,
37
- and holding 600 all the way down to text-sm made every heading shout equally
38
- — a heading stops being a headline somewhere, and the scale should say where.
39
-
40
- The ladder spans three weights — 400/500/600 — and 600 is the ceiling. No
41
- tier goes to 700: the display end separates itself by SIZE and tracking, not
42
- by weight, and a 30px 700 next to a 30px 500 elsewhere on the same product
43
- reads as two different type systems rather than one ladder.
44
-
45
- Both faces load as VARIABLE fonts (@fontsource-variable/inter,
46
- @fontsource-variable/instrument-sans), so the whole axis ships either way —
47
- the 600 ceiling is a design decision, not a payload one.
48
-
49
- With a single face carrying both headings and body, weight and tracking are
50
- the only things separating a heading from the copy around it — so the tiers
51
- have to actually differ, rather than all sitting at 600.
52
-
53
- REVISED 2026-08-24. The ladder above described weight falling with size, but
54
- the code ran 500/500/600/600/500/500 — a hump, where the LARGEST headings
55
- were the LIGHTEST and h3 outweighed h1. Two rules were in play and neither
56
- won cleanly. It is now monotonic: 600 for headings of consequence (h1-h4),
57
- 500 for small labels (h5/h6), 400 body. The display end still separates
58
- itself by SIZE and tracking, which is what the paragraph above asks of it;
59
- what it no longer does is separate itself by being *lighter* than the
60
- smaller headings beneath it. 600 remains the ceiling. */
61
-
62
- /* 600. This reverses the earlier "500, not 700" setting — not back toward 700,
63
- which stays banned, but up to the ceiling the ladder already used for h3/h4.
64
- The 500 was only ever visible in production: the dev-only TypeDevPanel has
65
- shipped a `wd: 600` default that overrode this with !important, so every
66
- local preview of this site has been 600 while rebase.pro rendered 500. The
67
- panel's constant is now telling the truth. */
68
- .typography-h1 {
69
- @apply text-4xl font-headers font-semibold tracking-display;
70
- }
71
-
72
- .typography-h2 {
73
- @apply text-3xl font-headers font-semibold tracking-display;
74
- }
75
-
76
- .typography-h3 {
77
- @apply text-2xl font-headers font-semibold tracking-title;
78
- }
79
-
80
- /* Semibold, not medium: h4 is the section heading inside a page, and at 20px
81
- medium sits close enough to body copy that a long page reads as one
82
- undifferentiated column. */
83
- .typography-h4 {
84
- @apply text-xl font-headers font-semibold tracking-title;
85
- }
86
-
87
- .typography-h5 {
88
- @apply text-lg font-headers font-medium tracking-heading;
89
- }
90
-
91
- .typography-h6 {
92
- @apply text-base font-headers font-medium tracking-heading;
93
- }
94
-
95
- .typography-subtitle1 {
96
- @apply text-sm font-headers font-medium tracking-heading;
97
- }
98
-
99
- .typography-subtitle2 {
100
- @apply text-sm font-headers font-medium;
101
- }
102
-
103
- .typography-body1 {
104
- @apply text-sm;
105
- }
106
-
107
- .typography-body2 {
108
- @apply text-xs;
109
- }
110
-
111
- .typography-caption {
112
- @apply text-[11px] leading-[1.4];
113
- }
114
-
115
- .typography-label {
116
- @apply text-xs font-medium tracking-wide;
117
- }
118
-
119
- .typography-inherit {
120
- @apply text-inherit;
121
- }
122
-
123
- .typography-button {
124
- @apply text-sm font-semibold tracking-wide;
125
- }
126
-
127
- /* ---------------------------------------------------------------------------
128
- * Three tiers the product kept improvising because the system had no name for
129
- * them. Each existed as hand-written utilities in several places before it
130
- * existed here, which is the definition of a missing token.
131
- * ------------------------------------------------------------------------- */
132
-
133
- /* The sentence under a page title. `body2` (12px) was standing in for it, which
134
- made the one line explaining what a page is FOR smaller than the page's own
135
- table rows. A lead is read once, deliberately, and it gets room to be read. */
136
- .typography-lead {
137
- @apply text-base leading-relaxed;
138
- }
139
-
140
- /* The micro-label above a value: SCANNED, KEPT, TOOK, WHEN. Uppercase and
141
- tracked so it reads as a field name rather than as copy, and small enough
142
- that it never competes with the value it names.
143
-
144
- This is the one product tier below `text-xs`. It earns the exception by never
145
- carrying a sentence — it is always one or two words naming the thing directly
146
- underneath it, and at 11px uppercase with this tracking it stays legible
147
- where 11px prose would not. */
148
- .typography-micro {
149
- @apply text-2xs font-medium uppercase tracking-[0.08em];
150
- }
151
-
152
- /* A measured value: a count, a duration, a timestamp, an id, a size.
153
- `tabular-nums` is the point — proportional digits make a column of numbers
154
- ragged and a live-updating counter jitter as its glyphs change width. */
155
- .typography-mono {
156
- @apply font-mono tabular-nums;
157
- }
158
-
159
- /* The headline number on a stat tile. Display tracking and tabular figures so a
160
- row of tiles shares a baseline grid. Semibold, not bold: the number is
161
- already the largest thing on the tile, and 600 is the system ceiling. */
162
- .typography-stat {
163
- @apply text-3xl font-headers font-semibold tracking-display tabular-nums;
164
- }
165
-
166
- :focus-visible {
167
- @apply outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-0 focus-visible:ring-offset-transparent
168
- }
169
-
package/src/index.ts DELETED
@@ -1,47 +0,0 @@
1
- // =============================================================================
2
- // Components
3
- // =============================================================================
4
- export * from "./components";
5
-
6
- // =============================================================================
7
- // Views
8
- // =============================================================================
9
- export * from "./views";
10
-
11
- // =============================================================================
12
- // Icons
13
- // =============================================================================
14
- export * from "./icons";
15
-
16
- // =============================================================================
17
- // Design System Utilities
18
- // =============================================================================
19
- export * from "./styles";
20
- export { cls } from "./util/cls";
21
- export { lazyChunk, loadChunk, isChunkLoadError } from "./util/lazy_chunk";
22
- export { CHIP_COLORS, CHIP_HUES, CHIP_SEED_KEYS, getColorSchemeForKey, getColorSchemeForSeed } from "./util/chip_colors";
23
- export type { ChipHue, ChipTone } from "./util/chip_colors";
24
-
25
- // =============================================================================
26
- // Public Hooks
27
- // =============================================================================
28
- export { useOutsideAlerter } from "./hooks/useOutsideAlerter";
29
- export { useDebouncedCallback } from "./hooks/useDebouncedCallback";
30
- export { useDebounceCallback } from "./hooks/useDebounceCallback";
31
- export { useDebounceValue } from "./hooks/useDebounceValue";
32
- export { useInjectStyles } from "./hooks/useInjectStyles";
33
- export { PortalContainerProvider, usePortalContainer } from "./hooks/PortalContainerContext";
34
- export type { PortalContainerContextType, PortalContainerProviderProps } from "./hooks/PortalContainerContext";
35
-
36
- // =============================================================================
37
- // Lower-level utilities (used by framework packages)
38
- // =============================================================================
39
- export { debounce } from "./util/debounce";
40
- export type { Cancelable } from "./util/debounce";
41
-
42
- // =============================================================================
43
- // NOT exported (internal plumbing — import directly if needed):
44
- //
45
- // ./util/hash – hashString
46
- // ./util/key_to_icon_component – keyToIconComponent
47
- // =============================================================================
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Migration script: fix lucide-react icon size props.
4
- *
5
- * Replaces string-based size props on lucide icon components
6
- * with numeric values from the iconSize map:
7
- * "smallest" -> 16
8
- * "small" -> 20
9
- * "medium" -> 24
10
- * "large" -> 28
11
- *
12
- * Only targets lines that match lucide icon component patterns
13
- * (PascalCase names ending with "Icon"), NOT IconButton/CircularProgress/etc.
14
- */
15
-
16
- const fs = require("fs");
17
- const path = require("path");
18
-
19
- const SIZE_MAP = {
20
- smallest: 16,
21
- small: 20,
22
- medium: 24,
23
- large: 28
24
- };
25
-
26
- const files = process.argv.slice(2);
27
-
28
- if (files.length === 0) {
29
- console.error("Usage: node fixIconSizes.js <file1> <file2> ...");
30
- process.exit(1);
31
- }
32
-
33
- let totalReplacements = 0;
34
-
35
- for (const filePath of files) {
36
- const content = fs.readFileSync(filePath, "utf8");
37
- let modified = content;
38
- let fileReplacements = 0;
39
-
40
- // Match patterns like: <SomeIcon size={"small"}/> or <SomeIcon size="small"/>
41
- // But NOT <IconButton, <CircularProgress, <CollectionSize, <AIIcon, <FileIcon, <IconForView
42
- // We target lines where the JSX tag name is a PascalCase name ending with "Icon"
43
- // preceded by < (opening tag)
44
- for (const [sizeStr, sizeNum] of Object.entries(SIZE_MAP)) {
45
- // Pattern: size={"sizeStr"} on Icon components (not IconButton etc.)
46
- // We replace size={"small"} -> size={20} only when it appears on a lucide icon line
47
- const patterns = [
48
- `size={"${sizeStr}"}`,
49
- `size="${sizeStr}"`
50
- ];
51
-
52
- for (const pattern of patterns) {
53
- const replacement = `size={${sizeNum}}`;
54
-
55
- // Process line by line to check context
56
- const lines = modified.split("\n");
57
- for (let i = 0; i < lines.length; i++) {
58
- const line = lines[i];
59
- if (!line.includes(pattern)) continue;
60
-
61
- // Skip if this is IconButton, CircularProgress, or other non-lucide components
62
- if (/\<(IconButton|CircularProgress|Icon |AIIcon|FileIcon|IconForView|CollectionSize)/.test(line)) continue;
63
-
64
- // Check if this line contains a lucide-style icon component (PascalCase ending with Icon)
65
- if (/\<[A-Z][a-zA-Z0-9]+Icon/.test(line)) {
66
- const newLine = line.replace(pattern, replacement);
67
- if (newLine !== line) {
68
- lines[i] = newLine;
69
- fileReplacements++;
70
- }
71
- }
72
- }
73
- modified = lines.join("\n");
74
- }
75
- }
76
-
77
- if (fileReplacements > 0) {
78
- // Check if file uses iconSize import, add if not
79
- if (modified.includes("iconSize") === false && /\bsize=\{(16|20|24|28)\}/.test(modified)) {
80
- // Add iconSize import — but actually we're using raw numbers, not iconSize references
81
- // So no import needed. The migration from previous session already set up the constants.
82
- }
83
-
84
- fs.writeFileSync(filePath, modified, "utf8");
85
- console.log(`✅ ${path.relative(process.cwd(), filePath)}: ${fileReplacements} replacement(s)`);
86
- totalReplacements += fileReplacements;
87
- } else {
88
- console.log(`⏭️ ${path.relative(process.cwd(), filePath)}: no changes`);
89
- }
90
- }
91
-
92
- console.log(`\nTotal: ${totalReplacements} replacements across ${files.length} files`);
@@ -1,106 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Replace raw numeric icon sizes with iconSize.xxx constants
4
- * and add the import if needed.
5
- *
6
- * size={16} -> size={iconSize.smallest}
7
- * size={20} -> size={iconSize.small}
8
- * size={24} -> size={iconSize.medium}
9
- * size={28} -> size={iconSize.large}
10
- */
11
-
12
- const fs = require("fs");
13
- const path = require("path");
14
-
15
- const SIZE_MAP = {
16
- 16: "iconSize.smallest",
17
- 20: "iconSize.small",
18
- 24: "iconSize.medium",
19
- 28: "iconSize.large"
20
- };
21
-
22
- // Regex to match lucide icon components with raw numeric sizes
23
- // e.g. <FilterIcon size={20}/> or <ArrowLeftIcon size={16}/>
24
- const ICON_SIZE_RE = /<([A-Z][a-zA-Z0-9]*Icon)\b[^>]*\bsize=\{(16|20|24|28)\}/;
25
-
26
- const files = process.argv.slice(2);
27
- if (!files.length) {
28
- console.error("Usage: node fixIconSizesToConst.cjs <files...>");
29
- process.exit(1);
30
- }
31
-
32
- let totalReplacements = 0;
33
-
34
- for (const filePath of files) {
35
- let content = fs.readFileSync(filePath, "utf8");
36
- let fileReplacements = 0;
37
-
38
- // Check if file has any lucide icon with raw numeric size
39
- if (!ICON_SIZE_RE.test(content)) {
40
- continue;
41
- }
42
-
43
- // Replace size={16|20|24|28} on Icon component lines
44
- const lines = content.split("\n");
45
- for (let i = 0; i < lines.length; i++) {
46
- const line = lines[i];
47
- // Skip non-icon components
48
- if (/\<(IconButton|CircularProgress|Icon |AIIcon|FileIconComp|IconForView|CollectionSize)/.test(line)) continue;
49
-
50
- // Only target lucide icon components
51
- if (/<[A-Z][a-zA-Z0-9]*Icon\b/.test(line)) {
52
- let newLine = line;
53
- for (const [num, constant] of Object.entries(SIZE_MAP)) {
54
- newLine = newLine.replace(
55
- new RegExp(`size=\\{${num}\\}`, "g"),
56
- `size={${constant}}`
57
- );
58
- }
59
- if (newLine !== line) {
60
- lines[i] = newLine;
61
- fileReplacements += (line.match(/size=\{(16|20|24|28)\}/g) || []).length;
62
- }
63
- }
64
- }
65
-
66
- if (fileReplacements === 0) continue;
67
-
68
- content = lines.join("\n");
69
-
70
- // Add iconSize import if not already present
71
- if (!content.includes("iconSize")) {
72
- // This shouldn't happen since we just added it, but safety check
73
- }
74
-
75
- if (content.includes("iconSize") && !content.match(/import\s.*iconSize/)) {
76
- // Try to add to existing @rebasepro/ui import
77
- const uiImportRe = /import\s*\{([^}]+)\}\s*from\s*["']@rebasepro\/ui["']/;
78
- const match = content.match(uiImportRe);
79
- if (match) {
80
- const existingImports = match[1];
81
- if (!existingImports.includes("iconSize")) {
82
- content = content.replace(
83
- uiImportRe,
84
- `import {${existingImports}, iconSize } from "@rebasepro/ui"`
85
- );
86
- }
87
- } else {
88
- // Add new import after the last import line
89
- const importLines = content.split("\n");
90
- let lastImportIdx = -1;
91
- for (let i = 0; i < importLines.length; i++) {
92
- if (/^import\s/.test(importLines[i])) lastImportIdx = i;
93
- }
94
- if (lastImportIdx >= 0) {
95
- importLines.splice(lastImportIdx + 1, 0, 'import { iconSize } from "@rebasepro/ui";');
96
- content = importLines.join("\n");
97
- }
98
- }
99
- }
100
-
101
- fs.writeFileSync(filePath, content, "utf8");
102
- console.log(`✅ ${path.relative(process.cwd(), filePath)}: ${fileReplacements} replacement(s)`);
103
- totalReplacements += fileReplacements;
104
- }
105
-
106
- console.log(`\nTotal: ${totalReplacements} replacements`);
@@ -1,41 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
- import * as LucideIcons from "lucide-react";
5
-
6
- export async function generateIconKeys() {
7
- const keys = Object.keys(LucideIcons).filter(k =>
8
- k !== "createLucideIcon" &&
9
- k !== "default" &&
10
- k !== "icons" &&
11
- k !== "LucideIcon" &&
12
- k !== "Icon" &&
13
- k !== "LucideProvider" &&
14
- k !== "useLucideContext" &&
15
- !k.endsWith("Node") &&
16
- !k.endsWith("Props") &&
17
- !k.endsWith("Icon") &&
18
- // Filter out Lucide-prefixed duplicates (e.g. "LucideArrowDown" duplicates "ArrowDown")
19
- !k.startsWith("Lucide")
20
- );
21
-
22
- // Remove case-insensitive duplicates (e.g. "ArrowDownAZ" vs "ArrowDownAz"),
23
- // keeping the first occurrence (typically the canonical PascalCase name)
24
- const seen = new Set<string>();
25
- const deduped = keys.filter(k => {
26
- const lower = k.toLowerCase();
27
- if (seen.has(lower)) return false;
28
- seen.add(lower);
29
- return true;
30
- });
31
-
32
- saveIconKeys(deduped);
33
- return deduped;
34
- }
35
-
36
- function saveIconKeys(keys: string[]) {
37
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
38
- fs.writeFileSync(path.join(__dirname, "../icons/icon_keys.ts"), `export const iconKeys = ${JSON.stringify(keys, null, 4)};`);
39
- }
40
-
41
- generateIconKeys();
@@ -1,4 +0,0 @@
1
- import { generateIconKeys } from "./generateIconKeys.ts";
2
- import { saveIconFiles } from "./saveIconFiles.ts";
3
-
4
- generateIconKeys().then(saveIconFiles);