@contractspec/lib.design-system 4.2.0 → 4.4.0
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/README.md +128 -0
- package/dist/browser/components/data-view/DataViewGrid.js +1 -0
- package/dist/browser/components/data-view/DataViewList.js +1 -1
- package/dist/browser/components/data-view/DataViewRenderer.js +1 -1
- package/dist/browser/components/data-view/DataViewTable.js +1 -1
- package/dist/browser/components/data-view/collection.js +1 -0
- package/dist/browser/components/data-view/utils.js +1 -1
- package/dist/browser/components/forms/controls/Select.js +1 -1
- package/dist/browser/components/molecules/Tabs.js +1 -1
- package/dist/browser/components/object-reference/DefaultObjectReferenceDetail.js +1 -0
- package/dist/browser/components/object-reference/DefaultObjectReferenceParts.js +1 -0
- package/dist/browser/components/object-reference/DefaultObjectReferenceProperty.js +1 -0
- package/dist/browser/components/object-reference/ObjectReferenceHandler.js +1 -0
- package/dist/browser/components/object-reference/ObjectReferencePanel.js +1 -0
- package/dist/browser/components/object-reference/ReferenceIcon.js +1 -0
- package/dist/browser/components/object-reference/actions.js +1 -0
- package/dist/browser/components/object-reference/index.js +1 -0
- package/dist/browser/components/object-reference/maps.js +1 -0
- package/dist/browser/components/object-reference/runtime.js +1 -0
- package/dist/browser/components/object-reference/types.js +0 -0
- package/dist/browser/components/object-reference/url-safety.js +1 -0
- package/dist/browser/components/object-reference/useObjectReferenceController.js +1 -0
- package/dist/browser/components/organisms/Header.js +1 -1
- package/dist/browser/components/organisms/MarketingHeader.js +1 -1
- package/dist/browser/components/organisms/MarketingHeaderMobile.js +1 -1
- package/dist/browser/components/overlays/AdaptivePanel.js +1 -0
- package/dist/browser/components/overlays/index.js +1 -0
- package/dist/browser/components/shell/AppShell.js +1 -0
- package/dist/browser/components/shell/AppShell.types.js +0 -0
- package/dist/browser/components/shell/PageOutline.js +1 -0
- package/dist/browser/components/shell/ShellNotifications.js +1 -0
- package/dist/browser/components/shell/ShellSidebar.js +1 -0
- package/dist/browser/components/shell/index.js +1 -0
- package/dist/browser/components/shell/outline.js +1 -0
- package/dist/browser/components/shell/policy.js +1 -0
- package/dist/browser/components/shell/types.js +0 -0
- package/dist/browser/design-system.feature.js +1 -1
- package/dist/browser/i18n/translation.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/renderers/form-contract/phone-country-control.js +1 -0
- package/dist/browser/renderers/form-contract/phone-country-utils.js +1 -0
- package/dist/browser/renderers/form-contract/phone-field.js +1 -0
- package/dist/browser/renderers/form-contract/phone-utils.js +1 -0
- package/dist/browser/renderers/form-contract/renderer.js +1 -1
- package/dist/browser/renderers/form-contract/rich-fields.js +1 -1
- package/dist/browser/renderers/form-contract/shell.js +1 -1
- package/dist/browser/renderers/form-contract/values.js +1 -1
- package/dist/browser/shell.js +1 -0
- package/dist/components/data-view/DataViewGrid.d.ts +12 -0
- package/dist/components/data-view/DataViewGrid.js +1 -0
- package/dist/components/data-view/DataViewGrid.native.d.ts +12 -0
- package/dist/components/data-view/DataViewList.d.ts +3 -2
- package/dist/components/data-view/DataViewList.js +1 -1
- package/dist/components/data-view/DataViewList.native.d.ts +12 -0
- package/dist/components/data-view/DataViewRenderer.d.ts +11 -2
- package/dist/components/data-view/DataViewRenderer.js +1 -1
- package/dist/components/data-view/DataViewRenderer.native.d.ts +11 -2
- package/dist/components/data-view/DataViewTable.d.ts +4 -3
- package/dist/components/data-view/DataViewTable.js +1 -1
- package/dist/components/data-view/DataViewTable.native.d.ts +4 -3
- package/dist/components/data-view/collection.d.ts +24 -0
- package/dist/components/data-view/collection.js +1 -0
- package/dist/components/data-view/utils.js +1 -1
- package/dist/components/forms/controls/Select.d.ts +1 -1
- package/dist/components/forms/controls/Select.js +1 -1
- package/dist/components/legal/molecules/LegalTOC.d.ts +1 -1
- package/dist/components/marketing/MarketingCardsSection.d.ts +1 -1
- package/dist/components/molecules/StatusChip.d.ts +1 -1
- package/dist/components/molecules/Tabs.js +1 -1
- package/dist/components/object-reference/DefaultObjectReferenceDetail.d.ts +10 -0
- package/dist/components/object-reference/DefaultObjectReferenceDetail.js +1 -0
- package/dist/components/object-reference/DefaultObjectReferenceParts.d.ts +15 -0
- package/dist/components/object-reference/DefaultObjectReferenceParts.js +1 -0
- package/dist/components/object-reference/DefaultObjectReferenceParts.native.d.ts +16 -0
- package/dist/components/object-reference/DefaultObjectReferenceProperty.d.ts +13 -0
- package/dist/components/object-reference/DefaultObjectReferenceProperty.js +1 -0
- package/dist/components/object-reference/ObjectReferenceHandler.d.ts +2 -0
- package/dist/components/object-reference/ObjectReferenceHandler.js +1 -0
- package/dist/components/object-reference/ObjectReferenceHandler.native.d.ts +2 -0
- package/dist/components/object-reference/ObjectReferencePanel.d.ts +18 -0
- package/dist/components/object-reference/ObjectReferencePanel.js +1 -0
- package/dist/components/object-reference/ReferenceIcon.d.ts +7 -0
- package/dist/components/object-reference/ReferenceIcon.js +1 -0
- package/dist/components/object-reference/actions.d.ts +12 -0
- package/dist/components/object-reference/actions.js +1 -0
- package/dist/components/object-reference/index.d.ts +6 -0
- package/dist/components/object-reference/index.js +1 -0
- package/dist/components/object-reference/index.native.d.ts +4 -0
- package/dist/components/object-reference/maps.d.ts +8 -0
- package/dist/components/object-reference/maps.js +1 -0
- package/dist/components/object-reference/runtime.d.ts +13 -0
- package/dist/components/object-reference/runtime.js +1 -0
- package/dist/components/object-reference/types.d.ts +106 -0
- package/dist/components/object-reference/types.js +0 -0
- package/dist/components/object-reference/url-safety.d.ts +2 -0
- package/dist/components/object-reference/url-safety.js +1 -0
- package/dist/components/object-reference/useObjectReferenceController.d.ts +16 -0
- package/dist/components/object-reference/useObjectReferenceController.js +1 -0
- package/dist/components/organisms/Header.js +1 -1
- package/dist/components/organisms/MarketingHeader.js +1 -1
- package/dist/components/organisms/MarketingHeaderMobile.js +1 -1
- package/dist/components/overlays/AdaptivePanel.d.ts +26 -0
- package/dist/components/overlays/AdaptivePanel.js +1 -0
- package/dist/components/overlays/index.d.ts +1 -0
- package/dist/components/overlays/index.js +1 -0
- package/dist/components/shell/AppShell.d.ts +2 -0
- package/dist/components/shell/AppShell.js +1 -0
- package/dist/components/shell/AppShell.native.d.ts +2 -0
- package/dist/components/shell/AppShell.types.d.ts +22 -0
- package/dist/components/shell/AppShell.types.js +0 -0
- package/dist/components/shell/PageOutline.d.ts +12 -0
- package/dist/components/shell/PageOutline.js +1 -0
- package/dist/components/shell/PageOutline.native.d.ts +11 -0
- package/dist/components/shell/ShellNotifications.d.ts +5 -0
- package/dist/components/shell/ShellNotifications.js +1 -0
- package/dist/components/shell/ShellNotifications.native.d.ts +5 -0
- package/dist/components/shell/ShellSidebar.d.ts +11 -0
- package/dist/components/shell/ShellSidebar.js +1 -0
- package/dist/components/shell/index.d.ts +8 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/components/shell/index.native.d.ts +5 -0
- package/dist/components/shell/outline.d.ts +5 -0
- package/dist/components/shell/outline.js +1 -0
- package/dist/components/shell/policy.d.ts +15 -0
- package/dist/components/shell/policy.js +1 -0
- package/dist/components/shell/types.d.ts +116 -0
- package/dist/components/shell/types.js +0 -0
- package/dist/design-system.feature.js +1 -1
- package/dist/i18n/translation.d.ts +6 -1
- package/dist/i18n/translation.js +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/native/components/data-view/DataViewGrid.js +1 -0
- package/dist/native/components/data-view/DataViewGrid.native.js +1 -0
- package/dist/native/components/data-view/DataViewList.js +1 -1
- package/dist/native/components/data-view/DataViewList.native.js +1 -0
- package/dist/native/components/data-view/DataViewRenderer.js +1 -1
- package/dist/native/components/data-view/DataViewRenderer.native.js +1 -1
- package/dist/native/components/data-view/DataViewTable.js +1 -1
- package/dist/native/components/data-view/DataViewTable.native.js +1 -1
- package/dist/native/components/data-view/collection.js +1 -0
- package/dist/native/components/data-view/utils.js +1 -1
- package/dist/native/components/forms/controls/Select.js +1 -1
- package/dist/native/components/molecules/Tabs.js +1 -1
- package/dist/native/components/molecules/Tabs.native.js +1 -1
- package/dist/native/components/object-reference/DefaultObjectReferenceDetail.js +1 -0
- package/dist/native/components/object-reference/DefaultObjectReferenceParts.js +1 -0
- package/dist/native/components/object-reference/DefaultObjectReferenceParts.native.js +1 -0
- package/dist/native/components/object-reference/DefaultObjectReferenceProperty.js +1 -0
- package/dist/native/components/object-reference/ObjectReferenceHandler.js +1 -0
- package/dist/native/components/object-reference/ObjectReferenceHandler.native.js +1 -0
- package/dist/native/components/object-reference/ObjectReferencePanel.js +1 -0
- package/dist/native/components/object-reference/ReferenceIcon.js +1 -0
- package/dist/native/components/object-reference/actions.js +1 -0
- package/dist/native/components/object-reference/index.js +1 -0
- package/dist/native/components/object-reference/index.native.js +1 -0
- package/dist/native/components/object-reference/maps.js +1 -0
- package/dist/native/components/object-reference/runtime.js +1 -0
- package/dist/native/components/object-reference/types.js +0 -0
- package/dist/native/components/object-reference/url-safety.js +1 -0
- package/dist/native/components/object-reference/useObjectReferenceController.js +1 -0
- package/dist/native/components/organisms/Header.js +1 -1
- package/dist/native/components/organisms/MarketingHeader.js +1 -1
- package/dist/native/components/organisms/MarketingHeaderMobile.js +1 -1
- package/dist/native/components/overlays/AdaptivePanel.js +1 -0
- package/dist/native/components/overlays/index.js +1 -0
- package/dist/native/components/shell/AppShell.js +1 -0
- package/dist/native/components/shell/AppShell.native.js +1 -0
- package/dist/native/components/shell/AppShell.types.js +0 -0
- package/dist/native/components/shell/PageOutline.js +1 -0
- package/dist/native/components/shell/PageOutline.native.js +1 -0
- package/dist/native/components/shell/ShellNotifications.js +1 -0
- package/dist/native/components/shell/ShellNotifications.native.js +1 -0
- package/dist/native/components/shell/ShellSidebar.js +1 -0
- package/dist/native/components/shell/index.js +1 -0
- package/dist/native/components/shell/index.native.js +1 -0
- package/dist/native/components/shell/outline.js +1 -0
- package/dist/native/components/shell/policy.js +1 -0
- package/dist/native/components/shell/types.js +0 -0
- package/dist/native/design-system.feature.js +1 -1
- package/dist/native/i18n/translation.js +1 -1
- package/dist/native/index.js +1 -1
- package/dist/native/renderers/form-contract/phone-country-control.js +1 -0
- package/dist/native/renderers/form-contract/phone-country-control.native.js +1 -0
- package/dist/native/renderers/form-contract/phone-country-utils.js +1 -0
- package/dist/native/renderers/form-contract/phone-field.js +1 -0
- package/dist/native/renderers/form-contract/phone-utils.js +1 -0
- package/dist/native/renderers/form-contract/renderer.js +1 -1
- package/dist/native/renderers/form-contract/rich-fields.js +1 -1
- package/dist/native/renderers/form-contract/shell.js +1 -1
- package/dist/native/renderers/form-contract/values.js +1 -1
- package/dist/native/shell.js +1 -0
- package/dist/native/shell.native.js +1 -0
- package/dist/renderers/form-contract/phone-country-control.d.ts +18 -0
- package/dist/renderers/form-contract/phone-country-control.js +1 -0
- package/dist/renderers/form-contract/phone-country-control.native.d.ts +18 -0
- package/dist/renderers/form-contract/phone-country-utils.d.ts +9 -0
- package/dist/renderers/form-contract/phone-country-utils.js +1 -0
- package/dist/renderers/form-contract/phone-field.d.ts +18 -0
- package/dist/renderers/form-contract/phone-field.js +1 -0
- package/dist/renderers/form-contract/phone-utils.d.ts +3 -0
- package/dist/renderers/form-contract/phone-utils.js +1 -0
- package/dist/renderers/form-contract/renderer.js +1 -1
- package/dist/renderers/form-contract/rich-fields.d.ts +2 -12
- package/dist/renderers/form-contract/rich-fields.js +1 -1
- package/dist/renderers/form-contract/shell.d.ts +9 -0
- package/dist/renderers/form-contract/shell.js +1 -1
- package/dist/renderers/form-contract/values.d.ts +1 -0
- package/dist/renderers/form-contract/values.js +1 -1
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +1 -0
- package/dist/shell.native.d.ts +1 -0
- package/dist/theme/variants.d.ts +1 -1
- package/package.json +523 -9
package/README.md
CHANGED
|
@@ -191,6 +191,113 @@ and keeps native rendering aligned for query, selected options, loading, error,
|
|
|
191
191
|
and empty states. FormSpec renderers pass resolver-backed async state through
|
|
192
192
|
these props without requiring product surfaces to know the underlying transport.
|
|
193
193
|
|
|
194
|
+
### Compose application shells
|
|
195
|
+
|
|
196
|
+
Use the shell subpath for app frames that need sidebar navigation, topbar
|
|
197
|
+
breadcrumbs, command search, account actions, and a right-side page outline.
|
|
198
|
+
The same typed shell contract has web and native entrypoints.
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { AppShell } from "@contractspec/lib.design-system/shell";
|
|
202
|
+
|
|
203
|
+
<AppShell
|
|
204
|
+
title="Workspace"
|
|
205
|
+
commands={[
|
|
206
|
+
{
|
|
207
|
+
heading: "Actions",
|
|
208
|
+
items: [{ id: "new-project", label: "New project" }],
|
|
209
|
+
},
|
|
210
|
+
]}
|
|
211
|
+
navigation={[
|
|
212
|
+
{
|
|
213
|
+
title: "Main",
|
|
214
|
+
items: [
|
|
215
|
+
{
|
|
216
|
+
label: "Projects",
|
|
217
|
+
href: "/projects",
|
|
218
|
+
children: [{ label: "Active", href: "/projects/active" }],
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
]}
|
|
223
|
+
breadcrumbs={[{ href: "/", label: "Home" }, { label: "Projects" }]}
|
|
224
|
+
pageOutline={[
|
|
225
|
+
{ id: "summary", label: "Summary" },
|
|
226
|
+
{ id: "details", label: "Details", level: 2 },
|
|
227
|
+
{ id: "audit", label: "Audit trail", level: 3 },
|
|
228
|
+
]}
|
|
229
|
+
>
|
|
230
|
+
{children}
|
|
231
|
+
</AppShell>;
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
On desktop web, `AppShell` renders a sidebar, sticky topbar, content region, and
|
|
235
|
+
optional `PageOutline` rail. On small web screens, navigation and page outline
|
|
236
|
+
move behind accessible menu triggers. On native, the shell maps primary
|
|
237
|
+
navigation to bottom tabs and keeps overflow navigation, actions, user content,
|
|
238
|
+
and page outline inside the menu sheet.
|
|
239
|
+
|
|
240
|
+
`AppShell` also accepts a prop-driven `notifications` center for in-app
|
|
241
|
+
notifications. Hosts provide structural `items`, `unreadCount`, loading/empty
|
|
242
|
+
state, and callbacks such as `onSelect`, `onMarkRead`, and `onMarkAllRead`; the
|
|
243
|
+
design-system shell renders the web topbar trigger and native menu section
|
|
244
|
+
without importing or owning any notification runtime package.
|
|
245
|
+
|
|
246
|
+
Shell navigation and command items may carry optional `policy` metadata plus a `policyBehavior` of `hide`, `disable`, or `show-with-lock`. Use `filterShellNavigationForPolicy()` / `annotateShellCommandsDecisions()` with decisions produced by your application runtime; AppShell only adapts affordances and does not fetch permissions or enforce backend access.
|
|
247
|
+
|
|
248
|
+
### Render actionable object references
|
|
249
|
+
|
|
250
|
+
Use `ObjectReferenceHandler` when product surfaces render references that usually
|
|
251
|
+
need quick interaction, such as addresses, phone numbers, users, customers,
|
|
252
|
+
files, URLs, or tenant-specific objects.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import {
|
|
256
|
+
ObjectReferenceHandler,
|
|
257
|
+
createMapsReferenceActions,
|
|
258
|
+
} from "@contractspec/lib.design-system";
|
|
259
|
+
|
|
260
|
+
const address = {
|
|
261
|
+
id: "customer-site",
|
|
262
|
+
kind: "address",
|
|
263
|
+
label: "10 Downing Street",
|
|
264
|
+
value: "10 Downing Street, London",
|
|
265
|
+
properties: [
|
|
266
|
+
{ id: "site-phone", kind: "phone", label: "Phone", value: "+33 1 23 45 67 89" },
|
|
267
|
+
{ id: "site-email", kind: "email", label: "Email", value: "hello@example.com" },
|
|
268
|
+
],
|
|
269
|
+
} as const;
|
|
270
|
+
|
|
271
|
+
<ObjectReferenceHandler
|
|
272
|
+
reference={address}
|
|
273
|
+
interactivityVisibility="icon"
|
|
274
|
+
actions={createMapsReferenceActions(address)}
|
|
275
|
+
openTarget="new-page"
|
|
276
|
+
panelMode="responsive"
|
|
277
|
+
/>;
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The descriptor and action descriptor types are intentionally data-only:
|
|
281
|
+
`id`, `kind`, `label`, `value`, `href`, `openTarget`, nested `properties`,
|
|
282
|
+
`sections`, `metadata`, and optional `iconKey`. Nested properties are regular
|
|
283
|
+
object reference descriptors, so a `user` reference can display email, phone,
|
|
284
|
+
address, file, and URL interactions in the same panel.
|
|
285
|
+
Runtime behavior belongs in props such as `actionHandlers`, `copyHandler`,
|
|
286
|
+
`openHref`, `renderTrigger`, `renderDetail`, `renderAction`, `renderProperty`,
|
|
287
|
+
`renderSection`, and `iconRenderer`. This keeps the surface compatible with
|
|
288
|
+
future declarative ContractSpec schema work without making React callbacks part
|
|
289
|
+
of the descriptor contract.
|
|
290
|
+
|
|
291
|
+
Web uses the exported `AdaptivePanel` primitive by default:
|
|
292
|
+
`panelMode="responsive"` renders a sheet on desktop and a bottom drawer on small
|
|
293
|
+
screens. Use `AdaptivePanel` directly for the same sheet/drawer decision outside
|
|
294
|
+
object references, or set `panelMode="sheet"` / `panelMode="drawer"` to force
|
|
295
|
+
one presentation. Detail links default to same-page navigation; set
|
|
296
|
+
`openTarget="new-page"` on the handler, reference, or action to open in a new
|
|
297
|
+
page. Native exports the same prop contract through the focused object-reference
|
|
298
|
+
subpath and uses a disclosure-style fallback until `@contractspec/lib.ui-kit`
|
|
299
|
+
provides a real native sheet primitive.
|
|
300
|
+
|
|
194
301
|
### Render forms on mobile through the shared renderer
|
|
195
302
|
|
|
196
303
|
Use the focused shared renderer subpath when rendering `FormSpec` contracts in
|
|
@@ -200,6 +307,13 @@ Expo or React Native apps:
|
|
|
200
307
|
import { formRenderer } from "@contractspec/lib.design-system/renderers";
|
|
201
308
|
```
|
|
202
309
|
|
|
310
|
+
The shared FormSpec renderer includes a first-class phone field implementation
|
|
311
|
+
that displays country flags, parses international input with
|
|
312
|
+
`libphonenumber-js`, and keeps single-input or split country/national controls
|
|
313
|
+
linked. Contracts can configure behavior through a phone field's `input`,
|
|
314
|
+
`output`, `country`, and `display` options; host apps can set package-wide
|
|
315
|
+
defaults by passing `phone` overrides to `createFormRenderer`.
|
|
316
|
+
|
|
203
317
|
Expo apps must keep the presentation Metro aliases enabled so design-system
|
|
204
318
|
imports of `@contractspec/lib.ui-kit-web/ui/*` are remapped to
|
|
205
319
|
`@contractspec/lib.ui-kit/ui/*` at bundle time:
|
|
@@ -287,6 +401,20 @@ export function AccountHealthTable() {
|
|
|
287
401
|
`DataTable` remains the composed card/container surface. `DataTableToolbar` is
|
|
288
402
|
the recommended ergonomic layer for search, chips, selection summary, and
|
|
289
403
|
hidden-column recovery without widening the primitive table API.
|
|
404
|
+
DataView-driven tables also honor field and column overflow hints from
|
|
405
|
+
`DataViewSpec`: column hints override field hints, markdown wraps by default,
|
|
406
|
+
compact scalar formats truncate, `expand` adds detail to the row expansion
|
|
407
|
+
surface, and `hideColumn` starts hidden when column visibility is enabled.
|
|
408
|
+
Collection `DataViewSpec` contracts can also declare `view.collection` defaults
|
|
409
|
+
for list/grid/table mode switching, toolbar controls, query page size, and
|
|
410
|
+
density. They can also declare `collection.dataDepth` and field-level
|
|
411
|
+
`visibility.minDataDepth` so one spec can project summary, standard, detailed,
|
|
412
|
+
or exhaustive fields. `DataViewRenderer` uses those defaults for web and native
|
|
413
|
+
renderers while keeping caller props authoritative through `viewMode`,
|
|
414
|
+
`density`, `dataDepth`, `onViewModeChange`, `onDensityChange`, and
|
|
415
|
+
`onDataDepthChange`. Personalization integrations should resolve preferences in
|
|
416
|
+
the host app and pass ordinary renderer props; the design system intentionally
|
|
417
|
+
does not import `@contractspec/lib.personalization`.
|
|
290
418
|
|
|
291
419
|
## API map
|
|
292
420
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cn as m}from"../../lib/utils";import{DataViewList as p}from"./DataViewList";export function DataViewGrid({spec:e,items:o,className:a,renderActions:c,onSelect:n,emptyState:s,density:t="comfortable"}){if(e.view.kind!=="grid")throw Error(`DataViewGrid received view kind "${e.view.kind}", expected "grid".`);const i=e.view,d=i.columns??3,l={...e,view:{kind:"list",layout:"card",fields:i.fields,primaryField:i.primaryField,secondaryFields:i.secondaryFields,filters:i.filters,filterScope:i.filterScope,actions:i.actions,collection:i.collection}};return r("div",{className:m("grid w-full gap-4",t==="compact"&&"gap-3",w(d),a),children:r(p,{spec:l,items:o,className:"contents",renderActions:c,onSelect:n,emptyState:s,density:t})})}function w(e){if(e<=1)return"grid-cols-1";if(e===2)return"md:grid-cols-2";if(e===4)return"md:grid-cols-2 xl:grid-cols-4";return"md:grid-cols-2 lg:grid-cols-3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as m}from"react/jsx-runtime";import{resolveTranslationString as
|
|
1
|
+
import{jsx as t,jsxs as m}from"react/jsx-runtime";import{resolveTranslationString as y,useDesignSystemTranslation as D}from"../../i18n/translation";import{cn as c}from"../../lib/utils";import{DisplayValue as u}from"./DataViewTable";export function DataViewList({spec:e,items:r,className:i,renderActions:d,onSelect:g,emptyState:v,density:p="comfortable"}){const b=D();if(e.view.kind!=="list")throw Error(`DataViewList received view kind "${e.view.kind}", expected "list".`);const n=e.view,a=n.fields,l=n.primaryField??a.find((o)=>o.key===n.primaryField)?.key??a[0]?.key;if(!r.length)return t("div",{className:c("flex w-full flex-col gap-4",i),children:v??t("div",{className:"rounded-md border border-muted-foreground/40 border-dashed p-8 text-center text-muted-foreground text-sm",children:"No records available."})});return t("div",{className:c("flex w-full flex-col",p==="compact"?"gap-2":"gap-4",i),children:r.map((o,w)=>{const f=k(o);return m("button",{type:"button",className:c("flex w-full flex-col gap-2 rounded-lg border border-muted bg-card p-4 text-left shadow-sm transition hover:border-primary/40 hover:shadow-md focus-visible:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",p==="compact"&&"p-3",n.layout==="compact"&&"md:flex-row md:items-center md:gap-4"),onClick:()=>g?.(o),children:[m("div",{className:"flex flex-1 flex-col gap-1",children:[l?t("span",{className:"font-medium text-base text-foreground",children:t(u,{item:f,fields:a,fieldKey:l})}):null,t("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-muted-foreground text-sm",children:x(n,l).map((s)=>m("span",{className:"flex items-center gap-1.5",children:[t("span",{className:"font-medium text-foreground/80",children:V(a,s,b)}),t("span",{children:t(u,{item:f,fields:a,fieldKey:s})})]},s))})]}),d?t("div",{className:"flex shrink-0 items-center gap-2",children:d(o)}):null]},w)})})}function k(e){if(e&&typeof e==="object")return e;return{}}function V(e,r,i){return y(e.find((d)=>d.key===r)?.label??r,i)}function x(e,r){if(e.secondaryFields?.length)return e.secondaryFields;return e.fields.map((i)=>i.key).filter((i)=>i!==r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as Y,jsxs as A,Fragment as sB}from"react/jsx-runtime";import{resolveDataViewFilters as EB}from"@contractspec/lib.contracts-spec/data-views";import{Pagination as NB}from"@contractspec/lib.ui-kit-web/ui/atoms/Pagination";import{VStack as RB}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as TB}from"@contractspec/lib.ui-kit-web/ui/text";import{Grid3X3 as AB,List as MB,Table2 as jB}from"lucide-react";import*as q from"react";import{resolveTranslationString as a,useDesignSystemTranslation as kB}from"../../i18n/translation";import{Button as T}from"../atoms/Button";import{Input as F}from"../atoms/Input";import{FiltersToolbar as VB}from"../molecules/FiltersToolbar";import{DATA_VIEW_DATA_DEPTHS as _B,formatDataViewDataDepth as SB,getDataViewCollectionConfig as bB,getDataViewCollectionViewModesConfig as xB,isDataViewCollectionKind as t,projectCollectionDataDepth as FB,resolveAllowedCollectionModes as wB,resolveCollectionDataDepth as mB,resolveCollectionDensity as CB,resolveCollectionView as DB}from"./collection";import{DataViewDetail as yB}from"./DataViewDetail";import{DataViewGrid as gB}from"./DataViewGrid";import{DataViewList as hB}from"./DataViewList";import{DataViewTable as uB}from"./DataViewTable";export function DataViewRenderer({spec:B,items:J=[],item:Q=null,className:Z,renderActions:O,onSelect:$,onRowClick:H,toolbar:M,loading:K,headerActions:X,emptyState:E,footer:C,viewMode:D,defaultViewMode:y,onViewModeChange:UB,density:g,defaultDensity:h,onDensityChange:YB,dataDepth:u,defaultDataDepth:v,onDataDepthChange:ZB,search:$B,onSearchChange:d,filters:z,onFilterChange:N,pagination:L,onPageChange:p}){const S=kB(),b=q.useMemo(()=>wB(B.view),[B.view]),[HB,WB]=q.useState(y),f=D??HB??y,j=q.useMemo(()=>DB(B,f),[f,B]),[XB,zB]=q.useState(h),P=CB(B,{density:g??XB,defaultDensity:h}),[GB,qB]=q.useState(v),k=mB(B,{dataDepth:u??GB,defaultDataDepth:v}),KB=bB(B.view),LB=xB(B.view),W=KB?.toolbar,V=W?.enabled!==!1,c=W?.filters!==!1,_=W?.actions??"end",r=_==="start"||_==="both"?X:void 0,o=_==="end"||_==="both"?X:void 0,s=typeof W?.search==="object"?W.search:void 0,n=Boolean(V&&W?.search!==!1&&d),G=q.useMemo(()=>EB({filters:B.view.filters,scope:B.view.filterScope,user:vB(z)}),[z,B.view.filterScope,B.view.filters]),i=q.useMemo(()=>{if(B.view.filterScope){const U=Object.entries(G.user).map(([I,R])=>({key:I,label:`${e(B,I)}: ${BB(R)}`,onRemove:()=>{const{[I]:iB,...PB}=G.user;N?.(PB)}})),x=G.lockedChips==="hidden"?[]:Object.entries(G.locked).map(([I,R])=>({key:`locked-${I}`,label:`${e(B,I)}: ${BB(R)}`,disabled:!0}));return[...U,...x]}return z?Object.entries(z).map(([U,x])=>({key:U,label:`${U}: ${String(x)}`,onRemove:()=>{const{[U]:I,...R}=z;N?.(R)}})):[]},[z,N,G,B]),IB=B.view.filterScope?Object.keys(G.user).length>0:Boolean(z&&Object.keys(z).length>0),l=q.useMemo(()=>{const U=t(B.view.kind)?FB(j.spec,k):B;switch(U.view.kind){case"list":return Y(hB,{spec:U,items:J,className:Z,renderActions:O,onSelect:$,emptyState:E,density:P});case"table":return Y(uB,{spec:U,items:J,className:Z,onRowClick:H,toolbar:M,loading:K,emptyState:E,headerActions:V?void 0:X,footer:C,density:P});case"detail":return Y(yB,{spec:B,item:Q,className:Z,emptyState:E,headerActions:X});case"grid":return Y(gB,{spec:U,items:J,className:Z,renderActions:O,onSelect:$,emptyState:E,density:P});default:return Y(TB,{className:Z,children:a("Unsupported data view kind",S)})}},[B,j.spec,J,Q,Z,O,$,H,M,K,X,E,C,P,k,V,S]);if(!(B.view.kind==="list"||B.view.kind==="table"||B.view.kind==="grid"))return Y(sB,{children:l});return A(RB,{gap:"lg",children:[V&&(c&&B.view.filters?.length||n||i.length||b.length>1||W?.density||W?.dataDepth||r||o)?A(VB,{searchValue:$B,onSearchChange:n?d:void 0,searchPlaceholder:s?.placeholder??a("Search...",S)??"Search...",debounceMs:s?.debounceMs,activeChips:i,onClearAll:IB?()=>N?.({}):void 0,right:o,children:[r,b.length>1&&W?.viewMode!==!1?Y(fB,{mode:j.mode,allowedModes:b,labels:t(B.view.kind)?LB?.labels:void 0,onChange:(U)=>{if(U===j.mode)return;if(D===void 0)WB(U);UB?.(U)}}):null,W?.density?Y(cB,{density:P,onChange:(U)=>{if(U===P)return;if(g===void 0)zB(U);YB?.(U)}}):null,W?.dataDepth?Y(rB,{dataDepth:k,onChange:(U)=>{if(U===k)return;if(u===void 0)qB(U);ZB?.(U)}}):null,c?Y(dB,{filters:B.view.filters,values:G.user,lockedKeys:Object.keys(G.locked),onFilterChange:N}):null]}):null,l,L&&L.total>0&&Y(NB,{currentPage:L.page,totalPages:Math.ceil(L.total/L.pageSize),totalItems:L.total,itemsPerPage:L.pageSize,onPageChange:(U)=>p?.(U),onItemsPerPageChange:(U)=>{p?.(1)},showItemsPerPage:!1})]})}function vB(B){if(!B)return;return Object.fromEntries(Object.entries(B??{}).filter((J)=>Boolean(J[1]&&typeof J[1]==="object"&&"kind"in J[1]&&typeof J[1].kind==="string")))}function e(B,J){return B.view.filters?.find((Q)=>Q.key===J)?.label??J}function BB(B){if(!B)return"";if(B.kind==="single")return String(B.value);if(B.kind==="multi")return B.values.map(String).join(", ");if(B.kind==="range")return[B.from==null?"":String(B.from),B.to==null?"":String(B.to)].filter(Boolean).join(" - ");return`${B.mode}(${B.clauses.length})`}function dB({filters:B,values:J,lockedKeys:Q,onFilterChange:Z}){if(!B?.length||!Z)return null;const O=new Set(Q),$=B.filter((H)=>H.type!=="search"&&!O.has(H.key));if($.length===0)return null;return Y("div",{className:"flex flex-wrap items-center gap-2",children:$.map((H)=>Y(pB,{filter:H,value:J[H.key],values:J,onFilterChange:Z},H.key))})}function pB({filter:B,value:J,values:Q,onFilterChange:Z}){if(B.type==="boolean"){const O=J?.kind==="single"?J.value===!0:void 0;return A(T,{size:"sm",variant:"outline",onPress:()=>JB(Q,B.key,O===void 0?!0:!O,Z),children:[B.label,": ",O?"Oui":"Non"]})}if(B.valueMode==="range"){const O=J?.kind==="range"?J:void 0;return A("div",{className:"flex min-w-0 items-center gap-2",children:[Y(F,{type:w(B),inputMode:m(B),value:O?.from==null?"":String(O.from),onChange:($)=>OB(Q,B,"from",$.currentTarget.value,Z),placeholder:`${B.label} min`,className:"h-9 w-28"}),Y(F,{type:w(B),inputMode:m(B),value:O?.to==null?"":String(O.to),onChange:($)=>OB(Q,B,"to",$.currentTarget.value,Z),placeholder:`${B.label} max`,className:"h-9 w-28"})]})}return Y(F,{type:w(B),inputMode:m(B),value:J?.kind==="single"?String(J.value):"",onChange:(O)=>JB(Q,B.key,QB(B,O.currentTarget.value),Z),placeholder:B.label,className:"h-9 w-36"})}function JB(B,J,Q,Z){const O={...B};if(Q===void 0||Q==="")delete O[J];else O[J]={kind:"single",value:Q};Z(O)}function OB(B,J,Q,Z,O){const $=B[J.key],H=$?.kind==="range"?$:{},M=QB(J,Z),K={...H,[Q]:M};if(K.from==null&&K.to==null){const X={...B};delete X[J.key];O(X);return}O({...B,[J.key]:{kind:"range",from:K.from,to:K.to}})}function QB(B,J){if(J==="")return;switch(B.type){case"number":case"percent":case"currency":case"duration":{const Q=Number(J);return Number.isFinite(Q)?Q:void 0}default:return J}}function w(B){switch(B.type){case"number":case"percent":case"currency":case"duration":return"number";case"date":return"date";case"time":return"time";case"datetime":return"datetime-local";default:return"text"}}function m(B){switch(B.type){case"number":case"percent":case"currency":case"duration":return"decimal";default:return}}function fB({mode:B,allowedModes:J,labels:Q,onChange:Z}){return Y("div",{className:"flex items-center gap-1 rounded-md border bg-background p-1",children:J.map((O)=>{const $=oB(O);return Y(T,{size:"sm",variant:O===B?"default":"ghost",onPress:()=>Z(O),ariaLabelI18n:Q?.[O]??O,children:Y($,{className:"h-4 w-4"})},O)})})}function cB({density:B,onChange:J}){return A("div",{className:"flex items-center gap-1 rounded-md border bg-background p-1",children:[Y(T,{size:"sm",variant:B==="comfortable"?"default":"ghost",onPress:()=>J("comfortable"),children:"Comfort"}),Y(T,{size:"sm",variant:B==="compact"?"default":"ghost",onPress:()=>J("compact"),children:"Compact"})]})}function rB({dataDepth:B,onChange:J}){return Y("div",{className:"flex items-center gap-1 rounded-md border bg-background p-1",children:_B.map((Q)=>Y(T,{size:"sm",variant:B===Q?"default":"ghost",onPress:()=>J(Q),children:SB(Q)},Q))})}function oB(B){if(B==="grid")return AB;if(B==="table")return jB;return MB}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as E,jsxs as
|
|
1
|
+
import{jsx as E,jsxs as _}from"react/jsx-runtime";import{useDataViewTable as C}from"@contractspec/lib.presentation-runtime-react";import{HStack as K,VStack as R}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as Z}from"@contractspec/lib.ui-kit-web/ui/text";import*as $ from"react";import{resolveTranslationString as X,useDesignSystemTranslation as g}from"../../i18n/translation";import{DataTable as D}from"../data-table/DataTable";import{DataViewFormattedValue as B,getAtPath as V}from"./utils";export function DataViewTable({spec:q,items:J,className:L,onRowClick:G,toolbar:O,loading:H,emptyState:P,headerActions:N,footer:A,density:Q}){const U=g();if(q.view.kind!=="table")throw Error(`DataViewTable received view kind "${q.view.kind}", expected "table".`);const Y=$.useMemo(()=>Q&&q.view.kind==="table"?{...q,view:{...q.view,density:Q}}:q,[Q,q]),M=Y.view,F=$.useMemo(()=>(M.rowExpansion?.fields??[]).map((z)=>M.fields.find((I)=>I.key===z)).filter((z)=>Boolean(z)),[M.fields,M.rowExpansion?.fields]),h=C({spec:Y,data:J,renderValue:({value:z,field:I})=>E(B,{value:z,format:I.format}),renderExpandedContent:F.length>0?({item:z,fields:I})=>E(R,{gap:"sm",className:"py-2",children:I.map((W)=>_(K,{justify:"between",align:"start",children:[E(Z,{className:"font-medium text-muted-foreground text-sm",children:X(W.label,U)}),E(Z,{className:"text-right text-sm",children:E(DisplayValue,{item:z,fields:I,fieldKey:W.key})})]},W.key))}):void 0});return E(D,{controller:h,className:L,title:X(q.meta.title,U),description:X(q.meta.description,U),toolbar:O,loading:H,headerActions:N,emptyState:P,footer:A,onRowPress:G?(z)=>G(z.original):void 0})}function b(q,J){return q.find((L)=>L.key===J)}export function DisplayValue({item:q,fields:J,fieldKey:L}){const G=b(J,L);if(!G)return"";const O=V(q,G.dataPath);return E(B,{value:O,format:G.format})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const X=["list","grid","table"];export const DATA_VIEW_DATA_DEPTHS=["summary","standard","detailed","exhaustive"];const $=new Map(DATA_VIEW_DATA_DEPTHS.map((z,B)=>[z,B]));export function formatDataViewDataDepth(z){if(z==="summary")return"Summary";if(z==="detailed")return"Detailed";if(z==="exhaustive")return"Exhaustive";return"Standard"}export function isDataViewCollectionKind(z){return z==="list"||z==="grid"||z==="table"}export function resolveAllowedCollectionModes(z){const B=getDataViewCollectionConfig(z);if(!B||!isDataViewCollectionKind(z.kind))return isDataViewCollectionKind(z.kind)?[z.kind]:[];const G=getDataViewCollectionViewModesConfig(z),J=G?.allowedModes?.filter(x);if(J?.length)return H(J);if(B.toolbar?.viewMode===!0)return X;return G?X:[z.kind]}export function getDataViewCollectionConfig(z){if(!isDataViewCollectionKind(z.kind))return;return z.collection}export function getDataViewCollectionViewModesConfig(z){const B=getDataViewCollectionConfig(z),G=B?.toolbar?.viewMode;if(B?.viewModes)return B.viewModes;return typeof G==="object"?G:void 0}export function resolveCollectionView(z,B){const G=resolveAllowedCollectionModes(z.view),J=j(z.view,G),U=B&&G.includes(B)?B:J;return{spec:{...z,view:R(z.view,U)},mode:U,allowedModes:G}}export function resolveCollectionDensity(z,B={}){const G=z.view.kind==="table"?z.view.density:void 0;return B.density??B.defaultDensity??G??getDataViewCollectionConfig(z.view)?.density??"comfortable"}export function resolveCollectionDataDepth(z,B={}){return B.dataDepth??B.defaultDataDepth??getDataViewCollectionConfig(z.view)?.dataDepth??"standard"}export function projectCollectionDataDepth(z,B){if(!isDataViewCollectionKind(z.view.kind))return z;const G=z.view.fields.filter((Q)=>P(Q,B)),J=new Set(G.map((Q)=>Q.key)),U=J.has(z.view.primaryField??"")?z.view.primaryField:G[0]?.key,Y=z.view.secondaryFields?.filter((Q)=>J.has(Q));if(z.view.kind==="table")return{...z,view:{...z.view,fields:G,primaryField:U,secondaryFields:Y,columns:z.view.columns?.filter((Q)=>J.has(Q.field)),rowExpansion:z.view.rowExpansion?{...z.view.rowExpansion,fields:z.view.rowExpansion.fields.filter((Q)=>J.has(Q))}:void 0}};return{...z,view:{...z.view,fields:G,primaryField:U,secondaryFields:Y}}}function j(z,B){const G=isDataViewCollectionKind(z.kind)&&getDataViewCollectionViewModesConfig(z)?.defaultMode;if(G&&B.includes(G))return G;if(isDataViewCollectionKind(z.kind)&&B.includes(z.kind))return z.kind;return B[0]??"list"}function R(z,B){const G=getDataViewCollectionConfig(z),J={fields:z.fields,primaryField:z.primaryField,secondaryFields:z.secondaryFields,filters:z.filters,filterScope:z.filterScope,actions:z.actions,collection:G};if(B==="list")return{...J,kind:"list",layout:z.kind==="list"?z.layout:"compact"};if(B==="grid")return{...J,kind:"grid",columns:z.kind==="grid"?z.columns:void 0};if(z.kind==="table")return{...z,...J,kind:"table"};return{...J,kind:"table",density:G?.density}}function x(z){return z==="list"||z==="grid"||z==="table"}function H(z){return X.filter((B)=>z.includes(B))}function P(z,B){const G=z.visibility?.minDataDepth;if(!G)return!0;return Z(B)>=Z(G)}function Z(z){return $.get(z)??0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{MarkdownRenderer as u}from"../molecules/MarkdownRenderer";export function getAtPath(n,t){if(!n)return;if(!t)return n;const e=t.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let i=n;for(const r of e){if(i==null||typeof i!=="object"&&!Array.isArray(i))return;i=i[r]}return i}export function DataViewFormattedValue({value:n,format:t}){if(n==null)return"";switch(typeof t==="string"?t:t?.type){case"boolean":return n?"Yes":"No";case"number":return m(n,t);case"currency":return d(n,t);case"percent":case"percentage":return p(n,t);case"date":return o(n,typeof t==="object"&&t.type==="date"?t:{dateStyle:"medium"});case"time":return o(n,typeof t==="object"&&t.type==="time"?t:{timeStyle:"short"});case"datetime":case"dateTime":return o(n,typeof t==="object"&&t.type==="datetime"?t:{dateStyle:"medium",timeStyle:"short"});case"duration":return g(n,t);case"markdown":return l(u,{content:n});default:return String(n)}}function m(n,t){if(typeof n!=="number")return String(n);const e=typeof t==="object"&&t.type==="number"?t:void 0;return new Intl.NumberFormat(e?.locale,{minimumFractionDigits:e?.minimumFractionDigits,maximumFractionDigits:e?.maximumFractionDigits,useGrouping:e?.useGrouping,notation:e?.notation,signDisplay:e?.signDisplay}).format(n)}function d(n,t){if(typeof n!=="number")return String(n);const e=typeof t==="object"&&t.type==="currency"?t:void 0;return new Intl.NumberFormat(e?.locale,{style:"currency",currency:e?.currency??"USD",currencyDisplay:e?.currencyDisplay,minimumFractionDigits:e?.rounded?0:e?.minimumFractionDigits,maximumFractionDigits:e?.rounded?0:e?.maximumFractionDigits,useGrouping:e?.useGrouping,notation:e?.notation,signDisplay:e?.signDisplay}).format(n)}function p(n,t){if(typeof n!=="number")return String(n);const e=typeof t==="object"&&t.type==="percent"?t:void 0,i=e?.valueScale==="whole"?n/100:n;return new Intl.NumberFormat(e?.locale,{style:"percent",minimumFractionDigits:e?.minimumFractionDigits??1,maximumFractionDigits:e?.maximumFractionDigits??1,useGrouping:e?.useGrouping,notation:e?.notation,signDisplay:e?.signDisplay}).format(i)}function o(n,t){const{locale:e,...i}=t;if(n instanceof Date)return new Intl.DateTimeFormat(e,i).format(n);if(typeof n==="string"||typeof n==="number"){const r=new Date(n);if(!Number.isNaN(r.getTime()))return new Intl.DateTimeFormat(e,i).format(r)}return String(n??"")}function g(n,t){if(typeof n!=="number")return String(n);const e=typeof t==="object"&&t.type==="duration"?t:void 0,i=e?.unit??"second";if(e?.display==="digital")return y(f(n,i));return new Intl.NumberFormat(e?.locale,{style:"unit",unit:i,unitDisplay:e?.display==="narrow"?"narrow":e?.display,maximumFractionDigits:2}).format(n)}function y(n){const t=n<0?"-":"",e=Math.round(Math.abs(n)),i=Math.floor(e/3600),r=Math.floor(e%3600/60),c=e%60,s=[r,c].map((a)=>String(a).padStart(2,"0")).join(":");return i>0?`${t}${i}:${s}`:`${t}${s}`}function f(n,t){switch(t){case"millisecond":return n/1000;case"minute":return n*60;case"hour":return n*3600;case"day":return n*86400;case"week":return n*604800;case"month":return n*2629746;case"year":return n*31556952;case"second":default:return n}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as z,jsxs as M}from"react/jsx-runtime";import{SelectContent,SelectGroup,SelectItem,SelectLabel,SelectTrigger,SelectValue,Select as
|
|
1
|
+
import{jsx as z,jsxs as M}from"react/jsx-runtime";import{SelectContent,SelectGroup,SelectItem,SelectLabel,SelectTrigger,SelectValue,Select as T}from"@contractspec/lib.ui-kit-web/ui/select";import{useThemedPrimitive as v,useTranslatedText as w}from"../../primitives/themed";import{selectGroupKey as G,selectGroupLabel as L,selectOptionGroups as V,selectOptionLabel as _,selectOptionValue as D}from"./select-options";export function Select({options:Q,groups:R,value:E,onChange:U,placeholder:X,disabled:Y,id:Z,name:$,className:k,componentKey:P,themeVariant:W,placeholderI18n:N,...C}){const B=w(),f=v({defaultComponentKey:"Select",componentKey:P,themeVariant:W,className:k}),K=V({options:Q,groups:R});return M(T,{value:E==null?"":D(E),onValueChange:(q)=>U?.(q),disabled:Y,name:$,...C,children:[z(SelectTrigger,{id:Z,className:f.className,children:z(SelectValue,{placeholder:B(N??X)})}),z(SelectContent,{children:K.map((q,F)=>{const H=G(q,F),J=L(q,B);return M(SelectGroup,{children:[J?z(SelectLabel,{children:J}):null,q.options.map((A,O)=>z(SelectItem,{value:D(A.value),disabled:A.disabled,children:_(A,B)},`${H}-${D(A.value)}-${O}`))]},`${H}-${F}`)})})]})}export{SelectContent,SelectGroup,SelectItem,SelectLabel,SelectTrigger,SelectValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as H}from"react/jsx-runtime";import{Tabs as R,TabsContent as S,TabsList as U,TabsTrigger as X}from"@contractspec/lib.ui-kit-web/ui/tabs";import{useThemedPrimitive as G}from"../primitives/themed";export function Tabs({value:z,defaultValue:A,onValueChange:B,className:D,children:q,orientation:F,dir:E,activationMode:J,componentKey:O,themeVariant:Q}){
|
|
1
|
+
import{jsx as H}from"react/jsx-runtime";import{Tabs as R,TabsContent as S,TabsList as U,TabsTrigger as X}from"@contractspec/lib.ui-kit-web/ui/tabs";import{useThemedPrimitive as G}from"../primitives/themed";export function Tabs({value:z,defaultValue:A,onValueChange:B,className:D,children:q,orientation:F,dir:E,activationMode:J,componentKey:O,themeVariant:Q}){const I=G({defaultComponentKey:"Tabs",componentKey:O,themeVariant:Q,className:D});return H(R,{...I.props,value:z,defaultValue:A,onValueChange:B,className:I.className,orientation:F,dir:E,activationMode:J,children:q})}export function TabsList({className:z,children:A,componentKey:B,themeVariant:D}){const q=G({defaultComponentKey:"TabsList",componentKey:B,themeVariant:D,className:z});return H(U,{...q.props,className:q.className,children:A})}export function TabsTrigger({value:z,disabled:A,className:B,children:D,componentKey:q,themeVariant:F}){const E=G({defaultComponentKey:"TabsTrigger",componentKey:q,themeVariant:F,className:B});return H(X,{...E.props,value:z,disabled:A,className:E.className,children:D})}export function TabsContent({value:z,forceMount:A,className:B,children:D,componentKey:q,themeVariant:F}){const E=G({defaultComponentKey:"TabsContent",componentKey:q,themeVariant:F,className:B});return H(S,{...E.props,value:z,forceMount:A?!0:void 0,className:E.className,children:D})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as q,jsxs as I}from"react/jsx-runtime";import{Fragment as J}from"react";import{getObjectReferenceDisplayValue as Q}from"./actions";import{DefaultActionButton as T}from"./DefaultObjectReferenceParts";import{DefaultReferenceProperty as U,MetadataList as K}from"./DefaultObjectReferenceProperty";export function DefaultReferenceDetail({context:k,iconRenderer:E,renderProperty:G,renderSection:C,runReferenceAction:v}){const{reference:z}=k;return I("div",{className:"flex flex-col gap-3",children:[q(W,{reference:z}),z.sections?.map((H)=>C?q(J,{children:C({...k,section:H})},H.id):q(X,{context:k,iconRenderer:E,renderProperty:G,runReferenceAction:v,section:H},H.id)),z.properties&&z.properties.length>0?q("div",{className:"grid gap-2",children:z.properties.map((H)=>q(N,{context:k,iconRenderer:E,property:H,renderProperty:G,runReferenceAction:v},H.id))}):null]})}function W({reference:k}){return I("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm",children:[q("div",{className:"font-medium text-foreground",children:Q(k)}),k.href?q("div",{className:"mt-1 break-all text-muted-foreground",children:k.href}):null,q(K,{entries:Object.entries(k.metadata??{})})]})}function X({context:k,iconRenderer:E,renderProperty:G,runReferenceAction:C,section:v}){return I("section",{className:"grid gap-2",children:[I("div",{children:[v.title?q("h3",{className:"font-medium text-foreground text-sm",children:v.title}):null,v.description?q("p",{className:"text-muted-foreground text-xs",children:v.description}):null]}),v.properties?.map((z)=>q(N,{context:k,iconRenderer:E,property:z,renderProperty:G,runReferenceAction:C},z.id)),v.actions&&v.actions.length>0?q("div",{className:"grid gap-2",children:v.actions.map((z)=>q(T,{action:z,reference:k.reference,iconRenderer:E,onClick:()=>C(k.reference,z)},z.id))}):null,q(K,{entries:Object.entries(v.metadata??{})})]})}function N({context:k,iconRenderer:E,property:G,renderProperty:C,runReferenceAction:v}){if(C)return q(J,{children:C({...k,property:G,depth:0,runPropertyAction:v})});return q(U,{context:k,depth:0,iconRenderer:E,property:G,runReferenceAction:v})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as i}from"react/jsx-runtime";import{cn as d}from"../../lib/utils";import{ReferenceIcon as l,ReferenceSearchIcon as a}from"./ReferenceIcon";export function DefaultObjectReferenceTrigger({context:e,iconRenderer:o,interactivityVisibility:n,className:c}){const{reference:t}=e;return i("span",{className:d("inline-flex min-w-0 items-center gap-1.5 text-foreground text-sm transition-colors hover:text-primary",n==="underline"&&"underline decoration-muted-foreground/50 underline-offset-4 hover:decoration-primary",c),children:[r(l,{context:{iconKey:t.iconKey??t.kind,reference:t},iconRenderer:o}),r("span",{className:"truncate",children:t.label}),n==="icon"?r(a,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):null]})}export function DefaultActionButton({action:e,reference:o,iconRenderer:n,onClick:c}){return i("button",{type:"button",className:d("flex min-h-11 w-full items-center gap-3 rounded-md border border-border px-3 py-2 text-left text-sm transition-colors hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring",e.variant==="primary"&&"border-primary/40 bg-primary/10",e.variant==="danger"&&"border-destructive/40 text-destructive",e.disabled&&"cursor-not-allowed opacity-50"),disabled:e.disabled,onClick:c,children:[r(l,{context:{iconKey:e.iconKey??e.id,reference:o,action:e},iconRenderer:n}),i("span",{className:"min-w-0 flex-1",children:[r("span",{className:"block font-medium",children:e.label}),e.description?r("span",{className:"block text-muted-foreground text-xs",children:e.description}):null]})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as q,jsxs as F}from"react/jsx-runtime";import{createDefaultObjectReferenceActions as J,getObjectReferenceDisplayValue as K}from"./actions";import{DefaultActionButton as L}from"./DefaultObjectReferenceParts";import{ReferenceIcon as N}from"./ReferenceIcon";export function DefaultReferenceProperty({context:z,depth:C,iconRenderer:E,property:g,runReferenceAction:H}){const I=g.actions??J(g),G=C<3?g.properties:void 0;return F("div",{className:"rounded-md border border-border p-3 text-sm",children:[F("div",{className:"flex items-start gap-2",children:[q(N,{context:{iconKey:g.iconKey??g.kind,reference:g},iconRenderer:E}),F("div",{className:"min-w-0 flex-1",children:[q("div",{className:"font-medium text-foreground",children:g.label}),q("div",{className:"break-words text-muted-foreground",children:K(g)}),g.description?q("div",{className:"mt-1 text-muted-foreground text-xs",children:g.description}):null]})]}),I.length>0?q("div",{className:"mt-3 grid gap-2",children:I.map((B)=>q(L,{action:B,reference:g,iconRenderer:E,onClick:()=>H(g,B)},B.id))}):null,G&&G.length>0?q("div",{className:"mt-3 grid gap-2",children:G.map((B)=>q(DefaultReferenceProperty,{context:z,depth:C+1,iconRenderer:E,property:B,runReferenceAction:H},B.id))}):null]})}export function MetadataList({entries:z}){if(z.length===0)return null;return q("dl",{className:"mt-3 grid gap-2",children:z.map(([C,E])=>F("div",{className:"grid gap-0.5",children:[q("dt",{className:"font-medium text-muted-foreground text-xs uppercase",children:C}),q("dd",{className:"break-words text-foreground",children:Q(E)})]},C))})}function Q(z){return typeof z==="object"&&z!==null?JSON.stringify(z):String(z)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as F,jsxs as z}from"react/jsx-runtime";import{Tooltip as j,TooltipContent as y,TooltipTrigger as x}from"@contractspec/lib.ui-kit-web/ui/tooltip";import*as T from"react";import{DefaultReferenceDetail as g}from"./DefaultObjectReferenceDetail";import{DefaultActionButton as d,DefaultObjectReferenceTrigger as l}from"./DefaultObjectReferenceParts";import{ObjectReferencePanel as p}from"./ObjectReferencePanel";import{normalizeSafeObjectReferenceHref as s}from"./url-safety";import{useObjectReferenceController as f}from"./useObjectReferenceController";export function ObjectReferenceHandler({reference:q,actions:K,interactivityVisibility:U="underline",openTarget:G,panelMode:Q,mobilePanelMode:I,desktopPanelMode:E,responsiveBreakpoint:V,defaultOpen:B=!1,open:S,onOpenChange:k,actionHandlers:N,onAction:C,onActionError:M,copyText:h,copyHandler:m,openHref:b,renderTrigger:X,renderDetail:Y,renderAction:Z,renderProperty:v,renderSection:P,iconRenderer:W,className:D,panelClassName:w}){const{context:L,openDetail:u,resolvedActions:H,resolvedOpen:O,runAction:$,runReferenceAction:_,setOpen:A}=f({reference:q,actions:K,defaultOpen:B,open:S,onOpenChange:k,actionHandlers:N,copyText:h,copyHandler:m,openHref:b,openTarget:G,onAction:C,onActionError:M,defaultOpenTarget:G,defaultCopy:i,defaultOpenHref:a}),R=X?X(L):F(l,{context:L,iconRenderer:W,interactivityVisibility:U,className:D});return F(p,{open:O,onOpenChange:A,mode:Q,mobileMode:I,desktopMode:E,breakpoint:V,title:q.label,description:q.description,className:w,trigger:z(j,{children:[F(x,{asChild:!0,children:F("button",{type:"button",className:"contents","aria-label":q.ariaLabel??`Open ${q.label}`,onClick:(J)=>{if(c(G,q))J.preventDefault();u()},children:R})}),F(y,{children:q.ariaLabel??q.label})]}),children:z("div",{className:"flex flex-col gap-4 px-4 pb-4",children:[Y?Y(L):F(g,{context:L,iconRenderer:W,renderProperty:v,renderSection:P,runReferenceAction:_}),F("div",{className:"flex flex-col gap-2",children:H.map((J)=>Z?F(T.Fragment,{children:Z({...L,action:J,runAction:$})},J.id):F(d,{action:J,reference:q,iconRenderer:W,onClick:()=>$(J)},J.id))})]})})}async function i(q,K){if(typeof navigator<"u"&&navigator.clipboard){await navigator.clipboard.writeText(q);return}throw Error("Clipboard is not available.")}async function a(q,K,{target:U}){const G=s(q);if(!G||typeof window>"u")return;if(U==="new-page"){const Q=window.open(G,"_blank","noopener,noreferrer");if(Q)Q.opener=null;return}window.location.assign(G)}function c(q,K){return(q??K.openTarget)==="new-page"&&Boolean(K.href)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{AdaptivePanel as t}from"../overlays/AdaptivePanel";export function ObjectReferencePanel(e){return n(t,{...e})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as p,Fragment as R}from"react/jsx-runtime";import{Copy as s,ExternalLink as r,FileText as l,Mail as o,MapPin as t,Phone as c,Search,User as i}from"lucide-react";const m={address:t,email:o,phone:c,user:i,customer:i,file:l,url:r,custom:Search,copy:s,emailAction:o,map:t,phoneAction:c,"external-link":r};export function ReferenceIcon({context:e,iconRenderer:n}){if(n)return p(R,{children:n(e)});const a=m[e.iconKey]??Search;return p(a,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}export{Search as ReferenceSearchIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{createMapsProviderHref,createMapsReferenceActions}from"./maps";import{createMapsReferenceActions as c}from"./maps";function n(e){return e.trim().replace(/\s+/g," ")}export function getObjectReferenceDisplayValue(e){return e.value??e.href??e.label}export function createCopyReferenceAction(e,t="Copy"){return{id:"copy",label:t,description:"Copy this reference",iconKey:"copy",metadata:{copyText:getObjectReferenceDisplayValue(e)}}}export function createOpenReferenceAction(e,t={}){if(!e.href)return null;const r=typeof t==="string"?{label:t}:t;return{id:"open",label:r.label??"Open details",description:"Open the related page or resource",href:e.href,openTarget:r.openTarget??e.openTarget,iconKey:"external-link"}}export function createEmailReferenceAction(e,t="Email"){if(e.kind!=="email")return null;const r=n(e.value??e.label);if(!r)return null;return{id:"email",label:t,description:"Send an email",href:`mailto:${r}`,iconKey:"email"}}export function createPhoneReferenceAction(e,t="Call"){if(e.kind!=="phone")return null;const r=n(e.value??e.label);if(!r)return null;return{id:"call",label:t,description:"Call this phone number",href:`tel:${r.replace(/[^\d+]/g,"")}`,iconKey:"phone"}}export function createDefaultObjectReferenceActions(e){return[createCopyReferenceAction(e),createOpenReferenceAction(e),createEmailReferenceAction(e),createPhoneReferenceAction(e),...c(e)].filter((t)=>Boolean(t))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{createCopyReferenceAction,createDefaultObjectReferenceActions,createEmailReferenceAction,createMapsProviderHref,createMapsReferenceActions,createOpenReferenceAction,createPhoneReferenceAction,getObjectReferenceDisplayValue}from"./actions";export{ObjectReferenceHandler}from"./ObjectReferenceHandler";export{ObjectReferencePanel}from"./ObjectReferencePanel";export{executeObjectReferenceAction}from"./runtime";export{normalizeSafeObjectReferenceHref,SAFE_OBJECT_REFERENCE_PROTOCOLS}from"./url-safety";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function createMapsProviderHref(e,t){const r=encodeURIComponent(a(t));switch(e){case"apple":return`https://maps.apple.com/?q=${r}`;case"google":return`https://www.google.com/maps/search/?api=1&query=${r}`;case"waze":return`https://waze.com/ul?q=${r}&navigate=yes`;case"geo":return`geo:0,0?q=${r}`}}export function createMapsReferenceActions(e,t={}){if(e.kind!=="address")return[];const r=e.value??e.label;if(!a(r))return[];const n=t.providers??["google","apple","waze"],o=t.labelPrefix??"Open in";return n.map((c)=>({id:`maps.${c}`,label:`${o} ${s(c)}`,description:"Open navigation for this address",href:createMapsProviderHref(c,r),iconKey:"map",metadata:{provider:c}}))}function a(e){return e.trim().replace(/\s+/g," ")}function s(e){switch(e){case"apple":return"Apple Maps";case"google":return"Google Maps";case"waze":return"Waze";case"geo":return"Maps"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getObjectReferenceDisplayValue as A}from"./actions";import{normalizeSafeObjectReferenceHref as B}from"./url-safety";export async function executeObjectReferenceAction(k,q){try{const w=q.actionHandlers?.[k.action.id];if(w)await w(k);else if(k.action.id==="copy")await C(k,q);else if(k.action.href){const y=B(k.action.href);if(!y)throw Error("Unsafe object reference href.");await D(y,k,E(k,q),q)}await q.onAction?.(k)}catch(w){q.onActionError?.(w,k)}}function C(k,q){const w=q.copyText??F(k.action.metadata?.copyText)??A(k.reference);if(q.copyHandler)return q.copyHandler(w,k);if(q.defaultCopy)return q.defaultCopy(w,k);throw Error("Clipboard is not available.")}function D(k,q,w,y){if(y.openHref)return y.openHref(k,q,{target:w});return y.defaultOpenHref?.(k,q,{target:w})}function E(k,q){return k.action.openTarget??G(k.action.metadata?.openTarget)??k.reference.openTarget??q.defaultOpenTarget??"same-page"}function F(k){return typeof k==="string"?k:void 0}function G(k){return k==="same-page"||k==="new-page"?k:void 0}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SAFE_OBJECT_REFERENCE_PROTOCOLS=new Set(["http:","https:","mailto:","tel:","geo:"]);export function normalizeSafeObjectReferenceHref(e){const t=e?.trim();if(!t)return null;if(t.startsWith("/")&&!t.startsWith("//"))return t;if(t.startsWith("#"))return t;try{const r=new URL(t);return SAFE_OBJECT_REFERENCE_PROTOCOLS.has(r.protocol)?r.toString():null}catch{return null}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as q from"react";import{createDefaultObjectReferenceActions as v}from"./actions";import{executeObjectReferenceAction as x}from"./runtime";export function useObjectReferenceController({reference:k,actions:I,defaultOpen:$=!1,open:J,onOpenChange:K,actionHandlers:L,onAction:M,onActionError:N,copyText:P,copyHandler:Q,openHref:S,openTarget:B,defaultCopy:V,defaultOpenTarget:W,defaultOpenHref:X}){const[U,b]=q.useState($),Y=J!==void 0,F=J??U,G=q.useMemo(()=>I??k.actions??v(k),[I,k]),w=q.useCallback((m)=>{if(!Y)b(m);K?.(m)},[Y,K]),j=q.useMemo(()=>({reference:k,actions:G,open:F,setOpen:w}),[k,G,F,w]),z=q.useCallback((m,Z,E="action")=>{if(Z.disabled)return;x({reference:m,action:Z,source:E},{actionHandlers:L,copyText:P,copyHandler:Q,openHref:S,onAction:M,onActionError:N,defaultOpenTarget:_(B,m.openTarget,W),defaultCopy:V,defaultOpenHref:X})},[L,Q,P,V,W,X,M,N,B,S]),D=q.useCallback((m)=>{z(k,m)},[k,z]),h=q.useCallback(()=>{const m=_(B,k.openTarget);if(m==="new-page"&&k.href){z(k,{id:"open-detail",label:"Open details",href:k.href,openTarget:m,iconKey:"external-link"},"trigger");return}w(!0)},[B,k,z,w]);return{context:j,openDetail:h,resolvedActions:G,resolvedOpen:F,runAction:D,runReferenceAction:z,setOpen:w}}function _(...k){return k.find(Boolean)??"same-page"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as z,jsxs as
|
|
1
|
+
import{jsx as z,jsxs as I,Fragment as A}from"react/jsx-runtime";import{Separator as Z}from"@contractspec/lib.ui-kit-web/ui/separator";import{cn as T}from"@contractspec/lib.ui-kit-web/ui/utils";import{cva as W}from"class-variance-authority";import{Menu as $}from"lucide-react";import*as q from"react";import{Button as D}from"../atoms/Button";import{ButtonLink as F}from"../atoms/ButtonLink";import{NavMain as O}from"../molecules/NavMain";import{NavUser as X}from"../molecules/NavUser";import{AdaptivePanel as P}from"../overlays";import{AppSidebar as R}from"./AppSidebar";const L=W("hidden items-center justify-between gap-4 md:flex",{variants:{density:{compact:"px-3 py-1",comfortable:"px-4 py-2"}},defaultVariants:{density:"comfortable"}}),V=W("flex items-center justify-between md:hidden",{variants:{density:{compact:"px-2 py-1",comfortable:"px-3 py-2"}},defaultVariants:{density:"comfortable"}});export function DesktopHeader({logo:E,nav:J,userMenu:C,cta:G,className:K,density:Q}){return I("header",{className:T(L({density:Q}),K),children:[I("div",{className:"flex items-center gap-4",children:[E,z(Z,{orientation:"vertical",className:"h-6"}),z(O,{items:J})]}),I("div",{className:"flex items-center gap-2",children:[G&&z(F,{variant:G.variant,href:G.href,children:G.label}),C&&z(X,{...C})]})]})}export function MobileHeader({logo:E,userMenu:J,mobileSidebar:C,className:G,density:K}){const[Q,Y]=q.useState(!1);return I("header",{className:T(V({density:K}),G),children:[z(P,{mode:"drawer",drawerDirection:"left",open:Q,onOpenChange:Y,trigger:z(D,{variant:"ghost",size:"icon","aria-label":"Open menu",children:z($,{className:"h-5 w-5"})}),title:"Menu",headerClassName:"sr-only",className:"w-[300px] p-0",children:C?z(R,{sections:C.sections,top:C.top,bottom:C.bottom,className:"h-svh"}):z("div",{className:"p-4",children:"No sidebar configured"})}),z("div",{className:"flex-1 px-2",children:E}),z("div",{className:"flex items-center gap-2",children:J&&z(X,{...J})})]})}export function Header(E){return I(A,{children:[z(MobileHeader,{...E}),z(DesktopHeader,{...E})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as z,jsxs as
|
|
1
|
+
import{jsx as z,jsxs as K,Fragment as I}from"react/jsx-runtime";import{NavigationMenu as M,NavigationMenuContent as C,NavigationMenuItem as L,NavigationMenuLink as k,NavigationMenuList as P,NavigationMenuTrigger as N}from"@contractspec/lib.ui-kit-web/ui/navigation-menu";import{Separator as d}from"@contractspec/lib.ui-kit-web/ui/separator";import{Box as Z,HStack as X,VStack as b}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as q}from"@contractspec/lib.ui-kit-web/ui/text";import{cn as D}from"@contractspec/lib.ui-kit-web/ui/utils";import{cva as S}from"class-variance-authority";import{Menu as p}from"lucide-react";import*as h from"react";import{Button as v}from"../atoms/Button";import{ButtonLink as F}from"../atoms/ButtonLink";import{CommandSearchTrigger as U}from"../molecules/CommandSearchTrigger";import{LangSwitchDropdown as g}from"../molecules/LangSwitchDropdown";import{MobileNavMenu as u}from"../molecules/MobileNavMenu";import{NavItemCard as f}from"../molecules/NavItemCard";import{NavUser as y}from"../molecules/NavUser";import{AdaptivePanel as _}from"../overlays";const j=S("flex items-center justify-between gap-4",{variants:{density:{compact:"px-3 py-2",comfortable:"px-4 py-3"}},defaultVariants:{density:"comfortable"}});export function MarketingHeader({logo:V,nav:Y=[],navLinkClassName:$,userMenu:A,cta:E,className:H,density:B,right:O,commandPaletteGroups:Q,langSwitchProps:W}){const[T,G]=h.useState(!1);return z(X,{as:"header",className:D("sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60",H),children:K(X,{className:D("mx-auto w-full max-w-7xl items-center justify-center",j({density:B})),children:[z(b,{className:"flex items-center gap-2 md:hidden",children:z(_,{mode:"drawer",drawerDirection:"left",open:T,onOpenChange:G,trigger:z(v,{variant:"ghost",size:"icon","aria-label":"Open menu",children:z(p,{className:"h-5 w-5"})}),title:"Menu",className:"w-[320px]",children:K("div",{className:"px-4 pb-4",children:[!!Q?.length&&z("div",{className:"mb-3",children:z(U,{groups:Q})}),E&&z(b,{className:"mb-3",children:z(F,{variant:E.variant,size:E.size,href:E.href,onClick:E.onClick,children:z(q,{children:E.label})})}),z(u,{items:Y})]})})}),V,z(X,{className:"hidden items-center gap-4 md:flex",children:Y.length>0&&K(I,{children:[z(d,{orientation:"vertical",className:"h-6"}),z(M,{className:"hidden md:flex",children:z(P,{children:Y.map((J)=>z(L,{children:J.items&&J.items.length>0?K(I,{children:[z(N,{className:$,children:J.label}),z(C,{children:z("div",{className:"grid w-[760px] grid-cols-3 gap-3 p-3",children:J.items.map((R)=>z(f,{item:R},R.href))})})]}):z(k,{className:$,href:J.href||"#",children:J.label})},String(J.key??J.href??J.label)))})})]})}),K(X,{className:"flex items-center gap-2",children:[!!Q?.length&&z(Z,{className:"hidden items-center gap-2 md:flex",children:z(U,{groups:Q})}),W?.options?.length>1&&z(g,{value:W.value,onChange:W.onChange,options:W.options}),O&&z(Z,{className:"hidden md:flex",children:O}),E&&z(Z,{className:"hidden md:flex",children:z(F,{variant:E.variant,size:E.size,href:E.href,onClick:E.onClick,children:z(q,{children:E.label})})}),A&&z(y,{...A})]})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as q,jsxs as
|
|
1
|
+
import{jsx as q,jsxs as E}from"react/jsx-runtime";import{VStack as W}from"@contractspec/lib.ui-kit-web/ui/stack";import{cn as X}from"@contractspec/lib.ui-kit-web/ui/utils";import{Menu as Y}from"lucide-react";import*as Z from"react";import{Button as $}from"../atoms/Button";import{CommandSearchTrigger as k}from"../molecules/CommandSearchTrigger";import{LangSwitchDropdown as A}from"../molecules/LangSwitchDropdown";import{MobileNavMenu as B}from"../molecules/MobileNavMenu";import{AdaptivePanel as O}from"../overlays";export function MarketingHeaderMobile({logo:I,nav:J=[],className:K,right:F,commandPaletteGroups:H,langSwitchProps:z}){const[Q,U]=Z.useState(!1);return q("div",{className:X("w-full border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60 md:hidden",K),children:E("div",{className:"mx-auto flex w-full max-w-7xl items-center justify-between px-3 py-2",children:[E("div",{className:"flex items-center gap-2",children:[q(O,{mode:"drawer",drawerDirection:"left",open:Q,onOpenChange:U,trigger:q($,{variant:"ghost",size:"icon","aria-label":"Open menu",children:q(Y,{className:"h-5 w-5"})}),title:"Menu",className:"w-[320px]",children:E("div",{className:"px-4 pb-4",children:[!!H?.length&&q("div",{className:"mb-3",children:q(k,{groups:H,compact:!0})}),q(W,{children:q(B,{items:J})}),F?q("div",{className:"mt-4",children:F}):null]})}),I]}),q("div",{className:"flex items-center gap-2",children:z?.options?.length>1&&q(A,{value:z.value,options:z.options,onChange:z.onChange})})]})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as F,jsxs as G}from"react/jsx-runtime";import{Drawer as Q,DrawerContent as M,DrawerDescription as O,DrawerHeader as T,DrawerTitle as f,DrawerTrigger as S}from"@contractspec/lib.ui-kit-web/ui/drawer";import{Sheet as u,SheetContent as y,SheetDescription as D,SheetHeader as b,SheetTitle as k,SheetTrigger as x}from"@contractspec/lib.ui-kit-web/ui/sheet";import{useMediaQuery as _}from"@contractspec/lib.ui-kit-web/ui/use-media-query";import{cn as K}from"../../lib/utils";const g={sm:"(min-width: 640px)",md:"(min-width: 768px)",lg:"(min-width: 1024px)"};export function AdaptivePanel({open:z,onOpenChange:L,trigger:V,title:W,description:J,mode:X="responsive",mobileMode:U="drawer",desktopMode:Y="sheet",breakpoint:A="md",sheetSide:B="right",drawerDirection:E="bottom",className:Z,headerClassName:$,titleClassName:q,descriptionClassName:v,sheetClassName:H,drawerClassName:P,children:I}){const R=_(toAdaptivePanelBreakpointQuery(A));if((X==="responsive"?R?Y:U:X)==="drawer")return G(Q,{open:z,onOpenChange:L,direction:E,children:[F(S,{asChild:!0,children:V}),G(M,{className:K("max-h-[85vh]",Z,P),children:[G(T,{className:$,children:[F(f,{className:q,children:W}),J?F(O,{className:v,children:J}):null]}),I]})]});return G(u,{open:z,onOpenChange:L,children:[F(x,{asChild:!0,children:V}),G(y,{side:B,className:K("sm:max-w-md",Z,H),children:[G(b,{className:$,children:[F(k,{className:q,children:W}),J?F(D,{className:v,children:J}):null]}),I]})]})}export function toAdaptivePanelBreakpointQuery(z){return typeof z==="number"?`(min-width: ${z}px)`:g[z]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{AdaptivePanel,toAdaptivePanelBreakpointQuery}from"./AdaptivePanel";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as k,jsxs as F}from"react/jsx-runtime";import{Dialog as P,DialogContent as B,DialogHeader as T,DialogTitle as D}from"@contractspec/lib.ui-kit-web/ui/dialog";import{cn as U}from"@contractspec/lib.ui-kit-web/ui/utils";import{MenuIcon as w,PanelRightIcon as y}from"lucide-react";import*as I from"react";import{Button as C}from"../atoms/Button";import{NavBrand as u}from"../atoms/NavBrand";import{Breadcrumbs as _}from"../molecules/Breadcrumbs";import{CommandSearchTrigger as x}from"../molecules/CommandSearchTrigger";import{PageOutline as M}from"./PageOutline";import{ShellNotifications as j}from"./ShellNotifications";import{ShellSidebar as d}from"./ShellSidebar";function f({sections:q,activeHref:G}){return k("nav",{className:"flex flex-col gap-5","aria-label":"Application navigation",children:q.map((A,J)=>F("div",{className:"flex flex-col gap-2",children:[A.title&&k("div",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:A.title}),k("div",{className:"flex flex-col gap-1",children:A.items.map((z)=>k(N,{item:z,activeHref:G},z.key??z.href??String(z.label)))})]},A.key??J))})}function N({item:q,activeHref:G,depth:A=0}){const J=q.active||Boolean(q.href)&&Boolean(G)&&(q.match==="startsWith"?G?.startsWith(q.href??""):G===q.href),z=F("span",{className:U("inline-flex min-w-0 items-center gap-2",A>0&&"pl-4"),children:[q.icon,k("span",{className:"truncate",children:q.label}),q.badge?k("span",{className:"ml-auto text-muted-foreground text-xs",children:q.badge}):null]}),Q=q.disabled||q.policyDecision?.effect==="deny";return F("div",{className:"flex flex-col gap-1",children:[q.href&&!Q?k("a",{href:q.href,target:q.target,"aria-current":J?"page":void 0,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground",J&&"bg-accent font-medium text-accent-foreground"),children:z}):k("button",{type:"button","aria-disabled":Q||void 0,disabled:Q,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",J&&"bg-accent font-medium text-accent-foreground"),children:z}),q.children?.length?k("div",{className:"flex flex-col gap-1",children:q.children.map((K)=>k(N,{item:K,activeHref:G,depth:A+1},K.key??K.href??String(K.label)))}):null]})}export function AppShell({brand:q,logo:G,title:A,homeHref:J,navigation:z=[],commands:Q=[],notifications:K,breadcrumbs:Z=[],pageOutline:V=[],activeHref:$,activeOutlineId:E,userMenu:W,topbarStart:S,topbarEnd:H,children:b,className:p,contentClassName:O,onNavigate:l}){const[v,L]=I.useState(!1),[h,X]=I.useState(!1),R=q??k(u,{href:J,logo:G,title:A}),Y=(g=!1)=>Q.length?k(x,{groups:Q,placeholder:"Search or run action...",compact:g}):null;return F("div",{className:U("min-h-svh bg-background",p),children:[k("header",{className:"sticky top-0 z-30 border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60",children:F("div",{className:"flex h-14 items-center gap-3 px-3 md:px-4",children:[k(C,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open navigation",onPress:()=>L(!0),children:k(w,{className:"h-4 w-4"})}),k("div",{className:"min-w-0 md:hidden",children:R}),k("div",{className:"hidden min-w-0 md:block",children:S}),k("div",{className:"min-w-0 flex-1",children:Z.length?k(_,{items:Z}):null}),k("div",{className:"hidden shrink-0 md:block",children:Y()}),V.length?k(C,{variant:"ghost",size:"icon",className:"lg:hidden","aria-label":"Open page outline",onPress:()=>X(!0),children:k(y,{className:"h-4 w-4"})}):null,K?k(j,{notifications:K}):null,H,W]})}),F("div",{className:"grid min-h-[calc(100svh-3.5rem)] grid-cols-1 md:grid-cols-[280px_minmax(0,1fr)] lg:grid-cols-[280px_minmax(0,1fr)_240px]",children:[k("aside",{className:"hidden border-r md:block",children:k(d,{sections:z,brand:R,commandTrigger:Y(),footer:W,activeHref:$})}),k("main",{className:U("min-w-0 px-4 py-5 md:px-6",O),children:b}),V.length?k("aside",{className:"hidden px-4 py-5 lg:block",children:k(M,{items:V,activeId:E})}):null]}),k(P,{open:v,onOpenChange:L,children:F(B,{className:"max-h-[85svh] overflow-auto sm:max-w-sm",children:[k(T,{children:k(D,{children:"Menu"})}),F("div",{className:"flex flex-col gap-4",children:[Y(),k(f,{sections:z,activeHref:$}),W]})]})}),k(P,{open:h,onOpenChange:X,children:F(B,{className:"max-h-[85svh] overflow-auto sm:max-w-sm",children:[k(T,{children:k(D,{children:"On this page"})}),k(M,{items:V,activeId:E,variant:"compact",onNavigate:()=>X(!1)})]})})]})}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as H}from"react/jsx-runtime";import{cn as S}from"@contractspec/lib.ui-kit-web/ui/utils";import*as M from"react";import{resolvePageOutlineItems as U}from"./outline";export function PageOutline({items:z,activeId:E,onNavigate:J,ariaLabel:K="On this page",variant:F="rail",maxLevel:C=3,className:B,...D}){const G=M.useMemo(()=>U(z,C),[z,C]);if(!G.length)return null;return H("nav",{"aria-label":K,className:S("text-muted-foreground text-sm",F==="rail"?"sticky top-20 max-h-[calc(100svh-6rem)] overflow-auto border-l pl-4":"rounded-md border p-3",B),...D,children:H("ol",{className:"m-0 list-none space-y-1 p-0",children:G.map((q)=>{const Q=E===q.id,T=q.href??`#${q.id}`;return H("li",{children:H("a",{href:T,"aria-current":Q?"location":void 0,onClick:()=>J?.(q),className:S("block rounded-xs px-2 py-1 transition-colors hover:bg-accent hover:text-accent-foreground",q.resolvedLevel===2&&"pl-5",q.resolvedLevel===3&&"pl-8 text-xs",Q&&"bg-accent font-medium text-accent-foreground"),children:q.label})},`${q.id}-${q.resolvedLevel}`)})})})}export function usePageOutlineActiveItem(z,E){const[J,K]=M.useState(z[0]);M.useEffect(()=>{if(!z.length||typeof IntersectionObserver>"u")return;const F=new IntersectionObserver((C)=>{const B=C.filter((D)=>D.isIntersecting).sort((D,G)=>G.intersectionRatio-D.intersectionRatio)[0];if(B?.target.id)K(B.target.id)},E??{rootMargin:"-20% 0px -65% 0px",threshold:[0,0.25,0.5,1]});for(const C of z){const B=document.getElementById(C);if(B)F.observe(B)}return()=>F.disconnect()},[z,E]);return J}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as D,jsxs as G,Fragment as S}from"react/jsx-runtime";import{cn as Z}from"@contractspec/lib.ui-kit-web/ui/utils";import{BellIcon as T,CheckIcon as $,XIcon as X}from"lucide-react";import*as q from"react";import{Button as V}from"../atoms/Button";function A(z){return z.status==="unread"||!z.status&&!z.readAt}function F(z){if(!z)return;return z instanceof Date?z.toLocaleString():z}export function ShellNotifications({notifications:z}){const[H,W]=q.useState(!1),E=z.items??[],J=z.unreadCount??E.filter((M)=>A(M)).length,K=z.label??"Notifications",P=z.emptyLabel??"No notifications",Q=z.markAllReadLabel??"Mark all notifications as read",Y=(M)=>{W(M);z.onOpenChange?.(M)};return G(S,{children:[G(V,{variant:"ghost",size:"icon",className:"relative",ariaLabelI18n:K,onPress:()=>Y(!0),children:[D(T,{className:"h-4 w-4"}),J>0?D("span",{"aria-label":`${J} unread notifications`,className:"absolute -top-1 -right-1 inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 font-medium text-[10px] text-destructive-foreground leading-none",children:J>99?"99+":J}):null]}),H?G("div",{"aria-label":K,"aria-modal":"true",className:"fixed top-16 right-4 z-50 max-h-[calc(100svh-5rem)] w-[min(24rem,calc(100vw-2rem))] overflow-auto rounded-md border bg-background p-4 shadow-lg",role:"dialog",children:[G("div",{className:"mb-3 flex items-center justify-between gap-3",children:[D("h2",{className:"font-semibold text-lg",children:K}),G("div",{className:"flex items-center gap-1",children:[E.length>0&&z.onMarkAllRead?G(V,{variant:"ghost",size:"sm",ariaLabelI18n:Q,onPress:z.onMarkAllRead,children:[D($,{className:"h-4 w-4"}),D("span",{children:"Mark all read"})]}):null,D(V,{variant:"ghost",size:"icon",ariaLabelI18n:"Close notifications",onPress:()=>Y(!1),children:D(X,{className:"h-4 w-4"})})]})]}),D("div",{className:"flex flex-col gap-2",children:z.loading?D("div",{"aria-live":"polite",className:"py-6 text-center text-muted-foreground text-sm",children:"Loading notifications..."}):E.length?E.map((M)=>D(U,{item:M,notifications:z,onClose:()=>Y(!1)},M.id)):D("div",{className:"py-6 text-center text-muted-foreground text-sm",children:P})})]}):null]})}function U({item:z,notifications:H,onClose:W}){const E=A(z),J=F(z.createdAt),K=()=>{H.onSelect?.(z);W()},P=()=>H.onMarkRead?.(z);if(H.renderItem)return D("div",{className:Z("rounded-xs border p-3",E&&"bg-muted/50"),children:H.renderItem(z,{unread:E,onSelect:K,onMarkRead:P})});const Q=D(S,{children:G("span",{className:"flex min-w-0 flex-1 flex-col gap-1 text-left",children:[G("span",{className:"flex items-center gap-2",children:[E?D("span",{className:"h-2 w-2 rounded-full bg-primary","aria-hidden":!0}):null,D("span",{className:"font-medium text-sm",children:z.title})]}),z.body?D("span",{className:"text-muted-foreground text-sm",children:z.body}):null,G("span",{className:"flex flex-wrap items-center gap-2 text-muted-foreground text-xs",children:[z.category?D("span",{children:z.category}):null,J?D("time",{children:J}):null]})]})});return G("div",{className:Z("flex items-start gap-2 rounded-xs border p-3",E&&"bg-muted/50"),children:[z.actionUrl?D("a",{href:z.actionUrl,className:"min-w-0 flex-1",onClick:K,children:Q}):D("button",{type:"button",className:"min-w-0 flex-1",onClick:K,children:Q}),E&&H.onMarkRead?D(V,{variant:"ghost",size:"icon",ariaLabelI18n:`Mark ${String(z.title)} as read`,onPress:P,children:D($,{className:"h-4 w-4"})}):null]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as z,jsxs as Q}from"react/jsx-runtime";import{Sidebar as A,SidebarContent as F,SidebarFooter as L,SidebarGroup as P,SidebarGroupContent as R,SidebarGroupLabel as B,SidebarHeader as K,SidebarMenu as Y,SidebarMenuBadge as N,SidebarMenuButton as C,SidebarMenuItem as G,SidebarProvider as I,SidebarRail as T}from"@contractspec/lib.ui-kit-web/ui/sidebar";import{cn as Z}from"@contractspec/lib.ui-kit-web/ui/utils";function M(q,D){if(q.active)return!0;if(!D||!q.href)return!1;return q.match==="startsWith"?D.startsWith(q.href):D===q.href}function $(q){return q.key??q.href??String(q.label)}function k({item:q,activeHref:D,depth:O=0}){const U=M(q,D),E=q.disabled||q.policyDecision?.effect==="deny",W=Boolean(q.children?.length),J=Q("span",{className:Z("inline-flex min-w-0 items-center gap-2",O>0&&"pl-4"),children:[q.icon,z("span",{className:"truncate",children:q.label})]});return Q(G,{children:[z(C,{asChild:!!q.href&&!E,isActive:U,"aria-disabled":E,"aria-label":q.href&&!E?void 0:q.ariaLabel,disabled:E,onClick:q.href||E?void 0:()=>q.onSelect?.(),children:q.href&&!E?z("a",{href:q.href,target:q.target,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),children:J}):J}),q.badge!=null&&z(N,{children:q.badge}),W&&z(Y,{className:"mt-1",children:q.children?.map((V)=>z(k,{item:V,activeHref:D,depth:O+1},$(V)))})]})}export function ShellSidebar({sections:q,brand:D,commandTrigger:O,footer:U,activeHref:E,className:W}){return z(I,{children:Q(A,{className:W,children:[z(T,{}),Q(K,{className:Z("gap-3",!D&&!O&&"hidden"),children:[D,O]}),z(F,{children:q.map((J,V)=>Q(P,{children:[J.title&&z(B,{children:J.title}),z(R,{children:z(Y,{children:J.items.map((X)=>z(k,{item:X,activeHref:E},$(X)))})})]},J.key??V))}),U&&z(L,{children:U})]})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{AppShell}from"./AppShell";export{PageOutline,usePageOutlineActiveItem}from"./PageOutline";export{annotateShellCommandsDecisions,annotateShellNavigationDecisions,filterShellNavigationForPolicy}from"./policy";export{ShellNotifications}from"./ShellNotifications";export{ShellSidebar}from"./ShellSidebar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function resolvePageOutlineItems(n,t,r=1){return n.flatMap((e)=>{const l=Math.min(e.level??r,t),a={...e,resolvedLevel:l},i=e.children?.length?resolvePageOutlineItems(e.children,t,Math.min(l+1,t)):[];return[a,...i]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function filterShellNavigationForPolicy(q,y){return annotateShellNavigationDecisions(q,y)}export function annotateShellNavigationDecisions(q,y){return q.flatMap((f)=>{const w=f.policy?y(f.policy,f):void 0,j=f.policyBehavior??"hide";if(w?.effect==="deny"&&j==="hide")return[];const k=f.items.flatMap((z)=>F(z,y));if(!k.length&&j==="hide")return[];if(!w&&k.length===f.items.length&&k.every((z,E)=>z===f.items[E]))return[f];return[{...f,items:k,policyDecision:w,disabled:w?.effect==="deny"&&j==="disable",locked:w?.effect==="deny"&&j==="show-with-lock"}]})}export function annotateShellCommandsDecisions(q,y){return q.flatMap((f)=>{const w=f.items.flatMap((j)=>{if(!j.policy)return[j];const k=y(j.policy,j);if(k.effect==="allow")return[{...j,policyDecision:k}];const A=j.policyBehavior??"disable";if(A==="hide")return[];return[{...j,policyDecision:k,disabled:A==="disable",locked:A==="show-with-lock"}]});return w.length?[{...f,items:w}]:[]})}function F(q,y){const f=q.policy?y(q.policy,q):void 0,w=q.policyBehavior??"hide";if(f?.effect==="deny"&&w==="hide")return[];const j=q.children,k=j?.flatMap((z)=>F(z,y));if(j?.length&&!k?.length&&!q.href&&w==="hide")return[];const A=!j&&!k||!!k&&k.length===j?.length&&k.every((z,E)=>z===j?.[E]);if(!f&&A)return[q];return[{...q,children:k,policyDecision:f,disabled:f?.effect==="deny"&&w==="disable",locked:f?.effect==="deny"&&w==="show-with-lock"}]}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineFeature as g}from"@contractspec/lib.contracts-spec/features";export const DesignSystemFeature=g({meta:{key:"libs.design-system",version:"1.0.0",title:"Design System",description:"Design tokens and
|
|
1
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec/features";export const DesignSystemFeature=g({meta:{key:"libs.design-system",version:"1.0.0",title:"Design System",description:"Design tokens, theming primitives, and composed product-surface components",domain:"design-system",owners:["@contractspec-core"],tags:["package","libs","design-system","components"],stability:"experimental"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as u}from"react/jsx-runtime";import*as l from"react";const c=l.createContext(void 0);export function DesignSystemTranslationProvider({children:e,resolver:n}){return u(c.Provider,{value:n,children:e})}export function useDesignSystemTranslation(){return l.useContext(c)}export function resolveTranslationString(e,n){if(!e)return e;return n?.(e)??e}export function resolveTranslationNode(e,n){return typeof e==="string"?resolveTranslationString(e,n):e}export function createTranslationResolver({registry:e,locale:n,fallbackLocale:s,specKeys:a=[]}){return(o)=>{const i=o.match(/^([^:]+)::(.+)$/);if(i?.[1]&&i[2]){const[,r,t]=i;return e.getWithFallback(r,t,n,s)?.message.value}for(const r of a){const t=e.getWithFallback(r,o,n,s);if(t)return t.message.value}return}}export function createRuntimeTranslationResolver({runtime:e,onMissing:n}){return(s,a)=>{const o=s.match(/^([^:]+)::(.+)$/),i=o?.[1],r=o?.[2]??s,t=e.tUnknown(r,a,{onMissing:n,specKey:i});return t===r&&n!=="key"?void 0:t}}
|
package/dist/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AgentMonitor}from"./components/agent/AgentMonitor";export{ApprovalQueue}from"./components/agent/ApprovalQueue";export{DeleteButton,EditButton,ToggleButton,ToggleLeftButton,ToggleRightButton,ViewButton}from"./components/atoms/ActionButtons";export{Button}from"./components/atoms/Button";export{ButtonLink}from"./components/atoms/ButtonLink";export{Cta}from"./components/atoms/Cta";export{DateChip,DurationChip,PlaceChip,TimeChip}from"./components/atoms/DataChips";export{EmptyState}from"./components/atoms/EmptyState";export{ErrorState}from"./components/atoms/ErrorState";export{Input}from"./components/atoms/Input";export{InputPassword}from"./components/atoms/InputPassword";export{Link}from"./components/atoms/Link";export{LoaderCircular}from"./components/atoms/LoaderCircular";export{NavBrand}from"./components/atoms/NavBrand";export{RankBadge}from"./components/atoms/RankBadge";export{ScoreBar}from"./components/atoms/ScoreBar";export{Stepper}from"./components/atoms/Stepper";export{Textarea}from"./components/atoms/Textarea";export{DataTable}from"./components/data-table/DataTable";export{DataTableToolbar}from"./components/data-table/DataTableToolbar";export{DataViewDetail}from"./components/data-view/DataViewDetail";export{DataViewList}from"./components/data-view/DataViewList";export{DataViewRenderer}from"./components/data-view/DataViewRenderer";export{DataViewTable}from"./components/data-view/DataViewTable";export*from"./components/forms";export*from"./components/layout";export{DefinitionList}from"./components/legal/atoms/DefinitionList";export{KeyValueList}from"./components/legal/atoms/KeyValueList";export{LegalCallout}from"./components/legal/atoms/LegalCallout";export{LegalHeading}from"./components/legal/atoms/LegalHeading";export{LegalList}from"./components/legal/atoms/LegalList";export{LegalSection}from"./components/legal/atoms/LegalSection";export{LegalText}from"./components/legal/atoms/LegalText";export{ConsentItem,ConsentList}from"./components/legal/molecules/Consent";export{ContactFields}from"./components/legal/molecules/ContactFields";export{LegalMeta}from"./components/legal/molecules/LegalMeta";export{LegalTOC}from"./components/legal/molecules/LegalTOC";export*from"./components/legal/organisms/ContactForm";export*from"./components/legal/organisms/GDPRDataRequest";export*from"./components/legal/organisms/GDPRRights";export*from"./components/legal/organisms/LegalPageLayout";export{ContactTemplate}from"./components/legal/templates/ContactTemplate";export{CookiesTemplate}from"./components/legal/templates/CookiesTemplate";export{PrivacyTemplate}from"./components/legal/templates/PrivacyTemplate";export{SalesTermsTemplate}from"./components/legal/templates/SalesTermsTemplate";export{TermsTemplate}from"./components/legal/templates/TermsTemplate";export{List,ListItem}from"./components/list";export{MarketingCard,MarketingCardContent,MarketingCardDescription,MarketingCardHeader,MarketingCardTitle}from"./components/marketing/MarketingCard";export{MarketingCardsSection}from"./components/marketing/MarketingCardsSection";export{MarketingComparisonSection}from"./components/marketing/MarketingComparisonSection";export{MarketingIconCard}from"./components/marketing/MarketingIconCard";export{MarketingSection}from"./components/marketing/MarketingSection";export{MarketingStepCard}from"./components/marketing/MarketingStepCard";export{AiLinkButton}from"./components/molecules/AiLinkButton";export{Breadcrumbs}from"./components/molecules/Breadcrumbs";export{CodeBlock}from"./components/molecules/CodeBlock";export{CommandPalette}from"./components/molecules/CommandPalette";export{CommandSearchTrigger}from"./components/molecules/CommandSearchTrigger";export{CommandTabs}from"./components/molecules/CommandTabs";export{CopyButton}from"./components/molecules/CopyButton";export{DimensionScoresCard}from"./components/molecules/DimensionScoresCard";export{EntityCard}from"./components/molecules/EntityCard";export{FiltersToolbar}from"./components/molecules/FiltersToolbar";export{HoverPreview}from"./components/molecules/HoverPreview";export{HoverPreviewDoc}from"./components/molecules/hover-previews/Doc";export{HoverPreviewMedia}from"./components/molecules/hover-previews/Media";export{HoverPreviewSimple}from"./components/molecules/hover-previews/Simple";export{HoverPreviewStats}from"./components/molecules/hover-previews/Stats";export{HoverPreviewUser}from"./components/molecules/hover-previews/User";export{InstallCommand}from"./components/molecules/InstallCommand";export{LangSwitch}from"./components/molecules/LangSwitch";export{LoaderBlock}from"./components/molecules/LoaderBlock";export{MarkdownRenderer}from"./components/molecules/MarkdownRenderer";export{NavMain}from"./components/molecules/NavMain";export{NavUser}from"./components/molecules/NavUser";export{OverviewCard}from"./components/molecules/OverviewCard";export{SkeletonBlock}from"./components/molecules/SkeletonBlock";export{SkeletonCircle}from"./components/molecules/SkeletonCircle";export{SkeletonList}from"./components/molecules/SkeletonList";export{StatCard,StatCardGroup}from"./components/molecules/StatCard";export{StatusChip}from"./components/molecules/StatusChip";export{Tabs,TabsContent,TabsList,TabsTrigger}from"./components/molecules/Tabs";export{AcademyLayout}from"./components/organisms/AcademyLayout";export{AppHeader}from"./components/organisms/AppHeader";export{AppLayout}from"./components/organisms/AppLayout";export{AppSidebar}from"./components/organisms/AppSidebar";export{EmptyDataList}from"./components/organisms/EmptyDataList";export{EmptySearchResult}from"./components/organisms/EmptySearchResult";export{FAQSection}from"./components/organisms/FAQSection";export{FeatureCarousel}from"./components/organisms/FeatureCarousel";export{FeaturesSection}from"./components/organisms/FeaturesSection";export{Footer}from"./components/organisms/Footer";export{DesktopHeader,Header,MobileHeader}from"./components/organisms/Header";export{HeroResponsive}from"./components/organisms/HeroResponsive";export{HeroSection}from"./components/organisms/HeroSection";export{ListCardPage}from"./components/organisms/ListCardPage";export{ListGridPage}from"./components/organisms/ListGridPage";export{ListPageResponsive}from"./components/organisms/ListPageResponsive";export{ListTablePage}from"./components/organisms/ListTablePage";export{MarketingHeader}from"./components/organisms/MarketingHeader";export{MarketingHeaderDesktop}from"./components/organisms/MarketingHeaderDesktop";export{MarketingHeaderMobile}from"./components/organisms/MarketingHeaderMobile";export{MarketingLayout}from"./components/organisms/MarketingLayout";export{ModelComparisonView}from"./components/organisms/ModelComparisonView";export{PageHeaderResponsive}from"./components/organisms/PageHeaderResponsive";export{PricingCarousel}from"./components/organisms/PricingCarousel";export{PricingSection}from"./components/organisms/PricingSection";export{TestimonialCarousel}from"./components/organisms/TestimonialCarousel";export{PackageManagerProvider,usePackageManager}from"./components/providers/PackageManagerProvider";export{ListPageTemplate}from"./components/templates/lists/ListPageTemplate";export{BlockQuote,Code,H1,H2,H3,H4,Large,Lead,Muted,P,Small,Text}from"./components/typography";export{ComparisonView}from"./components/visualization/ComparisonView";export{TimelineView}from"./components/visualization/TimelineView";export{VisualizationCard}from"./components/visualization/VisualizationCard";export{VisualizationGrid}from"./components/visualization/VisualizationGrid";export{VisualizationRenderer}from"./components/visualization/VisualizationRenderer";export*from"./design-system.feature";export{useListUrlState}from"./hooks/useListUrlState";export*from"./i18n/translation";export{useColorScheme}from"./platform/useColorScheme";export{useReducedMotion}from"./platform/useReducedMotion";export{useResponsive}from"./platform/useResponsive";export*from"./platform/withPlatformUI";export*from"./renderers";export*from"./theme";export*from"./types/navigation";
|
|
1
|
+
export{AgentMonitor}from"./components/agent/AgentMonitor";export{ApprovalQueue}from"./components/agent/ApprovalQueue";export{DeleteButton,EditButton,ToggleButton,ToggleLeftButton,ToggleRightButton,ViewButton}from"./components/atoms/ActionButtons";export{Button}from"./components/atoms/Button";export{ButtonLink}from"./components/atoms/ButtonLink";export{Cta}from"./components/atoms/Cta";export{DateChip,DurationChip,PlaceChip,TimeChip}from"./components/atoms/DataChips";export{EmptyState}from"./components/atoms/EmptyState";export{ErrorState}from"./components/atoms/ErrorState";export{Input}from"./components/atoms/Input";export{InputPassword}from"./components/atoms/InputPassword";export{Link}from"./components/atoms/Link";export{LoaderCircular}from"./components/atoms/LoaderCircular";export{NavBrand}from"./components/atoms/NavBrand";export{RankBadge}from"./components/atoms/RankBadge";export{ScoreBar}from"./components/atoms/ScoreBar";export{Stepper}from"./components/atoms/Stepper";export{Textarea}from"./components/atoms/Textarea";export{DataTable}from"./components/data-table/DataTable";export{DataTableToolbar}from"./components/data-table/DataTableToolbar";export{DataViewDetail}from"./components/data-view/DataViewDetail";export{DataViewGrid}from"./components/data-view/DataViewGrid";export{DataViewList}from"./components/data-view/DataViewList";export{DataViewRenderer}from"./components/data-view/DataViewRenderer";export{DataViewTable}from"./components/data-view/DataViewTable";export*from"./components/forms";export*from"./components/layout";export{DefinitionList}from"./components/legal/atoms/DefinitionList";export{KeyValueList}from"./components/legal/atoms/KeyValueList";export{LegalCallout}from"./components/legal/atoms/LegalCallout";export{LegalHeading}from"./components/legal/atoms/LegalHeading";export{LegalList}from"./components/legal/atoms/LegalList";export{LegalSection}from"./components/legal/atoms/LegalSection";export{LegalText}from"./components/legal/atoms/LegalText";export{ConsentItem,ConsentList}from"./components/legal/molecules/Consent";export{ContactFields}from"./components/legal/molecules/ContactFields";export{LegalMeta}from"./components/legal/molecules/LegalMeta";export{LegalTOC}from"./components/legal/molecules/LegalTOC";export*from"./components/legal/organisms/ContactForm";export*from"./components/legal/organisms/GDPRDataRequest";export*from"./components/legal/organisms/GDPRRights";export*from"./components/legal/organisms/LegalPageLayout";export{ContactTemplate}from"./components/legal/templates/ContactTemplate";export{CookiesTemplate}from"./components/legal/templates/CookiesTemplate";export{PrivacyTemplate}from"./components/legal/templates/PrivacyTemplate";export{SalesTermsTemplate}from"./components/legal/templates/SalesTermsTemplate";export{TermsTemplate}from"./components/legal/templates/TermsTemplate";export{List,ListItem}from"./components/list";export{MarketingCard,MarketingCardContent,MarketingCardDescription,MarketingCardHeader,MarketingCardTitle}from"./components/marketing/MarketingCard";export{MarketingCardsSection}from"./components/marketing/MarketingCardsSection";export{MarketingComparisonSection}from"./components/marketing/MarketingComparisonSection";export{MarketingIconCard}from"./components/marketing/MarketingIconCard";export{MarketingSection}from"./components/marketing/MarketingSection";export{MarketingStepCard}from"./components/marketing/MarketingStepCard";export{AiLinkButton}from"./components/molecules/AiLinkButton";export{Breadcrumbs}from"./components/molecules/Breadcrumbs";export{CodeBlock}from"./components/molecules/CodeBlock";export{CommandPalette}from"./components/molecules/CommandPalette";export{CommandSearchTrigger}from"./components/molecules/CommandSearchTrigger";export{CommandTabs}from"./components/molecules/CommandTabs";export{CopyButton}from"./components/molecules/CopyButton";export{DimensionScoresCard}from"./components/molecules/DimensionScoresCard";export{EntityCard}from"./components/molecules/EntityCard";export{FiltersToolbar}from"./components/molecules/FiltersToolbar";export{HoverPreview}from"./components/molecules/HoverPreview";export{HoverPreviewDoc}from"./components/molecules/hover-previews/Doc";export{HoverPreviewMedia}from"./components/molecules/hover-previews/Media";export{HoverPreviewSimple}from"./components/molecules/hover-previews/Simple";export{HoverPreviewStats}from"./components/molecules/hover-previews/Stats";export{HoverPreviewUser}from"./components/molecules/hover-previews/User";export{InstallCommand}from"./components/molecules/InstallCommand";export{LangSwitch}from"./components/molecules/LangSwitch";export{LoaderBlock}from"./components/molecules/LoaderBlock";export{MarkdownRenderer}from"./components/molecules/MarkdownRenderer";export{NavMain}from"./components/molecules/NavMain";export{NavUser}from"./components/molecules/NavUser";export{OverviewCard}from"./components/molecules/OverviewCard";export{SkeletonBlock}from"./components/molecules/SkeletonBlock";export{SkeletonCircle}from"./components/molecules/SkeletonCircle";export{SkeletonList}from"./components/molecules/SkeletonList";export{StatCard,StatCardGroup}from"./components/molecules/StatCard";export{StatusChip}from"./components/molecules/StatusChip";export{Tabs,TabsContent,TabsList,TabsTrigger}from"./components/molecules/Tabs";export{createCopyReferenceAction,createDefaultObjectReferenceActions,createEmailReferenceAction,createMapsProviderHref,createMapsReferenceActions,createOpenReferenceAction,createPhoneReferenceAction,getObjectReferenceDisplayValue,normalizeSafeObjectReferenceHref,ObjectReferenceHandler,SAFE_OBJECT_REFERENCE_PROTOCOLS}from"./components/object-reference";export{AcademyLayout}from"./components/organisms/AcademyLayout";export{AppHeader}from"./components/organisms/AppHeader";export{AppLayout}from"./components/organisms/AppLayout";export{AppSidebar}from"./components/organisms/AppSidebar";export{EmptyDataList}from"./components/organisms/EmptyDataList";export{EmptySearchResult}from"./components/organisms/EmptySearchResult";export{FAQSection}from"./components/organisms/FAQSection";export{FeatureCarousel}from"./components/organisms/FeatureCarousel";export{FeaturesSection}from"./components/organisms/FeaturesSection";export{Footer}from"./components/organisms/Footer";export{DesktopHeader,Header,MobileHeader}from"./components/organisms/Header";export{HeroResponsive}from"./components/organisms/HeroResponsive";export{HeroSection}from"./components/organisms/HeroSection";export{ListCardPage}from"./components/organisms/ListCardPage";export{ListGridPage}from"./components/organisms/ListGridPage";export{ListPageResponsive}from"./components/organisms/ListPageResponsive";export{ListTablePage}from"./components/organisms/ListTablePage";export{MarketingHeader}from"./components/organisms/MarketingHeader";export{MarketingHeaderDesktop}from"./components/organisms/MarketingHeaderDesktop";export{MarketingHeaderMobile}from"./components/organisms/MarketingHeaderMobile";export{MarketingLayout}from"./components/organisms/MarketingLayout";export{ModelComparisonView}from"./components/organisms/ModelComparisonView";export{PageHeaderResponsive}from"./components/organisms/PageHeaderResponsive";export{PricingCarousel}from"./components/organisms/PricingCarousel";export{PricingSection}from"./components/organisms/PricingSection";export{TestimonialCarousel}from"./components/organisms/TestimonialCarousel";export*from"./components/overlays";export{PackageManagerProvider,usePackageManager}from"./components/providers/PackageManagerProvider";export{AppShell,PageOutline,ShellSidebar,usePageOutlineActiveItem}from"./components/shell";export{ListPageTemplate}from"./components/templates/lists/ListPageTemplate";export{BlockQuote,Code,H1,H2,H3,H4,Large,Lead,Muted,P,Small,Text}from"./components/typography";export{ComparisonView}from"./components/visualization/ComparisonView";export{TimelineView}from"./components/visualization/TimelineView";export{VisualizationCard}from"./components/visualization/VisualizationCard";export{VisualizationGrid}from"./components/visualization/VisualizationGrid";export{VisualizationRenderer}from"./components/visualization/VisualizationRenderer";export*from"./design-system.feature";export{useListUrlState}from"./hooks/useListUrlState";export*from"./i18n/translation";export{useColorScheme}from"./platform/useColorScheme";export{useReducedMotion}from"./platform/useReducedMotion";export{useResponsive}from"./platform/useResponsive";export*from"./platform/withPlatformUI";export*from"./renderers";export*from"./theme";export*from"./types/navigation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as z,jsxs as $}from"react/jsx-runtime";import{Input as J}from"../../components/atoms/Input";import{Select as N}from"../../components/forms/controls/Select";import{HStack as Q}from"../../components/layout/Stack";import{optionValue as U}from"../../components/primitives/control";import{useTranslatedText as W}from"../../components/primitives/themed";import{countryCallingCode as Y,countryFlag as Z}from"./phone-country-utils";import{FORM_FALLBACK_TEXT as G}from"./values";export function PhoneFlag(b){if(b.hidden)return null;const q=Z(b.iso2);if(!q)return null;return z("span",{"aria-label":b.iso2,className:"shrink-0 text-lg",role:"img",children:q})}export function PhoneCountryControl(b){const q=W();return $(Q,{align:"center",gap:"sm",children:[z(PhoneFlag,{iso2:b.countryIso2,hidden:!b.display.flag}),b.display.countrySelect?z(N,{id:b.id,name:b.name,value:b.selectValue,onChange:(D)=>b.onCountryChange(U(D)),options:b.selectOptions,disabled:b.disabled||b.readOnly}):z(J,{id:b.id,name:b.name,value:b.countryCode,onChange:(D)=>b.onCountryChange(D.currentTarget.value),placeholder:q(b.parts?.placeholdersI18n?.countryCode??G.countryCode),"aria-label":q(G.countryCode),readOnly:b.readOnly,disabled:b.disabled}),b.display.callingCode?z("span",{className:"min-w-12 text-muted-foreground text-sm",children:Y(b.countryIso2)||b.countryCode}):null]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"country-flag-icons/unicode";import{getCountries as C,getCountryCallingCode as i}from"libphonenumber-js/min";const d=C();export function normalizeIso2(o){const n=o?.trim().toUpperCase();return n&&d.includes(n)?n:void 0}export function countryCallingCode(o){const n=normalizeIso2(o);return n?`+${i(n)}`:""}export function countryFlag(o){const n=normalizeIso2(o);return n?l(n):""}function c(o){const n=o?.allowedIso2?.map((e)=>normalizeIso2(e)).filter((e)=>Boolean(e));return n?.length?n:d}export function isAllowedPhoneCountry(o,n){const e=normalizeIso2(o);return Boolean(e&&c(n).includes(e))}export function countryFromCallingCode(o,n,e){const t=o?.trim().replace(/^\+/,"");if(!t)return;const r=c(n),u=normalizeIso2(e);if(u&&r.includes(u)&&i(u)===t)return u;return r.find((s)=>i(s)===t)}export function countryFromInput(o,n,e){const t=o?.trim(),r=normalizeIso2(t);return(r&&isAllowedPhoneCountry(r,n)?r:void 0)??countryFromCallingCode(t,n,e)}export function phoneCountryOptions(o){return c(o).map((n)=>{const e=countryCallingCode(n);return{labelI18n:`${countryFlag(n)} ${n} ${e}`,value:n}})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as U,jsxs as R}from"react/jsx-runtime";import{Input as N}from"../../components/atoms/Input";import{HStack as V,VStack as D}from"../../components/layout/Stack";import{inputValue as z}from"../../components/primitives/control";import{useTranslatedText as A}from"../../components/primitives/themed";import{PhoneCountryControl as L,PhoneFlag as T}from"./phone-country-control";import{countryCallingCode as j,countryFromInput as C,phoneCountryOptions as d}from"./phone-country-utils";import{normalizePhoneForDisplay as E,parsePhoneInput as K}from"./phone-utils";import{FORM_FALLBACK_TEXT as $}from"./values";export const PhoneField=(b)=>{const Z=A(),X=b.input?.mode??"split",g=b.input?.autoSwitch??!0,k=b.country?.detection??"input",W=b.output?.countryCodeFormat,H={flag:b.display?.flag??!0,callingCode:b.display?.callingCode??!0,countrySelect:b.display?.countrySelect??!0,extension:b.display?.extension??!0},G=E(b.value,b.country,W),Y=G.countryIso2,B=b.countryOptions?.length?b.countryOptions:d(b.country),M=B.some((q)=>String(q.value).toUpperCase()===Y)?Y:G.countryCode,Q=(q)=>{b.onChange?.(E(q,b.country,W))},S=(q)=>{const J=C(q,b.country,Y);Q({...G,countryIso2:J,countryCode:W==="iso2"?J??q:j(J)||q,e164:void 0})},f=(q)=>{if(g&&k==="input"&&q.trim().startsWith("+")){Q(K(q,G,b.country,W));return}Q({...G,nationalNumber:q,e164:void 0})},P=G.e164||`${G.countryCode}${G.nationalNumber}`,O=U(L,{id:b.id?`${b.id}-country`:void 0,name:b.name?`${b.name}.countryCode`:void 0,countryCode:G.countryCode,countryIso2:Y,selectValue:M,selectOptions:B,parts:b.parts,display:H,disabled:b.disabled,readOnly:b.readOnly,onCountryChange:S});if(X==="single")return U(D,{gap:"sm",children:R(V,{align:"center",gap:"sm",children:[U(T,{iso2:Y,hidden:!H.flag}),U(N,{id:b.id,name:b.name,value:P,onChange:(q)=>{const J=z(q);if(g&&k==="input"&&J.trim().startsWith("+")){Q(K(J,G,b.country,W));return}Q({...G,nationalNumber:J,e164:void 0})},placeholder:Z(b.parts?.placeholdersI18n?.nationalNumber??$.phoneNumber),keyboard:{kind:"phone",autoComplete:"tel"},"aria-invalid":b["aria-invalid"],"aria-describedby":b["aria-describedby"],readOnly:b.readOnly,disabled:b.disabled})]})});return R(D,{gap:"sm",children:[O,U(N,{id:b.id,name:b.name,value:G.nationalNumber,onChange:(q)=>f(z(q)),placeholder:Z(b.parts?.placeholdersI18n?.nationalNumber??$.phoneNumber),keyboard:{kind:"phone",autoComplete:"tel-national"},"aria-invalid":b["aria-invalid"],"aria-describedby":b["aria-describedby"],readOnly:b.readOnly,disabled:b.disabled}),H.extension?U(N,{id:b.id?`${b.id}-extension`:void 0,name:b.name?`${b.name}.extension`:void 0,value:G.extension??"",onChange:(q)=>Q({...G,extension:z(q)}),placeholder:Z(b.parts?.placeholdersI18n?.extension??$.extension),keyboard:{kind:"number"},"aria-label":Z($.extension),readOnly:b.readOnly,disabled:b.disabled}):null]})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parsePhoneNumberFromString as c}from"libphonenumber-js/min";import{countryCallingCode as d,countryFromCallingCode as C,isAllowedPhoneCountry as a,normalizeIso2 as i}from"./phone-country-utils";function l(o){const e=o.nationalNumber.replace(/\D+/g,""),r=o.nationalNumber.trim(),t=o.countryCode.trim(),n=t.startsWith("+")||/^\d+$/.test(t)?t.replace(/^\+?/,"+"):d(o.countryIso2);return{...o,e164:o.e164??(n&&e&&!r.startsWith("+")?`${n}${e}`:void 0)}}export function normalizePhoneForDisplay(o,e,r){const t=o?.e164?c(o.e164):void 0,n=t?.country&&!a(t.country,e)?void 0:t,u=i(o?.countryIso2),m=r==="iso2"?i(o?.countryCode):C(o?.countryCode,e,u),s=u??n?.country??m??i(e?.defaultIso2),y=r==="iso2"?s??o?.countryCode??"":o?.countryCode?.startsWith("+")?o.countryCode:d(s);return l({countryCode:y,countryIso2:s,nationalNumber:n?.nationalNumber??o?.nationalNumber??"",extension:n?.ext??o?.extension,e164:n?.number??o?.e164})}export function parsePhoneInput(o,e,r,t){const n=c(o,i(e.countryIso2??r?.defaultIso2));if(!n||n.country&&!a(n.country,r))return normalizePhoneForDisplay({...e,nationalNumber:o,e164:void 0},r,t);return normalizePhoneForDisplay({countryCode:t==="iso2"?n.country??e.countryIso2??"":`+${n.countryCallingCode}`,countryIso2:n.country??e.countryIso2,nationalNumber:n.nationalNumber,extension:n.ext,e164:n.number},r,t)}
|