@driveflux/beam 3.0.10 → 3.0.12
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,4 +1,129 @@
|
|
|
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 ownKeys(object, enumerableOnly) {
|
|
66
|
+
var keys = Object.keys(object);
|
|
67
|
+
if (Object.getOwnPropertySymbols) {
|
|
68
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
+
if (enumerableOnly) {
|
|
70
|
+
symbols = symbols.filter(function(sym) {
|
|
71
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
keys.push.apply(keys, symbols);
|
|
75
|
+
}
|
|
76
|
+
return keys;
|
|
77
|
+
}
|
|
78
|
+
function _object_spread_props(target, source) {
|
|
79
|
+
source = source != null ? source : {};
|
|
80
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
81
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
82
|
+
} else {
|
|
83
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
function _object_without_properties(source, excluded) {
|
|
90
|
+
if (source == null) return {};
|
|
91
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
92
|
+
var key, i;
|
|
93
|
+
if (Object.getOwnPropertySymbols) {
|
|
94
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
95
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
96
|
+
key = sourceSymbolKeys[i];
|
|
97
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
98
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
99
|
+
target[key] = source[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return target;
|
|
103
|
+
}
|
|
104
|
+
function _object_without_properties_loose(source, excluded) {
|
|
105
|
+
if (source == null) return {};
|
|
106
|
+
var target = {};
|
|
107
|
+
var sourceKeys = Object.keys(source);
|
|
108
|
+
var key, i;
|
|
109
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
110
|
+
key = sourceKeys[i];
|
|
111
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
112
|
+
target[key] = source[key];
|
|
113
|
+
}
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
116
|
+
function _sliced_to_array(arr, i) {
|
|
117
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
118
|
+
}
|
|
119
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
120
|
+
if (!o) return;
|
|
121
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
122
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
123
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
124
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
125
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
126
|
+
}
|
|
2
127
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
128
|
import { Command as CommandPrimitive } from 'cmdk';
|
|
4
129
|
import * as React from 'react';
|
|
@@ -7,112 +132,215 @@ import FieldWrapper from '../field-wrapper/FieldWrapper';
|
|
|
7
132
|
import IconClose from '../icons/IconClose';
|
|
8
133
|
import IconSelectArrow from '../icons/IconSelectArrow';
|
|
9
134
|
import { cn } from '../utils';
|
|
10
|
-
|
|
135
|
+
var Command = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
136
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
137
|
+
"className"
|
|
138
|
+
]);
|
|
139
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive, _object_spread({
|
|
140
|
+
ref: ref,
|
|
141
|
+
className: cn('flex relative w-full', className)
|
|
142
|
+
}, props));
|
|
143
|
+
});
|
|
11
144
|
Command.displayName = CommandPrimitive.displayName;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
145
|
+
var CommandInput = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
146
|
+
var className = _param.className, error = _param.error, prefix = _param.prefix, isFocused = _param.isFocused, isSelected = _param.isSelected, handleToggle = _param.handleToggle, handleClear = _param.handleClear, props = _object_without_properties(_param, [
|
|
147
|
+
"className",
|
|
148
|
+
"error",
|
|
149
|
+
"prefix",
|
|
150
|
+
"isFocused",
|
|
151
|
+
"isSelected",
|
|
152
|
+
"handleToggle",
|
|
153
|
+
"handleClear"
|
|
154
|
+
]);
|
|
155
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
156
|
+
ref: ref,
|
|
157
|
+
className: cn('flex items-center gap-2 h-10 w-full border border-primary2 bg-white text-sm cursor-pointer outline-none file:border-0 file:bg-transparent file:text-sm file:font-medium hover:border-black focus-within:border-black focus-within:outline-none rounded-lg', error && 'border-alert4 hover:border-alert4 focus-within:border-alert4', className),
|
|
158
|
+
children: [
|
|
159
|
+
prefix,
|
|
160
|
+
/*#__PURE__*/ _jsx(CommandPrimitive.Input, _object_spread_props(_object_spread({
|
|
161
|
+
className: cn('border-none h-full px-3 outline-hidden text-ellipsis placeholder:text-primary2 placeholder:tracking-normal w-full cursor-pointer disabled:cursor-not-allowed disabled:bg-primary1 disabled:text-primary3 rounded-lg'),
|
|
162
|
+
disabled: props.disabled
|
|
163
|
+
}, props), {
|
|
164
|
+
onClick: function(_e) {
|
|
165
|
+
if (isSelected) {
|
|
166
|
+
isFocused = true;
|
|
167
|
+
} else if (!isFocused) {
|
|
168
|
+
handleToggle();
|
|
169
|
+
}
|
|
15
170
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
171
|
+
})),
|
|
172
|
+
!props.disabled && /*#__PURE__*/ _jsx(Box, {
|
|
173
|
+
className: "flex items-center justify-center w-8 h-8 mx-1",
|
|
174
|
+
style: {
|
|
175
|
+
pointerEvents: 'auto'
|
|
176
|
+
},
|
|
177
|
+
children: isSelected ? /*#__PURE__*/ _jsx(IconClose, {
|
|
178
|
+
className: "text-black",
|
|
179
|
+
onClick: function(e) {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
handleClear(e);
|
|
183
|
+
}
|
|
184
|
+
}) : /*#__PURE__*/ _jsx(IconSelectArrow, {
|
|
185
|
+
variant: isFocused ? 'up' : 'down',
|
|
186
|
+
onClick: function() {
|
|
187
|
+
return handleToggle();
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
});
|
|
24
194
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
25
|
-
|
|
26
|
-
|
|
195
|
+
var CommandList = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
196
|
+
var className = _param.className, position = _param.position, props = _object_without_properties(_param, [
|
|
197
|
+
"className",
|
|
198
|
+
"position"
|
|
199
|
+
]);
|
|
200
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive.List, _object_spread({
|
|
201
|
+
ref: ref,
|
|
202
|
+
className: cn('max-h-80 absolute left-0 right-0 mt-1 shadow-md overflow-y-auto overflow-x-hidden z-50 bg-white rounded-lg', position === 'top' ? 'bottom-full mb-1' : 'top-full mt-1', className)
|
|
203
|
+
}, props));
|
|
27
204
|
});
|
|
28
205
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
29
|
-
|
|
206
|
+
var CommandEmpty = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
207
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive.Empty, _object_spread({
|
|
208
|
+
ref: ref,
|
|
209
|
+
className: "p-4 text-center text-sm text-primary3"
|
|
210
|
+
}, props));
|
|
211
|
+
});
|
|
30
212
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
31
|
-
|
|
213
|
+
var CommandGroup = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
214
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
215
|
+
"className"
|
|
216
|
+
]);
|
|
217
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive.Group, _object_spread({
|
|
218
|
+
ref: ref,
|
|
219
|
+
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)
|
|
220
|
+
}, props));
|
|
221
|
+
});
|
|
32
222
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
33
|
-
|
|
223
|
+
var CommandSeparator = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
224
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
225
|
+
"className"
|
|
226
|
+
]);
|
|
227
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive.Separator, _object_spread({
|
|
228
|
+
ref: ref,
|
|
229
|
+
className: cn('-mx-1 h-px bg-zinc-200 dark:bg-zinc-800', className)
|
|
230
|
+
}, props));
|
|
231
|
+
});
|
|
34
232
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
35
|
-
|
|
233
|
+
var CommandItem = /*#__PURE__*/ React.forwardRef(function(_param, ref) {
|
|
234
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
235
|
+
"className"
|
|
236
|
+
]);
|
|
237
|
+
return /*#__PURE__*/ _jsx(CommandPrimitive.Item, _object_spread({
|
|
238
|
+
ref: ref,
|
|
239
|
+
className: cn('relative flex cursor-pointer select-none items-center rounded-xs px-4 h-10 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[disabled=true]:bg-primary1 data-[disabled=true]:text-primary2 data-[selected=true]:bg-zinc-100 data-[selected=true]:text-zinc-900 dark:data-[selected=true]:bg-zinc-800 dark:data-[selected=true]:text-zinc-50', className)
|
|
240
|
+
}, props));
|
|
241
|
+
});
|
|
36
242
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
37
|
-
|
|
38
|
-
|
|
243
|
+
var CommandShortcut = function(_param) {
|
|
244
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
245
|
+
"className"
|
|
246
|
+
]);
|
|
247
|
+
return /*#__PURE__*/ _jsx("span", _object_spread({
|
|
248
|
+
className: cn('ml-auto text-xs tracking-widest text-zinc-500 dark:text-zinc-400', className)
|
|
249
|
+
}, props));
|
|
39
250
|
};
|
|
40
251
|
CommandShortcut.displayName = 'CommandShortcut';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// for wrapper
|
|
44
|
-
wrapperProps, htmlFor, label, showRequired, showOptional, outerPrefix, outerSuffix, error,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
252
|
+
var InputSelect = /*#__PURE__*/ React.forwardRef(function(props, _ref) {
|
|
253
|
+
var _options_find;
|
|
254
|
+
var // for wrapper
|
|
255
|
+
wrapperProps = props.wrapperProps, htmlFor = props.htmlFor, label = props.label, showRequired = props.showRequired, showOptional = props.showOptional, outerPrefix = props.outerPrefix, outerSuffix = props.outerSuffix, error = props.error, // for Select
|
|
256
|
+
providedValue = props.value, placeholder = props.placeholder, prefix = props.prefix, options = props.options, noOptionsText = props.noOptionsText, onChange = props.onChange, _props_isClearable = props.isClearable, isClearable = _props_isClearable === void 0 ? true : _props_isClearable, isDisabled = props.isDisabled, selectProps = _object_without_properties(props, [
|
|
257
|
+
"wrapperProps",
|
|
258
|
+
"htmlFor",
|
|
259
|
+
"label",
|
|
260
|
+
"showRequired",
|
|
261
|
+
"showOptional",
|
|
262
|
+
"outerPrefix",
|
|
263
|
+
"outerSuffix",
|
|
264
|
+
"error",
|
|
265
|
+
"value",
|
|
266
|
+
"placeholder",
|
|
267
|
+
"prefix",
|
|
268
|
+
"options",
|
|
269
|
+
"noOptionsText",
|
|
270
|
+
"onChange",
|
|
271
|
+
"isClearable",
|
|
272
|
+
"isDisabled"
|
|
273
|
+
]);
|
|
274
|
+
var _React_useState = _sliced_to_array(React.useState(false), 2), isFocused = _React_useState[0], setIsFocused = _React_useState[1];
|
|
275
|
+
var _React_useState1 = _sliced_to_array(React.useState(''), 2), search = _React_useState1[0], setSearch = _React_useState1[1];
|
|
276
|
+
var _React_useState2 = _sliced_to_array(React.useState(providedValue), 2), value = _React_useState2[0], setValue = _React_useState2[1];
|
|
277
|
+
var inputRef = React.useRef(null);
|
|
278
|
+
var _listRef = React.useRef(null);
|
|
279
|
+
var wrapperRef = React.useRef(null);
|
|
280
|
+
var _React_useState3 = _sliced_to_array(React.useState('bottom'), 2), position = _React_useState3[0], setPosition = _React_useState3[1];
|
|
281
|
+
var handleFocus = function() {
|
|
55
282
|
if (!isDisabled) {
|
|
56
283
|
setIsFocused(true);
|
|
57
284
|
}
|
|
58
285
|
};
|
|
59
|
-
|
|
286
|
+
var handleBlur = function(e) {
|
|
60
287
|
if (e.relatedTarget === null) {
|
|
288
|
+
var _inputRef_current;
|
|
61
289
|
setIsFocused(false);
|
|
62
|
-
inputRef.current
|
|
290
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
63
291
|
}
|
|
64
292
|
};
|
|
65
|
-
|
|
293
|
+
var handleChange = function(value) {
|
|
66
294
|
setSearch(value);
|
|
67
295
|
};
|
|
68
|
-
|
|
296
|
+
var handleSelect = function(option) {
|
|
297
|
+
var _inputRef_current;
|
|
69
298
|
setSearch(option.label);
|
|
70
|
-
onChange
|
|
299
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(option.value);
|
|
71
300
|
setValue(option.value);
|
|
72
301
|
setIsFocused(false);
|
|
73
|
-
inputRef.current
|
|
302
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
74
303
|
};
|
|
75
|
-
|
|
304
|
+
var handleToggle = function() {
|
|
76
305
|
if (!isDisabled) {
|
|
77
|
-
setIsFocused((isFocused)
|
|
78
|
-
|
|
306
|
+
setIsFocused(function(isFocused) {
|
|
307
|
+
var _inputRef_current;
|
|
308
|
+
isFocused && ((_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur());
|
|
79
309
|
return !isFocused;
|
|
80
310
|
});
|
|
81
311
|
}
|
|
82
312
|
};
|
|
83
|
-
|
|
313
|
+
var handleClear = function(event) {
|
|
84
314
|
if (!isDisabled) {
|
|
85
315
|
event.preventDefault();
|
|
86
316
|
event.stopPropagation();
|
|
87
317
|
setSearch('');
|
|
88
318
|
setIsFocused(false);
|
|
89
|
-
onChange
|
|
319
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
90
320
|
setValue(undefined);
|
|
91
321
|
}
|
|
92
322
|
};
|
|
93
|
-
|
|
94
|
-
if (wrapperRef.current &&
|
|
95
|
-
!wrapperRef.current.contains(event.target)) {
|
|
323
|
+
var handleClickOutside = function(event) {
|
|
324
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
96
325
|
setIsFocused(false);
|
|
97
326
|
}
|
|
98
327
|
};
|
|
99
328
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
100
|
-
React.useEffect(()
|
|
329
|
+
React.useEffect(function() {
|
|
101
330
|
document.addEventListener('mousedown', handleClickOutside);
|
|
102
|
-
return ()
|
|
331
|
+
return function() {
|
|
103
332
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
104
333
|
};
|
|
105
334
|
}, []);
|
|
106
|
-
React.useEffect(()
|
|
107
|
-
|
|
335
|
+
React.useEffect(function() {
|
|
336
|
+
var handlePosition = function() {
|
|
108
337
|
if (inputRef && 'current' in inputRef && inputRef.current) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
338
|
+
var rect = inputRef.current.getBoundingClientRect();
|
|
339
|
+
var spaceBelow = window.innerHeight - rect.bottom;
|
|
340
|
+
var spaceAbove = rect.top;
|
|
112
341
|
if (spaceAbove > spaceBelow) {
|
|
113
342
|
setPosition('top');
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
343
|
+
} else {
|
|
116
344
|
setPosition('bottom');
|
|
117
345
|
}
|
|
118
346
|
}
|
|
@@ -120,20 +348,81 @@ const InputSelect = React.forwardRef((props, _ref) => {
|
|
|
120
348
|
handlePosition();
|
|
121
349
|
window.addEventListener('resize', handlePosition);
|
|
122
350
|
window.addEventListener('scroll', handlePosition);
|
|
123
|
-
return ()
|
|
351
|
+
return function() {
|
|
124
352
|
window.removeEventListener('resize', handlePosition);
|
|
125
353
|
window.removeEventListener('scroll', handlePosition);
|
|
126
354
|
};
|
|
127
355
|
}, []);
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
356
|
+
return /*#__PURE__*/ _jsx(FieldWrapper, _object_spread_props(_object_spread({
|
|
357
|
+
htmlFor: htmlFor,
|
|
358
|
+
label: label,
|
|
359
|
+
showOptional: showOptional,
|
|
360
|
+
showRequired: showRequired,
|
|
361
|
+
outerPrefix: outerPrefix,
|
|
362
|
+
outerSuffix: outerSuffix,
|
|
363
|
+
error: error
|
|
364
|
+
}, wrapperProps), {
|
|
365
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
366
|
+
ref: wrapperRef,
|
|
367
|
+
className: "relative w-full",
|
|
368
|
+
children: /*#__PURE__*/ _jsxs(Command, {
|
|
369
|
+
shouldFilter: false,
|
|
370
|
+
onFocus: handleFocus,
|
|
371
|
+
onBlur: handleBlur,
|
|
372
|
+
children: [
|
|
373
|
+
/*#__PURE__*/ _jsx(CommandInput, _object_spread_props(_object_spread({}, selectProps), {
|
|
374
|
+
disabled: isDisabled,
|
|
375
|
+
ref: inputRef,
|
|
376
|
+
placeholder: placeholder,
|
|
377
|
+
value: isFocused ? search : ((_options_find = options.find(function(option) {
|
|
378
|
+
return option.value === value;
|
|
379
|
+
})) === null || _options_find === void 0 ? void 0 : _options_find.label) || '',
|
|
380
|
+
isFocused: isFocused,
|
|
381
|
+
isSelected: !!value,
|
|
382
|
+
prefix: prefix,
|
|
383
|
+
error: !!error,
|
|
384
|
+
onValueChange: handleChange,
|
|
385
|
+
handleToggle: handleToggle,
|
|
386
|
+
handleClear: handleClear
|
|
387
|
+
})),
|
|
388
|
+
/*#__PURE__*/ _jsx(CommandList, {
|
|
389
|
+
position: position,
|
|
390
|
+
children: isFocused && !isDisabled && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
391
|
+
children: [
|
|
392
|
+
options.length > 0 && search ? options.filter(function(option) {
|
|
393
|
+
return option.label.toLowerCase().includes(search.toLowerCase());
|
|
394
|
+
}).map(function(option) {
|
|
395
|
+
return /*#__PURE__*/ _jsx(CommandItem, {
|
|
396
|
+
value: JSON.stringify(option.value),
|
|
397
|
+
disabled: option.isDisabled,
|
|
398
|
+
onSelect: function() {
|
|
399
|
+
return handleSelect(option);
|
|
400
|
+
},
|
|
401
|
+
className: "tracking-normal text-primary3 w-full",
|
|
402
|
+
children: option.label
|
|
403
|
+
}, option.label);
|
|
404
|
+
}) : options.map(function(option) {
|
|
405
|
+
return /*#__PURE__*/ _jsx(CommandItem, {
|
|
406
|
+
value: JSON.stringify(option.value),
|
|
407
|
+
disabled: option.isDisabled,
|
|
408
|
+
onSelect: function() {
|
|
409
|
+
return handleSelect(option);
|
|
410
|
+
},
|
|
411
|
+
className: "tracking-normal text-primary3 w-full",
|
|
412
|
+
children: option.label
|
|
413
|
+
}, option.label);
|
|
414
|
+
}),
|
|
415
|
+
options.filter(function(option) {
|
|
416
|
+
return option.label.toLowerCase().includes(search.toLowerCase());
|
|
417
|
+
}).length === 0 && /*#__PURE__*/ _jsx(CommandEmpty, {
|
|
418
|
+
children: noOptionsText || 'No options'
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
]
|
|
424
|
+
})
|
|
425
|
+
})
|
|
426
|
+
}));
|
|
137
427
|
});
|
|
138
428
|
export default InputSelect;
|
|
139
|
-
//# sourceMappingURL=InputSelect.js.map
|
|
@@ -1,47 +1,120 @@
|
|
|
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_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
9
|
+
function _define_property(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
function _iterable_to_array(iter) {
|
|
23
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
24
|
+
}
|
|
25
|
+
function _non_iterable_spread() {
|
|
26
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27
|
+
}
|
|
28
|
+
function _object_spread(target) {
|
|
29
|
+
for(var i = 1; i < arguments.length; i++){
|
|
30
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
31
|
+
var ownKeys = Object.keys(source);
|
|
32
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
33
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
34
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
ownKeys.forEach(function(key) {
|
|
38
|
+
_define_property(target, key, source[key]);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
}
|
|
43
|
+
function _to_consumable_array(arr) {
|
|
44
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
45
|
+
}
|
|
46
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
47
|
+
if (!o) return;
|
|
48
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
49
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
50
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
51
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
52
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
53
|
+
}
|
|
1
54
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
55
|
import InputSelect from './InputSelect.js';
|
|
3
|
-
|
|
56
|
+
var meta = {
|
|
4
57
|
title: 'Input Select',
|
|
5
|
-
component: InputSelect
|
|
58
|
+
component: InputSelect
|
|
6
59
|
};
|
|
7
60
|
export default meta;
|
|
8
|
-
export
|
|
61
|
+
export var Demo = {
|
|
9
62
|
args: {
|
|
10
63
|
htmlFor: 'fruits',
|
|
11
64
|
label: 'fruits',
|
|
12
65
|
placeholder: 'Select Fruits',
|
|
13
66
|
options: [
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
67
|
+
{
|
|
68
|
+
label: 'Apple',
|
|
69
|
+
value: 'apple'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: 'Banana',
|
|
73
|
+
value: 'banana'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: 'Citrus',
|
|
77
|
+
value: 'citrus',
|
|
78
|
+
isDisabled: true
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
19
82
|
};
|
|
20
|
-
export
|
|
83
|
+
export var Long = {
|
|
21
84
|
args: {
|
|
22
85
|
htmlFor: 'year',
|
|
23
86
|
label: 'favourite year',
|
|
24
87
|
placeholder: 'Select Your Favourite Year',
|
|
25
|
-
options:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
88
|
+
options: _to_consumable_array(Array(20)).map(function(_, i) {
|
|
89
|
+
return {
|
|
90
|
+
label: "".concat(2000 + i),
|
|
91
|
+
value: 2000 + 1
|
|
92
|
+
};
|
|
93
|
+
})
|
|
94
|
+
}
|
|
30
95
|
};
|
|
31
|
-
export
|
|
96
|
+
export var Empty = {
|
|
32
97
|
args: {
|
|
33
98
|
htmlFor: 'fruits',
|
|
34
99
|
label: 'fruits',
|
|
35
100
|
placeholder: 'Select Fruits',
|
|
36
|
-
options: []
|
|
37
|
-
}
|
|
101
|
+
options: []
|
|
102
|
+
}
|
|
38
103
|
};
|
|
39
|
-
export
|
|
40
|
-
args: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
104
|
+
export var FluidPosition = {
|
|
105
|
+
args: _object_spread({}, Long.args),
|
|
106
|
+
render: function(args) {
|
|
107
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
108
|
+
className: "flex flex-col gap-4",
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ _jsx("div", {
|
|
111
|
+
className: "bg-primary1 h-[1000px]"
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsx(InputSelect, _object_spread({}, args)),
|
|
114
|
+
/*#__PURE__*/ _jsx("div", {
|
|
115
|
+
className: "bg-primary1 h-[1000px]"
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
46
120
|
};
|
|
47
|
-
//# sourceMappingURL=InputSelect.stories.js.map
|