@app-studio/web 0.8.10 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Form/CountryPicker/CountryPicker/CountryPicker.props.d.ts +0 -113
- package/dist/components/Form/CountryPicker/CountryPicker.d.ts +0 -3
- package/dist/components/Form/Select/Select/Select.props.d.ts +0 -150
- package/dist/components/Form/Select/Select.d.ts +0 -3
- package/dist/components/Form/Switch/Switch/Switch.props.d.ts +0 -40
- package/dist/components/Form/TextArea/TextArea/TextArea.props.d.ts +0 -99
- package/dist/components/Form/TextArea/TextArea.d.ts +0 -3
- package/dist/components/Form/TextField/TextField/TextField.props.d.ts +0 -80
- package/dist/components/Form/TextField/TextField.d.ts +0 -3
- package/dist/components/Link/Link/Link.props.d.ts +0 -28
- package/dist/components/Link/Link.d.ts +0 -3
- package/dist/components/Loader/Loader/Loader.props.d.ts +0 -51
- package/dist/components/Loader/Loader.d.ts +0 -3
- package/dist/components/Text/Text/Text.props.d.ts +0 -48
- package/dist/docsLoader.d.ts +1 -0
- package/dist/pages/docs/components/LiveCode.component.d.ts +3 -0
- package/dist/pages/docs/components/MarkdownEditor.component.d.ts +5 -0
- package/dist/pages/docs/components/docs.elements.d.ts +3 -0
- package/dist/pages/docs/components/docs.request.d.ts +10 -0
- package/dist/pages/docs/components/docs.states.d.ts +5 -0
- package/dist/pages/docs/docs.page.d.ts +4 -0
- package/dist/web.cjs.development.js +102 -47
- 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 +102 -47
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +102 -47
- 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 +12 -4
- package/dist/bot/Bot.d.ts +0 -14
- package/dist/bot/Cache.d.ts +0 -13
- package/dist/bot/Config.d.ts +0 -13
- package/dist/bot/ContentFetcher.d.ts +0 -9
- package/dist/bot/DocuCode.d.ts +0 -17
- package/dist/bot/FileHandler.d.ts +0 -24
- package/dist/bot/OpenAIConnector.d.ts +0 -27
- package/dist/bot/data.d.ts +0 -19
- package/dist/bot/extractors.d.ts +0 -8
- package/dist/bot/index.d.ts +0 -1
- package/dist/bot/prompt/1-project.d.ts +0 -1
- package/dist/bot/prompt/2-response.d.ts +0 -1
- package/dist/bot/prompt/3-comment.d.ts +0 -1
|
@@ -190,6 +190,7 @@
|
|
|
190
190
|
var Text = TextComponent;
|
|
191
191
|
|
|
192
192
|
var _excluded$1 = ["justifyContent", "isReversed"];
|
|
193
|
+
// Defines the functional component VerticalView with props specified by VerticalProps
|
|
193
194
|
var VerticalView = function VerticalView(_ref) {
|
|
194
195
|
var _ref$justifyContent = _ref.justifyContent,
|
|
195
196
|
justifyContent = _ref$justifyContent === void 0 ? 'flex-start' : _ref$justifyContent,
|
|
@@ -203,39 +204,46 @@
|
|
|
203
204
|
}, props));
|
|
204
205
|
};
|
|
205
206
|
|
|
206
|
-
|
|
207
|
-
* Vertical layout aligns all the elements in a container on the vertical axis.
|
|
208
|
-
*/
|
|
207
|
+
// Defines the VerticalComponent as a functional component with VerticalProps as its props signature.
|
|
209
208
|
var VerticalComponent = function VerticalComponent(props) {
|
|
210
|
-
return
|
|
209
|
+
return (
|
|
210
|
+
// Renders the VerticalView component, passing all of the received props through to it.
|
|
211
|
+
React__default.createElement(VerticalView, Object.assign({}, props))
|
|
212
|
+
);
|
|
211
213
|
};
|
|
214
|
+
// Exports the VerticalComponent as Vertical for use in other parts of the application.
|
|
212
215
|
var Vertical = VerticalComponent;
|
|
213
216
|
|
|
214
|
-
|
|
215
|
-
* Horizontal layout aligns all the elements in a container on the horizontal axis.
|
|
216
|
-
*/
|
|
217
|
+
// Defines a functional component 'HorizontalComponent' utilizing 'ViewProps'. It leverages flexbox to create a horizontal view, which can be reversed based on a prop.
|
|
217
218
|
var HorizontalComponent = function HorizontalComponent(props) {
|
|
218
219
|
return React__default.createElement(appStudio.View, Object.assign({
|
|
219
220
|
display: "flex",
|
|
220
221
|
flexDirection: props.isReversed ? 'row-reverse' : 'row'
|
|
221
222
|
}, props));
|
|
222
223
|
};
|
|
224
|
+
// Exports the HorizontalComponent as 'Horizontal', making it available for use in other parts of the application.
|
|
223
225
|
var Horizontal = HorizontalComponent;
|
|
224
226
|
|
|
227
|
+
// Defines a React Functional Component named CenterView which centers its children both horizontally and vertically using flexbox.
|
|
225
228
|
var CenterView = function CenterView(props) {
|
|
226
|
-
return
|
|
227
|
-
display
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
return (
|
|
230
|
+
// Renders a 'View' component with display flex and center alignment applied on both axes, passing all received props.
|
|
231
|
+
React__default.createElement(appStudio.View, Object.assign({
|
|
232
|
+
display: "flex",
|
|
233
|
+
justifyContent: "center",
|
|
234
|
+
alignItems: "center"
|
|
235
|
+
}, props))
|
|
236
|
+
);
|
|
231
237
|
};
|
|
232
238
|
|
|
233
|
-
|
|
234
|
-
* The Center component is a React functional component that provides a centered layout for its children using flexbox.
|
|
235
|
-
*/
|
|
239
|
+
// Defines a functional component named CenterComponent utilizing React's functional component structure, which expects props of the CenterProps type.
|
|
236
240
|
var CenterComponent = function CenterComponent(props) {
|
|
237
|
-
return
|
|
241
|
+
return (
|
|
242
|
+
// Renders the CenterView component, passing down all the props received by the CenterComponent.
|
|
243
|
+
React__default.createElement(CenterView, Object.assign({}, props))
|
|
244
|
+
);
|
|
238
245
|
};
|
|
246
|
+
// Exports CenterComponent as Center, making it available for use in other parts of the application.
|
|
239
247
|
var Center = CenterComponent;
|
|
240
248
|
|
|
241
249
|
var _excluded$2 = ["size", "color"];
|
|
@@ -1020,6 +1028,7 @@
|
|
|
1020
1028
|
};
|
|
1021
1029
|
// The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
|
|
1022
1030
|
|
|
1031
|
+
// This function initializes the Link component's state using the useState hook and exposes its state and setter function.
|
|
1023
1032
|
var useLinkState = function useLinkState() {
|
|
1024
1033
|
var _useState = React.useState(false),
|
|
1025
1034
|
isHovered = _useState[0],
|
|
@@ -1030,6 +1039,7 @@
|
|
|
1030
1039
|
};
|
|
1031
1040
|
};
|
|
1032
1041
|
|
|
1042
|
+
// Defines a mapping of various size names (from 'xs' to '6xl') to their respective numeric icon sizes, providing a scalable way to reference icon sizes throughout the component.
|
|
1033
1043
|
var IconSizes = {
|
|
1034
1044
|
xs: 12,
|
|
1035
1045
|
sm: 14,
|
|
@@ -1044,6 +1054,7 @@
|
|
|
1044
1054
|
};
|
|
1045
1055
|
|
|
1046
1056
|
var _excluded$g = ["children", "href", "iconSize", "underline", "isHovered", "isExternal", "styles", "setIsHovered"];
|
|
1057
|
+
// Component definition for 'LinkView', a functional component with props defined by 'LinkViewProps'.
|
|
1047
1058
|
var LinkView = function LinkView(_ref) {
|
|
1048
1059
|
var children = _ref.children,
|
|
1049
1060
|
_ref$href = _ref.href,
|
|
@@ -1064,6 +1075,7 @@
|
|
|
1064
1075
|
_ref$setIsHovered = _ref.setIsHovered,
|
|
1065
1076
|
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
1066
1077
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
1078
|
+
// Function to handle mouse enter/leave events to toggle hover state.
|
|
1067
1079
|
var handleHover = function handleHover() {
|
|
1068
1080
|
if (underline === 'hover') setIsHovered(true);
|
|
1069
1081
|
};
|
|
@@ -1084,13 +1096,14 @@
|
|
|
1084
1096
|
}))));
|
|
1085
1097
|
};
|
|
1086
1098
|
|
|
1099
|
+
// Defines the 'LinkComponent' as a functional component with props typed to 'LinkProps'
|
|
1087
1100
|
var LinkComponent = function LinkComponent(props) {
|
|
1101
|
+
// Gets stateful logic and data necessary for the link component via 'useLinkState' hook
|
|
1088
1102
|
var linkStates = useLinkState();
|
|
1103
|
+
// Renders 'LinkView' component passing down link state and props
|
|
1089
1104
|
return React__default.createElement(LinkView, Object.assign({}, linkStates, props));
|
|
1090
1105
|
};
|
|
1091
|
-
|
|
1092
|
-
* Link allows users to navigate from page to page. It have a similar appearance as the hyperlink.
|
|
1093
|
-
*/
|
|
1106
|
+
// Exports 'LinkComponent' as 'Link' for use in other parts of the application
|
|
1094
1107
|
var Link = LinkComponent;
|
|
1095
1108
|
|
|
1096
1109
|
var ButtonSizes = {
|
|
@@ -1198,6 +1211,8 @@
|
|
|
1198
1211
|
}
|
|
1199
1212
|
};
|
|
1200
1213
|
|
|
1214
|
+
// Defines a mapping of spinning speed labels to their respective duration in seconds for the Loader component animations.
|
|
1215
|
+
// Sets up a scale of sizes, mapping size labels to numerical values to be used for Loader component dimensions.
|
|
1201
1216
|
var DefaultSizes = {
|
|
1202
1217
|
xs: 14,
|
|
1203
1218
|
sm: 18,
|
|
@@ -1210,6 +1225,7 @@
|
|
|
1210
1225
|
'5xl': 70,
|
|
1211
1226
|
'6xl': 80
|
|
1212
1227
|
};
|
|
1228
|
+
// Specifies a mapping of spinning speed labels to numerical millisecond values, determining the speed of the Loader component's animation cycles.
|
|
1213
1229
|
var DefaultSpeeds = {
|
|
1214
1230
|
fast: 50,
|
|
1215
1231
|
normal: 100,
|
|
@@ -1393,12 +1409,14 @@
|
|
|
1393
1409
|
}, children));
|
|
1394
1410
|
};
|
|
1395
1411
|
|
|
1412
|
+
// Defines a LoaderComponent as a functional component with props defined by LoaderProps and returns the LoaderView component, passing along any received props.
|
|
1396
1413
|
var LoaderComponent = function LoaderComponent(props) {
|
|
1397
|
-
return
|
|
1414
|
+
return (
|
|
1415
|
+
// Renders the LoaderView component by spreading the received props, which allows for a clean pass-through of properties.
|
|
1416
|
+
React__default.createElement(LoaderView, Object.assign({}, props))
|
|
1417
|
+
);
|
|
1398
1418
|
};
|
|
1399
|
-
|
|
1400
|
-
* It gives the user an insight about an action being processed. It may have an undefined waiting time or display the process length.
|
|
1401
|
-
*/
|
|
1419
|
+
// Exports the LoaderComponent as Loader, making it available for use in other parts of the application.
|
|
1402
1420
|
var Loader = LoaderComponent;
|
|
1403
1421
|
|
|
1404
1422
|
var _excluded$i = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "isLoading", "isDisabled", "size", "variant", "iconPosition", "colorScheme", "shape", "onClick", "loaderProps", "loaderPosition", "effect", "isHovered", "setIsHovered"];
|
|
@@ -1584,26 +1602,34 @@
|
|
|
1584
1602
|
}, props));
|
|
1585
1603
|
};
|
|
1586
1604
|
|
|
1605
|
+
// Initializes the custom hook 'useSelectState' for managing the state of the Select component
|
|
1587
1606
|
var useSelectState = function useSelectState(_ref) {
|
|
1588
1607
|
var placeholder = _ref.placeholder,
|
|
1589
1608
|
isMulti = _ref.isMulti,
|
|
1590
1609
|
options = _ref.options;
|
|
1610
|
+
// Determines the default value based on the 'placeholder' and 'isMulti' props, setting to an empty array for multi-select or an empty string/single default option
|
|
1591
1611
|
var defaultValue = placeholder ? isMulti ? [] : '' : options[0].value;
|
|
1612
|
+
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
1592
1613
|
var _React$useState = React__default.useState(true),
|
|
1593
1614
|
hide = _React$useState[0],
|
|
1594
1615
|
setHide = _React$useState[1];
|
|
1616
|
+
// State hook for tracking mouse hover status over the Select component
|
|
1595
1617
|
var _React$useState2 = React__default.useState(false),
|
|
1596
1618
|
isHovered = _React$useState2[0],
|
|
1597
1619
|
setIsHovered = _React$useState2[1];
|
|
1620
|
+
// State hook for tracking focus status of the Select input field
|
|
1598
1621
|
var _React$useState3 = React__default.useState(false),
|
|
1599
1622
|
isFocused = _React$useState3[0],
|
|
1600
1623
|
setIsFocused = _React$useState3[1];
|
|
1624
|
+
// State hook for managing the value(s) selected by the user, initialized with the default value
|
|
1601
1625
|
var _React$useState4 = React__default.useState(defaultValue),
|
|
1602
1626
|
value = _React$useState4[0],
|
|
1603
1627
|
setValue = _React$useState4[1];
|
|
1628
|
+
// State hook for keeping track of the currently highlighted index in the options list
|
|
1604
1629
|
var _React$useState5 = React__default.useState(0),
|
|
1605
1630
|
highlightedIndex = _React$useState5[0],
|
|
1606
1631
|
setHighlightedIndex = _React$useState5[1];
|
|
1632
|
+
// Returns an object containing all stateful values and their associated setters to manage the Select component's state
|
|
1607
1633
|
return {
|
|
1608
1634
|
value: value,
|
|
1609
1635
|
setValue: setValue,
|
|
@@ -1617,10 +1643,13 @@
|
|
|
1617
1643
|
setHighlightedIndex: setHighlightedIndex
|
|
1618
1644
|
};
|
|
1619
1645
|
};
|
|
1646
|
+
// Initializes another custom hook 'useItemState' for managing the hover state of each Select item
|
|
1620
1647
|
var useItemState = function useItemState() {
|
|
1648
|
+
// State hook for tracking mouse hover status over individual Select item options
|
|
1621
1649
|
var _React$useState6 = React__default.useState(false),
|
|
1622
1650
|
isHovered = _React$useState6[0],
|
|
1623
1651
|
setIsHovered = _React$useState6[1];
|
|
1652
|
+
// Returns an object with 'isHovered' state and its associated setter from the 'useItemState' hook, for controlling individual Select item hover state
|
|
1624
1653
|
return {
|
|
1625
1654
|
isHovered: isHovered,
|
|
1626
1655
|
setIsHovered: setIsHovered
|
|
@@ -1894,6 +1923,8 @@
|
|
|
1894
1923
|
}, props), children);
|
|
1895
1924
|
};
|
|
1896
1925
|
|
|
1926
|
+
// Defines a mapping of 'Size' types to their corresponding CSSProperties. This allows different size configurations to be provided for the Select component.
|
|
1927
|
+
// Specifies the pixel sizes of icons associated with the Select component based on the predefined 'Size' types allowing for consistent icon scaling.
|
|
1897
1928
|
var IconSizes$2 = {
|
|
1898
1929
|
xs: 8,
|
|
1899
1930
|
sm: 10,
|
|
@@ -1906,6 +1937,7 @@
|
|
|
1906
1937
|
_excluded2$2 = ["id", "name", "value", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
|
|
1907
1938
|
_excluded3$1 = ["option", "size", "removeOption"],
|
|
1908
1939
|
_excluded4$1 = ["id", "name", "label", "value", "placeholder", "helperText", "hide", "error", "isMulti", "isFocused", "isHovered", "isDisabled", "isReadOnly", "options", "shadow", "size", "colorScheme", "shape", "variant", "styles", "onChange", "setHide", "setValue", "setIsHovered", "setIsFocused", "setHighlightedIndex", "highlightedIndex"];
|
|
1940
|
+
// Defines a component to render individual selection items within a list.
|
|
1909
1941
|
var Item = function Item(_ref) {
|
|
1910
1942
|
var isHovered = _ref.isHovered,
|
|
1911
1943
|
setIsHovered = _ref.setIsHovered,
|
|
@@ -1916,9 +1948,11 @@
|
|
|
1916
1948
|
callback = _ref$callback === void 0 ? function () {} : _ref$callback,
|
|
1917
1949
|
style = _ref.style,
|
|
1918
1950
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
1951
|
+
// Handles the click event on an option by invoking the callback with the selected option's value.
|
|
1919
1952
|
var handleOptionClick = function handleOptionClick(option) {
|
|
1920
1953
|
return callback(option);
|
|
1921
1954
|
};
|
|
1955
|
+
// Toggles the hover state on the item.
|
|
1922
1956
|
var handleHover = function handleHover() {
|
|
1923
1957
|
return setIsHovered(!isHovered);
|
|
1924
1958
|
};
|
|
@@ -2061,10 +2095,10 @@
|
|
|
2061
2095
|
backgroundColor: "white",
|
|
2062
2096
|
maxHeight: "200px",
|
|
2063
2097
|
style: {
|
|
2064
|
-
scrollbarWidth: 'none'
|
|
2065
|
-
msOverflowStyle: 'none'
|
|
2098
|
+
scrollbarWidth: 'none',
|
|
2099
|
+
msOverflowStyle: 'none',
|
|
2066
2100
|
'&::-webkit-scrollbar': {
|
|
2067
|
-
display: 'none'
|
|
2101
|
+
display: 'none'
|
|
2068
2102
|
}
|
|
2069
2103
|
}
|
|
2070
2104
|
}, shadow, styles['dropDown']), options.map(function (option, index) {
|
|
@@ -2258,15 +2292,17 @@
|
|
|
2258
2292
|
}));
|
|
2259
2293
|
};
|
|
2260
2294
|
|
|
2295
|
+
// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.
|
|
2261
2296
|
var SelectComponent = function SelectComponent(props) {
|
|
2297
|
+
// Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.
|
|
2262
2298
|
var selectStates = useSelectState(props);
|
|
2299
|
+
// Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.
|
|
2263
2300
|
return React__default.createElement(SelectView, Object.assign({}, selectStates, props));
|
|
2264
2301
|
};
|
|
2265
|
-
|
|
2266
|
-
* Select provides a dropdown list of options for the user to choose from.
|
|
2267
|
-
*/
|
|
2302
|
+
// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.
|
|
2268
2303
|
var Select = SelectComponent;
|
|
2269
2304
|
|
|
2305
|
+
// This file defines a custom hook for managing the state of a Switch component. It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.
|
|
2270
2306
|
var useSwitchState = function useSwitchState(_ref) {
|
|
2271
2307
|
var isDisabled = _ref.isDisabled,
|
|
2272
2308
|
isChecked = _ref.isChecked;
|
|
@@ -2284,6 +2320,7 @@
|
|
|
2284
2320
|
};
|
|
2285
2321
|
};
|
|
2286
2322
|
|
|
2323
|
+
// Defines a mapping of size types to their respective knob style properties, specifying the height and width for various predefined sizes.
|
|
2287
2324
|
var KnobSizes = {
|
|
2288
2325
|
xs: {
|
|
2289
2326
|
height: 6,
|
|
@@ -2326,6 +2363,7 @@
|
|
|
2326
2363
|
width: 33
|
|
2327
2364
|
}
|
|
2328
2365
|
};
|
|
2366
|
+
// Specifies the dimensions of the switch's slider for each predefined size by mapping them to the height and width CSS properties.
|
|
2329
2367
|
var SliderSizes = {
|
|
2330
2368
|
xs: {
|
|
2331
2369
|
height: 16,
|
|
@@ -2368,6 +2406,7 @@
|
|
|
2368
2406
|
width: 100
|
|
2369
2407
|
}
|
|
2370
2408
|
};
|
|
2409
|
+
// Associates each size type with corresponding padding values for vertical and horizontal spacing, used to adjust the position of the elements within the switch.
|
|
2371
2410
|
var SliderPadding = {
|
|
2372
2411
|
xs: {
|
|
2373
2412
|
paddingVertical: 0,
|
|
@@ -2502,28 +2541,38 @@
|
|
|
2502
2541
|
}, KnobSizes[size], styles['circle'])), inActiveChild && !value && React__default.createElement(View, null, inActiveChild)), labelPosition === 'right' && label && React__default.createElement(View, null, label));
|
|
2503
2542
|
};
|
|
2504
2543
|
|
|
2544
|
+
// Defines the SwitchComponent as a functional component that takes SwitchProps as props.
|
|
2505
2545
|
var SwitchComponent = function SwitchComponent(props) {
|
|
2546
|
+
// Invokes useSwitchState hook to obtain state for this component, passing props to it.
|
|
2506
2547
|
var switchStates = useSwitchState(props);
|
|
2548
|
+
// Renders the SwitchView component, spreading the switchStates and props to pass all necessary data.
|
|
2507
2549
|
return React__default.createElement(SwitchView, Object.assign({}, switchStates, props));
|
|
2508
2550
|
};
|
|
2551
|
+
// Exports the SwitchComponent as 'Switch' for use in other parts of the application.
|
|
2509
2552
|
var Switch = SwitchComponent;
|
|
2510
2553
|
|
|
2554
|
+
// Declaration of the useTextAreaState custom hook for managing the text area component state.
|
|
2511
2555
|
var useTextAreaState = function useTextAreaState(_ref) {
|
|
2512
2556
|
var label = _ref.label,
|
|
2513
2557
|
placeholder = _ref.placeholder,
|
|
2514
2558
|
defaultValue = _ref.value;
|
|
2559
|
+
// State hook for the 'hint' value, displaying either the label or placeholder as guidance within the text area.
|
|
2515
2560
|
var _useState = React.useState(label != null ? label : placeholder),
|
|
2516
2561
|
hint = _useState[0],
|
|
2517
2562
|
setHint = _useState[1];
|
|
2563
|
+
// State hook for tracking whether the text area is hovered over.
|
|
2518
2564
|
var _useState2 = React.useState(false),
|
|
2519
2565
|
isHovered = _useState2[0],
|
|
2520
2566
|
setIsHovered = _useState2[1];
|
|
2567
|
+
// State hook to manage the current value of the text area, initialized with the default value or an empty string.
|
|
2521
2568
|
var _useState3 = React.useState(defaultValue || ''),
|
|
2522
2569
|
value = _useState3[0],
|
|
2523
2570
|
setValue = _useState3[1];
|
|
2571
|
+
// State hook to determine if the text area is currently focused.
|
|
2524
2572
|
var _useState4 = React.useState(false),
|
|
2525
2573
|
isFocused = _useState4[0],
|
|
2526
2574
|
setIsFocused = _useState4[1];
|
|
2575
|
+
// Memoized callback that sets the hint based on focus state and value presence to ensure proper label or placeholder visibility.
|
|
2527
2576
|
React.useMemo(function () {
|
|
2528
2577
|
setHint(isFocused && !value ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
2529
2578
|
}, [value, isFocused, label, placeholder]);
|
|
@@ -2537,6 +2586,7 @@
|
|
|
2537
2586
|
isFocused: isFocused,
|
|
2538
2587
|
setIsFocused: setIsFocused
|
|
2539
2588
|
};
|
|
2589
|
+
// Export of the useTextAreaState hook for external usage.
|
|
2540
2590
|
};
|
|
2541
2591
|
|
|
2542
2592
|
var _excluded$t = ["id", "name", "hint", "error", "value", "label", "shadow", "helperText", "placeholder", "size", "shape", "variant", "colorScheme", "isHovered", "isFocused", "isEditable", "isReadOnly", "isDisabled", "isAutoFocus", "isMultiline", "maxRows", "maxCols", "onBlur", "onChange", "onFocus", "onChangeText", "setHint", "setValue", "setIsFocused", "setIsHovered", "styles"];
|
|
@@ -2626,7 +2676,6 @@
|
|
|
2626
2676
|
};
|
|
2627
2677
|
var handleChange = function handleChange(event) {
|
|
2628
2678
|
if (typeof event === 'string') {
|
|
2629
|
-
//for ios and android
|
|
2630
2679
|
setValue(event);
|
|
2631
2680
|
if (onChangeText) onChangeText(event);
|
|
2632
2681
|
} else {
|
|
@@ -2681,34 +2730,44 @@
|
|
|
2681
2730
|
})))));
|
|
2682
2731
|
};
|
|
2683
2732
|
|
|
2733
|
+
// Defines the TextAreaComponent as a functional component that accepts TextAreaProps for type safety and structure.
|
|
2684
2734
|
var TextAreaComponent = function TextAreaComponent(props) {
|
|
2735
|
+
// Creates a state for the TextAreaComponent using custom hook useTextAreaState which initializes the state with props.
|
|
2685
2736
|
var textAreaState = useTextAreaState(props);
|
|
2737
|
+
// Renders the TextAreaView component, passing along the state and any received props.
|
|
2686
2738
|
return React__default.createElement(TextAreaView, Object.assign({}, textAreaState, props));
|
|
2687
2739
|
};
|
|
2688
|
-
|
|
2689
|
-
* Text Area is an component used to create a multi-line input field.
|
|
2690
|
-
*/
|
|
2740
|
+
// Exports the TextAreaComponent as TextArea for use in other parts of the application.
|
|
2691
2741
|
var TextArea = TextAreaComponent;
|
|
2692
2742
|
|
|
2743
|
+
// Define a custom hook `useTextFieldState` that creates and manages the state of a text field component based on its properties.
|
|
2693
2744
|
var useTextFieldState = function useTextFieldState(_ref) {
|
|
2694
2745
|
var label = _ref.label,
|
|
2695
2746
|
placeholder = _ref.placeholder,
|
|
2696
2747
|
defaultValue = _ref.value;
|
|
2748
|
+
// Initialize `hint` state with either the label or placeholder text, using label as a priority if it exists.
|
|
2697
2749
|
var _useState = React.useState(label != null ? label : placeholder),
|
|
2698
2750
|
hint = _useState[0],
|
|
2699
2751
|
setHint = _useState[1];
|
|
2752
|
+
// Set up a boolean state `isFocused` to track if the text field is focused.
|
|
2700
2753
|
var _useState2 = React.useState(false),
|
|
2701
2754
|
isFocused = _useState2[0],
|
|
2702
2755
|
setIsFocused = _useState2[1];
|
|
2756
|
+
// Introduce a boolean state `isHovered` for tracking mouse hover status over the text field.
|
|
2703
2757
|
var _useState3 = React.useState(false),
|
|
2704
2758
|
isHovered = _useState3[0],
|
|
2705
2759
|
setIsHovered = _useState3[1];
|
|
2760
|
+
// Manage the `value` state that holds the current value of the text field, initialized with defaultValue.
|
|
2706
2761
|
var _useState4 = React.useState(defaultValue),
|
|
2707
2762
|
value = _useState4[0],
|
|
2708
2763
|
setValue = _useState4[1];
|
|
2764
|
+
// Use `useMemo` hook to recompute hint text when any dependency changes, updating it based on focus state and presence of value.
|
|
2709
2765
|
React.useMemo(function () {
|
|
2766
|
+
// Update the `hint` state depending on whether the text field is focused and if value is not present, falling back to placeholder or label.
|
|
2710
2767
|
setHint(isFocused && !value ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
2768
|
+
// Specify the dependencies for the `useMemo` hook - updating the `hint` text when value, isFocused, label, or placeholder changes.
|
|
2711
2769
|
}, [value, isFocused, label, placeholder]);
|
|
2770
|
+
// Return an object exposing the states and state setter functions for consumer components to use and manage the text field's UI and behavior.
|
|
2712
2771
|
return {
|
|
2713
2772
|
hint: hint,
|
|
2714
2773
|
setHint: setHint,
|
|
@@ -2815,12 +2874,10 @@
|
|
|
2815
2874
|
};
|
|
2816
2875
|
var handleChange = function handleChange(event) {
|
|
2817
2876
|
if (typeof event === 'string') {
|
|
2818
|
-
//for ios and android
|
|
2819
2877
|
setValue(event);
|
|
2820
2878
|
if (onChangeText) onChangeText(event);
|
|
2821
2879
|
if (onChange) onChange(event);
|
|
2822
2880
|
} else {
|
|
2823
|
-
//Web
|
|
2824
2881
|
setValue(event.target.value);
|
|
2825
2882
|
if (onChangeText) onChangeText(event.target.value);
|
|
2826
2883
|
if (onChange) onChange(event.target.value);
|
|
@@ -2828,7 +2885,6 @@
|
|
|
2828
2885
|
};
|
|
2829
2886
|
var handleClear = function handleClear() {
|
|
2830
2887
|
setValue('');
|
|
2831
|
-
//Web
|
|
2832
2888
|
if (onChange) {
|
|
2833
2889
|
onBlur({
|
|
2834
2890
|
target: {
|
|
@@ -2838,7 +2894,6 @@
|
|
|
2838
2894
|
if (onChangeText) onChangeText('');
|
|
2839
2895
|
if (onChange) onChange('');
|
|
2840
2896
|
}
|
|
2841
|
-
//for ios and android
|
|
2842
2897
|
if (typeof document === 'undefined' && onChangeText) onChangeText('');
|
|
2843
2898
|
};
|
|
2844
2899
|
return React__default.createElement(FieldContainer, {
|
|
@@ -2888,12 +2943,12 @@
|
|
|
2888
2943
|
};
|
|
2889
2944
|
|
|
2890
2945
|
var TextFieldComponent = function TextFieldComponent(props) {
|
|
2946
|
+
// Initializes the 'textFieldStates' with state-management logic and relevant properties from 'useTextFieldState' hook, passing current 'props' as the argument
|
|
2891
2947
|
var textFieldStates = useTextFieldState(props);
|
|
2948
|
+
// Renders the 'TextFieldView' component with the spread attributes from both 'textFieldStates' and 'props' to pass all necessary data
|
|
2892
2949
|
return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
|
|
2893
2950
|
};
|
|
2894
|
-
|
|
2895
|
-
* TextField is used to capture text data from users.
|
|
2896
|
-
*/
|
|
2951
|
+
// Exports 'TextFieldComponent' as 'TextField' for use in other parts of the application
|
|
2897
2952
|
var TextField = TextFieldComponent;
|
|
2898
2953
|
|
|
2899
2954
|
var useCheckboxState = function useCheckboxState(_ref) {
|
|
@@ -4530,6 +4585,7 @@
|
|
|
4530
4585
|
}
|
|
4531
4586
|
];
|
|
4532
4587
|
|
|
4588
|
+
// Defines a custom hook for managing the CountryPicker component's state, including options from a country list, selected value, and UI states for hiding, focus, and hover.
|
|
4533
4589
|
var useCountryPickerState = function useCountryPickerState(_ref) {
|
|
4534
4590
|
var placeholder = _ref.placeholder;
|
|
4535
4591
|
var _React$useState = React__default.useState(countryList),
|
|
@@ -4561,6 +4617,7 @@
|
|
|
4561
4617
|
};
|
|
4562
4618
|
};
|
|
4563
4619
|
|
|
4620
|
+
// Defines the size of icons based on predefined size categories to maintain design consistency.
|
|
4564
4621
|
var IconSizes$4 = {
|
|
4565
4622
|
xs: 8,
|
|
4566
4623
|
sm: 10,
|
|
@@ -4746,9 +4803,6 @@
|
|
|
4746
4803
|
onBlur(event);
|
|
4747
4804
|
setIsFocused(false);
|
|
4748
4805
|
};
|
|
4749
|
-
// useEffect(() => {
|
|
4750
|
-
// if (onChange) onChange(value); // Call onChange when valueCountry changes
|
|
4751
|
-
// }, [onChange, value]);
|
|
4752
4806
|
var isWithLabel = !!(isFocused && label);
|
|
4753
4807
|
var fieldStyles = _extends({
|
|
4754
4808
|
margin: 0,
|
|
@@ -4822,13 +4876,14 @@
|
|
|
4822
4876
|
}));
|
|
4823
4877
|
};
|
|
4824
4878
|
|
|
4879
|
+
// Defines the CountryPickerComponent as a functional component with type 'React.FC' that takes 'CountryPickerProps' as props.
|
|
4825
4880
|
var CountryPickerComponent = function CountryPickerComponent(props) {
|
|
4881
|
+
// Invokes the 'useCountryPickerState' hook to obtain state and methods related to country picking functionality.
|
|
4826
4882
|
var countryPickerStates = useCountryPickerState(props);
|
|
4883
|
+
// Renders the CountryPickerView component passing in state and props for dynamic UI representation.
|
|
4827
4884
|
return React__default.createElement(CountryPickerView, Object.assign({}, countryPickerStates, props));
|
|
4828
4885
|
};
|
|
4829
|
-
|
|
4830
|
-
* Country picker allows users to select a country from a dropdown list or search field.
|
|
4831
|
-
*/
|
|
4886
|
+
// Exports the CountryPickerComponent for use in other parts of the application as 'CountryPicker'.
|
|
4832
4887
|
var CountryPicker = CountryPickerComponent;
|
|
4833
4888
|
|
|
4834
4889
|
var useDatePickerState = function useDatePickerState() {
|
|
@@ -6013,7 +6068,7 @@
|
|
|
6013
6068
|
padding: 0,
|
|
6014
6069
|
margin: 0,
|
|
6015
6070
|
filter: "none",
|
|
6016
|
-
|
|
6071
|
+
width: 0
|
|
6017
6072
|
});
|
|
6018
6073
|
return React__default.createElement(Horizontal, Object.assign({
|
|
6019
6074
|
justifyContent: buttonPosition === 'none' ? 'center' : 'space-between',
|