@planetaexo/design-system 0.22.2 → 0.23.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/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -484,6 +484,18 @@ interface BookingDetailsLabels {
|
|
|
484
484
|
};
|
|
485
485
|
/** Botão "Request cancellation" no fim do card. Default EN. */
|
|
486
486
|
cancelRequestLabel?: string;
|
|
487
|
+
/** Texto de confirmação exibido via `window.confirm` quando o consumidor
|
|
488
|
+
* passa `adventure.allowEmptyAdventure === true` e o usuário clica em
|
|
489
|
+
* remover/desassociar o ÚLTIMO viajante da aventura.
|
|
490
|
+
* Default (apenas `message` é usado pelo `window.confirm`):
|
|
491
|
+
* "The adventure will be empty. Continue?". Os demais campos ficam
|
|
492
|
+
* reservados para uso futuro com modal interno. */
|
|
493
|
+
confirmRemoveLastTraveller?: {
|
|
494
|
+
title: string;
|
|
495
|
+
message: string;
|
|
496
|
+
confirm: string;
|
|
497
|
+
cancel: string;
|
|
498
|
+
};
|
|
487
499
|
}
|
|
488
500
|
interface SuggestedTraveller {
|
|
489
501
|
id: string;
|
|
@@ -543,6 +555,15 @@ interface BookingAdventure {
|
|
|
543
555
|
* Default: "No registration required". O consumidor passa label
|
|
544
556
|
* localizado (i18n) — espelha o padrão de `addTravellerLabel`. */
|
|
545
557
|
noRegistrationRequiredLabel?: string;
|
|
558
|
+
/** Quando `true`, permite que a aventura fique sem viajantes (botões de
|
|
559
|
+
* remover/desassociar ficam habilitados mesmo com apenas 1 traveller).
|
|
560
|
+
* Antes de remover o último, o DS dispara `window.confirm` usando
|
|
561
|
+
* `labels.confirmRemoveLastTraveller.message`.
|
|
562
|
+
*
|
|
563
|
+
* Default: `false` (preserva regra "min 1 traveller por aventura" do `/b`).
|
|
564
|
+
* Caso de uso: contexto admin onde o operador precisa esvaziar uma aventura
|
|
565
|
+
* para refazer assignments. */
|
|
566
|
+
allowEmptyAdventure?: boolean;
|
|
546
567
|
}
|
|
547
568
|
interface BookingContact {
|
|
548
569
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -484,6 +484,18 @@ interface BookingDetailsLabels {
|
|
|
484
484
|
};
|
|
485
485
|
/** Botão "Request cancellation" no fim do card. Default EN. */
|
|
486
486
|
cancelRequestLabel?: string;
|
|
487
|
+
/** Texto de confirmação exibido via `window.confirm` quando o consumidor
|
|
488
|
+
* passa `adventure.allowEmptyAdventure === true` e o usuário clica em
|
|
489
|
+
* remover/desassociar o ÚLTIMO viajante da aventura.
|
|
490
|
+
* Default (apenas `message` é usado pelo `window.confirm`):
|
|
491
|
+
* "The adventure will be empty. Continue?". Os demais campos ficam
|
|
492
|
+
* reservados para uso futuro com modal interno. */
|
|
493
|
+
confirmRemoveLastTraveller?: {
|
|
494
|
+
title: string;
|
|
495
|
+
message: string;
|
|
496
|
+
confirm: string;
|
|
497
|
+
cancel: string;
|
|
498
|
+
};
|
|
487
499
|
}
|
|
488
500
|
interface SuggestedTraveller {
|
|
489
501
|
id: string;
|
|
@@ -543,6 +555,15 @@ interface BookingAdventure {
|
|
|
543
555
|
* Default: "No registration required". O consumidor passa label
|
|
544
556
|
* localizado (i18n) — espelha o padrão de `addTravellerLabel`. */
|
|
545
557
|
noRegistrationRequiredLabel?: string;
|
|
558
|
+
/** Quando `true`, permite que a aventura fique sem viajantes (botões de
|
|
559
|
+
* remover/desassociar ficam habilitados mesmo com apenas 1 traveller).
|
|
560
|
+
* Antes de remover o último, o DS dispara `window.confirm` usando
|
|
561
|
+
* `labels.confirmRemoveLastTraveller.message`.
|
|
562
|
+
*
|
|
563
|
+
* Default: `false` (preserva regra "min 1 traveller por aventura" do `/b`).
|
|
564
|
+
* Caso de uso: contexto admin onde o operador precisa esvaziar uma aventura
|
|
565
|
+
* para refazer assignments. */
|
|
566
|
+
allowEmptyAdventure?: boolean;
|
|
546
567
|
}
|
|
547
568
|
interface BookingContact {
|
|
548
569
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -2780,8 +2780,15 @@ function AdventureSection({
|
|
|
2780
2780
|
] })
|
|
2781
2781
|
] }),
|
|
2782
2782
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y divide-border", children: adventure.travellers.map((t) => {
|
|
2783
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
|
|
2784
|
-
const canRemoveTraveller = adventure.travellers.length > 1;
|
|
2783
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
|
|
2784
|
+
const canRemoveTraveller = adventure.travellers.length > 1 || adventure.allowEmptyAdventure === true;
|
|
2785
|
+
const isRemovingLastTraveller = adventure.allowEmptyAdventure === true && adventure.travellers.length === 1;
|
|
2786
|
+
const confirmRemoveLastMessage = (_b2 = (_a2 = labels == null ? void 0 : labels.confirmRemoveLastTraveller) == null ? void 0 : _a2.message) != null ? _b2 : "The adventure will be empty. Continue?";
|
|
2787
|
+
const confirmIfLast = () => {
|
|
2788
|
+
if (!isRemovingLastTraveller) return true;
|
|
2789
|
+
if (typeof window === "undefined") return true;
|
|
2790
|
+
return window.confirm(confirmRemoveLastMessage);
|
|
2791
|
+
};
|
|
2785
2792
|
const disabledRemoveTitle = canRemoveTraveller ? void 0 : cannotRemoveLastTravellerLabel != null ? cannotRemoveLastTravellerLabel : "Cannot remove last traveller";
|
|
2786
2793
|
return /* @__PURE__ */ jsxs(
|
|
2787
2794
|
"div",
|
|
@@ -2795,7 +2802,7 @@ function AdventureSection({
|
|
|
2795
2802
|
" ",
|
|
2796
2803
|
t.lastName
|
|
2797
2804
|
] }),
|
|
2798
|
-
t.isChild && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold font-heading rounded-full px-2 py-0.5 bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400 shrink-0", children: (
|
|
2805
|
+
t.isChild && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold font-heading rounded-full px-2 py-0.5 bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400 shrink-0", children: (_c2 = labels == null ? void 0 : labels.childBadge) != null ? _c2 : "Child" })
|
|
2799
2806
|
] }),
|
|
2800
2807
|
t.formUrl && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2801
2808
|
/* @__PURE__ */ jsxs(
|
|
@@ -2807,7 +2814,7 @@ function AdventureSection({
|
|
|
2807
2814
|
className: "flex items-center gap-1 text-xs text-primary hover:text-primary/80 transition-colors font-ui",
|
|
2808
2815
|
children: [
|
|
2809
2816
|
/* @__PURE__ */ jsx(ExternalLinkIcon, { className: "w-3 h-3" }),
|
|
2810
|
-
(
|
|
2817
|
+
(_d2 = labels == null ? void 0 : labels.openFormLink) != null ? _d2 : "Open"
|
|
2811
2818
|
]
|
|
2812
2819
|
}
|
|
2813
2820
|
),
|
|
@@ -2817,7 +2824,7 @@ function AdventureSection({
|
|
|
2817
2824
|
type: "button",
|
|
2818
2825
|
onClick: () => handleCopyUrl(t.formUrl),
|
|
2819
2826
|
className: "flex items-center text-xs text-muted-foreground hover:text-primary transition-colors font-ui",
|
|
2820
|
-
"aria-label": (
|
|
2827
|
+
"aria-label": (_e2 = labels == null ? void 0 : labels.copyFormUrlAria) != null ? _e2 : "Copy form URL",
|
|
2821
2828
|
children: /* @__PURE__ */ jsx(CopyIcon, { className: "w-3 h-3" })
|
|
2822
2829
|
}
|
|
2823
2830
|
)
|
|
@@ -2831,7 +2838,7 @@ function AdventureSection({
|
|
|
2831
2838
|
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-bold font-heading uppercase tracking-wider shrink-0",
|
|
2832
2839
|
t.status === "completed" ? "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" : "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"
|
|
2833
2840
|
),
|
|
2834
|
-
children: t.status === "completed" ? (
|
|
2841
|
+
children: t.status === "completed" ? (_f2 = labels == null ? void 0 : labels.travellerStatusCompleted) != null ? _f2 : t.status : (_g2 = labels == null ? void 0 : labels.travellerStatusPending) != null ? _g2 : t.status
|
|
2835
2842
|
}
|
|
2836
2843
|
),
|
|
2837
2844
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 shrink-0", children: [
|
|
@@ -2847,7 +2854,7 @@ function AdventureSection({
|
|
|
2847
2854
|
}
|
|
2848
2855
|
},
|
|
2849
2856
|
className: "flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors",
|
|
2850
|
-
"aria-label": (
|
|
2857
|
+
"aria-label": (_i2 = (_h2 = labels == null ? void 0 : labels.editTravellerAria) == null ? void 0 : _h2.call(labels, t.firstName)) != null ? _i2 : `Edit ${t.firstName}`,
|
|
2851
2858
|
children: /* @__PURE__ */ jsx(PencilIcon, { className: "w-3.5 h-3.5" })
|
|
2852
2859
|
}
|
|
2853
2860
|
),
|
|
@@ -2857,6 +2864,7 @@ function AdventureSection({
|
|
|
2857
2864
|
type: "button",
|
|
2858
2865
|
onClick: () => {
|
|
2859
2866
|
if (!canRemoveTraveller) return;
|
|
2867
|
+
if (!confirmIfLast()) return;
|
|
2860
2868
|
if (onRemoveTraveller) {
|
|
2861
2869
|
onRemoveTraveller(adventure.id, t.id);
|
|
2862
2870
|
} else {
|
|
@@ -2870,7 +2878,7 @@ function AdventureSection({
|
|
|
2870
2878
|
"flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",
|
|
2871
2879
|
"disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
|
2872
2880
|
),
|
|
2873
|
-
"aria-label": (
|
|
2881
|
+
"aria-label": (_k2 = (_j2 = labels == null ? void 0 : labels.deleteTravellerAria) == null ? void 0 : _j2.call(labels, t.firstName)) != null ? _k2 : `Delete ${t.firstName}`,
|
|
2874
2882
|
children: /* @__PURE__ */ jsx(Trash2Icon, { className: "w-3.5 h-3.5" })
|
|
2875
2883
|
}
|
|
2876
2884
|
),
|
|
@@ -2880,6 +2888,7 @@ function AdventureSection({
|
|
|
2880
2888
|
type: "button",
|
|
2881
2889
|
onClick: () => {
|
|
2882
2890
|
if (!canRemoveTraveller) return;
|
|
2891
|
+
if (!confirmIfLast()) return;
|
|
2883
2892
|
if (onUnassignFromAdventure) {
|
|
2884
2893
|
onUnassignFromAdventure(adventure.id, t.id);
|
|
2885
2894
|
} else if (onRemoveTraveller) {
|
|
@@ -2895,7 +2904,7 @@ function AdventureSection({
|
|
|
2895
2904
|
"flex h-8 w-8 sm:h-7 sm:w-7 items-center justify-center rounded-lg text-muted-foreground hover:text-amber-500 hover:bg-amber-500/10 transition-colors",
|
|
2896
2905
|
"disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
|
2897
2906
|
),
|
|
2898
|
-
"aria-label": (
|
|
2907
|
+
"aria-label": (_m2 = (_l2 = labels == null ? void 0 : labels.removeFromAdventureAria) == null ? void 0 : _l2.call(labels, t.firstName)) != null ? _m2 : `Remove ${t.firstName} from adventure`,
|
|
2899
2908
|
children: /* @__PURE__ */ jsx(UserMinusIcon, { className: "w-3.5 h-3.5" })
|
|
2900
2909
|
}
|
|
2901
2910
|
)
|