mautourco-components 0.2.21 → 0.2.22

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.
Files changed (105) hide show
  1. package/dist/components/atoms/Checkbox/Checkbox.d.ts +3 -2
  2. package/dist/components/atoms/Checkbox/Checkbox.js +16 -6
  3. package/dist/components/atoms/Inputs/Input/Input.d.ts +1 -1
  4. package/dist/components/molecules/BookingPax/BookingPax.d.ts +43 -0
  5. package/dist/components/molecules/BookingPax/BookingPax.js +43 -0
  6. package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +34 -0
  7. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +10 -0
  8. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +89 -1
  9. package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +34 -11
  10. package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +43 -0
  11. package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +19 -0
  12. package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +15 -0
  13. package/dist/components/molecules/BookingPax/BookingPaxHeader.js +13 -0
  14. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +30 -0
  15. package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +15 -0
  16. package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +14 -0
  17. package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +11 -0
  18. package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +51 -0
  19. package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +19 -2
  20. package/dist/components/molecules/BookingPax/index.d.ts +1 -0
  21. package/dist/components/molecules/BookingPax/index.js +1 -0
  22. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +20 -0
  23. package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +17 -6
  24. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +18 -0
  25. package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +14 -3
  26. package/dist/components/organisms/Booking/BookingPaxList.d.ts +64 -0
  27. package/dist/components/organisms/Booking/BookingPaxList.js +19 -0
  28. package/dist/components/organisms/Dialog/Dialog.d.ts +1 -1
  29. package/dist/components/organisms/Dialog/Dialog.js +4 -4
  30. package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.d.ts +29 -0
  31. package/dist/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.js +31 -0
  32. package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.d.ts +29 -0
  33. package/dist/components/organisms/DialogBookingConfirm/BookingMailSent.js +31 -0
  34. package/dist/components/organisms/DialogBookingConfirm/BookingReference.d.ts +35 -0
  35. package/dist/components/organisms/DialogBookingConfirm/BookingReference.js +37 -0
  36. package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.d.ts +35 -0
  37. package/dist/components/organisms/DialogBookingConfirm/BookingSuccess.js +33 -0
  38. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +39 -2
  39. package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +25 -1
  40. package/dist/components/organisms/DialogBookingConfirm/index.d.ts +5 -0
  41. package/dist/components/organisms/DialogBookingConfirm/index.js +1 -0
  42. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.d.ts +25 -0
  43. package/dist/components/organisms/TabCancellationPolicy/CancellationAccom.js +16 -0
  44. package/dist/components/organisms/TabCancellationPolicy/CancellationBody.d.ts +24 -0
  45. package/dist/components/organisms/TabCancellationPolicy/CancellationBody.js +24 -0
  46. package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.d.ts +30 -0
  47. package/dist/components/organisms/TabCancellationPolicy/CancellationExcursion.js +15 -0
  48. package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.d.ts +23 -0
  49. package/dist/components/organisms/TabCancellationPolicy/CancellationHeader.js +23 -0
  50. package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.d.ts +22 -0
  51. package/dist/components/organisms/TabCancellationPolicy/CancellationTransfer.js +13 -0
  52. package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.d.ts +22 -0
  53. package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.js +13 -0
  54. package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.d.ts +18 -0
  55. package/dist/components/organisms/TabCancellationPolicy/HeaderExcursion.js +12 -0
  56. package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +7 -0
  57. package/dist/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.js +2 -1
  58. package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.d.ts +18 -0
  59. package/dist/components/organisms/TabCancellationPolicy/PolicyExcursion.js +12 -0
  60. package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.d.ts +11 -0
  61. package/dist/components/organisms/TabCancellationPolicy/PolicyTransfer.js +11 -0
  62. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.d.ts +29 -0
  63. package/dist/components/organisms/TabCancellationPolicy/TabCancellationPolicy.js +29 -0
  64. package/dist/index.d.ts +4 -0
  65. package/dist/index.js +2 -2
  66. package/dist/styles/components/checkbox.css +11 -5
  67. package/package.json +1 -2
  68. package/src/components/atoms/Checkbox/Checkbox.tsx +38 -23
  69. package/src/components/atoms/Inputs/Input/Input.tsx +1 -1
  70. package/src/components/molecules/BookingPax/BookingPax.tsx +43 -0
  71. package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +34 -0
  72. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +6 -0
  73. package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +92 -18
  74. package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +43 -0
  75. package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +28 -1
  76. package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +30 -0
  77. package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +14 -0
  78. package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +52 -2
  79. package/src/components/molecules/BookingPax/index.ts +2 -0
  80. package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +32 -12
  81. package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +27 -11
  82. package/src/components/organisms/Booking/BookingPaxList.tsx +64 -0
  83. package/src/components/organisms/Dialog/Dialog.tsx +13 -20
  84. package/src/components/organisms/DialogBookingConfirm/BookingCancellationPolicy.tsx +44 -0
  85. package/src/components/organisms/DialogBookingConfirm/BookingMailSent.tsx +56 -0
  86. package/src/components/organisms/DialogBookingConfirm/BookingReference.tsx +74 -0
  87. package/src/components/organisms/DialogBookingConfirm/BookingSuccess.tsx +67 -0
  88. package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +43 -2
  89. package/src/components/organisms/DialogBookingConfirm/index.ts +6 -0
  90. package/src/components/organisms/TabCancellationPolicy/CancellationAccom.tsx +25 -0
  91. package/src/components/organisms/TabCancellationPolicy/CancellationBody.tsx +24 -0
  92. package/src/components/organisms/TabCancellationPolicy/CancellationExcursion.tsx +30 -0
  93. package/src/components/organisms/TabCancellationPolicy/CancellationHeader.tsx +23 -0
  94. package/src/components/organisms/TabCancellationPolicy/CancellationTransfer.tsx +22 -0
  95. package/src/components/organisms/TabCancellationPolicy/HeaderAccom.tsx +22 -0
  96. package/src/components/organisms/TabCancellationPolicy/HeaderExcursion.tsx +18 -0
  97. package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.css +3 -0
  98. package/src/components/organisms/TabCancellationPolicy/PolicyAccom/PolicyAccom.tsx +3 -2
  99. package/src/components/organisms/TabCancellationPolicy/PolicyExcursion.tsx +18 -0
  100. package/src/components/organisms/TabCancellationPolicy/PolicyTransfer.tsx +11 -0
  101. package/src/components/organisms/TabCancellationPolicy/TabCancellationPolicy.tsx +29 -0
  102. package/src/styles/components/checkbox.css +11 -5
  103. package/dist/components/ui/checkbox.d.ts +0 -4
  104. package/dist/components/ui/checkbox.js +0 -31
  105. package/src/components/ui/checkbox.tsx +0 -32
@@ -3,6 +3,35 @@ import CancellationAccom from './CancellationAccom';
3
3
  import CancellationExcursion from './CancellationExcursion';
4
4
  import CancellationTransfer from './CancellationTransfer';
5
5
  import TabCancellationPolicyLayout from './TabCancellationPolicyLayout/TabCancellationPolicyLayout';
6
+ /**
7
+ * TabCancellationPolicy is a component that allows the user to display the tab cancellation policy.
8
+ *
9
+ * @example
10
+ * <TabCancellationPolicy>
11
+ * <TabCancellationPolicy.Accom
12
+ * hotelName="Hotel Name"
13
+ * pax="8 pax"
14
+ * dates={['2024-01-01', '2024-01-02']}
15
+ * image="/images/accom.png"
16
+ * roomPolicies={roomPolicies}
17
+ * isOnRequest={false}
18
+ * />
19
+ * <TabCancellationPolicy.Excursion
20
+ * name="Excursion Name"
21
+ * date="2024-01-01"
22
+ * image="/images/excursion.png"
23
+ * pickUpPoint="Pick Up Point"
24
+ * policies="Policies"
25
+ * />
26
+ * <TabCancellationPolicy.Transfer
27
+ * carName="Car Name"
28
+ * transferData={transferData}
29
+ * />
30
+ * </TabCancellationPolicy>
31
+ *
32
+ * @param props - The props for the TabCancellationPolicy component.
33
+ * @returns The TabCancellationPolicy component.
34
+ */
6
35
  declare function TabCancellationPolicy(props: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
7
36
  declare namespace TabCancellationPolicy {
8
37
  var Layout: typeof TabCancellationPolicyLayout;
@@ -14,6 +14,35 @@ import CancellationAccom from './CancellationAccom';
14
14
  import CancellationExcursion from './CancellationExcursion';
15
15
  import CancellationTransfer from './CancellationTransfer';
16
16
  import TabCancellationPolicyLayout from './TabCancellationPolicyLayout/TabCancellationPolicyLayout';
17
+ /**
18
+ * TabCancellationPolicy is a component that allows the user to display the tab cancellation policy.
19
+ *
20
+ * @example
21
+ * <TabCancellationPolicy>
22
+ * <TabCancellationPolicy.Accom
23
+ * hotelName="Hotel Name"
24
+ * pax="8 pax"
25
+ * dates={['2024-01-01', '2024-01-02']}
26
+ * image="/images/accom.png"
27
+ * roomPolicies={roomPolicies}
28
+ * isOnRequest={false}
29
+ * />
30
+ * <TabCancellationPolicy.Excursion
31
+ * name="Excursion Name"
32
+ * date="2024-01-01"
33
+ * image="/images/excursion.png"
34
+ * pickUpPoint="Pick Up Point"
35
+ * policies="Policies"
36
+ * />
37
+ * <TabCancellationPolicy.Transfer
38
+ * carName="Car Name"
39
+ * transferData={transferData}
40
+ * />
41
+ * </TabCancellationPolicy>
42
+ *
43
+ * @param props - The props for the TabCancellationPolicy component.
44
+ * @returns The TabCancellationPolicy component.
45
+ */
17
46
  export default function TabCancellationPolicy(props) {
18
47
  return _jsx("div", __assign({ className: "tab-cancellation-policy" }, props));
19
48
  }
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export { Breadcrumbs } from './components/molecules/Breadcrumbs/Breadcrumbs';
20
20
  export { default as CalendarInput } from './components/molecules/Calendar/CalendarInput';
21
21
  export { default as TimePicker } from './components/molecules/Calendar/TimePicker';
22
22
  export * from './components/molecules/DetailsInfo';
23
+ export * from './components/molecules/DialogContentPolicy';
23
24
  export { default as FeatureRow } from './components/molecules/FeatureRow/FeatureRow';
24
25
  export { default as FromTo } from './components/molecules/FromTo/FromTo';
25
26
  export { default as LocationDropdown } from './components/molecules/LocationDropdown/LocationDropdown';
@@ -42,6 +43,7 @@ export { default as CarBookingCard } from './components/organisms/CarBookingCard
42
43
  export { CardContainer } from './components/organisms/CardContainer/CardContainer';
43
44
  export { default as DateTimePicker } from './components/organisms/DateTimePicker/DateTimePicker';
44
45
  export { Dialog } from './components/organisms/Dialog/Dialog';
46
+ export * from './components/organisms/DialogBookingConfirm';
45
47
  export { Footer } from './components/organisms/Footer/Footer';
46
48
  export { default as MultipleQuotationDocket } from './components/organisms/MultipleQuotationDocket';
47
49
  export { default as PaxSelector } from './components/organisms/PaxSelector/PaxSelector';
@@ -81,6 +83,8 @@ export type { RoundTripData, RoundTripProps, RoundTripTransfer, } from './compon
81
83
  export type { SearchBarTransferData, SearchBarTransferProps, TransferMode, } from './components/organisms/SearchBarTransfer/SearchBarTransfer';
82
84
  export type { TopNavigationProps } from './components/organisms/TopNavigation/TopNavigation';
83
85
  export type { TransferLineData, TransferLineProps, TransferType, } from './components/organisms/TransferLine/TransferLine';
86
+ export type { CheckboxProps } from './components/atoms/Checkbox/Checkbox';
87
+ export type { InputProps } from './components/atoms/Inputs/Input/Input';
84
88
  export type { BreadcrumbsItem, BreadcrumbsProps, } from './components/molecules/Breadcrumbs/Breadcrumbs';
85
89
  export type { FromToProps } from './components/molecules/FromTo/FromTo';
86
90
  export type { SectionTitleProps } from './components/molecules/SectionTitle/SectionTitle';
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export { Breadcrumbs } from './components/molecules/Breadcrumbs/Breadcrumbs';
22
22
  export { default as CalendarInput } from './components/molecules/Calendar/CalendarInput';
23
23
  export { default as TimePicker } from './components/molecules/Calendar/TimePicker';
24
24
  export * from './components/molecules/DetailsInfo';
25
+ export * from './components/molecules/DialogContentPolicy';
25
26
  export { default as FeatureRow } from './components/molecules/FeatureRow/FeatureRow';
26
27
  export { default as FromTo } from './components/molecules/FromTo/FromTo';
27
28
  export { default as LocationDropdown } from './components/molecules/LocationDropdown/LocationDropdown';
@@ -45,6 +46,7 @@ export { default as CarBookingCard } from './components/organisms/CarBookingCard
45
46
  export { CardContainer } from './components/organisms/CardContainer/CardContainer';
46
47
  export { default as DateTimePicker } from './components/organisms/DateTimePicker/DateTimePicker';
47
48
  export { Dialog } from './components/organisms/Dialog/Dialog';
49
+ export * from './components/organisms/DialogBookingConfirm';
48
50
  export { Footer } from './components/organisms/Footer/Footer';
49
51
  export { default as MultipleQuotationDocket } from './components/organisms/MultipleQuotationDocket';
50
52
  export { default as PaxSelector } from './components/organisms/PaxSelector/PaxSelector';
@@ -71,5 +73,3 @@ export { default as SearchIcon } from './components/atoms/Icon/icons/Search';
71
73
  export { default as SettingsIcon } from './components/atoms/Icon/icons/Settings';
72
74
  export { default as UserIcon } from './components/atoms/Icon/icons/User';
73
75
  export * from './types/table';
74
- // export type { InputProps } from './components/atoms/Inputs/Input/Input';
75
- // export type { CheckboxProps } from './components/atoms/Checkbox/Checkbox';
@@ -2095,14 +2095,18 @@
2095
2095
  .checkbox-label {
2096
2096
  display: flex;
2097
2097
  align-items: center;
2098
- column-gap: var(--checkbox-spacing-inline-gap, var(--multiselect-spacing-option-icon-gap, 0.625rem));
2098
+ column-gap: var(
2099
+ --checkbox-spacing-inline-gap,
2100
+ var(--multiselect-spacing-option-icon-gap, 0.625rem)
2101
+ );
2099
2102
  cursor: pointer;
2100
2103
  -webkit-user-select: none;
2101
2104
  user-select: none;
2102
2105
  width: 100%;
2103
2106
  padding: var(--checkbox-spacing-label-padding, 0.5rem 0.75rem);
2104
2107
  border-radius: var(--checkbox-border-radius, 0.375rem);
2105
- transition: all var(--checkbox-transition-duration, 0.2s) var(--checkbox-transition-timing, ease-in-out);
2108
+ transition: all var(--checkbox-transition-duration, 0.2s)
2109
+ var(--checkbox-transition-timing, ease-in-out);
2106
2110
  }
2107
2111
 
2108
2112
  .checkbox-box {
@@ -2118,7 +2122,8 @@
2118
2122
  display: flex;
2119
2123
  align-items: center;
2120
2124
  justify-content: center;
2121
- transition: all var(--checkbox-transition-duration, 0.2s) var(--checkbox-transition-timing, ease-in-out);
2125
+ transition: all var(--checkbox-transition-duration, 0.2s)
2126
+ var(--checkbox-transition-timing, ease-in-out);
2122
2127
  flex-shrink: 0;
2123
2128
  }
2124
2129
 
@@ -2128,7 +2133,8 @@
2128
2133
  font-size: var(--checkbox-typography-fontSize, 0.875rem);
2129
2134
  line-height: var(--checkbox-typography-lineHeight, 1.25rem);
2130
2135
  color: var(--color-gray-900);
2131
- transition: color var(--checkbox-transition-duration, 0.2s) var(--checkbox-transition-timing, ease-in-out);
2136
+ transition: color var(--checkbox-transition-duration, 0.2s)
2137
+ var(--checkbox-transition-timing, ease-in-out);
2132
2138
  }
2133
2139
 
2134
2140
  .checkbox-leading {
@@ -2156,7 +2162,7 @@
2156
2162
 
2157
2163
  .checkbox--checked .checkbox-box {
2158
2164
  background-color: var(--color-transparent);
2159
- border-color: var(--checkbox-border-radius, 0.125rem);
2165
+ border-color: var(--color-atoll-green-800);
2160
2166
  }
2161
2167
 
2162
2168
  .checkbox--checked .checkbox-label {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Motorco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -25,7 +25,6 @@
25
25
  "motorco"
26
26
  ],
27
27
  "dependencies": {
28
- "@radix-ui/react-checkbox": "^1.3.3",
29
28
  "@radix-ui/react-popover": "^1.1.15",
30
29
  "@radix-ui/react-slot": "^1.2.4",
31
30
  "@radix-ui/react-tooltip": "^1.2.8",
@@ -1,15 +1,17 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import Check from '../Icon/icons/Check';
3
+ import { Text } from '../Typography/Typography';
3
4
 
4
- interface CheckboxProps {
5
+ export interface CheckboxProps {
5
6
  checked?: boolean;
6
7
  disabled?: boolean;
7
8
  error?: boolean;
8
9
  label?: string;
9
- onChange?: (checked: boolean) => void;
10
10
  className?: string;
11
11
  id?: string;
12
12
  leadingContent?: React.ReactNode;
13
+ labelPosition?: 'leading' | 'trailing';
14
+ onChange?: (checked: boolean) => void;
13
15
  }
14
16
 
15
17
  const Checkbox: React.FC<CheckboxProps> = ({
@@ -20,61 +22,74 @@ const Checkbox: React.FC<CheckboxProps> = ({
20
22
  onChange,
21
23
  className = '',
22
24
  id,
23
- leadingContent
25
+ leadingContent,
26
+ labelPosition = 'trailing',
24
27
  }) => {
28
+ const [isChecked, setIsChecked] = useState(false);
29
+
25
30
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
26
- if (!disabled && onChange) {
27
- onChange(e.target.checked);
31
+ if (!disabled) {
32
+ setIsChecked(e.target.checked);
28
33
  }
34
+ onChange?.(e.target.checked);
29
35
  };
30
36
 
31
37
  const handleLabelClick = (e: React.MouseEvent<HTMLLabelElement>) => {
32
38
  if (!disabled && onChange) {
33
39
  e.preventDefault();
34
- onChange(!checked);
40
+ onChange(!isChecked);
35
41
  }
36
42
  };
37
43
 
38
44
  const getStateClasses = () => {
39
45
  if (disabled) return 'checkbox--disabled';
40
46
  if (error) return 'checkbox--error';
41
- if (checked) return 'checkbox--checked';
47
+ if (isChecked) return 'checkbox--checked';
42
48
  return 'checkbox--default';
43
49
  };
44
50
 
45
51
  const checkboxId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
46
52
 
53
+ useEffect(() => {
54
+ setIsChecked(checked);
55
+ }, [checked]);
56
+
57
+ const renderLabel = () => {
58
+ return (
59
+ label && (
60
+ <Text
61
+ as="span"
62
+ size="sm"
63
+ variant="medium"
64
+ color={error ? 'state-error' : 'default'}>
65
+ {label}
66
+ </Text>
67
+ )
68
+ );
69
+ };
70
+
47
71
  return (
48
72
  <div className={`checkbox-container ${getStateClasses()} ${className}`}>
49
- <label
50
- htmlFor={checkboxId}
51
- className="checkbox-label"
52
- onClick={handleLabelClick}
53
- >
73
+ <label htmlFor={checkboxId} className="checkbox-label" onClick={handleLabelClick}>
54
74
  <input
55
75
  type="checkbox"
56
76
  id={checkboxId}
57
- checked={checked}
77
+ checked={isChecked}
58
78
  disabled={disabled}
59
79
  onChange={handleChange}
60
80
  className="checkbox-input"
61
81
  readOnly
62
82
  />
83
+ {labelPosition === 'leading' && renderLabel()}
63
84
  <div className="checkbox-button">
64
85
  <div className="checkbox-touch-target">
65
86
  <div className="checkbox-box">
66
- {checked && (
67
- <Check size="sm" className="checkbox-icon" />
68
- )}
87
+ {isChecked && <Check size="sm" className="checkbox-icon" />}
69
88
  </div>
70
89
  </div>
71
90
  </div>
72
- {leadingContent && (
73
- <span className="checkbox-leading">{leadingContent}</span>
74
- )}
75
- {label && (
76
- <span className="checkbox-text">{label}</span>
77
- )}
91
+ {leadingContent && <span className="checkbox-leading">{leadingContent}</span>}
92
+ {labelPosition === 'trailing' && renderLabel()}
78
93
  </label>
79
94
  </div>
80
95
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Icon, { IconName } from '../../Icon/Icon';
3
3
 
4
- interface InputProps {
4
+ export interface InputProps {
5
5
  variant?: 'default' | 'focus' | 'success' | 'error' | 'disabled';
6
6
  placeholder?: string;
7
7
  value?: string;
@@ -3,6 +3,49 @@ import { BookingPaxAccom } from './BookingPaxAccom';
3
3
  import { BookingPaxExcursion } from './BookingPaxExcursion';
4
4
  import { BookingPaxTransfer } from './BookingPaxTransfer';
5
5
 
6
+ /**
7
+ * BookingPax is a component that allows the user to display the booking pax.
8
+ *
9
+ * @example
10
+ * <BookingPax>
11
+ * <BookingPax.Accom
12
+ * name="Hotel Name"
13
+ * type="hotel"
14
+ * clientsInfo={clientsInfo}
15
+ * paxCount={1}
16
+ * selectedClientsInfoIds={selectedClientsInfoIds}
17
+ * isSubmitted={false}
18
+ * onPaxChange={onPaxChange}
19
+ * onRemarkChange={onRemarkChange}
20
+ * onError={onError}
21
+ * />
22
+ * <BookingPax.Excursion
23
+ * name="Excursion Name"
24
+ * type="sea"
25
+ * clientsInfo={clientsInfo}
26
+ * paxCount={1}
27
+ * selectedClientsInfoIds={selectedClientsInfoIds}
28
+ * isSubmitted={false}
29
+ * onPaxChange={onPaxChange}
30
+ * onRemarkChange={onRemarkChange}
31
+ * onError={onError}
32
+ * />
33
+ * <BookingPax.Transfer
34
+ * name="Transfer Name"
35
+ * type="transfer"
36
+ * clientsInfo={clientsInfo}
37
+ * paxCount={1}
38
+ * selectedClientsInfoIds={selectedClientsInfoIds}
39
+ * isSubmitted={false}
40
+ * onPaxChange={onPaxChange}
41
+ * onRemarkChange={onRemarkChange}
42
+ * onError={onError}
43
+ * />
44
+ * </BookingPax>
45
+ *
46
+ * @param props - The props for the BookingPax component.
47
+ * @returns The BookingPax component.
48
+ */
6
49
  export const BookingPax = (props: React.PropsWithChildren) => {
7
50
  return <div className="booking-pax space-y-6" {...props} />;
8
51
  };
@@ -11,16 +11,50 @@ import { BookingPaxLayout } from './BookingPaxLayout/BookingPaxLayout';
11
11
  import { BookingPaxRemarks } from './BookingPaxRemarks';
12
12
 
13
13
  export interface BookingPaxAccomRoom {
14
+ /**
15
+ * The pax count of the room.
16
+ */
14
17
  paxCount: number;
15
18
  }
16
19
 
17
20
  export interface RoomData {
21
+ /**
22
+ * The room of the room data.
23
+ */
18
24
  room: BookingPaxAccomRoom;
25
+ /**
26
+ * The room index of the room data.
27
+ */
19
28
  roomIndex: number;
29
+ /**
30
+ * The selected count of the room data.
31
+ */
20
32
  selectedCount: number;
33
+ /**
34
+ * Whether the pax count is error.
35
+ */
21
36
  isPaxCountError: boolean;
22
37
  }
23
38
 
39
+ /**
40
+ * BookingPaxAccomProps is the props for the BookingPaxAccom component.
41
+ *
42
+ * @example
43
+ * <BookingPaxAccom
44
+ * rooms={rooms}
45
+ * clientsInfo={clientsInfo}
46
+ * hotelName="Hotel Name"
47
+ * roomName="Room Name"
48
+ * selectedClientsInfoIds={selectedClientsInfoIds}
49
+ * isSubmitted={false}
50
+ * onPaxChange={onPaxChange}
51
+ * onRemarkChange={onRemarkChange}
52
+ * onError={onError}
53
+ * />
54
+ *
55
+ * @param props - The props for the BookingPaxAccom component.
56
+ * @returns The BookingPaxAccom component.
57
+ */
24
58
  export interface BookingPaxAccomProps extends Pick<
25
59
  BookingPaxClientProps,
26
60
  'selectedClientsInfoIds' | 'onPaxChange'
@@ -1,4 +1,10 @@
1
1
  .booking-pax-client {
2
2
  @apply grid gap-x-4 gap-y-2;
3
3
  @apply lg:grid-cols-2;
4
+ .checkbox-container {
5
+ label {
6
+ padding: 0;
7
+ background-color: transparent;
8
+ }
9
+ }
4
10
  }
@@ -1,41 +1,128 @@
1
+ import Checkbox, { CheckboxProps } from '@/src/components/atoms/Checkbox/Checkbox';
1
2
  import { Text } from '@/src/components/atoms/Typography/Typography';
2
- import { Checkbox } from '@/src/components/ui/checkbox';
3
3
  import useBookingPax from '@/src/hooks/useBookingPax';
4
4
  import { cn } from '@/src/lib/utils';
5
- import { CheckboxProps } from '@radix-ui/react-checkbox';
6
5
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
6
  import './BookingPaxClient.css';
8
7
 
9
8
  export interface BookingPaxClientInfo {
9
+ /**
10
+ * The first name of the client.
11
+ */
10
12
  firstName: string;
13
+ /**
14
+ * The last name of the client.
15
+ */
11
16
  lastName: string;
17
+ /**
18
+ * The age of the client.
19
+ */
12
20
  age: number;
21
+ /**
22
+ * The client type.
23
+ */
13
24
  clientType: 'Adult' | 'Teen' | 'Child' | 'Infant';
25
+ /**
26
+ * The client id.
27
+ */
14
28
  clientId: string;
15
29
  }
16
30
 
17
31
  export interface BookingPaxClientOptions {
32
+ /**
33
+ * The client id.
34
+ */
18
35
  clientId: string;
36
+ /**
37
+ * Whether the client is checked.
38
+ */
19
39
  checked: CheckboxProps['checked'];
40
+ /**
41
+ * The selected index.
42
+ */
20
43
  selectedIndex: number;
44
+ /**
45
+ * The selected pax index.
46
+ */
21
47
  selectedPaxIndex?: number;
48
+ /**
49
+ * The pax count.
50
+ */
22
51
  paxCount?: number;
52
+ /**
53
+ * The selected clients info ids.
54
+ */
23
55
  selectedClientsInfoIds?: Record<string | number, string[]>;
56
+ /**
57
+ * The selected clients.
58
+ */
24
59
  selectedClients?: Record<string | number, BookingPaxClientInfo[]>;
25
60
  }
26
61
 
27
62
  export interface BookingPaxClientProps {
63
+ /**
64
+ * The clients to select from.
65
+ */
28
66
  clients: BookingPaxClientInfo[];
67
+ /**
68
+ * The id of the booking pax client.
69
+ */
29
70
  id: string;
71
+ /**
72
+ * The selected clients info ids.
73
+ */
30
74
  selectedClientsInfoIds?: Record<string | number, string[]>;
75
+ /**
76
+ * The selected index.
77
+ */
31
78
  selectedIndex: number;
79
+ /**
80
+ * The selected pax index.
81
+ */
32
82
  selectedPaxIndex?: number;
83
+ /**
84
+ * The pax count.
85
+ */
33
86
  paxCount?: number;
87
+ /**
88
+ * Whether the form has been submitted.
89
+ */
34
90
  isSubmitted?: boolean;
91
+ /**
92
+ * The callback function to call when the pax changes.
93
+ */
35
94
  onPaxChange?: (options: BookingPaxClientOptions) => void;
95
+ /**
96
+ * The callback function to call when the error changes.
97
+ */
36
98
  onError?: (hasError: boolean) => void;
37
99
  }
38
100
 
101
+ /**
102
+ * BookingPaxClient is a component that allows the user to select the pax for a booking.
103
+ *
104
+ * @example
105
+ * <BookingPaxClient
106
+ * clients={clients}
107
+ * id="booking-pax-client"
108
+ * selectedClientsInfoIds={selectedClientsInfoIds}
109
+ * selectedIndex={0}
110
+ * paxCount={1}
111
+ * isSubmitted={false}
112
+ * onPaxChange={onPaxChange}
113
+ * onError={onError}
114
+ * />
115
+ *
116
+ * @param props - The props for the BookingPaxClient component.
117
+ * @param props.clients - The clients to select from.
118
+ * @param props.id - The id of the booking pax client.
119
+ * @param props.selectedClientsInfoIds - The selected clients info ids.
120
+ * @param props.selectedIndex - The selected index.
121
+ * @param props.paxCount - The pax count.
122
+ * @param props.isSubmitted - Whether the form has been submitted.
123
+ * @param props.onPaxChange - The callback function to call when the pax changes.
124
+ * @returns The BookingPaxClient component.
125
+ */
39
126
  export const BookingPaxClient: React.FC<BookingPaxClientProps> = (props) => {
40
127
  const {
41
128
  clients,
@@ -151,11 +238,12 @@ export const BookingPaxClient: React.FC<BookingPaxClientProps> = (props) => {
151
238
  <div key={client.clientId}>
152
239
  <div className="flex items-center gap-x-2">
153
240
  <Checkbox
154
- data-error={showError}
155
241
  id={`pc-${id}-${selectedIndex}-${client.clientId}`}
156
242
  checked={isSelected || clients.length === paxCount}
157
243
  disabled={clients.length === paxCount}
158
- onCheckedChange={(checked) => {
244
+ error={showError}
245
+ label={`${client.firstName} ${client.lastName} (${client.clientType}${client.clientType !== 'Adult' ? ` - ${client.age} years old` : ''})`}
246
+ onChange={(checked) => {
159
247
  handlePaxChange({
160
248
  clientId: client.clientId,
161
249
  checked,
@@ -164,20 +252,6 @@ export const BookingPaxClient: React.FC<BookingPaxClientProps> = (props) => {
164
252
  });
165
253
  }}
166
254
  />
167
- <label
168
- htmlFor={`pc-${id}-${selectedIndex}-${client.clientId}`}
169
- className={cn('cursor-pointer', {
170
- 'pointer-events-none': clients.length === paxCount,
171
- })}>
172
- <Text
173
- size="sm"
174
- leading="4"
175
- as="span"
176
- color={showError ? 'state-error' : undefined}>
177
- {client.firstName} {client.lastName} ({client.clientType}
178
- {client.clientType !== 'Adult' && ` - ${client.age} years old`})
179
- </Text>
180
- </label>
181
255
  </div>
182
256
  </div>
183
257
  );
@@ -15,13 +15,37 @@ export interface BookingPaxExcursionProps extends Pick<
15
15
  BookingPaxClientProps,
16
16
  'selectedClientsInfoIds' | 'onPaxChange'
17
17
  > {
18
+ /**
19
+ * The clients info of the booking pax excursion.
20
+ */
18
21
  clientsInfo: BookingPaxClientInfo[];
22
+ /**
23
+ * The name of the booking pax excursion.
24
+ */
19
25
  name: string;
26
+ /**
27
+ * The type of the booking pax excursion.
28
+ */
20
29
  type: ExcursionType;
30
+ /**
31
+ * Whether the booking pax excursion is submitted.
32
+ */
21
33
  isSubmitted?: boolean;
34
+ /**
35
+ * The pax count of the booking pax excursion.
36
+ */
22
37
  paxCount: number;
38
+ /**
39
+ * The max pax count of the booking pax excursion.
40
+ */
23
41
  maxPaxCount?: number;
42
+ /**
43
+ * The callback function to call when the remark changes.
44
+ */
24
45
  onRemarkChange?: (value: string) => void;
46
+ /**
47
+ * The callback function to call when the error changes.
48
+ */
25
49
  onError?: (hasError: boolean) => void;
26
50
  }
27
51
 
@@ -31,6 +55,25 @@ const mapType: Record<BookingPaxExcursionProps['type'], string> = {
31
55
  catamaran: 'Cruise excursion',
32
56
  };
33
57
 
58
+ /**
59
+ * BookingPaxExcursion is a component that allows the user to display the booking pax excursion.
60
+ *
61
+ * @example
62
+ * <BookingPaxExcursion
63
+ * name="Excursion Name"
64
+ * type="sea"
65
+ * clientsInfo={clientsInfo}
66
+ * paxCount={1}
67
+ * selectedClientsInfoIds={selectedClientsInfoIds}
68
+ * isSubmitted={false}
69
+ * onPaxChange={onPaxChange}
70
+ * onRemarkChange={onRemarkChange}
71
+ * onError={onError}
72
+ * />
73
+ *
74
+ * @param props - The props for the BookingPaxExcursion component.
75
+ * @returns The BookingPaxExcursion component.
76
+ */
34
77
  export const BookingPaxExcursion: React.FC<BookingPaxExcursionProps> = (props) => {
35
78
  const {
36
79
  name,