@driveflux/beam 2.0.15 → 2.0.16

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 (226) 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 +110 -14
  4. package/dist/alert/Alert.stories.js +50 -15
  5. package/dist/animations/LoadingAnimation.js +34 -21
  6. package/dist/badge/Badge.js +1 -1
  7. package/dist/badge/Badge.js.map +1 -1
  8. package/dist/badge/Badge.stories.js +28 -7
  9. package/dist/box/Box.js +87 -3
  10. package/dist/box/Box.stories.js +8 -7
  11. package/dist/breadcrumbs/Breadcrumbs.js +288 -28
  12. package/dist/breadcrumbs/Breadcrumbs.stories.js +51 -27
  13. package/dist/button/Button.js +124 -12
  14. package/dist/button/Button.stories.js +35 -7
  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 +127 -27
  30. package/dist/datepicker/DatePicker.stories.js +163 -58
  31. package/dist/datepicker/DatePickerDrawer.js +110 -14
  32. package/dist/datepicker/DatePickerPopover.js +207 -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.d.ts.map +1 -1
  73. package/dist/icons/IconCancel.js +4 -4
  74. package/dist/icons/IconCancel.js.map +1 -1
  75. package/dist/icons/IconCancelMark.js +72 -4
  76. package/dist/icons/IconCarSUV.js +72 -4
  77. package/dist/icons/IconCarSedan.js +147 -7
  78. package/dist/icons/IconChain.js +79 -5
  79. package/dist/icons/IconCheckmark.js +72 -4
  80. package/dist/icons/IconChevronRight.js +72 -4
  81. package/dist/icons/IconCircle.js +114 -11
  82. package/dist/icons/IconCircleCheckmark.js +77 -5
  83. package/dist/icons/IconCircleError.js +72 -4
  84. package/dist/icons/IconCircleExclamation.js +104 -6
  85. package/dist/icons/IconCircleMark.js +78 -5
  86. package/dist/icons/IconCircleOutline.js +139 -5
  87. package/dist/icons/IconClock.js +80 -5
  88. package/dist/icons/IconClose.js +72 -4
  89. package/dist/icons/IconCollapseAll.js +5 -94
  90. package/dist/icons/IconCollapseAll.js.map +1 -0
  91. package/dist/icons/IconConcierge.js +79 -5
  92. package/dist/icons/IconConciergeService.js +87 -5
  93. package/dist/icons/IconCreditCard.js +78 -5
  94. package/dist/icons/IconDash.js +72 -4
  95. package/dist/icons/IconDeliver.js +72 -4
  96. package/dist/icons/IconDelivery.js +87 -5
  97. package/dist/icons/IconDetails.js +72 -4
  98. package/dist/icons/IconDot.js +87 -6
  99. package/dist/icons/IconDownload.js +5 -79
  100. package/dist/icons/IconDownload.js.map +1 -0
  101. package/dist/icons/IconEVCharging.js +79 -5
  102. package/dist/icons/IconElectricCarFuel.js +80 -5
  103. package/dist/icons/IconEllipsis.js +78 -5
  104. package/dist/icons/IconEnvelope.js +72 -4
  105. package/dist/icons/IconExpandAll.js +5 -94
  106. package/dist/icons/IconExpandAll.js.map +1 -0
  107. package/dist/icons/IconEye.js +79 -5
  108. package/dist/icons/IconFacebook.js +94 -6
  109. package/dist/icons/IconFilter.js +83 -5
  110. package/dist/icons/IconFlagMalaysia.js +141 -5
  111. package/dist/icons/IconGiveKey.js +79 -5
  112. package/dist/icons/IconGlobe.js +70 -4
  113. package/dist/icons/IconGoogle.js +87 -5
  114. package/dist/icons/IconHome.js +78 -5
  115. package/dist/icons/IconHostAdvertise.js +72 -4
  116. package/dist/icons/IconHostCar.js +75 -4
  117. package/dist/icons/IconHostCash.js +91 -5
  118. package/dist/icons/IconHostHandle.js +70 -4
  119. package/dist/icons/IconHostLocation.js +70 -4
  120. package/dist/icons/IconHostPayment.js +91 -5
  121. package/dist/icons/IconHostService.js +79 -5
  122. package/dist/icons/IconHotDeals.js +72 -4
  123. package/dist/icons/IconInfo.js +77 -5
  124. package/dist/icons/IconInstagram.js +72 -4
  125. package/dist/icons/IconInsurance.js +99 -5
  126. package/dist/icons/IconInternet.js +73 -4
  127. package/dist/icons/IconInventory.js +78 -5
  128. package/dist/icons/IconLaurel.js +101 -5
  129. package/dist/icons/IconLinkedIn.js +72 -4
  130. package/dist/icons/IconLoading.js +78 -4
  131. package/dist/icons/IconLocation.js +80 -5
  132. package/dist/icons/IconLock.js +73 -4
  133. package/dist/icons/IconLogistics.js +72 -4
  134. package/dist/icons/IconMail.js +94 -5
  135. package/dist/icons/IconMember.js +78 -5
  136. package/dist/icons/IconMobilePen.js +83 -5
  137. package/dist/icons/IconMotorcycleMoped.js +78 -5
  138. package/dist/icons/IconNoCost.js +92 -5
  139. package/dist/icons/IconPDF.js +80 -5
  140. package/dist/icons/IconPencil.js +70 -4
  141. package/dist/icons/IconPhone.js +70 -4
  142. package/dist/icons/IconPlus.js +72 -4
  143. package/dist/icons/IconPricing.js +72 -4
  144. package/dist/icons/IconProtected.js +71 -4
  145. package/dist/icons/IconPsychology.js +72 -4
  146. package/dist/icons/IconQuestionTooltip.js +73 -4
  147. package/dist/icons/IconQuote.js +72 -4
  148. package/dist/icons/IconRate.js +71 -4
  149. package/dist/icons/IconRegister.js +99 -5
  150. package/dist/icons/IconReport.js +6 -89
  151. package/dist/icons/IconReport.js.map +1 -0
  152. package/dist/icons/IconReturn.js +72 -4
  153. package/dist/icons/IconSearch.js +70 -4
  154. package/dist/icons/IconSecure.js +71 -4
  155. package/dist/icons/IconSecurity.js +73 -4
  156. package/dist/icons/IconSedanOutline.js +159 -5
  157. package/dist/icons/IconSelectArrow.js +78 -6
  158. package/dist/icons/IconSort.js +79 -5
  159. package/dist/icons/IconSortListed.js +95 -5
  160. package/dist/icons/IconSortPriceAscending.js +83 -5
  161. package/dist/icons/IconSortPriceDescending.js +83 -5
  162. package/dist/icons/IconSortYear.js +79 -5
  163. package/dist/icons/IconSpan.js +71 -4
  164. package/dist/icons/IconSpeaker.js +79 -4
  165. package/dist/icons/IconSpecialCar.js +95 -5
  166. package/dist/icons/IconStar.js +92 -7
  167. package/dist/icons/IconStockPhoto.js +95 -5
  168. package/dist/icons/IconSubscription.js +113 -6
  169. package/dist/icons/IconSubscriptions.js +113 -6
  170. package/dist/icons/IconSwap.js +79 -5
  171. package/dist/icons/IconTax.js +72 -4
  172. package/dist/icons/IconThinArrow.js +78 -6
  173. package/dist/icons/IconThumbsdown.js +78 -5
  174. package/dist/icons/IconThumbsup.js +78 -5
  175. package/dist/icons/IconTool.js +72 -4
  176. package/dist/icons/IconTooltip.js +73 -4
  177. package/dist/icons/IconTrash.js +72 -4
  178. package/dist/icons/IconTriangleExclamation.js +72 -4
  179. package/dist/icons/IconTyersBrakes.js +83 -5
  180. package/dist/icons/IconTyre.js +83 -5
  181. package/dist/icons/IconVacancy.js +78 -5
  182. package/dist/icons/IconVolunteer.js +72 -4
  183. package/dist/icons/IconWhatsapp.js +73 -4
  184. package/dist/icons/IconXPlatform.js +72 -4
  185. package/dist/icons/IconZeroEffort.js +77 -5
  186. package/dist/icons/Logo.js +99 -3
  187. package/dist/input/Input.js +125 -11
  188. package/dist/input/Input.stories.js +17 -18
  189. package/dist/input-mask/InputMask.js +149 -11
  190. package/dist/input-mask/InputMask.stories.js +5 -6
  191. package/dist/input-mask/mask-trackers.js +4 -5
  192. package/dist/input-select/InputSelect.js +357 -68
  193. package/dist/input-select/InputSelect.stories.js +98 -25
  194. package/dist/popover/popover.js +72 -4
  195. package/dist/progress/Progress.js +96 -2
  196. package/dist/progress/Progress.stories.js +13 -14
  197. package/dist/radio/Radio.js +163 -4
  198. package/dist/scroll-area/scroll-area.js +113 -5
  199. package/dist/search-input-select/SearchInputSelect.js +346 -69
  200. package/dist/select/Select.js +1 -1
  201. package/dist/select/Select.js.map +1 -1
  202. package/dist/select/Select.stories.js +55 -19
  203. package/dist/skeleton/Skeleton.js +62 -3
  204. package/dist/skeleton/Skeleton.stories.js +8 -7
  205. package/dist/slider/Slider.js +106 -5
  206. package/dist/slider/Slider.stories.js +12 -11
  207. package/dist/stack/Stack.js +63 -3
  208. package/dist/stack/Stack.stories.js +19 -7
  209. package/dist/table/Table.js +131 -10
  210. package/dist/table/Table.stories.js +84 -8
  211. package/dist/tabs/Tabs.js +128 -9
  212. package/dist/tabs/Tabs.stories.js +46 -13
  213. package/dist/text/Text.js +88 -6
  214. package/dist/text/Text.stories.js +44 -7
  215. package/dist/toast/Toast.stories.js +66 -14
  216. package/dist/toast/ToastBox.js +71 -24
  217. package/dist/toast/index.js +0 -1
  218. package/dist/toast/sonner.js +66 -6
  219. package/dist/toggle/Toggle.js +116 -7
  220. package/dist/toggle/Toggle.stories.js +10 -8
  221. package/dist/tooltip/Tooltip.js +151 -12
  222. package/dist/tooltip/Tooltip.stories.js +71 -13
  223. package/dist/utils.js +4 -2
  224. package/dist/vstack/VStack.js +63 -3
  225. package/dist/vstack/VStack.stories.js +19 -7
  226. 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
@@ -4,7 +4,7 @@ import { format } from 'date-fns';
4
4
  import Calendar from 'react-calendar';
5
5
  import Box from '../box/Box';
6
6
  import Button from '../button/Button';
7
- import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger, } from '../drawer';
7
+ import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from '../drawer';
8
8
  import FieldWrapper from '../field-wrapper/FieldWrapper';
9
9
  import IconCalendar from '../icons/IconCalendar';
10
10
  import IconCalendarArrowBack from '../icons/IconCalendarArrowBack';
@@ -16,23 +16,119 @@ import Stack from '../stack/Stack';
16
16
  import Text from '../text/Text';
17
17
  import { cn } from '../utils';
18
18
  import { formatInputBy } from './utils';
19
- const DatePickerDrawer = ({ htmlFor = 'datepicker', locale = 'en', isRange, value: providedValue, minDate, maxDate, placeholder, calendarType, isDisabled, inputProps, drawerTitle, cancelButton, applyButton, tileDisabled, error,
20
- // non-customized props
21
- innerValue, setInnerValue, focused, setFocused, handleSelect, handleCancel, handleApply, }) => {
22
- const handleOpenChange = (open) => {
19
+ var DatePickerDrawer = function(param) {
20
+ 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, error = param.error, // non-customized props
21
+ innerValue = param.innerValue, setInnerValue = param.setInnerValue, focused = param.focused, setFocused = param.setFocused, handleSelect = param.handleSelect, handleCancel = param.handleCancel, handleApply = param.handleApply;
22
+ var handleOpenChange = function(open) {
23
23
  setFocused(open);
24
24
  if (!open) {
25
25
  handleCancel();
26
26
  }
27
27
  };
28
- const isApplyDisabled = !innerValue ||
29
- (isRange &&
30
- (!Array.isArray(innerValue) ||
31
- innerValue.length !== 2 ||
32
- !innerValue[0] ||
33
- !innerValue[1]));
34
- 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', isDisabled && 'bg-primary2', error &&
35
- '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 rounded-none', 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: 'flex item-center justify-center text-center', 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' })] })] }) }));
28
+ var isApplyDisabled = !innerValue || isRange && (!Array.isArray(innerValue) || innerValue.length !== 2 || !innerValue[0] || !innerValue[1]);
29
+ return /*#__PURE__*/ _jsx(FieldWrapper, {
30
+ htmlFor: htmlFor,
31
+ label: inputProps === null || inputProps === void 0 ? void 0 : inputProps.label,
32
+ error: error,
33
+ className: 'w-full',
34
+ children: /*#__PURE__*/ _jsxs(Drawer, {
35
+ open: focused,
36
+ onOpenChange: handleOpenChange,
37
+ children: [
38
+ /*#__PURE__*/ _jsx(DrawerTrigger, {
39
+ asChild: true,
40
+ disabled: isDisabled,
41
+ className: 'w-full',
42
+ children: /*#__PURE__*/ _jsxs(Box, {
43
+ className: cn('flex flex-row p-3 border border-primary2 cursor-pointer hover:border-primary4', isDisabled && 'bg-primary2', error && 'border-alert4 hover:border-alert4 focus-within:border-alert4'),
44
+ children: [
45
+ innerValue ? /*#__PURE__*/ _jsx(Text, {
46
+ className: "flex-1",
47
+ children: formatInputBy(innerValue, isRange)
48
+ }) : /*#__PURE__*/ _jsx(Text, {
49
+ className: 'flex-1 text-primary2',
50
+ children: placeholder || 'DD-MM-YYYY'
51
+ }),
52
+ /*#__PURE__*/ _jsx(IconCalendar, {
53
+ size: '16px'
54
+ })
55
+ ]
56
+ })
57
+ }),
58
+ /*#__PURE__*/ _jsxs(DrawerContent, {
59
+ hideGrabber: true,
60
+ className: 'datepicker-content flex flex-col items-stretch rounded-none',
61
+ children: [
62
+ /*#__PURE__*/ _jsxs(DrawerHeader, {
63
+ className: 'flex items-center justify-between py-4 px-6',
64
+ children: [
65
+ /*#__PURE__*/ _jsx(DrawerTitle, {
66
+ children: /*#__PURE__*/ _jsx(Text, {
67
+ className: 'text-xl font-bold uppercase',
68
+ children: drawerTitle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.label) || 'date'
69
+ })
70
+ }),
71
+ /*#__PURE__*/ _jsx(DrawerClose, {
72
+ className: 'text-primary3',
73
+ children: /*#__PURE__*/ _jsx(IconClose, {
74
+ className: 'w-4 h-4 lg:w-6 lg:h-6'
75
+ })
76
+ })
77
+ ]
78
+ }),
79
+ /*#__PURE__*/ _jsx(Calendar, {
80
+ value: innerValue,
81
+ onChange: handleSelect,
82
+ locale: locale || 'en',
83
+ selectRange: isRange,
84
+ minDate: minDate,
85
+ maxDate: maxDate,
86
+ calendarType: calendarType,
87
+ formatShortWeekday: function(_, date) {
88
+ return format(date, 'EEEEE');
89
+ },
90
+ className: 'p-6',
91
+ tileDisabled: tileDisabled,
92
+ tileClassName: 'flex item-center justify-center text-center',
93
+ prevLabel: /*#__PURE__*/ _jsx(IconCalendarArrowBack, {
94
+ size: 24
95
+ }),
96
+ nextLabel: /*#__PURE__*/ _jsx(IconCalendarArrowForward, {
97
+ size: 24
98
+ }),
99
+ prev2Label: /*#__PURE__*/ _jsx(IconCalendarDoubleArrowBack, {
100
+ size: 24
101
+ }),
102
+ next2Label: /*#__PURE__*/ _jsx(IconCalendarDoubleArrowForward, {
103
+ size: 24
104
+ })
105
+ }),
106
+ /*#__PURE__*/ _jsxs(Stack, {
107
+ className: 'flex flex-row gap-2 py-4 px-6 border-t border-primary1',
108
+ children: [
109
+ /*#__PURE__*/ _jsx(Button, {
110
+ type: 'button',
111
+ variant: 'outline',
112
+ className: 'w-full text-sm p-3 h-10 tracking-[0.5px]',
113
+ onClick: function() {
114
+ return handleOpenChange(false);
115
+ },
116
+ children: (cancelButton === null || cancelButton === void 0 ? void 0 : cancelButton.label) || 'cancel'
117
+ }),
118
+ /*#__PURE__*/ _jsx(Button, {
119
+ className: cn('w-full text-sm p-3 h-10 tracking-[0.5px]', isApplyDisabled && 'bg-primary1 hover:bg-primary1'),
120
+ onClick: isApplyDisabled ? undefined : handleApply,
121
+ children: (applyButton === null || applyButton === void 0 ? void 0 : applyButton.label) || 'done'
122
+ })
123
+ ]
124
+ }),
125
+ /*#__PURE__*/ _jsx(Box, {
126
+ className: 'h-safe-bottom-edge'
127
+ })
128
+ ]
129
+ })
130
+ ]
131
+ })
132
+ });
36
133
  };
37
134
  export default DatePickerDrawer;
38
- //# sourceMappingURL=DatePickerDrawer.js.map