@app-studio/web 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/bot/DocuCode.d.ts +7 -2
  2. package/dist/bot/prompt/3-comment.d.ts +1 -1
  3. package/dist/components/Button/Button/Button.props.d.ts +0 -60
  4. package/dist/components/Button/Button.d.ts +0 -3
  5. package/dist/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -68
  6. package/dist/components/Form/Checkbox/examples/index.d.ts +1 -0
  7. package/dist/components/Form/Checkbox/examples/infoText.d.ts +2 -0
  8. package/dist/components/Form/DatePicker/examples/index.d.ts +2 -2
  9. package/dist/components/Form/Label/Label/Label.props.d.ts +0 -24
  10. package/dist/components/Form/Select/Select/Select.props.d.ts +1 -0
  11. package/dist/components/Form/Select/Select/Select.state.d.ts +2 -0
  12. package/dist/components/Form/Select/examples/Color.d.ts +1 -1
  13. package/dist/components/Form/Select/examples/index.d.ts +1 -0
  14. package/dist/components/Form/Select/examples/isScrollable.d.ts +2 -0
  15. package/dist/components/Form/TextField/examples/index.d.ts +1 -1
  16. package/dist/web.cjs.development.js +340 -186
  17. package/dist/web.cjs.development.js.map +1 -1
  18. package/dist/web.cjs.production.min.js +1 -1
  19. package/dist/web.cjs.production.min.js.map +1 -1
  20. package/dist/web.esm.js +340 -186
  21. package/dist/web.esm.js.map +1 -1
  22. package/package.json +2 -1
  23. /package/dist/components/Form/DatePicker/examples/{ErrorCheckbox.d.ts → ErrorDatePicker.d.ts} +0 -0
  24. /package/dist/components/Form/DatePicker/examples/{FormCheckout.d.ts → FormDatePicker.d.ts} +0 -0
  25. /package/dist/components/Form/TextField/examples/{colorScheme.d.ts → ColorScheme.d.ts} +0 -0
  26. /package/dist/components/Message/{examples → Examples}/action.d.ts +0 -0
  27. /package/dist/components/Message/{examples → Examples}/default.d.ts +0 -0
  28. /package/dist/components/Message/{examples → Examples}/index.d.ts +0 -0
  29. /package/dist/components/Message/{examples → Examples}/isClosable.d.ts +0 -0
  30. /package/dist/components/Message/{examples → Examples}/showIcon.d.ts +0 -0
  31. /package/dist/components/Message/{examples → Examples}/styles.d.ts +0 -0
  32. /package/dist/components/Message/{examples → Examples}/subtitle.d.ts +0 -0
  33. /package/dist/components/Message/{examples → Examples}/timeout.d.ts +0 -0
  34. /package/dist/components/Message/{examples → Examples}/title.d.ts +0 -0
  35. /package/dist/components/Message/{examples → Examples}/variant.d.ts +0 -0
@@ -8,6 +8,7 @@ var React = require('react');
8
8
  var React__default = _interopDefault(React);
9
9
  var appStudio = require('app-studio');
10
10
  var reactRouterDom = require('react-router-dom');
11
+ var Layout = require('src/components/Layout');
11
12
  var format = _interopDefault(require('date-fns/format'));
12
13
  var formik = require('formik');
13
14
  var zustand = require('zustand');
@@ -16,11 +17,15 @@ var useButtonState = function useButtonState() {
16
17
  var _React$useState = React__default.useState(false),
17
18
  isHovered = _React$useState[0],
18
19
  setIsHovered = _React$useState[1];
20
+ // This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
19
21
  return {
20
22
  isHovered: isHovered,
21
23
  setIsHovered: setIsHovered
22
24
  };
25
+ // The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
26
+ // A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
23
27
  };
28
+ // The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
24
29
 
25
30
  function _extends() {
26
31
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -600,7 +605,9 @@ var LinkComponent = function LinkComponent(props) {
600
605
  var Link = LinkComponent;
601
606
 
602
607
  var ButtonSizes = {
608
+ // Defines a constant 'ButtonSizes' as a mapping from 'Size' to corresponding 'CSSProperties'.
603
609
  xs: {
610
+ // Establishes style configuration for extra-small (xs) button size.
604
611
  width: 79,
605
612
  paddingTop: 8,
606
613
  paddingBottom: 8,
@@ -619,6 +626,7 @@ var ButtonSizes = {
619
626
  paddingRight: 16,
620
627
  fontWeight: 600,
621
628
  fontSize: 'sm',
629
+ // Establishes style configuration for medium (md) button size.
622
630
  lineHeight: 20,
623
631
  letterSpacing: 1.25
624
632
  },
@@ -628,6 +636,7 @@ var ButtonSizes = {
628
636
  paddingBottom: 12,
629
637
  paddingLeft: 18,
630
638
  paddingRight: 18,
639
+ // Establishes style configuration for large (lg) button size.
631
640
  fontWeight: 600,
632
641
  fontSize: 'md',
633
642
  lineHeight: 24,
@@ -637,6 +646,7 @@ var ButtonSizes = {
637
646
  width: 178,
638
647
  paddingTop: 14,
639
648
  paddingBottom: 14,
649
+ // Establishes style configuration for extra-large (xl) button size.
640
650
  paddingLeft: 22,
641
651
  paddingRight: 22,
642
652
  fontWeight: 600,
@@ -647,28 +657,38 @@ var ButtonSizes = {
647
657
  xl: {
648
658
  width: 220,
649
659
  paddingTop: 16,
660
+ // Defines a constant 'ButtonShapes' with style properties for different button shapes such as 'sharp', 'rounded', and 'pillShaped'.
650
661
  paddingBottom: 16,
662
+ // Sets the border-radius for a sharp-edged button shape to '0'.
651
663
  paddingLeft: 26,
664
+ // Sets the border-radius for a rounded button shape to '4'.
652
665
  paddingRight: 26,
666
+ // Sets the border-radius for a pill-shaped button to '24'.
653
667
  fontWeight: 600,
654
668
  fontSize: 'xl',
669
+ // Defines a constant 'IconSizes' as a mapping from 'Size' to corresponding 'CSSProperties' for icons.
655
670
  lineHeight: 24,
671
+ // Sets the width, height, and padding for icons of extra-small size.
656
672
  letterSpacing: 1.25
657
673
  }
658
674
  };
659
675
  var ButtonShapes = {
676
+ // Sets the width, height, and padding for icons of small size.
660
677
  sharp: 0,
661
678
  rounded: 4,
662
679
  pillShaped: 24
663
680
  };
681
+ // Sets the width, height, and padding for icons of medium size.
664
682
  var IconSizes$1 = {
665
683
  xs: {
666
684
  width: 24,
667
685
  height: 24,
686
+ // Sets the width, height, and padding for icons of large size.
668
687
  padding: 12
669
688
  },
670
689
  sm: {
671
690
  width: 24,
691
+ // Sets the width, height, and padding for icons of extra-large size.
672
692
  height: 24,
673
693
  padding: 15
674
694
  },
@@ -939,6 +959,7 @@ var ButtonView = function ButtonView(_ref) {
939
959
  var reverse = isHovered && effect === 'reverse';
940
960
  var ButtonVariants = {
941
961
  filled: {
962
+ // Defines CSS properties for 'link' variant of the button with conditional styles based on reverse state, includes text decoration.
942
963
  backgroundColor: reverse ? 'transparent' : buttonColor,
943
964
  color: reverse ? buttonColor : 'color.white',
944
965
  borderWidth: 1,
@@ -947,15 +968,20 @@ var ButtonView = function ButtonView(_ref) {
947
968
  },
948
969
  outline: {
949
970
  backgroundColor: reverse ? buttonColor : 'transparent',
971
+ // Defines CSS properties for 'ghost' variant of the button with conditional styles based on reverse state.
950
972
  borderWidth: 1,
951
973
  borderStyle: 'solid',
952
974
  borderColor: reverse ? buttonColor : colorScheme,
975
+ // Fetches size-specific styles from ButtonSizes based on the 'size' prop.
953
976
  color: reverse ? 'white' : buttonColor
954
977
  },
978
+ // Adjusts button width based on isAuto and isFilled properties, using buttonSizeStyles for fallback width.
955
979
  link: {
956
980
  backgroundColor: 'transparent',
981
+ // Changes padding for the button based on whether isIconRounded is true or false.
957
982
  borderWidth: 1,
958
983
  borderStyle: 'solid',
984
+ // Creates the content for the button including loaders and icons positioned based on their respective properties.
959
985
  borderColor: reverse ? buttonColor : 'transparent',
960
986
  color: buttonColor,
961
987
  textDecoration: reverse ? 'none' : 'underline'
@@ -968,6 +994,7 @@ var ButtonView = function ButtonView(_ref) {
968
994
  borderColor: reverse ? buttonColor : 'transparent'
969
995
  }
970
996
  };
997
+ // Executes rendering of the button or a link element based on the variant; applies conditional rendering for externalHref in 'link' variant.
971
998
  var buttonSizeStyles = ButtonSizes[size];
972
999
  var buttonVariant = ButtonVariants[variant];
973
1000
  var scaleWidth = {
@@ -1004,23 +1031,32 @@ var ButtonView = function ButtonView(_ref) {
1004
1031
  }, content) : content);
1005
1032
  };
1006
1033
 
1034
+ // Importing a custom hook to manage the state specific to the button component.
1007
1035
  var ButtonComponent = function ButtonComponent(props) {
1036
+ // Importing the view part of the button, which is presumably a presentational component.
1008
1037
  var _useButtonState = useButtonState(),
1009
1038
  isHovered = _useButtonState.isHovered,
1010
1039
  setIsHovered = _useButtonState.setIsHovered;
1040
+ // Defining the button component with generic React Functional Component type augmented with ButtonProps type.
1011
1041
  var handleHover = function handleHover() {
1012
1042
  return setIsHovered(!isHovered);
1013
1043
  };
1014
- return React__default.createElement(ButtonView, Object.assign({
1015
- isHovered: isHovered,
1016
- setIsHovered: setIsHovered,
1017
- onMouseEnter: handleHover,
1018
- onMouseLeave: handleHover
1019
- }, props));
1044
+ // Destructuring the state and state update function from the custom hook for button state management.
1045
+ return (
1046
+ // Defines a function to toggle the hover state of the button.
1047
+ React__default.createElement(ButtonView, Object.assign({
1048
+ isHovered: isHovered,
1049
+ // Rendering the ButtonView component and spreading the received props on it.
1050
+ setIsHovered: setIsHovered,
1051
+ // Passing the isHovered state and the setIsHovered function to the ButtonView.
1052
+ onMouseEnter: handleHover,
1053
+ // Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
1054
+ onMouseLeave: handleHover
1055
+ }, props))
1056
+ );
1057
+ // Exports the Button component for use in other parts of the application.
1020
1058
  };
1021
- /**
1022
- * Buttons allow us to trigger an event or an action with a single click.
1023
- */
1059
+
1024
1060
  var Button = ButtonComponent;
1025
1061
 
1026
1062
  var useCheckboxState = function useCheckboxState(_ref) {
@@ -1040,34 +1076,43 @@ var useCheckboxState = function useCheckboxState(_ref) {
1040
1076
  };
1041
1077
  };
1042
1078
 
1079
+ // Import Headings type definition from Label.type module for type safety and consistency.
1043
1080
  var HeadingSizes = {
1081
+ // Initialize a constant 'HeadingSizes' to define styles for different heading levels.
1044
1082
  h1: {
1083
+ // Use TypeScript's 'Record' utility type to ensure the object matches the shape of 'Headings'.
1045
1084
  fontSize: 96,
1085
+ // Define style properties for 'h1' heading tag, including font size, line height, and letter spacing.
1046
1086
  lineHeight: 112,
1047
1087
  letterSpacing: -1.5
1048
1088
  },
1049
1089
  h2: {
1050
1090
  fontSize: 60,
1091
+ // Define style properties for 'h2' heading tag similar to 'h1', but with adjusted values for size and spacing.
1051
1092
  lineHeight: 71,
1052
1093
  letterSpacing: -0.5
1053
1094
  },
1054
1095
  h3: {
1055
1096
  fontSize: 48,
1097
+ // Define style properties for 'h3' heading tag with a standard letter spacing of 0.
1056
1098
  lineHeight: 57,
1057
1099
  letterSpacing: 0
1058
1100
  },
1059
1101
  h4: {
1060
1102
  fontSize: 34,
1103
+ // Provide style properties for 'h4' heading tag, with a slight increase in letter spacing.
1061
1104
  lineHeight: 40,
1062
1105
  letterSpacing: 0.25
1063
1106
  },
1064
1107
  h5: {
1065
1108
  fontSize: 24,
1109
+ // Set the 'h5' heading tag styles, opting for no additional letter spacing.
1066
1110
  lineHeight: 28,
1067
1111
  letterSpacing: 0
1068
1112
  },
1069
1113
  h6: {
1070
1114
  fontSize: 20,
1115
+ // Set the 'h6' heading tag styles, with the smallest font size and a subtle letter spacing.
1071
1116
  lineHeight: 24,
1072
1117
  letterSpacing: 0.15
1073
1118
  }
@@ -1088,21 +1133,36 @@ var LabelView = function LabelView(_ref) {
1088
1133
  _ref$size = _ref.size,
1089
1134
  size = _ref$size === void 0 ? 'sm' : _ref$size,
1090
1135
  props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
1136
+ // The fontStyle prop toggles between 'italic' and 'normal' based on the 'isItalic' boolean prop.
1091
1137
  var headingStyles = heading ? HeadingSizes[heading] : {};
1092
- return React__default.createElement(appStudio.Element, Object.assign({
1093
- as: "label",
1094
- width: "100%",
1095
- fontSize: size,
1096
- fontStyle: isItalic ? 'italic' : 'normal',
1097
- fontWeight: appStudio.Typography.fontWeights[weight],
1098
- textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
1099
- }, headingStyles, props), children);
1138
+ // fontWeight is derived from the Typography module, ensuring consistent font weighting across the app.
1139
+ return (
1140
+ // textDecoration conditionally applies 'line-through' or 'underline' based on respective boolean props; defaults to 'none' if both are false.
1141
+ React__default.createElement(appStudio.Element, Object.assign({
1142
+ as: "label",
1143
+ // Spreads any additional style properties from headingStyles into the Element if a heading size is specified.
1144
+ width: "100%",
1145
+ // Spreads the rest of the props to support extensibility of the LabelView component for future use cases.
1146
+ fontSize: size,
1147
+ // Includes children elements inside the Element, allowing for nested content within the label.
1148
+ fontStyle: isItalic ? 'italic' : 'normal',
1149
+ fontWeight: appStudio.Typography.fontWeights[weight],
1150
+ textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
1151
+ }, headingStyles, props), children)
1152
+ );
1100
1153
  };
1101
1154
 
1155
+ // Import custom type 'LabelProps' to type check the properties passed into the Label component.
1102
1156
  var LabelComponent = function LabelComponent(props) {
1103
- return React__default.createElement(LabelView, Object.assign({}, props));
1157
+ return (
1158
+ // Import 'LabelView' as a visual component for the label, separating the view from business logic.
1159
+ React__default.createElement(LabelView, Object.assign({}, props))
1160
+ // Define 'LabelComponent' as a functional component that uses React's FC type for type checking and utilizing React features.
1161
+ );
1104
1162
  };
1163
+ // Pass all properties received by 'LabelComponent' to 'LabelView' using the spread syntax, ensuring it has all props needed for rendering.
1105
1164
  var Label = LabelComponent;
1165
+ // Export the 'LabelComponent' as 'Label' to be reused throughout the project.
1106
1166
 
1107
1167
  var Sizes = {
1108
1168
  xs: {
@@ -1159,7 +1219,134 @@ var IconSizes$2 = {
1159
1219
  '6xl': 60
1160
1220
  };
1161
1221
 
1162
- var _excluded$i = ["id", "icon", "name", "label", "isChecked", "onChange", "onValueChange", "shadow", "labelPosition", "size", "colorScheme", "error", "isSelected", "isHovered", "isDisabled", "isReadOnly", "isIndeterminate", "defaultIsSelected", "setIsSelected", "setIsHovered", "styles"];
1222
+ var HeadingSizes$1 = {
1223
+ h1: {
1224
+ fontSize: 96,
1225
+ lineHeight: 112,
1226
+ letterSpacing: -1.5
1227
+ },
1228
+ h2: {
1229
+ fontSize: 60,
1230
+ lineHeight: 71,
1231
+ letterSpacing: -0.5
1232
+ },
1233
+ h3: {
1234
+ fontSize: 48,
1235
+ lineHeight: 57,
1236
+ letterSpacing: 0
1237
+ },
1238
+ h4: {
1239
+ fontSize: 34,
1240
+ lineHeight: 40,
1241
+ letterSpacing: 0.25
1242
+ },
1243
+ h5: {
1244
+ fontSize: 24,
1245
+ lineHeight: 28,
1246
+ letterSpacing: 0
1247
+ },
1248
+ h6: {
1249
+ fontSize: 20,
1250
+ lineHeight: 24,
1251
+ letterSpacing: 0.15
1252
+ }
1253
+ };
1254
+
1255
+ var _excluded$i = ["children", "heading", "maxLines", "isItalic", "isUnderlined", "isSub", "isSup", "isStriked", "isTruncated", "weight", "size"];
1256
+ var TextContent = function TextContent(_ref) {
1257
+ var children = _ref.children,
1258
+ isSub = _ref.isSub,
1259
+ isSup = _ref.isSup;
1260
+ return React__default.createElement(React__default.Fragment, null, typeof children === 'string' ? React__default.createElement(React__default.Fragment, null, isSub && React__default.createElement("sup", null, children), isSup && React__default.createElement("sup", null, children), !isSub && !isSup && React__default.createElement(React__default.Fragment, null, children)) : children);
1261
+ };
1262
+ var TruncateText = function TruncateText(_ref2) {
1263
+ var text = _ref2.text,
1264
+ _ref2$maxLines = _ref2.maxLines,
1265
+ maxLines = _ref2$maxLines === void 0 ? 1 : _ref2$maxLines;
1266
+ var containerRef = React.useRef(null);
1267
+ var _useState = React.useState(text.length),
1268
+ truncatedLength = _useState[0],
1269
+ setTruncatedLength = _useState[1];
1270
+ React.useEffect(function () {
1271
+ var textNode = containerRef.current;
1272
+ if (!textNode) return;
1273
+ var updateTruncatedText = function updateTruncatedText() {
1274
+ var comLineHeight = getComputedStyle(textNode).lineHeight;
1275
+ var lineHeight = comLineHeight !== 'normal' ? parseFloat(comLineHeight) : 20;
1276
+ var maxHeight = lineHeight * maxLines;
1277
+ var start = 0;
1278
+ var end = text.length;
1279
+ var middle;
1280
+ while (start <= end) {
1281
+ middle = Math.floor((start + end) / 2);
1282
+ textNode.innerText = text.substring(0, middle) + '...';
1283
+ var currentHeight = textNode.offsetHeight;
1284
+ if (currentHeight > maxHeight) {
1285
+ end = middle - 1;
1286
+ } else {
1287
+ start = middle + 1;
1288
+ }
1289
+ }
1290
+ setTruncatedLength(end);
1291
+ };
1292
+ updateTruncatedText();
1293
+ }, [text, maxLines]);
1294
+ var displayText = text.length > truncatedLength ? text.substring(0, truncatedLength) + '...' : text;
1295
+ return React__default.createElement("div", {
1296
+ ref: containerRef
1297
+ }, displayText);
1298
+ };
1299
+ var TextView = function TextView(_ref3) {
1300
+ var children = _ref3.children,
1301
+ heading = _ref3.heading,
1302
+ maxLines = _ref3.maxLines,
1303
+ _ref3$isItalic = _ref3.isItalic,
1304
+ isItalic = _ref3$isItalic === void 0 ? false : _ref3$isItalic,
1305
+ _ref3$isUnderlined = _ref3.isUnderlined,
1306
+ isUnderlined = _ref3$isUnderlined === void 0 ? false : _ref3$isUnderlined,
1307
+ _ref3$isSub = _ref3.isSub,
1308
+ isSub = _ref3$isSub === void 0 ? false : _ref3$isSub,
1309
+ _ref3$isSup = _ref3.isSup,
1310
+ isSup = _ref3$isSup === void 0 ? false : _ref3$isSup,
1311
+ _ref3$isStriked = _ref3.isStriked,
1312
+ isStriked = _ref3$isStriked === void 0 ? false : _ref3$isStriked,
1313
+ _ref3$isTruncated = _ref3.isTruncated,
1314
+ isTruncated = _ref3$isTruncated === void 0 ? false : _ref3$isTruncated,
1315
+ _ref3$weight = _ref3.weight,
1316
+ weight = _ref3$weight === void 0 ? 'normal' : _ref3$weight,
1317
+ _ref3$size = _ref3.size,
1318
+ size = _ref3$size === void 0 ? 'md' : _ref3$size,
1319
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded$i);
1320
+ var headingStyles = heading ? HeadingSizes$1[heading] : {};
1321
+ var noLineBreak = isSub || isSup ? {
1322
+ display: 'inline'
1323
+ } : {};
1324
+ var fontSize = appStudio.Typography.fontSizes[size];
1325
+ return React__default.createElement(appStudio.Element, Object.assign({
1326
+ role: "text",
1327
+ fontSize: fontSize,
1328
+ lineHeight: appStudio.Typography.lineHeights[size],
1329
+ fontStyle: isItalic ? 'italic' : 'normal',
1330
+ fontWeight: appStudio.Typography.fontWeights[weight],
1331
+ textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
1332
+ }, noLineBreak, headingStyles, props), isTruncated && maxLines && typeof children === 'string' ? React__default.createElement(TruncateText, {
1333
+ text: children,
1334
+ maxLines: maxLines
1335
+ }) : React__default.createElement(TextContent, Object.assign({
1336
+ isSub: isSub,
1337
+ isSup: isSup
1338
+ }, props), children));
1339
+ };
1340
+
1341
+ var TextComponent = function TextComponent(props) {
1342
+ return React__default.createElement(TextView, Object.assign({}, props));
1343
+ };
1344
+ /**
1345
+ * The Text component is a simple component that renders a text string or paragraphs as a DOM element in the UI. It is a <p> tag by default.
1346
+ */
1347
+ var Text = TextComponent;
1348
+
1349
+ var _excluded$j = ["id", "icon", "name", "label", "isChecked", "onChange", "onValueChange", "shadow", "labelPosition", "size", "colorScheme", "error", "isSelected", "isHovered", "isDisabled", "isReadOnly", "isIndeterminate", "defaultIsSelected", "setIsSelected", "setIsHovered", "styles", "infoText"];
1163
1350
  var CheckboxView = function CheckboxView(_ref) {
1164
1351
  var id = _ref.id,
1165
1352
  icon = _ref.icon,
@@ -1196,7 +1383,8 @@ var CheckboxView = function CheckboxView(_ref) {
1196
1383
  checkbox: {},
1197
1384
  label: {}
1198
1385
  } : _ref$styles,
1199
- props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
1386
+ infoText = _ref.infoText,
1387
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
1200
1388
  var handleHover = function handleHover() {
1201
1389
  return setIsHovered(!isHovered);
1202
1390
  };
@@ -1237,9 +1425,22 @@ var CheckboxView = function CheckboxView(_ref) {
1237
1425
  onMouseEnter: handleHover,
1238
1426
  onMouseLeave: handleHover,
1239
1427
  size: appStudio.Typography.fontSizes[size]
1240
- }, checkboxStyle.container, props), labelPosition === 'left' && label && React__default.createElement(appStudio.View, null, label), React__default.createElement(Center, Object.assign({}, checkboxStyle.checkbox), isIndeterminate ? React__default.createElement(IndeterminateSvg, null) : (isChecked || isSelected) && (icon != null ? icon : React__default.createElement(CheckSvg, {
1428
+ }, checkboxStyle.container, props), React__default.createElement(Layout.Vertical, {
1429
+ gap: 8
1430
+ }, React__default.createElement(Layout.Horizontal, {
1431
+ gap: 10,
1432
+ alignItems: "center"
1433
+ }, labelPosition === 'left' && label && React__default.createElement(Text, Object.assign({
1434
+ size: size
1435
+ }, styles == null ? void 0 : styles.label), label), React__default.createElement(Center, Object.assign({}, checkboxStyle.checkbox), isIndeterminate ? React__default.createElement(IndeterminateSvg, null) : (isChecked || isSelected) && (icon != null ? icon : React__default.createElement(CheckSvg, {
1241
1436
  size: IconSizes$2[size]
1242
- }))), labelPosition === 'right' && label && React__default.createElement(appStudio.View, null, label));
1437
+ }))), labelPosition === 'right' && label && React__default.createElement(Text, Object.assign({
1438
+ size: size
1439
+ }, styles == null ? void 0 : styles.label), label)), infoText && React__default.createElement(Text, Object.assign({
1440
+ marginLeft: labelPosition === 'left' ? 0 : 27,
1441
+ color: "color.gray.400",
1442
+ size: "sm"
1443
+ }, styles == null ? void 0 : styles.infoText), infoText)));
1243
1444
  };
1244
1445
 
1245
1446
  var CheckboxComponent = function CheckboxComponent(props) {
@@ -2737,133 +2938,6 @@ var useCountryPickerState = function useCountryPickerState(_ref) {
2737
2938
  };
2738
2939
  };
2739
2940
 
2740
- var HeadingSizes$1 = {
2741
- h1: {
2742
- fontSize: 96,
2743
- lineHeight: 112,
2744
- letterSpacing: -1.5
2745
- },
2746
- h2: {
2747
- fontSize: 60,
2748
- lineHeight: 71,
2749
- letterSpacing: -0.5
2750
- },
2751
- h3: {
2752
- fontSize: 48,
2753
- lineHeight: 57,
2754
- letterSpacing: 0
2755
- },
2756
- h4: {
2757
- fontSize: 34,
2758
- lineHeight: 40,
2759
- letterSpacing: 0.25
2760
- },
2761
- h5: {
2762
- fontSize: 24,
2763
- lineHeight: 28,
2764
- letterSpacing: 0
2765
- },
2766
- h6: {
2767
- fontSize: 20,
2768
- lineHeight: 24,
2769
- letterSpacing: 0.15
2770
- }
2771
- };
2772
-
2773
- var _excluded$j = ["children", "heading", "maxLines", "isItalic", "isUnderlined", "isSub", "isSup", "isStriked", "isTruncated", "weight", "size"];
2774
- var TextContent = function TextContent(_ref) {
2775
- var children = _ref.children,
2776
- isSub = _ref.isSub,
2777
- isSup = _ref.isSup;
2778
- return React__default.createElement(React__default.Fragment, null, typeof children === 'string' ? React__default.createElement(React__default.Fragment, null, isSub && React__default.createElement("sup", null, children), isSup && React__default.createElement("sup", null, children), !isSub && !isSup && React__default.createElement(React__default.Fragment, null, children)) : children);
2779
- };
2780
- var TruncateText = function TruncateText(_ref2) {
2781
- var text = _ref2.text,
2782
- _ref2$maxLines = _ref2.maxLines,
2783
- maxLines = _ref2$maxLines === void 0 ? 1 : _ref2$maxLines;
2784
- var containerRef = React.useRef(null);
2785
- var _useState = React.useState(text.length),
2786
- truncatedLength = _useState[0],
2787
- setTruncatedLength = _useState[1];
2788
- React.useEffect(function () {
2789
- var textNode = containerRef.current;
2790
- if (!textNode) return;
2791
- var updateTruncatedText = function updateTruncatedText() {
2792
- var comLineHeight = getComputedStyle(textNode).lineHeight;
2793
- var lineHeight = comLineHeight !== 'normal' ? parseFloat(comLineHeight) : 20;
2794
- var maxHeight = lineHeight * maxLines;
2795
- var start = 0;
2796
- var end = text.length;
2797
- var middle;
2798
- while (start <= end) {
2799
- middle = Math.floor((start + end) / 2);
2800
- textNode.innerText = text.substring(0, middle) + '...';
2801
- var currentHeight = textNode.offsetHeight;
2802
- if (currentHeight > maxHeight) {
2803
- end = middle - 1;
2804
- } else {
2805
- start = middle + 1;
2806
- }
2807
- }
2808
- setTruncatedLength(end);
2809
- };
2810
- updateTruncatedText();
2811
- }, [text, maxLines]);
2812
- var displayText = text.length > truncatedLength ? text.substring(0, truncatedLength) + '...' : text;
2813
- return React__default.createElement("div", {
2814
- ref: containerRef
2815
- }, displayText);
2816
- };
2817
- var TextView = function TextView(_ref3) {
2818
- var children = _ref3.children,
2819
- heading = _ref3.heading,
2820
- maxLines = _ref3.maxLines,
2821
- _ref3$isItalic = _ref3.isItalic,
2822
- isItalic = _ref3$isItalic === void 0 ? false : _ref3$isItalic,
2823
- _ref3$isUnderlined = _ref3.isUnderlined,
2824
- isUnderlined = _ref3$isUnderlined === void 0 ? false : _ref3$isUnderlined,
2825
- _ref3$isSub = _ref3.isSub,
2826
- isSub = _ref3$isSub === void 0 ? false : _ref3$isSub,
2827
- _ref3$isSup = _ref3.isSup,
2828
- isSup = _ref3$isSup === void 0 ? false : _ref3$isSup,
2829
- _ref3$isStriked = _ref3.isStriked,
2830
- isStriked = _ref3$isStriked === void 0 ? false : _ref3$isStriked,
2831
- _ref3$isTruncated = _ref3.isTruncated,
2832
- isTruncated = _ref3$isTruncated === void 0 ? false : _ref3$isTruncated,
2833
- _ref3$weight = _ref3.weight,
2834
- weight = _ref3$weight === void 0 ? 'normal' : _ref3$weight,
2835
- _ref3$size = _ref3.size,
2836
- size = _ref3$size === void 0 ? 'md' : _ref3$size,
2837
- props = _objectWithoutPropertiesLoose(_ref3, _excluded$j);
2838
- var headingStyles = heading ? HeadingSizes$1[heading] : {};
2839
- var noLineBreak = isSub || isSup ? {
2840
- display: 'inline'
2841
- } : {};
2842
- var fontSize = appStudio.Typography.fontSizes[size];
2843
- return React__default.createElement(appStudio.Element, Object.assign({
2844
- role: "text",
2845
- fontSize: fontSize,
2846
- lineHeight: appStudio.Typography.lineHeights[size],
2847
- fontStyle: isItalic ? 'italic' : 'normal',
2848
- fontWeight: appStudio.Typography.fontWeights[weight],
2849
- textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
2850
- }, noLineBreak, headingStyles, props), isTruncated && maxLines && typeof children === 'string' ? React__default.createElement(TruncateText, {
2851
- text: children,
2852
- maxLines: maxLines
2853
- }) : React__default.createElement(TextContent, Object.assign({
2854
- isSub: isSub,
2855
- isSup: isSup
2856
- }, props), children));
2857
- };
2858
-
2859
- var TextComponent = function TextComponent(props) {
2860
- return React__default.createElement(TextView, Object.assign({}, props));
2861
- };
2862
- /**
2863
- * The Text component is a simple component that renders a text string or paragraphs as a DOM element in the UI. It is a <p> tag by default.
2864
- */
2865
- var Text = TextComponent;
2866
-
2867
2941
  var _excluded$k = ["children", "styles"];
2868
2942
  var HelperText = function HelperText(_ref) {
2869
2943
  var children = _ref.children,
@@ -3417,7 +3491,7 @@ var DatePickerView = function DatePickerView(_ref) {
3417
3491
  if (onChangeText) onChangeText(event);
3418
3492
  } else {
3419
3493
  setDate(event.target.value);
3420
- if (onChange) onChange(event);
3494
+ if (onChange) onChange(event.target.value);
3421
3495
  }
3422
3496
  };
3423
3497
  var fieldStyles = _extends({
@@ -3467,14 +3541,16 @@ var DatePickerView = function DatePickerView(_ref) {
3467
3541
  }, styles), label), React__default.createElement(DatePickerContent, Object.assign({
3468
3542
  id: id,
3469
3543
  name: name,
3470
- value: date,
3471
3544
  onFocus: handleFocus,
3472
- onChange: handleDateChange,
3473
3545
  disabled: isDisabled,
3474
3546
  readOnly: isReadOnly
3475
- }, fieldStyles, onChangeText && {
3547
+ }, fieldStyles, props, {
3548
+ value: date
3549
+ }, onChangeText && {
3476
3550
  onChangeText: handleDateChange
3477
- }, props)))));
3551
+ }, {
3552
+ onChange: handleDateChange
3553
+ })))));
3478
3554
  };
3479
3555
 
3480
3556
  var DatePickerComponent = function DatePickerComponent(props) {
@@ -3744,6 +3820,9 @@ var useSelectState = function useSelectState(_ref) {
3744
3820
  var _React$useState4 = React__default.useState(defaultValue),
3745
3821
  value = _React$useState4[0],
3746
3822
  setValue = _React$useState4[1];
3823
+ var _React$useState5 = React__default.useState(0),
3824
+ highlightedIndex = _React$useState5[0],
3825
+ setHighlightedIndex = _React$useState5[1];
3747
3826
  return {
3748
3827
  value: value,
3749
3828
  setValue: setValue,
@@ -3752,13 +3831,15 @@ var useSelectState = function useSelectState(_ref) {
3752
3831
  isHovered: isHovered,
3753
3832
  setIsHovered: setIsHovered,
3754
3833
  isFocused: isFocused,
3755
- setIsFocused: setIsFocused
3834
+ setIsFocused: setIsFocused,
3835
+ highlightedIndex: highlightedIndex,
3836
+ setHighlightedIndex: setHighlightedIndex
3756
3837
  };
3757
3838
  };
3758
3839
  var useItemState = function useItemState() {
3759
- var _React$useState5 = React__default.useState(false),
3760
- isHovered = _React$useState5[0],
3761
- setIsHovered = _React$useState5[1];
3840
+ var _React$useState6 = React__default.useState(false),
3841
+ isHovered = _React$useState6[0],
3842
+ setIsHovered = _React$useState6[1];
3762
3843
  return {
3763
3844
  isHovered: isHovered,
3764
3845
  setIsHovered: setIsHovered
@@ -3776,7 +3857,7 @@ var IconSizes$4 = {
3776
3857
  var _excluded$v = ["isHovered", "setIsHovered", "option", "size", "callback"],
3777
3858
  _excluded2$2 = ["id", "name", "value", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
3778
3859
  _excluded3$1 = ["option", "size", "removeOption"],
3779
- _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"];
3860
+ _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"];
3780
3861
  var Item = function Item(_ref) {
3781
3862
  var isHovered = _ref.isHovered,
3782
3863
  setIsHovered = _ref.setIsHovered,
@@ -3792,11 +3873,10 @@ var Item = function Item(_ref) {
3792
3873
  var handleHover = function handleHover() {
3793
3874
  return setIsHovered(!isHovered);
3794
3875
  };
3795
- console.log(props.name);
3796
3876
  return React__default.createElement(appStudio.Element, Object.assign({
3797
3877
  as: "li",
3798
3878
  margin: 0,
3799
- paddingVertical: 8,
3879
+ paddingVertical: 10,
3800
3880
  paddingHorizontal: 12,
3801
3881
  listStyleType: "none",
3802
3882
  onMouseEnter: handleHover,
@@ -3806,7 +3886,7 @@ var Item = function Item(_ref) {
3806
3886
  return handleOptionClick(option);
3807
3887
  },
3808
3888
  backgroundColor: isHovered ? 'trueGray.100' : 'transparent'
3809
- }, props), option);
3889
+ }, props), React__default.createElement(Text, null, " ", option));
3810
3890
  };
3811
3891
  var SelectBox = function SelectBox(_ref2) {
3812
3892
  var _ref2$size = _ref2.size,
@@ -3888,7 +3968,9 @@ var DropDown$1 = function DropDown(_ref4) {
3888
3968
  } : _ref4$styles,
3889
3969
  options = _ref4.options,
3890
3970
  _ref4$callback = _ref4.callback,
3891
- callback = _ref4$callback === void 0 ? function () {} : _ref4$callback;
3971
+ callback = _ref4$callback === void 0 ? function () {} : _ref4$callback,
3972
+ highlightedIndex = _ref4.highlightedIndex,
3973
+ setHighlightedIndex = _ref4.setHighlightedIndex;
3892
3974
  var itemStates = useItemState();
3893
3975
  var handleCallback = function handleCallback(option) {
3894
3976
  return callback(option);
@@ -3911,8 +3993,8 @@ var DropDown$1 = function DropDown(_ref4) {
3911
3993
  top: "100%",
3912
3994
  width: "100%",
3913
3995
  display: "flex",
3914
- zIndex: 1000,
3915
- overflowY: "auto",
3996
+ zIndex: 100000,
3997
+ overflowY: "scroll",
3916
3998
  marginTop: 5,
3917
3999
  marginLeft: 0,
3918
4000
  marginRight: 0,
@@ -3922,13 +4004,24 @@ var DropDown$1 = function DropDown(_ref4) {
3922
4004
  position: "absolute",
3923
4005
  flexDirection: "column",
3924
4006
  backgroundColor: "white",
3925
- justifyContent: "space-evenly"
3926
- }, shadow, styles['dropDown']), options.map(function (option) {
4007
+ maxHeight: "200px",
4008
+ style: {
4009
+ scrollbarWidth: 'none' /* For Firefox */,
4010
+ msOverflowStyle: 'none' /* For Internet Explorer and Edge */,
4011
+ '&::-webkit-scrollbar': {
4012
+ display: 'none' /* For Chrome, Safari, and Opera */
4013
+ }
4014
+ }
4015
+ }, shadow, styles['dropDown']), options.map(function (option, index) {
3927
4016
  return React__default.createElement(Item, Object.assign({
3928
4017
  key: option,
3929
4018
  size: size,
3930
4019
  option: option,
3931
- callback: handleCallback
4020
+ callback: handleCallback,
4021
+ backgroundColor: index === highlightedIndex ? 'color.gray.100' : 'transparent',
4022
+ onMouseEnter: function onMouseEnter() {
4023
+ return setHighlightedIndex(index);
4024
+ }
3932
4025
  }, itemStates, styles['text']));
3933
4026
  }));
3934
4027
  };
@@ -4013,6 +4106,8 @@ var SelectView = function SelectView(_ref6) {
4013
4106
  setIsHovered = _ref6$setIsHovered === void 0 ? function () {} : _ref6$setIsHovered,
4014
4107
  _ref6$setIsFocused = _ref6.setIsFocused,
4015
4108
  setIsFocused = _ref6$setIsFocused === void 0 ? function () {} : _ref6$setIsFocused,
4109
+ setHighlightedIndex = _ref6.setHighlightedIndex,
4110
+ highlightedIndex = _ref6.highlightedIndex,
4016
4111
  props = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);
4017
4112
  var isWithLabel = !!(isFocused && label);
4018
4113
  var handleHover = function handleHover() {
@@ -4100,7 +4195,9 @@ var SelectView = function SelectView(_ref6) {
4100
4195
  size: size,
4101
4196
  styles: styles,
4102
4197
  options: options,
4103
- callback: handleCallback
4198
+ callback: handleCallback,
4199
+ highlightedIndex: highlightedIndex,
4200
+ setHighlightedIndex: setHighlightedIndex
4104
4201
  }));
4105
4202
  };
4106
4203
 
@@ -4790,27 +4887,32 @@ var PasswordComponent$1 = function PasswordComponent(_ref) {
4790
4887
  */
4791
4888
  var FormikPassword = PasswordComponent$1;
4792
4889
 
4793
- // Import the necessary types
4794
- // Define the useComboBoxState hook properly with types
4890
+ // Defines the useComboBoxState hook with parameters for the list of items and optional placeholder texts.
4795
4891
  var useComboBoxState = function useComboBoxState(items, placeholder, searchPlaceholder) {
4892
+ // State hook for filtered items with initial state set to the items passed to the hook.
4796
4893
  var _useState = React.useState(items),
4797
4894
  filteredItems = _useState[0],
4798
4895
  setFilteredItems = _useState[1];
4896
+ // State hook to track the selected item with an initial state based on the placeholder or the first item.
4799
4897
  var _useState2 = React.useState(placeholder ? {
4800
4898
  value: placeholder,
4801
4899
  label: placeholder
4802
4900
  } : items[0]),
4803
4901
  selectedItem = _useState2[0],
4804
4902
  setSelectedItem = _useState2[1];
4903
+ // State hook for highlighted index in the dropdown list, initialized to 0.
4805
4904
  var _useState3 = React.useState(0),
4806
4905
  highlightedIndex = _useState3[0],
4807
4906
  setHighlightedIndex = _useState3[1];
4907
+ // State hook for search query with an initial state based on the searchPlaceholder or empty string.
4808
4908
  var _useState4 = React.useState(searchPlaceholder != null ? searchPlaceholder : ''),
4809
4909
  searchQuery = _useState4[0],
4810
4910
  setSearchQuery = _useState4[1];
4911
+ // State hook to manage dropdown visibility, starts as false (hidden).
4811
4912
  var _useState5 = React.useState(false),
4812
4913
  isDropdownVisible = _useState5[0],
4813
4914
  setIsDropdownVisible = _useState5[1];
4915
+ // Start of object returned by the useComboBoxState hook containing all state and state updater functions.
4814
4916
  return {
4815
4917
  filteredItems: filteredItems,
4816
4918
  setFilteredItems: setFilteredItems,
@@ -4891,6 +4993,7 @@ var SearchLoopSvg = function SearchLoopSvg(_ref) {
4891
4993
  };
4892
4994
 
4893
4995
  var _excluded$E = ["placeholder", "items", "showTick", "onSelect", "searchEnabled", "left", "right", "label", "filteredItems", "setSelectedItem", "selectedItem", "highlightedIndex", "setHighlightedIndex", "searchQuery", "setSearchQuery", "setFilteredItems", "styles", "isDropdownVisible", "setIsDropdownVisible"];
4996
+ // Defines the functional component 'ComboBoxView' with destructured props.
4894
4997
  var ComboBoxView = function ComboBoxView(_ref) {
4895
4998
  var placeholder = _ref.placeholder,
4896
4999
  items = _ref.items,
@@ -4914,6 +5017,7 @@ var ComboBoxView = function ComboBoxView(_ref) {
4914
5017
  isDropdownVisible = _ref.isDropdownVisible,
4915
5018
  setIsDropdownVisible = _ref.setIsDropdownVisible,
4916
5019
  props = _objectWithoutPropertiesLoose(_ref, _excluded$E);
5020
+ // Sets up an effect to handle clicking outside the dropdown to close it.
4917
5021
  React.useEffect(function () {
4918
5022
  var handleClickOutside = function handleClickOutside(event) {
4919
5023
  var path = event.composedPath();
@@ -4929,6 +5033,7 @@ var ComboBoxView = function ComboBoxView(_ref) {
4929
5033
  return document.removeEventListener('mousedown', handleClickOutside);
4930
5034
  };
4931
5035
  }, []);
5036
+ // Defines 'handleSearch' to filter items based on the user's query.
4932
5037
  var handleSearch = function handleSearch(query) {
4933
5038
  setSearchQuery(query);
4934
5039
  if (query === '') {
@@ -4941,11 +5046,13 @@ var ComboBoxView = function ComboBoxView(_ref) {
4941
5046
  }
4942
5047
  setHighlightedIndex(0);
4943
5048
  };
5049
+ // Defines 'handleSelect' to handle item selection and close the dropdown.
4944
5050
  var handleSelect = function handleSelect(item) {
4945
5051
  setSelectedItem(item);
4946
5052
  onSelect == null || onSelect(item);
4947
5053
  setIsDropdownVisible(false);
4948
5054
  };
5055
+ // Starts the JSX returned by the component representing the combobox.
4949
5056
  return React__default.createElement(Horizontal, Object.assign({
4950
5057
  role: "combobox",
4951
5058
  wrap: "nowrap",
@@ -5207,7 +5314,6 @@ var ModalContainer = function ModalContainer(_ref2) {
5207
5314
  };
5208
5315
  return React__default.createElement(Vertical, Object.assign({
5209
5316
  cursor: "default",
5210
- overflow: "hidden",
5211
5317
  backgroundColor: "white",
5212
5318
  width: isFullScreen ? '100%' : 600,
5213
5319
  height: isFullScreen ? '100%' : 'fit-content',
@@ -5253,7 +5359,6 @@ var ModalBody = function ModalBody(_ref4) {
5253
5359
  borderStyle: 'solid'
5254
5360
  };
5255
5361
  return React__default.createElement(View, Object.assign({
5256
- overflowY: "auto",
5257
5362
  paddingVertical: 15,
5258
5363
  paddingHorizontal: 20
5259
5364
  }, defaultBorder, props), children);
@@ -5338,18 +5443,15 @@ var FileImage = function FileImage(_ref2) {
5338
5443
  }, props));
5339
5444
  };
5340
5445
 
5446
+ // Initializes a custom hook for managing tab states with an array of 'Tab' objects passed as properties.
5341
5447
  var useTabsState = function useTabsState(propTabs) {
5342
- // Defines a custom hook, named `useTabsState`, that manages the state of tabs within a component.
5343
5448
  var _useState = React.useState(propTabs[0]),
5344
5449
  isActive = _useState[0],
5345
5450
  setIsActive = _useState[1];
5346
- // Initializes 'isActive' state with the first tab from the 'propTabs' array, indicating the currently active tab.
5347
5451
  var _useState2 = React.useState(propTabs),
5348
5452
  tabsState = _useState2[0],
5349
5453
  setTabsState = _useState2[1];
5350
- // Initializes 'tabsState' as a stateful array that reflects the tabs passed through 'propTabs' prop, setting the initial state of tabs.
5351
5454
  return {
5352
- // The hook returns an object containing both the state and the functions to update the state, allowing components to control and access the current state of the tabs.
5353
5455
  isActive: isActive,
5354
5456
  setIsActive: setIsActive,
5355
5457
  tabsState: tabsState,
@@ -5357,21 +5459,31 @@ var useTabsState = function useTabsState(propTabs) {
5357
5459
  };
5358
5460
  };
5359
5461
 
5462
+ // Defines a functional component 'TabsView' with props of type 'TabsViewProps'.
5360
5463
  var TabsView = function TabsView(props) {
5464
+ // Destructures 'tabs', 'styles', 'isActive', 'setIsActive', 'tabsState', and 'setTabsState' from the component props.
5361
5465
  var tabs = props.tabs,
5362
5466
  styles = props.styles,
5363
5467
  isActive = props.isActive,
5364
5468
  setIsActive = props.setIsActive,
5365
5469
  tabsState = props.tabsState,
5366
5470
  setTabsState = props.setTabsState;
5471
+ // Declares a function 'moveSelectedTabToTop' that takes an index and modifies the tabs order.
5367
5472
  var moveSelectedTabToTop = function moveSelectedTabToTop(idx) {
5473
+ // Creates a copy of the 'tabs' array from props to be altered.
5368
5474
  var newTabs = [].concat(tabs);
5475
+ // Removes the tab at the provided index, effectively selecting this tab.
5369
5476
  var selectedTab = newTabs.splice(idx, 1);
5477
+ // Places the selected tab at the start of the 'newTabs' array.
5370
5478
  newTabs.unshift(selectedTab[0]);
5479
+ // Updates the state with the reordered tabs.
5371
5480
  setTabsState(newTabs);
5481
+ // Sets the active tab to the first tab in the 'newTabs' array.
5372
5482
  setIsActive(newTabs[0]);
5373
5483
  };
5484
+ // Defines a function 'isContentActive' that checks if the given tab's content is to be displayed.
5374
5485
  var isContentActive = function isContentActive(tab) {
5486
+ // Returns a boolean indicating if the given tab is identical to the first tab in 'tabsState'.
5375
5487
  return tab.value === tabsState[0].value;
5376
5488
  };
5377
5489
  return React__default.createElement(Horizontal, Object.assign({
@@ -5400,17 +5512,14 @@ var TabsView = function TabsView(props) {
5400
5512
  })));
5401
5513
  };
5402
5514
 
5403
- // Define the functional component TabsComponent that utilizes the TabsProps interface for its props.
5404
5515
  var TabsComponent = function TabsComponent(_ref) {
5405
5516
  var tabs = _ref.tabs,
5406
5517
  styles = _ref.styles;
5407
- // Destructure the 'tabs' and 'styles' properties from the component's props.
5408
5518
  var _useTabsState = useTabsState(tabs),
5409
5519
  isActive = _useTabsState.isActive,
5410
5520
  setIsActive = _useTabsState.setIsActive,
5411
5521
  tabsState = _useTabsState.tabsState,
5412
5522
  setTabsState = _useTabsState.setTabsState;
5413
- // Invoke the useTabsState custom hook with 'tabs' to manage state related to tab activities like the active tab and tab state management.
5414
5523
  return React__default.createElement(TabsView, {
5415
5524
  tabs: tabs,
5416
5525
  styles: styles,
@@ -5422,54 +5531,66 @@ var TabsComponent = function TabsComponent(_ref) {
5422
5531
  };
5423
5532
  var Tabs = /*#__PURE__*/React__default.memo(TabsComponent);
5424
5533
 
5534
+ // Define a constant object 'Themes' exporting various theme styles.
5425
5535
  var Themes = {
5536
+ // Start of the 'default' theme definition with style properties.
5426
5537
  default: {
5427
5538
  container: {
5428
5539
  backgroundColor: 'white',
5429
5540
  border: 'color.blackAlpha.800'
5430
5541
  },
5542
+ // Defines the content style for the 'default' theme.
5431
5543
  content: {
5432
5544
  color: 'color.blackAlpha.800'
5433
5545
  }
5434
5546
  },
5547
+ // The 'info' theme with unique container and content styles.
5435
5548
  info: {
5436
5549
  container: {
5437
5550
  backgroundColor: 'color.blue.200',
5438
5551
  border: 'color.blue.400'
5439
5552
  },
5553
+ // Content styles specific to the 'info' theme.
5440
5554
  content: {
5441
5555
  color: '#60a5fa'
5442
5556
  }
5443
5557
  },
5558
+ // Specifies the 'success' theme with corresponding container and content styles.
5444
5559
  success: {
5445
5560
  container: {
5446
5561
  backgroundColor: 'color.green.200',
5447
5562
  border: 'color.green.400'
5448
5563
  },
5564
+ // Sets the content styling nuances for the 'success' theme.
5449
5565
  content: {
5450
5566
  color: '#22c55e'
5451
5567
  }
5452
5568
  },
5569
+ // Start of the 'error' theme with its characteristic styles.
5453
5570
  error: {
5454
5571
  container: {
5455
5572
  backgroundColor: 'color.red.200',
5456
5573
  border: 'color.red.400'
5457
5574
  },
5575
+ // Content styling for the 'error' theme.
5458
5576
  content: {
5459
5577
  color: '#ef4444'
5460
5578
  }
5461
5579
  },
5580
+ // Introduction of the 'warning' theme styles.
5462
5581
  warning: {
5463
5582
  container: {
5464
5583
  backgroundColor: 'color.orange.200',
5465
5584
  border: 'color.orange.400'
5466
5585
  },
5586
+ // Defines color and aesthetics for the 'warning' theme's content.
5467
5587
  content: {
5468
5588
  color: '#f97316'
5469
5589
  }
5470
5590
  }
5471
5591
  };
5472
5592
 
5593
+ // Defines AlertView as a functional component using destructuring to extract props.
5473
5594
  var AlertView = function AlertView(_ref) {
5474
5595
  var _styles$icon$color;
5475
5596
  var icon = _ref.icon,
@@ -5502,6 +5623,7 @@ var AlertView = function AlertView(_ref) {
5502
5623
  }, styles == null ? void 0 : styles.description), description)));
5503
5624
  };
5504
5625
 
5626
+ // Definition of the AlertComponent functional component with destructured props.
5505
5627
  var AlertComponent = function AlertComponent(_ref) {
5506
5628
  var icon = _ref.icon,
5507
5629
  title = _ref.title,
@@ -5516,9 +5638,11 @@ var AlertComponent = function AlertComponent(_ref) {
5516
5638
  variant: variant
5517
5639
  });
5518
5640
  };
5641
+ // Exporting the AlertComponent as 'Alert' for use in other parts of the application.
5519
5642
  var Alert = AlertComponent;
5520
5643
 
5521
5644
  var _excluded$I = ["ratio", "children"];
5645
+ // Declaration of a functional component named AspectRatioView.
5522
5646
  var AspectRatioView = function AspectRatioView(_ref) {
5523
5647
  var _ref$ratio = _ref.ratio,
5524
5648
  ratio = _ref$ratio === void 0 ? 16 / 9 : _ref$ratio,
@@ -5540,26 +5664,31 @@ var AspectRatioView = function AspectRatioView(_ref) {
5540
5664
  };
5541
5665
 
5542
5666
  var _excluded$J = ["ratio", "children"];
5667
+ // Declaration of the AspectRatioComponent functional component with destructured props.
5543
5668
  var AspectRatioComponent = function AspectRatioComponent(_ref) {
5544
5669
  var ratio = _ref.ratio,
5545
5670
  children = _ref.children,
5546
5671
  props = _objectWithoutPropertiesLoose(_ref, _excluded$J);
5672
+ // Beginning of the return statement in the functional component.
5547
5673
  return React__default.createElement(AspectRatioView, Object.assign({
5548
5674
  ratio: ratio
5549
5675
  }, props), children);
5550
5676
  };
5551
5677
  var AspectRatio = AspectRatioComponent;
5552
5678
 
5679
+ // Defines a state hook for managing avatar image error status, initialized as false.
5553
5680
  var useAvatarState = function useAvatarState() {
5554
5681
  var _useState = React.useState(false),
5555
5682
  imageError = _useState[0],
5556
5683
  setImageError = _useState[1];
5684
+ // Provides an object containing the image error state and its setter function.
5557
5685
  return {
5558
5686
  imageError: imageError,
5559
5687
  setImageError: setImageError
5560
5688
  };
5561
5689
  };
5562
5690
 
5691
+ // Defines a mapping of avatar sizes to their respective numeric values
5563
5692
  var AvatarSizeMap = {
5564
5693
  xs: 24,
5565
5694
  sm: 32,
@@ -5568,6 +5697,7 @@ var AvatarSizeMap = {
5568
5697
  xl: 80
5569
5698
  };
5570
5699
 
5700
+ // Declaration of the AvatarView functional component with destructured props from AvatarViewProps.
5571
5701
  var AvatarView = function AvatarView(_ref) {
5572
5702
  var src = _ref.src,
5573
5703
  _ref$size = _ref.size,
@@ -5577,10 +5707,13 @@ var AvatarView = function AvatarView(_ref) {
5577
5707
  styles = _ref.styles,
5578
5708
  imageError = _ref.imageError,
5579
5709
  setImageError = _ref.setImageError;
5710
+ // Determines the size of the avatar by mapping the size prop to the predefined AvatarSizeMap.
5580
5711
  var avatarSize = AvatarSizeMap[size];
5712
+ // Initiates a style object for the image with an objectFit property and spreads additional image styles if provided.
5581
5713
  var imageStyle = _extends({
5582
5714
  objectFit: 'cover'
5583
5715
  }, (styles == null ? void 0 : styles.image) || {});
5716
+ // Start of the JSX returned by the AvatarView component, which uses the Center component as its root element.
5584
5717
  return React__default.createElement(Center, Object.assign({
5585
5718
  role: "avatar",
5586
5719
  width: avatarSize,
@@ -5590,7 +5723,7 @@ var AvatarView = function AvatarView(_ref) {
5590
5723
  borderWidth: "1px",
5591
5724
  borderStyle: "solid",
5592
5725
  borderColor: imageError ? 'black' : 'transparent',
5593
- boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)" // Add shadow effect
5726
+ boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)"
5594
5727
  }, styles == null ? void 0 : styles.container), !imageError ? React__default.createElement(appStudio.Image, {
5595
5728
  alt: "IM",
5596
5729
  src: src,
@@ -5605,14 +5738,17 @@ var AvatarView = function AvatarView(_ref) {
5605
5738
  }, styles == null ? void 0 : styles.fallback), fallback));
5606
5739
  };
5607
5740
 
5741
+ // Defines the AvatarComponent functional component with destructured props from AvatarProps type.
5608
5742
  var AvatarComponent = function AvatarComponent(_ref) {
5609
5743
  var src = _ref.src,
5610
5744
  size = _ref.size,
5611
5745
  styles = _ref.styles,
5612
5746
  fallback = _ref.fallback;
5747
+ // Uses custom hook useAvatarState to manage the avatar image loading error state.
5613
5748
  var _useAvatarState = useAvatarState(),
5614
5749
  imageError = _useAvatarState.imageError,
5615
5750
  setImageError = _useAvatarState.setImageError;
5751
+ // Begins the JSX return block for rendering the AvatarView component.
5616
5752
  return React__default.createElement(AvatarView, {
5617
5753
  src: src,
5618
5754
  size: size,
@@ -5621,7 +5757,9 @@ var AvatarComponent = function AvatarComponent(_ref) {
5621
5757
  imageError: imageError,
5622
5758
  setImageError: setImageError
5623
5759
  });
5760
+ // AvatarComponent is a functional component that wraps the AvatarView with added state logic.
5624
5761
  };
5762
+ // Exports the AvatarComponent as Avatar for use in other parts of the application.
5625
5763
  var Avatar = AvatarComponent;
5626
5764
 
5627
5765
  var BadgeSizes = {
@@ -5679,6 +5817,7 @@ var PositionStyles = {
5679
5817
  }
5680
5818
  };
5681
5819
 
5820
+ // Importing Text component to display the content text within the badge.
5682
5821
  var BadgeView = function BadgeView(_ref) {
5683
5822
  var content = _ref.content,
5684
5823
  position = _ref.position,
@@ -5700,6 +5839,7 @@ var BadgeView = function BadgeView(_ref) {
5700
5839
  borderColor: 'transparent'
5701
5840
  },
5702
5841
  outline: {
5842
+ // Combining various style objects along with conditional styles based on props to create the badge's appearance.
5703
5843
  backgroundColor: 'transparent',
5704
5844
  borderWidth: 1,
5705
5845
  borderStyle: 'solid',
@@ -5708,10 +5848,13 @@ var BadgeView = function BadgeView(_ref) {
5708
5848
  },
5709
5849
  link: {
5710
5850
  backgroundColor: 'transparent',
5851
+ // Rendering the Badge component using the Center layout component with combinedStyles applied.
5711
5852
  borderWidth: 1,
5853
+ // Inserting a Text component into the badge to display the content, with dynamic size and additional text styles.
5712
5854
  borderStyle: 'solid',
5713
5855
  borderColor: 'transparent',
5714
5856
  color: colorScheme,
5857
+ // Exporting BadgeView to be used in other parts of the application.
5715
5858
  textDecoration: 'underline'
5716
5859
  },
5717
5860
  ghost: {
@@ -5734,6 +5877,7 @@ var BadgeView = function BadgeView(_ref) {
5734
5877
  }, styles == null ? void 0 : styles.text), content));
5735
5878
  };
5736
5879
 
5880
+ // Importing type definitions for BadgeProps that will be used to type-check the Badge component's props.
5737
5881
  var Badge = function Badge(_ref) {
5738
5882
  var content = _ref.content,
5739
5883
  shape = _ref.shape,
@@ -5753,13 +5897,17 @@ var Badge = function Badge(_ref) {
5753
5897
  });
5754
5898
  };
5755
5899
 
5900
+ // Declares the useToggleState function which takes defaultToggled parameter to initialize the toggle state.
5756
5901
  var useToggleState = function useToggleState(defaultToggled) {
5902
+ // Creates a stateful value isHovered for tracking hover state and a function setIsHovered to update that state, initially false.
5757
5903
  var _useState = React.useState(false),
5758
5904
  isHovered = _useState[0],
5759
5905
  setIsHovered = _useState[1];
5906
+ // Creates a stateful value isToggle to store the current toggle state and a function setIsToggled to modify it, initialized with defaultToggled.
5760
5907
  var _useState2 = React.useState(defaultToggled),
5761
5908
  isToggle = _useState2[0],
5762
5909
  setIsToggled = _useState2[1];
5910
+ // Returns an object containing the current states and the functions to update them for external use.
5763
5911
  return {
5764
5912
  isHovered: isHovered,
5765
5913
  setIsHovered: setIsHovered,
@@ -5811,14 +5959,12 @@ var ToggleView = function ToggleView(_ref) {
5811
5959
  setIsToggled(function (prev) {
5812
5960
  var newState = !prev;
5813
5961
  if (onToggle) {
5814
- // Check if onToggle is defined before calling it
5815
5962
  onToggle(newState);
5816
5963
  }
5817
- return newState; // Expecting the onToggle to possibly do something with the newState
5964
+ return newState;
5818
5965
  });
5819
5966
  }
5820
5967
  };
5821
-
5822
5968
  return React__default.createElement(Center, Object.assign({
5823
5969
  role: "Toggle",
5824
5970
  padding: shape === 'pillShaped' ? '10px 12px' : '8px',
@@ -5838,6 +5984,7 @@ var ToggleView = function ToggleView(_ref) {
5838
5984
  };
5839
5985
 
5840
5986
  var _excluded$L = ["children", "shape", "colorScheme", "variant", "isDisabled", "isToggled", "onToggle"];
5987
+ // Destructuring properties from ToggleProps to be used within the ToggleComponent.
5841
5988
  var ToggleComponent = function ToggleComponent(_ref) {
5842
5989
  var children = _ref.children,
5843
5990
  shape = _ref.shape,
@@ -5848,14 +5995,17 @@ var ToggleComponent = function ToggleComponent(_ref) {
5848
5995
  isToggled = _ref$isToggled === void 0 ? false : _ref$isToggled,
5849
5996
  onToggle = _ref.onToggle,
5850
5997
  props = _objectWithoutPropertiesLoose(_ref, _excluded$L);
5998
+ // Initializing toggle state and set state functions using the custom hook useToggleState.
5851
5999
  var _useToggleState = useToggleState(isToggled),
5852
6000
  isHovered = _useToggleState.isHovered,
5853
6001
  setIsHovered = _useToggleState.setIsHovered,
5854
6002
  isToggle = _useToggleState.isToggle,
5855
6003
  setIsToggled = _useToggleState.setIsToggled;
6004
+ // Creating an effect that updates the isToggled state whenever the isToggled prop changes.
5856
6005
  React.useEffect(function () {
5857
6006
  setIsToggled(isToggled);
5858
6007
  }, [isToggled]);
6008
+ // Beginning of the JSX block to render the Toggle view component.
5859
6009
  return React__default.createElement(ToggleView, Object.assign({
5860
6010
  shape: shape,
5861
6011
  colorScheme: colorScheme,
@@ -5870,6 +6020,7 @@ var ToggleComponent = function ToggleComponent(_ref) {
5870
6020
  };
5871
6021
  var Toggle = ToggleComponent;
5872
6022
 
6023
+ // Define a custom hook for managing ToggleGroup state
5873
6024
  var useToggleGroupState = function useToggleGroupState() {
5874
6025
  var _useState = React.useState([]),
5875
6026
  activeToggles = _useState[0],
@@ -5880,6 +6031,7 @@ var useToggleGroupState = function useToggleGroupState() {
5880
6031
  };
5881
6032
  };
5882
6033
 
6034
+ // ToggleGroupView component declaration with destructured properties from props.
5883
6035
  var ToggleGroupView = function ToggleGroupView(_ref) {
5884
6036
  var items = _ref.items,
5885
6037
  onToggleChange = _ref.onToggleChange,
@@ -5891,14 +6043,13 @@ var ToggleGroupView = function ToggleGroupView(_ref) {
5891
6043
  variant = _ref$variant === void 0 ? 'ghost' : _ref$variant,
5892
6044
  _ref$colorScheme = _ref.colorScheme,
5893
6045
  colorScheme = _ref$colorScheme === void 0 ? 'color.trueGray.400' : _ref$colorScheme;
6046
+ // handleToggle is a memoized callback that handles the toggle state changes.
5894
6047
  var handleToggle = React.useCallback(function (id, isActive) {
5895
6048
  setActiveToggles(function (prevActiveToggles) {
5896
6049
  var newActiveToggles;
5897
6050
  if (isActive) {
5898
- // Add the ID only if it's not already included
5899
6051
  newActiveToggles = prevActiveToggles.includes(id) ? prevActiveToggles : [].concat(prevActiveToggles, [id]);
5900
6052
  } else {
5901
- // Remove the ID if it's included
5902
6053
  newActiveToggles = prevActiveToggles.filter(function (toggleId) {
5903
6054
  return toggleId !== id;
5904
6055
  });
@@ -5928,12 +6079,14 @@ var ToggleGroupView = function ToggleGroupView(_ref) {
5928
6079
  }));
5929
6080
  };
5930
6081
 
6082
+ // Define the functional component with destructured props
5931
6083
  var ToggleGroupComponent = function ToggleGroupComponent(_ref) {
5932
6084
  var items = _ref.items,
5933
6085
  shape = _ref.shape,
5934
6086
  colorScheme = _ref.colorScheme,
5935
6087
  variant = _ref.variant,
5936
6088
  onToggleChange = _ref.onToggleChange;
6089
+ // Hook to manage toggle group state, returns active toggles and a setter for it
5937
6090
  var _useToggleGroupState = useToggleGroupState(),
5938
6091
  activeToggles = _useToggleGroupState.activeToggles,
5939
6092
  setActiveToggles = _useToggleGroupState.setActiveToggles;
@@ -5947,6 +6100,7 @@ var ToggleGroupComponent = function ToggleGroupComponent(_ref) {
5947
6100
  onToggleChange: onToggleChange
5948
6101
  });
5949
6102
  };
6103
+ // Expose the ToggleGroupComponent for import into other modules
5950
6104
  var ToggleGroup = ToggleGroupComponent;
5951
6105
 
5952
6106
  // Create your store with the initial state and actions.