@reactberry/system 2.0.0-beta

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 (165) hide show
  1. package/README.md +48 -0
  2. package/package.json +74 -0
  3. package/src/blocks/Accordion/index.tsx +158 -0
  4. package/src/blocks/AnimatedCarousel/index.tsx +188 -0
  5. package/src/blocks/AppleGlow/index.tsx +144 -0
  6. package/src/blocks/Avatar/index.tsx +167 -0
  7. package/src/blocks/Await/index.tsx +45 -0
  8. package/src/blocks/Cards/AnimatedCard/index.tsx +175 -0
  9. package/src/blocks/Cards/FluorescentCard/index.tsx +180 -0
  10. package/src/blocks/Cards/InfoCard/index.tsx +206 -0
  11. package/src/blocks/Cards/TickerCard/index.tsx +125 -0
  12. package/src/blocks/Carousel/index.tsx +216 -0
  13. package/src/blocks/Checkbox/index.tsx +101 -0
  14. package/src/blocks/Collection/index.tsx +59 -0
  15. package/src/blocks/Container/index.tsx +55 -0
  16. package/src/blocks/Controls/Control.tsx +67 -0
  17. package/src/blocks/Controls/index.tsx +11 -0
  18. package/src/blocks/CyclingNumber/index.tsx +78 -0
  19. package/src/blocks/DisplaySet/index.tsx +42 -0
  20. package/src/blocks/Divider/index.tsx +14 -0
  21. package/src/blocks/Draggable/index.tsx +266 -0
  22. package/src/blocks/Drawer/index.tsx +136 -0
  23. package/src/blocks/DynamicIsland/DynamicIsland.tsx +89 -0
  24. package/src/blocks/DynamicIsland/index.tsx +2 -0
  25. package/src/blocks/Fader/index.tsx +145 -0
  26. package/src/blocks/FamilyDrawer/README.md +116 -0
  27. package/src/blocks/FamilyDrawer/example.tsx +108 -0
  28. package/src/blocks/FamilyDrawer/index.tsx +119 -0
  29. package/src/blocks/FamilyDrawer/views/DefaultView.tsx +93 -0
  30. package/src/blocks/FamilyDrawer/views/KeyView.tsx +129 -0
  31. package/src/blocks/FamilyDrawer/views/PhraseView.tsx +129 -0
  32. package/src/blocks/FamilyDrawer/views/RemoveView.tsx +81 -0
  33. package/src/blocks/FieldSet/index.tsx +173 -0
  34. package/src/blocks/Filesystem/index.tsx +198 -0
  35. package/src/blocks/Gallery/Carousel/index.tsx +257 -0
  36. package/src/blocks/Gallery/Modal/index.tsx +83 -0
  37. package/src/blocks/Gallery/index.tsx +57 -0
  38. package/src/blocks/Gallery/utils/animationVariants.ts +18 -0
  39. package/src/blocks/Gallery/utils/aspectRatio.ts +14 -0
  40. package/src/blocks/Gallery/utils/downloadPhoto.ts +24 -0
  41. package/src/blocks/Gallery/utils/range.ts +11 -0
  42. package/src/blocks/GradientMesh/index.tsx +106 -0
  43. package/src/blocks/Group/index.tsx +152 -0
  44. package/src/blocks/Heading/index.tsx +111 -0
  45. package/src/blocks/HorizontalScroller/index.tsx +135 -0
  46. package/src/blocks/Icon/index.tsx +45 -0
  47. package/src/blocks/Indicator/index.tsx +27 -0
  48. package/src/blocks/InlineEditor/index.tsx +216 -0
  49. package/src/blocks/List/index.tsx +657 -0
  50. package/src/blocks/Main/index.tsx +17 -0
  51. package/src/blocks/Marquee/index.tsx +116 -0
  52. package/src/blocks/MaskedField/index.tsx +199 -0
  53. package/src/blocks/Menu/MenuContent.tsx +246 -0
  54. package/src/blocks/Menu/MenuContext.tsx +34 -0
  55. package/src/blocks/Menu/MenuItem.tsx +104 -0
  56. package/src/blocks/Menu/index.tsx +60 -0
  57. package/src/blocks/Modal/index.tsx +268 -0
  58. package/src/blocks/MorphingPopover/index.tsx +294 -0
  59. package/src/blocks/Overlay/Backdrop.tsx +48 -0
  60. package/src/blocks/Overlay/OverscrollGuard.tsx +36 -0
  61. package/src/blocks/Overlay/index.ts +2 -0
  62. package/src/blocks/Parallax/index.tsx +117 -0
  63. package/src/blocks/ParallaxSection/index.tsx +61 -0
  64. package/src/blocks/Placeholder/index.tsx +48 -0
  65. package/src/blocks/Popover/index.tsx +402 -0
  66. package/src/blocks/Progress/getProgressColor.ts +61 -0
  67. package/src/blocks/Progress/index.tsx +179 -0
  68. package/src/blocks/ProgressiveBlur/index.tsx +75 -0
  69. package/src/blocks/README.md +15 -0
  70. package/src/blocks/RenderAsset/index.tsx +18 -0
  71. package/src/blocks/ScrollContainer/index.tsx +93 -0
  72. package/src/blocks/ShinyText/index.tsx +72 -0
  73. package/src/blocks/Skeleton/index.tsx +71 -0
  74. package/src/blocks/Slider/SliderControls.tsx +119 -0
  75. package/src/blocks/Slider/index.tsx +140 -0
  76. package/src/blocks/Slider/useSlider.ts +126 -0
  77. package/src/blocks/Slideshow/index.tsx +177 -0
  78. package/src/blocks/Spotlight/index.tsx +144 -0
  79. package/src/blocks/Steps/StepIndicator.tsx +149 -0
  80. package/src/blocks/Steps/StepProgress.tsx +164 -0
  81. package/src/blocks/Steps/Steps.tsx +197 -0
  82. package/src/blocks/Steps/StepsNav.tsx +30 -0
  83. package/src/blocks/Steps/StepsTracker.tsx +80 -0
  84. package/src/blocks/Steps/hooks.ts +71 -0
  85. package/src/blocks/Steps/index.tsx +16 -0
  86. package/src/blocks/Steps/types.ts +71 -0
  87. package/src/blocks/StickySectionStack/index.tsx +136 -0
  88. package/src/blocks/Switch/index.tsx +85 -0
  89. package/src/blocks/SystemNotice/index.tsx +81 -0
  90. package/src/blocks/Table/README.md +251 -0
  91. package/src/blocks/Table/Table.tsx +207 -0
  92. package/src/blocks/Table/TablePagination.tsx +189 -0
  93. package/src/blocks/Table/index.ts +33 -0
  94. package/src/blocks/Table/useTableControls.ts +331 -0
  95. package/src/blocks/Tag/index.tsx +27 -0
  96. package/src/blocks/TextBreak/index.tsx +96 -0
  97. package/src/blocks/TextReveal/index.tsx +104 -0
  98. package/src/blocks/Thumbnail/index.tsx +26 -0
  99. package/src/blocks/Ticker/index.tsx +112 -0
  100. package/src/blocks/Toast/index.tsx +77 -0
  101. package/src/blocks/Tooltip/index.tsx +174 -0
  102. package/src/blocks/Underlay/index.tsx +104 -0
  103. package/src/blocks/Upload/Dropzone.tsx +92 -0
  104. package/src/blocks/Upload/UploadBtn.tsx +38 -0
  105. package/src/blocks/Upload/index.tsx +61 -0
  106. package/src/blocks/Upload/types.ts +37 -0
  107. package/src/blocks/VideoMarquee/index.tsx +511 -0
  108. package/src/blocks/index.ts +119 -0
  109. package/src/blocks/pagination/Pagination.tsx +148 -0
  110. package/src/blocks/pagination/PaginationList.tsx +41 -0
  111. package/src/blocks/pagination/index.ts +2 -0
  112. package/src/charts/BarChart.tsx +63 -0
  113. package/src/charts/PieChart.tsx +39 -0
  114. package/src/charts/index.ts +3 -0
  115. package/src/charts/utils.ts +103 -0
  116. package/src/docs/README.md +373 -0
  117. package/src/docs/reference/README.md +299 -0
  118. package/src/elements/box.ts +163 -0
  119. package/src/elements/button.ts +49 -0
  120. package/src/elements/field.ts +129 -0
  121. package/src/elements/index.ts +8 -0
  122. package/src/elements/text.ts +47 -0
  123. package/src/elements/utils.js +97 -0
  124. package/src/hooks/use-copy-to-clipboard.tsx +33 -0
  125. package/src/hooks/use-enter-submit.tsx +23 -0
  126. package/src/hooks/use-local-storage.ts +42 -0
  127. package/src/hooks/use-sidebar.tsx +109 -0
  128. package/src/hooks/useAnimatedText.ts +32 -0
  129. package/src/hooks/useAutosizeTextArea.ts +45 -0
  130. package/src/hooks/useBreakpoint.tsx +123 -0
  131. package/src/hooks/useClickOutside.tsx +38 -0
  132. package/src/hooks/useHover.tsx +33 -0
  133. package/src/hooks/useHoverList.tsx +17 -0
  134. package/src/hooks/useKeyboardShortcuts.ts +91 -0
  135. package/src/hooks/useKeypress.ts +27 -0
  136. package/src/hooks/useOverlay.ts +32 -0
  137. package/src/hooks/useReducedMotion.ts +25 -0
  138. package/src/hooks/useStandaloneMode.ts +35 -0
  139. package/src/hooks/useTouchDevice.ts +34 -0
  140. package/src/icons/index.tsx +129 -0
  141. package/src/index.ts +12 -0
  142. package/src/providers/DesignSystemProvider.tsx +35 -0
  143. package/src/providers/StyledComponentsRegistry.tsx +30 -0
  144. package/src/providers/index.ts +2 -0
  145. package/src/themes/README.md +30 -0
  146. package/src/themes/default/assets/badge-avatar.tsx +45 -0
  147. package/src/themes/default/assets/logo.tsx +42 -0
  148. package/src/themes/default/global.ts +138 -0
  149. package/src/themes/default/modes/dark/config.js +49 -0
  150. package/src/themes/default/modes/dark/skins.js +631 -0
  151. package/src/themes/default/modes/dark/theme.js +87 -0
  152. package/src/themes/default/modes/light/config.js +48 -0
  153. package/src/themes/default/modes/light/skins.js +1026 -0
  154. package/src/themes/default/modes/light/theme.js +74 -0
  155. package/src/themes/default/tokens/controls.js +53 -0
  156. package/src/themes/default/tokens/shadows.js +63 -0
  157. package/src/themes/default/tokens/shapes.js +37 -0
  158. package/src/themes/default/tokens/space.js +143 -0
  159. package/src/themes/default/tokens/spectre.js +16 -0
  160. package/src/themes/default/utils.js +523 -0
  161. package/src/themes/index.ts +11 -0
  162. package/src/types.ts +394 -0
  163. package/src/utils/overlayTheme.ts +61 -0
  164. package/src/utils/pickColor.ts +15 -0
  165. package/tsconfig.json +24 -0
@@ -0,0 +1,207 @@
1
+ import React from "react";
2
+ import Text from "../../elements/text";
3
+
4
+ // Table component types
5
+ export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
6
+ [key: string]: any; // Allow additional props
7
+ }
8
+
9
+ export interface TableHeaderProps
10
+ extends React.HTMLAttributes<HTMLTableSectionElement> {
11
+ [key: string]: any; // Allow additional props
12
+ }
13
+ export interface TableBodyProps
14
+ extends React.HTMLAttributes<HTMLTableSectionElement> {}
15
+ export interface TableFooterProps
16
+ extends React.HTMLAttributes<HTMLTableSectionElement> {}
17
+ export interface TableRowProps
18
+ extends React.HTMLAttributes<HTMLTableRowElement> {
19
+ /** Whether this row is selected */
20
+ selected?: boolean;
21
+ /** Whether this row is clickable */
22
+ clickable?: boolean;
23
+ /** Custom width for the row */
24
+ width?: string | number;
25
+
26
+ [key: string]: any; // Allow additional props
27
+ }
28
+ export interface TableCellProps
29
+ extends React.TdHTMLAttributes<HTMLTableCellElement> {
30
+ /** Alignment of cell content */
31
+ align?: "left" | "center" | "right";
32
+ /** Whether this is a header cell */
33
+ header?: boolean;
34
+ /** Column span */
35
+ colSpan?: number;
36
+ /** Row span */
37
+ rowSpan?: number;
38
+ /** Whether to truncate text content */
39
+ truncate?: boolean;
40
+ [key: string]: any; // Allow additional props
41
+ }
42
+
43
+ export interface TableHeaderCellProps
44
+ extends React.ThHTMLAttributes<HTMLTableCellElement> {
45
+ /** Alignment of cell content */
46
+ align?: "left" | "center" | "right";
47
+ /** Column span */
48
+ colSpan?: number;
49
+ /** Row span */
50
+ rowSpan?: number;
51
+ /** Whether to show a visual sort indicator */
52
+ sortable?: boolean;
53
+ /** Whether to truncate text content */
54
+ truncate?: boolean;
55
+ /** Custom width for the row */
56
+ width?: string | number;
57
+
58
+ [key: string]: any; // Allow additional props
59
+ }
60
+
61
+ export const Table: React.FC<TableProps> = ({ children, ...props }) => {
62
+ return (
63
+ <Text
64
+ as="table"
65
+ width="100%"
66
+ {...props}
67
+ // style={{ borderCollapse: "collapse" }}
68
+ >
69
+ {children}
70
+ </Text>
71
+ );
72
+ };
73
+
74
+ // Table Header component
75
+ export const TableHeader: React.FC<TableHeaderProps> = ({
76
+ children,
77
+ ...props
78
+ }) => {
79
+ return (
80
+ <Text as="thead" {...props}>
81
+ {children}
82
+ </Text>
83
+ );
84
+ };
85
+
86
+ // Table Body component
87
+ export const TableBody: React.FC<TableBodyProps> = ({ children, ...props }) => {
88
+ return (
89
+ <Text as="tbody" {...props}>
90
+ {children}
91
+ </Text>
92
+ );
93
+ };
94
+
95
+ // Table Footer component
96
+ export const TableFooter: React.FC<TableFooterProps> = ({
97
+ children,
98
+ ...props
99
+ }) => {
100
+ return (
101
+ <Text as="tfoot" {...props}>
102
+ {children}
103
+ </Text>
104
+ );
105
+ };
106
+
107
+ export const TableRow: React.FC<TableRowProps> = ({ children, ...props }) => {
108
+ return (
109
+ <Text as="tr" {...props}>
110
+ {children}
111
+ </Text>
112
+ );
113
+ };
114
+
115
+ // Table Cell component
116
+ export const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(
117
+ (
118
+ {
119
+ children,
120
+ align = "center",
121
+ colSpan,
122
+ rowSpan,
123
+ truncate = true,
124
+ width,
125
+ ...props
126
+ },
127
+ ref,
128
+ ) => {
129
+ const Component = "td";
130
+
131
+ return (
132
+ <Text
133
+ as={Component}
134
+ ref={ref as any}
135
+ textAlign={align}
136
+ position={"relative"}
137
+ border="1px solid"
138
+ // borderWidth="1px 0"
139
+ //skin="row"
140
+ {...props}
141
+ width={width}
142
+ colSpan={colSpan}
143
+ rowSpan={rowSpan}
144
+ height="2rem"
145
+ >
146
+ {/* If children is text, wrap in Text component for proper typography */}
147
+ {typeof children === "string" || typeof children === "number" ? (
148
+ <Text
149
+ fontSize={"s"}
150
+ title={truncate ? String(children) : undefined}
151
+ truncate={truncate}
152
+ style={{ verticalAlign: "middle" }}
153
+ >
154
+ {children}
155
+ </Text>
156
+ ) : (
157
+ <>{children}</>
158
+ )}
159
+ </Text>
160
+ );
161
+ },
162
+ );
163
+
164
+ // Table Header Cell component
165
+ export const TableHeaderCell: React.FC<TableHeaderCellProps> = ({
166
+ children,
167
+ align = "left",
168
+ colSpan,
169
+ rowSpan,
170
+ width = "auto",
171
+ ...props
172
+ }) => {
173
+ return (
174
+ <Text
175
+ as="th"
176
+ skin="row.header"
177
+ border="1px solid"
178
+ borderColor={"surface"}
179
+ fontSize="xxs"
180
+ fontWeight="700"
181
+ textAlign={align}
182
+ width={width}
183
+ {...props}
184
+ colSpan={colSpan}
185
+ rowSpan={rowSpan}
186
+ >
187
+ <Text
188
+ as="div"
189
+ width={width}
190
+ style={{
191
+ verticalAlign: "middle",
192
+ }}
193
+ >
194
+ {children}
195
+ </Text>
196
+ </Text>
197
+ );
198
+ };
199
+
200
+ // Convenience exports
201
+ Table.displayName = "Table";
202
+ TableHeader.displayName = "TableHeader";
203
+ TableBody.displayName = "TableBody";
204
+ TableFooter.displayName = "TableFooter";
205
+ TableRow.displayName = "TableRow";
206
+ TableCell.displayName = "TableCell";
207
+ TableHeaderCell.displayName = "TableHeaderCell";
@@ -0,0 +1,189 @@
1
+ import React from "react";
2
+ import Box from "../../elements/box";
3
+ import Text from "../../elements/text";
4
+ import Button from "../../elements/button";
5
+
6
+ export interface TablePaginationProps {
7
+ /** Current page number (0-based) */
8
+ currentPage: number;
9
+ /** Total number of pages */
10
+ totalPages: number;
11
+ /** Total number of items */
12
+ totalItems: number;
13
+ /** Number of items per page */
14
+ itemsPerPage: number;
15
+ /** Callback when page changes */
16
+ onPageChange: (page: number) => void;
17
+ /** Whether to show page size selector */
18
+ showPageSize?: boolean;
19
+ /** Available page size options */
20
+ pageSizeOptions?: number[];
21
+ /** Callback when page size changes */
22
+ onPageSizeChange?: (pageSize: number) => void;
23
+ /** Whether to show item count information */
24
+ showItemCount?: boolean;
25
+ /** Maximum number of page buttons to show */
26
+ maxPageButtons?: number;
27
+ }
28
+
29
+ export const TablePagination: React.FC<TablePaginationProps> = ({
30
+ currentPage,
31
+ totalPages,
32
+ totalItems,
33
+ itemsPerPage,
34
+ onPageChange,
35
+ showPageSize = false,
36
+ pageSizeOptions = [10, 25, 50, 100],
37
+ onPageSizeChange,
38
+ showItemCount = true,
39
+ maxPageButtons = 5,
40
+ }) => {
41
+ const startItem = currentPage * itemsPerPage + 1;
42
+ const endItem = Math.min((currentPage + 1) * itemsPerPage, totalItems);
43
+
44
+ // Calculate page numbers to display
45
+ const getPageNumbers = () => {
46
+ const pages: (number | string)[] = [];
47
+
48
+ if (totalPages <= maxPageButtons) {
49
+ // Show all pages
50
+ for (let i = 0; i < totalPages; i++) {
51
+ pages.push(i);
52
+ }
53
+ } else {
54
+ // Show first page
55
+ pages.push(0);
56
+
57
+ // Calculate range around current page
58
+ const halfRange = Math.floor((maxPageButtons - 3) / 2);
59
+ const startRange = Math.max(1, currentPage - halfRange);
60
+ const endRange = Math.min(totalPages - 2, currentPage + halfRange);
61
+
62
+ // Add ellipsis if needed
63
+ if (startRange > 1) {
64
+ pages.push("...");
65
+ }
66
+
67
+ // Add pages in range
68
+ for (let i = startRange; i <= endRange; i++) {
69
+ pages.push(i);
70
+ }
71
+
72
+ // Add ellipsis if needed
73
+ if (endRange < totalPages - 2) {
74
+ pages.push("...");
75
+ }
76
+
77
+ // Show last page
78
+ pages.push(totalPages - 1);
79
+ }
80
+
81
+ return pages;
82
+ };
83
+
84
+ const pageNumbers = getPageNumbers();
85
+
86
+ return (
87
+ <Box
88
+ display="flex"
89
+ flexDirection={["column", "row"]}
90
+ alignItems={["stretch", "center"]}
91
+ justifyContent="space-between"
92
+ gap="m"
93
+ p="m"
94
+ borderTop="1px solid"
95
+ borderColor="palette.neutrals.200"
96
+ >
97
+ {/* Left side - Item count and page size */}
98
+ <Box display="flex" alignItems="center" gap="m" flexWrap="wrap">
99
+ {showItemCount && (
100
+ <Text fontSize="s" color="secondary">
101
+ Showing {startItem}-{endItem} of {totalItems} items
102
+ </Text>
103
+ )}
104
+
105
+ {showPageSize && onPageSizeChange && (
106
+ <Box display="flex" alignItems="center" gap="xs">
107
+ <Text fontSize="s" color="secondary">
108
+ Items per page:
109
+ </Text>
110
+ <select
111
+ style={{
112
+ padding: "var(--space-s)",
113
+ borderRadius: "var(--radii-s)",
114
+ border: "1px solid var(--colors-palette-neutrals-300)",
115
+ fontSize: "var(--fontSizes-s)",
116
+ backgroundColor: "white",
117
+ cursor: "pointer",
118
+ }}
119
+ value={itemsPerPage}
120
+ onChange={(e) => onPageSizeChange(Number(e.target.value))}
121
+ >
122
+ {pageSizeOptions.map((size) => (
123
+ <option key={size} value={size}>
124
+ {size}
125
+ </option>
126
+ ))}
127
+ </select>
128
+ </Box>
129
+ )}
130
+ </Box>
131
+
132
+ {/* Right side - Pagination controls */}
133
+ <Box display="flex" alignItems="center" gap="xs">
134
+ <Button
135
+ variant="ghost"
136
+ $size="small"
137
+ onClick={() => onPageChange(currentPage - 1)}
138
+ disabled={currentPage === 0}
139
+ aria-label="Previous page"
140
+ >
141
+
142
+ </Button>
143
+
144
+ {pageNumbers.map((page, index) => {
145
+ if (page === "...") {
146
+ return (
147
+ <Box key={`ellipsis-${index}`} px="s">
148
+ <Text fontSize="s" color="secondary">
149
+ ...
150
+ </Text>
151
+ </Box>
152
+ );
153
+ }
154
+
155
+ const pageNumber = page as number;
156
+ const isActive = pageNumber === currentPage;
157
+
158
+ return (
159
+ <Button
160
+ key={pageNumber}
161
+ variant={isActive ? "primary" : "ghost"}
162
+ $size="small"
163
+ onClick={() => onPageChange(pageNumber)}
164
+ aria-label={`Go to page ${pageNumber + 1}`}
165
+ aria-current={isActive ? "page" : undefined}
166
+ style={{
167
+ minWidth: "32px",
168
+ }}
169
+ >
170
+ {pageNumber + 1}
171
+ </Button>
172
+ );
173
+ })}
174
+
175
+ <Button
176
+ variant="ghost"
177
+ $size="small"
178
+ onClick={() => onPageChange(currentPage + 1)}
179
+ disabled={currentPage === totalPages - 1}
180
+ aria-label="Next page"
181
+ >
182
+
183
+ </Button>
184
+ </Box>
185
+ </Box>
186
+ );
187
+ };
188
+
189
+ TablePagination.displayName = "TablePagination";
@@ -0,0 +1,33 @@
1
+ export {
2
+ Table,
3
+ TableHeader,
4
+ TableBody,
5
+ TableFooter,
6
+ TableRow,
7
+ TableCell,
8
+ TableHeaderCell,
9
+ } from "./Table";
10
+ export type {
11
+ TableProps,
12
+ TableHeaderProps,
13
+ TableBodyProps,
14
+ TableFooterProps,
15
+ TableRowProps,
16
+ TableCellProps,
17
+ TableHeaderCellProps,
18
+ } from "./Table";
19
+
20
+ export { TablePagination } from "./TablePagination";
21
+ export type { TablePaginationProps } from "./TablePagination";
22
+
23
+ export {
24
+ useTableControls,
25
+ useTableFilters,
26
+ useFilteredTableControls,
27
+ } from "./useTableControls";
28
+ export type {
29
+ UseTableControlsOptions,
30
+ UseTableControlsReturn,
31
+ UseTableFiltersOptions,
32
+ UseTableFiltersReturn,
33
+ } from "./useTableControls";