@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.
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,153 +0,0 @@
1
- "use client";
2
- import React from "react";
3
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4
-
5
- import { cls } from "../util";
6
- import { useInjectStyles } from "../hooks";
7
- import { usePortalContainer } from "../hooks/PortalContainerContext";
8
-
9
- export type TooltipProps = {
10
- open?: boolean,
11
- defaultOpen?: boolean,
12
- onOpenChange?: (open: boolean) => void,
13
- side?: "top" | "bottom" | "left" | "right",
14
- align?: "start" | "center" | "end",
15
- sideOffset?: number,
16
- title?: string | React.ReactNode,
17
- delayDuration?: number;
18
- asChild?: boolean;
19
- tooltipClassName?: string,
20
- tooltipStyle?: React.CSSProperties;
21
- children: React.ReactNode,
22
- className?: string,
23
- container?: HTMLElement,
24
- style?: React.CSSProperties;
25
- };
26
-
27
- export const Tooltip = ({
28
- open,
29
- defaultOpen,
30
- side = "bottom",
31
- delayDuration = 200,
32
- sideOffset,
33
- align,
34
- onOpenChange,
35
- title,
36
- tooltipClassName,
37
- tooltipStyle,
38
- children,
39
- asChild = false,
40
- container,
41
- className,
42
- style
43
- }: TooltipProps) => {
44
-
45
- useInjectStyles("Tooltip", styles);
46
-
47
- // Get the portal container from context
48
- const contextContainer = usePortalContainer();
49
-
50
- // Prioritize manual prop, fallback to context container
51
- const finalContainer = (container ?? contextContainer ?? undefined) as HTMLElement | undefined;
52
-
53
- if (!title)
54
- return <>{children}</>;
55
-
56
- const trigger = asChild
57
- ? <TooltipPrimitive.Trigger asChild={true}>
58
- {children}
59
- </TooltipPrimitive.Trigger>
60
- : <TooltipPrimitive.Trigger asChild={true}>
61
- <div style={style} className={className}>
62
- {children}
63
- </div>
64
- </TooltipPrimitive.Trigger>;
65
-
66
- return (
67
- <TooltipPrimitive.Provider delayDuration={delayDuration}>
68
- <TooltipPrimitive.Root {...(open !== undefined ? { open,
69
- onOpenChange } : {})} defaultOpen={defaultOpen}>
70
- {trigger}
71
- <TooltipPrimitive.Portal container={finalContainer}>
72
- <TooltipPrimitive.Content
73
- className={cls("TooltipContent",
74
- "max-w-lg leading-relaxed",
75
- "z-50 rounded-md px-3 py-2 text-xs leading-none bg-surface-accent-700 dark:bg-surface-accent-800 bg-opacity-90 bg-surface-accent-700/90 dark:bg-surface-accent-800/90 font-medium text-surface-accent-50 shadow-2xl select-none duration-400 ease-in transform opacity-100",
76
- tooltipClassName)}
77
- style={tooltipStyle}
78
- sideOffset={sideOffset === undefined ? 4 : sideOffset}
79
- align={align}
80
- side={side}>
81
- {title}
82
- </TooltipPrimitive.Content>
83
- </TooltipPrimitive.Portal>
84
- </TooltipPrimitive.Root>
85
- </TooltipPrimitive.Provider>
86
- );
87
- };
88
-
89
- const styles = `
90
-
91
- .TooltipContent {
92
- animation-duration: 220ms;
93
- animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
94
- will-change: transform, opacity;
95
- }
96
-
97
- .TooltipContent[data-state='delayed-open'][data-side='top'] {
98
- animation-name: slideDownAndFade;
99
- }
100
- .TooltipContent[data-state='delayed-open'][data-side='right'] {
101
- animation-name: slideLeftAndFade;
102
- }
103
- .TooltipContent[data-state='delayed-open'][data-side='bottom'] {
104
- animation-name: slideUpAndFade;
105
- }
106
- .TooltipContent[data-state='delayed-open'][data-side='left'] {
107
- animation-name: slideRightAndFade;
108
- }
109
-
110
-
111
- @keyframes slideUpAndFade {
112
- from {
113
- opacity: 0;
114
- transform: translateY(4px);
115
- }
116
- to {
117
- opacity: 1;
118
- transform: translateY(0);
119
- }
120
- }
121
-
122
- @keyframes slideRightAndFade {
123
- from {
124
- opacity: 0;
125
- transform: translateX(-4px);
126
- }
127
- to {
128
- opacity: 1;
129
- transform: translateX(0);
130
- }
131
- }
132
-
133
- @keyframes slideDownAndFade {
134
- from {
135
- opacity: 0;
136
- transform: translateY(-4px);
137
- }
138
- to {
139
- opacity: 1;
140
- transform: translateY(0);
141
- }
142
- }
143
-
144
- @keyframes slideLeftAndFade {
145
- from {
146
- opacity: 0;
147
- transform: translateX(4px);
148
- }
149
- to {
150
- opacity: 1;
151
- transform: translateX(0);
152
- }
153
- }`;
@@ -1,132 +0,0 @@
1
- import React, { ReactEventHandler } from "react";
2
- import { cls } from "../util";
3
-
4
- export type TypographyVariant = keyof typeof typographyVariants;
5
- export type TypographyProps<C extends React.ElementType = "span"> = {
6
- align?: "center" | "inherit" | "justify" | "left" | "right";
7
- children?: React.ReactNode;
8
- className?: string;
9
- component?: C;
10
- gutterBottom?: boolean;
11
- noWrap?: boolean;
12
- paragraph?: boolean;
13
- variant?: TypographyVariant;
14
- variantMapping?: { [key: string]: string };
15
- color?: "inherit" | "initial" | "primary" | "secondary" | "disabled" | "error";
16
- onClick?: ReactEventHandler<HTMLElement>;
17
- style?: React.CSSProperties;
18
- } & React.ComponentPropsWithoutRef<C>;
19
-
20
- const typographyVariants = {
21
- h1: "h1",
22
- h2: "h2",
23
- h3: "h3",
24
- h4: "h4",
25
- h5: "h5",
26
- h6: "h6",
27
- subtitle1: "h6",
28
- subtitle2: "h6",
29
- label: "label",
30
- body1: "p",
31
- body2: "p",
32
- inherit: "p",
33
- caption: "p",
34
- button: "span",
35
- lead: "p",
36
- micro: "span",
37
- mono: "span",
38
- stat: "span"
39
- };
40
-
41
- const colorToClasses = {
42
- inherit: "text-inherit",
43
- initial: "text-current",
44
- primary: "text-text-primary dark:text-text-primary-dark",
45
- secondary: "text-text-secondary dark:text-text-secondary-dark",
46
- disabled: "text-text-disabled dark:text-text-disabled-dark",
47
- error: "text-red-600 dark:text-red-500"
48
- };
49
-
50
- const gutterBottomClasses = {
51
- h1: "mb-5",
52
- h2: "mb-4",
53
- h3: "mb-4",
54
- h4: "mb-4",
55
- h5: "mb-3",
56
- h6: "mb-3",
57
- subtitle1: "mb-3",
58
- subtitle2: "mb-3",
59
- body1: "mb-3",
60
- body2: "mb-3",
61
- inherit: "mb-3",
62
- caption: "mb-2",
63
- button: "mb-2",
64
- label: "mb-2",
65
- lead: "mb-4",
66
- micro: "mb-1",
67
- mono: "mb-2",
68
- stat: "mb-1"
69
- };
70
-
71
- const variantToClasses = {
72
- h1: "typography-h1",
73
- h2: "typography-h2",
74
- h3: "typography-h3",
75
- h4: "typography-h4",
76
- h5: "typography-h5",
77
- h6: "typography-h6",
78
- subtitle1: "typography-subtitle1",
79
- subtitle2: "typography-subtitle2",
80
- body1: "typography-body1",
81
- body2: "typography-body2",
82
- label: "typography-label",
83
- inherit: "typography-inherit",
84
- caption: "typography-caption",
85
- button: "typography-button",
86
- lead: "typography-lead",
87
- micro: "typography-micro",
88
- mono: "typography-mono",
89
- stat: "typography-stat"
90
- };
91
-
92
- export function Typography<C extends React.ElementType = "span">(
93
- {
94
- align = "inherit",
95
- color = "primary",
96
- children,
97
- className,
98
- component,
99
- gutterBottom = false,
100
- noWrap = false,
101
- paragraph = false,
102
- variant = "body1",
103
- variantMapping = typographyVariants,
104
- style,
105
- onClick,
106
- ...other
107
- }: TypographyProps<C>
108
- ) {
109
- const Component =
110
- component ||
111
- (paragraph ? "p" : variantMapping[variant] || typographyVariants[variant]) ||
112
- "span";
113
-
114
- const classes = cls(
115
- variantToClasses[variant],
116
- color ? colorToClasses[color] : "",
117
- align !== "inherit" && `text-${align}`,
118
- gutterBottom && gutterBottomClasses[variant],
119
- noWrap && "truncate",
120
- paragraph && "mb-3",
121
- className
122
- );
123
-
124
- return (
125
- <Component className={classes}
126
- onClick={onClick}
127
- style={style}
128
- {...other}>
129
- {children}
130
- </Component>
131
- );
132
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- import React from "react";
5
- import { render } from "@testing-library/react";
6
- import { VirtualTable } from "./VirtualTable";
7
- import { VirtualTableProps } from "./VirtualTableProps";
8
-
9
- // Counts executions of the row component body. The real VirtualTableRow is
10
- // swapped for a memoized stub so the count reflects React's bail-out decision
11
- // and nothing else.
12
- const renderCallback = jest.fn();
13
- jest.mock("./VirtualTableRow", () => {
14
- const React = require("react");
15
- // Memoized like the real component: without this the stub would re-render
16
- // on any parent render and the count would say nothing about the context.
17
- const VirtualTableRow = React.memo((props: any) => {
18
- renderCallback();
19
- return <div data-testid="row">{props.children}</div>;
20
- });
21
- VirtualTableRow.displayName = "VirtualTableRow";
22
- return { VirtualTableRow };
23
- });
24
-
25
- // Fixed bounds: the real hook measures nothing in jsdom, so the list would
26
- // render zero rows.
27
- jest.mock("react-use-measure", () => {
28
- return () => [
29
- (element: any) => {},
30
- { width: 500,
31
- height: 500,
32
- top: 0,
33
- left: 0,
34
- bottom: 0,
35
- right: 0,
36
- x: 0,
37
- y: 0 }
38
- ];
39
- });
40
-
41
- // jsdom has no ResizeObserver, and VirtualTable passes the global in as the
42
- // `react-use-measure` polyfill — the identifier has to resolve even though the
43
- // mock above means it is never constructed.
44
- global.ResizeObserver = class ResizeObserver {
45
- observe() {}
46
- unobserve() {}
47
- disconnect() {}
48
- };
49
-
50
- describe("VirtualTable Performance", () => {
51
-
52
- beforeEach(() => {
53
- renderCallback.mockClear();
54
- });
55
-
56
- it("does not re-render rows when VirtualTable re-renders but data is unchanged", async () => {
57
- const columns = [{ key: "col1",
58
- title: "Column 1",
59
- width: 100 }];
60
- const data = Array.from({ length: 10 }).map((_, i) => ({ col1: `Value ${i}` }));
61
- const cellRenderer = () => <div>Cell</div>;
62
-
63
- const props: VirtualTableProps<any> = {
64
- data,
65
- columns,
66
- rowHeight: 50,
67
- cellRenderer
68
- };
69
-
70
- const { rerender } = render(<VirtualTable {...props}
71
- className={"a"}/>);
72
-
73
- const initialRenderCount = renderCallback.mock.calls.length;
74
- expect(initialRenderCount).toBe(data.length);
75
-
76
- // `className` is deliberately NOT one of the context memo's dependencies:
77
- // changing it forces VirtualTable's body to run again (React.memo on the
78
- // table itself would otherwise bail out) while every value the rows read
79
- // stays identical.
80
- rerender(<VirtualTable {...props}
81
- className={"b"}/>);
82
-
83
- // Rows read everything through VirtualListContext, and the value handed
84
- // to the provider is memoized. If that memo goes away the provider gets a
85
- // fresh object, every Consumer re-runs, and each one hands the row a new
86
- // `style` object and a new children array — which defeats React.memo and
87
- // re-renders all 10 rows. So an unchanged count is the whole assertion.
88
- expect(renderCallback.mock.calls.length).toBe(initialRenderCount);
89
- });
90
- });