@voyantjs/suppliers-ui 0.32.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,10 @@ pnpm add @voyantjs/suppliers-ui @voyantjs/suppliers-react @voyantjs/ui @tanstack
12
12
 
13
13
  All components accept a `className` prop and merge it with `cn()`. Wrap or compose to extend; use the registry copy-paste path (`npx shadcn add @voyant/...`) for components you want to fork outright.
14
14
 
15
+ Page components render with `p-6` outer padding by default and are intended to
16
+ mount directly into an app route outlet. Pass `className` to extend or override
17
+ that spacing when a shell owns the page chrome.
18
+
15
19
  ## I18n
16
20
 
17
21
  Components render English by default. To localize them, wrap your UI in
@@ -1 +1 @@
1
- {"version":3,"file":"rate-dialog.d.ts","sourceRoot":"","sources":["../../src/components/rate-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,YAAY,EAA2B,MAAM,2BAA2B,CAAA;AAwClG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;CACzC,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE,eAAe,2CAsJjB"}
1
+ {"version":3,"file":"rate-dialog.d.ts","sourceRoot":"","sources":["../../src/components/rate-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,YAAY,EAA2B,MAAM,2BAA2B,CAAA;AAyClG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;CACzC,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE,eAAe,2CAsKjB"}
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { RATE_UNITS, useSupplierRateMutation } from "@voyantjs/suppliers-react";
4
4
  import { Button, Dialog, DialogBody, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea, } from "@voyantjs/ui/components";
5
+ import { DatePicker } from "@voyantjs/ui/components/date-picker";
5
6
  import { zodResolver } from "@voyantjs/ui/lib/zod-resolver";
6
7
  import { Loader2 } from "lucide-react";
7
8
  import * as React from "react";
@@ -75,7 +76,13 @@ export function RateDialog({ open, onOpenChange, supplierId, serviceId, rate, on
75
76
  onSuccess?.(saved);
76
77
  onOpenChange(false);
77
78
  }
78
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? dialog.editTitle : dialog.newTitle }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsx(Field, { label: dialog.seasonNameLabel, error: form.formState.errors.name?.message, children: _jsx(Input, { ...form.register("name"), placeholder: dialog.seasonNamePlaceholder }) }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-3", children: [_jsx(Field, { label: dialog.currencyLabel, error: form.formState.errors.currency?.message, children: _jsx(Input, { ...form.register("currency"), maxLength: 3, placeholder: dialog.currencyPlaceholder, className: "uppercase" }) }), _jsx(Field, { label: dialog.amountLabel, error: form.formState.errors.amount?.message, children: _jsx(Input, { ...form.register("amount"), type: "number", min: "0", step: "0.01", placeholder: dialog.amountPlaceholder }) }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: dialog.unitLabel }), _jsxs(Select, { value: form.watch("unit"), onValueChange: (value) => form.setValue("unit", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: RATE_UNITS.map((unit) => (_jsx(SelectItem, { value: unit.value, children: messages.common.rateUnitLabels[unit.value] }, unit.value))) })] })] })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsx(Field, { label: dialog.validFromLabel, children: _jsx(Input, { ...form.register("validFrom"), type: "date" }) }), _jsx(Field, { label: dialog.validToLabel, children: _jsx(Input, { ...form.register("validTo"), type: "date" }) })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsx(Field, { label: dialog.minPaxLabel, children: _jsx(Input, { ...form.register("minPax"), type: "number", min: "1", placeholder: dialog.minPaxPlaceholder }) }), _jsx(Field, { label: dialog.maxPaxLabel, children: _jsx(Input, { ...form.register("maxPax"), type: "number", min: "1", placeholder: dialog.maxPaxPlaceholder }) })] }), _jsx(Field, { label: dialog.notesLabel, children: _jsx(Textarea, { ...form.register("notes"), placeholder: dialog.notesPlaceholder }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: form.formState.isSubmitting, children: [form.formState.isSubmitting && _jsx(Loader2, { className: "animate-spin" }), isEditing ? messages.common.save : messages.common.create] })] })] })] }) }));
79
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: isEditing ? dialog.editTitle : dialog.newTitle }) }), _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(DialogBody, { className: "grid gap-4", children: [_jsx(Field, { label: dialog.seasonNameLabel, error: form.formState.errors.name?.message, children: _jsx(Input, { ...form.register("name"), placeholder: dialog.seasonNamePlaceholder }) }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-3", children: [_jsx(Field, { label: dialog.currencyLabel, error: form.formState.errors.currency?.message, children: _jsx(Input, { ...form.register("currency"), maxLength: 3, placeholder: dialog.currencyPlaceholder, className: "uppercase" }) }), _jsx(Field, { label: dialog.amountLabel, error: form.formState.errors.amount?.message, children: _jsx(Input, { ...form.register("amount"), type: "number", min: "0", step: "0.01", placeholder: dialog.amountPlaceholder }) }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: dialog.unitLabel }), _jsxs(Select, { value: form.watch("unit"), onValueChange: (value) => form.setValue("unit", value), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: RATE_UNITS.map((unit) => (_jsx(SelectItem, { value: unit.value, children: messages.common.rateUnitLabels[unit.value] }, unit.value))) })] })] })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsx(Field, { label: dialog.validFromLabel, children: _jsx(DatePicker, { value: form.watch("validFrom") || null, onChange: (nextValue) => form.setValue("validFrom", nextValue ?? "", {
80
+ shouldDirty: true,
81
+ shouldValidate: true,
82
+ }) }) }), _jsx(Field, { label: dialog.validToLabel, children: _jsx(DatePicker, { value: form.watch("validTo") || null, onChange: (nextValue) => form.setValue("validTo", nextValue ?? "", {
83
+ shouldDirty: true,
84
+ shouldValidate: true,
85
+ }) }) })] }), _jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [_jsx(Field, { label: dialog.minPaxLabel, children: _jsx(Input, { ...form.register("minPax"), type: "number", min: "1", placeholder: dialog.minPaxPlaceholder }) }), _jsx(Field, { label: dialog.maxPaxLabel, children: _jsx(Input, { ...form.register("maxPax"), type: "number", min: "1", placeholder: dialog.maxPaxPlaceholder }) })] }), _jsx(Field, { label: dialog.notesLabel, children: _jsx(Textarea, { ...form.register("notes"), placeholder: dialog.notesPlaceholder }) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: messages.common.cancel }), _jsxs(Button, { type: "submit", disabled: form.formState.isSubmitting, children: [form.formState.isSubmitting && _jsx(Loader2, { className: "animate-spin" }), isEditing ? messages.common.save : messages.common.create] })] })] })] }) }));
79
86
  }
80
87
  function Field({ label, error, children, }) {
81
88
  return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: label }), children, error && _jsx("p", { className: "text-xs text-destructive", children: error })] }));
@@ -6,11 +6,12 @@ export type SupplierDetailPageProps = {
6
6
  onBack?: () => void;
7
7
  onDeleted?: () => void;
8
8
  confirmAction?: (message: string) => boolean;
9
+ className?: string;
9
10
  renderCustomerPaymentPolicy?: (args: {
10
11
  supplier: Supplier;
11
12
  updateSupplier: (input: UpdateSupplierInput) => Promise<Supplier>;
12
13
  isUpdating: boolean;
13
14
  }) => React.ReactNode;
14
15
  };
15
- export declare function SupplierDetailPage({ id, locale, onBack, onDeleted, confirmAction, renderCustomerPaymentPolicy, }: SupplierDetailPageProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function SupplierDetailPage({ id, locale, onBack, onDeleted, confirmAction, className, renderCustomerPaymentPolicy, }: SupplierDetailPageProps): import("react/jsx-runtime").JSX.Element;
16
17
  //# sourceMappingURL=supplier-detail-page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"supplier-detail-page.d.ts","sourceRoot":"","sources":["../../src/components/supplier-detail-page.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EAIb,KAAK,mBAAmB,EAQzB,MAAM,2BAA2B,CAAA;AAWlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;IAC5C,2BAA2B,CAAC,EAAE,CAAC,IAAI,EAAE;QACnC,QAAQ,EAAE,QAAQ,CAAA;QAClB,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QACjE,UAAU,EAAE,OAAO,CAAA;KACpB,KAAK,KAAK,CAAC,SAAS,CAAA;CACtB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,MAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAkE,EAClE,2BAA2B,GAC5B,EAAE,uBAAuB,2CAmSzB"}
1
+ {"version":3,"file":"supplier-detail-page.d.ts","sourceRoot":"","sources":["../../src/components/supplier-detail-page.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EAIb,KAAK,mBAAmB,EAQzB,MAAM,2BAA2B,CAAA;AAYlC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2BAA2B,CAAC,EAAE,CAAC,IAAI,EAAE;QACnC,QAAQ,EAAE,QAAQ,CAAA;QAClB,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QACjE,UAAU,EAAE,OAAO,CAAA;KACpB,KAAK,KAAK,CAAC,SAAS,CAAA;CACtB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,MAAgB,EAChB,MAAM,EACN,SAAS,EACT,aAAkE,EAClE,SAAS,EACT,2BAA2B,GAC5B,EAAE,uBAAuB,2CA6SzB"}
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { statusVariant, useSupplier, useSupplierMutation, useSupplierNoteMutation, useSupplierNotes, useSupplierRateMutation, useSupplierServiceMutation, useSupplierServices, } from "@voyantjs/suppliers-react";
4
4
  import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Textarea, } from "@voyantjs/ui/components";
5
+ import { cn } from "@voyantjs/ui/lib/utils";
5
6
  import { ArrowLeft, Loader2, Pencil, Plus, Trash2 } from "lucide-react";
6
7
  import * as React from "react";
7
8
  import { useSuppliersUiMessagesOrDefault } from "../i18n/index.js";
@@ -9,7 +10,7 @@ import { RateDialog } from "./rate-dialog.js";
9
10
  import { ServiceDialog } from "./service-dialog.js";
10
11
  import { SupplierDialog } from "./supplier-dialog.js";
11
12
  import { SupplierServiceRow } from "./supplier-service-row.js";
12
- export function SupplierDetailPage({ id, locale = "en-US", onBack, onDeleted, confirmAction = (message) => globalThis.confirm?.(message) ?? true, renderCustomerPaymentPolicy, }) {
13
+ export function SupplierDetailPage({ id, locale = "en-US", onBack, onDeleted, confirmAction = (message) => globalThis.confirm?.(message) ?? true, className, renderCustomerPaymentPolicy, }) {
13
14
  const messages = useSuppliersUiMessagesOrDefault();
14
15
  const detail = messages.supplierDetailPage;
15
16
  const supplierQuery = useSupplier(id);
@@ -52,16 +53,16 @@ export function SupplierDetailPage({ id, locale = "en-US", onBack, onDeleted, co
52
53
  setNoteContent("");
53
54
  }
54
55
  if (supplierQuery.isPending)
55
- return _jsx(SupplierDetailSkeleton, {});
56
+ return _jsx(SupplierDetailSkeleton, { className: className });
56
57
  if (supplierQuery.isError) {
57
- return (_jsx(EmptyState, { message: detail.loadFailed, onBack: onBack, backLabel: detail.backToSuppliers }));
58
+ return (_jsx(EmptyState, { message: detail.loadFailed, onBack: onBack, backLabel: detail.backToSuppliers, className: className }));
58
59
  }
59
60
  if (!supplier) {
60
- return (_jsx(EmptyState, { message: detail.notFound, onBack: onBack, backLabel: detail.backToSuppliers }));
61
+ return (_jsx(EmptyState, { message: detail.notFound, onBack: onBack, backLabel: detail.backToSuppliers, className: className }));
61
62
  }
62
63
  const services = servicesQuery.data?.data ?? [];
63
64
  const notes = notesQuery.data?.data ?? [];
64
- return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [onBack && (_jsxs(Button, { type: "button", variant: "ghost", className: "w-fit px-0", onClick: onBack, children: [_jsx(ArrowLeft, {}), detail.backToSuppliers] })), _jsxs("div", { children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight", children: supplier.name }), _jsx(Badge, { variant: statusVariant[supplier.status], children: messages.common.supplierStatusLabels[supplier.status] })] }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: supplier.description })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { type: "button", variant: "outline", onClick: () => setEditOpen(true), children: [_jsx(Pencil, {}), messages.common.edit] }), _jsxs(Button, { type: "button", variant: "destructive", onClick: deleteSupplier, disabled: supplierMutation.remove.isPending, children: [_jsx(Trash2, {}), messages.common.delete] })] })] }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: detail.details }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsx(Detail, { label: detail.labels.type, children: messages.common.supplierTypeLabels[supplier.type] }), _jsx(Detail, { label: detail.labels.status, children: messages.common.supplierStatusLabels[supplier.status] }), _jsx(Detail, { label: detail.labels.city, children: supplier.city ?? messages.common.none }), _jsx(Detail, { label: detail.labels.country, children: supplier.country ?? messages.common.none }), _jsx(Detail, { label: detail.labels.currency, children: supplier.defaultCurrency ?? messages.common.none }), _jsx(Detail, { label: detail.labels.reservationTimeout, children: supplier.reservationTimeoutMinutes == null
65
+ return (_jsxs("div", { "data-slot": "supplier-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [onBack && (_jsxs(Button, { type: "button", variant: "ghost", className: "w-fit px-0", onClick: onBack, children: [_jsx(ArrowLeft, {}), detail.backToSuppliers] })), _jsxs("div", { children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight", children: supplier.name }), _jsx(Badge, { variant: statusVariant[supplier.status], children: messages.common.supplierStatusLabels[supplier.status] })] }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: supplier.description })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { type: "button", variant: "outline", onClick: () => setEditOpen(true), children: [_jsx(Pencil, {}), messages.common.edit] }), _jsxs(Button, { type: "button", variant: "destructive", onClick: deleteSupplier, disabled: supplierMutation.remove.isPending, children: [_jsx(Trash2, {}), messages.common.delete] })] })] }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: detail.details }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsx(Detail, { label: detail.labels.type, children: messages.common.supplierTypeLabels[supplier.type] }), _jsx(Detail, { label: detail.labels.status, children: messages.common.supplierStatusLabels[supplier.status] }), _jsx(Detail, { label: detail.labels.city, children: supplier.city ?? messages.common.none }), _jsx(Detail, { label: detail.labels.country, children: supplier.country ?? messages.common.none }), _jsx(Detail, { label: detail.labels.currency, children: supplier.defaultCurrency ?? messages.common.none }), _jsx(Detail, { label: detail.labels.reservationTimeout, children: supplier.reservationTimeoutMinutes == null
65
66
  ? messages.common.none
66
67
  : String(supplier.reservationTimeoutMinutes) }), _jsx(Detail, { label: detail.labels.created, children: formatDate(supplier.createdAt, locale) }), _jsx(Detail, { label: detail.labels.updated, children: formatDate(supplier.updatedAt, locale) })] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: detail.contact }) }), _jsx(CardContent, { className: "grid gap-3 text-sm", children: !hasContactDetails(supplier) ? (_jsx("p", { className: "text-muted-foreground", children: detail.noContact })) : (_jsxs(_Fragment, { children: [_jsx(Detail, { label: detail.labels.email, children: supplier.email ?? messages.common.none }), _jsx(Detail, { label: detail.labels.phone, children: supplier.phone ?? messages.common.none }), _jsx(Detail, { label: detail.labels.website, children: supplier.website ? (_jsx("a", { href: supplier.website, className: "text-primary underline-offset-4 hover:underline", children: supplier.website })) : (messages.common.none) }), _jsx(Detail, { label: detail.labels.address, children: supplier.address ?? messages.common.none }), _jsx(Detail, { label: detail.labels.contactName, children: supplier.contactName ?? messages.common.none }), _jsx(Detail, { label: detail.labels.contactEmail, children: supplier.contactEmail ?? messages.common.none }), _jsx(Detail, { label: detail.labels.contactPhone, children: supplier.contactPhone ?? messages.common.none })] })) })] })] }), renderCustomerPaymentPolicy?.({
67
68
  supplier,
@@ -81,11 +82,11 @@ export function SupplierDetailPage({ id, locale = "en-US", onBack, onDeleted, co
81
82
  function Detail({ label, children }) {
82
83
  return (_jsxs("div", { className: "grid grid-cols-[10rem_minmax(0,1fr)] gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: label }), _jsx("span", { className: "min-w-0 break-words", children: children })] }));
83
84
  }
84
- function EmptyState({ message, onBack, backLabel, }) {
85
- return (_jsxs("div", { className: "flex min-h-80 flex-col items-center justify-center gap-4 text-center", children: [_jsx("p", { className: "text-muted-foreground", children: message }), onBack && (_jsxs(Button, { type: "button", variant: "outline", onClick: onBack, children: [_jsx(ArrowLeft, {}), backLabel] }))] }));
85
+ function EmptyState({ message, onBack, backLabel, className, }) {
86
+ return (_jsxs("div", { className: cn("flex min-h-80 flex-col items-center justify-center gap-4 p-6 text-center", className), children: [_jsx("p", { className: "text-muted-foreground", children: message }), onBack && (_jsxs(Button, { type: "button", variant: "outline", onClick: onBack, children: [_jsx(ArrowLeft, {}), backLabel] }))] }));
86
87
  }
87
- function SupplierDetailSkeleton() {
88
- return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "h-9 w-72 animate-pulse rounded bg-muted" }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-2", children: [_jsx("div", { className: "h-64 animate-pulse rounded-md bg-muted" }), _jsx("div", { className: "h-64 animate-pulse rounded-md bg-muted" })] }), _jsx("div", { className: "h-96 animate-pulse rounded-md bg-muted" })] }));
88
+ function SupplierDetailSkeleton({ className }) {
89
+ return (_jsxs("div", { className: cn("flex flex-col gap-6 p-6", className), children: [_jsx("div", { className: "h-9 w-72 animate-pulse rounded bg-muted" }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-2", children: [_jsx("div", { className: "h-64 animate-pulse rounded-md bg-muted" }), _jsx("div", { className: "h-64 animate-pulse rounded-md bg-muted" })] }), _jsx("div", { className: "h-96 animate-pulse rounded-md bg-muted" })] }));
89
90
  }
90
91
  function LoadingLine() {
91
92
  return _jsx("div", { className: "h-4 w-40 animate-pulse rounded bg-muted" });
@@ -4,6 +4,7 @@ export type SuppliersPageProps = {
4
4
  onSupplierOpen?: (supplier: Supplier) => void;
5
5
  onSupplierCreated?: (supplier: Supplier) => void;
6
6
  initialSearch?: string;
7
+ className?: string;
7
8
  };
8
- export declare function SuppliersPage({ pageSize, onSupplierOpen, onSupplierCreated, initialSearch, }?: SuppliersPageProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function SuppliersPage({ pageSize, onSupplierOpen, onSupplierCreated, initialSearch, className, }?: SuppliersPageProps): import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=suppliers-page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suppliers-page.d.ts","sourceRoot":"","sources":["../../src/components/suppliers-page.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,QAAQ,EAKd,MAAM,2BAA2B,CAAA;AAmBlC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC7C,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAkB,GACnB,GAAE,kBAAuB,2CAoPzB"}
1
+ {"version":3,"file":"suppliers-page.d.ts","sourceRoot":"","sources":["../../src/components/suppliers-page.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,QAAQ,EAKd,MAAM,2BAA2B,CAAA;AAoBlC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC7C,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAkB,EAClB,SAAS,GACV,GAAE,kBAAuB,2CAoPzB"}
@@ -2,13 +2,14 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { SUPPLIER_STATUSES, SUPPLIER_TYPES, statusVariant, useSuppliers, } from "@voyantjs/suppliers-react";
4
4
  import { Badge, Button, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyantjs/ui/components";
5
+ import { cn } from "@voyantjs/ui/lib/utils";
5
6
  import { ArrowDown, ArrowUp, Plus, Search, SlidersHorizontal } from "lucide-react";
6
7
  import * as React from "react";
7
8
  import { useSuppliersUiMessagesOrDefault } from "../i18n/index.js";
8
9
  import { formatMessage } from "./message-format.js";
9
10
  import { SupplierDialog } from "./supplier-dialog.js";
10
11
  const ALL = "__all__";
11
- export function SuppliersPage({ pageSize = 25, onSupplierOpen, onSupplierCreated, initialSearch = "", } = {}) {
12
+ export function SuppliersPage({ pageSize = 25, onSupplierOpen, onSupplierCreated, initialSearch = "", className, } = {}) {
12
13
  const messages = useSuppliersUiMessagesOrDefault();
13
14
  const [search, setSearch] = React.useState(initialSearch);
14
15
  const [type, setType] = React.useState(ALL);
@@ -50,7 +51,7 @@ export function SuppliersPage({ pageSize = 25, onSupplierOpen, onSupplierCreated
50
51
  setCountry("");
51
52
  setCurrency("");
52
53
  }
53
- return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight", children: messages.suppliersPage.title }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: messages.suppliersPage.description })] }), _jsxs(Button, { onClick: () => setDialogOpen(true), children: [_jsx(Plus, {}), messages.suppliersPage.create] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { className: "pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { value: search, onChange: (event) => {
54
+ return (_jsxs("div", { "data-slot": "suppliers-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight", children: messages.suppliersPage.title }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: messages.suppliersPage.description })] }), _jsxs(Button, { onClick: () => setDialogOpen(true), children: [_jsx(Plus, {}), messages.suppliersPage.create] })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { className: "pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { value: search, onChange: (event) => {
54
55
  setSearch(event.target.value);
55
56
  setPageIndex(0);
56
57
  }, placeholder: messages.suppliersPage.searchPlaceholder, className: "pl-9" })] }), _jsxs("div", { className: "grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_10rem_10rem_auto]", children: [_jsxs(Select, { value: type, onValueChange: (value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/suppliers-ui",
3
- "version": "0.32.3",
3
+ "version": "0.34.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,11 +46,11 @@
46
46
  "react": "^19.0.0",
47
47
  "react-dom": "^19.0.0",
48
48
  "zod": "^4.0.0",
49
- "@voyantjs/suppliers-react": "0.32.3",
50
- "@voyantjs/ui": "0.32.3"
49
+ "@voyantjs/suppliers-react": "0.34.0",
50
+ "@voyantjs/ui": "0.34.0"
51
51
  },
52
52
  "dependencies": {
53
- "@voyantjs/i18n": "0.32.3"
53
+ "@voyantjs/i18n": "0.34.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@tanstack/react-query": "^5.96.2",
@@ -64,10 +64,10 @@
64
64
  "typescript": "^6.0.2",
65
65
  "vitest": "^4.1.2",
66
66
  "zod": "^4.3.6",
67
- "@voyantjs/i18n": "0.32.3",
68
- "@voyantjs/suppliers-react": "0.32.3",
67
+ "@voyantjs/i18n": "0.34.0",
68
+ "@voyantjs/suppliers-react": "0.34.0",
69
69
  "@voyantjs/voyant-typescript-config": "0.1.0",
70
- "@voyantjs/ui": "0.32.3"
70
+ "@voyantjs/ui": "0.34.0"
71
71
  },
72
72
  "files": [
73
73
  "dist",