@onesy/ui-react
Version:
UI for React
103 lines • 4.04 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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) { _defineProperty(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; }
import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { is } from '@onesy/utils';
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
import TypeElement from '../Type';
import ButtonElement from '../Button';
import { staticClassName } from '../utils';
import { jsx as _jsx } from "react/jsx-runtime";
const useStyle = styleMethod(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_ => {
const $ = _c(10);
const theme = useOnesyTheme();
const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyPaginationItem?.props?.default), props_);
const Button = theme?.elements?.Button || ButtonElement;
const Type = theme?.elements?.Type || TypeElement;
const {
tonal: t0,
color: t1,
version: t2,
elevation: t3,
size: t4,
TypeProps,
className,
children
} = props,
other = _objectWithoutProperties(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 = classNames([staticClassName("PaginationItem", theme) && ["onesy-PaginationItem-root", `onesy-PaginationItem-version-${version}`, `onesy-PaginationItem-size-${size}`], className, classes.root, classes[`size_${size}`]]);
const t8 = is("simple", children) ? /*#__PURE__*/_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__*/_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';
export default PaginationItem;