@bodynarf/react.components 1.4.27 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,7 @@ export default function Paginator({ count, onPageChange, currentPage, position,
|
|
|
22
22
|
const pageNumbers = useMemo(() => generatePageNumbers(page, count, nearPagesCount), [page, count]);
|
|
23
23
|
const canGoBack = useMemo(() => page > 1, [page]);
|
|
24
24
|
const canGoForward = useMemo(() => page < count, [page, count]);
|
|
25
|
-
if (pageNumbers.length
|
|
25
|
+
if (pageNumbers.length <= 1) {
|
|
26
26
|
return _jsx(_Fragment, {});
|
|
27
27
|
}
|
|
28
28
|
const classNames = getClassName([
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { InputColor, InputSize } from "../primitives";
|
|
2
|
+
import { BaseElementProps } from "../types";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
/** Tag item prop types */
|
|
5
|
+
interface TagProps extends BaseElementProps {
|
|
6
|
+
/** Tag contnet*/
|
|
7
|
+
content: string;
|
|
8
|
+
/**
|
|
9
|
+
* Element size.
|
|
10
|
+
* `Small` isn't allowed
|
|
11
|
+
*/
|
|
12
|
+
size?: InputSize;
|
|
13
|
+
/** Element color */
|
|
14
|
+
style?: InputColor;
|
|
15
|
+
/** Is element with rounded border */
|
|
16
|
+
rounded?: boolean;
|
|
17
|
+
/** Is element has light color */
|
|
18
|
+
lightColor?: boolean;
|
|
19
|
+
/** Click handler */
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
/** Manual color scheme */
|
|
22
|
+
customColor?: {
|
|
23
|
+
/** Text color */
|
|
24
|
+
color: string;
|
|
25
|
+
/** Background color */
|
|
26
|
+
backgroundColor: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Single tag item */
|
|
30
|
+
declare const Tag: ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }: TagProps) => JSX.Element;
|
|
31
|
+
export default Tag;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tag/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,cAAc,CAAC;AAEtB,0BAA0B;AAC1B,UAAU,QAAS,SAAQ,gBAAgB;IACvC,iBAAiB;IACjB,OAAO,EAAE,MAAM,CAAC;IAEhB;;;MAGE;IACF,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,oBAAoB;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,0BAA0B;IAC1B,WAAW,CAAC,EAAE;QACV,iBAAiB;QACjB,KAAK,EAAE,MAAM,CAAC;QAEd,uBAAuB;QACvB,eAAe,EAAE,MAAM,CAAC;KAC3B,CAAC;CACL;AAED,sBAAsB;AACtB,QAAA,MAAM,GAAG,2FAMN,QAAQ,KAAG,WAmCb,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import { InputColor, InputSize } from "../primitives";
|
|
4
|
+
import "./style.scss";
|
|
5
|
+
/** Single tag item */
|
|
6
|
+
const Tag = ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }) => {
|
|
7
|
+
size ??= InputSize.Normal;
|
|
8
|
+
style ??= InputColor.Default;
|
|
9
|
+
if (!isNullOrUndefined(customColor)) {
|
|
10
|
+
style = InputColor.Default;
|
|
11
|
+
}
|
|
12
|
+
const elClassName = getClassName([
|
|
13
|
+
"bbr-tag",
|
|
14
|
+
"tag",
|
|
15
|
+
style === InputColor.Default ? "" : `is-${style}`,
|
|
16
|
+
!isNullOrUndefined(customColor) ? "bbr-tag--custom" : "",
|
|
17
|
+
lightColor === true && isNullOrUndefined(customColor) ? "is-light" : "",
|
|
18
|
+
rounded === true ? "is-rounded" : "",
|
|
19
|
+
size === InputSize.Normal || size === InputSize.Small ? "" : `is-${size}`,
|
|
20
|
+
isNullOrUndefined(onClick) ? "" : "bbr-tag--clickable",
|
|
21
|
+
className,
|
|
22
|
+
]);
|
|
23
|
+
return (_jsx("span", { className: elClassName, onClick: onClick, title: title, color: customColor?.color, style: {
|
|
24
|
+
color: customColor?.color,
|
|
25
|
+
backgroundColor: customColor?.backgroundColor,
|
|
26
|
+
}, children: content }));
|
|
27
|
+
};
|
|
28
|
+
export default Tag;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.bbr-tag {
|
|
2
|
+
border: 1px solid transparent;
|
|
3
|
+
transition: border-color 0.15s ease-in-out;
|
|
4
|
+
|
|
5
|
+
&--clickable {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
&.is-light {
|
|
9
|
+
&:hover {
|
|
10
|
+
border-color: rgba(0, 0, 0, 0.25);
|
|
11
|
+
}
|
|
12
|
+
&:focus,
|
|
13
|
+
&:active {
|
|
14
|
+
border-color: rgba(0, 0, 0, 0.5);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&:not(.is-light) {
|
|
18
|
+
&:hover {
|
|
19
|
+
border-color: rgba(0, 0, 0, 0.35);
|
|
20
|
+
}
|
|
21
|
+
&:focus,
|
|
22
|
+
&:active {
|
|
23
|
+
border-color: rgba(0, 0, 0, 0.75);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|