@lovett/ui 0.0.3 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovett/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "restricted"
@@ -10,6 +10,7 @@
10
10
  */
11
11
 
12
12
  export { DataGrid } from './data-grid'
13
+ export { DataGridToolbar, type DataGridToolbarProps } from './toolbar'
13
14
  export { DataGridColumnOptionsMenu } from './column-options-menu'
14
15
  export { DrawerPanel } from './drawer-panel'
15
16
  export {
@@ -34,13 +34,12 @@ export const Table = forwardRef<
34
34
  style={{
35
35
  border: '1px solid rgb(var(--border))',
36
36
  borderRadius: 'var(--radius-lg)',
37
- // Thin, light scrollbars (light slate thumb on a transparent track).
38
- // Deliberately NOT styling ::-webkit-scrollbar that would force
39
- // classic always-on bars; leaving it unset preserves the platform's
40
- // auto-hiding overlay bars so they don't sit over the pinned action
41
- // column / content.
42
- scrollbarWidth: 'thin',
43
- scrollbarColor: 'rgba(100, 116, 139, 0.4) transparent',
37
+ // NOTE: intentionally NOT setting scrollbar-width / scrollbar-color.
38
+ // On macOS, any custom scrollbar property opts the element out of the
39
+ // platform's auto-hiding *overlay* scrollbars into *classic*
40
+ // always-visible ones which left the vertical bar permanently
41
+ // covering the pinned action column. Native overlay bars are already
42
+ // thin + light AND auto-hide, so we leave them untouched.
44
43
  }}
45
44
  >
46
45
  <table
@@ -0,0 +1,44 @@
1
+ /**
2
+ * DataGridToolbar — the standard layout band that sits directly above a
3
+ * DataGrid: a search field on the left and filter / column / view
4
+ * controls on the right (gray-ui "table toolbar" pattern). Collapses to
5
+ * a stacked column on narrow viewports.
6
+ *
7
+ * Purely a layout primitive — pass whatever search input + action
8
+ * buttons you like into the slots.
9
+ */
10
+
11
+ import type { ReactNode } from 'react'
12
+
13
+ import { cn } from '../lib/utils'
14
+
15
+ export interface DataGridToolbarProps {
16
+ /** Left slot — typically a <SearchBar>. Stretches up to a comfortable
17
+ * reading width, full-width when stacked. */
18
+ search?: ReactNode
19
+ /** Right slot — filter / columns / view-toggle controls. */
20
+ children?: ReactNode
21
+ className?: string
22
+ }
23
+
24
+ export function DataGridToolbar({
25
+ search,
26
+ children,
27
+ className,
28
+ }: DataGridToolbarProps) {
29
+ return (
30
+ <div
31
+ className={cn(
32
+ 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',
33
+ className,
34
+ )}
35
+ >
36
+ {search ? <div className="w-full sm:max-w-sm">{search}</div> : <span />}
37
+ {children ? (
38
+ <div className="flex flex-wrap items-center gap-2 sm:justify-end">
39
+ {children}
40
+ </div>
41
+ ) : null}
42
+ </div>
43
+ )
44
+ }
package/src/index.ts CHANGED
@@ -109,6 +109,7 @@ export {
109
109
  } from './dropdown-menu'
110
110
  export {
111
111
  DataGrid,
112
+ DataGridToolbar,
112
113
  DataGridColumnOptionsMenu,
113
114
  DataGridDragOverlay,
114
115
  DataGridDropIndicator,
@@ -117,6 +118,7 @@ export {
117
118
  type DataGridProps,
118
119
  type DataGridRowBase,
119
120
  type DataGridSortState,
121
+ type DataGridToolbarProps,
120
122
  type DataGridToolbarRenderProps,
121
123
  type DataGridIcon,
122
124
  type EditingCell,