/* @oracle/oraclejet-preact: undefined */
import { jsx } from 'preact/jsx-runtime';
import { forwardRef } from 'preact/compat';
import { d as dimensionInterpolations } from './dimensions-d4159ace.js';
import { p as paddingInterpolations } from './padding-28c96aec.js';
import { c as colorInterpolations } from './colors-170180bf.js';
import { a as ariaInterpolations } from './aria-efa0582c.js';
import { m as mergeInterpolations } from './mergeInterpolations-e2db2a66.js';
import { multiVariantStyles } from './PRIVATE_StyledCard/themes/StyledCardStyles.css.js';
import { c as classNames } from './classNames-4e12b00d.js';
import { u as useTestId } from './useTestId-9b504481.js';
import { _ as _curry2 } from './_curry2-34316bcf.js';

/**
 * Returns a partial copy of an object containing only the keys specified. If
 * the key does not exist, the property is ignored.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig [k] -> {k: v} -> {k: v}
 * @param {Array} names an array of String property names to copy onto a new object
 * @param {Object} obj The object to copy from
 * @return {Object} A new object with only properties from `names` on it.
 * @see R.omit, R.props
 * @example
 *
 *      R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
 *      R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}
 */

var pick =
/*#__PURE__*/
_curry2(function pick(names, obj) {
  var result = {};
  var idx = 0;

  while (idx < names.length) {
    if (names[idx] in obj) {
      result[names[idx]] = obj[names[idx]];
    }

    idx += 1;
  }

  return result;
});

var pick$1 = pick;

const eventHandlers = [
    'onBlur',
    'onClick',
    'onContextMenu',
    'onFocus',
    'onKeyDown',
    'onKeyUp',
    'onMouseDown',
    'onMouseEnter',
    'onMouseLeave',
    'onMouseUp',
    'onPointerCancel',
    'onPointerDown',
    'onPointerOut',
    'onPointerUp',
    'onTouchCancel',
    'onTouchEnd',
    'onTouchStart'
];
const interpolations = [
    ...Object.values(dimensionInterpolations),
    ...Object.values(colorInterpolations),
    ...Object.values(paddingInterpolations),
    ...Object.values(ariaInterpolations)
];
const mergedInterpolations = mergeInterpolations(interpolations);
/**
 * A StyledCard is a simple container that renders a group of related information in a styled rectangular area.
 * Width, height, padding, and background color are set through props.
 * This component is used by Card, SelectionCard, ActionCard, and RichSelectionItem.
 */
const StyledCard = forwardRef(({ ['aria-describedby']: ariaDescribedBy, children, cursor, display = 'inlineBlock', isActive, isDisabled, isFocusWithin, isHover, isSelected, parentComponentVariant = 'default', role, styleVariant, tabIndex, testId, ...rest }, ref) => {
    const testIdProps = useTestId(testId);
    // we want to pick all the event handlers only to spread over the div element
    const eventHandlersProps = pick$1(eventHandlers, rest);
    const { class: mergedClasses, ariaLabel, ariaLabelledBy, ...mergedStyles } = mergedInterpolations(rest);
    const variantClasses = multiVariantStyles({
        active: isActive ? 'isActive' : undefined,
        cursor,
        display,
        disabled: isDisabled ? 'isDisabled' : undefined,
        focusRing: tabIndex !== undefined && tabIndex >= 0 ? 'hasFocusRing' : undefined,
        focusWithin: isFocusWithin ? 'hasFocusWithin' : undefined,
        hover: isHover ? 'isHover' : 'notHover',
        parentComponentVariant,
        selected: isSelected ? 'isSelected' : 'notSelected',
        styleVariant
    });
    const classes = classNames([variantClasses, mergedClasses]);
    return (jsx("div", { ...eventHandlersProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className: classes, tabIndex: tabIndex, ref: ref, role: role, style: mergedStyles, ...testIdProps, children: children }));
});

export { StyledCard as S };
//# sourceMappingURL=StyledCard-362bd74b.js.map
