@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,187 +1,30 @@
1
1
  'use client';
2
- function _define_property(obj, key, value) {
3
- if (key in obj) {
4
- Object.defineProperty(obj, key, {
5
- value: value,
6
- enumerable: true,
7
- configurable: true,
8
- writable: true
9
- });
10
- } else {
11
- obj[key] = value;
12
- }
13
- return obj;
14
- }
15
- function _object_spread(target) {
16
- for(var i = 1; i < arguments.length; i++){
17
- var source = arguments[i] != null ? arguments[i] : {};
18
- var ownKeys = Object.keys(source);
19
- if (typeof Object.getOwnPropertySymbols === "function") {
20
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
- }));
23
- }
24
- ownKeys.forEach(function(key) {
25
- _define_property(target, key, source[key]);
26
- });
27
- }
28
- return target;
29
- }
30
- function ownKeys(object, enumerableOnly) {
31
- var keys = Object.keys(object);
32
- if (Object.getOwnPropertySymbols) {
33
- var symbols = Object.getOwnPropertySymbols(object);
34
- if (enumerableOnly) {
35
- symbols = symbols.filter(function(sym) {
36
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
37
- });
38
- }
39
- keys.push.apply(keys, symbols);
40
- }
41
- return keys;
42
- }
43
- function _object_spread_props(target, source) {
44
- source = source != null ? source : {};
45
- if (Object.getOwnPropertyDescriptors) {
46
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
- } else {
48
- ownKeys(Object(source)).forEach(function(key) {
49
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
- });
51
- }
52
- return target;
53
- }
54
- function _object_without_properties(source, excluded) {
55
- if (source == null) return {};
56
- var target = _object_without_properties_loose(source, excluded);
57
- var key, i;
58
- if (Object.getOwnPropertySymbols) {
59
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
60
- for(i = 0; i < sourceSymbolKeys.length; i++){
61
- key = sourceSymbolKeys[i];
62
- if (excluded.indexOf(key) >= 0) continue;
63
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
64
- target[key] = source[key];
65
- }
66
- }
67
- return target;
68
- }
69
- function _object_without_properties_loose(source, excluded) {
70
- if (source == null) return {};
71
- var target = {};
72
- var sourceKeys = Object.keys(source);
73
- var key, i;
74
- for(i = 0; i < sourceKeys.length; i++){
75
- key = sourceKeys[i];
76
- if (excluded.indexOf(key) >= 0) continue;
77
- target[key] = source[key];
78
- }
79
- return target;
80
- }
81
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
82
3
  import { Command as CommandPrimitive } from 'cmdk';
83
4
  import * as React from 'react';
84
5
  import { Dialog, DialogContent } from '../dialog/index';
85
6
  import IconSearch from '../icons/IconSearch';
86
7
  import { cn } from '../utils';
87
- var Command = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
88
- var className = _param.className, props = _object_without_properties(_param, [
89
- "className"
90
- ]);
91
- return /*#__PURE__*/ _jsx(CommandPrimitive, _object_spread({
92
- ref: ref,
93
- className: cn('flex h-full w-full flex-col overflow-hidden rounded-lg bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50', className)
94
- }, props));
95
- });
8
+ const Command = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive, { ref: ref, className: cn('flex h-full w-full flex-col overflow-hidden rounded-lg bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50', className), ...props })));
96
9
  Command.displayName = CommandPrimitive.displayName;
97
- var CommandDialog = function(_param) {
98
- var children = _param.children, props = _object_without_properties(_param, [
99
- "children"
100
- ]);
101
- return /*#__PURE__*/ _jsx(Dialog, _object_spread_props(_object_spread({}, props), {
102
- children: /*#__PURE__*/ _jsx(DialogContent, {
103
- className: "overflow-hidden p-0 shadow-lg",
104
- children: /*#__PURE__*/ _jsx(Command, {
105
- className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 dark:[&_[cmdk-group-heading]]:text-zinc-400",
106
- children: children
107
- })
108
- })
109
- }));
10
+ const CommandDialog = ({ children, ...props }) => {
11
+ return (_jsx(Dialog, { ...props, children: _jsx(DialogContent, { className: "overflow-hidden p-0 shadow-lg", children: _jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 dark:[&_[cmdk-group-heading]]:text-zinc-400", children: children }) }) }));
110
12
  };
111
- var CommandInput = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
112
- var className = _param.className, containerClassName = _param.containerClassName, props = _object_without_properties(_param, [
113
- "className",
114
- "containerClassName"
115
- ]);
116
- return /*#__PURE__*/ _jsxs("div", {
117
- className: cn('flex h-10 items-center border-b px-3', containerClassName),
118
- "cmdk-input-wrapper": "",
119
- children: [
120
- /*#__PURE__*/ _jsx(IconSearch, {
121
- className: "mr-2 h-4 w-4 shrink-0 opacity-50"
122
- }),
123
- /*#__PURE__*/ _jsx(CommandPrimitive.Input, _object_spread({
124
- ref: ref,
125
- className: cn('flex w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-zinc-500 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-zinc-400', className)
126
- }, props))
127
- ]
128
- });
129
- });
13
+ const CommandInput = React.forwardRef(({ className, containerClassName, ...props }, ref) => (_jsxs("div", { className: cn('flex h-10 items-center border-b px-3', containerClassName), "cmdk-input-wrapper": "", children: [_jsx(IconSearch, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { ref: ref, className: cn('flex w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-zinc-500 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-zinc-400', className), ...props })] })));
130
14
  CommandInput.displayName = CommandPrimitive.Input.displayName;
131
- var CommandList = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
132
- var className = _param.className, props = _object_without_properties(_param, [
133
- "className"
134
- ]);
135
- return /*#__PURE__*/ _jsx(CommandPrimitive.List, _object_spread({
136
- ref: ref,
137
- className: cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)
138
- }, props));
139
- });
15
+ const CommandList = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.List, { ref: ref, className: cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className), ...props })));
140
16
  CommandList.displayName = CommandPrimitive.List.displayName;
141
- var CommandEmpty = /*#__PURE__*/ React.forwardRef(function(props, ref) {
142
- return /*#__PURE__*/ _jsx(CommandPrimitive.Empty, _object_spread({
143
- ref: ref,
144
- className: "py-6 text-center text-sm"
145
- }, props));
146
- });
17
+ const CommandEmpty = React.forwardRef((props, ref) => (_jsx(CommandPrimitive.Empty, { ref: ref, className: "py-6 text-center text-sm", ...props })));
147
18
  CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
148
- var CommandGroup = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
149
- var className = _param.className, props = _object_without_properties(_param, [
150
- "className"
151
- ]);
152
- return /*#__PURE__*/ _jsx(CommandPrimitive.Group, _object_spread({
153
- ref: ref,
154
- className: cn('overflow-hidden p-1 text-zinc-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 dark:text-zinc-50 dark:[&_[cmdk-group-heading]]:text-zinc-400', className)
155
- }, props));
156
- });
19
+ const CommandGroup = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Group, { ref: ref, className: cn('overflow-hidden p-1 text-zinc-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-zinc-500 dark:text-zinc-50 dark:[&_[cmdk-group-heading]]:text-zinc-400', className), ...props })));
157
20
  CommandGroup.displayName = CommandPrimitive.Group.displayName;
158
- var CommandSeparator = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
159
- var className = _param.className, props = _object_without_properties(_param, [
160
- "className"
161
- ]);
162
- return /*#__PURE__*/ _jsx(CommandPrimitive.Separator, _object_spread({
163
- ref: ref,
164
- className: cn('-mx-1 h-px bg-zinc-200 dark:bg-zinc-800', className)
165
- }, props));
166
- });
21
+ const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Separator, { ref: ref, className: cn('-mx-1 h-px bg-zinc-200 dark:bg-zinc-800', className), ...props })));
167
22
  CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
168
- var CommandItem = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
169
- var className = _param.className, props = _object_without_properties(_param, [
170
- "className"
171
- ]);
172
- return /*#__PURE__*/ _jsx(CommandPrimitive.Item, _object_spread({
173
- ref: ref,
174
- className: cn("relative flex cursor-default select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected='true']:bg-zinc-100 data-[selected=true]:text-zinc-900 data-[disabled=true]:opacity-50 dark:data-[selected='true']:bg-zinc-800 dark:data-[selected=true]:text-zinc-50", className)
175
- }, props));
176
- });
23
+ const CommandItem = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected='true']:bg-zinc-100 data-[selected=true]:text-zinc-900 data-[disabled=true]:opacity-50 dark:data-[selected='true']:bg-zinc-800 dark:data-[selected=true]:text-zinc-50", className), ...props })));
177
24
  CommandItem.displayName = CommandPrimitive.Item.displayName;
178
- var CommandShortcut = function(_param) {
179
- var className = _param.className, props = _object_without_properties(_param, [
180
- "className"
181
- ]);
182
- return /*#__PURE__*/ _jsx("span", _object_spread({
183
- className: cn('ml-auto text-xs tracking-widest text-zinc-500 dark:text-zinc-400', className)
184
- }, props));
25
+ const CommandShortcut = ({ className, ...props }) => {
26
+ return (_jsx("span", { className: cn('ml-auto text-xs tracking-widest text-zinc-500 dark:text-zinc-400', className), ...props }));
185
27
  };
186
28
  CommandShortcut.displayName = 'CommandShortcut';
187
- export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
29
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
30
+ //# sourceMappingURL=command.js.map
@@ -1,322 +1,178 @@
1
1
  'use client';
2
- function _array_like_to_array(arr, len) {
3
- if (len == null || len > arr.length) len = arr.length;
4
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
- return arr2;
6
- }
7
- function _array_with_holes(arr) {
8
- if (Array.isArray(arr)) return arr;
9
- }
10
- function _define_property(obj, key, value) {
11
- if (key in obj) {
12
- Object.defineProperty(obj, key, {
13
- value: value,
14
- enumerable: true,
15
- configurable: true,
16
- writable: true
17
- });
18
- } else {
19
- obj[key] = value;
20
- }
21
- return obj;
22
- }
23
- function _iterable_to_array_limit(arr, i) {
24
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
25
- if (_i == null) return;
26
- var _arr = [];
27
- var _n = true;
28
- var _d = false;
29
- var _s, _e;
30
- try {
31
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
32
- _arr.push(_s.value);
33
- if (i && _arr.length === i) break;
34
- }
35
- } catch (err) {
36
- _d = true;
37
- _e = err;
38
- } finally{
39
- try {
40
- if (!_n && _i["return"] != null) _i["return"]();
41
- } finally{
42
- if (_d) throw _e;
43
- }
44
- }
45
- return _arr;
46
- }
47
- function _non_iterable_rest() {
48
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
49
- }
50
- function _object_spread(target) {
51
- for(var i = 1; i < arguments.length; i++){
52
- var source = arguments[i] != null ? arguments[i] : {};
53
- var ownKeys = Object.keys(source);
54
- if (typeof Object.getOwnPropertySymbols === "function") {
55
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
56
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
57
- }));
58
- }
59
- ownKeys.forEach(function(key) {
60
- _define_property(target, key, source[key]);
61
- });
62
- }
63
- return target;
64
- }
65
- function _object_without_properties(source, excluded) {
66
- if (source == null) return {};
67
- var target = _object_without_properties_loose(source, excluded);
68
- var key, i;
69
- if (Object.getOwnPropertySymbols) {
70
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
71
- for(i = 0; i < sourceSymbolKeys.length; i++){
72
- key = sourceSymbolKeys[i];
73
- if (excluded.indexOf(key) >= 0) continue;
74
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
75
- target[key] = source[key];
76
- }
77
- }
78
- return target;
79
- }
80
- function _object_without_properties_loose(source, excluded) {
81
- if (source == null) return {};
82
- var target = {};
83
- var sourceKeys = Object.keys(source);
84
- var key, i;
85
- for(i = 0; i < sourceKeys.length; i++){
86
- key = sourceKeys[i];
87
- if (excluded.indexOf(key) >= 0) continue;
88
- target[key] = source[key];
89
- }
90
- return target;
91
- }
92
- function _sliced_to_array(arr, i) {
93
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
94
- }
95
- function _unsupported_iterable_to_array(o, minLen) {
96
- if (!o) return;
97
- if (typeof o === "string") return _array_like_to_array(o, minLen);
98
- var n = Object.prototype.toString.call(o).slice(8, -1);
99
- if (n === "Object" && o.constructor) n = o.constructor.name;
100
- if (n === "Map" || n === "Set") return Array.from(n);
101
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
102
- }
103
2
  import { jsx as _jsx } from "react/jsx-runtime";
104
3
  import { useCallback, useState } from 'react';
105
4
  import { useIsMobile } from '../hooks/use-media-query';
106
5
  import DatePickerDrawer from './DatePickerDrawer';
107
6
  import DatePickerPopover from './DatePickerPopover';
108
7
  import { formatInputBy } from './utils';
109
- var DatePicker = function(_param) {
110
- var tileDisabled = _param.tileDisabled, onCancel = _param.onCancel, props = _object_without_properties(_param, [
111
- "tileDisabled",
112
- "onCancel"
113
- ]);
114
- var value = props.value, isRange = props.isRange, onChange = props.onChange, disableWeekends = props.disableWeekends, error = props.error, onSelect = props.onSelect;
115
- var isMobile = useIsMobile();
116
- var _useState = _sliced_to_array(useState(value), 2), innerValue = _useState[0], setInnerValue = _useState[1];
117
- var _useState1 = _sliced_to_array(useState(formatInputBy(value, isRange)), 2), inputValue = _useState1[0], setInputValue = _useState1[1];
118
- var _useState2 = _sliced_to_array(useState(false), 2), focused = _useState2[0], setFocused = _useState2[1];
119
- var isSameDate = function(date1, date2) {
120
- return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
8
+ const DatePicker = ({ tileDisabled, onCancel, ...props }) => {
9
+ const { value, isRange, onChange, disableWeekends, error, onSelect } = props;
10
+ const isMobile = useIsMobile();
11
+ const [innerValue, setInnerValue] = useState(value);
12
+ const [inputValue, setInputValue] = useState(formatInputBy(value, isRange));
13
+ const [focused, setFocused] = useState(false);
14
+ const isSameDate = (date1, date2) => {
15
+ return (date1.getFullYear() === date2.getFullYear() &&
16
+ date1.getMonth() === date2.getMonth() &&
17
+ date1.getDate() === date2.getDate());
121
18
  };
122
- var handleSelect = function(value) {
19
+ const handleSelect = (value) => {
123
20
  if (isRange) {
124
21
  // Handle range mode
125
- var currentRange = Array.isArray(innerValue) ? innerValue : undefined;
22
+ const currentRange = Array.isArray(innerValue) ? innerValue : undefined;
126
23
  if (Array.isArray(value) && value && value[0] && value[1]) {
127
24
  // Both dates selected
128
- var clickedStart = new Date(value[0]);
129
- var clickedEnd = new Date(value[1]);
25
+ const clickedStart = new Date(value[0]);
26
+ const clickedEnd = new Date(value[1]);
130
27
  // Check if clicking the same start date (start date matches, end might be different)
131
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[0]) && isSameDate(clickedStart, currentRange[0]) && currentRange[1] && !isSameDate(clickedEnd, currentRange[1])) {
28
+ if (currentRange?.[0] &&
29
+ isSameDate(clickedStart, currentRange[0]) &&
30
+ currentRange[1] &&
31
+ !isSameDate(clickedEnd, currentRange[1])) {
132
32
  // User clicked start date again - clear start, keep end
133
- var newValue = [
33
+ const newValue = [
134
34
  undefined,
135
- currentRange[1]
35
+ currentRange[1],
136
36
  ];
137
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue);
37
+ onSelect?.(newValue);
138
38
  setInnerValue(newValue);
139
39
  setInputValue(formatInputBy(newValue, isRange));
140
40
  return;
141
41
  }
142
42
  // Check if clicking the same end date (end date matches, start might be different)
143
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[1]) && isSameDate(clickedEnd, currentRange[1]) && currentRange[0] && !isSameDate(clickedStart, currentRange[0])) {
43
+ if (currentRange?.[1] &&
44
+ isSameDate(clickedEnd, currentRange[1]) &&
45
+ currentRange[0] &&
46
+ !isSameDate(clickedStart, currentRange[0])) {
144
47
  // User clicked end date again - clear end, keep start
145
- var newValue1 = [
48
+ const newValue = [
146
49
  currentRange[0],
147
- undefined
50
+ undefined,
148
51
  ];
149
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue1);
150
- setInnerValue(newValue1);
151
- setInputValue(formatInputBy(newValue1, isRange));
52
+ onSelect?.(newValue);
53
+ setInnerValue(newValue);
54
+ setInputValue(formatInputBy(newValue, isRange));
152
55
  return;
153
56
  }
154
57
  // Normal case: set both dates
155
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([
156
- new Date(value[0]),
157
- new Date(value[1])
158
- ]);
159
- setInnerValue([
160
- new Date(value[0]),
161
- new Date(value[1])
162
- ]);
163
- setInputValue(formatInputBy([
164
- value[0],
165
- value[1]
166
- ], isRange));
58
+ onSelect?.([new Date(value[0]), new Date(value[1])]);
59
+ setInnerValue([new Date(value[0]), new Date(value[1])]);
60
+ setInputValue(formatInputBy([value[0], value[1]], isRange));
167
61
  return;
168
62
  }
169
63
  // Single date selected in range mode
170
64
  if (!Array.isArray(value) && value) {
171
- var clickedDate = new Date(value);
65
+ const clickedDate = new Date(value);
172
66
  // Check if start and end are the same date and clicking that date
173
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[0]) && currentRange[1] && isSameDate(currentRange[0], currentRange[1]) && isSameDate(clickedDate, currentRange[0])) {
67
+ if (currentRange?.[0] &&
68
+ currentRange[1] &&
69
+ isSameDate(currentRange[0], currentRange[1]) &&
70
+ isSameDate(clickedDate, currentRange[0])) {
174
71
  // Clear both dates
175
- var newValue2 = [
72
+ const newValue = [
73
+ undefined,
176
74
  undefined,
177
- undefined
178
75
  ];
179
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue2);
180
- setInnerValue(newValue2);
181
- setInputValue(formatInputBy(newValue2, isRange));
76
+ onSelect?.(newValue);
77
+ setInnerValue(newValue);
78
+ setInputValue(formatInputBy(newValue, isRange));
182
79
  return;
183
80
  }
184
81
  // Check if clicking the same start date
185
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[0]) && isSameDate(clickedDate, currentRange[0])) {
82
+ if (currentRange?.[0] && isSameDate(clickedDate, currentRange[0])) {
186
83
  // Clear start date, keep end if it exists
187
- var newValue3 = currentRange[1] ? [
188
- undefined,
189
- currentRange[1]
190
- ] : [
191
- undefined,
192
- undefined
193
- ];
194
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue3);
195
- setInnerValue(newValue3);
196
- setInputValue(formatInputBy(newValue3, isRange));
84
+ const newValue = currentRange[1]
85
+ ? [undefined, currentRange[1]]
86
+ : [undefined, undefined];
87
+ onSelect?.(newValue);
88
+ setInnerValue(newValue);
89
+ setInputValue(formatInputBy(newValue, isRange));
197
90
  return;
198
91
  }
199
92
  // Check if clicking the same end date
200
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[1]) && isSameDate(clickedDate, currentRange[1])) {
93
+ if (currentRange?.[1] && isSameDate(clickedDate, currentRange[1])) {
201
94
  // Clear end date, keep start if it exists
202
- var newValue4 = currentRange[0] ? [
203
- currentRange[0],
204
- undefined
205
- ] : [
206
- undefined,
207
- undefined
208
- ];
209
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue4);
210
- setInnerValue(newValue4);
211
- setInputValue(formatInputBy(newValue4, isRange));
95
+ const newValue = currentRange[0]
96
+ ? [currentRange[0], undefined]
97
+ : [undefined, undefined];
98
+ onSelect?.(newValue);
99
+ setInnerValue(newValue);
100
+ setInputValue(formatInputBy(newValue, isRange));
212
101
  return;
213
102
  }
214
103
  // Normal case: set start date (or both if no range exists)
215
- if ((currentRange === null || currentRange === void 0 ? void 0 : currentRange[0]) && !currentRange[1]) {
104
+ if (currentRange?.[0] && !currentRange[1]) {
216
105
  // Start exists but no end - this click sets the end
217
- var start = currentRange[0];
218
- var end = clickedDate;
219
- var finalRange = start <= end ? [
220
- start,
221
- end
222
- ] : [
223
- end,
224
- start
225
- ];
226
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(finalRange);
106
+ const start = currentRange[0];
107
+ const end = clickedDate;
108
+ const finalRange = start <= end ? [start, end] : [end, start];
109
+ onSelect?.(finalRange);
227
110
  setInnerValue(finalRange);
228
111
  setInputValue(formatInputBy(finalRange, isRange));
229
112
  return;
230
113
  }
231
114
  // No range or both dates exist - set as new start
232
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([
233
- clickedDate,
234
- clickedDate
235
- ]);
236
- setInnerValue([
237
- clickedDate,
238
- clickedDate
239
- ]);
115
+ onSelect?.([clickedDate, clickedDate]);
116
+ setInnerValue([clickedDate, clickedDate]);
240
117
  setInputValue(formatInputBy(clickedDate, isRange));
241
118
  return;
242
119
  }
243
120
  }
244
121
  if (!isRange && !Array.isArray(value) && value) {
245
122
  // Handle single date mode - toggle if same date clicked
246
- var clickedDate1 = new Date(value);
247
- if (innerValue && !Array.isArray(innerValue) && isSameDate(clickedDate1, innerValue)) {
123
+ const clickedDate = new Date(value);
124
+ if (innerValue &&
125
+ !Array.isArray(innerValue) &&
126
+ isSameDate(clickedDate, innerValue)) {
248
127
  setInnerValue(undefined);
249
128
  setInputValue(formatInputBy(undefined, isRange));
250
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(undefined);
129
+ onSelect?.(undefined);
251
130
  return;
252
131
  }
253
132
  // Normal case: set the date
254
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(new Date(value));
133
+ onSelect?.(new Date(value));
255
134
  setInnerValue(new Date(value));
256
135
  setInputValue(formatInputBy(value, isRange));
257
136
  return;
258
137
  }
259
138
  };
260
- var handleCancel = function() {
139
+ const handleCancel = () => {
261
140
  setFocused(false);
262
141
  setInnerValue(value);
263
142
  setInputValue(formatInputBy(value, isRange));
264
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
143
+ onCancel?.();
265
144
  };
266
- var handleApply = function() {
267
- if (isRange && Array.isArray(innerValue) && innerValue && innerValue[0] && innerValue[1]) {
268
- onChange === null || onChange === void 0 ? void 0 : onChange([
269
- innerValue[0],
270
- innerValue[1]
271
- ]);
145
+ const handleApply = () => {
146
+ if (isRange &&
147
+ Array.isArray(innerValue) &&
148
+ innerValue &&
149
+ innerValue[0] &&
150
+ innerValue[1]) {
151
+ onChange?.([innerValue[0], innerValue[1]]);
272
152
  setFocused(false);
273
153
  return;
274
154
  }
275
155
  if (!isRange && !Array.isArray(innerValue) && innerValue) {
276
- onChange === null || onChange === void 0 ? void 0 : onChange(innerValue);
156
+ onChange?.(innerValue);
277
157
  setFocused(false);
278
158
  return;
279
159
  }
280
160
  };
281
- var weekendTiles = function(args) {
161
+ const weekendTiles = (args) => {
282
162
  if (args.view === 'month') {
283
- var day = args.date.getDay();
163
+ const day = args.date.getDay();
284
164
  return day === 0 || day === 6;
285
165
  }
286
166
  return false;
287
167
  };
288
- var combinedTileDisabled = useCallback(function(args) {
289
- if (disableWeekends && weekendTiles(args)) return true;
290
- if (typeof tileDisabled === 'function') return tileDisabled(args);
168
+ const combinedTileDisabled = useCallback((args) => {
169
+ if (disableWeekends && weekendTiles(args))
170
+ return true;
171
+ if (typeof tileDisabled === 'function')
172
+ return tileDisabled(args);
291
173
  return false;
292
- }, [
293
- disableWeekends,
294
- tileDisabled
295
- ]);
296
- return isMobile ? /*#__PURE__*/ _jsx(DatePickerDrawer, _object_spread({
297
- innerValue: innerValue,
298
- setInnerValue: setInnerValue,
299
- inputValue: inputValue,
300
- setInputValue: setInputValue,
301
- focused: focused,
302
- setFocused: setFocused,
303
- handleSelect: handleSelect,
304
- handleCancel: handleCancel,
305
- handleApply: handleApply,
306
- tileDisabled: combinedTileDisabled,
307
- error: error
308
- }, props)) : /*#__PURE__*/ _jsx(DatePickerPopover, _object_spread({
309
- innerValue: innerValue,
310
- setInnerValue: setInnerValue,
311
- inputValue: inputValue,
312
- setInputValue: setInputValue,
313
- focused: focused,
314
- setFocused: setFocused,
315
- handleSelect: handleSelect,
316
- handleCancel: handleCancel,
317
- handleApply: handleApply,
318
- tileDisabled: combinedTileDisabled,
319
- error: error
320
- }, props));
174
+ }, [disableWeekends, tileDisabled]);
175
+ return isMobile ? (_jsx(DatePickerDrawer, { innerValue: innerValue, setInnerValue: setInnerValue, inputValue: inputValue, setInputValue: setInputValue, focused: focused, setFocused: setFocused, handleSelect: handleSelect, handleCancel: handleCancel, handleApply: handleApply, tileDisabled: combinedTileDisabled, error: error, ...props })) : (_jsx(DatePickerPopover, { innerValue: innerValue, setInnerValue: setInnerValue, inputValue: inputValue, setInputValue: setInputValue, focused: focused, setFocused: setFocused, handleSelect: handleSelect, handleCancel: handleCancel, handleApply: handleApply, tileDisabled: combinedTileDisabled, error: error, ...props }));
321
176
  };
322
177
  export default DatePicker;
178
+ //# sourceMappingURL=DatePicker.js.map