@xqmsg/ui-core 0.16.1 → 0.16.2

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.
@@ -1,8 +1,8 @@
1
1
  import React__default, { useMemo, useCallback, useRef, useEffect, useState, memo, forwardRef, createElement } from 'react';
2
- import { Button as Button$2, Image, Alert as Alert$1, AlertDescription, Flex, Box, Text as Text$2, Icon as Icon$1, Spinner, Checkbox, Input as Input$2, InputGroup, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, Table as Table$2, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, extendTheme } from '@chakra-ui/react';
2
+ import { Button as Button$2, Image, Alert as Alert$1, AlertDescription, Flex, Box, Text as Text$2, Icon as Icon$1, Spinner, Checkbox, InputGroup, Input as Input$2, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, Tooltip, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, Table as Table$2, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, extendTheme } from '@chakra-ui/react';
3
3
  import { FormProvider, useWatch, Controller } from 'react-hook-form';
4
4
  import { debounce, truncate } from 'lodash-es';
5
- import { CloseIcon, HamburgerIcon } from '@chakra-ui/icons';
5
+ import { QuestionOutlineIcon, CloseIcon, HamburgerIcon } from '@chakra-ui/icons';
6
6
  import { HiOutlineRefresh } from 'react-icons/hi';
7
7
  import { ChakraProvider } from '@chakra-ui/provider';
8
8
  import { createBreakpoints, transparentize, mode, getColor } from '@chakra-ui/theme-tools';
@@ -454,7 +454,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
454
454
  return target;
455
455
  }
456
456
 
457
- var _excluded = ["type", "isRequired"];
457
+ var _excluded = ["type", "isRequired", "rightElement", "leftElement"];
458
458
  /**
459
459
  * A functional React component utilized to render the `StackedInput` component.
460
460
  */
@@ -463,13 +463,16 @@ var StackedInput = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref)
463
463
  var _ref2$type = _ref2.type,
464
464
  type = _ref2$type === void 0 ? 'text' : _ref2$type,
465
465
  isRequired = _ref2.isRequired,
466
+ rightElement = _ref2.rightElement,
467
+ leftElement = _ref2.leftElement,
466
468
  props = _objectWithoutPropertiesLoose(_ref2, _excluded);
467
469
 
468
- return /*#__PURE__*/React__default.createElement(Input$2, Object.assign({
469
- ref: _ref,
470
+ return /*#__PURE__*/React__default.createElement(InputGroup, null, leftElement && leftElement, /*#__PURE__*/React__default.createElement(Input$2, Object.assign({
470
471
  type: type,
471
472
  isRequired: isRequired
472
- }, props));
473
+ }, props, {
474
+ ref: _ref
475
+ })), rightElement && rightElement);
473
476
  });
474
477
 
475
478
  /**
@@ -1404,10 +1407,10 @@ var StackedPilledInput = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1404
1407
  onRemoveTag(index);
1405
1408
  }
1406
1409
  }));
1407
- }) : /*#__PURE__*/React__default.createElement(Text$2, {
1410
+ }) : null, !lastestFormValueToArray.length && !isFocussed ? /*#__PURE__*/React__default.createElement(Text$2, {
1408
1411
  color: colors.label.secondary.light,
1409
1412
  fontSize: "13px"
1410
- }, placeholder)), /*#__PURE__*/React__default.createElement(Flex, {
1413
+ }, placeholder) : null), /*#__PURE__*/React__default.createElement(Flex, {
1411
1414
  flex: 1,
1412
1415
  minWidth: isFocussed ? '20%' : 0
1413
1416
  }, /*#__PURE__*/React__default.createElement(Input$2, {
@@ -1467,12 +1470,22 @@ var StackedSwitch = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1467
1470
  */
1468
1471
 
1469
1472
  var Label$1 = function Label(_ref) {
1470
- var isRequired = _ref.isRequired,
1473
+ var tooltipText = _ref.tooltipText,
1474
+ isRequired = _ref.isRequired,
1471
1475
  label = _ref.label;
1472
- return /*#__PURE__*/React__default.createElement(FormLabel$1, null, label, isRequired && /*#__PURE__*/React__default.createElement(Box, {
1476
+ return /*#__PURE__*/React__default.createElement(FormLabel$1, {
1477
+ display: "flex",
1478
+ alignItems: "center"
1479
+ }, label, isRequired && /*#__PURE__*/React__default.createElement(Box, {
1473
1480
  ml: 1,
1474
1481
  color: colors.label.error
1475
- }, "*"));
1482
+ }, "*"), !!tooltipText && /*#__PURE__*/React__default.createElement(Tooltip, {
1483
+ label: tooltipText,
1484
+ placement: "top"
1485
+ }, /*#__PURE__*/React__default.createElement(QuestionOutlineIcon, {
1486
+ boxSize: "13px",
1487
+ ml: "8px"
1488
+ })));
1476
1489
  };
1477
1490
 
1478
1491
  /**
@@ -1489,6 +1502,7 @@ function Input(_ref) {
1489
1502
  name = _ref.name,
1490
1503
  helperText = _ref.helperText,
1491
1504
  options = _ref.options,
1505
+ tooltipText = _ref.tooltipText,
1492
1506
  isInvalid = _ref.isInvalid,
1493
1507
  errorText = _ref.errorText,
1494
1508
  isRequired = _ref.isRequired,
@@ -1496,6 +1510,8 @@ function Input(_ref) {
1496
1510
  defaultValue = _ref.defaultValue,
1497
1511
  control = _ref.control,
1498
1512
  disabled = _ref.disabled,
1513
+ rightElement = _ref.rightElement,
1514
+ leftElement = _ref.leftElement,
1499
1515
  onChange = _ref.onChange,
1500
1516
  setValue = _ref.setValue,
1501
1517
  setError = _ref.setError,
@@ -1516,6 +1532,8 @@ function Input(_ref) {
1516
1532
  onChange: onChange,
1517
1533
  onBlur: onBlur,
1518
1534
  ref: ref,
1535
+ rightElement: rightElement,
1536
+ leftElement: leftElement,
1519
1537
  disabled: disabled,
1520
1538
  value: value
1521
1539
  });
@@ -1558,6 +1576,7 @@ function Input(_ref) {
1558
1576
  className: "input-" + inputType + " " + (className != null ? className : ''),
1559
1577
  name: name,
1560
1578
  id: name,
1579
+ placeholder: placeholder,
1561
1580
  maxLength: maxLength,
1562
1581
  isInvalid: isInvalid,
1563
1582
  onChange: onChange,
@@ -1613,6 +1632,7 @@ function Input(_ref) {
1613
1632
  ref: ref,
1614
1633
  disabled: disabled,
1615
1634
  value: value,
1635
+ placeholder: placeholder,
1616
1636
  setValue: setValue,
1617
1637
  setError: setError,
1618
1638
  clearErrors: clearErrors,
@@ -1659,6 +1679,7 @@ function Input(_ref) {
1659
1679
  position: "relative",
1660
1680
  py: label || helperText || isInvalid ? 6 : 0
1661
1681
  }, label && /*#__PURE__*/React__default.createElement(Label$1, {
1682
+ tooltipText: tooltipText,
1662
1683
  label: label,
1663
1684
  isRequired: isRequired
1664
1685
  }), selectedInputField(onChange ? onChange : fieldOnChange, onBlur, ref, value), isInvalid ? /*#__PURE__*/React__default.createElement(FormErrorMessage, null, errorText) : helperText && /*#__PURE__*/React__default.createElement(FormHelperText, null, helperText));
@@ -2542,214 +2563,9 @@ var Link = {
2542
2563
  variants: variants$5
2543
2564
  };
2544
2565
 
2545
- var parts$4 = ['overlay', 'dialogContainer', 'dialog', 'header', 'closeButton', 'body', 'footer'];
2546
- var baseStyleOverlay = {
2547
- bg: 'blackAlpha.600',
2548
- zIndex: 'modal'
2549
- };
2550
-
2551
- function baseStyleDialogContainer(props) {
2552
- var scrollBehavior = props.scrollBehavior;
2553
- return {
2554
- display: 'flex',
2555
- zIndex: 'modal',
2556
- justifyContent: 'center',
2557
- alignItems: 'flex-start',
2558
- overflow: scrollBehavior === 'inside' ? 'hidden' : 'auto',
2559
- WebkitOverflowScrolling: 'touch'
2560
- };
2561
- }
2562
-
2563
- function baseStyleDialog(props) {
2564
- var isCentered = props.isCentered,
2565
- scrollBehavior = props.scrollBehavior;
2566
- return {
2567
- borderRadius: 'lg',
2568
- bg: mode('white', 'gray.700')(props),
2569
- color: 'inherit',
2570
- mt: isCentered ? {
2571
- base: 8,
2572
- md: 'auto'
2573
- } : '3.75rem',
2574
- mb: isCentered ? {
2575
- base: 20,
2576
- md: 'auto'
2577
- } : '3.75rem',
2578
- mx: 4,
2579
- zIndex: 'modal',
2580
- maxH: scrollBehavior === 'inside' ? 'calc(100vh - 7.5rem)' : undefined,
2581
- boxShadow: mode('xl', 'dark-lg')(props)
2582
- };
2583
- }
2584
-
2585
- var baseStyleHeader = {
2586
- px: 6,
2587
- py: 4,
2588
- minHeight: 20,
2589
- fontSize: 'xl',
2590
- display: 'flex',
2591
- alignItems: 'center',
2592
- fontWeight: 'bold',
2593
- bg: 'primary.900',
2594
- color: 'white',
2595
- userSelect: 'none'
2596
- };
2597
- var baseStyleCloseButton = {
2598
- position: 'absolute',
2599
- top: 2,
2600
- right: 3
2601
- };
2602
-
2603
- function baseStyleBody(props) {
2604
- var scrollBehavior = props.scrollBehavior;
2605
- return {
2606
- px: [6, null, 20],
2607
- py: 10,
2608
- flex: 1,
2609
- overflow: scrollBehavior === 'inside' ? 'auto' : undefined
2610
- };
2611
- }
2612
-
2613
- var baseStyleFooter = {
2614
- px: [6, null, 20],
2615
- pt: 5,
2616
- pb: 16
2617
- };
2618
-
2619
- var baseStyle$9 = function baseStyle(props) {
2620
- return {
2621
- overlay: baseStyleOverlay,
2622
- dialogContainer: baseStyleDialogContainer(props),
2623
- dialog: baseStyleDialog(props),
2624
- header: baseStyleHeader,
2625
- closeButton: baseStyleCloseButton,
2626
- body: baseStyleBody(props),
2627
- footer: baseStyleFooter
2628
- };
2629
- };
2630
- /**
2631
- * Since the `maxWidth` prop references theme.sizes internally,
2632
- * we can leverage that to size our modals.
2633
- */
2634
-
2635
-
2636
- function getSize(value) {
2637
- var commonBodyFooterStyles = {
2638
- xs: {
2639
- px: 8,
2640
- pb: 8
2641
- },
2642
- sm: {
2643
- px: 8,
2644
- pb: 8
2645
- },
2646
- md: {
2647
- px: 8,
2648
- pb: 8
2649
- },
2650
- lg: {
2651
- px: 10,
2652
- pb: 10
2653
- },
2654
- xl: {
2655
- px: 12,
2656
- pb: 10
2657
- }
2658
- };
2659
- var bodyStyles = {
2660
- xs: {
2661
- py: 6
2662
- },
2663
- sm: {
2664
- py: 6
2665
- },
2666
- md: {
2667
- py: 6
2668
- },
2669
- lg: {
2670
- py: 8
2671
- },
2672
- xl: {
2673
- py: 8
2674
- }
2675
- };
2676
- var footerStyles = {
2677
- xs: {
2678
- pb: 8
2679
- },
2680
- sm: {
2681
- pb: 8
2682
- },
2683
- md: {
2684
- pb: 8
2685
- },
2686
- lg: {
2687
- pb: 10
2688
- },
2689
- xl: {
2690
- pb: 10
2691
- }
2692
- };
2693
-
2694
- if (value === 'full') {
2695
- return {
2696
- content: {
2697
- maxW: '100vw',
2698
- h: '100vh'
2699
- }
2700
- };
2701
- }
2702
-
2703
- return {
2704
- content: {
2705
- maxW: value
2706
- },
2707
- body: _extends({}, commonBodyFooterStyles[value], bodyStyles[value]),
2708
- footer: _extends({}, commonBodyFooterStyles[value], footerStyles[value])
2709
- };
2710
- }
2711
-
2712
- var sizes = {
2713
- xs: /*#__PURE__*/getSize('xs'),
2714
- sm: /*#__PURE__*/getSize('sm'),
2715
- md: /*#__PURE__*/getSize('md'),
2716
- lg: /*#__PURE__*/getSize('lg'),
2717
- xl: /*#__PURE__*/getSize('xl'),
2718
- '2xl': /*#__PURE__*/getSize('2xl'),
2719
- '3xl': /*#__PURE__*/getSize('3xl'),
2720
- '4xl': /*#__PURE__*/getSize('4xl'),
2721
- '5xl': /*#__PURE__*/getSize('5xl'),
2722
- '6xl': /*#__PURE__*/getSize('6xl'),
2723
- full: /*#__PURE__*/getSize('full')
2724
- };
2725
-
2726
- var warningVariant = function warningVariant() {
2727
- return {
2728
- header: {
2729
- bg: 'warning.300',
2730
- color: 'black'
2731
- }
2732
- };
2733
- };
2734
-
2735
- var variants$6 = {
2736
- warning: warningVariant
2737
- };
2738
- var defaultProps$5 = {
2739
- size: 'lg',
2740
- isCentered: true
2741
- };
2742
- var Modal = {
2743
- parts: parts$4,
2744
- baseStyle: baseStyle$9,
2745
- sizes: sizes,
2746
- variants: variants$6,
2747
- defaultProps: defaultProps$5
2748
- };
2749
-
2750
- var defaultProps$6 = Input$1.defaultProps,
2751
- variants$7 = Input$1.variants;
2752
- var parts$5 = ['field', 'icon'];
2566
+ var defaultProps$5 = Input$1.defaultProps,
2567
+ variants$6 = Input$1.variants;
2568
+ var parts$4 = ['field', 'icon'];
2753
2569
 
2754
2570
  function baseStyleField() {
2755
2571
  return _extends({}, Input$1.baseStyle.field, {
@@ -2770,7 +2586,7 @@ var baseStyleInput = {
2770
2586
  }
2771
2587
  };
2772
2588
 
2773
- var baseStyle$a = function baseStyle() {
2589
+ var baseStyle$9 = function baseStyle() {
2774
2590
  return {
2775
2591
  field: baseStyleField(),
2776
2592
  icon: baseStyleInput
@@ -2778,13 +2594,13 @@ var baseStyle$a = function baseStyle() {
2778
2594
  };
2779
2595
 
2780
2596
  var Select = {
2781
- parts: parts$5,
2782
- baseStyle: baseStyle$a,
2783
- variants: variants$7,
2784
- defaultProps: defaultProps$6
2597
+ parts: parts$4,
2598
+ baseStyle: baseStyle$9,
2599
+ variants: variants$6,
2600
+ defaultProps: defaultProps$5
2785
2601
  };
2786
2602
 
2787
- var parts$6 = ['track', 'thumb'];
2603
+ var parts$5 = ['track', 'thumb'];
2788
2604
 
2789
2605
  function baseStyleTrack(props) {
2790
2606
  var c = props.colorScheme,
@@ -2817,14 +2633,14 @@ var baseStyleThumb = {
2817
2633
  transform: 'translateX(0)'
2818
2634
  };
2819
2635
 
2820
- var baseStyle$b = function baseStyle(props) {
2636
+ var baseStyle$a = function baseStyle(props) {
2821
2637
  return {
2822
2638
  track: baseStyleTrack(props),
2823
2639
  thumb: baseStyleThumb
2824
2640
  };
2825
2641
  };
2826
2642
 
2827
- var sizes$1 = {
2643
+ var sizes = {
2828
2644
  sm: {
2829
2645
  track: {
2830
2646
  w: '1.375rem',
@@ -2865,19 +2681,19 @@ var sizes$1 = {
2865
2681
  }
2866
2682
  }
2867
2683
  };
2868
- var defaultProps$7 = {
2684
+ var defaultProps$6 = {
2869
2685
  size: 'md',
2870
2686
  colorScheme: 'blue'
2871
2687
  };
2872
2688
  var Switch = {
2873
- parts: parts$6,
2874
- baseStyle: baseStyle$b,
2875
- sizes: sizes$1,
2876
- defaultProps: defaultProps$7
2689
+ parts: parts$5,
2690
+ baseStyle: baseStyle$a,
2691
+ sizes: sizes,
2692
+ defaultProps: defaultProps$6
2877
2693
  };
2878
2694
 
2879
- var parts$7 = ['th', 'td', 'tr', 'body', 'thead'];
2880
- var baseStyle$c = {
2695
+ var parts$6 = ['th', 'td', 'tr', 'body', 'thead'];
2696
+ var baseStyle$b = {
2881
2697
  thead: {
2882
2698
  bg: colors.label.primary.dark
2883
2699
  },
@@ -2913,11 +2729,11 @@ var baseStyle$c = {
2913
2729
  }
2914
2730
  };
2915
2731
  var Table$1 = {
2916
- parts: parts$7,
2917
- baseStyle: baseStyle$c
2732
+ parts: parts$6,
2733
+ baseStyle: baseStyle$b
2918
2734
  };
2919
2735
 
2920
- var parts$8 = ['root', 'tablist', 'tab', 'tabpanel', 'indicator'];
2736
+ var parts$7 = ['root', 'tablist', 'tab', 'tabpanel', 'indicator'];
2921
2737
 
2922
2738
  function baseStyleRoot(props) {
2923
2739
  var orientation = props.orientation;
@@ -2957,7 +2773,7 @@ var baseStyleTabpanel = {
2957
2773
  p: 4
2958
2774
  };
2959
2775
 
2960
- var baseStyle$d = function baseStyle(props) {
2776
+ var baseStyle$c = function baseStyle(props) {
2961
2777
  return {
2962
2778
  root: baseStyleRoot(props),
2963
2779
  tab: baseStyleTab(props),
@@ -2966,7 +2782,7 @@ var baseStyle$d = function baseStyle(props) {
2966
2782
  };
2967
2783
  };
2968
2784
 
2969
- var sizes$2 = {
2785
+ var sizes$1 = {
2970
2786
  sm: {
2971
2787
  tab: {
2972
2788
  py: '0.25rem',
@@ -3136,7 +2952,7 @@ var variantSimple = {
3136
2952
  }
3137
2953
  }
3138
2954
  };
3139
- var variants$8 = {
2955
+ var variants$7 = {
3140
2956
  line: variantLine,
3141
2957
  enclosed: variantEnclosed,
3142
2958
  'enclosed-colored': variantEnclosedColored,
@@ -3145,20 +2961,20 @@ var variants$8 = {
3145
2961
  unstyled: variantUnstyled,
3146
2962
  simple: variantSimple
3147
2963
  };
3148
- var defaultProps$8 = {
2964
+ var defaultProps$7 = {
3149
2965
  size: 'md',
3150
2966
  variant: 'line',
3151
2967
  colorScheme: 'blue'
3152
2968
  };
3153
2969
  var Tabs = {
3154
- parts: parts$8,
3155
- baseStyle: baseStyle$d,
3156
- sizes: sizes$2,
3157
- variants: variants$8,
3158
- defaultProps: defaultProps$8
2970
+ parts: parts$7,
2971
+ baseStyle: baseStyle$c,
2972
+ sizes: sizes$1,
2973
+ variants: variants$7,
2974
+ defaultProps: defaultProps$7
3159
2975
  };
3160
2976
 
3161
- var baseStyle$e = /*#__PURE__*/_extends({}, Input$1.baseStyle.field, {
2977
+ var baseStyle$d = /*#__PURE__*/_extends({}, Input$1.baseStyle.field, {
3162
2978
  fontSize: '13px',
3163
2979
  display: 'block',
3164
2980
  paddingY: '8px',
@@ -3167,16 +2983,16 @@ var baseStyle$e = /*#__PURE__*/_extends({}, Input$1.baseStyle.field, {
3167
2983
  lineHeight: 'short'
3168
2984
  });
3169
2985
 
3170
- var defaultProps$9 = {
2986
+ var defaultProps$8 = {
3171
2987
  variant: 'default'
3172
2988
  };
3173
2989
  var Textarea = {
3174
- baseStyle: baseStyle$e,
3175
- defaultProps: defaultProps$9
2990
+ baseStyle: baseStyle$d,
2991
+ defaultProps: defaultProps$8
3176
2992
  };
3177
2993
 
3178
- var defaultProps$a = Text$2.defaultProps;
3179
- var baseStyle$f = {
2994
+ var defaultProps$9 = Text$2.defaultProps;
2995
+ var baseStyle$e = {
3180
2996
  fontWeight: typography.fontWeights.normal,
3181
2997
  fontFamily: typography.fonts.base,
3182
2998
  fontSize: typography.fontSizes.sm,
@@ -3185,7 +3001,7 @@ var baseStyle$f = {
3185
3001
  };
3186
3002
 
3187
3003
  function variantHeader() {
3188
- return _extends({}, baseStyle$f, {
3004
+ return _extends({}, baseStyle$e, {
3189
3005
  fontWeight: typography.fontWeights.bold,
3190
3006
  fontSize: typography.fontSizes['3xl'],
3191
3007
  lineHeight: typography.lineHeights[8],
@@ -3194,7 +3010,7 @@ function variantHeader() {
3194
3010
  }
3195
3011
 
3196
3012
  function variantSubheader() {
3197
- return _extends({}, baseStyle$f, {
3013
+ return _extends({}, baseStyle$e, {
3198
3014
  fontWeight: typography.fontWeights.semibold,
3199
3015
  fontSize: typography.fontSizes['lg'],
3200
3016
  lineHeight: typography.lineHeights[5],
@@ -3203,19 +3019,19 @@ function variantSubheader() {
3203
3019
  }
3204
3020
 
3205
3021
  function variantParagraph() {
3206
- return baseStyle$f;
3022
+ return baseStyle$e;
3207
3023
  }
3208
3024
 
3209
- var variants$9 = {
3025
+ var variants$8 = {
3210
3026
  header: variantHeader,
3211
3027
  subheader: variantSubheader,
3212
3028
  paragraph: variantParagraph
3213
3029
  };
3214
3030
  var Text$1 = {
3215
- baseStyle: baseStyle$f,
3216
- variants: variants$9,
3217
- defaultProps: /*#__PURE__*/_extends({}, defaultProps$a, {
3218
- variant: variants$9.paragraph
3031
+ baseStyle: baseStyle$e,
3032
+ variants: variants$8,
3033
+ defaultProps: /*#__PURE__*/_extends({}, defaultProps$9, {
3034
+ variant: variants$8.paragraph
3219
3035
  })
3220
3036
  };
3221
3037
 
@@ -3255,7 +3071,6 @@ var customXQChakraTheme = /*#__PURE__*/extendTheme( /*#__PURE__*/_extends({
3255
3071
  FormLabel: FormLabel,
3256
3072
  Input: Input$1,
3257
3073
  Link: Link,
3258
- Modal: Modal,
3259
3074
  Select: Select,
3260
3075
  Switch: Switch,
3261
3076
  Table: Table$1,