@stll/workspace-ui 0.15.7 → 0.16.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/dist/calculation-format.d.ts +1 -3
- package/dist/calculation-format.js +1 -2
- package/dist/calculation-selection.d.ts +1 -3
- package/dist/calculation-selection.js +1 -2
- package/dist/calculations.d.ts +0 -2
- package/dist/calculations.js +1 -2
- package/dist/column-sort.d.ts +1 -3
- package/dist/column-sort.js +1 -2
- package/dist/conditions/builder.d.ts +1 -3
- package/dist/conditions/builder.js +31 -19
- package/dist/conditions/index.js +1 -1
- package/dist/conditions/logic.d.ts +0 -2
- package/dist/conditions/logic.js +1 -2
- package/dist/feature-previews/billing-preview.d.ts +1 -3
- package/dist/feature-previews/billing-preview.js +1 -2
- package/dist/feature-previews/contacts-preview.d.ts +1 -3
- package/dist/feature-previews/contacts-preview.js +1 -2
- package/dist/feature-previews/documents-preview.d.ts +1 -3
- package/dist/feature-previews/documents-preview.js +1 -2
- package/dist/feature-previews/format.d.ts +0 -2
- package/dist/feature-previews/format.js +1 -2
- package/dist/feature-previews/matters-preview.d.ts +1 -3
- package/dist/feature-previews/matters-preview.js +2 -3
- package/dist/feature-previews/mock-data.d.ts +1 -3
- package/dist/feature-previews/mock-data.js +1 -2
- package/dist/feature-previews/research-preview.d.ts +1 -3
- package/dist/feature-previews/research-preview.js +1 -2
- package/dist/feature-previews/surface.d.ts +0 -2
- package/dist/feature-previews/surface.js +1 -2
- package/dist/feature-previews/time-tracking-preview.d.ts +1 -3
- package/dist/feature-previews/time-tracking-preview.js +1 -2
- package/dist/field-value-logic.d.ts +25 -2
- package/dist/field-value-logic.js +36 -3
- package/dist/field-value.d.ts +7 -3
- package/dist/field-value.js +50 -12
- package/dist/formatting.d.ts +0 -2
- package/dist/formatting.js +1 -2
- package/dist/index.js +5 -5
- package/dist/kanban-grouping-picker.d.ts +1 -3
- package/dist/kanban-grouping-picker.js +1 -2
- package/dist/kanban-view.d.ts +0 -2
- package/dist/kanban-view.js +1 -2
- package/dist/property-icon.d.ts +1 -3
- package/dist/property-icon.js +6 -3
- package/dist/responsive-action-toolbar.d.ts +0 -2
- package/dist/responsive-action-toolbar.js +1 -2
- package/dist/sorts.d.ts +1 -3
- package/dist/sorts.js +1 -2
- package/dist/table-skeleton-rows.d.ts +0 -2
- package/dist/table-skeleton-rows.js +1 -2
- package/dist/task-status.d.ts +1 -3
- package/dist/task-status.js +1 -2
- package/dist/types.d.ts +49 -4
- package/dist/types.js +2 -2
- package/dist/view-switcher.d.ts +1 -3
- package/dist/view-switcher.js +1 -2
- package/dist/workspace-frame.d.ts +1 -3
- package/dist/workspace-frame.js +3 -3
- package/dist/workspace-frame.logic.d.ts +1 -3
- package/dist/workspace-frame.logic.js +1 -2
- package/package.json +5 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CalculationResult } from "@stll/calculations";
|
|
2
2
|
import { CentsAmount } from "@stll/money";
|
|
3
|
-
//#region src/calculation-format.d.ts
|
|
4
3
|
export type CalculationFormatters = {
|
|
5
4
|
number: (value: number) => string;
|
|
6
5
|
money: (amountCents: CentsAmount, currency: string) => string;
|
|
@@ -26,5 +25,4 @@ export type FormatCalculationParams = {
|
|
|
26
25
|
formatters: CalculationFormatters;
|
|
27
26
|
labels: CalculationLabels;
|
|
28
27
|
};
|
|
29
|
-
export declare const formatCalculationResult: ({ result, formatters, labels }: FormatCalculationParams) => FormattedCalculation;
|
|
30
|
-
//#endregion
|
|
28
|
+
export declare const formatCalculationResult: ({ result, formatters, labels }: FormatCalculationParams) => FormattedCalculation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { panic } from "better-result";
|
|
2
|
-
|
|
2
|
+
// src/calculation-format.ts
|
|
3
3
|
/**
|
|
4
4
|
* Turning a calculation result into the two strings a view shows: the compact
|
|
5
5
|
* line in the header, and the breakdown behind it.
|
|
@@ -30,5 +30,4 @@ const line = (kind, value) => ({
|
|
|
30
30
|
summary: `${kind} ${value}`,
|
|
31
31
|
breakdown: []
|
|
32
32
|
});
|
|
33
|
-
//#endregion
|
|
34
33
|
export { formatCalculationResult };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CalculationKind } from "@stll/calculations";
|
|
2
|
-
//#region src/calculation-selection.d.ts
|
|
3
2
|
export type CalculationSelection = {
|
|
4
3
|
propertyId: string;
|
|
5
4
|
kind: CalculationKind;
|
|
@@ -10,5 +9,4 @@ export type ApplyCalculationSelectionParams = {
|
|
|
10
9
|
/** The reduction to show, or null to stop showing one. */
|
|
11
10
|
kind: CalculationKind | null;
|
|
12
11
|
};
|
|
13
|
-
export declare const applyCalculationSelection: ({ selections, propertyId, kind }: ApplyCalculationSelectionParams) => CalculationSelection[];
|
|
14
|
-
//#endregion
|
|
12
|
+
export declare const applyCalculationSelection: ({ selections, propertyId, kind }: ApplyCalculationSelectionParams) => CalculationSelection[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/calculation-selection.ts
|
|
2
2
|
const applyCalculationSelection = ({ selections, propertyId, kind }) => {
|
|
3
3
|
if (kind === null) return selections.filter((selection) => selection.propertyId !== propertyId);
|
|
4
4
|
if (selections.some((selection) => selection.propertyId === propertyId)) return selections.map((selection) => selection.propertyId === propertyId ? {
|
|
@@ -10,5 +10,4 @@ const applyCalculationSelection = ({ selections, propertyId, kind }) => {
|
|
|
10
10
|
kind
|
|
11
11
|
}];
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { applyCalculationSelection };
|
package/dist/calculations.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { CalculationKind, CalculationResult, CalculationValue } from "@stll/calc
|
|
|
2
2
|
import { CalculationSelection } from "./calculation-selection.js";
|
|
3
3
|
import { FormattedCalculation } from "./calculation-format.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
|
-
//#region src/calculations.d.ts
|
|
6
5
|
/** A property a view can calculate over, with the reductions its values allow. */
|
|
7
6
|
export type CalculationProperty = {
|
|
8
7
|
id: string;
|
|
@@ -63,5 +62,4 @@ export type UseCalculationParams = {
|
|
|
63
62
|
export declare const useCalculation: ({ kind, labels, values, scopeValues }: UseCalculationParams) => FormattedCalculation;
|
|
64
63
|
/** One configured calculation, reduced over a column and rendered compactly. */
|
|
65
64
|
export declare const ColumnCalculation: (params: UseCalculationParams) => import("react").JSX.Element;
|
|
66
|
-
//#endregion
|
|
67
65
|
export type { CalculationResult, CalculationSelection };
|
package/dist/calculations.js
CHANGED
|
@@ -8,7 +8,7 @@ import { CheckIcon, SigmaIcon } from "@stll/ui/icons";
|
|
|
8
8
|
import { Menu, MenuItem, MenuPopup, MenuSub, MenuSubPopup, MenuSubTrigger, MenuTrigger } from "@stll/ui/menu";
|
|
9
9
|
import { Tooltip, TooltipPopup, TooltipTrigger } from "@stll/ui/tooltip";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
// src/calculations.tsx
|
|
12
12
|
/**
|
|
13
13
|
* Choose what a view calculates: a property, then a reduction. Every step is a
|
|
14
14
|
* menu item, so the whole choice is reachable from the keyboard.
|
|
@@ -106,5 +106,4 @@ const useCalculationFormatters = () => {
|
|
|
106
106
|
percent: (ratio) => format.number(ratio, { style: "percent" })
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
|
-
//#endregion
|
|
110
109
|
export { CalculationKindPicker, CalculationPicker, CalculationSummary, ColumnCalculation, useCalculation };
|
package/dist/column-sort.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/column-sort.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The vocabulary a table column's order is described in: which kind of value
|
|
4
3
|
* it orders by, and which way. The kind decides how a header names each
|
|
@@ -16,5 +15,4 @@ export type SortDirection = (typeof SORT_DIRECTIONS)[number];
|
|
|
16
15
|
*/
|
|
17
16
|
export type SortDirectionLabels = Record<ColumnSortKind, Record<SortDirection, string>>;
|
|
18
17
|
/** The direction a stored `desc` flag orders in. */
|
|
19
|
-
export declare const sortDirectionOf: (desc: boolean) => SortDirection;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare const sortDirectionOf: (desc: boolean) => SortDirection;
|
package/dist/column-sort.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/column-sort.ts
|
|
2
2
|
/**
|
|
3
3
|
* The vocabulary a table column's order is described in: which kind of value
|
|
4
4
|
* it orders by, and which way. The kind decides how a header names each
|
|
@@ -13,5 +13,4 @@ const COLUMN_SORT_KINDS = [
|
|
|
13
13
|
const SORT_DIRECTIONS = ["asc", "desc"];
|
|
14
14
|
/** The direction a stored `desc` flag orders in. */
|
|
15
15
|
const sortDirectionOf = (desc) => desc ? "desc" : "asc";
|
|
16
|
-
//#endregion
|
|
17
16
|
export { COLUMN_SORT_KINDS, SORT_DIRECTIONS, sortDirectionOf };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConditionNode, GroupNode } from "@stll/conditions";
|
|
2
2
|
import { ConditionOperator, FieldOption, FieldValueType, ValueEditorKind } from "./logic.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
//#region src/conditions/builder.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Every string the builder draws. The module resolves none of them: a host
|
|
7
6
|
* brings its own catalogue, and an exported module that reached into one would
|
|
@@ -96,9 +95,8 @@ type ConditionBuilderProps = {
|
|
|
96
95
|
onChange: (next: GroupNode) => void;
|
|
97
96
|
capabilities: ConditionCapabilities;
|
|
98
97
|
labels: ConditionBuilderLabels;
|
|
99
|
-
/** Formatting locale for the date
|
|
98
|
+
/** Formatting locale for the date and number editors. */
|
|
100
99
|
locale: string;
|
|
101
100
|
};
|
|
102
101
|
export declare const ConditionBuilder: ({ value, onChange, capabilities, labels, locale }: ConditionBuilderProps) => import("react").JSX.Element;
|
|
103
|
-
//#endregion
|
|
104
102
|
export {};
|
|
@@ -7,8 +7,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { cn } from "@stll/ui/utils";
|
|
8
8
|
import { DatePickerPopover } from "@stll/ui/date-picker-popover";
|
|
9
9
|
import { Input } from "@stll/ui/input";
|
|
10
|
+
import { NumberInput } from "@stll/ui/number-input";
|
|
10
11
|
import { Select, SelectItem, SelectPopup, SelectSeparator, SelectTrigger, SelectValue } from "@stll/ui/select";
|
|
11
|
-
|
|
12
|
+
// src/conditions/builder.tsx
|
|
12
13
|
const BuilderContext = createContext(null);
|
|
13
14
|
/**
|
|
14
15
|
* A context rather than a prop on every row because the builder is recursive:
|
|
@@ -213,7 +214,7 @@ const LeafRow = ({ node, capabilities, index, combinator, onChange, onRemove, on
|
|
|
213
214
|
}));
|
|
214
215
|
return;
|
|
215
216
|
}
|
|
216
|
-
const nextField = fields
|
|
217
|
+
const nextField = fields.find((_option, optionIndex) => String(optionIndex) === next);
|
|
217
218
|
if (nextField) onChange(leafFromField(nextField));
|
|
218
219
|
},
|
|
219
220
|
value: String(fieldIndex),
|
|
@@ -257,7 +258,6 @@ const LeafRow = ({ node, capabilities, index, combinator, onChange, onRemove, on
|
|
|
257
258
|
});
|
|
258
259
|
};
|
|
259
260
|
const FormulaLeafRow = ({ node, expr, capabilities, index, combinator, onChange, onRemove, onSetCombinator }) => {
|
|
260
|
-
const labels = useLabels();
|
|
261
261
|
const { fields, formulaNumberFields = [] } = capabilities;
|
|
262
262
|
const opsFor = capabilities.operatorsFor ?? operatorsFor;
|
|
263
263
|
const operator = leafOperator(node) ?? opsFor(FORMULA_VALUE_TYPE).at(0) ?? "eq";
|
|
@@ -300,17 +300,12 @@ const FormulaLeafRow = ({ node, expr, capabilities, index, combinator, onChange,
|
|
|
300
300
|
operator,
|
|
301
301
|
operators
|
|
302
302
|
}),
|
|
303
|
-
/* @__PURE__ */ jsx(
|
|
304
|
-
|
|
305
|
-
className: "h-7! w-24 text-xs",
|
|
306
|
-
onChange: (e) => onChange(buildLeaf({
|
|
303
|
+
/* @__PURE__ */ jsx(LeafNumberInput, {
|
|
304
|
+
onValueChange: (value) => onChange(buildLeaf({
|
|
307
305
|
operand: formulaOperand,
|
|
308
306
|
operator,
|
|
309
|
-
value
|
|
307
|
+
value
|
|
310
308
|
})),
|
|
311
|
-
placeholder: labels.valuePlaceholder,
|
|
312
|
-
size: "sm",
|
|
313
|
-
type: "number",
|
|
314
309
|
value: leafValueString(node)
|
|
315
310
|
})
|
|
316
311
|
]
|
|
@@ -319,6 +314,29 @@ const FormulaLeafRow = ({ node, expr, capabilities, index, combinator, onChange,
|
|
|
319
314
|
]
|
|
320
315
|
});
|
|
321
316
|
};
|
|
317
|
+
/** A condition stores its operand as text; an empty or unparsable one is no
|
|
318
|
+
* number yet, which the field shows as empty. */
|
|
319
|
+
const parseLeafNumber = (value) => {
|
|
320
|
+
if (value.trim() === "") return null;
|
|
321
|
+
const parsed = Number(value);
|
|
322
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
323
|
+
};
|
|
324
|
+
const LeafNumberInput = ({ onValueChange, value }) => {
|
|
325
|
+
const { labels, locale } = useBuilderContext();
|
|
326
|
+
return /* @__PURE__ */ jsx(NumberInput, {
|
|
327
|
+
className: "h-7! w-24",
|
|
328
|
+
format: { useGrouping: false },
|
|
329
|
+
inputClassName: "text-xs",
|
|
330
|
+
inputProps: {
|
|
331
|
+
"aria-label": labels.valuePlaceholder,
|
|
332
|
+
placeholder: labels.valuePlaceholder
|
|
333
|
+
},
|
|
334
|
+
locale,
|
|
335
|
+
onValueChange: (next) => onValueChange(next === null ? "" : String(next)),
|
|
336
|
+
size: "sm",
|
|
337
|
+
value: parseLeafNumber(value)
|
|
338
|
+
});
|
|
339
|
+
};
|
|
322
340
|
const OperatorSelect = ({ field, node, operator, operators, onChange }) => {
|
|
323
341
|
const labels = useLabels();
|
|
324
342
|
return /* @__PURE__ */ jsxs(Select, {
|
|
@@ -416,13 +434,8 @@ const LeafValueEditor = ({ capabilities, editorKind, field, node, operator, onCh
|
|
|
416
434
|
}, option.value))
|
|
417
435
|
})]
|
|
418
436
|
});
|
|
419
|
-
if (editorKind === "int") return /* @__PURE__ */ jsx(
|
|
420
|
-
|
|
421
|
-
className: "h-7! w-24 text-xs",
|
|
422
|
-
onChange: (e) => emit(e.currentTarget.value),
|
|
423
|
-
placeholder: labels.valuePlaceholder,
|
|
424
|
-
size: "sm",
|
|
425
|
-
type: "number",
|
|
437
|
+
if (editorKind === "int") return /* @__PURE__ */ jsx(LeafNumberInput, {
|
|
438
|
+
onValueChange: emit,
|
|
426
439
|
value: leafValueString(node)
|
|
427
440
|
});
|
|
428
441
|
if (editorKind === "date") return /* @__PURE__ */ jsx("div", {
|
|
@@ -445,5 +458,4 @@ const LeafValueEditor = ({ capabilities, editorKind, field, node, operator, onCh
|
|
|
445
458
|
value: leafValueString(node)
|
|
446
459
|
});
|
|
447
460
|
};
|
|
448
|
-
//#endregion
|
|
449
461
|
export { ConditionBuilder };
|
package/dist/conditions/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CONDITION_OPERATORS, appendChild, asGroup, buildLeaf, fieldForNode, isConditionOperator, isMultiValue, leafFromField, leafOperand, leafOperator, leafValueList, leafValueString, operandsEqual, operatorsFor, removeChild, replaceChild, valueEditorFor } from "./logic.js";
|
|
2
1
|
import { ConditionBuilder } from "./builder.js";
|
|
2
|
+
import { CONDITION_OPERATORS, appendChild, asGroup, buildLeaf, fieldForNode, isConditionOperator, isMultiValue, leafFromField, leafOperand, leafOperator, leafValueList, leafValueString, operandsEqual, operatorsFor, removeChild, replaceChild, valueEditorFor } from "./logic.js";
|
|
3
3
|
export { CONDITION_OPERATORS, ConditionBuilder, appendChild, asGroup, buildLeaf, fieldForNode, isConditionOperator, isMultiValue, leafFromField, leafOperand, leafOperator, leafValueList, leafValueString, operandsEqual, operatorsFor, removeChild, replaceChild, valueEditorFor };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ConditionNode, GroupNode, RefOperand } from "@stll/conditions";
|
|
2
2
|
import { PropertyIconType } from "../property-icon.js";
|
|
3
|
-
//#region src/conditions/logic.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Context-agnostic description of one operand the builder may filter
|
|
6
5
|
* on. `valueType` drives both the operator set (`operatorsFor`) and
|
|
@@ -66,5 +65,4 @@ export declare const asGroup: (value: ConditionNode | null) => GroupNode;
|
|
|
66
65
|
export declare const replaceChild: (group: GroupNode, index: number, child: ConditionNode) => GroupNode;
|
|
67
66
|
export declare const removeChild: (group: GroupNode, index: number) => GroupNode;
|
|
68
67
|
export declare const appendChild: (group: GroupNode, child: ConditionNode) => GroupNode;
|
|
69
|
-
//#endregion
|
|
70
68
|
export {};
|
package/dist/conditions/logic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/conditions/logic.ts
|
|
2
2
|
/**
|
|
3
3
|
* The surface operators the builder exposes. A subset maps to
|
|
4
4
|
* `compare` nodes (binary comparisons against a literal); the rest map
|
|
@@ -244,5 +244,4 @@ const appendChild = (group, child) => ({
|
|
|
244
244
|
...group,
|
|
245
245
|
children: [...group.children, child]
|
|
246
246
|
});
|
|
247
|
-
//#endregion
|
|
248
247
|
export { CONDITION_OPERATORS, appendChild, asGroup, buildLeaf, fieldForNode, isConditionOperator, isMultiValue, leafFromField, leafOperand, leafOperator, leafValueList, leafValueString, operandsEqual, operatorsFor, removeChild, replaceChild, valueEditorFor };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CentsAmount } from "@stll/money";
|
|
2
2
|
import { FeaturePreviewProps } from "./surface.js";
|
|
3
3
|
import { PreviewMatter } from "./mock-data.js";
|
|
4
|
-
//#region src/feature-previews/billing-preview.d.ts
|
|
5
4
|
export type BillingPreviewLabels = {
|
|
6
5
|
/** Column headings of the invoice's time entries: date, description,
|
|
7
6
|
* billed time ("Hours"), rate and fee ("Amount"). */
|
|
@@ -34,5 +33,4 @@ export type BillingPreviewData = {
|
|
|
34
33
|
/** An invoice draft: the matter's time entries in date order with hours,
|
|
35
34
|
* rate and amount, and the total. Amounts come from the same money helpers
|
|
36
35
|
* the app bills with. */
|
|
37
|
-
export declare const BillingPreview: ({ labels, locale, data, className }: FeaturePreviewProps<BillingPreviewLabels, BillingPreviewData>) => import("react").JSX.Element;
|
|
38
|
-
//#endregion
|
|
36
|
+
export declare const BillingPreview: ({ labels, locale, data, className }: FeaturePreviewProps<BillingPreviewLabels, BillingPreviewData>) => import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { cents, formatMoneyCents, timeEntryAmount } from "@stll/money";
|
|
|
5
5
|
import { BanknoteIcon } from "@stll/ui/icons";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { MatterIcon } from "@stll/ui/matter-icon";
|
|
8
|
-
|
|
8
|
+
// src/feature-previews/billing-preview.tsx
|
|
9
9
|
/** An invoice draft: the matter's time entries in date order with hours,
|
|
10
10
|
* rate and amount, and the total. Amounts come from the same money helpers
|
|
11
11
|
* the app bills with. */
|
|
@@ -156,5 +156,4 @@ const DEFAULT_DATA = {
|
|
|
156
156
|
}
|
|
157
157
|
]
|
|
158
158
|
};
|
|
159
|
-
//#endregion
|
|
160
159
|
export { BillingPreview };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FeaturePreviewProps } from "./surface.js";
|
|
2
2
|
import { PreviewMatter } from "./mock-data.js";
|
|
3
|
-
//#region src/feature-previews/contacts-preview.d.ts
|
|
4
3
|
export type ContactsPreviewLabels = {
|
|
5
4
|
/** Heading of the section filled from the company registry. */
|
|
6
5
|
businessRegistry: string;
|
|
@@ -31,5 +30,4 @@ export type ContactsPreviewData = {
|
|
|
31
30
|
};
|
|
32
31
|
/** A company contact filled from its business registry: legal form, status,
|
|
33
32
|
* registered details and the matters it appears in. */
|
|
34
|
-
export declare const ContactsPreview: ({ labels, locale, data: { company, linkedMatters }, className }: FeaturePreviewProps<ContactsPreviewLabels, ContactsPreviewData>) => import("react").JSX.Element;
|
|
35
|
-
//#endregion
|
|
33
|
+
export declare const ContactsPreview: ({ labels, locale, data: { company, linkedMatters }, className }: FeaturePreviewProps<ContactsPreviewLabels, ContactsPreviewData>) => import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { Building2Icon, ShieldCheckIcon } from "@stll/ui/icons";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { MatterIcon } from "@stll/ui/matter-icon";
|
|
7
7
|
import { DetailsGrid, DetailsItem } from "@stll/ui/details-grid";
|
|
8
|
-
|
|
8
|
+
// src/feature-previews/contacts-preview.tsx
|
|
9
9
|
/** A company contact filled from its business registry: legal form, status,
|
|
10
10
|
* registered details and the matters it appears in. */
|
|
11
11
|
const ContactsPreview = ({ labels, locale, data: { company, linkedMatters } = DEFAULT_DATA, className }) => /* @__PURE__ */ jsx(FeaturePreviewSurface, {
|
|
@@ -105,5 +105,4 @@ const DEFAULT_DATA = {
|
|
|
105
105
|
},
|
|
106
106
|
linkedMatters: [PREVIEW_MATTERS.cargo, PREVIEW_MATTERS.lease]
|
|
107
107
|
};
|
|
108
|
-
//#endregion
|
|
109
108
|
export { ContactsPreview };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FeaturePreviewProps } from "./surface.js";
|
|
2
2
|
import { PreviewPerson } from "./mock-data.js";
|
|
3
|
-
//#region src/feature-previews/documents-preview.d.ts
|
|
4
3
|
export type DocumentsPreviewLabels = {
|
|
5
4
|
/** Heading of the comment rail beside the page. */
|
|
6
5
|
comments: string;
|
|
@@ -40,5 +39,4 @@ export type DocumentsPreviewData = {
|
|
|
40
39
|
};
|
|
41
40
|
/** A Word document edited in place: a page with a tracked change and a
|
|
42
41
|
* commented passage, and the comment rail beside it. */
|
|
43
|
-
export declare const DocumentsPreview: ({ labels, locale, data, className }: FeaturePreviewProps<DocumentsPreviewLabels, DocumentsPreviewData>) => import("react").JSX.Element;
|
|
44
|
-
//#endregion
|
|
42
|
+
export declare const DocumentsPreview: ({ labels, locale, data, className }: FeaturePreviewProps<DocumentsPreviewLabels, DocumentsPreviewData>) => import("react").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { ReviewCommentCard } from "@stll/ui/review-comment-card";
|
|
7
7
|
import { ReviewDiffDeletion, ReviewDiffInsertion } from "@stll/ui/review-diff-text";
|
|
8
8
|
import { TextMark } from "@stll/ui/text-mark";
|
|
9
|
-
|
|
9
|
+
// src/feature-previews/documents-preview.tsx
|
|
10
10
|
/** A Word document edited in place: a page with a tracked change and a
|
|
11
11
|
* commented passage, and the comment rail beside it. */
|
|
12
12
|
const DocumentsPreview = ({ labels, locale, data = DEFAULT_DATA, className }) => /* @__PURE__ */ jsx(FeaturePreviewSurface, {
|
|
@@ -101,5 +101,4 @@ const DEFAULT_DATA = {
|
|
|
101
101
|
body: "Tie the escrow release to the claims deadline in clause 7.3."
|
|
102
102
|
}]
|
|
103
103
|
};
|
|
104
|
-
//#endregion
|
|
105
104
|
export { DocumentsPreview };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/feature-previews/format.d.ts
|
|
2
1
|
type FormatPreviewDateParams = {
|
|
3
2
|
locale: string;
|
|
4
3
|
/** `YYYY-MM-DD`. */
|
|
@@ -13,5 +12,4 @@ export declare const formatPreviewDuration: (locale: string, totalMinutes: numbe
|
|
|
13
12
|
/** Minutes as decimal hours, the way an invoice bills them. */
|
|
14
13
|
export declare const formatPreviewHours: (locale: string, totalMinutes: number) => string;
|
|
15
14
|
export declare const formatPreviewCount: (locale: string, count: number) => string;
|
|
16
|
-
//#endregion
|
|
17
15
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill/full";
|
|
2
|
-
|
|
2
|
+
// src/feature-previews/format.ts
|
|
3
3
|
const formatPreviewDate = ({ locale, date, options }) => Temporal.PlainDate.from(date).toLocaleString(locale, options);
|
|
4
4
|
/** A wall-clock time (`HH:MM`) in the locale's own hour cycle. */
|
|
5
5
|
const formatPreviewTime = (locale, time) => Temporal.PlainTime.from(time).toLocaleString(locale, {
|
|
@@ -16,5 +16,4 @@ const formatPreviewHours = (locale, totalMinutes) => new Intl.NumberFormat(local
|
|
|
16
16
|
maximumFractionDigits: 2
|
|
17
17
|
}).format(totalMinutes / 60);
|
|
18
18
|
const formatPreviewCount = (locale, count) => new Intl.NumberFormat(locale).format(count);
|
|
19
|
-
//#endregion
|
|
20
19
|
export { formatPreviewCount, formatPreviewDate, formatPreviewDuration, formatPreviewHours, formatPreviewTime };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FeaturePreviewProps } from "./surface.js";
|
|
2
2
|
import { PreviewMatter, PreviewPerson } from "./mock-data.js";
|
|
3
|
-
//#region src/feature-previews/matters-preview.d.ts
|
|
4
3
|
export type MattersPreviewLabels = {
|
|
5
4
|
/** Column names: the task statuses the board groups by. */
|
|
6
5
|
open: string;
|
|
@@ -26,5 +25,4 @@ export type MattersPreviewData = {
|
|
|
26
25
|
};
|
|
27
26
|
/** A matter's task board: three status columns of task cards with due dates,
|
|
28
27
|
* assignees and an attached document. */
|
|
29
|
-
export declare const MattersPreview: ({ labels, locale, data, className }: FeaturePreviewProps<MattersPreviewLabels, MattersPreviewData>) => import("react").JSX.Element;
|
|
30
|
-
//#endregion
|
|
28
|
+
export declare const MattersPreview: ({ labels, locale, data, className }: FeaturePreviewProps<MattersPreviewLabels, MattersPreviewData>) => import("react").JSX.Element;
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { cn } from "@stll/ui/utils";
|
|
8
8
|
import { KanbanCardShell, KanbanColumnHeader } from "@stll/ui/kanban";
|
|
9
9
|
import { MatterIcon } from "@stll/ui/matter-icon";
|
|
10
|
-
|
|
10
|
+
// src/feature-previews/matters-preview.tsx
|
|
11
11
|
/** A matter's task board: three status columns of task cards with due dates,
|
|
12
12
|
* assignees and an attached document. */
|
|
13
13
|
const MattersPreview = ({ labels, locale, data = DEFAULT_DATA, className }) => /* @__PURE__ */ jsx(FeaturePreviewSurface, {
|
|
@@ -65,7 +65,7 @@ const PreviewTaskCard = ({ task, locale }) => {
|
|
|
65
65
|
/* @__PURE__ */ jsxs("div", {
|
|
66
66
|
className: "text-muted-foreground flex min-w-0 items-center gap-1.5 leading-none",
|
|
67
67
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
68
|
-
className: "bg-muted/60 flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5 whitespace-nowrap tabular-nums",
|
|
68
|
+
className: "bg-muted/60 flex min-w-0 items-center gap-1 rounded-sm px-1.5 py-0.5 whitespace-nowrap tabular-nums",
|
|
69
69
|
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "size-3 shrink-0" }), formatPreviewDate({
|
|
70
70
|
locale,
|
|
71
71
|
date: task.due,
|
|
@@ -149,5 +149,4 @@ const DEFAULT_DATA = {
|
|
|
149
149
|
}
|
|
150
150
|
]
|
|
151
151
|
};
|
|
152
|
-
//#endregion
|
|
153
152
|
export { MattersPreview };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/feature-previews/mock-data.d.ts
|
|
2
1
|
/** A person drawn as initials (assignees, reviewers, comment authors). */
|
|
3
2
|
export type PreviewPerson = {
|
|
4
3
|
name: string;
|
|
@@ -37,5 +36,4 @@ export declare const PREVIEW_MATTERS: {
|
|
|
37
36
|
readonly color: "--option-amber";
|
|
38
37
|
readonly name: "Quayside warehouse lease";
|
|
39
38
|
};
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
39
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/feature-previews/mock-data.ts
|
|
2
2
|
const PREVIEW_PEOPLE = {
|
|
3
3
|
laura: { name: "Laura Chen" },
|
|
4
4
|
tomas: { name: "Tomás Novák" },
|
|
@@ -21,5 +21,4 @@ const PREVIEW_MATTERS = {
|
|
|
21
21
|
name: "Quayside warehouse lease"
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { PREVIEW_MATTERS, PREVIEW_PEOPLE };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { COURT_TIER_WEIGHT } from "@stll/ui/document-identity-badge.logic";
|
|
2
2
|
import { FeaturePreviewProps } from "./surface.js";
|
|
3
|
-
//#region src/feature-previews/research-preview.d.ts
|
|
4
3
|
export type ResearchPreviewLabels = {
|
|
5
4
|
/** Title of the case-law search surface. */
|
|
6
5
|
caseLaw: string;
|
|
@@ -29,5 +28,4 @@ export type ResearchPreviewData = {
|
|
|
29
28
|
};
|
|
30
29
|
/** Case-law search: a query and the decisions it found, each with its court,
|
|
31
30
|
* date, file number and the passage that matched. */
|
|
32
|
-
export declare const ResearchPreview: ({ labels, locale, data, className }: FeaturePreviewProps<ResearchPreviewLabels, ResearchPreviewData>) => import("react").JSX.Element;
|
|
33
|
-
//#endregion
|
|
31
|
+
export declare const ResearchPreview: ({ labels, locale, data, className }: FeaturePreviewProps<ResearchPreviewLabels, ResearchPreviewData>) => import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { CaseLawIcon, SearchIcon } from "@stll/ui/icons";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { SEARCH_HIT_MARK, TextMark } from "@stll/ui/text-mark";
|
|
6
6
|
import { DocumentIdentityBadge } from "@stll/ui/document-identity-badge";
|
|
7
|
-
|
|
7
|
+
// src/feature-previews/research-preview.tsx
|
|
8
8
|
/** Case-law search: a query and the decisions it found, each with its court,
|
|
9
9
|
* date, file number and the passage that matched. */
|
|
10
10
|
const ResearchPreview = ({ labels, locale, data = DEFAULT_DATA, className }) => /* @__PURE__ */ jsx(FeaturePreviewSurface, {
|
|
@@ -111,5 +111,4 @@ const DEFAULT_DATA = {
|
|
|
111
111
|
}
|
|
112
112
|
]
|
|
113
113
|
};
|
|
114
|
-
//#endregion
|
|
115
114
|
export { ResearchPreview };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PreviewPerson } from "./mock-data.js";
|
|
3
|
-
//#region src/feature-previews/surface.d.ts
|
|
4
3
|
/** Props every scene takes: its interface labels, the formatting locale for
|
|
5
4
|
* its dates and numbers, its content, and classes for the host's sizing. */
|
|
6
5
|
export type FeaturePreviewProps<Labels, Data> = {
|
|
@@ -31,5 +30,4 @@ export declare const PreviewAvatarStack: ({ people }: {
|
|
|
31
30
|
export declare const PreviewAvatar: ({ person }: {
|
|
32
31
|
person: PreviewPerson;
|
|
33
32
|
}) => React.JSX.Element;
|
|
34
|
-
//#endregion
|
|
35
33
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@stll/ui/utils";
|
|
3
3
|
import { ReviewAuthorAvatar } from "@stll/ui/review-author-avatar";
|
|
4
|
-
|
|
4
|
+
// src/feature-previews/surface.tsx
|
|
5
5
|
/**
|
|
6
6
|
* The window every scene draws in: a title row and a clipped body that fills
|
|
7
7
|
* whatever box the host gives it. Decorative, so it is hidden from assistive
|
|
@@ -38,5 +38,4 @@ const PreviewAvatar = ({ person }) => /* @__PURE__ */ jsx(ReviewAuthorAvatar, {
|
|
|
38
38
|
className: "size-5 shrink-0",
|
|
39
39
|
name: person.name
|
|
40
40
|
});
|
|
41
|
-
//#endregion
|
|
42
41
|
export { FeaturePreviewSurface, PreviewAvatar, PreviewAvatarStack };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FeaturePreviewProps } from "./surface.js";
|
|
2
2
|
import { PreviewMatter } from "./mock-data.js";
|
|
3
|
-
//#region src/feature-previews/time-tracking-preview.d.ts
|
|
4
3
|
export type TimeTrackingPreviewLabels = {
|
|
5
4
|
/** Title of the time-tracking surface. */
|
|
6
5
|
time: string;
|
|
@@ -31,5 +30,4 @@ export type TimeTrackingPreviewData = {
|
|
|
31
30
|
};
|
|
32
31
|
/** A running timer on a matter above the day's recorded entries and their
|
|
33
32
|
* total. */
|
|
34
|
-
export declare const TimeTrackingPreview: ({ labels, locale, data: { day, running, entries }, className }: FeaturePreviewProps<TimeTrackingPreviewLabels, TimeTrackingPreviewData>) => import("react").JSX.Element;
|
|
35
|
-
//#endregion
|
|
33
|
+
export declare const TimeTrackingPreview: ({ labels, locale, data: { day, running, entries }, className }: FeaturePreviewProps<TimeTrackingPreviewLabels, TimeTrackingPreviewData>) => import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { FeaturePreviewSurface } from "./surface.js";
|
|
|
4
4
|
import { ClockIcon, SquareIcon } from "@stll/ui/icons";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { MatterIcon } from "@stll/ui/matter-icon";
|
|
7
|
-
|
|
7
|
+
// src/feature-previews/time-tracking-preview.tsx
|
|
8
8
|
/** A running timer on a matter above the day's recorded entries and their
|
|
9
9
|
* total. */
|
|
10
10
|
const TimeTrackingPreview = ({ labels, locale, data: { day, running, entries } = DEFAULT_DATA, className }) => {
|
|
@@ -131,5 +131,4 @@ const DEFAULT_DATA = {
|
|
|
131
131
|
}
|
|
132
132
|
]
|
|
133
133
|
};
|
|
134
|
-
//#endregion
|
|
135
134
|
export { TimeTrackingPreview };
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import { RecordFieldState } from "./types.js";
|
|
2
2
|
export declare const getClipFieldValueLabel: ({ citation, url }: {
|
|
3
3
|
citation: string | null | undefined;
|
|
4
4
|
url: string;
|
|
5
5
|
}) => string;
|
|
6
|
-
|
|
6
|
+
/** Renders a money value; minor units are not a readable amount. */
|
|
7
|
+
export type RecordFieldMoneyFormat = (money: {
|
|
8
|
+
amountMinor: number;
|
|
9
|
+
currency: string;
|
|
10
|
+
}) => string;
|
|
11
|
+
export type RecordFieldSummary = {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "records";
|
|
16
|
+
count: number;
|
|
17
|
+
} | {
|
|
18
|
+
type: "choose";
|
|
19
|
+
count: number;
|
|
20
|
+
} | {
|
|
21
|
+
type: "needs-review";
|
|
22
|
+
} | {
|
|
23
|
+
type: "not-found";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* What a record cell shows at a glance. A candidate list nobody has chosen
|
|
27
|
+
* from asks for a choice; it never shows the first candidate as the answer.
|
|
28
|
+
*/
|
|
29
|
+
export declare const summarizeRecordField: (state: RecordFieldState, formatMoney: RecordFieldMoneyFormat) => RecordFieldSummary;
|
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { panic } from "better-result";
|
|
2
|
+
// src/field-value-logic.ts
|
|
2
3
|
const getClipFieldValueLabel = ({ citation, url }) => {
|
|
3
4
|
const trimmedCitation = citation?.trim();
|
|
4
5
|
if (trimmedCitation) return trimmedCitation;
|
|
5
6
|
return url;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
const recordText = (record, formatMoney) => Object.values(record).flatMap((value) => {
|
|
9
|
+
if (value === null) return [];
|
|
10
|
+
return [typeof value === "object" ? formatMoney(value) : String(value)];
|
|
11
|
+
}).join(" · ");
|
|
12
|
+
/**
|
|
13
|
+
* What a record cell shows at a glance. A candidate list nobody has chosen
|
|
14
|
+
* from asks for a choice; it never shows the first candidate as the answer.
|
|
15
|
+
*/
|
|
16
|
+
const summarizeRecordField = (state, formatMoney) => {
|
|
17
|
+
switch (state.status) {
|
|
18
|
+
case "input-needs-review": return { type: "needs-review" };
|
|
19
|
+
case "not-found": return { type: "not-found" };
|
|
20
|
+
case "resolved": break;
|
|
21
|
+
default: return panic("Unknown record field status");
|
|
22
|
+
}
|
|
23
|
+
const { result } = state;
|
|
24
|
+
if (result.kind === "one") return {
|
|
25
|
+
type: "text",
|
|
26
|
+
text: recordText(result.record, formatMoney)
|
|
27
|
+
};
|
|
28
|
+
const selected = result.selected === null ? void 0 : result.records.at(result.selected);
|
|
29
|
+
if (selected !== void 0) return {
|
|
30
|
+
type: "text",
|
|
31
|
+
text: recordText(selected, formatMoney)
|
|
32
|
+
};
|
|
33
|
+
return result.kind === "candidates" ? {
|
|
34
|
+
type: "choose",
|
|
35
|
+
count: result.records.length
|
|
36
|
+
} : {
|
|
37
|
+
type: "records",
|
|
38
|
+
count: result.records.length
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export { getClipFieldValueLabel, summarizeRecordField };
|
package/dist/field-value.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GenericProperty, WorkspaceFieldContent } from "./types.js";
|
|
2
2
|
import { useFormatter } from "./formatting.js";
|
|
3
|
-
//#region src/field-value.d.ts
|
|
4
3
|
export type FieldValueVariant = "default" | "table" | "kanban";
|
|
5
4
|
type PropertyContentType = GenericProperty["content"]["type"];
|
|
6
5
|
type FieldValueProps = {
|
|
@@ -10,6 +9,12 @@ type FieldValueProps = {
|
|
|
10
9
|
variant?: FieldValueVariant;
|
|
11
10
|
};
|
|
12
11
|
export declare const FieldValue: ({ content, property, pendingPreview, variant }: FieldValueProps) => import("react").JSX.Element | null;
|
|
12
|
+
export declare const RecordFieldValue: ({ content, variant }: {
|
|
13
|
+
content: Extract<WorkspaceFieldContent, {
|
|
14
|
+
type: "record";
|
|
15
|
+
}>;
|
|
16
|
+
variant: FieldValueVariant;
|
|
17
|
+
}) => import("react").JSX.Element | null;
|
|
13
18
|
export declare const IntFieldValue: ({ content, variant }: {
|
|
14
19
|
content: Extract<WorkspaceFieldContent, {
|
|
15
20
|
type: "int";
|
|
@@ -68,6 +73,5 @@ type PendingSkeletonProps = {
|
|
|
68
73
|
};
|
|
69
74
|
export declare const PendingSkeleton: ({ contentType }: PendingSkeletonProps) => import("react").JSX.Element;
|
|
70
75
|
export declare const getSelectPropertyColor: (property: GenericProperty, option: string | null) => import("@stll/ui/option-color").ColorVariants | undefined;
|
|
71
|
-
export declare const getIntClassName: (variant: FieldValueVariant) => "block max-w-full min-w-0 truncate text-start tabular-nums" | "block min-w-0 max-w-full truncate text-start text-sm tabular-nums" | "text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5 text-xs leading-none tabular-nums";
|
|
72
|
-
//#endregion
|
|
76
|
+
export declare const getIntClassName: (variant: FieldValueVariant) => "block max-w-full min-w-0 truncate text-start tabular-nums" | "block min-w-0 max-w-full truncate text-start text-sm tabular-nums" | "text-muted-foreground bg-muted/60 rounded-sm px-1.5 py-0.5 text-xs leading-none tabular-nums";
|
|
73
77
|
export {};
|