@clubmed/trident-ui 2.0.0-beta.74 → 2.0.0-beta.75

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
- export default function CriteriaTransportsB2bDemo(): import("react/jsx-runtime").JSX.Element;
1
+ export default function CriteriaTransportsB2BDemo(): import("react/jsx-runtime").JSX.Element;
@@ -1,51 +1,118 @@
1
1
  "use client";
2
2
  import { CriteriaTransports as e } from "../ui/criteria/CriteriaTransports.js";
3
- import { transportSections as t } from "./criteria-transports-data.js";
4
- import { useState as n } from "react";
5
- import { jsx as r } from "react/jsx-runtime";
3
+ import { useState as t } from "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
5
  //#region lib/examples/criteria-transports-b2b-demo.tsx
7
6
  var i = {
8
- addTransportationFrom: "Add transportation from",
7
+ toggleLabel: "Add transportation from",
8
+ topCitiesLabel: "Top cities",
9
+ otherCitiesLabel: "Other cities",
10
+ clubMedTransportTitle: "Opt for Club Med transportation:",
11
+ clubMedTransportDescription: "Assistance and support in case of unforeseen events. Comfort guaranteed from departure to arrival.",
9
12
  reset: "Reset",
10
13
  apply: "Confirm"
11
- };
12
- function a() {
13
- let [a, o] = n(!0), [s, c] = n("nyc"), [l, u] = n("round-trip"), [d, f] = n("All class"), [p, m] = n("");
14
+ }, a = {
15
+ roundTripLabel: "Round trip",
16
+ oneWayLabel: "One way",
17
+ cabinClassLabel: "Class",
18
+ departureDateLabel: "From"
19
+ }, o = [
20
+ {
21
+ value: "all",
22
+ label: "All classes"
23
+ },
24
+ {
25
+ value: "economy",
26
+ label: "Economy"
27
+ },
28
+ {
29
+ value: "business",
30
+ label: "Business"
31
+ },
32
+ {
33
+ value: "first",
34
+ label: "First class"
35
+ }
36
+ ], s = [
37
+ {
38
+ code: "BOS",
39
+ name: "Boston Logan International (BOS)"
40
+ },
41
+ {
42
+ code: "NYC",
43
+ name: "New York all airports (NYC)"
44
+ },
45
+ {
46
+ code: "MIA",
47
+ name: "Miami International (MIA)"
48
+ }
49
+ ], c = [
50
+ {
51
+ code: "ABQ",
52
+ name: "Albuquerque (ABQ)"
53
+ },
54
+ {
55
+ code: "ANC",
56
+ name: "Anchorage International (ANC)"
57
+ },
58
+ {
59
+ code: "ATL",
60
+ name: "Atlanta Hartsfield-Jackson (ATL)"
61
+ },
62
+ {
63
+ code: "AUS",
64
+ name: "Austin-Bergstrom International (AUS)"
65
+ },
66
+ {
67
+ code: "DEN",
68
+ name: "Denver International (DEN)"
69
+ },
70
+ {
71
+ code: "LAX",
72
+ name: "Los Angeles International (LAX)"
73
+ },
74
+ {
75
+ code: "SEA",
76
+ name: "Seattle-Tacoma International (SEA)"
77
+ },
78
+ {
79
+ code: "SFO",
80
+ name: "San Francisco International (SFO)"
81
+ }
82
+ ];
83
+ function l() {
84
+ let [l, u] = t(!1), [d, f] = t(null), [p, m] = t("roundtrip"), [h, g] = t(void 0), [_, v] = t("");
14
85
  return /* @__PURE__ */ r("div", {
15
- className: "w-[380px] h-600",
16
- children: /* @__PURE__ */ r(e, {
86
+ className: "w-[380px] space-y-24",
87
+ children: [/* @__PURE__ */ n(e, {
17
88
  mode: "b2b",
18
89
  labels: i,
90
+ b2bLabels: a,
19
91
  title: "Transport",
20
- enabled: a,
21
- sections: t,
22
- selectedId: s,
23
- flightType: l,
24
- flightTypeLabels: {
25
- roundTrip: "Aller/retour",
26
- oneWay: "Aller simple"
27
- },
28
- flightClass: d,
29
- flightClassLabel: "Class",
30
- flightClasses: [
31
- "All class",
32
- "Economy",
33
- "Business",
34
- "First"
35
- ],
36
- fromQuery: p,
37
- fromQueryLabel: "From",
38
- onChange: (e) => {
39
- e.type === "enabled" && o(e.payload), e.type === "select" && c(e.payload), e.type === "flightType" && u(e.payload), e.type === "flightClass" && f(e.payload), e.type === "fromQuery" && m(e.payload);
40
- },
92
+ enabled: l,
93
+ topCities: s,
94
+ otherCities: c,
95
+ selectedAirportCode: d,
96
+ flightType: p,
97
+ cabinClass: h,
98
+ cabinClassOptions: o,
99
+ departureQuery: _,
100
+ onToggle: u,
101
+ onSelect: f,
102
+ onFlightTypeChange: m,
103
+ onCabinClassChange: (e, t) => g(t),
104
+ onDepartureQueryChange: (e, t) => v(t),
41
105
  onReset: () => {
42
- o(!1), c(null), m("");
106
+ u(!1), f(null), m("roundtrip"), g(void 0), v("");
43
107
  },
44
108
  onApply: () => {}
45
- })
109
+ }), d && /* @__PURE__ */ r("p", {
110
+ className: "text-b4",
111
+ children: ["Selected: ", /* @__PURE__ */ n("strong", { children: d })]
112
+ })]
46
113
  });
47
114
  }
48
115
  //#endregion
49
- export { a as default };
116
+ export { l as default };
50
117
 
51
118
  //# sourceMappingURL=criteria-transports-b2b-demo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"criteria-transports-b2b-demo.js","names":[],"sources":["../../lib/examples/criteria-transports-b2b-demo.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\n\nimport { CriteriaTransports } from '@/ui/criteria/CriteriaTransports';\nimport type { CriteriaTransportsAction } from '@/ui/criteria/CriteriaTransports';\nimport { transportSections } from './criteria-transports-data';\n\nconst labels = {\n addTransportationFrom: 'Add transportation from',\n reset: 'Reset',\n apply: 'Confirm',\n};\n\nexport default function CriteriaTransportsB2bDemo() {\n const [enabled, setEnabled] = useState(true);\n const [selectedId, setSelectedId] = useState<string | null>('nyc');\n const [flightType, setFlightType] = useState<'round-trip' | 'one-way'>('round-trip');\n const [flightClass, setFlightClass] = useState('All class');\n const [fromQuery, setFromQuery] = useState('');\n\n const handleChange = (action: CriteriaTransportsAction) => {\n if (action.type === 'enabled') setEnabled(action.payload);\n if (action.type === 'select') setSelectedId(action.payload);\n if (action.type === 'flightType') setFlightType(action.payload);\n if (action.type === 'flightClass') setFlightClass(action.payload);\n if (action.type === 'fromQuery') setFromQuery(action.payload);\n };\n\n return (\n <div className=\"w-[380px] h-600\">\n <CriteriaTransports\n mode=\"b2b\"\n labels={labels}\n title=\"Transport\"\n enabled={enabled}\n sections={transportSections}\n selectedId={selectedId}\n flightType={flightType}\n flightTypeLabels={{ roundTrip: 'Aller/retour', oneWay: 'Aller simple' }}\n flightClass={flightClass}\n flightClassLabel=\"Class\"\n flightClasses={['All class', 'Economy', 'Business', 'First']}\n fromQuery={fromQuery}\n fromQueryLabel=\"From\"\n onChange={handleChange}\n onReset={() => {\n setEnabled(false);\n setSelectedId(null);\n setFromQuery('');\n }}\n onApply={() => {}}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,IAAM,IAAS;CACb,uBAAuB;CACvB,OAAO;CACP,OAAO;CACR;AAED,SAAwB,IAA4B;CAClD,IAAM,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAY,KAAiB,EAAwB,MAAM,EAC5D,CAAC,GAAY,KAAiB,EAAmC,aAAa,EAC9E,CAAC,GAAa,KAAkB,EAAS,YAAY,EACrD,CAAC,GAAW,KAAgB,EAAS,GAAG;AAU9C,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD;GACE,MAAK;GACG;GACR,OAAM;GACG;GACT,UAAU;GACE;GACA;GACZ,kBAAkB;IAAE,WAAW;IAAgB,QAAQ;IAAgB;GAC1D;GACb,kBAAiB;GACjB,eAAe;IAAC;IAAa;IAAW;IAAY;IAAQ;GACjD;GACX,gBAAe;GACf,WAxBgB,MAAqC;AAKzD,IAJI,EAAO,SAAS,aAAW,EAAW,EAAO,QAAQ,EACrD,EAAO,SAAS,YAAU,EAAc,EAAO,QAAQ,EACvD,EAAO,SAAS,gBAAc,EAAc,EAAO,QAAQ,EAC3D,EAAO,SAAS,iBAAe,EAAe,EAAO,QAAQ,EAC7D,EAAO,SAAS,eAAa,EAAa,EAAO,QAAQ;;GAoBzD,eAAe;AAGb,IAFA,EAAW,GAAM,EACjB,EAAc,KAAK,EACnB,EAAa,GAAG;;GAElB,eAAe;GACf,CAAA;EACE,CAAA"}
1
+ {"version":3,"file":"criteria-transports-b2b-demo.js","names":[],"sources":["../../lib/examples/criteria-transports-b2b-demo.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\n\nimport { CriteriaTransports } from '@/ui/criteria/CriteriaTransports';\nimport type {\n CriteriaTransportsProps,\n CriteriaTransportsB2BLabels,\n} from '@/ui/criteria/CriteriaTransports';\nimport type { RadioSelectOption } from '@/ui/forms/RadioSelect';\n\nconst labels: CriteriaTransportsProps['labels'] = {\n toggleLabel: 'Add transportation from',\n topCitiesLabel: 'Top cities',\n otherCitiesLabel: 'Other cities',\n clubMedTransportTitle: 'Opt for Club Med transportation:',\n clubMedTransportDescription:\n 'Assistance and support in case of unforeseen events. Comfort guaranteed from departure to arrival.',\n reset: 'Reset',\n apply: 'Confirm',\n};\n\nconst b2bLabels: CriteriaTransportsB2BLabels = {\n roundTripLabel: 'Round trip',\n oneWayLabel: 'One way',\n cabinClassLabel: 'Class',\n departureDateLabel: 'From',\n};\n\nconst cabinClassOptions: RadioSelectOption<string>[] = [\n { value: 'all', label: 'All classes' },\n { value: 'economy', label: 'Economy' },\n { value: 'business', label: 'Business' },\n { value: 'first', label: 'First class' },\n];\n\nconst topCities = [\n { code: 'BOS', name: 'Boston Logan International (BOS)' },\n { code: 'NYC', name: 'New York all airports (NYC)' },\n { code: 'MIA', name: 'Miami International (MIA)' },\n];\n\nconst otherCities = [\n { code: 'ABQ', name: 'Albuquerque (ABQ)' },\n { code: 'ANC', name: 'Anchorage International (ANC)' },\n { code: 'ATL', name: 'Atlanta Hartsfield-Jackson (ATL)' },\n { code: 'AUS', name: 'Austin-Bergstrom International (AUS)' },\n { code: 'DEN', name: 'Denver International (DEN)' },\n { code: 'LAX', name: 'Los Angeles International (LAX)' },\n { code: 'SEA', name: 'Seattle-Tacoma International (SEA)' },\n { code: 'SFO', name: 'San Francisco International (SFO)' },\n];\n\nexport default function CriteriaTransportsB2BDemo() {\n const [enabled, setEnabled] = useState(false);\n const [selected, setSelected] = useState<string | null>(null);\n const [flightType, setFlightType] = useState<'roundtrip' | 'oneway'>('roundtrip');\n const [cabinClass, setCabinClass] = useState<string | undefined>(undefined);\n const [departureQuery, setDepartureQuery] = useState('');\n\n return (\n <div className=\"w-[380px] space-y-24\">\n <CriteriaTransports\n mode=\"b2b\"\n labels={labels}\n b2bLabels={b2bLabels}\n title=\"Transport\"\n enabled={enabled}\n topCities={topCities}\n otherCities={otherCities}\n selectedAirportCode={selected}\n flightType={flightType}\n cabinClass={cabinClass}\n cabinClassOptions={cabinClassOptions}\n departureQuery={departureQuery}\n onToggle={setEnabled}\n onSelect={setSelected}\n onFlightTypeChange={setFlightType}\n onCabinClassChange={(_event, value) => setCabinClass(value)}\n onDepartureQueryChange={(_event, value) => setDepartureQuery(value)}\n onReset={() => {\n setEnabled(false);\n setSelected(null);\n setFlightType('roundtrip');\n setCabinClass(undefined);\n setDepartureQuery('');\n }}\n onApply={() => {}}\n />\n {selected && (\n <p className=\"text-b4\">\n Selected: <strong>{selected}</strong>\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAUA,IAAM,IAA4C;CAChD,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,uBAAuB;CACvB,6BACE;CACF,OAAO;CACP,OAAO;CACR,EAEK,IAAyC;CAC7C,gBAAgB;CAChB,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACrB,EAEK,IAAiD;CACrD;EAAE,OAAO;EAAO,OAAO;EAAe;CACtC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAY,OAAO;EAAY;CACxC;EAAE,OAAO;EAAS,OAAO;;CAC1B,EAEK,IAAY;CAChB;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAA+B;CACpD;EAAE,MAAM;EAAO,MAAM;;CACtB,EAEK,IAAc;CAClB;EAAE,MAAM;EAAO,MAAM;EAAqB;CAC1C;EAAE,MAAM;EAAO,MAAM;EAAiC;CACtD;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAAwC;CAC7D;EAAE,MAAM;EAAO,MAAM;EAA8B;CACnD;EAAE,MAAM;EAAO,MAAM;EAAmC;CACxD;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;;CACtB;AAED,SAAwB,IAA4B;CAClD,IAAM,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAU,KAAe,EAAwB,KAAK,EACvD,CAAC,GAAY,KAAiB,EAAiC,YAAY,EAC3E,CAAC,GAAY,KAAiB,EAA6B,KAAA,EAAU,EACrE,CAAC,GAAgB,KAAqB,EAAS,GAAG;AAExD,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GACE,MAAK;GACG;GACG;GACX,OAAM;GACG;GACE;GACE;GACb,qBAAqB;GACT;GACA;GACO;GACH;GAChB,UAAU;GACV,UAAU;GACV,oBAAoB;GACpB,qBAAqB,GAAQ,MAAU,EAAc,EAAM;GAC3D,yBAAyB,GAAQ,MAAU,EAAkB,EAAM;GACnE,eAAe;AAKb,IAJA,EAAW,GAAM,EACjB,EAAY,KAAK,EACjB,EAAc,YAAY,EAC1B,EAAc,KAAA,EAAU,EACxB,EAAkB,GAAG;;GAEvB,eAAe;GACf,CAAA,EACD,KACC,kBAAC,KAAD;GAAG,WAAU;aAAb,CAAuB,cACX,kBAAC,UAAD,EAAA,UAAS,GAAkB,CAAA,CAAA"}
@@ -1,34 +1,223 @@
1
1
  "use client";
2
2
  import { CriteriaTransports as e } from "../ui/criteria/CriteriaTransports.js";
3
- import { transportLabels as t, transportSections as n } from "./criteria-transports-data.js";
4
- import { useState as r } from "react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { useState as t } from "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
5
  //#region lib/examples/criteria-transports-demo.tsx
7
- function o() {
8
- let [o, s] = r(!1), [c, l] = r(null), u = (e) => {
9
- e.type === "enabled" && s(e.payload), e.type === "select" && l(e.payload);
10
- }, d = n.flatMap((e) => e.options);
11
- return /* @__PURE__ */ a("div", {
12
- className: "w-[380px] h-600 space-y-24",
13
- children: [/* @__PURE__ */ i(e, {
14
- mode: "b2c",
15
- labels: t,
6
+ var i = {
7
+ toggleLabel: "Add transportation from",
8
+ topCitiesLabel: "Top cities",
9
+ otherCitiesLabel: "Other cities",
10
+ clubMedTransportTitle: "Opt for Club Med transportation:",
11
+ clubMedTransportDescription: "Assistance and support in case of unforeseen events. Comfort guaranteed from departure to arrival.",
12
+ reset: "Reset",
13
+ apply: "Continue"
14
+ }, a = [
15
+ {
16
+ code: "BOS",
17
+ name: "Boston Logan International (BOS)"
18
+ },
19
+ {
20
+ code: "NYC",
21
+ name: "New York all airports (NYC)"
22
+ },
23
+ {
24
+ code: "MIA",
25
+ name: "Miami International (MIA)"
26
+ },
27
+ {
28
+ code: "LAX",
29
+ name: "Los Angeles International (LAX)"
30
+ },
31
+ {
32
+ code: "SFO",
33
+ name: "San Francisco International (SFO)"
34
+ }
35
+ ], o = [
36
+ {
37
+ code: "ABQ",
38
+ name: "Albuquerque (ABQ)"
39
+ },
40
+ {
41
+ code: "ANC",
42
+ name: "Anchorage International (ANC)"
43
+ },
44
+ {
45
+ code: "ATL",
46
+ name: "Atlanta Hartsfield-Jackson (ATL)"
47
+ },
48
+ {
49
+ code: "AUS",
50
+ name: "Austin-Bergstrom International (AUS)"
51
+ },
52
+ {
53
+ code: "BNA",
54
+ name: "Nashville International (BNA)"
55
+ },
56
+ {
57
+ code: "BUF",
58
+ name: "Buffalo Niagara International (BUF)"
59
+ },
60
+ {
61
+ code: "CLT",
62
+ name: "Charlotte Douglas International (CLT)"
63
+ },
64
+ {
65
+ code: "CMH",
66
+ name: "John Glenn Columbus International (CMH)"
67
+ },
68
+ {
69
+ code: "DAL",
70
+ name: "Dallas Love Field (DAL)"
71
+ },
72
+ {
73
+ code: "DEN",
74
+ name: "Denver International (DEN)"
75
+ },
76
+ {
77
+ code: "DTW",
78
+ name: "Detroit Metropolitan Wayne County (DTW)"
79
+ },
80
+ {
81
+ code: "HNL",
82
+ name: "Daniel K. Inouye International (HNL)"
83
+ },
84
+ {
85
+ code: "IAD",
86
+ name: "Washington Dulles International (IAD)"
87
+ },
88
+ {
89
+ code: "IND",
90
+ name: "Indianapolis International (IND)"
91
+ },
92
+ {
93
+ code: "JAX",
94
+ name: "Jacksonville International (JAX)"
95
+ },
96
+ {
97
+ code: "LAS",
98
+ name: "Harry Reid International (LAS)"
99
+ },
100
+ {
101
+ code: "MCI",
102
+ name: "Kansas City International (MCI)"
103
+ },
104
+ {
105
+ code: "MCO",
106
+ name: "Orlando International (MCO)"
107
+ },
108
+ {
109
+ code: "MDW",
110
+ name: "Chicago Midway International (MDW)"
111
+ },
112
+ {
113
+ code: "MEM",
114
+ name: "Memphis International (MEM)"
115
+ },
116
+ {
117
+ code: "MSP",
118
+ name: "Minneapolis-Saint Paul International (MSP)"
119
+ },
120
+ {
121
+ code: "MSY",
122
+ name: "Louis Armstrong New Orleans International (MSY)"
123
+ },
124
+ {
125
+ code: "OAK",
126
+ name: "Oakland Metropolitan International (OAK)"
127
+ },
128
+ {
129
+ code: "ORD",
130
+ name: "Chicago O'Hare International (ORD)"
131
+ },
132
+ {
133
+ code: "PHL",
134
+ name: "Philadelphia International (PHL)"
135
+ },
136
+ {
137
+ code: "PHX",
138
+ name: "Phoenix Sky Harbor International (PHX)"
139
+ },
140
+ {
141
+ code: "PIT",
142
+ name: "Pittsburgh International (PIT)"
143
+ },
144
+ {
145
+ code: "PDX",
146
+ name: "Portland International (PDX)"
147
+ },
148
+ {
149
+ code: "RDU",
150
+ name: "Raleigh-Durham International (RDU)"
151
+ },
152
+ {
153
+ code: "RSW",
154
+ name: "Southwest Florida International (RSW)"
155
+ },
156
+ {
157
+ code: "SAN",
158
+ name: "San Diego International (SAN)"
159
+ },
160
+ {
161
+ code: "SAT",
162
+ name: "San Antonio International (SAT)"
163
+ },
164
+ {
165
+ code: "SEA",
166
+ name: "Seattle-Tacoma International (SEA)"
167
+ },
168
+ {
169
+ code: "SJC",
170
+ name: "Norman Y. Mineta San José International (SJC)"
171
+ },
172
+ {
173
+ code: "SLC",
174
+ name: "Salt Lake City International (SLC)"
175
+ },
176
+ {
177
+ code: "SMF",
178
+ name: "Sacramento International (SMF)"
179
+ },
180
+ {
181
+ code: "SNA",
182
+ name: "John Wayne Airport Orange County (SNA)"
183
+ },
184
+ {
185
+ code: "STL",
186
+ name: "St. Louis Lambert International (STL)"
187
+ },
188
+ {
189
+ code: "TPA",
190
+ name: "Tampa International (TPA)"
191
+ },
192
+ {
193
+ code: "TUL",
194
+ name: "Tulsa International (TUL)"
195
+ }
196
+ ];
197
+ function s() {
198
+ let [s, c] = t(!1), [l, u] = t(null);
199
+ return /* @__PURE__ */ r("div", {
200
+ className: "w-[380px] space-y-24",
201
+ children: [/* @__PURE__ */ n(e, {
202
+ labels: i,
16
203
  title: "Transport",
17
- enabled: o,
18
- sections: n,
19
- selectedId: c,
20
- onChange: u,
204
+ enabled: s,
205
+ topCities: a,
206
+ otherCities: o,
207
+ selectedAirportCode: l,
208
+ onToggle: c,
209
+ onSelect: u,
21
210
  onReset: () => {
22
- s(!1), l(null);
211
+ c(!1), u(null);
23
212
  },
24
213
  onApply: () => {}
25
- }), c && /* @__PURE__ */ a("p", {
214
+ }), l && /* @__PURE__ */ r("p", {
26
215
  className: "text-b4",
27
- children: ["Selected: ", d.find((e) => e.id === c)?.label]
216
+ children: ["Selected: ", /* @__PURE__ */ n("strong", { children: l })]
28
217
  })]
29
218
  });
30
219
  }
31
220
  //#endregion
32
- export { o as default };
221
+ export { s as default };
33
222
 
34
223
  //# sourceMappingURL=criteria-transports-demo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"criteria-transports-demo.js","names":[],"sources":["../../lib/examples/criteria-transports-demo.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\n\nimport { CriteriaTransports } from '@/ui/criteria/CriteriaTransports';\nimport type { CriteriaTransportsAction } from '@/ui/criteria/CriteriaTransports';\nimport { transportLabels, transportSections } from './criteria-transports-data';\n\nexport default function CriteriaTransportsDemo() {\n const [enabled, setEnabled] = useState(false);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n const handleChange = (action: CriteriaTransportsAction) => {\n if (action.type === 'enabled') setEnabled(action.payload);\n if (action.type === 'select') setSelectedId(action.payload);\n };\n\n const allOptions = transportSections.flatMap((s) => s.options);\n\n return (\n <div className=\"w-[380px] h-600 space-y-24\">\n <CriteriaTransports\n mode=\"b2c\"\n labels={transportLabels}\n title=\"Transport\"\n enabled={enabled}\n sections={transportSections}\n selectedId={selectedId}\n onChange={handleChange}\n onReset={() => {\n setEnabled(false);\n setSelectedId(null);\n }}\n onApply={() => {}}\n />\n {selectedId && (\n <p className=\"text-b4\">Selected: {allOptions.find((o) => o.id === selectedId)?.label}</p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAwB,IAAyB;CAC/C,IAAM,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAE3D,KAAgB,MAAqC;AAEzD,EADI,EAAO,SAAS,aAAW,EAAW,EAAO,QAAQ,EACrD,EAAO,SAAS,YAAU,EAAc,EAAO,QAAQ;IAGvD,IAAa,EAAkB,SAAS,MAAM,EAAE,QAAQ;AAE9D,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GACE,MAAK;GACL,QAAQ;GACR,OAAM;GACG;GACT,UAAU;GACE;GACZ,UAAU;GACV,eAAe;AAEb,IADA,EAAW,GAAM,EACjB,EAAc,KAAK;;GAErB,eAAe;GACf,CAAA,EACD,KACC,kBAAC,KAAD;GAAG,WAAU;aAAb,CAAuB,cAAW,EAAW,MAAM,MAAM,EAAE,OAAO,EAAW,EAAE,MAAA"}
1
+ {"version":3,"file":"criteria-transports-demo.js","names":[],"sources":["../../lib/examples/criteria-transports-demo.tsx"],"sourcesContent":["'use client';\nimport { useState } from 'react';\n\nimport { CriteriaTransports } from '@/ui/criteria/CriteriaTransports';\nimport type { CriteriaTransportsProps } from '@/ui/criteria/CriteriaTransports';\n\nconst labels: CriteriaTransportsProps['labels'] = {\n toggleLabel: 'Add transportation from',\n topCitiesLabel: 'Top cities',\n otherCitiesLabel: 'Other cities',\n clubMedTransportTitle: 'Opt for Club Med transportation:',\n clubMedTransportDescription:\n 'Assistance and support in case of unforeseen events. Comfort guaranteed from departure to arrival.',\n reset: 'Reset',\n apply: 'Continue',\n};\n\nconst topCities = [\n { code: 'BOS', name: 'Boston Logan International (BOS)' },\n { code: 'NYC', name: 'New York all airports (NYC)' },\n { code: 'MIA', name: 'Miami International (MIA)' },\n { code: 'LAX', name: 'Los Angeles International (LAX)' },\n { code: 'SFO', name: 'San Francisco International (SFO)' },\n];\n\nconst otherCities = [\n { code: 'ABQ', name: 'Albuquerque (ABQ)' },\n { code: 'ANC', name: 'Anchorage International (ANC)' },\n { code: 'ATL', name: 'Atlanta Hartsfield-Jackson (ATL)' },\n { code: 'AUS', name: 'Austin-Bergstrom International (AUS)' },\n { code: 'BNA', name: 'Nashville International (BNA)' },\n { code: 'BUF', name: 'Buffalo Niagara International (BUF)' },\n { code: 'CLT', name: 'Charlotte Douglas International (CLT)' },\n { code: 'CMH', name: 'John Glenn Columbus International (CMH)' },\n { code: 'DAL', name: 'Dallas Love Field (DAL)' },\n { code: 'DEN', name: 'Denver International (DEN)' },\n { code: 'DTW', name: 'Detroit Metropolitan Wayne County (DTW)' },\n { code: 'HNL', name: 'Daniel K. Inouye International (HNL)' },\n { code: 'IAD', name: 'Washington Dulles International (IAD)' },\n { code: 'IND', name: 'Indianapolis International (IND)' },\n { code: 'JAX', name: 'Jacksonville International (JAX)' },\n { code: 'LAS', name: 'Harry Reid International (LAS)' },\n { code: 'MCI', name: 'Kansas City International (MCI)' },\n { code: 'MCO', name: 'Orlando International (MCO)' },\n { code: 'MDW', name: 'Chicago Midway International (MDW)' },\n { code: 'MEM', name: 'Memphis International (MEM)' },\n { code: 'MSP', name: 'Minneapolis-Saint Paul International (MSP)' },\n { code: 'MSY', name: 'Louis Armstrong New Orleans International (MSY)' },\n { code: 'OAK', name: 'Oakland Metropolitan International (OAK)' },\n { code: 'ORD', name: \"Chicago O'Hare International (ORD)\" },\n { code: 'PHL', name: 'Philadelphia International (PHL)' },\n { code: 'PHX', name: 'Phoenix Sky Harbor International (PHX)' },\n { code: 'PIT', name: 'Pittsburgh International (PIT)' },\n { code: 'PDX', name: 'Portland International (PDX)' },\n { code: 'RDU', name: 'Raleigh-Durham International (RDU)' },\n { code: 'RSW', name: 'Southwest Florida International (RSW)' },\n { code: 'SAN', name: 'San Diego International (SAN)' },\n { code: 'SAT', name: 'San Antonio International (SAT)' },\n { code: 'SEA', name: 'Seattle-Tacoma International (SEA)' },\n { code: 'SJC', name: 'Norman Y. Mineta San José International (SJC)' },\n { code: 'SLC', name: 'Salt Lake City International (SLC)' },\n { code: 'SMF', name: 'Sacramento International (SMF)' },\n { code: 'SNA', name: 'John Wayne Airport Orange County (SNA)' },\n { code: 'STL', name: 'St. Louis Lambert International (STL)' },\n { code: 'TPA', name: 'Tampa International (TPA)' },\n { code: 'TUL', name: 'Tulsa International (TUL)' },\n];\n\nexport default function CriteriaTransportsDemo() {\n const [enabled, setEnabled] = useState(false);\n const [selected, setSelected] = useState<string | null>(null);\n\n return (\n <div className=\"w-[380px] space-y-24\">\n <CriteriaTransports\n labels={labels}\n title=\"Transport\"\n enabled={enabled}\n topCities={topCities}\n otherCities={otherCities}\n selectedAirportCode={selected}\n onToggle={setEnabled}\n onSelect={setSelected}\n onReset={() => {\n setEnabled(false);\n setSelected(null);\n }}\n onApply={() => {}}\n />\n {selected && (\n <p className=\"text-b4\">\n Selected: <strong>{selected}</strong>\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAMA,IAAM,IAA4C;CAChD,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,uBAAuB;CACvB,6BACE;CACF,OAAO;CACP,OAAO;CACR,EAEK,IAAY;CAChB;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAA+B;CACpD;EAAE,MAAM;EAAO,MAAM;EAA6B;CAClD;EAAE,MAAM;EAAO,MAAM;EAAmC;CACxD;EAAE,MAAM;EAAO,MAAM;;CACtB,EAEK,IAAc;CAClB;EAAE,MAAM;EAAO,MAAM;EAAqB;CAC1C;EAAE,MAAM;EAAO,MAAM;EAAiC;CACtD;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAAwC;CAC7D;EAAE,MAAM;EAAO,MAAM;EAAiC;CACtD;EAAE,MAAM;EAAO,MAAM;EAAuC;CAC5D;EAAE,MAAM;EAAO,MAAM;EAAyC;CAC9D;EAAE,MAAM;EAAO,MAAM;EAA2C;CAChE;EAAE,MAAM;EAAO,MAAM;EAA2B;CAChD;EAAE,MAAM;EAAO,MAAM;EAA8B;CACnD;EAAE,MAAM;EAAO,MAAM;EAA2C;CAChE;EAAE,MAAM;EAAO,MAAM;EAAwC;CAC7D;EAAE,MAAM;EAAO,MAAM;EAAyC;CAC9D;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAAkC;CACvD;EAAE,MAAM;EAAO,MAAM;EAAmC;CACxD;EAAE,MAAM;EAAO,MAAM;EAA+B;CACpD;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;EAA+B;CACpD;EAAE,MAAM;EAAO,MAAM;EAA8C;CACnE;EAAE,MAAM;EAAO,MAAM;EAAmD;CACxE;EAAE,MAAM;EAAO,MAAM;EAA4C;CACjE;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;EAAoC;CACzD;EAAE,MAAM;EAAO,MAAM;EAA0C;CAC/D;EAAE,MAAM;EAAO,MAAM;EAAkC;CACvD;EAAE,MAAM;EAAO,MAAM;EAAgC;CACrD;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;EAAyC;CAC9D;EAAE,MAAM;EAAO,MAAM;EAAiC;CACtD;EAAE,MAAM;EAAO,MAAM;EAAmC;CACxD;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;EAAiD;CACtE;EAAE,MAAM;EAAO,MAAM;EAAsC;CAC3D;EAAE,MAAM;EAAO,MAAM;EAAkC;CACvD;EAAE,MAAM;EAAO,MAAM;EAA0C;CAC/D;EAAE,MAAM;EAAO,MAAM;EAAyC;CAC9D;EAAE,MAAM;EAAO,MAAM;EAA6B;CAClD;EAAE,MAAM;EAAO,MAAM;;CACtB;AAED,SAAwB,IAAyB;CAC/C,IAAM,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAU,KAAe,EAAwB,KAAK;AAE7D,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GACU;GACR,OAAM;GACG;GACE;GACE;GACb,qBAAqB;GACrB,UAAU;GACV,UAAU;GACV,eAAe;AAEb,IADA,EAAW,GAAM,EACjB,EAAY,KAAK;;GAEnB,eAAe;GACf,CAAA,EACD,KACC,kBAAC,KAAD;GAAG,WAAU;aAAb,CAAuB,cACX,kBAAC,UAAD,EAAA,UAAS,GAAkB,CAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clubmed/trident-ui",
3
- "version": "2.0.0-beta.74",
3
+ "version": "2.0.0-beta.75",
4
4
  "type": "module",
5
5
  "description": "Shared ClubMed React UI components",
6
6
  "keywords": [
@@ -12,6 +12,7 @@ var r = ({ className: r, children: i, innerClassName: a, isExpanded: o = !1, min
12
12
  style: { minHeight: s },
13
13
  className: e("overflow-hidden", a),
14
14
  ref: l,
15
+ ...o ? {} : { inert: !0 },
15
16
  children: i
16
17
  })
17
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ElasticHeight.js","names":[],"sources":["../../lib/ui/ElasticHeight.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { type ComponentPropsWithoutRef, type FunctionComponent, useRef } from 'react';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n\n return (\n <div\n {...attrs}\n className={clsx(\n 'overflow-hidden transition-all duration-500 grid',\n 'data-[expanded=true]:grid-rows-[1fr]',\n 'data-[expanded=false]:grid-rows-[0fr]',\n className,\n )}\n data-expanded={isExpanded}\n >\n <div style={{ minHeight: min }} className={clsx('overflow-hidden', innerClassName)} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;AASA,IAAa,KAAwD,EACnE,cACA,aACA,mBACA,gBAAa,IACb,SAAM,GACN,GAAG,QACC;CACJ,IAAM,IAAM,EAAuB,KAAY;AAE/C,QACE,kBAAC,OAAD;EACE,GAAI;EACJ,WAAW,EACT,oDACA,wCACA,yCACA,EACD;EACD,iBAAe;YAEf,kBAAC,OAAD;GAAK,OAAO,EAAE,WAAW,GAAK;GAAE,WAAW,EAAK,mBAAmB,EAAe;GAAO;GACtF;GACG,CAAA;EACF,CAAA"}
1
+ {"version":3,"file":"ElasticHeight.js","names":[],"sources":["../../lib/ui/ElasticHeight.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { type ComponentPropsWithoutRef, type FunctionComponent, useRef } from 'react';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n\n return (\n <div\n {...attrs}\n className={clsx(\n 'overflow-hidden transition-all duration-500 grid',\n 'data-[expanded=true]:grid-rows-[1fr]',\n 'data-[expanded=false]:grid-rows-[0fr]',\n className,\n )}\n data-expanded={isExpanded}\n >\n <div\n style={{ minHeight: min }}\n className={clsx('overflow-hidden', innerClassName)}\n ref={ref}\n {...(!isExpanded ? { inert: true } : {})}\n >\n {children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;AASA,IAAa,KAAwD,EACnE,cACA,aACA,mBACA,gBAAa,IACb,SAAM,GACN,GAAG,QACC;CACJ,IAAM,IAAM,EAAuB,KAAY;AAE/C,QACE,kBAAC,OAAD;EACE,GAAI;EACJ,WAAW,EACT,oDACA,wCACA,yCACA,EACD;EACD,iBAAe;YAEf,kBAAC,OAAD;GACE,OAAO,EAAE,WAAW,GAAK;GACzB,WAAW,EAAK,mBAAmB,EAAe;GAC7C;GACL,GAAM,IAA+B,EAAE,GAApB,EAAE,OAAO,IAAM;GAEjC;GACG,CAAA;EACF,CAAA"}
@@ -1,72 +1,53 @@
1
- import { Dispatch, FunctionComponent } from 'react';
2
- export interface TransportOption {
3
- id: string;
4
- label: string;
5
- }
6
- export interface TransportSection {
7
- title: string;
8
- options: TransportOption[];
9
- }
10
- export interface TransportPromotionalCard {
11
- icon?: string;
12
- title: string;
13
- description: string;
1
+ import { FunctionComponent } from 'react';
2
+ import { RadioSelectOption } from '../forms/RadioSelect';
3
+ export interface Airport {
4
+ code: string;
5
+ name: string;
14
6
  }
15
7
  export interface CriteriaTransportsLabels {
16
- addTransportationFrom: string;
8
+ toggleLabel: string;
9
+ topCitiesLabel: string;
10
+ otherCitiesLabel: string;
11
+ clubMedTransportTitle: string;
12
+ clubMedTransportDescription: string;
17
13
  reset?: string;
18
14
  apply?: string;
19
15
  }
20
- export type CriteriaTransportsAction = {
21
- type: 'enabled';
22
- payload: boolean;
23
- } | {
24
- type: 'select';
25
- payload: string | null;
26
- } | {
27
- type: 'flightType';
28
- payload: 'round-trip' | 'one-way';
29
- } | {
30
- type: 'flightClass';
31
- payload: string;
32
- } | {
33
- type: 'fromQuery';
34
- payload: string;
35
- };
16
+ export interface CriteriaTransportsB2BLabels {
17
+ roundTripLabel: string;
18
+ oneWayLabel: string;
19
+ cabinClassLabel: string;
20
+ departureDateLabel: string;
21
+ }
36
22
  export interface CriteriaTransportsProps {
37
23
  labels: CriteriaTransportsLabels;
38
24
  title?: string;
39
- /** card (default): white outer card with sand inner. flat: no background, content rendered directly */
25
+ /** card (default): white outer card with sand inner. flat: no background, fields rendered directly */
40
26
  variant?: 'card' | 'flat';
41
- /** b2c (default): large items + promotional card. b2b: compact items + flight controls */
27
+ /** Switches between B2C (default) and B2B mode. B2B mode adds flight type, cabin class, and departure selectors. */
42
28
  mode?: 'b2c' | 'b2b';
43
29
  enabled: boolean;
44
- sections: TransportSection[];
45
- selectedId: string | null;
30
+ topCities: Airport[];
31
+ otherCities: Airport[];
32
+ selectedAirportCode?: string | null;
46
33
  className?: string;
47
- onChange: Dispatch<CriteriaTransportsAction>;
34
+ onToggle: (enabled: boolean) => void;
35
+ onSelect: (code: string | null) => void;
48
36
  onReset?: () => void;
49
37
  onApply?: () => void;
50
- /** B2C: promotional card shown in the sand area when enabled=false */
51
- promotionalCard?: TransportPromotionalCard;
52
- /** Error message — shown instead of sections when enabled=true */
38
+ b2bLabels?: CriteriaTransportsB2BLabels;
39
+ /** Currently selected flight type (B2B mode). Defaults to 'roundtrip'. */
40
+ flightType?: 'roundtrip' | 'oneway';
41
+ onFlightTypeChange?: (type: 'roundtrip' | 'oneway') => void;
42
+ /** Currently selected cabin class value (B2B mode). */
43
+ cabinClass?: string;
44
+ /** Options for the cabin class RadioSelect (B2B mode). */
45
+ cabinClassOptions?: RadioSelectOption<string>[];
46
+ onCabinClassChange?: (event: Event, value: string) => void;
47
+ /** Controlled value for the departure airport TextField; also used to filter the airport list. */
48
+ departureQuery?: string;
49
+ onDepartureQueryChange?: (event: Event, value: string) => void;
50
+ /** Error message shown in B2B mode when a prerequisite (e.g. resort selection) is missing. */
53
51
  error?: string;
54
- /** B2B: controlled flight type */
55
- flightType?: 'round-trip' | 'one-way';
56
- /** B2B: labels for the round-trip/one-way radio row */
57
- flightTypeLabels?: {
58
- roundTrip: string;
59
- oneWay: string;
60
- };
61
- /** B2B: controlled selected class label */
62
- flightClass?: string;
63
- /** B2B: label for the class selector field */
64
- flightClassLabel?: string;
65
- /** B2B: available class options */
66
- flightClasses?: string[];
67
- /** B2B: controlled from/search query */
68
- fromQuery?: string;
69
- /** B2B: label for the from search field */
70
- fromQueryLabel?: string;
71
52
  }
72
53
  export declare const CriteriaTransports: FunctionComponent<CriteriaTransportsProps>;