@hexure/ui 1.13.15 → 1.13.17

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/esm/index.js CHANGED
@@ -736,14 +736,11 @@ const MoreMenu = (_a) => {
736
736
  };
737
737
 
738
738
  const MenuWrapper = styled.div `
739
- position: relative;
739
+ position: relative; // Ensure this is relative
740
740
  display: inline-block;
741
741
  `;
742
742
  const StyledMoreMenu = styled(MoreMenu) `
743
- position: fixed;
744
- top: ${props => props.$top};
745
- left: ${props => props.$left};
746
- position: fixed;
743
+ position: absolute; // Changed from fixed to absolute
747
744
  top: ${props => props.$top};
748
745
  left: ${props => props.$left};
749
746
  width: ${props => props.$menuWidth};
@@ -776,44 +773,44 @@ const ButtonMenu = ({ disabled, label, maxHeight, menuItems, small, position = '
776
773
  if (showMenu && menuWrapperRef.current) {
777
774
  const wrapperRect = menuWrapperRef.current.getBoundingClientRect();
778
775
  const menuWidthInt = parseInt(menuWidth, 10);
779
- let top = wrapperRect.top;
780
- let left = wrapperRect.left;
776
+ let top = 0;
777
+ let left = 0;
781
778
  switch (position) {
782
779
  case 'top':
783
- top = wrapperRect.top - 142; // Menu above the wrapper
784
- left = wrapperRect.left;
780
+ top = -142; // Menu above the wrapper
781
+ left = 0;
785
782
  break;
786
783
  case 'bottom':
787
- top = wrapperRect.bottom; // Menu below the wrapper
788
- left = wrapperRect.left;
784
+ top = wrapperRect.height; // Menu below the wrapper
785
+ left = 0;
789
786
  break;
790
787
  case 'left':
791
- top = wrapperRect.top;
792
- left = wrapperRect.left - menuWidthInt; // Menu to the left of the wrapper
788
+ top = 0;
789
+ left = -menuWidthInt; // Menu to the left of the wrapper
793
790
  break;
794
791
  case 'right':
795
- top = wrapperRect.top;
796
- left = wrapperRect.right; // Menu to the right of the wrapper
792
+ top = 0;
793
+ left = wrapperRect.width; // Menu to the right of the wrapper
797
794
  break;
798
795
  case 'bottomLeft':
799
- top = wrapperRect.bottom;
800
- left = wrapperRect.right - menuWidthInt;
796
+ top = wrapperRect.height;
797
+ left = wrapperRect.width - menuWidthInt;
801
798
  break;
802
799
  case 'bottomRight':
803
- top = wrapperRect.bottom;
804
- left = wrapperRect.left;
800
+ top = wrapperRect.height;
801
+ left = 0;
805
802
  break;
806
803
  case 'topRight':
807
- top = wrapperRect.top - 142;
808
- left = wrapperRect.right - 24;
804
+ top = -142;
805
+ left = wrapperRect.width - 24;
809
806
  break;
810
807
  case 'topLeft':
811
- top = wrapperRect.top - 142;
812
- left = wrapperRect.left - 188;
808
+ top = -142;
809
+ left = -188;
813
810
  break;
814
811
  default:
815
- top = wrapperRect.bottom;
816
- left = wrapperRect.left;
812
+ top = wrapperRect.height;
813
+ left = 0;
817
814
  break;
818
815
  }
819
816
  setMenuPosition({ top: `${top}px`, left: `${left}px` });
@@ -1072,38 +1069,36 @@ const SearchInput$1 = styled.input `
1072
1069
  white-space: nowrap;
1073
1070
  `;
1074
1071
  const Select = (_a) => {
1075
- var { options, optionGroups, placeholder, readOnly, invalid, searchable = false, value, onChange, style } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style"]);
1072
+ var { options, optionGroups, placeholder = '--Select-One--', readOnly, invalid, searchable = false, value: propValue, onChange, style } = _a, accessibleProps = __rest(_a, ["options", "optionGroups", "placeholder", "readOnly", "invalid", "searchable", "value", "onChange", "style"]);
1076
1073
  const [searchTerm, setSearchTerm] = useState('');
1074
+ const [value, setValue] = useState(propValue || '');
1075
+ // Update the value when the prop changes
1076
+ useEffect(() => {
1077
+ setValue(propValue || '');
1078
+ }, [propValue]);
1077
1079
  const handleSearch = (event) => {
1078
1080
  setSearchTerm(event.target.value);
1079
1081
  };
1080
- const filteredOptions = options === null || options === void 0 ? void 0 : options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); });
1081
- const filteredOptionGroups = optionGroups === null || optionGroups === void 0 ? void 0 : optionGroups.map(group => (Object.assign(Object.assign({}, group), { options: group.options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); }) })));
1082
+ const handleChange = (event) => {
1083
+ setValue(event.target.value);
1084
+ if (onChange) {
1085
+ onChange(event);
1086
+ }
1087
+ };
1088
+ const filteredOptions = searchable
1089
+ ? options === null || options === void 0 ? void 0 : options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); })
1090
+ : options;
1091
+ const filteredOptionGroups = searchable
1092
+ ? optionGroups === null || optionGroups === void 0 ? void 0 : optionGroups.map(group => (Object.assign(Object.assign({}, group), { options: group.options.filter(option => { var _a; return (_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm.toLowerCase()); }) })))
1093
+ : optionGroups;
1082
1094
  return (React.createElement(Wrapper$a, { "$invalid": invalid, "$readOnly": readOnly, "$style": style },
1083
- searchable && (React.createElement(SearchInput$1, Object.assign({ onChange: handleSearch, placeholder: '--Select-One-', type: 'text', value: searchTerm }, accessibleProps))),
1084
- searchable ? (React.createElement(Trigger$1, Object.assign({ disabled: readOnly, onChange: onChange, placeholder: placeholder, value: value }, accessibleProps),
1085
- placeholder ? (React.createElement("option", { disabled: true, value: '' }, placeholder)) : null,
1095
+ searchable && (React.createElement(SearchInput$1, Object.assign({ onChange: handleSearch, placeholder: placeholder, type: 'text', value: searchTerm }, accessibleProps))),
1096
+ React.createElement(Trigger$1, Object.assign({ disabled: readOnly, onChange: handleChange, placeholder: placeholder, value: value }, accessibleProps),
1097
+ placeholder && !value && (React.createElement("option", { disabled: true, value: '' }, placeholder)),
1086
1098
  filteredOptionGroups &&
1087
- filteredOptionGroups.map((group, i) => {
1088
- return (React.createElement("optgroup", { key: i, label: group.label || `Group ${i}` }, group.options.map((option, i) => {
1089
- return (option.label && (React.createElement("option", { key: i, style: { color: option.color }, value: option.value }, option.label || option.value)));
1090
- })));
1091
- }),
1099
+ filteredOptionGroups.map((group, i) => (React.createElement("optgroup", { key: i, label: group.label || `Group ${i}` }, group.options.map((option, i) => (React.createElement("option", { key: i, style: { color: option.color }, value: option.value }, option.label || option.value)))))),
1092
1100
  filteredOptions &&
1093
- filteredOptions.map((option, i) => {
1094
- return (option.label && (React.createElement("option", { key: i, style: { color: option.color }, value: option.value }, option.label || option.value)));
1095
- }))) : (React.createElement(Trigger$1, Object.assign({ disabled: readOnly, onChange: onChange, placeholder: placeholder, value: value }, accessibleProps),
1096
- placeholder ? (React.createElement("option", { disabled: true, value: '' }, placeholder)) : null,
1097
- optionGroups &&
1098
- optionGroups.map((group, i) => {
1099
- return (React.createElement("optgroup", { key: i, label: group.label || `Group ${i}` }, group.options.map((option, i) => {
1100
- return (React.createElement("option", { key: i, value: option.value }, option.label || option.value));
1101
- })));
1102
- }),
1103
- options &&
1104
- options.map((option, i) => {
1105
- return (React.createElement("option", { key: i, value: option.value }, option.label || option.value));
1106
- }))),
1101
+ filteredOptions.map((option, i) => (React.createElement("option", { key: i, style: { color: option.color }, value: option.value }, option.label || option.value)))),
1107
1102
  React.createElement(IconWrapper$2, { color: Colors.BLACK.Hex, path: mdiChevronDown, size: '22px' })));
1108
1103
  };
1109
1104
 
@@ -1738,7 +1733,7 @@ const SuggestedValues = styled.div `
1738
1733
  position: absolute;
1739
1734
  right: -1px;
1740
1735
  top: 39px;
1741
- z-index: 10;
1736
+ z-index: 9999;
1742
1737
  max-height: 220px;
1743
1738
  overflow: auto;
1744
1739
  `;
@@ -2075,8 +2070,11 @@ const ButtonBar = styled.div `
2075
2070
  justify-self: flex-end;
2076
2071
  box-sizing: border-box;
2077
2072
  `;
2073
+ const ButtonContainer = styled.div `
2074
+ margin: 0 10px;
2075
+ `;
2078
2076
  const Modal = (_a) => {
2079
- var { children, title, onClose, maxWidth, fullscreen, steps, primaryButton, secondaryButton, tertiaryButton } = _a, accessibleProps = __rest(_a, ["children", "title", "onClose", "maxWidth", "fullscreen", "steps", "primaryButton", "secondaryButton", "tertiaryButton"]);
2077
+ var { children, title, onClose, maxWidth, fullscreen, steps, primaryButton, secondaryButton, tertiaryButton, quarternaryButton } = _a, accessibleProps = __rest(_a, ["children", "title", "onClose", "maxWidth", "fullscreen", "steps", "primaryButton", "secondaryButton", "tertiaryButton", "quarternaryButton"]);
2080
2078
  useEffect(() => {
2081
2079
  document.onkeydown = e => {
2082
2080
  if (e.key === 'Escape') {
@@ -2096,15 +2094,24 @@ const Modal = (_a) => {
2096
2094
  React.createElement(Icon, { color: Colors.BLACK.Hex, path: mdiClose, size: '24px' }))),
2097
2095
  steps ? React.createElement(ProgressBar, { steps: steps }) : null,
2098
2096
  React.createElement(ContentWrapper, null, children),
2099
- primaryButton || secondaryButton || tertiaryButton ? (React.createElement(ButtonBar, null,
2100
- tertiaryButton ? React.createElement(Button, Object.assign({}, tertiaryButton, { format: 'secondary' })) : null,
2097
+ primaryButton || secondaryButton || tertiaryButton || quarternaryButton ? (React.createElement(ButtonBar, null,
2098
+ tertiaryButton || quarternaryButton ? (React.createElement("div", { style: {
2099
+ marginRight: 'auto',
2100
+ paddingRight: 40,
2101
+ display: 'flex',
2102
+ alignItems: 'center',
2103
+ } },
2104
+ tertiaryButton ? (React.createElement(Button, Object.assign({}, tertiaryButton, { format: tertiaryButton.format || 'secondary' }))) : null,
2105
+ quarternaryButton ? (React.createElement(ButtonContainer, null,
2106
+ React.createElement(Button, Object.assign({}, quarternaryButton, { format: quarternaryButton.format || 'secondary' })))) : null)) : null,
2101
2107
  primaryButton || secondaryButton ? (React.createElement("div", { style: {
2102
2108
  marginLeft: 'auto',
2103
2109
  paddingLeft: 40,
2104
2110
  display: 'flex',
2105
2111
  alignItems: 'center',
2106
2112
  } },
2107
- secondaryButton ? (React.createElement(Button, Object.assign({}, secondaryButton, { format: secondaryButton.format || 'secondary' }))) : null,
2113
+ secondaryButton ? (React.createElement(ButtonContainer, null,
2114
+ React.createElement(Button, Object.assign({}, secondaryButton, { format: secondaryButton.format || 'secondary' })))) : null,
2108
2115
  primaryButton ? (React.createElement(Button, Object.assign({}, primaryButton, { format: primaryButton.format || 'primary' }))) : null)) : null)) : null)));
2109
2116
  };
2110
2117