@mgamadeus/ddd-admin-ui 0.1.0-rc.3 → 0.1.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/ddd-admin-ui-specialist/SKILL.md +17 -2
- package/CHANGELOG.md +76 -0
- package/README.md +51 -8
- package/STANDARDS.md +55 -5
- package/dist/components.css +10 -5
- package/dist/form/FormActions.d.ts.map +1 -1
- package/dist/form/FormActions.js +7 -2
- package/dist/form/FormActions.js.map +1 -1
- package/dist/i18n/hints.json +11 -7
- package/dist/i18n-keys.json +45 -8
- package/dist/list/Combobox.d.ts +33 -3
- package/dist/list/Combobox.d.ts.map +1 -1
- package/dist/list/Combobox.js +71 -13
- package/dist/list/Combobox.js.map +1 -1
- package/dist/list/CopyButton.d.ts +23 -0
- package/dist/list/CopyButton.d.ts.map +1 -0
- package/dist/list/CopyButton.js +28 -0
- package/dist/list/CopyButton.js.map +1 -0
- package/dist/list/EntityListBody.d.ts +2 -2
- package/dist/list/EntityListBody.d.ts.map +1 -1
- package/dist/list/EntityListBody.js +2 -2
- package/dist/list/EntityListBody.js.map +1 -1
- package/dist/list/EntityListEmpty.d.ts +6 -1
- package/dist/list/EntityListEmpty.d.ts.map +1 -1
- package/dist/list/EntityListEmpty.js +4 -1
- package/dist/list/EntityListEmpty.js.map +1 -1
- package/dist/list/EntityListTable.d.ts +12 -3
- package/dist/list/EntityListTable.d.ts.map +1 -1
- package/dist/list/EntityListTable.js +8 -7
- package/dist/list/EntityListTable.js.map +1 -1
- package/dist/list/filters.d.ts +8 -1
- package/dist/list/filters.d.ts.map +1 -1
- package/dist/list/filters.js +5 -2
- package/dist/list/filters.js.map +1 -1
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.d.ts.map +1 -1
- package/dist/list/index.js +1 -0
- package/dist/list/index.js.map +1 -1
- package/dist/logic/browser/storage.d.ts +17 -0
- package/dist/logic/browser/storage.d.ts.map +1 -0
- package/dist/logic/browser/storage.js +40 -0
- package/dist/logic/browser/storage.js.map +1 -0
- package/dist/logic/index.d.ts +8 -1
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/index.js +4 -0
- package/dist/logic/index.js.map +1 -1
- package/dist/logic/pure/confirm.d.ts +4 -0
- package/dist/logic/pure/confirm.d.ts.map +1 -1
- package/dist/logic/pure/confirm.js.map +1 -1
- package/dist/logic/pure/dateInput.d.ts +21 -0
- package/dist/logic/pure/dateInput.d.ts.map +1 -0
- package/dist/logic/pure/dateInput.js +79 -0
- package/dist/logic/pure/dateInput.js.map +1 -0
- package/dist/logic/pure/listSort.d.ts +11 -3
- package/dist/logic/pure/listSort.d.ts.map +1 -1
- package/dist/logic/pure/listSort.js +9 -5
- package/dist/logic/pure/listSort.js.map +1 -1
- package/dist/logic/pure/stickyParams.d.ts +10 -0
- package/dist/logic/pure/stickyParams.d.ts.map +1 -0
- package/dist/logic/pure/stickyParams.js +31 -0
- package/dist/logic/pure/stickyParams.js.map +1 -0
- package/dist/logic/react/useLatestSearch.d.ts +18 -0
- package/dist/logic/react/useLatestSearch.d.ts.map +1 -0
- package/dist/logic/react/useLatestSearch.js +37 -0
- package/dist/logic/react/useLatestSearch.js.map +1 -0
- package/dist/logic/react/useRowSelection.d.ts +12 -2
- package/dist/logic/react/useRowSelection.d.ts.map +1 -1
- package/dist/logic/react/useRowSelection.js +16 -8
- package/dist/logic/react/useRowSelection.js.map +1 -1
- package/dist/next/storage.d.ts +2 -10
- package/dist/next/storage.d.ts.map +1 -1
- package/dist/next/storage.js +2 -33
- package/dist/next/storage.js.map +1 -1
- package/dist/page/DefinitionList.d.ts +7 -2
- package/dist/page/DefinitionList.d.ts.map +1 -1
- package/dist/page/DefinitionList.js +4 -1
- package/dist/page/DefinitionList.js.map +1 -1
- package/dist/page/EntityDetailShell.d.ts +2 -2
- package/dist/page/EntityDetailShell.d.ts.map +1 -1
- package/dist/page/EntityDetailShell.js +3 -2
- package/dist/page/EntityDetailShell.js.map +1 -1
- package/dist/page/EntityListPage.d.ts +3 -1
- package/dist/page/EntityListPage.d.ts.map +1 -1
- package/dist/page/EntityListPage.js +1 -1
- package/dist/page/EntityListPage.js.map +1 -1
- package/dist/page/EntityTabs.d.ts +2 -2
- package/dist/page/EntityTabs.d.ts.map +1 -1
- package/dist/page/EntityTabs.js +3 -2
- package/dist/page/EntityTabs.js.map +1 -1
- package/dist/page/PageFrame.d.ts +6 -1
- package/dist/page/PageFrame.d.ts.map +1 -1
- package/dist/page/PageFrame.js +1 -1
- package/dist/page/PageFrame.js.map +1 -1
- package/dist/page/PageToolbar.d.ts +2 -2
- package/dist/page/PageToolbar.d.ts.map +1 -1
- package/dist/page/PageToolbar.js +3 -2
- package/dist/page/PageToolbar.js.map +1 -1
- package/dist/page/SectionHeader.d.ts +1 -1
- package/dist/page/SectionHeader.d.ts.map +1 -1
- package/dist/page/links.d.ts +2 -17
- package/dist/page/links.d.ts.map +1 -1
- package/dist/page/links.js +3 -3
- package/dist/page/links.js.map +1 -1
- package/dist/primitives/breadcrumb.d.ts.map +1 -1
- package/dist/primitives/breadcrumb.js +7 -0
- package/dist/primitives/breadcrumb.js.map +1 -1
- package/dist/primitives/command.js +1 -1
- package/dist/primitives/command.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/link.d.ts +28 -0
- package/dist/primitives/link.d.ts.map +1 -0
- package/dist/primitives/link.js +15 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/segmented-control.d.ts +65 -0
- package/dist/primitives/segmented-control.d.ts.map +1 -0
- package/dist/primitives/segmented-control.js +224 -0
- package/dist/primitives/segmented-control.js.map +1 -0
- package/dist/primitives/segmentedControlNavigation.d.ts +31 -0
- package/dist/primitives/segmentedControlNavigation.d.ts.map +1 -0
- package/dist/primitives/segmentedControlNavigation.js +65 -0
- package/dist/primitives/segmentedControlNavigation.js.map +1 -0
- package/dist/provider/AdminUiProvider.d.ts +3 -3
- package/dist/provider/AdminUiProvider.d.ts.map +1 -1
- package/dist/provider/AdminUiProvider.js +5 -4
- package/dist/provider/AdminUiProvider.js.map +1 -1
- package/dist/provider/types.d.ts +6 -0
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/scripts/build-i18n-manifest.mjs +9 -3
- package/dist/showcase/Showcase.d.ts +35 -0
- package/dist/showcase/Showcase.d.ts.map +1 -0
- package/dist/showcase/Showcase.js +47 -0
- package/dist/showcase/Showcase.js.map +1 -0
- package/dist/showcase/coverage.d.ts +11 -0
- package/dist/showcase/coverage.d.ts.map +1 -0
- package/dist/showcase/coverage.js +80 -0
- package/dist/showcase/coverage.js.map +1 -0
- package/dist/showcase/index.d.ts +6 -0
- package/dist/showcase/index.d.ts.map +1 -0
- package/dist/showcase/index.js +5 -0
- package/dist/showcase/index.js.map +1 -0
- package/dist/showcase/sections/FormShowcase.d.ts +3 -0
- package/dist/showcase/sections/FormShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/FormShowcase.js +26 -0
- package/dist/showcase/sections/FormShowcase.js.map +1 -0
- package/dist/showcase/sections/GlassShowcase.d.ts +3 -0
- package/dist/showcase/sections/GlassShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/GlassShowcase.js +19 -0
- package/dist/showcase/sections/GlassShowcase.js.map +1 -0
- package/dist/showcase/sections/ListShowcase.d.ts +13 -0
- package/dist/showcase/sections/ListShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/ListShowcase.js +97 -0
- package/dist/showcase/sections/ListShowcase.js.map +1 -0
- package/dist/showcase/sections/MediaShowcase.d.ts +3 -0
- package/dist/showcase/sections/MediaShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/MediaShowcase.js +28 -0
- package/dist/showcase/sections/MediaShowcase.js.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts +14 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.js +32 -0
- package/dist/showcase/sections/OptionalShowcase.js.map +1 -0
- package/dist/showcase/sections/PageShowcase.d.ts +3 -0
- package/dist/showcase/sections/PageShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PageShowcase.js +41 -0
- package/dist/showcase/sections/PageShowcase.js.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts +13 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.js +40 -0
- package/dist/showcase/sections/PrimitivesShowcase.js.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts +3 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.js +30 -0
- package/dist/showcase/sections/TranslationsShowcase.js.map +1 -0
- package/dist/tokens.json +17 -1
- package/dist/translations/TranslationControls.d.ts.map +1 -1
- package/dist/translations/TranslationControls.js +8 -6
- package/dist/translations/TranslationControls.js.map +1 -1
- package/package.json +6 -2
package/dist/i18n-keys.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@mgamadeus/ddd-admin-ui",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
4
|
"generatedBy": "scripts/build-i18n-manifest.mjs",
|
|
5
5
|
"keys": [
|
|
6
6
|
{
|
|
@@ -143,8 +143,9 @@
|
|
|
143
143
|
"hint": "Footer button of the media picker dialog; click to close the dialog without changing the chosen media item."
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
|
-
"key": "
|
|
146
|
+
"key": "Cancelled__translation-status",
|
|
147
147
|
"text": "Cancelled",
|
|
148
|
+
"context": "translation-status",
|
|
148
149
|
"files": [
|
|
149
150
|
"translations/TranslationControls.tsx"
|
|
150
151
|
],
|
|
@@ -159,6 +160,14 @@
|
|
|
159
160
|
],
|
|
160
161
|
"hint": "Button label under a media field preview; click to open the picker and replace the currently chosen image. Shown only when an image is already set."
|
|
161
162
|
},
|
|
163
|
+
{
|
|
164
|
+
"key": "Clear",
|
|
165
|
+
"text": "Clear",
|
|
166
|
+
"files": [
|
|
167
|
+
"list/Combobox.tsx"
|
|
168
|
+
],
|
|
169
|
+
"hint": "Accessible name and tooltip of the small × inside a picker (combobox) that removes the picked value, leaving the field empty."
|
|
170
|
+
},
|
|
162
171
|
{
|
|
163
172
|
"key": "Clear %label%",
|
|
164
173
|
"text": "Clear %label%",
|
|
@@ -278,6 +287,14 @@
|
|
|
278
287
|
],
|
|
279
288
|
"hint": "Button on the right of a generic confirmation dialog that carries out the action asked about. Shown when the caller did not set its own label."
|
|
280
289
|
},
|
|
290
|
+
{
|
|
291
|
+
"key": "Copied",
|
|
292
|
+
"text": "Copied",
|
|
293
|
+
"files": [
|
|
294
|
+
"list/CopyButton.tsx"
|
|
295
|
+
],
|
|
296
|
+
"hint": "Toast after a copy button put a value (an id, a link, a code) on the clipboard."
|
|
297
|
+
},
|
|
281
298
|
{
|
|
282
299
|
"key": "Copy ID",
|
|
283
300
|
"text": "Copy ID",
|
|
@@ -295,6 +312,22 @@
|
|
|
295
312
|
],
|
|
296
313
|
"hint": "Accessible label (screen reader and tooltip) of the small button that copies the record ID to the clipboard, shown in the metadata block of every detail screen. %id% is the record ID, for example 4711 or a UUID. Imperative tone."
|
|
297
314
|
},
|
|
315
|
+
{
|
|
316
|
+
"key": "Could not copy",
|
|
317
|
+
"text": "Could not copy",
|
|
318
|
+
"files": [
|
|
319
|
+
"list/CopyButton.tsx"
|
|
320
|
+
],
|
|
321
|
+
"hint": "Error toast when the browser refused to put a value on the clipboard (no permission or an insecure page)."
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"key": "Create “%term%”",
|
|
325
|
+
"text": "Create “%term%”",
|
|
326
|
+
"files": [
|
|
327
|
+
"list/Combobox.tsx"
|
|
328
|
+
],
|
|
329
|
+
"hint": "Last row of a picker's search list: creates a new entry named by the typed text (%term%) because no existing entry has that name."
|
|
330
|
+
},
|
|
298
331
|
{
|
|
299
332
|
"key": "Created__entity-metadata",
|
|
300
333
|
"text": "Created",
|
|
@@ -331,8 +364,9 @@
|
|
|
331
364
|
"hint": "Button in the AI translation panel that hides the finished progress list of the last translation run. Imperative."
|
|
332
365
|
},
|
|
333
366
|
{
|
|
334
|
-
"key": "
|
|
367
|
+
"key": "Done__translation-status",
|
|
335
368
|
"text": "Done",
|
|
369
|
+
"context": "translation-status",
|
|
336
370
|
"files": [
|
|
337
371
|
"translations/TranslationControls.tsx"
|
|
338
372
|
],
|
|
@@ -364,8 +398,9 @@
|
|
|
364
398
|
"hint": "Sample text of the outline button specimen in the UI showcase; imperative, exports a list as a spreadsheet. Maintenance UI showcase screen, Buttons section."
|
|
365
399
|
},
|
|
366
400
|
{
|
|
367
|
-
"key": "
|
|
401
|
+
"key": "Failed__translation-status",
|
|
368
402
|
"text": "Failed",
|
|
403
|
+
"context": "translation-status",
|
|
369
404
|
"files": [
|
|
370
405
|
"translations/TranslationControls.tsx"
|
|
371
406
|
],
|
|
@@ -620,8 +655,8 @@
|
|
|
620
655
|
"hint": "Accessible label of a search input field in a list toolbar, read by screen readers. Use the plain noun or verb for searching."
|
|
621
656
|
},
|
|
622
657
|
{
|
|
623
|
-
"key": "Search for a command to run
|
|
624
|
-
"text": "Search for a command to run
|
|
658
|
+
"key": "Search for a command to run…",
|
|
659
|
+
"text": "Search for a command to run…",
|
|
625
660
|
"files": [
|
|
626
661
|
"primitives/command.tsx"
|
|
627
662
|
],
|
|
@@ -875,8 +910,9 @@
|
|
|
875
910
|
"hint": "Button in the AI translation panel that starts translating the texts into all language chips the user selected. Imperative."
|
|
876
911
|
},
|
|
877
912
|
{
|
|
878
|
-
"key": "
|
|
913
|
+
"key": "Translating__translation-status",
|
|
879
914
|
"text": "Translating",
|
|
915
|
+
"context": "translation-status",
|
|
880
916
|
"files": [
|
|
881
917
|
"translations/TranslationControls.tsx"
|
|
882
918
|
],
|
|
@@ -967,8 +1003,9 @@
|
|
|
967
1003
|
"hint": "Label and accessible name of the toggle on the Home screen that switches between the Timeline and Kanban views."
|
|
968
1004
|
},
|
|
969
1005
|
{
|
|
970
|
-
"key": "
|
|
1006
|
+
"key": "Waiting__translation-status",
|
|
971
1007
|
"text": "Waiting",
|
|
1008
|
+
"context": "translation-status",
|
|
972
1009
|
"files": [
|
|
973
1010
|
"translations/TranslationControls.tsx"
|
|
974
1011
|
],
|
package/dist/list/Combobox.d.ts
CHANGED
|
@@ -5,10 +5,16 @@ export interface ComboboxOption {
|
|
|
5
5
|
/** Second line in the list (e.g. an id or a parent). */
|
|
6
6
|
description?: string;
|
|
7
7
|
icon?: ReactNode;
|
|
8
|
+
/** Heading the option is listed under; groups keep the order in which they first appear. */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** A small marker after the label (a count, a status). */
|
|
11
|
+
badge?: ReactNode;
|
|
8
12
|
}
|
|
13
|
+
/** Wait (ms) after the last keystroke before `onSearch` runs. */
|
|
14
|
+
export declare const COMBOBOX_SEARCH_DEBOUNCE_MS = 300;
|
|
9
15
|
export interface ComboboxProps {
|
|
10
16
|
options: readonly ComboboxOption[];
|
|
11
|
-
/** `''` = nothing picked. */
|
|
17
|
+
/** `''` = nothing picked (unless an option has the value `''`: then it is an ordinary option). */
|
|
12
18
|
value: string;
|
|
13
19
|
onChange: (value: string) => void;
|
|
14
20
|
placeholder?: string;
|
|
@@ -24,9 +30,33 @@ export interface ComboboxProps {
|
|
|
24
30
|
*/
|
|
25
31
|
shape?: 'field' | 'pill';
|
|
26
32
|
id?: string;
|
|
33
|
+
/** Classes of the trigger; with `clearable`, of the wrapper around trigger and clear button (size it there). */
|
|
27
34
|
className?: string;
|
|
28
35
|
'aria-label'?: string;
|
|
36
|
+
/**
|
|
37
|
+
* A clear control (`value` → `''`) while something is picked; picking the picked option again clears it too. Without
|
|
38
|
+
* it, picking the picked option keeps the value.
|
|
39
|
+
*/
|
|
40
|
+
clearable?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Server search: the block stops filtering and calls this with the typed term, debounced
|
|
43
|
+
* (`COMBOBOX_SEARCH_DEBOUNCE_MS`), and with `''` when the popover closes. Pass the answer as `options` and
|
|
44
|
+
* `isSearching` while a request runs; until the answer to the current term is in, the list shows the searching
|
|
45
|
+
* state, never the previous term's options. Drop answers to older terms (`useLatestSearch` does both).
|
|
46
|
+
*/
|
|
47
|
+
onSearch?: (term: string) => void;
|
|
48
|
+
/** A search request is in flight (with `onSearch`). */
|
|
49
|
+
isSearching?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Offers a "Create “…”" row while the trimmed term matches no option label (case-insensitive). Choosing it calls this
|
|
52
|
+
* with the trimmed term, closes the popover and clears the term; the host creates the entry and sets `value`.
|
|
53
|
+
*/
|
|
54
|
+
onRequestCreate?: (term: string) => void;
|
|
55
|
+
/** The picked option when it is not among `options` (a server search result list without it): its label shows. */
|
|
56
|
+
selectedOption?: ComboboxOption;
|
|
57
|
+
/** Classes of the popover (e.g. a wider list than the trigger). */
|
|
58
|
+
popoverClassName?: string;
|
|
29
59
|
}
|
|
30
|
-
/** Single-choice combobox with a search field
|
|
31
|
-
export declare const Combobox: ({ options: rawOptions, value, onChange, placeholder, searchPlaceholder, emptyMessage, isLoading, disabled, size, shape, id, className, "aria-label": ariaLabel, }: ComboboxProps) => import("react").JSX.Element;
|
|
60
|
+
/** Single-choice combobox with a search field: client-side filtering, or a server search through `onSearch`. */
|
|
61
|
+
export declare const Combobox: ({ options: rawOptions, value, onChange, placeholder, searchPlaceholder, emptyMessage, isLoading, disabled, size, shape, id, className, "aria-label": ariaLabel, clearable, onSearch, isSearching, onRequestCreate, selectedOption, popoverClassName, }: ComboboxProps) => import("react").JSX.Element;
|
|
32
62
|
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../src/list/Combobox.tsx"],"names":[],"m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,IAAI,CAAC;IAClC,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,kHAAkH;IAClH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAkBD,gHAAgH;AAChH,eAAO,MAAM,QAAQ,GAAI,wPAoBtB,aAAa,gCAqJf,CAAC"}
|
package/dist/list/Combobox.js
CHANGED
|
@@ -1,27 +1,85 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Check, ChevronsUpDown } from 'lucide-react';
|
|
4
|
-
import { useState } from 'react';
|
|
3
|
+
import { Check, ChevronsUpDown, Plus, X } from 'lucide-react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { CONTROL_SURFACE_CLASS, Button, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Popover, PopoverContent, PopoverTrigger, Skeleton, } from "../primitives/index.js";
|
|
6
6
|
import { useTranslate } from "../i18n/index.js";
|
|
7
7
|
import { cn } from "../primitives/cn.js";
|
|
8
|
-
/**
|
|
9
|
-
export const
|
|
8
|
+
/** Wait (ms) after the last keystroke before `onSearch` runs. */
|
|
9
|
+
export const COMBOBOX_SEARCH_DEBOUNCE_MS = 300;
|
|
10
|
+
/** Groups in the order they first appear; options without a group first. */
|
|
11
|
+
const groupOptions = (options) => {
|
|
12
|
+
const groups = new Map();
|
|
13
|
+
for (const option of options) {
|
|
14
|
+
const key = option.group ?? '';
|
|
15
|
+
if (!groups.has(key))
|
|
16
|
+
groups.set(key, []);
|
|
17
|
+
groups.get(key)?.push(option);
|
|
18
|
+
}
|
|
19
|
+
const ungrouped = groups.get('');
|
|
20
|
+
if (ungrouped) {
|
|
21
|
+
groups.delete('');
|
|
22
|
+
return [['', ungrouped], ...groups.entries()];
|
|
23
|
+
}
|
|
24
|
+
return [...groups.entries()];
|
|
25
|
+
};
|
|
26
|
+
/** Single-choice combobox with a search field: client-side filtering, or a server search through `onSearch`. */
|
|
27
|
+
export const Combobox = ({ options: rawOptions, value, onChange, placeholder, searchPlaceholder, emptyMessage, isLoading = false, disabled, size = 'default', shape = 'field', id, className, 'aria-label': ariaLabel, clearable = false, onSearch, isSearching = false, onRequestCreate, selectedOption, popoverClassName, }) => {
|
|
10
28
|
const { t } = useTranslate();
|
|
11
29
|
const [open, setOpen] = useState(false);
|
|
30
|
+
const [term, setTerm] = useState('');
|
|
31
|
+
// the last term handed to `onSearch`: until it equals the typed term and the answer is in, options are stale
|
|
32
|
+
const [sentTerm, setSentTerm] = useState('');
|
|
33
|
+
const onSearchRef = useRef(onSearch);
|
|
34
|
+
onSearchRef.current = onSearch;
|
|
12
35
|
// Labels marked with `m()` (status / type option lists) are translated here; an already translated or a user text
|
|
13
|
-
// (a
|
|
14
|
-
const
|
|
36
|
+
// (a name) has no key and stays as it is.
|
|
37
|
+
const translate = (option) => ({
|
|
15
38
|
...option,
|
|
16
39
|
label: t(option.label),
|
|
17
40
|
description: option.description ? t(option.description) : undefined,
|
|
18
|
-
})
|
|
19
|
-
const
|
|
20
|
-
|
|
41
|
+
});
|
|
42
|
+
const options = rawOptions.map(translate);
|
|
43
|
+
const selected = options.find(option => option.value === value) ??
|
|
44
|
+
(selectedOption && selectedOption.value === value ? translate(selectedOption) : undefined);
|
|
45
|
+
const serverSearch = onSearch !== undefined;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!serverSearch || !open || term === sentTerm)
|
|
48
|
+
return;
|
|
49
|
+
const timer = setTimeout(() => {
|
|
50
|
+
setSentTerm(term);
|
|
51
|
+
onSearchRef.current?.(term);
|
|
52
|
+
}, COMBOBOX_SEARCH_DEBOUNCE_MS);
|
|
53
|
+
return () => clearTimeout(timer);
|
|
54
|
+
}, [serverSearch, open, term, sentTerm]);
|
|
55
|
+
const setOpenState = (next) => {
|
|
56
|
+
setOpen(next);
|
|
57
|
+
if (next)
|
|
58
|
+
return;
|
|
59
|
+
// closing resets the search: the next opening starts from the full (or the host's default) list
|
|
60
|
+
if (serverSearch && (term !== '' || sentTerm !== ''))
|
|
61
|
+
onSearchRef.current?.('');
|
|
62
|
+
setTerm('');
|
|
63
|
+
setSentTerm('');
|
|
64
|
+
};
|
|
65
|
+
const pick = (option) => {
|
|
66
|
+
onChange(clearable && option.value === value ? '' : option.value);
|
|
67
|
+
setOpenState(false);
|
|
68
|
+
};
|
|
69
|
+
const trimmed = term.trim();
|
|
70
|
+
const canCreate = onRequestCreate !== undefined &&
|
|
71
|
+
trimmed !== '' &&
|
|
72
|
+
!options.some(option => option.label.trim().toLowerCase() === trimmed.toLowerCase());
|
|
73
|
+
const searching = isLoading || (serverSearch && (isSearching || term !== sentTerm));
|
|
74
|
+
const showClear = clearable && value !== '' && !disabled;
|
|
75
|
+
const trigger = (_jsxs(Popover, { open: open, onOpenChange: setOpenState, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { id: id, type: "button", variant: "field", rounded: shape === 'pill' ? 'full' : 'default', "data-control": shape, role: "combobox", "aria-expanded": open, "aria-label": ariaLabel, disabled: disabled, className: cn('justify-between', shape === 'pill'
|
|
21
76
|
? cn(CONTROL_SURFACE_CLASS, 'data-[state=open]:bg-tint-strong')
|
|
22
|
-
: 'data-[state=open]:border-field-edge-strong', size === 'sm' ? 'h-8' : 'h-9', selected && selected.value !== '' && 'font-bold', className), children: [_jsx("span", { className: cn('truncate', !selected && 'text-muted-foreground'), children: selected?.label ?? placeholder ?? t('Select…') }), _jsx(ChevronsUpDown, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": true })] }) }), _jsx(PopoverContent, { className:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
77
|
+
: 'data-[state=open]:border-field-edge-strong', size === 'sm' ? 'h-8' : 'h-9', selected && selected.value !== '' && 'font-bold', clearable ? cn('w-full', showClear && 'pr-14') : className), children: [_jsx("span", { className: cn('truncate', !selected && 'text-muted-foreground'), children: selected?.label ?? placeholder ?? t('Select…') }), _jsx(ChevronsUpDown, { className: "size-4 shrink-0 text-muted-foreground", "aria-hidden": true })] }) }), _jsx(PopoverContent, { className: cn('w-(--radix-popover-trigger-width) min-w-56 p-0', popoverClassName), align: "start", children: _jsxs(Command, { shouldFilter: !serverSearch, children: [_jsx(CommandInput, { placeholder: searchPlaceholder ?? t('Search…'), value: term, onValueChange: setTerm }), _jsxs(CommandList, { children: [searching ? (_jsxs("div", { className: "space-y-2 p-2", "aria-busy": true, children: [_jsx(Skeleton, { className: "h-6 w-full" }), _jsx(Skeleton, { className: "h-6 w-3/4" })] })) : (_jsxs(_Fragment, { children: [_jsx(CommandEmpty, { children: emptyMessage ?? t('No results') }), groupOptions(options).map(([group, groupOptionsList]) => (_jsx(CommandGroup, { heading: group ? t(group) : undefined, children: groupOptionsList.map(option => (_jsxs(CommandItem, { value: `${option.label} ${option.value}`, onSelect: () => pick(option), children: [_jsx(Check, { className: cn('size-4', option.value === value ? 'opacity-100' : 'opacity-0'), "aria-hidden": true }), option.icon, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate", children: option.label }), option.description && (_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: option.description }))] }), option.badge !== undefined && _jsx("span", { className: "shrink-0", children: option.badge })] }, option.value))) }, group || '__ungrouped__')))] })), canCreate && !searching && (_jsx(CommandGroup, { forceMount: true, children: _jsxs(CommandItem, { forceMount: true, value: `__create__ ${trimmed}`, onSelect: () => {
|
|
78
|
+
onRequestCreate?.(trimmed);
|
|
79
|
+
setOpenState(false);
|
|
80
|
+
}, children: [_jsx(Plus, { className: "size-4", "aria-hidden": true }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: t('Create “%term%”', { replacements: { term: trimmed } }) })] }) }))] })] }) })] }));
|
|
81
|
+
if (!clearable)
|
|
82
|
+
return trigger;
|
|
83
|
+
return (_jsxs("div", { className: cn('relative', className), children: [trigger, showClear && (_jsx("button", { type: "button", onClick: () => onChange(''), "aria-label": t('Clear'), title: t('Clear'), className: "absolute top-1/2 right-8 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground hover:bg-tint hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", children: _jsx(X, { className: "size-3.5", "aria-hidden": true }) }))] }));
|
|
26
84
|
};
|
|
27
85
|
//# sourceMappingURL=Combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","sourceRoot":"","sources":["../../src/list/Combobox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Combobox.js","sourceRoot":"","sources":["../../src/list/Combobox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EACL,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,EACP,cAAc,EACd,cAAc,EACd,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAczC,iEAAiE;AACjE,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAgD/C,4EAA4E;AAC5E,MAAM,YAAY,GAAG,CAAqC,OAA2B,EAAE,EAAE;IACvF,MAAM,MA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B,CAAC,IACD,CACJ,EACA,SAAS,IAAI,CAAC,SAAS,IAAI,CAC1B,KAAC,YAAY,IAAC,UAAU,kBACtB,MAAC,WAAW,IACV,UAAU,QACV,KAAK,EAAE,cAAc,OAAO,EAAE,EAC9B,QAAQ,EAAE,GAAG,EAAE;4CACb,eAAe,EAAE,CAAC,OAAO,CAAC,CAAC;4CAC3B,YAAY,CAAC,KAAK,CAAC,CAAC;wCACtB,CAAC,aAED,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,wBAAe,EACvC,eAAM,SAAS,EAAC,yBAAyB,YAAE,CAAC,CAAC,iBAAiB,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAQ,IAChG,GACD,CAChB,IACW,IACN,GACK,IACT,CACX,CAAC;IAEF,IAAI,CAAC,SAAS;QAAE,OAAO,OAAO,CAAC;IAC/B,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACtC,OAAO,EACP,SAAS,IAAI,CACZ,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,gBACf,CAAC,CAAC,OAAO,CAAC,EACtB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,EACjB,SAAS,EAAC,oOAAoO,YAE9O,KAAC,CAAC,IAAC,SAAS,EAAC,UAAU,wBAAe,GAC/B,CACV,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CopyButtonProps {
|
|
2
|
+
/** The text written to the clipboard. */
|
|
3
|
+
value: string;
|
|
4
|
+
/** Accessible name and tooltip (`Copy link`); an English UI text, translated by the button. */
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* `always` (default): always visible. `hover`: shown while the pointer is over the row (`group/row`) or a `group`
|
|
8
|
+
* ancestor, and on keyboard focus — for a copy next to a value in a table or a definition list.
|
|
9
|
+
*/
|
|
10
|
+
reveal?: 'hover' | 'always';
|
|
11
|
+
/**
|
|
12
|
+
* A toast after copying (through `notify`): `true` for "Copied", a text for your own message. A refused copy then
|
|
13
|
+
* toasts "Could not copy". Absent: the icon turns into a check, no toast.
|
|
14
|
+
*/
|
|
15
|
+
notify?: boolean | string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An icon button that copies a value (`useCopyToClipboard`): the copy icon turns into a check for a moment. Its click
|
|
20
|
+
* never runs the row's action. Use it next to a value outside the ID column (an `IdCell` brings its own).
|
|
21
|
+
*/
|
|
22
|
+
export declare const CopyButton: ({ value, label, reveal, notify: toast, className }: CopyButtonProps) => import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/list/CopyButton.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,oDAA+D,eAAe,gCA6BxG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Copy } from 'lucide-react';
|
|
4
|
+
import { useTranslate } from "../i18n/index.js";
|
|
5
|
+
import { notify } from "../logic/pure/notify.js";
|
|
6
|
+
import { useCopyToClipboard } from "../logic/react/useCopyToClipboard.js";
|
|
7
|
+
import { cn } from "../primitives/cn.js";
|
|
8
|
+
/**
|
|
9
|
+
* An icon button that copies a value (`useCopyToClipboard`): the copy icon turns into a check for a moment. Its click
|
|
10
|
+
* never runs the row's action. Use it next to a value outside the ID column (an `IdCell` brings its own).
|
|
11
|
+
*/
|
|
12
|
+
export const CopyButton = ({ value, label, reveal = 'always', notify: toast, className }) => {
|
|
13
|
+
const { t } = useTranslate();
|
|
14
|
+
const { copy, copied } = useCopyToClipboard();
|
|
15
|
+
const name = t(label);
|
|
16
|
+
const handleCopy = async (event) => {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
const done = await copy(value);
|
|
19
|
+
if (!toast)
|
|
20
|
+
return;
|
|
21
|
+
if (done)
|
|
22
|
+
notify.success(typeof toast === 'string' ? t(toast) : t('Copied'));
|
|
23
|
+
else
|
|
24
|
+
notify.error(t('Could not copy'));
|
|
25
|
+
};
|
|
26
|
+
return (_jsx("button", { type: "button", "data-row-action-ignore": true, onClick: handleCopy, "aria-label": name, title: name, className: cn('inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-tint hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none', reveal === 'hover' && 'opacity-0 group-hover:opacity-100 group-hover/row:opacity-100', className), children: copied ? _jsx(Check, { className: "size-3.5 text-success", "aria-hidden": true }) : _jsx(Copy, { className: "size-3.5", "aria-hidden": true }) }));
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/list/CopyButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,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Ae,GACtG,CACV,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import { type EntityListColumn, type EntityListTableProps } from './EntityListTable.js';
|
|
3
3
|
import type { EntityCardRenderer, EntityListDataProps, ListDisplayMode } from './types.js';
|
|
4
4
|
import type { EntityListSelection } from '../logic/react/useRowSelection.js';
|
|
5
|
-
export interface EntityListBodyProps<TItem, TExtra extends string = never> extends EntityListDataProps<TItem>, Pick<EntityListTableProps<TItem>, 'sort' | 'onSortChange' | 'showRowIndex'> {
|
|
5
|
+
export interface EntityListBodyProps<TItem, TExtra extends string = never> extends EntityListDataProps<TItem>, Pick<EntityListTableProps<TItem>, 'sort' | 'onSortChange' | 'sortRequired' | 'showRowIndex' | 'rowClassName'> {
|
|
6
6
|
displayMode: ListDisplayMode | TExtra;
|
|
7
7
|
columns: EntityListColumn<TItem>[];
|
|
8
8
|
/** Card of the grid view. Absent → table only (and no view toggle). */
|
|
@@ -30,5 +30,5 @@ export interface EntityListBodyProps<TItem, TExtra extends string = never> exten
|
|
|
30
30
|
* scroll container, empty states and infinite-scroll tail. Below `md` a list with a card always shows cards (the
|
|
31
31
|
* toggle is hidden there), because a multi-column table does not fit a phone.
|
|
32
32
|
*/
|
|
33
|
-
export declare const EntityListBody: <TItem, TExtra extends string = never>({ displayMode, columns, renderCard, skeletonRows, skeletonCards, selection, renderExtraView, renderOwnView, sort, onSortChange, showRowIndex, className, ...data }: EntityListBodyProps<TItem, TExtra>) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null;
|
|
33
|
+
export declare const EntityListBody: <TItem, TExtra extends string = never>({ displayMode, columns, renderCard, skeletonRows, skeletonCards, selection, renderExtraView, renderOwnView, sort, onSortChange, sortRequired, showRowIndex, rowClassName, className, ...data }: EntityListBodyProps<TItem, TExtra>) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null;
|
|
34
34
|
//# sourceMappingURL=EntityListBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListBody.d.ts","sourceRoot":"","sources":["../../src/list/EntityListBody.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,KAAK,gBAAgB,EAAmB,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,MAAM,WAAW,mBAAmB,CAAC,KAAK,EAAE,MAAM,SAAS,MAAM,GAAG,KAAK,CACvE,SAAQ,mBAAmB,CAAC,KAAK,CAAC,EAChC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityListBody.d.ts","sourceRoot":"","sources":["../../src/list/EntityListBody.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,KAAK,gBAAgB,EAAmB,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,MAAM,WAAW,mBAAmB,CAAC,KAAK,EAAE,MAAM,SAAS,MAAM,GAAG,KAAK,CACvE,SAAQ,mBAAmB,CAAC,KAAK,CAAC,EAChC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC;IAC/G,WAAW,EAAE,eAAe,GAAG,MAAM,CAAC;IACtC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,uEAAuE;IACvE,UAAU,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,SAAS,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,SAAS,CAAC;IAC9D;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC;CACzD;AAKD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,EAAE,MAAM,SAAS,MAAM,GAAG,KAAK,EAAE,gMAgBlE,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,oTA6CpC,CAAC"}
|
|
@@ -9,13 +9,13 @@ const isExtraMode = (mode) => mode !== 'table' && mode !== 'grid';
|
|
|
9
9
|
* scroll container, empty states and infinite-scroll tail. Below `md` a list with a card always shows cards (the
|
|
10
10
|
* toggle is hidden there), because a multi-column table does not fit a phone.
|
|
11
11
|
*/
|
|
12
|
-
export const EntityListBody = ({ displayMode, columns, renderCard, skeletonRows, skeletonCards, selection, renderExtraView, renderOwnView, sort, onSortChange, showRowIndex, className, ...data }) => {
|
|
12
|
+
export const EntityListBody = ({ displayMode, columns, renderCard, skeletonRows, skeletonCards, selection, renderExtraView, renderOwnView, sort, onSortChange, sortRequired, showRowIndex, rowClassName, className, ...data }) => {
|
|
13
13
|
if (isExtraMode(displayMode) && renderOwnView) {
|
|
14
14
|
const ownView = renderOwnView(displayMode);
|
|
15
15
|
if (ownView !== undefined)
|
|
16
16
|
return ownView;
|
|
17
17
|
}
|
|
18
|
-
const tableProps = { sort, onSortChange, showRowIndex };
|
|
18
|
+
const tableProps = { sort, onSortChange, sortRequired, showRowIndex, rowClassName };
|
|
19
19
|
if (isExtraMode(displayMode) && renderExtraView) {
|
|
20
20
|
return (_jsx(EntityListGrid, { ...data, renderItems: items => renderExtraView(displayMode, items), skeletonCards: skeletonCards, isGridView: false, className: className }));
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListBody.js","sourceRoot":"","sources":["../../src/list/EntityListBody.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AACtD,OAAO,EAAyB,eAAe,EAA6B,MAAM,sBAAuB,CAAC;AA8B1G,MAAM,WAAW,GAAG,CAAwB,IAA8B,EAAkB,EAAE,CAC5F,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAuC,EACnE,WAAW,EACX,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,eAAe,EACf,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EAC4B,EAAE,EAAE;IACvC,IAAI,WAAW,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;IAC5C,CAAC;IACD,MAAM,UAAU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CAAC;IACD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CACL,KAAC,eAAe,OACV,IAAI,KACJ,UAAU,EACd,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;IACJ,CAAC;IACD,IAAI,WAAW,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,KAAC,cAAc,OAAK,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC;IAClH,CAAC;IACD,OAAO,CACL,8BACE,KAAC,eAAe,OACV,IAAI,KACJ,UAAU,EACd,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,GAC3C,EACF,KAAC,cAAc,OAAK,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,GAAI,IAC3I,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -7,7 +7,12 @@ export interface EntityListEmptyProps {
|
|
|
7
7
|
onClearSearch?: () => void;
|
|
8
8
|
/** One outlined call to action (e.g. "Create …"). */
|
|
9
9
|
action?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* `default`: the 64 px centred block of a list card. `compact`: one inline line (icon, message, buttons), for a
|
|
12
|
+
* small list inside a card or a section.
|
|
13
|
+
*/
|
|
14
|
+
size?: 'default' | 'compact';
|
|
10
15
|
}
|
|
11
16
|
/** Empty, no-results and error state of a list: one short sentence, at most one CTA. */
|
|
12
|
-
export declare const EntityListEmpty: ({ message, tone, icon, onClearSearch, action }: EntityListEmptyProps) => import("react").JSX.Element;
|
|
17
|
+
export declare const EntityListEmpty: ({ message, tone, icon, onClearSearch, action, size }: EntityListEmptyProps) => import("react").JSX.Element;
|
|
13
18
|
//# sourceMappingURL=EntityListEmpty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListEmpty.d.ts","sourceRoot":"","sources":["../../src/list/EntityListEmpty.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,qDAAqD;IACrD,MAAM,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityListEmpty.d.ts","sourceRoot":"","sources":["../../src/list/EntityListEmpty.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,qDAAqD;IACrD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B;AAED,wFAAwF;AACxF,eAAO,MAAM,eAAe,GAAI,sDAA8E,oBAAoB,gCAoCjI,CAAC"}
|
|
@@ -4,8 +4,11 @@ import { Button } from "../primitives/index.js";
|
|
|
4
4
|
import { useTranslate } from "../i18n/index.js";
|
|
5
5
|
import { cn } from "../primitives/cn.js";
|
|
6
6
|
/** Empty, no-results and error state of a list: one short sentence, at most one CTA. */
|
|
7
|
-
export const EntityListEmpty = ({ message, tone = 'default', icon, onClearSearch, action }) => {
|
|
7
|
+
export const EntityListEmpty = ({ message, tone = 'default', icon, onClearSearch, action, size = 'default' }) => {
|
|
8
8
|
const { t } = useTranslate();
|
|
9
|
+
if (size === 'compact') {
|
|
10
|
+
return (_jsxs("div", { "data-list-empty": true, className: "flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 text-[13px] text-muted-foreground", role: tone === 'error' ? 'alert' : undefined, children: [icon && _jsx("span", { className: "flex shrink-0 [&_svg]:size-4", children: icon }), _jsx("span", { className: cn(tone === 'error' && 'text-destructive'), children: message }), onClearSearch && (_jsx(Button, { variant: "outline", size: "xs", onClick: onClearSearch, children: t('Clear search') })), action] }));
|
|
11
|
+
}
|
|
9
12
|
return (_jsxs("div", { "data-list-empty": true, className: "rounded-3xl px-4 py-16 text-center", role: tone === 'error' ? 'alert' : undefined, children: [icon && _jsx("div", { className: "mb-4 flex justify-center text-muted-foreground", children: icon }), _jsx("p", { className: cn('text-[13px] text-muted-foreground', tone === 'error' && 'text-destructive'), children: message }), (onClearSearch || action) && (_jsxs("div", { className: "mt-4 flex items-center justify-center gap-2", children: [onClearSearch && (_jsx(Button, { variant: "outline", size: "sm", onClick: onClearSearch, children: t('Clear search') })), action] }))] }));
|
|
10
13
|
};
|
|
11
14
|
//# sourceMappingURL=EntityListEmpty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListEmpty.js","sourceRoot":"","sources":["../../src/list/EntityListEmpty.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityListEmpty.js","sourceRoot":"","sources":["../../src/list/EntityListEmpty.tsx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,EAC3G,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAC5B,eAAK,SAAS,EAAC,6CAA6C,aACzD,aAAa,IAAI,CAChB,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,aAAa,YACvD,CAAC,CAAC,cAAc,CAAC,GACX,CACV,EACA,MAAM,IACH,CACP,IACG,CACL,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { EntityListDataProps } from './types.js';
|
|
3
|
-
import { type EntityListSort } from '../logic/pure/listSort.js';
|
|
3
|
+
import { type EntityListSort, type ListSortDirection } from '../logic/pure/listSort.js';
|
|
4
4
|
import { type ListColumnAlign, type ListColumnPin, type ListColumnWidth } from '../logic/pure/listTracks.js';
|
|
5
5
|
import type { EntityListSelection } from '../logic/react/useRowSelection.js';
|
|
6
6
|
export interface EntityListColumn<TItem> {
|
|
@@ -30,6 +30,8 @@ export interface EntityListColumn<TItem> {
|
|
|
30
30
|
* `onSortChange`. The table never sorts rows itself: the host maps the key to its request.
|
|
31
31
|
*/
|
|
32
32
|
sortKey?: string;
|
|
33
|
+
/** The first direction when this column becomes sorted (default `'asc'`; e.g. `'desc'` for dates, newest first). */
|
|
34
|
+
sortStart?: ListSortDirection;
|
|
33
35
|
}
|
|
34
36
|
export interface EntityListTableProps<TItem> extends EntityListDataProps<TItem> {
|
|
35
37
|
columns: EntityListColumn<TItem>[];
|
|
@@ -48,10 +50,17 @@ export interface EntityListTableProps<TItem> extends EntityListDataProps<TItem>
|
|
|
48
50
|
stickyHeaderTop?: string;
|
|
49
51
|
/** The current sort (`null`: the host's default order). Shown on the header of the column with that `sortKey`. */
|
|
50
52
|
sort?: EntityListSort | null;
|
|
51
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Called with the next sort when a sortable header is clicked: not sorted → the column's `sortStart` (ascending by
|
|
55
|
+
* default) → the other direction → `null` (or back to `sortStart` with `sortRequired`).
|
|
56
|
+
*/
|
|
52
57
|
onSortChange?: (sort: EntityListSort | null) => void;
|
|
58
|
+
/** The list is always sorted: a sorted column's third click returns to its first direction instead of `null`. */
|
|
59
|
+
sortRequired?: boolean;
|
|
53
60
|
/** A leading `#` column: the 1-based position of the row among the loaded rows. Pinned with the selection column. */
|
|
54
61
|
showRowIndex?: boolean;
|
|
62
|
+
/** Extra classes of a body row (`index`: 0-based among the loaded rows), e.g. a muted archived row. */
|
|
63
|
+
rowClassName?: (item: TItem, index: number) => string | undefined;
|
|
55
64
|
}
|
|
56
65
|
/**
|
|
57
66
|
* Table view of an entity list: one scroll container that fills its card, sticky header, skeleton rows on the
|
|
@@ -63,5 +72,5 @@ export interface EntityListTableProps<TItem> extends EntityListDataProps<TItem>
|
|
|
63
72
|
* exactly as before they existed. Sizes are measured only after hydration; the server render and the hydration render
|
|
64
73
|
* use the CSS form of the same tracks.
|
|
65
74
|
*/
|
|
66
|
-
export declare const EntityListTable: <TItem>({ columns, items, getRowKey, isLoading, isFetchingMore, hasMore, onLoadMore, emptyMessage, noResultsMessage, isSearchActive, onClearSearch, loadingMessage, error, rowAction, skeletonRows, selection, className, stickyHeaderTop, sort, onSortChange, showRowIndex, }: EntityListTableProps<TItem>) => import("react").JSX.Element;
|
|
75
|
+
export declare const EntityListTable: <TItem>({ columns, items, getRowKey, isLoading, isFetchingMore, hasMore, onLoadMore, emptyMessage, noResultsMessage, isSearchActive, onClearSearch, loadingMessage, error, rowAction, skeletonRows, selection, className, stickyHeaderTop, sort, onSortChange, sortRequired, showRowIndex, rowClassName, }: EntityListTableProps<TItem>) => import("react").JSX.Element;
|
|
67
76
|
//# sourceMappingURL=EntityListTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListTable.d.ts","sourceRoot":"","sources":["../../src/list/EntityListTable.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,SAAS,EA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OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kHAAkH;IAClH,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,iHAAiH;IACjH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qHAAqH;IACrH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uGAAuG;IACvG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACnE;AAkMD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,EAAG,oSAwBrC,oBAAoB,CAAC,KAAK,CAAC,gCA8O7B,CAAC"}
|
|
@@ -57,16 +57,17 @@ const SelectAllHeader = ({ selection, disabled }) => {
|
|
|
57
57
|
return (_jsx(Checkbox, { checked: selection.allLoadedState, onCheckedChange: checked => selection.setAllLoadedSelected(checked === true), disabled: disabled || selection.disabled, "aria-label": t('Select all loaded'), title: t('Select all loaded'), className: "align-middle" }));
|
|
58
58
|
};
|
|
59
59
|
/** A sortable column's header content: one button that moves the sort on; the cell carries `aria-sort`. */
|
|
60
|
-
const SortHeaderButton = ({ label, direction, onClick, }) => {
|
|
60
|
+
const SortHeaderButton = ({ label, direction, onClick, iconFirst, }) => {
|
|
61
61
|
const Icon = direction === 'asc' ? ArrowUp : direction === 'desc' ? ArrowDown : ArrowUpDown;
|
|
62
|
-
|
|
62
|
+
const icon = _jsx(Icon, { "aria-hidden": true, className: cn('size-3.5 shrink-0', !direction && 'opacity-50') });
|
|
63
|
+
return (_jsxs("button", { type: "button", onClick: onClick, className: cn('-mx-1 inline-flex cursor-pointer items-center gap-1.5 rounded-sm px-1 text-left font-bold tracking-[inherit] uppercase outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring', direction && 'text-foreground'), children: [iconFirst && icon, _jsx("span", { children: label }), !iconFirst && icon] }));
|
|
63
64
|
};
|
|
64
|
-
const EntityListTableRow = ({ item, rowKey, columns, action, selection, rowNumber, layout }) => {
|
|
65
|
+
const EntityListTableRow = ({ item, rowKey, columns, action, selection, rowNumber, layout, className, }) => {
|
|
65
66
|
const { t } = useTranslate();
|
|
66
67
|
const activation = useRowActivation(action);
|
|
67
68
|
const selected = selection?.isItemSelected(item) ?? false;
|
|
68
69
|
const leading = (selection ? 1 : 0) + (rowNumber !== undefined ? 1 : 0);
|
|
69
|
-
return (_jsxs(TableRow, { className: cn('group/row', action && 'cursor-pointer'), "data-state": selected ? 'selected' : undefined, role: roleIn(layout, 'row'), ...activation, children: [selection && (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, SELECT_CELL_CLASS), "data-row-action-ignore": true, role: roleIn(layout, 'cell'), ...pinProps(layout, 0, false), children: selection.isItemSelectable(item)
|
|
70
|
+
return (_jsxs(TableRow, { className: cn('group/row', action && 'cursor-pointer', className), "data-state": selected ? 'selected' : undefined, role: roleIn(layout, 'row'), ...activation, children: [selection && (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, SELECT_CELL_CLASS), "data-row-action-ignore": true, role: roleIn(layout, 'cell'), ...pinProps(layout, 0, false), children: selection.isItemSelectable(item) ? (_jsx(Checkbox, { checked: selected, onCheckedChange: checked => selection.setItemSelected(item, checked === true), disabled: selection.disabled, "aria-label": selection.rowLabel?.(item) ?? t('Select row %rowKey%', { replacements: { rowKey } }), className: "align-middle" })) : (selection.isItemSelectionDisabled?.(item) && (_jsx(Checkbox, { checked: false, disabled: true, "aria-label": selection.rowLabel?.(item) ?? t('Select row %rowKey%', { replacements: { rowKey } }), className: "align-middle" }))) })), rowNumber !== undefined && (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, INDEX_CELL_CLASS), role: roleIn(layout, 'cell'), ...pinProps(layout, selection ? 1 : 0, false), children: rowNumber })), columns.map((column, index) => (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, column.className, cellLayoutClass(layout, column.align)), role: roleIn(layout, 'cell'), ...pinProps(layout, leading + index, false), children: cellContent(layout, column.cell(item), column.align) }, column.id)))] }));
|
|
70
71
|
};
|
|
71
72
|
const sameMeasure = (previous, next) => previous !== null &&
|
|
72
73
|
previous.visibleWidth === next.visibleWidth &&
|
|
@@ -83,7 +84,7 @@ const sameMeasure = (previous, next) => previous !== null &&
|
|
|
83
84
|
* exactly as before they existed. Sizes are measured only after hydration; the server render and the hydration render
|
|
84
85
|
* use the CSS form of the same tracks.
|
|
85
86
|
*/
|
|
86
|
-
export const EntityListTable = ({ columns, items, getRowKey, isLoading = false, isFetchingMore = false, hasMore = false, onLoadMore, emptyMessage, noResultsMessage, isSearchActive, onClearSearch, loadingMessage, error, rowAction, skeletonRows = 8, selection, className, stickyHeaderTop, sort, onSortChange, showRowIndex = false, }) => {
|
|
87
|
+
export const EntityListTable = ({ columns, items, getRowKey, isLoading = false, isFetchingMore = false, hasMore = false, onLoadMore, emptyMessage, noResultsMessage, isSearchActive, onClearSearch, loadingMessage, error, rowAction, skeletonRows = 8, selection, className, stickyHeaderTop, sort, onSortChange, sortRequired = false, showRowIndex = false, rowClassName, }) => {
|
|
87
88
|
const { t } = useTranslate();
|
|
88
89
|
const headerTopStyle = stickyHeaderTop ? { top: stickyHeaderTop } : undefined;
|
|
89
90
|
const hasFilterRow = columns.some(column => column.filter !== undefined);
|
|
@@ -185,10 +186,10 @@ export const EntityListTable = ({ columns, items, getRowKey, isLoading = false,
|
|
|
185
186
|
const label = typeof column.header === 'string' ? t(column.header) : column.header;
|
|
186
187
|
const sortable = column.sortKey !== undefined && onSortChange !== undefined;
|
|
187
188
|
const direction = sortable && sort && sort.key === column.sortKey ? sort.direction : undefined;
|
|
188
|
-
return (_jsx(TableHead, { className: cn(HEADER_CELL_CLASS, 'top-0', column.className, cellLayoutClass(layout, column.align)), "aria-sort": direction === 'asc' ? 'ascending' : direction === 'desc' ? 'descending' : undefined, ...headerCellProps(leadingCount + index, headerTopStyle), children: cellContent(layout, sortable ? (_jsx(SortHeaderButton, { label: label, direction: direction, onClick: () => onSortChange(nextListSort(sort, column.sortKey)) })) : (label), column.align) }, column.id));
|
|
189
|
+
return (_jsx(TableHead, { className: cn(HEADER_CELL_CLASS, 'top-0', column.className, cellLayoutClass(layout, column.align)), "aria-sort": direction === 'asc' ? 'ascending' : direction === 'desc' ? 'descending' : undefined, ...headerCellProps(leadingCount + index, headerTopStyle), children: cellContent(layout, sortable ? (_jsx(SortHeaderButton, { label: label, direction: direction, onClick: () => onSortChange(nextListSort(sort, column.sortKey, { start: column.sortStart, required: sortRequired })), iconFirst: column.align === 'end' })) : (label), column.align) }, column.id));
|
|
189
190
|
})] }), hasFilterRow && (_jsxs(TableRow, { className: "hover:bg-transparent", role: roleIn(layout, 'row'), children: [selection && _jsx(TableHead, { className: cn(HEADER_CELL_CLASS, 'top-12 py-2.5', SELECT_CELL_CLASS), ...headerCellProps(0) }), showRowIndex && (_jsx(TableHead, { className: cn(HEADER_CELL_CLASS, 'top-12 py-2.5', INDEX_CELL_CLASS), ...headerCellProps(indexPosition) })), columns.map((column, index) => (_jsx(TableHead, { className: cn(HEADER_CELL_CLASS, 'top-12 py-2.5 font-normal normal-case', column.className, cellLayoutClass(layout, column.align)), ...headerCellProps(leadingCount + index), children: column.filter === undefined ? column.filter : cellContent(layout, column.filter, column.align) }, column.id)))] }))] }), _jsx(TableBody, { role: roleIn(layout, 'rowgroup'), children: isLoading && !error
|
|
190
191
|
? Array.from({ length: skeletonRows }, (_, row) => (_jsxs(TableRow, { className: "hover:bg-transparent", "aria-hidden": true, role: roleIn(layout, 'row'), children: [selection && (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, SELECT_CELL_CLASS), role: roleIn(layout, 'cell'), ...pinProps(layout, 0, false), children: _jsx(Skeleton, { className: "size-4" }) })), showRowIndex && (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, INDEX_CELL_CLASS), role: roleIn(layout, 'cell'), ...pinProps(layout, indexPosition, false), children: _jsx(Skeleton, { className: "h-4 w-5" }) })), columns.map((column, index) => (_jsx(TableCell, { className: cn(BODY_CELL_CLASS, column.className, cellLayoutClass(layout, column.align)), role: roleIn(layout, 'cell'), ...pinProps(layout, leadingCount + index, false), children: _jsx(Skeleton, { className: "h-4 w-full min-w-12" }) }, column.id)))] }, row)))
|
|
191
192
|
: showRows &&
|
|
192
|
-
items.map((item, index) => (_jsx(EntityListTableRow, { rowKey: getRowKey(item), item: item, columns: columns, action: rowAction ? rowAction(item) : undefined, selection: selection, rowNumber: showRowIndex ? index + 1 : undefined, layout: layout }, getRowKey(item)))) })] }), _jsx(EntityListStatus, { itemCount: items.length, isLoading: isLoading, emptyMessage: emptyMessage, noResultsMessage: noResultsMessage, isSearchActive: isSearchActive, onClearSearch: onClearSearch, loadingMessage: loadingMessage, error: error }), _jsx(EntityListLoadMore, { hasMore: showRows && hasMore, isFetchingMore: isFetchingMore, onLoadMore: onLoadMore })] }));
|
|
193
|
+
items.map((item, index) => (_jsx(EntityListTableRow, { rowKey: getRowKey(item), item: item, columns: columns, action: rowAction ? rowAction(item) : undefined, selection: selection, rowNumber: showRowIndex ? index + 1 : undefined, layout: layout, className: rowClassName?.(item, index) }, getRowKey(item)))) })] }), _jsx(EntityListStatus, { itemCount: items.length, isLoading: isLoading, emptyMessage: emptyMessage, noResultsMessage: noResultsMessage, isSearchActive: isSearchActive, onClearSearch: onClearSearch, loadingMessage: loadingMessage, error: error }), _jsx(EntityListLoadMore, { hasMore: showRows && hasMore, isFetchingMore: isFetchingMore, onLoadMore: onLoadMore })] }));
|
|
193
194
|
};
|
|
194
195
|
//# sourceMappingURL=EntityListTable.js.map
|