@app-studio/web 0.3.69 → 0.6.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.
- package/dist/bot/Bot.d.ts +4 -3
- package/dist/bot/DocuCode.d.ts +7 -2
- package/dist/bot/FileHandler.d.ts +5 -0
- package/dist/bot/OpenAIConnector.d.ts +2 -0
- package/dist/bot/prompt/1-project.d.ts +1 -1
- package/dist/bot/prompt/2-response.d.ts +1 -1
- package/dist/bot/prompt/3-comment.d.ts +1 -1
- package/dist/components/Button/Button/Button.props.d.ts +0 -60
- package/dist/components/Button/Button.d.ts +0 -3
- package/dist/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -71
- package/dist/components/Form/Checkbox/examples/index.d.ts +1 -0
- package/dist/components/Form/Checkbox/examples/infoText.d.ts +2 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.context.d.ts +10 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.props.d.ts +36 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.provider.d.ts +2 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.state.d.ts +2 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.type.d.ts +12 -0
- package/dist/components/Form/ComboBox/ComboBox/ComboBox.view.d.ts +4 -0
- package/dist/components/Form/ComboBox/ComboBox.d.ts +3 -0
- package/dist/components/Form/ComboBox/examples/default.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/index.d.ts +10 -0
- package/dist/components/Form/ComboBox/examples/label.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/left.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/onSelect.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/placeholder.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/right.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/searchEnabled.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/searchPlaceholder.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/showTick.d.ts +2 -0
- package/dist/components/Form/ComboBox/examples/styles.d.ts +2 -0
- package/dist/components/Form/DatePicker/DatePicker/DatePicker.props.d.ts +0 -3
- package/dist/components/Form/Label/Label/Label.props.d.ts +0 -24
- package/dist/components/Form/Select/Select/Select.props.d.ts +1 -0
- package/dist/components/Form/Select/Select/Select.state.d.ts +2 -0
- package/dist/components/Form/Select/examples/color.d.ts +2 -0
- package/dist/components/Form/Select/examples/index.d.ts +2 -1
- package/dist/components/Form/Select/examples/isScrollable.d.ts +2 -0
- package/dist/components/Form/TextField/examples/index.d.ts +1 -1
- package/dist/components/Formik/Formik.ComboBox.d.ts +6 -0
- package/dist/components/Formik/examples/FormikComboBox.d.ts +2 -0
- package/dist/components/Formik/examples/index.d.ts +1 -0
- package/dist/components/Formik/index.d.ts +1 -0
- package/dist/components/Layout/index.d.ts +4 -0
- package/dist/components/Message/Message/Message.layout.d.ts +1 -1
- package/dist/components/Message/Message/Message.props.d.ts +31 -107
- package/dist/components/Message/Message/Message.store.d.ts +2 -8
- package/dist/components/Message/Message/Message.style.d.ts +2 -2
- package/dist/components/Message/Message/Message.view.d.ts +2 -18
- package/dist/components/Message/examples/action.d.ts +2 -0
- package/dist/components/Message/examples/default.d.ts +2 -0
- package/dist/components/Message/examples/index.d.ts +9 -0
- package/dist/components/Message/examples/isClosable.d.ts +2 -0
- package/dist/components/Message/examples/showIcon.d.ts +2 -0
- package/dist/components/Message/examples/styles.d.ts +2 -0
- package/dist/components/Message/examples/subtitle.d.ts +2 -0
- package/dist/components/Message/examples/timeout.d.ts +2 -0
- package/dist/components/Message/examples/title.d.ts +2 -0
- package/dist/components/Message/examples/variant.d.ts +2 -0
- package/dist/components/Svg/Error.d.ts +8 -0
- package/dist/components/Svg/Info.d.ts +8 -0
- package/dist/components/Svg/Plus.d.ts +8 -0
- package/dist/components/Svg/Search.d.ts +8 -0
- package/dist/components/Svg/Success.d.ts +8 -0
- package/dist/components/Svg/Tick.d.ts +8 -0
- package/dist/components/Svg/index.d.ts +3 -0
- package/dist/components/Table/Table/Table.context.d.ts +16 -0
- package/dist/components/Table/Table/Table.props.d.ts +22 -0
- package/dist/components/Table/Table/Table.state.d.ts +5 -0
- package/dist/components/Table/Table/Table.type.d.ts +19 -0
- package/dist/components/Table/Table/Table.view.d.ts +11 -0
- package/dist/components/Table/Table.d.ts +13 -0
- package/dist/components/Table/examples/caption.d.ts +2 -0
- package/dist/components/Table/examples/data.d.ts +2 -0
- package/dist/components/Table/examples/default.d.ts +2 -0
- package/dist/components/Table/examples/footer.d.ts +2 -0
- package/dist/components/Table/examples/index.d.ts +5 -0
- package/dist/components/Table/examples/styles.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/pages/comboBox.page.d.ts +3 -0
- package/dist/pages/message.page.d.ts +2 -2
- package/dist/pages/table.page.d.ts +3 -0
- package/dist/utils/componentsPageImports.d.ts +6 -0
- package/dist/web.cjs.development.js +1044 -243
- 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 +1039 -244
- package/dist/web.esm.js.map +1 -1
- package/package.json +7 -5
- package/dist/components/Form/Select/examples/Color.d.ts +0 -2
- package/dist/components/Message/Examples/CloseButtonMessage.d.ts +0 -2
- package/dist/components/Message/Examples/DefaultMessage.d.ts +0 -2
- package/dist/components/Message/Examples/VariantMessage.d.ts +0 -2
- package/dist/components/Message/Examples/index.d.ts +0 -3
- /package/dist/components/Form/TextField/examples/{ColorScheme.d.ts → colorScheme.d.ts} +0 -0
package/dist/web.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useMemo, useCallback, createContext, useContext, Fragment } from 'react';
|
|
2
2
|
import { View as View$1, Element, useTheme, Typography, Input, Form, Image } from 'app-studio';
|
|
3
3
|
import { Link as Link$1 } from 'react-router-dom';
|
|
4
|
+
import { Vertical as Vertical$1, Horizontal as Horizontal$1 } from 'src/components/Layout';
|
|
4
5
|
import format from 'date-fns/format';
|
|
5
6
|
import { useFormikContext } from 'formik';
|
|
6
7
|
import { create } from 'zustand';
|
|
@@ -9,11 +10,15 @@ var useButtonState = function useButtonState() {
|
|
|
9
10
|
var _React$useState = React.useState(false),
|
|
10
11
|
isHovered = _React$useState[0],
|
|
11
12
|
setIsHovered = _React$useState[1];
|
|
13
|
+
// This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
|
|
12
14
|
return {
|
|
13
15
|
isHovered: isHovered,
|
|
14
16
|
setIsHovered: setIsHovered
|
|
15
17
|
};
|
|
18
|
+
// The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
|
|
19
|
+
// A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
|
|
16
20
|
};
|
|
21
|
+
// The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
|
|
17
22
|
|
|
18
23
|
function _extends() {
|
|
19
24
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -434,6 +439,101 @@ var WarningSvg = function WarningSvg(_ref) {
|
|
|
434
439
|
})))))));
|
|
435
440
|
};
|
|
436
441
|
|
|
442
|
+
var _excluded$b = ["size", "color"];
|
|
443
|
+
var SuccessSvg = function SuccessSvg(_ref) {
|
|
444
|
+
var _ref$size = _ref.size,
|
|
445
|
+
size = _ref$size === void 0 ? 64 : _ref$size,
|
|
446
|
+
_ref$color = _ref.color,
|
|
447
|
+
color = _ref$color === void 0 ? 'white' : _ref$color,
|
|
448
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
449
|
+
return React.createElement(Center, {
|
|
450
|
+
width: size + "px",
|
|
451
|
+
height: size + "px"
|
|
452
|
+
}, React.createElement("svg", Object.assign({
|
|
453
|
+
height: size + "px",
|
|
454
|
+
width: size + "px",
|
|
455
|
+
version: "1.1",
|
|
456
|
+
id: "Capa_1",
|
|
457
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
458
|
+
viewBox: "0 0 484.8 484.8",
|
|
459
|
+
fill: color
|
|
460
|
+
}, props), React.createElement("g", {
|
|
461
|
+
id: "SVGRepo_bgCarrier"
|
|
462
|
+
}), React.createElement("g", {
|
|
463
|
+
id: "SVGRepo_tracerCarrier"
|
|
464
|
+
}), React.createElement("g", {
|
|
465
|
+
id: "SVGRepo_iconCarrier"
|
|
466
|
+
}, React.createElement("g", null, React.createElement("g", null, React.createElement("path", {
|
|
467
|
+
d: "M242.4,0C108.6,0,0,108.6,0,242.4S108.6,484.8,242.4,484.8S484.8,376.2,484.8,242.4S376.2,0,242.4,0z M198.4,358.8l-120-120L84,228l114.4,114.4l188-188l28.8,28.8L198.4,358.8z",
|
|
468
|
+
fill: color
|
|
469
|
+
}))))));
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
var _excluded$c = ["size", "color"];
|
|
473
|
+
var InfoSvg = function InfoSvg(_ref) {
|
|
474
|
+
var _ref$size = _ref.size,
|
|
475
|
+
size = _ref$size === void 0 ? 64 : _ref$size,
|
|
476
|
+
_ref$color = _ref.color,
|
|
477
|
+
color = _ref$color === void 0 ? 'white' : _ref$color,
|
|
478
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
479
|
+
return React.createElement(Center, {
|
|
480
|
+
width: size + "px",
|
|
481
|
+
height: size + "px"
|
|
482
|
+
}, React.createElement("svg", Object.assign({
|
|
483
|
+
height: size + "px",
|
|
484
|
+
width: size + "px",
|
|
485
|
+
version: "1.1",
|
|
486
|
+
id: "Capa_1",
|
|
487
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
488
|
+
viewBox: "0 0 192.146 192.146",
|
|
489
|
+
fill: color
|
|
490
|
+
}, props), React.createElement("g", {
|
|
491
|
+
id: "SVGRepo_bgCarrier"
|
|
492
|
+
}), React.createElement("g", {
|
|
493
|
+
id: "SVGRepo_tracerCarrier"
|
|
494
|
+
}), React.createElement("g", {
|
|
495
|
+
id: "SVGRepo_iconCarrier"
|
|
496
|
+
}, React.createElement("g", null, React.createElement("g", null, React.createElement("g", null, React.createElement("path", {
|
|
497
|
+
d: "M96.073,3.515C43.19,3.515,0,46.705,0,99.587s43.19,96.072,96.073,96.072s96.073-43.19,96.073-96.072 S148.955,3.515,96.073,3.515z M101.468,154.072h-15.447V120.57h15.447V154.072z M101.468,111.875h-15.447V49.54h15.447V111.875z"
|
|
498
|
+
})))))));
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
var _excluded$d = ["size", "color"];
|
|
502
|
+
var ErrorSvg = function ErrorSvg(_ref) {
|
|
503
|
+
var _ref$size = _ref.size,
|
|
504
|
+
size = _ref$size === void 0 ? 64 : _ref$size,
|
|
505
|
+
_ref$color = _ref.color,
|
|
506
|
+
color = _ref$color === void 0 ? 'white' : _ref$color,
|
|
507
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
508
|
+
return React.createElement(Center, {
|
|
509
|
+
width: size + "px",
|
|
510
|
+
height: size + "px"
|
|
511
|
+
}, React.createElement("svg", Object.assign({
|
|
512
|
+
height: size + "px",
|
|
513
|
+
width: size + "px",
|
|
514
|
+
version: "1.1",
|
|
515
|
+
id: "Capa_1",
|
|
516
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
517
|
+
viewBox: "0 0 510 510",
|
|
518
|
+
fill: color
|
|
519
|
+
}, props), React.createElement("g", {
|
|
520
|
+
id: "SVGRepo_bgCarrier"
|
|
521
|
+
}), React.createElement("g", {
|
|
522
|
+
id: "SVGRepo_tracerCarrier"
|
|
523
|
+
}), React.createElement("g", {
|
|
524
|
+
id: "SVGRepo_iconCarrier"
|
|
525
|
+
}, React.createElement("g", null, React.createElement("g", null, React.createElement("path", {
|
|
526
|
+
d: "M255,0C114.615,0,0,114.615,0,255s114.615,255,255,255s255-114.615,255-255S395.385,0,255,0z M255,459c-114.75,0-207-92.25-207-207c0-114.75,92.25-207,207-207c114.75,0,207,92.25,207,207C462,366.75,369.75,459,255,459z",
|
|
527
|
+
fill: color
|
|
528
|
+
}), React.createElement("path", {
|
|
529
|
+
d: "M255,140.25c11.05,0,20-8.95,20-20s-8.95-20-20-20s-20,8.95-20,20S243.95,140.25,255,140.25z",
|
|
530
|
+
fill: color
|
|
531
|
+
}), React.createElement("path", {
|
|
532
|
+
d: "M265,357c0,11.05-8.95,20-20,20s-20-8.95-20-20v-175c0-11.05,8.95-20,20-20s20,8.95,20,20V357z",
|
|
533
|
+
fill: color
|
|
534
|
+
}))))));
|
|
535
|
+
};
|
|
536
|
+
|
|
437
537
|
var IconSizes = {
|
|
438
538
|
xs: 12,
|
|
439
539
|
sm: 14,
|
|
@@ -447,7 +547,7 @@ var IconSizes = {
|
|
|
447
547
|
'6xl': 64
|
|
448
548
|
};
|
|
449
549
|
|
|
450
|
-
var _excluded$
|
|
550
|
+
var _excluded$e = ["children", "href", "iconSize", "underline", "isHovered", "isExternal", "styles", "setIsHovered"];
|
|
451
551
|
var LinkView = function LinkView(_ref) {
|
|
452
552
|
var children = _ref.children,
|
|
453
553
|
_ref$href = _ref.href,
|
|
@@ -467,7 +567,7 @@ var LinkView = function LinkView(_ref) {
|
|
|
467
567
|
} : _ref$styles,
|
|
468
568
|
_ref$setIsHovered = _ref.setIsHovered,
|
|
469
569
|
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
470
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
570
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
471
571
|
var handleHover = function handleHover() {
|
|
472
572
|
if (underline === 'hover') setIsHovered(true);
|
|
473
573
|
};
|
|
@@ -498,7 +598,9 @@ var LinkComponent = function LinkComponent(props) {
|
|
|
498
598
|
var Link = LinkComponent;
|
|
499
599
|
|
|
500
600
|
var ButtonSizes = {
|
|
601
|
+
// Defines a constant 'ButtonSizes' as a mapping from 'Size' to corresponding 'CSSProperties'.
|
|
501
602
|
xs: {
|
|
603
|
+
// Establishes style configuration for extra-small (xs) button size.
|
|
502
604
|
width: 79,
|
|
503
605
|
paddingTop: 8,
|
|
504
606
|
paddingBottom: 8,
|
|
@@ -517,6 +619,7 @@ var ButtonSizes = {
|
|
|
517
619
|
paddingRight: 16,
|
|
518
620
|
fontWeight: 600,
|
|
519
621
|
fontSize: 'sm',
|
|
622
|
+
// Establishes style configuration for medium (md) button size.
|
|
520
623
|
lineHeight: 20,
|
|
521
624
|
letterSpacing: 1.25
|
|
522
625
|
},
|
|
@@ -526,6 +629,7 @@ var ButtonSizes = {
|
|
|
526
629
|
paddingBottom: 12,
|
|
527
630
|
paddingLeft: 18,
|
|
528
631
|
paddingRight: 18,
|
|
632
|
+
// Establishes style configuration for large (lg) button size.
|
|
529
633
|
fontWeight: 600,
|
|
530
634
|
fontSize: 'md',
|
|
531
635
|
lineHeight: 24,
|
|
@@ -535,6 +639,7 @@ var ButtonSizes = {
|
|
|
535
639
|
width: 178,
|
|
536
640
|
paddingTop: 14,
|
|
537
641
|
paddingBottom: 14,
|
|
642
|
+
// Establishes style configuration for extra-large (xl) button size.
|
|
538
643
|
paddingLeft: 22,
|
|
539
644
|
paddingRight: 22,
|
|
540
645
|
fontWeight: 600,
|
|
@@ -545,28 +650,38 @@ var ButtonSizes = {
|
|
|
545
650
|
xl: {
|
|
546
651
|
width: 220,
|
|
547
652
|
paddingTop: 16,
|
|
653
|
+
// Defines a constant 'ButtonShapes' with style properties for different button shapes such as 'sharp', 'rounded', and 'pillShaped'.
|
|
548
654
|
paddingBottom: 16,
|
|
655
|
+
// Sets the border-radius for a sharp-edged button shape to '0'.
|
|
549
656
|
paddingLeft: 26,
|
|
657
|
+
// Sets the border-radius for a rounded button shape to '4'.
|
|
550
658
|
paddingRight: 26,
|
|
659
|
+
// Sets the border-radius for a pill-shaped button to '24'.
|
|
551
660
|
fontWeight: 600,
|
|
552
661
|
fontSize: 'xl',
|
|
662
|
+
// Defines a constant 'IconSizes' as a mapping from 'Size' to corresponding 'CSSProperties' for icons.
|
|
553
663
|
lineHeight: 24,
|
|
664
|
+
// Sets the width, height, and padding for icons of extra-small size.
|
|
554
665
|
letterSpacing: 1.25
|
|
555
666
|
}
|
|
556
667
|
};
|
|
557
668
|
var ButtonShapes = {
|
|
669
|
+
// Sets the width, height, and padding for icons of small size.
|
|
558
670
|
sharp: 0,
|
|
559
671
|
rounded: 4,
|
|
560
672
|
pillShaped: 24
|
|
561
673
|
};
|
|
674
|
+
// Sets the width, height, and padding for icons of medium size.
|
|
562
675
|
var IconSizes$1 = {
|
|
563
676
|
xs: {
|
|
564
677
|
width: 24,
|
|
565
678
|
height: 24,
|
|
679
|
+
// Sets the width, height, and padding for icons of large size.
|
|
566
680
|
padding: 12
|
|
567
681
|
},
|
|
568
682
|
sm: {
|
|
569
683
|
width: 24,
|
|
684
|
+
// Sets the width, height, and padding for icons of extra-large size.
|
|
570
685
|
height: 24,
|
|
571
686
|
padding: 15
|
|
572
687
|
},
|
|
@@ -605,7 +720,7 @@ var DefaultSpeeds = {
|
|
|
605
720
|
slow: 300
|
|
606
721
|
};
|
|
607
722
|
|
|
608
|
-
var _excluded$
|
|
723
|
+
var _excluded$f = ["size", "speed", "color"],
|
|
609
724
|
_excluded2 = ["size", "speed", "color"],
|
|
610
725
|
_excluded3 = ["size", "speed", "color"],
|
|
611
726
|
_excluded4 = ["size", "children", "textColor", "loaderColor", "type", "speed", "textPosition"];
|
|
@@ -616,7 +731,7 @@ var DefaultSpinner = function DefaultSpinner(_ref) {
|
|
|
616
731
|
speed = _ref$speed === void 0 ? 'normal' : _ref$speed,
|
|
617
732
|
_ref$color = _ref.color,
|
|
618
733
|
color = _ref$color === void 0 ? 'theme.loading' : _ref$color,
|
|
619
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
734
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
620
735
|
var theme = useTheme();
|
|
621
736
|
var colorStyle = theme.getColor(color);
|
|
622
737
|
var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
|
|
@@ -790,7 +905,7 @@ var LoaderComponent = function LoaderComponent(props) {
|
|
|
790
905
|
*/
|
|
791
906
|
var Loader = LoaderComponent;
|
|
792
907
|
|
|
793
|
-
var _excluded$
|
|
908
|
+
var _excluded$g = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "isLoading", "isDisabled", "size", "variant", "iconPosition", "colorScheme", "shape", "onClick", "loaderProps", "loaderPosition", "effect", "isHovered"];
|
|
794
909
|
var ButtonView = function ButtonView(_ref) {
|
|
795
910
|
var _props$onClick;
|
|
796
911
|
var icon = _ref.icon,
|
|
@@ -827,7 +942,7 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
827
942
|
_ref$effect = _ref.effect,
|
|
828
943
|
effect = _ref$effect === void 0 ? 'default' : _ref$effect,
|
|
829
944
|
isHovered = _ref.isHovered,
|
|
830
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
945
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
831
946
|
var isActive = !(isDisabled || isLoading);
|
|
832
947
|
var defaultNativeProps = {
|
|
833
948
|
disabled: !isActive
|
|
@@ -837,6 +952,7 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
837
952
|
var reverse = isHovered && effect === 'reverse';
|
|
838
953
|
var ButtonVariants = {
|
|
839
954
|
filled: {
|
|
955
|
+
// Defines CSS properties for 'link' variant of the button with conditional styles based on reverse state, includes text decoration.
|
|
840
956
|
backgroundColor: reverse ? 'transparent' : buttonColor,
|
|
841
957
|
color: reverse ? buttonColor : 'color.white',
|
|
842
958
|
borderWidth: 1,
|
|
@@ -845,15 +961,20 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
845
961
|
},
|
|
846
962
|
outline: {
|
|
847
963
|
backgroundColor: reverse ? buttonColor : 'transparent',
|
|
964
|
+
// Defines CSS properties for 'ghost' variant of the button with conditional styles based on reverse state.
|
|
848
965
|
borderWidth: 1,
|
|
849
966
|
borderStyle: 'solid',
|
|
850
967
|
borderColor: reverse ? buttonColor : colorScheme,
|
|
968
|
+
// Fetches size-specific styles from ButtonSizes based on the 'size' prop.
|
|
851
969
|
color: reverse ? 'white' : buttonColor
|
|
852
970
|
},
|
|
971
|
+
// Adjusts button width based on isAuto and isFilled properties, using buttonSizeStyles for fallback width.
|
|
853
972
|
link: {
|
|
854
973
|
backgroundColor: 'transparent',
|
|
974
|
+
// Changes padding for the button based on whether isIconRounded is true or false.
|
|
855
975
|
borderWidth: 1,
|
|
856
976
|
borderStyle: 'solid',
|
|
977
|
+
// Creates the content for the button including loaders and icons positioned based on their respective properties.
|
|
857
978
|
borderColor: reverse ? buttonColor : 'transparent',
|
|
858
979
|
color: buttonColor,
|
|
859
980
|
textDecoration: reverse ? 'none' : 'underline'
|
|
@@ -866,6 +987,7 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
866
987
|
borderColor: reverse ? buttonColor : 'transparent'
|
|
867
988
|
}
|
|
868
989
|
};
|
|
990
|
+
// Executes rendering of the button or a link element based on the variant; applies conditional rendering for externalHref in 'link' variant.
|
|
869
991
|
var buttonSizeStyles = ButtonSizes[size];
|
|
870
992
|
var buttonVariant = ButtonVariants[variant];
|
|
871
993
|
var scaleWidth = {
|
|
@@ -902,23 +1024,32 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
902
1024
|
}, content) : content);
|
|
903
1025
|
};
|
|
904
1026
|
|
|
1027
|
+
// Importing a custom hook to manage the state specific to the button component.
|
|
905
1028
|
var ButtonComponent = function ButtonComponent(props) {
|
|
1029
|
+
// Importing the view part of the button, which is presumably a presentational component.
|
|
906
1030
|
var _useButtonState = useButtonState(),
|
|
907
1031
|
isHovered = _useButtonState.isHovered,
|
|
908
1032
|
setIsHovered = _useButtonState.setIsHovered;
|
|
1033
|
+
// Defining the button component with generic React Functional Component type augmented with ButtonProps type.
|
|
909
1034
|
var handleHover = function handleHover() {
|
|
910
1035
|
return setIsHovered(!isHovered);
|
|
911
1036
|
};
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1037
|
+
// Destructuring the state and state update function from the custom hook for button state management.
|
|
1038
|
+
return (
|
|
1039
|
+
// Defines a function to toggle the hover state of the button.
|
|
1040
|
+
React.createElement(ButtonView, Object.assign({
|
|
1041
|
+
isHovered: isHovered,
|
|
1042
|
+
// Rendering the ButtonView component and spreading the received props on it.
|
|
1043
|
+
setIsHovered: setIsHovered,
|
|
1044
|
+
// Passing the isHovered state and the setIsHovered function to the ButtonView.
|
|
1045
|
+
onMouseEnter: handleHover,
|
|
1046
|
+
// Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
|
|
1047
|
+
onMouseLeave: handleHover
|
|
1048
|
+
}, props))
|
|
1049
|
+
);
|
|
1050
|
+
// Exports the Button component for use in other parts of the application.
|
|
918
1051
|
};
|
|
919
|
-
|
|
920
|
-
* Buttons allow us to trigger an event or an action with a single click.
|
|
921
|
-
*/
|
|
1052
|
+
|
|
922
1053
|
var Button = ButtonComponent;
|
|
923
1054
|
|
|
924
1055
|
var useCheckboxState = function useCheckboxState(_ref) {
|
|
@@ -938,40 +1069,49 @@ var useCheckboxState = function useCheckboxState(_ref) {
|
|
|
938
1069
|
};
|
|
939
1070
|
};
|
|
940
1071
|
|
|
1072
|
+
// Import Headings type definition from Label.type module for type safety and consistency.
|
|
941
1073
|
var HeadingSizes = {
|
|
1074
|
+
// Initialize a constant 'HeadingSizes' to define styles for different heading levels.
|
|
942
1075
|
h1: {
|
|
1076
|
+
// Use TypeScript's 'Record' utility type to ensure the object matches the shape of 'Headings'.
|
|
943
1077
|
fontSize: 96,
|
|
1078
|
+
// Define style properties for 'h1' heading tag, including font size, line height, and letter spacing.
|
|
944
1079
|
lineHeight: 112,
|
|
945
1080
|
letterSpacing: -1.5
|
|
946
1081
|
},
|
|
947
1082
|
h2: {
|
|
948
1083
|
fontSize: 60,
|
|
1084
|
+
// Define style properties for 'h2' heading tag similar to 'h1', but with adjusted values for size and spacing.
|
|
949
1085
|
lineHeight: 71,
|
|
950
1086
|
letterSpacing: -0.5
|
|
951
1087
|
},
|
|
952
1088
|
h3: {
|
|
953
1089
|
fontSize: 48,
|
|
1090
|
+
// Define style properties for 'h3' heading tag with a standard letter spacing of 0.
|
|
954
1091
|
lineHeight: 57,
|
|
955
1092
|
letterSpacing: 0
|
|
956
1093
|
},
|
|
957
1094
|
h4: {
|
|
958
1095
|
fontSize: 34,
|
|
1096
|
+
// Provide style properties for 'h4' heading tag, with a slight increase in letter spacing.
|
|
959
1097
|
lineHeight: 40,
|
|
960
1098
|
letterSpacing: 0.25
|
|
961
1099
|
},
|
|
962
1100
|
h5: {
|
|
963
1101
|
fontSize: 24,
|
|
1102
|
+
// Set the 'h5' heading tag styles, opting for no additional letter spacing.
|
|
964
1103
|
lineHeight: 28,
|
|
965
1104
|
letterSpacing: 0
|
|
966
1105
|
},
|
|
967
1106
|
h6: {
|
|
968
1107
|
fontSize: 20,
|
|
1108
|
+
// Set the 'h6' heading tag styles, with the smallest font size and a subtle letter spacing.
|
|
969
1109
|
lineHeight: 24,
|
|
970
1110
|
letterSpacing: 0.15
|
|
971
1111
|
}
|
|
972
1112
|
};
|
|
973
1113
|
|
|
974
|
-
var _excluded$
|
|
1114
|
+
var _excluded$h = ["children", "heading", "isItalic", "isUnderlined", "isStriked", "weight", "size"];
|
|
975
1115
|
var LabelView = function LabelView(_ref) {
|
|
976
1116
|
var children = _ref.children,
|
|
977
1117
|
heading = _ref.heading,
|
|
@@ -985,22 +1125,37 @@ var LabelView = function LabelView(_ref) {
|
|
|
985
1125
|
weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
|
|
986
1126
|
_ref$size = _ref.size,
|
|
987
1127
|
size = _ref$size === void 0 ? 'sm' : _ref$size,
|
|
988
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1128
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
1129
|
+
// The fontStyle prop toggles between 'italic' and 'normal' based on the 'isItalic' boolean prop.
|
|
989
1130
|
var headingStyles = heading ? HeadingSizes[heading] : {};
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1131
|
+
// fontWeight is derived from the Typography module, ensuring consistent font weighting across the app.
|
|
1132
|
+
return (
|
|
1133
|
+
// textDecoration conditionally applies 'line-through' or 'underline' based on respective boolean props; defaults to 'none' if both are false.
|
|
1134
|
+
React.createElement(Element, Object.assign({
|
|
1135
|
+
as: "label",
|
|
1136
|
+
// Spreads any additional style properties from headingStyles into the Element if a heading size is specified.
|
|
1137
|
+
width: "100%",
|
|
1138
|
+
// Spreads the rest of the props to support extensibility of the LabelView component for future use cases.
|
|
1139
|
+
fontSize: size,
|
|
1140
|
+
// Includes children elements inside the Element, allowing for nested content within the label.
|
|
1141
|
+
fontStyle: isItalic ? 'italic' : 'normal',
|
|
1142
|
+
fontWeight: Typography.fontWeights[weight],
|
|
1143
|
+
textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
|
|
1144
|
+
}, headingStyles, props), children)
|
|
1145
|
+
);
|
|
998
1146
|
};
|
|
999
1147
|
|
|
1148
|
+
// Import custom type 'LabelProps' to type check the properties passed into the Label component.
|
|
1000
1149
|
var LabelComponent = function LabelComponent(props) {
|
|
1001
|
-
return
|
|
1150
|
+
return (
|
|
1151
|
+
// Import 'LabelView' as a visual component for the label, separating the view from business logic.
|
|
1152
|
+
React.createElement(LabelView, Object.assign({}, props))
|
|
1153
|
+
// Define 'LabelComponent' as a functional component that uses React's FC type for type checking and utilizing React features.
|
|
1154
|
+
);
|
|
1002
1155
|
};
|
|
1156
|
+
// Pass all properties received by 'LabelComponent' to 'LabelView' using the spread syntax, ensuring it has all props needed for rendering.
|
|
1003
1157
|
var Label = LabelComponent;
|
|
1158
|
+
// Export the 'LabelComponent' as 'Label' to be reused throughout the project.
|
|
1004
1159
|
|
|
1005
1160
|
var Sizes = {
|
|
1006
1161
|
xs: {
|
|
@@ -1057,7 +1212,134 @@ var IconSizes$2 = {
|
|
|
1057
1212
|
'6xl': 60
|
|
1058
1213
|
};
|
|
1059
1214
|
|
|
1060
|
-
var
|
|
1215
|
+
var HeadingSizes$1 = {
|
|
1216
|
+
h1: {
|
|
1217
|
+
fontSize: 96,
|
|
1218
|
+
lineHeight: 112,
|
|
1219
|
+
letterSpacing: -1.5
|
|
1220
|
+
},
|
|
1221
|
+
h2: {
|
|
1222
|
+
fontSize: 60,
|
|
1223
|
+
lineHeight: 71,
|
|
1224
|
+
letterSpacing: -0.5
|
|
1225
|
+
},
|
|
1226
|
+
h3: {
|
|
1227
|
+
fontSize: 48,
|
|
1228
|
+
lineHeight: 57,
|
|
1229
|
+
letterSpacing: 0
|
|
1230
|
+
},
|
|
1231
|
+
h4: {
|
|
1232
|
+
fontSize: 34,
|
|
1233
|
+
lineHeight: 40,
|
|
1234
|
+
letterSpacing: 0.25
|
|
1235
|
+
},
|
|
1236
|
+
h5: {
|
|
1237
|
+
fontSize: 24,
|
|
1238
|
+
lineHeight: 28,
|
|
1239
|
+
letterSpacing: 0
|
|
1240
|
+
},
|
|
1241
|
+
h6: {
|
|
1242
|
+
fontSize: 20,
|
|
1243
|
+
lineHeight: 24,
|
|
1244
|
+
letterSpacing: 0.15
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
var _excluded$i = ["children", "heading", "maxLines", "isItalic", "isUnderlined", "isSub", "isSup", "isStriked", "isTruncated", "weight", "size"];
|
|
1249
|
+
var TextContent = function TextContent(_ref) {
|
|
1250
|
+
var children = _ref.children,
|
|
1251
|
+
isSub = _ref.isSub,
|
|
1252
|
+
isSup = _ref.isSup;
|
|
1253
|
+
return React.createElement(React.Fragment, null, typeof children === 'string' ? React.createElement(React.Fragment, null, isSub && React.createElement("sup", null, children), isSup && React.createElement("sup", null, children), !isSub && !isSup && React.createElement(React.Fragment, null, children)) : children);
|
|
1254
|
+
};
|
|
1255
|
+
var TruncateText = function TruncateText(_ref2) {
|
|
1256
|
+
var text = _ref2.text,
|
|
1257
|
+
_ref2$maxLines = _ref2.maxLines,
|
|
1258
|
+
maxLines = _ref2$maxLines === void 0 ? 1 : _ref2$maxLines;
|
|
1259
|
+
var containerRef = useRef(null);
|
|
1260
|
+
var _useState = useState(text.length),
|
|
1261
|
+
truncatedLength = _useState[0],
|
|
1262
|
+
setTruncatedLength = _useState[1];
|
|
1263
|
+
useEffect(function () {
|
|
1264
|
+
var textNode = containerRef.current;
|
|
1265
|
+
if (!textNode) return;
|
|
1266
|
+
var updateTruncatedText = function updateTruncatedText() {
|
|
1267
|
+
var comLineHeight = getComputedStyle(textNode).lineHeight;
|
|
1268
|
+
var lineHeight = comLineHeight !== 'normal' ? parseFloat(comLineHeight) : 20;
|
|
1269
|
+
var maxHeight = lineHeight * maxLines;
|
|
1270
|
+
var start = 0;
|
|
1271
|
+
var end = text.length;
|
|
1272
|
+
var middle;
|
|
1273
|
+
while (start <= end) {
|
|
1274
|
+
middle = Math.floor((start + end) / 2);
|
|
1275
|
+
textNode.innerText = text.substring(0, middle) + '...';
|
|
1276
|
+
var currentHeight = textNode.offsetHeight;
|
|
1277
|
+
if (currentHeight > maxHeight) {
|
|
1278
|
+
end = middle - 1;
|
|
1279
|
+
} else {
|
|
1280
|
+
start = middle + 1;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
setTruncatedLength(end);
|
|
1284
|
+
};
|
|
1285
|
+
updateTruncatedText();
|
|
1286
|
+
}, [text, maxLines]);
|
|
1287
|
+
var displayText = text.length > truncatedLength ? text.substring(0, truncatedLength) + '...' : text;
|
|
1288
|
+
return React.createElement("div", {
|
|
1289
|
+
ref: containerRef
|
|
1290
|
+
}, displayText);
|
|
1291
|
+
};
|
|
1292
|
+
var TextView = function TextView(_ref3) {
|
|
1293
|
+
var children = _ref3.children,
|
|
1294
|
+
heading = _ref3.heading,
|
|
1295
|
+
maxLines = _ref3.maxLines,
|
|
1296
|
+
_ref3$isItalic = _ref3.isItalic,
|
|
1297
|
+
isItalic = _ref3$isItalic === void 0 ? false : _ref3$isItalic,
|
|
1298
|
+
_ref3$isUnderlined = _ref3.isUnderlined,
|
|
1299
|
+
isUnderlined = _ref3$isUnderlined === void 0 ? false : _ref3$isUnderlined,
|
|
1300
|
+
_ref3$isSub = _ref3.isSub,
|
|
1301
|
+
isSub = _ref3$isSub === void 0 ? false : _ref3$isSub,
|
|
1302
|
+
_ref3$isSup = _ref3.isSup,
|
|
1303
|
+
isSup = _ref3$isSup === void 0 ? false : _ref3$isSup,
|
|
1304
|
+
_ref3$isStriked = _ref3.isStriked,
|
|
1305
|
+
isStriked = _ref3$isStriked === void 0 ? false : _ref3$isStriked,
|
|
1306
|
+
_ref3$isTruncated = _ref3.isTruncated,
|
|
1307
|
+
isTruncated = _ref3$isTruncated === void 0 ? false : _ref3$isTruncated,
|
|
1308
|
+
_ref3$weight = _ref3.weight,
|
|
1309
|
+
weight = _ref3$weight === void 0 ? 'normal' : _ref3$weight,
|
|
1310
|
+
_ref3$size = _ref3.size,
|
|
1311
|
+
size = _ref3$size === void 0 ? 'md' : _ref3$size,
|
|
1312
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded$i);
|
|
1313
|
+
var headingStyles = heading ? HeadingSizes$1[heading] : {};
|
|
1314
|
+
var noLineBreak = isSub || isSup ? {
|
|
1315
|
+
display: 'inline'
|
|
1316
|
+
} : {};
|
|
1317
|
+
var fontSize = Typography.fontSizes[size];
|
|
1318
|
+
return React.createElement(Element, Object.assign({
|
|
1319
|
+
role: "text",
|
|
1320
|
+
fontSize: fontSize,
|
|
1321
|
+
lineHeight: Typography.lineHeights[size],
|
|
1322
|
+
fontStyle: isItalic ? 'italic' : 'normal',
|
|
1323
|
+
fontWeight: Typography.fontWeights[weight],
|
|
1324
|
+
textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
|
|
1325
|
+
}, noLineBreak, headingStyles, props), isTruncated && maxLines && typeof children === 'string' ? React.createElement(TruncateText, {
|
|
1326
|
+
text: children,
|
|
1327
|
+
maxLines: maxLines
|
|
1328
|
+
}) : React.createElement(TextContent, Object.assign({
|
|
1329
|
+
isSub: isSub,
|
|
1330
|
+
isSup: isSup
|
|
1331
|
+
}, props), children));
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
var TextComponent = function TextComponent(props) {
|
|
1335
|
+
return React.createElement(TextView, Object.assign({}, props));
|
|
1336
|
+
};
|
|
1337
|
+
/**
|
|
1338
|
+
* 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.
|
|
1339
|
+
*/
|
|
1340
|
+
var Text = TextComponent;
|
|
1341
|
+
|
|
1342
|
+
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"];
|
|
1061
1343
|
var CheckboxView = function CheckboxView(_ref) {
|
|
1062
1344
|
var id = _ref.id,
|
|
1063
1345
|
icon = _ref.icon,
|
|
@@ -1094,7 +1376,8 @@ var CheckboxView = function CheckboxView(_ref) {
|
|
|
1094
1376
|
checkbox: {},
|
|
1095
1377
|
label: {}
|
|
1096
1378
|
} : _ref$styles,
|
|
1097
|
-
|
|
1379
|
+
infoText = _ref.infoText,
|
|
1380
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
1098
1381
|
var handleHover = function handleHover() {
|
|
1099
1382
|
return setIsHovered(!isHovered);
|
|
1100
1383
|
};
|
|
@@ -1135,9 +1418,22 @@ var CheckboxView = function CheckboxView(_ref) {
|
|
|
1135
1418
|
onMouseEnter: handleHover,
|
|
1136
1419
|
onMouseLeave: handleHover,
|
|
1137
1420
|
size: Typography.fontSizes[size]
|
|
1138
|
-
}, checkboxStyle.container, props),
|
|
1421
|
+
}, checkboxStyle.container, props), React.createElement(Vertical$1, {
|
|
1422
|
+
gap: 8
|
|
1423
|
+
}, React.createElement(Horizontal$1, {
|
|
1424
|
+
gap: 10,
|
|
1425
|
+
alignItems: "center"
|
|
1426
|
+
}, labelPosition === 'left' && label && React.createElement(Text, Object.assign({
|
|
1427
|
+
size: size
|
|
1428
|
+
}, styles == null ? void 0 : styles.label), label), React.createElement(Center, Object.assign({}, checkboxStyle.checkbox), isIndeterminate ? React.createElement(IndeterminateSvg, null) : (isChecked || isSelected) && (icon != null ? icon : React.createElement(CheckSvg, {
|
|
1139
1429
|
size: IconSizes$2[size]
|
|
1140
|
-
}))), labelPosition === 'right' && label && React.createElement(
|
|
1430
|
+
}))), labelPosition === 'right' && label && React.createElement(Text, Object.assign({
|
|
1431
|
+
size: size
|
|
1432
|
+
}, styles == null ? void 0 : styles.label), label)), infoText && React.createElement(Text, Object.assign({
|
|
1433
|
+
marginLeft: labelPosition === 'left' ? 0 : 27,
|
|
1434
|
+
color: "color.gray.400",
|
|
1435
|
+
size: "sm"
|
|
1436
|
+
}, styles == null ? void 0 : styles.infoText), infoText)));
|
|
1141
1437
|
};
|
|
1142
1438
|
|
|
1143
1439
|
var CheckboxComponent = function CheckboxComponent(props) {
|
|
@@ -2622,154 +2918,27 @@ var useCountryPickerState = function useCountryPickerState(_ref) {
|
|
|
2622
2918
|
isHovered = _React$useState5[0],
|
|
2623
2919
|
setIsHovered = _React$useState5[1];
|
|
2624
2920
|
return {
|
|
2625
|
-
hide: hide,
|
|
2626
|
-
setHide: setHide,
|
|
2627
|
-
newOptions: newOptions,
|
|
2628
|
-
setNewOptions: setNewOptions,
|
|
2629
|
-
isHovered: isHovered,
|
|
2630
|
-
setIsHovered: setIsHovered,
|
|
2631
|
-
isFocused: isFocused,
|
|
2632
|
-
setIsFocused: setIsFocused,
|
|
2633
|
-
value: value,
|
|
2634
|
-
setValue: setValue
|
|
2635
|
-
};
|
|
2636
|
-
};
|
|
2637
|
-
|
|
2638
|
-
var HeadingSizes$1 = {
|
|
2639
|
-
h1: {
|
|
2640
|
-
fontSize: 96,
|
|
2641
|
-
lineHeight: 112,
|
|
2642
|
-
letterSpacing: -1.5
|
|
2643
|
-
},
|
|
2644
|
-
h2: {
|
|
2645
|
-
fontSize: 60,
|
|
2646
|
-
lineHeight: 71,
|
|
2647
|
-
letterSpacing: -0.5
|
|
2648
|
-
},
|
|
2649
|
-
h3: {
|
|
2650
|
-
fontSize: 48,
|
|
2651
|
-
lineHeight: 57,
|
|
2652
|
-
letterSpacing: 0
|
|
2653
|
-
},
|
|
2654
|
-
h4: {
|
|
2655
|
-
fontSize: 34,
|
|
2656
|
-
lineHeight: 40,
|
|
2657
|
-
letterSpacing: 0.25
|
|
2658
|
-
},
|
|
2659
|
-
h5: {
|
|
2660
|
-
fontSize: 24,
|
|
2661
|
-
lineHeight: 28,
|
|
2662
|
-
letterSpacing: 0
|
|
2663
|
-
},
|
|
2664
|
-
h6: {
|
|
2665
|
-
fontSize: 20,
|
|
2666
|
-
lineHeight: 24,
|
|
2667
|
-
letterSpacing: 0.15
|
|
2668
|
-
}
|
|
2669
|
-
};
|
|
2670
|
-
|
|
2671
|
-
var _excluded$g = ["children", "heading", "maxLines", "isItalic", "isUnderlined", "isSub", "isSup", "isStriked", "isTruncated", "weight", "size"];
|
|
2672
|
-
var TextContent = function TextContent(_ref) {
|
|
2673
|
-
var children = _ref.children,
|
|
2674
|
-
isSub = _ref.isSub,
|
|
2675
|
-
isSup = _ref.isSup;
|
|
2676
|
-
return React.createElement(React.Fragment, null, typeof children === 'string' ? React.createElement(React.Fragment, null, isSub && React.createElement("sup", null, children), isSup && React.createElement("sup", null, children), !isSub && !isSup && React.createElement(React.Fragment, null, children)) : children);
|
|
2677
|
-
};
|
|
2678
|
-
var TruncateText = function TruncateText(_ref2) {
|
|
2679
|
-
var text = _ref2.text,
|
|
2680
|
-
_ref2$maxLines = _ref2.maxLines,
|
|
2681
|
-
maxLines = _ref2$maxLines === void 0 ? 1 : _ref2$maxLines;
|
|
2682
|
-
var containerRef = useRef(null);
|
|
2683
|
-
var _useState = useState(text.length),
|
|
2684
|
-
truncatedLength = _useState[0],
|
|
2685
|
-
setTruncatedLength = _useState[1];
|
|
2686
|
-
useEffect(function () {
|
|
2687
|
-
var textNode = containerRef.current;
|
|
2688
|
-
if (!textNode) return;
|
|
2689
|
-
var updateTruncatedText = function updateTruncatedText() {
|
|
2690
|
-
var comLineHeight = getComputedStyle(textNode).lineHeight;
|
|
2691
|
-
var lineHeight = comLineHeight !== 'normal' ? parseFloat(comLineHeight) : 20;
|
|
2692
|
-
var maxHeight = lineHeight * maxLines;
|
|
2693
|
-
var start = 0;
|
|
2694
|
-
var end = text.length;
|
|
2695
|
-
var middle;
|
|
2696
|
-
while (start <= end) {
|
|
2697
|
-
middle = Math.floor((start + end) / 2);
|
|
2698
|
-
textNode.innerText = text.substring(0, middle) + '...';
|
|
2699
|
-
var currentHeight = textNode.offsetHeight;
|
|
2700
|
-
if (currentHeight > maxHeight) {
|
|
2701
|
-
end = middle - 1;
|
|
2702
|
-
} else {
|
|
2703
|
-
start = middle + 1;
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
setTruncatedLength(end);
|
|
2707
|
-
};
|
|
2708
|
-
updateTruncatedText();
|
|
2709
|
-
}, [text, maxLines]);
|
|
2710
|
-
var displayText = text.length > truncatedLength ? text.substring(0, truncatedLength) + '...' : text;
|
|
2711
|
-
return React.createElement("div", {
|
|
2712
|
-
ref: containerRef
|
|
2713
|
-
}, displayText);
|
|
2714
|
-
};
|
|
2715
|
-
var TextView = function TextView(_ref3) {
|
|
2716
|
-
var children = _ref3.children,
|
|
2717
|
-
heading = _ref3.heading,
|
|
2718
|
-
maxLines = _ref3.maxLines,
|
|
2719
|
-
_ref3$isItalic = _ref3.isItalic,
|
|
2720
|
-
isItalic = _ref3$isItalic === void 0 ? false : _ref3$isItalic,
|
|
2721
|
-
_ref3$isUnderlined = _ref3.isUnderlined,
|
|
2722
|
-
isUnderlined = _ref3$isUnderlined === void 0 ? false : _ref3$isUnderlined,
|
|
2723
|
-
_ref3$isSub = _ref3.isSub,
|
|
2724
|
-
isSub = _ref3$isSub === void 0 ? false : _ref3$isSub,
|
|
2725
|
-
_ref3$isSup = _ref3.isSup,
|
|
2726
|
-
isSup = _ref3$isSup === void 0 ? false : _ref3$isSup,
|
|
2727
|
-
_ref3$isStriked = _ref3.isStriked,
|
|
2728
|
-
isStriked = _ref3$isStriked === void 0 ? false : _ref3$isStriked,
|
|
2729
|
-
_ref3$isTruncated = _ref3.isTruncated,
|
|
2730
|
-
isTruncated = _ref3$isTruncated === void 0 ? false : _ref3$isTruncated,
|
|
2731
|
-
_ref3$weight = _ref3.weight,
|
|
2732
|
-
weight = _ref3$weight === void 0 ? 'normal' : _ref3$weight,
|
|
2733
|
-
_ref3$size = _ref3.size,
|
|
2734
|
-
size = _ref3$size === void 0 ? 'md' : _ref3$size,
|
|
2735
|
-
props = _objectWithoutPropertiesLoose(_ref3, _excluded$g);
|
|
2736
|
-
var headingStyles = heading ? HeadingSizes$1[heading] : {};
|
|
2737
|
-
var noLineBreak = isSub || isSup ? {
|
|
2738
|
-
display: 'inline'
|
|
2739
|
-
} : {};
|
|
2740
|
-
var fontSize = Typography.fontSizes[size];
|
|
2741
|
-
return React.createElement(Element, Object.assign({
|
|
2742
|
-
role: "text",
|
|
2743
|
-
fontSize: fontSize,
|
|
2744
|
-
lineHeight: Typography.lineHeights[size],
|
|
2745
|
-
fontStyle: isItalic ? 'italic' : 'normal',
|
|
2746
|
-
fontWeight: Typography.fontWeights[weight],
|
|
2747
|
-
textDecoration: isStriked ? 'line-through' : isUnderlined ? 'underline' : 'none'
|
|
2748
|
-
}, noLineBreak, headingStyles, props), isTruncated && maxLines && typeof children === 'string' ? React.createElement(TruncateText, {
|
|
2749
|
-
text: children,
|
|
2750
|
-
maxLines: maxLines
|
|
2751
|
-
}) : React.createElement(TextContent, Object.assign({
|
|
2752
|
-
isSub: isSub,
|
|
2753
|
-
isSup: isSup
|
|
2754
|
-
}, props), children));
|
|
2755
|
-
};
|
|
2756
|
-
|
|
2757
|
-
var TextComponent = function TextComponent(props) {
|
|
2758
|
-
return React.createElement(TextView, Object.assign({}, props));
|
|
2921
|
+
hide: hide,
|
|
2922
|
+
setHide: setHide,
|
|
2923
|
+
newOptions: newOptions,
|
|
2924
|
+
setNewOptions: setNewOptions,
|
|
2925
|
+
isHovered: isHovered,
|
|
2926
|
+
setIsHovered: setIsHovered,
|
|
2927
|
+
isFocused: isFocused,
|
|
2928
|
+
setIsFocused: setIsFocused,
|
|
2929
|
+
value: value,
|
|
2930
|
+
setValue: setValue
|
|
2931
|
+
};
|
|
2759
2932
|
};
|
|
2760
|
-
/**
|
|
2761
|
-
* 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.
|
|
2762
|
-
*/
|
|
2763
|
-
var Text = TextComponent;
|
|
2764
2933
|
|
|
2765
|
-
var _excluded$
|
|
2934
|
+
var _excluded$k = ["children", "styles"];
|
|
2766
2935
|
var HelperText = function HelperText(_ref) {
|
|
2767
2936
|
var children = _ref.children,
|
|
2768
2937
|
_ref$styles = _ref.styles,
|
|
2769
2938
|
styles = _ref$styles === void 0 ? {
|
|
2770
2939
|
helperText: {}
|
|
2771
2940
|
} : _ref$styles,
|
|
2772
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
2941
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
|
2773
2942
|
return React.createElement(Text, Object.assign({
|
|
2774
2943
|
size: "xs",
|
|
2775
2944
|
marginVertical: 0,
|
|
@@ -2778,7 +2947,7 @@ var HelperText = function HelperText(_ref) {
|
|
|
2778
2947
|
}, styles['helperText'], props), children);
|
|
2779
2948
|
};
|
|
2780
2949
|
|
|
2781
|
-
var _excluded$
|
|
2950
|
+
var _excluded$l = ["children", "wrap", "justify", "isReversed"];
|
|
2782
2951
|
var VerticalView = function VerticalView(_ref) {
|
|
2783
2952
|
var children = _ref.children,
|
|
2784
2953
|
_ref$wrap = _ref.wrap,
|
|
@@ -2787,7 +2956,7 @@ var VerticalView = function VerticalView(_ref) {
|
|
|
2787
2956
|
justify = _ref$justify === void 0 ? 'flex-start' : _ref$justify,
|
|
2788
2957
|
_ref$isReversed = _ref.isReversed,
|
|
2789
2958
|
isReversed = _ref$isReversed === void 0 ? false : _ref$isReversed,
|
|
2790
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
2959
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
2791
2960
|
return React.createElement(View$1, Object.assign({
|
|
2792
2961
|
display: "flex",
|
|
2793
2962
|
flexWrap: wrap,
|
|
@@ -2804,14 +2973,14 @@ var VerticalComponent = function VerticalComponent(props) {
|
|
|
2804
2973
|
};
|
|
2805
2974
|
var Vertical = VerticalComponent;
|
|
2806
2975
|
|
|
2807
|
-
var _excluded$
|
|
2976
|
+
var _excluded$m = ["children", "helperText", "error", "styles"];
|
|
2808
2977
|
var FieldContainer = function FieldContainer(_ref) {
|
|
2809
2978
|
var children = _ref.children,
|
|
2810
2979
|
helperText = _ref.helperText,
|
|
2811
2980
|
_ref$error = _ref.error,
|
|
2812
2981
|
error = _ref$error === void 0 ? false : _ref$error,
|
|
2813
2982
|
styles = _ref.styles,
|
|
2814
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
2983
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$m);
|
|
2815
2984
|
return React.createElement(Vertical, Object.assign({
|
|
2816
2985
|
gap: 5,
|
|
2817
2986
|
position: "relative"
|
|
@@ -2870,7 +3039,7 @@ var PaddingWithoutLabel = {
|
|
|
2870
3039
|
paddingRight: 36
|
|
2871
3040
|
};
|
|
2872
3041
|
|
|
2873
|
-
var _excluded$
|
|
3042
|
+
var _excluded$n = ["label", "shadow", "children", "value", "size", "shape", "variant", "error", "isWithLabel", "isFocused", "isHovered", "isDisabled", "isReadOnly", "colorScheme", "styles"];
|
|
2874
3043
|
var FieldContent = function FieldContent(_ref) {
|
|
2875
3044
|
var shadow = _ref.shadow,
|
|
2876
3045
|
children = _ref.children,
|
|
@@ -2898,7 +3067,7 @@ var FieldContent = function FieldContent(_ref) {
|
|
|
2898
3067
|
styles = _ref$styles === void 0 ? {
|
|
2899
3068
|
pickerBox: {}
|
|
2900
3069
|
} : _ref$styles,
|
|
2901
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3070
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
|
2902
3071
|
var isInteractive = (isHovered || isFocused) && !isDisabled;
|
|
2903
3072
|
var color = error ? 'error' : isInteractive ? colorScheme : 'midgray';
|
|
2904
3073
|
return React.createElement(Horizontal, Object.assign({
|
|
@@ -2919,10 +3088,10 @@ var FieldContent = function FieldContent(_ref) {
|
|
|
2919
3088
|
}, isWithLabel ? PadddingWithLabel : PaddingWithoutLabel, shadow, Shapes[shape], InputVariants[variant], styles['box'], props), children);
|
|
2920
3089
|
};
|
|
2921
3090
|
|
|
2922
|
-
var _excluded$
|
|
3091
|
+
var _excluded$o = ["children"];
|
|
2923
3092
|
var FieldIcons = function FieldIcons(_ref) {
|
|
2924
3093
|
var children = _ref.children,
|
|
2925
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3094
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
2926
3095
|
return React.createElement(Center, Object.assign({
|
|
2927
3096
|
gap: 10,
|
|
2928
3097
|
right: 16,
|
|
@@ -2932,7 +3101,7 @@ var FieldIcons = function FieldIcons(_ref) {
|
|
|
2932
3101
|
}, props), children);
|
|
2933
3102
|
};
|
|
2934
3103
|
|
|
2935
|
-
var _excluded$
|
|
3104
|
+
var _excluded$p = ["children", "size", "error", "color", "styles"];
|
|
2936
3105
|
var FieldLabel = function FieldLabel(_ref) {
|
|
2937
3106
|
var children = _ref.children,
|
|
2938
3107
|
_ref$size = _ref.size,
|
|
@@ -2945,7 +3114,7 @@ var FieldLabel = function FieldLabel(_ref) {
|
|
|
2945
3114
|
styles = _ref$styles === void 0 ? {
|
|
2946
3115
|
label: {}
|
|
2947
3116
|
} : _ref$styles,
|
|
2948
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3117
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
2949
3118
|
return React.createElement(Label, Object.assign({
|
|
2950
3119
|
top: 6,
|
|
2951
3120
|
zIndex: 1000,
|
|
@@ -2958,10 +3127,10 @@ var FieldLabel = function FieldLabel(_ref) {
|
|
|
2958
3127
|
}, styles['label'], props), children);
|
|
2959
3128
|
};
|
|
2960
3129
|
|
|
2961
|
-
var _excluded$
|
|
3130
|
+
var _excluded$q = ["children"];
|
|
2962
3131
|
var FieldWrapper = function FieldWrapper(_ref) {
|
|
2963
3132
|
var children = _ref.children,
|
|
2964
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3133
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
2965
3134
|
return React.createElement(Vertical, Object.assign({
|
|
2966
3135
|
width: "100%"
|
|
2967
3136
|
}, props), children);
|
|
@@ -2975,7 +3144,7 @@ var IconSizes$3 = {
|
|
|
2975
3144
|
xl: 16
|
|
2976
3145
|
};
|
|
2977
3146
|
|
|
2978
|
-
var _excluded$
|
|
3147
|
+
var _excluded$r = ["id", "name", "label", "value", "placeholder", "helperText", "hide", "error", "isHovered", "isFocused", "isAutoFocus", "isDisabled", "isReadOnly", "shadow", "newOptions", "size", "variant", "shape", "colorScheme", "onChange", "onBlur", "setHide", "setNewOptions", "setIsHovered", "setIsFocused", "setValue", "styles"];
|
|
2979
3148
|
var CountryList = function CountryList(props) {
|
|
2980
3149
|
return React.createElement(Element, Object.assign({
|
|
2981
3150
|
as: "ul"
|
|
@@ -3115,7 +3284,7 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3115
3284
|
helperText: {},
|
|
3116
3285
|
box: {}
|
|
3117
3286
|
} : _ref3$styles,
|
|
3118
|
-
props = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
|
3287
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded$r);
|
|
3119
3288
|
var _useTheme = useTheme(),
|
|
3120
3289
|
getColor = _useTheme.getColor;
|
|
3121
3290
|
var IconColor = getColor('color.blueGray.700');
|
|
@@ -3253,7 +3422,7 @@ var useDatePickerState = function useDatePickerState() {
|
|
|
3253
3422
|
};
|
|
3254
3423
|
};
|
|
3255
3424
|
|
|
3256
|
-
var _excluded$
|
|
3425
|
+
var _excluded$s = ["id", "icon", "name", "label", "date", "children", "helperText", "shadow", "size", "variant", "shape", "colorScheme", "styles", "error", "isHovered", "isFocused", "isDisabled", "isReadOnly", "setDate", "setIsFocused", "setIsHovered", "onChange", "onChangeText"];
|
|
3257
3426
|
var DatePickerContent = function DatePickerContent(props) {
|
|
3258
3427
|
return React.createElement(Input, Object.assign({
|
|
3259
3428
|
type: "date"
|
|
@@ -3301,7 +3470,7 @@ var DatePickerView = function DatePickerView(_ref) {
|
|
|
3301
3470
|
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
3302
3471
|
onChange = _ref.onChange,
|
|
3303
3472
|
onChangeText = _ref.onChangeText,
|
|
3304
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3473
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
3305
3474
|
var isWithLabel = !!(isFocused && label);
|
|
3306
3475
|
var handleHover = function handleHover() {
|
|
3307
3476
|
return setIsHovered(!isHovered);
|
|
@@ -3426,7 +3595,7 @@ var usePasswordState = function usePasswordState(props) {
|
|
|
3426
3595
|
}, props, textFieldStates);
|
|
3427
3596
|
};
|
|
3428
3597
|
|
|
3429
|
-
var _excluded$
|
|
3598
|
+
var _excluded$t = ["id", "name", "label", "hint", "value", "onChange", "leftChild", "rightChild", "helperText", "placeholder", "onChangeText", "shadow", "styles", "size", "shape", "variant", "colorScheme", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isClearable", "isAutoFocus", "setHint", "setIsFocused", "setIsHovered", "setValue", "onClick", "onFocus", "onBlur"];
|
|
3430
3599
|
var TextFieldInput = function TextFieldInput(props) {
|
|
3431
3600
|
return React.createElement(Input, Object.assign({
|
|
3432
3601
|
type: "text"
|
|
@@ -3484,7 +3653,7 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3484
3653
|
onFocus = _ref.onFocus,
|
|
3485
3654
|
_ref$onBlur = _ref.onBlur,
|
|
3486
3655
|
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
3487
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3656
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
3488
3657
|
var _useTheme = useTheme(),
|
|
3489
3658
|
getColor = _useTheme.getColor;
|
|
3490
3659
|
var IconColor = getColor('color.blueGray.700');
|
|
@@ -3592,7 +3761,7 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3592
3761
|
}), rightChild && React.createElement(React.Fragment, null, rightChild))));
|
|
3593
3762
|
};
|
|
3594
3763
|
|
|
3595
|
-
var _excluded$
|
|
3764
|
+
var _excluded$u = ["visibleIcon", "hiddenIcon"],
|
|
3596
3765
|
_excluded2$1 = ["isVisible", "setIsVisible"];
|
|
3597
3766
|
var PasswordComponent = function PasswordComponent(_ref) {
|
|
3598
3767
|
var _ref$visibleIcon = _ref.visibleIcon,
|
|
@@ -3603,7 +3772,7 @@ var PasswordComponent = function PasswordComponent(_ref) {
|
|
|
3603
3772
|
hiddenIcon = _ref$hiddenIcon === void 0 ? React.createElement(CloseEyeSvg, {
|
|
3604
3773
|
size: 14
|
|
3605
3774
|
}) : _ref$hiddenIcon,
|
|
3606
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3775
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
3607
3776
|
var _usePasswordState = usePasswordState(props),
|
|
3608
3777
|
isVisible = _usePasswordState.isVisible,
|
|
3609
3778
|
setIsVisible = _usePasswordState.setIsVisible,
|
|
@@ -3642,6 +3811,9 @@ var useSelectState = function useSelectState(_ref) {
|
|
|
3642
3811
|
var _React$useState4 = React.useState(defaultValue),
|
|
3643
3812
|
value = _React$useState4[0],
|
|
3644
3813
|
setValue = _React$useState4[1];
|
|
3814
|
+
var _React$useState5 = React.useState(0),
|
|
3815
|
+
highlightedIndex = _React$useState5[0],
|
|
3816
|
+
setHighlightedIndex = _React$useState5[1];
|
|
3645
3817
|
return {
|
|
3646
3818
|
value: value,
|
|
3647
3819
|
setValue: setValue,
|
|
@@ -3650,13 +3822,15 @@ var useSelectState = function useSelectState(_ref) {
|
|
|
3650
3822
|
isHovered: isHovered,
|
|
3651
3823
|
setIsHovered: setIsHovered,
|
|
3652
3824
|
isFocused: isFocused,
|
|
3653
|
-
setIsFocused: setIsFocused
|
|
3825
|
+
setIsFocused: setIsFocused,
|
|
3826
|
+
highlightedIndex: highlightedIndex,
|
|
3827
|
+
setHighlightedIndex: setHighlightedIndex
|
|
3654
3828
|
};
|
|
3655
3829
|
};
|
|
3656
3830
|
var useItemState = function useItemState() {
|
|
3657
|
-
var _React$
|
|
3658
|
-
isHovered = _React$
|
|
3659
|
-
setIsHovered = _React$
|
|
3831
|
+
var _React$useState6 = React.useState(false),
|
|
3832
|
+
isHovered = _React$useState6[0],
|
|
3833
|
+
setIsHovered = _React$useState6[1];
|
|
3660
3834
|
return {
|
|
3661
3835
|
isHovered: isHovered,
|
|
3662
3836
|
setIsHovered: setIsHovered
|
|
@@ -3671,10 +3845,10 @@ var IconSizes$4 = {
|
|
|
3671
3845
|
xl: 16
|
|
3672
3846
|
};
|
|
3673
3847
|
|
|
3674
|
-
var _excluded$
|
|
3848
|
+
var _excluded$v = ["isHovered", "setIsHovered", "option", "size", "callback"],
|
|
3675
3849
|
_excluded2$2 = ["id", "name", "value", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
|
|
3676
3850
|
_excluded3$1 = ["option", "size", "removeOption"],
|
|
3677
|
-
_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"];
|
|
3851
|
+
_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"];
|
|
3678
3852
|
var Item = function Item(_ref) {
|
|
3679
3853
|
var isHovered = _ref.isHovered,
|
|
3680
3854
|
setIsHovered = _ref.setIsHovered,
|
|
@@ -3683,7 +3857,7 @@ var Item = function Item(_ref) {
|
|
|
3683
3857
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3684
3858
|
_ref$callback = _ref.callback,
|
|
3685
3859
|
callback = _ref$callback === void 0 ? function () {} : _ref$callback,
|
|
3686
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3860
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$v);
|
|
3687
3861
|
var handleOptionClick = function handleOptionClick(option) {
|
|
3688
3862
|
return callback(option);
|
|
3689
3863
|
};
|
|
@@ -3693,7 +3867,7 @@ var Item = function Item(_ref) {
|
|
|
3693
3867
|
return React.createElement(Element, Object.assign({
|
|
3694
3868
|
as: "li",
|
|
3695
3869
|
margin: 0,
|
|
3696
|
-
paddingVertical:
|
|
3870
|
+
paddingVertical: 10,
|
|
3697
3871
|
paddingHorizontal: 12,
|
|
3698
3872
|
listStyleType: "none",
|
|
3699
3873
|
onMouseEnter: handleHover,
|
|
@@ -3703,7 +3877,7 @@ var Item = function Item(_ref) {
|
|
|
3703
3877
|
return handleOptionClick(option);
|
|
3704
3878
|
},
|
|
3705
3879
|
backgroundColor: isHovered ? 'trueGray.100' : 'transparent'
|
|
3706
|
-
}, props), option);
|
|
3880
|
+
}, props), React.createElement(Text, null, " ", option));
|
|
3707
3881
|
};
|
|
3708
3882
|
var SelectBox = function SelectBox(_ref2) {
|
|
3709
3883
|
var _ref2$size = _ref2.size,
|
|
@@ -3785,7 +3959,9 @@ var DropDown$1 = function DropDown(_ref4) {
|
|
|
3785
3959
|
} : _ref4$styles,
|
|
3786
3960
|
options = _ref4.options,
|
|
3787
3961
|
_ref4$callback = _ref4.callback,
|
|
3788
|
-
callback = _ref4$callback === void 0 ? function () {} : _ref4$callback
|
|
3962
|
+
callback = _ref4$callback === void 0 ? function () {} : _ref4$callback,
|
|
3963
|
+
highlightedIndex = _ref4.highlightedIndex,
|
|
3964
|
+
setHighlightedIndex = _ref4.setHighlightedIndex;
|
|
3789
3965
|
var itemStates = useItemState();
|
|
3790
3966
|
var handleCallback = function handleCallback(option) {
|
|
3791
3967
|
return callback(option);
|
|
@@ -3809,7 +3985,7 @@ var DropDown$1 = function DropDown(_ref4) {
|
|
|
3809
3985
|
width: "100%",
|
|
3810
3986
|
display: "flex",
|
|
3811
3987
|
zIndex: 1000,
|
|
3812
|
-
overflowY: "
|
|
3988
|
+
overflowY: "scroll",
|
|
3813
3989
|
marginTop: 5,
|
|
3814
3990
|
marginLeft: 0,
|
|
3815
3991
|
marginRight: 0,
|
|
@@ -3819,13 +3995,24 @@ var DropDown$1 = function DropDown(_ref4) {
|
|
|
3819
3995
|
position: "absolute",
|
|
3820
3996
|
flexDirection: "column",
|
|
3821
3997
|
backgroundColor: "white",
|
|
3822
|
-
|
|
3823
|
-
|
|
3998
|
+
maxHeight: "200px",
|
|
3999
|
+
style: {
|
|
4000
|
+
scrollbarWidth: 'none' /* For Firefox */,
|
|
4001
|
+
msOverflowStyle: 'none' /* For Internet Explorer and Edge */,
|
|
4002
|
+
'&::-webkit-scrollbar': {
|
|
4003
|
+
display: 'none' /* For Chrome, Safari, and Opera */
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
}, shadow, styles['dropDown']), options.map(function (option, index) {
|
|
3824
4007
|
return React.createElement(Item, Object.assign({
|
|
3825
4008
|
key: option,
|
|
3826
4009
|
size: size,
|
|
3827
4010
|
option: option,
|
|
3828
|
-
callback: handleCallback
|
|
4011
|
+
callback: handleCallback,
|
|
4012
|
+
backgroundColor: index === highlightedIndex ? 'color.gray.100' : 'transparent',
|
|
4013
|
+
onMouseEnter: function onMouseEnter() {
|
|
4014
|
+
return setHighlightedIndex(index);
|
|
4015
|
+
}
|
|
3829
4016
|
}, itemStates, styles['text']));
|
|
3830
4017
|
}));
|
|
3831
4018
|
};
|
|
@@ -3910,6 +4097,8 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3910
4097
|
setIsHovered = _ref6$setIsHovered === void 0 ? function () {} : _ref6$setIsHovered,
|
|
3911
4098
|
_ref6$setIsFocused = _ref6.setIsFocused,
|
|
3912
4099
|
setIsFocused = _ref6$setIsFocused === void 0 ? function () {} : _ref6$setIsFocused,
|
|
4100
|
+
setHighlightedIndex = _ref6.setHighlightedIndex,
|
|
4101
|
+
highlightedIndex = _ref6.highlightedIndex,
|
|
3913
4102
|
props = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);
|
|
3914
4103
|
var isWithLabel = !!(isFocused && label);
|
|
3915
4104
|
var handleHover = function handleHover() {
|
|
@@ -3997,7 +4186,9 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3997
4186
|
size: size,
|
|
3998
4187
|
styles: styles,
|
|
3999
4188
|
options: options,
|
|
4000
|
-
callback: handleCallback
|
|
4189
|
+
callback: handleCallback,
|
|
4190
|
+
highlightedIndex: highlightedIndex,
|
|
4191
|
+
setHighlightedIndex: setHighlightedIndex
|
|
4001
4192
|
}));
|
|
4002
4193
|
};
|
|
4003
4194
|
|
|
@@ -4154,7 +4345,7 @@ var SliderPadding = {
|
|
|
4154
4345
|
}
|
|
4155
4346
|
};
|
|
4156
4347
|
|
|
4157
|
-
var _excluded$
|
|
4348
|
+
var _excluded$w = ["id", "name", "label", "inActiveChild", "activeChild", "labelPosition", "shadow", "size", "colorScheme", "value", "isHovered", "isDisabled", "isReadOnly", "onChange", "setValue", "setIsHovered", "styles"];
|
|
4158
4349
|
var SwitchContent = function SwitchContent(props) {
|
|
4159
4350
|
return React.createElement(Input, Object.assign({
|
|
4160
4351
|
type: "checkbox"
|
|
@@ -4193,7 +4384,7 @@ var SwitchView = function SwitchView(_ref) {
|
|
|
4193
4384
|
circle: {},
|
|
4194
4385
|
label: {}
|
|
4195
4386
|
} : _ref$styles,
|
|
4196
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4387
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$w);
|
|
4197
4388
|
var handleToggle = function handleToggle(event) {
|
|
4198
4389
|
if (!isReadOnly) {
|
|
4199
4390
|
setValue(!value);
|
|
@@ -4279,7 +4470,7 @@ var useTextAreaState = function useTextAreaState(_ref) {
|
|
|
4279
4470
|
};
|
|
4280
4471
|
};
|
|
4281
4472
|
|
|
4282
|
-
var _excluded$
|
|
4473
|
+
var _excluded$x = ["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"];
|
|
4283
4474
|
var TextAreaView = function TextAreaView(_ref) {
|
|
4284
4475
|
var id = _ref.id,
|
|
4285
4476
|
name = _ref.name,
|
|
@@ -4334,7 +4525,7 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4334
4525
|
helperText: {},
|
|
4335
4526
|
field: {}
|
|
4336
4527
|
} : _ref$styles,
|
|
4337
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4528
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$x);
|
|
4338
4529
|
var isWithLabel = !!(isFocused && label);
|
|
4339
4530
|
var fieldStyles = _extends({
|
|
4340
4531
|
margin: 0,
|
|
@@ -4502,7 +4693,7 @@ var FormikForm = function FormikForm(_ref) {
|
|
|
4502
4693
|
}, React.createElement(Form, null, children));
|
|
4503
4694
|
};
|
|
4504
4695
|
|
|
4505
|
-
var _excluded$
|
|
4696
|
+
var _excluded$y = ["name", "type"];
|
|
4506
4697
|
var getInputTypeProps = function getInputTypeProps(type) {
|
|
4507
4698
|
switch (type) {
|
|
4508
4699
|
case 'email':
|
|
@@ -4532,7 +4723,7 @@ var getInputTypeProps = function getInputTypeProps(type) {
|
|
|
4532
4723
|
var useFormikInput = function useFormikInput(_ref) {
|
|
4533
4724
|
var name = _ref.name,
|
|
4534
4725
|
type = _ref.type,
|
|
4535
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4726
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$y);
|
|
4536
4727
|
var focus = useFormFocus();
|
|
4537
4728
|
var _useFormikContext = useFormikContext(),
|
|
4538
4729
|
touched = _useFormikContext.touched,
|
|
@@ -4579,11 +4770,11 @@ var useFormikInput = function useFormikInput(_ref) {
|
|
|
4579
4770
|
// import FormRater from 'src/Rate/Rate';
|
|
4580
4771
|
// import Upload from 'src/Upload/Upload';
|
|
4581
4772
|
|
|
4582
|
-
var _excluded$
|
|
4773
|
+
var _excluded$z = ["value"];
|
|
4583
4774
|
var CheckboxComponent$1 = function CheckboxComponent(props) {
|
|
4584
4775
|
var _useFormikInput = useFormikInput(props),
|
|
4585
4776
|
value = _useFormikInput.value,
|
|
4586
|
-
formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$
|
|
4777
|
+
formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$z);
|
|
4587
4778
|
formProps.isChecked = value;
|
|
4588
4779
|
var checkboxStates = useCheckboxState(props);
|
|
4589
4780
|
return React.createElement(CheckboxView, Object.assign({}, checkboxStates, formProps));
|
|
@@ -4641,11 +4832,11 @@ var TextAreaComponent$1 = function TextAreaComponent(props) {
|
|
|
4641
4832
|
*/
|
|
4642
4833
|
var FormikTextArea = TextAreaComponent$1;
|
|
4643
4834
|
|
|
4644
|
-
var _excluded$
|
|
4835
|
+
var _excluded$A = ["value"];
|
|
4645
4836
|
var TextFieldComponent$1 = function TextFieldComponent(props) {
|
|
4646
4837
|
var formProps = useFormikInput(props);
|
|
4647
4838
|
var _useTextFieldState = useTextFieldState(props),
|
|
4648
|
-
textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$
|
|
4839
|
+
textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$A);
|
|
4649
4840
|
return React.createElement(TextFieldView, Object.assign({}, textFieldStates, formProps));
|
|
4650
4841
|
};
|
|
4651
4842
|
/**
|
|
@@ -4653,7 +4844,7 @@ var TextFieldComponent$1 = function TextFieldComponent(props) {
|
|
|
4653
4844
|
*/
|
|
4654
4845
|
var FormikTextField = TextFieldComponent$1;
|
|
4655
4846
|
|
|
4656
|
-
var _excluded$
|
|
4847
|
+
var _excluded$B = ["visibleIcon", "hiddenIcon"],
|
|
4657
4848
|
_excluded2$3 = ["isVisible", "setIsVisible"];
|
|
4658
4849
|
var PasswordComponent$1 = function PasswordComponent(_ref) {
|
|
4659
4850
|
var _ref$visibleIcon = _ref.visibleIcon,
|
|
@@ -4664,7 +4855,7 @@ var PasswordComponent$1 = function PasswordComponent(_ref) {
|
|
|
4664
4855
|
hiddenIcon = _ref$hiddenIcon === void 0 ? React.createElement(CloseEyeSvg, {
|
|
4665
4856
|
size: 14
|
|
4666
4857
|
}) : _ref$hiddenIcon,
|
|
4667
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4858
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$B);
|
|
4668
4859
|
var formProps = useFormikInput(props);
|
|
4669
4860
|
var _usePasswordState = usePasswordState(formProps),
|
|
4670
4861
|
isVisible = _usePasswordState.isVisible,
|
|
@@ -4687,6 +4878,281 @@ var PasswordComponent$1 = function PasswordComponent(_ref) {
|
|
|
4687
4878
|
*/
|
|
4688
4879
|
var FormikPassword = PasswordComponent$1;
|
|
4689
4880
|
|
|
4881
|
+
// Defines the useComboBoxState hook with parameters for the list of items and optional placeholder texts.
|
|
4882
|
+
var useComboBoxState = function useComboBoxState(items, placeholder, searchPlaceholder) {
|
|
4883
|
+
// State hook for filtered items with initial state set to the items passed to the hook.
|
|
4884
|
+
var _useState = useState(items),
|
|
4885
|
+
filteredItems = _useState[0],
|
|
4886
|
+
setFilteredItems = _useState[1];
|
|
4887
|
+
// State hook to track the selected item with an initial state based on the placeholder or the first item.
|
|
4888
|
+
var _useState2 = useState(placeholder ? {
|
|
4889
|
+
value: placeholder,
|
|
4890
|
+
label: placeholder
|
|
4891
|
+
} : items[0]),
|
|
4892
|
+
selectedItem = _useState2[0],
|
|
4893
|
+
setSelectedItem = _useState2[1];
|
|
4894
|
+
// State hook for highlighted index in the dropdown list, initialized to 0.
|
|
4895
|
+
var _useState3 = useState(0),
|
|
4896
|
+
highlightedIndex = _useState3[0],
|
|
4897
|
+
setHighlightedIndex = _useState3[1];
|
|
4898
|
+
// State hook for search query with an initial state based on the searchPlaceholder or empty string.
|
|
4899
|
+
var _useState4 = useState(searchPlaceholder != null ? searchPlaceholder : ''),
|
|
4900
|
+
searchQuery = _useState4[0],
|
|
4901
|
+
setSearchQuery = _useState4[1];
|
|
4902
|
+
// State hook to manage dropdown visibility, starts as false (hidden).
|
|
4903
|
+
var _useState5 = useState(false),
|
|
4904
|
+
isDropdownVisible = _useState5[0],
|
|
4905
|
+
setIsDropdownVisible = _useState5[1];
|
|
4906
|
+
// Start of object returned by the useComboBoxState hook containing all state and state updater functions.
|
|
4907
|
+
return {
|
|
4908
|
+
filteredItems: filteredItems,
|
|
4909
|
+
setFilteredItems: setFilteredItems,
|
|
4910
|
+
selectedItem: selectedItem,
|
|
4911
|
+
setSelectedItem: setSelectedItem,
|
|
4912
|
+
highlightedIndex: highlightedIndex,
|
|
4913
|
+
setHighlightedIndex: setHighlightedIndex,
|
|
4914
|
+
searchQuery: searchQuery,
|
|
4915
|
+
setSearchQuery: setSearchQuery,
|
|
4916
|
+
isDropdownVisible: isDropdownVisible,
|
|
4917
|
+
setIsDropdownVisible: setIsDropdownVisible
|
|
4918
|
+
};
|
|
4919
|
+
};
|
|
4920
|
+
|
|
4921
|
+
var _excluded$C = ["size", "color"];
|
|
4922
|
+
var TickSvg = function TickSvg(_ref) {
|
|
4923
|
+
var _ref$size = _ref.size,
|
|
4924
|
+
size = _ref$size === void 0 ? 16 : _ref$size,
|
|
4925
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$C);
|
|
4926
|
+
return React.createElement(Center, {
|
|
4927
|
+
width: size + "px",
|
|
4928
|
+
height: size + "px"
|
|
4929
|
+
}, React.createElement("svg", Object.assign({
|
|
4930
|
+
width: size + "px",
|
|
4931
|
+
height: size + "px",
|
|
4932
|
+
viewBox: "0 -0.5 25 25",
|
|
4933
|
+
fill: "none",
|
|
4934
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4935
|
+
}, props), React.createElement("g", {
|
|
4936
|
+
id: "SVGRepo_bgCarrier",
|
|
4937
|
+
strokeWidth: "0"
|
|
4938
|
+
}), React.createElement("g", {
|
|
4939
|
+
id: "SVGRepo_tracerCarrier",
|
|
4940
|
+
strokeLinecap: "round",
|
|
4941
|
+
strokeLinejoin: "round"
|
|
4942
|
+
}), React.createElement("g", {
|
|
4943
|
+
id: "SVGRepo_iconCarrier"
|
|
4944
|
+
}, ' ', React.createElement("path", {
|
|
4945
|
+
d: "M5.5 12.5L10.167 17L19.5 8",
|
|
4946
|
+
stroke: "#444444",
|
|
4947
|
+
strokeWidth: "1.5",
|
|
4948
|
+
strokeLinecap: "round",
|
|
4949
|
+
strokeLinejoin: "round"
|
|
4950
|
+
}), ' ')));
|
|
4951
|
+
};
|
|
4952
|
+
|
|
4953
|
+
var _excluded$D = ["size", "color"];
|
|
4954
|
+
var SearchLoopSvg = function SearchLoopSvg(_ref) {
|
|
4955
|
+
var _ref$size = _ref.size,
|
|
4956
|
+
size = _ref$size === void 0 ? 14 : _ref$size,
|
|
4957
|
+
_ref$color = _ref.color,
|
|
4958
|
+
color = _ref$color === void 0 ? '#c0c0c0' : _ref$color,
|
|
4959
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$D);
|
|
4960
|
+
return React.createElement(Center, {
|
|
4961
|
+
width: size + "px",
|
|
4962
|
+
height: size + "px"
|
|
4963
|
+
}, React.createElement("svg", Object.assign({
|
|
4964
|
+
fill: "#c0c0c0",
|
|
4965
|
+
width: size + "px",
|
|
4966
|
+
height: size + "px",
|
|
4967
|
+
version: "1.1",
|
|
4968
|
+
id: "Capa_1",
|
|
4969
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4970
|
+
viewBox: "0 0 488.4 488.4",
|
|
4971
|
+
stroke: color
|
|
4972
|
+
}, props), React.createElement("g", {
|
|
4973
|
+
id: "SVGRepo_bgCarrier",
|
|
4974
|
+
strokeWidth: "9.279599999999999"
|
|
4975
|
+
}), React.createElement("g", {
|
|
4976
|
+
id: "SVGRepo_tracerCarrier",
|
|
4977
|
+
strokeLinecap: "round",
|
|
4978
|
+
strokeLinejoin: "round"
|
|
4979
|
+
}), React.createElement("g", {
|
|
4980
|
+
id: "SVGRepo_iconCarrier"
|
|
4981
|
+
}, React.createElement("g", null, React.createElement("g", null, React.createElement("path", {
|
|
4982
|
+
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"
|
|
4983
|
+
}), ' ')))));
|
|
4984
|
+
};
|
|
4985
|
+
|
|
4986
|
+
var _excluded$E = ["placeholder", "items", "showTick", "onSelect", "searchEnabled", "left", "right", "label", "filteredItems", "setSelectedItem", "selectedItem", "highlightedIndex", "setHighlightedIndex", "searchQuery", "setSearchQuery", "setFilteredItems", "styles", "isDropdownVisible", "setIsDropdownVisible"];
|
|
4987
|
+
// Defines the functional component 'ComboBoxView' with destructured props.
|
|
4988
|
+
var ComboBoxView = function ComboBoxView(_ref) {
|
|
4989
|
+
var placeholder = _ref.placeholder,
|
|
4990
|
+
items = _ref.items,
|
|
4991
|
+
_ref$showTick = _ref.showTick,
|
|
4992
|
+
showTick = _ref$showTick === void 0 ? true : _ref$showTick,
|
|
4993
|
+
onSelect = _ref.onSelect,
|
|
4994
|
+
_ref$searchEnabled = _ref.searchEnabled,
|
|
4995
|
+
searchEnabled = _ref$searchEnabled === void 0 ? true : _ref$searchEnabled,
|
|
4996
|
+
left = _ref.left,
|
|
4997
|
+
right = _ref.right,
|
|
4998
|
+
label = _ref.label,
|
|
4999
|
+
filteredItems = _ref.filteredItems,
|
|
5000
|
+
setSelectedItem = _ref.setSelectedItem,
|
|
5001
|
+
selectedItem = _ref.selectedItem,
|
|
5002
|
+
highlightedIndex = _ref.highlightedIndex,
|
|
5003
|
+
setHighlightedIndex = _ref.setHighlightedIndex,
|
|
5004
|
+
searchQuery = _ref.searchQuery,
|
|
5005
|
+
setSearchQuery = _ref.setSearchQuery,
|
|
5006
|
+
setFilteredItems = _ref.setFilteredItems,
|
|
5007
|
+
styles = _ref.styles,
|
|
5008
|
+
isDropdownVisible = _ref.isDropdownVisible,
|
|
5009
|
+
setIsDropdownVisible = _ref.setIsDropdownVisible,
|
|
5010
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
|
5011
|
+
// Sets up an effect to handle clicking outside the dropdown to close it.
|
|
5012
|
+
useEffect(function () {
|
|
5013
|
+
var handleClickOutside = function handleClickOutside(event) {
|
|
5014
|
+
var path = event.composedPath();
|
|
5015
|
+
var isOutside = !path.some(function (element) {
|
|
5016
|
+
return (element == null ? void 0 : element.id) === 'combobox-dropdown';
|
|
5017
|
+
});
|
|
5018
|
+
if (isOutside) {
|
|
5019
|
+
setIsDropdownVisible(false);
|
|
5020
|
+
}
|
|
5021
|
+
};
|
|
5022
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
5023
|
+
return function () {
|
|
5024
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
5025
|
+
};
|
|
5026
|
+
}, []);
|
|
5027
|
+
// Defines 'handleSearch' to filter items based on the user's query.
|
|
5028
|
+
var handleSearch = function handleSearch(query) {
|
|
5029
|
+
setSearchQuery(query);
|
|
5030
|
+
if (query === '') {
|
|
5031
|
+
setFilteredItems(items);
|
|
5032
|
+
} else {
|
|
5033
|
+
var filtered = items.filter(function (item) {
|
|
5034
|
+
return item.label.toLowerCase().includes(query.toLowerCase());
|
|
5035
|
+
});
|
|
5036
|
+
setFilteredItems(filtered);
|
|
5037
|
+
}
|
|
5038
|
+
setHighlightedIndex(0);
|
|
5039
|
+
};
|
|
5040
|
+
// Defines 'handleSelect' to handle item selection and close the dropdown.
|
|
5041
|
+
var handleSelect = function handleSelect(item) {
|
|
5042
|
+
setSelectedItem(item);
|
|
5043
|
+
onSelect == null || onSelect(item);
|
|
5044
|
+
setIsDropdownVisible(false);
|
|
5045
|
+
};
|
|
5046
|
+
// Starts the JSX returned by the component representing the combobox.
|
|
5047
|
+
return React.createElement(Horizontal, Object.assign({
|
|
5048
|
+
role: "combobox",
|
|
5049
|
+
wrap: "nowrap",
|
|
5050
|
+
gap: 15,
|
|
5051
|
+
alignItems: "center",
|
|
5052
|
+
width: "100%"
|
|
5053
|
+
}, props), label && React.createElement(Text, {
|
|
5054
|
+
styles: styles == null ? void 0 : styles.label,
|
|
5055
|
+
htmlFor: props.id
|
|
5056
|
+
}, label), React.createElement(View, {
|
|
5057
|
+
position: "relative"
|
|
5058
|
+
}, React.createElement(Horizontal, Object.assign({
|
|
5059
|
+
cursor: "pointer",
|
|
5060
|
+
backgroundColor: "white",
|
|
5061
|
+
boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
|
|
5062
|
+
padding: "12px",
|
|
5063
|
+
display: "flex",
|
|
5064
|
+
alignItems: "center",
|
|
5065
|
+
borderRadius: "4px",
|
|
5066
|
+
justify: "space-between",
|
|
5067
|
+
minWidth: 300,
|
|
5068
|
+
wrap: "nowrap"
|
|
5069
|
+
}, styles == null ? void 0 : styles.container), React.createElement(Horizontal, Object.assign({
|
|
5070
|
+
gap: 15,
|
|
5071
|
+
alignItems: "center",
|
|
5072
|
+
position: "relative",
|
|
5073
|
+
width: "100%",
|
|
5074
|
+
onClick: function onClick() {
|
|
5075
|
+
return setIsDropdownVisible(!isDropdownVisible);
|
|
5076
|
+
}
|
|
5077
|
+
}, styles == null ? void 0 : styles.labelContainer), left, React.createElement(Text, Object.assign({
|
|
5078
|
+
weight: "medium",
|
|
5079
|
+
flexGrow: 1
|
|
5080
|
+
}, styles == null ? void 0 : styles.label), selectedItem.label)), right, isDropdownVisible && React.createElement(View, Object.assign({
|
|
5081
|
+
id: "combobox-dropdown",
|
|
5082
|
+
position: "absolute",
|
|
5083
|
+
backgroundColor: "white",
|
|
5084
|
+
boxShadow: "rgba(0, 0 ,0 ,0.16) 0px 1px 4px",
|
|
5085
|
+
width: "100%",
|
|
5086
|
+
overflowY: "auto",
|
|
5087
|
+
zIndex: 10000,
|
|
5088
|
+
bottom: -8,
|
|
5089
|
+
left: 0,
|
|
5090
|
+
transform: "translateY(100%)",
|
|
5091
|
+
marginTop: "4px",
|
|
5092
|
+
borderRadius: "4px"
|
|
5093
|
+
}, styles == null ? void 0 : styles.dropdown), searchEnabled && React.createElement(TextFieldView, {
|
|
5094
|
+
id: props.id,
|
|
5095
|
+
name: props.name,
|
|
5096
|
+
width: "100%",
|
|
5097
|
+
type: "search",
|
|
5098
|
+
value: searchQuery,
|
|
5099
|
+
onChange: function onChange(value) {
|
|
5100
|
+
return handleSearch(value);
|
|
5101
|
+
},
|
|
5102
|
+
hint: placeholder,
|
|
5103
|
+
isClearable: false,
|
|
5104
|
+
leftChild: React.createElement(SearchLoopSvg, {
|
|
5105
|
+
size: 12
|
|
5106
|
+
}),
|
|
5107
|
+
styles: {
|
|
5108
|
+
box: _extends({
|
|
5109
|
+
width: '100%',
|
|
5110
|
+
padding: '6px 12px',
|
|
5111
|
+
borderBottom: filteredItems.length > 0 ? '1px solid #ccc' : '1px solid transparent'
|
|
5112
|
+
}, styles == null ? void 0 : styles.text)
|
|
5113
|
+
}
|
|
5114
|
+
}), filteredItems.length > 0 && React.createElement(View, {
|
|
5115
|
+
margin: 0,
|
|
5116
|
+
padding: 4
|
|
5117
|
+
}, filteredItems.map(function (item, index) {
|
|
5118
|
+
return React.createElement(Horizontal, Object.assign({
|
|
5119
|
+
justify: "space-between",
|
|
5120
|
+
key: item.value,
|
|
5121
|
+
padding: "12px",
|
|
5122
|
+
cursor: "pointer",
|
|
5123
|
+
borderRadius: 4,
|
|
5124
|
+
backgroundColor: index === highlightedIndex ? 'color.gray.100' : 'transparent',
|
|
5125
|
+
onMouseEnter: function onMouseEnter() {
|
|
5126
|
+
return setHighlightedIndex(index);
|
|
5127
|
+
},
|
|
5128
|
+
onClick: function onClick() {
|
|
5129
|
+
return handleSelect(item);
|
|
5130
|
+
}
|
|
5131
|
+
}, styles == null ? void 0 : styles.item), React.createElement(Text, null, item.label), React.createElement(React.Fragment, null, item.icon && item.icon, item.value === selectedItem.value && showTick && !item.icon && React.createElement(TickSvg, null)));
|
|
5132
|
+
}))))));
|
|
5133
|
+
};
|
|
5134
|
+
|
|
5135
|
+
var _excluded$F = ["items", "placeholder", "searchPlaceholder"];
|
|
5136
|
+
var ComboBoxComponent = function ComboBoxComponent(_ref) {
|
|
5137
|
+
var items = _ref.items,
|
|
5138
|
+
placeholder = _ref.placeholder,
|
|
5139
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
5140
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$F);
|
|
5141
|
+
var formProps = useFormikInput(props);
|
|
5142
|
+
var ComboBoxStates = useComboBoxState(items, placeholder, searchPlaceholder);
|
|
5143
|
+
// Ensure the onChange function from formProps is being called when an item is selected
|
|
5144
|
+
var handleSelect = function handleSelect(item) {
|
|
5145
|
+
formProps.onChange(item);
|
|
5146
|
+
};
|
|
5147
|
+
return React.createElement(ComboBoxView, Object.assign({}, ComboBoxStates, formProps, {
|
|
5148
|
+
onSelect: handleSelect
|
|
5149
|
+
}));
|
|
5150
|
+
};
|
|
5151
|
+
/**
|
|
5152
|
+
* ComboBox allows users to select one or more options from a list of choices.
|
|
5153
|
+
*/
|
|
5154
|
+
var FormikComboBox = ComboBoxComponent;
|
|
5155
|
+
|
|
4690
5156
|
var useModalStore = /*#__PURE__*/create(function (set) {
|
|
4691
5157
|
return {
|
|
4692
5158
|
modal: false,
|
|
@@ -4772,7 +5238,7 @@ var HeaderIconSizes = {
|
|
|
4772
5238
|
xl: 28
|
|
4773
5239
|
};
|
|
4774
5240
|
|
|
4775
|
-
var _excluded$
|
|
5241
|
+
var _excluded$G = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
|
|
4776
5242
|
_excluded2$4 = ["children", "shadow", "isFullScreen", "shape"],
|
|
4777
5243
|
_excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
|
|
4778
5244
|
_excluded4$2 = ["children"],
|
|
@@ -4788,7 +5254,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
4788
5254
|
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
4789
5255
|
_ref$position = _ref.position,
|
|
4790
5256
|
position = _ref$position === void 0 ? 'center' : _ref$position,
|
|
4791
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5257
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$G);
|
|
4792
5258
|
var handleClick = function handleClick() {
|
|
4793
5259
|
if (!isClosePrevented) onClose();
|
|
4794
5260
|
};
|
|
@@ -4944,12 +5410,12 @@ Modal.Body = ModalBody;
|
|
|
4944
5410
|
Modal.Footer = ModalFooter;
|
|
4945
5411
|
Modal.Layout = ModalLayout;
|
|
4946
5412
|
|
|
4947
|
-
var _excluded$
|
|
5413
|
+
var _excluded$H = ["src", "color"],
|
|
4948
5414
|
_excluded2$5 = ["path"];
|
|
4949
5415
|
var FileSVG = function FileSVG(_ref) {
|
|
4950
5416
|
var src = _ref.src,
|
|
4951
5417
|
color = _ref.color,
|
|
4952
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5418
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$H);
|
|
4953
5419
|
var _useTheme = useTheme(),
|
|
4954
5420
|
getColor = _useTheme.getColor;
|
|
4955
5421
|
var Colorprops = color ? {
|
|
@@ -4970,18 +5436,15 @@ var FileImage = function FileImage(_ref2) {
|
|
|
4970
5436
|
}, props));
|
|
4971
5437
|
};
|
|
4972
5438
|
|
|
5439
|
+
// Initializes a custom hook for managing tab states with an array of 'Tab' objects passed as properties.
|
|
4973
5440
|
var useTabsState = function useTabsState(propTabs) {
|
|
4974
|
-
// Defines a custom hook, named `useTabsState`, that manages the state of tabs within a component.
|
|
4975
5441
|
var _useState = useState(propTabs[0]),
|
|
4976
5442
|
isActive = _useState[0],
|
|
4977
5443
|
setIsActive = _useState[1];
|
|
4978
|
-
// Initializes 'isActive' state with the first tab from the 'propTabs' array, indicating the currently active tab.
|
|
4979
5444
|
var _useState2 = useState(propTabs),
|
|
4980
5445
|
tabsState = _useState2[0],
|
|
4981
5446
|
setTabsState = _useState2[1];
|
|
4982
|
-
// Initializes 'tabsState' as a stateful array that reflects the tabs passed through 'propTabs' prop, setting the initial state of tabs.
|
|
4983
5447
|
return {
|
|
4984
|
-
// 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.
|
|
4985
5448
|
isActive: isActive,
|
|
4986
5449
|
setIsActive: setIsActive,
|
|
4987
5450
|
tabsState: tabsState,
|
|
@@ -4989,21 +5452,31 @@ var useTabsState = function useTabsState(propTabs) {
|
|
|
4989
5452
|
};
|
|
4990
5453
|
};
|
|
4991
5454
|
|
|
5455
|
+
// Defines a functional component 'TabsView' with props of type 'TabsViewProps'.
|
|
4992
5456
|
var TabsView = function TabsView(props) {
|
|
5457
|
+
// Destructures 'tabs', 'styles', 'isActive', 'setIsActive', 'tabsState', and 'setTabsState' from the component props.
|
|
4993
5458
|
var tabs = props.tabs,
|
|
4994
5459
|
styles = props.styles,
|
|
4995
5460
|
isActive = props.isActive,
|
|
4996
5461
|
setIsActive = props.setIsActive,
|
|
4997
5462
|
tabsState = props.tabsState,
|
|
4998
5463
|
setTabsState = props.setTabsState;
|
|
5464
|
+
// Declares a function 'moveSelectedTabToTop' that takes an index and modifies the tabs order.
|
|
4999
5465
|
var moveSelectedTabToTop = function moveSelectedTabToTop(idx) {
|
|
5466
|
+
// Creates a copy of the 'tabs' array from props to be altered.
|
|
5000
5467
|
var newTabs = [].concat(tabs);
|
|
5468
|
+
// Removes the tab at the provided index, effectively selecting this tab.
|
|
5001
5469
|
var selectedTab = newTabs.splice(idx, 1);
|
|
5470
|
+
// Places the selected tab at the start of the 'newTabs' array.
|
|
5002
5471
|
newTabs.unshift(selectedTab[0]);
|
|
5472
|
+
// Updates the state with the reordered tabs.
|
|
5003
5473
|
setTabsState(newTabs);
|
|
5474
|
+
// Sets the active tab to the first tab in the 'newTabs' array.
|
|
5004
5475
|
setIsActive(newTabs[0]);
|
|
5005
5476
|
};
|
|
5477
|
+
// Defines a function 'isContentActive' that checks if the given tab's content is to be displayed.
|
|
5006
5478
|
var isContentActive = function isContentActive(tab) {
|
|
5479
|
+
// Returns a boolean indicating if the given tab is identical to the first tab in 'tabsState'.
|
|
5007
5480
|
return tab.value === tabsState[0].value;
|
|
5008
5481
|
};
|
|
5009
5482
|
return React.createElement(Horizontal, Object.assign({
|
|
@@ -5032,17 +5505,14 @@ var TabsView = function TabsView(props) {
|
|
|
5032
5505
|
})));
|
|
5033
5506
|
};
|
|
5034
5507
|
|
|
5035
|
-
// Define the functional component TabsComponent that utilizes the TabsProps interface for its props.
|
|
5036
5508
|
var TabsComponent = function TabsComponent(_ref) {
|
|
5037
5509
|
var tabs = _ref.tabs,
|
|
5038
5510
|
styles = _ref.styles;
|
|
5039
|
-
// Destructure the 'tabs' and 'styles' properties from the component's props.
|
|
5040
5511
|
var _useTabsState = useTabsState(tabs),
|
|
5041
5512
|
isActive = _useTabsState.isActive,
|
|
5042
5513
|
setIsActive = _useTabsState.setIsActive,
|
|
5043
5514
|
tabsState = _useTabsState.tabsState,
|
|
5044
5515
|
setTabsState = _useTabsState.setTabsState;
|
|
5045
|
-
// Invoke the useTabsState custom hook with 'tabs' to manage state related to tab activities like the active tab and tab state management.
|
|
5046
5516
|
return React.createElement(TabsView, {
|
|
5047
5517
|
tabs: tabs,
|
|
5048
5518
|
styles: styles,
|
|
@@ -5054,54 +5524,66 @@ var TabsComponent = function TabsComponent(_ref) {
|
|
|
5054
5524
|
};
|
|
5055
5525
|
var Tabs = /*#__PURE__*/React.memo(TabsComponent);
|
|
5056
5526
|
|
|
5527
|
+
// Define a constant object 'Themes' exporting various theme styles.
|
|
5057
5528
|
var Themes = {
|
|
5529
|
+
// Start of the 'default' theme definition with style properties.
|
|
5058
5530
|
default: {
|
|
5059
5531
|
container: {
|
|
5060
5532
|
backgroundColor: 'white',
|
|
5061
5533
|
border: 'color.blackAlpha.800'
|
|
5062
5534
|
},
|
|
5535
|
+
// Defines the content style for the 'default' theme.
|
|
5063
5536
|
content: {
|
|
5064
5537
|
color: 'color.blackAlpha.800'
|
|
5065
5538
|
}
|
|
5066
5539
|
},
|
|
5540
|
+
// The 'info' theme with unique container and content styles.
|
|
5067
5541
|
info: {
|
|
5068
5542
|
container: {
|
|
5069
5543
|
backgroundColor: 'color.blue.200',
|
|
5070
5544
|
border: 'color.blue.400'
|
|
5071
5545
|
},
|
|
5546
|
+
// Content styles specific to the 'info' theme.
|
|
5072
5547
|
content: {
|
|
5073
5548
|
color: '#60a5fa'
|
|
5074
5549
|
}
|
|
5075
5550
|
},
|
|
5551
|
+
// Specifies the 'success' theme with corresponding container and content styles.
|
|
5076
5552
|
success: {
|
|
5077
5553
|
container: {
|
|
5078
5554
|
backgroundColor: 'color.green.200',
|
|
5079
5555
|
border: 'color.green.400'
|
|
5080
5556
|
},
|
|
5557
|
+
// Sets the content styling nuances for the 'success' theme.
|
|
5081
5558
|
content: {
|
|
5082
5559
|
color: '#22c55e'
|
|
5083
5560
|
}
|
|
5084
5561
|
},
|
|
5562
|
+
// Start of the 'error' theme with its characteristic styles.
|
|
5085
5563
|
error: {
|
|
5086
5564
|
container: {
|
|
5087
5565
|
backgroundColor: 'color.red.200',
|
|
5088
5566
|
border: 'color.red.400'
|
|
5089
5567
|
},
|
|
5568
|
+
// Content styling for the 'error' theme.
|
|
5090
5569
|
content: {
|
|
5091
5570
|
color: '#ef4444'
|
|
5092
5571
|
}
|
|
5093
5572
|
},
|
|
5573
|
+
// Introduction of the 'warning' theme styles.
|
|
5094
5574
|
warning: {
|
|
5095
5575
|
container: {
|
|
5096
5576
|
backgroundColor: 'color.orange.200',
|
|
5097
5577
|
border: 'color.orange.400'
|
|
5098
5578
|
},
|
|
5579
|
+
// Defines color and aesthetics for the 'warning' theme's content.
|
|
5099
5580
|
content: {
|
|
5100
5581
|
color: '#f97316'
|
|
5101
5582
|
}
|
|
5102
5583
|
}
|
|
5103
5584
|
};
|
|
5104
5585
|
|
|
5586
|
+
// Defines AlertView as a functional component using destructuring to extract props.
|
|
5105
5587
|
var AlertView = function AlertView(_ref) {
|
|
5106
5588
|
var _styles$icon$color;
|
|
5107
5589
|
var icon = _ref.icon,
|
|
@@ -5134,6 +5616,7 @@ var AlertView = function AlertView(_ref) {
|
|
|
5134
5616
|
}, styles == null ? void 0 : styles.description), description)));
|
|
5135
5617
|
};
|
|
5136
5618
|
|
|
5619
|
+
// Definition of the AlertComponent functional component with destructured props.
|
|
5137
5620
|
var AlertComponent = function AlertComponent(_ref) {
|
|
5138
5621
|
var icon = _ref.icon,
|
|
5139
5622
|
title = _ref.title,
|
|
@@ -5148,14 +5631,16 @@ var AlertComponent = function AlertComponent(_ref) {
|
|
|
5148
5631
|
variant: variant
|
|
5149
5632
|
});
|
|
5150
5633
|
};
|
|
5634
|
+
// Exporting the AlertComponent as 'Alert' for use in other parts of the application.
|
|
5151
5635
|
var Alert = AlertComponent;
|
|
5152
5636
|
|
|
5153
|
-
var _excluded$
|
|
5637
|
+
var _excluded$I = ["ratio", "children"];
|
|
5638
|
+
// Declaration of a functional component named AspectRatioView.
|
|
5154
5639
|
var AspectRatioView = function AspectRatioView(_ref) {
|
|
5155
5640
|
var _ref$ratio = _ref.ratio,
|
|
5156
5641
|
ratio = _ref$ratio === void 0 ? 16 / 9 : _ref$ratio,
|
|
5157
5642
|
children = _ref.children,
|
|
5158
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5643
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$I);
|
|
5159
5644
|
return React.createElement(Center, Object.assign({
|
|
5160
5645
|
width: '100%',
|
|
5161
5646
|
position: "relative",
|
|
@@ -5171,27 +5656,32 @@ var AspectRatioView = function AspectRatioView(_ref) {
|
|
|
5171
5656
|
}, children));
|
|
5172
5657
|
};
|
|
5173
5658
|
|
|
5174
|
-
var _excluded$
|
|
5659
|
+
var _excluded$J = ["ratio", "children"];
|
|
5660
|
+
// Declaration of the AspectRatioComponent functional component with destructured props.
|
|
5175
5661
|
var AspectRatioComponent = function AspectRatioComponent(_ref) {
|
|
5176
5662
|
var ratio = _ref.ratio,
|
|
5177
5663
|
children = _ref.children,
|
|
5178
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5664
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$J);
|
|
5665
|
+
// Beginning of the return statement in the functional component.
|
|
5179
5666
|
return React.createElement(AspectRatioView, Object.assign({
|
|
5180
5667
|
ratio: ratio
|
|
5181
5668
|
}, props), children);
|
|
5182
5669
|
};
|
|
5183
5670
|
var AspectRatio = AspectRatioComponent;
|
|
5184
5671
|
|
|
5672
|
+
// Defines a state hook for managing avatar image error status, initialized as false.
|
|
5185
5673
|
var useAvatarState = function useAvatarState() {
|
|
5186
5674
|
var _useState = useState(false),
|
|
5187
5675
|
imageError = _useState[0],
|
|
5188
5676
|
setImageError = _useState[1];
|
|
5677
|
+
// Provides an object containing the image error state and its setter function.
|
|
5189
5678
|
return {
|
|
5190
5679
|
imageError: imageError,
|
|
5191
5680
|
setImageError: setImageError
|
|
5192
5681
|
};
|
|
5193
5682
|
};
|
|
5194
5683
|
|
|
5684
|
+
// Defines a mapping of avatar sizes to their respective numeric values
|
|
5195
5685
|
var AvatarSizeMap = {
|
|
5196
5686
|
xs: 24,
|
|
5197
5687
|
sm: 32,
|
|
@@ -5200,6 +5690,7 @@ var AvatarSizeMap = {
|
|
|
5200
5690
|
xl: 80
|
|
5201
5691
|
};
|
|
5202
5692
|
|
|
5693
|
+
// Declaration of the AvatarView functional component with destructured props from AvatarViewProps.
|
|
5203
5694
|
var AvatarView = function AvatarView(_ref) {
|
|
5204
5695
|
var src = _ref.src,
|
|
5205
5696
|
_ref$size = _ref.size,
|
|
@@ -5209,10 +5700,13 @@ var AvatarView = function AvatarView(_ref) {
|
|
|
5209
5700
|
styles = _ref.styles,
|
|
5210
5701
|
imageError = _ref.imageError,
|
|
5211
5702
|
setImageError = _ref.setImageError;
|
|
5703
|
+
// Determines the size of the avatar by mapping the size prop to the predefined AvatarSizeMap.
|
|
5212
5704
|
var avatarSize = AvatarSizeMap[size];
|
|
5705
|
+
// Initiates a style object for the image with an objectFit property and spreads additional image styles if provided.
|
|
5213
5706
|
var imageStyle = _extends({
|
|
5214
5707
|
objectFit: 'cover'
|
|
5215
5708
|
}, (styles == null ? void 0 : styles.image) || {});
|
|
5709
|
+
// Start of the JSX returned by the AvatarView component, which uses the Center component as its root element.
|
|
5216
5710
|
return React.createElement(Center, Object.assign({
|
|
5217
5711
|
role: "avatar",
|
|
5218
5712
|
width: avatarSize,
|
|
@@ -5222,7 +5716,7 @@ var AvatarView = function AvatarView(_ref) {
|
|
|
5222
5716
|
borderWidth: "1px",
|
|
5223
5717
|
borderStyle: "solid",
|
|
5224
5718
|
borderColor: imageError ? 'black' : 'transparent',
|
|
5225
|
-
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)"
|
|
5719
|
+
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)"
|
|
5226
5720
|
}, styles == null ? void 0 : styles.container), !imageError ? React.createElement(Image, {
|
|
5227
5721
|
alt: "IM",
|
|
5228
5722
|
src: src,
|
|
@@ -5237,14 +5731,17 @@ var AvatarView = function AvatarView(_ref) {
|
|
|
5237
5731
|
}, styles == null ? void 0 : styles.fallback), fallback));
|
|
5238
5732
|
};
|
|
5239
5733
|
|
|
5734
|
+
// Defines the AvatarComponent functional component with destructured props from AvatarProps type.
|
|
5240
5735
|
var AvatarComponent = function AvatarComponent(_ref) {
|
|
5241
5736
|
var src = _ref.src,
|
|
5242
5737
|
size = _ref.size,
|
|
5243
5738
|
styles = _ref.styles,
|
|
5244
5739
|
fallback = _ref.fallback;
|
|
5740
|
+
// Uses custom hook useAvatarState to manage the avatar image loading error state.
|
|
5245
5741
|
var _useAvatarState = useAvatarState(),
|
|
5246
5742
|
imageError = _useAvatarState.imageError,
|
|
5247
5743
|
setImageError = _useAvatarState.setImageError;
|
|
5744
|
+
// Begins the JSX return block for rendering the AvatarView component.
|
|
5248
5745
|
return React.createElement(AvatarView, {
|
|
5249
5746
|
src: src,
|
|
5250
5747
|
size: size,
|
|
@@ -5253,7 +5750,9 @@ var AvatarComponent = function AvatarComponent(_ref) {
|
|
|
5253
5750
|
imageError: imageError,
|
|
5254
5751
|
setImageError: setImageError
|
|
5255
5752
|
});
|
|
5753
|
+
// AvatarComponent is a functional component that wraps the AvatarView with added state logic.
|
|
5256
5754
|
};
|
|
5755
|
+
// Exports the AvatarComponent as Avatar for use in other parts of the application.
|
|
5257
5756
|
var Avatar = AvatarComponent;
|
|
5258
5757
|
|
|
5259
5758
|
var BadgeSizes = {
|
|
@@ -5288,7 +5787,6 @@ var BadgeShapes = {
|
|
|
5288
5787
|
rounded: 4,
|
|
5289
5788
|
pillShaped: 24
|
|
5290
5789
|
};
|
|
5291
|
-
// Example of how you might adjust styles based on the 'position' prop
|
|
5292
5790
|
var PositionStyles = {
|
|
5293
5791
|
'top-right': {
|
|
5294
5792
|
top: 0,
|
|
@@ -5312,6 +5810,7 @@ var PositionStyles = {
|
|
|
5312
5810
|
}
|
|
5313
5811
|
};
|
|
5314
5812
|
|
|
5813
|
+
// Importing Text component to display the content text within the badge.
|
|
5315
5814
|
var BadgeView = function BadgeView(_ref) {
|
|
5316
5815
|
var content = _ref.content,
|
|
5317
5816
|
position = _ref.position,
|
|
@@ -5333,6 +5832,7 @@ var BadgeView = function BadgeView(_ref) {
|
|
|
5333
5832
|
borderColor: 'transparent'
|
|
5334
5833
|
},
|
|
5335
5834
|
outline: {
|
|
5835
|
+
// Combining various style objects along with conditional styles based on props to create the badge's appearance.
|
|
5336
5836
|
backgroundColor: 'transparent',
|
|
5337
5837
|
borderWidth: 1,
|
|
5338
5838
|
borderStyle: 'solid',
|
|
@@ -5341,10 +5841,13 @@ var BadgeView = function BadgeView(_ref) {
|
|
|
5341
5841
|
},
|
|
5342
5842
|
link: {
|
|
5343
5843
|
backgroundColor: 'transparent',
|
|
5844
|
+
// Rendering the Badge component using the Center layout component with combinedStyles applied.
|
|
5344
5845
|
borderWidth: 1,
|
|
5846
|
+
// Inserting a Text component into the badge to display the content, with dynamic size and additional text styles.
|
|
5345
5847
|
borderStyle: 'solid',
|
|
5346
5848
|
borderColor: 'transparent',
|
|
5347
5849
|
color: colorScheme,
|
|
5850
|
+
// Exporting BadgeView to be used in other parts of the application.
|
|
5348
5851
|
textDecoration: 'underline'
|
|
5349
5852
|
},
|
|
5350
5853
|
ghost: {
|
|
@@ -5367,6 +5870,7 @@ var BadgeView = function BadgeView(_ref) {
|
|
|
5367
5870
|
}, styles == null ? void 0 : styles.text), content));
|
|
5368
5871
|
};
|
|
5369
5872
|
|
|
5873
|
+
// Importing type definitions for BadgeProps that will be used to type-check the Badge component's props.
|
|
5370
5874
|
var Badge = function Badge(_ref) {
|
|
5371
5875
|
var content = _ref.content,
|
|
5372
5876
|
shape = _ref.shape,
|
|
@@ -5386,13 +5890,17 @@ var Badge = function Badge(_ref) {
|
|
|
5386
5890
|
});
|
|
5387
5891
|
};
|
|
5388
5892
|
|
|
5893
|
+
// Declares the useToggleState function which takes defaultToggled parameter to initialize the toggle state.
|
|
5389
5894
|
var useToggleState = function useToggleState(defaultToggled) {
|
|
5895
|
+
// Creates a stateful value isHovered for tracking hover state and a function setIsHovered to update that state, initially false.
|
|
5390
5896
|
var _useState = useState(false),
|
|
5391
5897
|
isHovered = _useState[0],
|
|
5392
5898
|
setIsHovered = _useState[1];
|
|
5899
|
+
// Creates a stateful value isToggle to store the current toggle state and a function setIsToggled to modify it, initialized with defaultToggled.
|
|
5393
5900
|
var _useState2 = useState(defaultToggled),
|
|
5394
5901
|
isToggle = _useState2[0],
|
|
5395
5902
|
setIsToggled = _useState2[1];
|
|
5903
|
+
// Returns an object containing the current states and the functions to update them for external use.
|
|
5396
5904
|
return {
|
|
5397
5905
|
isHovered: isHovered,
|
|
5398
5906
|
setIsHovered: setIsHovered,
|
|
@@ -5407,7 +5915,7 @@ var ToggleShapes = {
|
|
|
5407
5915
|
pillShaped: 24
|
|
5408
5916
|
};
|
|
5409
5917
|
|
|
5410
|
-
var _excluded$
|
|
5918
|
+
var _excluded$K = ["children", "shape", "colorScheme", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle"];
|
|
5411
5919
|
var ToggleView = function ToggleView(_ref) {
|
|
5412
5920
|
var children = _ref.children,
|
|
5413
5921
|
_ref$shape = _ref.shape,
|
|
@@ -5422,7 +5930,7 @@ var ToggleView = function ToggleView(_ref) {
|
|
|
5422
5930
|
isToggle = _ref.isToggle,
|
|
5423
5931
|
setIsToggled = _ref.setIsToggled,
|
|
5424
5932
|
onToggle = _ref.onToggle,
|
|
5425
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5933
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$K);
|
|
5426
5934
|
var toggleColor = !isDisabled ? colorScheme : 'theme.disabled';
|
|
5427
5935
|
var isActive = !!(isToggle || isHovered);
|
|
5428
5936
|
var ToggleVariants = {
|
|
@@ -5444,14 +5952,12 @@ var ToggleView = function ToggleView(_ref) {
|
|
|
5444
5952
|
setIsToggled(function (prev) {
|
|
5445
5953
|
var newState = !prev;
|
|
5446
5954
|
if (onToggle) {
|
|
5447
|
-
// Check if onToggle is defined before calling it
|
|
5448
5955
|
onToggle(newState);
|
|
5449
5956
|
}
|
|
5450
|
-
return newState;
|
|
5957
|
+
return newState;
|
|
5451
5958
|
});
|
|
5452
5959
|
}
|
|
5453
5960
|
};
|
|
5454
|
-
|
|
5455
5961
|
return React.createElement(Center, Object.assign({
|
|
5456
5962
|
role: "Toggle",
|
|
5457
5963
|
padding: shape === 'pillShaped' ? '10px 12px' : '8px',
|
|
@@ -5470,7 +5976,8 @@ var ToggleView = function ToggleView(_ref) {
|
|
|
5470
5976
|
}, ToggleVariants[variant], props), children);
|
|
5471
5977
|
};
|
|
5472
5978
|
|
|
5473
|
-
var _excluded$
|
|
5979
|
+
var _excluded$L = ["children", "shape", "colorScheme", "variant", "isDisabled", "isToggled", "onToggle"];
|
|
5980
|
+
// Destructuring properties from ToggleProps to be used within the ToggleComponent.
|
|
5474
5981
|
var ToggleComponent = function ToggleComponent(_ref) {
|
|
5475
5982
|
var children = _ref.children,
|
|
5476
5983
|
shape = _ref.shape,
|
|
@@ -5480,15 +5987,18 @@ var ToggleComponent = function ToggleComponent(_ref) {
|
|
|
5480
5987
|
_ref$isToggled = _ref.isToggled,
|
|
5481
5988
|
isToggled = _ref$isToggled === void 0 ? false : _ref$isToggled,
|
|
5482
5989
|
onToggle = _ref.onToggle,
|
|
5483
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5990
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$L);
|
|
5991
|
+
// Initializing toggle state and set state functions using the custom hook useToggleState.
|
|
5484
5992
|
var _useToggleState = useToggleState(isToggled),
|
|
5485
5993
|
isHovered = _useToggleState.isHovered,
|
|
5486
5994
|
setIsHovered = _useToggleState.setIsHovered,
|
|
5487
5995
|
isToggle = _useToggleState.isToggle,
|
|
5488
5996
|
setIsToggled = _useToggleState.setIsToggled;
|
|
5997
|
+
// Creating an effect that updates the isToggled state whenever the isToggled prop changes.
|
|
5489
5998
|
useEffect(function () {
|
|
5490
5999
|
setIsToggled(isToggled);
|
|
5491
6000
|
}, [isToggled]);
|
|
6001
|
+
// Beginning of the JSX block to render the Toggle view component.
|
|
5492
6002
|
return React.createElement(ToggleView, Object.assign({
|
|
5493
6003
|
shape: shape,
|
|
5494
6004
|
colorScheme: colorScheme,
|
|
@@ -5503,6 +6013,7 @@ var ToggleComponent = function ToggleComponent(_ref) {
|
|
|
5503
6013
|
};
|
|
5504
6014
|
var Toggle = ToggleComponent;
|
|
5505
6015
|
|
|
6016
|
+
// Define a custom hook for managing ToggleGroup state
|
|
5506
6017
|
var useToggleGroupState = function useToggleGroupState() {
|
|
5507
6018
|
var _useState = useState([]),
|
|
5508
6019
|
activeToggles = _useState[0],
|
|
@@ -5513,6 +6024,7 @@ var useToggleGroupState = function useToggleGroupState() {
|
|
|
5513
6024
|
};
|
|
5514
6025
|
};
|
|
5515
6026
|
|
|
6027
|
+
// ToggleGroupView component declaration with destructured properties from props.
|
|
5516
6028
|
var ToggleGroupView = function ToggleGroupView(_ref) {
|
|
5517
6029
|
var items = _ref.items,
|
|
5518
6030
|
onToggleChange = _ref.onToggleChange,
|
|
@@ -5524,14 +6036,13 @@ var ToggleGroupView = function ToggleGroupView(_ref) {
|
|
|
5524
6036
|
variant = _ref$variant === void 0 ? 'ghost' : _ref$variant,
|
|
5525
6037
|
_ref$colorScheme = _ref.colorScheme,
|
|
5526
6038
|
colorScheme = _ref$colorScheme === void 0 ? 'color.trueGray.400' : _ref$colorScheme;
|
|
6039
|
+
// handleToggle is a memoized callback that handles the toggle state changes.
|
|
5527
6040
|
var handleToggle = useCallback(function (id, isActive) {
|
|
5528
6041
|
setActiveToggles(function (prevActiveToggles) {
|
|
5529
6042
|
var newActiveToggles;
|
|
5530
6043
|
if (isActive) {
|
|
5531
|
-
// Add the ID only if it's not already included
|
|
5532
6044
|
newActiveToggles = prevActiveToggles.includes(id) ? prevActiveToggles : [].concat(prevActiveToggles, [id]);
|
|
5533
6045
|
} else {
|
|
5534
|
-
// Remove the ID if it's included
|
|
5535
6046
|
newActiveToggles = prevActiveToggles.filter(function (toggleId) {
|
|
5536
6047
|
return toggleId !== id;
|
|
5537
6048
|
});
|
|
@@ -5561,12 +6072,14 @@ var ToggleGroupView = function ToggleGroupView(_ref) {
|
|
|
5561
6072
|
}));
|
|
5562
6073
|
};
|
|
5563
6074
|
|
|
6075
|
+
// Define the functional component with destructured props
|
|
5564
6076
|
var ToggleGroupComponent = function ToggleGroupComponent(_ref) {
|
|
5565
6077
|
var items = _ref.items,
|
|
5566
6078
|
shape = _ref.shape,
|
|
5567
6079
|
colorScheme = _ref.colorScheme,
|
|
5568
6080
|
variant = _ref.variant,
|
|
5569
6081
|
onToggleChange = _ref.onToggleChange;
|
|
6082
|
+
// Hook to manage toggle group state, returns active toggles and a setter for it
|
|
5570
6083
|
var _useToggleGroupState = useToggleGroupState(),
|
|
5571
6084
|
activeToggles = _useToggleGroupState.activeToggles,
|
|
5572
6085
|
setActiveToggles = _useToggleGroupState.setActiveToggles;
|
|
@@ -5580,7 +6093,289 @@ var ToggleGroupComponent = function ToggleGroupComponent(_ref) {
|
|
|
5580
6093
|
onToggleChange: onToggleChange
|
|
5581
6094
|
});
|
|
5582
6095
|
};
|
|
6096
|
+
// Expose the ToggleGroupComponent for import into other modules
|
|
5583
6097
|
var ToggleGroup = ToggleGroupComponent;
|
|
5584
6098
|
|
|
5585
|
-
|
|
6099
|
+
// Create your store with the initial state and actions.
|
|
6100
|
+
var useMessageStore = /*#__PURE__*/create(function (set) {
|
|
6101
|
+
return {
|
|
6102
|
+
// initial state
|
|
6103
|
+
visible: false,
|
|
6104
|
+
title: '',
|
|
6105
|
+
subtitle: '',
|
|
6106
|
+
variant: 'info',
|
|
6107
|
+
isClosable: false,
|
|
6108
|
+
styles: {},
|
|
6109
|
+
action: function action() {},
|
|
6110
|
+
actionText: '',
|
|
6111
|
+
showIcon: false,
|
|
6112
|
+
timeout: 3000,
|
|
6113
|
+
show: function show(variant, title, subtitle, isClosable, styles, action, actionText, showIcon, timeout) {
|
|
6114
|
+
if (title === void 0) {
|
|
6115
|
+
title = '';
|
|
6116
|
+
}
|
|
6117
|
+
if (subtitle === void 0) {
|
|
6118
|
+
subtitle = '';
|
|
6119
|
+
}
|
|
6120
|
+
return set({
|
|
6121
|
+
visible: true,
|
|
6122
|
+
variant: variant,
|
|
6123
|
+
title: title,
|
|
6124
|
+
subtitle: subtitle,
|
|
6125
|
+
isClosable: isClosable,
|
|
6126
|
+
styles: styles,
|
|
6127
|
+
action: action,
|
|
6128
|
+
actionText: actionText,
|
|
6129
|
+
showIcon: showIcon,
|
|
6130
|
+
timeout: timeout
|
|
6131
|
+
});
|
|
6132
|
+
},
|
|
6133
|
+
hide: function hide() {
|
|
6134
|
+
return set({
|
|
6135
|
+
visible: false
|
|
6136
|
+
});
|
|
6137
|
+
}
|
|
6138
|
+
};
|
|
6139
|
+
});
|
|
6140
|
+
var showMessage = function showMessage(variant, title, subtitle, props) {
|
|
6141
|
+
useMessageStore.getState().show(variant, title, subtitle, props == null ? void 0 : props.isClosable, props == null ? void 0 : props.styles, props == null ? void 0 : props.action, props == null ? void 0 : props.actionText, props == null ? void 0 : props.showIcon, props == null ? void 0 : props.timeout);
|
|
6142
|
+
};
|
|
6143
|
+
var hideMessage = function hideMessage() {
|
|
6144
|
+
useMessageStore.getState().hide();
|
|
6145
|
+
};
|
|
6146
|
+
|
|
6147
|
+
var Themes$1 = {
|
|
6148
|
+
info: {
|
|
6149
|
+
container: {
|
|
6150
|
+
backgroundColor: 'color.blue.200',
|
|
6151
|
+
border: 'color.blue.400'
|
|
6152
|
+
},
|
|
6153
|
+
icon: {
|
|
6154
|
+
color: 'color.blue.500',
|
|
6155
|
+
name: 'InformationSvg'
|
|
6156
|
+
},
|
|
6157
|
+
content: {
|
|
6158
|
+
color: 'color.blue.500'
|
|
6159
|
+
},
|
|
6160
|
+
close: {
|
|
6161
|
+
color: 'color.blue.500',
|
|
6162
|
+
name: 'CloseSvg'
|
|
6163
|
+
}
|
|
6164
|
+
},
|
|
6165
|
+
success: {
|
|
6166
|
+
container: {
|
|
6167
|
+
backgroundColor: 'color.green.200',
|
|
6168
|
+
border: 'color.green.400'
|
|
6169
|
+
},
|
|
6170
|
+
icon: {
|
|
6171
|
+
color: 'color.green.500',
|
|
6172
|
+
name: 'CheckCircleSvg'
|
|
6173
|
+
},
|
|
6174
|
+
content: {
|
|
6175
|
+
color: 'color.green.500'
|
|
6176
|
+
},
|
|
6177
|
+
close: {
|
|
6178
|
+
color: 'color.green.500',
|
|
6179
|
+
name: 'CloseSvg'
|
|
6180
|
+
}
|
|
6181
|
+
},
|
|
6182
|
+
error: {
|
|
6183
|
+
container: {
|
|
6184
|
+
backgroundColor: 'color.red.200',
|
|
6185
|
+
border: 'color.red.400'
|
|
6186
|
+
},
|
|
6187
|
+
icon: {
|
|
6188
|
+
color: 'color.red.500',
|
|
6189
|
+
name: 'ErrrorSvg'
|
|
6190
|
+
},
|
|
6191
|
+
content: {
|
|
6192
|
+
color: 'color.red.500'
|
|
6193
|
+
},
|
|
6194
|
+
close: {
|
|
6195
|
+
color: 'color.red.500',
|
|
6196
|
+
name: 'CloseSvg'
|
|
6197
|
+
}
|
|
6198
|
+
},
|
|
6199
|
+
warning: {
|
|
6200
|
+
container: {
|
|
6201
|
+
backgroundColor: 'color.orange.200',
|
|
6202
|
+
border: 'color.orange.400'
|
|
6203
|
+
},
|
|
6204
|
+
icon: {
|
|
6205
|
+
color: 'color.orange.500',
|
|
6206
|
+
name: 'ErrrorSvg'
|
|
6207
|
+
},
|
|
6208
|
+
content: {
|
|
6209
|
+
color: 'color.orange.500'
|
|
6210
|
+
},
|
|
6211
|
+
close: {
|
|
6212
|
+
color: 'color.orange.500',
|
|
6213
|
+
name: 'CloseSvg'
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
};
|
|
6217
|
+
|
|
6218
|
+
var MessageView = function MessageView(_ref) {
|
|
6219
|
+
var _styles$closingIcon, _styles$closingIcon2;
|
|
6220
|
+
var variant = _ref.variant,
|
|
6221
|
+
hide = _ref.hide,
|
|
6222
|
+
title = _ref.title,
|
|
6223
|
+
subtitle = _ref.subtitle,
|
|
6224
|
+
theme = _ref.theme,
|
|
6225
|
+
action = _ref.action,
|
|
6226
|
+
actionText = _ref.actionText,
|
|
6227
|
+
_ref$showIcon = _ref.showIcon,
|
|
6228
|
+
showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
|
|
6229
|
+
_ref$isClosable = _ref.isClosable,
|
|
6230
|
+
isClosable = _ref$isClosable === void 0 ? false : _ref$isClosable,
|
|
6231
|
+
_ref$timeout = _ref.timeout,
|
|
6232
|
+
timeout = _ref$timeout === void 0 ? 3000 : _ref$timeout,
|
|
6233
|
+
styles = _ref.styles;
|
|
6234
|
+
useEffect(function () {
|
|
6235
|
+
if (timeout && !isClosable) {
|
|
6236
|
+
var timeId = setTimeout(function () {
|
|
6237
|
+
// After 3 seconds set the show value to false
|
|
6238
|
+
hide();
|
|
6239
|
+
}, timeout);
|
|
6240
|
+
return function () {
|
|
6241
|
+
clearTimeout(timeId);
|
|
6242
|
+
};
|
|
6243
|
+
}
|
|
6244
|
+
return;
|
|
6245
|
+
}, []);
|
|
6246
|
+
var Theme = theme != null ? theme : Themes$1;
|
|
6247
|
+
var isWithAction = !!(action && actionText);
|
|
6248
|
+
var containerStyle = {
|
|
6249
|
+
borderWidth: 1,
|
|
6250
|
+
borderStyle: 'solid',
|
|
6251
|
+
borderRadius: 8,
|
|
6252
|
+
borderColor: "" + Theme[variant].container.border
|
|
6253
|
+
};
|
|
6254
|
+
var iconColor = {
|
|
6255
|
+
info: '#3b82f6',
|
|
6256
|
+
success: '#4ade80',
|
|
6257
|
+
warning: '#f97316',
|
|
6258
|
+
error: '#ef4444'
|
|
6259
|
+
}[variant];
|
|
6260
|
+
var iconComponent = {
|
|
6261
|
+
info: React.createElement(InfoSvg, Object.assign({
|
|
6262
|
+
size: 24,
|
|
6263
|
+
color: iconColor
|
|
6264
|
+
}, styles == null ? void 0 : styles.icon)),
|
|
6265
|
+
success: React.createElement(SuccessSvg, Object.assign({
|
|
6266
|
+
size: 24,
|
|
6267
|
+
color: iconColor
|
|
6268
|
+
}, styles == null ? void 0 : styles.icon)),
|
|
6269
|
+
warning: React.createElement(WarningSvg, Object.assign({
|
|
6270
|
+
size: 24,
|
|
6271
|
+
color: iconColor
|
|
6272
|
+
}, styles == null ? void 0 : styles.icon)),
|
|
6273
|
+
error: React.createElement(ErrorSvg, Object.assign({
|
|
6274
|
+
size: 24,
|
|
6275
|
+
color: iconColor
|
|
6276
|
+
}, styles == null ? void 0 : styles.icon))
|
|
6277
|
+
}[variant];
|
|
6278
|
+
var isShowIcon = showIcon && iconComponent;
|
|
6279
|
+
return React.createElement(Horizontal, Object.assign({
|
|
6280
|
+
role: "messageContent",
|
|
6281
|
+
gap: 16,
|
|
6282
|
+
width: 400,
|
|
6283
|
+
// safe={true}
|
|
6284
|
+
wrap: "nowrap",
|
|
6285
|
+
position: 'relative',
|
|
6286
|
+
alignItems: "center",
|
|
6287
|
+
padding: "14px 24px 14px 14px",
|
|
6288
|
+
color: "" + Theme[variant].content.color,
|
|
6289
|
+
backgroundColor: "" + Theme[variant].container.backgroundColor,
|
|
6290
|
+
onClick: isClosable ? function () {} : function () {
|
|
6291
|
+
hide();
|
|
6292
|
+
}
|
|
6293
|
+
}, containerStyle, styles == null ? void 0 : styles.container), isShowIcon && iconComponent, React.createElement(Vertical, {
|
|
6294
|
+
gap: 8,
|
|
6295
|
+
width: "100%"
|
|
6296
|
+
}, React.createElement(Text, Object.assign({
|
|
6297
|
+
size: "md",
|
|
6298
|
+
weight: "semiBold"
|
|
6299
|
+
}, styles == null ? void 0 : styles.title), title), subtitle && React.createElement(Text, Object.assign({
|
|
6300
|
+
size: "sm"
|
|
6301
|
+
}, styles == null ? void 0 : styles.subtitle), subtitle)), isWithAction && React.createElement(Text, Object.assign({
|
|
6302
|
+
marginRight: 10,
|
|
6303
|
+
onClick: action,
|
|
6304
|
+
padding: "6px 10px",
|
|
6305
|
+
whiteSpace: "nowrap"
|
|
6306
|
+
}, containerStyle, styles == null ? void 0 : styles.actionText), actionText), isClosable && React.createElement(View, Object.assign({
|
|
6307
|
+
position: "absolute",
|
|
6308
|
+
zIndex: 10000,
|
|
6309
|
+
right: 8,
|
|
6310
|
+
top: 6,
|
|
6311
|
+
onClick: function onClick() {
|
|
6312
|
+
hide();
|
|
6313
|
+
}
|
|
6314
|
+
}, styles == null || (_styles$closingIcon = styles.closingIcon) == null ? void 0 : _styles$closingIcon.container), React.createElement(CloseSvg, Object.assign({
|
|
6315
|
+
size: 18,
|
|
6316
|
+
color: iconColor
|
|
6317
|
+
}, styles == null || (_styles$closingIcon2 = styles.closingIcon) == null ? void 0 : _styles$closingIcon2.icon))));
|
|
6318
|
+
};
|
|
6319
|
+
|
|
6320
|
+
var MessageLayout = function MessageLayout(_ref) {
|
|
6321
|
+
var container = _ref.container,
|
|
6322
|
+
theme = _ref.theme,
|
|
6323
|
+
_ref$position = _ref.position,
|
|
6324
|
+
position = _ref$position === void 0 ? 'topRight' : _ref$position;
|
|
6325
|
+
var _useMessageStore = useMessageStore(),
|
|
6326
|
+
visible = _useMessageStore.visible,
|
|
6327
|
+
title = _useMessageStore.title,
|
|
6328
|
+
variant = _useMessageStore.variant,
|
|
6329
|
+
subtitle = _useMessageStore.subtitle,
|
|
6330
|
+
isClosable = _useMessageStore.isClosable,
|
|
6331
|
+
styles = _useMessageStore.styles,
|
|
6332
|
+
action = _useMessageStore.action,
|
|
6333
|
+
actionText = _useMessageStore.actionText,
|
|
6334
|
+
showIcon = _useMessageStore.showIcon,
|
|
6335
|
+
timeout = _useMessageStore.timeout;
|
|
6336
|
+
var toastPosition = {
|
|
6337
|
+
topLeft: {
|
|
6338
|
+
top: 6,
|
|
6339
|
+
left: 8
|
|
6340
|
+
},
|
|
6341
|
+
topRight: {
|
|
6342
|
+
top: 6,
|
|
6343
|
+
right: 8
|
|
6344
|
+
},
|
|
6345
|
+
bottomLeft: {
|
|
6346
|
+
bottom: 8,
|
|
6347
|
+
left: 6
|
|
6348
|
+
},
|
|
6349
|
+
bottomRight: {
|
|
6350
|
+
bottom: 8,
|
|
6351
|
+
right: 6
|
|
6352
|
+
}
|
|
6353
|
+
}[position];
|
|
6354
|
+
// Crée une fonction pour construire le contenu du message
|
|
6355
|
+
var renderMessageContent = function renderMessageContent() {
|
|
6356
|
+
return React.createElement(MessageView, {
|
|
6357
|
+
variant: variant,
|
|
6358
|
+
subtitle: subtitle,
|
|
6359
|
+
show: visible,
|
|
6360
|
+
title: title,
|
|
6361
|
+
theme: theme,
|
|
6362
|
+
isClosable: isClosable,
|
|
6363
|
+
styles: styles,
|
|
6364
|
+
action: action,
|
|
6365
|
+
actionText: actionText,
|
|
6366
|
+
showIcon: showIcon,
|
|
6367
|
+
timeout: timeout,
|
|
6368
|
+
hide: function hide() {
|
|
6369
|
+
return hideMessage();
|
|
6370
|
+
}
|
|
6371
|
+
});
|
|
6372
|
+
};
|
|
6373
|
+
var MessageContainer = container ? React.cloneElement(container, {}, renderMessageContent()) : React.createElement(View, Object.assign({
|
|
6374
|
+
position: 'absolute',
|
|
6375
|
+
zIndex: 10000
|
|
6376
|
+
}, toastPosition), renderMessageContent());
|
|
6377
|
+
return visible ? MessageContainer : null;
|
|
6378
|
+
};
|
|
6379
|
+
|
|
6380
|
+
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, Tabs, Text, TextArea, TextField, Toggle, ToggleGroup, Top, Vertical, View, hideMessage, hideModal, showMessage, showModal, useMessageStore, useModalStore };
|
|
5586
6381
|
//# sourceMappingURL=web.esm.js.map
|