@parallelworks/ui 0.90.0 → 0.92.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 +2 -1
- package/dist/components/Table.d.ts +7 -0
- package/dist/components/Table.js +10 -3
- package/dist/list/ListFilterBar.d.ts +6 -1
- package/dist/list/ListFilterBar.js +109 -3
- package/dist/list/ListPage.d.ts +23 -2
- package/dist/list/ListPage.js +95 -30
- package/dist/list/ListToolbar.d.ts +13 -7
- package/dist/list/ListToolbar.js +28 -17
- package/dist/list/index.d.ts +2 -2
- package/dist/list/index.js +3 -3
- package/dist/list/listSearch.d.ts +18 -2
- package/dist/list/listSearch.js +24 -8
- package/dist/list/listView.d.ts +10 -0
- package/dist/list/listView.js +2 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -18,10 +18,26 @@ export declare function ListSearchControl({ search, placeholder, label: labelPro
|
|
|
18
18
|
placeholder: string;
|
|
19
19
|
label?: string | undefined;
|
|
20
20
|
}): import("react").JSX.Element;
|
|
21
|
-
|
|
21
|
+
/** What a list's count needs: how many there are, how many a search or filter leaves, and the
|
|
22
|
+
* noun in both numbers. */
|
|
23
|
+
export interface ListCountProps {
|
|
22
24
|
total: number;
|
|
23
25
|
matches: number;
|
|
24
26
|
filterActive: boolean;
|
|
25
27
|
noun: string;
|
|
26
28
|
nounPlural: string;
|
|
27
|
-
}
|
|
29
|
+
}
|
|
30
|
+
/** True inside a `ListPage` that shows its count under its rows, so a count placed in its toolbar
|
|
31
|
+
* by hand gives way rather than showing twice. */
|
|
32
|
+
export declare const ListFooterCountContext: import("react").Context<boolean>;
|
|
33
|
+
/** True where a toolbar shares a line with the list's filter chips, at its end: a `ListToolbar`
|
|
34
|
+
* there drops its own row's height and padding. */
|
|
35
|
+
export declare const ListToolbarInlineContext: import("react").Context<boolean>;
|
|
36
|
+
/** The count's words, "7 tokens" or "2 of 7 tokens", as a status so a screen reader hears the
|
|
37
|
+
* count change as a filter narrows it. */
|
|
38
|
+
export declare function ListCountText({ total, matches, filterActive, noun, nounPlural }: ListCountProps): import("react").JSX.Element;
|
|
39
|
+
/** A list's count, placed by hand.
|
|
40
|
+
* @deprecated Give `ListPage` a `count` instead (with its `total` and `matches`): it shows the
|
|
41
|
+
* count under the last row, beside a `pager`, and hides it while the list shows its empty or
|
|
42
|
+
* no-matches state. Inside a `ListPage` that shows its own count, this renders nothing. */
|
|
43
|
+
export declare function ListCount(props: ListCountProps): import("react").JSX.Element;
|
package/dist/list/listSearch.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Tooltip } from "../components/Tooltip.js";
|
|
|
5
5
|
import { useLocale, usePersistedState, useStrings } from "../components/Provider.js";
|
|
6
6
|
import { isTextEntryContext } from "../components/shortcutKey.js";
|
|
7
7
|
import { formatInteger } from "../format.js";
|
|
8
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/list/listSearch.tsx
|
|
11
11
|
var NO_TERMS = [];
|
|
@@ -133,18 +133,34 @@ function ListSearchControl({ search, placeholder, label: labelProp }) {
|
|
|
133
133
|
})
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
/** True inside a `ListPage` that shows its count under its rows, so a count placed in its toolbar
|
|
137
|
+
* by hand gives way rather than showing twice. */
|
|
138
|
+
var ListFooterCountContext = createContext(false);
|
|
139
|
+
/** True where a toolbar shares a line with the list's filter chips, at its end: a `ListToolbar`
|
|
140
|
+
* there drops its own row's height and padding. */
|
|
141
|
+
var ListToolbarInlineContext = createContext(false);
|
|
142
|
+
/** The count's words, "7 tokens" or "2 of 7 tokens", as a status so a screen reader hears the
|
|
143
|
+
* count change as a filter narrows it. */
|
|
144
|
+
function ListCountText({ total, matches, filterActive, noun, nounPlural }) {
|
|
137
145
|
const { list: t } = useStrings();
|
|
138
146
|
const locale = useLocale();
|
|
139
147
|
const count = (n) => formatInteger(n, locale);
|
|
148
|
+
return /* @__PURE__ */ jsx("span", {
|
|
149
|
+
role: "status",
|
|
150
|
+
className: "text-[13px] text-(--theme-muted-text-color)",
|
|
151
|
+
children: filterActive ? t.matchCount(count(matches), count(total), nounPlural) : t.count(count(total), total === 1 ? noun : nounPlural)
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/** A list's count, placed by hand.
|
|
155
|
+
* @deprecated Give `ListPage` a `count` instead (with its `total` and `matches`): it shows the
|
|
156
|
+
* count under the last row, beside a `pager`, and hides it while the list shows its empty or
|
|
157
|
+
* no-matches state. Inside a `ListPage` that shows its own count, this renders nothing. */
|
|
158
|
+
function ListCount(props) {
|
|
159
|
+
if (useContext(ListFooterCountContext)) return /* @__PURE__ */ jsx("span", { "aria-hidden": "true" });
|
|
140
160
|
return /* @__PURE__ */ jsx("div", {
|
|
141
161
|
className: "flex items-center h-8",
|
|
142
|
-
children: /* @__PURE__ */ jsx(
|
|
143
|
-
role: "status",
|
|
144
|
-
className: "text-[13px] text-(--theme-muted-text-color)",
|
|
145
|
-
children: filterActive ? t.matchCount(count(matches), count(total), nounPlural) : t.count(count(total), total === 1 ? noun : nounPlural)
|
|
146
|
-
})
|
|
162
|
+
children: /* @__PURE__ */ jsx(ListCountText, { ...props })
|
|
147
163
|
});
|
|
148
164
|
}
|
|
149
165
|
//#endregion
|
|
150
|
-
export { ListCount, ListSearchControl, useListSearch };
|
|
166
|
+
export { ListCount, ListCountText, ListFooterCountContext, ListSearchControl, ListToolbarInlineContext, useListSearch };
|
package/dist/list/listView.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ export interface ColumnDef {
|
|
|
26
26
|
* column there: for something short that compares best lined up, like a
|
|
27
27
|
* total. The first column never stacks; it is what the others stack under. */
|
|
28
28
|
stack?: boolean;
|
|
29
|
+
/** Where a stacked column's value sits on the lines under the name. By default the stacked
|
|
30
|
+
* values share a line, flowing and wrapping between them. `own` starts a line of its own, for
|
|
31
|
+
* a value read first, such as a status; `join` stays on the line before it after a "·", for
|
|
32
|
+
* one that belongs with that value, such as a job's nodes after its partition. */
|
|
33
|
+
stackLine?: StackLine | undefined;
|
|
29
34
|
/** The `value` of the {@link OrderByOption} this column sorts by. Its header
|
|
30
35
|
* then sorts the list: it shows, and sets, the same order as Display
|
|
31
36
|
* options' Ordering. */
|
|
@@ -43,6 +48,9 @@ export interface ColumnDef {
|
|
|
43
48
|
}
|
|
44
49
|
/** Column responsive importance; `low` drops before `medium`. See {@link ColumnDef.priority}. */
|
|
45
50
|
type ColumnPriority = 'low' | 'medium';
|
|
51
|
+
/** How a stacked column's value lines up with the others under the name; see
|
|
52
|
+
* {@link ColumnDef.stackLine}. */
|
|
53
|
+
export type StackLine = 'own' | 'join';
|
|
46
54
|
/** Whether a column is always shown and kept out of the column picker. */
|
|
47
55
|
export declare function isLocked(col: ColumnDef): boolean;
|
|
48
56
|
interface GroupByOption {
|
|
@@ -130,6 +138,8 @@ export interface ListViewChrome {
|
|
|
130
138
|
/** Per visible column, whether it stacks under the first on a narrow
|
|
131
139
|
* container ({@link ColumnDef.stack}); `ListRow` reads entry `i`. */
|
|
132
140
|
columnStacks: boolean[];
|
|
141
|
+
/** Per visible column, the line its stacked value takes ({@link ColumnDef.stackLine}). */
|
|
142
|
+
columnStackLines?: (StackLine | undefined)[] | undefined;
|
|
133
143
|
/** Whether the last column is a locked one, such as a delete button's: the
|
|
134
144
|
* row's `⋯` then keeps a lane of its own after it rather than floating over
|
|
135
145
|
* it on hover. */
|
package/dist/list/listView.js
CHANGED
|
@@ -94,6 +94,7 @@ function useListView({ storageKey, sharedFiltersKey, columns, groupBys = [], def
|
|
|
94
94
|
const visibleColumns = useMemo(() => columns.filter((c) => !c.inline && (isLocked(c) || !hiddenKeys.includes(c.key))), [columns, hiddenKeys]);
|
|
95
95
|
const columnClasses = useMemo(() => visibleColumns.map(columnClass), [visibleColumns]);
|
|
96
96
|
const columnStacks = useMemo(() => visibleColumns.map(stacks), [visibleColumns]);
|
|
97
|
+
const columnStackLines = useMemo(() => visibleColumns.map((c) => c.stackLine), [visibleColumns]);
|
|
97
98
|
const last = visibleColumns.at(-1);
|
|
98
99
|
const lastColumnLocked = visibleColumns.length > 1 && last !== void 0 && !last.alwaysVisible && isLocked(last);
|
|
99
100
|
const reservesActionLane = lastColumnLocked || visibleColumns.length > 1 && last?.align === "end";
|
|
@@ -191,6 +192,7 @@ function useListView({ storageKey, sharedFiltersKey, columns, groupBys = [], def
|
|
|
191
192
|
visibleColumns,
|
|
192
193
|
columnClasses,
|
|
193
194
|
columnStacks,
|
|
195
|
+
columnStackLines,
|
|
194
196
|
lastColumnLocked,
|
|
195
197
|
reservesActionLane,
|
|
196
198
|
isVisible,
|