@driveflux/beam 3.0.9 → 3.0.10

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 (222) hide show
  1. package/dist/accordion/Accordion.js +7 -133
  2. package/dist/accordion/Accordion.stories.js +11 -31
  3. package/dist/alert/Alert.js +19 -120
  4. package/dist/alert/Alert.stories.js +15 -50
  5. package/dist/animations/LoadingAnimation.js +21 -34
  6. package/dist/badge/Badge.js +7 -96
  7. package/dist/badge/Badge.stories.js +7 -28
  8. package/dist/box/Box.js +3 -87
  9. package/dist/box/Box.stories.js +7 -8
  10. package/dist/breadcrumbs/Breadcrumbs.js +28 -288
  11. package/dist/breadcrumbs/Breadcrumbs.stories.js +27 -51
  12. package/dist/button/Button.js +16 -128
  13. package/dist/button/Button.js.map +1 -1
  14. package/dist/button/Button.stories.js +7 -35
  15. package/dist/button/TextButton.js +11 -106
  16. package/dist/button/TextButton.js.map +1 -1
  17. package/dist/card/Card.js +7 -109
  18. package/dist/card/Card.stories.js +7 -10
  19. package/dist/carousel/Carousel.js +58 -281
  20. package/dist/carousel/Carousel.stories.js +7 -39
  21. package/dist/carousel/CarouselButton.js +7 -68
  22. package/dist/center/Center.js +3 -63
  23. package/dist/center/Center.stories.js +7 -19
  24. package/dist/checkbox/Checkbox.js +4 -124
  25. package/dist/checkbox/Checkbox.stories.js +8 -10
  26. package/dist/chip/Chip.js +3 -104
  27. package/dist/chip/Chip.stories.js +7 -19
  28. package/dist/circular-progress/CircularProgress.js +11 -150
  29. package/dist/circular-progress/CircularProgress.stories.js +14 -54
  30. package/dist/command/command.js +13 -170
  31. package/dist/datepicker/DatePicker.js +90 -234
  32. package/dist/datepicker/DatePicker.stories.js +58 -163
  33. package/dist/datepicker/DatePickerDrawer.js +17 -116
  34. package/dist/datepicker/DatePickerPopover.js +35 -208
  35. package/dist/datepicker/constants.js +4 -3
  36. package/dist/datepicker/utils.js +11 -4
  37. package/dist/dialog/index.js +33 -180
  38. package/dist/divider/Divider.js +3 -63
  39. package/dist/divider/Divider.stories.js +7 -13
  40. package/dist/drawer/index.js +12 -157
  41. package/dist/dropdown/Dropdown.js +26 -212
  42. package/dist/dropdown/Dropdown.stories.js +22 -109
  43. package/dist/field-wrapper/FieldWrapper.js +3 -139
  44. package/dist/field-wrapper/FieldWrapper.stories.js +28 -124
  45. package/dist/flex/Flex.js +3 -63
  46. package/dist/flex/Flex.stories.js +7 -19
  47. package/dist/grid/Grid.js +3 -63
  48. package/dist/grid/Grid.stories.js +7 -28
  49. package/dist/hooks/use-breakpoint-value.js +14 -77
  50. package/dist/hooks/use-media-query.js +12 -61
  51. package/dist/hstack/HStack.js +3 -63
  52. package/dist/hstack/HStack.stories.js +7 -19
  53. package/dist/icons/FluxLogo.js +9 -213
  54. package/dist/icons/FluxLogoTable.js +5 -109
  55. package/dist/icons/Icon.js +7 -108
  56. package/dist/icons/Icon.stories.js +7 -12
  57. package/dist/icons/Icon24Hours.js +5 -83
  58. package/dist/icons/IconAcceleration.js +4 -72
  59. package/dist/icons/IconAccount.js +4 -72
  60. package/dist/icons/IconApplicant.js +5 -78
  61. package/dist/icons/IconArrow.js +6 -78
  62. package/dist/icons/IconArrowBack.js +4 -72
  63. package/dist/icons/IconArrowForward.js +4 -72
  64. package/dist/icons/IconArrowTopLeft.js +4 -70
  65. package/dist/icons/IconBluesharkProductGuide.js +5 -80
  66. package/dist/icons/IconBolt.js +4 -72
  67. package/dist/icons/IconBriefcase.js +4 -72
  68. package/dist/icons/IconBulb.js +4 -72
  69. package/dist/icons/IconCalendar.js +4 -72
  70. package/dist/icons/IconCalendarArrowBack.js +4 -72
  71. package/dist/icons/IconCalendarArrowForward.js +4 -72
  72. package/dist/icons/IconCalendarDoubleArrowBack.js +4 -72
  73. package/dist/icons/IconCalendarDoubleArrowForward.js +4 -72
  74. package/dist/icons/IconCancel.js +5 -77
  75. package/dist/icons/IconCancelMark.js +4 -72
  76. package/dist/icons/IconCarSUV.js +4 -72
  77. package/dist/icons/IconCarSedan.js +7 -147
  78. package/dist/icons/IconChain.js +5 -79
  79. package/dist/icons/IconCheckmark.js +4 -72
  80. package/dist/icons/IconChevronRight.js +4 -72
  81. package/dist/icons/IconCircle.js +11 -114
  82. package/dist/icons/IconCircleCheckmark.js +5 -77
  83. package/dist/icons/IconCircleError.js +4 -72
  84. package/dist/icons/IconCircleExclamation.js +6 -104
  85. package/dist/icons/IconCircleMark.js +5 -78
  86. package/dist/icons/IconCircleOutline.js +5 -139
  87. package/dist/icons/IconClock.js +5 -80
  88. package/dist/icons/IconClose.js +4 -72
  89. package/dist/icons/IconCollapseAll.js +5 -94
  90. package/dist/icons/IconConcierge.js +5 -79
  91. package/dist/icons/IconConciergeService.js +5 -87
  92. package/dist/icons/IconCreditCard.js +5 -78
  93. package/dist/icons/IconDash.js +4 -72
  94. package/dist/icons/IconDeliver.js +4 -72
  95. package/dist/icons/IconDelivery.js +5 -87
  96. package/dist/icons/IconDetails.js +4 -72
  97. package/dist/icons/IconDot.js +6 -87
  98. package/dist/icons/IconDownload.js +5 -79
  99. package/dist/icons/IconEVCharging.js +5 -79
  100. package/dist/icons/IconElectricCarFuel.js +5 -80
  101. package/dist/icons/IconEllipsis.js +5 -78
  102. package/dist/icons/IconEnvelope.js +4 -72
  103. package/dist/icons/IconExpandAll.js +5 -94
  104. package/dist/icons/IconEye.js +5 -79
  105. package/dist/icons/IconFacebook.js +6 -94
  106. package/dist/icons/IconFilter.js +5 -83
  107. package/dist/icons/IconFlagMalaysia.js +5 -141
  108. package/dist/icons/IconGiveKey.js +5 -79
  109. package/dist/icons/IconGlobe.js +4 -70
  110. package/dist/icons/IconGoogle.js +5 -87
  111. package/dist/icons/IconHome.js +5 -78
  112. package/dist/icons/IconHostAdvertise.js +4 -72
  113. package/dist/icons/IconHostCar.js +4 -75
  114. package/dist/icons/IconHostCash.js +5 -91
  115. package/dist/icons/IconHostHandle.js +4 -70
  116. package/dist/icons/IconHostLocation.js +4 -70
  117. package/dist/icons/IconHostPayment.js +5 -91
  118. package/dist/icons/IconHostService.js +5 -79
  119. package/dist/icons/IconHotDeals.js +4 -72
  120. package/dist/icons/IconInfo.js +5 -77
  121. package/dist/icons/IconInstagram.js +4 -72
  122. package/dist/icons/IconInsurance.js +5 -99
  123. package/dist/icons/IconInternet.js +4 -73
  124. package/dist/icons/IconInventory.js +5 -78
  125. package/dist/icons/IconLaurel.js +5 -101
  126. package/dist/icons/IconLinkedIn.js +4 -72
  127. package/dist/icons/IconLoading.js +4 -78
  128. package/dist/icons/IconLocation.js +5 -80
  129. package/dist/icons/IconLock.js +4 -73
  130. package/dist/icons/IconLogistics.js +4 -72
  131. package/dist/icons/IconMail.js +5 -94
  132. package/dist/icons/IconMember.js +5 -78
  133. package/dist/icons/IconMobilePen.js +5 -83
  134. package/dist/icons/IconMotorcycleMoped.js +5 -78
  135. package/dist/icons/IconNoCost.js +5 -92
  136. package/dist/icons/IconPDF.js +5 -80
  137. package/dist/icons/IconPencil.js +4 -70
  138. package/dist/icons/IconPhone.js +4 -70
  139. package/dist/icons/IconPlus.js +4 -72
  140. package/dist/icons/IconPricing.js +4 -72
  141. package/dist/icons/IconProtected.js +4 -71
  142. package/dist/icons/IconPsychology.js +4 -72
  143. package/dist/icons/IconQuestionTooltip.js +4 -73
  144. package/dist/icons/IconQuote.js +4 -72
  145. package/dist/icons/IconRate.js +4 -71
  146. package/dist/icons/IconRegister.js +5 -99
  147. package/dist/icons/IconReport.js +6 -89
  148. package/dist/icons/IconReturn.js +4 -72
  149. package/dist/icons/IconSearch.js +4 -70
  150. package/dist/icons/IconSecure.js +4 -71
  151. package/dist/icons/IconSecurity.js +4 -73
  152. package/dist/icons/IconSedanOutline.js +5 -159
  153. package/dist/icons/IconSelectArrow.js +6 -78
  154. package/dist/icons/IconSort.js +5 -79
  155. package/dist/icons/IconSortListed.js +5 -95
  156. package/dist/icons/IconSortPriceAscending.js +5 -83
  157. package/dist/icons/IconSortPriceDescending.js +5 -83
  158. package/dist/icons/IconSortYear.js +5 -79
  159. package/dist/icons/IconSpan.js +4 -71
  160. package/dist/icons/IconSpeaker.js +4 -79
  161. package/dist/icons/IconSpecialCar.js +5 -95
  162. package/dist/icons/IconStar.js +7 -92
  163. package/dist/icons/IconStockPhoto.js +5 -95
  164. package/dist/icons/IconSubscription.js +6 -113
  165. package/dist/icons/IconSubscriptions.js +6 -113
  166. package/dist/icons/IconSwap.js +5 -79
  167. package/dist/icons/IconTax.js +4 -72
  168. package/dist/icons/IconThinArrow.js +6 -78
  169. package/dist/icons/IconThumbsdown.js +5 -78
  170. package/dist/icons/IconThumbsup.js +5 -78
  171. package/dist/icons/IconTool.js +4 -72
  172. package/dist/icons/IconTooltip.js +4 -73
  173. package/dist/icons/IconTrash.js +4 -72
  174. package/dist/icons/IconTriangleExclamation.js +4 -72
  175. package/dist/icons/IconTyersBrakes.js +5 -83
  176. package/dist/icons/IconTyre.js +5 -83
  177. package/dist/icons/IconVacancy.js +5 -78
  178. package/dist/icons/IconVolunteer.js +4 -72
  179. package/dist/icons/IconWhatsapp.js +4 -73
  180. package/dist/icons/IconXPlatform.js +4 -72
  181. package/dist/icons/IconZeroEffort.js +5 -77
  182. package/dist/icons/Logo.js +3 -99
  183. package/dist/input/Input.js +11 -125
  184. package/dist/input/Input.stories.js +18 -17
  185. package/dist/input-mask/InputMask.js +11 -149
  186. package/dist/input-mask/InputMask.stories.js +6 -5
  187. package/dist/input-mask/mask-trackers.js +5 -4
  188. package/dist/input-select/InputSelect.js +68 -357
  189. package/dist/input-select/InputSelect.stories.js +25 -98
  190. package/dist/popover/popover.js +4 -72
  191. package/dist/progress/Progress.js +2 -96
  192. package/dist/progress/Progress.stories.js +14 -13
  193. package/dist/radio/Radio.js +4 -163
  194. package/dist/scroll-area/scroll-area.js +5 -113
  195. package/dist/search-input-select/SearchInputSelect.js +69 -346
  196. package/dist/select/Select.js +29 -315
  197. package/dist/select/Select.stories.js +19 -55
  198. package/dist/skeleton/Skeleton.js +3 -62
  199. package/dist/skeleton/Skeleton.stories.js +7 -8
  200. package/dist/slider/Slider.js +5 -106
  201. package/dist/slider/Slider.stories.js +11 -12
  202. package/dist/stack/Stack.js +3 -63
  203. package/dist/stack/Stack.stories.js +7 -19
  204. package/dist/table/Table.js +10 -131
  205. package/dist/table/Table.stories.js +8 -84
  206. package/dist/tabs/Tabs.js +9 -128
  207. package/dist/tabs/Tabs.stories.js +13 -46
  208. package/dist/text/Text.js +6 -88
  209. package/dist/text/Text.js.map +1 -1
  210. package/dist/text/Text.stories.js +7 -44
  211. package/dist/toast/Toast.stories.js +14 -66
  212. package/dist/toast/ToastBox.js +29 -77
  213. package/dist/toast/index.js +1 -0
  214. package/dist/toast/sonner.js +6 -66
  215. package/dist/toggle/Toggle.js +7 -116
  216. package/dist/toggle/Toggle.stories.js +8 -10
  217. package/dist/tooltip/Tooltip.js +12 -151
  218. package/dist/tooltip/Tooltip.stories.js +13 -71
  219. package/dist/utils.js +2 -4
  220. package/dist/vstack/VStack.js +3 -63
  221. package/dist/vstack/VStack.stories.js +7 -19
  222. package/package.json +1 -1
@@ -1,184 +1,79 @@
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
- }
47
1
  import { jsx as _jsx } from "react/jsx-runtime";
48
2
  import { useState } from 'react';
49
3
  import DatePicker from './DatePicker.js';
50
- var meta = {
4
+ const meta = {
51
5
  component: DatePicker,
52
6
  argTypes: {
53
7
  locale: {
54
- options: [
55
- 'en',
56
- 'ms',
57
- 'zh',
58
- 'ar'
59
- ],
60
- control: {
61
- type: 'select'
62
- }
8
+ options: ['en', 'ms', 'zh', 'ar'],
9
+ control: { type: 'select' },
63
10
  },
64
11
  calendarType: {
65
- options: [
66
- 'iso8601',
67
- 'gregory',
68
- 'islamic',
69
- 'hebrew'
70
- ],
71
- control: {
72
- type: 'select'
73
- }
74
- }
75
- }
12
+ options: ['iso8601', 'gregory', 'islamic', 'hebrew'],
13
+ control: { type: 'select' },
14
+ },
15
+ },
76
16
  };
77
17
  export default meta;
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
- }
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
+ },
87
23
  };
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
- }
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
+ },
98
29
  };
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) {
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) => {
108
35
  setDates(dates);
109
36
  setError('');
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
- }
37
+ }, onError: (type) => type === 'start-gte-end' &&
38
+ setError('Start Date must be earlier than End Date'), inputProps: {
39
+ error: error,
40
+ } }));
41
+ },
119
42
  };
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
- }
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
+ },
130
48
  };
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
- }
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
+ },
141
54
  };
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
- }
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
+ },
152
60
  };
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
- }
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
+ },
163
66
  };
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
- }
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
+ },
174
72
  };
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
- }
73
+ export const NoDate = {
74
+ render: () => {
75
+ const [date, setDate] = useState();
76
+ return (_jsx(DatePicker, { htmlFor: "no-date-calendar", value: date, onChange: setDate }));
77
+ },
184
78
  };
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,126 +17,27 @@ 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
- 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) {
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) => {
24
24
  setFocused(open);
25
25
  if (!open) {
26
26
  handleCancel();
27
27
  }
28
28
  };
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);
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);
32
37
  return cn('flex item-center justify-center text-center', additionalClassNames);
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
- });
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' })] })] }) }));
141
41
  };
142
42
  export default DatePickerDrawer;
43
+ //# sourceMappingURL=DatePickerDrawer.js.map