@vritti/quantum-ui 0.6.8 → 0.6.10
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/DangerZoneSkeleton.js +16 -2
- package/dist/DangerZoneSkeleton.js.map +1 -1
- package/dist/QuantityField.js +323 -105
- package/dist/QuantityField.js.map +1 -1
- package/dist/Spinner.js +8 -2
- package/dist/Spinner.js.map +1 -1
- package/dist/assets/quantum-ui.css +88 -0
- package/dist/components/QuantityField.js +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index13.js +2 -1
- package/dist/index13.js.map +1 -1
- package/dist/lib/components/DangerZone/DangerZone.d.ts +3 -1
- package/dist/lib/components/DangerZone/DangerZone.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/DataTablePagination.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts +3 -2
- package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/RowActions.d.ts +2 -0
- package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
- package/dist/lib/components/DataTable/hooks/useDataTable.d.ts +4 -1
- package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/index.d.ts +1 -1
- package/dist/lib/components/DataTable/index.d.ts.map +1 -1
- package/dist/lib/components/DataTable/types.d.ts +13 -1
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/DataTable/utils.d.ts +2 -2
- package/dist/lib/components/DataTable/utils.d.ts.map +1 -1
- package/dist/lib/components/QuantityField/QuantityField.d.ts +6 -1
- package/dist/lib/components/QuantityField/QuantityField.d.ts.map +1 -1
- package/dist/lib/components/QuantityField/index.d.ts +1 -1
- package/dist/lib/components/QuantityField/index.d.ts.map +1 -1
- package/dist/lib/components/QuantityField/quantity.d.ts +14 -0
- package/dist/lib/components/QuantityField/quantity.d.ts.map +1 -1
- package/dist/lib/utils/format.d.ts +4 -0
- package/dist/lib/utils/format.d.ts.map +1 -1
- package/dist/popover.js +5 -2
- package/dist/popover.js.map +1 -1
- package/dist/shadcn/shadcnPopover/index.d.ts +1 -1
- package/dist/shadcn/shadcnPopover/index.d.ts.map +1 -1
- package/dist/shadcn/shadcnPopover/popover.d.ts +2 -1
- package/dist/shadcn/shadcnPopover/popover.d.ts.map +1 -1
- package/dist/useConfirm.js +1 -26
- package/dist/useConfirm.js.map +1 -1
- package/dist/useDataTable.js +172 -27
- package/dist/useDataTable.js.map +1 -1
- package/dist/useDialog.js +28 -0
- package/dist/useDialog.js.map +1 -0
- package/dist/utils/format.js +14 -6
- package/dist/utils/format.js.map +1 -1
- package/package.json +1 -1
- package/dist/Spinner2.js +0 -10
- package/dist/Spinner2.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { u as useConfirm } from './useConfirm.js';
|
|
2
3
|
import { A as Alert } from './Alert.js';
|
|
3
4
|
import { B as Button } from './Button.js';
|
|
4
5
|
import { c as usePermission } from './PermissionGate.js';
|
|
@@ -16,8 +17,10 @@ const DangerZone = ({
|
|
|
16
17
|
isLoading,
|
|
17
18
|
warning,
|
|
18
19
|
showWarning,
|
|
19
|
-
permission
|
|
20
|
+
permission,
|
|
21
|
+
confirm
|
|
20
22
|
}) => {
|
|
23
|
+
const askConfirm = useConfirm();
|
|
21
24
|
const { granted } = usePermission(permission);
|
|
22
25
|
if (!granted) {
|
|
23
26
|
return null;
|
|
@@ -39,7 +42,18 @@ const DangerZone = ({
|
|
|
39
42
|
variant: "destructive",
|
|
40
43
|
size: "sm",
|
|
41
44
|
permission,
|
|
42
|
-
onClick
|
|
45
|
+
onClick: () => {
|
|
46
|
+
if (!confirm) return onClick();
|
|
47
|
+
void askConfirm({
|
|
48
|
+
title: `${title}?`,
|
|
49
|
+
description,
|
|
50
|
+
confirmLabel: buttonText,
|
|
51
|
+
variant: "destructive",
|
|
52
|
+
...confirm === true ? {} : confirm
|
|
53
|
+
}).then((accepted) => {
|
|
54
|
+
if (accepted) onClick();
|
|
55
|
+
});
|
|
56
|
+
},
|
|
43
57
|
disabled,
|
|
44
58
|
isLoading,
|
|
45
59
|
children: buttonText
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DangerZoneSkeleton.js","sources":["../lib/components/DangerZone/DangerZone.tsx","../lib/components/DangerZone/DangerZoneSkeleton.tsx"],"sourcesContent":["import { AlertTriangle } from 'lucide-react';\nimport { Alert } from '../Alert';\nimport { Button } from '../Button';\nimport { Card, CardContent, CardHeader, CardTitle } from '../Card';\nimport { usePermission } from '../PermissionGate';\n\nexport interface DangerZoneProps {\n title: string;\n description: string;\n buttonText: string;\n onClick: () => void;\n disabled?: boolean;\n isLoading?: boolean;\n warning?: string;\n /** When true, renders the `warning` alert below the action */\n showWarning?: boolean;\n /** Permission code gating the action: hides the whole card when not granted; the button locks (disabled) when locked */\n permission?: string;\n}\n\n// Renders a destructive-bordered card with a warning heading, description, and action button\nexport const DangerZone = ({\n title,\n description,\n buttonText,\n onClick,\n disabled,\n isLoading,\n warning,\n showWarning,\n permission,\n}: DangerZoneProps) => {\n // No provider / no code resolves to granted, so the card renders unless a role explicitly withholds delete\n const { granted } = usePermission(permission);\n if (!granted) {\n return null;\n }\n\n return (\n <Card className=\"border-destructive/50\">\n <CardHeader>\n <CardTitle className=\"text-destructive flex items-center gap-2\">\n <AlertTriangle className=\"size-4\" />\n Danger Zone\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"flex items-center justify-between gap-4\">\n <div>\n <p className=\"text-sm font-medium\">{title}</p>\n <p className=\"text-sm text-muted-foreground\">{description}</p>\n </div>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n permission={permission}\n onClick={onClick}\n disabled={disabled}\n isLoading={isLoading}\n >\n {buttonText}\n </Button>\n </div>\n {showWarning && warning && (\n <div className=\"mt-4\">\n <Alert variant=\"warning\" description={warning} />\n </div>\n )}\n </CardContent>\n </Card>\n );\n};\n\nDangerZone.displayName = 'DangerZone';\n","import type * as React from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { Skeleton } from '../Skeleton';\n\nexport interface DangerZoneSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n showWarning?: boolean;\n}\n\nexport const DangerZoneSkeleton = ({ showWarning = false, className, ...props }: DangerZoneSkeletonProps) => (\n <div className={cn('bg-card text-card-foreground rounded-xl border py-6', className)} {...props}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"px-6 flex items-center gap-2\">\n <Skeleton className=\"size-4 rounded\" />\n <Skeleton className=\"h-5 w-24\" />\n </div>\n <div className=\"px-6\">\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex flex-col gap-1\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-4 w-72\" />\n </div>\n <Skeleton className=\"h-8 w-24 rounded-md\" />\n </div>\n {showWarning && (\n <div className=\"mt-4\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n </div>\n )}\n </div>\n </div>\n </div>\n);\n\nDangerZoneSkeleton.displayName = 'DangerZoneSkeleton';\n"],"names":["AlertTriangle"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DangerZoneSkeleton.js","sources":["../lib/components/DangerZone/DangerZone.tsx","../lib/components/DangerZone/DangerZoneSkeleton.tsx"],"sourcesContent":["import { AlertTriangle } from 'lucide-react';\nimport { type ConfirmOptions, useConfirm } from '../../hooks/useConfirm';\nimport { Alert } from '../Alert';\nimport { Button } from '../Button';\nimport { Card, CardContent, CardHeader, CardTitle } from '../Card';\nimport { usePermission } from '../PermissionGate';\n\nexport interface DangerZoneProps {\n title: string;\n description: string;\n buttonText: string;\n onClick: () => void;\n disabled?: boolean;\n isLoading?: boolean;\n warning?: string;\n /** When true, renders the `warning` alert below the action */\n showWarning?: boolean;\n /** Permission code gating the action: hides the whole card when not granted; the button locks (disabled) when locked */\n permission?: string;\n // Asks before onClick runs: true reuses the card's title, description and button text in a destructive confirm, an\n // object overrides any of those\n confirm?: ConfirmOptions | boolean;\n}\n\n// Renders a destructive-bordered card with a warning heading, description, and action button\nexport const DangerZone = ({\n title,\n description,\n buttonText,\n onClick,\n disabled,\n isLoading,\n warning,\n showWarning,\n permission,\n confirm,\n}: DangerZoneProps) => {\n const askConfirm = useConfirm();\n // No provider / no code resolves to granted, so the card renders unless a role explicitly withholds delete\n const { granted } = usePermission(permission);\n if (!granted) {\n return null;\n }\n\n return (\n <Card className=\"border-destructive/50\">\n <CardHeader>\n <CardTitle className=\"text-destructive flex items-center gap-2\">\n <AlertTriangle className=\"size-4\" />\n Danger Zone\n </CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"flex items-center justify-between gap-4\">\n <div>\n <p className=\"text-sm font-medium\">{title}</p>\n <p className=\"text-sm text-muted-foreground\">{description}</p>\n </div>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n permission={permission}\n onClick={() => {\n if (!confirm) return onClick();\n void askConfirm({\n title: `${title}?`,\n description,\n confirmLabel: buttonText,\n variant: 'destructive',\n ...(confirm === true ? {} : confirm),\n }).then((accepted) => {\n if (accepted) onClick();\n });\n }}\n disabled={disabled}\n isLoading={isLoading}\n >\n {buttonText}\n </Button>\n </div>\n {showWarning && warning && (\n <div className=\"mt-4\">\n <Alert variant=\"warning\" description={warning} />\n </div>\n )}\n </CardContent>\n </Card>\n );\n};\n\nDangerZone.displayName = 'DangerZone';\n","import type * as React from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { Skeleton } from '../Skeleton';\n\nexport interface DangerZoneSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n showWarning?: boolean;\n}\n\nexport const DangerZoneSkeleton = ({ showWarning = false, className, ...props }: DangerZoneSkeletonProps) => (\n <div className={cn('bg-card text-card-foreground rounded-xl border py-6', className)} {...props}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"px-6 flex items-center gap-2\">\n <Skeleton className=\"size-4 rounded\" />\n <Skeleton className=\"h-5 w-24\" />\n </div>\n <div className=\"px-6\">\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex flex-col gap-1\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-4 w-72\" />\n </div>\n <Skeleton className=\"h-8 w-24 rounded-md\" />\n </div>\n {showWarning && (\n <div className=\"mt-4\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n </div>\n )}\n </div>\n </div>\n </div>\n);\n\nDangerZoneSkeleton.displayName = 'DangerZoneSkeleton';\n"],"names":["AlertTriangle"],"mappings":"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"}
|
package/dist/QuantityField.js
CHANGED
|
@@ -4,9 +4,11 @@ import { F as Field, e as FieldLabel, a as FieldContent, b as FieldDescription,
|
|
|
4
4
|
import { c as cn } from './utils.js';
|
|
5
5
|
import { formatNumber } from './utils/format.js';
|
|
6
6
|
import { getLocale } from './utils/locale.js';
|
|
7
|
+
import { B as Button } from './Button.js';
|
|
7
8
|
import { S as Select } from './Select.js';
|
|
8
9
|
import Decimal from './utils/decimal.js';
|
|
9
|
-
import {
|
|
10
|
+
import { P as Popover, c as PopoverAnchor, a as PopoverTrigger, b as PopoverContent } from './popover.js';
|
|
11
|
+
import { a as Spinner } from './Spinner.js';
|
|
10
12
|
import { C as ChevronDown } from './chevron-down.js';
|
|
11
13
|
|
|
12
14
|
const PRIMARY_DECIMALS = 3;
|
|
@@ -27,6 +29,86 @@ function fromPrimaryQty(primaryQty, unit) {
|
|
|
27
29
|
if (primaryQty == null || !Number.isFinite(primaryQty)) return "";
|
|
28
30
|
return new Decimal(primaryQty).times(unit.uomQty).div(unit.primaryUomQty).toDecimalPlaces(UNIT_DECIMALS).toFixed();
|
|
29
31
|
}
|
|
32
|
+
function unitSize(unit) {
|
|
33
|
+
return new Decimal(unit.primaryUomQty).div(unit.uomQty);
|
|
34
|
+
}
|
|
35
|
+
function isPackUnit(unit, primaryUnitId) {
|
|
36
|
+
return unit.id !== primaryUnitId && unit.isPack !== false;
|
|
37
|
+
}
|
|
38
|
+
function packLadder(anchor, units, primaryUnitId, cascade) {
|
|
39
|
+
const ladder = [anchor];
|
|
40
|
+
if (!cascade) return ladder;
|
|
41
|
+
const smaller = units.filter((unit) => isPackUnit(unit, primaryUnitId) && unit.id !== anchor.id).filter((unit) => unitSize(unit).lt(unitSize(anchor)) && unitSize(unit).gt(1)).sort((a, b) => unitSize(b).cmp(unitSize(a)));
|
|
42
|
+
for (const unit of smaller) {
|
|
43
|
+
if (unitSize(ladder[ladder.length - 1]).mod(unitSize(unit)).isZero())
|
|
44
|
+
ladder.push(unit);
|
|
45
|
+
}
|
|
46
|
+
return ladder;
|
|
47
|
+
}
|
|
48
|
+
function breakDownQty(primaryQty, units, anchorUnitId, primaryUnitId, cascade = false) {
|
|
49
|
+
const primary = units.find((unit) => unit.id === primaryUnitId);
|
|
50
|
+
if (!primary || !Number.isFinite(primaryQty)) return [];
|
|
51
|
+
const anchor = units.find((unit) => unit.id === anchorUnitId) ?? primary;
|
|
52
|
+
const total = new Decimal(primaryQty);
|
|
53
|
+
if (anchor.id !== primary.id && !isPackUnit(anchor, primaryUnitId)) {
|
|
54
|
+
return [{ unit: anchor, amount: total.div(unitSize(anchor)).toDecimalPlaces(PRIMARY_DECIMALS) }];
|
|
55
|
+
}
|
|
56
|
+
const pieces = [];
|
|
57
|
+
let left = total;
|
|
58
|
+
if (anchor.id !== primary.id) {
|
|
59
|
+
for (const unit of packLadder(anchor, units, primaryUnitId, cascade)) {
|
|
60
|
+
const amount = left.div(unitSize(unit)).floor();
|
|
61
|
+
pieces.push({ unit, amount });
|
|
62
|
+
left = left.minus(amount.times(unitSize(unit)));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
pieces.push({ unit: primary, amount: left.toDecimalPlaces(PRIMARY_DECIMALS) });
|
|
66
|
+
return pieces;
|
|
67
|
+
}
|
|
68
|
+
function entryUnits(units, primaryUnitId, anchorUnitId) {
|
|
69
|
+
return units.filter((unit) => unit.id === primaryUnitId || unit.id === anchorUnitId || isPackUnit(unit, primaryUnitId)).sort((a, b) => unitSize(b).cmp(unitSize(a)));
|
|
70
|
+
}
|
|
71
|
+
function takesDecimals(unit, primaryUnitId, allowDecimal) {
|
|
72
|
+
return allowDecimal && !isPackUnit(unit, primaryUnitId);
|
|
73
|
+
}
|
|
74
|
+
function toDisplayQuantity(primaryQty, units, primaryUnitId, displayUnitId, cascade = false) {
|
|
75
|
+
const primary = units.find((unit) => unit.id === primaryUnitId);
|
|
76
|
+
if (!primary || !Number.isFinite(primaryQty)) return null;
|
|
77
|
+
const display = units.find((unit) => unit.id === displayUnitId) ?? primary;
|
|
78
|
+
const size = unitSize(display);
|
|
79
|
+
const total = new Decimal(primaryQty);
|
|
80
|
+
const whole = total.div(size).trunc();
|
|
81
|
+
const isPack = isPackUnit(display, primaryUnitId);
|
|
82
|
+
const breakdown = isPack && primaryQty >= 0 ? breakDownQty(primaryQty, units, display.id, primaryUnitId, cascade).filter((piece) => !piece.amount.isZero()).map((piece) => ({ qty: piece.amount.toNumber(), symbol: piece.unit.symbol })) : [];
|
|
83
|
+
return {
|
|
84
|
+
primaryUomQty: primaryQty,
|
|
85
|
+
displayUomQty: total.div(size).toDecimalPlaces(PRIMARY_DECIMALS).toNumber(),
|
|
86
|
+
wholeDisplayUomQty: whole.toNumber(),
|
|
87
|
+
remainderPrimaryUomQty: total.minus(whole.times(size)).toDecimalPlaces(PRIMARY_DECIMALS).toNumber(),
|
|
88
|
+
displayUomSymbol: display.symbol,
|
|
89
|
+
primaryUomSymbol: primary.symbol,
|
|
90
|
+
isPack,
|
|
91
|
+
breakdown
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function sumParts(parts, units) {
|
|
95
|
+
let total = null;
|
|
96
|
+
for (const unit of units) {
|
|
97
|
+
const amount = parseAmount(parts[unit.id] ?? "");
|
|
98
|
+
if (amount) total = (total ?? new Decimal(0)).plus(amount.times(unitSize(unit)));
|
|
99
|
+
}
|
|
100
|
+
return total?.toDecimalPlaces(PRIMARY_DECIMALS).toNumber();
|
|
101
|
+
}
|
|
102
|
+
function partsOfQty(primaryQty, units, anchorUnitId, primaryUnitId, cascade = false) {
|
|
103
|
+
if (primaryQty == null) return {};
|
|
104
|
+
const anchor = units.find((unit) => unit.id === anchorUnitId);
|
|
105
|
+
const enteredIn = anchor && isPackUnit(anchor, primaryUnitId) ? anchorUnitId : primaryUnitId;
|
|
106
|
+
const parts = breakDownQty(primaryQty, units, enteredIn, primaryUnitId, cascade).filter(
|
|
107
|
+
(piece) => !piece.amount.isZero()
|
|
108
|
+
);
|
|
109
|
+
if (parts.length === 0) return { [enteredIn]: "0" };
|
|
110
|
+
return Object.fromEntries(parts.map((piece) => [piece.unit.id, piece.amount.toFixed()]));
|
|
111
|
+
}
|
|
30
112
|
function quantityPlaceholder(primaryQty) {
|
|
31
113
|
return `{{qty:${primaryQty}}}`;
|
|
32
114
|
}
|
|
@@ -37,7 +119,9 @@ function resolveQuantityMessage(message, unit, primaryUnit, formatNumber) {
|
|
|
37
119
|
).split(PRIMARY_UNIT_PLACEHOLDER).join(primaryUnit.symbol);
|
|
38
120
|
}
|
|
39
121
|
|
|
40
|
-
const
|
|
122
|
+
const WHOLE_PATTERN = /^\d*$/;
|
|
123
|
+
const DECIMAL_PATTERN = /^\d*\.?\d{0,3}$/;
|
|
124
|
+
const DIGIT_KEY = /^\d$/;
|
|
41
125
|
function formatAmount(value) {
|
|
42
126
|
return String(formatNumber(value, { localeTag: getLocale() ?? "en-US" }).primary);
|
|
43
127
|
}
|
|
@@ -46,13 +130,18 @@ const QuantityField = React__default.forwardRef(
|
|
|
46
130
|
units,
|
|
47
131
|
primaryUnitId,
|
|
48
132
|
defaultUnitId,
|
|
133
|
+
anchorUnitId,
|
|
134
|
+
onAnchorUnitChange,
|
|
135
|
+
allowDecimal = false,
|
|
136
|
+
cascade = false,
|
|
137
|
+
compact,
|
|
49
138
|
value,
|
|
50
139
|
onChange,
|
|
51
140
|
onBlur,
|
|
52
141
|
nullable,
|
|
53
142
|
label,
|
|
54
143
|
description,
|
|
55
|
-
placeholder,
|
|
144
|
+
placeholder = "Qty",
|
|
56
145
|
error,
|
|
57
146
|
disabled,
|
|
58
147
|
required,
|
|
@@ -61,122 +150,251 @@ const QuantityField = React__default.forwardRef(
|
|
|
61
150
|
}, ref) => {
|
|
62
151
|
const fieldId = React__default.useId();
|
|
63
152
|
const [pickedUnitId, setPickedUnitId] = React__default.useState();
|
|
64
|
-
const [
|
|
153
|
+
const [parts, setParts] = React__default.useState({});
|
|
154
|
+
const [open, setOpen] = React__default.useState(false);
|
|
65
155
|
const shown = React__default.useRef(null);
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
156
|
+
const focusTarget = React__default.useRef(null);
|
|
157
|
+
const rowInputs = React__default.useRef(/* @__PURE__ */ new Map());
|
|
158
|
+
React__default.useImperativeHandle(ref, () => focusTarget.current);
|
|
159
|
+
const primaryUnit = units.find((unit) => unit.id === primaryUnitId);
|
|
160
|
+
const anchor = units.find((unit) => unit.id === (anchorUnitId ?? pickedUnitId)) ?? units.find((unit) => unit.id === defaultUnitId) ?? primaryUnit;
|
|
161
|
+
const singleUnit = units.length === 1 && !!primaryUnit;
|
|
162
|
+
const isDisabled = !!disabled || !!loading || !anchor;
|
|
69
163
|
const options = React__default.useMemo(
|
|
70
|
-
() => units.map((
|
|
164
|
+
() => [...units].sort((a, b) => unitSize(b).cmp(unitSize(a))).map((unit) => ({ value: unit.id, label: unit.symbol, description: unit.name })),
|
|
71
165
|
[units]
|
|
72
166
|
);
|
|
167
|
+
const ladder = React__default.useMemo(() => entryUnits(units, primaryUnitId, anchor?.id), [units, primaryUnitId, anchor]);
|
|
73
168
|
React__default.useEffect(() => {
|
|
74
|
-
if (!
|
|
169
|
+
if (!primaryUnit || !anchor) return;
|
|
75
170
|
const qty = value ?? void 0;
|
|
76
|
-
if (shown.current && shown.current.qty === qty
|
|
77
|
-
shown.current = { qty
|
|
78
|
-
|
|
79
|
-
}, [value,
|
|
80
|
-
const
|
|
81
|
-
|
|
171
|
+
if (shown.current && shown.current.qty === qty) return;
|
|
172
|
+
shown.current = { qty };
|
|
173
|
+
setParts(partsOfQty(qty, units, anchor.id, primaryUnit.id, cascade));
|
|
174
|
+
}, [value, units, anchor, primaryUnit, cascade]);
|
|
175
|
+
const commit = (next) => {
|
|
176
|
+
setParts(next);
|
|
177
|
+
const qty = sumParts(next, units);
|
|
82
178
|
const previous = shown.current?.qty;
|
|
83
|
-
shown.current = { qty
|
|
179
|
+
shown.current = { qty };
|
|
84
180
|
if (qty !== previous) onChange?.(qty === void 0 && nullable ? null : qty);
|
|
85
181
|
};
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
182
|
+
const enter = (unit, text) => {
|
|
183
|
+
const pattern = takesDecimals(unit, primaryUnitId, allowDecimal) ? DECIMAL_PATTERN : WHOLE_PATTERN;
|
|
184
|
+
if (!pattern.test(text)) return;
|
|
185
|
+
commit({ ...parts, [unit.id]: text });
|
|
186
|
+
};
|
|
187
|
+
const handleAnchorChange = (next) => {
|
|
188
|
+
const unit = units.find((option) => option.id === next);
|
|
189
|
+
if (!unit) return;
|
|
190
|
+
setPickedUnitId(unit.id);
|
|
191
|
+
onAnchorUnitChange?.(unit.id);
|
|
192
|
+
};
|
|
193
|
+
const focusRow = (unitId) => {
|
|
194
|
+
const input = unitId ? rowInputs.current.get(unitId) : void 0;
|
|
195
|
+
if (!input) return;
|
|
196
|
+
input.focus();
|
|
197
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
198
|
+
};
|
|
199
|
+
const handleOpenChange = (next) => {
|
|
200
|
+
setOpen(next);
|
|
201
|
+
if (!next) onBlur?.();
|
|
90
202
|
};
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
203
|
+
const handleReadingKeyDown = (event) => {
|
|
204
|
+
if (!anchor) return;
|
|
205
|
+
if (DIGIT_KEY.test(event.key)) {
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
const typed = Object.values(parts).filter((amount) => amount !== "" && Number(amount) !== 0).length;
|
|
208
|
+
if (typed <= 1) commit({ [anchor.id]: event.key });
|
|
209
|
+
setOpen(true);
|
|
210
|
+
} else if (event.key === "ArrowDown") {
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
setOpen(true);
|
|
213
|
+
}
|
|
96
214
|
};
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
215
|
+
const handleRowKeyDown = (event, index) => {
|
|
216
|
+
if (event.key !== "Enter" && event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
const next = ladder[index + (event.key === "ArrowUp" ? -1 : 1)];
|
|
219
|
+
if (next) focusRow(next.id);
|
|
220
|
+
else if (event.key === "Enter") handleOpenChange(false);
|
|
221
|
+
};
|
|
222
|
+
const total = sumParts(parts, units);
|
|
223
|
+
const pieces = total === void 0 || !anchor || !primaryUnit ? [] : breakDownQty(total, units, anchor.id, primaryUnit.id, cascade);
|
|
224
|
+
const shownPieces = pieces.filter((piece) => !piece.amount.isZero());
|
|
225
|
+
const reading = total === void 0 || !anchor ? null : shownPieces.length === 0 ? `0 ${anchor.symbol}` : shownPieces.map((piece) => `${formatAmount(piece.amount.toNumber())} ${piece.unit.symbol}`).join(compact ? " " : " + ");
|
|
226
|
+
const message = error && anchor && primaryUnit ? resolveQuantityMessage(error, anchor, primaryUnit, formatAmount) : error;
|
|
227
|
+
const describedBy = [description && !message && `${fieldId}-description`, message && `${fieldId}-error`].filter(Boolean).join(" ") || void 0;
|
|
228
|
+
const boxClass = cn(
|
|
229
|
+
"flex h-9 w-full items-stretch rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] dark:bg-input/30",
|
|
230
|
+
"focus-within:border-ring focus-within:ring-1 focus-within:ring-ring/50",
|
|
231
|
+
open && "border-ring ring-1 ring-ring/50",
|
|
232
|
+
isDisabled && "cursor-not-allowed opacity-50",
|
|
233
|
+
message && "border-destructive focus-within:ring-destructive/20 dark:focus-within:ring-destructive/40",
|
|
234
|
+
className
|
|
235
|
+
);
|
|
104
236
|
return /* @__PURE__ */ jsxs(Field, { "data-disabled": isDisabled, children: [
|
|
105
237
|
label && /* @__PURE__ */ jsx(FieldLabel, { htmlFor: fieldId, children: label }),
|
|
106
238
|
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
107
|
-
/* @__PURE__ */ jsxs(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
239
|
+
singleUnit ? /* @__PURE__ */ jsxs("div", { className: boxClass, children: [
|
|
240
|
+
/* @__PURE__ */ jsx(
|
|
241
|
+
"input",
|
|
242
|
+
{
|
|
243
|
+
ref: (node) => {
|
|
244
|
+
focusTarget.current = node;
|
|
245
|
+
},
|
|
246
|
+
id: fieldId,
|
|
247
|
+
type: "text",
|
|
248
|
+
inputMode: allowDecimal ? "decimal" : "numeric",
|
|
249
|
+
autoComplete: "off",
|
|
250
|
+
value: parts[primaryUnit.id] ?? "",
|
|
251
|
+
onChange: (event) => enter(primaryUnit, event.target.value),
|
|
252
|
+
onBlur,
|
|
253
|
+
disabled: isDisabled,
|
|
254
|
+
required,
|
|
255
|
+
placeholder,
|
|
256
|
+
"aria-invalid": !!message,
|
|
257
|
+
"aria-describedby": describedBy,
|
|
258
|
+
className: cn(
|
|
259
|
+
"min-w-0 flex-1 bg-transparent py-1 text-sm tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
|
|
260
|
+
compact ? "px-2.5" : "px-3"
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
"span",
|
|
266
|
+
{
|
|
267
|
+
className: cn(
|
|
268
|
+
"flex shrink-0 items-center rounded-r-md border-l border-input bg-muted/60 text-sm font-medium text-muted-foreground",
|
|
269
|
+
compact ? "px-2" : "px-3"
|
|
137
270
|
),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
271
|
+
children: primaryUnit.symbol
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
] }) : /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
275
|
+
/* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: boxClass, children: [
|
|
276
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
277
|
+
"button",
|
|
278
|
+
{
|
|
279
|
+
ref: (node) => {
|
|
280
|
+
focusTarget.current = node;
|
|
281
|
+
},
|
|
282
|
+
id: fieldId,
|
|
283
|
+
type: "button",
|
|
284
|
+
disabled: isDisabled,
|
|
285
|
+
title: reading ?? void 0,
|
|
286
|
+
onKeyDown: handleReadingKeyDown,
|
|
287
|
+
"aria-invalid": !!message,
|
|
288
|
+
"aria-busy": loading || void 0,
|
|
289
|
+
"aria-describedby": describedBy,
|
|
290
|
+
className: cn(
|
|
291
|
+
"flex min-w-0 flex-1 items-center rounded-l-md text-left text-sm tabular-nums outline-none disabled:cursor-not-allowed",
|
|
292
|
+
compact ? "px-2.5" : "px-3"
|
|
293
|
+
),
|
|
294
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("min-w-0 truncate", !reading && "text-muted-foreground"), children: reading ?? placeholder })
|
|
295
|
+
}
|
|
296
|
+
) }),
|
|
297
|
+
/* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-stretch border-l border-input", children: /* @__PURE__ */ jsx(
|
|
298
|
+
Select,
|
|
299
|
+
{
|
|
300
|
+
options,
|
|
301
|
+
value: anchor?.id ?? null,
|
|
302
|
+
onChange: handleAnchorChange,
|
|
303
|
+
disabled: isDisabled,
|
|
304
|
+
clearable: false,
|
|
305
|
+
label: "",
|
|
306
|
+
contentClassName: "min-w-40",
|
|
307
|
+
anchor: ({ selectedOption, open: unitsOpen, disabled: anchorDisabled }) => /* @__PURE__ */ jsxs(
|
|
308
|
+
"button",
|
|
309
|
+
{
|
|
310
|
+
type: "button",
|
|
311
|
+
disabled: anchorDisabled,
|
|
312
|
+
"aria-label": "Read the quantity in",
|
|
313
|
+
"aria-expanded": unitsOpen,
|
|
314
|
+
className: cn(
|
|
315
|
+
"flex h-full items-center gap-1 rounded-r-md text-sm font-medium text-foreground outline-none hover:bg-accent/50 focus-visible:bg-accent/50 disabled:cursor-not-allowed",
|
|
316
|
+
compact ? "px-2" : "px-3"
|
|
317
|
+
),
|
|
318
|
+
children: [
|
|
319
|
+
loading ? /* @__PURE__ */ jsx(Spinner, { className: "size-3.5 text-muted-foreground" }) : /* @__PURE__ */ jsx("span", { className: "truncate", children: selectedOption?.label ?? anchor?.symbol ?? "—" }),
|
|
320
|
+
/* @__PURE__ */ jsx(
|
|
321
|
+
ChevronDown,
|
|
322
|
+
{
|
|
323
|
+
className: cn(
|
|
324
|
+
"size-3.5 shrink-0 text-muted-foreground transition-transform",
|
|
325
|
+
unitsOpen && "rotate-180"
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
) })
|
|
334
|
+
] }) }),
|
|
335
|
+
/* @__PURE__ */ jsxs(
|
|
336
|
+
PopoverContent,
|
|
337
|
+
{
|
|
338
|
+
align: "start",
|
|
339
|
+
className: "w-72 p-3",
|
|
340
|
+
"aria-label": "Quantity by unit",
|
|
341
|
+
onOpenAutoFocus: (event) => {
|
|
342
|
+
event.preventDefault();
|
|
343
|
+
focusRow(anchor?.id);
|
|
344
|
+
},
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium tracking-wider text-muted-foreground uppercase", children: "Quantity by unit" }),
|
|
347
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1.5", children: ladder.map((unit, index) => {
|
|
348
|
+
const decimal = takesDecimals(unit, primaryUnitId, allowDecimal);
|
|
349
|
+
const size = unitSize(unit);
|
|
350
|
+
return /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
351
|
+
/* @__PURE__ */ jsx("span", { className: "w-14 truncate text-sm font-medium", children: unit.symbol }),
|
|
352
|
+
/* @__PURE__ */ jsx(
|
|
353
|
+
"input",
|
|
354
|
+
{
|
|
355
|
+
ref: (node) => {
|
|
356
|
+
if (node) rowInputs.current.set(unit.id, node);
|
|
357
|
+
else rowInputs.current.delete(unit.id);
|
|
358
|
+
},
|
|
359
|
+
type: "text",
|
|
360
|
+
inputMode: decimal ? "decimal" : "numeric",
|
|
361
|
+
autoComplete: "off",
|
|
362
|
+
value: parts[unit.id] ?? "",
|
|
363
|
+
placeholder: "0",
|
|
364
|
+
onChange: (event) => enter(unit, event.target.value),
|
|
365
|
+
onKeyDown: (event) => handleRowKeyDown(event, index),
|
|
366
|
+
className: "h-8 min-w-0 flex-1 rounded-md border border-input bg-transparent px-2 text-sm tabular-nums shadow-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30"
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ jsx("span", { className: "w-20 shrink-0 truncate text-right text-xs text-muted-foreground tabular-nums", children: unit.id === primaryUnitId || !primaryUnit ? "" : `×${formatAmount(size.toNumber())} ${primaryUnit.symbol}` })
|
|
370
|
+
] }, unit.id);
|
|
371
|
+
}) }),
|
|
372
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between border-t pt-2.5", children: [
|
|
373
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm tabular-nums", children: [
|
|
374
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "=" }),
|
|
375
|
+
" ",
|
|
376
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: total === void 0 || !primaryUnit ? "—" : `${formatAmount(total)} ${primaryUnit.symbol}` })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", children: [
|
|
379
|
+
/* @__PURE__ */ jsx(
|
|
380
|
+
Button,
|
|
381
|
+
{
|
|
382
|
+
type: "button",
|
|
383
|
+
variant: "ghost",
|
|
384
|
+
size: "xs",
|
|
385
|
+
onClick: () => {
|
|
386
|
+
commit({});
|
|
387
|
+
focusRow(anchor?.id);
|
|
388
|
+
},
|
|
389
|
+
children: "Clear"
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "xs", onClick: () => handleOpenChange(false), children: "Done" })
|
|
393
|
+
] })
|
|
394
|
+
] })
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
)
|
|
180
398
|
] }),
|
|
181
399
|
description && !message && /* @__PURE__ */ jsx(FieldDescription, { id: `${fieldId}-description`, children: description }),
|
|
182
400
|
message && /* @__PURE__ */ jsx(FieldError, { id: `${fieldId}-error`, children: message })
|
|
@@ -186,5 +404,5 @@ const QuantityField = React__default.forwardRef(
|
|
|
186
404
|
);
|
|
187
405
|
QuantityField.displayName = "QuantityField";
|
|
188
406
|
|
|
189
|
-
export { PRIMARY_UNIT_PLACEHOLDER as P, QuantityField as Q, fromPrimaryQty as f, quantityPlaceholder as q, resolveQuantityMessage as r,
|
|
407
|
+
export { PRIMARY_UNIT_PLACEHOLDER as P, QuantityField as Q, toDisplayQuantity as a, breakDownQty as b, toPrimaryQty as c, entryUnits as e, fromPrimaryQty as f, partsOfQty as p, quantityPlaceholder as q, resolveQuantityMessage as r, sumParts as s, takesDecimals as t, unitSize as u };
|
|
190
408
|
//# sourceMappingURL=QuantityField.js.map
|