@indico-data/design-system 2.21.0 → 2.21.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.
package/lib/index.js CHANGED
@@ -3186,7 +3186,7 @@ var classnames = {exports: {}};
3186
3186
  var classnamesExports = classnames.exports;
3187
3187
  var y$1 = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
3188
3188
 
3189
- const Button$2 = (props) => {
3189
+ const Button$2 = e.forwardRef((props, ref) => {
3190
3190
  const { ariaLabel, children, isLoading, isDisabled, variant = 'solid', color = 'primary', iconPosition = 'left', iconName, onClick, type = 'button', size = 'md', onMouseEnter, onMouseExit, onKeyDown, className, href } = props, rest = __rest$1(props, ["ariaLabel", "children", "isLoading", "isDisabled", "variant", "color", "iconPosition", "iconName", "onClick", "type", "size", "onMouseEnter", "onMouseExit", "onKeyDown", "className", "href"]);
3191
3191
  const buttonClasses = y$1('btn', {
3192
3192
  [`btn--${color}`]: color,
@@ -3195,12 +3195,12 @@ const Button$2 = (props) => {
3195
3195
  'btn--loading': isLoading,
3196
3196
  }, className);
3197
3197
  const handleOnClick = (event) => {
3198
- if (!isLoading && props.onClick) {
3199
- props.onClick(event);
3198
+ if (!isLoading && onClick) {
3199
+ onClick(event);
3200
3200
  }
3201
3201
  };
3202
- return (jsxRuntime.jsxs("button", Object.assign({ disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseExit, onKeyDown: onKeyDown }, rest, { children: [isLoading && (jsxRuntime.jsx(Icon, { name: "fa-circle-notch", style: { animation: 'spin 1s linear infinite' }, className: "mr-2", ariaLabel: "Loading..." })), !children && iconName && jsxRuntime.jsx(Icon, { name: iconName, ariaLabel: `${iconName} Icon` }), children && iconPosition === 'left' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, children && iconPosition === 'right' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3203
- };
3202
+ return (jsxRuntime.jsxs("button", Object.assign({ ref: ref, disabled: isLoading || isDisabled, className: buttonClasses, role: "button", onClick: handleOnClick, "aria-label": ariaLabel || 'button', "aria-disabled": isLoading || isDisabled, "aria-busy": isLoading, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseExit, onKeyDown: onKeyDown }, rest, { children: [isLoading && (jsxRuntime.jsx(Icon, { name: "fa-circle-notch", style: { animation: 'spin 1s linear infinite' }, className: "mr-2", ariaLabel: "Loading..." })), !children && iconName && jsxRuntime.jsx(Icon, { name: iconName, ariaLabel: `${iconName} Icon` }), children && iconPosition === 'left' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "mr-2", ariaLabel: `${iconName} Icon` })), children, children && iconPosition === 'right' && iconName && (jsxRuntime.jsx(Icon, { name: iconName, className: "ml-2", ariaLabel: `${iconName} Icon` }))] })));
3203
+ });
3204
3204
 
3205
3205
  function ownKeys$2(object, enumerableOnly) {
3206
3206
  var keys = Object.keys(object);
@@ -40935,7 +40935,11 @@ function ModalBase(props) {
40935
40935
  ariaProps['describedby'] = describedBy;
40936
40936
  }
40937
40937
  // Try to render modal within the theme-root, otherwise attach to the root
40938
- const parentSelector = () => document.getElementById('theme-root') || document.getElementById('root');
40938
+ const parentSelector = () => {
40939
+ const themeRoot = document.getElementById('theme-root');
40940
+ const root = document.getElementById('root');
40941
+ return themeRoot || root || document.body;
40942
+ };
40939
40943
  return (jsxRuntime.jsx(StyledModalBase, { ariaHideApp: false, "data-cy": props['data-cy'], aria: ariaProps, className: className || 'baseModal', contentLabel: 'labelText' in props ? props.labelText : null, id: id, isOpen: open, node: node, onRequestClose: clickToDismiss, parentSelector: parentSelector, shouldCloseOnEsc: !preventEscDismiss, shouldReturnFocusAfterClose: !preventReturnFocus, maxWidth: maxWidth, children: children }));
40940
40944
  }
40941
40945