@sincpro/web-ui 2.11.0 → 2.13.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 +77 -20
- package/dist/components/activity/Messages.d.ts +3 -23
- package/dist/components/activity/Messages.js +3 -17
- package/dist/components/activity/index.d.ts +2 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/activity/messageKind.d.ts +23 -0
- package/dist/components/activity/messageKind.js +17 -0
- package/dist/components/assist/assist.d.ts +1 -1
- package/dist/components/assist/assist.js +1 -1
- package/dist/components/frame/model.js +1 -1
- package/dist/components/guide/index.d.ts +2 -1
- package/dist/components/guide/index.js +2 -1
- package/dist/components/guide/selector.d.ts +25 -0
- package/dist/components/guide/selector.js +14 -0
- package/dist/components/guide/target.d.ts +3 -25
- package/dist/components/guide/target.js +2 -14
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/listing/AxisLevels.d.ts +2 -5
- package/dist/components/listing/AxisLevels.js +5 -22
- package/dist/components/listing/BoardColumns.js +10 -6
- package/dist/components/listing/ColumnsMenu.d.ts +3 -7
- package/dist/components/listing/ColumnsMenu.js +4 -8
- package/dist/components/listing/Listing.js +3 -1
- package/dist/components/listing/ListingBar.d.ts +16 -94
- package/dist/components/listing/ListingBar.js +24 -2
- package/dist/components/listing/RecordCard.d.ts +41 -3
- package/dist/components/listing/RecordCard.js +63 -22
- package/dist/components/listing/Row.js +5 -2
- package/dist/components/listing/collapsed.d.ts +2 -0
- package/dist/components/listing/collapsed.js +8 -0
- package/dist/components/listing/columnSpecs.d.ts +34 -0
- package/dist/components/listing/columnSpecs.js +54 -0
- package/dist/components/listing/columns.d.ts +3 -21
- package/dist/components/listing/columns.js +2 -39
- package/dist/components/listing/index.d.ts +11 -7
- package/dist/components/listing/index.js +15 -8
- package/dist/components/listing/levels.d.ts +9 -0
- package/dist/components/listing/levels.js +27 -0
- package/dist/components/listing/pageSizes.d.ts +9 -0
- package/dist/components/listing/pageSizes.js +11 -0
- package/dist/components/listing/pages.d.ts +2 -9
- package/dist/components/listing/pages.js +5 -9
- package/dist/components/listing/set.d.ts +1 -1
- package/dist/components/listing/tree.d.ts +2 -1
- package/dist/components/listing/tree.js +4 -5
- package/dist/components/preview/FilePreview.d.ts +3 -3
- package/dist/components/preview/FilePreview.js +3 -15
- package/dist/components/preview/index.d.ts +2 -1
- package/dist/components/preview/index.js +2 -1
- package/dist/components/preview/previewKind.d.ts +3 -0
- package/dist/components/preview/previewKind.js +17 -0
- package/dist/components/receipt/Receipt.d.ts +51 -0
- package/dist/components/receipt/Receipt.js +23 -0
- package/dist/components/receipt/index.d.ts +1 -0
- package/dist/components/receipt/index.js +3 -0
- package/dist/components/search/CriteriaChips.js +5 -3
- package/dist/components/search/FilterBuilder.d.ts +5 -139
- package/dist/components/search/FilterBuilder.js +5 -579
- package/dist/components/search/JsonEditor.d.ts +2 -8
- package/dist/components/search/JsonEditor.js +5 -15
- package/dist/components/search/RuleValue.d.ts +2 -2
- package/dist/components/search/RuleValue.js +5 -4
- package/dist/components/search/datePeriods.js +1 -1
- package/dist/components/search/filterTree.d.ts +183 -0
- package/dist/components/search/filterTree.js +570 -0
- package/dist/components/search/formatJson.d.ts +8 -0
- package/dist/components/search/formatJson.js +17 -0
- package/dist/components/search/index.d.ts +5 -3
- package/dist/components/search/index.js +7 -3
- package/dist/components/search/query.js +1 -1
- package/dist/components/shell/KioskFrame.d.ts +35 -0
- package/dist/components/shell/KioskFrame.js +39 -0
- package/dist/components/shell/SearchEntry.js +1 -1
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/foundations/calendar.js +1 -1
- package/dist/foundations/catalog.d.ts +7 -8
- package/dist/foundations/catalog.js +10 -35
- package/dist/foundations/chart.js +1 -1
- package/dist/foundations/clock.d.ts +3 -0
- package/dist/foundations/clock.js +41 -0
- package/dist/foundations/controlName.d.ts +12 -0
- package/dist/foundations/controlName.js +14 -0
- package/dist/foundations/copy.d.ts +3 -1130
- package/dist/foundations/copy.es.d.ts +1 -1
- package/dist/foundations/copy.es.js +26 -0
- package/dist/foundations/copy.js +13 -747
- package/dist/foundations/copyStore.d.ts +21 -0
- package/dist/foundations/copyStore.js +47 -0
- package/dist/foundations/density.d.ts +4 -8
- package/dist/foundations/density.js +2 -9
- package/dist/foundations/form.d.ts +2 -12
- package/dist/foundations/form.js +4 -14
- package/dist/foundations/idle.d.ts +1 -0
- package/dist/foundations/idle.js +34 -0
- package/dist/foundations/index.d.ts +21 -11
- package/dist/foundations/index.js +28 -11
- package/dist/foundations/keys.d.ts +8 -0
- package/dist/foundations/keys.js +6 -0
- package/dist/foundations/pickBy.d.ts +16 -0
- package/dist/foundations/pickBy.js +17 -0
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/pointer.d.ts +25 -0
- package/dist/foundations/pointer.js +28 -0
- package/dist/foundations/shortcut.d.ts +3 -9
- package/dist/foundations/shortcut.js +2 -7
- package/dist/foundations/sticky.d.ts +2 -6
- package/dist/foundations/sticky.js +5 -8
- package/dist/foundations/stickyStyle.d.ts +12 -0
- package/dist/foundations/stickyStyle.js +13 -0
- package/dist/foundations/surface.d.ts +2 -2
- package/dist/foundations/surface.js +4 -2
- package/dist/foundations/theme.d.ts +3 -13
- package/dist/foundations/theme.js +2 -15
- package/dist/foundations/themeChoice.d.ts +19 -0
- package/dist/foundations/themeChoice.js +22 -0
- package/dist/foundations/types.d.ts +3 -0
- package/dist/foundations/uiCopy.d.ts +1173 -0
- package/dist/foundations/uiCopy.js +775 -0
- package/dist/foundations/xlsx.d.ts +4 -10
- package/dist/foundations/xlsx.js +0 -0
- package/dist/foundations/xlsxDownload.d.ts +8 -0
- package/dist/foundations/xlsxDownload.js +28 -0
- package/dist/primitives/button/Button.d.ts +3 -15
- package/dist/primitives/button/Button.js +2 -65
- package/dist/primitives/button/classes.d.ts +21 -0
- package/dist/primitives/button/classes.js +65 -0
- package/dist/primitives/button/index.d.ts +2 -1
- package/dist/primitives/button/index.js +3 -1
- package/dist/primitives/choice/RadioGroup.d.ts +8 -1
- package/dist/primitives/choice/RadioGroup.js +9 -1
- package/dist/primitives/choice/options.d.ts +3 -0
- package/dist/primitives/field/Field.d.ts +2 -6
- package/dist/primitives/field/Field.js +4 -10
- package/dist/primitives/field/Keypad.d.ts +43 -0
- package/dist/primitives/field/Keypad.js +62 -0
- package/dist/primitives/field/Stepper.d.ts +28 -0
- package/dist/primitives/field/Stepper.js +52 -0
- package/dist/primitives/field/classes.d.ts +6 -0
- package/dist/primitives/field/classes.js +13 -0
- package/dist/primitives/field/clipboard.js +1 -1
- package/dist/primitives/field/index.d.ts +5 -1
- package/dist/primitives/field/index.js +9 -1
- package/dist/primitives/field/keypadKeys.d.ts +24 -0
- package/dist/primitives/field/keypadKeys.js +80 -0
- package/dist/primitives/hint/Hint.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +2 -19
- package/dist/primitives/menu/Menu.js +4 -30
- package/dist/primitives/menu/classes.d.ts +18 -0
- package/dist/primitives/menu/classes.js +33 -0
- package/dist/primitives/menu/index.d.ts +2 -1
- package/dist/primitives/menu/index.js +3 -1
- package/dist/primitives/notice/Flag.js +1 -1
- package/dist/primitives/notice/Outcome.d.ts +28 -0
- package/dist/primitives/notice/Outcome.js +28 -0
- package/dist/primitives/notice/index.d.ts +1 -0
- package/dist/primitives/notice/index.js +2 -0
- package/dist/primitives/table/CellCopy.js +1 -1
- package/dist/primitives/table/EditableTable.d.ts +3 -37
- package/dist/primitives/table/EditableTable.js +2 -47
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/RowActions.js +1 -1
- package/dist/primitives/table/Table.d.ts +2 -4
- package/dist/primitives/table/Table.js +13 -16
- package/dist/primitives/table/cellTone.d.ts +5 -0
- package/dist/primitives/table/cellTone.js +13 -0
- package/dist/primitives/table/editRules.d.ts +43 -0
- package/dist/primitives/table/editRules.js +53 -0
- package/dist/primitives/table/index.d.ts +4 -2
- package/dist/primitives/table/index.js +4 -2
- package/dist/primitives/tag/Count.d.ts +2 -3
- package/dist/primitives/tag/Count.js +4 -5
- package/dist/primitives/tag/Tags.d.ts +22 -1
- package/dist/primitives/tag/Tags.js +57 -14
- package/dist/primitives/tag/countText.d.ts +3 -0
- package/dist/primitives/tag/countText.js +7 -0
- package/dist/primitives/tag/index.d.ts +3 -2
- package/dist/primitives/tag/index.js +2 -1
- package/dist/primitives/value/DateValue.d.ts +2 -5
- package/dist/primitives/value/DateValue.js +6 -44
- package/dist/primitives/value/Elapsed.d.ts +16 -0
- package/dist/primitives/value/Elapsed.js +37 -0
- package/dist/primitives/value/Meter.d.ts +3 -8
- package/dist/primitives/value/Meter.js +2 -9
- package/dist/primitives/value/RichText.d.ts +2 -4
- package/dist/primitives/value/RichText.js +5 -20
- package/dist/primitives/value/Value.d.ts +10 -7
- package/dist/primitives/value/Value.js +7 -24
- package/dist/primitives/value/elapsedTime.d.ts +26 -0
- package/dist/primitives/value/elapsedTime.js +32 -0
- package/dist/primitives/value/format.d.ts +16 -0
- package/dist/primitives/value/format.js +81 -0
- package/dist/primitives/value/index.d.ts +9 -4
- package/dist/primitives/value/index.js +13 -4
- package/dist/primitives/value/meterLevel.d.ts +10 -0
- package/dist/primitives/value/meterLevel.js +12 -0
- package/dist/primitives/value/richTextPlain.d.ts +4 -0
- package/dist/primitives/value/richTextPlain.js +23 -0
- package/dist/tokens.css +87 -1
- package/dist/views/list/List.d.ts +11 -0
- package/dist/views/list/List.js +14 -3
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +26 -6
- package/dist/views/list/types.d.ts +7 -0
- package/dist/views/record/Record.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,9 +123,36 @@ export default { plugins: { "@tailwindcss/postcss": {} } };
|
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
- **Server Components** may import from `@sincpro/web-ui`. Every module that needs the browser
|
|
126
|
-
(hooks, context, events) starts with `"use client"`, and a test keeps it that way
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
(hooks, context, events) starts with `"use client"`, and a test keeps it that way. What is
|
|
127
|
+
public and draws nothing lives in a module WITHOUT it, so a Server Component calls it and
|
|
128
|
+
gets a value, not a client reference: the looks (`buttonClasses`, `controlClasses`,
|
|
129
|
+
`menuTriggerClasses`, `CELL_TONE`, `byDensity`, `bySurface`), the formatters (`formatCount`,
|
|
130
|
+
`formatNumber`, `formatWith`, `formatDateTime`, `formatRelative`, `countText`), the words
|
|
131
|
+
(`installCopy`, `currentCopy`, `fillCopy`, `ENGLISH_COPY`), the theme's names
|
|
132
|
+
(`THEME_ATTRIBUTE`, `isTheme`), `writeXlsx`, the calendar, the pivot, the criteria and the
|
|
133
|
+
filter's tree (`describeFilter`, `treeFromFilter`) — `tests/serverBoundary.test.ts` holds
|
|
134
|
+
it. What needs a browser stays client: `downloadFile`, `downloadXlsx`, `applyTheme`,
|
|
135
|
+
`sanitizeRichText`. The views are client components: compose `Record` or `List` inside a
|
|
136
|
+
client component of your own.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// app/invoices/page.tsx — a Server Component
|
|
140
|
+
import Link from "next/link";
|
|
141
|
+
import { buttonClasses, formatCount } from "@sincpro/web-ui";
|
|
142
|
+
|
|
143
|
+
export default async function Invoices() {
|
|
144
|
+
const pending = await countPending();
|
|
145
|
+
return (
|
|
146
|
+
<header>
|
|
147
|
+
<p>{formatCount(pending)} por cobrar</p>
|
|
148
|
+
<Link href="/invoices/new" className={buttonClasses("primary", "md")}>
|
|
149
|
+
Nueva factura
|
|
150
|
+
</Link>
|
|
151
|
+
</header>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
129
156
|
- **The language.** `installCopy` sets the one global there is — and on a server, one process
|
|
130
157
|
renders every page and every request. Installed in one page, it leaks into the next page the
|
|
131
158
|
server renders, which the browser then draws in English: a hydration error. Install it in a
|
|
@@ -142,6 +169,11 @@ export default { plugins: { "@tailwindcss/postcss": {} } };
|
|
|
142
169
|
}
|
|
143
170
|
```
|
|
144
171
|
|
|
172
|
+
A Server Component that formats (`formatCount`, `formatDateTime`, `describeFilter`) reads
|
|
173
|
+
the words installed in ITS module graph — the server components' copy of the package is not
|
|
174
|
+
the browser's. Install the language there too, at the top of a module your root layout
|
|
175
|
+
imports (the same for every request), or pass the locale: `formatCount(total, "es-BO")`.
|
|
176
|
+
|
|
145
177
|
- **webpack** (`next build --webpack`): a Server Component that imports from the package root
|
|
146
178
|
makes webpack send the WHOLE library to the browser (~1.2 MB gzip for one `Button`). Let Next
|
|
147
179
|
rewrite those imports — Turbopack, the default, does not need it:
|
|
@@ -233,22 +265,23 @@ follows:
|
|
|
233
265
|
}
|
|
234
266
|
```
|
|
235
267
|
|
|
236
|
-
| Component
|
|
237
|
-
|
|
|
238
|
-
| `Button`, `ButtonLink`
|
|
239
|
-
| `IconButton`, `IconLink`
|
|
240
|
-
| Inputs, selects, date and pickers' boxes
|
|
241
|
-
| Menus, lists, popovers, the cuts panel
|
|
242
|
-
| A row inside them (menu item, option)
|
|
243
|
-
| `Dialog`
|
|
244
|
-
| `Block`, `RecordCard`, `Metric`
|
|
245
|
-
| A
|
|
246
|
-
|
|
|
247
|
-
| `
|
|
248
|
-
|
|
|
249
|
-
|
|
|
250
|
-
|
|
|
251
|
-
|
|
|
268
|
+
| Component | Tokens |
|
|
269
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
|
|
270
|
+
| `Button`, `ButtonLink` | `--ui-button-radius` |
|
|
271
|
+
| `IconButton`, `IconLink` | `--ui-icon-button-radius` |
|
|
272
|
+
| Inputs, selects, date and pickers' boxes | `--ui-control-radius`, `--ui-control-bg`, `--ui-control-border` |
|
|
273
|
+
| Menus, lists, popovers, the cuts panel | `--ui-popover-radius`, `--ui-popover-bg`, `--ui-popover-border`, `--ui-popover-shadow` |
|
|
274
|
+
| A row inside them (menu item, option) | `--ui-option-radius`, `--ui-option-active-bg` |
|
|
275
|
+
| `Dialog` | `--ui-dialog-radius`, `--ui-dialog-bg` |
|
|
276
|
+
| `Block`, `RecordCard`, `Metric` | `--ui-card-radius`, `--ui-card-bg`, `--ui-card-border` |
|
|
277
|
+
| A record's card on a board or a grid (`RecordCard`, `RadioGroup look="cards"`) | `--ui-record-card-radius` (falls back to the card's, then to the control's corner) |
|
|
278
|
+
| A board's `BoardTile` and `BoardStat` | `--ui-tile-radius`, `--ui-tile-bg`, `--ui-tile-border` (fall back to the card's) |
|
|
279
|
+
| `Tag`, `Tags`, the search bar's chips | `--ui-tag-radius` |
|
|
280
|
+
| `SearchBar`'s field | `--ui-search-radius` (and the control's bg and border) |
|
|
281
|
+
| The sidebar on the canvas | `--ui-sidebar-bg`, `--ui-sidebar-border` |
|
|
282
|
+
| `NavigationTree` | `--ui-nav-radius`, `--ui-nav-current-bg` |
|
|
283
|
+
| Table headers (`DataTable`, `EditableTable`, `ReportTable`) | `--ui-table-head-bg` |
|
|
284
|
+
| `Guide` (a guided tour): its card and its veil | `--ui-guide-radius`, `--ui-guide-bg`, `--ui-guide-scrim` |
|
|
252
285
|
|
|
253
286
|
What a token does not cover, a **part** does. Every customizable piece names its root
|
|
254
287
|
`data-ui="<component>"` and its parts `data-ui="<component>.<part>"`, with its variant beside
|
|
@@ -265,7 +298,13 @@ of classes that change with the next refactor:
|
|
|
265
298
|
```
|
|
266
299
|
|
|
267
300
|
The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`,
|
|
268
|
-
`menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card
|
|
301
|
+
`menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card` (with `data-layout`
|
|
302
|
+
`card` | `compact` | `tile`), `record-card.title`, `record-card.figure`, `record-card.fields`,
|
|
303
|
+
`record-card.media`, `record-card.badge`, `record-card.footer`, `record-card.stripe`,
|
|
304
|
+
`board.lane`, `list.tiles`, `elapsed`, `keypad`, `keypad.key`, `keypad.screen`, `stepper`,
|
|
305
|
+
`radio-group`, `radio-group.card`, `tags.count`, `outcome`, `outcome.figure`, `receipt`,
|
|
306
|
+
`receipt.document`, `receipt.lines`, `receipt.totals`, `kiosk`, `kiosk.attract`,
|
|
307
|
+
`kiosk.content`, `kiosk.reach`, `board.tile`,
|
|
269
308
|
`board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `file-value`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
|
|
270
309
|
`search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.advanced`,
|
|
271
310
|
`search.keys`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `yes-no`,
|
|
@@ -278,6 +317,24 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
278
317
|
carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
|
|
279
318
|
outside any layer.
|
|
280
319
|
|
|
320
|
+
#### Touch and the counter: a till, a kitchen, a kiosk, a shop
|
|
321
|
+
|
|
322
|
+
The same pieces as the ERP, drawn for a finger — no «POS» inside the package. The application
|
|
323
|
+
says what the person presses with, on `<html>` or on a zone (a till is a touch monitor with a
|
|
324
|
+
mouse plugged in, so the browser alone says «mouse»):
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
<html {...pointerAttributes("touch")}> {/* data-pointer="touch" */}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Controls grow to 44 px, what is drawn small answers to `--size-target` (`hit-target`), and what
|
|
331
|
+
only shows on hover follows the `touch:` variant. Then: `List.Tiles` (a product grid),
|
|
332
|
+
`List.Filters` with `Tags size="md" | "lg"` and `count`, `RadioGroup look="cards"`, `Keypad`
|
|
333
|
+
(with `screen`), `Stepper`, `RecordCard elapsed`, `Outcome`, `Receipt`, and `KioskFrame` (an
|
|
334
|
+
attract screen, `idleAfter`, a reduced-height mode). The Storybook page «Táctil y mostrador»
|
|
335
|
+
orders them by what they solve; `5 · Plantillas/Mostrador` has the till, the express till, the
|
|
336
|
+
kitchen, the kiosk and the shop.
|
|
337
|
+
|
|
281
338
|
#### A form that explains itself: the «settings» style
|
|
282
339
|
|
|
283
340
|
The default form is the dense sheet of an ERP — label | control, two columns, help behind a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type MessageKind, writeANote } from "./messageKind.js";
|
|
1
2
|
import type { AttachmentFile } from "../attachments/files.js";
|
|
2
|
-
import { type UiCopy } from "../../foundations/copy.js";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
4
|
/**
|
|
5
5
|
* The box to write in. What gets written is drawn by `Activity`, together with
|
|
@@ -38,28 +38,8 @@ export type Message = {
|
|
|
38
38
|
* (`FileList`). A message may be only its files: then `body` is empty. */
|
|
39
39
|
files?: readonly AttachmentFile[];
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export type MessageKind = {
|
|
44
|
-
id: string;
|
|
45
|
-
label: string;
|
|
46
|
-
/** It stays inside. Without this the kit assumes it leaves, which is the
|
|
47
|
-
* answer that errs on the side of asking. */
|
|
48
|
-
internal?: boolean;
|
|
49
|
-
/** Who gets it, in their own words: names for a mail, numbers for WhatsApp.
|
|
50
|
-
* Shown before sending, never after. */
|
|
51
|
-
recipients?: readonly string[];
|
|
52
|
-
placeholder?: string;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* WRITE A NOTE, the way every list has.
|
|
56
|
-
*
|
|
57
|
-
* It is a function and not a constant because its words come from the copy, and a
|
|
58
|
-
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
59
|
-
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
60
|
-
* component passes it those of its branch.
|
|
61
|
-
*/
|
|
62
|
-
export declare function writeANote(copy?: UiCopy): MessageKind;
|
|
41
|
+
export type { MessageKind };
|
|
42
|
+
export { writeANote };
|
|
63
43
|
export type MessageComposerProps = {
|
|
64
44
|
/** The ways of writing this record takes. Its own list because it is the
|
|
65
45
|
* application that knows whether there is WhatsApp, and to whose number. */
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { writeANote, } from "./messageKind.js";
|
|
4
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
5
|
import { Button } from "../../primitives/button/Button.js";
|
|
5
6
|
import { TextArea } from "../../primitives/field/Field.js";
|
|
6
7
|
import { Send, Users, X } from "lucide-react";
|
|
7
8
|
import { useState } from "react";
|
|
8
|
-
|
|
9
|
-
* WRITE A NOTE, the way every list has.
|
|
10
|
-
*
|
|
11
|
-
* It is a function and not a constant because its words come from the copy, and a
|
|
12
|
-
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
13
|
-
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
14
|
-
* component passes it those of its branch.
|
|
15
|
-
*/
|
|
16
|
-
export function writeANote(copy = currentCopy()) {
|
|
17
|
-
return {
|
|
18
|
-
id: "note",
|
|
19
|
-
label: copy.activity.writeNote,
|
|
20
|
-
internal: true,
|
|
21
|
-
placeholder: copy.activity.notePlaceholder,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
9
|
+
export { writeANote };
|
|
24
10
|
export function MessageComposer({ kinds, onSend, sending = false, footer, }) {
|
|
25
11
|
const copy = useUiCopy();
|
|
26
12
|
/* The default way is built in here and not in the signature: a parameter
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Activity, type ActivityAlert, type ActivityChange, type ActivityEvent, type ActivityLayout, type ActivityProps, useActivity, } from "./Activity.js";
|
|
2
2
|
export { ActivityBadge, type ActivityState, } from "./ActivityBadge.js";
|
|
3
|
-
export { type
|
|
3
|
+
export { type MessageKind, writeANote, } from "./messageKind.js";
|
|
4
|
+
export { type Message, MessageComposer, type MessageComposerProps, } from "./Messages.js";
|
|
4
5
|
export { Timeline, type TimelineItemProps, type TimelineProps, } from "./Timeline.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* ACTIVITY — everything around a record: its notices, its conversation and its history. */
|
|
2
2
|
export { Activity, useActivity, } from "./Activity.js";
|
|
3
3
|
export { ActivityBadge, } from "./ActivityBadge.js";
|
|
4
|
-
export {
|
|
4
|
+
export { writeANote, } from "./messageKind.js";
|
|
5
|
+
export { MessageComposer, } from "./Messages.js";
|
|
5
6
|
export { Timeline, } from "./Timeline.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type UiCopy } from "../../foundations/uiCopy.js";
|
|
2
|
+
/** A way of writing. `note` stays inside; everything else leaves, and what
|
|
3
|
+
* changes between them is only the channel and who is on the other side. */
|
|
4
|
+
export type MessageKind = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** It stays inside. Without this the kit assumes it leaves, which is the
|
|
8
|
+
* answer that errs on the side of asking. */
|
|
9
|
+
internal?: boolean;
|
|
10
|
+
/** Who gets it, in their own words: names for a mail, numbers for WhatsApp.
|
|
11
|
+
* Shown before sending, never after. */
|
|
12
|
+
recipients?: readonly string[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* WRITE A NOTE, the way every list has.
|
|
17
|
+
*
|
|
18
|
+
* It is a function and not a constant because its words come from the copy, and a
|
|
19
|
+
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
20
|
+
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
21
|
+
* component passes it those of its branch.
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeANote(copy?: UiCopy): MessageKind;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { currentCopy } from "../../foundations/uiCopy.js";
|
|
2
|
+
/**
|
|
3
|
+
* WRITE A NOTE, the way every list has.
|
|
4
|
+
*
|
|
5
|
+
* It is a function and not a constant because its words come from the copy, and a
|
|
6
|
+
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
7
|
+
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
8
|
+
* component passes it those of its branch.
|
|
9
|
+
*/
|
|
10
|
+
export function writeANote(copy = currentCopy()) {
|
|
11
|
+
return {
|
|
12
|
+
id: "note",
|
|
13
|
+
label: copy.activity.writeNote,
|
|
14
|
+
internal: true,
|
|
15
|
+
placeholder: copy.activity.notePlaceholder,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UiCopy } from "../../foundations/
|
|
1
|
+
import { type UiCopy } from "../../foundations/uiCopy.js";
|
|
2
2
|
import type { ToastSpec } from "../../primitives/notice/Toast.js";
|
|
3
3
|
import { type LucideIcon } from "lucide-react";
|
|
4
4
|
import type { ReactNode } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fillCopy } from "../../foundations/
|
|
1
|
+
import { fillCopy } from "../../foundations/uiCopy.js";
|
|
2
2
|
import { Bot } from "lucide-react";
|
|
3
3
|
/* ==================================================================== *
|
|
4
4
|
* THE ASSISTANT'S CONTRACT — what every piece of this family agrees on.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Guide, type GuideCloseReason, type GuideProps, type GuideStep, } from "./Guide.js";
|
|
2
2
|
export { GuideSpot } from "./GuideSpot.js";
|
|
3
3
|
export { type Box as GuideBox, type CardPlacement as GuideCardPlacement, type GuideSide, type Size as GuideSize, placeCard, } from "./place.js";
|
|
4
|
-
export {
|
|
4
|
+
export { type GuideTarget, selectorOf } from "./selector.js";
|
|
5
|
+
export { boxOf, findTarget, type Found as GuideMatch, } from "./target.js";
|
|
@@ -3,4 +3,5 @@ export { Guide, } from "./Guide.js";
|
|
|
3
3
|
export { GuideSpot } from "./GuideSpot.js";
|
|
4
4
|
/* The rules underneath, for an application that draws a tour of its own. */
|
|
5
5
|
export { placeCard, } from "./place.js";
|
|
6
|
-
export {
|
|
6
|
+
export { selectorOf } from "./selector.js";
|
|
7
|
+
export { boxOf, findTarget, } from "./target.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a step of a tour points at.
|
|
3
|
+
*
|
|
4
|
+
* Context: the anchors are the ones the system already keeps stable, so no component needs a
|
|
5
|
+
* prop to be pointed at:
|
|
6
|
+
*
|
|
7
|
+
* - `{ part }` — a web-ui part (`data-ui`, listed in the README and guarded by a test):
|
|
8
|
+
* `{ part: "sidebar.search" }`. With `key`, one item of a collection:
|
|
9
|
+
* `{ part: "navigation.item", key: "socios.cuotas" }`.
|
|
10
|
+
* - `{ spot }` — anything the application marked: `<GuideSpot id="cifras">` or its own
|
|
11
|
+
* element with `data-guide="cifras"`.
|
|
12
|
+
* - `{ selector }` — any CSS selector, for what has no name yet.
|
|
13
|
+
* - a function — a ref, or whatever the application computes at that moment.
|
|
14
|
+
*/
|
|
15
|
+
export type GuideTarget = {
|
|
16
|
+
part: string;
|
|
17
|
+
key?: string;
|
|
18
|
+
} | {
|
|
19
|
+
spot: string;
|
|
20
|
+
} | {
|
|
21
|
+
selector: string;
|
|
22
|
+
} | (() => Element | null | undefined);
|
|
23
|
+
/** The CSS selector a target names; `null` for a function. */
|
|
24
|
+
export declare function selectorOf(target: Exclude<GuideTarget, () => unknown>): string;
|
|
25
|
+
export declare function selectorOf(target: GuideTarget): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* A quoted attribute value: only `"` and `\` need escaping there — and unlike `CSS.escape`
|
|
2
|
+
this also runs where there is no DOM (a test, a server). */
|
|
3
|
+
const quoted = (value) => `"${value.replace(/["\\]/g, "\\$&")}"`;
|
|
4
|
+
export function selectorOf(target) {
|
|
5
|
+
if (typeof target === "function")
|
|
6
|
+
return null;
|
|
7
|
+
if ("part" in target) {
|
|
8
|
+
const part = `[data-ui=${quoted(target.part)}]`;
|
|
9
|
+
return target.key === undefined ? part : `${part}[data-key=${quoted(target.key)}]`;
|
|
10
|
+
}
|
|
11
|
+
if ("spot" in target)
|
|
12
|
+
return `[data-guide=${quoted(target.spot)}]`;
|
|
13
|
+
return target.selector;
|
|
14
|
+
}
|
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
import type { Box } from "./place.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Context: the anchors are the ones the system already keeps stable, so no component needs a
|
|
6
|
-
* prop to be pointed at:
|
|
7
|
-
*
|
|
8
|
-
* - `{ part }` — a web-ui part (`data-ui`, listed in the README and guarded by a test):
|
|
9
|
-
* `{ part: "sidebar.search" }`. With `key`, one item of a collection:
|
|
10
|
-
* `{ part: "navigation.item", key: "socios.cuotas" }`.
|
|
11
|
-
* - `{ spot }` — anything the application marked: `<GuideSpot id="cifras">` or its own
|
|
12
|
-
* element with `data-guide="cifras"`.
|
|
13
|
-
* - `{ selector }` — any CSS selector, for what has no name yet.
|
|
14
|
-
* - a function — a ref, or whatever the application computes at that moment.
|
|
15
|
-
*/
|
|
16
|
-
export type GuideTarget = {
|
|
17
|
-
part: string;
|
|
18
|
-
key?: string;
|
|
19
|
-
} | {
|
|
20
|
-
spot: string;
|
|
21
|
-
} | {
|
|
22
|
-
selector: string;
|
|
23
|
-
} | (() => Element | null | undefined);
|
|
24
|
-
/** The CSS selector a target names; `null` for a function. */
|
|
25
|
-
export declare function selectorOf(target: Exclude<GuideTarget, () => unknown>): string;
|
|
26
|
-
export declare function selectorOf(target: GuideTarget): string | null;
|
|
2
|
+
import { type GuideTarget, selectorOf } from "./selector.js";
|
|
3
|
+
export type { GuideTarget };
|
|
4
|
+
export { selectorOf };
|
|
27
5
|
/** The element's box on screen, `null` when it has none — hidden, or not laid out. A
|
|
28
6
|
* `GuideSpot` measures as the union of what it wraps. */
|
|
29
7
|
export declare function boxOf(element: Element): Box | null;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const quoted = (value) => `"${value.replace(/["\\]/g, "\\$&")}"`;
|
|
5
|
-
export function selectorOf(target) {
|
|
6
|
-
if (typeof target === "function")
|
|
7
|
-
return null;
|
|
8
|
-
if ("part" in target) {
|
|
9
|
-
const part = `[data-ui=${quoted(target.part)}]`;
|
|
10
|
-
return target.key === undefined ? part : `${part}[data-key=${quoted(target.key)}]`;
|
|
11
|
-
}
|
|
12
|
-
if ("spot" in target)
|
|
13
|
-
return `[data-guide=${quoted(target.spot)}]`;
|
|
14
|
-
return target.selector;
|
|
15
|
-
}
|
|
2
|
+
import { selectorOf } from "./selector.js";
|
|
3
|
+
export { selectorOf };
|
|
16
4
|
/** `display: contents` has no box of its own (a `GuideSpot`): its box is its children's. */
|
|
17
5
|
function wraps(element) {
|
|
18
6
|
return getComputedStyle(element).display === "contents";
|
|
@@ -14,6 +14,7 @@ export * from "./lines/index.js";
|
|
|
14
14
|
export * from "./listing/index.js";
|
|
15
15
|
export * from "./navigation/index.js";
|
|
16
16
|
export * from "./preview/index.js";
|
|
17
|
+
export * from "./receipt/index.js";
|
|
17
18
|
export * from "./record/index.js";
|
|
18
19
|
export * from "./search/index.js";
|
|
19
20
|
export * from "./shell/index.js";
|
package/dist/components/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./lines/index.js";
|
|
|
15
15
|
export * from "./listing/index.js";
|
|
16
16
|
export * from "./navigation/index.js";
|
|
17
17
|
export * from "./preview/index.js";
|
|
18
|
+
export * from "./receipt/index.js";
|
|
18
19
|
export * from "./record/index.js";
|
|
19
20
|
export * from "./search/index.js";
|
|
20
21
|
export * from "./shell/index.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { levelId, levelLabeler, namer } from "./levels.js";
|
|
1
2
|
import type { GroupableField, GroupLevel } from "../../foundations/grouping.js";
|
|
2
3
|
/**
|
|
3
4
|
* The levels of ONE axis, chosen on the screen: a tag per level with its ×, and «+» to add
|
|
@@ -6,11 +7,7 @@ import type { GroupableField, GroupLevel } from "../../foundations/grouping.js";
|
|
|
6
7
|
* Context: the pivot had it written inline, and the chart asks the same question twice
|
|
7
8
|
* (its axis and its series). Two copies would drift; this is the one both draw.
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
-
/** How a level is named: the field's label, and its grain when it is a date. */
|
|
11
|
-
export declare function levelLabeler(fields: readonly GroupableField[]): (level: GroupLevel) => string;
|
|
12
|
-
/** `fields` name what they list; anything else is named by `fallback`, then by its id. */
|
|
13
|
-
export declare function namer(fields: readonly GroupableField[], fallback?: (level: GroupLevel) => string): (level: GroupLevel) => string;
|
|
10
|
+
export { levelId, levelLabeler, namer };
|
|
14
11
|
export declare function AxisLevels({ name, levels, onChange, fields, used, labelOf: outerLabel, }: {
|
|
15
12
|
name: string;
|
|
16
13
|
levels: readonly GroupLevel[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { fromId, levelId, levelLabeler, namer, } from "./levels.js";
|
|
4
4
|
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
5
5
|
import { Menu } from "../../primitives/menu/Menu.js";
|
|
6
6
|
import { Tags } from "../../primitives/tag/Tags.js";
|
|
@@ -12,27 +12,10 @@ import { Plus } from "lucide-react";
|
|
|
12
12
|
* Context: the pivot had it written inline, and the chart asks the same question twice
|
|
13
13
|
* (its axis and its series). Two copies would drift; this is the one both draw.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
/** How a level is named: the field's label, and its grain when it is a date. */
|
|
21
|
-
export function levelLabeler(fields) {
|
|
22
|
-
return (level) => {
|
|
23
|
-
const field = fields.find((one) => one.field === level.field)?.label ?? level.field;
|
|
24
|
-
return level.grain === undefined
|
|
25
|
-
? field
|
|
26
|
-
: `${field} · ${grainName(level.grain).toLowerCase()}`;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/** `fields` name what they list; anything else is named by `fallback`, then by its id. */
|
|
30
|
-
export function namer(fields, fallback) {
|
|
31
|
-
const named = levelLabeler(fields);
|
|
32
|
-
return (level) => fallback !== undefined && !fields.some((one) => one.field === level.field)
|
|
33
|
-
? fallback(level)
|
|
34
|
-
: named(level);
|
|
35
|
-
}
|
|
15
|
+
/* `levelId`, `levelLabeler` and `namer` are plain (`levels.ts`), without the directive, so a
|
|
16
|
+
server component names a level the same way; re-exported so every path that read them here
|
|
17
|
+
keeps reading them. */
|
|
18
|
+
export { levelId, levelLabeler, namer };
|
|
36
19
|
export function AxisLevels({ name, levels, onChange, fields, used, labelOf: outerLabel, }) {
|
|
37
20
|
const words = useUiCopy().pivot;
|
|
38
21
|
const labelOf = namer(fields, outerLabel);
|
|
@@ -41,7 +41,7 @@ function ProgressBar({ items, progress, }) {
|
|
|
41
41
|
const parts = PROGRESS_ORDER.filter((tone) => (counts.get(tone) ?? 0) > 0);
|
|
42
42
|
if (parts.length === 0)
|
|
43
43
|
return null;
|
|
44
|
-
return (_jsx("div", { role: "img", "aria-label": parts.map((tone) => `${tone}: ${counts.get(tone)}`).join(", "), className: "mx-1 flex h-1
|
|
44
|
+
return (_jsx("div", { role: "img", "aria-label": parts.map((tone) => `${tone}: ${counts.get(tone)}`).join(", "), className: "mx-1.5 flex h-1 overflow-hidden rounded-pill bg-ink/8", children: parts.map((tone) => (_jsx("span", { className: PROGRESS_FILL[tone], style: { width: `${((counts.get(tone) ?? 0) / items.length) * 100}%` } }, tone))) }));
|
|
45
45
|
}
|
|
46
46
|
/* ==================================================================== *
|
|
47
47
|
* THE BOARD BY STAGES — Odoo's kanban.
|
|
@@ -106,14 +106,18 @@ export function BoardColumns({ items, keyOf, stages, card, }) {
|
|
|
106
106
|
event.preventDefault();
|
|
107
107
|
move(keyOf(item), next.id);
|
|
108
108
|
};
|
|
109
|
-
return (
|
|
109
|
+
return (
|
|
110
|
+
/* The lanes are a wash on the canvas and not boxes: the card is the only box, so a board
|
|
111
|
+
reads as columns of records and not as boxes inside boxes. They share the width when
|
|
112
|
+
the stages fit (up to `--container-lane-max`) and scroll sideways when they do not. */
|
|
113
|
+
_jsxs("div", { className: "flex min-w-0 items-start gap-2 overflow-x-auto p-3", children: [columns.map((column) => {
|
|
110
114
|
const inside = items.filter((item) => of(item) === column.id);
|
|
111
115
|
if (folded.has(column.id)) {
|
|
112
116
|
/* Folded: a strip with its count and its name down the spine. Still a drop target —
|
|
113
117
|
dropping on «perdido» is how a lost deal is marked. */
|
|
114
|
-
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-12 shrink-0 flex-col items-center gap-2 rounded-
|
|
118
|
+
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-12 shrink-0 flex-col items-center gap-2 rounded-control py-2 ${over === column.id ? "bg-primary/8 ring-1 ring-primary/40" : "bg-ink/3"}`, children: [_jsx(IconButton, { icon: ChevronsLeftRight, label: fillCopy(copy.board.unfold, { column: column.label }), onClick: () => toggleFold(column.id) }), _jsx("span", { className: "text-micro text-muted tabular-nums", children: inside.length }), _jsx("span", { className: "text-vertical text-meta font-semibold text-ink", children: column.label })] }, column.id));
|
|
115
119
|
}
|
|
116
|
-
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), className: `flex w-(--container-lane) shrink-0 flex-col gap-
|
|
120
|
+
return (_jsxs("section", { "aria-label": column.label, ...dropOn(column.id), "data-ui": "board.lane", className: `flex max-w-(--container-lane-max) min-w-(--container-lane) flex-1 shrink-0 basis-(--container-lane) flex-col gap-1.5 rounded-control p-1.5 transition-colors duration-(--duration-instant) ${over === column.id ? "bg-primary/8 ring-1 ring-primary/40" : "bg-ink/3"}`, children: [_jsxs("header", { className: "flex min-w-0 items-center gap-1.5 px-1.5 pt-0.5", children: [_jsx("h3", { className: "min-w-0 flex-1 truncate text-meta font-semibold text-ink", children: column.tone === undefined ? (column.label) : (_jsx(StatusDot, { tone: column.tone, label: column.label })) }), _jsx("span", { className: "shrink-0 rounded-pill bg-ink/6 px-1.5 text-micro text-muted tabular-nums", children: inside.length }), total === undefined ? null : (_jsx("span", { className: "shrink-0 text-meta font-semibold text-ink tabular-nums", children: total(inside) })), onQuickCreate === undefined ? null : (_jsx(IconButton, { icon: Plus, label: fillCopy(copy.board.quickCreate, { column: column.label }), onClick: () => setCreating(column.id) })), _jsx(IconButton, { icon: ChevronsLeftRight, label: fillCopy(copy.board.fold, { column: column.label }), onClick: () => toggleFold(column.id) })] }), progress === undefined || inside.length === 0 ? null : (_jsx(ProgressBar, { items: inside, progress: progress })), creating === column.id && onQuickCreate !== undefined ? (_jsx(BoardInput, { label: fillCopy(copy.board.quickCreate, { column: column.label }), placeholder: copy.board.quickPlaceholder, onCommit: (name) => onQuickCreate(column.id, name), onClose: () => setCreating(null) })) : null, inside.length === 0 ? (_jsx("p", { className: "px-1 py-3 text-micro text-muted", children: copy.board.emptyLane })) : (_jsx("ul", { className: "flex min-w-0 flex-col gap-1.5", children: inside.map((item) => {
|
|
117
121
|
const id = keyOf(item);
|
|
118
122
|
return (_jsx("li", { ...(onMove === undefined
|
|
119
123
|
? {}
|
|
@@ -129,9 +133,9 @@ export function BoardColumns({ items, keyOf, stages, card, }) {
|
|
|
129
133
|
},
|
|
130
134
|
onDragEnd: () => setDragging(null),
|
|
131
135
|
onKeyDown: (event) => byKeyboard(event, item),
|
|
132
|
-
}), className: `flex min-w-0 flex-col rounded-
|
|
136
|
+
}), className: `flex min-w-0 flex-col rounded-ui-record-card focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${onMove === undefined ? "" : "cursor-grab active:cursor-grabbing"} ${dragging === id ? "opacity-50" : ""}`, children: card(item) }, id));
|
|
133
137
|
}) }))] }, column.id));
|
|
134
|
-
}), onAddColumn === undefined ? null : (_jsx("div", { className: "flex w-(--container-lane) shrink-0 flex-col gap-2 p-
|
|
138
|
+
}), onAddColumn === undefined ? null : (_jsx("div", { className: "flex w-(--container-lane) shrink-0 flex-col gap-2 p-1.5", children: adding ? (_jsx(BoardInput, { label: copy.board.addColumn, placeholder: copy.board.addColumnPlaceholder, onCommit: (label) => {
|
|
135
139
|
onAddColumn(label);
|
|
136
140
|
setAdding(false);
|
|
137
141
|
}, onClose: () => setAdding(false) })) : (_jsxs("button", { type: "button", onClick: () => setAdding(true), className: "flex h-(--size-control-md) items-center gap-1.5 rounded-control px-2 text-meta text-muted transition-colors duration-(--duration-instant) hover:bg-ink/5 hover:text-ink focus-visible:outline-2 focus-visible:outline-primary", children: [_jsx(Plus, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2 }), copy.board.addColumn] })) })), _jsx("span", { role: "status", className: "sr-only", children: said })] }));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ColumnControl
|
|
1
|
+
import type { ColumnControl } from "./columns.js";
|
|
2
|
+
import { specsFromColumns } from "./columnSpecs.js";
|
|
2
3
|
import { type PathPick } from "../search/FieldPath.js";
|
|
3
4
|
import type { Surface } from "../../foundations/types.js";
|
|
4
5
|
/**
|
|
@@ -18,9 +19,4 @@ export declare function ColumnsMenu({ control, surface, addPath, }: {
|
|
|
18
19
|
surface?: Surface;
|
|
19
20
|
addPath?: PathPick;
|
|
20
21
|
}): import("react").JSX.Element | null;
|
|
21
|
-
export
|
|
22
|
-
id: string;
|
|
23
|
-
header: string;
|
|
24
|
-
optional?: boolean;
|
|
25
|
-
defaultHidden?: boolean;
|
|
26
|
-
}[], fallbackOptional: boolean): ColumnSpec[];
|
|
22
|
+
export { specsFromColumns };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { specsFromColumns } from "./columnSpecs.js";
|
|
3
4
|
import { FieldPath } from "../search/FieldPath.js";
|
|
4
5
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
5
6
|
import { Menu } from "../../primitives/menu/Menu.js";
|
|
@@ -47,11 +48,6 @@ export function ColumnsMenu({ control, surface, addPath, }) {
|
|
|
47
48
|
const menu = (_jsx(Menu, { label: copy.frame.columns, icon: Columns3, groups: groups, onSelect: control.toggle, closeOnSelect: false, active: hiddenOptional, ...(surface === undefined ? {} : { surface }), size: "sm" }));
|
|
48
49
|
return picker === null ? (menu) : (_jsxs("span", { className: "flex items-center gap-1.5", children: [menu, picker] }));
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
label: column.header,
|
|
54
|
-
optional: column.optional ?? fallbackOptional,
|
|
55
|
-
...(column.defaultHidden === true ? { defaultHidden: true } : {}),
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
51
|
+
/* `specsFromColumns` is plain (`columnSpecs.ts`), without the directive; re-exported so every
|
|
52
|
+
path that read it here keeps reading it. */
|
|
53
|
+
export { specsFromColumns };
|
|
@@ -84,5 +84,7 @@ export function Listing({ bar, metrics, sticky = false, surface, children, }) {
|
|
|
84
84
|
background is its white and its radius; a frame around a list that is
|
|
85
85
|
already inside a framed panel is a nested rectangle, and nested
|
|
86
86
|
rectangles are what make a product read like a cloud console. */
|
|
87
|
-
|
|
87
|
+
/* `isolate`: the list's sticky bar and floating pill stay over its rows, and under
|
|
88
|
+
whatever the host lays on the list — a workspace's modal (see `Record`). */
|
|
89
|
+
_jsxs("div", { className: `isolate flex min-w-0 flex-col ${byDensity(d, "gap-2.5", "gap-2")}`, children: [bar === undefined || bar === null ? null : inSlot ? (createPortal(bar, slot)) : (_jsx("div", { ref: band.ref, className: `min-w-0 ${pegada ? `sticky z-30 ${surface === "chrome" ? "bg-chrome" : "bg-ground"}` : ""}`, style: pegada ? band.self : undefined, children: bar })), inSlot && metrics !== undefined ? _jsx("div", { className: "pt-2", children: metrics }) : metrics, _jsx("div", { className: "min-w-0 overflow-clip rounded-box bg-surface", style: pegada && !inSlot ? band.below : undefined, children: children })] }));
|
|
88
90
|
}
|