UNPKG

@onesy/ui-react

Version:
78 lines (77 loc) 4.3 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _compilerRuntime = require("react/compiler-runtime"); var _react = _interopRequireDefault(require("react")); var _styleReact = require("@onesy/style-react"); var _ListItem = _interopRequireDefault(require("../ListItem")); var _utils = require("../utils"); var _jsxRuntime = require("react/jsx-runtime"); const _excluded = ["position", "backgroundOpacity", "Component", "className", "children"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } const useStyle = (0, _styleReact.style)(theme => ({ root: {}, position_top: { position: 'absolute', top: '0', insetInline: '0', borderRadius: `0 0 ${theme.shape.radius.unit * 3}px ${theme.shape.radius.unit * 3}px` }, position_bottom: { position: 'absolute', bottom: '0', insetInline: '0', borderRadius: `${theme.shape.radius.unit * 3}px ${theme.shape.radius.unit * 3}px 0 0` } }), { name: 'onesy-ImageListItemBox' }); const ImageListItemBox = props_ => { var _theme$ui, _theme$ui2, _theme$elements; const $ = (0, _compilerRuntime.c)(7); const theme = (0, _styleReact.useOnesyTheme)(); const props = _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyImageListItemBox) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_); const ListItem = (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.ListItem) || _ListItem.default; const { position, backgroundOpacity: t0, Component: t1, className, children } = props, other = (0, _objectWithoutProperties2.default)(props, _excluded); const backgroundOpacity = t0 === undefined ? 0.74 : t0; const Component = t1 === undefined ? "div" : t1; const { classes } = useStyle(); const t2 = (0, _styleReact.classNames)([(0, _utils.staticClassName)("ImageListItemBox", theme) && ["onesy-ImageListItemBox-root"], className, classes.root, position && classes[`position_${position}`]]); let t3; if ($[0] !== Component || $[1] !== ListItem || $[2] !== backgroundOpacity || $[3] !== children || $[4] !== other || $[5] !== t2) { t3 = /*#__PURE__*/(0, _jsxRuntime.jsx)(ListItem, _objectSpread(_objectSpread({ backgroundOpacity: backgroundOpacity, Component: Component, className: t2 }, other), {}, { children: children })); $[0] = Component; $[1] = ListItem; $[2] = backgroundOpacity; $[3] = children; $[4] = other; $[5] = t2; $[6] = t3; } else { t3 = $[6]; } return t3; }; ImageListItemBox.displayName = 'onesy-ImageListItemBox'; var _default = exports.default = ImageListItemBox;