@payglocal_ui/flux-ui 0.2.5 → 0.2.6
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/dist/index.cjs +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data-table.tsx +13 -2
- package/src/dropdown-menu.tsx +9 -3
package/package.json
CHANGED
package/src/data-table.tsx
CHANGED
|
@@ -239,6 +239,16 @@ export function DataTable<T>({
|
|
|
239
239
|
return seen === 0 ? base : `${base}__${seen}`;
|
|
240
240
|
});
|
|
241
241
|
|
|
242
|
+
/**
|
|
243
|
+
* No rows to show. The width hints are dropped in this state: a grid whose
|
|
244
|
+
* columns carry minimums (via `colgroup` in fixed layout, or `cellClassName`
|
|
245
|
+
* in the others) would otherwise have its HEADER row alone force the table
|
|
246
|
+
* past the container and raise a horizontal scrollbar — over an empty region
|
|
247
|
+
* with nothing to scroll to. Headers still render, at their natural width, so
|
|
248
|
+
* the shape of the missing data is still legible.
|
|
249
|
+
*/
|
|
250
|
+
const isEmpty = !isLoading && paginated.length === 0;
|
|
251
|
+
|
|
242
252
|
const comfortable = density === "comfortable";
|
|
243
253
|
const compact = density === "compact";
|
|
244
254
|
const compactCellPad = compact
|
|
@@ -331,7 +341,7 @@ export function DataTable<T>({
|
|
|
331
341
|
width: "100%",
|
|
332
342
|
}}
|
|
333
343
|
>
|
|
334
|
-
{tableLayout === "fixed" && (
|
|
344
|
+
{tableLayout === "fixed" && !isEmpty && (
|
|
335
345
|
<colgroup>
|
|
336
346
|
{hasExpand ? <col style={{ width: 40 }} /> : null}
|
|
337
347
|
{columns.map((col) => (
|
|
@@ -376,7 +386,8 @@ export function DataTable<T>({
|
|
|
376
386
|
: col.align === "center"
|
|
377
387
|
? "text-center"
|
|
378
388
|
: "text-left",
|
|
379
|
-
|
|
389
|
+
// Width hints live in `cellClassName`; see `isEmpty`.
|
|
390
|
+
!isEmpty && col.cellClassName
|
|
380
391
|
)}
|
|
381
392
|
>
|
|
382
393
|
{col.header}
|
package/src/dropdown-menu.tsx
CHANGED
|
@@ -19,7 +19,9 @@ const DropdownMenuSubTrigger = React.forwardRef<
|
|
|
19
19
|
<DropdownMenuPrimitive.SubTrigger
|
|
20
20
|
ref={ref}
|
|
21
21
|
className={cn(
|
|
22
|
-
|
|
22
|
+
// Matches DropdownMenuItem: a submenu row sits in the same list as the
|
|
23
|
+
// plain rows, so it cannot be a different size from them.
|
|
24
|
+
"flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none",
|
|
23
25
|
"focus:bg-muted data-[state=open]:bg-muted",
|
|
24
26
|
inset && "pl-8",
|
|
25
27
|
className
|
|
@@ -94,7 +96,9 @@ const DropdownMenuCheckboxItem = React.forwardRef<
|
|
|
94
96
|
<DropdownMenuPrimitive.CheckboxItem
|
|
95
97
|
ref={ref}
|
|
96
98
|
className={cn(
|
|
97
|
-
|
|
99
|
+
// Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /
|
|
100
|
+
// dot indicator's, not padding.
|
|
101
|
+
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors",
|
|
98
102
|
"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
99
103
|
className
|
|
100
104
|
)}
|
|
@@ -118,7 +122,9 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
118
122
|
<DropdownMenuPrimitive.RadioItem
|
|
119
123
|
ref={ref}
|
|
120
124
|
className={cn(
|
|
121
|
-
|
|
125
|
+
// Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /
|
|
126
|
+
// dot indicator's, not padding.
|
|
127
|
+
"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors",
|
|
122
128
|
"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
123
129
|
className
|
|
124
130
|
)}
|