@voyantjs/products-ui 0.52.1 → 0.52.2
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/components/product-day-dialog.d.ts +8 -1
- package/dist/components/product-day-dialog.d.ts.map +1 -1
- package/dist/components/product-day-dialog.js +9 -8
- package/dist/components/product-day-service-form.d.ts.map +1 -1
- package/dist/components/product-day-service-form.js +2 -1
- package/package.json +19 -19
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProductDayRecord } from "@voyantjs/products-react";
|
|
2
|
+
import type { ProductMediaUploadHandler } from "./product-media-section.js";
|
|
2
3
|
export interface ProductDayDialogProps {
|
|
3
4
|
open: boolean;
|
|
4
5
|
onOpenChange: (open: boolean) => void;
|
|
@@ -8,6 +9,12 @@ export interface ProductDayDialogProps {
|
|
|
8
9
|
day?: ProductDayRecord;
|
|
9
10
|
nextDayNumber?: number;
|
|
10
11
|
onSuccess?: (day: ProductDayRecord) => void;
|
|
12
|
+
/**
|
|
13
|
+
* When provided, the dialog renders a media tray below the form (edit
|
|
14
|
+
* mode only — new days don't have an id yet, so there's nothing to
|
|
15
|
+
* attach media to until after first save).
|
|
16
|
+
*/
|
|
17
|
+
uploadMedia?: ProductMediaUploadHandler;
|
|
11
18
|
}
|
|
12
|
-
export declare function ProductDayDialog({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, onSuccess, }: ProductDayDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function ProductDayDialog({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, onSuccess, uploadMedia, }: ProductDayDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
13
20
|
//# sourceMappingURL=product-day-dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-day-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-day-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAahE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"product-day-dialog.d.ts","sourceRoot":"","sources":["../../src/components/product-day-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAahE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAA;CACxC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,GAAG,EACH,aAAa,EACb,SAAS,EACT,WAAW,GACZ,EAAE,qBAAqB,2CA4CvB"}
|
|
@@ -3,17 +3,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@voyantjs/ui/components/dialog";
|
|
4
4
|
import { useProductsUiMessagesOrDefault } from "../i18n/provider.js";
|
|
5
5
|
import { ProductDayForm } from "./product-day-form.js";
|
|
6
|
-
|
|
6
|
+
import { ProductDayMediaTray } from "./product-day-media-tray.js";
|
|
7
|
+
export function ProductDayDialog({ open, onOpenChange, productId, itineraryId, day, nextDayNumber, onSuccess, uploadMedia, }) {
|
|
7
8
|
const isEdit = Boolean(day);
|
|
8
9
|
const messages = useProductsUiMessagesOrDefault();
|
|
9
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "product-day-dialog", className: "sm:max-w-[640px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEdit
|
|
10
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "product-day-dialog", className: "flex max-h-[90vh] flex-col gap-4 sm:max-w-[640px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: isEdit
|
|
10
11
|
? messages.productDayDialog.titles.edit
|
|
11
12
|
: messages.productDayDialog.titles.create }), _jsx(DialogDescription, { children: isEdit
|
|
12
13
|
? messages.productDayDialog.descriptions.edit
|
|
13
|
-
: messages.productDayDialog.descriptions.create })] }), _jsx(ProductDayForm, { mode: day
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
: messages.productDayDialog.descriptions.create })] }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto", children: [_jsx(ProductDayForm, { mode: day
|
|
15
|
+
? { kind: "edit", productId, day }
|
|
16
|
+
: { kind: "create", productId, itineraryId, nextDayNumber }, onSuccess: (savedDay) => {
|
|
17
|
+
onSuccess?.(savedDay);
|
|
18
|
+
onOpenChange(false);
|
|
19
|
+
}, onCancel: () => onOpenChange(false) }), day ? (_jsx("div", { className: "border-t pt-4", children: _jsx(ProductDayMediaTray, { productId: productId, dayId: day.id, uploadMedia: uploadMedia }) })) : null] })] }) }));
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-day-service-form.d.ts","sourceRoot":"","sources":["../../src/components/product-day-service-form.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"product-day-service-form.d.ts","sourceRoot":"","sources":["../../src/components/product-day-service-form.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,0BAA0B,CAAA;AAcjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,KAAK,qBAAqB,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAA;AAEnE,KAAK,IAAI,GACL;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,uBAAuB,CAAA;CAAE,CAAA;AAExF,MAAM,WAAW,sCAAsC;IACrD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACtD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC9C,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CACnD;AAED,MAAM,WAAW,0CAA0C;IACzD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,CACR,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,MAAM,CAAC,EAAE,sCAAsC,GAAG,IAAI,KACnD,IAAI,CAAA;CACV;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,IAAI,CAAA;IACV,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACtD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,0BAA0B,CAAC,EAAE,CAC3B,KAAK,EAAE,0CAA0C,KAC9C,KAAK,CAAC,SAAS,CAAA;IACpB,yBAAyB,CAAC,EAAE,CAC1B,MAAM,EAAE,sCAAsC,EAC9C,OAAO,EAAE,4BAA4B,KAClC,IAAI,CAAA;CACV;AA6CD,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,0BAA0B,EAC1B,yBAAyB,GAC1B,EAAE,0BAA0B,2CA0R5B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useProductDayServiceMutation, } from "@voyantjs/products-react";
|
|
4
4
|
import { Button } from "@voyantjs/ui/components/button";
|
|
5
|
+
import { CurrencyCombobox } from "@voyantjs/ui/components/currency-combobox";
|
|
5
6
|
import { Input } from "@voyantjs/ui/components/input";
|
|
6
7
|
import { Label } from "@voyantjs/ui/components/label";
|
|
7
8
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyantjs/ui/components/select";
|
|
@@ -145,7 +146,7 @@ export function ProductDayServiceForm({ mode, onSuccess, onCancel, renderSupplie
|
|
|
145
146
|
value: state.supplierServiceId || null,
|
|
146
147
|
disabled: isSubmitting,
|
|
147
148
|
onChange: handleSupplierServiceChange,
|
|
148
|
-
})) : (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-supplier-service", children: serviceMessages.fields.supplierService }), _jsx(Input, { id: "product-day-service-supplier-service", value: state.supplierServiceId, onChange: (event) => handleSupplierServiceChange(event.target.value || null), placeholder: serviceMessages.placeholders.supplierService, disabled: isSubmitting })] })), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: serviceMessages.fields.serviceType }), _jsxs(Select, { value: state.serviceType, onValueChange: (value) => field("serviceType")(value), items: serviceTypes, disabled: isSubmitting, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: serviceTypes.map((type) => (_jsx(SelectItem, { value: type.value, children: type.label }, type.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-country", children: serviceMessages.fields.countryCode }), _jsx(Input, { id: "product-day-service-country", value: state.countryCode, maxLength: 2, onChange: (event) => field("countryCode")(event.target.value), placeholder: serviceMessages.placeholders.countryCode, disabled: isSubmitting })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-name", children: serviceMessages.fields.name }), _jsx(Input, { id: "product-day-service-name", value: state.name, onChange: (event) => field("name")(event.target.value), placeholder: serviceMessages.placeholders.name, required: true, disabled: isSubmitting })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-description", children: serviceMessages.fields.description }), _jsx(Textarea, { id: "product-day-service-description", value: state.description, onChange: (event) => field("description")(event.target.value), placeholder: serviceMessages.placeholders.description, disabled: isSubmitting })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-currency", children: serviceMessages.fields.costCurrency }), _jsx(
|
|
149
|
+
})) : (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-supplier-service", children: serviceMessages.fields.supplierService }), _jsx(Input, { id: "product-day-service-supplier-service", value: state.supplierServiceId, onChange: (event) => handleSupplierServiceChange(event.target.value || null), placeholder: serviceMessages.placeholders.supplierService, disabled: isSubmitting })] })), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { children: serviceMessages.fields.serviceType }), _jsxs(Select, { value: state.serviceType, onValueChange: (value) => field("serviceType")(value), items: serviceTypes, disabled: isSubmitting, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: serviceTypes.map((type) => (_jsx(SelectItem, { value: type.value, children: type.label }, type.value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-country", children: serviceMessages.fields.countryCode }), _jsx(Input, { id: "product-day-service-country", value: state.countryCode, maxLength: 2, onChange: (event) => field("countryCode")(event.target.value), placeholder: serviceMessages.placeholders.countryCode, disabled: isSubmitting })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-name", children: serviceMessages.fields.name }), _jsx(Input, { id: "product-day-service-name", value: state.name, onChange: (event) => field("name")(event.target.value), placeholder: serviceMessages.placeholders.name, required: true, disabled: isSubmitting })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-description", children: serviceMessages.fields.description }), _jsx(Textarea, { id: "product-day-service-description", value: state.description, onChange: (event) => field("description")(event.target.value), placeholder: serviceMessages.placeholders.description, disabled: isSubmitting })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-currency", children: serviceMessages.fields.costCurrency }), _jsx(CurrencyCombobox, { value: state.costCurrency || null, onChange: (next) => field("costCurrency")(next ?? ""), disabled: isSubmitting })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-cost", children: serviceMessages.fields.costAmount }), _jsx(Input, { id: "product-day-service-cost", type: "number", min: "0", step: "0.01", value: state.costAmount, onChange: (event) => field("costAmount")(event.target.value), disabled: isSubmitting })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-quantity", children: serviceMessages.fields.quantity }), _jsx(Input, { id: "product-day-service-quantity", type: "number", min: "1", value: state.quantity, onChange: (event) => field("quantity")(event.target.value), disabled: isSubmitting })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-sort", children: serviceMessages.fields.sortOrder }), _jsx(Input, { id: "product-day-service-sort", type: "number", value: state.sortOrder, onChange: (event) => field("sortOrder")(event.target.value), disabled: isSubmitting })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "product-day-service-notes", children: serviceMessages.fields.notes }), _jsx(Textarea, { id: "product-day-service-notes", value: state.notes, onChange: (event) => field("notes")(event.target.value), placeholder: serviceMessages.placeholders.notes, disabled: isSubmitting })] }), error ? _jsx("p", { className: "text-sm text-destructive", children: error }) : null, _jsxs("div", { className: "flex items-center justify-end gap-2", children: [onCancel ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onCancel, disabled: isSubmitting, children: messages.common.cancel })) : null, _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "mr-2 size-4 animate-spin", "aria-hidden": "true" })) : null, mode.kind === "create"
|
|
149
150
|
? serviceMessages.actions.addService
|
|
150
151
|
: serviceMessages.actions.saveService] })] })] }));
|
|
151
152
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/products-ui",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"react-dom": "^19.0.0",
|
|
46
46
|
"react-hook-form": "^7.60.0",
|
|
47
47
|
"zod": "^4.3.6",
|
|
48
|
-
"@voyantjs/availability-react": "0.52.
|
|
49
|
-
"@voyantjs/catalog-react": "0.52.
|
|
50
|
-
"@voyantjs/finance": "0.52.
|
|
51
|
-
"@voyantjs/finance-ui": "0.52.
|
|
52
|
-
"@voyantjs/pricing-react": "0.52.
|
|
53
|
-
"@voyantjs/products-react": "0.52.
|
|
54
|
-
"@voyantjs/suppliers-react": "0.52.
|
|
55
|
-
"@voyantjs/ui": "0.52.
|
|
48
|
+
"@voyantjs/availability-react": "0.52.2",
|
|
49
|
+
"@voyantjs/catalog-react": "0.52.2",
|
|
50
|
+
"@voyantjs/finance": "0.52.2",
|
|
51
|
+
"@voyantjs/finance-ui": "0.52.2",
|
|
52
|
+
"@voyantjs/pricing-react": "0.52.2",
|
|
53
|
+
"@voyantjs/products-react": "0.52.2",
|
|
54
|
+
"@voyantjs/suppliers-react": "0.52.2",
|
|
55
|
+
"@voyantjs/ui": "0.52.2"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@voyantjs/i18n": "0.52.
|
|
58
|
+
"@voyantjs/i18n": "0.52.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@tanstack/react-query": "^5.96.2",
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"typescript": "^6.0.2",
|
|
69
69
|
"vitest": "^4.1.2",
|
|
70
70
|
"zod": "^4.3.6",
|
|
71
|
-
"@voyantjs/availability-react": "0.52.
|
|
72
|
-
"@voyantjs/catalog-react": "0.52.
|
|
73
|
-
"@voyantjs/finance": "0.52.
|
|
74
|
-
"@voyantjs/finance-ui": "0.52.
|
|
75
|
-
"@voyantjs/i18n": "0.52.
|
|
76
|
-
"@voyantjs/pricing-react": "0.52.
|
|
77
|
-
"@voyantjs/products-react": "0.52.
|
|
78
|
-
"@voyantjs/suppliers-react": "0.52.
|
|
71
|
+
"@voyantjs/availability-react": "0.52.2",
|
|
72
|
+
"@voyantjs/catalog-react": "0.52.2",
|
|
73
|
+
"@voyantjs/finance": "0.52.2",
|
|
74
|
+
"@voyantjs/finance-ui": "0.52.2",
|
|
75
|
+
"@voyantjs/i18n": "0.52.2",
|
|
76
|
+
"@voyantjs/pricing-react": "0.52.2",
|
|
77
|
+
"@voyantjs/products-react": "0.52.2",
|
|
78
|
+
"@voyantjs/suppliers-react": "0.52.2",
|
|
79
79
|
"@voyantjs/voyant-typescript-config": "0.1.0",
|
|
80
|
-
"@voyantjs/ui": "0.52.
|
|
80
|
+
"@voyantjs/ui": "0.52.2"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"dist",
|