@open-mercato/ui 0.10.1-develop.8045.1.3e5aadf0fb → 0.10.1-develop.8050.1.45ae874fe7

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.
@@ -5,7 +5,7 @@ function FrontendLayout({ header, footer, children }) {
5
5
  /* @__PURE__ */ jsx(FlashMessages, {}),
6
6
  header ? /* @__PURE__ */ jsx("div", { className: "border-b bg-background/80", children: header }) : null,
7
7
  /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children }),
8
- footer ? /* @__PURE__ */ jsx("div", { className: "border-t bg-background/80", children: footer }) : null
8
+ footer ? /* @__PURE__ */ jsx("div", { className: "border-t bg-background/80 empty:hidden", children: footer }) : null
9
9
  ] });
10
10
  }
11
11
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/frontend/Layout.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\nimport { FlashMessages } from '../backend/FlashMessages'\n\nexport function FrontendLayout({ header, footer, children }: { header?: React.ReactNode; footer?: React.ReactNode; children: React.ReactNode }) {\n return (\n <div className=\"min-h-svh flex flex-col\">\n <FlashMessages />\n {header ? <div className=\"border-b bg-background/80\">{header}</div> : null}\n <div className=\"flex-1 min-h-0\">{children}</div>\n {footer ? <div className=\"border-t bg-background/80\">{footer}</div> : null}\n </div>\n )\n}\n"],
5
- "mappings": "AAKI,SACE,KADF;AAJJ,SAAS,qBAAqB;AAEvB,SAAS,eAAe,EAAE,QAAQ,QAAQ,SAAS,GAAsF;AAC9I,SACE,qBAAC,SAAI,WAAU,2BACb;AAAA,wBAAC,iBAAc;AAAA,IACd,SAAS,oBAAC,SAAI,WAAU,6BAA6B,kBAAO,IAAS;AAAA,IACtE,oBAAC,SAAI,WAAU,kBAAkB,UAAS;AAAA,IACzC,SAAS,oBAAC,SAAI,WAAU,6BAA6B,kBAAO,IAAS;AAAA,KACxE;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react'\nimport { FlashMessages } from '../backend/FlashMessages'\n\nexport function FrontendLayout({ header, footer, children }: { header?: React.ReactNode; footer?: React.ReactNode; children: React.ReactNode }) {\n return (\n <div className=\"min-h-svh flex flex-col\">\n <FlashMessages />\n {header ? <div className=\"border-b bg-background/80\">{header}</div> : null}\n <div className=\"flex-1 min-h-0\">{children}</div>\n {footer ? <div className=\"border-t bg-background/80 empty:hidden\">{footer}</div> : null}\n </div>\n )\n}\n"],
5
+ "mappings": "AAKI,SACE,KADF;AAJJ,SAAS,qBAAqB;AAEvB,SAAS,eAAe,EAAE,QAAQ,QAAQ,SAAS,GAAsF;AAC9I,SACE,qBAAC,SAAI,WAAU,2BACb;AAAA,wBAAC,iBAAc;AAAA,IACd,SAAS,oBAAC,SAAI,WAAU,6BAA6B,kBAAO,IAAS;AAAA,IACtE,oBAAC,SAAI,WAAU,kBAAkB,UAAS;AAAA,IACzC,SAAS,oBAAC,SAAI,WAAU,0CAA0C,kBAAO,IAAS;AAAA,KACrF;AAEJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/ui",
3
- "version": "0.10.1-develop.8045.1.3e5aadf0fb",
3
+ "version": "0.10.1-develop.8050.1.45ae874fe7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -156,14 +156,14 @@
156
156
  "remark-gfm": "^4.0.1"
157
157
  },
158
158
  "peerDependencies": {
159
- "@open-mercato/shared": "0.10.1-develop.8045.1.3e5aadf0fb",
159
+ "@open-mercato/shared": "0.10.1-develop.8050.1.45ae874fe7",
160
160
  "react": ">=18.0.0",
161
161
  "react-dom": ">=18.0.0",
162
162
  "react-is": ">=18.0.0"
163
163
  },
164
164
  "devDependencies": {
165
165
  "@figma/code-connect": "^1.3.4",
166
- "@open-mercato/shared": "0.10.1-develop.8045.1.3e5aadf0fb",
166
+ "@open-mercato/shared": "0.10.1-develop.8050.1.45ae874fe7",
167
167
  "@testing-library/dom": "^10.4.1",
168
168
  "@testing-library/jest-dom": "^7.0.1",
169
169
  "@testing-library/react": "^16.3.3",
@@ -1628,7 +1628,7 @@ function AppShellBody({ productName, logo, email, canManageUpgradeActions = fals
1628
1628
  spotId={LEGACY_GLOBAL_MUTATION_INJECTION_SPOT_ID}
1629
1629
  context={injectionContext}
1630
1630
  />
1631
- <div id="om-top-banners" className="mb-3 space-y-2" />
1631
+ <div id="om-top-banners" className="mb-3 space-y-2 empty:hidden" />
1632
1632
  <OrganizationScopeBoundary active={isOnSettingsPath}>
1633
1633
  <BackendRecordInjectionContextProvider setCurrentRecordInjectionContext={setCurrentRecordInjectionContext}>
1634
1634
  {children}
@@ -3810,7 +3810,7 @@ function DataTableImpl<T extends RowData>({
3810
3810
  )}
3811
3811
  {shouldRenderToolbarBelow ? <div className={toolbarWrapperClassName}>{builtToolbar}</div> : null}
3812
3812
  {headerInjectionSpotId ? (
3813
- <div className={embedded ? 'mt-2' : 'mt-3'}>
3813
+ <div className={embedded ? 'mt-2 empty:hidden' : 'mt-3 empty:hidden'}>
3814
3814
  <InjectionSpot spotId={headerInjectionSpotId} context={resolvedInjectionContext} />
3815
3815
  </div>
3816
3816
  ) : null}
@@ -283,6 +283,30 @@ describe('AppShell', () => {
283
283
  expect(screen.getByRole('main')).toHaveAttribute('tabindex', '-1')
284
284
  })
285
285
 
286
+ // Modules portal banners (e.g. record locks) into `#om-top-banners`; while
287
+ // nothing is portaled in, the slot must not keep its bottom margin as an
288
+ // empty gap above every page.
289
+ it('collapses the top banner slot while it is empty and keeps it as a portal target', () => {
290
+ renderWithProviders(
291
+ <AppShell email="demo@example.com" groups={groups}>
292
+ <div>Child content</div>
293
+ </AppShell>,
294
+ { dict },
295
+ )
296
+
297
+ const bannerSlot = document.getElementById('om-top-banners')
298
+ expect(bannerSlot).not.toBeNull()
299
+ expect(bannerSlot).toHaveClass('empty:hidden')
300
+ expect(bannerSlot).toBeEmptyDOMElement()
301
+
302
+ const banner = document.createElement('div')
303
+ banner.textContent = 'Multiple users are currently on this record.'
304
+ bannerSlot?.appendChild(banner)
305
+
306
+ expect(bannerSlot).not.toBeEmptyDOMElement()
307
+ expect(bannerSlot).toHaveTextContent('Multiple users are currently on this record.')
308
+ })
309
+
286
310
  it('keeps the incoming page breadcrumb when the pathname change and ApplyBreadcrumb land in the same commit', () => {
287
311
  const { rerender } = renderWithProviders(
288
312
  <AppShell email="demo@example.com" groups={groups}>
@@ -144,6 +144,30 @@ describe('DataTable extensions', () => {
144
144
  view.cleanupQueryClient()
145
145
  })
146
146
 
147
+ // With no widgets registered, the header/footer injection spots render
148
+ // nothing; their wrappers must collapse instead of leaving an empty gap
149
+ // under the filter bar and an empty bordered strip above the pagination.
150
+ it.each([false, true])('collapses empty header and footer injection spot wrappers (embedded: %s)', async (embedded) => {
151
+ const view = renderTable({
152
+ title: 'People',
153
+ columns: [{ accessorKey: 'name', header: 'Name' }],
154
+ data: [{ id: 'r1', name: 'Alice' }],
155
+ extensionTableId: 'tests.empty-slots',
156
+ embedded,
157
+ })
158
+
159
+ await waitFor(() => expect(screen.getByRole('columnheader', { name: 'Name' })).toBeInTheDocument())
160
+ const slotWrappers = Array.from(view.container.querySelectorAll('div.empty\\:hidden'))
161
+ expect(slotWrappers).toHaveLength(2)
162
+ slotWrappers.forEach((wrapper) => expect(wrapper).toBeEmptyDOMElement())
163
+
164
+ const widget = document.createElement('div')
165
+ widget.textContent = 'Injected footer widget'
166
+ slotWrappers[1].appendChild(widget)
167
+ expect(slotWrappers[1]).not.toBeEmptyDOMElement()
168
+ view.cleanupQueryClient()
169
+ })
170
+
147
171
  it('executes transforms and wrappers at the derived DataTable handle', () => {
148
172
  registerComponentOverrides([
149
173
  {
@@ -7,7 +7,7 @@ export function FrontendLayout({ header, footer, children }: { header?: React.Re
7
7
  <FlashMessages />
8
8
  {header ? <div className="border-b bg-background/80">{header}</div> : null}
9
9
  <div className="flex-1 min-h-0">{children}</div>
10
- {footer ? <div className="border-t bg-background/80">{footer}</div> : null}
10
+ {footer ? <div className="border-t bg-background/80 empty:hidden">{footer}</div> : null}
11
11
  </div>
12
12
  )
13
13
  }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
+ import * as React from 'react'
6
+ import { render, screen } from '@testing-library/react'
7
+ import { FrontendLayout } from '../Layout'
8
+
9
+ jest.mock('../../backend/FlashMessages', () => ({
10
+ FlashMessages: () => null,
11
+ }))
12
+
13
+ function NothingToShow() {
14
+ return null
15
+ }
16
+
17
+ // A footer element is always truthy, even when its component renders nothing
18
+ // (e.g. an injection spot with no widgets). The wrapper must then hide itself
19
+ // instead of leaving an empty bordered strip at the bottom of the page.
20
+ describe('FrontendLayout footer', () => {
21
+ it('hides the footer wrapper while the footer renders nothing', () => {
22
+ const { container } = render(
23
+ <FrontendLayout footer={<NothingToShow />}>
24
+ <div>Page</div>
25
+ </FrontendLayout>,
26
+ )
27
+
28
+ const footerWrapper = container.querySelector('.border-t')
29
+ expect(footerWrapper).not.toBeNull()
30
+ expect(footerWrapper).toHaveClass('empty:hidden')
31
+ expect(footerWrapper).toBeEmptyDOMElement()
32
+ })
33
+
34
+ it('renders the footer content inside the wrapper', () => {
35
+ const { container } = render(
36
+ <FrontendLayout footer={<p>Footer links</p>}>
37
+ <div>Page</div>
38
+ </FrontendLayout>,
39
+ )
40
+
41
+ expect(screen.getByText('Footer links')).toBeInTheDocument()
42
+ expect(container.querySelector('.border-t')).not.toBeEmptyDOMElement()
43
+ })
44
+ })