@onesy/ui-react
Version:
UI for React
111 lines (110 loc) • 5.39 kB
JavaScript
"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 _utils = require("@onesy/utils");
var _styleReact = require("@onesy/style-react");
var _Type = _interopRequireDefault(require("../Type"));
var _Button = _interopRequireDefault(require("../Button"));
var _utils2 = require("../utils");
var _jsxRuntime = require("react/jsx-runtime");
const _excluded = ["tonal", "color", "version", "elevation", "size", "TypeProps", "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: {},
size_small: {
'&.onesy-Button-root': {
width: 'unset',
minWidth: '30px',
paddingInline: theme.methods.space.value(0.5, 'px')
}
},
size_regular: {
'&.onesy-Button-root': {
width: 'unset',
minWidth: '40px',
paddingInline: theme.methods.space.value(1, 'px')
}
},
size_large: {
'&.onesy-Button-root': {
width: 'unset',
minWidth: '50px',
paddingInline: theme.methods.space.value(1.25, 'px')
}
}
}), {
name: 'onesy-PaginationItem'
});
const PaginationItem = props_ => {
var _theme$ui, _theme$ui2, _theme$elements, _theme$elements2;
const $ = (0, _compilerRuntime.c)(10);
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.onesyPaginationItem) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
const Button = (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Button) || _Button.default;
const Type = (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Type) || _Type.default;
const {
tonal: t0,
color: t1,
version: t2,
elevation: t3,
size: t4,
TypeProps,
className,
children
} = props,
other = (0, _objectWithoutProperties2.default)(props, _excluded);
const tonal = t0 === undefined ? false : t0;
const color = t1 === undefined ? "default" : t1;
const version = t2 === undefined ? "text" : t2;
const elevation = t3 === undefined ? false : t3;
const size = t4 === undefined ? "regular" : t4;
const {
classes
} = useStyle();
const t5 = true;
const t6 = true;
const t7 = (0, _styleReact.classNames)([(0, _utils2.staticClassName)("PaginationItem", theme) && ["onesy-PaginationItem-root", `onesy-PaginationItem-version-${version}`, `onesy-PaginationItem-size-${size}`], className, classes.root, classes[`size_${size}`]]);
const t8 = (0, _utils.is)("simple", children) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Type, _objectSpread(_objectSpread({
version: size === "large" ? "b1" : size === "regular" ? "b2" : "b3"
}, TypeProps), {}, {
children: children
})) : children;
let t9;
if ($[0] !== Button || $[1] !== color || $[2] !== elevation || $[3] !== other || $[4] !== size || $[5] !== t7 || $[6] !== t8 || $[7] !== tonal || $[8] !== version) {
t9 = /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, _objectSpread(_objectSpread({
tonal: tonal,
color: color,
version: version,
elevation: elevation,
size: size,
icon: t5,
noFontSize: t6,
className: t7
}, other), {}, {
children: t8
}));
$[0] = Button;
$[1] = color;
$[2] = elevation;
$[3] = other;
$[4] = size;
$[5] = t7;
$[6] = t8;
$[7] = tonal;
$[8] = version;
$[9] = t9;
} else {
t9 = $[9];
}
return t9;
};
PaginationItem.displayName = 'onesy-PaginationItem';
var _default = exports.default = PaginationItem;