@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.
- package/dist/accordion/Accordion.js +133 -7
- package/dist/accordion/Accordion.stories.js +31 -11
- package/dist/alert/Alert.js +120 -19
- package/dist/alert/Alert.stories.js +50 -15
- package/dist/animations/LoadingAnimation.js +34 -21
- package/dist/badge/Badge.js +96 -7
- package/dist/badge/Badge.stories.js +28 -7
- package/dist/box/Box.js +87 -3
- package/dist/box/Box.stories.js +8 -7
- package/dist/breadcrumbs/Breadcrumbs.js +288 -28
- package/dist/breadcrumbs/Breadcrumbs.stories.js +51 -27
- package/dist/button/Button.js +127 -13
- package/dist/button/Button.stories.js +35 -7
- package/dist/button/TextButton.js +104 -9
- package/dist/card/Card.js +109 -7
- package/dist/card/Card.stories.js +10 -7
- package/dist/carousel/Carousel.js +281 -58
- package/dist/carousel/Carousel.stories.js +39 -7
- package/dist/carousel/CarouselButton.js +68 -7
- package/dist/center/Center.js +63 -3
- package/dist/center/Center.stories.js +19 -7
- package/dist/checkbox/Checkbox.js +124 -4
- package/dist/checkbox/Checkbox.stories.js +10 -8
- package/dist/chip/Chip.js +104 -3
- package/dist/chip/Chip.stories.js +19 -7
- package/dist/circular-progress/CircularProgress.js +150 -11
- package/dist/circular-progress/CircularProgress.stories.js +54 -14
- package/dist/command/command.js +170 -13
- package/dist/datepicker/DatePicker.js +234 -90
- package/dist/datepicker/DatePicker.stories.js +163 -58
- package/dist/datepicker/DatePickerDrawer.js +116 -17
- package/dist/datepicker/DatePickerPopover.js +208 -35
- package/dist/datepicker/constants.js +3 -4
- package/dist/datepicker/utils.js +4 -11
- package/dist/dialog/index.js +180 -33
- package/dist/divider/Divider.js +63 -3
- package/dist/divider/Divider.stories.js +13 -7
- package/dist/drawer/index.js +157 -12
- package/dist/dropdown/Dropdown.js +212 -26
- package/dist/dropdown/Dropdown.stories.js +109 -22
- package/dist/field-wrapper/FieldWrapper.js +139 -3
- package/dist/field-wrapper/FieldWrapper.stories.js +124 -28
- package/dist/flex/Flex.js +63 -3
- package/dist/flex/Flex.stories.js +19 -7
- package/dist/grid/Grid.js +63 -3
- package/dist/grid/Grid.stories.js +28 -7
- package/dist/hooks/use-breakpoint-value.js +77 -14
- package/dist/hooks/use-media-query.js +61 -12
- package/dist/hstack/HStack.js +63 -3
- package/dist/hstack/HStack.stories.js +19 -7
- package/dist/icons/FluxLogo.js +213 -9
- package/dist/icons/FluxLogoTable.js +109 -5
- package/dist/icons/Icon.js +108 -7
- package/dist/icons/Icon.stories.js +12 -7
- package/dist/icons/Icon24Hours.js +83 -5
- package/dist/icons/IconAcceleration.js +72 -4
- package/dist/icons/IconAccount.js +72 -4
- package/dist/icons/IconApplicant.js +78 -5
- package/dist/icons/IconArrow.js +78 -6
- package/dist/icons/IconArrowBack.js +72 -4
- package/dist/icons/IconArrowForward.js +72 -4
- package/dist/icons/IconArrowTopLeft.js +70 -4
- package/dist/icons/IconBluesharkProductGuide.js +80 -5
- package/dist/icons/IconBolt.js +72 -4
- package/dist/icons/IconBriefcase.js +72 -4
- package/dist/icons/IconBulb.js +72 -4
- package/dist/icons/IconCalendar.js +72 -4
- package/dist/icons/IconCalendarArrowBack.js +72 -4
- package/dist/icons/IconCalendarArrowForward.js +72 -4
- package/dist/icons/IconCalendarDoubleArrowBack.js +72 -4
- package/dist/icons/IconCalendarDoubleArrowForward.js +72 -4
- package/dist/icons/IconCancel.js +77 -5
- package/dist/icons/IconCancelMark.js +72 -4
- package/dist/icons/IconCarSUV.js +72 -4
- package/dist/icons/IconCarSedan.js +147 -7
- package/dist/icons/IconChain.js +79 -5
- package/dist/icons/IconCheckmark.js +72 -4
- package/dist/icons/IconChevronRight.js +72 -4
- package/dist/icons/IconCircle.js +114 -11
- package/dist/icons/IconCircleCheckmark.js +77 -5
- package/dist/icons/IconCircleError.js +72 -4
- package/dist/icons/IconCircleExclamation.js +104 -6
- package/dist/icons/IconCircleMark.js +78 -5
- package/dist/icons/IconCircleOutline.js +139 -5
- package/dist/icons/IconClock.js +80 -5
- package/dist/icons/IconClose.js +72 -4
- package/dist/icons/IconCollapseAll.js +94 -5
- package/dist/icons/IconConcierge.js +79 -5
- package/dist/icons/IconConciergeService.js +87 -5
- package/dist/icons/IconCreditCard.js +78 -5
- package/dist/icons/IconDash.js +72 -4
- package/dist/icons/IconDeliver.js +72 -4
- package/dist/icons/IconDelivery.js +87 -5
- package/dist/icons/IconDetails.js +72 -4
- package/dist/icons/IconDot.js +87 -6
- package/dist/icons/IconDownload.js +79 -5
- package/dist/icons/IconEVCharging.js +79 -5
- package/dist/icons/IconElectricCarFuel.js +80 -5
- package/dist/icons/IconEllipsis.js +78 -5
- package/dist/icons/IconEnvelope.js +72 -4
- package/dist/icons/IconExpandAll.js +94 -5
- package/dist/icons/IconEye.js +79 -5
- package/dist/icons/IconFacebook.js +94 -6
- package/dist/icons/IconFilter.js +83 -5
- package/dist/icons/IconFlagMalaysia.js +141 -5
- package/dist/icons/IconGiveKey.js +79 -5
- package/dist/icons/IconGlobe.js +70 -4
- package/dist/icons/IconGoogle.js +87 -5
- package/dist/icons/IconHome.js +78 -5
- package/dist/icons/IconHostAdvertise.js +72 -4
- package/dist/icons/IconHostCar.js +75 -4
- package/dist/icons/IconHostCash.js +91 -5
- package/dist/icons/IconHostHandle.js +70 -4
- package/dist/icons/IconHostLocation.js +70 -4
- package/dist/icons/IconHostPayment.js +91 -5
- package/dist/icons/IconHostService.js +79 -5
- package/dist/icons/IconHotDeals.js +72 -4
- package/dist/icons/IconInfo.js +77 -5
- package/dist/icons/IconInstagram.js +72 -4
- package/dist/icons/IconInsurance.js +99 -5
- package/dist/icons/IconInternet.js +73 -4
- package/dist/icons/IconInventory.js +78 -5
- package/dist/icons/IconLaurel.js +101 -5
- package/dist/icons/IconLinkedIn.js +72 -4
- package/dist/icons/IconLoading.js +78 -4
- package/dist/icons/IconLocation.js +80 -5
- package/dist/icons/IconLock.js +73 -4
- package/dist/icons/IconLogistics.js +72 -4
- package/dist/icons/IconMail.js +94 -5
- package/dist/icons/IconMember.js +78 -5
- package/dist/icons/IconMobilePen.js +83 -5
- package/dist/icons/IconMotorcycleMoped.js +78 -5
- package/dist/icons/IconNoCost.js +92 -5
- package/dist/icons/IconPDF.js +80 -5
- package/dist/icons/IconPencil.js +70 -4
- package/dist/icons/IconPhone.js +70 -4
- package/dist/icons/IconPlus.js +72 -4
- package/dist/icons/IconPricing.js +72 -4
- package/dist/icons/IconProtected.js +71 -4
- package/dist/icons/IconPsychology.js +72 -4
- package/dist/icons/IconQuestionTooltip.js +73 -4
- package/dist/icons/IconQuote.js +72 -4
- package/dist/icons/IconRate.js +71 -4
- package/dist/icons/IconRegister.js +99 -5
- package/dist/icons/IconReport.js +89 -6
- package/dist/icons/IconReturn.js +72 -4
- package/dist/icons/IconSearch.js +70 -4
- package/dist/icons/IconSecure.js +71 -4
- package/dist/icons/IconSecurity.js +73 -4
- package/dist/icons/IconSedanOutline.js +159 -5
- package/dist/icons/IconSelectArrow.js +78 -6
- package/dist/icons/IconSort.js +79 -5
- package/dist/icons/IconSortListed.js +95 -5
- package/dist/icons/IconSortPriceAscending.js +83 -5
- package/dist/icons/IconSortPriceDescending.js +83 -5
- package/dist/icons/IconSortYear.js +79 -5
- package/dist/icons/IconSpan.js +71 -4
- package/dist/icons/IconSpeaker.js +79 -4
- package/dist/icons/IconSpecialCar.js +95 -5
- package/dist/icons/IconStar.js +92 -7
- package/dist/icons/IconStockPhoto.js +95 -5
- package/dist/icons/IconSubscription.js +113 -6
- package/dist/icons/IconSubscriptions.js +113 -6
- package/dist/icons/IconSwap.js +79 -5
- package/dist/icons/IconTax.js +72 -4
- package/dist/icons/IconThinArrow.js +78 -6
- package/dist/icons/IconThumbsdown.js +78 -5
- package/dist/icons/IconThumbsup.js +78 -5
- package/dist/icons/IconTool.js +72 -4
- package/dist/icons/IconTooltip.js +73 -4
- package/dist/icons/IconTrash.js +72 -4
- package/dist/icons/IconTriangleExclamation.js +72 -4
- package/dist/icons/IconTyersBrakes.js +83 -5
- package/dist/icons/IconTyre.js +83 -5
- package/dist/icons/IconVacancy.js +78 -5
- package/dist/icons/IconVolunteer.js +72 -4
- package/dist/icons/IconWhatsapp.js +73 -4
- package/dist/icons/IconXPlatform.js +72 -4
- package/dist/icons/IconZeroEffort.js +77 -5
- package/dist/icons/Logo.js +99 -3
- package/dist/input/Input.js +125 -11
- package/dist/input/Input.stories.js +17 -18
- package/dist/input-mask/InputMask.js +149 -11
- package/dist/input-mask/InputMask.stories.js +5 -6
- package/dist/input-mask/mask-trackers.js +4 -5
- package/dist/input-select/InputSelect.js +357 -68
- package/dist/input-select/InputSelect.stories.js +98 -25
- package/dist/popover/popover.js +72 -4
- package/dist/progress/Progress.js +96 -2
- package/dist/progress/Progress.stories.js +13 -14
- package/dist/radio/Radio.js +163 -4
- package/dist/scroll-area/scroll-area.js +113 -5
- package/dist/search-input-select/SearchInputSelect.js +346 -69
- package/dist/select/Select.js +315 -29
- package/dist/select/Select.stories.js +55 -19
- package/dist/skeleton/Skeleton.js +62 -3
- package/dist/skeleton/Skeleton.stories.js +8 -7
- package/dist/slider/Slider.js +106 -5
- package/dist/slider/Slider.stories.js +12 -11
- package/dist/stack/Stack.js +63 -3
- package/dist/stack/Stack.stories.js +19 -7
- package/dist/table/Table.js +131 -10
- package/dist/table/Table.stories.js +84 -8
- package/dist/tabs/Tabs.js +128 -9
- package/dist/tabs/Tabs.stories.js +46 -13
- package/dist/text/Text.js +88 -6
- package/dist/text/Text.stories.js +44 -7
- package/dist/toast/Toast.stories.js +66 -14
- package/dist/toast/ToastBox.js +77 -29
- package/dist/toast/index.js +0 -1
- package/dist/toast/sonner.js +66 -6
- package/dist/toggle/Toggle.js +116 -7
- package/dist/toggle/Toggle.stories.js +10 -8
- package/dist/tooltip/Tooltip.js +151 -12
- package/dist/tooltip/Tooltip.stories.js +71 -13
- package/dist/utils.js +4 -2
- package/dist/vstack/VStack.js +63 -3
- package/dist/vstack/VStack.stories.js +19 -7
- 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
|
-
|
|
50
|
+
var meta = {
|
|
5
51
|
component: DatePicker,
|
|
6
52
|
argTypes: {
|
|
7
53
|
locale: {
|
|
8
|
-
options: [
|
|
9
|
-
|
|
54
|
+
options: [
|
|
55
|
+
'en',
|
|
56
|
+
'ms',
|
|
57
|
+
'zh',
|
|
58
|
+
'ar'
|
|
59
|
+
],
|
|
60
|
+
control: {
|
|
61
|
+
type: 'select'
|
|
62
|
+
}
|
|
10
63
|
},
|
|
11
64
|
calendarType: {
|
|
12
|
-
options: [
|
|
13
|
-
|
|
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
|
|
19
|
-
render: ()
|
|
20
|
-
|
|
21
|
-
return
|
|
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
|
|
25
|
-
render: ()
|
|
26
|
-
|
|
27
|
-
return
|
|
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
|
|
31
|
-
render: (_args)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
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
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
44
|
-
render: ()
|
|
45
|
-
|
|
46
|
-
return
|
|
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
|
|
50
|
-
render: ()
|
|
51
|
-
|
|
52
|
-
return
|
|
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
|
|
56
|
-
render: ()
|
|
57
|
-
|
|
58
|
-
return
|
|
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
|
|
62
|
-
render: ()
|
|
63
|
-
|
|
64
|
-
return
|
|
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
|
|
68
|
-
render: ()
|
|
69
|
-
|
|
70
|
-
return
|
|
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
|
|
74
|
-
render: ()
|
|
75
|
-
|
|
76
|
-
return
|
|
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
|
|
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
|
-
|
|
21
|
-
// non-customized props
|
|
22
|
-
innerValue, setInnerValue, focused, setFocused, handleSelect, handleCancel, handleApply
|
|
23
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}, [
|
|
39
|
-
|
|
40
|
-
|
|
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
|