/* @oracle/oraclejet-preact: undefined */
'use strict';

var jsxRuntime = require('preact/jsx-runtime');
var compat = require('preact/compat');
var dimensions = require('./dimensions-b4be9793.js');
var padding = require('./padding-c5a8f4f5.js');
var colors = require('./colors-846e841c.js');
var aria = require('./aria-889aedd0.js');
var mergeInterpolations = require('./mergeInterpolations-6727b536.js');
var PRIVATE_StyledCard_themes_StyledCardStyles_css = require('./PRIVATE_StyledCard/themes/StyledCardStyles.css.js');
var classNames = require('./classNames-c14c6ef3.js');
var useTestId = require('./useTestId-32c35bff.js');
var _curry2 = require('./_curry2-c15d89cd.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._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(dimensions.dimensionInterpolations),
    ...Object.values(colors.colorInterpolations),
    ...Object.values(padding.paddingInterpolations),
    ...Object.values(aria.ariaInterpolations)
];
const mergedInterpolations = mergeInterpolations.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 = compat.forwardRef(({ ['aria-describedby']: ariaDescribedBy, children, cursor, display = 'inlineBlock', isActive, isDisabled, isFocusWithin, isHover, isSelected, parentComponentVariant = 'default', role, styleVariant, tabIndex, testId, ...rest }, ref) => {
    const testIdProps = useTestId.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 = PRIVATE_StyledCard_themes_StyledCardStyles_css.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.classNames([variantClasses, mergedClasses]);
    return (jsxRuntime.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 }));
});

exports.StyledCard = StyledCard;
//# sourceMappingURL=StyledCard-67d90e2e.js.map
