@stll/workspace-ui 0.4.0 → 0.4.1
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.
|
@@ -4,6 +4,6 @@ import { WorkspaceKanbanGroupingPickerProps, WorkspaceKanbanProperty } from "./k
|
|
|
4
4
|
* Accessible picker shared by the board's Group and Sub-group controls. The
|
|
5
5
|
* caller labels built-ins because only its domain owns their human names.
|
|
6
6
|
*/
|
|
7
|
-
declare const WorkspaceKanbanGroupingPicker: <TRow, TProperty extends WorkspaceKanbanProperty>({ allowNone, excludedGroupBy, getBuiltInGroupLabel, labels, onValueChange, schema, value }: WorkspaceKanbanGroupingPickerProps<TRow, TProperty>) => import("react").JSX.Element;
|
|
7
|
+
declare const WorkspaceKanbanGroupingPicker: <TRow, TProperty extends WorkspaceKanbanProperty<TGroupId>, TGroupId extends string = string>({ allowNone, excludedGroupBy, getBuiltInGroupLabel, labels, onValueChange, schema, value }: WorkspaceKanbanGroupingPickerProps<TRow, TProperty, TGroupId>) => import("react").JSX.Element;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { WorkspaceKanbanGroupingPicker };
|
|
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "@stll/ui/select";
|
|
4
4
|
//#region src/kanban-grouping-picker.tsx
|
|
5
5
|
const NO_GROUPING_VALUE = "";
|
|
6
|
+
const toSelectTransportValue = (value) => value;
|
|
6
7
|
/**
|
|
7
8
|
* Accessible picker shared by the board's Group and Sub-group controls. The
|
|
8
9
|
* caller labels built-ins because only its domain owns their human names.
|
|
@@ -13,12 +14,18 @@ const WorkspaceKanbanGroupingPicker = ({ allowNone, excludedGroupBy, getBuiltInG
|
|
|
13
14
|
schema
|
|
14
15
|
}).filter(({ id }) => id !== excludedGroupBy);
|
|
15
16
|
const display = choices.find((choice) => choice.id === value)?.label ?? (allowNone ? labels.none : labels.placeholder);
|
|
17
|
+
const selectedValue = toSelectTransportValue(value);
|
|
16
18
|
return /* @__PURE__ */ jsxs(Select, {
|
|
17
19
|
onValueChange: (nextValue) => {
|
|
18
20
|
if (nextValue === null) return;
|
|
19
|
-
|
|
21
|
+
if (nextValue === NO_GROUPING_VALUE) {
|
|
22
|
+
onValueChange(NO_GROUPING_VALUE);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const nextChoice = choices.find(({ id }) => id === nextValue);
|
|
26
|
+
if (nextChoice !== void 0) onValueChange(nextChoice.id);
|
|
20
27
|
},
|
|
21
|
-
value,
|
|
28
|
+
value: selectedValue,
|
|
22
29
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
23
30
|
"aria-label": labels.control,
|
|
24
31
|
size: "sm",
|
|
@@ -30,7 +37,7 @@ const WorkspaceKanbanGroupingPicker = ({ allowNone, excludedGroupBy, getBuiltInG
|
|
|
30
37
|
value: NO_GROUPING_VALUE,
|
|
31
38
|
children: labels.none
|
|
32
39
|
}) : null, choices.map((choice) => /* @__PURE__ */ jsx(SelectItem, {
|
|
33
|
-
value: choice.id,
|
|
40
|
+
value: toSelectTransportValue(choice.id),
|
|
34
41
|
children: choice.label
|
|
35
42
|
}, choice.id))] })]
|
|
36
43
|
});
|
package/dist/kanban-view.d.ts
CHANGED
|
@@ -13,75 +13,76 @@ type KanbanSavedGroupReference = {
|
|
|
13
13
|
} | {
|
|
14
14
|
type: "uncategorized";
|
|
15
15
|
};
|
|
16
|
-
type KanbanSavedAxisState = {
|
|
16
|
+
type KanbanSavedAxisState<TGroupId extends string = string> = {
|
|
17
17
|
emptyGroups: KanbanEmptyGroupVisibility;
|
|
18
|
-
groupBy:
|
|
18
|
+
groupBy: TGroupId;
|
|
19
19
|
hiddenGroups: readonly KanbanSavedGroupReference[];
|
|
20
20
|
orderedGroups: readonly KanbanSavedGroupReference[];
|
|
21
21
|
};
|
|
22
|
-
type KanbanSavedSubgroupState = KanbanSavedAxisState & {
|
|
22
|
+
type KanbanSavedSubgroupState<TGroupId extends string = string> = KanbanSavedAxisState<TGroupId> & {
|
|
23
23
|
collapsedGroups: readonly KanbanSavedGroupReference[];
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* View state is deliberately separate from the board's domain data. It may
|
|
27
27
|
* change visibility, order, and collapse, but cannot change a card's cell.
|
|
28
28
|
*/
|
|
29
|
-
type KanbanSavedViewState = {
|
|
30
|
-
group: KanbanSavedAxisState
|
|
31
|
-
subgroup: KanbanSavedSubgroupState | null;
|
|
29
|
+
type KanbanSavedViewState<TGroupId extends string = string> = {
|
|
30
|
+
group: KanbanSavedAxisState<TGroupId>;
|
|
31
|
+
subgroup: KanbanSavedSubgroupState<TGroupId> | null;
|
|
32
32
|
version: 1;
|
|
33
33
|
};
|
|
34
|
-
type WorkspaceKanbanProperty = GenericProperty & {
|
|
35
|
-
id:
|
|
34
|
+
type WorkspaceKanbanProperty<TGroupId extends string = string> = GenericProperty & {
|
|
35
|
+
id: TGroupId;
|
|
36
36
|
name: string;
|
|
37
37
|
};
|
|
38
|
-
type CreateWorkspaceKanbanSchemaParams<TRow, TProperty extends WorkspaceKanbanProperty> = {
|
|
39
|
-
builtInGroups: readonly KanbanBuiltInGroup<TRow>[];
|
|
38
|
+
type CreateWorkspaceKanbanSchemaParams<TRow, TBuiltInGroupId extends string, TProperty extends WorkspaceKanbanProperty> = {
|
|
39
|
+
builtInGroups: readonly KanbanBuiltInGroup<TRow, TBuiltInGroupId>[];
|
|
40
40
|
properties: readonly TProperty[];
|
|
41
41
|
};
|
|
42
|
+
type WorkspaceKanbanSchemaGroupId<TBuiltInGroupId extends string, TProperty extends WorkspaceKanbanProperty> = TBuiltInGroupId | TProperty["id"];
|
|
42
43
|
/**
|
|
43
44
|
* Turns the authoritative workspace property model into board declarations.
|
|
44
45
|
* Select options remain the sole source of property-derived columns and lanes.
|
|
45
46
|
*/
|
|
46
|
-
declare const createWorkspaceKanbanSchema: <TRow, TProperty extends WorkspaceKanbanProperty>({ builtInGroups, properties }: CreateWorkspaceKanbanSchemaParams<TRow, TProperty>) => KanbanSchema<TRow, TProperty
|
|
47
|
-
type WorkspaceKanbanGroupingChoice = {
|
|
48
|
-
id:
|
|
47
|
+
declare const createWorkspaceKanbanSchema: <TRow, TBuiltInGroupId extends string, TProperty extends WorkspaceKanbanProperty>({ builtInGroups, properties }: CreateWorkspaceKanbanSchemaParams<TRow, TBuiltInGroupId, TProperty>) => KanbanSchema<TRow, TProperty, WorkspaceKanbanSchemaGroupId<TBuiltInGroupId, TProperty>>;
|
|
48
|
+
type WorkspaceKanbanGroupingChoice<TGroupId extends string = string> = {
|
|
49
|
+
id: TGroupId;
|
|
49
50
|
label: string;
|
|
50
51
|
type: "built-in" | "property";
|
|
51
52
|
};
|
|
52
|
-
type WorkspaceKanbanBuiltInGroupLabel<TRow> = (group: KanbanBuiltInGroup<TRow>) => string;
|
|
53
|
+
type WorkspaceKanbanBuiltInGroupLabel<TRow, TGroupId extends string = string> = (group: KanbanBuiltInGroup<TRow, TGroupId>) => string;
|
|
53
54
|
/** Property-aware data for a Group or Sub-group picker. */
|
|
54
|
-
declare const getWorkspaceKanbanGroupingChoices: <TRow, TProperty extends WorkspaceKanbanProperty>({ getBuiltInGroupLabel, schema }: {
|
|
55
|
-
getBuiltInGroupLabel: WorkspaceKanbanBuiltInGroupLabel<TRow>;
|
|
56
|
-
schema: KanbanSchema<TRow, TProperty>;
|
|
57
|
-
}) => WorkspaceKanbanGroupingChoice[];
|
|
55
|
+
declare const getWorkspaceKanbanGroupingChoices: <TRow, TProperty extends WorkspaceKanbanProperty<TGroupId>, TGroupId extends string = string>({ getBuiltInGroupLabel, schema }: {
|
|
56
|
+
getBuiltInGroupLabel: WorkspaceKanbanBuiltInGroupLabel<TRow, TGroupId>;
|
|
57
|
+
schema: KanbanSchema<TRow, TProperty, TGroupId>;
|
|
58
|
+
}) => WorkspaceKanbanGroupingChoice<TGroupId>[];
|
|
58
59
|
type WorkspaceKanbanGroupingPickerLabels = {
|
|
59
60
|
control: string;
|
|
60
61
|
none: string;
|
|
61
62
|
placeholder: string;
|
|
62
63
|
};
|
|
63
|
-
type WorkspaceKanbanGroupingPickerProps<TRow, TProperty extends WorkspaceKanbanProperty> = {
|
|
64
|
+
type WorkspaceKanbanGroupingPickerProps<TRow, TProperty extends WorkspaceKanbanProperty<TGroupId>, TGroupId extends string = string> = {
|
|
64
65
|
allowNone: boolean;
|
|
65
|
-
excludedGroupBy?:
|
|
66
|
-
getBuiltInGroupLabel: WorkspaceKanbanBuiltInGroupLabel<TRow>;
|
|
66
|
+
excludedGroupBy?: TGroupId | undefined;
|
|
67
|
+
getBuiltInGroupLabel: WorkspaceKanbanBuiltInGroupLabel<TRow, TGroupId>;
|
|
67
68
|
labels: WorkspaceKanbanGroupingPickerLabels;
|
|
68
|
-
onValueChange: (groupBy:
|
|
69
|
-
schema: KanbanSchema<TRow, TProperty>;
|
|
70
|
-
value:
|
|
69
|
+
onValueChange: (groupBy: TGroupId | "") => void;
|
|
70
|
+
schema: KanbanSchema<TRow, TProperty, TGroupId>;
|
|
71
|
+
value: TGroupId | "";
|
|
71
72
|
};
|
|
72
|
-
type ResolveWorkspaceKanbanViewParams<TRow, TProperty> = {
|
|
73
|
-
schema: KanbanSchema<TRow, TProperty>;
|
|
74
|
-
state: KanbanSavedViewState
|
|
73
|
+
type ResolveWorkspaceKanbanViewParams<TRow, TProperty, TGroupId extends string = string> = {
|
|
74
|
+
schema: KanbanSchema<TRow, TProperty, TGroupId>;
|
|
75
|
+
state: KanbanSavedViewState<TGroupId>;
|
|
75
76
|
};
|
|
76
|
-
type ResolvedWorkspaceKanbanView<TRow, TProperty> = {
|
|
77
|
-
group: KanbanGrouping<TRow, TProperty>;
|
|
78
|
-
subgroup: KanbanGrouping<TRow, TProperty>;
|
|
77
|
+
type ResolvedWorkspaceKanbanView<TRow, TProperty, TGroupId extends string = string> = {
|
|
78
|
+
group: KanbanGrouping<TRow, TProperty, TGroupId>;
|
|
79
|
+
subgroup: KanbanGrouping<TRow, TProperty, TGroupId>;
|
|
79
80
|
};
|
|
80
81
|
/**
|
|
81
82
|
* A property cannot control both axes. Rejecting that configuration here means
|
|
82
83
|
* a later diagonal drag never has two contradictory assignments for one field.
|
|
83
84
|
*/
|
|
84
|
-
declare const resolveWorkspaceKanbanView: <TRow, TProperty>({ schema, state }: ResolveWorkspaceKanbanViewParams<TRow, TProperty>) => ResolvedWorkspaceKanbanView<TRow, TProperty>;
|
|
85
|
+
declare const resolveWorkspaceKanbanView: <TRow, TProperty, TGroupId extends string = string>({ schema, state }: ResolveWorkspaceKanbanViewParams<TRow, TProperty, TGroupId>) => ResolvedWorkspaceKanbanView<TRow, TProperty, TGroupId>;
|
|
85
86
|
type KanbanPresentedLane<TRow> = {
|
|
86
87
|
cells: KanbanBoardCell<TRow>[];
|
|
87
88
|
collapsed: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/workspace-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Reusable workspace presentation components and view helpers for Stella.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calculations",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@stll/calculations": "^0.1.0",
|
|
112
112
|
"@stll/conditions": "^0.2.0",
|
|
113
113
|
"@stll/money": "^0.1.0",
|
|
114
|
-
"@stll/ui": "^0.9.
|
|
114
|
+
"@stll/ui": "^0.9.1",
|
|
115
115
|
"better-result": "3.0.0",
|
|
116
116
|
"lucide-react": "1.30.0",
|
|
117
117
|
"use-intl": "4.13.5"
|