@xqmsg/ui-core 0.19.2 → 0.19.4

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.
@@ -28,4 +28,5 @@ import { TableFill } from './table/fill';
28
28
  import { TableOutline } from './table/outline';
29
29
  import { Trash } from './trash';
30
30
  import { Warning } from './warning';
31
- export { Checkmark, ChevronDown, ChevronRight, Clock, Close, Dropdown, Error, FileFill, FileOutline, FolderFill, FolderOutline, FolderAddFill, FolderAddOutline, Google, GoogleDrive, Group, Home, Image, Link, Menu, Microsoft, MicrosoftOneDrive, Neutral, Positive, Search, Settings, TableFill, TableOutline, Trash, Warning, };
31
+ import { Services } from './services';
32
+ export { Checkmark, ChevronDown, ChevronRight, Clock, Close, Dropdown, Error, FileFill, FileOutline, FolderFill, FolderOutline, FolderAddFill, FolderAddOutline, Google, GoogleDrive, Group, Home, Image, Link, Menu, Microsoft, MicrosoftOneDrive, Neutral, Positive, Search, Services, Settings, TableFill, TableOutline, Trash, Warning, };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ServicesProps {
3
+ boxSize: number | string;
4
+ }
5
+ /**
6
+ * A functional React component utilized to render the `Services` icon component
7
+ */
8
+ export declare const Services: React.FC<ServicesProps>;
@@ -4,6 +4,7 @@ import { StackedInputProps } from '../StackedInput/StackedInput';
4
4
  import { UseFormSetValue, FieldValues, Control } from 'react-hook-form';
5
5
  export interface StackedSelectProps extends StackedInputProps {
6
6
  options: FieldOptions;
7
+ fullOptions?: FieldOptions;
7
8
  setValue: UseFormSetValue<FieldValues>;
8
9
  control: Control<FieldValues, any>;
9
10
  handleOnChange: (value?: string) => void;
@@ -10,6 +10,7 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
10
10
  label?: string;
11
11
  className?: string;
12
12
  options?: FieldOptions;
13
+ fullOptions?: FieldOptions;
13
14
  maxLength?: number;
14
15
  helperText?: React.ReactNode;
15
16
  control: Control<T, any>;
@@ -26,4 +27,4 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
26
27
  * A functional React component utilized to render the `Input` component. Utilizes a switch statement
27
28
  * to render the correct input based on the `inputType`.
28
29
  */
29
- export declare function Input<T extends FieldValues>({ inputType, label, ariaLabel, className, placeholder, name, helperText, options, tooltipText, isInvalid, errorText, isRequired, maxLength, defaultValue, control, disabled, rightElement, leftElement, onChange, setValue, setError, clearErrors, }: InputProps<T>): JSX.Element;
30
+ export declare function Input<T extends FieldValues>({ inputType, label, ariaLabel, className, placeholder, name, helperText, options, tooltipText, isInvalid, errorText, isRequired, maxLength, defaultValue, fullOptions, control, disabled, rightElement, leftElement, onChange, setValue, setError, clearErrors, }: InputProps<T>): JSX.Element;
@@ -14,7 +14,7 @@ export declare type GroupedMenuItem = {
14
14
  };
15
15
  export interface NavigationMenuProps {
16
16
  groupedMenuItems: GroupedMenuItem[];
17
- defaultSelectedMenuItem?: string;
17
+ selectedMenuItem?: string;
18
18
  }
19
19
  /**
20
20
  * A functional React component utilized to render the `NavigationMenu` component
@@ -808,13 +808,6 @@ var Dropdown = function Dropdown(_ref) {
808
808
  }, DropdownContent);
809
809
  };
810
810
 
811
- var useDidMountEffect = function useDidMountEffect(func, deps) {
812
- var didMount = React.useRef(false);
813
- React.useEffect(function () {
814
- if (didMount.current) func();else didMount.current = true; // eslint-disable-next-line
815
- }, deps);
816
- };
817
-
818
811
  function useOnClickOutside(ref, handler) {
819
812
  React.useEffect(function () {
820
813
  var listener = function listener(event) {
@@ -872,7 +865,7 @@ var Dropdown$1 = function Dropdown(_ref) {
872
865
  });
873
866
  };
874
867
 
875
- var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value"];
868
+ var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value", "fullOptions"];
876
869
  /**
877
870
  * A functional React component utilized to render the `StackedSelect` component.
878
871
  */
@@ -887,6 +880,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
887
880
  handleOnChange = _ref2.handleOnChange,
888
881
  disabled = _ref2.disabled,
889
882
  value = _ref2.value,
883
+ fullOptions = _ref2.fullOptions,
890
884
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
891
885
 
892
886
  var dropdownRef = React.useRef(null);
@@ -930,13 +924,13 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
930
924
  setPosition('bottom');
931
925
  }
932
926
  }, [boundingClientRect]);
933
- useDidMountEffect(function () {
934
- var _options$find$label2, _options$find2;
927
+ React.useEffect(function () {
928
+ var _find$label, _find;
935
929
 
936
- setSelectedOption((_options$find$label2 = (_options$find2 = options.find(function (option) {
930
+ setSelectedOption((_find$label = (_find = (fullOptions || options).find(function (option) {
937
931
  return option.value === value;
938
- })) == null ? void 0 : _options$find2.label) != null ? _options$find$label2 : '');
939
- }, [value]);
932
+ })) == null ? void 0 : _find.label) != null ? _find$label : '');
933
+ }, [fullOptions, value]);
940
934
  useOnClickOutside(dropdownRef, function () {
941
935
  return setIsFocussed(false);
942
936
  });
@@ -1810,6 +1804,7 @@ function Input(_ref) {
1810
1804
  isRequired = _ref.isRequired,
1811
1805
  maxLength = _ref.maxLength,
1812
1806
  defaultValue = _ref.defaultValue,
1807
+ fullOptions = _ref.fullOptions,
1813
1808
  control = _ref.control,
1814
1809
  disabled = _ref.disabled,
1815
1810
  rightElement = _ref.rightElement,
@@ -1870,7 +1865,8 @@ function Input(_ref) {
1870
1865
  disabled: disabled,
1871
1866
  value: value,
1872
1867
  defaultValue: defaultValue,
1873
- placeholder: placeholder
1868
+ placeholder: placeholder,
1869
+ fullOptions: fullOptions
1874
1870
  });
1875
1871
 
1876
1872
  case 'textarea':
@@ -2722,6 +2718,37 @@ var Trash = function Trash(_ref) {
2722
2718
  });
2723
2719
  };
2724
2720
 
2721
+ var _path$u;
2722
+ function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
2723
+ var SvgServices = function SvgServices(props, ref) {
2724
+ return /*#__PURE__*/React.createElement("svg", _extends$v({
2725
+ width: 14,
2726
+ height: 14,
2727
+ viewBox: "0 0 14 14",
2728
+ fill: "none",
2729
+ xmlns: "http://www.w3.org/2000/svg",
2730
+ ref: ref
2731
+ }, props), _path$u || (_path$u = /*#__PURE__*/React.createElement("path", {
2732
+ d: "M8.5 3.058c0-.237.124-.45.267-.64.148-.193.233-.422.233-.668C9 1.06 8.328.5 7.5.5S6 1.06 6 1.75c0 .246.085.475.233.669.143.188.267.402.267.639v0c0 .24-.197.435-.438.428a32.26 32.26 0 0 1-2.775-.2c.124 1.076.195 2.167.21 3.272A.437.437 0 0 1 3.058 7v0c-.237 0-.45-.124-.64-.267A1.098 1.098 0 0 0 1.75 6.5C1.06 6.5.5 7.172.5 8s.56 1.5 1.25 1.5c.246 0 .475-.085.669-.233.188-.143.402-.267.639-.267v0c.206 0 .37.174.355.38a32.022 32.022 0 0 1-.429 3.37 32.23 32.23 0 0 0 3.078.236.427.427 0 0 0 .438-.428v0c0-.237-.124-.45-.267-.64A1.098 1.098 0 0 1 6 11.25c0-.69.672-1.25 1.5-1.25.829 0 1.5.56 1.5 1.25 0 .246-.085.475-.232.669-.144.188-.268.402-.268.639v0c0 .222.185.4.407.386a32.068 32.068 0 0 0 3.618-.42c.18-1.031.31-2.08.388-3.144a.355.355 0 0 0-.355-.38v0c-.237 0-.45.124-.64.268a1.098 1.098 0 0 1-.668.232C10.56 9.5 10 8.828 10 8s.56-1.5 1.25-1.5c.246 0 .476.085.669.233.188.143.402.267.639.267v0a.437.437 0 0 0 .44-.442c-.017-1.209-.1-2.4-.247-3.573a32.06 32.06 0 0 1-3.844.459.385.385 0 0 1-.407-.386v0Z",
2733
+ stroke: "#0082FF",
2734
+ strokeLinecap: "round",
2735
+ strokeLinejoin: "round"
2736
+ })));
2737
+ };
2738
+ var ForwardRef$u = /*#__PURE__*/React.forwardRef(SvgServices);
2739
+ var Memo$u = /*#__PURE__*/React.memo(ForwardRef$u);
2740
+
2741
+ /**
2742
+ * A functional React component utilized to render the `Services` icon component
2743
+ */
2744
+
2745
+ var Services = function Services(_ref) {
2746
+ var boxSize = _ref.boxSize;
2747
+ return /*#__PURE__*/React__default.createElement(Memo$u, {
2748
+ boxSize: boxSize
2749
+ });
2750
+ };
2751
+
2725
2752
  /**
2726
2753
  * A functional React component utilized to render the `BorderedBox` component
2727
2754
  */
@@ -2925,18 +2952,20 @@ var NavigationMenuItem = function NavigationMenuItem(_ref) {
2925
2952
 
2926
2953
  var NavigationMenu = function NavigationMenu(_ref) {
2927
2954
  var groupedMenuItems = _ref.groupedMenuItems,
2928
- _ref$defaultSelectedM = _ref.defaultSelectedMenuItem,
2929
- defaultSelectedMenuItem = _ref$defaultSelectedM === void 0 ? '' : _ref$defaultSelectedM;
2955
+ selectedMenuItem = _ref.selectedMenuItem;
2930
2956
  var sortedGroupedMenuItems = React.useMemo(function () {
2931
2957
  return groupedMenuItems == null ? void 0 : groupedMenuItems.sort(function (a, b) {
2932
2958
  return a.groupSortValue - b.groupSortValue;
2933
2959
  });
2934
2960
  }, [groupedMenuItems]);
2935
2961
 
2936
- var _useState = React.useState(defaultSelectedMenuItem),
2937
- selectedMenuItem = _useState[0],
2962
+ var _useState = React.useState(''),
2963
+ _selectedMenuItem = _useState[0],
2938
2964
  setSelectedMenuItem = _useState[1];
2939
2965
 
2966
+ React.useEffect(function () {
2967
+ if (selectedMenuItem) setSelectedMenuItem(selectedMenuItem);
2968
+ }, [selectedMenuItem]);
2940
2969
  return /*#__PURE__*/React__default.createElement(react.Box, {
2941
2970
  bg: "#7474800D",
2942
2971
  py: "32px",
@@ -2955,7 +2984,7 @@ var NavigationMenu = function NavigationMenu(_ref) {
2955
2984
  }), menuItemGroup.groupMenuItems.map(function (item, idx) {
2956
2985
  return /*#__PURE__*/React__default.createElement(NavigationMenuItem, Object.assign({}, item, {
2957
2986
  key: idx,
2958
- isSelected: selectedMenuItem === item.label,
2987
+ isSelected: _selectedMenuItem === item.label,
2959
2988
  onClick: function onClick() {
2960
2989
  return setSelectedMenuItem(item.label);
2961
2990
  }
@@ -4479,6 +4508,7 @@ exports.NavigationMenu = NavigationMenu;
4479
4508
  exports.Neutral = Neutral;
4480
4509
  exports.Positive = Positive;
4481
4510
  exports.Search = Search;
4511
+ exports.Services = Services;
4482
4512
  exports.Settings = Settings;
4483
4513
  exports.SpinnerButton = SpinnerButton;
4484
4514
  exports.Table = Table;