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