@driveflux/beam 3.0.10 → 3.0.11

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 (219) hide show
  1. package/dist/accordion/Accordion.js +133 -7
  2. package/dist/accordion/Accordion.stories.js +31 -11
  3. package/dist/alert/Alert.js +120 -19
  4. package/dist/alert/Alert.stories.js +50 -15
  5. package/dist/animations/LoadingAnimation.js +34 -21
  6. package/dist/badge/Badge.js +96 -7
  7. package/dist/badge/Badge.stories.js +28 -7
  8. package/dist/box/Box.js +87 -3
  9. package/dist/box/Box.stories.js +8 -7
  10. package/dist/breadcrumbs/Breadcrumbs.js +288 -28
  11. package/dist/breadcrumbs/Breadcrumbs.stories.js +51 -27
  12. package/dist/button/Button.js +127 -13
  13. package/dist/button/Button.stories.js +35 -7
  14. package/dist/button/TextButton.js +104 -9
  15. package/dist/card/Card.js +109 -7
  16. package/dist/card/Card.stories.js +10 -7
  17. package/dist/carousel/Carousel.js +281 -58
  18. package/dist/carousel/Carousel.stories.js +39 -7
  19. package/dist/carousel/CarouselButton.js +68 -7
  20. package/dist/center/Center.js +63 -3
  21. package/dist/center/Center.stories.js +19 -7
  22. package/dist/checkbox/Checkbox.js +124 -4
  23. package/dist/checkbox/Checkbox.stories.js +10 -8
  24. package/dist/chip/Chip.js +104 -3
  25. package/dist/chip/Chip.stories.js +19 -7
  26. package/dist/circular-progress/CircularProgress.js +150 -11
  27. package/dist/circular-progress/CircularProgress.stories.js +54 -14
  28. package/dist/command/command.js +170 -13
  29. package/dist/datepicker/DatePicker.js +234 -90
  30. package/dist/datepicker/DatePicker.stories.js +163 -58
  31. package/dist/datepicker/DatePickerDrawer.js +116 -17
  32. package/dist/datepicker/DatePickerPopover.js +208 -35
  33. package/dist/datepicker/constants.js +3 -4
  34. package/dist/datepicker/utils.js +4 -11
  35. package/dist/dialog/index.js +180 -33
  36. package/dist/divider/Divider.js +63 -3
  37. package/dist/divider/Divider.stories.js +13 -7
  38. package/dist/drawer/index.js +157 -12
  39. package/dist/dropdown/Dropdown.js +212 -26
  40. package/dist/dropdown/Dropdown.stories.js +109 -22
  41. package/dist/field-wrapper/FieldWrapper.js +139 -3
  42. package/dist/field-wrapper/FieldWrapper.stories.js +124 -28
  43. package/dist/flex/Flex.js +63 -3
  44. package/dist/flex/Flex.stories.js +19 -7
  45. package/dist/grid/Grid.js +63 -3
  46. package/dist/grid/Grid.stories.js +28 -7
  47. package/dist/hooks/use-breakpoint-value.js +77 -14
  48. package/dist/hooks/use-media-query.js +61 -12
  49. package/dist/hstack/HStack.js +63 -3
  50. package/dist/hstack/HStack.stories.js +19 -7
  51. package/dist/icons/FluxLogo.js +213 -9
  52. package/dist/icons/FluxLogoTable.js +109 -5
  53. package/dist/icons/Icon.js +108 -7
  54. package/dist/icons/Icon.stories.js +12 -7
  55. package/dist/icons/Icon24Hours.js +83 -5
  56. package/dist/icons/IconAcceleration.js +72 -4
  57. package/dist/icons/IconAccount.js +72 -4
  58. package/dist/icons/IconApplicant.js +78 -5
  59. package/dist/icons/IconArrow.js +78 -6
  60. package/dist/icons/IconArrowBack.js +72 -4
  61. package/dist/icons/IconArrowForward.js +72 -4
  62. package/dist/icons/IconArrowTopLeft.js +70 -4
  63. package/dist/icons/IconBluesharkProductGuide.js +80 -5
  64. package/dist/icons/IconBolt.js +72 -4
  65. package/dist/icons/IconBriefcase.js +72 -4
  66. package/dist/icons/IconBulb.js +72 -4
  67. package/dist/icons/IconCalendar.js +72 -4
  68. package/dist/icons/IconCalendarArrowBack.js +72 -4
  69. package/dist/icons/IconCalendarArrowForward.js +72 -4
  70. package/dist/icons/IconCalendarDoubleArrowBack.js +72 -4
  71. package/dist/icons/IconCalendarDoubleArrowForward.js +72 -4
  72. package/dist/icons/IconCancel.js +77 -5
  73. package/dist/icons/IconCancelMark.js +72 -4
  74. package/dist/icons/IconCarSUV.js +72 -4
  75. package/dist/icons/IconCarSedan.js +147 -7
  76. package/dist/icons/IconChain.js +79 -5
  77. package/dist/icons/IconCheckmark.js +72 -4
  78. package/dist/icons/IconChevronRight.js +72 -4
  79. package/dist/icons/IconCircle.js +114 -11
  80. package/dist/icons/IconCircleCheckmark.js +77 -5
  81. package/dist/icons/IconCircleError.js +72 -4
  82. package/dist/icons/IconCircleExclamation.js +104 -6
  83. package/dist/icons/IconCircleMark.js +78 -5
  84. package/dist/icons/IconCircleOutline.js +139 -5
  85. package/dist/icons/IconClock.js +80 -5
  86. package/dist/icons/IconClose.js +72 -4
  87. package/dist/icons/IconCollapseAll.js +94 -5
  88. package/dist/icons/IconConcierge.js +79 -5
  89. package/dist/icons/IconConciergeService.js +87 -5
  90. package/dist/icons/IconCreditCard.js +78 -5
  91. package/dist/icons/IconDash.js +72 -4
  92. package/dist/icons/IconDeliver.js +72 -4
  93. package/dist/icons/IconDelivery.js +87 -5
  94. package/dist/icons/IconDetails.js +72 -4
  95. package/dist/icons/IconDot.js +87 -6
  96. package/dist/icons/IconDownload.js +79 -5
  97. package/dist/icons/IconEVCharging.js +79 -5
  98. package/dist/icons/IconElectricCarFuel.js +80 -5
  99. package/dist/icons/IconEllipsis.js +78 -5
  100. package/dist/icons/IconEnvelope.js +72 -4
  101. package/dist/icons/IconExpandAll.js +94 -5
  102. package/dist/icons/IconEye.js +79 -5
  103. package/dist/icons/IconFacebook.js +94 -6
  104. package/dist/icons/IconFilter.js +83 -5
  105. package/dist/icons/IconFlagMalaysia.js +141 -5
  106. package/dist/icons/IconGiveKey.js +79 -5
  107. package/dist/icons/IconGlobe.js +70 -4
  108. package/dist/icons/IconGoogle.js +87 -5
  109. package/dist/icons/IconHome.js +78 -5
  110. package/dist/icons/IconHostAdvertise.js +72 -4
  111. package/dist/icons/IconHostCar.js +75 -4
  112. package/dist/icons/IconHostCash.js +91 -5
  113. package/dist/icons/IconHostHandle.js +70 -4
  114. package/dist/icons/IconHostLocation.js +70 -4
  115. package/dist/icons/IconHostPayment.js +91 -5
  116. package/dist/icons/IconHostService.js +79 -5
  117. package/dist/icons/IconHotDeals.js +72 -4
  118. package/dist/icons/IconInfo.js +77 -5
  119. package/dist/icons/IconInstagram.js +72 -4
  120. package/dist/icons/IconInsurance.js +99 -5
  121. package/dist/icons/IconInternet.js +73 -4
  122. package/dist/icons/IconInventory.js +78 -5
  123. package/dist/icons/IconLaurel.js +101 -5
  124. package/dist/icons/IconLinkedIn.js +72 -4
  125. package/dist/icons/IconLoading.js +78 -4
  126. package/dist/icons/IconLocation.js +80 -5
  127. package/dist/icons/IconLock.js +73 -4
  128. package/dist/icons/IconLogistics.js +72 -4
  129. package/dist/icons/IconMail.js +94 -5
  130. package/dist/icons/IconMember.js +78 -5
  131. package/dist/icons/IconMobilePen.js +83 -5
  132. package/dist/icons/IconMotorcycleMoped.js +78 -5
  133. package/dist/icons/IconNoCost.js +92 -5
  134. package/dist/icons/IconPDF.js +80 -5
  135. package/dist/icons/IconPencil.js +70 -4
  136. package/dist/icons/IconPhone.js +70 -4
  137. package/dist/icons/IconPlus.js +72 -4
  138. package/dist/icons/IconPricing.js +72 -4
  139. package/dist/icons/IconProtected.js +71 -4
  140. package/dist/icons/IconPsychology.js +72 -4
  141. package/dist/icons/IconQuestionTooltip.js +73 -4
  142. package/dist/icons/IconQuote.js +72 -4
  143. package/dist/icons/IconRate.js +71 -4
  144. package/dist/icons/IconRegister.js +99 -5
  145. package/dist/icons/IconReport.js +89 -6
  146. package/dist/icons/IconReturn.js +72 -4
  147. package/dist/icons/IconSearch.js +70 -4
  148. package/dist/icons/IconSecure.js +71 -4
  149. package/dist/icons/IconSecurity.js +73 -4
  150. package/dist/icons/IconSedanOutline.js +159 -5
  151. package/dist/icons/IconSelectArrow.js +78 -6
  152. package/dist/icons/IconSort.js +79 -5
  153. package/dist/icons/IconSortListed.js +95 -5
  154. package/dist/icons/IconSortPriceAscending.js +83 -5
  155. package/dist/icons/IconSortPriceDescending.js +83 -5
  156. package/dist/icons/IconSortYear.js +79 -5
  157. package/dist/icons/IconSpan.js +71 -4
  158. package/dist/icons/IconSpeaker.js +79 -4
  159. package/dist/icons/IconSpecialCar.js +95 -5
  160. package/dist/icons/IconStar.js +92 -7
  161. package/dist/icons/IconStockPhoto.js +95 -5
  162. package/dist/icons/IconSubscription.js +113 -6
  163. package/dist/icons/IconSubscriptions.js +113 -6
  164. package/dist/icons/IconSwap.js +79 -5
  165. package/dist/icons/IconTax.js +72 -4
  166. package/dist/icons/IconThinArrow.js +78 -6
  167. package/dist/icons/IconThumbsdown.js +78 -5
  168. package/dist/icons/IconThumbsup.js +78 -5
  169. package/dist/icons/IconTool.js +72 -4
  170. package/dist/icons/IconTooltip.js +73 -4
  171. package/dist/icons/IconTrash.js +72 -4
  172. package/dist/icons/IconTriangleExclamation.js +72 -4
  173. package/dist/icons/IconTyersBrakes.js +83 -5
  174. package/dist/icons/IconTyre.js +83 -5
  175. package/dist/icons/IconVacancy.js +78 -5
  176. package/dist/icons/IconVolunteer.js +72 -4
  177. package/dist/icons/IconWhatsapp.js +73 -4
  178. package/dist/icons/IconXPlatform.js +72 -4
  179. package/dist/icons/IconZeroEffort.js +77 -5
  180. package/dist/icons/Logo.js +99 -3
  181. package/dist/input/Input.js +125 -11
  182. package/dist/input/Input.stories.js +17 -18
  183. package/dist/input-mask/InputMask.js +149 -11
  184. package/dist/input-mask/InputMask.stories.js +5 -6
  185. package/dist/input-mask/mask-trackers.js +4 -5
  186. package/dist/input-select/InputSelect.js +357 -68
  187. package/dist/input-select/InputSelect.stories.js +98 -25
  188. package/dist/popover/popover.js +72 -4
  189. package/dist/progress/Progress.js +96 -2
  190. package/dist/progress/Progress.stories.js +13 -14
  191. package/dist/radio/Radio.js +163 -4
  192. package/dist/scroll-area/scroll-area.js +113 -5
  193. package/dist/search-input-select/SearchInputSelect.js +346 -69
  194. package/dist/select/Select.js +315 -29
  195. package/dist/select/Select.stories.js +55 -19
  196. package/dist/skeleton/Skeleton.js +62 -3
  197. package/dist/skeleton/Skeleton.stories.js +8 -7
  198. package/dist/slider/Slider.js +106 -5
  199. package/dist/slider/Slider.stories.js +12 -11
  200. package/dist/stack/Stack.js +63 -3
  201. package/dist/stack/Stack.stories.js +19 -7
  202. package/dist/table/Table.js +131 -10
  203. package/dist/table/Table.stories.js +84 -8
  204. package/dist/tabs/Tabs.js +128 -9
  205. package/dist/tabs/Tabs.stories.js +46 -13
  206. package/dist/text/Text.js +88 -6
  207. package/dist/text/Text.stories.js +44 -7
  208. package/dist/toast/Toast.stories.js +66 -14
  209. package/dist/toast/ToastBox.js +77 -29
  210. package/dist/toast/index.js +0 -1
  211. package/dist/toast/sonner.js +66 -6
  212. package/dist/toggle/Toggle.js +116 -7
  213. package/dist/toggle/Toggle.stories.js +10 -8
  214. package/dist/tooltip/Tooltip.js +151 -12
  215. package/dist/tooltip/Tooltip.stories.js +71 -13
  216. package/dist/utils.js +4 -2
  217. package/dist/vstack/VStack.js +63 -3
  218. package/dist/vstack/VStack.stories.js +19 -7
  219. package/package.json +1 -1
@@ -1,79 +1,184 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
1
47
  import { jsx as _jsx } from "react/jsx-runtime";
2
48
  import { useState } from 'react';
3
49
  import DatePicker from './DatePicker.js';
4
- const meta = {
50
+ var meta = {
5
51
  component: DatePicker,
6
52
  argTypes: {
7
53
  locale: {
8
- options: ['en', 'ms', 'zh', 'ar'],
9
- control: { type: 'select' },
54
+ options: [
55
+ 'en',
56
+ 'ms',
57
+ 'zh',
58
+ 'ar'
59
+ ],
60
+ control: {
61
+ type: 'select'
62
+ }
10
63
  },
11
64
  calendarType: {
12
- options: ['iso8601', 'gregory', 'islamic', 'hebrew'],
13
- control: { type: 'select' },
14
- },
15
- },
65
+ options: [
66
+ 'iso8601',
67
+ 'gregory',
68
+ 'islamic',
69
+ 'hebrew'
70
+ ],
71
+ control: {
72
+ type: 'select'
73
+ }
74
+ }
75
+ }
16
76
  };
17
77
  export default meta;
18
- export const Standard = {
19
- render: () => {
20
- const [date, setDate] = useState(new Date());
21
- return (_jsx(DatePicker, { htmlFor: "standard-calendar", value: date, onChange: setDate }));
22
- },
78
+ export var Standard = {
79
+ render: function() {
80
+ var _useState = _sliced_to_array(useState(new Date()), 2), date = _useState[0], setDate = _useState[1];
81
+ return /*#__PURE__*/ _jsx(DatePicker, {
82
+ htmlFor: "standard-calendar",
83
+ value: date,
84
+ onChange: setDate
85
+ });
86
+ }
23
87
  };
24
- export const Locale = {
25
- render: () => {
26
- const [date, setDate] = useState();
27
- return (_jsx(DatePicker, { htmlFor: "standard-calendar", locale: "ms", value: date, onChange: setDate }));
28
- },
88
+ export var Locale = {
89
+ render: function() {
90
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
91
+ return /*#__PURE__*/ _jsx(DatePicker, {
92
+ htmlFor: "standard-calendar",
93
+ locale: "ms",
94
+ value: date,
95
+ onChange: setDate
96
+ });
97
+ }
29
98
  };
30
- export const Ranged = {
31
- render: (_args) => {
32
- const [dates, setDates] = useState();
33
- const [error, setError] = useState('');
34
- return (_jsx(DatePicker, { htmlFor: "ranged-calendar", isRange: true, value: dates, onChange: (dates) => {
99
+ export var Ranged = {
100
+ render: function(_args) {
101
+ var _useState = _sliced_to_array(useState(), 2), dates = _useState[0], setDates = _useState[1];
102
+ var _useState1 = _sliced_to_array(useState(''), 2), error = _useState1[0], setError = _useState1[1];
103
+ return /*#__PURE__*/ _jsx(DatePicker, {
104
+ htmlFor: "ranged-calendar",
105
+ isRange: true,
106
+ value: dates,
107
+ onChange: function(dates) {
35
108
  setDates(dates);
36
109
  setError('');
37
- }, onError: (type) => type === 'start-gte-end' &&
38
- setError('Start Date must be earlier than End Date'), inputProps: {
39
- error: error,
40
- } }));
41
- },
110
+ },
111
+ onError: function(type) {
112
+ return type === 'start-gte-end' && setError('Start Date must be earlier than End Date');
113
+ },
114
+ inputProps: {
115
+ error: error
116
+ }
117
+ });
118
+ }
42
119
  };
43
- export const MinDate = {
44
- render: () => {
45
- const [date, setDate] = useState();
46
- return (_jsx(DatePicker, { htmlFor: "mindate-calendar", minDate: new Date(), value: date, onChange: setDate }));
47
- },
120
+ export var MinDate = {
121
+ render: function() {
122
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
123
+ return /*#__PURE__*/ _jsx(DatePicker, {
124
+ htmlFor: "mindate-calendar",
125
+ minDate: new Date(),
126
+ value: date,
127
+ onChange: setDate
128
+ });
129
+ }
48
130
  };
49
- export const MaxDate = {
50
- render: () => {
51
- const [date, setDate] = useState();
52
- return (_jsx(DatePicker, { htmlFor: "maxdate-calendar", maxDate: new Date(), value: date, onChange: setDate }));
53
- },
131
+ export var MaxDate = {
132
+ render: function() {
133
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
134
+ return /*#__PURE__*/ _jsx(DatePicker, {
135
+ htmlFor: "maxdate-calendar",
136
+ maxDate: new Date(),
137
+ value: date,
138
+ onChange: setDate
139
+ });
140
+ }
54
141
  };
55
- export const CalendarType = {
56
- render: () => {
57
- const [date, setDate] = useState();
58
- return (_jsx(DatePicker, { htmlFor: "islamic-calendar", calendarType: "islamic", value: date, onChange: setDate }));
59
- },
142
+ export var CalendarType = {
143
+ render: function() {
144
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
145
+ return /*#__PURE__*/ _jsx(DatePicker, {
146
+ htmlFor: "islamic-calendar",
147
+ calendarType: "islamic",
148
+ value: date,
149
+ onChange: setDate
150
+ });
151
+ }
60
152
  };
61
- export const Disabled = {
62
- render: () => {
63
- const [date, setDate] = useState();
64
- return (_jsx(DatePicker, { htmlFor: "disabled-calendar", isDisabled: true, value: date, onChange: setDate }));
65
- },
153
+ export var Disabled = {
154
+ render: function() {
155
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
156
+ return /*#__PURE__*/ _jsx(DatePicker, {
157
+ htmlFor: "disabled-calendar",
158
+ isDisabled: true,
159
+ value: date,
160
+ onChange: setDate
161
+ });
162
+ }
66
163
  };
67
- export const DisableWeekends = {
68
- render: () => {
69
- const [date, setDate] = useState();
70
- return (_jsx(DatePicker, { htmlFor: "no-date-calendar", value: date, onChange: setDate, disableWeekends: true }));
71
- },
164
+ export var DisableWeekends = {
165
+ render: function() {
166
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
167
+ return /*#__PURE__*/ _jsx(DatePicker, {
168
+ htmlFor: "no-date-calendar",
169
+ value: date,
170
+ onChange: setDate,
171
+ disableWeekends: true
172
+ });
173
+ }
72
174
  };
73
- export const NoDate = {
74
- render: () => {
75
- const [date, setDate] = useState();
76
- return (_jsx(DatePicker, { htmlFor: "no-date-calendar", value: date, onChange: setDate }));
77
- },
175
+ export var NoDate = {
176
+ render: function() {
177
+ var _useState = _sliced_to_array(useState(), 2), date = _useState[0], setDate = _useState[1];
178
+ return /*#__PURE__*/ _jsx(DatePicker, {
179
+ htmlFor: "no-date-calendar",
180
+ value: date,
181
+ onChange: setDate
182
+ });
183
+ }
78
184
  };
79
- //# sourceMappingURL=DatePicker.stories.js.map
@@ -5,7 +5,7 @@ import { useCallback } from 'react';
5
5
  import Calendar from 'react-calendar';
6
6
  import Box from '../box/Box';
7
7
  import Button from '../button/Button';
8
- import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger, } from '../drawer';
8
+ import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from '../drawer';
9
9
  import FieldWrapper from '../field-wrapper/FieldWrapper';
10
10
  import IconCalendar from '../icons/IconCalendar';
11
11
  import IconCalendarArrowBack from '../icons/IconCalendarArrowBack';
@@ -17,27 +17,126 @@ import Stack from '../stack/Stack';
17
17
  import Text from '../text/Text';
18
18
  import { cn } from '../utils';
19
19
  import { formatInputBy } from './utils';
20
- const DatePickerDrawer = ({ htmlFor = 'datepicker', locale = 'en', isRange, value: providedValue, minDate, maxDate, placeholder, calendarType, isDisabled, inputProps, drawerTitle, cancelButton, applyButton, tileDisabled, tileClassName, error,
21
- // non-customized props
22
- innerValue, setInnerValue, focused, setFocused, handleSelect, handleCancel, handleApply, }) => {
23
- const handleOpenChange = (open) => {
20
+ var DatePickerDrawer = function(param) {
21
+ var _param_htmlFor = param.htmlFor, htmlFor = _param_htmlFor === void 0 ? 'datepicker' : _param_htmlFor, _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, isRange = param.isRange, providedValue = param.value, minDate = param.minDate, maxDate = param.maxDate, placeholder = param.placeholder, calendarType = param.calendarType, isDisabled = param.isDisabled, inputProps = param.inputProps, drawerTitle = param.drawerTitle, cancelButton = param.cancelButton, applyButton = param.applyButton, tileDisabled = param.tileDisabled, tileClassName = param.tileClassName, error = param.error, // non-customized props
22
+ innerValue = param.innerValue, setInnerValue = param.setInnerValue, focused = param.focused, setFocused = param.setFocused, handleSelect = param.handleSelect, handleCancel = param.handleCancel, handleApply = param.handleApply;
23
+ var handleOpenChange = function(open) {
24
24
  setFocused(open);
25
25
  if (!open) {
26
26
  handleCancel();
27
27
  }
28
28
  };
29
- const isApplyDisabled = !innerValue ||
30
- (isRange &&
31
- (!Array.isArray(innerValue) ||
32
- innerValue.length !== 2 ||
33
- !innerValue[0] ||
34
- !innerValue[1]));
35
- const finalTileClassName = useCallback((args) => {
36
- const additionalClassNames = tileClassName?.(args);
29
+ var isApplyDisabled = !innerValue || isRange && (!Array.isArray(innerValue) || innerValue.length !== 2 || !innerValue[0] || !innerValue[1]);
30
+ var finalTileClassName = useCallback(function(args) {
31
+ var additionalClassNames = tileClassName === null || tileClassName === void 0 ? void 0 : tileClassName(args);
37
32
  return cn('flex item-center justify-center text-center', additionalClassNames);
38
- }, [tileClassName, innerValue]);
39
- return (_jsx(FieldWrapper, { htmlFor: htmlFor, label: inputProps?.label, error: error, className: 'w-full', children: _jsxs(Drawer, { open: focused, onOpenChange: handleOpenChange, children: [_jsx(DrawerTrigger, { asChild: true, disabled: isDisabled, className: 'w-full', children: _jsxs(Box, { className: cn('flex flex-row p-3 border border-primary2 cursor-pointer hover:border-primary4 rounded-lg', isDisabled && 'bg-primary2', error &&
40
- 'border-alert4 hover:border-alert4 focus-within:border-alert4'), children: [innerValue ? (_jsx(Text, { className: "flex-1", children: formatInputBy(innerValue, isRange) })) : (_jsx(Text, { className: 'flex-1 text-primary2', children: placeholder || 'DD-MM-YYYY' })), _jsx(IconCalendar, { size: '16px' })] }) }), _jsxs(DrawerContent, { hideGrabber: true, className: 'datepicker-content flex flex-col items-stretch', children: [_jsxs(DrawerHeader, { className: 'flex items-center justify-between py-4 px-6', children: [_jsx(DrawerTitle, { children: _jsx(Text, { className: 'text-xl font-bold uppercase', children: drawerTitle || inputProps?.label || 'date' }) }), _jsx(DrawerClose, { className: 'text-primary3', children: _jsx(IconClose, { className: 'w-4 h-4 lg:w-6 lg:h-6' }) })] }), _jsx(Calendar, { value: innerValue, onChange: handleSelect, locale: locale || 'en', selectRange: isRange, minDate: minDate, maxDate: maxDate, calendarType: calendarType, formatShortWeekday: (_, date) => format(date, 'EEEEE'), className: 'p-6', tileDisabled: tileDisabled, tileClassName: finalTileClassName, prevLabel: _jsx(IconCalendarArrowBack, { size: 24 }), nextLabel: _jsx(IconCalendarArrowForward, { size: 24 }), prev2Label: _jsx(IconCalendarDoubleArrowBack, { size: 24 }), next2Label: _jsx(IconCalendarDoubleArrowForward, { size: 24 }) }), _jsxs(Stack, { className: 'flex flex-row gap-2 py-4 px-6 border-t border-primary1', children: [_jsx(Button, { type: 'button', variant: 'outline', className: 'w-full text-sm p-3 h-10 tracking-[0.5px]', onClick: () => handleOpenChange(false), children: cancelButton?.label || 'cancel' }), _jsx(Button, { className: cn('w-full text-sm p-3 h-10 tracking-[0.5px]', isApplyDisabled && 'bg-primary1 hover:bg-primary1'), onClick: isApplyDisabled ? undefined : handleApply, children: applyButton?.label || 'done' })] }), _jsx(Box, { className: 'h-safe-bottom-edge' })] })] }) }));
33
+ }, [
34
+ tileClassName,
35
+ innerValue
36
+ ]);
37
+ return /*#__PURE__*/ _jsx(FieldWrapper, {
38
+ htmlFor: htmlFor,
39
+ label: inputProps === null || inputProps === void 0 ? void 0 : inputProps.label,
40
+ error: error,
41
+ className: 'w-full',
42
+ children: /*#__PURE__*/ _jsxs(Drawer, {
43
+ open: focused,
44
+ onOpenChange: handleOpenChange,
45
+ children: [
46
+ /*#__PURE__*/ _jsx(DrawerTrigger, {
47
+ asChild: true,
48
+ disabled: isDisabled,
49
+ className: 'w-full',
50
+ children: /*#__PURE__*/ _jsxs(Box, {
51
+ className: cn('flex flex-row p-3 border border-primary2 cursor-pointer hover:border-primary4 rounded-lg', isDisabled && 'bg-primary2', error && 'border-alert4 hover:border-alert4 focus-within:border-alert4'),
52
+ children: [
53
+ innerValue ? /*#__PURE__*/ _jsx(Text, {
54
+ className: "flex-1",
55
+ children: formatInputBy(innerValue, isRange)
56
+ }) : /*#__PURE__*/ _jsx(Text, {
57
+ className: 'flex-1 text-primary2',
58
+ children: placeholder || 'DD-MM-YYYY'
59
+ }),
60
+ /*#__PURE__*/ _jsx(IconCalendar, {
61
+ size: '16px'
62
+ })
63
+ ]
64
+ })
65
+ }),
66
+ /*#__PURE__*/ _jsxs(DrawerContent, {
67
+ hideGrabber: true,
68
+ className: 'datepicker-content flex flex-col items-stretch',
69
+ children: [
70
+ /*#__PURE__*/ _jsxs(DrawerHeader, {
71
+ className: 'flex items-center justify-between py-4 px-6',
72
+ children: [
73
+ /*#__PURE__*/ _jsx(DrawerTitle, {
74
+ children: /*#__PURE__*/ _jsx(Text, {
75
+ className: 'text-xl font-bold uppercase',
76
+ children: drawerTitle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.label) || 'date'
77
+ })
78
+ }),
79
+ /*#__PURE__*/ _jsx(DrawerClose, {
80
+ className: 'text-primary3',
81
+ children: /*#__PURE__*/ _jsx(IconClose, {
82
+ className: 'w-4 h-4 lg:w-6 lg:h-6'
83
+ })
84
+ })
85
+ ]
86
+ }),
87
+ /*#__PURE__*/ _jsx(Calendar, {
88
+ value: innerValue,
89
+ onChange: handleSelect,
90
+ locale: locale || 'en',
91
+ selectRange: isRange,
92
+ minDate: minDate,
93
+ maxDate: maxDate,
94
+ calendarType: calendarType,
95
+ formatShortWeekday: function(_, date) {
96
+ return format(date, 'EEEEE');
97
+ },
98
+ className: 'p-6',
99
+ tileDisabled: tileDisabled,
100
+ tileClassName: finalTileClassName,
101
+ prevLabel: /*#__PURE__*/ _jsx(IconCalendarArrowBack, {
102
+ size: 24
103
+ }),
104
+ nextLabel: /*#__PURE__*/ _jsx(IconCalendarArrowForward, {
105
+ size: 24
106
+ }),
107
+ prev2Label: /*#__PURE__*/ _jsx(IconCalendarDoubleArrowBack, {
108
+ size: 24
109
+ }),
110
+ next2Label: /*#__PURE__*/ _jsx(IconCalendarDoubleArrowForward, {
111
+ size: 24
112
+ })
113
+ }),
114
+ /*#__PURE__*/ _jsxs(Stack, {
115
+ className: 'flex flex-row gap-2 py-4 px-6 border-t border-primary1',
116
+ children: [
117
+ /*#__PURE__*/ _jsx(Button, {
118
+ type: 'button',
119
+ variant: 'outline',
120
+ className: 'w-full text-sm p-3 h-10 tracking-[0.5px]',
121
+ onClick: function() {
122
+ return handleOpenChange(false);
123
+ },
124
+ children: (cancelButton === null || cancelButton === void 0 ? void 0 : cancelButton.label) || 'cancel'
125
+ }),
126
+ /*#__PURE__*/ _jsx(Button, {
127
+ className: cn('w-full text-sm p-3 h-10 tracking-[0.5px]', isApplyDisabled && 'bg-primary1 hover:bg-primary1'),
128
+ onClick: isApplyDisabled ? undefined : handleApply,
129
+ children: (applyButton === null || applyButton === void 0 ? void 0 : applyButton.label) || 'done'
130
+ })
131
+ ]
132
+ }),
133
+ /*#__PURE__*/ _jsx(Box, {
134
+ className: 'h-safe-bottom-edge'
135
+ })
136
+ ]
137
+ })
138
+ ]
139
+ })
140
+ });
41
141
  };
42
142
  export default DatePickerDrawer;
43
- //# sourceMappingURL=DatePickerDrawer.js.map