@app-studio/web 0.8.81 → 0.8.82
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/components/Gradient/Gradient/Gradient.style.d.ts +16 -15
- package/dist/components/OTPInput/OTPInput/OTPInput.props.d.ts +3 -0
- package/dist/components/OTPInput/OTPInput/OTPInput.state.d.ts +2 -1
- package/dist/components/OTPInput/OTPInput/OTPInput.view.d.ts +1 -0
- package/dist/components/Sidebar/Sidebar/Sidebar.view.d.ts +1 -1
- package/dist/web.cjs.development.js +99 -108
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +99 -108
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +100 -110
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +1 -1
package/dist/web.esm.js
CHANGED
|
@@ -27,6 +27,7 @@ import 'core-js/modules/es.string.match.js';
|
|
|
27
27
|
import 'core-js/modules/es.string.search.js';
|
|
28
28
|
import 'core-js/modules/es.array.flat-map.js';
|
|
29
29
|
import 'core-js/modules/es.array.unscopables.flat-map.js';
|
|
30
|
+
import 'core-js/modules/es.string.trim.js';
|
|
30
31
|
|
|
31
32
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
32
33
|
if (null == r) return {};
|
|
@@ -3757,7 +3758,9 @@ var ButtonView = _ref => {
|
|
|
3757
3758
|
var hovering = isHovered && effect === 'hover';
|
|
3758
3759
|
var reverse = isHovered && effect === 'reverse';
|
|
3759
3760
|
// Determine if the button color is light or dark for proper contrast
|
|
3760
|
-
var
|
|
3761
|
+
var buttonMode = elementMode ? elementMode : themeMode;
|
|
3762
|
+
var reverseMode = reverse && buttonMode == 'light' ? 'dark' : "light"; // Slightly darker
|
|
3763
|
+
var isLight = contrast(getColor(buttonColor, buttonMode)) == 'light';
|
|
3761
3764
|
// Define button variants with effect support
|
|
3762
3765
|
var ButtonVariants = {
|
|
3763
3766
|
filled: {
|
|
@@ -3767,12 +3770,12 @@ var ButtonView = _ref => {
|
|
|
3767
3770
|
borderStyle: 'solid',
|
|
3768
3771
|
borderColor: reverse ? buttonColor : 'transparent',
|
|
3769
3772
|
_hover: {
|
|
3770
|
-
|
|
3771
|
-
transform: 'translateY(-
|
|
3773
|
+
themeMode: reverse && buttonMode == 'light' ? 'light' : "dark",
|
|
3774
|
+
transform: 'translateY(-1px)',
|
|
3772
3775
|
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)'
|
|
3773
3776
|
},
|
|
3774
3777
|
_active: {
|
|
3775
|
-
|
|
3778
|
+
themeMode: reverse && buttonMode == 'light' ? 'light' : "dark",
|
|
3776
3779
|
transform: 'translateY(0)',
|
|
3777
3780
|
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)'
|
|
3778
3781
|
}
|
|
@@ -3784,12 +3787,12 @@ var ButtonView = _ref => {
|
|
|
3784
3787
|
borderColor: reverse ? buttonColor : colorScheme,
|
|
3785
3788
|
color: reverse ? 'white' : buttonColor,
|
|
3786
3789
|
_hover: {
|
|
3787
|
-
|
|
3788
|
-
transform: 'translateY(-
|
|
3790
|
+
themeMode: reverse ? reverseMode : buttonMode,
|
|
3791
|
+
transform: 'translateY(-1px)',
|
|
3789
3792
|
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.05)'
|
|
3790
3793
|
},
|
|
3791
3794
|
_active: {
|
|
3792
|
-
|
|
3795
|
+
themeMode: reverse ? reverseMode : buttonMode,
|
|
3793
3796
|
transform: 'translateY(0)',
|
|
3794
3797
|
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.05)'
|
|
3795
3798
|
}
|
|
@@ -3817,11 +3820,11 @@ var ButtonView = _ref => {
|
|
|
3817
3820
|
borderStyle: 'none',
|
|
3818
3821
|
borderColor: 'transparent',
|
|
3819
3822
|
_hover: {
|
|
3820
|
-
|
|
3821
|
-
transform: 'translateY(-
|
|
3823
|
+
themeMode: reverse ? reverseMode : buttonMode,
|
|
3824
|
+
transform: 'translateY(-1px)'
|
|
3822
3825
|
},
|
|
3823
3826
|
_active: {
|
|
3824
|
-
|
|
3827
|
+
themeMode: reverse ? reverseMode : buttonMode,
|
|
3825
3828
|
transform: 'translateY(0)'
|
|
3826
3829
|
}
|
|
3827
3830
|
}
|
|
@@ -4432,7 +4435,7 @@ var _excluded$c = ["children", "isActive", "views"],
|
|
|
4432
4435
|
_excluded3$5 = ["views", "children"],
|
|
4433
4436
|
_excluded4$4 = ["children", "views"],
|
|
4434
4437
|
_excluded5$1 = ["children", "views", "style"],
|
|
4435
|
-
_excluded6$1 = ["children", "defaultActiveIndex", "activeIndex", "onChange", "showNavigation", "navigationPosition", "prevButton", "nextButton", "showIndicators", "indicatorPosition", "indicatorVariant", "autoPlay", "autoPlayInterval", "pauseOnHover", "infinite", "direction", "transitionDuration", "views", "themeMode"];
|
|
4438
|
+
_excluded6$1 = ["children", "defaultActiveIndex", "activeIndex", "onChange", "showNavigation", "navigationPosition", "prevButton", "nextButton", "showIndicators", "indicatorPosition", "indicatorVariant", "autoPlay", "autoPlayInterval", "pauseOnHover", "infinite", "direction", "transitionDuration", "views", "stepIndices", "themeMode"];
|
|
4436
4439
|
var CarouselSlide = _ref => {
|
|
4437
4440
|
var {
|
|
4438
4441
|
children,
|
|
@@ -6325,17 +6328,6 @@ var InputVariants = {
|
|
|
6325
6328
|
_focus: {
|
|
6326
6329
|
borderColor: 'theme.primary',
|
|
6327
6330
|
boxShadow: '0 0 0 1px rgba(66, 153, 225, 0.2)'
|
|
6328
|
-
},
|
|
6329
|
-
'@media (prefers-color-scheme: dark)': {
|
|
6330
|
-
backgroundColor: 'color.gray.800',
|
|
6331
|
-
borderColor: 'color.gray.700',
|
|
6332
|
-
_hover: {
|
|
6333
|
-
borderColor: 'color.gray.600'
|
|
6334
|
-
},
|
|
6335
|
-
_focus: {
|
|
6336
|
-
borderColor: 'theme.primary',
|
|
6337
|
-
boxShadow: '0 0 0 1px rgba(66, 153, 225, 0.4)'
|
|
6338
|
-
}
|
|
6339
6331
|
}
|
|
6340
6332
|
},
|
|
6341
6333
|
default: {
|
|
@@ -6351,16 +6343,6 @@ var InputVariants = {
|
|
|
6351
6343
|
},
|
|
6352
6344
|
_focus: {
|
|
6353
6345
|
borderBottomColor: 'theme.primary'
|
|
6354
|
-
},
|
|
6355
|
-
'@media (prefers-color-scheme: dark)': {
|
|
6356
|
-
backgroundColor: 'color.gray.800',
|
|
6357
|
-
borderBottomColor: 'color.gray.700',
|
|
6358
|
-
_hover: {
|
|
6359
|
-
borderBottomColor: 'color.gray.600'
|
|
6360
|
-
},
|
|
6361
|
-
_focus: {
|
|
6362
|
-
borderBottomColor: 'theme.primary'
|
|
6363
|
-
}
|
|
6364
6346
|
}
|
|
6365
6347
|
},
|
|
6366
6348
|
none: {
|
|
@@ -6492,7 +6474,7 @@ var HeadingSizes$1 = {
|
|
|
6492
6474
|
}
|
|
6493
6475
|
};
|
|
6494
6476
|
|
|
6495
|
-
var _excluded$l = ["children", "heading", "isItalic", "isUnderlined", "isStriked", "weight", "size"];
|
|
6477
|
+
var _excluded$l = ["children", "heading", "isItalic", "isUnderlined", "isStriked", "weight", "size", "dropDown"];
|
|
6496
6478
|
var LabelView = _ref => {
|
|
6497
6479
|
var {
|
|
6498
6480
|
children,
|
|
@@ -6702,11 +6684,7 @@ var SelectBox = _ref2 => {
|
|
|
6702
6684
|
// State properties
|
|
6703
6685
|
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
6704
6686
|
// Animation
|
|
6705
|
-
transition: 'all 0.2s ease'
|
|
6706
|
-
// Dark mode support
|
|
6707
|
-
'@media (prefers-color-scheme: dark)': {
|
|
6708
|
-
color: isDisabled ? 'color.gray.600' : 'color.gray.100'
|
|
6709
|
-
}
|
|
6687
|
+
transition: 'all 0.2s ease'
|
|
6710
6688
|
}, views['field'], views['text']);
|
|
6711
6689
|
var option = options.length > 0 && options.find(option => option.value === value);
|
|
6712
6690
|
return /*#__PURE__*/React.createElement(Text, Object.assign({}, fieldStyles), (value === '' || Array.isArray(value) && value.length === 0) && !!placeholder ? placeholder : (/*#__PURE__*/React.createElement(React.Fragment, null, typeof value === 'string' ? (_ref3 = option && option.label) != null ? _ref3 : value :
|
|
@@ -6765,9 +6743,7 @@ var HiddenSelect = _ref4 => {
|
|
|
6765
6743
|
var DropDown = _ref5 => {
|
|
6766
6744
|
var {
|
|
6767
6745
|
size,
|
|
6768
|
-
views = {
|
|
6769
|
-
dropDown: {}
|
|
6770
|
-
},
|
|
6746
|
+
views = {},
|
|
6771
6747
|
options,
|
|
6772
6748
|
callback = () => {},
|
|
6773
6749
|
highlightedIndex,
|
|
@@ -6817,7 +6793,7 @@ var DropDown = _ref5 => {
|
|
|
6817
6793
|
borderRadius: '4px'
|
|
6818
6794
|
}
|
|
6819
6795
|
}
|
|
6820
|
-
}, shadow, views
|
|
6796
|
+
}, shadow, views == null ? void 0 : views.dropDown), options.length > 0 && options.map((option, index) => (/*#__PURE__*/React.createElement(Item, Object.assign({
|
|
6821
6797
|
key: option.value,
|
|
6822
6798
|
size: size,
|
|
6823
6799
|
style: views['text'],
|
|
@@ -7127,7 +7103,7 @@ var ColorSchemes = {
|
|
|
7127
7103
|
}
|
|
7128
7104
|
};
|
|
7129
7105
|
|
|
7130
|
-
var _excluded$p = ["id", "name", "label", "inActiveChild", "activeChild", "labelPosition", "shadow", "size", "value", "isHovered", "isDisabled", "isReadOnly", "on", "setOn", "onChange", "setValue", "setIsHovered", "helperText", "views"];
|
|
7106
|
+
var _excluded$p = ["id", "name", "label", "inActiveChild", "isChecked", "activeChild", "labelPosition", "shadow", "size", "value", "isHovered", "isDisabled", "isReadOnly", "on", "setOn", "onChange", "setValue", "setIsHovered", "helperText", "views"];
|
|
7131
7107
|
var SwitchContent = props => /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
7132
7108
|
type: "checkbox"
|
|
7133
7109
|
}, props));
|
|
@@ -7534,11 +7510,7 @@ var TextFieldView = _ref => {
|
|
|
7534
7510
|
// State properties
|
|
7535
7511
|
cursor: isDisabled ? 'not-allowed' : 'text',
|
|
7536
7512
|
// Animation
|
|
7537
|
-
transition: 'all 0.2s ease'
|
|
7538
|
-
// Dark mode support
|
|
7539
|
-
'@media (prefers-color-scheme: dark)': {
|
|
7540
|
-
color: isDisabled ? 'color.gray.600' : 'color.gray.100'
|
|
7541
|
-
}
|
|
7513
|
+
transition: 'all 0.2s ease'
|
|
7542
7514
|
}, views['field']);
|
|
7543
7515
|
var handleFocus = () => {
|
|
7544
7516
|
setIsFocused(true);
|
|
@@ -9519,8 +9491,8 @@ var CountryPickerView = _ref5 => {
|
|
|
9519
9491
|
var showLabel = !!(label && (isFocused || value));
|
|
9520
9492
|
var fieldStyles = Object.assign({
|
|
9521
9493
|
margin: 0,
|
|
9522
|
-
|
|
9523
|
-
|
|
9494
|
+
paddingVertical: 8,
|
|
9495
|
+
paddingHorizontal: 0,
|
|
9524
9496
|
width: '100%',
|
|
9525
9497
|
heigth: '100%',
|
|
9526
9498
|
border: 'none',
|
|
@@ -9984,6 +9956,12 @@ var useOTPInputState = _ref => {
|
|
|
9984
9956
|
onChange,
|
|
9985
9957
|
onChangeText,
|
|
9986
9958
|
onComplete,
|
|
9959
|
+
onKeyDown,
|
|
9960
|
+
onKeyPress,
|
|
9961
|
+
onBlur,
|
|
9962
|
+
onFocus,
|
|
9963
|
+
isReadOnly,
|
|
9964
|
+
isDisabled,
|
|
9987
9965
|
pattern,
|
|
9988
9966
|
stepValues,
|
|
9989
9967
|
pasteTransformer
|
|
@@ -10097,6 +10075,16 @@ var useOTPInputState = _ref => {
|
|
|
10097
10075
|
var handleKeyDown = useCallback(_ => {
|
|
10098
10076
|
// Handle special keys like backspace, arrows, etc.
|
|
10099
10077
|
// This is handled by the browser for the single input
|
|
10078
|
+
if (onKeyDown) {
|
|
10079
|
+
onKeyDown(_);
|
|
10080
|
+
}
|
|
10081
|
+
}, []);
|
|
10082
|
+
var handleKeyPress = useCallback(e => {
|
|
10083
|
+
// Handle key press events
|
|
10084
|
+
// This is handled by the browser for the single input
|
|
10085
|
+
if (onKeyPress) {
|
|
10086
|
+
onKeyPress(e);
|
|
10087
|
+
}
|
|
10100
10088
|
}, []);
|
|
10101
10089
|
var handlePaste = useCallback(e => {
|
|
10102
10090
|
var input = inputRef.current;
|
|
@@ -10253,11 +10241,12 @@ var useOTPInputState = _ref => {
|
|
|
10253
10241
|
handleFocus,
|
|
10254
10242
|
handleBlur,
|
|
10255
10243
|
handleKeyDown,
|
|
10244
|
+
handleKeyPress,
|
|
10256
10245
|
handlePaste
|
|
10257
10246
|
};
|
|
10258
10247
|
};
|
|
10259
10248
|
|
|
10260
|
-
var _excluded$y = ["id", "name", "label", "value", "length", "onChange", "onChangeText", "onComplete", "helperText", "placeholder", "shadow", "views", "size", "shape", "variant", "gap", "type", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isAutoFocus", "setValue", "setIsFocused", "setIsHovered", "inputRef", "containerRef", "mirrorSelectionStart", "mirrorSelectionEnd", "setMirrorSelectionStart", "setMirrorSelectionEnd", "handlePaste", "handleChange", "handleFocus", "handleBlur", "handleKeyDown", "stepValues", "setInputRef", "onBlur", "onClick", "onFocus"];
|
|
10249
|
+
var _excluded$y = ["id", "name", "label", "value", "length", "onChange", "onChangeText", "onComplete", "helperText", "placeholder", "shadow", "views", "size", "shape", "variant", "gap", "type", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isAutoFocus", "setValue", "setIsFocused", "setIsHovered", "inputRef", "containerRef", "mirrorSelectionStart", "mirrorSelectionEnd", "setMirrorSelectionStart", "setMirrorSelectionEnd", "handlePaste", "handleChange", "handleFocus", "handleBlur", "handleKeyDown", "handleKeyPress", "secureTextEntry", "isFirstColumn", "stepValues", "setInputRef", "onBlur", "onClick", "onFocus"];
|
|
10261
10250
|
// Create a context for OTP input slots
|
|
10262
10251
|
var OTPInputContext = /*#__PURE__*/createContext({
|
|
10263
10252
|
slots: [],
|
|
@@ -10265,7 +10254,7 @@ var OTPInputContext = /*#__PURE__*/createContext({
|
|
|
10265
10254
|
isHovering: false
|
|
10266
10255
|
});
|
|
10267
10256
|
// CSS for noscript fallback
|
|
10268
|
-
var NOSCRIPT_CSS_FALLBACK = "\n@keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n}\n\n[data-input-otp] {\n --nojs-bg: white !important;\n --nojs-fg: black !important;\n\n background-color: var(--nojs-bg) !important;\n color: var(--nojs-fg) !important;\n caret-color: var(--nojs-fg) !important;\n letter-spacing: .25em !important;\n text-align: center !important;\n border: 1px solid var(--nojs-fg) !important;\n border-radius: 4px !important;\n width: 100% !important;\n}\n
|
|
10257
|
+
var NOSCRIPT_CSS_FALLBACK = "\n@keyframes blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n}\n\n[data-input-otp] {\n --nojs-bg: white !important;\n --nojs-fg: black !important;\n\n background-color: var(--nojs-bg) !important;\n color: var(--nojs-fg) !important;\n caret-color: var(--nojs-fg) !important;\n letter-spacing: .25em !important;\n text-align: center !important;\n border: 1px solid var(--nojs-fg) !important;\n border-radius: 4px !important;\n width: 100% !important;\n}\n";
|
|
10269
10258
|
// Helper function to safely insert CSS rules
|
|
10270
10259
|
function safeInsertRule(sheet, rule) {
|
|
10271
10260
|
try {
|
|
@@ -10513,7 +10502,8 @@ var OTPInputComponent = props => {
|
|
|
10513
10502
|
handleFocus,
|
|
10514
10503
|
handleBlur,
|
|
10515
10504
|
handleKeyDown,
|
|
10516
|
-
handlePaste
|
|
10505
|
+
handlePaste,
|
|
10506
|
+
handleKeyPress
|
|
10517
10507
|
} = useOTPInputState(props);
|
|
10518
10508
|
// Use the controlled value if it exists, otherwise use the internal state value
|
|
10519
10509
|
var displayValue = controlledValue !== undefined ? controlledValue : value;
|
|
@@ -10535,6 +10525,7 @@ var OTPInputComponent = props => {
|
|
|
10535
10525
|
handleFocus: handleFocus,
|
|
10536
10526
|
handleBlur: handleBlur,
|
|
10537
10527
|
handleKeyDown: handleKeyDown,
|
|
10528
|
+
handleKeyPress: handleKeyPress,
|
|
10538
10529
|
handlePaste: handlePaste,
|
|
10539
10530
|
stepValues: props.stepValues
|
|
10540
10531
|
}));
|
|
@@ -11952,12 +11943,12 @@ var UploadView = _ref => {
|
|
|
11952
11943
|
} = _ref;
|
|
11953
11944
|
var finalPreviewUrl = externalPreviewUrl || previewUrl;
|
|
11954
11945
|
// Debug log to help troubleshoot
|
|
11955
|
-
console.log('Uploader state:', {
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
});
|
|
11946
|
+
// console.log('Uploader state:', {
|
|
11947
|
+
// fileType,
|
|
11948
|
+
// finalPreviewUrl,
|
|
11949
|
+
// selectedFile: selectedFile?.name,
|
|
11950
|
+
// progress,
|
|
11951
|
+
// });
|
|
11961
11952
|
return /*#__PURE__*/React.createElement(Center, Object.assign({
|
|
11962
11953
|
onClick: handleClick,
|
|
11963
11954
|
cursor: "pointer",
|
|
@@ -12208,7 +12199,7 @@ var ModalTypography = {
|
|
|
12208
12199
|
};
|
|
12209
12200
|
|
|
12210
12201
|
var _excluded$H = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position", "views"],
|
|
12211
|
-
_excluded2$c = ["children", "shadow", "isFullScreen", "shape", "views"],
|
|
12202
|
+
_excluded2$c = ["children", "shadow", "isFullScreen", "shape", "views", "isOpen"],
|
|
12212
12203
|
_excluded3$9 = ["children", "buttonColor", "iconSize", "buttonPosition", "views"],
|
|
12213
12204
|
_excluded4$7 = ["children", "views"],
|
|
12214
12205
|
_excluded5$3 = ["children", "views"];
|
|
@@ -13094,7 +13085,9 @@ var useTabsState = (propTabs, initialTabValue) => {
|
|
|
13094
13085
|
return foundTab;
|
|
13095
13086
|
}
|
|
13096
13087
|
// Warn if initialTabValue is provided but not found
|
|
13097
|
-
console.warn(
|
|
13088
|
+
// console.warn(
|
|
13089
|
+
// `Tabs: initialTabValue "${initialTabValue}" not found in tabs. Defaulting to the first tab.`
|
|
13090
|
+
// );
|
|
13098
13091
|
}
|
|
13099
13092
|
return propTabs[0]; // Default to the first tab
|
|
13100
13093
|
};
|
|
@@ -16002,7 +15995,7 @@ var HandleIconStyles = {
|
|
|
16002
15995
|
|
|
16003
15996
|
var _excluded$X = ["children", "id", "defaultSize", "minSize", "maxSize", "collapsible", "defaultCollapsed", "onCollapseChange", "views"],
|
|
16004
15997
|
_excluded2$g = ["id", "position", "disabled", "withVisualIndicator", "withCollapseButton", "collapseTarget", "views"],
|
|
16005
|
-
_excluded3$c = ["children", "orientation", "size", "variant", "defaultSizes", "minSize", "maxSize", "collapsible", "containerRef", "views"];
|
|
15998
|
+
_excluded3$c = ["children", "orientation", "size", "variant", "defaultSizes", "minSize", "maxSize", "collapsible", "containerRef", "autoSaveId", "views"];
|
|
16006
15999
|
// Create context for the Resizable component
|
|
16007
16000
|
var ResizableContext = /*#__PURE__*/createContext({
|
|
16008
16001
|
orientation: 'horizontal',
|
|
@@ -16798,6 +16791,16 @@ var Toast = /*#__PURE__*/Object.assign(ToastComponent, {
|
|
|
16798
16791
|
// Export the hook for component usage
|
|
16799
16792
|
var useToast$1 = useToast;
|
|
16800
16793
|
|
|
16794
|
+
// Default filter function defined outside the hook to avoid recreating it on each render
|
|
16795
|
+
var defaultFilterFn = (value, item) => {
|
|
16796
|
+
var _item$description, _item$keywords;
|
|
16797
|
+
if (!value) return true;
|
|
16798
|
+
var searchValue = value.toLowerCase();
|
|
16799
|
+
var matchesName = item.name.toLowerCase().includes(searchValue);
|
|
16800
|
+
var matchesDescription = ((_item$description = item.description) == null ? void 0 : _item$description.toLowerCase().includes(searchValue)) || false;
|
|
16801
|
+
var matchesKeywords = ((_item$keywords = item.keywords) == null ? void 0 : _item$keywords.some(keyword => keyword.toLowerCase().includes(searchValue))) || false;
|
|
16802
|
+
return matchesName || matchesDescription || matchesKeywords;
|
|
16803
|
+
};
|
|
16801
16804
|
var useCommandState = _ref => {
|
|
16802
16805
|
var {
|
|
16803
16806
|
open,
|
|
@@ -16806,46 +16809,36 @@ var useCommandState = _ref => {
|
|
|
16806
16809
|
commands = [],
|
|
16807
16810
|
filter
|
|
16808
16811
|
} = _ref;
|
|
16809
|
-
// Combine commands from groups and flat list
|
|
16810
|
-
var allCommands = useCallback(() => {
|
|
16811
|
-
var groupCommands = groups.flatMap(group => group.commands);
|
|
16812
|
-
return [...groupCommands, ...commands];
|
|
16813
|
-
}, [groups, commands]);
|
|
16814
16812
|
// State for search input
|
|
16815
16813
|
var [search, setSearch] = useState('');
|
|
16816
16814
|
// State for selected item index
|
|
16817
16815
|
var [selectedIndex, setSelectedIndex] = useState(0);
|
|
16818
16816
|
// Ref for the command list element
|
|
16819
16817
|
var listRef = useRef(null);
|
|
16820
|
-
//
|
|
16821
|
-
var
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
var
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
}, [allCommands, filter, defaultFilter]);
|
|
16835
|
-
// Filtered commands based on search
|
|
16836
|
-
var [filteredCommands, setFilteredCommands] = useState(allCommands());
|
|
16837
|
-
// Filtered groups based on search
|
|
16838
|
-
var filteredGroups = useCallback(() => {
|
|
16818
|
+
// Use the provided filter or fall back to the default
|
|
16819
|
+
var filterFn = useMemo(() => filter || defaultFilterFn, [filter]);
|
|
16820
|
+
// Combine and memoize all commands from groups and flat list
|
|
16821
|
+
var allCommands = useMemo(() => {
|
|
16822
|
+
var groupCommands = groups.flatMap(group => group.commands);
|
|
16823
|
+
return [...groupCommands, ...commands];
|
|
16824
|
+
}, [groups, commands]);
|
|
16825
|
+
// Filter and memoize commands based on search
|
|
16826
|
+
var filteredCommands = useMemo(() => {
|
|
16827
|
+
if (!search.trim()) return allCommands;
|
|
16828
|
+
return allCommands.filter(item => filterFn(search, item));
|
|
16829
|
+
}, [allCommands, search, filterFn]);
|
|
16830
|
+
// Filter and memoize groups based on search
|
|
16831
|
+
var filteredGroups = useMemo(() => {
|
|
16839
16832
|
if (!search) return groups;
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
|
|
16843
|
-
|
|
16844
|
-
|
|
16833
|
+
var filterFn = filter || defaultFilterFn;
|
|
16834
|
+
return groups.map(g => Object.assign({}, g, {
|
|
16835
|
+
commands: g.commands.filter(c => filterFn(search, c))
|
|
16836
|
+
})).filter(g => g.commands.length);
|
|
16837
|
+
}, [groups, search, filter]);
|
|
16838
|
+
// Reset selected index when filtered commands change
|
|
16845
16839
|
useEffect(() => {
|
|
16846
|
-
setFilteredCommands(filterCommands(search));
|
|
16847
16840
|
setSelectedIndex(0);
|
|
16848
|
-
}, [
|
|
16841
|
+
}, [filteredCommands.length]);
|
|
16849
16842
|
// Handle keyboard navigation
|
|
16850
16843
|
var handleKeyDown = useCallback(e => {
|
|
16851
16844
|
if (!open) return;
|
|
@@ -16895,6 +16888,9 @@ var useCommandState = _ref => {
|
|
|
16895
16888
|
useEffect(() => {
|
|
16896
16889
|
if (open) {
|
|
16897
16890
|
setSelectedIndex(0);
|
|
16891
|
+
} else {
|
|
16892
|
+
// Clear search when closed
|
|
16893
|
+
setSearch('');
|
|
16898
16894
|
}
|
|
16899
16895
|
}, [open]);
|
|
16900
16896
|
return {
|
|
@@ -16903,7 +16899,7 @@ var useCommandState = _ref => {
|
|
|
16903
16899
|
selectedIndex,
|
|
16904
16900
|
setSelectedIndex,
|
|
16905
16901
|
filteredCommands,
|
|
16906
|
-
filteredGroups
|
|
16902
|
+
filteredGroups,
|
|
16907
16903
|
listRef
|
|
16908
16904
|
};
|
|
16909
16905
|
};
|
|
@@ -17172,26 +17168,21 @@ var CommandView = _ref7 => {
|
|
|
17172
17168
|
} = _ref7,
|
|
17173
17169
|
props = _objectWithoutPropertiesLoose(_ref7, _excluded6$3);
|
|
17174
17170
|
if (!open) return null;
|
|
17175
|
-
var handleItemSelect = item => {
|
|
17176
|
-
if (
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
var
|
|
17183
|
-
if (e.target === e.currentTarget) {
|
|
17184
|
-
onOpenChange(false);
|
|
17185
|
-
}
|
|
17186
|
-
};
|
|
17187
|
-
var contextValue = {
|
|
17171
|
+
var handleItemSelect = React.useCallback(item => {
|
|
17172
|
+
if (item.disabled) return;
|
|
17173
|
+
item.onSelect();
|
|
17174
|
+
onOpenChange(false);
|
|
17175
|
+
setSearch('');
|
|
17176
|
+
}, [onOpenChange, setSearch]);
|
|
17177
|
+
var handleBackdropClick = React.useCallback(e => e.target === e.currentTarget && onOpenChange(false), [onOpenChange]);
|
|
17178
|
+
var contextValue = React.useMemo(() => ({
|
|
17188
17179
|
search,
|
|
17189
17180
|
setSearch,
|
|
17190
17181
|
selectedIndex,
|
|
17191
17182
|
setSelectedIndex,
|
|
17192
17183
|
filteredCommands,
|
|
17193
17184
|
onSelect: handleItemSelect
|
|
17194
|
-
};
|
|
17185
|
+
}), [search, selectedIndex, filteredCommands, handleItemSelect, setSearch, setSelectedIndex]);
|
|
17195
17186
|
var hasGroups = groups.length > 0;
|
|
17196
17187
|
// const hasCommands = commands.length > 0;
|
|
17197
17188
|
var isEmpty = filteredCommands.length === 0;
|