@app-studio/web 0.8.16 → 0.8.17
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/index.d.ts +1 -0
- package/dist/web.cjs.development.js +284 -251
- 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 +284 -252
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +284 -251
- 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
|
@@ -4843,7 +4843,270 @@ var PasswordComponent = _ref => {
|
|
|
4843
4843
|
*/
|
|
4844
4844
|
var Password = PasswordComponent;
|
|
4845
4845
|
|
|
4846
|
-
|
|
4846
|
+
// Defines the useComboBoxState hook with parameters for the list of items and optional placeholder texts.
|
|
4847
|
+
var useComboBoxState = (items, placeholder, searchPlaceholder) => {
|
|
4848
|
+
// State hook for filtered items with initial state set to the items passed to the hook.
|
|
4849
|
+
var [filteredItems, setFilteredItems] = useState(items);
|
|
4850
|
+
// State hook to track the selected item with an initial state based on the placeholder or the first item.
|
|
4851
|
+
var [selectedItem, setSelectedItem] = useState(placeholder ? {
|
|
4852
|
+
value: placeholder,
|
|
4853
|
+
label: placeholder
|
|
4854
|
+
} : items[0]);
|
|
4855
|
+
// State hook for highlighted index in the dropdown list, initialized to 0.
|
|
4856
|
+
var [highlightedIndex, setHighlightedIndex] = useState(0);
|
|
4857
|
+
// State hook for search query with an initial state based on the searchPlaceholder or empty string.
|
|
4858
|
+
var [searchQuery, setSearchQuery] = useState(searchPlaceholder != null ? searchPlaceholder : '');
|
|
4859
|
+
// State hook to manage dropdown visibility, starts as false (hidden).
|
|
4860
|
+
var [isDropdownVisible, setIsDropdownVisible] = useState(false);
|
|
4861
|
+
// Start of object returned by the useComboBoxState hook containing all state and state updater functions.
|
|
4862
|
+
return {
|
|
4863
|
+
filteredItems,
|
|
4864
|
+
setFilteredItems,
|
|
4865
|
+
selectedItem,
|
|
4866
|
+
setSelectedItem,
|
|
4867
|
+
highlightedIndex,
|
|
4868
|
+
setHighlightedIndex,
|
|
4869
|
+
searchQuery,
|
|
4870
|
+
setSearchQuery,
|
|
4871
|
+
isDropdownVisible,
|
|
4872
|
+
setIsDropdownVisible
|
|
4873
|
+
};
|
|
4874
|
+
};
|
|
4875
|
+
|
|
4876
|
+
var _excluded$z = ["size", "color"];
|
|
4877
|
+
var TickSvg = _ref => {
|
|
4878
|
+
var {
|
|
4879
|
+
size = 16,
|
|
4880
|
+
color = '#c0c0c0'
|
|
4881
|
+
} = _ref,
|
|
4882
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$z);
|
|
4883
|
+
return /*#__PURE__*/React.createElement(Center, {
|
|
4884
|
+
width: size + "px",
|
|
4885
|
+
height: size + "px"
|
|
4886
|
+
}, /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
4887
|
+
width: size + "px",
|
|
4888
|
+
height: size + "px",
|
|
4889
|
+
viewBox: "0 -0.5 25 25",
|
|
4890
|
+
fill: "none",
|
|
4891
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4892
|
+
}, props), /*#__PURE__*/React.createElement("g", {
|
|
4893
|
+
id: "SVGRepo_bgCarrier",
|
|
4894
|
+
strokeWidth: "0"
|
|
4895
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
4896
|
+
id: "SVGRepo_tracerCarrier",
|
|
4897
|
+
strokeLinecap: "round",
|
|
4898
|
+
strokeLinejoin: "round"
|
|
4899
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
4900
|
+
id: "SVGRepo_iconCarrier"
|
|
4901
|
+
}, ' ', /*#__PURE__*/React.createElement("path", {
|
|
4902
|
+
d: "M5.5 12.5L10.167 17L19.5 8",
|
|
4903
|
+
stroke: "#444444",
|
|
4904
|
+
strokeWidth: "1.5",
|
|
4905
|
+
strokeLinecap: "round",
|
|
4906
|
+
strokeLinejoin: "round"
|
|
4907
|
+
}), ' ')));
|
|
4908
|
+
};
|
|
4909
|
+
|
|
4910
|
+
var _excluded$A = ["size", "color"];
|
|
4911
|
+
var SearchLoopSvg = _ref => {
|
|
4912
|
+
var {
|
|
4913
|
+
size = 14,
|
|
4914
|
+
color = '#c0c0c0'
|
|
4915
|
+
} = _ref,
|
|
4916
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$A);
|
|
4917
|
+
return /*#__PURE__*/React.createElement(Center, {
|
|
4918
|
+
width: size + "px",
|
|
4919
|
+
height: size + "px"
|
|
4920
|
+
}, /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
4921
|
+
fill: "#c0c0c0",
|
|
4922
|
+
width: size + "px",
|
|
4923
|
+
height: size + "px",
|
|
4924
|
+
version: "1.1",
|
|
4925
|
+
id: "Capa_1",
|
|
4926
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4927
|
+
viewBox: "0 0 488.4 488.4",
|
|
4928
|
+
stroke: color
|
|
4929
|
+
}, props), /*#__PURE__*/React.createElement("g", {
|
|
4930
|
+
id: "SVGRepo_bgCarrier",
|
|
4931
|
+
strokeWidth: "9.279599999999999"
|
|
4932
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
4933
|
+
id: "SVGRepo_tracerCarrier",
|
|
4934
|
+
strokeLinecap: "round",
|
|
4935
|
+
strokeLinejoin: "round"
|
|
4936
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
4937
|
+
id: "SVGRepo_iconCarrier"
|
|
4938
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
4939
|
+
d: "M0,203.25c0,112.1,91.2,203.2,203.2,203.2c51.6,0,98.8-19.4,134.7-51.2l129.5,129.5c2.4,2.4,5.5,3.6,8.7,3.6 s6.3-1.2,8.7-3.6c4.8-4.8,4.8-12.5,0-17.3l-129.6-129.5c31.8-35.9,51.2-83,51.2-134.7c0-112.1-91.2-203.2-203.2-203.2 S0,91.15,0,203.25z M381.9,203.25c0,98.5-80.2,178.7-178.7,178.7s-178.7-80.2-178.7-178.7s80.2-178.7,178.7-178.7 S381.9,104.65,381.9,203.25z"
|
|
4940
|
+
}), ' ')))));
|
|
4941
|
+
};
|
|
4942
|
+
|
|
4943
|
+
var _excluded$B = ["placeholder", "items", "showTick", "onSelect", "searchEnabled", "left", "right", "label", "filteredItems", "setSelectedItem", "selectedItem", "highlightedIndex", "setHighlightedIndex", "searchQuery", "setSearchQuery", "setFilteredItems", "styles", "isDropdownVisible", "setIsDropdownVisible"];
|
|
4944
|
+
// Defines the functional component 'ComboBoxView' with destructured props.
|
|
4945
|
+
var ComboBoxView = _ref => {
|
|
4946
|
+
var {
|
|
4947
|
+
placeholder,
|
|
4948
|
+
items,
|
|
4949
|
+
showTick = true,
|
|
4950
|
+
onSelect,
|
|
4951
|
+
searchEnabled = true,
|
|
4952
|
+
left,
|
|
4953
|
+
right,
|
|
4954
|
+
label,
|
|
4955
|
+
filteredItems,
|
|
4956
|
+
setSelectedItem,
|
|
4957
|
+
selectedItem,
|
|
4958
|
+
highlightedIndex,
|
|
4959
|
+
setHighlightedIndex,
|
|
4960
|
+
searchQuery,
|
|
4961
|
+
setSearchQuery,
|
|
4962
|
+
setFilteredItems,
|
|
4963
|
+
styles,
|
|
4964
|
+
isDropdownVisible,
|
|
4965
|
+
setIsDropdownVisible
|
|
4966
|
+
// Collects all further props not destructured explicitly.
|
|
4967
|
+
} = _ref,
|
|
4968
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$B);
|
|
4969
|
+
// Sets up an effect to handle clicking outside the dropdown to close it.
|
|
4970
|
+
useEffect(() => {
|
|
4971
|
+
var handleClickOutside = event => {
|
|
4972
|
+
var path = event.composedPath();
|
|
4973
|
+
var isOutside = !path.some(element => (element == null ? void 0 : element.id) === 'combobox-dropdown');
|
|
4974
|
+
if (isOutside) {
|
|
4975
|
+
setIsDropdownVisible(false);
|
|
4976
|
+
}
|
|
4977
|
+
};
|
|
4978
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
4979
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
4980
|
+
}, []);
|
|
4981
|
+
// Defines 'handleSearch' to filter items based on the user's query.
|
|
4982
|
+
var handleSearch = query => {
|
|
4983
|
+
setSearchQuery(query);
|
|
4984
|
+
if (query === '') {
|
|
4985
|
+
setFilteredItems(items);
|
|
4986
|
+
} else {
|
|
4987
|
+
var filtered = items.filter(item => item.label.toLowerCase().includes(query.toLowerCase()));
|
|
4988
|
+
setFilteredItems(filtered);
|
|
4989
|
+
}
|
|
4990
|
+
setHighlightedIndex(0);
|
|
4991
|
+
};
|
|
4992
|
+
// Defines 'handleSelect' to handle item selection and close the dropdown.
|
|
4993
|
+
var handleSelect = item => {
|
|
4994
|
+
setSelectedItem(item);
|
|
4995
|
+
onSelect == null || onSelect(item);
|
|
4996
|
+
setIsDropdownVisible(false);
|
|
4997
|
+
};
|
|
4998
|
+
// Starts the JSX returned by the component representing the combobox.
|
|
4999
|
+
return /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5000
|
+
role: "combobox",
|
|
5001
|
+
flexWrap: "nowrap",
|
|
5002
|
+
gap: 15,
|
|
5003
|
+
alignItems: "center",
|
|
5004
|
+
width: "100%"
|
|
5005
|
+
}, props), label && (/*#__PURE__*/React.createElement(Text, {
|
|
5006
|
+
styles: styles == null ? void 0 : styles.label,
|
|
5007
|
+
htmlFor: props.id
|
|
5008
|
+
}, label)), /*#__PURE__*/React.createElement(View, {
|
|
5009
|
+
position: "relative"
|
|
5010
|
+
}, /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5011
|
+
cursor: "pointer",
|
|
5012
|
+
backgroundColor: "white",
|
|
5013
|
+
boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
|
|
5014
|
+
padding: "12px",
|
|
5015
|
+
display: "flex",
|
|
5016
|
+
alignItems: "center",
|
|
5017
|
+
borderRadius: "4px",
|
|
5018
|
+
justifyContent: "space-between",
|
|
5019
|
+
minWidth: 300,
|
|
5020
|
+
flexWrap: "nowrap"
|
|
5021
|
+
}, styles == null ? void 0 : styles.container), /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5022
|
+
gap: 15,
|
|
5023
|
+
alignItems: "center",
|
|
5024
|
+
position: "relative",
|
|
5025
|
+
width: "100%",
|
|
5026
|
+
onClick: () => setIsDropdownVisible(!isDropdownVisible)
|
|
5027
|
+
}, styles == null ? void 0 : styles.labelContainer), left, /*#__PURE__*/React.createElement(Text, Object.assign({
|
|
5028
|
+
weight: "medium",
|
|
5029
|
+
flexGrow: 1
|
|
5030
|
+
}, styles == null ? void 0 : styles.label), selectedItem.label)), right, isDropdownVisible && (/*#__PURE__*/React.createElement(View, Object.assign({
|
|
5031
|
+
id: "combobox-dropdown",
|
|
5032
|
+
position: "absolute",
|
|
5033
|
+
backgroundColor: "white",
|
|
5034
|
+
boxShadow: "rgba(0, 0 ,0 ,0.16) 0px 1px 4px",
|
|
5035
|
+
width: "100%",
|
|
5036
|
+
overflowY: "auto",
|
|
5037
|
+
zIndex: 10000,
|
|
5038
|
+
bottom: -8,
|
|
5039
|
+
left: 0,
|
|
5040
|
+
transform: "translateY(100%)",
|
|
5041
|
+
marginTop: "4px",
|
|
5042
|
+
borderRadius: "4px"
|
|
5043
|
+
}, styles == null ? void 0 : styles.dropdown), searchEnabled && (/*#__PURE__*/React.createElement(TextFieldView, {
|
|
5044
|
+
id: props.id,
|
|
5045
|
+
name: props.name,
|
|
5046
|
+
width: "100%",
|
|
5047
|
+
type: "search",
|
|
5048
|
+
value: searchQuery,
|
|
5049
|
+
onChange: value => handleSearch(value),
|
|
5050
|
+
hint: placeholder,
|
|
5051
|
+
isClearable: false,
|
|
5052
|
+
leftChild: /*#__PURE__*/React.createElement(SearchLoopSvg, {
|
|
5053
|
+
size: 12
|
|
5054
|
+
}),
|
|
5055
|
+
styles: {
|
|
5056
|
+
box: Object.assign({
|
|
5057
|
+
width: '100%',
|
|
5058
|
+
padding: '6px 12px',
|
|
5059
|
+
borderBottom: filteredItems.length > 0 ? '1px solid #ccc' : '1px solid transparent'
|
|
5060
|
+
}, styles == null ? void 0 : styles.text)
|
|
5061
|
+
}
|
|
5062
|
+
})), filteredItems.length > 0 && (/*#__PURE__*/React.createElement(View, {
|
|
5063
|
+
margin: 0,
|
|
5064
|
+
padding: 4
|
|
5065
|
+
}, filteredItems.map((item, index) => (/*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5066
|
+
justifyContent: "space-between",
|
|
5067
|
+
key: item.value,
|
|
5068
|
+
padding: "12px",
|
|
5069
|
+
cursor: "pointer",
|
|
5070
|
+
borderRadius: 4,
|
|
5071
|
+
backgroundColor: index === highlightedIndex ? 'color.gray.100' : 'transparent',
|
|
5072
|
+
onMouseEnter: () => setHighlightedIndex(index),
|
|
5073
|
+
onClick: () => handleSelect(item)
|
|
5074
|
+
}, styles == null ? void 0 : styles.item), /*#__PURE__*/React.createElement(Text, null, item.label), /*#__PURE__*/React.createElement(React.Fragment, null, item.icon && item.icon, item.value === selectedItem.value && showTick && !item.icon && /*#__PURE__*/React.createElement(TickSvg, null))))))))))));
|
|
5075
|
+
};
|
|
5076
|
+
|
|
5077
|
+
var _excluded$C = ["id", "name", "items", "placeholder", "searchPlaceholder"];
|
|
5078
|
+
// Defines the ComboBoxComponent functional component with ComboBoxProps
|
|
5079
|
+
var ComboBoxComponent = _ref => {
|
|
5080
|
+
var {
|
|
5081
|
+
// Destructures 'id' from component props
|
|
5082
|
+
id,
|
|
5083
|
+
// Destructures 'name' from component props
|
|
5084
|
+
name,
|
|
5085
|
+
// Destructures 'items' from component props, used to populate combobox
|
|
5086
|
+
items,
|
|
5087
|
+
// Destructures 'placeholder' from component props, displayed when no item selected
|
|
5088
|
+
placeholder,
|
|
5089
|
+
// Destructures 'searchPlaceholder' from component props, used as the search field placeholder
|
|
5090
|
+
searchPlaceholder
|
|
5091
|
+
// Destructures the rest of the props not explicitly defined
|
|
5092
|
+
} = _ref,
|
|
5093
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$C);
|
|
5094
|
+
// Initializes ComboBox state using custom hook with items and placeholders
|
|
5095
|
+
var state = useComboBoxState(items, placeholder, searchPlaceholder);
|
|
5096
|
+
return (
|
|
5097
|
+
/*#__PURE__*/
|
|
5098
|
+
// Render ComboBoxView with passed and state props
|
|
5099
|
+
React.createElement(ComboBoxView, Object.assign({
|
|
5100
|
+
id: id,
|
|
5101
|
+
name: name,
|
|
5102
|
+
items: items
|
|
5103
|
+
}, state, props))
|
|
5104
|
+
);
|
|
5105
|
+
};
|
|
5106
|
+
// Exports the ComboBoxComponent as ComboBox
|
|
5107
|
+
var ComboBox = ComboBoxComponent;
|
|
5108
|
+
|
|
5109
|
+
var _excluded$D = ["children", "autoFocus", "initFocus", "onChange"];
|
|
4847
5110
|
var FocusContext = /*#__PURE__*/createContext({
|
|
4848
5111
|
active: false,
|
|
4849
5112
|
focusNextInput: () => {},
|
|
@@ -4859,7 +5122,7 @@ var FormikForm = _ref => {
|
|
|
4859
5122
|
initFocus,
|
|
4860
5123
|
onChange = () => {}
|
|
4861
5124
|
} = _ref,
|
|
4862
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5125
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
|
4863
5126
|
var formik = useFormikContext();
|
|
4864
5127
|
useEffect(() => {
|
|
4865
5128
|
onChange(formik.values);
|
|
@@ -4907,7 +5170,7 @@ var FormikForm = _ref => {
|
|
|
4907
5170
|
}, /*#__PURE__*/React.createElement(Form, Object.assign({}, props), children));
|
|
4908
5171
|
};
|
|
4909
5172
|
|
|
4910
|
-
var _excluded$
|
|
5173
|
+
var _excluded$E = ["name", "type"];
|
|
4911
5174
|
var getInputTypeProps = type => {
|
|
4912
5175
|
switch (type) {
|
|
4913
5176
|
case 'email':
|
|
@@ -4946,7 +5209,7 @@ var useFormikInput = _ref => {
|
|
|
4946
5209
|
name,
|
|
4947
5210
|
type
|
|
4948
5211
|
} = _ref,
|
|
4949
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5212
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
|
4950
5213
|
var focus = useFormFocus();
|
|
4951
5214
|
var {
|
|
4952
5215
|
touched,
|
|
@@ -4990,13 +5253,13 @@ var useFormikInput = _ref => {
|
|
|
4990
5253
|
} : {});
|
|
4991
5254
|
};
|
|
4992
5255
|
|
|
4993
|
-
var _excluded$
|
|
5256
|
+
var _excluded$F = ["value"];
|
|
4994
5257
|
var CheckboxComponent$1 = props => {
|
|
4995
5258
|
var _useFormikInput = useFormikInput(props),
|
|
4996
5259
|
{
|
|
4997
5260
|
value
|
|
4998
5261
|
} = _useFormikInput,
|
|
4999
|
-
formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$
|
|
5262
|
+
formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$F);
|
|
5000
5263
|
formProps.isChecked = value;
|
|
5001
5264
|
var checkboxStates = useCheckboxState(props);
|
|
5002
5265
|
return /*#__PURE__*/React.createElement(CheckboxView, Object.assign({}, checkboxStates, formProps));
|
|
@@ -5054,11 +5317,11 @@ var TextAreaComponent$1 = props => {
|
|
|
5054
5317
|
*/
|
|
5055
5318
|
var FormikTextArea = TextAreaComponent$1;
|
|
5056
5319
|
|
|
5057
|
-
var _excluded$
|
|
5320
|
+
var _excluded$G = ["value"];
|
|
5058
5321
|
var TextFieldComponent$1 = props => {
|
|
5059
5322
|
var formProps = useFormikInput(props);
|
|
5060
5323
|
var _useTextFieldState = useTextFieldState(props),
|
|
5061
|
-
textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$
|
|
5324
|
+
textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$G);
|
|
5062
5325
|
return /*#__PURE__*/React.createElement(TextFieldView, Object.assign({}, textFieldStates, formProps));
|
|
5063
5326
|
};
|
|
5064
5327
|
/**
|
|
@@ -5066,7 +5329,7 @@ var TextFieldComponent$1 = props => {
|
|
|
5066
5329
|
*/
|
|
5067
5330
|
var FormikTextField = TextFieldComponent$1;
|
|
5068
5331
|
|
|
5069
|
-
var _excluded$
|
|
5332
|
+
var _excluded$H = ["visibleIcon", "hiddenIcon"],
|
|
5070
5333
|
_excluded2$5 = ["isVisible", "setIsVisible"];
|
|
5071
5334
|
var PasswordComponent$1 = _ref => {
|
|
5072
5335
|
var {
|
|
@@ -5077,7 +5340,7 @@ var PasswordComponent$1 = _ref => {
|
|
|
5077
5340
|
size: 14
|
|
5078
5341
|
})
|
|
5079
5342
|
} = _ref,
|
|
5080
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5343
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$H);
|
|
5081
5344
|
var formProps = useFormikInput(props);
|
|
5082
5345
|
var _usePasswordState = usePasswordState(formProps),
|
|
5083
5346
|
{
|
|
@@ -5102,245 +5365,14 @@ var PasswordComponent$1 = _ref => {
|
|
|
5102
5365
|
*/
|
|
5103
5366
|
var FormikPassword = PasswordComponent$1;
|
|
5104
5367
|
|
|
5105
|
-
|
|
5106
|
-
var
|
|
5107
|
-
// State hook for filtered items with initial state set to the items passed to the hook.
|
|
5108
|
-
var [filteredItems, setFilteredItems] = useState(items);
|
|
5109
|
-
// State hook to track the selected item with an initial state based on the placeholder or the first item.
|
|
5110
|
-
var [selectedItem, setSelectedItem] = useState(placeholder ? {
|
|
5111
|
-
value: placeholder,
|
|
5112
|
-
label: placeholder
|
|
5113
|
-
} : items[0]);
|
|
5114
|
-
// State hook for highlighted index in the dropdown list, initialized to 0.
|
|
5115
|
-
var [highlightedIndex, setHighlightedIndex] = useState(0);
|
|
5116
|
-
// State hook for search query with an initial state based on the searchPlaceholder or empty string.
|
|
5117
|
-
var [searchQuery, setSearchQuery] = useState(searchPlaceholder != null ? searchPlaceholder : '');
|
|
5118
|
-
// State hook to manage dropdown visibility, starts as false (hidden).
|
|
5119
|
-
var [isDropdownVisible, setIsDropdownVisible] = useState(false);
|
|
5120
|
-
// Start of object returned by the useComboBoxState hook containing all state and state updater functions.
|
|
5121
|
-
return {
|
|
5122
|
-
filteredItems,
|
|
5123
|
-
setFilteredItems,
|
|
5124
|
-
selectedItem,
|
|
5125
|
-
setSelectedItem,
|
|
5126
|
-
highlightedIndex,
|
|
5127
|
-
setHighlightedIndex,
|
|
5128
|
-
searchQuery,
|
|
5129
|
-
setSearchQuery,
|
|
5130
|
-
isDropdownVisible,
|
|
5131
|
-
setIsDropdownVisible
|
|
5132
|
-
};
|
|
5133
|
-
};
|
|
5134
|
-
|
|
5135
|
-
var _excluded$E = ["size", "color"];
|
|
5136
|
-
var TickSvg = _ref => {
|
|
5137
|
-
var {
|
|
5138
|
-
size = 16,
|
|
5139
|
-
color = '#c0c0c0'
|
|
5140
|
-
} = _ref,
|
|
5141
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
|
5142
|
-
return /*#__PURE__*/React.createElement(Center, {
|
|
5143
|
-
width: size + "px",
|
|
5144
|
-
height: size + "px"
|
|
5145
|
-
}, /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
5146
|
-
width: size + "px",
|
|
5147
|
-
height: size + "px",
|
|
5148
|
-
viewBox: "0 -0.5 25 25",
|
|
5149
|
-
fill: "none",
|
|
5150
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
5151
|
-
}, props), /*#__PURE__*/React.createElement("g", {
|
|
5152
|
-
id: "SVGRepo_bgCarrier",
|
|
5153
|
-
strokeWidth: "0"
|
|
5154
|
-
}), /*#__PURE__*/React.createElement("g", {
|
|
5155
|
-
id: "SVGRepo_tracerCarrier",
|
|
5156
|
-
strokeLinecap: "round",
|
|
5157
|
-
strokeLinejoin: "round"
|
|
5158
|
-
}), /*#__PURE__*/React.createElement("g", {
|
|
5159
|
-
id: "SVGRepo_iconCarrier"
|
|
5160
|
-
}, ' ', /*#__PURE__*/React.createElement("path", {
|
|
5161
|
-
d: "M5.5 12.5L10.167 17L19.5 8",
|
|
5162
|
-
stroke: "#444444",
|
|
5163
|
-
strokeWidth: "1.5",
|
|
5164
|
-
strokeLinecap: "round",
|
|
5165
|
-
strokeLinejoin: "round"
|
|
5166
|
-
}), ' ')));
|
|
5167
|
-
};
|
|
5168
|
-
|
|
5169
|
-
var _excluded$F = ["size", "color"];
|
|
5170
|
-
var SearchLoopSvg = _ref => {
|
|
5171
|
-
var {
|
|
5172
|
-
size = 14,
|
|
5173
|
-
color = '#c0c0c0'
|
|
5174
|
-
} = _ref,
|
|
5175
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$F);
|
|
5176
|
-
return /*#__PURE__*/React.createElement(Center, {
|
|
5177
|
-
width: size + "px",
|
|
5178
|
-
height: size + "px"
|
|
5179
|
-
}, /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
5180
|
-
fill: "#c0c0c0",
|
|
5181
|
-
width: size + "px",
|
|
5182
|
-
height: size + "px",
|
|
5183
|
-
version: "1.1",
|
|
5184
|
-
id: "Capa_1",
|
|
5185
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5186
|
-
viewBox: "0 0 488.4 488.4",
|
|
5187
|
-
stroke: color
|
|
5188
|
-
}, props), /*#__PURE__*/React.createElement("g", {
|
|
5189
|
-
id: "SVGRepo_bgCarrier",
|
|
5190
|
-
strokeWidth: "9.279599999999999"
|
|
5191
|
-
}), /*#__PURE__*/React.createElement("g", {
|
|
5192
|
-
id: "SVGRepo_tracerCarrier",
|
|
5193
|
-
strokeLinecap: "round",
|
|
5194
|
-
strokeLinejoin: "round"
|
|
5195
|
-
}), /*#__PURE__*/React.createElement("g", {
|
|
5196
|
-
id: "SVGRepo_iconCarrier"
|
|
5197
|
-
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
5198
|
-
d: "M0,203.25c0,112.1,91.2,203.2,203.2,203.2c51.6,0,98.8-19.4,134.7-51.2l129.5,129.5c2.4,2.4,5.5,3.6,8.7,3.6 s6.3-1.2,8.7-3.6c4.8-4.8,4.8-12.5,0-17.3l-129.6-129.5c31.8-35.9,51.2-83,51.2-134.7c0-112.1-91.2-203.2-203.2-203.2 S0,91.15,0,203.25z M381.9,203.25c0,98.5-80.2,178.7-178.7,178.7s-178.7-80.2-178.7-178.7s80.2-178.7,178.7-178.7 S381.9,104.65,381.9,203.25z"
|
|
5199
|
-
}), ' ')))));
|
|
5200
|
-
};
|
|
5201
|
-
|
|
5202
|
-
var _excluded$G = ["placeholder", "items", "showTick", "onSelect", "searchEnabled", "left", "right", "label", "filteredItems", "setSelectedItem", "selectedItem", "highlightedIndex", "setHighlightedIndex", "searchQuery", "setSearchQuery", "setFilteredItems", "styles", "isDropdownVisible", "setIsDropdownVisible"];
|
|
5203
|
-
// Defines the functional component 'ComboBoxView' with destructured props.
|
|
5204
|
-
var ComboBoxView = _ref => {
|
|
5205
|
-
var {
|
|
5206
|
-
placeholder,
|
|
5207
|
-
items,
|
|
5208
|
-
showTick = true,
|
|
5209
|
-
onSelect,
|
|
5210
|
-
searchEnabled = true,
|
|
5211
|
-
left,
|
|
5212
|
-
right,
|
|
5213
|
-
label,
|
|
5214
|
-
filteredItems,
|
|
5215
|
-
setSelectedItem,
|
|
5216
|
-
selectedItem,
|
|
5217
|
-
highlightedIndex,
|
|
5218
|
-
setHighlightedIndex,
|
|
5219
|
-
searchQuery,
|
|
5220
|
-
setSearchQuery,
|
|
5221
|
-
setFilteredItems,
|
|
5222
|
-
styles,
|
|
5223
|
-
isDropdownVisible,
|
|
5224
|
-
setIsDropdownVisible
|
|
5225
|
-
// Collects all further props not destructured explicitly.
|
|
5226
|
-
} = _ref,
|
|
5227
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$G);
|
|
5228
|
-
// Sets up an effect to handle clicking outside the dropdown to close it.
|
|
5229
|
-
useEffect(() => {
|
|
5230
|
-
var handleClickOutside = event => {
|
|
5231
|
-
var path = event.composedPath();
|
|
5232
|
-
var isOutside = !path.some(element => (element == null ? void 0 : element.id) === 'combobox-dropdown');
|
|
5233
|
-
if (isOutside) {
|
|
5234
|
-
setIsDropdownVisible(false);
|
|
5235
|
-
}
|
|
5236
|
-
};
|
|
5237
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
5238
|
-
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
5239
|
-
}, []);
|
|
5240
|
-
// Defines 'handleSearch' to filter items based on the user's query.
|
|
5241
|
-
var handleSearch = query => {
|
|
5242
|
-
setSearchQuery(query);
|
|
5243
|
-
if (query === '') {
|
|
5244
|
-
setFilteredItems(items);
|
|
5245
|
-
} else {
|
|
5246
|
-
var filtered = items.filter(item => item.label.toLowerCase().includes(query.toLowerCase()));
|
|
5247
|
-
setFilteredItems(filtered);
|
|
5248
|
-
}
|
|
5249
|
-
setHighlightedIndex(0);
|
|
5250
|
-
};
|
|
5251
|
-
// Defines 'handleSelect' to handle item selection and close the dropdown.
|
|
5252
|
-
var handleSelect = item => {
|
|
5253
|
-
setSelectedItem(item);
|
|
5254
|
-
onSelect == null || onSelect(item);
|
|
5255
|
-
setIsDropdownVisible(false);
|
|
5256
|
-
};
|
|
5257
|
-
// Starts the JSX returned by the component representing the combobox.
|
|
5258
|
-
return /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5259
|
-
role: "combobox",
|
|
5260
|
-
flexWrap: "nowrap",
|
|
5261
|
-
gap: 15,
|
|
5262
|
-
alignItems: "center",
|
|
5263
|
-
width: "100%"
|
|
5264
|
-
}, props), label && (/*#__PURE__*/React.createElement(Text, {
|
|
5265
|
-
styles: styles == null ? void 0 : styles.label,
|
|
5266
|
-
htmlFor: props.id
|
|
5267
|
-
}, label)), /*#__PURE__*/React.createElement(View, {
|
|
5268
|
-
position: "relative"
|
|
5269
|
-
}, /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5270
|
-
cursor: "pointer",
|
|
5271
|
-
backgroundColor: "white",
|
|
5272
|
-
boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
|
|
5273
|
-
padding: "12px",
|
|
5274
|
-
display: "flex",
|
|
5275
|
-
alignItems: "center",
|
|
5276
|
-
borderRadius: "4px",
|
|
5277
|
-
justifyContent: "space-between",
|
|
5278
|
-
minWidth: 300,
|
|
5279
|
-
flexWrap: "nowrap"
|
|
5280
|
-
}, styles == null ? void 0 : styles.container), /*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5281
|
-
gap: 15,
|
|
5282
|
-
alignItems: "center",
|
|
5283
|
-
position: "relative",
|
|
5284
|
-
width: "100%",
|
|
5285
|
-
onClick: () => setIsDropdownVisible(!isDropdownVisible)
|
|
5286
|
-
}, styles == null ? void 0 : styles.labelContainer), left, /*#__PURE__*/React.createElement(Text, Object.assign({
|
|
5287
|
-
weight: "medium",
|
|
5288
|
-
flexGrow: 1
|
|
5289
|
-
}, styles == null ? void 0 : styles.label), selectedItem.label)), right, isDropdownVisible && (/*#__PURE__*/React.createElement(View, Object.assign({
|
|
5290
|
-
id: "combobox-dropdown",
|
|
5291
|
-
position: "absolute",
|
|
5292
|
-
backgroundColor: "white",
|
|
5293
|
-
boxShadow: "rgba(0, 0 ,0 ,0.16) 0px 1px 4px",
|
|
5294
|
-
width: "100%",
|
|
5295
|
-
overflowY: "auto",
|
|
5296
|
-
zIndex: 10000,
|
|
5297
|
-
bottom: -8,
|
|
5298
|
-
left: 0,
|
|
5299
|
-
transform: "translateY(100%)",
|
|
5300
|
-
marginTop: "4px",
|
|
5301
|
-
borderRadius: "4px"
|
|
5302
|
-
}, styles == null ? void 0 : styles.dropdown), searchEnabled && (/*#__PURE__*/React.createElement(TextFieldView, {
|
|
5303
|
-
id: props.id,
|
|
5304
|
-
name: props.name,
|
|
5305
|
-
width: "100%",
|
|
5306
|
-
type: "search",
|
|
5307
|
-
value: searchQuery,
|
|
5308
|
-
onChange: value => handleSearch(value),
|
|
5309
|
-
hint: placeholder,
|
|
5310
|
-
isClearable: false,
|
|
5311
|
-
leftChild: /*#__PURE__*/React.createElement(SearchLoopSvg, {
|
|
5312
|
-
size: 12
|
|
5313
|
-
}),
|
|
5314
|
-
styles: {
|
|
5315
|
-
box: Object.assign({
|
|
5316
|
-
width: '100%',
|
|
5317
|
-
padding: '6px 12px',
|
|
5318
|
-
borderBottom: filteredItems.length > 0 ? '1px solid #ccc' : '1px solid transparent'
|
|
5319
|
-
}, styles == null ? void 0 : styles.text)
|
|
5320
|
-
}
|
|
5321
|
-
})), filteredItems.length > 0 && (/*#__PURE__*/React.createElement(View, {
|
|
5322
|
-
margin: 0,
|
|
5323
|
-
padding: 4
|
|
5324
|
-
}, filteredItems.map((item, index) => (/*#__PURE__*/React.createElement(Horizontal, Object.assign({
|
|
5325
|
-
justifyContent: "space-between",
|
|
5326
|
-
key: item.value,
|
|
5327
|
-
padding: "12px",
|
|
5328
|
-
cursor: "pointer",
|
|
5329
|
-
borderRadius: 4,
|
|
5330
|
-
backgroundColor: index === highlightedIndex ? 'color.gray.100' : 'transparent',
|
|
5331
|
-
onMouseEnter: () => setHighlightedIndex(index),
|
|
5332
|
-
onClick: () => handleSelect(item)
|
|
5333
|
-
}, styles == null ? void 0 : styles.item), /*#__PURE__*/React.createElement(Text, null, item.label), /*#__PURE__*/React.createElement(React.Fragment, null, item.icon && item.icon, item.value === selectedItem.value && showTick && !item.icon && /*#__PURE__*/React.createElement(TickSvg, null))))))))))));
|
|
5334
|
-
};
|
|
5335
|
-
|
|
5336
|
-
var _excluded$H = ["items", "placeholder", "searchPlaceholder"];
|
|
5337
|
-
var ComboBoxComponent = _ref => {
|
|
5368
|
+
var _excluded$I = ["items", "placeholder", "searchPlaceholder"];
|
|
5369
|
+
var ComboBoxComponent$1 = _ref => {
|
|
5338
5370
|
var {
|
|
5339
5371
|
items,
|
|
5340
5372
|
placeholder,
|
|
5341
5373
|
searchPlaceholder
|
|
5342
5374
|
} = _ref,
|
|
5343
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5375
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$I);
|
|
5344
5376
|
var formProps = useFormikInput(props);
|
|
5345
5377
|
var ComboBoxStates = useComboBoxState(items, placeholder, searchPlaceholder);
|
|
5346
5378
|
// Ensure the onChange function from formProps is being called when an item is selected
|
|
@@ -5354,7 +5386,7 @@ var ComboBoxComponent = _ref => {
|
|
|
5354
5386
|
/**
|
|
5355
5387
|
* ComboBox allows users to select one or more options from a list of choices.
|
|
5356
5388
|
*/
|
|
5357
|
-
var FormikComboBox = ComboBoxComponent;
|
|
5389
|
+
var FormikComboBox = ComboBoxComponent$1;
|
|
5358
5390
|
|
|
5359
5391
|
// Create your store with the initial state and actions.
|
|
5360
5392
|
var useMessageStore = /*#__PURE__*/create(set => ({
|
|
@@ -5709,7 +5741,7 @@ var HeaderIconSizes = {
|
|
|
5709
5741
|
xl: 28
|
|
5710
5742
|
};
|
|
5711
5743
|
|
|
5712
|
-
var _excluded$
|
|
5744
|
+
var _excluded$J = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
|
|
5713
5745
|
_excluded2$6 = ["children", "shadow", "isFullScreen", "shape"],
|
|
5714
5746
|
_excluded3$3 = ["children", "buttonColor", "iconSize", "buttonPosition"],
|
|
5715
5747
|
_excluded4$2 = ["children"],
|
|
@@ -5723,7 +5755,7 @@ var ModalOverlay = _ref => {
|
|
|
5723
5755
|
onClose = () => {},
|
|
5724
5756
|
position = 'center'
|
|
5725
5757
|
} = _ref,
|
|
5726
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5758
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$J);
|
|
5727
5759
|
var handleClick = () => {
|
|
5728
5760
|
if (!isClosePrevented) onClose();
|
|
5729
5761
|
};
|
|
@@ -6112,7 +6144,7 @@ var ToggleShapes = {
|
|
|
6112
6144
|
pillShaped: 24
|
|
6113
6145
|
};
|
|
6114
6146
|
|
|
6115
|
-
var _excluded$
|
|
6147
|
+
var _excluded$K = ["children", "shape", "colorScheme", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle"];
|
|
6116
6148
|
var ToggleView = _ref => {
|
|
6117
6149
|
var {
|
|
6118
6150
|
children,
|
|
@@ -6126,7 +6158,7 @@ var ToggleView = _ref => {
|
|
|
6126
6158
|
setIsToggled,
|
|
6127
6159
|
onToggle
|
|
6128
6160
|
} = _ref,
|
|
6129
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6161
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$K);
|
|
6130
6162
|
var toggleColor = !isDisabled ? colorScheme : 'theme.disabled';
|
|
6131
6163
|
var isActive = !!(isToggle || isHovered);
|
|
6132
6164
|
var ToggleVariants = {
|
|
@@ -6168,7 +6200,7 @@ var ToggleView = _ref => {
|
|
|
6168
6200
|
}, ToggleVariants[variant], props), children);
|
|
6169
6201
|
};
|
|
6170
6202
|
|
|
6171
|
-
var _excluded$
|
|
6203
|
+
var _excluded$L = ["children", "shape", "colorScheme", "variant", "isDisabled", "isToggled", "onToggle"];
|
|
6172
6204
|
// Destructuring properties from ToggleProps to be used within the ToggleComponent.
|
|
6173
6205
|
var ToggleComponent = _ref => {
|
|
6174
6206
|
var {
|
|
@@ -6181,7 +6213,7 @@ var ToggleComponent = _ref => {
|
|
|
6181
6213
|
isToggled = false,
|
|
6182
6214
|
onToggle
|
|
6183
6215
|
} = _ref,
|
|
6184
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6216
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$L);
|
|
6185
6217
|
// Initializing toggle state and set state functions using the custom hook useToggleState.
|
|
6186
6218
|
var {
|
|
6187
6219
|
isHovered,
|
|
@@ -6296,5 +6328,5 @@ var ToggleGroupComponent = _ref => {
|
|
|
6296
6328
|
// Expose the ToggleGroupComponent for import into other modules
|
|
6297
6329
|
var ToggleGroup = ToggleGroupComponent;
|
|
6298
6330
|
|
|
6299
|
-
export { Alert, AspectRatio, Avatar, Badge, Bottom, Button, Center, Checkbox, CountryPicker, DatePicker, FileImage, FileSVG, FormikCheckbox, FormikComboBox, FormikCountryPicker, FormikDatePicker, FormikForm, FormikPassword, FormikSelect, FormikSwitch, FormikTextArea, FormikTextField, Horizontal, Inline, Left, Link, Loader, MessageLayout, MessageView, Modal, Password, Right, Select, Switch, Table, Tabs, Text, TextArea, TextField, Toggle, ToggleGroup, Top, Vertical, View, hideMessage, hideModal, showMessage, showModal, useMessageStore, useModalStore };
|
|
6331
|
+
export { Alert, AspectRatio, Avatar, Badge, Bottom, Button, Center, Checkbox, ComboBox, CountryPicker, DatePicker, FileImage, FileSVG, FormikCheckbox, FormikComboBox, FormikCountryPicker, FormikDatePicker, FormikForm, FormikPassword, FormikSelect, FormikSwitch, FormikTextArea, FormikTextField, Horizontal, Inline, Left, Link, Loader, MessageLayout, MessageView, Modal, Password, Right, Select, Switch, Table, Tabs, Text, TextArea, TextField, Toggle, ToggleGroup, Top, Vertical, View, hideMessage, hideModal, showMessage, showModal, useMessageStore, useModalStore };
|
|
6300
6332
|
//# sourceMappingURL=web.esm.js.map
|