@voyantjs/cruises-ui 0.34.0 → 0.37.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.
@@ -1 +1 @@
1
- {"version":3,"file":"cruise-catalog-card.d.ts","sourceRoot":"","sources":["../../src/components/cruise-catalog-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAK/D,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,gBAAgB,CAAA;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,sBAAsB,2CAgEpF"}
1
+ {"version":3,"file":"cruise-catalog-card.d.ts","sourceRoot":"","sources":["../../src/components/cruise-catalog-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAM/D,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,gBAAgB,CAAA;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,sBAAsB,2CAoEpF"}
@@ -3,14 +3,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Badge } from "@voyantjs/ui/components/badge";
4
4
  import { Card, CardContent } from "@voyantjs/ui/components/card";
5
5
  import { cn } from "@voyantjs/ui/lib/utils";
6
+ import { useCruisesUiI18nOrDefault } from "../i18n/index.js";
6
7
  /**
7
8
  * Search-result card for a cruise hit. Reads sailing-shaped fields:
8
9
  * `name`, `shipName`, `departureDate`, `nights`, `status`, `priceFromCents`,
9
10
  * `currency`, `embarkationPort`, `tags`.
10
11
  */
11
12
  export function CruiseCatalogCard({ hit, onClick, className }) {
13
+ const i18n = useCruisesUiI18nOrDefault();
14
+ const messages = i18n.messages.catalogCard;
12
15
  const f = hit.document.fields;
13
- const name = stringOr(f.name, "Untitled sailing");
16
+ const name = stringOr(f.name, messages.untitled);
14
17
  const shipName = stringOr(f.shipName, null);
15
18
  const status = stringOr(f.status, null);
16
19
  const departureDate = stringOr(f.departureDate, null);
@@ -20,13 +23,21 @@ export function CruiseCatalogCard({ hit, onClick, className }) {
20
23
  const priceFrom = numberOr(f.priceFromCents, null);
21
24
  const currency = stringOr(f.currency ?? f.sellCurrency, null);
22
25
  const priceLabel = priceFrom != null && currency
23
- ? `from ${new Intl.NumberFormat(undefined, {
24
- style: "currency",
25
- currency,
26
- maximumFractionDigits: 0,
27
- }).format(priceFrom / 100)}`
26
+ ? formatTemplate(messages.priceFrom, {
27
+ amount: i18n.formatCurrency(priceFrom / 100, currency, {
28
+ maximumFractionDigits: 0,
29
+ }),
30
+ })
28
31
  : null;
29
- return (_jsx(Card, { className: cn("h-full cursor-pointer transition-colors hover:border-primary/40", onClick == null && "cursor-default", className), onClick: onClick ? () => onClick(hit) : undefined, children: _jsxs(CardContent, { className: "flex h-full flex-col gap-2 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "line-clamp-2 font-medium text-sm", children: name }), shipName && _jsx("p", { className: "text-muted-foreground text-xs", children: shipName })] }), status && (_jsx(Badge, { variant: status === "active" ? "default" : "secondary", className: "shrink-0", children: status }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-muted-foreground text-xs", children: [departureDate && _jsx("span", { children: departureDate }), nights != null && (_jsxs("span", { children: [nights, " night", nights === 1 ? "" : "s"] })), embarkationPort && _jsxs("span", { children: ["\u00B7 ", embarkationPort] }), priceLabel && _jsx("span", { className: "ml-auto font-medium text-foreground", children: priceLabel })] }), tags.length > 0 && (_jsx("div", { className: "mt-auto flex flex-wrap gap-1", children: tags.slice(0, 4).map((tag) => (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: tag }, tag))) }))] }) }));
32
+ return (_jsx(Card, { className: cn("h-full cursor-pointer transition-colors hover:border-primary/40", onClick == null && "cursor-default", className), onClick: onClick ? () => onClick(hit) : undefined, children: _jsxs(CardContent, { className: "flex h-full flex-col gap-2 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "line-clamp-2 font-medium text-sm", children: name }), shipName && _jsx("p", { className: "text-muted-foreground text-xs", children: shipName })] }), status && (_jsx(Badge, { variant: status === "active" ? "default" : "secondary", className: "shrink-0", children: status }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-muted-foreground text-xs", children: [departureDate && _jsx("span", { children: departureDate }), nights != null && (_jsx("span", { children: formatTemplate(nights === 1 ? messages.nightsSingular : messages.nightsPlural, {
33
+ count: nights,
34
+ }) })), embarkationPort && _jsxs("span", { children: ["\u00B7 ", embarkationPort] }), priceLabel && _jsx("span", { className: "ml-auto font-medium text-foreground", children: priceLabel })] }), tags.length > 0 && (_jsx("div", { className: "mt-auto flex flex-wrap gap-1", children: tags.slice(0, 4).map((tag) => (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: tag }, tag))) }))] }) }));
35
+ }
36
+ function formatTemplate(template, values) {
37
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
38
+ const value = values[key];
39
+ return value === undefined ? "" : String(value);
40
+ });
30
41
  }
31
42
  function stringOr(value, fallback) {
32
43
  return typeof value === "string" && value.length > 0 ? value : fallback;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,WAAW,EAAE,iBAwEzB,CAAA"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,WAAW,EAAE,iBA8EzB,CAAA"}
package/dist/i18n/en.js CHANGED
@@ -9,6 +9,12 @@ export const cruisesUiEn = {
9
9
  fallback: "{count}-occupancy",
10
10
  },
11
11
  },
12
+ catalogCard: {
13
+ untitled: "Untitled sailing",
14
+ priceFrom: "from {amount}",
15
+ nightsSingular: "{count} night",
16
+ nightsPlural: "{count} nights",
17
+ },
12
18
  enrichmentProgramList: {
13
19
  loading: "Loading enrichment programs…",
14
20
  empty: "No enrichment programs published for this cruise.",
@@ -13,6 +13,12 @@ export type CruisesUiMessages = {
13
13
  fallback: string;
14
14
  };
15
15
  };
16
+ catalogCard: {
17
+ untitled: string;
18
+ priceFrom: string;
19
+ nightsSingular: string;
20
+ nightsPlural: string;
21
+ };
16
22
  enrichmentProgramList: {
17
23
  loading: string;
18
24
  empty: string;
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/i18n/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE1F,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAA;AACnE,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AACjE,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,sBAAsB,EAAE,MAAM,CAAA;QAC9B,oBAAoB,EAAE;Y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AAuB,EAAE,MAAM,CAAC,CAAA;KAC5D,CAAA;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,kBAAkB,EAAE,MAAM,CAAA;QAC1B,gBAAgB,EAAE,MAAM,CAAA;QACxB,cAAc,EAAE,MAAM,CAAA;QACtB,YAAY,EAAE,MAAM,CAAA;QACpB,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,EAAE;YACR,SAAS,EAAE,MAAM,CAAA;YACjB,OAAO,EAAE,MAAM,CAAA;YACf,QAAQ,EAAE,MAAM,CAAA;SACjB,CAAA;QACD,mBAAmB,EAAE,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAA;QAC7D,cAAc,EAAE;YACd,SAAS,EAAE,MAAM,CAAA;YACjB,QAAQ,EAAE,MAAM,CAAA;SACjB,CAAA;QACD,cAAc,EAAE,MAAM,CAAA;QACtB,MAAM,EAAE;YACN,SAAS,EAAE,MAAM,CAAA;YACjB,aAAa,EAAE,MAAM,CAAA;SACtB,CAAA;KACF,CAAA;CACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ro.d.ts","sourceRoot":"","sources":["../../src/i18n/ro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,WAAW,EAAE,iBAwEzB,CAAA"}
1
+ {"version":3,"file":"ro.d.ts","sourceRoot":"","sources":["../../src/i18n/ro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,WAAW,EAAE,iBA8EzB,CAAA"}
package/dist/i18n/ro.js CHANGED
@@ -9,6 +9,12 @@ export const cruisesUiRo = {
9
9
  fallback: "{count} locuri",
10
10
  },
11
11
  },
12
+ catalogCard: {
13
+ untitled: "Croaziera fara nume",
14
+ priceFrom: "de la {amount}",
15
+ nightsSingular: "{count} noapte",
16
+ nightsPlural: "{count} nopti",
17
+ },
12
18
  enrichmentProgramList: {
13
19
  loading: "Se incarca programele de imbogatire…",
14
20
  empty: "Nu exista programe de imbogatire publicate pentru aceasta croaziera.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/cruises-ui",
3
- "version": "0.34.0",
3
+ "version": "0.37.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,12 +43,12 @@
43
43
  "@tanstack/react-query": "^5.0.0",
44
44
  "react": "^19.0.0",
45
45
  "react-dom": "^19.0.0",
46
- "@voyantjs/catalog-react": "0.34.0",
47
- "@voyantjs/cruises-react": "0.34.0",
48
- "@voyantjs/ui": "0.34.0"
46
+ "@voyantjs/catalog-react": "0.37.0",
47
+ "@voyantjs/cruises-react": "0.37.0",
48
+ "@voyantjs/ui": "0.37.0"
49
49
  },
50
50
  "dependencies": {
51
- "@voyantjs/i18n": "0.34.0"
51
+ "@voyantjs/i18n": "0.37.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@tanstack/react-query": "^5.96.2",
@@ -59,10 +59,10 @@
59
59
  "react-dom": "^19.2.4",
60
60
  "typescript": "^6.0.2",
61
61
  "vitest": "^4.1.2",
62
- "@voyantjs/catalog-react": "0.34.0",
63
- "@voyantjs/cruises-react": "0.34.0",
64
- "@voyantjs/i18n": "0.34.0",
65
- "@voyantjs/ui": "0.34.0",
62
+ "@voyantjs/catalog-react": "0.37.0",
63
+ "@voyantjs/cruises-react": "0.37.0",
64
+ "@voyantjs/i18n": "0.37.0",
65
+ "@voyantjs/ui": "0.37.0",
66
66
  "@voyantjs/voyant-typescript-config": "0.1.0"
67
67
  },
68
68
  "files": [