@open-mercato/ui 0.6.5-develop.5382.1.f542de69af → 0.6.5
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/.turbo/turbo-build.log +1 -1
- package/dist/backend/AppShell.js +15 -8
- package/dist/backend/AppShell.js.map +2 -2
- package/dist/backend/DataTable.js +10 -9
- package/dist/backend/DataTable.js.map +2 -2
- package/dist/backend/charts/KpiCard.js +22 -14
- package/dist/backend/charts/KpiCard.js.map +2 -2
- package/dist/backend/charts/Sparkline.js +75 -0
- package/dist/backend/charts/Sparkline.js.map +7 -0
- package/dist/backend/charts/index.js +4 -1
- package/dist/backend/charts/index.js.map +2 -2
- package/dist/backend/dashboard/DashboardScreen.js +1 -2
- package/dist/backend/dashboard/DashboardScreen.js.map +2 -2
- package/dist/backend/injection/InjectionSpot.js +23 -6
- package/dist/backend/injection/InjectionSpot.js.map +2 -2
- package/dist/primitives/avatar.js +2 -2
- package/dist/primitives/avatar.js.map +2 -2
- package/dist/primitives/pagination.js +3 -3
- package/dist/primitives/pagination.js.map +2 -2
- package/package.json +5 -6
- package/src/backend/AppShell.tsx +18 -8
- package/src/backend/DataTable.tsx +16 -9
- package/src/backend/__tests__/AppShell.test.tsx +61 -1
- package/src/backend/__tests__/DataTable.stickyResponsive.test.tsx +99 -0
- package/src/backend/charts/KpiCard.tsx +22 -12
- package/src/backend/charts/Sparkline.tsx +87 -0
- package/src/backend/charts/index.ts +2 -1
- package/src/backend/dashboard/DashboardScreen.tsx +1 -2
- package/src/backend/injection/InjectionSpot.tsx +27 -7
- package/src/backend/injection/__tests__/InjectionSpot.remount.test.tsx +140 -0
- package/src/primitives/__tests__/alert.test.tsx +16 -0
- package/src/primitives/__tests__/avatar.test.tsx +36 -1
- package/src/primitives/__tests__/pagination.test.tsx +31 -0
- package/src/primitives/avatar.tsx +8 -2
- package/src/primitives/pagination.tsx +3 -3
|
@@ -60,6 +60,37 @@ describe('Pagination', () => {
|
|
|
60
60
|
expect(nav.getAttribute('aria-label')).toBe('Pagination')
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
+
// The info text, page buttons, and page-size select together need ~600px of
|
|
64
|
+
// min-content (info and the select are shrink-0). Without flex-wrap the row
|
|
65
|
+
// cannot compress on a phone-width container, overflows its card, and drags
|
|
66
|
+
// the whole page into horizontal scroll. Every level that holds a fixed-width,
|
|
67
|
+
// shrink-0 button run must be allowed to wrap: the root row, the controls
|
|
68
|
+
// group (first/prev/pages/next/last ≈ 392px at 6 pages — wider than a phone
|
|
69
|
+
// on its own), and the page-number list itself (so a long run wraps instead
|
|
70
|
+
// of overflowing). Wrapping just the outer row leaves the ~392px controls
|
|
71
|
+
// group on a single unbreakable line that still overflows.
|
|
72
|
+
it('lets every fixed-width control row wrap on narrow containers', () => {
|
|
73
|
+
const { container } = render(
|
|
74
|
+
<Pagination
|
|
75
|
+
page={3}
|
|
76
|
+
pageSize={20}
|
|
77
|
+
total={120}
|
|
78
|
+
onPageChange={() => {}}
|
|
79
|
+
onPageSizeChange={() => {}}
|
|
80
|
+
/>,
|
|
81
|
+
)
|
|
82
|
+
const tokensOf = (selector: string) => {
|
|
83
|
+
const el = container.querySelector(selector) as HTMLElement | null
|
|
84
|
+
expect(el).not.toBeNull()
|
|
85
|
+
return (el!.getAttribute('class') ?? '').split(/\s+/).filter(Boolean)
|
|
86
|
+
}
|
|
87
|
+
expect(tokensOf('[data-slot="pagination"]')).toEqual(
|
|
88
|
+
expect.arrayContaining(['flex-wrap', 'justify-between']),
|
|
89
|
+
)
|
|
90
|
+
expect(tokensOf('[data-slot="pagination-controls"]')).toContain('flex-wrap')
|
|
91
|
+
expect(tokensOf('[data-slot="pagination-pages"]')).toContain('flex-wrap')
|
|
92
|
+
})
|
|
93
|
+
|
|
63
94
|
it('renders "Page X of Y" info by default', () => {
|
|
64
95
|
const { container } = render(
|
|
65
96
|
<Pagination page={2} pageSize={10} total={100} onPageChange={() => {}} />,
|
|
@@ -279,12 +279,18 @@ export type AvatarStackProps = {
|
|
|
279
279
|
max?: number
|
|
280
280
|
size?: VariantProps<typeof avatarVariants>['size']
|
|
281
281
|
className?: string
|
|
282
|
+
/**
|
|
283
|
+
* Additional hidden items not represented by `children` — e.g. a server-truncated list that
|
|
284
|
+
* already returned only the top N owners. Added to the children-derived overflow so the
|
|
285
|
+
* "+N" badge reflects the true number of omitted items, not just the ones dropped locally.
|
|
286
|
+
*/
|
|
287
|
+
overflowCount?: number
|
|
282
288
|
}
|
|
283
289
|
|
|
284
|
-
export function AvatarStack({ children, max = 4, size = 'md', className }: AvatarStackProps) {
|
|
290
|
+
export function AvatarStack({ children, max = 4, size = 'md', className, overflowCount = 0 }: AvatarStackProps) {
|
|
285
291
|
const items = React.Children.toArray(children)
|
|
286
292
|
const visible = items.slice(0, max)
|
|
287
|
-
const overflow = items.length - max
|
|
293
|
+
const overflow = Math.max(0, items.length - max) + Math.max(0, overflowCount)
|
|
288
294
|
|
|
289
295
|
return (
|
|
290
296
|
<div
|
|
@@ -235,7 +235,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
|
|
|
235
235
|
ref={ref}
|
|
236
236
|
data-slot="pagination"
|
|
237
237
|
aria-label={props['aria-label'] ?? t('ui.pagination.landmark.ariaLabel', 'Pagination')}
|
|
238
|
-
className={cn('flex w-full items-center justify-between gap-6', className)}
|
|
238
|
+
className={cn('flex w-full flex-wrap items-center justify-between gap-x-6 gap-y-2', className)}
|
|
239
239
|
{...props}
|
|
240
240
|
>
|
|
241
241
|
{showInfo ? (
|
|
@@ -251,7 +251,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
|
|
|
251
251
|
|
|
252
252
|
<div
|
|
253
253
|
data-slot="pagination-controls"
|
|
254
|
-
className="
|
|
254
|
+
className="flex flex-wrap items-center justify-center gap-2"
|
|
255
255
|
>
|
|
256
256
|
{showFirstLast ? (
|
|
257
257
|
<button
|
|
@@ -280,7 +280,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
|
|
|
280
280
|
|
|
281
281
|
<ol
|
|
282
282
|
data-slot="pagination-pages"
|
|
283
|
-
className="
|
|
283
|
+
className="flex flex-wrap items-center justify-center gap-2 list-none"
|
|
284
284
|
>
|
|
285
285
|
{items.map((entry, index) => {
|
|
286
286
|
if (entry === 'ellipsis-left' || entry === 'ellipsis-right') {
|